ooxml-core 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-X6AO6LKJ.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
- package/dist/{PptxHandler-5X4VOWAO.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
- package/dist/{PptxHandler-4AHDZDA5.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
- package/dist/{PresentationBuilder-UY3S4YE2.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
- package/dist/{PresentationBuilder-LRX55PXA.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
- package/dist/{PresentationBuilder-MJB4LIFS.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
- package/dist/automation/index.cjs +535 -266
- package/dist/automation/index.mjs +535 -266
- package/dist/chart/axis-range-auto.d.ts +10 -0
- package/dist/chart/axis-range-auto.d.ts.map +1 -0
- package/dist/chart/axis-range-types.d.ts +27 -0
- package/dist/chart/axis-range-types.d.ts.map +1 -0
- package/dist/chart/axis-range.d.ts +37 -0
- package/dist/chart/axis-range.d.ts.map +1 -0
- package/dist/chart/axis-ticks.d.ts +8 -0
- package/dist/chart/axis-ticks.d.ts.map +1 -0
- package/dist/chart/index.cjs +815 -165
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +795 -166
- package/dist/chart/line-dash.d.ts +2 -0
- package/dist/chart/line-dash.d.ts.map +1 -0
- package/dist/chart/marker-shape.d.ts +70 -0
- package/dist/chart/marker-shape.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-axes.d.ts +9 -0
- package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-markers.d.ts +6 -0
- package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
- package/dist/chart/render/chart-view-axes.d.ts +30 -0
- package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
- package/dist/chart/render/chart-view-markers.d.ts +27 -0
- package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
- package/dist/chart/render/chart-view-series.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +4 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/index.d.ts +2 -0
- package/dist/chart/render/index.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +6 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-7NWQUCGX.mjs → chunk-3XFPCZKB.mjs} +1 -1
- package/dist/{chunk-Z5Y53IZD.mjs → chunk-75GLSRZE.mjs} +4 -4
- package/dist/{chunk-LT7RCEHY.mjs → chunk-BIVNVDAH.mjs} +1 -1
- package/dist/{chunk-I5ZE3VLI.mjs → chunk-QBJRB6WW.mjs} +1 -1
- package/dist/{chunk-U7IDT6VT.mjs → chunk-RUZEMWDI.mjs} +1 -1
- package/dist/docx/index.cjs +695 -168
- package/dist/docx/index.mjs +695 -168
- package/dist/docx/layout/index.cjs +697 -170
- package/dist/docx/layout/index.mjs +697 -170
- package/dist/docx/ui/index.cjs +704 -177
- package/dist/docx/ui/index.mjs +704 -177
- package/dist/index.cjs +912 -262
- package/dist/index.mjs +912 -262
- package/dist/pptx/automation/index.cjs +54 -0
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/cli/index.cjs +54 -0
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +54 -0
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +71 -5
- package/dist/teams/index.mjs +71 -5
- package/dist/visio/index.cjs +483 -214
- package/dist/visio/index.mjs +483 -214
- package/dist/visio/ui/index.cjs +504 -235
- package/dist/visio/ui/index.mjs +504 -235
- package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +818 -281
- package/dist/xlsx/index.mjs +818 -281
- package/dist/xlsx/load/index.cjs +58 -5
- package/dist/xlsx/load/index.mjs +58 -5
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +835 -298
- package/dist/xlsx/ui/index.mjs +835 -298
- package/package.json +1 -1
- /package/dist/{chunk-C363NN2C.mjs → chunk-H6TNNXJK.mjs} +0 -0
- /package/dist/{chunk-R4BCOQHB.cjs → chunk-MHMVD23Y.cjs} +0 -0
package/dist/visio/index.cjs
CHANGED
|
@@ -118,11 +118,11 @@ function checkXmlLimits(xml, label, limits = {}) {
|
|
|
118
118
|
throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth}`);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function parseXml(xml,
|
|
122
|
-
const label =
|
|
121
|
+
function parseXml(xml, options2 = {}) {
|
|
122
|
+
const label = options2.label ?? "OOXML";
|
|
123
123
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
124
124
|
throw new Error(`${label} XML with DTD or entity declarations is not supported`);
|
|
125
|
-
checkXmlLimits(xml, label,
|
|
125
|
+
checkXmlLimits(xml, label, options2.limits);
|
|
126
126
|
let parseError = "";
|
|
127
127
|
let parsed;
|
|
128
128
|
try {
|
|
@@ -693,8 +693,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
693
693
|
if (Date.now() >= this.deadline)
|
|
694
694
|
fail("LIMIT_RUNTIME", "Visio package processing deadline exceeded");
|
|
695
695
|
};
|
|
696
|
-
static async open(input,
|
|
697
|
-
const limits = { ...DEFAULTS, ...
|
|
696
|
+
static async open(input, options2 = {}) {
|
|
697
|
+
const limits = { ...DEFAULTS, ...options2 };
|
|
698
698
|
for (const value3 of Object.values(limits))
|
|
699
699
|
if (!Number.isFinite(value3) || value3 <= 0)
|
|
700
700
|
fail("INVALID_LIMITS", "Package limits must be finite positive numbers");
|
|
@@ -1438,10 +1438,10 @@ function jpeg(bytes, limits) {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
return invalid2("JPEG has no image terminator.");
|
|
1440
1440
|
}
|
|
1441
|
-
function inspectVisioRasterImage(bytes,
|
|
1442
|
-
if (!
|
|
1441
|
+
function inspectVisioRasterImage(bytes, options2 = {}) {
|
|
1442
|
+
if (!options2 || typeof options2 !== "object" || Array.isArray(options2))
|
|
1443
1443
|
throw new VisioImageError("invalid-limit", "Image limits must be an options object.");
|
|
1444
|
-
const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...
|
|
1444
|
+
const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...options2 };
|
|
1445
1445
|
for (const key2 of Object.keys(VISIO_RASTER_IMAGE_LIMITS)) {
|
|
1446
1446
|
const value3 = limits[key2];
|
|
1447
1447
|
if (!Number.isSafeInteger(value3) || value3 <= 0 || value3 > VISIO_RASTER_IMAGE_LIMITS[key2])
|
|
@@ -1452,10 +1452,10 @@ function inspectVisioRasterImage(bytes, options = {}) {
|
|
|
1452
1452
|
throw new VisioImageError("image-limit", "Raster image bytes exceed the configured limit.");
|
|
1453
1453
|
return inspect(bytes, limits);
|
|
1454
1454
|
}
|
|
1455
|
-
async function readVisioImage(pkg, sourcePart, foreignData, report,
|
|
1455
|
+
async function readVisioImage(pkg, sourcePart, foreignData, report, options2 = {}) {
|
|
1456
1456
|
const limits = {
|
|
1457
1457
|
...VISIO_RASTER_IMAGE_LIMITS,
|
|
1458
|
-
...
|
|
1458
|
+
...options2
|
|
1459
1459
|
};
|
|
1460
1460
|
if (Object.values(limits).some((value3) => !Number.isSafeInteger(value3) || value3 <= 0))
|
|
1461
1461
|
throw new VisioPackageError("INVALID_LIMIT", "Image limits must be positive safe integers.");
|
|
@@ -4231,9 +4231,9 @@ function cellUnit(name3, relative) {
|
|
|
4231
4231
|
return !relative && /\.[XY]\d+$/i.test(name3) ? "length" : "scalar";
|
|
4232
4232
|
}
|
|
4233
4233
|
var isBooleanLiteral = (ref) => ref.shapeId === void 0 && /^(true|false)$/i.test(ref.cell);
|
|
4234
|
-
function indexCells(roots,
|
|
4234
|
+
function indexCells(roots, options2) {
|
|
4235
4235
|
const cells4 = /* @__PURE__ */ new Map();
|
|
4236
|
-
const maxCells = bound(
|
|
4236
|
+
const maxCells = bound(options2.maxCells, 1e5);
|
|
4237
4237
|
const add = (item) => {
|
|
4238
4238
|
const id3 = key(item);
|
|
4239
4239
|
if (cells4.has(id3)) fail("EDIT_AMBIGUOUS_CELL", "Duplicate local ShapeSheet cell.");
|
|
@@ -4259,11 +4259,11 @@ function indexCells(roots, options) {
|
|
|
4259
4259
|
const visit = (parent, inherited, nested) => {
|
|
4260
4260
|
for (const container of children2(parent, "Shapes"))
|
|
4261
4261
|
for (const node3 of children2(container, "Shape")) {
|
|
4262
|
-
|
|
4262
|
+
options2.check?.();
|
|
4263
4263
|
const shapeId2 = attribute2(node3, "ID");
|
|
4264
4264
|
if (!shapeId2 || ids.has(shapeId2)) fail("INVALID_SHAPE_ID", "Shape IDs must be unique.");
|
|
4265
4265
|
ids.add(shapeId2);
|
|
4266
|
-
const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute2(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute2(node3, "Type") !== void 0 && attribute2(node3, "Type") !== "Shape" || children2(node3, "ForeignData").length > 0 || children2(node3, "Rel").length > 0) || connected.has(shapeId2) && !
|
|
4266
|
+
const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute2(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute2(node3, "Type") !== void 0 && attribute2(node3, "Type") !== "Shape" || children2(node3, "ForeignData").length > 0 || children2(node3, "Rel").length > 0) || connected.has(shapeId2) && !options2.glueShapes?.has(node3) || !options2.lineEditShapes?.has(node3) && children2(node3, "Cell").some(
|
|
4267
4267
|
(cell) => /^(BeginX|BeginY|EndX|EndY)$/i.test(attribute2(cell, "N") ?? "") || attribute2(cell, "N")?.toLowerCase() === "oned" && (attribute2(cell, "V") !== "0" || !!executableCellFormula(attribute2(cell, "F")) || attribute2(cell, "F") === "Inh")
|
|
4268
4268
|
) || children2(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node3, "Del") ?? "");
|
|
4269
4269
|
sheets.push({ node: node3, shapeId: shapeId2, unsafe: unsafe2 });
|
|
@@ -4356,7 +4356,7 @@ function indexCells(roots, options) {
|
|
|
4356
4356
|
}
|
|
4357
4357
|
}
|
|
4358
4358
|
for (const node3 of Array.from(root2.getElementsByTagName("*"))) {
|
|
4359
|
-
|
|
4359
|
+
options2.check?.();
|
|
4360
4360
|
if (node3.hasAttribute("F") && !indexedNodes.has(node3))
|
|
4361
4361
|
fail(
|
|
4362
4362
|
"EDIT_UNKNOWN_DEPENDENCY",
|
|
@@ -4368,12 +4368,12 @@ function indexCells(roots, options) {
|
|
|
4368
4368
|
}
|
|
4369
4369
|
|
|
4370
4370
|
// visio/edit-recalculate-values.ts
|
|
4371
|
-
function createVisioCellEvaluator(cells4,
|
|
4371
|
+
function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
4372
4372
|
const active = /* @__PURE__ */ new Set(), values = /* @__PURE__ */ new Map();
|
|
4373
|
-
let steps = bound(
|
|
4374
|
-
const maxDepth = bound(
|
|
4373
|
+
let steps = bound(options2.maxSteps, 1e5);
|
|
4374
|
+
const maxDepth = bound(options2.maxDepth, 64);
|
|
4375
4375
|
const evaluate = (id3) => {
|
|
4376
|
-
|
|
4376
|
+
options2.check?.();
|
|
4377
4377
|
if (--steps < 0)
|
|
4378
4378
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
4379
4379
|
const cached5 = values.get(id3);
|
|
@@ -4382,7 +4382,7 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4382
4382
|
if (active.size >= maxDepth)
|
|
4383
4383
|
fail("LIMIT_FORMULA_DEPTH", "ShapeSheet dependency depth limit exceeded.");
|
|
4384
4384
|
const item = cells4.get(id3);
|
|
4385
|
-
if (!item || item.unsafe && (!item.node || !
|
|
4385
|
+
if (!item || item.unsafe && (!item.node || !options2.masterMovePins?.has(item.node) && !options2.groupRotationCells?.has(item.node)))
|
|
4386
4386
|
fail(
|
|
4387
4387
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
4388
4388
|
"Affected formula references missing, inherited or grouped cells."
|
|
@@ -4406,7 +4406,7 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4406
4406
|
key({ pageId: item.pageId, shapeId: ref.shapeId ?? item.shapeId, cell: ref.cell })
|
|
4407
4407
|
),
|
|
4408
4408
|
{
|
|
4409
|
-
...
|
|
4409
|
+
...options2.pageContext?.get(item.pageId),
|
|
4410
4410
|
onStep: () => {
|
|
4411
4411
|
if (--steps < 0)
|
|
4412
4412
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
@@ -4438,8 +4438,8 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4438
4438
|
}
|
|
4439
4439
|
|
|
4440
4440
|
// visio/edit-recalculate.ts
|
|
4441
|
-
function recalculateVisioCells(roots, changed,
|
|
4442
|
-
const cells4 = indexCells(roots,
|
|
4441
|
+
function recalculateVisioCells(roots, changed, options2 = {}) {
|
|
4442
|
+
const cells4 = indexCells(roots, options2);
|
|
4443
4443
|
const reverse = /* @__PURE__ */ new Map();
|
|
4444
4444
|
for (const [id3, item] of cells4)
|
|
4445
4445
|
for (const dependency of item.dependencies) {
|
|
@@ -4449,9 +4449,9 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
4449
4449
|
}
|
|
4450
4450
|
const affected = new Set(changed.map(key));
|
|
4451
4451
|
const pending2 = [...affected];
|
|
4452
|
-
const maxAffected = bound(
|
|
4452
|
+
const maxAffected = bound(options2.maxAffectedCells, 1e4);
|
|
4453
4453
|
for (let i = 0; i < pending2.length; i++) {
|
|
4454
|
-
|
|
4454
|
+
options2.check?.();
|
|
4455
4455
|
for (const id3 of reverse.get(pending2[i]) ?? [])
|
|
4456
4456
|
if (!affected.has(id3)) {
|
|
4457
4457
|
affected.add(id3);
|
|
@@ -4460,7 +4460,7 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
4460
4460
|
if (affected.size > maxAffected)
|
|
4461
4461
|
fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
|
|
4462
4462
|
}
|
|
4463
|
-
const evaluate = createVisioCellEvaluator(cells4,
|
|
4463
|
+
const evaluate = createVisioCellEvaluator(cells4, options2);
|
|
4464
4464
|
const values = /* @__PURE__ */ new Map();
|
|
4465
4465
|
for (const id3 of affected) values.set(id3, evaluate(id3));
|
|
4466
4466
|
const pages = /* @__PURE__ */ new Set();
|
|
@@ -4476,10 +4476,10 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
4476
4476
|
}
|
|
4477
4477
|
return [...pages];
|
|
4478
4478
|
}
|
|
4479
|
-
function assertVisioShapesUnreferenced(roots, removed,
|
|
4480
|
-
const cells4 = indexCells(roots,
|
|
4479
|
+
function assertVisioShapesUnreferenced(roots, removed, options2 = {}) {
|
|
4480
|
+
const cells4 = indexCells(roots, options2);
|
|
4481
4481
|
for (const cell of cells4.values()) {
|
|
4482
|
-
|
|
4482
|
+
options2.check?.();
|
|
4483
4483
|
if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
|
|
4484
4484
|
if (cell.dependencies.some((id3) => {
|
|
4485
4485
|
const parts = JSON.parse(id3);
|
|
@@ -4490,24 +4490,24 @@ function assertVisioShapesUnreferenced(roots, removed, options = {}) {
|
|
|
4490
4490
|
for (const [pageId2, ids] of removed)
|
|
4491
4491
|
for (const connections2 of children2(roots.get(pageId2), "Connects"))
|
|
4492
4492
|
for (const connection of children2(connections2, "Connect")) {
|
|
4493
|
-
|
|
4493
|
+
options2.check?.();
|
|
4494
4494
|
if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
|
|
4495
4495
|
fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
4496
4496
|
}
|
|
4497
4497
|
}
|
|
4498
|
-
function assertVisioShapeUnreferenced(roots, pageId2, shapeId2,
|
|
4499
|
-
assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]),
|
|
4498
|
+
function assertVisioShapeUnreferenced(roots, pageId2, shapeId2, options2 = {}) {
|
|
4499
|
+
assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
4500
4500
|
}
|
|
4501
|
-
function createVisioDependencyQuery(roots,
|
|
4502
|
-
const cells4 = indexCells(roots,
|
|
4501
|
+
function createVisioDependencyQuery(roots, options2 = {}) {
|
|
4502
|
+
const cells4 = indexCells(roots, options2);
|
|
4503
4503
|
return (source, targets) => {
|
|
4504
4504
|
const wanted = new Set(targets.map(key));
|
|
4505
4505
|
const seen = /* @__PURE__ */ new Set();
|
|
4506
4506
|
const pending2 = [key(source)];
|
|
4507
|
-
const maxSteps = bound(
|
|
4507
|
+
const maxSteps = bound(options2.maxSteps, 1e5);
|
|
4508
4508
|
let found = false;
|
|
4509
4509
|
while (pending2.length) {
|
|
4510
|
-
|
|
4510
|
+
options2.check?.();
|
|
4511
4511
|
const id3 = pending2.pop();
|
|
4512
4512
|
if (seen.has(id3)) continue;
|
|
4513
4513
|
seen.add(id3);
|
|
@@ -5802,16 +5802,16 @@ function emfInputView(input) {
|
|
|
5802
5802
|
return null;
|
|
5803
5803
|
}
|
|
5804
5804
|
}
|
|
5805
|
-
function emfInputOptions(
|
|
5806
|
-
if (!
|
|
5805
|
+
function emfInputOptions(options2) {
|
|
5806
|
+
if (!options2 || typeof options2 !== "object") return null;
|
|
5807
5807
|
try {
|
|
5808
|
-
const prototype = Object.getPrototypeOf(
|
|
5808
|
+
const prototype = Object.getPrototypeOf(options2);
|
|
5809
5809
|
if (prototype !== null && prototype !== Object.prototype) return null;
|
|
5810
5810
|
const snapshot2 = {};
|
|
5811
5811
|
for (const key2 of Object.keys(
|
|
5812
5812
|
VISIO_EMF_ADMISSION_LIMITS
|
|
5813
5813
|
)) {
|
|
5814
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
5814
|
+
const descriptor = Object.getOwnPropertyDescriptor(options2, key2);
|
|
5815
5815
|
if (!descriptor) continue;
|
|
5816
5816
|
if (!("value" in descriptor)) return null;
|
|
5817
5817
|
const value3 = descriptor.value;
|
|
@@ -5827,18 +5827,18 @@ function emfInputOptions(options) {
|
|
|
5827
5827
|
|
|
5828
5828
|
// visio/emf-admission-context.ts
|
|
5829
5829
|
var EmfAdmissionContext = class {
|
|
5830
|
-
constructor(view2,
|
|
5830
|
+
constructor(view2, options2) {
|
|
5831
5831
|
this.view = view2;
|
|
5832
5832
|
this.limits = { ...VISIO_EMF_ADMISSION_LIMITS };
|
|
5833
|
-
if (!
|
|
5833
|
+
if (!options2 || typeof options2 !== "object") {
|
|
5834
5834
|
this.emit("invalid", "limits", "Expected an options object.");
|
|
5835
5835
|
return;
|
|
5836
5836
|
}
|
|
5837
|
-
const cap =
|
|
5837
|
+
const cap = options2.maxDiagnostics;
|
|
5838
5838
|
if (cap !== void 0 && Number.isInteger(cap) && cap > 0 && cap <= this.limits.maxDiagnostics)
|
|
5839
5839
|
this.limits.maxDiagnostics = cap;
|
|
5840
5840
|
for (const key2 of Object.keys(VISIO_EMF_ADMISSION_LIMITS)) {
|
|
5841
|
-
const value3 =
|
|
5841
|
+
const value3 = options2[key2];
|
|
5842
5842
|
if (value3 === void 0) continue;
|
|
5843
5843
|
if (!Number.isSafeInteger(value3) || value3 < 1 || value3 > this.limits[key2])
|
|
5844
5844
|
this.emit("invalid", "limits", "Limits must be positive integers below the hard ceiling.");
|
|
@@ -6391,8 +6391,8 @@ function inspectEmfObjectRecord(c2) {
|
|
|
6391
6391
|
}
|
|
6392
6392
|
|
|
6393
6393
|
// visio/emf-admission.ts
|
|
6394
|
-
function inspectVisioEmfAdmission(input,
|
|
6395
|
-
const snapshot2 = emfInputOptions(
|
|
6394
|
+
function inspectVisioEmfAdmission(input, options2 = {}) {
|
|
6395
|
+
const snapshot2 = emfInputOptions(options2);
|
|
6396
6396
|
const view2 = snapshot2 === null ? null : emfInputView(input);
|
|
6397
6397
|
const c2 = new EmfAdmissionContext(view2 ?? new DataView(new ArrayBuffer(0)), snapshot2 ?? {});
|
|
6398
6398
|
if (snapshot2 === null) {
|
|
@@ -6616,9 +6616,9 @@ function record(value3, allowed) {
|
|
|
6616
6616
|
}
|
|
6617
6617
|
return result2;
|
|
6618
6618
|
}
|
|
6619
|
-
function limitsFor(
|
|
6619
|
+
function limitsFor(options2) {
|
|
6620
6620
|
const result2 = { ...VISIO_FOREIGN_VECTOR_LIMITS };
|
|
6621
|
-
const values = record(
|
|
6621
|
+
const values = record(options2, Object.keys(result2));
|
|
6622
6622
|
for (const key2 of Object.keys(values)) {
|
|
6623
6623
|
const value3 = values[key2];
|
|
6624
6624
|
if (typeof value3 !== "number" || !Number.isSafeInteger(value3) || value3 < 1 || value3 > result2[key2])
|
|
@@ -6964,9 +6964,9 @@ var PAINT = {
|
|
|
6964
6964
|
fillOpacity: "fill-opacity",
|
|
6965
6965
|
strokeOpacity: "stroke-opacity"
|
|
6966
6966
|
};
|
|
6967
|
-
function validateVisioForeignVector(value3,
|
|
6967
|
+
function validateVisioForeignVector(value3, options2 = {}) {
|
|
6968
6968
|
try {
|
|
6969
|
-
return validate(value3, limitsFor(
|
|
6969
|
+
return validate(value3, limitsFor(options2));
|
|
6970
6970
|
} catch (error) {
|
|
6971
6971
|
if (error instanceof VisioForeignVectorError) throw error;
|
|
6972
6972
|
unsafe("Unable to inspect vector scene safely.");
|
|
@@ -7128,9 +7128,9 @@ var ATTRS = {
|
|
|
7128
7128
|
clipPath: ["id", "clipPathUnits", "clip-rule", ...BASE]
|
|
7129
7129
|
};
|
|
7130
7130
|
var ID = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
|
|
7131
|
-
function sanitizeVisioForeignVectorTree(root2,
|
|
7131
|
+
function sanitizeVisioForeignVectorTree(root2, options2 = {}) {
|
|
7132
7132
|
try {
|
|
7133
|
-
return sanitize(root2, limitsFor(
|
|
7133
|
+
return sanitize(root2, limitsFor(options2));
|
|
7134
7134
|
} catch (error) {
|
|
7135
7135
|
if (error instanceof VisioForeignVectorError) throw error;
|
|
7136
7136
|
unsafe("Unable to inspect converter output safely.");
|
|
@@ -8669,15 +8669,15 @@ function renderAbs(v, section3, generalWidth) {
|
|
|
8669
8669
|
}
|
|
8670
8670
|
return { text: text6, zero: general === "0" };
|
|
8671
8671
|
}
|
|
8672
|
-
function hashFill(
|
|
8673
|
-
const width =
|
|
8674
|
-
const one =
|
|
8672
|
+
function hashFill(options2) {
|
|
8673
|
+
const width = options2.width ?? 0;
|
|
8674
|
+
const one = options2.measure ? options2.measure("#") : 1;
|
|
8675
8675
|
return "#".repeat(Math.max(1, Math.floor(one > 0 ? width / one : width)));
|
|
8676
8676
|
}
|
|
8677
|
-
function fitNumber(value3, format5,
|
|
8678
|
-
const date1904 =
|
|
8679
|
-
const width =
|
|
8680
|
-
const fits = (text6) => (
|
|
8677
|
+
function fitNumber(value3, format5, options2) {
|
|
8678
|
+
const date1904 = options2.date1904 ?? false;
|
|
8679
|
+
const width = options2.width ?? 0;
|
|
8680
|
+
const fits = (text6) => (options2.measure ? options2.measure(text6) : text6.length) <= width;
|
|
8681
8681
|
const first2 = formatNumber2(value3, format5, date1904);
|
|
8682
8682
|
if (fits(first2.text) || first2.text === OVERFLOW_TEXT) return first2;
|
|
8683
8683
|
const choice2 = chooseSection(compileFormat(format5), value3);
|
|
@@ -8688,7 +8688,7 @@ function fitNumber(value3, format5, options) {
|
|
|
8688
8688
|
if (fits(next.text)) return next;
|
|
8689
8689
|
}
|
|
8690
8690
|
}
|
|
8691
|
-
const fill = hashFill(
|
|
8691
|
+
const fill = hashFill(options2);
|
|
8692
8692
|
return first2.color ? { text: fill, color: first2.color } : { text: fill };
|
|
8693
8693
|
}
|
|
8694
8694
|
function formatNumber2(value3, format5, date1904, generalWidth) {
|
|
@@ -8710,13 +8710,13 @@ function formatNumber2(value3, format5, date1904, generalWidth) {
|
|
|
8710
8710
|
const minus = value3 < 0 && !abs && !zero;
|
|
8711
8711
|
return result(minus ? `-${text6}` : text6, section3);
|
|
8712
8712
|
}
|
|
8713
|
-
function formatValue(value3, format5,
|
|
8713
|
+
function formatValue(value3, format5, options2 = {}) {
|
|
8714
8714
|
if (value3 === null) return { text: "" };
|
|
8715
8715
|
if (typeof value3 === "boolean") return { text: value3 ? "TRUE" : "FALSE" };
|
|
8716
8716
|
if (typeof value3 === "string") return formatText(value3, compileFormat(format5).text);
|
|
8717
8717
|
if (isCellError(value3)) return { text: value3.error };
|
|
8718
|
-
if (
|
|
8719
|
-
return formatNumber2(value3, format5,
|
|
8718
|
+
if (options2.width !== void 0) return fitNumber(value3, format5, options2);
|
|
8719
|
+
return formatNumber2(value3, format5, options2.date1904 ?? false);
|
|
8720
8720
|
}
|
|
8721
8721
|
|
|
8722
8722
|
// xlsx/formula/ast.ts
|
|
@@ -12755,8 +12755,8 @@ function rgbToHsl(r, g, b) {
|
|
|
12755
12755
|
}
|
|
12756
12756
|
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
12757
12757
|
}
|
|
12758
|
-
function hslToRgb(h, s, l, roundChannel = Math.round,
|
|
12759
|
-
const sC =
|
|
12758
|
+
function hslToRgb(h, s, l, roundChannel = Math.round, options2) {
|
|
12759
|
+
const sC = options2?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
12760
12760
|
const lC = clampUnitInterval(l);
|
|
12761
12761
|
const hN = (h % 360 + 360) % 360;
|
|
12762
12762
|
const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
@@ -12991,13 +12991,13 @@ var APPLIED = /* @__PURE__ */ new Set([
|
|
|
12991
12991
|
"lumMod",
|
|
12992
12992
|
"lumOff"
|
|
12993
12993
|
]);
|
|
12994
|
-
function resolveDrawingColor(color2, theme2,
|
|
12994
|
+
function resolveDrawingColor(color2, theme2, options2) {
|
|
12995
12995
|
const base2 = baseHex(color2, theme2);
|
|
12996
12996
|
const rgb6 = base2 ? hexToRgbChannels(base2) : null;
|
|
12997
12997
|
if (!rgb6) return void 0;
|
|
12998
|
-
if (
|
|
12998
|
+
if (options2?.transformOrder === "document") {
|
|
12999
12999
|
const value3 = orderedColorTransforms(rgb6, color2.transforms);
|
|
13000
|
-
const round3 =
|
|
13000
|
+
const round3 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
13001
13001
|
return {
|
|
13002
13002
|
hex: `#${toHex(round3(value3.r))}${toHex(round3(value3.g))}${toHex(round3(value3.b))}`,
|
|
13003
13003
|
alpha: value3.alpha,
|
|
@@ -13048,7 +13048,7 @@ function resolveDrawingColor(color2, theme2, options) {
|
|
|
13048
13048
|
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
13049
13049
|
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
13050
13050
|
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
13051
|
-
const round3 =
|
|
13051
|
+
const round3 = options2?.hslRounding === "halfDown" ? (value3) => Math.ceil(value3 - 0.5) : Math.round;
|
|
13052
13052
|
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round3));
|
|
13053
13053
|
}
|
|
13054
13054
|
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
@@ -15858,6 +15858,74 @@ function parseChartSpace(source) {
|
|
|
15858
15858
|
);
|
|
15859
15859
|
return { chartSpace, issues: context.issues };
|
|
15860
15860
|
}
|
|
15861
|
+
var AUTOMATIC_MARKER_CYCLE = [
|
|
15862
|
+
"diamond",
|
|
15863
|
+
"square",
|
|
15864
|
+
"triangle",
|
|
15865
|
+
"x",
|
|
15866
|
+
"star",
|
|
15867
|
+
"circle",
|
|
15868
|
+
"plus",
|
|
15869
|
+
"dot",
|
|
15870
|
+
"dash"
|
|
15871
|
+
];
|
|
15872
|
+
function automaticMarkerSymbol(seriesIdx) {
|
|
15873
|
+
const length = AUTOMATIC_MARKER_CYCLE.length;
|
|
15874
|
+
const normalized = (Math.trunc(seriesIdx) % length + length) % length;
|
|
15875
|
+
return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
|
|
15876
|
+
}
|
|
15877
|
+
|
|
15878
|
+
// chart/render/chart-view-markers.ts
|
|
15879
|
+
function summaryMarkers(source, group2, seriesPosition) {
|
|
15880
|
+
if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
|
|
15881
|
+
const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
|
|
15882
|
+
const symbol = source.marker?.symbol;
|
|
15883
|
+
const marker3 = {
|
|
15884
|
+
...source.marker,
|
|
15885
|
+
symbol: symbol && symbol !== "auto" ? symbol : source.marker || enabled ? automaticMarkerSymbol(source.index ?? seriesPosition) : "none"
|
|
15886
|
+
};
|
|
15887
|
+
const pointMarkers = {};
|
|
15888
|
+
for (const point2 of source.dataPoints) {
|
|
15889
|
+
if (point2.index === void 0 || !point2.marker) continue;
|
|
15890
|
+
const override = point2.marker;
|
|
15891
|
+
pointMarkers[point2.index] = {
|
|
15892
|
+
...marker3,
|
|
15893
|
+
...override,
|
|
15894
|
+
...override.symbol === "auto" || !source.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source.index ?? seriesPosition) } : {},
|
|
15895
|
+
...marker3.spPr || override.spPr ? {
|
|
15896
|
+
spPr: {
|
|
15897
|
+
...marker3.spPr,
|
|
15898
|
+
...override.spPr,
|
|
15899
|
+
...marker3.spPr?.line || override.spPr?.line ? { line: { ...marker3.spPr?.line, ...override.spPr?.line } } : {}
|
|
15900
|
+
}
|
|
15901
|
+
} : {}
|
|
15902
|
+
};
|
|
15903
|
+
}
|
|
15904
|
+
return { marker: marker3, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
|
|
15905
|
+
}
|
|
15906
|
+
function seriesMarkerViews(source, drawingColor2) {
|
|
15907
|
+
const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor2(fill.color) : void 0;
|
|
15908
|
+
const resolve = (marker3) => {
|
|
15909
|
+
const fill = fillColor(marker3.spPr?.fill);
|
|
15910
|
+
const stroke = fillColor(marker3.spPr?.line?.fill);
|
|
15911
|
+
const width = marker3.spPr?.line?.widthEmu;
|
|
15912
|
+
return {
|
|
15913
|
+
...marker3.symbol !== void 0 ? { symbol: marker3.symbol } : {},
|
|
15914
|
+
...marker3.size !== void 0 ? { size: marker3.size } : {},
|
|
15915
|
+
...fill !== void 0 ? { fill } : {},
|
|
15916
|
+
...stroke !== void 0 ? { stroke } : {},
|
|
15917
|
+
...width !== void 0 ? { strokeWidth: width / 9525 } : {}
|
|
15918
|
+
};
|
|
15919
|
+
};
|
|
15920
|
+
return {
|
|
15921
|
+
...source.marker ? { marker: resolve(source.marker) } : {},
|
|
15922
|
+
...source.pointMarkers ? {
|
|
15923
|
+
pointMarkers: Object.fromEntries(
|
|
15924
|
+
Object.entries(source.pointMarkers).map(([i, marker3]) => [i, resolve(marker3)])
|
|
15925
|
+
)
|
|
15926
|
+
} : {}
|
|
15927
|
+
};
|
|
15928
|
+
}
|
|
15861
15929
|
|
|
15862
15930
|
// chart/render/summary-analysis.ts
|
|
15863
15931
|
function summaryTrendline(source) {
|
|
@@ -16181,17 +16249,17 @@ function composeDataLabelText(input) {
|
|
|
16181
16249
|
}
|
|
16182
16250
|
|
|
16183
16251
|
// chart/render/summary-labels.ts
|
|
16184
|
-
function level(
|
|
16252
|
+
function level(options2, custom) {
|
|
16185
16253
|
const out = {};
|
|
16186
|
-
if (
|
|
16187
|
-
if (
|
|
16188
|
-
if (
|
|
16189
|
-
if (
|
|
16190
|
-
if (
|
|
16191
|
-
if (
|
|
16192
|
-
if (
|
|
16193
|
-
if (
|
|
16194
|
-
if (
|
|
16254
|
+
if (options2.deleted !== void 0) out.deleted = options2.deleted;
|
|
16255
|
+
if (options2.showValue !== void 0) out.showValue = options2.showValue;
|
|
16256
|
+
if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
|
|
16257
|
+
if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
|
|
16258
|
+
if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
|
|
16259
|
+
if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
|
|
16260
|
+
if (options2.separator !== void 0) out.separator = options2.separator;
|
|
16261
|
+
if (options2.position) out.position = options2.position;
|
|
16262
|
+
if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
|
|
16195
16263
|
if (custom?.text !== void 0) out.text = custom.text;
|
|
16196
16264
|
return out;
|
|
16197
16265
|
}
|
|
@@ -16298,7 +16366,10 @@ function extraGroups(chartSpace, firstType) {
|
|
|
16298
16366
|
const type = group2.kind === "bar" ? "column" : group2.kind;
|
|
16299
16367
|
const entry3 = {
|
|
16300
16368
|
chartType: type,
|
|
16301
|
-
series: group2.series.map((source) =>
|
|
16369
|
+
series: group2.series.map((source, index2) => ({
|
|
16370
|
+
...chartSummarySeries(source, type, group2.dataLabels),
|
|
16371
|
+
...summaryMarkers(source, group2, index2)
|
|
16372
|
+
})),
|
|
16302
16373
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
16303
16374
|
};
|
|
16304
16375
|
if (group2.grouping && GROUPINGS.has(group2.grouping))
|
|
@@ -16316,13 +16387,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
16316
16387
|
const group2 = chartSpace.plotArea.groups[0];
|
|
16317
16388
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
16318
16389
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
16319
|
-
const series = (group2?.series ?? []).map(
|
|
16320
|
-
|
|
16321
|
-
|
|
16390
|
+
const series = (group2?.series ?? []).map((source, index2) => ({
|
|
16391
|
+
...chartSummarySeries(source, chartType, group2?.dataLabels),
|
|
16392
|
+
...group2 ? summaryMarkers(source, group2, index2) : {}
|
|
16393
|
+
}));
|
|
16322
16394
|
const summary = {
|
|
16323
16395
|
chartType,
|
|
16324
16396
|
series,
|
|
16325
|
-
showLegend: chartSpace.legend !== void 0
|
|
16397
|
+
showLegend: chartSpace.legend !== void 0,
|
|
16398
|
+
axes: chartSpace.plotArea.axes,
|
|
16399
|
+
axisIds: group2?.axisIds ?? []
|
|
16326
16400
|
};
|
|
16327
16401
|
const combined = extraGroups(chartSpace, chartType);
|
|
16328
16402
|
if (combined.length) summary.extraGroups = combined;
|
|
@@ -16405,6 +16479,8 @@ function parseChart(xml, anchor, partName, name3) {
|
|
|
16405
16479
|
showLegend: summary.showLegend,
|
|
16406
16480
|
partName
|
|
16407
16481
|
};
|
|
16482
|
+
if (summary.axes) object.axes = summary.axes;
|
|
16483
|
+
if (summary.axisIds) object.axisIds = summary.axisIds;
|
|
16408
16484
|
if (summary.grouping) object.grouping = summary.grouping;
|
|
16409
16485
|
if (summary.barGapWidth !== void 0) object.barGapWidth = summary.barGapWidth;
|
|
16410
16486
|
if (summary.barOverlap !== void 0) object.barOverlap = summary.barOverlap;
|
|
@@ -17825,14 +17901,14 @@ function* units2(raw) {
|
|
|
17825
17901
|
exp++;
|
|
17826
17902
|
}
|
|
17827
17903
|
}
|
|
17828
|
-
function niceScale(dataMin, dataMax,
|
|
17829
|
-
const maxIntervals = Math.max(1,
|
|
17904
|
+
function niceScale(dataMin, dataMax, options2 = {}) {
|
|
17905
|
+
const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
|
|
17830
17906
|
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
17831
17907
|
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
17832
17908
|
if (lo > hi) [lo, hi] = [hi, lo];
|
|
17833
17909
|
if (lo === hi) {
|
|
17834
17910
|
if (lo === 0) hi = 1;
|
|
17835
|
-
else if (
|
|
17911
|
+
else if (options2.noZero) {
|
|
17836
17912
|
const pad5 = Math.abs(lo) * 0.1 || 1;
|
|
17837
17913
|
lo -= pad5;
|
|
17838
17914
|
hi += pad5;
|
|
@@ -17841,7 +17917,7 @@ function niceScale(dataMin, dataMax, options = {}) {
|
|
|
17841
17917
|
}
|
|
17842
17918
|
let fixedLo = false;
|
|
17843
17919
|
let fixedHi = false;
|
|
17844
|
-
if (!
|
|
17920
|
+
if (!options2.noZero) {
|
|
17845
17921
|
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
17846
17922
|
lo = 0;
|
|
17847
17923
|
fixedLo = true;
|
|
@@ -17881,6 +17957,194 @@ function formatAxisValue(value3, percent = false) {
|
|
|
17881
17957
|
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
17882
17958
|
}
|
|
17883
17959
|
|
|
17960
|
+
// chart/axis-range.ts
|
|
17961
|
+
function computeLogValueRange(series, logBase) {
|
|
17962
|
+
const allValues = series.flatMap((item) => item.values).filter((value3) => value3 !== null && Number.isFinite(value3) && value3 > 0);
|
|
17963
|
+
if (allValues.length === 0) {
|
|
17964
|
+
return { min: 1, max: logBase, span: 1, logScale: true, logBase };
|
|
17965
|
+
}
|
|
17966
|
+
const dataMin = Math.min(...allValues);
|
|
17967
|
+
const dataMax = Math.max(...allValues);
|
|
17968
|
+
const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
|
|
17969
|
+
const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
|
|
17970
|
+
const min = logBase ** logMin;
|
|
17971
|
+
const max = logBase ** Math.max(logMax, logMin + 1);
|
|
17972
|
+
return {
|
|
17973
|
+
min,
|
|
17974
|
+
max,
|
|
17975
|
+
span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
|
|
17976
|
+
logScale: true,
|
|
17977
|
+
logBase
|
|
17978
|
+
};
|
|
17979
|
+
}
|
|
17980
|
+
function withAxisBounds(automatic, axis, logBase) {
|
|
17981
|
+
const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
|
|
17982
|
+
const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
|
|
17983
|
+
const min = validMin ?? automatic.min;
|
|
17984
|
+
let max = validMax ?? automatic.max;
|
|
17985
|
+
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
17986
|
+
if (max <= min) {
|
|
17987
|
+
max = logBase ? min * logBase : min + 1;
|
|
17988
|
+
}
|
|
17989
|
+
const span = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
|
|
17990
|
+
return {
|
|
17991
|
+
min,
|
|
17992
|
+
max,
|
|
17993
|
+
span: Math.max(span, Number.EPSILON),
|
|
17994
|
+
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
17995
|
+
...logBase ? { logScale: true, logBase } : {},
|
|
17996
|
+
...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
17997
|
+
};
|
|
17998
|
+
}
|
|
17999
|
+
|
|
18000
|
+
// chart/axis-ticks.ts
|
|
18001
|
+
var LOG_EXPONENT_TOLERANCE = 1e-12;
|
|
18002
|
+
function generateLogTicks(range2) {
|
|
18003
|
+
if (!range2.logScale || !range2.logBase) {
|
|
18004
|
+
return [];
|
|
18005
|
+
}
|
|
18006
|
+
const base2 = range2.logBase;
|
|
18007
|
+
const logMin = Math.log(range2.min) / Math.log(base2);
|
|
18008
|
+
const logMax = Math.log(range2.max) / Math.log(base2);
|
|
18009
|
+
const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
|
|
18010
|
+
const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
|
|
18011
|
+
if (lastExponent < firstExponent) {
|
|
18012
|
+
return range2.min === range2.max ? [range2.min] : [range2.min, range2.max];
|
|
18013
|
+
}
|
|
18014
|
+
return Array.from(
|
|
18015
|
+
{ length: lastExponent - firstExponent + 1 },
|
|
18016
|
+
(_unused, index2) => base2 ** (firstExponent + index2)
|
|
18017
|
+
);
|
|
18018
|
+
}
|
|
18019
|
+
function generateIntervalTicks(range2, unit3) {
|
|
18020
|
+
if (!Number.isFinite(unit3) || unit3 <= 0 || range2.logScale) {
|
|
18021
|
+
return [];
|
|
18022
|
+
}
|
|
18023
|
+
const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-12;
|
|
18024
|
+
const first2 = Math.ceil((range2.min - tolerance) / unit3);
|
|
18025
|
+
const last = Math.floor((range2.max + tolerance) / unit3);
|
|
18026
|
+
const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
|
|
18027
|
+
return Array.from({ length: count }, (_, index2) => (first2 + index2) * unit3);
|
|
18028
|
+
}
|
|
18029
|
+
function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
18030
|
+
if (range2.logScale && range2.logBase) {
|
|
18031
|
+
return generateLogTicks(range2);
|
|
18032
|
+
}
|
|
18033
|
+
const explicit = generateIntervalTicks(range2, axis?.majorUnit ?? 0);
|
|
18034
|
+
if (explicit.length > 0) {
|
|
18035
|
+
return explicit;
|
|
18036
|
+
}
|
|
18037
|
+
const automatic = generateIntervalTicks(range2, range2.majorUnit ?? 0);
|
|
18038
|
+
if (automatic.length > 0) {
|
|
18039
|
+
return automatic;
|
|
18040
|
+
}
|
|
18041
|
+
return Array.from(
|
|
18042
|
+
{ length: defaultIntervals + 1 },
|
|
18043
|
+
(_, index2) => range2.min + range2.span / defaultIntervals * index2
|
|
18044
|
+
);
|
|
18045
|
+
}
|
|
18046
|
+
function generateMinorAxisTicks(range2, axis) {
|
|
18047
|
+
const minor = generateIntervalTicks(range2, axis?.minorUnit ?? 0);
|
|
18048
|
+
if (minor.length === 0) {
|
|
18049
|
+
return [];
|
|
18050
|
+
}
|
|
18051
|
+
const majorUnit = axis?.majorUnit;
|
|
18052
|
+
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
18053
|
+
return minor;
|
|
18054
|
+
}
|
|
18055
|
+
const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-10;
|
|
18056
|
+
return minor.filter(
|
|
18057
|
+
(value3) => Math.abs(value3 / majorUnit - Math.round(value3 / majorUnit)) > tolerance
|
|
18058
|
+
);
|
|
18059
|
+
}
|
|
18060
|
+
|
|
18061
|
+
// chart/render/chart-view-axes.ts
|
|
18062
|
+
function options(axis) {
|
|
18063
|
+
return {
|
|
18064
|
+
...axis.scaling,
|
|
18065
|
+
...axis.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
18066
|
+
...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
|
|
18067
|
+
...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
|
|
18068
|
+
};
|
|
18069
|
+
}
|
|
18070
|
+
function applyChartAxes(model2, chart, color2) {
|
|
18071
|
+
if (!chart.axes?.length) return;
|
|
18072
|
+
const axes = chart.axes;
|
|
18073
|
+
const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
|
|
18074
|
+
const candidates = linked.length ? linked : axes;
|
|
18075
|
+
const xy = model2.type === "scatter" || model2.type === "bubble";
|
|
18076
|
+
const value3 = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
|
|
18077
|
+
const category = candidates.find(
|
|
18078
|
+
(axis) => xy ? axis.kind === "val" && axis !== value3 : axis.kind === "cat" || axis.kind === "date"
|
|
18079
|
+
);
|
|
18080
|
+
const secondary = axes.find((axis) => axis.kind === "val" && axis !== value3 && axis !== category);
|
|
18081
|
+
const paint2 = (shape) => {
|
|
18082
|
+
const ln = shape?.line;
|
|
18083
|
+
const fill = ln?.fill;
|
|
18084
|
+
const resolved = fill?.kind === "none" ? "none" : color2(fill?.kind === "solid" ? fill.color : void 0);
|
|
18085
|
+
return {
|
|
18086
|
+
...resolved === void 0 ? {} : { color: resolved },
|
|
18087
|
+
...ln?.widthEmu === void 0 ? {} : { width: ln.widthEmu / EMU_PER_PIXEL },
|
|
18088
|
+
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
18089
|
+
};
|
|
18090
|
+
};
|
|
18091
|
+
const bind = (axis, scale, values) => {
|
|
18092
|
+
const opts = options(axis);
|
|
18093
|
+
const automatic = opts.logScale ? computeLogValueRange(
|
|
18094
|
+
[{ values: values ?? [] }],
|
|
18095
|
+
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
18096
|
+
) : {
|
|
18097
|
+
min: scale?.min ?? 0,
|
|
18098
|
+
max: scale?.max ?? 1,
|
|
18099
|
+
span: (scale?.max ?? 1) - (scale?.min ?? 0),
|
|
18100
|
+
...scale ? { majorUnit: scale.majorUnit } : {}
|
|
18101
|
+
};
|
|
18102
|
+
const logBase = automatic.logBase;
|
|
18103
|
+
const range2 = withAxisBounds(automatic, opts, logBase);
|
|
18104
|
+
if (scale) {
|
|
18105
|
+
scale.min = range2.min;
|
|
18106
|
+
scale.max = range2.max;
|
|
18107
|
+
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
18108
|
+
}
|
|
18109
|
+
return {
|
|
18110
|
+
source: axis,
|
|
18111
|
+
range: range2,
|
|
18112
|
+
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
18113
|
+
line: paint2(axis.spPr),
|
|
18114
|
+
majorGrid: paint2(axis.majorGridlinesSpPr),
|
|
18115
|
+
minorGrid: paint2(axis.minorGridlinesSpPr)
|
|
18116
|
+
};
|
|
18117
|
+
};
|
|
18118
|
+
const out = {};
|
|
18119
|
+
if (value3)
|
|
18120
|
+
out.value = bind(
|
|
18121
|
+
value3,
|
|
18122
|
+
model2.valueAxis,
|
|
18123
|
+
[
|
|
18124
|
+
...model2.series,
|
|
18125
|
+
...model2.extraGroups?.filter((g) => !g.secondary).flatMap((g) => g.series) ?? []
|
|
18126
|
+
].flatMap((s) => s.values)
|
|
18127
|
+
);
|
|
18128
|
+
if (category)
|
|
18129
|
+
out.category = bind(
|
|
18130
|
+
category,
|
|
18131
|
+
model2.xAxis ?? {
|
|
18132
|
+
min: 0,
|
|
18133
|
+
max: Math.max(1, model2.categories.length - 1),
|
|
18134
|
+
majorUnit: 1,
|
|
18135
|
+
ticks: []
|
|
18136
|
+
},
|
|
18137
|
+
model2.series.flatMap((s) => s.xValues ?? [])
|
|
18138
|
+
);
|
|
18139
|
+
if (secondary)
|
|
18140
|
+
out.secondary = bind(
|
|
18141
|
+
secondary,
|
|
18142
|
+
model2.secondaryAxis,
|
|
18143
|
+
model2.extraGroups?.filter((g) => g.secondary).flatMap((g) => g.series.flatMap((s) => s.values))
|
|
18144
|
+
);
|
|
18145
|
+
model2.axes = out;
|
|
18146
|
+
}
|
|
18147
|
+
|
|
17884
18148
|
// chart/hierarchy.ts
|
|
17885
18149
|
function normalizeLevels(levels, pointCount) {
|
|
17886
18150
|
return levels.map((level2) => {
|
|
@@ -18103,15 +18367,15 @@ function seriesName(series, index2, evaluateRef2) {
|
|
|
18103
18367
|
const fromRef = resolveRef(series.nameRef, evaluateRef2)?.map(toText).filter((t) => t !== "").join(" ");
|
|
18104
18368
|
return fromRef || series.name || `Series${index2 + 1}`;
|
|
18105
18369
|
}
|
|
18106
|
-
function seriesContext(chart, theme2,
|
|
18370
|
+
function seriesContext(chart, theme2, options2) {
|
|
18107
18371
|
const scheme = chartColorScheme(theme2);
|
|
18108
18372
|
const resolver = { scheme: (name3) => scheme[name3] };
|
|
18109
18373
|
return {
|
|
18110
18374
|
theme: theme2,
|
|
18111
18375
|
scheme,
|
|
18112
18376
|
palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
|
|
18113
|
-
evaluateRef:
|
|
18114
|
-
seriesColor:
|
|
18377
|
+
evaluateRef: options2.evaluateRef ?? (() => []),
|
|
18378
|
+
seriesColor: options2.seriesColor,
|
|
18115
18379
|
drawingColor: (color2) => color2 && drawingColorCss(resolveDrawingColor(color2, resolver, { transformOrder: "document" })),
|
|
18116
18380
|
gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
18117
18381
|
fill,
|
|
@@ -18137,7 +18401,11 @@ function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
|
18137
18401
|
})
|
|
18138
18402
|
);
|
|
18139
18403
|
if (Object.keys(points).length) view2.pointGradients = points;
|
|
18140
|
-
Object.assign(
|
|
18404
|
+
Object.assign(
|
|
18405
|
+
view2,
|
|
18406
|
+
analysisView(s, color2, ctx.drawingColor),
|
|
18407
|
+
seriesMarkerViews(s, ctx.drawingColor)
|
|
18408
|
+
);
|
|
18141
18409
|
return view2;
|
|
18142
18410
|
}
|
|
18143
18411
|
|
|
@@ -18402,14 +18670,14 @@ function scottBinCount(values, min, max) {
|
|
|
18402
18670
|
const width = 3.49 * sd * values.length ** (-1 / 3);
|
|
18403
18671
|
return Math.max(1, Math.ceil((max - min) / width));
|
|
18404
18672
|
}
|
|
18405
|
-
function computeHistogramBins(values,
|
|
18406
|
-
const closed =
|
|
18673
|
+
function computeHistogramBins(values, options2, format5 = String) {
|
|
18674
|
+
const closed = options2.intervalClosed ?? "l";
|
|
18407
18675
|
const finite4 = values.map((value3, sourceIndex) => ({ value: value3, sourceIndex })).filter((item) => Number.isFinite(item.value));
|
|
18408
18676
|
if (finite4.length === 0) {
|
|
18409
18677
|
return [];
|
|
18410
18678
|
}
|
|
18411
|
-
const underflow = typeof
|
|
18412
|
-
const overflow = typeof
|
|
18679
|
+
const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
|
|
18680
|
+
const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
|
|
18413
18681
|
const under = underflow === void 0 ? [] : finite4.filter(
|
|
18414
18682
|
(item) => closed === "r" ? item.value <= underflow : item.value < underflow
|
|
18415
18683
|
);
|
|
@@ -18426,8 +18694,8 @@ function computeHistogramBins(values, options, format5 = String) {
|
|
|
18426
18694
|
if (regular.length > 0) {
|
|
18427
18695
|
const min = Math.min(...regular.map((item) => item.value));
|
|
18428
18696
|
const max = Math.max(...regular.map((item) => item.value));
|
|
18429
|
-
const requestedSize =
|
|
18430
|
-
const requestedCount =
|
|
18697
|
+
const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
|
|
18698
|
+
const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
|
|
18431
18699
|
const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
|
|
18432
18700
|
const count = requestedSize ? Math.max(
|
|
18433
18701
|
closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
|
|
@@ -18478,9 +18746,9 @@ function aggregateByCategory(values, rawCategories) {
|
|
|
18478
18746
|
}
|
|
18479
18747
|
|
|
18480
18748
|
// chart/waterfall.ts
|
|
18481
|
-
function buildWaterfallSteps(values,
|
|
18749
|
+
function buildWaterfallSteps(values, options2) {
|
|
18482
18750
|
const subtotalIndices = new Set(
|
|
18483
|
-
|
|
18751
|
+
options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
|
|
18484
18752
|
);
|
|
18485
18753
|
const steps = [];
|
|
18486
18754
|
let runningTotal = 0;
|
|
@@ -18564,11 +18832,11 @@ function histogramView(chart, model2) {
|
|
|
18564
18832
|
const first2 = model2.series[0];
|
|
18565
18833
|
if (!first2) return;
|
|
18566
18834
|
const raw = first2.values.map((v) => v ?? Number.NaN);
|
|
18567
|
-
const
|
|
18568
|
-
const bins =
|
|
18835
|
+
const options2 = chart.histogram ?? {};
|
|
18836
|
+
const bins = options2.aggregateByCategory ? aggregateByCategory(
|
|
18569
18837
|
first2.values.map((v) => v ?? 0),
|
|
18570
18838
|
model2.categories
|
|
18571
|
-
) : computeHistogramBins(raw,
|
|
18839
|
+
) : computeHistogramBins(raw, options2, formatAxisValue);
|
|
18572
18840
|
model2.categories = bins.map((bin) => bin.label);
|
|
18573
18841
|
first2.values = bins.map((bin) => bin.value);
|
|
18574
18842
|
model2.barGapWidth = 0;
|
|
@@ -18592,11 +18860,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
|
|
|
18592
18860
|
"treemap",
|
|
18593
18861
|
"sunburst"
|
|
18594
18862
|
]);
|
|
18595
|
-
function chartSummaryView(chart, theme2,
|
|
18863
|
+
function chartSummaryView(chart, theme2, options2 = {}) {
|
|
18596
18864
|
const type = chart.chartType;
|
|
18597
18865
|
const radial = type === "pie" || type === "doughnut";
|
|
18598
18866
|
const byPoint = radial || type === "treemap" || type === "sunburst";
|
|
18599
|
-
const ctx = seriesContext(chart, theme2,
|
|
18867
|
+
const ctx = seriesContext(chart, theme2, options2);
|
|
18600
18868
|
const { palette, scheme, drawingColor: drawingColor2 } = ctx;
|
|
18601
18869
|
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
18602
18870
|
const rawCategories = [];
|
|
@@ -18682,6 +18950,7 @@ function chartSummaryView(chart, theme2, options = {}) {
|
|
|
18682
18950
|
else if (!byPoint) model2.valueAxis = valueAxis(model2);
|
|
18683
18951
|
applyDataLabels(model2, chart.series, extra);
|
|
18684
18952
|
chartExtraAxes(model2);
|
|
18953
|
+
applyChartAxes(model2, chart, ctx.drawingColor);
|
|
18685
18954
|
return model2;
|
|
18686
18955
|
}
|
|
18687
18956
|
|
|
@@ -18813,7 +19082,7 @@ async function readEmbeddedChartObject(pkg, sourcePart, foreignData, report) {
|
|
|
18813
19082
|
}
|
|
18814
19083
|
|
|
18815
19084
|
// visio/prepare-images.ts
|
|
18816
|
-
async function prepareImages(shapes, pkg, sourcePart, report,
|
|
19085
|
+
async function prepareImages(shapes, pkg, sourcePart, report, options2, converter) {
|
|
18817
19086
|
for (const shape of shapes) {
|
|
18818
19087
|
if (shape.deleted) continue;
|
|
18819
19088
|
const localReport = (code, message, extra) => report(code, message, { part: sourcePart, shapeId: shape.id, ...extra });
|
|
@@ -18841,12 +19110,12 @@ async function prepareImages(shapes, pkg, sourcePart, report, options, converter
|
|
|
18841
19110
|
sourcePart,
|
|
18842
19111
|
shape.foreignData,
|
|
18843
19112
|
localReport,
|
|
18844
|
-
|
|
19113
|
+
options2
|
|
18845
19114
|
);
|
|
18846
19115
|
if (image) shape.image = image;
|
|
18847
19116
|
}
|
|
18848
19117
|
}
|
|
18849
|
-
await prepareImages(shape.children, pkg, sourcePart, report,
|
|
19118
|
+
await prepareImages(shape.children, pkg, sourcePart, report, options2, converter);
|
|
18850
19119
|
}
|
|
18851
19120
|
}
|
|
18852
19121
|
|
|
@@ -22170,8 +22439,8 @@ function readVisioAnnotations(sheet, pageId2) {
|
|
|
22170
22439
|
}
|
|
22171
22440
|
|
|
22172
22441
|
// visio/shape-metadata.ts
|
|
22173
|
-
function createMetadataBudget(
|
|
22174
|
-
const maxRows =
|
|
22442
|
+
function createMetadataBudget(options2 = {}) {
|
|
22443
|
+
const maxRows = options2.maxRows ?? 1e5, maxCharacters = options2.maxCharacters ?? 5e6;
|
|
22175
22444
|
if (![maxRows, maxCharacters].every((v) => Number.isSafeInteger(v) && v > 0))
|
|
22176
22445
|
throw new VisioPackageError("INVALID_LIMIT", "Metadata limits must be positive safe integers.");
|
|
22177
22446
|
let rows = 0, characters = 0;
|
|
@@ -23607,21 +23876,21 @@ function option(value3, fallback) {
|
|
|
23607
23876
|
throw new VisioPackageError("INVALID_LIMIT", "Parser limits must be positive safe integers.");
|
|
23608
23877
|
return value3;
|
|
23609
23878
|
}
|
|
23610
|
-
async function parseVsdx(input,
|
|
23611
|
-
const deadline = Date.now() + (
|
|
23879
|
+
async function parseVsdx(input, options2 = {}) {
|
|
23880
|
+
const deadline = Date.now() + (options2.limits?.maxRuntimeMs ?? 1e4);
|
|
23612
23881
|
const checkTime = () => {
|
|
23613
23882
|
if (Date.now() >= deadline)
|
|
23614
23883
|
throw new VisioPackageError("LIMIT_RUNTIME", "Visio parsing deadline exceeded.");
|
|
23615
23884
|
};
|
|
23616
|
-
const maxShapes = option(
|
|
23617
|
-
const maxCurveWork = option(
|
|
23885
|
+
const maxShapes = option(options2.maxShapes, 25e3), maxShapeDepth = option(options2.maxShapeDepth, 64);
|
|
23886
|
+
const maxCurveWork = option(options2.maxCurveWork, 2e7);
|
|
23618
23887
|
let curveWork = 0;
|
|
23619
|
-
const maxGeometry = option(
|
|
23620
|
-
const maxDiagnostics = option(
|
|
23621
|
-
const maxRuns = option(
|
|
23888
|
+
const maxGeometry = option(options2.maxGeometryCommands, 5e5), maxText = option(options2.maxTextCharacters, 5e6);
|
|
23889
|
+
const maxDiagnostics = option(options2.maxDiagnostics, 2e3);
|
|
23890
|
+
const maxRuns = option(options2.maxTextRuns, 1e5), maxParagraphs = option(options2.maxParagraphs, 5e4);
|
|
23622
23891
|
const diagnosticState = diagnosticCollector(maxDiagnostics);
|
|
23623
23892
|
const report = diagnosticState.report;
|
|
23624
|
-
const pkg = await VisioPackage.open(input,
|
|
23893
|
+
const pkg = await VisioPackage.open(input, options2.limits);
|
|
23625
23894
|
const types = await pkg.readXml("[Content_Types].xml", "Types");
|
|
23626
23895
|
if (types.namespaceURI !== "http://schemas.openxmlformats.org/package/2006/content-types")
|
|
23627
23896
|
throw new VisioPackageError("INVALID_CONTENT_TYPES", "Invalid content type namespace.");
|
|
@@ -23631,7 +23900,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
23631
23900
|
const documentType = elements(types).find(
|
|
23632
23901
|
(node3) => node3.localName === "Override" && attribute2(node3, "PartName") === `/${documentPart2}`
|
|
23633
23902
|
)?.getAttribute("ContentType");
|
|
23634
|
-
if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(
|
|
23903
|
+
if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(options2.stencil && documentType && STENCIL_MAIN_TYPES.has(documentType)))
|
|
23635
23904
|
throw new VisioPackageError(
|
|
23636
23905
|
"UNSUPPORTED_FORMAT",
|
|
23637
23906
|
"Only VSDX drawing packages are supported; VSD, VDX, VSDM and templates are not supported."
|
|
@@ -23704,8 +23973,8 @@ async function parseVsdx(input, options = {}) {
|
|
|
23704
23973
|
pkg,
|
|
23705
23974
|
part,
|
|
23706
23975
|
report,
|
|
23707
|
-
|
|
23708
|
-
|
|
23976
|
+
options2.images,
|
|
23977
|
+
options2.metafileConverter
|
|
23709
23978
|
);
|
|
23710
23979
|
masters.set(id3, masterShapes2);
|
|
23711
23980
|
masterRecords.push({ id: id3, node: master2, shapes: masterShapes2 });
|
|
@@ -23713,7 +23982,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
23713
23982
|
}
|
|
23714
23983
|
let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
|
|
23715
23984
|
const context = {
|
|
23716
|
-
metadataBudget: createMetadataBudget(
|
|
23985
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
23717
23986
|
layerBudget: createLayerBudget(),
|
|
23718
23987
|
masters,
|
|
23719
23988
|
layers: /* @__PURE__ */ new Map(),
|
|
@@ -23765,11 +24034,11 @@ async function parseVsdx(input, options = {}) {
|
|
|
23765
24034
|
}
|
|
23766
24035
|
};
|
|
23767
24036
|
const documentMasters = listVisioMasters(masterRecords, context, {
|
|
23768
|
-
metadataBudget: createMetadataBudget(
|
|
24037
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
23769
24038
|
layerBudget: createLayerBudget()
|
|
23770
24039
|
});
|
|
23771
|
-
const pagesPart = await related(pkg, documentPart2, "pages", !
|
|
23772
|
-
if (!pagesPart && !
|
|
24040
|
+
const pagesPart = await related(pkg, documentPart2, "pages", !options2.stencil);
|
|
24041
|
+
if (!pagesPart && !options2.stencil)
|
|
23773
24042
|
throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
|
|
23774
24043
|
const pages = [], pageIds2 = /* @__PURE__ */ new Set();
|
|
23775
24044
|
const comments = [];
|
|
@@ -23823,8 +24092,8 @@ async function parseVsdx(input, options = {}) {
|
|
|
23823
24092
|
pkg,
|
|
23824
24093
|
part,
|
|
23825
24094
|
localReport,
|
|
23826
|
-
|
|
23827
|
-
|
|
24095
|
+
options2.images,
|
|
24096
|
+
options2.metafileConverter
|
|
23828
24097
|
);
|
|
23829
24098
|
const shapes = normalizeShapes(rawShapes, context);
|
|
23830
24099
|
normalizeVisioPageGeometry(shapes, drawingToPageScale, checkTime);
|
|
@@ -23941,13 +24210,13 @@ function getVisioPageLayers(document, pageId2) {
|
|
|
23941
24210
|
|
|
23942
24211
|
// visio/stencil-file.ts
|
|
23943
24212
|
var isCompoundFile = (bytes) => [208, 207, 17, 224].every((value3, index2) => bytes[index2] === value3);
|
|
23944
|
-
async function readVisioStencil(input,
|
|
24213
|
+
async function readVisioStencil(input, options2 = {}) {
|
|
23945
24214
|
if (isCompoundFile(input))
|
|
23946
24215
|
throw new VisioPackageError(
|
|
23947
24216
|
"UNSUPPORTED_FORMAT",
|
|
23948
24217
|
"Legacy binary stencils (.vss) are not supported; open a .vssx stencil."
|
|
23949
24218
|
);
|
|
23950
|
-
const document = await parseVsdx(input, { ...
|
|
24219
|
+
const document = await parseVsdx(input, { ...options2, stencil: true });
|
|
23951
24220
|
return { masters: document.masters ?? [], diagnostics: document.diagnostics };
|
|
23952
24221
|
}
|
|
23953
24222
|
|
|
@@ -24256,8 +24525,8 @@ function findStreamByName(entries, name3, isReadable) {
|
|
|
24256
24525
|
}
|
|
24257
24526
|
|
|
24258
24527
|
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
24259
|
-
function parseOle2(buffer,
|
|
24260
|
-
const strict =
|
|
24528
|
+
function parseOle2(buffer, options2 = {}) {
|
|
24529
|
+
const strict = options2.strict === true;
|
|
24261
24530
|
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
24262
24531
|
const view2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
24263
24532
|
const warnings = [];
|
|
@@ -27606,16 +27875,16 @@ function joinedData(record5) {
|
|
|
27606
27875
|
}
|
|
27607
27876
|
|
|
27608
27877
|
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
|
|
27609
|
-
function decodeFormula(rgce, extra, context,
|
|
27878
|
+
function decodeFormula(rgce, extra, context, options2) {
|
|
27610
27879
|
try {
|
|
27611
|
-
return decode2(rgce, new ByteReader(extra), context,
|
|
27880
|
+
return decode2(rgce, new ByteReader(extra), context, options2);
|
|
27612
27881
|
} catch {
|
|
27613
27882
|
return void 0;
|
|
27614
27883
|
}
|
|
27615
27884
|
}
|
|
27616
27885
|
var Unsupported = class extends Error {
|
|
27617
27886
|
};
|
|
27618
|
-
function decode2(rgce, extra, context,
|
|
27887
|
+
function decode2(rgce, extra, context, options2) {
|
|
27619
27888
|
const reader2 = new ByteReader(rgce);
|
|
27620
27889
|
const stack = [];
|
|
27621
27890
|
let space = "";
|
|
@@ -27742,7 +28011,7 @@ function decode2(rgce, extra, context, options) {
|
|
|
27742
28011
|
case 4:
|
|
27743
28012
|
case 12: {
|
|
27744
28013
|
const row2 = reader2.u16();
|
|
27745
|
-
push(cellText(readLoc(row2, reader2.u16(), base2 === 12,
|
|
28014
|
+
push(cellText(readLoc(row2, reader2.u16(), base2 === 12, options2)));
|
|
27746
28015
|
break;
|
|
27747
28016
|
}
|
|
27748
28017
|
case 5:
|
|
@@ -27750,7 +28019,7 @@ function decode2(rgce, extra, context, options) {
|
|
|
27750
28019
|
const rows = [reader2.u16(), reader2.u16()];
|
|
27751
28020
|
const cols = [reader2.u16(), reader2.u16()];
|
|
27752
28021
|
const relative = base2 === 13;
|
|
27753
|
-
push(areaText(readLoc(rows[0], cols[0], relative,
|
|
28022
|
+
push(areaText(readLoc(rows[0], cols[0], relative, options2), readLoc(rows[1], cols[1], relative, options2)));
|
|
27754
28023
|
break;
|
|
27755
28024
|
}
|
|
27756
28025
|
case 6:
|
|
@@ -27785,15 +28054,15 @@ function decode2(rgce, extra, context, options) {
|
|
|
27785
28054
|
case 26: {
|
|
27786
28055
|
const sheet = prefix2(reader2.u16());
|
|
27787
28056
|
const row2 = reader2.u16();
|
|
27788
|
-
push(sheet + cellText(readLoc(row2, reader2.u16(),
|
|
28057
|
+
push(sheet + cellText(readLoc(row2, reader2.u16(), options2.shared === true, options2)));
|
|
27789
28058
|
break;
|
|
27790
28059
|
}
|
|
27791
28060
|
case 27: {
|
|
27792
28061
|
const sheet = prefix2(reader2.u16());
|
|
27793
28062
|
const rows = [reader2.u16(), reader2.u16()];
|
|
27794
28063
|
const cols = [reader2.u16(), reader2.u16()];
|
|
27795
|
-
const relative =
|
|
27796
|
-
push(sheet + areaText(readLoc(rows[0], cols[0], relative,
|
|
28064
|
+
const relative = options2.shared === true;
|
|
28065
|
+
push(sheet + areaText(readLoc(rows[0], cols[0], relative, options2), readLoc(rows[1], cols[1], relative, options2)));
|
|
27797
28066
|
break;
|
|
27798
28067
|
}
|
|
27799
28068
|
case 28:
|
|
@@ -33209,19 +33478,19 @@ function detect(bytes) {
|
|
|
33209
33478
|
formats.push("vsd");
|
|
33210
33479
|
return { format: formats.length === 1 ? formats[0] : void 0, ambiguous: formats.length > 1 || workbook && book };
|
|
33211
33480
|
}
|
|
33212
|
-
function parseOle22(input,
|
|
33481
|
+
function parseOle22(input, options2) {
|
|
33213
33482
|
const bytes = bytesOf2(input);
|
|
33214
33483
|
const container = new CfbDocument(bytes);
|
|
33215
33484
|
const detected = detect(bytes);
|
|
33216
|
-
if (
|
|
33485
|
+
if (options2?.expect === "cfb")
|
|
33217
33486
|
return new CfbDocument(bytes, detected.format, detected.ambiguous ? [{ code: "ambiguous-format", message: "Multiple root format identities; container inspection only." }] : []);
|
|
33218
33487
|
if (detected.ambiguous) {
|
|
33219
|
-
if (
|
|
33488
|
+
if (options2)
|
|
33220
33489
|
throw new Ole2DocumentError("ambiguous-format", "Multiple root format identities; no format model can be selected.");
|
|
33221
33490
|
return new CfbDocument(bytes, void 0, [{ code: "ambiguous-format", message: "Multiple root format identities; container inspection only." }]);
|
|
33222
33491
|
}
|
|
33223
|
-
if (
|
|
33224
|
-
throw new Ole2DocumentError("format-mismatch", `Expected ${
|
|
33492
|
+
if (options2 && options2.expect !== detected.format)
|
|
33493
|
+
throw new Ole2DocumentError("format-mismatch", `Expected ${options2.expect}; detected ${detected.format ?? "cfb"}.`);
|
|
33225
33494
|
if (!detected.format)
|
|
33226
33495
|
return container;
|
|
33227
33496
|
try {
|
|
@@ -33236,7 +33505,7 @@ function parseOle22(input, options) {
|
|
|
33236
33505
|
return new VsdDocument(bytes);
|
|
33237
33506
|
}
|
|
33238
33507
|
} catch (error) {
|
|
33239
|
-
if (
|
|
33508
|
+
if (options2)
|
|
33240
33509
|
throw new Ole2DocumentError("unsupported-model", `Cannot decode ${detected.format} model: ${error instanceof Error ? error.message : String(error)}`);
|
|
33241
33510
|
return new CfbDocument(bytes, detected.format, [{ code: "unsupported-model", message: error instanceof Error ? error.message : String(error) }]);
|
|
33242
33511
|
}
|
|
@@ -33255,11 +33524,11 @@ function limit2(value3, fallback) {
|
|
|
33255
33524
|
);
|
|
33256
33525
|
return resolved;
|
|
33257
33526
|
}
|
|
33258
|
-
function normalizeLegacyVsd(document,
|
|
33259
|
-
const maxShapes = limit2(
|
|
33260
|
-
const maxGeometry = limit2(
|
|
33261
|
-
const maxText = limit2(
|
|
33262
|
-
const diagnostics = diagnosticCollector(limit2(
|
|
33527
|
+
function normalizeLegacyVsd(document, options2 = {}) {
|
|
33528
|
+
const maxShapes = limit2(options2.maxShapes, 25e3);
|
|
33529
|
+
const maxGeometry = limit2(options2.maxGeometryCommands, 5e5);
|
|
33530
|
+
const maxText = limit2(options2.maxTextCharacters, 5e6);
|
|
33531
|
+
const diagnostics = diagnosticCollector(limit2(options2.maxDiagnostics, 2e3));
|
|
33263
33532
|
const report = diagnostics.report;
|
|
33264
33533
|
let shapeCount = 0, geometryCount = 0, textCount = 0;
|
|
33265
33534
|
report(
|
|
@@ -33404,15 +33673,15 @@ function normalizeLegacyVsd(document, options = {}) {
|
|
|
33404
33673
|
throw new VisioPackageError("LEGACY_PAGE_GEOMETRY", "Legacy drawing has no decoded pages.");
|
|
33405
33674
|
return { format: "vsd", pages, diagnostics: diagnostics.finish() };
|
|
33406
33675
|
}
|
|
33407
|
-
function parseLegacyVsd(input,
|
|
33676
|
+
function parseLegacyVsd(input, options2 = {}) {
|
|
33408
33677
|
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
33409
|
-
const maxInput = limit2(
|
|
33410
|
-
const maxRuntime = limit2(
|
|
33678
|
+
const maxInput = limit2(options2.limits?.maxInputBytes, 32 * 1024 * 1024);
|
|
33679
|
+
const maxRuntime = limit2(options2.limits?.maxRuntimeMs, 1e4), start = Date.now();
|
|
33411
33680
|
if (bytes.byteLength > maxInput)
|
|
33412
33681
|
throw new VisioPackageError("LIMIT_INPUT", "Legacy Visio input exceeds limit.");
|
|
33413
33682
|
try {
|
|
33414
33683
|
const document = parseVsd(bytes);
|
|
33415
|
-
const scene = normalizeLegacyVsd(document,
|
|
33684
|
+
const scene = normalizeLegacyVsd(document, options2);
|
|
33416
33685
|
if (Date.now() - start >= maxRuntime)
|
|
33417
33686
|
throw new VisioPackageError("LIMIT_RUNTIME", "Legacy Visio processing deadline exceeded.");
|
|
33418
33687
|
return scene;
|
|
@@ -33426,11 +33695,11 @@ function parseLegacyVsd(input, options = {}) {
|
|
|
33426
33695
|
}
|
|
33427
33696
|
|
|
33428
33697
|
// visio/load.ts
|
|
33429
|
-
async function loadVisio(input,
|
|
33698
|
+
async function loadVisio(input, options2 = {}) {
|
|
33430
33699
|
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
33431
33700
|
if ([208, 207, 17, 224, 161, 177, 26, 225].every((value3, index2) => bytes[index2] === value3))
|
|
33432
|
-
return parseLegacyVsd(bytes,
|
|
33433
|
-
if (bytes[0] === 80 && bytes[1] === 75) return parseVsdx(input,
|
|
33701
|
+
return parseLegacyVsd(bytes, options2);
|
|
33702
|
+
if (bytes[0] === 80 && bytes[1] === 75) return parseVsdx(input, options2);
|
|
33434
33703
|
throw new VisioPackageError(
|
|
33435
33704
|
"UNSUPPORTED_FORMAT",
|
|
33436
33705
|
"Expected a VSD compound file or VSDX ZIP package."
|
|
@@ -33457,7 +33726,7 @@ function layerId(id3) {
|
|
|
33457
33726
|
if (typeof id3 !== "string" || !id3.length) invalid3("Layer IDs must be nonempty strings.");
|
|
33458
33727
|
bounded4(id3.length, VISIO_VISIBILITY_LIMITS.maxLayerIdLength, "layer ID length");
|
|
33459
33728
|
}
|
|
33460
|
-
function resolveVisioPageVisibility(page,
|
|
33729
|
+
function resolveVisioPageVisibility(page, options2 = {}) {
|
|
33461
33730
|
const limits = VISIO_VISIBILITY_LIMITS;
|
|
33462
33731
|
const sourceLayers = page.layers ?? [];
|
|
33463
33732
|
if (!Array.isArray(sourceLayers) || !Array.isArray(page.shapes))
|
|
@@ -33470,8 +33739,8 @@ function resolveVisioPageVisibility(page, options = {}) {
|
|
|
33470
33739
|
if (!layers.has(layer.id)) layers.set(layer.id, layer);
|
|
33471
33740
|
}
|
|
33472
33741
|
const overrides = /* @__PURE__ */ new Map();
|
|
33473
|
-
if (
|
|
33474
|
-
const source =
|
|
33742
|
+
if (options2.layerVisibilityOverrides !== void 0) {
|
|
33743
|
+
const source = options2.layerVisibilityOverrides;
|
|
33475
33744
|
if (!source || typeof source[Symbol.iterator] !== "function")
|
|
33476
33745
|
invalid3("Layer visibility overrides must be an iterable map.");
|
|
33477
33746
|
bounded4(source.size, limits.maxLayers, "override count");
|
|
@@ -34011,13 +34280,13 @@ function unique(items, key2, what) {
|
|
|
34011
34280
|
return result2;
|
|
34012
34281
|
}
|
|
34013
34282
|
var cellMap2 = (parent) => unique(children2(parent, "Cell"), (cell) => attribute2(cell, "N") ?? "", "cell");
|
|
34014
|
-
function instanceSheet(instance, template,
|
|
34283
|
+
function instanceSheet(instance, template, options2 = {}) {
|
|
34015
34284
|
for (const node3 of [instance, template]) {
|
|
34016
34285
|
const type = attribute2(node3, "Type");
|
|
34017
|
-
if (!(
|
|
34286
|
+
if (!(options2.group ? ["Shape", "Group", void 0] : ["Shape", void 0]).includes(type) || !options2.group && children2(node3, "Shapes").length > 0 || children2(node3, "ForeignData").length || deleted2(node3))
|
|
34018
34287
|
fail(
|
|
34019
34288
|
"UNSUPPORTED_INSTANCE_EDIT",
|
|
34020
|
-
|
|
34289
|
+
options2.group ? "A stencil shape that holds a picture or a deleted part cannot be changed." : "Only stencil shapes made of one plain shape can be changed; grouped, picture and deleted ones cannot."
|
|
34021
34290
|
);
|
|
34022
34291
|
}
|
|
34023
34292
|
if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
|
|
@@ -34096,7 +34365,7 @@ function effectiveFormula(cell) {
|
|
|
34096
34365
|
return own === "Inh" ? executableCellFormula(attribute2(cell.inherited, "F")) : executableCellFormula(own);
|
|
34097
34366
|
}
|
|
34098
34367
|
var AFTER_SECTIONS = ["Text", "Data1", "Data2", "Data3", "ForeignData", "Shapes"];
|
|
34099
|
-
function writeInstanceCell(sheet, cell, value3,
|
|
34368
|
+
function writeInstanceCell(sheet, cell, value3, options2 = {}) {
|
|
34100
34369
|
const { instance } = sheet;
|
|
34101
34370
|
const create2 = (name3) => instance.ownerDocument.createElementNS(instance.namespaceURI, name3);
|
|
34102
34371
|
let node3 = cell.local;
|
|
@@ -34142,9 +34411,9 @@ function writeInstanceCell(sheet, cell, value3, options = {}) {
|
|
|
34142
34411
|
}
|
|
34143
34412
|
node3.setAttribute("V", value3);
|
|
34144
34413
|
node3.removeAttribute("E");
|
|
34145
|
-
const unit3 =
|
|
34146
|
-
if (unit3 !== void 0 && (created ||
|
|
34147
|
-
if (
|
|
34414
|
+
const unit3 = options2.unit ?? attribute2(cell.inherited, "U");
|
|
34415
|
+
if (unit3 !== void 0 && (created || options2.unit !== void 0)) node3.setAttribute("U", unit3);
|
|
34416
|
+
if (options2.formula) node3.setAttribute("F", options2.formula);
|
|
34148
34417
|
else node3.removeAttribute("F");
|
|
34149
34418
|
return node3;
|
|
34150
34419
|
}
|
|
@@ -36304,7 +36573,7 @@ function proveConnectorShape(shape, route = routeOf(shape)) {
|
|
|
36304
36573
|
"Only right-angle and curved connectors drawn here can be rerouted."
|
|
36305
36574
|
);
|
|
36306
36575
|
}
|
|
36307
|
-
function rerouteConnector(roots, pageId2, glue, check,
|
|
36576
|
+
function rerouteConnector(roots, pageId2, glue, check, options2 = {}) {
|
|
36308
36577
|
const root2 = roots.get(pageId2);
|
|
36309
36578
|
const shape = glue.shape;
|
|
36310
36579
|
const stencil = isStencilConnector(shape);
|
|
@@ -36316,7 +36585,7 @@ function rerouteConnector(roots, pageId2, glue, check, options = {}) {
|
|
|
36316
36585
|
if (target2) return glueSites(root2, target2);
|
|
36317
36586
|
return [
|
|
36318
36587
|
{
|
|
36319
|
-
point:
|
|
36588
|
+
point: options2.free?.[end] ?? {
|
|
36320
36589
|
x: numeric(local.get(`${prefix(end)}X`)),
|
|
36321
36590
|
y: numeric(local.get(`${prefix(end)}Y`))
|
|
36322
36591
|
}
|
|
@@ -36325,7 +36594,7 @@ function rerouteConnector(roots, pageId2, glue, check, options = {}) {
|
|
|
36325
36594
|
};
|
|
36326
36595
|
const chosen = chooseSites(sites("begin"), sites("end"));
|
|
36327
36596
|
if (isStencilLine(shape)) {
|
|
36328
|
-
if (
|
|
36597
|
+
if (options2.route && options2.route !== "straight")
|
|
36329
36598
|
fail(
|
|
36330
36599
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
36331
36600
|
"This connector is a straight line from a stencil; only Visio's Dynamic connector can be restyled."
|
|
@@ -36344,12 +36613,12 @@ function rerouteConnector(roots, pageId2, glue, check, options = {}) {
|
|
|
36344
36613
|
const target2 = glue.ends[end];
|
|
36345
36614
|
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
|
|
36346
36615
|
};
|
|
36347
|
-
const route =
|
|
36616
|
+
const route = options2.route ?? current;
|
|
36348
36617
|
if (route === "straight" && current === "straight" && ENDS.every(
|
|
36349
36618
|
(end) => sameLineCoordinate(numeric(local.get(`${prefix(end)}X`)), chosen[end].point.x) && sameLineCoordinate(numeric(local.get(`${prefix(end)}Y`)), chosen[end].point.y)
|
|
36350
36619
|
))
|
|
36351
36620
|
return [];
|
|
36352
|
-
if (
|
|
36621
|
+
if (options2.route) setRouteCells(shape, options2.route);
|
|
36353
36622
|
const obstacles = route === "right-angle" ? connectorObstacles(
|
|
36354
36623
|
root2,
|
|
36355
36624
|
/* @__PURE__ */ new Set([
|
|
@@ -36705,14 +36974,14 @@ async function measuresOwnText(root2, shapeId2, template, check) {
|
|
|
36705
36974
|
return false;
|
|
36706
36975
|
}
|
|
36707
36976
|
}
|
|
36708
|
-
async function refreshTextSizes(targets, result2,
|
|
36977
|
+
async function refreshTextSizes(targets, result2, options2, deadline) {
|
|
36709
36978
|
if (!targets.length || !result2.changedParts.length) return result2;
|
|
36710
36979
|
const check = () => {
|
|
36711
36980
|
if (Date.now() >= deadline) throw new VisioPackageError("LIMIT_RUNTIME", "Deadline exceeded.");
|
|
36712
36981
|
};
|
|
36713
36982
|
const limits = {
|
|
36714
36983
|
...DEFAULTS,
|
|
36715
|
-
...
|
|
36984
|
+
...options2.limits,
|
|
36716
36985
|
maxInputBytes: Math.max(DEFAULTS.maxInputBytes, result2.bytes.length),
|
|
36717
36986
|
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
36718
36987
|
};
|
|
@@ -36802,7 +37071,7 @@ async function refreshTextSizes(targets, result2, options, deadline) {
|
|
|
36802
37071
|
}
|
|
36803
37072
|
const bytes = await writeEditedPackage(
|
|
36804
37073
|
parts,
|
|
36805
|
-
|
|
37074
|
+
options2.maxOutputBytes ?? limits.maxInputBytes,
|
|
36806
37075
|
deadline,
|
|
36807
37076
|
check
|
|
36808
37077
|
);
|
|
@@ -37074,14 +37343,14 @@ function cacheRows(path2) {
|
|
|
37074
37343
|
}
|
|
37075
37344
|
return rows.every((row2) => Number.isFinite(row2.x) && Number.isFinite(row2.y)) ? rows : [];
|
|
37076
37345
|
}
|
|
37077
|
-
async function refreshLineJumpCaches(pageIds2, source, result2,
|
|
37346
|
+
async function refreshLineJumpCaches(pageIds2, source, result2, options2, deadline) {
|
|
37078
37347
|
if (!pageIds2.size || !result2.changedParts.length) return result2;
|
|
37079
37348
|
const check = () => {
|
|
37080
37349
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
37081
37350
|
};
|
|
37082
37351
|
const limits = {
|
|
37083
37352
|
...DEFAULTS,
|
|
37084
|
-
...
|
|
37353
|
+
...options2.limits,
|
|
37085
37354
|
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
37086
37355
|
};
|
|
37087
37356
|
const { pkg, parts, pages } = await openEditablePackage(result2.bytes, limits, check);
|
|
@@ -37161,7 +37430,7 @@ async function refreshLineJumpCaches(pageIds2, source, result2, options, deadlin
|
|
|
37161
37430
|
return {
|
|
37162
37431
|
bytes: await writeEditedPackage(
|
|
37163
37432
|
parts,
|
|
37164
|
-
|
|
37433
|
+
options2.maxOutputBytes ?? limits.maxInputBytes,
|
|
37165
37434
|
deadline,
|
|
37166
37435
|
check
|
|
37167
37436
|
),
|
|
@@ -41076,9 +41345,9 @@ function snapshotStencilMasterDrop(edit) {
|
|
|
41076
41345
|
y: edit.y
|
|
41077
41346
|
};
|
|
41078
41347
|
}
|
|
41079
|
-
async function editVsdxMasterDrops(source, commands,
|
|
41080
|
-
const limits = { ...DEFAULTS, ...
|
|
41081
|
-
const maxOutput =
|
|
41348
|
+
async function editVsdxMasterDrops(source, commands, options2, lone, apply3) {
|
|
41349
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
41350
|
+
const maxOutput = options2.maxOutputBytes ?? limits.maxInputBytes;
|
|
41082
41351
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
41083
41352
|
const check = () => {
|
|
41084
41353
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
@@ -42293,12 +42562,12 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check, glueShapes = /*
|
|
|
42293
42562
|
}
|
|
42294
42563
|
|
|
42295
42564
|
// visio/edit-transform-formula.ts
|
|
42296
|
-
function editableTransformCell(roots, edit, node3, check,
|
|
42565
|
+
function editableTransformCell(roots, edit, node3, check, options2 = {}) {
|
|
42297
42566
|
const formula = executableCellFormula(attribute2(node3, "F"));
|
|
42298
42567
|
if (!formula || !analyzeVisioFormula(formula).references.length) return editableCell(node3);
|
|
42299
42568
|
const evaluate = createVisioCellEvaluator(
|
|
42300
|
-
indexCells(roots, { ...
|
|
42301
|
-
{ ...
|
|
42569
|
+
indexCells(roots, { ...options2, check }),
|
|
42570
|
+
{ ...options2, check },
|
|
42302
42571
|
true
|
|
42303
42572
|
);
|
|
42304
42573
|
editableCell(
|
|
@@ -42767,7 +43036,7 @@ async function assertDuplicateScope(pkg, pagePaths, targetPage, newIds, check, s
|
|
|
42767
43036
|
}
|
|
42768
43037
|
|
|
42769
43038
|
// visio/formula-master.ts
|
|
42770
|
-
function analyzeVisioMasterFormula(source,
|
|
43039
|
+
function analyzeVisioMasterFormula(source, options2) {
|
|
42771
43040
|
const ast = parseVisioFormula(source);
|
|
42772
43041
|
const analysis = analyzeVisioFormula(ast);
|
|
42773
43042
|
const references = /* @__PURE__ */ new Map();
|
|
@@ -42788,7 +43057,7 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
42788
43057
|
if (["TEXTWIDTH", "TEXTHEIGHT", "SHAPETEXT"].includes(node3.name)) {
|
|
42789
43058
|
const text6 = node3.args[0];
|
|
42790
43059
|
const count = node3.name === "TEXTHEIGHT" ? node3.args.length === 2 : node3.args.length === 1;
|
|
42791
|
-
local =
|
|
43060
|
+
local = options2.textFieldFree && count && text6?.kind === "reference" && text6.reference.shapeId === void 0 && text6.reference.cell.toLowerCase() === "thetext";
|
|
42792
43061
|
readsText = true;
|
|
42793
43062
|
}
|
|
42794
43063
|
if (["LUM", "HUE", "SAT"].includes(node3.name)) {
|
|
@@ -43423,16 +43692,16 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
|
|
|
43423
43692
|
);
|
|
43424
43693
|
}
|
|
43425
43694
|
if (!needed) return;
|
|
43426
|
-
const
|
|
43695
|
+
const options2 = { check, pageContext: after };
|
|
43427
43696
|
const changed = [];
|
|
43428
|
-
for (const cell of indexCells(roots,
|
|
43697
|
+
for (const cell of indexCells(roots, options2).values()) {
|
|
43429
43698
|
if (!cell.node) continue;
|
|
43430
43699
|
const functions = pageFunctions(attribute2(cell.node, "F") ?? "");
|
|
43431
43700
|
const old = before.get(cell.pageId), current = after.get(cell.pageId);
|
|
43432
43701
|
if (functions.has("PAGENUMBER") && old?.pageNumber !== current.pageNumber || functions.has("PAGECOUNT") && old?.pageCount !== current.pageCount)
|
|
43433
43702
|
changed.push(cell);
|
|
43434
43703
|
}
|
|
43435
|
-
for (const id3 of recalculateVisioCells(roots, changed,
|
|
43704
|
+
for (const id3 of recalculateVisioCells(roots, changed, options2)) {
|
|
43436
43705
|
const root2 = roots.get(id3);
|
|
43437
43706
|
const sheet = sheets.get(id3);
|
|
43438
43707
|
if (sheet) {
|
|
@@ -46755,14 +47024,14 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
|
|
|
46755
47024
|
}
|
|
46756
47025
|
|
|
46757
47026
|
// visio/clipboard.ts
|
|
46758
|
-
async function captureVisioClipboard(input, pageId2, shapeIds2,
|
|
47027
|
+
async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
|
|
46759
47028
|
pageId2 = clipboardId(pageId2);
|
|
46760
47029
|
if (!Array.isArray(shapeIds2) || !shapeIds2.length || shapeIds2.length > 1e3)
|
|
46761
47030
|
fail("INVALID_CLIPBOARD", "Capture requires one to 1000 selected shapes.");
|
|
46762
47031
|
const selected = shapeIds2.map(clipboardId);
|
|
46763
47032
|
if (new Set(selected).size !== selected.length)
|
|
46764
47033
|
fail("INVALID_CLIPBOARD", "Capture selection must be unique.");
|
|
46765
|
-
const limits = { ...DEFAULTS, ...
|
|
47034
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
46766
47035
|
for (const value3 of Object.values(limits))
|
|
46767
47036
|
if (!Number.isSafeInteger(value3) || value3 <= 0)
|
|
46768
47037
|
fail("INVALID_LIMITS", "Capture limits require positive safe integers.");
|
|
@@ -46849,13 +47118,13 @@ async function retarget(clipboard, bytes, pageId2, limits) {
|
|
|
46849
47118
|
fail("UNSUPPORTED_SUBPROCESS", "The new page does not share the source page settings.");
|
|
46850
47119
|
return { ...clipboard, pageContext: target2.xml };
|
|
46851
47120
|
}
|
|
46852
|
-
async function editVsdxSubprocess(source, edit,
|
|
46853
|
-
const limits = { ...DEFAULTS, ...
|
|
47121
|
+
async function editVsdxSubprocess(source, edit, options2) {
|
|
47122
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
46854
47123
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
46855
47124
|
const remaining = () => {
|
|
46856
47125
|
const time = deadline - Date.now();
|
|
46857
47126
|
if (time <= 0) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
46858
|
-
return { ...
|
|
47127
|
+
return { ...options2, limits: { ...options2.limits, maxRuntimeMs: time } };
|
|
46859
47128
|
};
|
|
46860
47129
|
const changed = /* @__PURE__ */ new Set();
|
|
46861
47130
|
const diagnostics = /* @__PURE__ */ new Map();
|
|
@@ -47442,7 +47711,7 @@ function positive2(value3) {
|
|
|
47442
47711
|
fail("INVALID_LIMITS", "Edit limits must be positive safe integers.");
|
|
47443
47712
|
return value3;
|
|
47444
47713
|
}
|
|
47445
|
-
async function editVsdx(input, edits,
|
|
47714
|
+
async function editVsdx(input, edits, options2 = {}) {
|
|
47446
47715
|
const clock = {
|
|
47447
47716
|
deadline: 0,
|
|
47448
47717
|
autoSize: /* @__PURE__ */ new Set(),
|
|
@@ -47450,36 +47719,36 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
47450
47719
|
jumpPages: /* @__PURE__ */ new Set(),
|
|
47451
47720
|
jumpSource: void 0
|
|
47452
47721
|
};
|
|
47453
|
-
const edited = await editVsdxTransaction(input, edits,
|
|
47454
|
-
const resized = await refreshTextSizes(clock.textSizes, edited,
|
|
47722
|
+
const edited = await editVsdxTransaction(input, edits, options2, clock);
|
|
47723
|
+
const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
|
|
47455
47724
|
const result2 = await refreshLineJumpCaches(
|
|
47456
47725
|
clock.jumpPages,
|
|
47457
47726
|
clock.jumpSource,
|
|
47458
47727
|
resized,
|
|
47459
|
-
|
|
47728
|
+
options2,
|
|
47460
47729
|
clock.deadline
|
|
47461
47730
|
);
|
|
47462
47731
|
return growAutoSizePages(
|
|
47463
47732
|
clock.autoSize,
|
|
47464
47733
|
result2,
|
|
47465
47734
|
(bytes, growth) => editVsdxTransaction(bytes, growth, {
|
|
47466
|
-
...
|
|
47467
|
-
limits: { ...
|
|
47735
|
+
...options2,
|
|
47736
|
+
limits: { ...options2.limits, maxRuntimeMs: Math.max(1, clock.deadline - Date.now()) }
|
|
47468
47737
|
})
|
|
47469
47738
|
);
|
|
47470
47739
|
}
|
|
47471
|
-
async function editVsdxTransaction(input, edits,
|
|
47740
|
+
async function editVsdxTransaction(input, edits, options2, clock = {
|
|
47472
47741
|
deadline: 0,
|
|
47473
47742
|
autoSize: /* @__PURE__ */ new Set(),
|
|
47474
47743
|
textSizes: [],
|
|
47475
47744
|
jumpPages: /* @__PURE__ */ new Set(),
|
|
47476
47745
|
jumpSource: void 0
|
|
47477
47746
|
}) {
|
|
47478
|
-
const limits = { ...DEFAULTS, ...
|
|
47747
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
47479
47748
|
for (const value3 of Object.values(limits)) positive2(value3);
|
|
47480
|
-
const maxEdits = positive2(
|
|
47481
|
-
const maxText = positive2(
|
|
47482
|
-
const maxOutput = positive2(
|
|
47749
|
+
const maxEdits = positive2(options2.maxEdits ?? 1e3);
|
|
47750
|
+
const maxText = positive2(options2.maxTextCharacters ?? 1e6);
|
|
47751
|
+
const maxOutput = positive2(options2.maxOutputBytes ?? limits.maxInputBytes);
|
|
47483
47752
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
47484
47753
|
clock.deadline = deadline;
|
|
47485
47754
|
const check = () => {
|
|
@@ -47498,13 +47767,13 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47498
47767
|
if (subprocess) {
|
|
47499
47768
|
if (allCommands.length !== 1)
|
|
47500
47769
|
fail("EDIT_MIXED_SUBPROCESS_TRANSACTION", "A subprocess requires its own transaction.");
|
|
47501
|
-
return editVsdxSubprocess(original, subprocess,
|
|
47770
|
+
return editVsdxSubprocess(original, subprocess, options2);
|
|
47502
47771
|
}
|
|
47503
47772
|
if (allCommands.some(isVisioMasterDrop))
|
|
47504
47773
|
return editVsdxMasterDrops(
|
|
47505
47774
|
original,
|
|
47506
47775
|
allCommands,
|
|
47507
|
-
|
|
47776
|
+
options2,
|
|
47508
47777
|
async (bytes2, instance, info) => {
|
|
47509
47778
|
const opened = await openEditablePackage(bytes2, limits, check);
|
|
47510
47779
|
return editVsdxMasterInstance(
|
|
@@ -47519,7 +47788,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47519
47788
|
info
|
|
47520
47789
|
);
|
|
47521
47790
|
},
|
|
47522
|
-
(bytes2, rest) => editVsdx(bytes2, rest,
|
|
47791
|
+
(bytes2, rest) => editVsdx(bytes2, rest, options2)
|
|
47523
47792
|
);
|
|
47524
47793
|
const { pkg, parts, pages } = await openEditablePackage(original, limits, check);
|
|
47525
47794
|
const builtIn = await changeStencilShapeToBuiltIn(
|
|
@@ -47528,7 +47797,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47528
47797
|
pages,
|
|
47529
47798
|
allCommands,
|
|
47530
47799
|
{ limits, maxOutput, deadline, check },
|
|
47531
|
-
(bytes2, edits2) => editVsdx(bytes2, edits2,
|
|
47800
|
+
(bytes2, edits2) => editVsdx(bytes2, edits2, options2)
|
|
47532
47801
|
);
|
|
47533
47802
|
if (builtIn) return builtIn;
|
|
47534
47803
|
if (allCommands.some(isVisioCommentEdit)) {
|
|
@@ -47611,8 +47880,8 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
47611
47880
|
check
|
|
47612
47881
|
);
|
|
47613
47882
|
const moved = await editVsdxTransaction(resized.bytes, commands, {
|
|
47614
|
-
...
|
|
47615
|
-
limits: { ...
|
|
47883
|
+
...options2,
|
|
47884
|
+
limits: { ...options2.limits, maxRuntimeMs: Math.max(1, deadline - Date.now()) }
|
|
47616
47885
|
});
|
|
47617
47886
|
return {
|
|
47618
47887
|
bytes: moved.bytes,
|
|
@@ -48054,8 +48323,8 @@ function documentPart() {
|
|
|
48054
48323
|
});
|
|
48055
48324
|
return document;
|
|
48056
48325
|
}
|
|
48057
|
-
async function createVsdx(
|
|
48058
|
-
const width =
|
|
48326
|
+
async function createVsdx(options2 = {}) {
|
|
48327
|
+
const width = options2.width ?? 8.5, height = options2.height ?? 11;
|
|
48059
48328
|
if (![width, height].every(
|
|
48060
48329
|
(value3) => typeof value3 === "number" && Number.isFinite(value3) && value3 > 0 && value3 <= 1e6
|
|
48061
48330
|
))
|
|
@@ -48128,7 +48397,7 @@ async function createVsdx(options = {}) {
|
|
|
48128
48397
|
Page: "0",
|
|
48129
48398
|
ViewScale: "-1"
|
|
48130
48399
|
});
|
|
48131
|
-
const stencils = [...new Set(
|
|
48400
|
+
const stencils = [...new Set(options2.stencils ?? [])];
|
|
48132
48401
|
if (stencils.some((id3) => !Object.hasOwn(VISIO_STENCIL_FILES, id3)))
|
|
48133
48402
|
fail("INVALID_EDIT", "Unknown built-in stencil.");
|
|
48134
48403
|
stencils.forEach((id3, index2) => {
|