@poe-platform/safe-bash 0.1.754 → 0.1.756
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/image-ast/index.browser.js +39 -3
- package/dist/image-ast/index.js +39 -3
- package/dist/pdf-ast/canvas.d.ts +1 -0
- package/dist/pdf-ast/fonts/truetype.d.ts +1 -0
- package/dist/pdf-ast/index.js +39 -3
- package/dist/safe-bash/chunks/{chunk-3W6CRM25.js → chunk-CBVANNKK.js} +553 -289
- package/dist/safe-bash/chunks/{chunk-R2WG64VB.js → chunk-JCN3FXLP.js} +40 -4
- package/dist/safe-bash/chunks/{chunk-WNB4XH45.js → chunk-OSUXMC43.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-37Y7GZTK.js → chunk-RSAWYAEH.js} +2 -2
- package/dist/safe-bash/chunks/{pdf-renderer-DHQDZC6N.js → pdf-renderer-CMF3CSVU.js} +3 -3
- package/dist/safe-bash/chunks/{src-S52LORVD.js → src-MXIKQCIC.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-IJHV6I6X.js → chunk-3DOHQQJR.js} +8 -6
- package/dist/safe-bash/command-chunks/{chunk-PUOJAS3O.js → chunk-H2FQA4OU.js} +39 -3
- package/dist/safe-bash/command-chunks/chunk-IDR3WWKI.js +46 -0
- package/dist/safe-bash/command-chunks/{chunk-XAZ3NTJ4.js → chunk-KBBI4CSU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YY7HJMBG.js → chunk-KOM3FNCE.js} +1 -37
- package/dist/safe-bash/command-chunks/chunk-QQOAK7JQ.js +888 -0
- package/dist/safe-bash/command-chunks/{chunk-BE4AM2JW.js → chunk-UGX6MXDD.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-CM4SVTIA.js → chunk-WI35236J.js} +1 -1
- package/dist/safe-bash/commands/ssconvert/index.d.ts +1 -2
- package/dist/safe-bash/commands/ssconvert/index.js +6 -260
- package/dist/safe-bash/core.browser.js +5 -207
- package/dist/safe-bash-command-csvkit/index.js +277 -49
- package/dist/safe-bash-command-ffmpeg/index.js +1741 -1717
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +39 -3
- package/dist/safe-bash-command-pdfinfo/index.js +39 -3
- package/dist/safe-bash-command-pdftk/index.js +39 -3
- package/dist/safe-bash-command-pdftoppm/index.js +39 -3
- package/dist/safe-bash-command-pdftotext/index.js +39 -3
- package/dist/safe-bash-command-qpdf/index.js +39 -3
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +5 -4
- package/dist/safe-bash-command-ssconvert/formats/csv.js +4 -3
- package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +4 -2
- package/dist/safe-bash-command-ssconvert/formats/xls.js +10 -666
- package/dist/safe-bash-command-ssconvert/index.d.ts +1 -0
- package/dist/safe-bash-command-ssconvert/index.js +706 -392
- package/dist/safe-bash-command-ssconvert/sync.d.ts +7 -0
- package/dist/safe-bash-command-timeout/index.js +1 -1
- package/dist/safe-bash-command-wkhtmltopdf/index.js +39 -3
- package/dist/spreadsheet-format-csv/text-export.d.ts +14 -0
- package/dist/spreadsheet-format-csv/text-export.js +2 -2
- package/dist/spreadsheet-format-xls/biff-binary.d.ts +7 -2
- package/dist/spreadsheet-format-xls/biff-binary.js +10 -1
- package/dist/spreadsheet-format-xls/biff-strings.d.ts +2 -3
- package/dist/spreadsheet-format-xls/biff-strings.js +14 -2
- package/package.json +2 -3
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +8 -1
- package/dist/safe-bash/command-chunks/chunk-MPUNHXWI.js +0 -205
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
PdfDocument,
|
|
7
7
|
renderPdfPageToPng
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JCN3FXLP.js";
|
|
9
9
|
import {
|
|
10
10
|
CodecError,
|
|
11
11
|
createCompressionCodec,
|
|
@@ -25038,9 +25038,9 @@ function parseExpression(source, options) {
|
|
|
25038
25038
|
options.signal?.throwIfAborted();
|
|
25039
25039
|
options.onWork?.();
|
|
25040
25040
|
if (++nodes > (options.maximumNodes ?? Infinity)) throw new SsconvertError("resource-limit", "ssconvert formula node limit exceeded");
|
|
25041
|
-
const
|
|
25041
|
+
const children8 = value3.kind === "binary" ? [value3.left, value3.right] : value3.kind === "unary" || value3.kind === "parentheses" ? [value3.child] : value3.kind === "call" ? value3.args : value3.kind === "array" ? value3.rows.flat() : [];
|
|
25042
25042
|
let height = 1;
|
|
25043
|
-
for (const child7 of
|
|
25043
|
+
for (const child7 of children8) height = Math.max(height, 1 + (heights.get(child7) ?? 1));
|
|
25044
25044
|
if (height > (options.maximumDepth ?? Infinity)) throw new SsconvertError("resource-limit", "ssconvert formula depth limit exceeded");
|
|
25045
25045
|
heights.set(value3, height);
|
|
25046
25046
|
return value3;
|
|
@@ -25679,7 +25679,7 @@ init_platform();
|
|
|
25679
25679
|
|
|
25680
25680
|
// packages/spreadsheet-engine/src/formulas/named-expressions.ts
|
|
25681
25681
|
init_platform();
|
|
25682
|
-
function parseNamedExpression(name5, book,
|
|
25682
|
+
function parseNamedExpression(name5, book, parse4, tick, maximumDepth = Infinity) {
|
|
25683
25683
|
if (name5.expression === "" || name5.expression === "=") {
|
|
25684
25684
|
tick();
|
|
25685
25685
|
return { kind: "literal", value: { kind: "blank" }, start: 0, end: 0 };
|
|
@@ -25701,7 +25701,7 @@ function parseNamedExpression(name5, book, parse3, tick, maximumDepth = Infinity
|
|
|
25701
25701
|
if (node3.kind === "array") return { ...node3, rows: node3.rows.map((row) => row.map((child7) => bind2(child7, depth + 1))) };
|
|
25702
25702
|
return node3;
|
|
25703
25703
|
}
|
|
25704
|
-
return bind2(
|
|
25704
|
+
return bind2(parse4(name5.expression, position, name5.arrayStringLiterals));
|
|
25705
25705
|
}
|
|
25706
25706
|
|
|
25707
25707
|
// packages/spreadsheet-engine/src/formulas/values.ts
|
|
@@ -25974,7 +25974,7 @@ function binary(op, left, right, admission) {
|
|
|
25974
25974
|
}
|
|
25975
25975
|
|
|
25976
25976
|
// packages/spreadsheet-engine/src/formulas/dependencies.ts
|
|
25977
|
-
function buildDependencyGraph(book, roots, resolve,
|
|
25977
|
+
function buildDependencyGraph(book, roots, resolve, parse4, tick, onRange, maximumDepth = Infinity) {
|
|
25978
25978
|
const precedents = /* @__PURE__ */ new Map(), dependents = /* @__PURE__ */ new Map(), volatile = /* @__PURE__ */ new Set();
|
|
25979
25979
|
const link = (cell, precedent) => {
|
|
25980
25980
|
tick();
|
|
@@ -25984,12 +25984,12 @@ function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maxim
|
|
|
25984
25984
|
precedents.set(cell, parents);
|
|
25985
25985
|
}
|
|
25986
25986
|
parents.add(precedent);
|
|
25987
|
-
let
|
|
25988
|
-
if (!
|
|
25989
|
-
|
|
25990
|
-
dependents.set(precedent,
|
|
25987
|
+
let children8 = dependents.get(precedent);
|
|
25988
|
+
if (!children8) {
|
|
25989
|
+
children8 = /* @__PURE__ */ new Set();
|
|
25990
|
+
dependents.set(precedent, children8);
|
|
25991
25991
|
}
|
|
25992
|
-
|
|
25992
|
+
children8.add(cell);
|
|
25993
25993
|
};
|
|
25994
25994
|
const range5 = (cell, value3) => {
|
|
25995
25995
|
tick();
|
|
@@ -26040,7 +26040,7 @@ function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maxim
|
|
|
26040
26040
|
if (node3.kind === "name") {
|
|
26041
26041
|
const name5 = named(node3, position);
|
|
26042
26042
|
if (!name5 || names2.has(name5)) return [];
|
|
26043
|
-
return staticRanges(parseNamedExpression(name5, book,
|
|
26043
|
+
return staticRanges(parseNamedExpression(name5, book, parse4, tick, maximumDepth), position, /* @__PURE__ */ new Set([...names2, name5]), depth + 1);
|
|
26044
26044
|
}
|
|
26045
26045
|
if (node3.kind === "call" && (node3.name === "IF" || node3.name === "CHOOSE")) {
|
|
26046
26046
|
const ranges3 = [];
|
|
@@ -26132,11 +26132,11 @@ function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maxim
|
|
|
26132
26132
|
if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "")) {
|
|
26133
26133
|
const name5 = named(node3, position2);
|
|
26134
26134
|
if (name5 && !names3.has(name5)) {
|
|
26135
|
-
pending.push({ node: parseNamedExpression(name5, book,
|
|
26135
|
+
pending.push({ node: parseNamedExpression(name5, book, parse4, tick, maximumDepth), position: position2, names: /* @__PURE__ */ new Set([...names3, name5]), depth: depth + 1 });
|
|
26136
26136
|
}
|
|
26137
26137
|
}
|
|
26138
|
-
const
|
|
26139
|
-
for (let index2 =
|
|
26138
|
+
const children8 = node3.kind === "unary" || node3.kind === "parentheses" ? [node3.child] : node3.kind === "binary" ? [node3.left, node3.right] : node3.kind === "call" ? node3.args : node3.kind === "array" ? node3.rows.flat() : [];
|
|
26139
|
+
for (let index2 = children8.length - 1; index2 >= 0; index2--) pending.push({ node: children8[index2], position: position2, names: names3, depth: depth + 1 });
|
|
26140
26140
|
}
|
|
26141
26141
|
}
|
|
26142
26142
|
for (const sheet of book.sheets) for (const cell of sheet.cells) {
|
|
@@ -26747,8 +26747,8 @@ function resizeRetainedRecords(sheet, old, size, context2) {
|
|
|
26747
26747
|
if (![r0, r1, c0, c1].every(Number.isSafeInteger)) throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: resize style bounds");
|
|
26748
26748
|
return [{ node: node3, r0, r1, c0, c1 }];
|
|
26749
26749
|
});
|
|
26750
|
-
const
|
|
26751
|
-
return [{ ...record7, data: { ...data4, children:
|
|
26750
|
+
const children8 = rectangles2.filter((r) => r.r0 < size.rows && r.c0 < size.columns).map((r) => attributes(r.node, { endRow: String(Math.min(r.r1, size.rows - 1)), endCol: String(Math.min(r.c1, size.columns - 1)) }));
|
|
26751
|
+
return [{ ...record7, data: { ...data4, children: children8 } }];
|
|
26752
26752
|
});
|
|
26753
26753
|
if (size.rows <= old.rows && size.columns <= old.columns) return retained2;
|
|
26754
26754
|
const rectangles = [];
|
|
@@ -27031,13 +27031,13 @@ var odfNamespaces = {
|
|
|
27031
27031
|
function odfObject(value3) {
|
|
27032
27032
|
return value3 !== null && typeof value3 === "object" && !Array.isArray(value3) ? value3 : void 0;
|
|
27033
27033
|
}
|
|
27034
|
-
function odfAttributes(value3,
|
|
27034
|
+
function odfAttributes(value3, namespace6) {
|
|
27035
27035
|
const source = odfObject(value3)?.attributes;
|
|
27036
27036
|
if (Array.isArray(source)) return Object.fromEntries(source.flatMap((a3) => {
|
|
27037
27037
|
const v2 = odfObject(a3);
|
|
27038
|
-
return typeof v2?.name === "string" && typeof v2.value === "string" && (
|
|
27038
|
+
return typeof v2?.name === "string" && typeof v2.value === "string" && (namespace6 === void 0 || v2.namespace === namespace6) ? [[v2.name, v2.value]] : [];
|
|
27039
27039
|
}));
|
|
27040
|
-
if (
|
|
27040
|
+
if (namespace6 !== void 0) return {};
|
|
27041
27041
|
return Object.fromEntries(Object.entries(odfObject(source) ?? {}).filter((entry2) => typeof entry2[1] === "string"));
|
|
27042
27042
|
}
|
|
27043
27043
|
function odfChildren(value3) {
|
|
@@ -27047,7 +27047,7 @@ function odfChildren(value3) {
|
|
|
27047
27047
|
function upgradeOdfAnnotation(node3, charge) {
|
|
27048
27048
|
const original = odfChildren(node3);
|
|
27049
27049
|
charge(original.length);
|
|
27050
|
-
const attributes4 = [],
|
|
27050
|
+
const attributes4 = [], children8 = [...original];
|
|
27051
27051
|
for (const value3 of Array.isArray(node3.attributes) ? node3.attributes : []) {
|
|
27052
27052
|
charge();
|
|
27053
27053
|
const a3 = odfObject(value3);
|
|
@@ -27056,7 +27056,7 @@ function upgradeOdfAnnotation(node3, charge) {
|
|
|
27056
27056
|
if (a3.name === "author") continue;
|
|
27057
27057
|
if (a3.name === "create-date" || a3.name === "create-date-string") {
|
|
27058
27058
|
const date = a3.name === "create-date";
|
|
27059
|
-
|
|
27059
|
+
children8.push({
|
|
27060
27060
|
name: date ? "date" : "date-string",
|
|
27061
27061
|
namespace: odfNamespaces[date ? "dc" : "meta"],
|
|
27062
27062
|
attributes: [],
|
|
@@ -27072,13 +27072,13 @@ function upgradeOdfAnnotation(node3, charge) {
|
|
|
27072
27072
|
...node3,
|
|
27073
27073
|
namespace: odfNamespaces.office,
|
|
27074
27074
|
attributes: attributes4,
|
|
27075
|
-
children:
|
|
27076
|
-
content:
|
|
27075
|
+
children: children8,
|
|
27076
|
+
content: children8.map((_2, index2) => ({ kind: "element", index: index2 }))
|
|
27077
27077
|
};
|
|
27078
27078
|
}
|
|
27079
27079
|
function createOdfXml(context2, extended) {
|
|
27080
27080
|
let work = 0, nodes = 0;
|
|
27081
|
-
const
|
|
27081
|
+
const encoder3 = new TextEncoder(), names2 = /* @__PURE__ */ new Set();
|
|
27082
27082
|
const declarations = {
|
|
27083
27083
|
...Object.fromEntries(Object.entries(odfNamespaces).map(([prefix2, uri]) => ["xmlns:" + prefix2, uri])),
|
|
27084
27084
|
"xmlns:loext": odfEncryptionNamespace
|
|
@@ -27124,7 +27124,7 @@ function createOdfXml(context2, extended) {
|
|
|
27124
27124
|
result2 += ` ${key2}="${escape3(String(value3))}"`;
|
|
27125
27125
|
}
|
|
27126
27126
|
result2 += content2 ? ">" + content2 + "</" + tag3 + ">" : "/>";
|
|
27127
|
-
if (result2.length > context2.limits.outputBytes ||
|
|
27127
|
+
if (result2.length > context2.limits.outputBytes || encoder3.encode(result2).length > context2.limits.outputBytes)
|
|
27128
27128
|
throw new SsconvertError("resource-limit", "ssconvert OpenDocument output bytes limit exceeded");
|
|
27129
27129
|
return result2;
|
|
27130
27130
|
}
|
|
@@ -27167,15 +27167,15 @@ function createOdfXml(context2, extended) {
|
|
|
27167
27167
|
const attributes4 = {};
|
|
27168
27168
|
if (Array.isArray(v2.attributes)) for (const a3 of v2.attributes) {
|
|
27169
27169
|
charge();
|
|
27170
|
-
const
|
|
27171
|
-
if (typeof
|
|
27172
|
-
const p2 = Object.entries(odfNamespaces).find(([, uri]) => uri ===
|
|
27173
|
-
if (
|
|
27174
|
-
attributes4[(p2 ? p2 + ":" : "") +
|
|
27170
|
+
const attribute7 = odfObject(a3);
|
|
27171
|
+
if (typeof attribute7?.name !== "string" || typeof attribute7.value !== "string" || typeof attribute7.namespace !== "string") continue;
|
|
27172
|
+
const p2 = Object.entries(odfNamespaces).find(([, uri]) => uri === attribute7.namespace)?.[0];
|
|
27173
|
+
if (attribute7.namespace && (!p2 || !extended && ["gnm", "calcext"].includes(p2))) continue;
|
|
27174
|
+
attributes4[(p2 ? p2 + ":" : "") + attribute7.name] = attribute7.value;
|
|
27175
27175
|
}
|
|
27176
27176
|
if (prefix2 === "text" && v2.name === "a" && attributes4["xlink:href"] !== void 0 && hyperlink)
|
|
27177
27177
|
attributes4["xlink:href"] = hyperlink(attributes4["xlink:href"]);
|
|
27178
|
-
const
|
|
27178
|
+
const children8 = odfChildren(v2);
|
|
27179
27179
|
const childHyperlinkContent = Boolean(hyperlink) && prefix2 === "text" && v2.name === "a" && attributes4["xlink:href"] !== void 0;
|
|
27180
27180
|
const content2 = contentOverride ?? (Array.isArray(v2.content) ? v2.content.map((c4) => {
|
|
27181
27181
|
charge();
|
|
@@ -27183,11 +27183,11 @@ function createOdfXml(context2, extended) {
|
|
|
27183
27183
|
if (item?.kind === "text" && typeof item.text === "string") return escape3(item.text);
|
|
27184
27184
|
if (item?.kind !== "element") return "";
|
|
27185
27185
|
if (item.index === void 0) return retained2(item.value, depth + 1, hyperlink, childHyperlinkContent);
|
|
27186
|
-
if (typeof item.index !== "number" || !Number.isSafeInteger(item.index) || item.index < 0 || item.index >=
|
|
27186
|
+
if (typeof item.index !== "number" || !Number.isSafeInteger(item.index) || item.index < 0 || item.index >= children8.length)
|
|
27187
27187
|
throw new SsconvertError("invalid-request", "Invalid OpenDocument metadata child index");
|
|
27188
|
-
return retained2(
|
|
27189
|
-
}).join("") : (typeof v2.text === "string" ? escape3(v2.text) : "") +
|
|
27190
|
-
if (hyperlinkContent && prefix2 === "text" && !content2 && !
|
|
27188
|
+
return retained2(children8[item.index], depth + 1, hyperlink, childHyperlinkContent);
|
|
27189
|
+
}).join("") : (typeof v2.text === "string" ? escape3(v2.text) : "") + children8.map((c4) => retained2(c4, depth + 1, hyperlink, childHyperlinkContent)).join(""));
|
|
27190
|
+
if (hyperlinkContent && prefix2 === "text" && !content2 && !children8.length) {
|
|
27191
27191
|
if (v2.name === "s" && Object.keys(attributes4).every((key2) => key2 === "text:c")) {
|
|
27192
27192
|
const count = Number(attributes4["text:c"] ?? "1");
|
|
27193
27193
|
if (!Number.isSafeInteger(count) || count < 0) throw new SsconvertError("invalid-request", "Invalid OpenDocument whitespace count");
|
|
@@ -27331,25 +27331,25 @@ function rewriteWorkbookHyperlinks(book, names2, context2) {
|
|
|
27331
27331
|
item.assign(updated);
|
|
27332
27332
|
const attributes4 = odfObject(node3.attributes);
|
|
27333
27333
|
const list = Array.isArray(node3.attributes) ? node3.attributes : [];
|
|
27334
|
-
const field = (name5,
|
|
27335
|
-
if (attributes4 && !
|
|
27334
|
+
const field = (name5, namespace6) => {
|
|
27335
|
+
if (attributes4 && !namespace6 && typeof attributes4[name5] === "string") return attributes4[name5];
|
|
27336
27336
|
for (const value4 of list) {
|
|
27337
27337
|
charge();
|
|
27338
|
-
const
|
|
27339
|
-
if (
|
|
27338
|
+
const attribute7 = odfObject(value4);
|
|
27339
|
+
if (attribute7?.name === name5 && attribute7.namespace === namespace6 && typeof attribute7.value === "string") return attribute7.value;
|
|
27340
27340
|
}
|
|
27341
27341
|
return void 0;
|
|
27342
27342
|
};
|
|
27343
27343
|
const link = odf ? node3.name === "a" : node3.name === "HyperLink" && field("type", "") === "GnmHLinkCurWB";
|
|
27344
27344
|
if (link) {
|
|
27345
|
-
const name5 = odf ? "href" : "target",
|
|
27346
|
-
const source = field(name5,
|
|
27345
|
+
const name5 = odf ? "href" : "target", namespace6 = odf ? odfNamespaces.xlink : "";
|
|
27346
|
+
const source = field(name5, namespace6);
|
|
27347
27347
|
if (source !== void 0) {
|
|
27348
27348
|
const rewritten = target(source, odf);
|
|
27349
27349
|
updated.attributes = attributes4 ? { ...attributes4, [name5]: rewritten } : list.map((value4) => {
|
|
27350
27350
|
charge();
|
|
27351
|
-
const
|
|
27352
|
-
return
|
|
27351
|
+
const attribute7 = odfObject(value4);
|
|
27352
|
+
return attribute7?.name === name5 && attribute7.namespace === namespace6 ? { ...attribute7, value: rewritten } : value4;
|
|
27353
27353
|
});
|
|
27354
27354
|
}
|
|
27355
27355
|
}
|
|
@@ -27360,10 +27360,10 @@ function rewriteWorkbookHyperlinks(book, names2, context2) {
|
|
|
27360
27360
|
if (typeof child7?.name === "string") pending.push({ value: value4, role: childRole ?? child7.name, depth: item.depth + 1, assign });
|
|
27361
27361
|
};
|
|
27362
27362
|
if (Array.isArray(node3.children)) {
|
|
27363
|
-
const
|
|
27364
|
-
updated.children =
|
|
27365
|
-
|
|
27366
|
-
|
|
27363
|
+
const children8 = [...node3.children];
|
|
27364
|
+
updated.children = children8;
|
|
27365
|
+
children8.forEach((child7, index2) => enqueue(child7, (next) => {
|
|
27366
|
+
children8[index2] = next;
|
|
27367
27367
|
}));
|
|
27368
27368
|
}
|
|
27369
27369
|
if (odf && Array.isArray(node3.content)) {
|
|
@@ -27419,20 +27419,20 @@ function rewriteWorkbook(book, context2, rewrite) {
|
|
|
27419
27419
|
if (!parsed.ok) throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: formula syntax at ${parsed.diagnostic.start}:${parsed.diagnostic.end}`);
|
|
27420
27420
|
return rewrite(parsed.document, namedExpression);
|
|
27421
27421
|
};
|
|
27422
|
-
const chart = (value3, sheet, parent,
|
|
27422
|
+
const chart = (value3, sheet, parent, namespace6) => {
|
|
27423
27423
|
context2.signal.throwIfAborted();
|
|
27424
27424
|
if (++work > maximum) throw new SsconvertError("resource-limit", "ssconvert workbook work limit exceeded");
|
|
27425
27425
|
if (value3 === null || typeof value3 !== "object" || Array.isArray(value3)) return value3;
|
|
27426
27426
|
const node3 = value3;
|
|
27427
|
-
const role = parent === void 0 && node3.name === "Objects" ? "Objects" : parent === "Objects" && node3.namespace ===
|
|
27427
|
+
const role = parent === void 0 && node3.name === "Objects" ? "Objects" : parent === "Objects" && node3.namespace === namespace6 && (node3.name === "SheetObjectGraph" || node3.name === "GnmGraph") ? "graph" : (parent === "graph" || parent === "GogObject") && node3.namespace === "" && node3.name === "GogObject" ? "GogObject" : parent === "GogObject" && node3.namespace === "" && node3.name === "data" ? "data" : void 0;
|
|
27428
27428
|
const dimension = parent === "data" && node3.name === "dimension" && node3.namespace === "";
|
|
27429
27429
|
if (role === void 0 && !dimension) return value3;
|
|
27430
|
-
const type = Array.isArray(node3.attributes) ? node3.attributes.find((
|
|
27430
|
+
const type = Array.isArray(node3.attributes) ? node3.attributes.find((attribute7) => attribute7 !== null && typeof attribute7 === "object" && !Array.isArray(attribute7) && attribute7.name === "type" && attribute7.namespace === "") : void 0;
|
|
27431
27431
|
const typeName = type && typeof type === "object" && !Array.isArray(type) && typeof type.value === "string" ? type.value : "";
|
|
27432
27432
|
return {
|
|
27433
27433
|
...node3,
|
|
27434
27434
|
...dimension && Object.hasOwn(chartDataTypes, typeName) && chartDataTypes[typeName].storage === "expression" && typeof node3.text === "string" && node3.text ? { text: formula3(node3.text, { sheet, row: 0, column: 0 }) } : {},
|
|
27435
|
-
...role !== void 0 && Array.isArray(node3.children) ? { children: node3.children.map((child7) => chart(child7, sheet, role, role === "Objects" && typeof node3.namespace === "string" ? node3.namespace :
|
|
27435
|
+
...role !== void 0 && Array.isArray(node3.children) ? { children: node3.children.map((child7) => chart(child7, sheet, role, role === "Objects" && typeof node3.namespace === "string" ? node3.namespace : namespace6)) } : {}
|
|
27436
27436
|
};
|
|
27437
27437
|
};
|
|
27438
27438
|
const rewriteSheet = (sheet) => ({
|
|
@@ -33062,7 +33062,7 @@ function caseByteText(input, uppercase, maximum, tick) {
|
|
|
33062
33062
|
tick();
|
|
33063
33063
|
end2++;
|
|
33064
33064
|
}
|
|
33065
|
-
const source = input.subarray(0, end2),
|
|
33065
|
+
const source = input.subarray(0, end2), encoder3 = new TextEncoder();
|
|
33066
33066
|
const fullCases = uppercase ? upperFullCases : lowerFullCases;
|
|
33067
33067
|
const traverse = (emit3) => {
|
|
33068
33068
|
let position = 0;
|
|
@@ -33076,7 +33076,7 @@ function caseByteText(input, uppercase, maximum, tick) {
|
|
|
33076
33076
|
while (position < end2) {
|
|
33077
33077
|
const mark = readByteTextCharacter(source, position, tick);
|
|
33078
33078
|
if (!hasProperty(mark.point, 4)) break;
|
|
33079
|
-
const bytes2 =
|
|
33079
|
+
const bytes2 = encoder3.encode(String.fromCodePoint(mark.point));
|
|
33080
33080
|
emit3(bytes2, 0, bytes2.length);
|
|
33081
33081
|
position = mark.next;
|
|
33082
33082
|
}
|
|
@@ -33087,7 +33087,7 @@ function caseByteText(input, uppercase, maximum, tick) {
|
|
|
33087
33087
|
emit3(source, start, next);
|
|
33088
33088
|
continue;
|
|
33089
33089
|
}
|
|
33090
|
-
const bytes =
|
|
33090
|
+
const bytes = encoder3.encode(text2);
|
|
33091
33091
|
emit3(bytes, 0, bytes.length);
|
|
33092
33092
|
}
|
|
33093
33093
|
};
|
|
@@ -48211,7 +48211,7 @@ function* recalculateWorkbookSteps(input, context2, options = false, onDiagnosti
|
|
|
48211
48211
|
const key2 = JSON.stringify([value3.sheets.map((sheet) => sheet.id), value3.firstRow, value3.lastRow, value3.firstColumn, value3.lastColumn]);
|
|
48212
48212
|
ranges2.set(key2, value3);
|
|
48213
48213
|
}
|
|
48214
|
-
function
|
|
48214
|
+
function parse4(source, position, arrayStringLiterals = false) {
|
|
48215
48215
|
tick();
|
|
48216
48216
|
const parsed = parseExpression(source, { position, arrayStringLiterals, workbook: book, signal: context2.signal, maximumDepth: context2.limits.formulaDepth, maximumLength: context2.limits.inputBytes, maximumNodes: maximumWork2 - work, onWork: tick });
|
|
48217
48217
|
if (!parsed.ok) throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: formula syntax at ${parsed.diagnostic.start}:${parsed.diagnostic.end}`);
|
|
@@ -48222,7 +48222,7 @@ function* recalculateWorkbookSteps(input, context2, options = false, onDiagnosti
|
|
|
48222
48222
|
if (!cell.formula) continue;
|
|
48223
48223
|
const group = sheet.formulaGroups?.find((group2) => group2.id === cell.formulaGroup && group2.kind === "array");
|
|
48224
48224
|
if (group) arrayKeys.set(cell, `${sheet.id}:${group.id}`);
|
|
48225
|
-
const root =
|
|
48225
|
+
const root = parse4(cell.formula, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals);
|
|
48226
48226
|
expressions.set(cell, root);
|
|
48227
48227
|
if (work - checkpoint >= WORK_QUANTUM) {
|
|
48228
48228
|
checkpoint = work;
|
|
@@ -48289,7 +48289,7 @@ function* recalculateWorkbookSteps(input, context2, options = false, onDiagnosti
|
|
|
48289
48289
|
const matches = (entry2) => entry2.name === node3.name;
|
|
48290
48290
|
const name5 = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
|
|
48291
48291
|
if (!name5 || names2.has(name5)) return error("#REF!");
|
|
48292
|
-
return indirectRange(parseNamedExpression(name5, book,
|
|
48292
|
+
return indirectRange(parseNamedExpression(name5, book, parse4, tick, context2.limits.formulaDependencyDepth ?? Infinity), position, /* @__PURE__ */ new Set([...names2, name5]), depth2 + 1);
|
|
48293
48293
|
}
|
|
48294
48294
|
function scalar(value3, position) {
|
|
48295
48295
|
const label = scalarLabels.get(value3);
|
|
@@ -48363,7 +48363,7 @@ function* recalculateWorkbookSteps(input, context2, options = false, onDiagnosti
|
|
|
48363
48363
|
const matches = (entry2) => entry2.name === node3.name;
|
|
48364
48364
|
const name5 = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
|
|
48365
48365
|
if (!name5 || names2.has(name5)) return error("#NAME?");
|
|
48366
|
-
return evaluate(parseNamedExpression(name5, book,
|
|
48366
|
+
return evaluate(parseNamedExpression(name5, book, parse4, tick, context2.limits.formulaDependencyDepth ?? Infinity), position, array, /* @__PURE__ */ new Set([...names2, name5]), wantReference);
|
|
48367
48367
|
}
|
|
48368
48368
|
if (node3.kind === "unary") {
|
|
48369
48369
|
const apply3 = (value3) => {
|
|
@@ -48686,7 +48686,7 @@ function* recalculateWorkbookSteps(input, context2, options = false, onDiagnosti
|
|
|
48686
48686
|
activeCell = cell;
|
|
48687
48687
|
const group = sheet.formulaGroups?.find((g) => g.id === cell.formulaGroup && g.kind === "array");
|
|
48688
48688
|
const position = { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column };
|
|
48689
|
-
const node3 = expressions.get(cell) ??
|
|
48689
|
+
const node3 = expressions.get(cell) ?? parse4(cell.formula, position);
|
|
48690
48690
|
let result2 = cell.cachedResult ?? cell.value;
|
|
48691
48691
|
try {
|
|
48692
48692
|
let remaining = book.iteration?.maximum ?? 0;
|
|
@@ -48731,7 +48731,7 @@ function* recalculateWorkbookSteps(input, context2, options = false, onDiagnosti
|
|
|
48731
48731
|
}
|
|
48732
48732
|
const currentValues = /* @__PURE__ */ new Map();
|
|
48733
48733
|
const dependencyRanges = [];
|
|
48734
|
-
const graph = buildDependencyGraph(book, expressions, (node3, position) => localReferenceRange(book, node3, position),
|
|
48734
|
+
const graph = buildDependencyGraph(book, expressions, (node3, position) => localReferenceRange(book, node3, position), parse4, tick, (cell, range5) => dependencyRanges.push([cell, range5]), context2.limits.formulaDependencyDepth ?? Infinity);
|
|
48735
48735
|
const pending = /* @__PURE__ */ new Set();
|
|
48736
48736
|
const queue2 = [];
|
|
48737
48737
|
const queueVolatile = typeof options === "boolean" || options.queueVolatile !== false;
|
|
@@ -49090,8 +49090,8 @@ init_platform();
|
|
|
49090
49090
|
// packages/spreadsheet-engine/src/codecs/ordering.ts
|
|
49091
49091
|
init_platform();
|
|
49092
49092
|
function compareServiceIds(a3, b3) {
|
|
49093
|
-
const
|
|
49094
|
-
const left =
|
|
49093
|
+
const encoder3 = new TextEncoder();
|
|
49094
|
+
const left = encoder3.encode(a3.id), right = encoder3.encode(b3.id);
|
|
49095
49095
|
for (let index2 = 0; index2 < Math.min(left.length, right.length); index2++) {
|
|
49096
49096
|
const difference2 = left[index2] - right[index2];
|
|
49097
49097
|
if (difference2) return difference2;
|
|
@@ -50879,14 +50879,14 @@ init_platform();
|
|
|
50879
50879
|
init_platform();
|
|
50880
50880
|
function kaplanMeierChart(name5, rows, probability, ticks, size, context2) {
|
|
50881
50881
|
let work = 0;
|
|
50882
|
-
const node3 = (name6, attributes4 = {},
|
|
50882
|
+
const node3 = (name6, attributes4 = {}, children8 = [], text2 = "", namespace7 = "") => {
|
|
50883
50883
|
context2.signal.throwIfAborted();
|
|
50884
50884
|
work += 1 + text2.length + Object.entries(attributes4).reduce((sum3, [key2, value3]) => sum3 + key2.length + value3.length, 0);
|
|
50885
50885
|
if (work > context2.limits.operations) throw new SsconvertError("resource-limit", "ssconvert analysis chart exceeds workbook limits");
|
|
50886
|
-
return { name: name6, namespace:
|
|
50886
|
+
return { name: name6, namespace: namespace7, text: text2, attributes: Object.entries(attributes4).map(([name7, value3]) => ({ name: name7, namespace: "", value: value3 })), children: children8 };
|
|
50887
50887
|
};
|
|
50888
50888
|
const property = (name6, value3) => node3("property", { name: name6 }, [], value3);
|
|
50889
|
-
const style2 = (
|
|
50889
|
+
const style2 = (children8) => node3("property", { name: "style", type: "GogStyle" }, children8);
|
|
50890
50890
|
const line = () => node3("line", { "auto-dash": "1", "auto-width": "1", "auto-color": "1" });
|
|
50891
50891
|
const fill2 = () => node3("fill", { type: "none", "auto-type": "1", "is-auto": "1", "auto-fore": "1" });
|
|
50892
50892
|
const axis = (role) => node3("GogObject", { role }, [
|
|
@@ -50947,13 +50947,13 @@ function kaplanMeierChart(name5, rows, probability, ticks, size, context2) {
|
|
|
50947
50947
|
plot
|
|
50948
50948
|
])
|
|
50949
50949
|
]);
|
|
50950
|
-
const
|
|
50950
|
+
const namespace6 = "http://www.gnumeric.org/v10.dtd";
|
|
50951
50951
|
return { source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: node3("Objects", {}, [node3("SheetObjectGraph", {
|
|
50952
50952
|
ObjectBound: `A2:${formatA1(Math.min(20, size.rows - 1), Math.min(5, size.columns - 1), size)}`,
|
|
50953
50953
|
ObjectOffset: "0 0 0 0",
|
|
50954
50954
|
Direction: "255",
|
|
50955
50955
|
Print: "1"
|
|
50956
|
-
}, [graph], "",
|
|
50956
|
+
}, [graph], "", namespace6)], "", namespace6) };
|
|
50957
50957
|
}
|
|
50958
50958
|
async function analysisUtility(book, tool, options, context2, add5, merges) {
|
|
50959
50959
|
const p2 = options.properties;
|
|
@@ -52600,14 +52600,14 @@ async function statisticalAnalysis(book, tool, options, context2) {
|
|
|
52600
52600
|
if (anovaValidityRow !== void 0) {
|
|
52601
52601
|
if (cell.row === anovaValidityRow && cell.column === 0) return { ...cell, format: '"ANOVA";[Red]"Invalid ANOVA: Missing Observations"', style: { italic: true, horizontalAlignment: "left", verticalAlignment: "bottom" } };
|
|
52602
52602
|
if (cell.row === anovaValidityRow + 1 || cell.row === anovaErrorRow) {
|
|
52603
|
-
const
|
|
52603
|
+
const namespace6 = "http://www.gnumeric.org/v10.dtd";
|
|
52604
52604
|
return { ...cell, style: { ...cell.style, ...cell.row === anovaValidityRow + 1 ? { italic: true } : {}, gnumeric: {
|
|
52605
52605
|
name: "Style",
|
|
52606
|
-
namespace:
|
|
52606
|
+
namespace: namespace6,
|
|
52607
52607
|
attributes: [],
|
|
52608
|
-
children: [{ name: "StyleBorder", namespace:
|
|
52608
|
+
children: [{ name: "StyleBorder", namespace: namespace6, attributes: [], children: [{
|
|
52609
52609
|
name: "Bottom",
|
|
52610
|
-
namespace:
|
|
52610
|
+
namespace: namespace6,
|
|
52611
52611
|
attributes: [{ name: "Style", namespace: "", value: "1" }, { name: "Color", namespace: "", value: "0:0:0" }],
|
|
52612
52612
|
children: []
|
|
52613
52613
|
}] }]
|
|
@@ -53257,7 +53257,7 @@ function dirtyWorkbook(book, changes, context2) {
|
|
|
53257
53257
|
const tick = budget(context2);
|
|
53258
53258
|
book = snapshotWorkbook(book, context2.limits);
|
|
53259
53259
|
const dirty = /* @__PURE__ */ new Set();
|
|
53260
|
-
function
|
|
53260
|
+
function parse4(source, position, arrayStringLiterals = false) {
|
|
53261
53261
|
tick();
|
|
53262
53262
|
const parsed = parseExpression(source, {
|
|
53263
53263
|
maximumDepth: context2.limits.formulaDepth,
|
|
@@ -53277,10 +53277,10 @@ function dirtyWorkbook(book, changes, context2) {
|
|
|
53277
53277
|
const group = sheet.formulaGroups?.find((group2) => group2.id === cell.formulaGroup && group2.kind === "array");
|
|
53278
53278
|
const source = cell.formula ?? group?.expression;
|
|
53279
53279
|
if (!source) continue;
|
|
53280
|
-
roots.set(cell,
|
|
53280
|
+
roots.set(cell, parse4(source, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals ?? group?.arrayStringLiterals));
|
|
53281
53281
|
if (cell.formulaDirty) dirty.add(cell);
|
|
53282
53282
|
}
|
|
53283
|
-
const graph = buildDependencyGraph(book, roots, (node3, position) => localReferenceRange(book, node3, position),
|
|
53283
|
+
const graph = buildDependencyGraph(book, roots, (node3, position) => localReferenceRange(book, node3, position), parse4, tick, (cell, range5) => {
|
|
53284
53284
|
for (const sheet of range5.sheets) for (const change of changes) {
|
|
53285
53285
|
tick();
|
|
53286
53286
|
if (change.sheet === sheet.id && change.startRow <= range5.lastRow && change.endRow >= range5.firstRow && change.startColumn <= range5.lastColumn && change.endColumn >= range5.firstColumn) dirty.add(cell);
|
|
@@ -55129,8 +55129,8 @@ ${errors.map((e) => ` E ${e}`).join("\n")}`);
|
|
|
55129
55129
|
const parsed = legacyExpression(formula3, { ...gnumericGrammar, quoteSheetName: quoteNativeSheet }, { sheet: id, row, column }, context2);
|
|
55130
55130
|
return parsed.ok ? rewriteReferences(parsed.document, { sheets: renames, signal: context2.signal }) : formula3;
|
|
55131
55131
|
}
|
|
55132
|
-
function node3(name5, style3,
|
|
55133
|
-
return { name: name5, namespace: "http://www.gnumeric.org/v10.dtd", text: text2, children:
|
|
55132
|
+
function node3(name5, style3, children8 = [], text2 = "") {
|
|
55133
|
+
return { name: name5, namespace: "http://www.gnumeric.org/v10.dtd", text: text2, children: children8, attributes: Object.entries(style3).map(([name6, value3]) => {
|
|
55134
55134
|
let text3 = typeof value3 === "boolean" ? String(Number(value3)) : String(value3);
|
|
55135
55135
|
if (["Fore", "Back", "PatternColor", "Color"].includes(name6) && text3.length === 8 && [...text3].every((c4) => "0123456789ABCDEF".includes(c4)))
|
|
55136
55136
|
text3 = [text3.slice(2, 4), text3.slice(4, 6), text3.slice(6, 8)].map((s) => (parseInt(s, 16) * 257).toString(16).toUpperCase()).join(":");
|
|
@@ -55312,7 +55312,7 @@ function escapeXlsx(value3) {
|
|
|
55312
55312
|
}
|
|
55313
55313
|
function createXlsxXml(context2) {
|
|
55314
55314
|
let nodes = 0, work = 0;
|
|
55315
|
-
const
|
|
55315
|
+
const encoder3 = new TextEncoder();
|
|
55316
55316
|
const names2 = /* @__PURE__ */ new Set();
|
|
55317
55317
|
function charge(amount = 1) {
|
|
55318
55318
|
context2.signal.throwIfAborted();
|
|
@@ -55354,7 +55354,7 @@ function createXlsxXml(context2) {
|
|
|
55354
55354
|
text2 += ` ${key2}="${escapeXlsx(raw).split("\n").join(" ").split(" ").join("	")}"`;
|
|
55355
55355
|
}
|
|
55356
55356
|
text2 += content2 ? ">" + content2 + "</" + name5 + ">" : "/>";
|
|
55357
|
-
if (text2.length > context2.limits.outputBytes ||
|
|
55357
|
+
if (text2.length > context2.limits.outputBytes || encoder3.encode(text2).length > context2.limits.outputBytes)
|
|
55358
55358
|
throw new SsconvertError("resource-limit", "ssconvert XLSX output bytes limit exceeded");
|
|
55359
55359
|
return text2;
|
|
55360
55360
|
};
|
|
@@ -55375,10 +55375,10 @@ function metadataNode(value3, charge) {
|
|
|
55375
55375
|
if (Array.isArray(source.attributes)) for (const a3 of source.attributes) {
|
|
55376
55376
|
charge?.();
|
|
55377
55377
|
if (a3 && typeof a3 === "object" && !Array.isArray(a3)) {
|
|
55378
|
-
const
|
|
55379
|
-
if (typeof
|
|
55380
|
-
charge?.(
|
|
55381
|
-
attributes4[
|
|
55378
|
+
const attribute7 = a3;
|
|
55379
|
+
if (typeof attribute7.name === "string" && typeof attribute7.value === "string") {
|
|
55380
|
+
charge?.(attribute7.name.length + attribute7.value.length);
|
|
55381
|
+
attributes4[attribute7.name] = attribute7.value;
|
|
55382
55382
|
}
|
|
55383
55383
|
}
|
|
55384
55384
|
}
|
|
@@ -55913,14 +55913,22 @@ function readCfb(bytes, context2) {
|
|
|
55913
55913
|
return result2;
|
|
55914
55914
|
}
|
|
55915
55915
|
function readBiffRecords(bytes, context2) {
|
|
55916
|
+
context2.signal.throwIfAborted();
|
|
55917
|
+
if (bytes.length > context2.limits.inputBytes) throw new SsconvertError("resource-limit", "ssconvert input bytes limit exceeded");
|
|
55916
55918
|
const binary3 = new Binary(bytes), records = [];
|
|
55917
55919
|
for (let offset = 0; offset < bytes.length; ) {
|
|
55918
55920
|
context2.signal.throwIfAborted();
|
|
55921
|
+
context2.work?.();
|
|
55919
55922
|
binary3.check(offset, 4);
|
|
55920
55923
|
const opcode = binary3.u16(offset), length = binary3.u16(offset + 2);
|
|
55921
|
-
if (opcode === 0 && length === 0 && bytes.subarray(offset).every((byte) =>
|
|
55924
|
+
if (opcode === 0 && length === 0 && bytes.subarray(offset).every((byte) => {
|
|
55925
|
+
context2.signal.throwIfAborted();
|
|
55926
|
+
context2.work?.();
|
|
55927
|
+
return byte === 0;
|
|
55928
|
+
})) break;
|
|
55922
55929
|
if (records.length >= (context2.limits.workbookNodes ?? context2.limits.inputBytes))
|
|
55923
55930
|
throw new SsconvertError("resource-limit", "ssconvert BIFF record limit exceeded");
|
|
55931
|
+
context2.retain?.(128);
|
|
55924
55932
|
records.push({ opcode, offset, data: new Binary(binary3.slice(offset + 4, length)) });
|
|
55925
55933
|
offset += length + 4;
|
|
55926
55934
|
}
|
|
@@ -56827,6 +56835,7 @@ function biffOverrideCodepage(encoding) {
|
|
|
56827
56835
|
return encoding === void 0 ? void 0 : overrideCodepages[encoding];
|
|
56828
56836
|
}
|
|
56829
56837
|
function biffDecode(bytes, codepage) {
|
|
56838
|
+
if (codepage === 65001) return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
56830
56839
|
const multibyte = biffDbcsTables[codepage];
|
|
56831
56840
|
if (multibyte) {
|
|
56832
56841
|
const characters2 = [];
|
|
@@ -56842,7 +56851,7 @@ function biffDecode(bytes, codepage) {
|
|
|
56842
56851
|
}
|
|
56843
56852
|
return characters2.join("");
|
|
56844
56853
|
}
|
|
56845
|
-
const name5 = codepage === 1200 || codepage === 1201 ? "iso-8859-1" : codepage === 1e4 ? "macintosh" : codepage >= 1250 && codepage <= 1258 ? `windows-${codepage}` : `cp${codepage}`;
|
|
56854
|
+
const name5 = codepage === 20127 ? "ascii" : codepage === 1200 || codepage === 1201 || codepage === 28591 ? "iso-8859-1" : codepage === 1e4 ? "macintosh" : codepage >= 1250 && codepage <= 1258 ? `windows-${codepage}` : `cp${codepage}`;
|
|
56846
56855
|
const table10 = singleByteTables[name5];
|
|
56847
56856
|
if (!table10) throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: BIFF codepage ${codepage}`);
|
|
56848
56857
|
const characters = [];
|
|
@@ -56869,12 +56878,16 @@ var BiffStrings = class {
|
|
|
56869
56878
|
}
|
|
56870
56879
|
advance() {
|
|
56871
56880
|
while (this.part < this.parts.length && this.offset === this.parts[this.part].bytes.length) {
|
|
56881
|
+
this.context.signal.throwIfAborted();
|
|
56882
|
+
this.context.work?.();
|
|
56872
56883
|
this.part++;
|
|
56873
56884
|
this.offset = 0;
|
|
56874
56885
|
}
|
|
56875
56886
|
if (this.part >= this.parts.length) invalidBiff("truncated string/CONTINUE");
|
|
56876
56887
|
}
|
|
56877
56888
|
byte() {
|
|
56889
|
+
this.context.signal.throwIfAborted();
|
|
56890
|
+
this.context.work?.();
|
|
56878
56891
|
this.advance();
|
|
56879
56892
|
return this.parts[this.part].u8(this.offset++);
|
|
56880
56893
|
}
|
|
@@ -56896,6 +56909,7 @@ var BiffStrings = class {
|
|
|
56896
56909
|
this.context.signal.throwIfAborted();
|
|
56897
56910
|
if (length > (this.context.limits.workbookTextBytes ?? this.context.limits.inputBytes))
|
|
56898
56911
|
throw new SsconvertError("resource-limit", "ssconvert BIFF string limit exceeded");
|
|
56912
|
+
this.context.retain?.(length * 16);
|
|
56899
56913
|
}
|
|
56900
56914
|
unicode(length) {
|
|
56901
56915
|
this.admit(length * 3);
|
|
@@ -56907,6 +56921,7 @@ var BiffStrings = class {
|
|
|
56907
56921
|
const characters = [];
|
|
56908
56922
|
for (let i4 = 0; i4 < length; i4++) {
|
|
56909
56923
|
this.context.signal.throwIfAborted();
|
|
56924
|
+
this.context.work?.();
|
|
56910
56925
|
if (this.offset === this.parts[this.part].bytes.length) {
|
|
56911
56926
|
this.advance();
|
|
56912
56927
|
const width2 = this.byte();
|
|
@@ -61120,8 +61135,8 @@ function translateBiffFormula(bytes, context2) {
|
|
|
61120
61135
|
const rawSheet = data4.u16(offset), signedSheet = rawSheet >= 32768 ? rawSheet - 65536 : rawSheet;
|
|
61121
61136
|
const index2 = context2.revision >= 8 ? data4.u32(offset + 2) : data4.u16(offset + 10);
|
|
61122
61137
|
offset += width2;
|
|
61123
|
-
const
|
|
61124
|
-
const extern =
|
|
61138
|
+
const namespace6 = context2.revision >= 8 ? rawSheet : signedSheet > 0 ? signedSheet - 1 : void 0;
|
|
61139
|
+
const extern = namespace6 === void 0 ? void 0 : context2.externalNames?.[namespace6];
|
|
61125
61140
|
if (extern !== void 0) {
|
|
61126
61141
|
const name6 = extern[index2 - 1];
|
|
61127
61142
|
if (!name6) {
|
|
@@ -61316,7 +61331,7 @@ init_platform();
|
|
|
61316
61331
|
function biffFormulaExtras(parts, revision2, codepage, context2, accountWork) {
|
|
61317
61332
|
const cursor = new BiffStrings(parts, context2, codepage);
|
|
61318
61333
|
const number5 = new Uint8Array(8), view2 = new DataView(number5.buffer);
|
|
61319
|
-
const
|
|
61334
|
+
const encoder3 = new TextEncoder();
|
|
61320
61335
|
const workLimit = context2.limits.workbookWork ?? context2.limits.inputBytes * 8;
|
|
61321
61336
|
const textLimit = context2.limits.workbookTextBytes ?? context2.limits.inputBytes;
|
|
61322
61337
|
let work = 0, textBytes = 0;
|
|
@@ -61330,7 +61345,7 @@ function biffFormulaExtras(parts, revision2, codepage, context2, accountWork) {
|
|
|
61330
61345
|
accountWork?.(columns * rows);
|
|
61331
61346
|
const chunks = [];
|
|
61332
61347
|
const append = (text2) => {
|
|
61333
|
-
textBytes +=
|
|
61348
|
+
textBytes += encoder3.encode(text2).length;
|
|
61334
61349
|
if (textBytes > textLimit) throw new SsconvertError("resource-limit", "ssconvert BIFF array text limit exceeded");
|
|
61335
61350
|
chunks.push(text2);
|
|
61336
61351
|
};
|
|
@@ -61668,8 +61683,8 @@ var BiffNameBindings = class {
|
|
|
61668
61683
|
|
|
61669
61684
|
// packages/spreadsheet-format-xls/src/biff-metadata.ts
|
|
61670
61685
|
init_platform();
|
|
61671
|
-
function biffNode(name5, attributes4, text2 = "",
|
|
61672
|
-
return { name: name5, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), text: text2, children:
|
|
61686
|
+
function biffNode(name5, attributes4, text2 = "", children8 = []) {
|
|
61687
|
+
return { name: name5, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), text: text2, children: children8 };
|
|
61673
61688
|
}
|
|
61674
61689
|
var biffMetadataOpcodes = /* @__PURE__ */ new Set([
|
|
61675
61690
|
42,
|
|
@@ -74235,7 +74250,7 @@ var BiffFormulaWriter = class {
|
|
|
74235
74250
|
return order;
|
|
74236
74251
|
}
|
|
74237
74252
|
compile(source, sheet, row, column, definition, arrayStringLiterals) {
|
|
74238
|
-
const
|
|
74253
|
+
const parse4 = (expression2, position, literals = arrayStringLiterals ?? false) => {
|
|
74239
74254
|
const parsed = parseExpression(expression2, {
|
|
74240
74255
|
maximumDepth: this.context.limits.formulaDepth,
|
|
74241
74256
|
workbook: this.book,
|
|
@@ -74254,7 +74269,7 @@ var BiffFormulaWriter = class {
|
|
|
74254
74269
|
}).root;
|
|
74255
74270
|
};
|
|
74256
74271
|
const relative = definition !== void 0;
|
|
74257
|
-
const root = definition ? parseNamedExpression(definition, this.book,
|
|
74272
|
+
const root = definition ? parseNamedExpression(definition, this.book, parse4, () => this.context.signal.throwIfAborted()) : parse4(source, { sheet, row, column });
|
|
74258
74273
|
const bytes = [], arrays = [], diagnostics = [];
|
|
74259
74274
|
const tokenBoundaries = [], arrayBoundaries = [];
|
|
74260
74275
|
const arrayStrings = [];
|
|
@@ -75510,12 +75525,12 @@ async function mergeBiffProperties(book, streams3, handled, context2, charge, al
|
|
|
75510
75525
|
}
|
|
75511
75526
|
for (const name5 of duplicates) snapshots.delete(name5);
|
|
75512
75527
|
if (!snapshots.size) return preserved;
|
|
75513
|
-
const
|
|
75528
|
+
const parse4 = (bytes) => readBiffPropertySections(bytes, admit2, charge).map((section) => {
|
|
75514
75529
|
const data4 = bytes.subarray(section.offset, section.end);
|
|
75515
75530
|
return { ...section, bytes: data4, ...biffPropertyFields.has(section.guid) || section.guid === biffPropertyFormats.custom ? { values: readBiffPropertyValues(new Binary(data4), admit2, charge) } : {} };
|
|
75516
75531
|
});
|
|
75517
|
-
const old = new Map([...snapshots].map(([name5, snapshot]) => [name5,
|
|
75518
|
-
const fresh = new Map([...streams3].map(([name5, bytes]) => [name5,
|
|
75532
|
+
const old = new Map([...snapshots].map(([name5, snapshot]) => [name5, parse4(snapshot.bytes)]));
|
|
75533
|
+
const fresh = new Map([...streams3].map(([name5, bytes]) => [name5, parse4(bytes)]));
|
|
75519
75534
|
const original = /* @__PURE__ */ new Map(), pending = /* @__PURE__ */ new Map();
|
|
75520
75535
|
const identity2 = (property) => `${property.stream}:${property.section}:${property.id}`;
|
|
75521
75536
|
const readContext = { ...context2, limits: { ...context2.limits, inputBytes: context2.limits.outputBytes } };
|
|
@@ -75781,7 +75796,7 @@ function handledPropertyRecord(record7, keys3, charge) {
|
|
|
75781
75796
|
charge(data4.name.length + data4.namespace.length + data4.text.length + data4.attributes.length + data4.children.length);
|
|
75782
75797
|
return data4;
|
|
75783
75798
|
};
|
|
75784
|
-
const attributes4 = (n,
|
|
75799
|
+
const attributes4 = (n, namespace6, allowed) => {
|
|
75785
75800
|
const result2 = /* @__PURE__ */ new Map();
|
|
75786
75801
|
for (const value3 of n.attributes) {
|
|
75787
75802
|
charge(1);
|
|
@@ -75791,8 +75806,8 @@ function handledPropertyRecord(record7, keys3, charge) {
|
|
|
75791
75806
|
charge(1);
|
|
75792
75807
|
if (!["name", "namespace", "value"].includes(key2)) return void 0;
|
|
75793
75808
|
}
|
|
75794
|
-
if (typeof attr6.name !== "string" || attr6.namespace !==
|
|
75795
|
-
charge(attr6.name.length +
|
|
75809
|
+
if (typeof attr6.name !== "string" || attr6.namespace !== namespace6 || typeof attr6.value !== "string" || !allowed.includes(attr6.name) || result2.has(attr6.name)) return void 0;
|
|
75810
|
+
charge(attr6.name.length + namespace6.length + attr6.value.length);
|
|
75796
75811
|
result2.set(attr6.name, attr6.value);
|
|
75797
75812
|
}
|
|
75798
75813
|
return result2;
|
|
@@ -79200,8 +79215,8 @@ function number(value3, fallback = 0) {
|
|
|
79200
79215
|
function sourceRecord(node3) {
|
|
79201
79216
|
return { name: node3.localName, namespace: node3.namespace, attributes: Object.fromEntries(node3.attributes.filter((a3) => a3.namespace !== "http://www.w3.org/2000/xmlns/").map((a3) => [a3.name, a3.value])), text: node3.text, children: node3.children.map(sourceRecord) };
|
|
79202
79217
|
}
|
|
79203
|
-
function record2(name5, attributes4, text2 = "",
|
|
79204
|
-
return { name: name5, namespace, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), text: text2, children:
|
|
79218
|
+
function record2(name5, attributes4, text2 = "", children8 = []) {
|
|
79219
|
+
return { name: name5, namespace, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), text: text2, children: children8 };
|
|
79205
79220
|
}
|
|
79206
79221
|
function indexed(index2) {
|
|
79207
79222
|
if (index2 < 8) return palette[index2] ?? "000000";
|
|
@@ -79410,8 +79425,8 @@ function numeric3(source, fallback) {
|
|
|
79410
79425
|
if (!Number.isFinite(value3)) throw new SsconvertError("io", "E Invalid XLSX: invalid print number");
|
|
79411
79426
|
return value3;
|
|
79412
79427
|
}
|
|
79413
|
-
function gnode(name5, attributes4 = {},
|
|
79414
|
-
return { name: name5, namespace: gnumericNamespace, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), children:
|
|
79428
|
+
function gnode(name5, attributes4 = {}, children8 = [], text2 = "") {
|
|
79429
|
+
return { name: name5, namespace: gnumericNamespace, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), children: children8, text: text2 };
|
|
79415
79430
|
}
|
|
79416
79431
|
function header2(source) {
|
|
79417
79432
|
const sections = { Left: "", Middle: "", Right: "" };
|
|
@@ -79623,7 +79638,7 @@ function header3(node3, fallback, charge) {
|
|
|
79623
79638
|
return "&" + ["L", "C", "R"][index2] + output2;
|
|
79624
79639
|
}).join("");
|
|
79625
79640
|
}
|
|
79626
|
-
async function writeXlsxSheetSettings(sheet, records, xml2, context2,
|
|
79641
|
+
async function writeXlsxSheetSettings(sheet, records, xml2, context2, namespace6, charge) {
|
|
79627
79642
|
const handled = /* @__PURE__ */ new Set(), raw = /* @__PURE__ */ new Map();
|
|
79628
79643
|
for (const { record: record7, node: node4 } of records) {
|
|
79629
79644
|
charge();
|
|
@@ -79634,7 +79649,7 @@ async function writeXlsxSheetSettings(sheet, records, xml2, context2, namespace5
|
|
|
79634
79649
|
}
|
|
79635
79650
|
const node3 = (name5, attributes4 = {}, content2 = [], text2 = "") => {
|
|
79636
79651
|
charge();
|
|
79637
|
-
return { name: name5, namespace:
|
|
79652
|
+
return { name: name5, namespace: namespace6, attributes: Object.fromEntries(Object.entries(attributes4).flatMap(([key2, value3]) => value3 === void 0 ? [] : [[key2, String(value3)]])), children: content2, text: text2 };
|
|
79638
79653
|
};
|
|
79639
79654
|
const originalPrint = metadataNode(readXlsxMetadata(node3("worksheet", {}, [...raw.values()])).find((record7) => record7.kind === "PrintInformation")?.data, charge);
|
|
79640
79655
|
const currentPrint = records.find((record7) => record7.record.kind === "PrintInformation")?.node ?? originalPrint;
|
|
@@ -79821,7 +79836,7 @@ function rgb(source, fallback) {
|
|
|
79821
79836
|
function alignment(value3, fallback) {
|
|
79822
79837
|
return value3 === void 0 ? fallback : value3.toLowerCase().split("_").at(-1) ?? fallback;
|
|
79823
79838
|
}
|
|
79824
|
-
function createXlsxStyles(xml2, edition,
|
|
79839
|
+
function createXlsxStyles(xml2, edition, namespace6, charge) {
|
|
79825
79840
|
const styles = [{ format: "General" }];
|
|
79826
79841
|
const dxfs = [];
|
|
79827
79842
|
const differentialIds = /* @__PURE__ */ new Map();
|
|
@@ -79882,7 +79897,7 @@ function createXlsxStyles(xml2, edition, namespace5, charge) {
|
|
|
79882
79897
|
if (index2 === 0) defaultXf = xml2("xf", attrs, properties);
|
|
79883
79898
|
xfs.push(xml2("xf", { applyAlignment: 1, applyBorder: 1, applyFont: 1, applyFill: 1, applyNumberFormat: 1, ...attrs, xfId: 0 }, properties));
|
|
79884
79899
|
}
|
|
79885
|
-
return xml2("styleSheet", { xmlns:
|
|
79900
|
+
return xml2("styleSheet", { xmlns: namespace6 }, (custom2.size ? xml2("numFmts", { count: custom2.size }, [...custom2].map(([formatCode, numFmtId]) => xml2("numFmt", { formatCode, numFmtId })).join("")) : "") + xml2("fonts", { count: fonts.length }, fonts.join("")) + xml2("fills", { count: fills.length }, fills.join("")) + xml2("borders", { count: borders.length }, borders.join("")) + xml2("cellStyleXfs", { count: 1 }, defaultXf) + xml2("cellXfs", { count: xfs.length }, xfs.join("")) + xml2("cellStyles", { count: 1 }, xml2("cellStyle", { name: "Normal", xfId: 0, builtinId: 0 })) + (dxfs.length ? xml2("dxfs", { count: dxfs.length }, dxfs.map((node3) => {
|
|
79886
79901
|
const a3 = node3.attributes;
|
|
79887
79902
|
let content2 = "";
|
|
79888
79903
|
if (a3.Back !== void 0 || a3.Shade !== void 0) content2 += xml2("fill", {}, xml2("patternFill", { patternType: patterns2[Number(a3.Shade ?? 1)] ?? "solid" }, xml2("bgColor", { rgb: rgb(a3.Back, "FFFFFFFF") })));
|
|
@@ -79912,9 +79927,9 @@ init_platform();
|
|
|
79912
79927
|
function child3(node3, name5) {
|
|
79913
79928
|
return node3?.children.find((n) => n.name === name5);
|
|
79914
79929
|
}
|
|
79915
|
-
async function writeXlsxSheetMetadata(sheet, number5, xml2, context2,
|
|
79930
|
+
async function writeXlsxSheetMetadata(sheet, number5, xml2, context2, namespace6, formula3, styles, charge) {
|
|
79916
79931
|
const records = (sheet.unsupportedRecords ?? []).map((record7) => ({ record: record7, node: metadataNode(record7.data, charge) }));
|
|
79917
|
-
const settings = await writeXlsxSheetSettings(sheet, records, xml2, context2,
|
|
79932
|
+
const settings = await writeXlsxSheetSettings(sheet, records, xml2, context2, namespace6, charge);
|
|
79918
79933
|
const pi2 = records.find((r) => r.record.kind === "PrintInformation")?.node;
|
|
79919
79934
|
let print = settings.print;
|
|
79920
79935
|
let filters = "", rules = "";
|
|
@@ -79922,7 +79937,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context2, namespace5
|
|
|
79922
79937
|
const handled = /* @__PURE__ */ new Set(["PrintInformation", "SheetLayout", "Styles"]);
|
|
79923
79938
|
const render = (node3) => {
|
|
79924
79939
|
charge();
|
|
79925
|
-
if (node3.namespace !==
|
|
79940
|
+
if (node3.namespace !== namespace6 || Object.keys(node3.attributes).some((name5) => name5 === "xmlns" || name5.includes(":") && name5 !== "xml:space"))
|
|
79926
79941
|
throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: XLSX metadata namespace or relationship");
|
|
79927
79942
|
return xml2(node3.name, node3.attributes, escapeXlsx(node3.text) + node3.children.map(render).join(""));
|
|
79928
79943
|
};
|
|
@@ -79930,7 +79945,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context2, namespace5
|
|
|
79930
79945
|
handled.add(name5);
|
|
79931
79946
|
const breaks = child3(pi2, gnm);
|
|
79932
79947
|
if (!breaks || breaks.children.length === 0) continue;
|
|
79933
|
-
const raw = records.find((r) => r.record.kind === name5 && r.node?.namespace ===
|
|
79948
|
+
const raw = records.find((r) => r.record.kind === name5 && r.node?.namespace === namespace6)?.node;
|
|
79934
79949
|
const original = raw?.children.filter((n) => {
|
|
79935
79950
|
charge();
|
|
79936
79951
|
return n.name === "brk";
|
|
@@ -80063,7 +80078,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context2, namespace5
|
|
|
80063
80078
|
name: `comments${number5}.xml`,
|
|
80064
80079
|
relation: "comments",
|
|
80065
80080
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
|
80066
|
-
content: xml2("comments", { xmlns:
|
|
80081
|
+
content: xml2("comments", { xmlns: namespace6 }, xml2("authors", {}, authors.map((a3) => xml2("author", {}, escapeXlsx(encodeXlsxString(a3)))).join("")) + xml2("commentList", {}, comments.map((comment) => xml2(
|
|
80067
80082
|
"comment",
|
|
80068
80083
|
{ ref: comment.attributes.ObjectBound?.split(":")[0] ?? "A1", authorId: comment.attributes.Author === void 0 ? void 0 : authors.indexOf(comment.attributes.Author) },
|
|
80069
80084
|
commentText(comment)
|
|
@@ -80158,7 +80173,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context2, namespace5
|
|
|
80158
80173
|
context2.signal.throwIfAborted();
|
|
80159
80174
|
if (handled.has(record7.kind) || settings.handled.has(record7) || record7.kind === "autoFilter") continue;
|
|
80160
80175
|
if (record7.source === "Gnumeric_XmlIO:sax" && (record7.kind === "Rows" && sheet.rows !== void 0 || record7.kind === "Cols" && sheet.columns !== void 0)) continue;
|
|
80161
|
-
if (node3?.namespace ===
|
|
80176
|
+
if (node3?.namespace === namespace6 && record7.kind === "dataValidations") {
|
|
80162
80177
|
rules += render(node3);
|
|
80163
80178
|
continue;
|
|
80164
80179
|
}
|
|
@@ -80215,8 +80230,8 @@ function writeXlsxProperties(book, xml2) {
|
|
|
80215
80230
|
"xlsx:HyperlinksChanged": ["HyperlinksChanged", "bool"],
|
|
80216
80231
|
"gsf:security": ["DocSecurity", "int"]
|
|
80217
80232
|
};
|
|
80218
|
-
const
|
|
80219
|
-
const sorted = Object.entries(book.properties ?? {}).map(([key2, value3]) => ({ key: key2, value: value3, bytes:
|
|
80233
|
+
const encoder3 = new TextEncoder();
|
|
80234
|
+
const sorted = Object.entries(book.properties ?? {}).map(([key2, value3]) => ({ key: key2, value: value3, bytes: encoder3.encode(key2) })).sort((a3, b3) => {
|
|
80220
80235
|
for (let index2 = 0; index2 < Math.min(a3.bytes.length, b3.bytes.length); index2++) {
|
|
80221
80236
|
const diff = a3.bytes[index2] - b3.bytes[index2];
|
|
80222
80237
|
if (diff) return diff;
|
|
@@ -80293,16 +80308,16 @@ function nativeOpenFormula(source, position, context2, arrayStringLiterals = fal
|
|
|
80293
80308
|
return serializeExpression(parsed.document, gnumericGrammar, false, true, { relativeSheets: "fixed" });
|
|
80294
80309
|
}
|
|
80295
80310
|
function readFormulaSemantics(node3) {
|
|
80296
|
-
const value3 = node3?.attributes.find((
|
|
80311
|
+
const value3 = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "array-string-literals")?.value;
|
|
80297
80312
|
if (value3 !== void 0 && value3 !== "0" && value3 !== "1")
|
|
80298
80313
|
throw new SsconvertError("io", "Invalid ssconvert formula array string semantics");
|
|
80299
80314
|
return value3 === "1" ? { arrayStringLiterals: true } : {};
|
|
80300
80315
|
}
|
|
80301
80316
|
function readOpenFormula(node3) {
|
|
80302
|
-
const source = node3?.attributes.find((
|
|
80317
|
+
const source = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "openformula")?.value;
|
|
80303
80318
|
if (source === void 0) return void 0;
|
|
80304
80319
|
if (!source.startsWith("of:=")) throw new SsconvertError("io", "Invalid ssconvert OpenFormula expression");
|
|
80305
|
-
const anchor = node3?.attributes.find((
|
|
80320
|
+
const anchor = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "openformula-origin")?.value;
|
|
80306
80321
|
if (anchor === void 0) return { source };
|
|
80307
80322
|
let values3;
|
|
80308
80323
|
try {
|
|
@@ -80356,22 +80371,22 @@ async function recognize(root, schema, context2) {
|
|
|
80356
80371
|
context2.signal.throwIfAborted();
|
|
80357
80372
|
const matches = edges2.get(parent + ":" + node3.localName) ?? [];
|
|
80358
80373
|
const scans = ancestors.length === 0 || xlsxNamespaceScanElements.has(ancestors[ancestors.length - 1]);
|
|
80359
|
-
let
|
|
80360
|
-
if (scans) for (const
|
|
80361
|
-
if (
|
|
80362
|
-
const key2 = Object.keys(xlsxNamespaces).find((key3) => xlsxNamespaces[key3].includes(
|
|
80363
|
-
if (
|
|
80364
|
-
if (key2)
|
|
80374
|
+
let namespace6 = inheritedNamespace;
|
|
80375
|
+
if (scans) for (const attribute7 of node3.attributes) {
|
|
80376
|
+
if (attribute7.namespace !== "http://www.w3.org/2000/xmlns/") continue;
|
|
80377
|
+
const key2 = Object.keys(xlsxNamespaces).find((key3) => xlsxNamespaces[key3].includes(attribute7.value));
|
|
80378
|
+
if (attribute7.name === "xmlns") {
|
|
80379
|
+
if (key2) namespace6 = key2;
|
|
80365
80380
|
} else if (key2) {
|
|
80366
|
-
const prefix3 =
|
|
80381
|
+
const prefix3 = attribute7.localName;
|
|
80367
80382
|
if (!prefixes.has(prefix3)) {
|
|
80368
80383
|
prefixes.set(prefix3, key2);
|
|
80369
80384
|
if (!namespacePrefixes.has(key2)) namespacePrefixes.set(key2, prefix3);
|
|
80370
80385
|
}
|
|
80371
|
-
} else unknownPrefixes.add(
|
|
80386
|
+
} else unknownPrefixes.add(attribute7.localName);
|
|
80372
80387
|
}
|
|
80373
80388
|
const colon = node3.name.indexOf(":"), prefix2 = colon < 0 ? void 0 : node3.name.slice(0, colon);
|
|
80374
|
-
const match3 = matches.find((m) => prefix2 === void 0 ? m[2] ===
|
|
80389
|
+
const match3 = matches.find((m) => prefix2 === void 0 ? m[2] === namespace6 : namespacePrefixes.get(m[2]) === prefix2);
|
|
80375
80390
|
if (!match3) {
|
|
80376
80391
|
if (prefix2 !== void 0 && unknownPrefixes.has(prefix2)) return void 0;
|
|
80377
80392
|
const message = `Unexpected element '${node3.name}' in state :
|
|
@@ -80388,17 +80403,17 @@ async function recognize(root, schema, context2) {
|
|
|
80388
80403
|
if (node3.localName === "ext") return node3;
|
|
80389
80404
|
const accepted2 = [];
|
|
80390
80405
|
for (const item of node3.children) {
|
|
80391
|
-
const child7 = await visit(item, match3[1], [...ancestors, node3.localName],
|
|
80406
|
+
const child7 = await visit(item, match3[1], [...ancestors, node3.localName], namespace6);
|
|
80392
80407
|
if (child7) accepted2.push(child7);
|
|
80393
80408
|
}
|
|
80394
80409
|
return {
|
|
80395
80410
|
...node3,
|
|
80396
80411
|
namespace: xlsxNamespaces[match3[2]]?.[0] ?? node3.namespace,
|
|
80397
80412
|
children: accepted2,
|
|
80398
|
-
attributes: node3.attributes.map((
|
|
80399
|
-
const colon2 =
|
|
80400
|
-
const key2 = colon2 < 0 ? void 0 : prefixes.get(
|
|
80401
|
-
return key2 ? { ...
|
|
80413
|
+
attributes: node3.attributes.map((attribute7) => {
|
|
80414
|
+
const colon2 = attribute7.name.indexOf(":");
|
|
80415
|
+
const key2 = colon2 < 0 ? void 0 : prefixes.get(attribute7.name.slice(0, colon2));
|
|
80416
|
+
return key2 ? { ...attribute7, namespace: xlsxNamespaces[key2][0] } : attribute7;
|
|
80402
80417
|
})
|
|
80403
80418
|
};
|
|
80404
80419
|
}
|
|
@@ -80416,8 +80431,8 @@ function children3(node3, name5) {
|
|
|
80416
80431
|
function child4(node3, name5) {
|
|
80417
80432
|
return children3(node3, name5)[0];
|
|
80418
80433
|
}
|
|
80419
|
-
function attr2(node3, name5,
|
|
80420
|
-
return node3?.attributes.find((item) => item.localName === name5 && item.namespace ===
|
|
80434
|
+
function attr2(node3, name5, namespace6 = "") {
|
|
80435
|
+
return node3?.attributes.find((item) => item.localName === name5 && item.namespace === namespace6)?.value;
|
|
80421
80436
|
}
|
|
80422
80437
|
function number2(value3, fallback = 0) {
|
|
80423
80438
|
if (value3 === void 0) return fallback;
|
|
@@ -81047,8 +81062,8 @@ function createXlsxWriter(edition) {
|
|
|
81047
81062
|
}) };
|
|
81048
81063
|
}) };
|
|
81049
81064
|
}
|
|
81050
|
-
const
|
|
81051
|
-
const styles = createXlsxStyles(xml2, edition,
|
|
81065
|
+
const namespace6 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
81066
|
+
const styles = createXlsxStyles(xml2, edition, namespace6, charge);
|
|
81052
81067
|
const zip = createZipCodec();
|
|
81053
81068
|
const bounds2 = {
|
|
81054
81069
|
...zipLimits(context2),
|
|
@@ -81060,20 +81075,20 @@ function createXlsxWriter(edition) {
|
|
|
81060
81075
|
const entries = [], types3 = [
|
|
81061
81076
|
{ name: "xl/workbook.xml", type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" }
|
|
81062
81077
|
];
|
|
81063
|
-
const
|
|
81078
|
+
const encoder3 = new TextEncoder();
|
|
81064
81079
|
let plainBytes = 0;
|
|
81065
81080
|
const declaration = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
81066
81081
|
const modified = new Date(context2.clock?.now() ?? Date.UTC(2e3, 0, 1));
|
|
81067
81082
|
async function add5(name5, content2, type) {
|
|
81068
81083
|
context2.signal.throwIfAborted();
|
|
81069
81084
|
charge(content2.length);
|
|
81070
|
-
const length =
|
|
81085
|
+
const length = encoder3.encode(declaration + content2 + "\n").length;
|
|
81071
81086
|
if (length > context2.limits.outputBytes - plainBytes) limit("output bytes");
|
|
81072
81087
|
if (entries.length >= bounds2.maxMembers) limit("members");
|
|
81073
81088
|
plainBytes += length;
|
|
81074
81089
|
entries.push(await zip.makeZipEntry(
|
|
81075
81090
|
name5,
|
|
81076
|
-
|
|
81091
|
+
encoder3.encode(declaration + content2 + "\n"),
|
|
81077
81092
|
{ modified, mode: 420, directory: false, symlink: false, compression: "deflate" },
|
|
81078
81093
|
bounds2,
|
|
81079
81094
|
context2.signal
|
|
@@ -81238,7 +81253,7 @@ function createXlsxWriter(edition) {
|
|
|
81238
81253
|
};
|
|
81239
81254
|
for (const [gnm, xlsx, invert] of [["DisplayFormulas", "showFormulas", false], ["HideZero", "showZeros", true], ["HideGrid", "showGridLines", true], ["HideColHeader", "showRowColHeaders", true], ["DisplayOutlines", "showOutlineSymbols", false], ["RTL_Layout", "rightToLeft", false]])
|
|
81240
81255
|
if (view2[gnm] !== void 0) viewAttrs[xlsx] = (invert ? !Number(view2[gnm]) : !!Number(view2[gnm])) ? 1 : 0;
|
|
81241
|
-
const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context2,
|
|
81256
|
+
const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context2, namespace6, exportXlsxFormula.bind(null, book), styles, charge);
|
|
81242
81257
|
let cols = "", nextColumn = 0;
|
|
81243
81258
|
for (const c4 of [...sheet.columns ?? []].sort((a3, b3) => a3.index - b3.index)) {
|
|
81244
81259
|
const importedColumn = metadataNode(c4.style?.gnumeric, charge);
|
|
@@ -81285,7 +81300,7 @@ function createXlsxWriter(edition) {
|
|
|
81285
81300
|
}
|
|
81286
81301
|
const sheetXml = xml2(
|
|
81287
81302
|
"worksheet",
|
|
81288
|
-
{ xmlns:
|
|
81303
|
+
{ xmlns: namespace6, "xmlns:r": relationships, "xmlns:gnmx": "http://www.gnumeric.org/ext/spreadsheetml" },
|
|
81289
81304
|
metadata3.properties + xml2("dimension", { ref: dimension }) + xml2("sheetViews", {}, xml2("sheetView", viewAttrs, xml2("selection", { activeCell: "A1", sqref: "A1" }))) + metadata3.format + xml2("cols", {}, cols) + xml2("sheetData", {}, sheetData) + metadata3.protection + metadata3.filters + (sheet.merges?.length ? xml2("mergeCells", {}, sheet.merges.map((r) => xml2("mergeCell", { ref: rangeText(r) })).join("")) : "") + metadata3.rules + (hyperlinks ? xml2("hyperlinks", {}, hyperlinks) : "") + metadata3.print + (legacyDrawing ? xml2("legacyDrawing", { "r:id": legacyDrawing }) : "")
|
|
81290
81305
|
);
|
|
81291
81306
|
const partName = `worksheets/sheet${index2 + 1}.xml`;
|
|
@@ -81296,7 +81311,7 @@ function createXlsxWriter(edition) {
|
|
|
81296
81311
|
sheetNodes.push(xml2("sheet", { name: sheet.name, sheetId: index2 + 1, "r:id": id }));
|
|
81297
81312
|
}
|
|
81298
81313
|
if (shared.length) {
|
|
81299
|
-
await add5("xl/sharedStrings.xml", xml2("sst", { xmlns:
|
|
81314
|
+
await add5("xl/sharedStrings.xml", xml2("sst", { xmlns: namespace6, uniqueCount: shared.length, count: shared.length }, shared.map((cell) => xml2("si", {}, writeRichString(cell.value.kind === "string" ? cell.value.value : "", cell.richText, xml2, charge))).join("")), "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
|
|
81300
81315
|
workbookRelations.push({ id: `rId${workbookRelations.length + 1}`, type: relationships + "/sharedStrings", target: "sharedStrings.xml" });
|
|
81301
81316
|
}
|
|
81302
81317
|
await add5("xl/styles.xml", styles.serialize(), "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
|
|
@@ -81329,7 +81344,7 @@ function createXlsxWriter(edition) {
|
|
|
81329
81344
|
}
|
|
81330
81345
|
await add5("xl/workbook.xml", xml2(
|
|
81331
81346
|
"workbook",
|
|
81332
|
-
{ xmlns:
|
|
81347
|
+
{ xmlns: namespace6, "xmlns:r": relationships },
|
|
81333
81348
|
xml2("fileVersion", { lastEdited: 4, lowestEdited: 4, rupBuild: 3820 }) + xml2("workbookPr", { date1904: book.dateSystem === "1904" ? 1 : 0 }) + xml2("bookViews", {}, xml2("workbookView", { activeTab: active })) + xml2("sheets", {}, sheetNodes.join("")) + xml2("definedNames", {}, names2) + xml2("calcPr", {
|
|
81334
81349
|
calcMode: book.calculationMode === "manual" ? "manual" : "auto",
|
|
81335
81350
|
iterate: book.iteration?.enabled === false ? 0 : 1,
|
|
@@ -81486,8 +81501,8 @@ import { parseXmlSteps as parseXmlSteps4, XmlLimitError as XmlLimitError2 } from
|
|
|
81486
81501
|
init_platform();
|
|
81487
81502
|
var xl = "urn:schemas-microsoft-com:office:excel";
|
|
81488
81503
|
var gnumeric = "http://www.gnumeric.org/v10.dtd";
|
|
81489
|
-
function node(name5, attributes4 = {},
|
|
81490
|
-
return { name: name5, namespace: gnumeric, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), text: "", children:
|
|
81504
|
+
function node(name5, attributes4 = {}, children8 = []) {
|
|
81505
|
+
return { name: name5, namespace: gnumeric, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), text: "", children: children8 };
|
|
81491
81506
|
}
|
|
81492
81507
|
function readSpreadsheetMLMetadata(worksheet, sheet, context2, chargeWorkbookWork) {
|
|
81493
81508
|
const result2 = [];
|
|
@@ -81766,14 +81781,14 @@ async function recognize2(root, context2, positions, warnings) {
|
|
|
81766
81781
|
async function visit(node3, parent, ancestors, inherited) {
|
|
81767
81782
|
context2.signal.throwIfAborted();
|
|
81768
81783
|
const start = position++;
|
|
81769
|
-
let
|
|
81784
|
+
let namespace6 = inherited;
|
|
81770
81785
|
const defaultNamespace = node3.attributes.find((a3) => a3.name === "xmlns");
|
|
81771
|
-
if (defaultNamespace)
|
|
81786
|
+
if (defaultNamespace) namespace6 = Object.keys(namespaces).find((key2) => namespaces[key2].includes(defaultNamespace.value)) ?? "";
|
|
81772
81787
|
if (parent === "START" || parent === "WORKBOOK") for (const a3 of node3.attributes) {
|
|
81773
81788
|
if (a3.namespace !== "http://www.w3.org/2000/xmlns/") continue;
|
|
81774
81789
|
const key2 = Object.keys(namespaces).find((key3) => namespaces[key3].includes(a3.value));
|
|
81775
81790
|
if (a3.name === "xmlns") {
|
|
81776
|
-
if (key2)
|
|
81791
|
+
if (key2) namespace6 = key2;
|
|
81777
81792
|
} else if (key2) {
|
|
81778
81793
|
if (!prefixes.has(a3.localName)) {
|
|
81779
81794
|
prefixes.set(a3.localName, key2);
|
|
@@ -81782,7 +81797,7 @@ async function recognize2(root, context2, positions, warnings) {
|
|
|
81782
81797
|
} else unknown.add(a3.localName);
|
|
81783
81798
|
}
|
|
81784
81799
|
const colon = node3.name.indexOf(":"), prefix2 = colon < 0 ? void 0 : node3.name.slice(0, colon);
|
|
81785
|
-
const match3 = spreadsheetmlSchema.find((n) => n[0] === parent && n[3] === node3.localName && (prefix2 === void 0 ? n[2] ===
|
|
81800
|
+
const match3 = spreadsheetmlSchema.find((n) => n[0] === parent && n[3] === node3.localName && (prefix2 === void 0 ? n[2] === namespace6 : primary.get(n[2]) === prefix2));
|
|
81786
81801
|
if (!match3) {
|
|
81787
81802
|
if (prefix2 === void 0 || !unknown.has(prefix2)) {
|
|
81788
81803
|
const message = `Unexpected element '${node3.name}' in state :
|
|
@@ -81794,7 +81809,7 @@ async function recognize2(root, context2, positions, warnings) {
|
|
|
81794
81809
|
}
|
|
81795
81810
|
const accepted2 = [];
|
|
81796
81811
|
for (const child7 of node3.children) {
|
|
81797
|
-
const value3 = await visit(child7, match3[1], [...ancestors, node3.localName],
|
|
81812
|
+
const value3 = await visit(child7, match3[1], [...ancestors, node3.localName], namespace6);
|
|
81798
81813
|
if (value3) accepted2.push(value3);
|
|
81799
81814
|
}
|
|
81800
81815
|
const result2 = {
|
|
@@ -81811,8 +81826,8 @@ async function recognize2(root, context2, positions, warnings) {
|
|
|
81811
81826
|
}
|
|
81812
81827
|
return visit(root, "START", [], "");
|
|
81813
81828
|
}
|
|
81814
|
-
function children4(node3, name5,
|
|
81815
|
-
return node3?.children.filter((n) => n.localName === name5 && n.namespace === namespaces[
|
|
81829
|
+
function children4(node3, name5, namespace6 = "SS") {
|
|
81830
|
+
return node3?.children.filter((n) => n.localName === name5 && n.namespace === namespaces[namespace6][0]) ?? [];
|
|
81816
81831
|
}
|
|
81817
81832
|
function attr3(node3, name5) {
|
|
81818
81833
|
return node3?.attributes.find((a3) => a3.localName === name5 && a3.namespace === namespaces.SS[0])?.value;
|
|
@@ -81826,11 +81841,11 @@ function content(node3) {
|
|
|
81826
81841
|
function styleMetadata(style2) {
|
|
81827
81842
|
const attributes4 = [], nested = [];
|
|
81828
81843
|
const color5 = (value3) => value3.startsWith("#") && value3.length === 7 ? [value3.slice(1, 3), value3.slice(3, 5), value3.slice(5, 7)].map((c4) => (parseInt(c4, 16) * 257).toString(16).toUpperCase()).join(":") : value3;
|
|
81829
|
-
const node3 = (name5, values3,
|
|
81844
|
+
const node3 = (name5, values3, children8 = [], text2 = "") => ({
|
|
81830
81845
|
name: name5,
|
|
81831
81846
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
81832
81847
|
text: text2,
|
|
81833
|
-
children:
|
|
81848
|
+
children: children8,
|
|
81834
81849
|
attributes: Object.entries(values3).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(name6 === "Color" ? color5(String(value3)) : value3) }))
|
|
81835
81850
|
});
|
|
81836
81851
|
const fullStyle = {
|
|
@@ -82182,17 +82197,17 @@ async function readSpreadsheetML(bytes, context2) {
|
|
|
82182
82197
|
charge();
|
|
82183
82198
|
const origin = colIndex;
|
|
82184
82199
|
let across = 0, down = 0, explicit;
|
|
82185
|
-
for (const
|
|
82186
|
-
if (
|
|
82187
|
-
if (
|
|
82200
|
+
for (const attribute7 of node3.attributes) {
|
|
82201
|
+
if (attribute7.namespace !== namespaces.SS[0]) continue;
|
|
82202
|
+
if (attribute7.localName === "Index") {
|
|
82188
82203
|
const index3 = await numeric4(node3, "Index", colIndex + 1, true, name5, rowIndex, colIndex);
|
|
82189
82204
|
if (index3 > 0) colIndex = index3 - 1;
|
|
82190
|
-
} else if (
|
|
82191
|
-
const result2 = await formula3(
|
|
82205
|
+
} else if (attribute7.localName === "Formula") {
|
|
82206
|
+
const result2 = await formula3(attribute7.value, name5, rowIndex, origin, colIndex);
|
|
82192
82207
|
if (result2 !== void 0) pending = result2;
|
|
82193
|
-
} else if (
|
|
82194
|
-
else if (
|
|
82195
|
-
else if (
|
|
82208
|
+
} else if (attribute7.localName === "MergeAcross") across = await numeric4(node3, "MergeAcross", 0, true, name5, rowIndex, colIndex);
|
|
82209
|
+
else if (attribute7.localName === "MergeDown") down = await numeric4(node3, "MergeDown", 0, true, name5, rowIndex, colIndex);
|
|
82210
|
+
else if (attribute7.localName === "StyleID") explicit = styles.get(attribute7.value);
|
|
82196
82211
|
}
|
|
82197
82212
|
if (rowIndex >= 1048576 || colIndex >= 16384) limit2("cell coordinates");
|
|
82198
82213
|
const columnStyle = columns.get(colIndex)?.style;
|
|
@@ -84865,20 +84880,20 @@ var EntityDecoder2 = class {
|
|
|
84865
84880
|
};
|
|
84866
84881
|
function getDecoder(decodeTree) {
|
|
84867
84882
|
let ret = "";
|
|
84868
|
-
const
|
|
84883
|
+
const decoder2 = new EntityDecoder2(decodeTree, (str2) => ret += fromCodePoint2(str2));
|
|
84869
84884
|
return function decodeWithTrie(str2, decodeMode) {
|
|
84870
84885
|
let lastIndex = 0;
|
|
84871
84886
|
let offset = 0;
|
|
84872
84887
|
while ((offset = str2.indexOf("&", offset)) >= 0) {
|
|
84873
84888
|
ret += str2.slice(lastIndex, offset);
|
|
84874
|
-
|
|
84875
|
-
const len5 =
|
|
84889
|
+
decoder2.startEntity(decodeMode);
|
|
84890
|
+
const len5 = decoder2.write(
|
|
84876
84891
|
str2,
|
|
84877
84892
|
// Skip the "&"
|
|
84878
84893
|
offset + 1
|
|
84879
84894
|
);
|
|
84880
84895
|
if (len5 < 0) {
|
|
84881
|
-
lastIndex = offset +
|
|
84896
|
+
lastIndex = offset + decoder2.end();
|
|
84882
84897
|
break;
|
|
84883
84898
|
}
|
|
84884
84899
|
lastIndex = offset + len5;
|
|
@@ -86001,8 +86016,8 @@ function probeHtml(bytes, context2) {
|
|
|
86001
86016
|
return text2.includes("<table") || text2.includes("<html") || text2.includes("<!doctype html");
|
|
86002
86017
|
}
|
|
86003
86018
|
var namespace3 = "http://www.gnumeric.org/v10.dtd";
|
|
86004
|
-
function record4(name5, attributes4,
|
|
86005
|
-
return { name: name5, namespace: namespace3, text: text2, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), children:
|
|
86019
|
+
function record4(name5, attributes4, children8 = [], text2 = "") {
|
|
86020
|
+
return { name: name5, namespace: namespace3, text: text2, attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), children: children8 };
|
|
86006
86021
|
}
|
|
86007
86022
|
function span(source) {
|
|
86008
86023
|
if (source === void 0) return 1;
|
|
@@ -86386,36 +86401,36 @@ function createHtmlWriter(profile) {
|
|
|
86386
86401
|
for (const run of cell.richText) {
|
|
86387
86402
|
tick();
|
|
86388
86403
|
if (from < run.start || from >= run.end) continue;
|
|
86389
|
-
for (const [key2,
|
|
86404
|
+
for (const [key2, attribute7] of Object.entries(run.attributes)) {
|
|
86390
86405
|
tick();
|
|
86391
|
-
attributes4.set(key2,
|
|
86406
|
+
attributes4.set(key2, attribute7);
|
|
86392
86407
|
}
|
|
86393
86408
|
}
|
|
86394
|
-
for (const [key2,
|
|
86409
|
+
for (const [key2, attribute7] of attributes4) {
|
|
86395
86410
|
tick();
|
|
86396
86411
|
let open = "", close = "";
|
|
86397
|
-
if (key2 === "bold" && Number(
|
|
86412
|
+
if (key2 === "bold" && Number(attribute7)) {
|
|
86398
86413
|
open = "<b>";
|
|
86399
86414
|
close = "</b>";
|
|
86400
86415
|
}
|
|
86401
|
-
if (key2 === "italic" && Number(
|
|
86416
|
+
if (key2 === "italic" && Number(attribute7)) {
|
|
86402
86417
|
open = "<i>";
|
|
86403
86418
|
close = "</i>";
|
|
86404
86419
|
}
|
|
86405
|
-
if (key2 === "strikethrough" && Number(
|
|
86420
|
+
if (key2 === "strikethrough" && Number(attribute7)) {
|
|
86406
86421
|
open = profile.legacy ? "<strike>" : '<span style="text-decoration: line-through;">';
|
|
86407
86422
|
close = profile.legacy ? "</strike>" : "</span>";
|
|
86408
86423
|
}
|
|
86409
|
-
if (key2 === "underline" &&
|
|
86410
|
-
const value4 = String(
|
|
86424
|
+
if (key2 === "underline" && attribute7 !== "none") {
|
|
86425
|
+
const value4 = String(attribute7);
|
|
86411
86426
|
const name5 = Object.hasOwn(richUnderlineClasses, value4) ? richUnderlineClasses[value4] : void 0;
|
|
86412
86427
|
if (name5) {
|
|
86413
86428
|
open = profile.legacy ? "<u>" : `<span class="${name5}">`;
|
|
86414
86429
|
close = profile.legacy ? "</u>" : "</span>";
|
|
86415
86430
|
}
|
|
86416
86431
|
}
|
|
86417
|
-
if (key2 === "rise" && Math.abs(Number(
|
|
86418
|
-
const sub = key2 === "subscript" || key2 === "rise" && Number(
|
|
86432
|
+
if (key2 === "rise" && Math.abs(Number(attribute7)) > 5 || key2 === "subscript" && Number(attribute7) || key2 === "superscript" && Number(attribute7)) {
|
|
86433
|
+
const sub = key2 === "subscript" || key2 === "rise" && Number(attribute7) < 0;
|
|
86419
86434
|
open = sub ? "<sub>" : "<sup>";
|
|
86420
86435
|
close = sub ? "</sub>" : "</sup>";
|
|
86421
86436
|
}
|
|
@@ -88433,7 +88448,7 @@ async function readLotusWorks(bytes, context2, formula3, decodeLmbcs) {
|
|
|
88433
88448
|
if (id === 21594) {
|
|
88434
88449
|
const font2 = fonts[data4.u8(4)], align = data4.u8(1), style3 = {};
|
|
88435
88450
|
if (font2) {
|
|
88436
|
-
for (const [bit,
|
|
88451
|
+
for (const [bit, attribute7] of [[1, "bold"], [2, "italic"], [4, "underline"], [8, "strike"]]) style3[attribute7] = !!(font2.variant & bit);
|
|
88437
88452
|
if (font2.size) style3.fontSize = font2.size / 2;
|
|
88438
88453
|
if (font2.variant & 240) style3.fontColor = colors[font2.variant >> 4 & 15];
|
|
88439
88454
|
style3.fontName = font2.name;
|
|
@@ -91333,13 +91348,13 @@ init_platform();
|
|
|
91333
91348
|
|
|
91334
91349
|
// packages/safe-bash-command-ssconvert/src/codecs/mps.ts
|
|
91335
91350
|
init_platform();
|
|
91336
|
-
function solverRecord(attributes4,
|
|
91351
|
+
function solverRecord(attributes4, children8 = []) {
|
|
91337
91352
|
return {
|
|
91338
91353
|
name: "Solver",
|
|
91339
91354
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
91340
91355
|
text: "",
|
|
91341
91356
|
attributes: Object.entries(attributes4).map(([name5, value3]) => ({ name: name5, namespace: "", value: value3 })),
|
|
91342
|
-
children:
|
|
91357
|
+
children: children8
|
|
91343
91358
|
};
|
|
91344
91359
|
}
|
|
91345
91360
|
function constraintRecord(type, lhs, rhs) {
|
|
@@ -91553,12 +91568,12 @@ init_platform();
|
|
|
91553
91568
|
// packages/safe-bash-command-ssconvert/src/codecs/sylk-styles.ts
|
|
91554
91569
|
init_platform();
|
|
91555
91570
|
function sylkStyleNode(style2) {
|
|
91556
|
-
function node3(name5, attributes4,
|
|
91571
|
+
function node3(name5, attributes4, children8 = [], text2 = "") {
|
|
91557
91572
|
return {
|
|
91558
91573
|
name: name5,
|
|
91559
91574
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
91560
91575
|
text: text2,
|
|
91561
|
-
children:
|
|
91576
|
+
children: children8,
|
|
91562
91577
|
attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) }))
|
|
91563
91578
|
};
|
|
91564
91579
|
}
|
|
@@ -93542,8 +93557,8 @@ function invalid4(message) {
|
|
|
93542
93557
|
function unsupported4(message = "package") {
|
|
93543
93558
|
throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: encrypted OpenDocument ${message}`);
|
|
93544
93559
|
}
|
|
93545
|
-
function attribute3(node3, name5,
|
|
93546
|
-
return node3?.attributes.find((a3) => a3.namespace ===
|
|
93560
|
+
function attribute3(node3, name5, namespace6 = manifestNamespace) {
|
|
93561
|
+
return node3?.attributes.find((a3) => a3.namespace === namespace6 && a3.localName === name5)?.value;
|
|
93547
93562
|
}
|
|
93548
93563
|
function child5(node3, name5, optional = false) {
|
|
93549
93564
|
const found = node3.children.filter((c4) => c4.namespace === manifestNamespace && c4.localName === name5);
|
|
@@ -94498,8 +94513,8 @@ var namespaces2 = {
|
|
|
94498
94513
|
svg: [odfNamespaces.svg, "http://www.w3.org/2000/svg"],
|
|
94499
94514
|
gnm: [odfNamespaces.gnm]
|
|
94500
94515
|
};
|
|
94501
|
-
function attribute4(node3, name5,
|
|
94502
|
-
return node3.attributes.find((a3) => a3.localName === name5 && namespaces2[
|
|
94516
|
+
function attribute4(node3, name5, namespace6) {
|
|
94517
|
+
return node3.attributes.find((a3) => a3.localName === name5 && namespaces2[namespace6].includes(a3.namespace))?.value;
|
|
94503
94518
|
}
|
|
94504
94519
|
function pointSize(source) {
|
|
94505
94520
|
if (!source) return void 0;
|
|
@@ -94662,11 +94677,11 @@ var ns = {
|
|
|
94662
94677
|
xlink: ["http://www.w3.org/1999/xlink"],
|
|
94663
94678
|
gnm: ["http://www.gnumeric.org/odf-extension/1.0"]
|
|
94664
94679
|
};
|
|
94665
|
-
function attr4(node3, name5,
|
|
94666
|
-
return node3?.attributes.find((a3) => a3.localName === name5 && ns[
|
|
94680
|
+
function attr4(node3, name5, namespace6) {
|
|
94681
|
+
return node3?.attributes.find((a3) => a3.localName === name5 && ns[namespace6].includes(a3.namespace))?.value;
|
|
94667
94682
|
}
|
|
94668
|
-
function gnode2(name5, attributes4 = {},
|
|
94669
|
-
return { name: name5, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), children:
|
|
94683
|
+
function gnode2(name5, attributes4 = {}, children8 = [], text2 = "") {
|
|
94684
|
+
return { name: name5, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) })), children: children8, text: text2 };
|
|
94670
94685
|
}
|
|
94671
94686
|
function object2(value3) {
|
|
94672
94687
|
return value3 !== null && typeof value3 === "object" && !Array.isArray(value3) ? value3 : void 0;
|
|
@@ -94918,7 +94933,7 @@ function readOdfLabelRanges(parent, sheets, context2, charge) {
|
|
|
94918
94933
|
function invalid10() {
|
|
94919
94934
|
throw new SsconvertError("io", "E Invalid OpenDocument: invalid label range");
|
|
94920
94935
|
}
|
|
94921
|
-
function
|
|
94936
|
+
function attribute7(node3, name5) {
|
|
94922
94937
|
return node3.attributes.find((a3) => a3.localName === name5 && tableNamespaces.includes(a3.namespace))?.value;
|
|
94923
94938
|
}
|
|
94924
94939
|
function address(source) {
|
|
@@ -94947,10 +94962,10 @@ function readOdfLabelRanges(parent, sheets, context2, charge) {
|
|
|
94947
94962
|
for (const node3 of container.children) {
|
|
94948
94963
|
charge();
|
|
94949
94964
|
if (node3.localName !== "label-range" || !tableNamespaces.includes(node3.namespace)) continue;
|
|
94950
|
-
const axis =
|
|
94965
|
+
const axis = attribute7(node3, "orientation");
|
|
94951
94966
|
if (axis !== "row" && axis !== "column") invalid10();
|
|
94952
|
-
const labels = address(
|
|
94953
|
-
const data4 = address(
|
|
94967
|
+
const labels = address(attribute7(node3, "label-cell-range-address"));
|
|
94968
|
+
const data4 = address(attribute7(node3, "data-cell-range-address"));
|
|
94954
94969
|
include(labels.sheet, labels.range);
|
|
94955
94970
|
include(data4.sheet, data4.range);
|
|
94956
94971
|
let pairs = ranges2.get(labels.sheet.id);
|
|
@@ -95350,8 +95365,8 @@ function createOdfStyleDefinitions(book, xml2) {
|
|
|
95350
95365
|
if (!node3 || !name5 || !Array.isArray(node3.attributes)) continue;
|
|
95351
95366
|
const attributes4 = node3.attributes.filter((value3) => {
|
|
95352
95367
|
xml2.charge();
|
|
95353
|
-
const
|
|
95354
|
-
return
|
|
95368
|
+
const attribute7 = odfObject(value3);
|
|
95369
|
+
return attribute7?.namespace !== odfNamespaces.style || attribute7?.name !== "name";
|
|
95355
95370
|
});
|
|
95356
95371
|
byShape.set(xml2.retained({ ...node3, attributes: attributes4 }), name5);
|
|
95357
95372
|
}
|
|
@@ -95795,13 +95810,13 @@ var odfWriterFunctionNames = Object.freeze({
|
|
|
95795
95810
|
init_platform();
|
|
95796
95811
|
async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context2, formula3, sheetNames) {
|
|
95797
95812
|
const e = xml2.element, a3 = odfAttributes(node3), base = styles.register({ style: { gnumeric: node3 }, ...a3.Format ? { format: a3.Format } : {} });
|
|
95798
|
-
const
|
|
95813
|
+
const children8 = odfChildren(node3), baseAddress = quoteFormulaString(sheet.name, "'", odfGrammar) + "." + formatA1(r.startRow, r.startColumn);
|
|
95799
95814
|
function expression2(source, name5) {
|
|
95800
95815
|
const n = odfChildren(source).find((n2) => odfObject(n2)?.name === name5), text2 = odfObject(n)?.text;
|
|
95801
95816
|
return typeof text2 === "string" ? formula3(text2.startsWith("=") ? text2 : "=" + text2, sheet, r.startRow, r.startColumn).slice(4) : "";
|
|
95802
95817
|
}
|
|
95803
95818
|
let maps = "", validationXml = "";
|
|
95804
|
-
for (const condition of
|
|
95819
|
+
for (const condition of children8.filter((n) => odfObject(n)?.name === "Condition")) {
|
|
95805
95820
|
xml2.charge();
|
|
95806
95821
|
const a4 = odfAttributes(condition), op = Number(a4.Operator), overlay = odfChildren(condition).find((n) => odfObject(n)?.name === "Style");
|
|
95807
95822
|
const first = expression2(condition, "Expression0"), last2 = expression2(condition, "Expression1");
|
|
@@ -95816,7 +95831,7 @@ async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context2, formu
|
|
|
95816
95831
|
}
|
|
95817
95832
|
const styleName = maps ? id + "c" : base.name;
|
|
95818
95833
|
const styleXml = maps ? e("style:style", { "style:name": styleName, "style:family": "table-cell", "style:parent-style-name": base.name }, maps) : "";
|
|
95819
|
-
const validation =
|
|
95834
|
+
const validation = children8.find((n) => odfObject(n)?.name === "Validation"), input = children8.find((n) => odfObject(n)?.name === "InputMessage");
|
|
95820
95835
|
let validationName;
|
|
95821
95836
|
if (validation || input) {
|
|
95822
95837
|
const a4 = odfAttributes(validation), type = (a4.Type ?? "GNM_VALIDATION_TYPE_ANY").slice("GNM_VALIDATION_TYPE_".length), op = (a4.Operator ?? "GNM_VALIDATION_OP_NONE").slice("GNM_VALIDATION_OP_".length);
|
|
@@ -95846,7 +95861,7 @@ async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context2, formu
|
|
|
95846
95861
|
}, content2);
|
|
95847
95862
|
}
|
|
95848
95863
|
}
|
|
95849
|
-
const link =
|
|
95864
|
+
const link = children8.find((n) => odfObject(n)?.name === "HyperLink"), linkAttributes = odfAttributes(link);
|
|
95850
95865
|
return { styleName, styleXml, validationName, validationXml, ...linkAttributes.target ? { link: {
|
|
95851
95866
|
"xlink:href": linkAttributes.type === "GnmHLinkCurWB" ? translateOdfHyperlink(linkAttributes.target, "export", xml2.charge, sheetNames) : linkAttributes.target,
|
|
95852
95867
|
"xlink:type": "simple",
|
|
@@ -97258,12 +97273,12 @@ function createOdfWriter(profile) {
|
|
|
97258
97273
|
});
|
|
97259
97274
|
}
|
|
97260
97275
|
spreadsheet = prelude + (validations ? e("table:content-validations", {}, validations) : "") + spreadsheet + (labelRanges ? e("table:label-ranges", {}, labelRanges) : "") + names2() + databaseRanges;
|
|
97261
|
-
const parts = /* @__PURE__ */ new Map(),
|
|
97276
|
+
const parts = /* @__PURE__ */ new Map(), encoder3 = new TextEncoder();
|
|
97262
97277
|
if (wrapped) context2.own(() => {
|
|
97263
97278
|
for (const bytes of parts.values()) bytes.fill(0);
|
|
97264
97279
|
});
|
|
97265
97280
|
function part(name5, value3) {
|
|
97266
|
-
parts.set(name5,
|
|
97281
|
+
parts.set(name5, encoder3.encode(value3));
|
|
97267
97282
|
}
|
|
97268
97283
|
part("mimetype", "application/vnd.oasis.opendocument.spreadsheet");
|
|
97269
97284
|
part("content.xml", xml2.document("office:document-content", e("office:scripts") + e("office:font-face-decls", {}, definitions3.render("fonts")) + e("office:automatic-styles", {}, definitions3.render("contentAutomatic") + automatic + cellStyles.styles.join("")) + e("office:body", {}, e("office:spreadsheet", {}, spreadsheet))));
|
|
@@ -97368,7 +97383,7 @@ function createOdfWriter(profile) {
|
|
|
97368
97383
|
);
|
|
97369
97384
|
return await packageParts(/* @__PURE__ */ new Map([
|
|
97370
97385
|
["mimetype", mime],
|
|
97371
|
-
["META-INF/manifest.xml",
|
|
97386
|
+
["META-INF/manifest.xml", encoder3.encode(manifest)],
|
|
97372
97387
|
["encrypted-package", member.bytes]
|
|
97373
97388
|
]), encrypted);
|
|
97374
97389
|
} finally {
|
|
@@ -101609,12 +101624,12 @@ var PDFPageLeaf = (
|
|
|
101609
101624
|
return this.context.lookupMaybe(numberOrRef, PDFNumber_default);
|
|
101610
101625
|
};
|
|
101611
101626
|
PDFPageLeaf2.prototype.getInheritableAttribute = function(name5) {
|
|
101612
|
-
var
|
|
101627
|
+
var attribute7;
|
|
101613
101628
|
this.ascend(function(node3) {
|
|
101614
|
-
if (!
|
|
101615
|
-
|
|
101629
|
+
if (!attribute7)
|
|
101630
|
+
attribute7 = node3.get(name5);
|
|
101616
101631
|
});
|
|
101617
|
-
return
|
|
101632
|
+
return attribute7;
|
|
101618
101633
|
};
|
|
101619
101634
|
PDFPageLeaf2.prototype.setParent = function(parentRef) {
|
|
101620
101635
|
this.set(PDFName_default.Parent, parentRef);
|
|
@@ -106820,12 +106835,12 @@ var PDFAcroField = (
|
|
|
106820
106835
|
this.clearFlag(flag3);
|
|
106821
106836
|
};
|
|
106822
106837
|
PDFAcroField2.prototype.getInheritableAttribute = function(name5) {
|
|
106823
|
-
var
|
|
106838
|
+
var attribute7;
|
|
106824
106839
|
this.ascend(function(node3) {
|
|
106825
|
-
if (!
|
|
106826
|
-
|
|
106840
|
+
if (!attribute7)
|
|
106841
|
+
attribute7 = node3.dict.get(name5);
|
|
106827
106842
|
});
|
|
106828
|
-
return
|
|
106843
|
+
return attribute7;
|
|
106829
106844
|
};
|
|
106830
106845
|
PDFAcroField2.prototype.ascend = function(visitor) {
|
|
106831
106846
|
visitor(this);
|
|
@@ -107885,12 +107900,12 @@ var flagIsSet = function(flags2, flag3) {
|
|
|
107885
107900
|
return (flags2 & flag3) !== 0;
|
|
107886
107901
|
};
|
|
107887
107902
|
var getInheritableAttribute = function(startNode, name5) {
|
|
107888
|
-
var
|
|
107903
|
+
var attribute7;
|
|
107889
107904
|
ascend(startNode, function(node3) {
|
|
107890
|
-
if (!
|
|
107891
|
-
|
|
107905
|
+
if (!attribute7)
|
|
107906
|
+
attribute7 = node3.get(name5);
|
|
107892
107907
|
});
|
|
107893
|
-
return
|
|
107908
|
+
return attribute7;
|
|
107894
107909
|
};
|
|
107895
107910
|
var ascend = function(startNode, visitor) {
|
|
107896
107911
|
visitor(startNode);
|
|
@@ -118248,8 +118263,8 @@ if (!safer.constants) {
|
|
|
118248
118263
|
var safer_1 = safer;
|
|
118249
118264
|
var BOMChar = "\uFEFF";
|
|
118250
118265
|
var PrependBOM = PrependBOMWrapper;
|
|
118251
|
-
function PrependBOMWrapper(
|
|
118252
|
-
this.encoder =
|
|
118266
|
+
function PrependBOMWrapper(encoder3, options) {
|
|
118267
|
+
this.encoder = encoder3;
|
|
118253
118268
|
this.addBOM = true;
|
|
118254
118269
|
}
|
|
118255
118270
|
PrependBOMWrapper.prototype.write = function(str2) {
|
|
@@ -118263,8 +118278,8 @@ PrependBOMWrapper.prototype.end = function() {
|
|
|
118263
118278
|
return this.encoder.end();
|
|
118264
118279
|
};
|
|
118265
118280
|
var StripBOM = StripBOMWrapper;
|
|
118266
|
-
function StripBOMWrapper(
|
|
118267
|
-
this.decoder =
|
|
118281
|
+
function StripBOMWrapper(decoder2, options) {
|
|
118282
|
+
this.decoder = decoder2;
|
|
118268
118283
|
this.pass = false;
|
|
118269
118284
|
this.options = options || {};
|
|
118270
118285
|
}
|
|
@@ -128491,9 +128506,9 @@ var lib = createCommonjsModule(function(module) {
|
|
|
128491
128506
|
iconv.defaultCharSingleByte = "?";
|
|
128492
128507
|
iconv.encode = function encode(str2, encoding, options) {
|
|
128493
128508
|
str2 = "" + (str2 || "");
|
|
128494
|
-
var
|
|
128495
|
-
var res =
|
|
128496
|
-
var trail =
|
|
128509
|
+
var encoder3 = iconv.getEncoder(encoding, options);
|
|
128510
|
+
var res = encoder3.write(str2);
|
|
128511
|
+
var trail = encoder3.end();
|
|
128497
128512
|
return trail && trail.length > 0 ? Buffer3.concat([res, trail]) : res;
|
|
128498
128513
|
};
|
|
128499
128514
|
iconv.decode = function decode5(buf, encoding, options) {
|
|
@@ -128504,9 +128519,9 @@ var lib = createCommonjsModule(function(module) {
|
|
|
128504
128519
|
}
|
|
128505
128520
|
buf = Buffer3.from("" + (buf || ""), "binary");
|
|
128506
128521
|
}
|
|
128507
|
-
var
|
|
128508
|
-
var res =
|
|
128509
|
-
var trail =
|
|
128522
|
+
var decoder2 = iconv.getDecoder(encoding, options);
|
|
128523
|
+
var res = decoder2.write(buf);
|
|
128524
|
+
var trail = decoder2.end();
|
|
128510
128525
|
return trail ? res + trail : res;
|
|
128511
128526
|
};
|
|
128512
128527
|
iconv.encodingExists = function encodingExists(enc) {
|
|
@@ -128553,14 +128568,14 @@ var lib = createCommonjsModule(function(module) {
|
|
|
128553
128568
|
return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
|
|
128554
128569
|
};
|
|
128555
128570
|
iconv.getEncoder = function getEncoder(encoding, options) {
|
|
128556
|
-
var codec = iconv.getCodec(encoding),
|
|
128557
|
-
if (codec.bomAware && options && options.addBOM)
|
|
128558
|
-
return
|
|
128571
|
+
var codec = iconv.getCodec(encoding), encoder3 = new codec.encoder(options, codec);
|
|
128572
|
+
if (codec.bomAware && options && options.addBOM) encoder3 = new bomHandling.PrependBOM(encoder3, options);
|
|
128573
|
+
return encoder3;
|
|
128559
128574
|
};
|
|
128560
128575
|
iconv.getDecoder = function getDecoder2(encoding, options) {
|
|
128561
|
-
var codec = iconv.getCodec(encoding),
|
|
128562
|
-
if (codec.bomAware && !(options && options.stripBOM === false))
|
|
128563
|
-
return
|
|
128576
|
+
var codec = iconv.getCodec(encoding), decoder2 = new codec.decoder(options, codec);
|
|
128577
|
+
if (codec.bomAware && !(options && options.stripBOM === false)) decoder2 = new bomHandling.StripBOM(decoder2, options);
|
|
128578
|
+
return decoder2;
|
|
128564
128579
|
};
|
|
128565
128580
|
var nodeVer = typeof process !== "undefined" && process.versions && process.versions.node;
|
|
128566
128581
|
if (nodeVer) {
|
|
@@ -141035,7 +141050,7 @@ var CFFGlyph = /* @__PURE__ */ (function(_Glyph) {
|
|
|
141035
141050
|
path2.moveTo(x2, y2);
|
|
141036
141051
|
open = true;
|
|
141037
141052
|
}
|
|
141038
|
-
var
|
|
141053
|
+
var parse4 = function parse5() {
|
|
141039
141054
|
while (stream2.pos < end2) {
|
|
141040
141055
|
var op = stream2.readUInt8();
|
|
141041
141056
|
if (op < 32) {
|
|
@@ -141097,7 +141112,7 @@ var CFFGlyph = /* @__PURE__ */ (function(_Glyph) {
|
|
|
141097
141112
|
var e = end2;
|
|
141098
141113
|
stream2.pos = subr.offset;
|
|
141099
141114
|
end2 = subr.offset + subr.length;
|
|
141100
|
-
|
|
141115
|
+
parse5();
|
|
141101
141116
|
stream2.pos = p2;
|
|
141102
141117
|
end2 = e;
|
|
141103
141118
|
}
|
|
@@ -141239,7 +141254,7 @@ var CFFGlyph = /* @__PURE__ */ (function(_Glyph) {
|
|
|
141239
141254
|
var e = end2;
|
|
141240
141255
|
stream2.pos = subr.offset;
|
|
141241
141256
|
end2 = subr.offset + subr.length;
|
|
141242
|
-
|
|
141257
|
+
parse5();
|
|
141243
141258
|
stream2.pos = p2;
|
|
141244
141259
|
end2 = e;
|
|
141245
141260
|
}
|
|
@@ -141472,7 +141487,7 @@ var CFFGlyph = /* @__PURE__ */ (function(_Glyph) {
|
|
|
141472
141487
|
}
|
|
141473
141488
|
}
|
|
141474
141489
|
};
|
|
141475
|
-
|
|
141490
|
+
parse4();
|
|
141476
141491
|
if (open) {
|
|
141477
141492
|
path2.closePath();
|
|
141478
141493
|
}
|
|
@@ -147823,19 +147838,19 @@ function sheetObjects(sheet, context2) {
|
|
|
147823
147838
|
for (const item of Array.isArray(record7.attributes) ? record7.attributes : []) {
|
|
147824
147839
|
charge();
|
|
147825
147840
|
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
147826
|
-
const
|
|
147827
|
-
if (typeof
|
|
147828
|
-
charge(
|
|
147829
|
-
if (
|
|
147830
|
-
else qualifiedAttributes.push({ name:
|
|
147841
|
+
const attribute7 = item;
|
|
147842
|
+
if (typeof attribute7.name === "string" && typeof attribute7.namespace === "string" && typeof attribute7.value === "string") {
|
|
147843
|
+
charge(attribute7.name.length + attribute7.namespace.length + attribute7.value.length);
|
|
147844
|
+
if (attribute7.namespace === "") attributes4[attribute7.name] = attribute7.value;
|
|
147845
|
+
else qualifiedAttributes.push({ name: attribute7.name, namespace: attribute7.namespace, value: attribute7.value });
|
|
147831
147846
|
}
|
|
147832
147847
|
}
|
|
147833
|
-
const
|
|
147848
|
+
const children8 = [];
|
|
147834
147849
|
for (const child7 of Array.isArray(record7.children) ? record7.children : []) {
|
|
147835
147850
|
const parsed = node3(child7, depth + 1);
|
|
147836
|
-
if (parsed)
|
|
147851
|
+
if (parsed) children8.push(parsed);
|
|
147837
147852
|
}
|
|
147838
|
-
return { name: record7.name, namespace: record7.namespace, text: record7.text, attributes: attributes4, qualifiedAttributes, children:
|
|
147853
|
+
return { name: record7.name, namespace: record7.namespace, text: record7.text, attributes: attributes4, qualifiedAttributes, children: children8 };
|
|
147839
147854
|
};
|
|
147840
147855
|
const style2 = (value3) => {
|
|
147841
147856
|
if (!value3 || value3.namespace !== "") return void 0;
|
|
@@ -148336,18 +148351,18 @@ function sheetPrintSettings(sheet, context2) {
|
|
|
148336
148351
|
const attributes4 = /* @__PURE__ */ Object.create(null);
|
|
148337
148352
|
for (const value4 of Array.isArray(data4.attributes) ? data4.attributes : []) {
|
|
148338
148353
|
tick();
|
|
148339
|
-
const
|
|
148340
|
-
if (
|
|
148341
|
-
tick(
|
|
148342
|
-
attributes4[
|
|
148354
|
+
const attribute7 = record7(value4);
|
|
148355
|
+
if (attribute7?.namespace === "" && typeof attribute7.name === "string" && typeof attribute7.value === "string") {
|
|
148356
|
+
tick(attribute7.name.length + attribute7.value.length);
|
|
148357
|
+
attributes4[attribute7.name] = attribute7.value;
|
|
148343
148358
|
}
|
|
148344
148359
|
}
|
|
148345
|
-
const
|
|
148360
|
+
const children8 = [];
|
|
148346
148361
|
for (const value4 of Array.isArray(data4.children) ? data4.children : []) {
|
|
148347
148362
|
const child7 = project(value4, depth + 1);
|
|
148348
|
-
if (child7)
|
|
148363
|
+
if (child7) children8.push(child7);
|
|
148349
148364
|
}
|
|
148350
|
-
return { name: data4.name, text: data4.text, attributes: attributes4, children:
|
|
148365
|
+
return { name: data4.name, text: data4.text, attributes: attributes4, children: children8 };
|
|
148351
148366
|
};
|
|
148352
148367
|
const margins = { top: 120, bottom: 120, left: 72, right: 72 };
|
|
148353
148368
|
let firstPageNumber;
|
|
@@ -154985,12 +155000,12 @@ ${warnings.map((w) => ` W ${w}`).join("\n")}`);
|
|
|
154985
155000
|
if (!Object.keys(style2).length) return cell;
|
|
154986
155001
|
return { ...cell, ...typeof style2.Format === "string" ? { format: style2.Format } : {}, style: { ...style2, gnumeric: sylkStyleNode(style2) } };
|
|
154987
155002
|
});
|
|
154988
|
-
function node3(name5, attributes4,
|
|
155003
|
+
function node3(name5, attributes4, children8 = []) {
|
|
154989
155004
|
return {
|
|
154990
155005
|
name: name5,
|
|
154991
155006
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
154992
155007
|
text: "",
|
|
154993
|
-
children:
|
|
155008
|
+
children: children8,
|
|
154994
155009
|
attributes: Object.entries(attributes4).map(([name6, value3]) => ({ name: name6, namespace: "", value: String(value3) }))
|
|
154995
155010
|
};
|
|
154996
155011
|
}
|
|
@@ -155336,9 +155351,9 @@ function decodeText(bytes, encoding) {
|
|
|
155336
155351
|
if (unit3 >= 55296 && unit3 <= 57343) throw new RangeError("Invalid UCS-2");
|
|
155337
155352
|
}
|
|
155338
155353
|
}
|
|
155339
|
-
const
|
|
155340
|
-
if (
|
|
155341
|
-
return
|
|
155354
|
+
const decoder2 = new TextDecoder(decoderLabel, { fatal: true });
|
|
155355
|
+
if (decoder2.encoding === "windows-1252" && bytes.some((b3) => [129, 141, 143, 144, 157].includes(b3))) continue;
|
|
155356
|
+
return decoder2.decode(bytes, { stream: true });
|
|
155342
155357
|
} catch {
|
|
155343
155358
|
}
|
|
155344
155359
|
}
|
|
@@ -155656,7 +155671,7 @@ function byteField(source, options, maximum, tick) {
|
|
|
155656
155671
|
append([quote]);
|
|
155657
155672
|
return Uint8Array.from(result2);
|
|
155658
155673
|
}
|
|
155659
|
-
function
|
|
155674
|
+
function appendTextField(text2, options, append) {
|
|
155660
155675
|
const whitespace3 = (c4) => c4 !== void 0 && c4 !== "\v" && c4 !== "\uFEFF" && c4.trim() === "";
|
|
155661
155676
|
const quoted = options.mode === "always" || options.mode === "auto" && (text2.includes(",") || text2.includes(" ") || text2.includes(" ") || text2.includes("\n") || text2.includes('"') || options.whitespace && (whitespace3(text2[0]) || whitespace3(text2.at(-1))));
|
|
155662
155677
|
if (!quoted || !options.quote) {
|
|
@@ -155735,7 +155750,7 @@ async function exportText(args, options) {
|
|
|
155735
155750
|
);
|
|
155736
155751
|
length += bytes.length;
|
|
155737
155752
|
chunks.push(bytes);
|
|
155738
|
-
} else
|
|
155753
|
+
} else appendTextField(cell ? await renderCellText(cell, book, renderingContext, options.format) : "", options, append);
|
|
155739
155754
|
}
|
|
155740
155755
|
append(options.eol);
|
|
155741
155756
|
}
|
|
@@ -157243,19 +157258,19 @@ function clipboardStyles(sheet, selection, defaults, cellStyle, context2) {
|
|
|
157243
157258
|
if (!a3 || !b3) return patch;
|
|
157244
157259
|
const attrs = /* @__PURE__ */ new Map();
|
|
157245
157260
|
for (const source of [a3, b3]) for (const raw of Array.isArray(source.attributes) ? source.attributes : []) {
|
|
157246
|
-
const
|
|
157247
|
-
if (
|
|
157261
|
+
const attribute7 = object3(raw);
|
|
157262
|
+
if (attribute7) attrs.set(`${String(attribute7.namespace)}:${String(attribute7.name)}`, raw);
|
|
157248
157263
|
}
|
|
157249
|
-
const
|
|
157264
|
+
const children8 = [...Array.isArray(a3.children) ? a3.children : []];
|
|
157250
157265
|
for (const child7 of Array.isArray(b3.children) ? b3.children : []) {
|
|
157251
|
-
const node3 = object3(child7), index2 =
|
|
157266
|
+
const node3 = object3(child7), index2 = children8.findIndex((raw) => {
|
|
157252
157267
|
const old = object3(raw);
|
|
157253
157268
|
return old?.name === node3?.name && old?.namespace === node3?.namespace;
|
|
157254
157269
|
});
|
|
157255
|
-
if (index2 < 0)
|
|
157256
|
-
else
|
|
157270
|
+
if (index2 < 0) children8.push(child7);
|
|
157271
|
+
else children8[index2] = merge(children8[index2], child7);
|
|
157257
157272
|
}
|
|
157258
|
-
return { ...a3, ...b3, text:
|
|
157273
|
+
return { ...a3, ...b3, text: children8.length ? "" : b3.text || a3.text || "", attributes: [...attrs.values()], children: children8 };
|
|
157259
157274
|
};
|
|
157260
157275
|
let regions = [{ range: selection, style: merge(defaults, {}) }];
|
|
157261
157276
|
const apply3 = (range5, style2) => {
|
|
@@ -169112,23 +169127,23 @@ function clipboardObjectRecords(sheet, range5, context2) {
|
|
|
169112
169127
|
name: value3.name,
|
|
169113
169128
|
namespace: value3.namespace,
|
|
169114
169129
|
text: value3.text,
|
|
169115
|
-
attributes: [...Object.entries(value3.attributes).map(([name5, value4]) => ({ name: name5, namespace: "", value: value4 })), ...value3.qualifiedAttributes].map((
|
|
169116
|
-
...
|
|
169117
|
-
value: bound !== void 0 &&
|
|
169130
|
+
attributes: [...Object.entries(value3.attributes).map(([name5, value4]) => ({ name: name5, namespace: "", value: value4 })), ...value3.qualifiedAttributes].map((attribute7) => ({
|
|
169131
|
+
...attribute7,
|
|
169132
|
+
value: bound !== void 0 && attribute7.namespace === "" && attribute7.name === "ObjectBound" ? bound : attribute7.value
|
|
169118
169133
|
})),
|
|
169119
169134
|
children: value3.children.map((child7) => node3(child7))
|
|
169120
169135
|
};
|
|
169121
169136
|
};
|
|
169122
|
-
const
|
|
169137
|
+
const children8 = copied.map((object5) => {
|
|
169123
169138
|
const bound = object5.anchor.range;
|
|
169124
169139
|
return node3(object5.payload, `${formatA1(bound.startRow - range5.startRow, bound.startColumn - range5.startColumn)}:${formatA1(bound.endRow - range5.startRow, bound.endColumn - range5.startColumn)}`);
|
|
169125
169140
|
});
|
|
169126
|
-
return
|
|
169141
|
+
return children8.length ? [{ source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: {
|
|
169127
169142
|
name: "Objects",
|
|
169128
169143
|
namespace: copied[0].payload.namespace,
|
|
169129
169144
|
text: "",
|
|
169130
169145
|
attributes: [],
|
|
169131
|
-
children:
|
|
169146
|
+
children: children8
|
|
169132
169147
|
} }] : [];
|
|
169133
169148
|
}
|
|
169134
169149
|
function imageBytes(text2, maximum, context2) {
|
|
@@ -170201,13 +170216,13 @@ function clipboardStyleRecords(sheet, range5, context2) {
|
|
|
170201
170216
|
}
|
|
170202
170217
|
return record6(step.value.children[0], true);
|
|
170203
170218
|
};
|
|
170204
|
-
const
|
|
170219
|
+
const children8 = clipboardStyles(sheet, range5, styleNode({ Script: 0 }, "General", true), styleNode, context2).map((region) => ({ name: "StyleRegion", namespace: namespace4, text: "", attributes: Object.entries({
|
|
170205
170220
|
startCol: region.range.startColumn - range5.startColumn,
|
|
170206
170221
|
startRow: region.range.startRow - range5.startRow,
|
|
170207
170222
|
endCol: region.range.endColumn - range5.startColumn,
|
|
170208
170223
|
endRow: region.range.endRow - range5.startRow
|
|
170209
170224
|
}).map(([name5, value3]) => ({ name: name5, namespace: "", value: String(value3) })), children: [region.style] }));
|
|
170210
|
-
return [{ source: "Gnumeric_XmlIO:sax", kind: "Styles", disposition: "retained", data: { name: "Styles", namespace: namespace4, text: "", attributes: [], children:
|
|
170225
|
+
return [{ source: "Gnumeric_XmlIO:sax", kind: "Styles", disposition: "retained", data: { name: "Styles", namespace: namespace4, text: "", attributes: [], children: children8 } }];
|
|
170211
170226
|
}
|
|
170212
170227
|
function writeClipboardGnumeric(book, sheet, range5, context2) {
|
|
170213
170228
|
const writer = new XmlWriter(context2.limits.outputBytes, context2);
|
|
@@ -170884,10 +170899,10 @@ Run 'ssconvert --help' to see a full list of available command line options.
|
|
|
170884
170899
|
`
|
|
170885
170900
|
);
|
|
170886
170901
|
function parseCommand(supplied, profile) {
|
|
170887
|
-
const
|
|
170888
|
-
const
|
|
170902
|
+
const encoder3 = new TextEncoder();
|
|
170903
|
+
const decoder2 = new TextDecoder("utf8", { ignoreBOM: true });
|
|
170889
170904
|
const byteMode = supplied.some((argument) => typeof argument !== "string");
|
|
170890
|
-
const bytes = supplied.map((argument) => typeof argument === "string" ?
|
|
170905
|
+
const bytes = supplied.map((argument) => typeof argument === "string" ? encoder3.encode(argument) : new Uint8Array(argument));
|
|
170891
170906
|
const argv2 = bytes.map((argument) => Array.from(argument, (byte) => String.fromCharCode(byte)).join(""));
|
|
170892
170907
|
const operandBytes = [];
|
|
170893
170908
|
const unknown = (index2) => {
|
|
@@ -170901,15 +170916,15 @@ function parseCommand(supplied, profile) {
|
|
|
170901
170916
|
message = "[Invalid UTF-8] Unknown option " + Array.from(option, (byte) => byte >= 32 && byte < 127 || byte === 9 || byte === 10 ? String.fromCharCode(byte) : `\\x${byte.toString(16).padStart(2, "0")}`).join("");
|
|
170902
170917
|
}
|
|
170903
170918
|
const result2 = parserError(message);
|
|
170904
|
-
return { ...result2, stderrBytes:
|
|
170919
|
+
return { ...result2, stderrBytes: encoder3.encode(result2.stderr) };
|
|
170905
170920
|
}
|
|
170906
|
-
const prefix2 =
|
|
170907
|
-
const suffix =
|
|
170921
|
+
const prefix2 = encoder3.encode("Unknown option ");
|
|
170922
|
+
const suffix = encoder3.encode("\nRun 'ssconvert --help' to see a full list of available command line options.\n");
|
|
170908
170923
|
const raw = new Uint8Array(prefix2.length + option.length + suffix.length);
|
|
170909
170924
|
raw.set(prefix2);
|
|
170910
170925
|
raw.set(option, prefix2.length);
|
|
170911
170926
|
raw.set(suffix, prefix2.length + option.length);
|
|
170912
|
-
return { kind: "terminal", exitCode: 1, stdout: "", stderr:
|
|
170927
|
+
return { kind: "terminal", exitCode: 1, stdout: "", stderr: decoder2.decode(raw), stderrBytes: raw };
|
|
170913
170928
|
};
|
|
170914
170929
|
const operands = [], scalars = {}, scalarBytes = {}, arrays = {}, flags2 = /* @__PURE__ */ new Set();
|
|
170915
170930
|
let options = true;
|
|
@@ -170925,7 +170940,7 @@ function parseCommand(supplied, profile) {
|
|
|
170925
170940
|
continue;
|
|
170926
170941
|
}
|
|
170927
170942
|
if (!options || !argument.startsWith("-") || argument === "-") {
|
|
170928
|
-
operands.push(
|
|
170943
|
+
operands.push(decoder2.decode(bytes[index2]));
|
|
170929
170944
|
operandBytes.push(bytes[index2]);
|
|
170930
170945
|
continue;
|
|
170931
170946
|
}
|
|
@@ -170972,7 +170987,7 @@ function parseCommand(supplied, profile) {
|
|
|
170972
170987
|
let decoded;
|
|
170973
170988
|
if (scalar === "lib-dir" || scalar === "data-dir") {
|
|
170974
170989
|
scalarBytes[scalar] = new Uint8Array(valueBytes);
|
|
170975
|
-
decoded =
|
|
170990
|
+
decoded = decoder2.decode(valueBytes);
|
|
170976
170991
|
} else {
|
|
170977
170992
|
try {
|
|
170978
170993
|
decoded = new TextDecoder("utf8", { fatal: true, ignoreBOM: true }).decode(valueBytes);
|
|
@@ -171058,7 +171073,7 @@ async function runCommand(argv2, engine, operation, profile) {
|
|
|
171058
171073
|
return { exitCode: error3.exitCode };
|
|
171059
171074
|
}
|
|
171060
171075
|
const parsed = parseCommand(argv2, profile);
|
|
171061
|
-
const
|
|
171076
|
+
const encoder3 = new TextEncoder();
|
|
171062
171077
|
let stderrFailed = false;
|
|
171063
171078
|
async function report(bytes) {
|
|
171064
171079
|
operation.signal.throwIfAborted();
|
|
@@ -171078,7 +171093,7 @@ async function runCommand(argv2, engine, operation, profile) {
|
|
|
171078
171093
|
if (outputBytes2 > (engine.limits.commandOutputBytes ?? Infinity))
|
|
171079
171094
|
throw new SsconvertError("resource-limit", "ssconvert output bytes limit exceeded");
|
|
171080
171095
|
}
|
|
171081
|
-
return
|
|
171096
|
+
return encoder3.encode(text2);
|
|
171082
171097
|
}
|
|
171083
171098
|
try {
|
|
171084
171099
|
if (parsed.kind === "terminal") {
|
|
@@ -171179,7 +171194,7 @@ async function runCommand(argv2, engine, operation, profile) {
|
|
|
171179
171194
|
...operation,
|
|
171180
171195
|
async diagnostic(diagnostic) {
|
|
171181
171196
|
operation.signal.throwIfAborted();
|
|
171182
|
-
await report(diagnostic.bytes ??
|
|
171197
|
+
await report(diagnostic.bytes ?? encoder3.encode(`${diagnostic.message}
|
|
171183
171198
|
`));
|
|
171184
171199
|
emitted.add(diagnostic);
|
|
171185
171200
|
operation.signal.throwIfAborted();
|
|
@@ -171192,7 +171207,7 @@ async function runCommand(argv2, engine, operation, profile) {
|
|
|
171192
171207
|
for (const diagnostic of result2.diagnostics) {
|
|
171193
171208
|
if (emitted.has(diagnostic)) continue;
|
|
171194
171209
|
operation.signal.throwIfAborted();
|
|
171195
|
-
await report(diagnostic.bytes ??
|
|
171210
|
+
await report(diagnostic.bytes ?? encoder3.encode(`${diagnostic.message}
|
|
171196
171211
|
`));
|
|
171197
171212
|
}
|
|
171198
171213
|
operation.signal.throwIfAborted();
|
|
@@ -171201,7 +171216,7 @@ async function runCommand(argv2, engine, operation, profile) {
|
|
|
171201
171216
|
operation.signal.throwIfAborted();
|
|
171202
171217
|
if (stderrFailed) throw error3;
|
|
171203
171218
|
if (!isSsconvertError(error3)) throw error3;
|
|
171204
|
-
await report(
|
|
171219
|
+
await report(encoder3.encode(`${error3.message}
|
|
171205
171220
|
`));
|
|
171206
171221
|
operation.signal.throwIfAborted();
|
|
171207
171222
|
return { exitCode: error3.exitCode };
|
|
@@ -174359,6 +174374,249 @@ function createSsconvertCommands(options = {}) {
|
|
|
174359
174374
|
return Object.freeze([createSsconvertCommand(options)]);
|
|
174360
174375
|
}
|
|
174361
174376
|
|
|
174377
|
+
// packages/safe-bash-command-ssconvert/src/sync.ts
|
|
174378
|
+
init_platform();
|
|
174379
|
+
import { builtInDirectContextExecutors as builtInDirectContextExecutors2 } from "../../safe-bash-contracts/runtime-control.js";
|
|
174380
|
+
|
|
174381
|
+
// packages/spreadsheet-format-csv/src/sync-table.ts
|
|
174382
|
+
init_platform();
|
|
174383
|
+
function parseSimpleSeparatedRows(text2, sep) {
|
|
174384
|
+
const rows = [];
|
|
174385
|
+
let row = [];
|
|
174386
|
+
let field = "";
|
|
174387
|
+
let quoted = false;
|
|
174388
|
+
for (let i4 = 0; i4 < text2.length; i4++) {
|
|
174389
|
+
const ch = text2[i4];
|
|
174390
|
+
if (ch === '"') {
|
|
174391
|
+
if (quoted && text2[i4 + 1] === '"') {
|
|
174392
|
+
field += '"';
|
|
174393
|
+
i4++;
|
|
174394
|
+
} else if (quoted || field.length === 0) {
|
|
174395
|
+
quoted = !quoted;
|
|
174396
|
+
} else {
|
|
174397
|
+
return void 0;
|
|
174398
|
+
}
|
|
174399
|
+
} else if (!quoted && ch === sep) {
|
|
174400
|
+
if (field.startsWith("=") || field.startsWith("'")) return void 0;
|
|
174401
|
+
row.push(field);
|
|
174402
|
+
field = "";
|
|
174403
|
+
} else if (!quoted && (ch === "\r" || ch === "\n")) {
|
|
174404
|
+
if (field.startsWith("=") || field.startsWith("'")) return void 0;
|
|
174405
|
+
row.push(field);
|
|
174406
|
+
rows.push(row);
|
|
174407
|
+
row = [];
|
|
174408
|
+
field = "";
|
|
174409
|
+
if (ch === "\r" && text2[i4 + 1] === "\n") i4++;
|
|
174410
|
+
} else {
|
|
174411
|
+
field += ch;
|
|
174412
|
+
}
|
|
174413
|
+
}
|
|
174414
|
+
if (quoted) return void 0;
|
|
174415
|
+
if (field.length > 0 || row.length > 0) {
|
|
174416
|
+
if (field.startsWith("=") || field.startsWith("'")) return void 0;
|
|
174417
|
+
row.push(field);
|
|
174418
|
+
rows.push(row);
|
|
174419
|
+
}
|
|
174420
|
+
return rows;
|
|
174421
|
+
}
|
|
174422
|
+
function formatSimpleCsv(rows) {
|
|
174423
|
+
let output2 = "";
|
|
174424
|
+
for (const row of rows) {
|
|
174425
|
+
for (let index2 = 0; index2 < row.length; index2++) {
|
|
174426
|
+
if (index2) output2 += ",";
|
|
174427
|
+
const value3 = row[index2];
|
|
174428
|
+
appendTextField(
|
|
174429
|
+
typeof value3 === "string" ? value3 : rendered(value3),
|
|
174430
|
+
{ mode: "auto", quote: '"', whitespace: true },
|
|
174431
|
+
(text2) => {
|
|
174432
|
+
output2 += text2;
|
|
174433
|
+
}
|
|
174434
|
+
);
|
|
174435
|
+
}
|
|
174436
|
+
output2 += "\n";
|
|
174437
|
+
}
|
|
174438
|
+
return output2;
|
|
174439
|
+
}
|
|
174440
|
+
|
|
174441
|
+
// packages/spreadsheet-format-xlsx/src/sync-table.ts
|
|
174442
|
+
init_platform();
|
|
174443
|
+
|
|
174444
|
+
// packages/xlsx-ast/src/sync-table.ts
|
|
174445
|
+
init_platform();
|
|
174446
|
+
import { parseXml } from "@poe-platform/safe-fs/core";
|
|
174447
|
+
var namespace5 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
174448
|
+
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
174449
|
+
var encoder2 = new TextEncoder();
|
|
174450
|
+
function parse3(bytes) {
|
|
174451
|
+
if (bytes.byteLength > 2097152) throw new RangeError("Synchronous XLSX XML limit exceeded");
|
|
174452
|
+
return parseXml(decoder.decode(bytes), { maxDepth: 32, maxNodes: 1e5, maxAttributes: 2e5, maxTextLength: 2097152 });
|
|
174453
|
+
}
|
|
174454
|
+
function attribute6(node3, name5) {
|
|
174455
|
+
return node3.attributes.find((item) => item.name === name5)?.value;
|
|
174456
|
+
}
|
|
174457
|
+
function children7(node3, name5) {
|
|
174458
|
+
return node3.children.filter((item) => item.namespace === namespace5 && item.localName === name5);
|
|
174459
|
+
}
|
|
174460
|
+
function stringValue(node3) {
|
|
174461
|
+
return decodeXlsxString(node3.children.flatMap((item) => {
|
|
174462
|
+
if (item.namespace !== namespace5) return [];
|
|
174463
|
+
if (item.localName === "t") return [item.text];
|
|
174464
|
+
return item.localName === "r" ? children7(item, "t").map((text2) => text2.text) : [];
|
|
174465
|
+
}).join(""));
|
|
174466
|
+
}
|
|
174467
|
+
function parseSimpleXlsxTable(entries) {
|
|
174468
|
+
let expandedBytes = 0;
|
|
174469
|
+
for (const [name5, bytes] of entries) {
|
|
174470
|
+
expandedBytes += bytes.byteLength;
|
|
174471
|
+
if (expandedBytes > 2097152 || name5 === "EncryptionInfo" || name5 === "EncryptedPackage" || name5.startsWith("xl/worksheets/") && name5.endsWith(".xml") && name5 !== "xl/worksheets/sheet1.xml") return void 0;
|
|
174472
|
+
}
|
|
174473
|
+
const workbookBytes2 = entries.get("xl/workbook.xml");
|
|
174474
|
+
let sheetName2 = "Sheet1";
|
|
174475
|
+
if (workbookBytes2) {
|
|
174476
|
+
const workbook = parse3(workbookBytes2);
|
|
174477
|
+
const sheets = children7(workbook, "sheets")[0];
|
|
174478
|
+
if (!sheets || children7(sheets, "sheet").length !== 1) return void 0;
|
|
174479
|
+
sheetName2 = attribute6(children7(sheets, "sheet")[0], "name") ?? sheetName2;
|
|
174480
|
+
}
|
|
174481
|
+
const sheetBytes = entries.get("xl/worksheets/sheet1.xml");
|
|
174482
|
+
if (!sheetBytes) return void 0;
|
|
174483
|
+
const sheet = parse3(sheetBytes);
|
|
174484
|
+
if (sheet.namespace !== namespace5 || sheet.localName !== "worksheet") return void 0;
|
|
174485
|
+
const data4 = children7(sheet, "sheetData")[0];
|
|
174486
|
+
if (!data4) return void 0;
|
|
174487
|
+
const sharedBytes = entries.get("xl/sharedStrings.xml");
|
|
174488
|
+
const sharedItems = sharedBytes ? children7(parse3(sharedBytes), "si") : [];
|
|
174489
|
+
if (sharedItems.some((item) => children7(item, "r").some((run) => children7(run, "rPr").length))) return void 0;
|
|
174490
|
+
const strings = sharedItems.map(stringValue);
|
|
174491
|
+
const rows = [];
|
|
174492
|
+
for (const row of children7(data4, "row")) {
|
|
174493
|
+
if (attribute6(row, "r") !== String(rows.length + 1)) return void 0;
|
|
174494
|
+
const values3 = [];
|
|
174495
|
+
for (const cell of children7(row, "c")) {
|
|
174496
|
+
const ref = attribute6(cell, "r");
|
|
174497
|
+
if (ref === void 0 || attribute6(cell, "s") !== void 0 || children7(cell, "f").length) return void 0;
|
|
174498
|
+
const address = parseA1(ref);
|
|
174499
|
+
if (address.row !== rows.length || address.column !== values3.length) return void 0;
|
|
174500
|
+
const type = attribute6(cell, "t") ?? "n";
|
|
174501
|
+
const raw = children7(cell, "v")[0]?.text ?? "";
|
|
174502
|
+
if (type === "inlineStr") {
|
|
174503
|
+
const value3 = children7(cell, "is")[0];
|
|
174504
|
+
if (value3 && children7(value3, "r").some((run) => children7(run, "rPr").length)) return void 0;
|
|
174505
|
+
values3.push({ kind: "string", value: value3 ? stringValue(value3) : "" });
|
|
174506
|
+
} else if (type === "s") {
|
|
174507
|
+
const index2 = Number(raw);
|
|
174508
|
+
if (!Number.isSafeInteger(index2) || index2 < 0 || String(index2) !== raw || strings[index2] === void 0) return void 0;
|
|
174509
|
+
values3.push({ kind: "string", value: strings[index2] });
|
|
174510
|
+
} else if (type === "b") {
|
|
174511
|
+
if (raw !== "0" && raw !== "1") return void 0;
|
|
174512
|
+
values3.push({ kind: "boolean", value: raw === "1" });
|
|
174513
|
+
} else if (type === "str") values3.push({ kind: "string", value: decodeXlsxString(raw) });
|
|
174514
|
+
else if (type === "n") {
|
|
174515
|
+
if (raw === "") values3.push({ kind: "blank" });
|
|
174516
|
+
else if (Number.isFinite(Number(raw))) values3.push({ kind: "number", value: Number(raw) });
|
|
174517
|
+
else return void 0;
|
|
174518
|
+
} else return void 0;
|
|
174519
|
+
}
|
|
174520
|
+
if (rows.length && values3.length !== rows[0].length) return void 0;
|
|
174521
|
+
rows.push(values3);
|
|
174522
|
+
}
|
|
174523
|
+
return { rows, sheetName: sheetName2 };
|
|
174524
|
+
}
|
|
174525
|
+
function simpleDecimal(value3) {
|
|
174526
|
+
let offset = value3.startsWith("-") ? 1 : 0;
|
|
174527
|
+
const first = offset;
|
|
174528
|
+
while (offset < value3.length && value3.charCodeAt(offset) >= 48 && value3.charCodeAt(offset) <= 57) offset++;
|
|
174529
|
+
if (offset === first || offset > first + 1 && value3[first] === "0") return false;
|
|
174530
|
+
if (value3[offset] === ".") {
|
|
174531
|
+
const start = ++offset;
|
|
174532
|
+
while (offset < value3.length && value3.charCodeAt(offset) >= 48 && value3.charCodeAt(offset) <= 57) offset++;
|
|
174533
|
+
if (offset === start) return false;
|
|
174534
|
+
}
|
|
174535
|
+
return offset === value3.length && Number.isFinite(Number(value3));
|
|
174536
|
+
}
|
|
174537
|
+
function buildSimpleXlsx(rows, sheetName2 = "Sheet1") {
|
|
174538
|
+
const sheetRows = rows.map((row, rowIndex) => `<row r="${rowIndex + 1}">${row.map((value3, column) => {
|
|
174539
|
+
const reference = formatA1(rowIndex, column);
|
|
174540
|
+
const cell = typeof value3 === "string" ? simpleDecimal(value3) ? { kind: "number", value: Number(value3) } : { kind: "string", value: value3 } : value3;
|
|
174541
|
+
if (cell.kind === "blank") return `<c r="${reference}"/>`;
|
|
174542
|
+
if (cell.kind === "number") return `<c r="${reference}" t="n"><v>${cell.value}</v></c>`;
|
|
174543
|
+
if (cell.kind === "boolean") return `<c r="${reference}" t="b"><v>${cell.value ? 1 : 0}</v></c>`;
|
|
174544
|
+
if (cell.kind !== "string") throw new TypeError("Unsupported synchronous XLSX cell");
|
|
174545
|
+
return `<c r="${reference}" t="inlineStr"><is><t xml:space="preserve">${escapeXlsx(encodeXlsxString(cell.value))}</t></is></c>`;
|
|
174546
|
+
}).join("")}</row>`).join("");
|
|
174547
|
+
return {
|
|
174548
|
+
"[Content_Types].xml": encoder2.encode('<?xml version="1.0" encoding="UTF-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>'),
|
|
174549
|
+
"_rels/.rels": encoder2.encode('<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>'),
|
|
174550
|
+
"xl/workbook.xml": encoder2.encode(`<?xml version="1.0" encoding="UTF-8"?><workbook xmlns="${namespace5}"><sheets><sheet name="${escapeXlsx(sheetName2)}" sheetId="1" r:id="rId1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/></sheets></workbook>`),
|
|
174551
|
+
"xl/_rels/workbook.xml.rels": encoder2.encode('<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/></Relationships>'),
|
|
174552
|
+
"xl/worksheets/sheet1.xml": encoder2.encode(`<?xml version="1.0" encoding="UTF-8"?><worksheet xmlns="${namespace5}"><sheetData>${sheetRows}</sheetData></worksheet>`)
|
|
174553
|
+
};
|
|
174554
|
+
}
|
|
174555
|
+
|
|
174556
|
+
// packages/safe-bash-command-ssconvert/src/sync.ts
|
|
174557
|
+
var syncUtf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
174558
|
+
var syncUtf8Encoder = new TextEncoder();
|
|
174559
|
+
function createSyncSsconvertEvaluator(archive) {
|
|
174560
|
+
return function evalSyncSsconvert(execute, opArgs, inBytes, readFileSync, writeFileSync) {
|
|
174561
|
+
if (!builtInDirectContextExecutors2.has(execute) || opArgs.length === 0) return void 0;
|
|
174562
|
+
try {
|
|
174563
|
+
const parsed = parseCommand(opArgs);
|
|
174564
|
+
if (parsed.kind === "terminal") {
|
|
174565
|
+
if (parsed.exitCode === 0 && !parsed.stderr && parsed.stdout) {
|
|
174566
|
+
return parsed.stdout;
|
|
174567
|
+
}
|
|
174568
|
+
return void 0;
|
|
174569
|
+
}
|
|
174570
|
+
if (parsed.action !== "convert" || parsed.flags.length > 0 || Object.keys(parsed.arrays).length > 0 || parsed.scalars.clipboard !== void 0 || parsed.scalars.resize !== void 0 || parsed.scalars["export-range"] !== void 0 || parsed.scalars["export-options"] !== void 0 || parsed.scalars["import-encoding"] !== void 0 || parsed.operands.length !== 2) {
|
|
174571
|
+
return void 0;
|
|
174572
|
+
}
|
|
174573
|
+
const [srcUri, dstUri] = parsed.operands;
|
|
174574
|
+
if (srcUri.includes("%") || dstUri.includes("%")) return void 0;
|
|
174575
|
+
if (srcUri.includes("://") && srcUri !== "fd://0") return void 0;
|
|
174576
|
+
if (dstUri.includes("://") && dstUri !== "fd://1") return void 0;
|
|
174577
|
+
const impType = parsed.scalars["import-type"];
|
|
174578
|
+
const expType = parsed.scalars["export-type"];
|
|
174579
|
+
const lowerSrc = srcUri.toLowerCase();
|
|
174580
|
+
const lowerDst = dstUri.toLowerCase();
|
|
174581
|
+
let inFmt;
|
|
174582
|
+
if (impType === "Gnumeric_stf:stf_csvtab" || !impType && lowerSrc.endsWith(".csv")) inFmt = "csv";
|
|
174583
|
+
else if (!impType && lowerSrc.endsWith(".tsv")) inFmt = "tsv";
|
|
174584
|
+
else if (impType === "Gnumeric_Excel:xlsx" || !impType && lowerSrc.endsWith(".xlsx")) inFmt = "xlsx";
|
|
174585
|
+
if (!inFmt) return void 0;
|
|
174586
|
+
let outFmt;
|
|
174587
|
+
if (expType === "Gnumeric_stf:stf_csv" || !expType && lowerDst.endsWith(".csv")) outFmt = "csv";
|
|
174588
|
+
else if (expType === "Gnumeric_Excel:xlsx" || expType === "Gnumeric_Excel:xlsx2" || !expType && lowerDst.endsWith(".xlsx")) outFmt = "xlsx";
|
|
174589
|
+
if (!outFmt) return void 0;
|
|
174590
|
+
if (dstUri === "fd://1" && (!expType || outFmt !== "csv")) return void 0;
|
|
174591
|
+
const srcBytes = srcUri === "fd://0" ? inBytes : readFileSync?.(srcUri);
|
|
174592
|
+
if (!srcBytes || srcBytes.byteLength === 0 || srcBytes.byteLength > 131072) return void 0;
|
|
174593
|
+
let rows;
|
|
174594
|
+
let sheetName2 = srcUri === "fd://0" ? "Sheet1" : srcUri.split("/").pop() || "Sheet1";
|
|
174595
|
+
if (inFmt === "csv" || inFmt === "tsv") {
|
|
174596
|
+
const text2 = syncUtf8Decoder.decode(srcBytes);
|
|
174597
|
+
rows = parseSimpleSeparatedRows(text2, inFmt === "tsv" ? " " : ",");
|
|
174598
|
+
} else {
|
|
174599
|
+
const table10 = parseSimpleXlsxTable(archive.read(srcBytes));
|
|
174600
|
+
if (!table10) return void 0;
|
|
174601
|
+
rows = table10.rows;
|
|
174602
|
+
sheetName2 = table10.sheetName;
|
|
174603
|
+
}
|
|
174604
|
+
if (!rows) return void 0;
|
|
174605
|
+
if (outFmt === "csv") {
|
|
174606
|
+
const csvText = formatSimpleCsv(rows);
|
|
174607
|
+
if (dstUri === "fd://1") return csvText;
|
|
174608
|
+
if (!writeFileSync || !writeFileSync(dstUri, syncUtf8Encoder.encode(csvText))) return void 0;
|
|
174609
|
+
return "";
|
|
174610
|
+
}
|
|
174611
|
+
const xlsxBytes = archive.write(buildSimpleXlsx(rows, sheetName2));
|
|
174612
|
+
if (!writeFileSync || !writeFileSync(dstUri, xlsxBytes)) return void 0;
|
|
174613
|
+
return "";
|
|
174614
|
+
} catch {
|
|
174615
|
+
return void 0;
|
|
174616
|
+
}
|
|
174617
|
+
};
|
|
174618
|
+
}
|
|
174619
|
+
|
|
174362
174620
|
export {
|
|
174363
174621
|
blake2b,
|
|
174364
174622
|
hmac,
|
|
@@ -174415,7 +174673,12 @@ export {
|
|
|
174415
174673
|
readXlsx,
|
|
174416
174674
|
createXlsxWriter,
|
|
174417
174675
|
xlsxFormat,
|
|
174676
|
+
invalidBiff,
|
|
174677
|
+
Binary,
|
|
174678
|
+
isCfb,
|
|
174418
174679
|
readCfb,
|
|
174680
|
+
readBiffRecords,
|
|
174681
|
+
BiffStrings,
|
|
174419
174682
|
parseColor,
|
|
174420
174683
|
decodeJpegImage,
|
|
174421
174684
|
readImageMetadata,
|
|
@@ -174483,7 +174746,8 @@ export {
|
|
|
174483
174746
|
createDatabaseFunctions,
|
|
174484
174747
|
createSsconvertCommand,
|
|
174485
174748
|
ssconvertCommands,
|
|
174486
|
-
createSsconvertCommands
|
|
174749
|
+
createSsconvertCommands,
|
|
174750
|
+
createSyncSsconvertEvaluator
|
|
174487
174751
|
};
|
|
174488
174752
|
/*!
|
|
174489
174753
|
* UNICODE LICENSE V3
|
|
@@ -174547,4 +174811,4 @@ tslib/tslib.js:
|
|
|
174547
174811
|
@noble/ciphers/utils.js:
|
|
174548
174812
|
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
|
174549
174813
|
*/
|
|
174550
|
-
//# sourceMappingURL=chunk-
|
|
174814
|
+
//# sourceMappingURL=chunk-CBVANNKK.js.map
|