ooxml-core 1.18.0 → 1.19.1
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-2V4PQL6O.mjs} +2 -2
- package/dist/{PptxHandler-4AHDZDA5.cjs → PptxHandler-6TNIQ7S5.cjs} +2 -2
- package/dist/{PptxHandler-5X4VOWAO.mjs → PptxHandler-HSPKEP5E.mjs} +1 -1
- package/dist/{PresentationBuilder-UY3S4YE2.mjs → PresentationBuilder-G7MPEGXJ.mjs} +1 -1
- package/dist/{PresentationBuilder-LRX55PXA.mjs → PresentationBuilder-HQ6C7L4V.mjs} +2 -2
- package/dist/{PresentationBuilder-MJB4LIFS.cjs → PresentationBuilder-RM52LCVN.cjs} +4 -4
- package/dist/automation/index.cjs +535 -266
- package/dist/automation/index.mjs +535 -266
- package/dist/automation/node.cjs +2 -1
- package/dist/automation/node.d.ts.map +1 -1
- package/dist/automation/node.mjs +2 -1
- 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-D4GBMBG6.mjs → chunk-365VXA3X.mjs} +1 -1
- package/dist/{chunk-7NWQUCGX.mjs → chunk-4FTUAD2B.mjs} +20 -5
- package/dist/{chunk-PLWRGPRH.mjs → chunk-4YDPRQRH.mjs} +145 -96
- package/dist/{chunk-QXDWDDLN.mjs → chunk-6UV3JVB3.mjs} +1 -1
- package/dist/{chunk-3ATTMOYZ.mjs → chunk-7FPQ7LGN.mjs} +1 -1
- package/dist/{chunk-7WCCQKV2.mjs → chunk-7I7CMDUZ.mjs} +1 -1
- package/dist/{chunk-KZ6UTEES.mjs → chunk-E6WNB3JX.mjs} +1 -1
- package/dist/{chunk-SPG7WICG.mjs → chunk-EDRS3OSM.mjs} +1 -1
- package/dist/{chunk-VXLBSKZ6.mjs → chunk-GKLDCQLY.mjs} +1 -1
- package/dist/{chunk-ITQNJLJW.mjs → chunk-ILG6NKXV.mjs} +1 -1
- package/dist/{chunk-OXZUJR7O.mjs → chunk-J3PD5JWS.mjs} +1 -1
- package/dist/{chunk-I5ZE3VLI.mjs → chunk-JUABSM7C.mjs} +1 -1
- package/dist/{chunk-5GBNB7VU.mjs → chunk-LMDNFNZJ.mjs} +1 -1
- package/dist/{chunk-LT7RCEHY.mjs → chunk-M6GDBVQ7.mjs} +1 -1
- package/dist/{chunk-4SMQRUUE.mjs → chunk-MZP6H7QY.mjs} +1 -1
- package/dist/{chunk-KCALUCYU.mjs → chunk-NIGOXRUP.mjs} +1 -1
- package/dist/{chunk-VB7NKWZH.mjs → chunk-P37EWZBC.mjs} +1 -1
- package/dist/{chunk-VD3XNFJH.mjs → chunk-PIOG7ZFF.mjs} +1 -1
- package/dist/{chunk-R4BCOQHB.cjs → chunk-R5FIHHGB.cjs} +33 -13
- package/dist/{chunk-4EUHK4OA.mjs → chunk-RRQFRNPQ.mjs} +1 -1
- package/dist/{chunk-AXDQEOYK.mjs → chunk-S3E6XBOU.mjs} +1 -1
- package/dist/{chunk-U7IDT6VT.mjs → chunk-SLNQNVQM.mjs} +1 -1
- package/dist/{chunk-Z5Y53IZD.mjs → chunk-TJPUAUWL.mjs} +4 -4
- package/dist/{chunk-53GW7NSV.mjs → chunk-UFZZESXL.mjs} +1 -1
- package/dist/{chunk-4JGKTRLH.mjs → chunk-X45XTEMI.mjs} +1 -1
- package/dist/{chunk-DUSAQQTU.mjs → chunk-YIXIC3TR.mjs} +1 -1
- package/dist/{chunk-YSKKMXDL.mjs → chunk-ZDD2RZGB.mjs} +1 -1
- package/dist/{chunk-C363NN2C.mjs → chunk-ZJ2OKIJN.mjs} +33 -13
- 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 +89 -14
- package/dist/pptx/automation/index.d.ts +2 -2
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/automation/schemas/chart-formatting-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/chart-formatting-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/chart-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/chart-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/chart-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/chart-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/chart-user-shape-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/element-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/element-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/element-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/element-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/export-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/export-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/export-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/export-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/geometry-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/geometry-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/geometry-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/geometry-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/hyperlink-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/hyperlink-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/index.cjs +145 -96
- package/dist/pptx/automation/schemas/index.mjs +21 -21
- package/dist/pptx/automation/schemas/json-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/json-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/json-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/json-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/layout-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/layout-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/layout-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/layout-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/lock-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/lock-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/lock-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/lock-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/metadata-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/metadata-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/metadata-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/metadata-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/ole-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/ole-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/ole-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/ole-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/presentation-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/presentation-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/presentation-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/presentation-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/section-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/section-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/section-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/section-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/slide-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/slide-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/slide-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/slide-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/smartart-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/smartart-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/smartart-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/smartart-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/table-style-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/table-style-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/table-style-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/table-style-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/template-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/template-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/template-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/template-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/theme-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/theme-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/theme-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/theme-schemas.mjs +2 -2
- package/dist/pptx/automation/schemas/validation-schemas.cjs +145 -96
- package/dist/pptx/automation/schemas/validation-schemas.d.ts +1 -1
- package/dist/pptx/automation/schemas/validation-schemas.d.ts.map +1 -1
- package/dist/pptx/automation/schemas/validation-schemas.mjs +2 -2
- package/dist/pptx/chunks/{index-CiyTR6mm.d.ts → index-B9x557hr.d.ts} +3 -2
- package/dist/pptx/chunks/{index-CiyTR6mm.d.ts.map → index-B9x557hr.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-BWHNCVNC.d.ts → index-Bqm-jFG-.d.ts} +3 -4
- package/dist/pptx/chunks/{index-BWHNCVNC.d.ts.map → index-Bqm-jFG-.d.ts.map} +1 -1
- package/dist/pptx/chunks/schemas-CWr181Wx.d.ts +2186 -0
- package/dist/pptx/chunks/schemas-CWr181Wx.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +89 -14
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/loader/table-style-image-paths.d.ts +1 -0
- package/dist/pptx/editor/render/collaboration-text-native-edit.d.ts +1 -0
- package/dist/pptx/editor/render/collaboration-text-session-paragraph.d.ts +1 -0
- package/dist/pptx/editor/render/collaboration-text-snapshot-positions.d.ts.map +1 -1
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- 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 +84 -6
- package/dist/pptx/index.d.ts +2 -2
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/ui/index.d.ts +1 -0
- 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 +9 -9
- package/dist/pptx/chunks/external-DQ3B4V-o.d.ts +0 -4275
- package/dist/pptx/chunks/external-DQ3B4V-o.d.ts.map +0 -1
package/dist/visio/ui/index.cjs
CHANGED
|
@@ -1133,11 +1133,11 @@ function checkXmlLimits(xml, label2, limits = {}) {
|
|
|
1133
1133
|
throw new Error(`${label2} XML exceeds the nesting depth limit of ${maxDepth}`);
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
|
-
function parseXml(xml,
|
|
1137
|
-
const label2 =
|
|
1136
|
+
function parseXml(xml, options2 = {}) {
|
|
1137
|
+
const label2 = options2.label ?? "OOXML";
|
|
1138
1138
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
1139
1139
|
throw new Error(`${label2} XML with DTD or entity declarations is not supported`);
|
|
1140
|
-
checkXmlLimits(xml, label2,
|
|
1140
|
+
checkXmlLimits(xml, label2, options2.limits);
|
|
1141
1141
|
let parseError = "";
|
|
1142
1142
|
let parsed;
|
|
1143
1143
|
try {
|
|
@@ -1655,8 +1655,8 @@ var VisioPackage = class _VisioPackage {
|
|
|
1655
1655
|
if (Date.now() >= this.deadline)
|
|
1656
1656
|
fail("LIMIT_RUNTIME", "Visio package processing deadline exceeded");
|
|
1657
1657
|
};
|
|
1658
|
-
static async open(input,
|
|
1659
|
-
const limits = { ...DEFAULTS, ...
|
|
1658
|
+
static async open(input, options2 = {}) {
|
|
1659
|
+
const limits = { ...DEFAULTS, ...options2 };
|
|
1660
1660
|
for (const value3 of Object.values(limits))
|
|
1661
1661
|
if (!Number.isFinite(value3) || value3 <= 0)
|
|
1662
1662
|
fail("INVALID_LIMITS", "Package limits must be finite positive numbers");
|
|
@@ -2175,10 +2175,10 @@ function jpeg(bytes, limits) {
|
|
|
2175
2175
|
}
|
|
2176
2176
|
return invalid("JPEG has no image terminator.");
|
|
2177
2177
|
}
|
|
2178
|
-
function inspectVisioRasterImage(bytes,
|
|
2179
|
-
if (!
|
|
2178
|
+
function inspectVisioRasterImage(bytes, options2 = {}) {
|
|
2179
|
+
if (!options2 || typeof options2 !== "object" || Array.isArray(options2))
|
|
2180
2180
|
throw new VisioImageError("invalid-limit", "Image limits must be an options object.");
|
|
2181
|
-
const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...
|
|
2181
|
+
const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...options2 };
|
|
2182
2182
|
for (const key2 of Object.keys(VISIO_RASTER_IMAGE_LIMITS)) {
|
|
2183
2183
|
const value3 = limits[key2];
|
|
2184
2184
|
if (!Number.isSafeInteger(value3) || value3 <= 0 || value3 > VISIO_RASTER_IMAGE_LIMITS[key2])
|
|
@@ -2189,10 +2189,10 @@ function inspectVisioRasterImage(bytes, options = {}) {
|
|
|
2189
2189
|
throw new VisioImageError("image-limit", "Raster image bytes exceed the configured limit.");
|
|
2190
2190
|
return inspect(bytes, limits);
|
|
2191
2191
|
}
|
|
2192
|
-
async function readVisioImage(pkg, sourcePart, foreignData, report,
|
|
2192
|
+
async function readVisioImage(pkg, sourcePart, foreignData, report, options2 = {}) {
|
|
2193
2193
|
const limits = {
|
|
2194
2194
|
...VISIO_RASTER_IMAGE_LIMITS,
|
|
2195
|
-
...
|
|
2195
|
+
...options2
|
|
2196
2196
|
};
|
|
2197
2197
|
if (Object.values(limits).some((value3) => !Number.isSafeInteger(value3) || value3 <= 0))
|
|
2198
2198
|
throw new VisioPackageError("INVALID_LIMIT", "Image limits must be positive safe integers.");
|
|
@@ -4655,9 +4655,9 @@ function cellUnit(name3, relative) {
|
|
|
4655
4655
|
return !relative && /\.[XY]\d+$/i.test(name3) ? "length" : "scalar";
|
|
4656
4656
|
}
|
|
4657
4657
|
var isBooleanLiteral = (ref) => ref.shapeId === void 0 && /^(true|false)$/i.test(ref.cell);
|
|
4658
|
-
function indexCells(roots2,
|
|
4658
|
+
function indexCells(roots2, options2) {
|
|
4659
4659
|
const cells4 = /* @__PURE__ */ new Map();
|
|
4660
|
-
const maxCells = bound(
|
|
4660
|
+
const maxCells = bound(options2.maxCells, 1e5);
|
|
4661
4661
|
const add = (item) => {
|
|
4662
4662
|
const id3 = key(item);
|
|
4663
4663
|
if (cells4.has(id3)) fail("EDIT_AMBIGUOUS_CELL", "Duplicate local ShapeSheet cell.");
|
|
@@ -4683,11 +4683,11 @@ function indexCells(roots2, options) {
|
|
|
4683
4683
|
const visit = (parent, inherited, nested) => {
|
|
4684
4684
|
for (const container of children2(parent, "Shapes"))
|
|
4685
4685
|
for (const node3 of children2(container, "Shape")) {
|
|
4686
|
-
|
|
4686
|
+
options2.check?.();
|
|
4687
4687
|
const shapeId2 = attribute2(node3, "ID");
|
|
4688
4688
|
if (!shapeId2 || ids.has(shapeId2)) fail("INVALID_SHAPE_ID", "Shape IDs must be unique.");
|
|
4689
4689
|
ids.add(shapeId2);
|
|
4690
|
-
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) && !
|
|
4690
|
+
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(
|
|
4691
4691
|
(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")
|
|
4692
4692
|
) || children2(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute2(node3, "Del") ?? "");
|
|
4693
4693
|
sheets.push({ node: node3, shapeId: shapeId2, unsafe: unsafe2 });
|
|
@@ -4780,7 +4780,7 @@ function indexCells(roots2, options) {
|
|
|
4780
4780
|
}
|
|
4781
4781
|
}
|
|
4782
4782
|
for (const node3 of Array.from(root2.getElementsByTagName("*"))) {
|
|
4783
|
-
|
|
4783
|
+
options2.check?.();
|
|
4784
4784
|
if (node3.hasAttribute("F") && !indexedNodes.has(node3))
|
|
4785
4785
|
fail(
|
|
4786
4786
|
"EDIT_UNKNOWN_DEPENDENCY",
|
|
@@ -4792,12 +4792,12 @@ function indexCells(roots2, options) {
|
|
|
4792
4792
|
}
|
|
4793
4793
|
|
|
4794
4794
|
// visio/edit-recalculate-values.ts
|
|
4795
|
-
function createVisioCellEvaluator(cells4,
|
|
4795
|
+
function createVisioCellEvaluator(cells4, options2 = {}, verifyCaches = false) {
|
|
4796
4796
|
const active = /* @__PURE__ */ new Set(), values = /* @__PURE__ */ new Map();
|
|
4797
|
-
let steps = bound(
|
|
4798
|
-
const maxDepth = bound(
|
|
4797
|
+
let steps = bound(options2.maxSteps, 1e5);
|
|
4798
|
+
const maxDepth = bound(options2.maxDepth, 64);
|
|
4799
4799
|
const evaluate = (id3) => {
|
|
4800
|
-
|
|
4800
|
+
options2.check?.();
|
|
4801
4801
|
if (--steps < 0)
|
|
4802
4802
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
4803
4803
|
const cached5 = values.get(id3);
|
|
@@ -4806,7 +4806,7 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4806
4806
|
if (active.size >= maxDepth)
|
|
4807
4807
|
fail("LIMIT_FORMULA_DEPTH", "ShapeSheet dependency depth limit exceeded.");
|
|
4808
4808
|
const item = cells4.get(id3);
|
|
4809
|
-
if (!item || item.unsafe && (!item.node || !
|
|
4809
|
+
if (!item || item.unsafe && (!item.node || !options2.masterMovePins?.has(item.node) && !options2.groupRotationCells?.has(item.node)))
|
|
4810
4810
|
fail(
|
|
4811
4811
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
4812
4812
|
"Affected formula references missing, inherited or grouped cells."
|
|
@@ -4830,7 +4830,7 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4830
4830
|
key({ pageId: item.pageId, shapeId: ref.shapeId ?? item.shapeId, cell: ref.cell })
|
|
4831
4831
|
),
|
|
4832
4832
|
{
|
|
4833
|
-
...
|
|
4833
|
+
...options2.pageContext?.get(item.pageId),
|
|
4834
4834
|
onStep: () => {
|
|
4835
4835
|
if (--steps < 0)
|
|
4836
4836
|
fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
|
|
@@ -4862,8 +4862,8 @@ function createVisioCellEvaluator(cells4, options = {}, verifyCaches = false) {
|
|
|
4862
4862
|
}
|
|
4863
4863
|
|
|
4864
4864
|
// visio/edit-recalculate.ts
|
|
4865
|
-
function recalculateVisioCells(roots2, changed,
|
|
4866
|
-
const cells4 = indexCells(roots2,
|
|
4865
|
+
function recalculateVisioCells(roots2, changed, options2 = {}) {
|
|
4866
|
+
const cells4 = indexCells(roots2, options2);
|
|
4867
4867
|
const reverse = /* @__PURE__ */ new Map();
|
|
4868
4868
|
for (const [id3, item] of cells4)
|
|
4869
4869
|
for (const dependency of item.dependencies) {
|
|
@@ -4873,9 +4873,9 @@ function recalculateVisioCells(roots2, changed, options = {}) {
|
|
|
4873
4873
|
}
|
|
4874
4874
|
const affected = new Set(changed.map(key));
|
|
4875
4875
|
const pending2 = [...affected];
|
|
4876
|
-
const maxAffected = bound(
|
|
4876
|
+
const maxAffected = bound(options2.maxAffectedCells, 1e4);
|
|
4877
4877
|
for (let i = 0; i < pending2.length; i++) {
|
|
4878
|
-
|
|
4878
|
+
options2.check?.();
|
|
4879
4879
|
for (const id3 of reverse.get(pending2[i]) ?? [])
|
|
4880
4880
|
if (!affected.has(id3)) {
|
|
4881
4881
|
affected.add(id3);
|
|
@@ -4884,7 +4884,7 @@ function recalculateVisioCells(roots2, changed, options = {}) {
|
|
|
4884
4884
|
if (affected.size > maxAffected)
|
|
4885
4885
|
fail("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
|
|
4886
4886
|
}
|
|
4887
|
-
const evaluate = createVisioCellEvaluator(cells4,
|
|
4887
|
+
const evaluate = createVisioCellEvaluator(cells4, options2);
|
|
4888
4888
|
const values = /* @__PURE__ */ new Map();
|
|
4889
4889
|
for (const id3 of affected) values.set(id3, evaluate(id3));
|
|
4890
4890
|
const pages = /* @__PURE__ */ new Set();
|
|
@@ -4900,10 +4900,10 @@ function recalculateVisioCells(roots2, changed, options = {}) {
|
|
|
4900
4900
|
}
|
|
4901
4901
|
return [...pages];
|
|
4902
4902
|
}
|
|
4903
|
-
function assertVisioShapesUnreferenced(roots2, removed,
|
|
4904
|
-
const cells4 = indexCells(roots2,
|
|
4903
|
+
function assertVisioShapesUnreferenced(roots2, removed, options2 = {}) {
|
|
4904
|
+
const cells4 = indexCells(roots2, options2);
|
|
4905
4905
|
for (const cell of cells4.values()) {
|
|
4906
|
-
|
|
4906
|
+
options2.check?.();
|
|
4907
4907
|
if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
|
|
4908
4908
|
if (cell.dependencies.some((id3) => {
|
|
4909
4909
|
const parts = JSON.parse(id3);
|
|
@@ -4914,24 +4914,24 @@ function assertVisioShapesUnreferenced(roots2, removed, options = {}) {
|
|
|
4914
4914
|
for (const [pageId2, ids] of removed)
|
|
4915
4915
|
for (const connections2 of children2(roots2.get(pageId2), "Connects"))
|
|
4916
4916
|
for (const connection of children2(connections2, "Connect")) {
|
|
4917
|
-
|
|
4917
|
+
options2.check?.();
|
|
4918
4918
|
if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute2(connection, name3) ?? "")))
|
|
4919
4919
|
fail("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
|
|
4920
4920
|
}
|
|
4921
4921
|
}
|
|
4922
|
-
function assertVisioShapeUnreferenced(roots2, pageId2, shapeId2,
|
|
4923
|
-
assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]),
|
|
4922
|
+
function assertVisioShapeUnreferenced(roots2, pageId2, shapeId2, options2 = {}) {
|
|
4923
|
+
assertVisioShapesUnreferenced(roots2, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
|
|
4924
4924
|
}
|
|
4925
|
-
function createVisioDependencyQuery(roots2,
|
|
4926
|
-
const cells4 = indexCells(roots2,
|
|
4925
|
+
function createVisioDependencyQuery(roots2, options2 = {}) {
|
|
4926
|
+
const cells4 = indexCells(roots2, options2);
|
|
4927
4927
|
return (source, targets) => {
|
|
4928
4928
|
const wanted = new Set(targets.map(key));
|
|
4929
4929
|
const seen = /* @__PURE__ */ new Set();
|
|
4930
4930
|
const pending2 = [key(source)];
|
|
4931
|
-
const maxSteps = bound(
|
|
4931
|
+
const maxSteps = bound(options2.maxSteps, 1e5);
|
|
4932
4932
|
let found = false;
|
|
4933
4933
|
while (pending2.length) {
|
|
4934
|
-
|
|
4934
|
+
options2.check?.();
|
|
4935
4935
|
const id3 = pending2.pop();
|
|
4936
4936
|
if (seen.has(id3)) continue;
|
|
4937
4937
|
seen.add(id3);
|
|
@@ -8843,16 +8843,16 @@ function emfInputView(input) {
|
|
|
8843
8843
|
return null;
|
|
8844
8844
|
}
|
|
8845
8845
|
}
|
|
8846
|
-
function emfInputOptions(
|
|
8847
|
-
if (!
|
|
8846
|
+
function emfInputOptions(options2) {
|
|
8847
|
+
if (!options2 || typeof options2 !== "object") return null;
|
|
8848
8848
|
try {
|
|
8849
|
-
const prototype = Object.getPrototypeOf(
|
|
8849
|
+
const prototype = Object.getPrototypeOf(options2);
|
|
8850
8850
|
if (prototype !== null && prototype !== Object.prototype) return null;
|
|
8851
8851
|
const snapshot = {};
|
|
8852
8852
|
for (const key2 of Object.keys(
|
|
8853
8853
|
VISIO_EMF_ADMISSION_LIMITS
|
|
8854
8854
|
)) {
|
|
8855
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
8855
|
+
const descriptor = Object.getOwnPropertyDescriptor(options2, key2);
|
|
8856
8856
|
if (!descriptor) continue;
|
|
8857
8857
|
if (!("value" in descriptor)) return null;
|
|
8858
8858
|
const value3 = descriptor.value;
|
|
@@ -8868,18 +8868,18 @@ function emfInputOptions(options) {
|
|
|
8868
8868
|
|
|
8869
8869
|
// visio/emf-admission-context.ts
|
|
8870
8870
|
var EmfAdmissionContext = class {
|
|
8871
|
-
constructor(view,
|
|
8871
|
+
constructor(view, options2) {
|
|
8872
8872
|
this.view = view;
|
|
8873
8873
|
this.limits = { ...VISIO_EMF_ADMISSION_LIMITS };
|
|
8874
|
-
if (!
|
|
8874
|
+
if (!options2 || typeof options2 !== "object") {
|
|
8875
8875
|
this.emit("invalid", "limits", "Expected an options object.");
|
|
8876
8876
|
return;
|
|
8877
8877
|
}
|
|
8878
|
-
const cap =
|
|
8878
|
+
const cap = options2.maxDiagnostics;
|
|
8879
8879
|
if (cap !== void 0 && Number.isInteger(cap) && cap > 0 && cap <= this.limits.maxDiagnostics)
|
|
8880
8880
|
this.limits.maxDiagnostics = cap;
|
|
8881
8881
|
for (const key2 of Object.keys(VISIO_EMF_ADMISSION_LIMITS)) {
|
|
8882
|
-
const value3 =
|
|
8882
|
+
const value3 = options2[key2];
|
|
8883
8883
|
if (value3 === void 0) continue;
|
|
8884
8884
|
if (!Number.isSafeInteger(value3) || value3 < 1 || value3 > this.limits[key2])
|
|
8885
8885
|
this.emit("invalid", "limits", "Limits must be positive integers below the hard ceiling.");
|
|
@@ -9432,8 +9432,8 @@ function inspectEmfObjectRecord(c2) {
|
|
|
9432
9432
|
}
|
|
9433
9433
|
|
|
9434
9434
|
// visio/emf-admission.ts
|
|
9435
|
-
function inspectVisioEmfAdmission(input,
|
|
9436
|
-
const snapshot = emfInputOptions(
|
|
9435
|
+
function inspectVisioEmfAdmission(input, options2 = {}) {
|
|
9436
|
+
const snapshot = emfInputOptions(options2);
|
|
9437
9437
|
const view = snapshot === null ? null : emfInputView(input);
|
|
9438
9438
|
const c2 = new EmfAdmissionContext(view ?? new DataView(new ArrayBuffer(0)), snapshot ?? {});
|
|
9439
9439
|
if (snapshot === null) {
|
|
@@ -9660,9 +9660,9 @@ function record(value3, allowed) {
|
|
|
9660
9660
|
}
|
|
9661
9661
|
return result2;
|
|
9662
9662
|
}
|
|
9663
|
-
function limitsFor(
|
|
9663
|
+
function limitsFor(options2) {
|
|
9664
9664
|
const result2 = { ...VISIO_FOREIGN_VECTOR_LIMITS };
|
|
9665
|
-
const values = record(
|
|
9665
|
+
const values = record(options2, Object.keys(result2));
|
|
9666
9666
|
for (const key2 of Object.keys(values)) {
|
|
9667
9667
|
const value3 = values[key2];
|
|
9668
9668
|
if (typeof value3 !== "number" || !Number.isSafeInteger(value3) || value3 < 1 || value3 > result2[key2])
|
|
@@ -10008,9 +10008,9 @@ var PAINT = {
|
|
|
10008
10008
|
fillOpacity: "fill-opacity",
|
|
10009
10009
|
strokeOpacity: "stroke-opacity"
|
|
10010
10010
|
};
|
|
10011
|
-
function validateVisioForeignVector(value3,
|
|
10011
|
+
function validateVisioForeignVector(value3, options2 = {}) {
|
|
10012
10012
|
try {
|
|
10013
|
-
return validate(value3, limitsFor(
|
|
10013
|
+
return validate(value3, limitsFor(options2));
|
|
10014
10014
|
} catch (error) {
|
|
10015
10015
|
if (error instanceof VisioForeignVectorError) throw error;
|
|
10016
10016
|
unsafe("Unable to inspect vector scene safely.");
|
|
@@ -10172,9 +10172,9 @@ var ATTRS = {
|
|
|
10172
10172
|
clipPath: ["id", "clipPathUnits", "clip-rule", ...BASE]
|
|
10173
10173
|
};
|
|
10174
10174
|
var ID2 = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
|
|
10175
|
-
function sanitizeVisioForeignVectorTree(root2,
|
|
10175
|
+
function sanitizeVisioForeignVectorTree(root2, options2 = {}) {
|
|
10176
10176
|
try {
|
|
10177
|
-
return sanitize(root2, limitsFor(
|
|
10177
|
+
return sanitize(root2, limitsFor(options2));
|
|
10178
10178
|
} catch (error) {
|
|
10179
10179
|
if (error instanceof VisioForeignVectorError) throw error;
|
|
10180
10180
|
unsafe("Unable to inspect converter output safely.");
|
|
@@ -11713,15 +11713,15 @@ function renderAbs(v, section3, generalWidth) {
|
|
|
11713
11713
|
}
|
|
11714
11714
|
return { text: text8, zero: general === "0" };
|
|
11715
11715
|
}
|
|
11716
|
-
function hashFill(
|
|
11717
|
-
const width =
|
|
11718
|
-
const one =
|
|
11716
|
+
function hashFill(options2) {
|
|
11717
|
+
const width = options2.width ?? 0;
|
|
11718
|
+
const one = options2.measure ? options2.measure("#") : 1;
|
|
11719
11719
|
return "#".repeat(Math.max(1, Math.floor(one > 0 ? width / one : width)));
|
|
11720
11720
|
}
|
|
11721
|
-
function fitNumber(value3, format5,
|
|
11722
|
-
const date1904 =
|
|
11723
|
-
const width =
|
|
11724
|
-
const fits = (text8) => (
|
|
11721
|
+
function fitNumber(value3, format5, options2) {
|
|
11722
|
+
const date1904 = options2.date1904 ?? false;
|
|
11723
|
+
const width = options2.width ?? 0;
|
|
11724
|
+
const fits = (text8) => (options2.measure ? options2.measure(text8) : text8.length) <= width;
|
|
11725
11725
|
const first2 = formatNumber2(value3, format5, date1904);
|
|
11726
11726
|
if (fits(first2.text) || first2.text === OVERFLOW_TEXT) return first2;
|
|
11727
11727
|
const choice2 = chooseSection(compileFormat(format5), value3);
|
|
@@ -11732,7 +11732,7 @@ function fitNumber(value3, format5, options) {
|
|
|
11732
11732
|
if (fits(next.text)) return next;
|
|
11733
11733
|
}
|
|
11734
11734
|
}
|
|
11735
|
-
const fill = hashFill(
|
|
11735
|
+
const fill = hashFill(options2);
|
|
11736
11736
|
return first2.color ? { text: fill, color: first2.color } : { text: fill };
|
|
11737
11737
|
}
|
|
11738
11738
|
function formatNumber2(value3, format5, date1904, generalWidth) {
|
|
@@ -11754,13 +11754,13 @@ function formatNumber2(value3, format5, date1904, generalWidth) {
|
|
|
11754
11754
|
const minus = value3 < 0 && !abs && !zero;
|
|
11755
11755
|
return result(minus ? `-${text8}` : text8, section3);
|
|
11756
11756
|
}
|
|
11757
|
-
function formatValue(value3, format5,
|
|
11757
|
+
function formatValue(value3, format5, options2 = {}) {
|
|
11758
11758
|
if (value3 === null) return { text: "" };
|
|
11759
11759
|
if (typeof value3 === "boolean") return { text: value3 ? "TRUE" : "FALSE" };
|
|
11760
11760
|
if (typeof value3 === "string") return formatText(value3, compileFormat(format5).text);
|
|
11761
11761
|
if (isCellError(value3)) return { text: value3.error };
|
|
11762
|
-
if (
|
|
11763
|
-
return formatNumber2(value3, format5,
|
|
11762
|
+
if (options2.width !== void 0) return fitNumber(value3, format5, options2);
|
|
11763
|
+
return formatNumber2(value3, format5, options2.date1904 ?? false);
|
|
11764
11764
|
}
|
|
11765
11765
|
function isDateFormat(format5) {
|
|
11766
11766
|
return compileFormat(format5).isDate;
|
|
@@ -15802,8 +15802,8 @@ function rgbToHsl(r, g, b) {
|
|
|
15802
15802
|
}
|
|
15803
15803
|
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
15804
15804
|
}
|
|
15805
|
-
function hslToRgb(h, s, l, roundChannel = Math.round,
|
|
15806
|
-
const sC =
|
|
15805
|
+
function hslToRgb(h, s, l, roundChannel = Math.round, options2) {
|
|
15806
|
+
const sC = options2?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
15807
15807
|
const lC = clampUnitInterval(l);
|
|
15808
15808
|
const hN = (h % 360 + 360) % 360;
|
|
15809
15809
|
const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
@@ -16316,13 +16316,13 @@ var APPLIED = /* @__PURE__ */ new Set([
|
|
|
16316
16316
|
"lumMod",
|
|
16317
16317
|
"lumOff"
|
|
16318
16318
|
]);
|
|
16319
|
-
function resolveDrawingColor(color2, theme2,
|
|
16319
|
+
function resolveDrawingColor(color2, theme2, options2) {
|
|
16320
16320
|
const base2 = baseHex(color2, theme2);
|
|
16321
16321
|
const rgb6 = base2 ? hexToRgbChannels(base2) : null;
|
|
16322
16322
|
if (!rgb6) return void 0;
|
|
16323
|
-
if (
|
|
16323
|
+
if (options2?.transformOrder === "document") {
|
|
16324
16324
|
const value3 = orderedColorTransforms(rgb6, color2.transforms);
|
|
16325
|
-
const round6 =
|
|
16325
|
+
const round6 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
16326
16326
|
return {
|
|
16327
16327
|
hex: `#${toHex(round6(value3.r))}${toHex(round6(value3.g))}${toHex(round6(value3.b))}`,
|
|
16328
16328
|
alpha: value3.alpha,
|
|
@@ -16373,7 +16373,7 @@ function resolveDrawingColor(color2, theme2, options) {
|
|
|
16373
16373
|
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
16374
16374
|
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
16375
16375
|
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
16376
|
-
const round6 =
|
|
16376
|
+
const round6 = options2?.hslRounding === "halfDown" ? (value3) => Math.ceil(value3 - 0.5) : Math.round;
|
|
16377
16377
|
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round6));
|
|
16378
16378
|
}
|
|
16379
16379
|
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
@@ -19183,6 +19183,74 @@ function parseChartSpace(source) {
|
|
|
19183
19183
|
);
|
|
19184
19184
|
return { chartSpace, issues: context.issues };
|
|
19185
19185
|
}
|
|
19186
|
+
var AUTOMATIC_MARKER_CYCLE = [
|
|
19187
|
+
"diamond",
|
|
19188
|
+
"square",
|
|
19189
|
+
"triangle",
|
|
19190
|
+
"x",
|
|
19191
|
+
"star",
|
|
19192
|
+
"circle",
|
|
19193
|
+
"plus",
|
|
19194
|
+
"dot",
|
|
19195
|
+
"dash"
|
|
19196
|
+
];
|
|
19197
|
+
function automaticMarkerSymbol(seriesIdx) {
|
|
19198
|
+
const length = AUTOMATIC_MARKER_CYCLE.length;
|
|
19199
|
+
const normalized = (Math.trunc(seriesIdx) % length + length) % length;
|
|
19200
|
+
return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
|
|
19201
|
+
}
|
|
19202
|
+
|
|
19203
|
+
// chart/render/chart-view-markers.ts
|
|
19204
|
+
function summaryMarkers(source, group2, seriesPosition) {
|
|
19205
|
+
if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
|
|
19206
|
+
const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
|
|
19207
|
+
const symbol = source.marker?.symbol;
|
|
19208
|
+
const marker3 = {
|
|
19209
|
+
...source.marker,
|
|
19210
|
+
symbol: symbol && symbol !== "auto" ? symbol : source.marker || enabled ? automaticMarkerSymbol(source.index ?? seriesPosition) : "none"
|
|
19211
|
+
};
|
|
19212
|
+
const pointMarkers = {};
|
|
19213
|
+
for (const point2 of source.dataPoints) {
|
|
19214
|
+
if (point2.index === void 0 || !point2.marker) continue;
|
|
19215
|
+
const override = point2.marker;
|
|
19216
|
+
pointMarkers[point2.index] = {
|
|
19217
|
+
...marker3,
|
|
19218
|
+
...override,
|
|
19219
|
+
...override.symbol === "auto" || !source.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source.index ?? seriesPosition) } : {},
|
|
19220
|
+
...marker3.spPr || override.spPr ? {
|
|
19221
|
+
spPr: {
|
|
19222
|
+
...marker3.spPr,
|
|
19223
|
+
...override.spPr,
|
|
19224
|
+
...marker3.spPr?.line || override.spPr?.line ? { line: { ...marker3.spPr?.line, ...override.spPr?.line } } : {}
|
|
19225
|
+
}
|
|
19226
|
+
} : {}
|
|
19227
|
+
};
|
|
19228
|
+
}
|
|
19229
|
+
return { marker: marker3, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
|
|
19230
|
+
}
|
|
19231
|
+
function seriesMarkerViews(source, drawingColor2) {
|
|
19232
|
+
const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor2(fill.color) : void 0;
|
|
19233
|
+
const resolve = (marker3) => {
|
|
19234
|
+
const fill = fillColor(marker3.spPr?.fill);
|
|
19235
|
+
const stroke = fillColor(marker3.spPr?.line?.fill);
|
|
19236
|
+
const width = marker3.spPr?.line?.widthEmu;
|
|
19237
|
+
return {
|
|
19238
|
+
...marker3.symbol !== void 0 ? { symbol: marker3.symbol } : {},
|
|
19239
|
+
...marker3.size !== void 0 ? { size: marker3.size } : {},
|
|
19240
|
+
...fill !== void 0 ? { fill } : {},
|
|
19241
|
+
...stroke !== void 0 ? { stroke } : {},
|
|
19242
|
+
...width !== void 0 ? { strokeWidth: width / 9525 } : {}
|
|
19243
|
+
};
|
|
19244
|
+
};
|
|
19245
|
+
return {
|
|
19246
|
+
...source.marker ? { marker: resolve(source.marker) } : {},
|
|
19247
|
+
...source.pointMarkers ? {
|
|
19248
|
+
pointMarkers: Object.fromEntries(
|
|
19249
|
+
Object.entries(source.pointMarkers).map(([i, marker3]) => [i, resolve(marker3)])
|
|
19250
|
+
)
|
|
19251
|
+
} : {}
|
|
19252
|
+
};
|
|
19253
|
+
}
|
|
19186
19254
|
|
|
19187
19255
|
// chart/render/summary-analysis.ts
|
|
19188
19256
|
function summaryTrendline(source) {
|
|
@@ -19506,17 +19574,17 @@ function composeDataLabelText(input) {
|
|
|
19506
19574
|
}
|
|
19507
19575
|
|
|
19508
19576
|
// chart/render/summary-labels.ts
|
|
19509
|
-
function level(
|
|
19577
|
+
function level(options2, custom) {
|
|
19510
19578
|
const out = {};
|
|
19511
|
-
if (
|
|
19512
|
-
if (
|
|
19513
|
-
if (
|
|
19514
|
-
if (
|
|
19515
|
-
if (
|
|
19516
|
-
if (
|
|
19517
|
-
if (
|
|
19518
|
-
if (
|
|
19519
|
-
if (
|
|
19579
|
+
if (options2.deleted !== void 0) out.deleted = options2.deleted;
|
|
19580
|
+
if (options2.showValue !== void 0) out.showValue = options2.showValue;
|
|
19581
|
+
if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
|
|
19582
|
+
if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
|
|
19583
|
+
if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
|
|
19584
|
+
if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
|
|
19585
|
+
if (options2.separator !== void 0) out.separator = options2.separator;
|
|
19586
|
+
if (options2.position) out.position = options2.position;
|
|
19587
|
+
if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
|
|
19520
19588
|
if (custom?.text !== void 0) out.text = custom.text;
|
|
19521
19589
|
return out;
|
|
19522
19590
|
}
|
|
@@ -19623,7 +19691,10 @@ function extraGroups(chartSpace, firstType) {
|
|
|
19623
19691
|
const type = group2.kind === "bar" ? "column" : group2.kind;
|
|
19624
19692
|
const entry3 = {
|
|
19625
19693
|
chartType: type,
|
|
19626
|
-
series: group2.series.map((source) =>
|
|
19694
|
+
series: group2.series.map((source, index2) => ({
|
|
19695
|
+
...chartSummarySeries(source, type, group2.dataLabels),
|
|
19696
|
+
...summaryMarkers(source, group2, index2)
|
|
19697
|
+
})),
|
|
19627
19698
|
secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
|
|
19628
19699
|
};
|
|
19629
19700
|
if (group2.grouping && GROUPINGS.has(group2.grouping))
|
|
@@ -19641,13 +19712,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
|
19641
19712
|
const group2 = chartSpace.plotArea.groups[0];
|
|
19642
19713
|
let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
|
|
19643
19714
|
if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
|
|
19644
|
-
const series = (group2?.series ?? []).map(
|
|
19645
|
-
|
|
19646
|
-
|
|
19715
|
+
const series = (group2?.series ?? []).map((source, index2) => ({
|
|
19716
|
+
...chartSummarySeries(source, chartType, group2?.dataLabels),
|
|
19717
|
+
...group2 ? summaryMarkers(source, group2, index2) : {}
|
|
19718
|
+
}));
|
|
19647
19719
|
const summary = {
|
|
19648
19720
|
chartType,
|
|
19649
19721
|
series,
|
|
19650
|
-
showLegend: chartSpace.legend !== void 0
|
|
19722
|
+
showLegend: chartSpace.legend !== void 0,
|
|
19723
|
+
axes: chartSpace.plotArea.axes,
|
|
19724
|
+
axisIds: group2?.axisIds ?? []
|
|
19651
19725
|
};
|
|
19652
19726
|
const combined = extraGroups(chartSpace, chartType);
|
|
19653
19727
|
if (combined.length) summary.extraGroups = combined;
|
|
@@ -19730,6 +19804,8 @@ function parseChart(xml, anchor, partName, name3) {
|
|
|
19730
19804
|
showLegend: summary.showLegend,
|
|
19731
19805
|
partName
|
|
19732
19806
|
};
|
|
19807
|
+
if (summary.axes) object.axes = summary.axes;
|
|
19808
|
+
if (summary.axisIds) object.axisIds = summary.axisIds;
|
|
19733
19809
|
if (summary.grouping) object.grouping = summary.grouping;
|
|
19734
19810
|
if (summary.barGapWidth !== void 0) object.barGapWidth = summary.barGapWidth;
|
|
19735
19811
|
if (summary.barOverlap !== void 0) object.barOverlap = summary.barOverlap;
|
|
@@ -21150,14 +21226,14 @@ function* units2(raw) {
|
|
|
21150
21226
|
exp++;
|
|
21151
21227
|
}
|
|
21152
21228
|
}
|
|
21153
|
-
function niceScale(dataMin, dataMax,
|
|
21154
|
-
const maxIntervals = Math.max(1,
|
|
21229
|
+
function niceScale(dataMin, dataMax, options2 = {}) {
|
|
21230
|
+
const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
|
|
21155
21231
|
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
21156
21232
|
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
21157
21233
|
if (lo > hi) [lo, hi] = [hi, lo];
|
|
21158
21234
|
if (lo === hi) {
|
|
21159
21235
|
if (lo === 0) hi = 1;
|
|
21160
|
-
else if (
|
|
21236
|
+
else if (options2.noZero) {
|
|
21161
21237
|
const pad5 = Math.abs(lo) * 0.1 || 1;
|
|
21162
21238
|
lo -= pad5;
|
|
21163
21239
|
hi += pad5;
|
|
@@ -21166,7 +21242,7 @@ function niceScale(dataMin, dataMax, options = {}) {
|
|
|
21166
21242
|
}
|
|
21167
21243
|
let fixedLo = false;
|
|
21168
21244
|
let fixedHi = false;
|
|
21169
|
-
if (!
|
|
21245
|
+
if (!options2.noZero) {
|
|
21170
21246
|
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
21171
21247
|
lo = 0;
|
|
21172
21248
|
fixedLo = true;
|
|
@@ -21206,6 +21282,194 @@ function formatAxisValue(value3, percent = false) {
|
|
|
21206
21282
|
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
21207
21283
|
}
|
|
21208
21284
|
|
|
21285
|
+
// chart/axis-range.ts
|
|
21286
|
+
function computeLogValueRange(series, logBase) {
|
|
21287
|
+
const allValues = series.flatMap((item) => item.values).filter((value3) => value3 !== null && Number.isFinite(value3) && value3 > 0);
|
|
21288
|
+
if (allValues.length === 0) {
|
|
21289
|
+
return { min: 1, max: logBase, span: 1, logScale: true, logBase };
|
|
21290
|
+
}
|
|
21291
|
+
const dataMin = Math.min(...allValues);
|
|
21292
|
+
const dataMax = Math.max(...allValues);
|
|
21293
|
+
const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
|
|
21294
|
+
const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
|
|
21295
|
+
const min = logBase ** logMin;
|
|
21296
|
+
const max = logBase ** Math.max(logMax, logMin + 1);
|
|
21297
|
+
return {
|
|
21298
|
+
min,
|
|
21299
|
+
max,
|
|
21300
|
+
span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
|
|
21301
|
+
logScale: true,
|
|
21302
|
+
logBase
|
|
21303
|
+
};
|
|
21304
|
+
}
|
|
21305
|
+
function withAxisBounds(automatic, axis, logBase) {
|
|
21306
|
+
const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
|
|
21307
|
+
const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
|
|
21308
|
+
const min = validMin ?? automatic.min;
|
|
21309
|
+
let max = validMax ?? automatic.max;
|
|
21310
|
+
const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
|
|
21311
|
+
if (max <= min) {
|
|
21312
|
+
max = logBase ? min * logBase : min + 1;
|
|
21313
|
+
}
|
|
21314
|
+
const span = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
|
|
21315
|
+
return {
|
|
21316
|
+
min,
|
|
21317
|
+
max,
|
|
21318
|
+
span: Math.max(span, Number.EPSILON),
|
|
21319
|
+
...majorUnit !== void 0 ? { majorUnit } : {},
|
|
21320
|
+
...logBase ? { logScale: true, logBase } : {},
|
|
21321
|
+
...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
|
|
21322
|
+
};
|
|
21323
|
+
}
|
|
21324
|
+
|
|
21325
|
+
// chart/axis-ticks.ts
|
|
21326
|
+
var LOG_EXPONENT_TOLERANCE = 1e-12;
|
|
21327
|
+
function generateLogTicks(range2) {
|
|
21328
|
+
if (!range2.logScale || !range2.logBase) {
|
|
21329
|
+
return [];
|
|
21330
|
+
}
|
|
21331
|
+
const base2 = range2.logBase;
|
|
21332
|
+
const logMin = Math.log(range2.min) / Math.log(base2);
|
|
21333
|
+
const logMax = Math.log(range2.max) / Math.log(base2);
|
|
21334
|
+
const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
|
|
21335
|
+
const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
|
|
21336
|
+
if (lastExponent < firstExponent) {
|
|
21337
|
+
return range2.min === range2.max ? [range2.min] : [range2.min, range2.max];
|
|
21338
|
+
}
|
|
21339
|
+
return Array.from(
|
|
21340
|
+
{ length: lastExponent - firstExponent + 1 },
|
|
21341
|
+
(_unused, index2) => base2 ** (firstExponent + index2)
|
|
21342
|
+
);
|
|
21343
|
+
}
|
|
21344
|
+
function generateIntervalTicks(range2, unit3) {
|
|
21345
|
+
if (!Number.isFinite(unit3) || unit3 <= 0 || range2.logScale) {
|
|
21346
|
+
return [];
|
|
21347
|
+
}
|
|
21348
|
+
const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-12;
|
|
21349
|
+
const first2 = Math.ceil((range2.min - tolerance) / unit3);
|
|
21350
|
+
const last = Math.floor((range2.max + tolerance) / unit3);
|
|
21351
|
+
const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
|
|
21352
|
+
return Array.from({ length: count }, (_, index2) => (first2 + index2) * unit3);
|
|
21353
|
+
}
|
|
21354
|
+
function generateAxisTicks(range2, axis, defaultIntervals) {
|
|
21355
|
+
if (range2.logScale && range2.logBase) {
|
|
21356
|
+
return generateLogTicks(range2);
|
|
21357
|
+
}
|
|
21358
|
+
const explicit = generateIntervalTicks(range2, axis?.majorUnit ?? 0);
|
|
21359
|
+
if (explicit.length > 0) {
|
|
21360
|
+
return explicit;
|
|
21361
|
+
}
|
|
21362
|
+
const automatic = generateIntervalTicks(range2, range2.majorUnit ?? 0);
|
|
21363
|
+
if (automatic.length > 0) {
|
|
21364
|
+
return automatic;
|
|
21365
|
+
}
|
|
21366
|
+
return Array.from(
|
|
21367
|
+
{ length: defaultIntervals + 1 },
|
|
21368
|
+
(_, index2) => range2.min + range2.span / defaultIntervals * index2
|
|
21369
|
+
);
|
|
21370
|
+
}
|
|
21371
|
+
function generateMinorAxisTicks(range2, axis) {
|
|
21372
|
+
const minor = generateIntervalTicks(range2, axis?.minorUnit ?? 0);
|
|
21373
|
+
if (minor.length === 0) {
|
|
21374
|
+
return [];
|
|
21375
|
+
}
|
|
21376
|
+
const majorUnit = axis?.majorUnit;
|
|
21377
|
+
if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
|
|
21378
|
+
return minor;
|
|
21379
|
+
}
|
|
21380
|
+
const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-10;
|
|
21381
|
+
return minor.filter(
|
|
21382
|
+
(value3) => Math.abs(value3 / majorUnit - Math.round(value3 / majorUnit)) > tolerance
|
|
21383
|
+
);
|
|
21384
|
+
}
|
|
21385
|
+
|
|
21386
|
+
// chart/render/chart-view-axes.ts
|
|
21387
|
+
function options(axis) {
|
|
21388
|
+
return {
|
|
21389
|
+
...axis.scaling,
|
|
21390
|
+
...axis.scaling.logBase === void 0 ? {} : { logScale: true },
|
|
21391
|
+
...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
|
|
21392
|
+
...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
|
|
21393
|
+
};
|
|
21394
|
+
}
|
|
21395
|
+
function applyChartAxes(model, chart, color2) {
|
|
21396
|
+
if (!chart.axes?.length) return;
|
|
21397
|
+
const axes = chart.axes;
|
|
21398
|
+
const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
|
|
21399
|
+
const candidates = linked.length ? linked : axes;
|
|
21400
|
+
const xy = model.type === "scatter" || model.type === "bubble";
|
|
21401
|
+
const value3 = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
|
|
21402
|
+
const category = candidates.find(
|
|
21403
|
+
(axis) => xy ? axis.kind === "val" && axis !== value3 : axis.kind === "cat" || axis.kind === "date"
|
|
21404
|
+
);
|
|
21405
|
+
const secondary = axes.find((axis) => axis.kind === "val" && axis !== value3 && axis !== category);
|
|
21406
|
+
const paint2 = (shape) => {
|
|
21407
|
+
const ln = shape?.line;
|
|
21408
|
+
const fill = ln?.fill;
|
|
21409
|
+
const resolved = fill?.kind === "none" ? "none" : color2(fill?.kind === "solid" ? fill.color : void 0);
|
|
21410
|
+
return {
|
|
21411
|
+
...resolved === void 0 ? {} : { color: resolved },
|
|
21412
|
+
...ln?.widthEmu === void 0 ? {} : { width: ln.widthEmu / EMU_PER_PIXEL },
|
|
21413
|
+
...ln?.dash === void 0 ? {} : { dash: ln.dash }
|
|
21414
|
+
};
|
|
21415
|
+
};
|
|
21416
|
+
const bind = (axis, scale, values) => {
|
|
21417
|
+
const opts = options(axis);
|
|
21418
|
+
const automatic = opts.logScale ? computeLogValueRange(
|
|
21419
|
+
[{ values: values ?? [] }],
|
|
21420
|
+
opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
|
|
21421
|
+
) : {
|
|
21422
|
+
min: scale?.min ?? 0,
|
|
21423
|
+
max: scale?.max ?? 1,
|
|
21424
|
+
span: (scale?.max ?? 1) - (scale?.min ?? 0),
|
|
21425
|
+
...scale ? { majorUnit: scale.majorUnit } : {}
|
|
21426
|
+
};
|
|
21427
|
+
const logBase = automatic.logBase;
|
|
21428
|
+
const range2 = withAxisBounds(automatic, opts, logBase);
|
|
21429
|
+
if (scale) {
|
|
21430
|
+
scale.min = range2.min;
|
|
21431
|
+
scale.max = range2.max;
|
|
21432
|
+
scale.ticks = generateAxisTicks(range2, opts, 5);
|
|
21433
|
+
}
|
|
21434
|
+
return {
|
|
21435
|
+
source: axis,
|
|
21436
|
+
range: range2,
|
|
21437
|
+
minorTicks: generateMinorAxisTicks(range2, opts),
|
|
21438
|
+
line: paint2(axis.spPr),
|
|
21439
|
+
majorGrid: paint2(axis.majorGridlinesSpPr),
|
|
21440
|
+
minorGrid: paint2(axis.minorGridlinesSpPr)
|
|
21441
|
+
};
|
|
21442
|
+
};
|
|
21443
|
+
const out = {};
|
|
21444
|
+
if (value3)
|
|
21445
|
+
out.value = bind(
|
|
21446
|
+
value3,
|
|
21447
|
+
model.valueAxis,
|
|
21448
|
+
[
|
|
21449
|
+
...model.series,
|
|
21450
|
+
...model.extraGroups?.filter((g) => !g.secondary).flatMap((g) => g.series) ?? []
|
|
21451
|
+
].flatMap((s) => s.values)
|
|
21452
|
+
);
|
|
21453
|
+
if (category)
|
|
21454
|
+
out.category = bind(
|
|
21455
|
+
category,
|
|
21456
|
+
model.xAxis ?? {
|
|
21457
|
+
min: 0,
|
|
21458
|
+
max: Math.max(1, model.categories.length - 1),
|
|
21459
|
+
majorUnit: 1,
|
|
21460
|
+
ticks: []
|
|
21461
|
+
},
|
|
21462
|
+
model.series.flatMap((s) => s.xValues ?? [])
|
|
21463
|
+
);
|
|
21464
|
+
if (secondary)
|
|
21465
|
+
out.secondary = bind(
|
|
21466
|
+
secondary,
|
|
21467
|
+
model.secondaryAxis,
|
|
21468
|
+
model.extraGroups?.filter((g) => g.secondary).flatMap((g) => g.series.flatMap((s) => s.values))
|
|
21469
|
+
);
|
|
21470
|
+
model.axes = out;
|
|
21471
|
+
}
|
|
21472
|
+
|
|
21209
21473
|
// chart/hierarchy.ts
|
|
21210
21474
|
function normalizeLevels(levels, pointCount) {
|
|
21211
21475
|
return levels.map((level2) => {
|
|
@@ -21428,15 +21692,15 @@ function seriesName(series, index2, evaluateRef2) {
|
|
|
21428
21692
|
const fromRef = resolveRef(series.nameRef, evaluateRef2)?.map(toText).filter((t) => t !== "").join(" ");
|
|
21429
21693
|
return fromRef || series.name || `Series${index2 + 1}`;
|
|
21430
21694
|
}
|
|
21431
|
-
function seriesContext(chart, theme2,
|
|
21695
|
+
function seriesContext(chart, theme2, options2) {
|
|
21432
21696
|
const scheme = chartColorScheme(theme2);
|
|
21433
21697
|
const resolver = { scheme: (name3) => scheme[name3] };
|
|
21434
21698
|
return {
|
|
21435
21699
|
theme: theme2,
|
|
21436
21700
|
scheme,
|
|
21437
21701
|
palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
|
|
21438
|
-
evaluateRef:
|
|
21439
|
-
seriesColor:
|
|
21702
|
+
evaluateRef: options2.evaluateRef ?? (() => []),
|
|
21703
|
+
seriesColor: options2.seriesColor,
|
|
21440
21704
|
drawingColor: (color2) => color2 && drawingColorCss(resolveDrawingColor(color2, resolver, { transformOrder: "document" })),
|
|
21441
21705
|
gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
21442
21706
|
fill,
|
|
@@ -21462,7 +21726,11 @@ function seriesView(ctx, s, index2, total, categoriesOf) {
|
|
|
21462
21726
|
})
|
|
21463
21727
|
);
|
|
21464
21728
|
if (Object.keys(points2).length) view.pointGradients = points2;
|
|
21465
|
-
Object.assign(
|
|
21729
|
+
Object.assign(
|
|
21730
|
+
view,
|
|
21731
|
+
analysisView(s, color2, ctx.drawingColor),
|
|
21732
|
+
seriesMarkerViews(s, ctx.drawingColor)
|
|
21733
|
+
);
|
|
21466
21734
|
return view;
|
|
21467
21735
|
}
|
|
21468
21736
|
|
|
@@ -21727,14 +21995,14 @@ function scottBinCount(values, min, max) {
|
|
|
21727
21995
|
const width = 3.49 * sd * values.length ** (-1 / 3);
|
|
21728
21996
|
return Math.max(1, Math.ceil((max - min) / width));
|
|
21729
21997
|
}
|
|
21730
|
-
function computeHistogramBins(values,
|
|
21731
|
-
const closed =
|
|
21998
|
+
function computeHistogramBins(values, options2, format5 = String) {
|
|
21999
|
+
const closed = options2.intervalClosed ?? "l";
|
|
21732
22000
|
const finite5 = values.map((value3, sourceIndex) => ({ value: value3, sourceIndex })).filter((item) => Number.isFinite(item.value));
|
|
21733
22001
|
if (finite5.length === 0) {
|
|
21734
22002
|
return [];
|
|
21735
22003
|
}
|
|
21736
|
-
const underflow = typeof
|
|
21737
|
-
const overflow = typeof
|
|
22004
|
+
const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
|
|
22005
|
+
const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
|
|
21738
22006
|
const under = underflow === void 0 ? [] : finite5.filter(
|
|
21739
22007
|
(item) => closed === "r" ? item.value <= underflow : item.value < underflow
|
|
21740
22008
|
);
|
|
@@ -21751,8 +22019,8 @@ function computeHistogramBins(values, options, format5 = String) {
|
|
|
21751
22019
|
if (regular.length > 0) {
|
|
21752
22020
|
const min = Math.min(...regular.map((item) => item.value));
|
|
21753
22021
|
const max = Math.max(...regular.map((item) => item.value));
|
|
21754
|
-
const requestedSize =
|
|
21755
|
-
const requestedCount =
|
|
22022
|
+
const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
|
|
22023
|
+
const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
|
|
21756
22024
|
const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
|
|
21757
22025
|
const count = requestedSize ? Math.max(
|
|
21758
22026
|
closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
|
|
@@ -21803,9 +22071,9 @@ function aggregateByCategory(values, rawCategories) {
|
|
|
21803
22071
|
}
|
|
21804
22072
|
|
|
21805
22073
|
// chart/waterfall.ts
|
|
21806
|
-
function buildWaterfallSteps(values,
|
|
22074
|
+
function buildWaterfallSteps(values, options2) {
|
|
21807
22075
|
const subtotalIndices = new Set(
|
|
21808
|
-
|
|
22076
|
+
options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
|
|
21809
22077
|
);
|
|
21810
22078
|
const steps = [];
|
|
21811
22079
|
let runningTotal = 0;
|
|
@@ -21889,11 +22157,11 @@ function histogramView(chart, model) {
|
|
|
21889
22157
|
const first2 = model.series[0];
|
|
21890
22158
|
if (!first2) return;
|
|
21891
22159
|
const raw = first2.values.map((v) => v ?? Number.NaN);
|
|
21892
|
-
const
|
|
21893
|
-
const bins =
|
|
22160
|
+
const options2 = chart.histogram ?? {};
|
|
22161
|
+
const bins = options2.aggregateByCategory ? aggregateByCategory(
|
|
21894
22162
|
first2.values.map((v) => v ?? 0),
|
|
21895
22163
|
model.categories
|
|
21896
|
-
) : computeHistogramBins(raw,
|
|
22164
|
+
) : computeHistogramBins(raw, options2, formatAxisValue);
|
|
21897
22165
|
model.categories = bins.map((bin) => bin.label);
|
|
21898
22166
|
first2.values = bins.map((bin) => bin.value);
|
|
21899
22167
|
model.barGapWidth = 0;
|
|
@@ -21917,11 +22185,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
|
|
|
21917
22185
|
"treemap",
|
|
21918
22186
|
"sunburst"
|
|
21919
22187
|
]);
|
|
21920
|
-
function chartSummaryView(chart, theme2,
|
|
22188
|
+
function chartSummaryView(chart, theme2, options2 = {}) {
|
|
21921
22189
|
const type = chart.chartType;
|
|
21922
22190
|
const radial = type === "pie" || type === "doughnut";
|
|
21923
22191
|
const byPoint = radial || type === "treemap" || type === "sunburst";
|
|
21924
|
-
const ctx = seriesContext(chart, theme2,
|
|
22192
|
+
const ctx = seriesContext(chart, theme2, options2);
|
|
21925
22193
|
const { palette, scheme, drawingColor: drawingColor2 } = ctx;
|
|
21926
22194
|
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
21927
22195
|
const rawCategories = [];
|
|
@@ -22007,6 +22275,7 @@ function chartSummaryView(chart, theme2, options = {}) {
|
|
|
22007
22275
|
else if (!byPoint) model.valueAxis = valueAxis(model);
|
|
22008
22276
|
applyDataLabels(model, chart.series, extra);
|
|
22009
22277
|
chartExtraAxes(model);
|
|
22278
|
+
applyChartAxes(model, chart, ctx.drawingColor);
|
|
22010
22279
|
return model;
|
|
22011
22280
|
}
|
|
22012
22281
|
|
|
@@ -22101,7 +22370,7 @@ async function readEmbeddedChartObject(pkg, sourcePart, foreignData, report) {
|
|
|
22101
22370
|
}
|
|
22102
22371
|
|
|
22103
22372
|
// visio/prepare-images.ts
|
|
22104
|
-
async function prepareImages(shapes, pkg, sourcePart, report,
|
|
22373
|
+
async function prepareImages(shapes, pkg, sourcePart, report, options2, converter) {
|
|
22105
22374
|
for (const shape of shapes) {
|
|
22106
22375
|
if (shape.deleted) continue;
|
|
22107
22376
|
const localReport = (code, message, extra) => report(code, message, { part: sourcePart, shapeId: shape.id, ...extra });
|
|
@@ -22129,12 +22398,12 @@ async function prepareImages(shapes, pkg, sourcePart, report, options, converter
|
|
|
22129
22398
|
sourcePart,
|
|
22130
22399
|
shape.foreignData,
|
|
22131
22400
|
localReport,
|
|
22132
|
-
|
|
22401
|
+
options2
|
|
22133
22402
|
);
|
|
22134
22403
|
if (image) shape.image = image;
|
|
22135
22404
|
}
|
|
22136
22405
|
}
|
|
22137
|
-
await prepareImages(shape.children, pkg, sourcePart, report,
|
|
22406
|
+
await prepareImages(shape.children, pkg, sourcePart, report, options2, converter);
|
|
22138
22407
|
}
|
|
22139
22408
|
}
|
|
22140
22409
|
|
|
@@ -25243,8 +25512,8 @@ function diagnosticCollector(maxCount) {
|
|
|
25243
25512
|
}
|
|
25244
25513
|
|
|
25245
25514
|
// visio/shape-metadata.ts
|
|
25246
|
-
function createMetadataBudget(
|
|
25247
|
-
const maxRows =
|
|
25515
|
+
function createMetadataBudget(options2 = {}) {
|
|
25516
|
+
const maxRows = options2.maxRows ?? 1e5, maxCharacters = options2.maxCharacters ?? 5e6;
|
|
25248
25517
|
if (![maxRows, maxCharacters].every((v) => Number.isSafeInteger(v) && v > 0))
|
|
25249
25518
|
throw new VisioPackageError("INVALID_LIMIT", "Metadata limits must be positive safe integers.");
|
|
25250
25519
|
let rows = 0, characters = 0;
|
|
@@ -26484,21 +26753,21 @@ function option(value3, fallback) {
|
|
|
26484
26753
|
throw new VisioPackageError("INVALID_LIMIT", "Parser limits must be positive safe integers.");
|
|
26485
26754
|
return value3;
|
|
26486
26755
|
}
|
|
26487
|
-
async function parseVsdx(input,
|
|
26488
|
-
const deadline = Date.now() + (
|
|
26756
|
+
async function parseVsdx(input, options2 = {}) {
|
|
26757
|
+
const deadline = Date.now() + (options2.limits?.maxRuntimeMs ?? 1e4);
|
|
26489
26758
|
const checkTime = () => {
|
|
26490
26759
|
if (Date.now() >= deadline)
|
|
26491
26760
|
throw new VisioPackageError("LIMIT_RUNTIME", "Visio parsing deadline exceeded.");
|
|
26492
26761
|
};
|
|
26493
|
-
const maxShapes = option(
|
|
26494
|
-
const maxCurveWork = option(
|
|
26762
|
+
const maxShapes = option(options2.maxShapes, 25e3), maxShapeDepth = option(options2.maxShapeDepth, 64);
|
|
26763
|
+
const maxCurveWork = option(options2.maxCurveWork, 2e7);
|
|
26495
26764
|
let curveWork = 0;
|
|
26496
|
-
const maxGeometry = option(
|
|
26497
|
-
const maxDiagnostics = option(
|
|
26498
|
-
const maxRuns = option(
|
|
26765
|
+
const maxGeometry = option(options2.maxGeometryCommands, 5e5), maxText = option(options2.maxTextCharacters, 5e6);
|
|
26766
|
+
const maxDiagnostics = option(options2.maxDiagnostics, 2e3);
|
|
26767
|
+
const maxRuns = option(options2.maxTextRuns, 1e5), maxParagraphs = option(options2.maxParagraphs, 5e4);
|
|
26499
26768
|
const diagnosticState = diagnosticCollector(maxDiagnostics);
|
|
26500
26769
|
const report = diagnosticState.report;
|
|
26501
|
-
const pkg = await VisioPackage.open(input,
|
|
26770
|
+
const pkg = await VisioPackage.open(input, options2.limits);
|
|
26502
26771
|
const types = await pkg.readXml("[Content_Types].xml", "Types");
|
|
26503
26772
|
if (types.namespaceURI !== "http://schemas.openxmlformats.org/package/2006/content-types")
|
|
26504
26773
|
throw new VisioPackageError("INVALID_CONTENT_TYPES", "Invalid content type namespace.");
|
|
@@ -26508,7 +26777,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
26508
26777
|
const documentType = elements(types).find(
|
|
26509
26778
|
(node3) => node3.localName === "Override" && attribute2(node3, "PartName") === `/${documentPart2}`
|
|
26510
26779
|
)?.getAttribute("ContentType");
|
|
26511
|
-
if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(
|
|
26780
|
+
if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(options2.stencil && documentType && STENCIL_MAIN_TYPES.has(documentType)))
|
|
26512
26781
|
throw new VisioPackageError(
|
|
26513
26782
|
"UNSUPPORTED_FORMAT",
|
|
26514
26783
|
"Only VSDX drawing packages are supported; VSD, VDX, VSDM and templates are not supported."
|
|
@@ -26581,8 +26850,8 @@ async function parseVsdx(input, options = {}) {
|
|
|
26581
26850
|
pkg,
|
|
26582
26851
|
part,
|
|
26583
26852
|
report,
|
|
26584
|
-
|
|
26585
|
-
|
|
26853
|
+
options2.images,
|
|
26854
|
+
options2.metafileConverter
|
|
26586
26855
|
);
|
|
26587
26856
|
masters.set(id3, masterShapes2);
|
|
26588
26857
|
masterRecords.push({ id: id3, node: master2, shapes: masterShapes2 });
|
|
@@ -26590,7 +26859,7 @@ async function parseVsdx(input, options = {}) {
|
|
|
26590
26859
|
}
|
|
26591
26860
|
let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
|
|
26592
26861
|
const context = {
|
|
26593
|
-
metadataBudget: createMetadataBudget(
|
|
26862
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
26594
26863
|
layerBudget: createLayerBudget(),
|
|
26595
26864
|
masters,
|
|
26596
26865
|
layers: /* @__PURE__ */ new Map(),
|
|
@@ -26642,11 +26911,11 @@ async function parseVsdx(input, options = {}) {
|
|
|
26642
26911
|
}
|
|
26643
26912
|
};
|
|
26644
26913
|
const documentMasters = listVisioMasters(masterRecords, context, {
|
|
26645
|
-
metadataBudget: createMetadataBudget(
|
|
26914
|
+
metadataBudget: createMetadataBudget(options2.metadata),
|
|
26646
26915
|
layerBudget: createLayerBudget()
|
|
26647
26916
|
});
|
|
26648
|
-
const pagesPart = await related(pkg, documentPart2, "pages", !
|
|
26649
|
-
if (!pagesPart && !
|
|
26917
|
+
const pagesPart = await related(pkg, documentPart2, "pages", !options2.stencil);
|
|
26918
|
+
if (!pagesPart && !options2.stencil)
|
|
26650
26919
|
throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
|
|
26651
26920
|
const pages = [], pageIds2 = /* @__PURE__ */ new Set();
|
|
26652
26921
|
const comments = [];
|
|
@@ -26700,8 +26969,8 @@ async function parseVsdx(input, options = {}) {
|
|
|
26700
26969
|
pkg,
|
|
26701
26970
|
part,
|
|
26702
26971
|
localReport,
|
|
26703
|
-
|
|
26704
|
-
|
|
26972
|
+
options2.images,
|
|
26973
|
+
options2.metafileConverter
|
|
26705
26974
|
);
|
|
26706
26975
|
const shapes = normalizeShapes(rawShapes, context);
|
|
26707
26976
|
normalizeVisioPageGeometry(shapes, drawingToPageScale, checkTime);
|
|
@@ -27495,9 +27764,9 @@ function snapshotStencilMasterDrop(edit) {
|
|
|
27495
27764
|
y: edit.y
|
|
27496
27765
|
};
|
|
27497
27766
|
}
|
|
27498
|
-
async function editVsdxMasterDrops(source, commands,
|
|
27499
|
-
const limits = { ...DEFAULTS, ...
|
|
27500
|
-
const maxOutput =
|
|
27767
|
+
async function editVsdxMasterDrops(source, commands, options2, lone, apply5) {
|
|
27768
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
27769
|
+
const maxOutput = options2.maxOutputBytes ?? limits.maxInputBytes;
|
|
27501
27770
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
27502
27771
|
const check = () => {
|
|
27503
27772
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
@@ -29528,13 +29797,13 @@ function unique(items, key2, what) {
|
|
|
29528
29797
|
return result2;
|
|
29529
29798
|
}
|
|
29530
29799
|
var cellMap2 = (parent) => unique(children2(parent, "Cell"), (cell) => attribute2(cell, "N") ?? "", "cell");
|
|
29531
|
-
function instanceSheet(instance, template,
|
|
29800
|
+
function instanceSheet(instance, template, options2 = {}) {
|
|
29532
29801
|
for (const node3 of [instance, template]) {
|
|
29533
29802
|
const type = attribute2(node3, "Type");
|
|
29534
|
-
if (!(
|
|
29803
|
+
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))
|
|
29535
29804
|
fail(
|
|
29536
29805
|
"UNSUPPORTED_INSTANCE_EDIT",
|
|
29537
|
-
|
|
29806
|
+
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."
|
|
29538
29807
|
);
|
|
29539
29808
|
}
|
|
29540
29809
|
if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
|
|
@@ -29613,7 +29882,7 @@ function effectiveFormula(cell) {
|
|
|
29613
29882
|
return own === "Inh" ? executableCellFormula(attribute2(cell.inherited, "F")) : executableCellFormula(own);
|
|
29614
29883
|
}
|
|
29615
29884
|
var AFTER_SECTIONS = ["Text", "Data1", "Data2", "Data3", "ForeignData", "Shapes"];
|
|
29616
|
-
function writeInstanceCell(sheet, cell, value3,
|
|
29885
|
+
function writeInstanceCell(sheet, cell, value3, options2 = {}) {
|
|
29617
29886
|
const { instance } = sheet;
|
|
29618
29887
|
const create2 = (name3) => instance.ownerDocument.createElementNS(instance.namespaceURI, name3);
|
|
29619
29888
|
let node3 = cell.local;
|
|
@@ -29659,9 +29928,9 @@ function writeInstanceCell(sheet, cell, value3, options = {}) {
|
|
|
29659
29928
|
}
|
|
29660
29929
|
node3.setAttribute("V", value3);
|
|
29661
29930
|
node3.removeAttribute("E");
|
|
29662
|
-
const unit3 =
|
|
29663
|
-
if (unit3 !== void 0 && (created ||
|
|
29664
|
-
if (
|
|
29931
|
+
const unit3 = options2.unit ?? attribute2(cell.inherited, "U");
|
|
29932
|
+
if (unit3 !== void 0 && (created || options2.unit !== void 0)) node3.setAttribute("U", unit3);
|
|
29933
|
+
if (options2.formula) node3.setAttribute("F", options2.formula);
|
|
29665
29934
|
else node3.removeAttribute("F");
|
|
29666
29935
|
return node3;
|
|
29667
29936
|
}
|
|
@@ -30970,7 +31239,7 @@ function proveConnectorShape(shape, route = routeOf(shape)) {
|
|
|
30970
31239
|
"Only right-angle and curved connectors drawn here can be rerouted."
|
|
30971
31240
|
);
|
|
30972
31241
|
}
|
|
30973
|
-
function rerouteConnector(roots2, pageId2, glue, check,
|
|
31242
|
+
function rerouteConnector(roots2, pageId2, glue, check, options2 = {}) {
|
|
30974
31243
|
const root2 = roots2.get(pageId2);
|
|
30975
31244
|
const shape = glue.shape;
|
|
30976
31245
|
const stencil = isStencilConnector(shape);
|
|
@@ -30982,7 +31251,7 @@ function rerouteConnector(roots2, pageId2, glue, check, options = {}) {
|
|
|
30982
31251
|
if (target2) return glueSites(root2, target2);
|
|
30983
31252
|
return [
|
|
30984
31253
|
{
|
|
30985
|
-
point:
|
|
31254
|
+
point: options2.free?.[end] ?? {
|
|
30986
31255
|
x: numeric(local.get(`${prefix(end)}X`)),
|
|
30987
31256
|
y: numeric(local.get(`${prefix(end)}Y`))
|
|
30988
31257
|
}
|
|
@@ -30991,7 +31260,7 @@ function rerouteConnector(roots2, pageId2, glue, check, options = {}) {
|
|
|
30991
31260
|
};
|
|
30992
31261
|
const chosen = chooseSites(sites("begin"), sites("end"));
|
|
30993
31262
|
if (isStencilLine(shape)) {
|
|
30994
|
-
if (
|
|
31263
|
+
if (options2.route && options2.route !== "straight")
|
|
30995
31264
|
fail(
|
|
30996
31265
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
30997
31266
|
"This connector is a straight line from a stencil; only Visio's Dynamic connector can be restyled."
|
|
@@ -31010,12 +31279,12 @@ function rerouteConnector(roots2, pageId2, glue, check, options = {}) {
|
|
|
31010
31279
|
const target2 = glue.ends[end];
|
|
31011
31280
|
return target2 && target2.point === void 0 ? walkShape(glueBox(root2, target2.target)) : { point: sites(end)[0].point };
|
|
31012
31281
|
};
|
|
31013
|
-
const route =
|
|
31282
|
+
const route = options2.route ?? current;
|
|
31014
31283
|
if (route === "straight" && current === "straight" && ENDS.every(
|
|
31015
31284
|
(end) => sameLineCoordinate(numeric(local.get(`${prefix(end)}X`)), chosen[end].point.x) && sameLineCoordinate(numeric(local.get(`${prefix(end)}Y`)), chosen[end].point.y)
|
|
31016
31285
|
))
|
|
31017
31286
|
return [];
|
|
31018
|
-
if (
|
|
31287
|
+
if (options2.route) setRouteCells(shape, options2.route);
|
|
31019
31288
|
const obstacles = route === "right-angle" ? connectorObstacles(
|
|
31020
31289
|
root2,
|
|
31021
31290
|
/* @__PURE__ */ new Set([
|
|
@@ -31367,14 +31636,14 @@ async function measuresOwnText(root2, shapeId2, template, check) {
|
|
|
31367
31636
|
return false;
|
|
31368
31637
|
}
|
|
31369
31638
|
}
|
|
31370
|
-
async function refreshTextSizes(targets, result2,
|
|
31639
|
+
async function refreshTextSizes(targets, result2, options2, deadline) {
|
|
31371
31640
|
if (!targets.length || !result2.changedParts.length) return result2;
|
|
31372
31641
|
const check = () => {
|
|
31373
31642
|
if (Date.now() >= deadline) throw new VisioPackageError("LIMIT_RUNTIME", "Deadline exceeded.");
|
|
31374
31643
|
};
|
|
31375
31644
|
const limits = {
|
|
31376
31645
|
...DEFAULTS,
|
|
31377
|
-
...
|
|
31646
|
+
...options2.limits,
|
|
31378
31647
|
maxInputBytes: Math.max(DEFAULTS.maxInputBytes, result2.bytes.length),
|
|
31379
31648
|
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
31380
31649
|
};
|
|
@@ -31464,7 +31733,7 @@ async function refreshTextSizes(targets, result2, options, deadline) {
|
|
|
31464
31733
|
}
|
|
31465
31734
|
const bytes = await writeEditedPackage(
|
|
31466
31735
|
parts,
|
|
31467
|
-
|
|
31736
|
+
options2.maxOutputBytes ?? limits.maxInputBytes,
|
|
31468
31737
|
deadline,
|
|
31469
31738
|
check
|
|
31470
31739
|
);
|
|
@@ -31733,14 +32002,14 @@ function cacheRows(path2) {
|
|
|
31733
32002
|
}
|
|
31734
32003
|
return rows.every((row2) => Number.isFinite(row2.x) && Number.isFinite(row2.y)) ? rows : [];
|
|
31735
32004
|
}
|
|
31736
|
-
async function refreshLineJumpCaches(pageIds2, source, result2,
|
|
32005
|
+
async function refreshLineJumpCaches(pageIds2, source, result2, options2, deadline) {
|
|
31737
32006
|
if (!pageIds2.size || !result2.changedParts.length) return result2;
|
|
31738
32007
|
const check = () => {
|
|
31739
32008
|
if (Date.now() >= deadline) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
31740
32009
|
};
|
|
31741
32010
|
const limits = {
|
|
31742
32011
|
...DEFAULTS,
|
|
31743
|
-
...
|
|
32012
|
+
...options2.limits,
|
|
31744
32013
|
maxRuntimeMs: Math.max(1, deadline - Date.now())
|
|
31745
32014
|
};
|
|
31746
32015
|
const { pkg, parts, pages } = await openEditablePackage(result2.bytes, limits, check);
|
|
@@ -31820,7 +32089,7 @@ async function refreshLineJumpCaches(pageIds2, source, result2, options, deadlin
|
|
|
31820
32089
|
return {
|
|
31821
32090
|
bytes: await writeEditedPackage(
|
|
31822
32091
|
parts,
|
|
31823
|
-
|
|
32092
|
+
options2.maxOutputBytes ?? limits.maxInputBytes,
|
|
31824
32093
|
deadline,
|
|
31825
32094
|
check
|
|
31826
32095
|
),
|
|
@@ -33536,12 +33805,12 @@ function resizeVisioShapeAtAnchor(roots2, document, edit, check, glueShapes = /*
|
|
|
33536
33805
|
}
|
|
33537
33806
|
|
|
33538
33807
|
// visio/edit-transform-formula.ts
|
|
33539
|
-
function editableTransformCell(roots2, edit, node3, check,
|
|
33808
|
+
function editableTransformCell(roots2, edit, node3, check, options2 = {}) {
|
|
33540
33809
|
const formula = executableCellFormula(attribute2(node3, "F"));
|
|
33541
33810
|
if (!formula || !analyzeVisioFormula(formula).references.length) return editableCell(node3);
|
|
33542
33811
|
const evaluate = createVisioCellEvaluator(
|
|
33543
|
-
indexCells(roots2, { ...
|
|
33544
|
-
{ ...
|
|
33812
|
+
indexCells(roots2, { ...options2, check }),
|
|
33813
|
+
{ ...options2, check },
|
|
33545
33814
|
true
|
|
33546
33815
|
);
|
|
33547
33816
|
editableCell(
|
|
@@ -34010,7 +34279,7 @@ async function assertDuplicateScope(pkg, pagePaths, targetPage, newIds, check, s
|
|
|
34010
34279
|
}
|
|
34011
34280
|
|
|
34012
34281
|
// visio/formula-master.ts
|
|
34013
|
-
function analyzeVisioMasterFormula(source,
|
|
34282
|
+
function analyzeVisioMasterFormula(source, options2) {
|
|
34014
34283
|
const ast = parseVisioFormula(source);
|
|
34015
34284
|
const analysis = analyzeVisioFormula(ast);
|
|
34016
34285
|
const references = /* @__PURE__ */ new Map();
|
|
@@ -34031,7 +34300,7 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
34031
34300
|
if (["TEXTWIDTH", "TEXTHEIGHT", "SHAPETEXT"].includes(node3.name)) {
|
|
34032
34301
|
const text8 = node3.args[0];
|
|
34033
34302
|
const count = node3.name === "TEXTHEIGHT" ? node3.args.length === 2 : node3.args.length === 1;
|
|
34034
|
-
local =
|
|
34303
|
+
local = options2.textFieldFree && count && text8?.kind === "reference" && text8.reference.shapeId === void 0 && text8.reference.cell.toLowerCase() === "thetext";
|
|
34035
34304
|
readsText = true;
|
|
34036
34305
|
}
|
|
34037
34306
|
if (["LUM", "HUE", "SAT"].includes(node3.name)) {
|
|
@@ -34666,16 +34935,16 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
|
|
|
34666
34935
|
);
|
|
34667
34936
|
}
|
|
34668
34937
|
if (!needed) return;
|
|
34669
|
-
const
|
|
34938
|
+
const options2 = { check, pageContext: after };
|
|
34670
34939
|
const changed = [];
|
|
34671
|
-
for (const cell of indexCells(roots2,
|
|
34940
|
+
for (const cell of indexCells(roots2, options2).values()) {
|
|
34672
34941
|
if (!cell.node) continue;
|
|
34673
34942
|
const functions = pageFunctions(attribute2(cell.node, "F") ?? "");
|
|
34674
34943
|
const old = before.get(cell.pageId), current = after.get(cell.pageId);
|
|
34675
34944
|
if (functions.has("PAGENUMBER") && old?.pageNumber !== current.pageNumber || functions.has("PAGECOUNT") && old?.pageCount !== current.pageCount)
|
|
34676
34945
|
changed.push(cell);
|
|
34677
34946
|
}
|
|
34678
|
-
for (const id3 of recalculateVisioCells(roots2, changed,
|
|
34947
|
+
for (const id3 of recalculateVisioCells(roots2, changed, options2)) {
|
|
34679
34948
|
const root2 = roots2.get(id3);
|
|
34680
34949
|
const sheet = sheets.get(id3);
|
|
34681
34950
|
if (sheet) {
|
|
@@ -37998,14 +38267,14 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
|
|
|
37998
38267
|
}
|
|
37999
38268
|
|
|
38000
38269
|
// visio/clipboard.ts
|
|
38001
|
-
async function captureVisioClipboard(input, pageId2, shapeIds2,
|
|
38270
|
+
async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
|
|
38002
38271
|
pageId2 = clipboardId(pageId2);
|
|
38003
38272
|
if (!Array.isArray(shapeIds2) || !shapeIds2.length || shapeIds2.length > 1e3)
|
|
38004
38273
|
fail("INVALID_CLIPBOARD", "Capture requires one to 1000 selected shapes.");
|
|
38005
38274
|
const selected2 = shapeIds2.map(clipboardId);
|
|
38006
38275
|
if (new Set(selected2).size !== selected2.length)
|
|
38007
38276
|
fail("INVALID_CLIPBOARD", "Capture selection must be unique.");
|
|
38008
|
-
const limits = { ...DEFAULTS, ...
|
|
38277
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
38009
38278
|
for (const value3 of Object.values(limits))
|
|
38010
38279
|
if (!Number.isSafeInteger(value3) || value3 <= 0)
|
|
38011
38280
|
fail("INVALID_LIMITS", "Capture limits require positive safe integers.");
|
|
@@ -38092,13 +38361,13 @@ async function retarget(clipboard, bytes, pageId2, limits) {
|
|
|
38092
38361
|
fail("UNSUPPORTED_SUBPROCESS", "The new page does not share the source page settings.");
|
|
38093
38362
|
return { ...clipboard, pageContext: target2.xml };
|
|
38094
38363
|
}
|
|
38095
|
-
async function editVsdxSubprocess(source, edit,
|
|
38096
|
-
const limits = { ...DEFAULTS, ...
|
|
38364
|
+
async function editVsdxSubprocess(source, edit, options2) {
|
|
38365
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
38097
38366
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
38098
38367
|
const remaining = () => {
|
|
38099
38368
|
const time = deadline - Date.now();
|
|
38100
38369
|
if (time <= 0) fail("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
|
|
38101
|
-
return { ...
|
|
38370
|
+
return { ...options2, limits: { ...options2.limits, maxRuntimeMs: time } };
|
|
38102
38371
|
};
|
|
38103
38372
|
const changed = /* @__PURE__ */ new Set();
|
|
38104
38373
|
const diagnostics = /* @__PURE__ */ new Map();
|
|
@@ -38685,7 +38954,7 @@ function positive2(value3) {
|
|
|
38685
38954
|
fail("INVALID_LIMITS", "Edit limits must be positive safe integers.");
|
|
38686
38955
|
return value3;
|
|
38687
38956
|
}
|
|
38688
|
-
async function editVsdx(input, edits,
|
|
38957
|
+
async function editVsdx(input, edits, options2 = {}) {
|
|
38689
38958
|
const clock = {
|
|
38690
38959
|
deadline: 0,
|
|
38691
38960
|
autoSize: /* @__PURE__ */ new Set(),
|
|
@@ -38693,36 +38962,36 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
38693
38962
|
jumpPages: /* @__PURE__ */ new Set(),
|
|
38694
38963
|
jumpSource: void 0
|
|
38695
38964
|
};
|
|
38696
|
-
const edited = await editVsdxTransaction(input, edits,
|
|
38697
|
-
const resized = await refreshTextSizes(clock.textSizes, edited,
|
|
38965
|
+
const edited = await editVsdxTransaction(input, edits, options2, clock);
|
|
38966
|
+
const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
|
|
38698
38967
|
const result2 = await refreshLineJumpCaches(
|
|
38699
38968
|
clock.jumpPages,
|
|
38700
38969
|
clock.jumpSource,
|
|
38701
38970
|
resized,
|
|
38702
|
-
|
|
38971
|
+
options2,
|
|
38703
38972
|
clock.deadline
|
|
38704
38973
|
);
|
|
38705
38974
|
return growAutoSizePages(
|
|
38706
38975
|
clock.autoSize,
|
|
38707
38976
|
result2,
|
|
38708
38977
|
(bytes, growth) => editVsdxTransaction(bytes, growth, {
|
|
38709
|
-
...
|
|
38710
|
-
limits: { ...
|
|
38978
|
+
...options2,
|
|
38979
|
+
limits: { ...options2.limits, maxRuntimeMs: Math.max(1, clock.deadline - Date.now()) }
|
|
38711
38980
|
})
|
|
38712
38981
|
);
|
|
38713
38982
|
}
|
|
38714
|
-
async function editVsdxTransaction(input, edits,
|
|
38983
|
+
async function editVsdxTransaction(input, edits, options2, clock = {
|
|
38715
38984
|
deadline: 0,
|
|
38716
38985
|
autoSize: /* @__PURE__ */ new Set(),
|
|
38717
38986
|
textSizes: [],
|
|
38718
38987
|
jumpPages: /* @__PURE__ */ new Set(),
|
|
38719
38988
|
jumpSource: void 0
|
|
38720
38989
|
}) {
|
|
38721
|
-
const limits = { ...DEFAULTS, ...
|
|
38990
|
+
const limits = { ...DEFAULTS, ...options2.limits };
|
|
38722
38991
|
for (const value3 of Object.values(limits)) positive2(value3);
|
|
38723
|
-
const maxEdits = positive2(
|
|
38724
|
-
const maxText = positive2(
|
|
38725
|
-
const maxOutput = positive2(
|
|
38992
|
+
const maxEdits = positive2(options2.maxEdits ?? 1e3);
|
|
38993
|
+
const maxText = positive2(options2.maxTextCharacters ?? 1e6);
|
|
38994
|
+
const maxOutput = positive2(options2.maxOutputBytes ?? limits.maxInputBytes);
|
|
38726
38995
|
const deadline = Date.now() + limits.maxRuntimeMs;
|
|
38727
38996
|
clock.deadline = deadline;
|
|
38728
38997
|
const check = () => {
|
|
@@ -38741,13 +39010,13 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
38741
39010
|
if (subprocess) {
|
|
38742
39011
|
if (allCommands.length !== 1)
|
|
38743
39012
|
fail("EDIT_MIXED_SUBPROCESS_TRANSACTION", "A subprocess requires its own transaction.");
|
|
38744
|
-
return editVsdxSubprocess(original, subprocess,
|
|
39013
|
+
return editVsdxSubprocess(original, subprocess, options2);
|
|
38745
39014
|
}
|
|
38746
39015
|
if (allCommands.some(isVisioMasterDrop))
|
|
38747
39016
|
return editVsdxMasterDrops(
|
|
38748
39017
|
original,
|
|
38749
39018
|
allCommands,
|
|
38750
|
-
|
|
39019
|
+
options2,
|
|
38751
39020
|
async (bytes2, instance, info) => {
|
|
38752
39021
|
const opened = await openEditablePackage(bytes2, limits, check);
|
|
38753
39022
|
return editVsdxMasterInstance(
|
|
@@ -38762,7 +39031,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
38762
39031
|
info
|
|
38763
39032
|
);
|
|
38764
39033
|
},
|
|
38765
|
-
(bytes2, rest) => editVsdx(bytes2, rest,
|
|
39034
|
+
(bytes2, rest) => editVsdx(bytes2, rest, options2)
|
|
38766
39035
|
);
|
|
38767
39036
|
const { pkg, parts, pages } = await openEditablePackage(original, limits, check);
|
|
38768
39037
|
const builtIn = await changeStencilShapeToBuiltIn(
|
|
@@ -38771,7 +39040,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
38771
39040
|
pages,
|
|
38772
39041
|
allCommands,
|
|
38773
39042
|
{ limits, maxOutput, deadline, check },
|
|
38774
|
-
(bytes2, edits2) => editVsdx(bytes2, edits2,
|
|
39043
|
+
(bytes2, edits2) => editVsdx(bytes2, edits2, options2)
|
|
38775
39044
|
);
|
|
38776
39045
|
if (builtIn) return builtIn;
|
|
38777
39046
|
if (allCommands.some(isVisioCommentEdit)) {
|
|
@@ -38854,8 +39123,8 @@ async function editVsdxTransaction(input, edits, options, clock = {
|
|
|
38854
39123
|
check
|
|
38855
39124
|
);
|
|
38856
39125
|
const moved = await editVsdxTransaction(resized.bytes, commands, {
|
|
38857
|
-
...
|
|
38858
|
-
limits: { ...
|
|
39126
|
+
...options2,
|
|
39127
|
+
limits: { ...options2.limits, maxRuntimeMs: Math.max(1, deadline - Date.now()) }
|
|
38859
39128
|
});
|
|
38860
39129
|
return {
|
|
38861
39130
|
bytes: moved.bytes,
|
|
@@ -39297,8 +39566,8 @@ function documentPart() {
|
|
|
39297
39566
|
});
|
|
39298
39567
|
return document;
|
|
39299
39568
|
}
|
|
39300
|
-
async function createVsdx(
|
|
39301
|
-
const width =
|
|
39569
|
+
async function createVsdx(options2 = {}) {
|
|
39570
|
+
const width = options2.width ?? 8.5, height = options2.height ?? 11;
|
|
39302
39571
|
if (![width, height].every(
|
|
39303
39572
|
(value3) => typeof value3 === "number" && Number.isFinite(value3) && value3 > 0 && value3 <= 1e6
|
|
39304
39573
|
))
|
|
@@ -39371,7 +39640,7 @@ async function createVsdx(options = {}) {
|
|
|
39371
39640
|
Page: "0",
|
|
39372
39641
|
ViewScale: "-1"
|
|
39373
39642
|
});
|
|
39374
|
-
const stencils = [...new Set(
|
|
39643
|
+
const stencils = [...new Set(options2.stencils ?? [])];
|
|
39375
39644
|
if (stencils.some((id3) => !Object.hasOwn(VISIO_STENCIL_FILES, id3)))
|
|
39376
39645
|
fail("INVALID_EDIT", "Unknown built-in stencil.");
|
|
39377
39646
|
stencils.forEach((id3, index2) => {
|
|
@@ -40863,18 +41132,18 @@ function visioChangeMasterCommand(document, page, selection, masterId) {
|
|
|
40863
41132
|
}
|
|
40864
41133
|
|
|
40865
41134
|
// geometry/align-distribute.ts
|
|
40866
|
-
function usesSlideReference(elementCount,
|
|
40867
|
-
if (!
|
|
41135
|
+
function usesSlideReference(elementCount, options2) {
|
|
41136
|
+
if (!options2?.slideSize) {
|
|
40868
41137
|
return false;
|
|
40869
41138
|
}
|
|
40870
|
-
return
|
|
41139
|
+
return options2.reference === "slide";
|
|
40871
41140
|
}
|
|
40872
|
-
function resolveAlignReferenceBox(elements2,
|
|
41141
|
+
function resolveAlignReferenceBox(elements2, options2) {
|
|
40873
41142
|
if (elements2.length === 0) {
|
|
40874
41143
|
return null;
|
|
40875
41144
|
}
|
|
40876
|
-
if (usesSlideReference(elements2.length,
|
|
40877
|
-
return { minX: 0, minY: 0, maxX:
|
|
41145
|
+
if (usesSlideReference(elements2.length, options2)) {
|
|
41146
|
+
return { minX: 0, minY: 0, maxX: options2.slideSize.width, maxY: options2.slideSize.height };
|
|
40878
41147
|
}
|
|
40879
41148
|
if (elements2.length < 2) {
|
|
40880
41149
|
return null;
|
|
@@ -40886,9 +41155,9 @@ function resolveAlignReferenceBox(elements2, options) {
|
|
|
40886
41155
|
maxY: Math.max(...elements2.map((e) => e.y + e.height))
|
|
40887
41156
|
};
|
|
40888
41157
|
}
|
|
40889
|
-
function alignElements(elements2, edge,
|
|
41158
|
+
function alignElements(elements2, edge, options2) {
|
|
40890
41159
|
const result2 = /* @__PURE__ */ new Map();
|
|
40891
|
-
const ref = resolveAlignReferenceBox(elements2,
|
|
41160
|
+
const ref = resolveAlignReferenceBox(elements2, options2);
|
|
40892
41161
|
if (!ref) {
|
|
40893
41162
|
return result2;
|
|
40894
41163
|
}
|
|
@@ -41483,12 +41752,12 @@ function visioFileMasterDropCommand(page, master2, stencil, centre2) {
|
|
|
41483
41752
|
// visio/ui/draw-plan.ts
|
|
41484
41753
|
var SNAP = 1 / 16;
|
|
41485
41754
|
var boundedNumber = (value3) => Number.isFinite(value3) && Math.abs(value3) <= 1e6;
|
|
41486
|
-
function visioDrawingPoint(page, point2,
|
|
41755
|
+
function visioDrawingPoint(page, point2, options2 = {}) {
|
|
41487
41756
|
if (![point2.x, point2.y, page.width, page.height].every(boundedNumber) || page.width <= 0 || page.height <= 0)
|
|
41488
41757
|
return void 0;
|
|
41489
41758
|
const coordinate = (value3, maximum) => {
|
|
41490
|
-
const bounded6 =
|
|
41491
|
-
return
|
|
41759
|
+
const bounded6 = options2.bounded === false ? value3 : Math.max(0, Math.min(maximum, value3));
|
|
41760
|
+
return options2.snap === false ? bounded6 : Math.round(bounded6 / SNAP) * SNAP;
|
|
41492
41761
|
};
|
|
41493
41762
|
return { x: coordinate(point2.x, page.width), y: coordinate(point2.y, page.height) };
|
|
41494
41763
|
}
|
|
@@ -41776,10 +42045,10 @@ function strokeExtent(points2) {
|
|
|
41776
42045
|
const xs = points2.map((point2) => point2.x), ys = points2.map((point2) => point2.y);
|
|
41777
42046
|
return Math.hypot(Math.max(...xs) - Math.min(...xs), Math.max(...ys) - Math.min(...ys));
|
|
41778
42047
|
}
|
|
41779
|
-
function visioPathDrawPlan(page, kind, samples,
|
|
42048
|
+
function visioPathDrawPlan(page, kind, samples, options2 = {}) {
|
|
41780
42049
|
if (!isVisioPathTool(kind) || !Array.isArray(samples) || samples.length > MAX_SAMPLES)
|
|
41781
42050
|
throw new Error("Invalid path drawing tool or samples.");
|
|
41782
|
-
const tolerance =
|
|
42051
|
+
const tolerance = options2.tolerance ?? VISIO_PATH_TOLERANCE;
|
|
41783
42052
|
if (!(tolerance > 0) || !bounded5(tolerance)) throw new Error("Invalid path fitting tolerance.");
|
|
41784
42053
|
const points2 = visioCleanSamples(samples).filter((point2) => bounded5(point2.x) && bounded5(point2.y));
|
|
41785
42054
|
if (points2.length < 2 || strokeExtent(points2) < MINIMUM) return void 0;
|
|
@@ -42720,9 +42989,9 @@ function pageIssues(page, enabled) {
|
|
|
42720
42989
|
}
|
|
42721
42990
|
return issues;
|
|
42722
42991
|
}
|
|
42723
|
-
function checkVisioDiagram(document,
|
|
42724
|
-
const enabled = new Set(
|
|
42725
|
-
const limit2 =
|
|
42992
|
+
function checkVisioDiagram(document, options2 = {}) {
|
|
42993
|
+
const enabled = new Set(options2.ruleSets ?? VISIO_DIAGRAM_RULE_SETS.map((set) => set.id));
|
|
42994
|
+
const limit2 = options2.maxIssues ?? 5e3;
|
|
42726
42995
|
const issues = [];
|
|
42727
42996
|
for (const page of document.pages) {
|
|
42728
42997
|
if (page.isBackground) continue;
|
|
@@ -42754,12 +43023,12 @@ var BASE_COLUMNS = [
|
|
|
42754
43023
|
"Pin Y (in)",
|
|
42755
43024
|
"Text"
|
|
42756
43025
|
];
|
|
42757
|
-
function visioShapeReport(document,
|
|
42758
|
-
const limit2 =
|
|
43026
|
+
function visioShapeReport(document, options2 = {}) {
|
|
43027
|
+
const limit2 = options2.maxRows ?? 25e3;
|
|
42759
43028
|
const rows = [];
|
|
42760
43029
|
const keys = /* @__PURE__ */ new Set();
|
|
42761
43030
|
let truncated = false;
|
|
42762
|
-
const pages =
|
|
43031
|
+
const pages = options2.pageIndex === void 0 ? document.pages.filter((page) => !page.isBackground) : document.pages.slice(options2.pageIndex, options2.pageIndex + 1);
|
|
42763
43032
|
for (const page of pages) {
|
|
42764
43033
|
const visit = (shapes) => {
|
|
42765
43034
|
for (const shape of shapes) {
|
|
@@ -42903,8 +43172,8 @@ var typed = (cell) => {
|
|
|
42903
43172
|
const result2 = cellText(cell);
|
|
42904
43173
|
return typeof cell === "string" ? { ...result2, raw: text7(cell).trim() } : result2;
|
|
42905
43174
|
};
|
|
42906
|
-
function visioDataTable(grid,
|
|
42907
|
-
const header =
|
|
43175
|
+
function visioDataTable(grid, options2 = {}) {
|
|
43176
|
+
const header = options2.header ?? true;
|
|
42908
43177
|
const width = Math.min(
|
|
42909
43178
|
VISIO_DATA_LIMITS.maxColumns,
|
|
42910
43179
|
Math.max(0, ...grid.map((row2) => row2.length))
|
|
@@ -43109,14 +43378,14 @@ function visioRemoveDataGraphicEdits(page, shapeIds2, kind) {
|
|
|
43109
43378
|
}
|
|
43110
43379
|
return edits;
|
|
43111
43380
|
}
|
|
43112
|
-
function visioDataGraphicEdits(page, shapeIds2,
|
|
43381
|
+
function visioDataGraphicEdits(page, shapeIds2, options2) {
|
|
43113
43382
|
const targets = page.shapes.filter(
|
|
43114
|
-
(shape) => shapeIds2.includes(shape.id) && !visioDataGraphicMarker(shape) && visioShapeDataRow(shape,
|
|
43383
|
+
(shape) => shapeIds2.includes(shape.id) && !visioDataGraphicMarker(shape) && visioShapeDataRow(shape, options2.field)
|
|
43115
43384
|
);
|
|
43116
|
-
const edits =
|
|
43385
|
+
const edits = options2.kind === "color" ? [] : visioRemoveDataGraphicEdits(
|
|
43117
43386
|
page,
|
|
43118
43387
|
targets.map((shape) => shape.id),
|
|
43119
|
-
|
|
43388
|
+
options2.kind
|
|
43120
43389
|
);
|
|
43121
43390
|
const ratio = page.drawingToPageScale ?? 1;
|
|
43122
43391
|
let next = Number(visioNextShapeId(page));
|
|
@@ -43126,16 +43395,16 @@ function visioDataGraphicEdits(page, shapeIds2, options) {
|
|
|
43126
43395
|
pageId: page.id,
|
|
43127
43396
|
shapeId: shapeId2,
|
|
43128
43397
|
row: VISIO_DATA_GRAPHIC_ROW,
|
|
43129
|
-
data: hidden(
|
|
43398
|
+
data: hidden(options2.kind, owner)
|
|
43130
43399
|
});
|
|
43131
|
-
const values = targets.map((shape) => visioShapeDataNumber(shape,
|
|
43400
|
+
const values = targets.map((shape) => visioShapeDataNumber(shape, options2.field));
|
|
43132
43401
|
const known = values.filter((value3) => value3 !== void 0);
|
|
43133
|
-
const min =
|
|
43134
|
-
const max =
|
|
43135
|
-
const colors =
|
|
43402
|
+
const min = options2.min ?? Math.min(0, ...known);
|
|
43403
|
+
const max = options2.max ?? Math.max(...known, min + 1);
|
|
43404
|
+
const colors = options2.kind === "color" ? visioColorRules(
|
|
43136
43405
|
page,
|
|
43137
43406
|
targets.map((s) => s.id),
|
|
43138
|
-
|
|
43407
|
+
options2.field
|
|
43139
43408
|
) : void 0;
|
|
43140
43409
|
for (const [index2, shape] of targets.entries()) {
|
|
43141
43410
|
const box5 = visioShapePageBox(page, shape);
|
|
@@ -43149,8 +43418,8 @@ function visioDataGraphicEdits(page, shapeIds2, options) {
|
|
|
43149
43418
|
pageId: page.id,
|
|
43150
43419
|
...shape.kind === "shape" && !shape.masterId && !shape.children.length ? { followShapeId: shape.id } : {}
|
|
43151
43420
|
};
|
|
43152
|
-
if (
|
|
43153
|
-
const text8 = visioShapeDataText(shape,
|
|
43421
|
+
if (options2.kind === "text") {
|
|
43422
|
+
const text8 = visioShapeDataText(shape, options2.field) ?? "";
|
|
43154
43423
|
const shapeId2 = id3();
|
|
43155
43424
|
edits.push(
|
|
43156
43425
|
{
|
|
@@ -43165,7 +43434,7 @@ function visioDataGraphicEdits(page, shapeIds2, options) {
|
|
|
43165
43434
|
},
|
|
43166
43435
|
mark(shapeId2, shape.id)
|
|
43167
43436
|
);
|
|
43168
|
-
} else if (
|
|
43437
|
+
} else if (options2.kind === "bar") {
|
|
43169
43438
|
if (value3 === void 0) continue;
|
|
43170
43439
|
const barWidth = Math.min(Math.max(width, 0.8), 2);
|
|
43171
43440
|
const fraction = Math.max(0, Math.min(1, (value3 - min) / (max - min || 1)));
|
|
@@ -43207,7 +43476,7 @@ function visioDataGraphicEdits(page, shapeIds2, options) {
|
|
|
43207
43476
|
mark(bar, shape.id)
|
|
43208
43477
|
);
|
|
43209
43478
|
}
|
|
43210
|
-
} else if (
|
|
43479
|
+
} else if (options2.kind === "icon") {
|
|
43211
43480
|
if (value3 === void 0) continue;
|
|
43212
43481
|
const share = (value3 - min) / (max - min || 1);
|
|
43213
43482
|
const color2 = share >= 2 / 3 ? VISIO_DATA_GRAPHIC_ICONS.high : share >= 1 / 3 ? VISIO_DATA_GRAPHIC_ICONS.mid : VISIO_DATA_GRAPHIC_ICONS.low;
|
|
@@ -43234,7 +43503,7 @@ function visioDataGraphicEdits(page, shapeIds2, options) {
|
|
|
43234
43503
|
pageId: page.id,
|
|
43235
43504
|
shapeId: shape.id,
|
|
43236
43505
|
row: VISIO_DATA_GRAPHIC_FILL_ROW,
|
|
43237
|
-
data: hidden(
|
|
43506
|
+
data: hidden(options2.field, shape.style.fill)
|
|
43238
43507
|
});
|
|
43239
43508
|
edits.push({
|
|
43240
43509
|
...target2,
|
|
@@ -43375,7 +43644,7 @@ function space2(groups, start, size3, minimumGap) {
|
|
|
43375
43644
|
});
|
|
43376
43645
|
return result2;
|
|
43377
43646
|
}
|
|
43378
|
-
function autoAlignBoxes(boxes,
|
|
43647
|
+
function autoAlignBoxes(boxes, options2 = {}) {
|
|
43379
43648
|
if (new Set(boxes.map((box5) => box5.id)).size !== boxes.length)
|
|
43380
43649
|
throw new Error("Auto align box IDs must be unique.");
|
|
43381
43650
|
if (!boxes.every(
|
|
@@ -43384,9 +43653,9 @@ function autoAlignBoxes(boxes, options = {}) {
|
|
|
43384
43653
|
throw new Error("Auto align boxes must be finite.");
|
|
43385
43654
|
const result2 = /* @__PURE__ */ new Map();
|
|
43386
43655
|
if (!boxes.length) return result2;
|
|
43387
|
-
const toleranceX =
|
|
43388
|
-
const toleranceY =
|
|
43389
|
-
const minimumGap =
|
|
43656
|
+
const toleranceX = options2.tolerance?.x ?? median(boxes.map((box5) => box5.width)) / 2;
|
|
43657
|
+
const toleranceY = options2.tolerance?.y ?? median(boxes.map((box5) => box5.height)) / 2;
|
|
43658
|
+
const minimumGap = options2.minimumGap ?? 0;
|
|
43390
43659
|
const rows = clusters(boxes, (box5) => box5.y + box5.height / 2, toleranceY);
|
|
43391
43660
|
const columns = clusters(boxes, (box5) => box5.x + box5.width / 2, toleranceX);
|
|
43392
43661
|
const ys = space2(
|
|
@@ -43623,10 +43892,10 @@ function placeGrid(ids, size3, spacing) {
|
|
|
43623
43892
|
height: size3.get(id3).height
|
|
43624
43893
|
}));
|
|
43625
43894
|
}
|
|
43626
|
-
function layoutGraph(nodes, edges, style2,
|
|
43895
|
+
function layoutGraph(nodes, edges, style2, options2 = {}) {
|
|
43627
43896
|
if (!GRAPH_LAYOUT_STYLES.includes(style2)) throw new Error("Unknown graph layout style.");
|
|
43628
|
-
const spacing =
|
|
43629
|
-
const layerSpacing =
|
|
43897
|
+
const spacing = options2.spacing ?? 0.5;
|
|
43898
|
+
const layerSpacing = options2.layerSpacing ?? spacing;
|
|
43630
43899
|
if (![spacing, layerSpacing].every((value3) => Number.isFinite(value3) && value3 >= 0))
|
|
43631
43900
|
throw new Error("Layout spacing must be finite and not negative.");
|
|
43632
43901
|
const size3 = /* @__PURE__ */ new Map();
|
|
@@ -43758,12 +44027,12 @@ function moves(page, boxes, targets) {
|
|
|
43758
44027
|
}
|
|
43759
44028
|
return commands;
|
|
43760
44029
|
}
|
|
43761
|
-
function visioReLayoutCommands(page, style2, ids,
|
|
44030
|
+
function visioReLayoutCommands(page, style2, ids, options2 = {}) {
|
|
43762
44031
|
if (!VISIO_LAYOUT_STYLES.includes(style2)) return void 0;
|
|
43763
44032
|
if (ids && (ids.length > 1e3 || new Set(ids).size !== ids.length)) return void 0;
|
|
43764
44033
|
const { boxes, skipped } = scope(page, ids && ids.length > 1 ? ids : void 0);
|
|
43765
44034
|
if (boxes.length < 2) return void 0;
|
|
43766
|
-
const spacing =
|
|
44035
|
+
const spacing = options2.spacing ?? 0.5;
|
|
43767
44036
|
const inScope = new Set(boxes.map((box5) => box5.shape.id));
|
|
43768
44037
|
const edges = visioConnectorEdges(page).filter(
|
|
43769
44038
|
(edge) => inScope.has(edge.from) && inScope.has(edge.to)
|
|
@@ -43774,7 +44043,7 @@ function visioReLayoutCommands(page, style2, ids, options = {}) {
|
|
|
43774
44043
|
boxes.map((box5) => ({ id: box5.shape.id, width: box5.width, height: box5.height })),
|
|
43775
44044
|
edges,
|
|
43776
44045
|
style2,
|
|
43777
|
-
{ spacing, layerSpacing:
|
|
44046
|
+
{ spacing, layerSpacing: options2.layerSpacing ?? spacing * 1.5 }
|
|
43778
44047
|
);
|
|
43779
44048
|
} catch {
|
|
43780
44049
|
return void 0;
|
|
@@ -44078,17 +44347,17 @@ function visioShapeSnapBox(shape) {
|
|
|
44078
44347
|
};
|
|
44079
44348
|
return Object.values(box5).every(Number.isFinite) ? box5 : void 0;
|
|
44080
44349
|
}
|
|
44081
|
-
function visioSnapMoveDelta(page, ids, delta,
|
|
44350
|
+
function visioSnapMoveDelta(page, ids, delta, options2) {
|
|
44082
44351
|
const unchanged = { delta, lines: [] };
|
|
44083
44352
|
const usable = (value3) => value3 !== void 0 && value3 > 0 && Number.isFinite(value3) ? value3 : 0;
|
|
44084
|
-
const source =
|
|
44353
|
+
const source = options2.grid;
|
|
44085
44354
|
const grid = typeof source === "object" ? {
|
|
44086
44355
|
x: usable(source.x),
|
|
44087
44356
|
y: usable(source.y),
|
|
44088
44357
|
originX: Number.isFinite(source.originX) ? source.originX : 0,
|
|
44089
44358
|
originY: Number.isFinite(source.originY) ? source.originY : 0
|
|
44090
44359
|
} : { x: usable(source), y: usable(source), originX: 0, originY: 0 };
|
|
44091
|
-
if (!
|
|
44360
|
+
if (!options2.shapes && !options2.guides && !grid.x && !grid.y || !(options2.threshold > 0))
|
|
44092
44361
|
return unchanged;
|
|
44093
44362
|
const moving = new Set(ids);
|
|
44094
44363
|
const boxes = ids.map((id3) => visioMovementShape(page, id3)).map((shape) => shape && visioShapeSnapBox(shape));
|
|
@@ -44099,18 +44368,18 @@ function visioSnapMoveDelta(page, ids, delta, options) {
|
|
|
44099
44368
|
const bottom = Math.max(...boxes.map((box6) => box6.y + box6.height));
|
|
44100
44369
|
const box5 = { x: left + delta.x, y: top - delta.y, width: right2 - left, height: bottom - top };
|
|
44101
44370
|
const others = [];
|
|
44102
|
-
if (
|
|
44371
|
+
if (options2.shapes)
|
|
44103
44372
|
for (const shape of page.shapes) {
|
|
44104
44373
|
if (moving.has(shape.id) || shape.hidden || shape.visibility?.guide) continue;
|
|
44105
44374
|
const other = visioShapeSnapBox(shape);
|
|
44106
44375
|
if (other && (other.width > 0 || other.height > 0)) others.push(other);
|
|
44107
44376
|
}
|
|
44108
|
-
if (
|
|
44377
|
+
if (options2.guides)
|
|
44109
44378
|
for (const guide of visioPageGuides(page))
|
|
44110
44379
|
others.push(
|
|
44111
44380
|
guide.orientation === "vertical" ? { x: guide.position, y: -1e6, width: 0, height: 4e6 } : { x: -1e6, y: -guide.position, width: 4e6, height: 0 }
|
|
44112
44381
|
);
|
|
44113
|
-
const snapped = computeSnap(box5, others,
|
|
44382
|
+
const snapped = computeSnap(box5, others, options2.threshold);
|
|
44114
44383
|
const axes = new Set(snapped.guides.map((line2) => line2.axis));
|
|
44115
44384
|
if (grid.x && !axes.has("x")) snapped.x = gridEdge(snapped.x, box5.width, grid.x, grid.originX);
|
|
44116
44385
|
if (grid.y && !axes.has("y")) snapped.y = gridEdge(snapped.y, box5.height, grid.y, -grid.originY);
|
|
@@ -44193,7 +44462,7 @@ function visioTextSource(text8) {
|
|
|
44193
44462
|
}
|
|
44194
44463
|
var high = (value3) => !!value3 && /[\ud800-\udbff]/.test(value3);
|
|
44195
44464
|
var low = (value3) => !!value3 && /[\udc00-\udfff]/.test(value3);
|
|
44196
|
-
function visioTextDraftEdit(page, shapeId2, draft,
|
|
44465
|
+
function visioTextDraftEdit(page, shapeId2, draft, options2 = {}) {
|
|
44197
44466
|
const shape = visioTextShape(page, shapeId2);
|
|
44198
44467
|
if (!shape) return refuse4("The shape is no longer on this page.");
|
|
44199
44468
|
const text8 = shape.text;
|
|
@@ -44201,7 +44470,7 @@ function visioTextDraftEdit(page, shapeId2, draft, options = {}) {
|
|
|
44201
44470
|
if (draft === display) return void 0;
|
|
44202
44471
|
const fields2 = text8.fields ?? [];
|
|
44203
44472
|
const target2 = { pageId: page.id, shapeId: shapeId2 };
|
|
44204
|
-
if (!fields2.length && !
|
|
44473
|
+
if (!fields2.length && !options2.ranges)
|
|
44205
44474
|
return { type: "replace-plain-text", ...target2, text: draft };
|
|
44206
44475
|
let start = 0;
|
|
44207
44476
|
const limit2 = Math.min(display.length, draft.length);
|