ooxml-core 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/{PptxHandler-VQQS4VS6.mjs → PptxHandler-ZPJNHEZZ.mjs} +2 -2
- package/dist/automation/index.cjs +7972 -5580
- package/dist/automation/index.mjs +7972 -5580
- package/dist/{chunk-5U27IVB7.mjs → chunk-BB55ASTX.mjs} +3 -3
- package/dist/{chunk-V2BIGIH4.mjs → chunk-H4TPDZV4.mjs} +1 -1
- package/dist/{chunk-5VLNF4OX.mjs → chunk-IVDC75E5.mjs} +1 -1
- package/dist/{chunk-XBNSBDNT.mjs → chunk-QPQDLSJQ.mjs} +1 -1
- package/dist/{chunk-XSFHGZFH.mjs → chunk-XGLKW3JJ.mjs} +5 -3
- package/dist/pptx/automation/index.cjs +4 -2
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/cli/index.cjs +4 -2
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/index.cjs +4 -2
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +91 -33
- package/dist/teams/index.mjs +91 -33
- package/dist/visio/clipboard-resources.d.ts +11 -0
- package/dist/visio/clipboard-resources.d.ts.map +1 -0
- package/dist/visio/clipboard-types.d.ts +26 -0
- package/dist/visio/clipboard-types.d.ts.map +1 -0
- package/dist/visio/clipboard-xml.d.ts +8 -0
- package/dist/visio/clipboard-xml.d.ts.map +1 -0
- package/dist/visio/clipboard.d.ts +7 -0
- package/dist/visio/clipboard.d.ts.map +1 -0
- package/dist/visio/create-document.d.ts +8 -0
- package/dist/visio/create-document.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +29 -3
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-delete.d.ts +9 -0
- package/dist/visio/edit-delete.d.ts.map +1 -0
- package/dist/visio/edit-duplicate-commands.d.ts +14 -0
- package/dist/visio/edit-duplicate-commands.d.ts.map +1 -0
- package/dist/visio/edit-duplicate-scope.d.ts +4 -0
- package/dist/visio/edit-duplicate-scope.d.ts.map +1 -0
- package/dist/visio/edit-duplicate.d.ts +10 -0
- package/dist/visio/edit-duplicate.d.ts.map +1 -0
- package/dist/visio/edit-formatting-cell-admission.d.ts +3 -0
- package/dist/visio/edit-formatting-cell-admission.d.ts.map +1 -0
- package/dist/visio/edit-formatting-commands.d.ts +46 -0
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -0
- package/dist/visio/edit-formatting-font.d.ts +6 -0
- package/dist/visio/edit-formatting-font.d.ts.map +1 -0
- package/dist/visio/edit-formatting-paint-scope.d.ts +6 -0
- package/dist/visio/edit-formatting-paint-scope.d.ts.map +1 -0
- package/dist/visio/edit-formatting-paint.d.ts +6 -0
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -0
- package/dist/visio/edit-formatting-rows.d.ts +14 -0
- package/dist/visio/edit-formatting-rows.d.ts.map +1 -0
- package/dist/visio/edit-formatting-scope.d.ts +6 -0
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -0
- package/dist/visio/edit-formatting-text.d.ts +8 -0
- package/dist/visio/edit-formatting-text.d.ts.map +1 -0
- package/dist/visio/edit-formatting.d.ts +12 -0
- package/dist/visio/edit-formatting.d.ts.map +1 -0
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-page-size.d.ts +5 -0
- package/dist/visio/edit-page-size.d.ts.map +1 -0
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-paste-commands.d.ts +15 -0
- package/dist/visio/edit-paste-commands.d.ts.map +1 -0
- package/dist/visio/edit-paste.d.ts +5 -0
- package/dist/visio/edit-paste.d.ts.map +1 -0
- package/dist/visio/edit-recalculate.d.ts +3 -1
- package/dist/visio/edit-recalculate.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts +8 -0
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -0
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts +1 -1
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-shape-order.d.ts +7 -0
- package/dist/visio/edit-shape-order.d.ts.map +1 -0
- package/dist/visio/edit-style-admission.d.ts +17 -0
- package/dist/visio/edit-style-admission.d.ts.map +1 -0
- package/dist/visio/edit-text-range-commands.d.ts +21 -0
- package/dist/visio/edit-text-range-commands.d.ts.map +1 -0
- package/dist/visio/edit-text-range-plan.d.ts +7 -0
- package/dist/visio/edit-text-range-plan.d.ts.map +1 -0
- package/dist/visio/edit-text-ranges.d.ts +4 -0
- package/dist/visio/edit-text-ranges.d.ts.map +1 -0
- package/dist/visio/edit-text-scope.d.ts +7 -0
- package/dist/visio/edit-text-scope.d.ts.map +1 -0
- package/dist/visio/edit-text-target.d.ts +3 -0
- package/dist/visio/edit-text-target.d.ts.map +1 -0
- package/dist/visio/edit-text.d.ts +1 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +3612 -1076
- package/dist/visio/index.d.ts +3 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +3608 -1078
- package/dist/visio/line-pattern.d.ts +1 -1
- package/dist/visio/line-pattern.d.ts.map +1 -1
- package/dist/visio/line-style.d.ts.map +1 -1
- package/dist/visio/model.d.ts +26 -3
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/plain-text.d.ts +5 -0
- package/dist/visio/plain-text.d.ts.map +1 -0
- package/dist/visio/resize-anchor.d.ts +27 -0
- package/dist/visio/resize-anchor.d.ts.map +1 -0
- package/dist/visio/source-paint.d.ts +5 -0
- package/dist/visio/source-paint.d.ts.map +1 -0
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/theme-root.d.ts.map +1 -1
- package/dist/visio/ui/contract.d.ts +10 -6
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/draw-plan.d.ts +32 -0
- package/dist/visio/ui/draw-plan.d.ts.map +1 -0
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/formatting.d.ts +28 -0
- package/dist/visio/ui/formatting.d.ts.map +1 -0
- package/dist/visio/ui/index.cjs +1429 -16
- package/dist/visio/ui/index.d.ts +16 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +1380 -17
- package/dist/visio/ui/line-dash.d.ts +4 -0
- package/dist/visio/ui/line-dash.d.ts.map +1 -0
- package/dist/visio/ui/marquee.d.ts +15 -0
- package/dist/visio/ui/marquee.d.ts.map +1 -0
- package/dist/visio/ui/page-edit.d.ts.map +1 -1
- package/dist/visio/ui/page-size.d.ts +31 -0
- package/dist/visio/ui/page-size.d.ts.map +1 -0
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/selection.d.ts +12 -0
- package/dist/visio/ui/selection.d.ts.map +1 -0
- package/dist/visio/ui/shape-arrange.d.ts +17 -0
- package/dist/visio/ui/shape-arrange.d.ts.map +1 -0
- package/dist/visio/ui/shape-clipboard.d.ts +10 -0
- package/dist/visio/ui/shape-clipboard.d.ts.map +1 -0
- package/dist/visio/ui/shape-duplicate.d.ts +5 -0
- package/dist/visio/ui/shape-duplicate.d.ts.map +1 -0
- package/dist/visio/ui/shape-formatting.d.ts +14 -0
- package/dist/visio/ui/shape-formatting.d.ts.map +1 -0
- package/dist/visio/ui/shape-move.d.ts +14 -0
- package/dist/visio/ui/shape-move.d.ts.map +1 -0
- package/dist/visio/ui/shape-order.d.ts +4 -0
- package/dist/visio/ui/shape-order.d.ts.map +1 -0
- package/dist/visio/ui/shape-resize.d.ts +61 -0
- package/dist/visio/ui/shape-resize.d.ts.map +1 -0
- package/dist/visio/ui/size-position.d.ts +19 -0
- package/dist/visio/ui/size-position.d.ts.map +1 -0
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/svg-stroke.d.ts +8 -0
- package/dist/visio/ui/svg-stroke.d.ts.map +1 -0
- package/dist/visio/ui/text-replace-selection.d.ts +9 -0
- package/dist/visio/ui/text-replace-selection.d.ts.map +1 -0
- package/dist/visio/ui/text-replace-snapshot.d.ts +14 -0
- package/dist/visio/ui/text-replace-snapshot.d.ts.map +1 -0
- package/dist/visio/ui/text-replace-types.d.ts +52 -0
- package/dist/visio/ui/text-replace-types.d.ts.map +1 -0
- package/dist/visio/ui/text-replace.d.ts +17 -0
- package/dist/visio/ui/text-replace.d.ts.map +1 -0
- package/dist/visio/xml-validation.d.ts.map +1 -1
- package/dist/xlsx/collab/codec.d.ts +2 -0
- package/dist/xlsx/collab/codec.d.ts.map +1 -1
- package/dist/xlsx/collab/index.cjs +5 -0
- package/dist/xlsx/collab/index.mjs +5 -0
- package/dist/xlsx/display-text.d.ts +4 -0
- package/dist/xlsx/display-text.d.ts.map +1 -0
- package/dist/xlsx/edit/cell-values.d.ts +4 -3
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/context.d.ts +7 -5
- package/dist/xlsx/edit/context.d.ts.map +1 -1
- package/dist/xlsx/edit/deps.d.ts +1 -1
- package/dist/xlsx/edit/deps.d.ts.map +1 -1
- package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/fill.d.ts.map +1 -1
- package/dist/xlsx/edit/filter.d.ts.map +1 -1
- package/dist/xlsx/edit/find.d.ts.map +1 -1
- package/dist/xlsx/edit/paste-selection.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts +10 -4
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/table-header-names.d.ts +3 -0
- package/dist/xlsx/edit/table-header-names.d.ts.map +1 -0
- package/dist/xlsx/edit/tables.d.ts +1 -2
- package/dist/xlsx/edit/tables.d.ts.map +1 -1
- package/dist/xlsx/filter-rows.d.ts +8 -0
- package/dist/xlsx/filter-rows.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/math-sum.d.ts.map +1 -1
- package/dist/xlsx/formula/lexemes.d.ts.map +1 -1
- package/dist/xlsx/formula/table-refs.d.ts +2 -0
- package/dist/xlsx/formula/table-refs.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +463 -332
- package/dist/xlsx/index.mjs +463 -332
- package/dist/xlsx/load/index.cjs +7628 -7583
- package/dist/xlsx/load/index.mjs +7628 -7583
- package/dist/xlsx/model.d.ts +4 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +461 -332
- package/dist/xlsx/ui/index.mjs +461 -332
- package/dist/xlsx/ui/locales/de/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/shell.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/visio/ui/index.mjs
CHANGED
|
@@ -11,7 +11,8 @@ var eventKeys = [
|
|
|
11
11
|
"document-error",
|
|
12
12
|
"page-change",
|
|
13
13
|
"zoom-change",
|
|
14
|
-
"shape-select"
|
|
14
|
+
"shape-select",
|
|
15
|
+
"selection-change"
|
|
15
16
|
];
|
|
16
17
|
|
|
17
18
|
// visio/ui/demo-document.ts
|
|
@@ -322,6 +323,298 @@ function textSearchStatus(search) {
|
|
|
322
323
|
return result + (search.indexTruncated ? " \xB7 Partial text index" : "");
|
|
323
324
|
}
|
|
324
325
|
|
|
326
|
+
// visio/package-common.ts
|
|
327
|
+
var VisioPackageError = class extends Error {
|
|
328
|
+
constructor(code, message) {
|
|
329
|
+
super(message);
|
|
330
|
+
this.code = code;
|
|
331
|
+
this.name = "VisioPackageError";
|
|
332
|
+
}
|
|
333
|
+
code;
|
|
334
|
+
};
|
|
335
|
+
function fail(code, message) {
|
|
336
|
+
throw new VisioPackageError(code, message);
|
|
337
|
+
}
|
|
338
|
+
new TextDecoder("utf-8", { fatal: true });
|
|
339
|
+
var crcTable = Uint32Array.from({ length: 256 }, (_, value) => {
|
|
340
|
+
for (let i = 0; i < 8; i++) value = value & 1 ? 3988292384 ^ value >>> 1 : value >>> 1;
|
|
341
|
+
return value >>> 0;
|
|
342
|
+
});
|
|
343
|
+
function crc32(bytes, crc = 4294967295) {
|
|
344
|
+
for (const byte of bytes) crc = (crcTable[(crc ^ byte) & 255] ?? 0) ^ crc >>> 8;
|
|
345
|
+
return crc >>> 0;
|
|
346
|
+
}
|
|
347
|
+
function decodePath(path) {
|
|
348
|
+
try {
|
|
349
|
+
return decodeURIComponent(path);
|
|
350
|
+
} catch {
|
|
351
|
+
return fail("UNSAFE_PATH", "Invalid percent encoding in package path");
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function safePath(path, directory = false) {
|
|
355
|
+
const decoded = decodePath(path);
|
|
356
|
+
if (/%(?:2f|5c)/i.test(path)) fail("UNSAFE_PATH", "Encoded path separators are unsupported");
|
|
357
|
+
if (/[\\:#?\u0000-\u001f\u007f]/.test(path) || /[\\:#?%\u0000-\u001f\u007f]/.test(decoded))
|
|
358
|
+
fail("UNSAFE_PATH", `Unsafe package path: ${path}`);
|
|
359
|
+
for (const candidate of [path, decoded]) {
|
|
360
|
+
const name = directory && candidate.endsWith("/") ? candidate.slice(0, -1) : candidate;
|
|
361
|
+
if (!name || name.split("/").some((part) => !part || part === "." || part === ".."))
|
|
362
|
+
fail("UNSAFE_PATH", `Unsafe package path: ${path}`);
|
|
363
|
+
}
|
|
364
|
+
return path;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// visio/edit-formatting-commands.ts
|
|
368
|
+
var isVisioFormatEdit = (edit) => edit.type === "format-text" || edit.type === "format-shape";
|
|
369
|
+
function snapshotFormatting(edit) {
|
|
370
|
+
const result = { type: edit.type, pageId: edit.pageId, shapeId: edit.shapeId };
|
|
371
|
+
const points = (value, minimum, maximum) => {
|
|
372
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < minimum || value > maximum)
|
|
373
|
+
fail("INVALID_EDIT", "Formatting point size is outside supported limits.");
|
|
374
|
+
return value;
|
|
375
|
+
};
|
|
376
|
+
const color = (value, allowNone = false) => {
|
|
377
|
+
if (typeof value !== "string" || !(allowNone && value === "none") && !/^#[0-9a-f]{6}$/i.test(value))
|
|
378
|
+
fail("INVALID_EDIT", "Formatting colors require six hexadecimal digits.");
|
|
379
|
+
return value.toLowerCase();
|
|
380
|
+
};
|
|
381
|
+
if (edit.type === "format-text" && result.type === "format-text") {
|
|
382
|
+
if (edit.fontSize !== void 0) result.fontSize = points(edit.fontSize, 1, 1e3);
|
|
383
|
+
if (edit.fontColor !== void 0) result.fontColor = color(edit.fontColor);
|
|
384
|
+
if (edit.indentLeft !== void 0) result.indentLeft = points(edit.indentLeft, 0, 7200);
|
|
385
|
+
if (edit.fontFamily !== void 0) {
|
|
386
|
+
if (typeof edit.fontFamily !== "string" || !edit.fontFamily.trim() || edit.fontFamily.length > 256 || /[\u0000-\u001f\u007f]/.test(edit.fontFamily))
|
|
387
|
+
fail("INVALID_EDIT", "Invalid font family.");
|
|
388
|
+
result.fontFamily = edit.fontFamily;
|
|
389
|
+
}
|
|
390
|
+
for (const name of ["bold", "italic", "underline", "strikethrough", "bullets"]) {
|
|
391
|
+
if (edit[name] === void 0) continue;
|
|
392
|
+
if (typeof edit[name] !== "boolean") fail("INVALID_EDIT", "Text styles require booleans.");
|
|
393
|
+
result[name] = edit[name];
|
|
394
|
+
}
|
|
395
|
+
if (edit.horizontalAlign !== void 0) {
|
|
396
|
+
if (!["left", "center", "right", "justify"].includes(edit.horizontalAlign))
|
|
397
|
+
fail("INVALID_EDIT", "Invalid horizontal alignment.");
|
|
398
|
+
result.horizontalAlign = edit.horizontalAlign;
|
|
399
|
+
}
|
|
400
|
+
if (edit.verticalAlign !== void 0) {
|
|
401
|
+
if (!["top", "middle", "bottom"].includes(edit.verticalAlign))
|
|
402
|
+
fail("INVALID_EDIT", "Invalid vertical alignment.");
|
|
403
|
+
result.verticalAlign = edit.verticalAlign;
|
|
404
|
+
}
|
|
405
|
+
} else if (edit.type === "format-shape" && result.type === "format-shape") {
|
|
406
|
+
if (edit.fillColor !== void 0) result.fillColor = color(edit.fillColor, true);
|
|
407
|
+
if (edit.lineColor !== void 0) result.lineColor = color(edit.lineColor);
|
|
408
|
+
if (edit.lineWeight !== void 0) result.lineWeight = points(edit.lineWeight, 0, 100);
|
|
409
|
+
for (const [name, maximum] of [
|
|
410
|
+
["linePattern", 23],
|
|
411
|
+
["fillPattern", 24]
|
|
412
|
+
]) {
|
|
413
|
+
if (edit[name] === void 0) continue;
|
|
414
|
+
const value = points(edit[name], 0, maximum);
|
|
415
|
+
if (!Number.isInteger(value)) fail("INVALID_EDIT", "Paint patterns require integers.");
|
|
416
|
+
result[name] = value;
|
|
417
|
+
}
|
|
418
|
+
for (const name of ["lineTransparency", "fillTransparency"])
|
|
419
|
+
if (edit[name] !== void 0) result[name] = Math.round(points(edit[name], 0, 100) * 2) / 2;
|
|
420
|
+
if (edit.fillBackgroundColor !== void 0)
|
|
421
|
+
result.fillBackgroundColor = color(edit.fillBackgroundColor);
|
|
422
|
+
if (result.fillColor === "none" && result.fillPattern !== void 0 && result.fillPattern !== 0)
|
|
423
|
+
fail("INVALID_EDIT", "No fill conflicts with a visible fill pattern.");
|
|
424
|
+
}
|
|
425
|
+
if (Object.keys(result).length === 3)
|
|
426
|
+
fail("INVALID_EDIT", "Formatting requires at least one property.");
|
|
427
|
+
return result;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// visio/edit-duplicate-commands.ts
|
|
431
|
+
function snapshotDuplicateShapes(edit) {
|
|
432
|
+
if (!Array.isArray(edit.copies) || !edit.copies.length || edit.copies.length > 1e3)
|
|
433
|
+
fail("INVALID_EDIT", "Duplication requires between one and 1000 shape mappings.");
|
|
434
|
+
if ([edit.offsetX, edit.offsetY].some(
|
|
435
|
+
(value) => typeof value !== "number" || !Number.isFinite(value) || Math.abs(value) > 1e6
|
|
436
|
+
))
|
|
437
|
+
fail("INVALID_EDIT", "Duplication offsets require bounded finite drawing inches.");
|
|
438
|
+
const sources = /* @__PURE__ */ new Set(), targets = /* @__PURE__ */ new Set();
|
|
439
|
+
const id = (value) => {
|
|
440
|
+
if (typeof value !== "string" || !/^(0|[1-9]\d{0,9})$/.test(value) || Number(value) > 4294967295)
|
|
441
|
+
fail("INVALID_EDIT", "Duplicate shape IDs require canonical unsigned integers.");
|
|
442
|
+
return value;
|
|
443
|
+
};
|
|
444
|
+
const copies = edit.copies.map((copy) => {
|
|
445
|
+
if (!copy || typeof copy !== "object") fail("INVALID_EDIT", "Invalid duplicate shape mapping.");
|
|
446
|
+
const shapeId = id(copy.shapeId), newShapeId = id(copy.newShapeId);
|
|
447
|
+
if (sources.has(shapeId) || targets.has(newShapeId))
|
|
448
|
+
fail("INVALID_EDIT", "Duplicate shape mappings must have unique sources and targets.");
|
|
449
|
+
sources.add(shapeId);
|
|
450
|
+
targets.add(newShapeId);
|
|
451
|
+
return { shapeId, newShapeId };
|
|
452
|
+
});
|
|
453
|
+
return {
|
|
454
|
+
type: edit.type,
|
|
455
|
+
pageId: edit.pageId,
|
|
456
|
+
copies,
|
|
457
|
+
offsetX: edit.offsetX,
|
|
458
|
+
offsetY: edit.offsetY
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// visio/clipboard-types.ts
|
|
463
|
+
var VISIO_CLIPBOARD_MAX_CHARS = 8 * 1024 * 1024;
|
|
464
|
+
function clipboardId(value) {
|
|
465
|
+
if (typeof value !== "string" || !/^(0|[1-9]\d{0,9})$/.test(value) || Number(value) > 4294967295)
|
|
466
|
+
fail("INVALID_CLIPBOARD", "Clipboard IDs require canonical unsigned integers.");
|
|
467
|
+
return value;
|
|
468
|
+
}
|
|
469
|
+
function snapshotVisioClipboard(value) {
|
|
470
|
+
if (!value || typeof value !== "object" || value.format !== "ooxml.visio-shapes" || value.version !== 1)
|
|
471
|
+
fail("INVALID_CLIPBOARD", "Unsupported Visio clipboard format or version.");
|
|
472
|
+
const sourcePageId = clipboardId(value.sourcePageId), sourceDrawingScale = value.sourceDrawingScale;
|
|
473
|
+
if (!Number.isFinite(sourceDrawingScale) || sourceDrawingScale <= 0 || sourceDrawingScale > 1e6)
|
|
474
|
+
fail("INVALID_CLIPBOARD", "Invalid clipboard drawing ratio.");
|
|
475
|
+
let characters = 0;
|
|
476
|
+
const text = (input) => {
|
|
477
|
+
if (typeof input !== "string" || (characters += input.length) > VISIO_CLIPBOARD_MAX_CHARS)
|
|
478
|
+
fail("LIMIT_CLIPBOARD", "Clipboard XML exceeds bounded text limits.");
|
|
479
|
+
if (/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/.test(input))
|
|
480
|
+
fail("INVALID_CLIPBOARD", "Clipboard XML must contain well-formed Unicode.");
|
|
481
|
+
return input;
|
|
482
|
+
};
|
|
483
|
+
const list = (input, max) => {
|
|
484
|
+
if (!Array.isArray(input) || !input.length || input.length > max)
|
|
485
|
+
fail("INVALID_CLIPBOARD", "Invalid clipboard array length.");
|
|
486
|
+
return input;
|
|
487
|
+
};
|
|
488
|
+
const selectionIds = list(value.selectionIds, 1e3).map(clipboardId);
|
|
489
|
+
const shapes = list(value.shapes, 1e3).map((shape) => {
|
|
490
|
+
if (!shape || typeof shape !== "object") fail("INVALID_CLIPBOARD", "Invalid captured shape.");
|
|
491
|
+
return { shapeId: clipboardId(shape.shapeId), xml: text(shape.xml) };
|
|
492
|
+
});
|
|
493
|
+
const resources = list(value.resources, 64).map((resource) => {
|
|
494
|
+
const path = resource?.path;
|
|
495
|
+
if (!resource || typeof resource !== "object" || typeof path !== "string" || path.length > 1024 || !/^visio\/(?:document\.xml|_rels\/document\.xml\.rels|theme\/[^/]+\.(?:xml|rels)|theme\/_rels\/[^/]+\.rels)$/.test(
|
|
496
|
+
path
|
|
497
|
+
))
|
|
498
|
+
fail("INVALID_CLIPBOARD", "Invalid clipboard resource path.");
|
|
499
|
+
return { path: text(safePath(path)), xml: text(resource.xml) };
|
|
500
|
+
});
|
|
501
|
+
if (new Set(selectionIds).size !== selectionIds.length || new Set(shapes.map((shape) => shape.shapeId)).size !== shapes.length || selectionIds.length !== shapes.length || selectionIds.some((id) => !shapes.some((shape) => shape.shapeId === id)) || new Set(resources.map((resource) => resource.path)).size !== resources.length)
|
|
502
|
+
fail("INVALID_CLIPBOARD", "Clipboard mappings and resources must be unique and complete.");
|
|
503
|
+
return {
|
|
504
|
+
format: "ooxml.visio-shapes",
|
|
505
|
+
version: 1,
|
|
506
|
+
sourcePageId,
|
|
507
|
+
sourceDrawingScale,
|
|
508
|
+
selectionIds,
|
|
509
|
+
shapes,
|
|
510
|
+
resources: resources.sort((a, b) => a.path.localeCompare(b.path)),
|
|
511
|
+
pageContext: text(value.pageContext)
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// visio/edit-paste-commands.ts
|
|
516
|
+
function snapshotPasteShapes(edit) {
|
|
517
|
+
const clipboard = snapshotVisioClipboard(edit.clipboard);
|
|
518
|
+
const copies = snapshotDuplicateShapes({
|
|
519
|
+
type: "duplicate-shapes",
|
|
520
|
+
pageId: edit.pageId,
|
|
521
|
+
copies: edit.copies,
|
|
522
|
+
offsetX: edit.offsetX,
|
|
523
|
+
offsetY: edit.offsetY
|
|
524
|
+
});
|
|
525
|
+
if (copies.copies.length !== clipboard.shapes.length || copies.copies.some((copy) => !clipboard.selectionIds.includes(copy.shapeId)))
|
|
526
|
+
fail("INVALID_CLIPBOARD", "Paste mappings must cover every captured shape exactly once.");
|
|
527
|
+
return {
|
|
528
|
+
type: "paste-shapes",
|
|
529
|
+
pageId: copies.pageId,
|
|
530
|
+
copies: copies.copies,
|
|
531
|
+
offsetX: copies.offsetX,
|
|
532
|
+
offsetY: copies.offsetY,
|
|
533
|
+
clipboard
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// visio/resize-anchor.ts
|
|
538
|
+
function snapshotResizeAnchor(value) {
|
|
539
|
+
if (value === void 0) return void 0;
|
|
540
|
+
if (!value || typeof value !== "object") fail("INVALID_EDIT", "Invalid resize anchor.");
|
|
541
|
+
const { x, y } = value;
|
|
542
|
+
if (![0, 0.5, 1].includes(x) || ![0, 0.5, 1].includes(y))
|
|
543
|
+
fail("INVALID_EDIT", "Resize anchor coordinates must be 0, 0.5 or 1.");
|
|
544
|
+
return { x, y };
|
|
545
|
+
}
|
|
546
|
+
function visioAnchoredResizeGeometry(current, size, anchor) {
|
|
547
|
+
const [a, b, c, d, e, f] = current.transform;
|
|
548
|
+
const determinant = a * d - b * c;
|
|
549
|
+
if (![0, 0.5, 1].includes(anchor.x) || ![0, 0.5, 1].includes(anchor.y) || ![
|
|
550
|
+
current.width,
|
|
551
|
+
current.height,
|
|
552
|
+
current.pinX,
|
|
553
|
+
current.pinY,
|
|
554
|
+
...current.transform,
|
|
555
|
+
size.width,
|
|
556
|
+
size.height,
|
|
557
|
+
anchor.x,
|
|
558
|
+
anchor.y
|
|
559
|
+
].every(Number.isFinite) || !(current.width > 0 && current.height > 0 && size.width > 0 && size.height > 0) || Math.abs(Math.abs(determinant) - 1) > 1e-8 || Math.abs(a * a + b * b - 1) > 1e-8 || Math.abs(c * c + d * d - 1) > 1e-8 || Math.abs(a * c + b * d) > 1e-8)
|
|
560
|
+
return void 0;
|
|
561
|
+
const offsetX = current.pinX - e, offsetY = current.pinY - f;
|
|
562
|
+
const oldX = (d * offsetX - c * offsetY) / determinant;
|
|
563
|
+
const oldY = (-b * offsetX + a * offsetY) / determinant;
|
|
564
|
+
const locPinX = oldX / current.width * size.width, locPinY = oldY / current.height * size.height;
|
|
565
|
+
const deltaX = anchor.x * (current.width - size.width) - oldX + locPinX;
|
|
566
|
+
const deltaY = anchor.y * (current.height - size.height) - oldY + locPinY;
|
|
567
|
+
const pinX = current.pinX + a * deltaX + c * deltaY, pinY = current.pinY + b * deltaX + d * deltaY;
|
|
568
|
+
const matrix2 = [
|
|
569
|
+
a,
|
|
570
|
+
b,
|
|
571
|
+
c,
|
|
572
|
+
d,
|
|
573
|
+
pinX - a * locPinX - c * locPinY,
|
|
574
|
+
pinY - b * locPinX - d * locPinY
|
|
575
|
+
];
|
|
576
|
+
return [pinX, pinY, locPinX, locPinY, ...matrix2].every(Number.isFinite) ? { pinX, pinY, locPinX, locPinY, transform: matrix2 } : void 0;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// visio/edit-text-range-commands.ts
|
|
580
|
+
var invalidXmlText = /[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
|
|
581
|
+
function textRangeBoundary(text, offset) {
|
|
582
|
+
return !(offset > 0 && offset < text.length && /[\ud800-\udbff]/.test(text[offset - 1]) && /[\udc00-\udfff]/.test(text[offset]));
|
|
583
|
+
}
|
|
584
|
+
function snapshotTextRanges(edit, consume) {
|
|
585
|
+
let characters = 0;
|
|
586
|
+
const text = (value) => {
|
|
587
|
+
if (typeof value !== "string" || invalidXmlText.test(value))
|
|
588
|
+
fail("INVALID_EDIT_TEXT", "Range replacement requires valid XML text.");
|
|
589
|
+
characters += value.length;
|
|
590
|
+
if (characters > 1e6)
|
|
591
|
+
fail("LIMIT_EDIT_TEXT", "Range replacement text exceeds input limits.");
|
|
592
|
+
return consume ? consume(value) : value;
|
|
593
|
+
};
|
|
594
|
+
const pageId = edit.pageId, shapeId = edit.shapeId;
|
|
595
|
+
if ([pageId, shapeId].some((id) => typeof id !== "string" || !id || id.length > 256))
|
|
596
|
+
fail("INVALID_EDIT", "Invalid text range target.");
|
|
597
|
+
const expectedText = text(edit.expectedText), original = edit.ranges;
|
|
598
|
+
if (!Array.isArray(original)) fail("INVALID_EDIT", "Text ranges require an array.");
|
|
599
|
+
const length = original.length;
|
|
600
|
+
if (!Number.isSafeInteger(length) || length < 1 || length > 1e4)
|
|
601
|
+
fail("LIMIT_EDITS", "Range replacement requires 1-10000 ranges.");
|
|
602
|
+
const ranges = [];
|
|
603
|
+
let end = 0, output = expectedText.length;
|
|
604
|
+
for (let index = 0; index < length; index++) {
|
|
605
|
+
const input = original[index], start = input.start, nextEnd = input.end, replacement = text(input.text);
|
|
606
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(nextEnd) || start < end || nextEnd <= start || nextEnd > expectedText.length || !textRangeBoundary(expectedText, start) || !textRangeBoundary(expectedText, nextEnd))
|
|
607
|
+
fail("INVALID_EDIT", "Text ranges require ascending nonoverlapping UTF16 scalar boundaries.");
|
|
608
|
+
if (replacement.includes("\n") || expectedText.slice(start, nextEnd).includes("\n"))
|
|
609
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Range replacement across paragraph breaks is unsupported.");
|
|
610
|
+
ranges.push({ start, end: nextEnd, text: replacement });
|
|
611
|
+
end = nextEnd;
|
|
612
|
+
output += replacement.length - (nextEnd - start);
|
|
613
|
+
}
|
|
614
|
+
if (output > 1e6) fail("LIMIT_EDIT_TEXT", "Range replacement output exceeds limits.");
|
|
615
|
+
return { type: "replace-text-ranges", pageId, shapeId, expectedText, ranges };
|
|
616
|
+
}
|
|
617
|
+
|
|
325
618
|
// visio/ui/edit-commands.ts
|
|
326
619
|
function snapshotEdits(edits) {
|
|
327
620
|
if (!Array.isArray(edits) || edits.length > 1e3)
|
|
@@ -330,12 +623,26 @@ function snapshotEdits(edits) {
|
|
|
330
623
|
return edits.map((command) => {
|
|
331
624
|
if (!command || typeof command.pageId !== "string" || !command.pageId || command.pageId.length > 256)
|
|
332
625
|
throw new Error("Invalid edit command.");
|
|
626
|
+
if (command.type === "duplicate-shapes") return snapshotDuplicateShapes(command);
|
|
627
|
+
if (command.type === "paste-shapes") return snapshotPasteShapes(command);
|
|
333
628
|
if (command.type === "reorder-page") {
|
|
334
629
|
if (!Number.isSafeInteger(command.index) || command.index < 0 || command.index > 1e6)
|
|
335
630
|
throw new Error("Invalid page order index.");
|
|
336
631
|
return { type: command.type, pageId: command.pageId, index: command.index };
|
|
337
632
|
}
|
|
338
633
|
if (command.type === "delete-page") return { type: command.type, pageId: command.pageId };
|
|
634
|
+
if (command.type === "set-page-size") {
|
|
635
|
+
if (![command.width, command.height].every(
|
|
636
|
+
(value) => typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 1e6
|
|
637
|
+
))
|
|
638
|
+
throw new Error("Invalid physical page dimensions.");
|
|
639
|
+
return {
|
|
640
|
+
type: command.type,
|
|
641
|
+
pageId: command.pageId,
|
|
642
|
+
width: command.width,
|
|
643
|
+
height: command.height
|
|
644
|
+
};
|
|
645
|
+
}
|
|
339
646
|
const text = (value) => {
|
|
340
647
|
if (typeof value !== "string") throw new Error("Invalid edit text.");
|
|
341
648
|
characters += value.length;
|
|
@@ -362,7 +669,23 @@ function snapshotEdits(edits) {
|
|
|
362
669
|
if (typeof command.shapeId !== "string" || !command.shapeId || command.shapeId.length > 256)
|
|
363
670
|
throw new Error("Invalid edit shape target.");
|
|
364
671
|
const target = { pageId: command.pageId, shapeId: command.shapeId };
|
|
672
|
+
if (isVisioFormatEdit(command)) return snapshotFormatting(command);
|
|
365
673
|
switch (command.type) {
|
|
674
|
+
case "create-text-box":
|
|
675
|
+
numbers(command.x, command.y, command.width, command.height);
|
|
676
|
+
return {
|
|
677
|
+
type: command.type,
|
|
678
|
+
...target,
|
|
679
|
+
x: command.x,
|
|
680
|
+
y: command.y,
|
|
681
|
+
width: command.width,
|
|
682
|
+
height: command.height,
|
|
683
|
+
text: text(command.text)
|
|
684
|
+
};
|
|
685
|
+
case "reorder-shape":
|
|
686
|
+
if (!["front", "back", "forward", "backward"].includes(command.order))
|
|
687
|
+
throw new Error("Invalid shape order.");
|
|
688
|
+
return { ...target, type: command.type, order: command.order };
|
|
366
689
|
case "create-line":
|
|
367
690
|
numbers(command.beginX, command.beginY, command.endX, command.endY);
|
|
368
691
|
return {
|
|
@@ -375,6 +698,8 @@ function snapshotEdits(edits) {
|
|
|
375
698
|
};
|
|
376
699
|
case "replace-plain-text":
|
|
377
700
|
return { type: command.type, ...target, text: text(command.text) };
|
|
701
|
+
case "replace-text-ranges":
|
|
702
|
+
return snapshotTextRanges(command, text);
|
|
378
703
|
case "delete-shape":
|
|
379
704
|
return { type: command.type, ...target };
|
|
380
705
|
case "rotate-shape":
|
|
@@ -398,9 +723,17 @@ function snapshotEdits(edits) {
|
|
|
398
723
|
x: command.x,
|
|
399
724
|
y: command.y
|
|
400
725
|
};
|
|
401
|
-
case "resize-shape":
|
|
726
|
+
case "resize-shape": {
|
|
402
727
|
numbers(command.width, command.height);
|
|
403
|
-
|
|
728
|
+
const anchor = snapshotResizeAnchor(command.anchor);
|
|
729
|
+
return {
|
|
730
|
+
type: command.type,
|
|
731
|
+
...target,
|
|
732
|
+
width: command.width,
|
|
733
|
+
height: command.height,
|
|
734
|
+
...anchor === void 0 ? {} : { anchor }
|
|
735
|
+
};
|
|
736
|
+
}
|
|
404
737
|
case "create-rectangle":
|
|
405
738
|
case "create-ellipse":
|
|
406
739
|
numbers(command.x, command.y, command.width, command.height);
|
|
@@ -428,15 +761,6 @@ function editErrorMessage(error) {
|
|
|
428
761
|
function isEditCancellation(error) {
|
|
429
762
|
return !!error && typeof error === "object" && "name" in error && error.name === "AbortError";
|
|
430
763
|
}
|
|
431
|
-
new TextDecoder("utf-8", { fatal: true });
|
|
432
|
-
var crcTable = Uint32Array.from({ length: 256 }, (_, value) => {
|
|
433
|
-
for (let i = 0; i < 8; i++) value = value & 1 ? 3988292384 ^ value >>> 1 : value >>> 1;
|
|
434
|
-
return value >>> 0;
|
|
435
|
-
});
|
|
436
|
-
function crc32(bytes, crc = 4294967295) {
|
|
437
|
-
for (const byte of bytes) crc = (crcTable[(crc ^ byte) & 255] ?? 0) ^ crc >>> 8;
|
|
438
|
-
return crc >>> 0;
|
|
439
|
-
}
|
|
440
764
|
|
|
441
765
|
// visio/foreign-vector-types.ts
|
|
442
766
|
var VISIO_FOREIGN_VECTOR_LIMITS = Object.freeze({
|
|
@@ -1376,6 +1700,29 @@ function transform(x, y, localX, localY, angle, flipX = false, flipY = false) {
|
|
|
1376
1700
|
return [a, b, c, d, x - a * localX - c * localY, y - b * localX - d * localY];
|
|
1377
1701
|
}
|
|
1378
1702
|
|
|
1703
|
+
// visio/parser.ts
|
|
1704
|
+
function getVisioPageLayers(document, pageId) {
|
|
1705
|
+
const result = [], seen = /* @__PURE__ */ new Set();
|
|
1706
|
+
const pages = new Map(document.pages.map((page) => [page.id, page]));
|
|
1707
|
+
let current = pages.get(pageId);
|
|
1708
|
+
while (current && !seen.has(current.id)) {
|
|
1709
|
+
seen.add(current.id);
|
|
1710
|
+
result.push(current);
|
|
1711
|
+
current = current.backgroundPageId === void 0 ? void 0 : pages.get(current.backgroundPageId);
|
|
1712
|
+
}
|
|
1713
|
+
return result.reverse();
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// visio/visibility.ts
|
|
1717
|
+
var VISIO_VISIBILITY_LIMITS = Object.freeze({
|
|
1718
|
+
maxShapes: 25e3,
|
|
1719
|
+
maxDepth: 64,
|
|
1720
|
+
maxLayers: 25e3,
|
|
1721
|
+
maxMemberships: 1e5,
|
|
1722
|
+
maxMembershipsPerShape: 1024,
|
|
1723
|
+
maxLayerIdLength: 256
|
|
1724
|
+
});
|
|
1725
|
+
|
|
1379
1726
|
// visio/ui/foreign-vector-budget.ts
|
|
1380
1727
|
var FOREIGN_VECTOR_SCENE_LIMITS = Object.freeze({
|
|
1381
1728
|
maxNodes: 1e5,
|
|
@@ -1573,6 +1920,11 @@ function assertViewableDocument(model) {
|
|
|
1573
1920
|
metadataBytes += value.length;
|
|
1574
1921
|
if (metadataBytes > 1e6) throw new Error("The scene exceeds aggregate metadata limits.");
|
|
1575
1922
|
};
|
|
1923
|
+
if (model.fontFamilies !== void 0) {
|
|
1924
|
+
if (!Array.isArray(model.fontFamilies) || model.fontFamilies.length > 1e4)
|
|
1925
|
+
throw new Error("The scene has an invalid font family list.");
|
|
1926
|
+
for (const family of model.fontFamilies) label(family, 1024);
|
|
1927
|
+
}
|
|
1576
1928
|
for (const diagnostic of model.diagnostics) {
|
|
1577
1929
|
label(diagnostic.code, 256);
|
|
1578
1930
|
label(diagnostic.message);
|
|
@@ -1599,6 +1951,9 @@ function assertViewableDocument(model) {
|
|
|
1599
1951
|
finite2(page.height, "page height", 1e-3);
|
|
1600
1952
|
if (page.drawingToPageScale !== void 0)
|
|
1601
1953
|
finite2(page.drawingToPageScale, "drawing scale", Number.MIN_VALUE, Number.MAX_VALUE);
|
|
1954
|
+
for (const mode of [page.drawingSizeType, page.drawingResizeType])
|
|
1955
|
+
if (mode !== void 0 && (!Number.isSafeInteger(mode) || mode < 0 || mode > 255))
|
|
1956
|
+
throw new Error("The scene has an invalid drawing page-size mode.");
|
|
1602
1957
|
if (!Array.isArray(page.shapes) || stack.length + page.shapes.length > MAX_SHAPES)
|
|
1603
1958
|
throw new Error("The scene exceeds safe shape count limits or has an invalid shape list.");
|
|
1604
1959
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -1618,7 +1973,9 @@ function assertViewableDocument(model) {
|
|
|
1618
1973
|
member(shape.kind, ["shape", "group", "connector", "foreign"], "shape kind");
|
|
1619
1974
|
if (shape.groupDisplayMode !== void 0)
|
|
1620
1975
|
member(shape.groupDisplayMode, [0, 1, 2], "group display mode");
|
|
1621
|
-
member(shape.text.horizontalAlign, ["left", "center", "right"], "text alignment");
|
|
1976
|
+
member(shape.text.horizontalAlign, ["left", "center", "right", "justify"], "text alignment");
|
|
1977
|
+
for (const key of ["bold", "italic", "underline", "strikethrough"])
|
|
1978
|
+
if (shape.text[key] !== void 0) member(shape.text[key], [true, false], "text style");
|
|
1622
1979
|
member(shape.text.verticalAlign, ["top", "middle", "bottom"], "text alignment");
|
|
1623
1980
|
label(shape.name);
|
|
1624
1981
|
label(shape.text.fontFamily, 1024);
|
|
@@ -1657,7 +2014,7 @@ function assertViewableDocument(model) {
|
|
|
1657
2014
|
const dash = shape.style.lineDash;
|
|
1658
2015
|
if (!Array.isArray(dash) || dash.length < 2 || dash.length > 6 || dash.length % 2 !== 0)
|
|
1659
2016
|
throw new Error("The scene has an invalid normalized line dash.");
|
|
1660
|
-
for (const value of dash) finite2(value, "line dash length", 0,
|
|
2017
|
+
for (const value of dash) finite2(value, "line dash length", 0, 40);
|
|
1661
2018
|
if (!dash.some((value) => value > 0))
|
|
1662
2019
|
throw new Error("The scene has an empty line dash pattern.");
|
|
1663
2020
|
}
|
|
@@ -1672,6 +2029,21 @@ function assertViewableDocument(model) {
|
|
|
1672
2029
|
throw new Error("The scene has an invalid normalized line cap.");
|
|
1673
2030
|
finite2(shape.style.fillOpacity, "fill opacity", 0, 1);
|
|
1674
2031
|
finite2(shape.style.lineOpacity, "line opacity", 0, 1);
|
|
2032
|
+
if (shape.style.lineDashDotLength !== void 0)
|
|
2033
|
+
finite2(shape.style.lineDashDotLength, "line dash dot length", 0, 1e6);
|
|
2034
|
+
for (const name of [
|
|
2035
|
+
"fillForegroundOpacity",
|
|
2036
|
+
"fillBackgroundOpacity",
|
|
2037
|
+
"lineColorOpacity"
|
|
2038
|
+
])
|
|
2039
|
+
if (shape.style[name] !== void 0) finite2(shape.style[name], "source paint opacity", 0, 1);
|
|
2040
|
+
if (shape.style.fillPatternIndex !== void 0) {
|
|
2041
|
+
finite2(shape.style.fillPatternIndex, "source fill pattern", 0, 65535);
|
|
2042
|
+
if (!Number.isInteger(shape.style.fillPatternIndex))
|
|
2043
|
+
throw new Error("The scene has an invalid source fill pattern.");
|
|
2044
|
+
}
|
|
2045
|
+
if (shape.style.fillBackgroundColor !== void 0 && (typeof shape.style.fillBackgroundColor !== "string" || !/^#[0-9a-f]{6}$/i.test(shape.style.fillBackgroundColor)))
|
|
2046
|
+
throw new Error("The scene has an invalid source fill background color.");
|
|
1675
2047
|
if (shape.style.fillPattern) {
|
|
1676
2048
|
const tile = shape.style.fillPattern;
|
|
1677
2049
|
finite2(tile.width, "fill pattern width", 1 / 12, 1 / 12);
|
|
@@ -1694,6 +2066,8 @@ function assertViewableDocument(model) {
|
|
|
1694
2066
|
if (!Array.isArray(shape.text.runs) || runCount + shape.text.runs.length > 1e5)
|
|
1695
2067
|
throw new Error("The scene exceeds safe text run limits or has an invalid run list.");
|
|
1696
2068
|
for (const run of shape.text.runs) {
|
|
2069
|
+
if (run.strikethrough !== void 0)
|
|
2070
|
+
member(run.strikethrough, [true, false], "strikethrough style");
|
|
1697
2071
|
label(run.fontFamily, 1024);
|
|
1698
2072
|
label(run.color, 256);
|
|
1699
2073
|
if (run.opacity !== void 0) finite2(run.opacity, "text run opacity", 0, 1);
|
|
@@ -1866,10 +2240,16 @@ function copySnapshotScene(model) {
|
|
|
1866
2240
|
const style = (source) => {
|
|
1867
2241
|
const result = fields(source, [
|
|
1868
2242
|
"fill",
|
|
2243
|
+
"fillPatternIndex",
|
|
2244
|
+
"fillForegroundOpacity",
|
|
2245
|
+
"fillBackgroundColor",
|
|
2246
|
+
"fillBackgroundOpacity",
|
|
1869
2247
|
"lineColor",
|
|
1870
2248
|
"lineWidth",
|
|
1871
2249
|
"lineCap",
|
|
1872
2250
|
"linePattern",
|
|
2251
|
+
"lineDashDotLength",
|
|
2252
|
+
"lineColorOpacity",
|
|
1873
2253
|
"fillOpacity",
|
|
1874
2254
|
"lineOpacity",
|
|
1875
2255
|
"startArrow",
|
|
@@ -1948,6 +2328,10 @@ function copySnapshotScene(model) {
|
|
|
1948
2328
|
const text = (source) => ({
|
|
1949
2329
|
...fields(source, [
|
|
1950
2330
|
"plainText",
|
|
2331
|
+
"bold",
|
|
2332
|
+
"italic",
|
|
2333
|
+
"underline",
|
|
2334
|
+
"strikethrough",
|
|
1951
2335
|
"backgroundColor",
|
|
1952
2336
|
"backgroundOpacity",
|
|
1953
2337
|
"opacity",
|
|
@@ -1965,7 +2349,8 @@ function copySnapshotScene(model) {
|
|
|
1965
2349
|
...fields(run, ["text", "fontFamily", "fontSize", "color", "opacity"]),
|
|
1966
2350
|
bold: !!run.bold,
|
|
1967
2351
|
italic: !!run.italic,
|
|
1968
|
-
underline: !!run.underline
|
|
2352
|
+
underline: !!run.underline,
|
|
2353
|
+
...run.strikethrough === void 0 ? {} : { strikethrough: !!run.strikethrough }
|
|
1969
2354
|
})),
|
|
1970
2355
|
...source.paragraphs === void 0 ? {} : { paragraphs: list(source.paragraphs, "paragraphs", 5e4, paragraph) }
|
|
1971
2356
|
});
|
|
@@ -1997,6 +2382,12 @@ function copySnapshotScene(model) {
|
|
|
1997
2382
|
};
|
|
1998
2383
|
return {
|
|
1999
2384
|
format: "vsdx",
|
|
2385
|
+
...model.fontFamilies === void 0 ? {} : {
|
|
2386
|
+
fontFamilies: list(model.fontFamilies, "font families", 1e4, (font) => {
|
|
2387
|
+
if (typeof font !== "string" || font.length > 1024) throw invalid2();
|
|
2388
|
+
return font;
|
|
2389
|
+
})
|
|
2390
|
+
},
|
|
2000
2391
|
diagnostics: list(
|
|
2001
2392
|
model.diagnostics,
|
|
2002
2393
|
"diagnostics",
|
|
@@ -2011,7 +2402,9 @@ function copySnapshotScene(model) {
|
|
|
2011
2402
|
"height",
|
|
2012
2403
|
"isBackground",
|
|
2013
2404
|
"backgroundPageId",
|
|
2014
|
-
"drawingToPageScale"
|
|
2405
|
+
"drawingToPageScale",
|
|
2406
|
+
"drawingSizeType",
|
|
2407
|
+
"drawingResizeType"
|
|
2015
2408
|
]),
|
|
2016
2409
|
shapes: shapes(page.shapes),
|
|
2017
2410
|
connectors: []
|
|
@@ -2051,6 +2444,7 @@ function visioPageEditToDrawing(page, edit) {
|
|
|
2051
2444
|
return edit;
|
|
2052
2445
|
case "create-rectangle":
|
|
2053
2446
|
case "create-ellipse":
|
|
2447
|
+
case "create-text-box":
|
|
2054
2448
|
return {
|
|
2055
2449
|
...edit,
|
|
2056
2450
|
x: coordinate(edit.x),
|
|
@@ -2098,6 +2492,103 @@ function visioNextShapeId(page) {
|
|
|
2098
2492
|
return String(max + 1);
|
|
2099
2493
|
}
|
|
2100
2494
|
|
|
2495
|
+
// visio/ui/formatting.ts
|
|
2496
|
+
function visioStyleFormattingShape(page, shapeId) {
|
|
2497
|
+
const candidates = page.shapes.filter((shape2) => shape2.id === shapeId);
|
|
2498
|
+
if (candidates.length !== 1) return void 0;
|
|
2499
|
+
const shape = candidates[0];
|
|
2500
|
+
if (shape.hidden || shape.masterId || shape.layerIds?.length || shape.children.length || !["shape", "connector"].includes(shape.kind) || shape.image || shape.foreignVector)
|
|
2501
|
+
return void 0;
|
|
2502
|
+
return shape;
|
|
2503
|
+
}
|
|
2504
|
+
function visioFormattingShape(page, shapeId) {
|
|
2505
|
+
return visioStyleFormattingShape(page, shapeId);
|
|
2506
|
+
}
|
|
2507
|
+
function visioFontFamilies(document) {
|
|
2508
|
+
return [...new Set(document.fontFamilies ?? [])].sort((left, right) => left.localeCompare(right));
|
|
2509
|
+
}
|
|
2510
|
+
function visioTextFormattingState(shapes) {
|
|
2511
|
+
const common = (values) => values.length && values.every((value) => value === values[0]) ? values[0] : void 0;
|
|
2512
|
+
const runs = shapes.flatMap(
|
|
2513
|
+
(shape) => shape.text.runs.length ? shape.text.runs : [shape.text]
|
|
2514
|
+
);
|
|
2515
|
+
const styled = (key) => !!runs.length && runs.every((run) => !!run[key]);
|
|
2516
|
+
const paragraphs = shapes.flatMap((shape) => shape.text.paragraphs ?? []);
|
|
2517
|
+
const alignment = common(
|
|
2518
|
+
shapes.flatMap(
|
|
2519
|
+
(shape) => shape.text.paragraphs?.length ? shape.text.paragraphs.map((paragraph) => paragraph.horizontalAlign) : [shape.text.horizontalAlign]
|
|
2520
|
+
)
|
|
2521
|
+
);
|
|
2522
|
+
return {
|
|
2523
|
+
bold: styled("bold"),
|
|
2524
|
+
italic: styled("italic"),
|
|
2525
|
+
underline: styled("underline"),
|
|
2526
|
+
strikethrough: styled("strikethrough"),
|
|
2527
|
+
bullets: !!shapes.length && shapes.every(
|
|
2528
|
+
(shape) => !!shape.text.paragraphs?.length && shape.text.paragraphs.every((paragraph) => !!paragraph.bullet)
|
|
2529
|
+
),
|
|
2530
|
+
fontFamily: common(runs.map((run) => run.fontFamily)),
|
|
2531
|
+
fontSize: common(runs.map((run) => run.fontSize)),
|
|
2532
|
+
fontColor: common(runs.map((run) => run.color)),
|
|
2533
|
+
horizontalAlign: alignment === "distributed" ? void 0 : alignment,
|
|
2534
|
+
verticalAlign: common(shapes.map((shape) => shape.text.verticalAlign)),
|
|
2535
|
+
canIndentDecrease: paragraphs.some((paragraph) => paragraph.indentLeft > 0)
|
|
2536
|
+
};
|
|
2537
|
+
}
|
|
2538
|
+
function visioTextIndentCommand(page, shapeId, direction) {
|
|
2539
|
+
const shape = visioFormattingShape(page, shapeId);
|
|
2540
|
+
if (!shape || !["increase", "decrease"].includes(direction)) return void 0;
|
|
2541
|
+
const paragraphs = shape.text.paragraphs ?? [];
|
|
2542
|
+
const left = paragraphs[0]?.indentLeft ?? 0;
|
|
2543
|
+
if (!Number.isFinite(left) || left < 0 || paragraphs.some((paragraph) => paragraph.indentLeft !== left))
|
|
2544
|
+
return void 0;
|
|
2545
|
+
const points = left * 72;
|
|
2546
|
+
const indentLeft = Math.min(7200, Math.max(0, points + (direction === "increase" ? 18 : -18)));
|
|
2547
|
+
return { type: "format-text", pageId: page.id, shapeId, indentLeft };
|
|
2548
|
+
}
|
|
2549
|
+
function visioTextFontStepCommand(page, shapeId, direction) {
|
|
2550
|
+
const shape = visioFormattingShape(page, shapeId);
|
|
2551
|
+
if (!shape || !["increase", "decrease"].includes(direction)) return void 0;
|
|
2552
|
+
const sizes = shape.text.runs.length ? shape.text.runs.map((run) => run.fontSize) : [shape.text.fontSize];
|
|
2553
|
+
const size = sizes[0];
|
|
2554
|
+
if (!Number.isFinite(size) || sizes.some((value) => Math.abs(value - size) > 1e-10))
|
|
2555
|
+
return void 0;
|
|
2556
|
+
const current = size * 72;
|
|
2557
|
+
if (current < 1 || current > 1e3) return void 0;
|
|
2558
|
+
const steps = [6, 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72];
|
|
2559
|
+
const fontSize = direction === "increase" ? steps.find((value) => value > current + 1e-3) ?? Math.min(1e3, Math.ceil(current * 1.2)) : steps.reverse().find((value) => value < current - 1e-3) ?? Math.max(1, Math.floor(current / 1.2));
|
|
2560
|
+
return { type: "format-text", pageId: page.id, shapeId, fontSize };
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
// visio/ui/shape-duplicate.ts
|
|
2564
|
+
function visioDuplicateCommand(page, shapeIds) {
|
|
2565
|
+
if (!shapeIds.length || shapeIds.length > 1e3 || new Set(shapeIds).size !== shapeIds.length || shapeIds.some((id) => {
|
|
2566
|
+
const shape = visioStyleFormattingShape(page, id);
|
|
2567
|
+
return !shape || shape.kind !== "shape" || !(shape.width > 0) || !(shape.height > 0) || page.connectors.some(
|
|
2568
|
+
(connection) => connection.fromShapeId === id || connection.toShapeId === id
|
|
2569
|
+
);
|
|
2570
|
+
}))
|
|
2571
|
+
return void 0;
|
|
2572
|
+
let next;
|
|
2573
|
+
try {
|
|
2574
|
+
next = Number(visioNextShapeId(page));
|
|
2575
|
+
} catch {
|
|
2576
|
+
return void 0;
|
|
2577
|
+
}
|
|
2578
|
+
if (next + shapeIds.length - 1 > 4294967295) return void 0;
|
|
2579
|
+
const selected = new Set(shapeIds);
|
|
2580
|
+
const mapping = new Map(
|
|
2581
|
+
page.shapes.filter((shape) => selected.has(shape.id)).map((shape) => [shape.id, String(next++)])
|
|
2582
|
+
);
|
|
2583
|
+
return {
|
|
2584
|
+
type: "duplicate-shapes",
|
|
2585
|
+
pageId: page.id,
|
|
2586
|
+
copies: shapeIds.map((shapeId) => ({ shapeId, newShapeId: mapping.get(shapeId) })),
|
|
2587
|
+
offsetX: 0.33,
|
|
2588
|
+
offsetY: -0.33
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2101
2592
|
// visio/ui/fill-pattern-transform.ts
|
|
2102
2593
|
function visioFillPatternTransform(world, pageHeight = 0) {
|
|
2103
2594
|
const determinant = world[0] * world[3] - world[1] * world[2];
|
|
@@ -2157,4 +2648,876 @@ function visioQuarterTurnCommand(page, shapeId, direction) {
|
|
|
2157
2648
|
};
|
|
2158
2649
|
}
|
|
2159
2650
|
|
|
2160
|
-
|
|
2651
|
+
// visio/ui/shape-order.ts
|
|
2652
|
+
function visioOrderingShape(page, shapeId) {
|
|
2653
|
+
if (page.shapes.some(
|
|
2654
|
+
(shape2) => shape2.kind !== "shape" || shape2.masterId || shape2.children.length || shape2.image || shape2.foreignVector
|
|
2655
|
+
))
|
|
2656
|
+
return void 0;
|
|
2657
|
+
const shape = page.shapes.find((candidate) => candidate.id === shapeId);
|
|
2658
|
+
return shape && !shape.hidden && !shape.layerIds?.length ? shape : void 0;
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
// geometry/align-distribute.ts
|
|
2662
|
+
function usesSlideReference(elementCount, options) {
|
|
2663
|
+
if (!options?.slideSize) {
|
|
2664
|
+
return false;
|
|
2665
|
+
}
|
|
2666
|
+
return options.reference === "slide";
|
|
2667
|
+
}
|
|
2668
|
+
function resolveAlignReferenceBox(elements, options) {
|
|
2669
|
+
if (elements.length === 0) {
|
|
2670
|
+
return null;
|
|
2671
|
+
}
|
|
2672
|
+
if (usesSlideReference(elements.length, options)) {
|
|
2673
|
+
return { minX: 0, minY: 0, maxX: options.slideSize.width, maxY: options.slideSize.height };
|
|
2674
|
+
}
|
|
2675
|
+
if (elements.length < 2) {
|
|
2676
|
+
return null;
|
|
2677
|
+
}
|
|
2678
|
+
return {
|
|
2679
|
+
minX: Math.min(...elements.map((e) => e.x)),
|
|
2680
|
+
minY: Math.min(...elements.map((e) => e.y)),
|
|
2681
|
+
maxX: Math.max(...elements.map((e) => e.x + e.width)),
|
|
2682
|
+
maxY: Math.max(...elements.map((e) => e.y + e.height))
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
function alignElements(elements, edge, options) {
|
|
2686
|
+
const result = /* @__PURE__ */ new Map();
|
|
2687
|
+
const ref = resolveAlignReferenceBox(elements, options);
|
|
2688
|
+
if (!ref) {
|
|
2689
|
+
return result;
|
|
2690
|
+
}
|
|
2691
|
+
const { minX, minY, maxX, maxY } = ref;
|
|
2692
|
+
const centerX = (minX + maxX) / 2;
|
|
2693
|
+
const centerY = (minY + maxY) / 2;
|
|
2694
|
+
for (const el of elements) {
|
|
2695
|
+
switch (edge) {
|
|
2696
|
+
case "left":
|
|
2697
|
+
result.set(el.id, { x: minX });
|
|
2698
|
+
break;
|
|
2699
|
+
case "right":
|
|
2700
|
+
result.set(el.id, { x: maxX - el.width });
|
|
2701
|
+
break;
|
|
2702
|
+
case "centerH":
|
|
2703
|
+
result.set(el.id, { x: centerX - el.width / 2 });
|
|
2704
|
+
break;
|
|
2705
|
+
case "top":
|
|
2706
|
+
result.set(el.id, { y: minY });
|
|
2707
|
+
break;
|
|
2708
|
+
case "bottom":
|
|
2709
|
+
result.set(el.id, { y: maxY - el.height });
|
|
2710
|
+
break;
|
|
2711
|
+
case "middle":
|
|
2712
|
+
result.set(el.id, { y: centerY - el.height / 2 });
|
|
2713
|
+
break;
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
return result;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
// visio/ui/shape-arrange.ts
|
|
2720
|
+
function distributeBoxes(boxes, axis) {
|
|
2721
|
+
const horizontal = axis === "horizontal";
|
|
2722
|
+
const start = (box2) => horizontal ? box2.x : -box2.y - box2.height;
|
|
2723
|
+
const size = (box2) => horizontal ? box2.width : box2.height;
|
|
2724
|
+
const center = (box2) => start(box2) + size(box2) / 2;
|
|
2725
|
+
const sorted = [...boxes].sort((left, right) => center(left) - center(right));
|
|
2726
|
+
const first = sorted[0], last = sorted.at(-1);
|
|
2727
|
+
const total = sorted.reduce((sum, box2) => sum + size(box2), 0);
|
|
2728
|
+
const gap = (start(last) + size(last) - start(first) - total) / (sorted.length - 1);
|
|
2729
|
+
let cursor = start(first);
|
|
2730
|
+
const positions = /* @__PURE__ */ new Map();
|
|
2731
|
+
for (const box2 of sorted) {
|
|
2732
|
+
positions.set(box2.id, horizontal ? { x: cursor } : { y: -cursor - box2.height });
|
|
2733
|
+
cursor += size(box2) + gap;
|
|
2734
|
+
}
|
|
2735
|
+
return positions;
|
|
2736
|
+
}
|
|
2737
|
+
function alignmentBox(shape) {
|
|
2738
|
+
if (!shape.rotation || shape.kind !== "shape" || !(shape.width > 0 && shape.height > 0))
|
|
2739
|
+
return void 0;
|
|
2740
|
+
const [a, b, c, d, e, f] = shape.transform;
|
|
2741
|
+
if (![a, b, c, d, e, f, shape.rotation.pinX, shape.rotation.pinY, shape.width, shape.height].every(
|
|
2742
|
+
Number.isFinite
|
|
2743
|
+
))
|
|
2744
|
+
return void 0;
|
|
2745
|
+
const points = [
|
|
2746
|
+
[0, 0],
|
|
2747
|
+
[shape.width, 0],
|
|
2748
|
+
[0, shape.height],
|
|
2749
|
+
[shape.width, shape.height]
|
|
2750
|
+
];
|
|
2751
|
+
const xs = points.map(([x2, y]) => a * x2 + c * y + e);
|
|
2752
|
+
const ys = points.map(([x2, y]) => b * x2 + d * y + f);
|
|
2753
|
+
const x = Math.min(...xs), top = Math.max(...ys);
|
|
2754
|
+
const width = Math.max(...xs) - x, height = top - Math.min(...ys);
|
|
2755
|
+
if (![x, top, width, height].every(Number.isFinite) || width <= 0 || height <= 0)
|
|
2756
|
+
return void 0;
|
|
2757
|
+
return { id: shape.id, x, y: -top, width, height };
|
|
2758
|
+
}
|
|
2759
|
+
function visioArrangeCommands(page, shapeIds, action) {
|
|
2760
|
+
const minimum = action.type === "align" ? 2 : 3;
|
|
2761
|
+
if (shapeIds.length < minimum || shapeIds.length > 1e3 || new Set(shapeIds).size !== shapeIds.length)
|
|
2762
|
+
return void 0;
|
|
2763
|
+
if (action.type === "align" ? !["left", "center", "right", "top", "middle", "bottom"].includes(action.edge) : action.type !== "distribute" || !["horizontal", "vertical"].includes(action.axis))
|
|
2764
|
+
return void 0;
|
|
2765
|
+
const shapes = [];
|
|
2766
|
+
const boxes = [];
|
|
2767
|
+
for (const id of shapeIds) {
|
|
2768
|
+
const shape = visioStyleFormattingShape(page, id);
|
|
2769
|
+
const box2 = shape && alignmentBox(shape);
|
|
2770
|
+
if (!shape || !box2 || page.connectors.some(
|
|
2771
|
+
(connection) => connection.fromShapeId === id || connection.toShapeId === id
|
|
2772
|
+
))
|
|
2773
|
+
return void 0;
|
|
2774
|
+
shapes.push(shape);
|
|
2775
|
+
boxes.push(box2);
|
|
2776
|
+
}
|
|
2777
|
+
const reference = boxes[0];
|
|
2778
|
+
const normalized = boxes.map((box2) => ({
|
|
2779
|
+
...box2,
|
|
2780
|
+
x: box2.x - reference.x,
|
|
2781
|
+
y: box2.y - reference.y
|
|
2782
|
+
}));
|
|
2783
|
+
const edge = action.type === "align" ? action.edge === "center" ? "centerH" : action.edge : void 0;
|
|
2784
|
+
const positions = action.type === "align" ? alignElements(normalized, edge, {
|
|
2785
|
+
reference: "slide",
|
|
2786
|
+
slideSize: { width: reference.width, height: reference.height }
|
|
2787
|
+
}) : distributeBoxes(normalized, action.axis);
|
|
2788
|
+
const commands = [];
|
|
2789
|
+
try {
|
|
2790
|
+
for (let index = 0; index < shapes.length; index++) {
|
|
2791
|
+
const shape = shapes[index], box2 = normalized[index];
|
|
2792
|
+
const position = positions.get(shape.id);
|
|
2793
|
+
if (!position) return void 0;
|
|
2794
|
+
const dx = (position.x ?? box2.x) - box2.x, dy = -((position.y ?? box2.y) - box2.y);
|
|
2795
|
+
if (Math.abs(dx) < 1e-10 && Math.abs(dy) < 1e-10) continue;
|
|
2796
|
+
commands.push(
|
|
2797
|
+
visioPageEditToDrawing(page, {
|
|
2798
|
+
type: "move-shape",
|
|
2799
|
+
pageId: page.id,
|
|
2800
|
+
shapeId: shape.id,
|
|
2801
|
+
x: shape.rotation.pinX + dx,
|
|
2802
|
+
y: shape.rotation.pinY + dy
|
|
2803
|
+
})
|
|
2804
|
+
);
|
|
2805
|
+
}
|
|
2806
|
+
} catch {
|
|
2807
|
+
return void 0;
|
|
2808
|
+
}
|
|
2809
|
+
return commands;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
// visio/ui/selection.ts
|
|
2813
|
+
var EMPTY_SELECTION = Object.freeze([]);
|
|
2814
|
+
var selectionKey = (shape, pageId) => JSON.stringify([shape.pageId ?? pageId, shape.id]);
|
|
2815
|
+
function visioSelectionIsOnPage(selection, pageId) {
|
|
2816
|
+
return !!selection && (selection.pageId === void 0 || selection.pageId === pageId);
|
|
2817
|
+
}
|
|
2818
|
+
function sameSelection(left, right) {
|
|
2819
|
+
return left.length === right.length && left.every((shape, index) => {
|
|
2820
|
+
const other = right[index];
|
|
2821
|
+
return shape.id === other.id && shape.pageId === other.pageId && shape.name === other.name;
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
function snapshotSelection(model, pageIndex, input, visible) {
|
|
2825
|
+
if (!Array.isArray(input)) throw new Error("Selection requires an array.");
|
|
2826
|
+
const length = input.length;
|
|
2827
|
+
if (length > VISIO_VISIBILITY_LIMITS.maxShapes)
|
|
2828
|
+
throw new Error("Selection exceeds the supported shape count.");
|
|
2829
|
+
const page = model?.pages[pageIndex];
|
|
2830
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
2831
|
+
for (let index = 0; index < length; index++) {
|
|
2832
|
+
const item = input[index];
|
|
2833
|
+
const id = item?.id, name = item?.name, pageId = item?.pageId;
|
|
2834
|
+
if (typeof id !== "string" || typeof name !== "string" || id.length > 1024 || name.length > 4096 || pageId !== void 0 && (typeof pageId !== "string" || pageId.length > 256))
|
|
2835
|
+
throw new Error("Selection requires shape IDs, names and optional page IDs.");
|
|
2836
|
+
const copied = Object.freeze({ id, name, ...pageId === void 0 ? {} : { pageId } });
|
|
2837
|
+
const key = selectionKey(copied, page?.id ?? "");
|
|
2838
|
+
if (!candidates.has(key)) candidates.set(key, copied);
|
|
2839
|
+
}
|
|
2840
|
+
if (!model || !page || !length) return EMPTY_SELECTION;
|
|
2841
|
+
const accepted = /* @__PURE__ */ new Map();
|
|
2842
|
+
const content = /* @__PURE__ */ new WeakMap();
|
|
2843
|
+
for (const source of getVisioPageLayers(model, page.id)) {
|
|
2844
|
+
const pending = source.shapes.map((shape) => ({ shape, ancestors: [] }));
|
|
2845
|
+
while (pending.length) {
|
|
2846
|
+
const { shape, ancestors } = pending.pop();
|
|
2847
|
+
const key = selectionKey({ id: shape.id, pageId: source.id }, page.id);
|
|
2848
|
+
if (candidates.has(key) && hasVisibleShapeContent(shape, visible, content))
|
|
2849
|
+
accepted.set(key, ancestors);
|
|
2850
|
+
for (const child of shape.children)
|
|
2851
|
+
pending.push({ shape: child, ancestors: [...ancestors, key] });
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
const result = [];
|
|
2855
|
+
for (const [key, item] of candidates) {
|
|
2856
|
+
const ancestors = accepted.get(key);
|
|
2857
|
+
if (!ancestors || ancestors.some((ancestor) => accepted.has(ancestor))) continue;
|
|
2858
|
+
result.push(item);
|
|
2859
|
+
}
|
|
2860
|
+
return result.length ? Object.freeze(result) : EMPTY_SELECTION;
|
|
2861
|
+
}
|
|
2862
|
+
function hasVisibleShapeContent(shape, visible, cache = /* @__PURE__ */ new WeakMap()) {
|
|
2863
|
+
const cached = cache.get(shape);
|
|
2864
|
+
if (cached !== void 0) return cached;
|
|
2865
|
+
const own = !(shape.kind === "group" && shape.groupDisplayMode === 0) && (shape.geometry.length > 0 || !!shape.image || !!shape.foreignVector || !!shape.text.plainText || shape.kind === "foreign");
|
|
2866
|
+
const renderable = (visible?.get(shape) ?? !shape.hidden) && (own || shape.children.some((child) => hasVisibleShapeContent(child, visible, cache)));
|
|
2867
|
+
cache.set(shape, renderable);
|
|
2868
|
+
return renderable;
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
// visio/ui/shape-clipboard.ts
|
|
2872
|
+
function visioClipboardShape(page, shapeId) {
|
|
2873
|
+
const shape = visioStyleFormattingShape(page, shapeId);
|
|
2874
|
+
if (!shape || shape.kind !== "shape" || !(shape.width > 0) || !(shape.height > 0) || page.connectors.some(
|
|
2875
|
+
(connection) => connection.fromShapeId === shapeId || connection.toShapeId === shapeId
|
|
2876
|
+
))
|
|
2877
|
+
return void 0;
|
|
2878
|
+
return shape;
|
|
2879
|
+
}
|
|
2880
|
+
function visioPasteCommand(page, value, offset = { x: 0.33, y: -0.33 }) {
|
|
2881
|
+
try {
|
|
2882
|
+
const clipboard = snapshotVisioClipboard(value);
|
|
2883
|
+
if ((page.drawingToPageScale ?? 1) !== clipboard.sourceDrawingScale || [offset.x, offset.y].some((number) => !Number.isFinite(number) || Math.abs(number) > 1e6))
|
|
2884
|
+
return void 0;
|
|
2885
|
+
let next = Number(visioNextShapeId(page));
|
|
2886
|
+
if (next + clipboard.shapes.length - 1 > 4294967295) return void 0;
|
|
2887
|
+
const ids = new Map(clipboard.shapes.map((shape) => [shape.shapeId, String(next++)]));
|
|
2888
|
+
return {
|
|
2889
|
+
type: "paste-shapes",
|
|
2890
|
+
pageId: page.id,
|
|
2891
|
+
clipboard,
|
|
2892
|
+
copies: clipboard.selectionIds.map((shapeId) => ({ shapeId, newShapeId: ids.get(shapeId) })),
|
|
2893
|
+
offsetX: offset.x,
|
|
2894
|
+
offsetY: offset.y
|
|
2895
|
+
};
|
|
2896
|
+
} catch {
|
|
2897
|
+
return void 0;
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
// visio/ui/shape-move.ts
|
|
2902
|
+
function visioMovementShape(page, id) {
|
|
2903
|
+
const shape = visioStyleFormattingShape(page, id);
|
|
2904
|
+
if (!shape || shape.kind !== "shape" || !shape.rotation || !(shape.width > 0 && shape.height > 0) || ![
|
|
2905
|
+
shape.width,
|
|
2906
|
+
shape.height,
|
|
2907
|
+
shape.rotation.pinX,
|
|
2908
|
+
shape.rotation.pinY,
|
|
2909
|
+
...shape.transform
|
|
2910
|
+
].every(Number.isFinite) || page.connectors.some(
|
|
2911
|
+
(connection) => connection.fromShapeId === id || connection.toShapeId === id
|
|
2912
|
+
))
|
|
2913
|
+
return void 0;
|
|
2914
|
+
return shape;
|
|
2915
|
+
}
|
|
2916
|
+
function visioPageDragDelta(start, end) {
|
|
2917
|
+
return { x: end.x - start.x, y: start.y - end.y };
|
|
2918
|
+
}
|
|
2919
|
+
function visioMovePreviewTransform(shape, delta) {
|
|
2920
|
+
if (![delta.x, delta.y, ...shape.transform].every(Number.isFinite)) return void 0;
|
|
2921
|
+
const [a, b, c, d, e, f] = shape.transform;
|
|
2922
|
+
const result = [a, b, c, d, e + delta.x, f + delta.y];
|
|
2923
|
+
return result.every(Number.isFinite) ? result : void 0;
|
|
2924
|
+
}
|
|
2925
|
+
function visioMoveCommands(page, ids, delta) {
|
|
2926
|
+
if (!ids.length || ids.length > 1e3 || new Set(ids).size !== ids.length || ![delta.x, delta.y].every(Number.isFinite))
|
|
2927
|
+
return void 0;
|
|
2928
|
+
const shapes = ids.map((id) => visioMovementShape(page, id));
|
|
2929
|
+
if (shapes.some((shape) => !shape)) return void 0;
|
|
2930
|
+
if (delta.x === 0 && delta.y === 0) return [];
|
|
2931
|
+
try {
|
|
2932
|
+
const edits = shapes.map(
|
|
2933
|
+
(shape) => visioPageEditToDrawing(page, {
|
|
2934
|
+
type: "move-shape",
|
|
2935
|
+
pageId: page.id,
|
|
2936
|
+
shapeId: shape.id,
|
|
2937
|
+
x: shape.rotation.pinX + delta.x,
|
|
2938
|
+
y: shape.rotation.pinY + delta.y
|
|
2939
|
+
})
|
|
2940
|
+
);
|
|
2941
|
+
return edits.every(
|
|
2942
|
+
(edit) => edit.type === "move-shape" && Number.isFinite(edit.x) && Number.isFinite(edit.y)
|
|
2943
|
+
) ? edits : void 0;
|
|
2944
|
+
} catch {
|
|
2945
|
+
return void 0;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
// visio/ui/size-position.ts
|
|
2950
|
+
var bounded = (value) => Number.isFinite(value) && Math.abs(value) <= 1e6;
|
|
2951
|
+
function visioSizePositionState(page, id) {
|
|
2952
|
+
const shape = visioMovementShape(page, id), ratio = page.drawingToPageScale ?? 1;
|
|
2953
|
+
if (!shape || !Number.isFinite(ratio) || ratio <= 0) return void 0;
|
|
2954
|
+
const rotation = shape.rotation;
|
|
2955
|
+
const state = {
|
|
2956
|
+
pageId: page.id,
|
|
2957
|
+
shapeId: id,
|
|
2958
|
+
x: rotation.pinX / ratio,
|
|
2959
|
+
y: rotation.pinY / ratio,
|
|
2960
|
+
width: shape.width / ratio,
|
|
2961
|
+
height: shape.height / ratio,
|
|
2962
|
+
angle: rotation.angle * 180 / Math.PI
|
|
2963
|
+
};
|
|
2964
|
+
if (![state.x, state.y, state.width, state.height, rotation.angle].every(bounded) || !Number.isFinite(state.angle))
|
|
2965
|
+
return void 0;
|
|
2966
|
+
return Object.freeze(state);
|
|
2967
|
+
}
|
|
2968
|
+
function visioSizePositionCommand(page, id, field, value) {
|
|
2969
|
+
const state = visioSizePositionState(page, id);
|
|
2970
|
+
if (!state || !Number.isFinite(value)) return void 0;
|
|
2971
|
+
if (!["x", "y", "width", "height", "angle"].includes(field)) return void 0;
|
|
2972
|
+
if (value === state[field]) return [];
|
|
2973
|
+
const target = { pageId: page.id, shapeId: id };
|
|
2974
|
+
if (field === "angle") {
|
|
2975
|
+
const angle = value * Math.PI / 180;
|
|
2976
|
+
return bounded(angle) ? [{ type: "rotate-shape", ...target, angle }] : void 0;
|
|
2977
|
+
}
|
|
2978
|
+
if (!bounded(value)) return void 0;
|
|
2979
|
+
if (field === "x" || field === "y")
|
|
2980
|
+
return [
|
|
2981
|
+
{
|
|
2982
|
+
type: "move-shape",
|
|
2983
|
+
...target,
|
|
2984
|
+
x: field === "x" ? value : state.x,
|
|
2985
|
+
y: field === "y" ? value : state.y
|
|
2986
|
+
}
|
|
2987
|
+
];
|
|
2988
|
+
if (value <= 0) return void 0;
|
|
2989
|
+
return [
|
|
2990
|
+
{
|
|
2991
|
+
type: "resize-shape",
|
|
2992
|
+
...target,
|
|
2993
|
+
width: field === "width" ? value : state.width,
|
|
2994
|
+
height: field === "height" ? value : state.height
|
|
2995
|
+
}
|
|
2996
|
+
];
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
// visio/ui/marquee.ts
|
|
3000
|
+
function visioMarqueeBox(start, end) {
|
|
3001
|
+
if (![start.x, start.y, end.x, end.y].every(Number.isFinite)) return void 0;
|
|
3002
|
+
const box2 = {
|
|
3003
|
+
x: Math.min(start.x, end.x),
|
|
3004
|
+
y: Math.min(start.y, end.y),
|
|
3005
|
+
width: Math.abs(end.x - start.x),
|
|
3006
|
+
height: Math.abs(end.y - start.y)
|
|
3007
|
+
};
|
|
3008
|
+
return Object.values(box2).every(Number.isFinite) ? box2 : void 0;
|
|
3009
|
+
}
|
|
3010
|
+
function visioShapePageBox(page, shape) {
|
|
3011
|
+
if (![page.height, shape.width, shape.height, ...shape.transform].every(Number.isFinite) || shape.width < 0 || shape.height < 0)
|
|
3012
|
+
return void 0;
|
|
3013
|
+
const [a, b, c, d, e, f] = shape.transform;
|
|
3014
|
+
const corners = [
|
|
3015
|
+
[0, 0],
|
|
3016
|
+
[shape.width, 0],
|
|
3017
|
+
[0, shape.height],
|
|
3018
|
+
[shape.width, shape.height]
|
|
3019
|
+
];
|
|
3020
|
+
const xs = corners.map(([x, y]) => a * x + c * y + e), ys = corners.map(([x, y]) => b * x + d * y + f);
|
|
3021
|
+
const left = Math.min(...xs), right = Math.max(...xs), bottom = Math.min(...ys), top = Math.max(...ys);
|
|
3022
|
+
const box2 = { x: left, y: page.height - top, width: right - left, height: top - bottom };
|
|
3023
|
+
return Object.values(box2).every(Number.isFinite) ? box2 : void 0;
|
|
3024
|
+
}
|
|
3025
|
+
function visioMarqueeSelection(page, box2, visible) {
|
|
3026
|
+
if (![box2.x, box2.y, box2.width, box2.height].every(Number.isFinite) || box2.width <= 0 || box2.height <= 0)
|
|
3027
|
+
return [];
|
|
3028
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3029
|
+
return page.shapes.flatMap((shape) => {
|
|
3030
|
+
const extent = visioShapePageBox(page, shape);
|
|
3031
|
+
return extent && hasVisibleShapeContent(shape, visible, cache) && extent.x >= box2.x && extent.y >= box2.y && extent.x + extent.width <= box2.x + box2.width && extent.y + extent.height <= box2.y + box2.height ? [{ id: shape.id, name: shape.name, pageId: page.id }] : [];
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
// visio/ui/shape-resize.ts
|
|
3036
|
+
var VISIO_RESIZE_HANDLES = [
|
|
3037
|
+
{ id: "sw", x: 0, y: 0 },
|
|
3038
|
+
{ id: "s", x: 0.5, y: 0 },
|
|
3039
|
+
{ id: "se", x: 1, y: 0 },
|
|
3040
|
+
{ id: "e", x: 1, y: 0.5 },
|
|
3041
|
+
{ id: "ne", x: 1, y: 1 },
|
|
3042
|
+
{ id: "n", x: 0.5, y: 1 },
|
|
3043
|
+
{ id: "nw", x: 0, y: 1 },
|
|
3044
|
+
{ id: "w", x: 0, y: 0.5 }
|
|
3045
|
+
];
|
|
3046
|
+
function visioResizeShape(page, id) {
|
|
3047
|
+
const shape = visioMovementShape(page, id);
|
|
3048
|
+
return shape && visioResizeFrame(shape, { width: shape.width, height: shape.height }, { x: 0, y: 0 }) ? shape : void 0;
|
|
3049
|
+
}
|
|
3050
|
+
function visioResizeFrame(shape, size, anchor) {
|
|
3051
|
+
if (!shape.rotation) return void 0;
|
|
3052
|
+
const geometry = visioAnchoredResizeGeometry(
|
|
3053
|
+
{ ...shape, pinX: shape.rotation.pinX, pinY: shape.rotation.pinY },
|
|
3054
|
+
size,
|
|
3055
|
+
anchor
|
|
3056
|
+
);
|
|
3057
|
+
return geometry ? {
|
|
3058
|
+
width: size.width,
|
|
3059
|
+
height: size.height,
|
|
3060
|
+
transform: geometry.transform,
|
|
3061
|
+
pinX: geometry.pinX,
|
|
3062
|
+
pinY: geometry.pinY
|
|
3063
|
+
} : void 0;
|
|
3064
|
+
}
|
|
3065
|
+
function visioResizeDrag(page, id, handle, start, end) {
|
|
3066
|
+
const shape = visioResizeShape(page, id), location = VISIO_RESIZE_HANDLES.find((item) => item.id === handle);
|
|
3067
|
+
if (!shape || !location) return void 0;
|
|
3068
|
+
const delta = visioPageDragDelta(start, end), [a, b, c, d] = shape.transform, determinant = a * d - b * c;
|
|
3069
|
+
const x = (d * delta.x - c * delta.y) / determinant, y = (-b * delta.x + a * delta.y) / determinant;
|
|
3070
|
+
const size = {
|
|
3071
|
+
width: location.x === 0.5 ? shape.width : Math.max(Math.min(1 / 16, shape.width), shape.width + (location.x === 1 ? x : -x)),
|
|
3072
|
+
height: location.y === 0.5 ? shape.height : Math.max(Math.min(1 / 16, shape.height), shape.height + (location.y === 1 ? y : -y))
|
|
3073
|
+
};
|
|
3074
|
+
const anchor = {
|
|
3075
|
+
x: 1 - location.x,
|
|
3076
|
+
y: 1 - location.y
|
|
3077
|
+
};
|
|
3078
|
+
const frame = visioResizeFrame(shape, size, anchor);
|
|
3079
|
+
if (!frame) return void 0;
|
|
3080
|
+
try {
|
|
3081
|
+
const command = visioPageEditToDrawing(page, {
|
|
3082
|
+
type: "resize-shape",
|
|
3083
|
+
pageId: page.id,
|
|
3084
|
+
shapeId: id,
|
|
3085
|
+
...size,
|
|
3086
|
+
anchor
|
|
3087
|
+
});
|
|
3088
|
+
return command.type === "resize-shape" && command.width <= 1e6 && command.height <= 1e6 ? { frame, command } : void 0;
|
|
3089
|
+
} catch {
|
|
3090
|
+
return void 0;
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
// visio/ui/draw-plan.ts
|
|
3095
|
+
var SNAP = 1 / 16;
|
|
3096
|
+
var boundedNumber = (value) => Number.isFinite(value) && Math.abs(value) <= 1e6;
|
|
3097
|
+
function visioDrawingPoint(page, point, options = {}) {
|
|
3098
|
+
if (![point.x, point.y, page.width, page.height].every(boundedNumber) || page.width <= 0 || page.height <= 0)
|
|
3099
|
+
return void 0;
|
|
3100
|
+
const coordinate = (value, maximum) => {
|
|
3101
|
+
const bounded2 = options.bounded === false ? value : Math.max(0, Math.min(maximum, value));
|
|
3102
|
+
return options.snap === false ? bounded2 : Math.round(bounded2 / SNAP) * SNAP;
|
|
3103
|
+
};
|
|
3104
|
+
return { x: coordinate(point.x, page.width), y: coordinate(point.y, page.height) };
|
|
3105
|
+
}
|
|
3106
|
+
function visioDrawBounds(start, end) {
|
|
3107
|
+
if (![start.x, start.y, end.x, end.y].every(boundedNumber))
|
|
3108
|
+
throw new Error("Invalid drawing bounds.");
|
|
3109
|
+
return {
|
|
3110
|
+
x: Math.min(start.x, end.x),
|
|
3111
|
+
y: Math.min(start.y, end.y),
|
|
3112
|
+
width: Math.abs(end.x - start.x),
|
|
3113
|
+
height: Math.abs(end.y - start.y),
|
|
3114
|
+
centerX: (start.x + end.x) / 2,
|
|
3115
|
+
centerY: (start.y + end.y) / 2,
|
|
3116
|
+
radiusX: Math.abs(end.x - start.x) / 2,
|
|
3117
|
+
radiusY: Math.abs(end.y - start.y) / 2
|
|
3118
|
+
};
|
|
3119
|
+
}
|
|
3120
|
+
function visioBoxCreationCommand(page, kind, centre, size, text) {
|
|
3121
|
+
if (!["rectangle", "ellipse", "text"].includes(kind) || ![centre.x, centre.y, size.width, size.height].every(boundedNumber) || size.width <= 0 || size.height <= 0)
|
|
3122
|
+
throw new Error("Invalid box creation geometry or tool.");
|
|
3123
|
+
const box2 = {
|
|
3124
|
+
pageId: page.id,
|
|
3125
|
+
shapeId: visioNextShapeId(page),
|
|
3126
|
+
x: centre.x,
|
|
3127
|
+
y: page.height - centre.y,
|
|
3128
|
+
width: size.width,
|
|
3129
|
+
height: size.height
|
|
3130
|
+
};
|
|
3131
|
+
const command = kind === "text" ? { ...box2, type: "create-text-box", text: text ?? "" } : {
|
|
3132
|
+
...box2,
|
|
3133
|
+
type: kind === "ellipse" ? "create-ellipse" : "create-rectangle",
|
|
3134
|
+
...text === void 0 ? {} : { text }
|
|
3135
|
+
};
|
|
3136
|
+
return drawingCommand(page, command);
|
|
3137
|
+
}
|
|
3138
|
+
function drawingCommand(page, command) {
|
|
3139
|
+
const result = visioPageEditToDrawing(page, command);
|
|
3140
|
+
if (Object.values(result).some((value) => typeof value === "number" && !boundedNumber(value)))
|
|
3141
|
+
throw new Error("Drawing coordinates exceed finite limits.");
|
|
3142
|
+
return result;
|
|
3143
|
+
}
|
|
3144
|
+
function visioLineCreationCommand(page, begin, end) {
|
|
3145
|
+
if (![begin.x, begin.y, end.x, end.y].every(boundedNumber))
|
|
3146
|
+
throw new Error("Invalid line creation geometry.");
|
|
3147
|
+
return drawingCommand(page, {
|
|
3148
|
+
type: "create-line",
|
|
3149
|
+
pageId: page.id,
|
|
3150
|
+
shapeId: visioNextShapeId(page),
|
|
3151
|
+
beginX: begin.x,
|
|
3152
|
+
beginY: page.height - begin.y,
|
|
3153
|
+
endX: end.x,
|
|
3154
|
+
endY: page.height - end.y
|
|
3155
|
+
});
|
|
3156
|
+
}
|
|
3157
|
+
function visioDrawIsLargeEnough(kind, start, end) {
|
|
3158
|
+
if (!["rectangle", "ellipse", "line", "text"].includes(kind) || ![start.x, start.y, end.x, end.y].every(boundedNumber))
|
|
3159
|
+
return false;
|
|
3160
|
+
const bounds = visioDrawBounds(start, end);
|
|
3161
|
+
return kind === "line" ? Math.hypot(bounds.width, bounds.height) >= SNAP : bounds.width >= SNAP && bounds.height >= SNAP;
|
|
3162
|
+
}
|
|
3163
|
+
function visioDrawPlan(page, kind, start, end, text) {
|
|
3164
|
+
if (!visioDrawIsLargeEnough(kind, start, end)) return void 0;
|
|
3165
|
+
const bounds = visioDrawBounds(start, end);
|
|
3166
|
+
return kind === "line" ? visioLineCreationCommand(page, start, end) : visioBoxCreationCommand(page, kind, { x: bounds.centerX, y: bounds.centerY }, bounds, text);
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
// visio/ui/line-dash.ts
|
|
3170
|
+
function visioLineDashLengths(style) {
|
|
3171
|
+
return style.lineDash?.map(
|
|
3172
|
+
(length, index) => length === 0 && index % 2 === 0 ? style.lineDashDotLength ?? 0 : length * style.lineWidth
|
|
3173
|
+
);
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
// visio/ui/shape-formatting.ts
|
|
3177
|
+
function visioShapeFormattingState(shapes) {
|
|
3178
|
+
const common = (values) => values.length && values.every((value) => value === values[0]) ? values[0] : void 0;
|
|
3179
|
+
const percent = (opacity) => opacity === void 0 || !Number.isFinite(opacity) || opacity < 0 || opacity > 1 ? void 0 : Math.round((1 - opacity) * 200) / 2;
|
|
3180
|
+
const foreground = shapes.map(
|
|
3181
|
+
(shape) => percent(
|
|
3182
|
+
shape.style.fillForegroundOpacity ?? (shape.style.fillGradient || shape.style.fillPattern ? void 0 : shape.style.fillOpacity)
|
|
3183
|
+
)
|
|
3184
|
+
);
|
|
3185
|
+
const background = shapes.map((shape) => percent(shape.style.fillBackgroundOpacity));
|
|
3186
|
+
return {
|
|
3187
|
+
linePattern: common(shapes.map((shape) => shape.style.linePattern)),
|
|
3188
|
+
fillPatternIndex: common(shapes.map((shape) => shape.style.fillPatternIndex)),
|
|
3189
|
+
fillBackgroundColor: common(shapes.map((shape) => shape.style.fillBackgroundColor)),
|
|
3190
|
+
fillForegroundTransparency: common(foreground),
|
|
3191
|
+
fillBackgroundTransparency: common(background),
|
|
3192
|
+
fillTransparency: common([...foreground, ...background]),
|
|
3193
|
+
lineTransparency: common(
|
|
3194
|
+
shapes.map(
|
|
3195
|
+
(shape) => percent(
|
|
3196
|
+
shape.style.lineColorOpacity ?? (shape.style.lineGradient ? void 0 : shape.style.lineOpacity)
|
|
3197
|
+
)
|
|
3198
|
+
)
|
|
3199
|
+
)
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
// visio/ui/text-replace-types.ts
|
|
3204
|
+
var VISIO_TEXT_REPLACE_LIMITS = Object.freeze({
|
|
3205
|
+
query: 256,
|
|
3206
|
+
replacement: 32768,
|
|
3207
|
+
text: 2e6,
|
|
3208
|
+
names: 1e6,
|
|
3209
|
+
output: 1e6,
|
|
3210
|
+
matches: 1e4,
|
|
3211
|
+
commands: 1e3,
|
|
3212
|
+
shapes: 25e3,
|
|
3213
|
+
pages: 256,
|
|
3214
|
+
depth: 64
|
|
3215
|
+
});
|
|
3216
|
+
var textReplaceError = (message) => {
|
|
3217
|
+
throw new Error(message);
|
|
3218
|
+
};
|
|
3219
|
+
function replaceString(value, maximum, label) {
|
|
3220
|
+
if (typeof value !== "string" || value.length > maximum)
|
|
3221
|
+
return textReplaceError(`Replace ${label} exceeds supported string limits.`);
|
|
3222
|
+
return value;
|
|
3223
|
+
}
|
|
3224
|
+
function replaceIdentity(value) {
|
|
3225
|
+
const id = replaceString(value, 256, "identity");
|
|
3226
|
+
if (!id) textReplaceError("Replace requires nonempty identities.");
|
|
3227
|
+
return id;
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
// visio/ui/text-replace-snapshot.ts
|
|
3231
|
+
function snapshotReplaceScope(input) {
|
|
3232
|
+
const query = replaceString(input.query, VISIO_TEXT_REPLACE_LIMITS.query, "query");
|
|
3233
|
+
const scope = input.scope, pageId = replaceIdentity(input.pageId), matchCase = input.matchCase;
|
|
3234
|
+
if (!query || matchCase !== true || !["selection", "current-page", "all-pages"].includes(scope))
|
|
3235
|
+
textReplaceError(
|
|
3236
|
+
"Replace requires a nonempty literal query, Match case, and an explicit scope."
|
|
3237
|
+
);
|
|
3238
|
+
let selection;
|
|
3239
|
+
const original = input.selection;
|
|
3240
|
+
if (original !== void 0) {
|
|
3241
|
+
const length = original.length;
|
|
3242
|
+
if (!Array.isArray(original) || !Number.isSafeInteger(length) || length > VISIO_TEXT_REPLACE_LIMITS.shapes || length < 0)
|
|
3243
|
+
textReplaceError("Replace selection exceeds supported limits.");
|
|
3244
|
+
selection = [];
|
|
3245
|
+
for (let index = 0; index < length; index++) {
|
|
3246
|
+
const item = original[index], id = replaceIdentity(item.id), page = item.pageId;
|
|
3247
|
+
selection.push(
|
|
3248
|
+
Object.freeze({ id, ...page === void 0 ? {} : { pageId: replaceIdentity(page) } })
|
|
3249
|
+
);
|
|
3250
|
+
}
|
|
3251
|
+
Object.freeze(selection);
|
|
3252
|
+
}
|
|
3253
|
+
return Object.freeze({ query, scope, pageId, matchCase, ...selection ? { selection } : {} });
|
|
3254
|
+
}
|
|
3255
|
+
function replaceEntries(model, scope, requirePage = true) {
|
|
3256
|
+
const pages = model.pages;
|
|
3257
|
+
const count = pages.length;
|
|
3258
|
+
if (!Array.isArray(pages) || !Number.isSafeInteger(count) || count > VISIO_TEXT_REPLACE_LIMITS.pages || count < 0)
|
|
3259
|
+
textReplaceError("Replace page list exceeds supported limits.");
|
|
3260
|
+
const all = [], identities = /* @__PURE__ */ new Map(), pageIds = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set();
|
|
3261
|
+
let characters = 0, names = 0;
|
|
3262
|
+
for (let pageIndex = 0; pageIndex < count; pageIndex++) {
|
|
3263
|
+
const page = pages[pageIndex], pageId = replaceIdentity(page.id), ids = /* @__PURE__ */ new Set();
|
|
3264
|
+
if (pageIds.has(pageId)) textReplaceError("Replace page identities are ambiguous.");
|
|
3265
|
+
pageIds.add(pageId);
|
|
3266
|
+
const walk = (source, depth) => {
|
|
3267
|
+
const length = source.length;
|
|
3268
|
+
if (!Array.isArray(source) || !Number.isSafeInteger(length) || length < 0 || length > 0 && depth > VISIO_TEXT_REPLACE_LIMITS.depth || length > VISIO_TEXT_REPLACE_LIMITS.shapes)
|
|
3269
|
+
textReplaceError("Replace shape list exceeds supported limits.");
|
|
3270
|
+
for (let index = 0; index < length; index++) {
|
|
3271
|
+
const shape = source[index], shapeId = replaceIdentity(shape.id);
|
|
3272
|
+
if (seen.has(shape) || ids.has(shapeId) || seen.size >= VISIO_TEXT_REPLACE_LIMITS.shapes)
|
|
3273
|
+
textReplaceError("Replace shape identities, depth or cycles are invalid.");
|
|
3274
|
+
seen.add(shape);
|
|
3275
|
+
ids.add(shapeId);
|
|
3276
|
+
const text = replaceString(shape.text.plainText, VISIO_TEXT_REPLACE_LIMITS.text, "source text");
|
|
3277
|
+
const name = replaceString(shape.name, 4096, "shape name");
|
|
3278
|
+
names += name.length;
|
|
3279
|
+
if (names > VISIO_TEXT_REPLACE_LIMITS.names) textReplaceError("Replace shape names exceed aggregate limits.");
|
|
3280
|
+
characters += text.length;
|
|
3281
|
+
if (characters > VISIO_TEXT_REPLACE_LIMITS.text) textReplaceError("Replace text exceeds aggregate limits.");
|
|
3282
|
+
const entry = { pageId, shapeId, name, pageIndex, text, end: 0 };
|
|
3283
|
+
identities.set(JSON.stringify([pageId, shapeId]), all.length);
|
|
3284
|
+
all.push(entry);
|
|
3285
|
+
walk(shape.children, depth + 1);
|
|
3286
|
+
entry.end = all.length;
|
|
3287
|
+
}
|
|
3288
|
+
};
|
|
3289
|
+
walk(page.shapes, 0);
|
|
3290
|
+
}
|
|
3291
|
+
if (requirePage && !pageIds.has(scope.pageId))
|
|
3292
|
+
textReplaceError("Replace current page does not exist.");
|
|
3293
|
+
if (scope.scope === "all-pages") return all;
|
|
3294
|
+
if (scope.scope === "current-page") return all.filter((entry) => entry.pageId === scope.pageId);
|
|
3295
|
+
const result = [], added = /* @__PURE__ */ new Set();
|
|
3296
|
+
for (const selected of scope.selection ?? []) {
|
|
3297
|
+
const pageId = selected.pageId ?? scope.pageId;
|
|
3298
|
+
const start = identities.get(JSON.stringify([pageId, selected.id]));
|
|
3299
|
+
if (start === void 0) return textReplaceError("Replace selected shape does not exist.");
|
|
3300
|
+
for (let index = start; index < all[start].end; index++) {
|
|
3301
|
+
const entry = all[index];
|
|
3302
|
+
if (added.has(entry)) {
|
|
3303
|
+
index = entry.end - 1;
|
|
3304
|
+
continue;
|
|
3305
|
+
}
|
|
3306
|
+
result.push(entry);
|
|
3307
|
+
added.add(entry);
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
return result;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
// visio/ui/text-replace-selection.ts
|
|
3314
|
+
function visioTextOccurrenceSelection(model, occurrence) {
|
|
3315
|
+
const pageId = replaceIdentity(occurrence.pageId), shapeId = replaceIdentity(occurrence.shapeId), start = occurrence.start, end = occurrence.end;
|
|
3316
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end <= start)
|
|
3317
|
+
return void 0;
|
|
3318
|
+
const entries = replaceEntries(
|
|
3319
|
+
model,
|
|
3320
|
+
{ pageId, scope: "all-pages"},
|
|
3321
|
+
false
|
|
3322
|
+
);
|
|
3323
|
+
const entry = entries.find((item) => item.pageId === pageId && item.shapeId === shapeId);
|
|
3324
|
+
if (!entry || end > entry.text.length) return void 0;
|
|
3325
|
+
return Object.freeze({
|
|
3326
|
+
pageIndex: entry.pageIndex,
|
|
3327
|
+
selection: Object.freeze({ id: shapeId, name: entry.name, pageId })
|
|
3328
|
+
});
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
// visio/ui/text-replace.ts
|
|
3332
|
+
function occurrences(entries, query) {
|
|
3333
|
+
const result = [];
|
|
3334
|
+
for (const entry of entries) {
|
|
3335
|
+
let start = entry.text.indexOf(query);
|
|
3336
|
+
while (start >= 0) {
|
|
3337
|
+
if (result.length >= VISIO_TEXT_REPLACE_LIMITS.matches)
|
|
3338
|
+
textReplaceError("Replace occurrence count exceeds limits.");
|
|
3339
|
+
result.push(
|
|
3340
|
+
Object.freeze({
|
|
3341
|
+
pageId: entry.pageId,
|
|
3342
|
+
shapeId: entry.shapeId,
|
|
3343
|
+
start,
|
|
3344
|
+
end: start + query.length
|
|
3345
|
+
})
|
|
3346
|
+
);
|
|
3347
|
+
start = entry.text.indexOf(query, start + query.length);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
return Object.freeze(result);
|
|
3351
|
+
}
|
|
3352
|
+
function visioTextReplaceOccurrences(model, input) {
|
|
3353
|
+
const scope = snapshotReplaceScope(input);
|
|
3354
|
+
return occurrences(replaceEntries(model, scope), scope.query);
|
|
3355
|
+
}
|
|
3356
|
+
function visioTextReplaceFindNext(model, input, current) {
|
|
3357
|
+
const saved = snapshotOccurrence(current);
|
|
3358
|
+
const found = visioTextReplaceOccurrences(model, input);
|
|
3359
|
+
if (saved === void 0) return found[0];
|
|
3360
|
+
const index = found.findIndex((match) => sameOccurrence(match, saved));
|
|
3361
|
+
if (index < 0) return textReplaceError("Find occurrence is stale or outside the scope.");
|
|
3362
|
+
return found[(index + 1) % found.length];
|
|
3363
|
+
}
|
|
3364
|
+
var records = /* @__PURE__ */ new WeakMap();
|
|
3365
|
+
var sameOccurrence = (a, b) => a.pageId === b.pageId && a.shapeId === b.shapeId && a.start === b.start && a.end === b.end;
|
|
3366
|
+
var sameTarget = (entry, match) => entry.pageId === match.pageId && entry.shapeId === match.shapeId;
|
|
3367
|
+
function snapshotOccurrence(original) {
|
|
3368
|
+
if (original === void 0) return void 0;
|
|
3369
|
+
const current = {
|
|
3370
|
+
pageId: replaceIdentity(original.pageId),
|
|
3371
|
+
shapeId: replaceIdentity(original.shapeId),
|
|
3372
|
+
start: original.start,
|
|
3373
|
+
end: original.end
|
|
3374
|
+
};
|
|
3375
|
+
if (!Number.isSafeInteger(current.start) || !Number.isSafeInteger(current.end) || current.start < 0 || current.end <= current.start || current.end > VISIO_TEXT_REPLACE_LIMITS.text)
|
|
3376
|
+
textReplaceError("Invalid replacement occurrence range.");
|
|
3377
|
+
return current;
|
|
3378
|
+
}
|
|
3379
|
+
function visioTextReplacePlan(model, input) {
|
|
3380
|
+
const scope = snapshotReplaceScope(input), replacement = replaceString(input.replacement, VISIO_TEXT_REPLACE_LIMITS.replacement, "replacement"), mode = input.mode, current = snapshotOccurrence(input.current);
|
|
3381
|
+
if (mode !== "current" && mode !== "all") textReplaceError("Invalid replacement mode.");
|
|
3382
|
+
if (/[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u.test(
|
|
3383
|
+
replacement
|
|
3384
|
+
))
|
|
3385
|
+
textReplaceError("Replacement contains invalid XML text characters.");
|
|
3386
|
+
const entries = replaceEntries(model, scope), found = occurrences(entries, scope.query);
|
|
3387
|
+
const active = current === void 0 ? found[0] : found.find((match) => sameOccurrence(match, current));
|
|
3388
|
+
if (current !== void 0 && !active)
|
|
3389
|
+
textReplaceError("Replace occurrence is stale or outside the scope.");
|
|
3390
|
+
const selected = mode === "all" ? found : active ? [active] : [];
|
|
3391
|
+
const targets = /* @__PURE__ */ new Map();
|
|
3392
|
+
for (const match of selected) {
|
|
3393
|
+
const key = JSON.stringify([match.pageId, match.shapeId]);
|
|
3394
|
+
const list = targets.get(key) ?? [];
|
|
3395
|
+
list.push(match);
|
|
3396
|
+
targets.set(key, list);
|
|
3397
|
+
}
|
|
3398
|
+
if (targets.size > VISIO_TEXT_REPLACE_LIMITS.commands) textReplaceError("Replace command count exceeds limits.");
|
|
3399
|
+
const edits = [], updated = [];
|
|
3400
|
+
let outputCharacters = 0, commandCharacters = 0;
|
|
3401
|
+
for (const entry of entries) {
|
|
3402
|
+
const matches = targets.get(JSON.stringify([entry.pageId, entry.shapeId]));
|
|
3403
|
+
let text = entry.text;
|
|
3404
|
+
if (matches) {
|
|
3405
|
+
const length = text.length + matches.length * (replacement.length - scope.query.length);
|
|
3406
|
+
outputCharacters += length;
|
|
3407
|
+
if (length > VISIO_TEXT_REPLACE_LIMITS.output || outputCharacters > VISIO_TEXT_REPLACE_LIMITS.output)
|
|
3408
|
+
textReplaceError("Replace output exceeds aggregate command text limits.");
|
|
3409
|
+
const parts = [];
|
|
3410
|
+
let from = 0;
|
|
3411
|
+
for (const match of matches) {
|
|
3412
|
+
parts.push(text.slice(from, match.start), replacement);
|
|
3413
|
+
from = match.end;
|
|
3414
|
+
}
|
|
3415
|
+
parts.push(text.slice(from));
|
|
3416
|
+
text = parts.join("");
|
|
3417
|
+
const target = { pageId: entry.pageId, shapeId: entry.shapeId };
|
|
3418
|
+
if (replacement.includes("\n") || scope.query.includes("\n")) {
|
|
3419
|
+
commandCharacters += text.length;
|
|
3420
|
+
edits.push(Object.freeze({ type: "replace-plain-text", ...target, text }));
|
|
3421
|
+
} else {
|
|
3422
|
+
commandCharacters += entry.text.length + matches.length * replacement.length;
|
|
3423
|
+
edits.push(
|
|
3424
|
+
Object.freeze({
|
|
3425
|
+
type: "replace-text-ranges",
|
|
3426
|
+
...target,
|
|
3427
|
+
expectedText: entry.text,
|
|
3428
|
+
ranges: Object.freeze(
|
|
3429
|
+
matches.map(
|
|
3430
|
+
(match) => Object.freeze({ start: match.start, end: match.end, text: replacement })
|
|
3431
|
+
)
|
|
3432
|
+
)
|
|
3433
|
+
})
|
|
3434
|
+
);
|
|
3435
|
+
}
|
|
3436
|
+
if (commandCharacters > VISIO_TEXT_REPLACE_LIMITS.output)
|
|
3437
|
+
textReplaceError("Replace input exceeds aggregate command text limits.");
|
|
3438
|
+
}
|
|
3439
|
+
updated.push({ ...entry, text });
|
|
3440
|
+
}
|
|
3441
|
+
const remaining = mode === "current" ? occurrences(updated, scope.query) : [];
|
|
3442
|
+
const activeEntry = active ? entries.findIndex((entry) => sameTarget(entry, active)) : -1;
|
|
3443
|
+
const entryIndices = new Map(
|
|
3444
|
+
entries.map((entry, index) => [JSON.stringify([entry.pageId, entry.shapeId]), index])
|
|
3445
|
+
);
|
|
3446
|
+
const nextOccurrence = active ? remaining.find((match) => {
|
|
3447
|
+
const index = entryIndices.get(JSON.stringify([match.pageId, match.shapeId]));
|
|
3448
|
+
return index > activeEntry || index === activeEntry && match.start >= active.start + replacement.length;
|
|
3449
|
+
}) ?? remaining[0] : remaining[0];
|
|
3450
|
+
const plan = Object.freeze({
|
|
3451
|
+
occurrences: found,
|
|
3452
|
+
replacementCount: selected.length,
|
|
3453
|
+
edits: Object.freeze(edits),
|
|
3454
|
+
nextOccurrence
|
|
3455
|
+
});
|
|
3456
|
+
records.set(plan, { scope, entries });
|
|
3457
|
+
return plan;
|
|
3458
|
+
}
|
|
3459
|
+
function visioTextReplaceCommands(model, plan) {
|
|
3460
|
+
const record2 = records.get(plan);
|
|
3461
|
+
if (!record2) return textReplaceError("Replace plan was not produced by this planner.");
|
|
3462
|
+
const current = replaceEntries(model, record2.scope);
|
|
3463
|
+
if (current.length !== record2.entries.length || current.some((entry, index) => {
|
|
3464
|
+
const saved = record2.entries[index];
|
|
3465
|
+
return entry.pageId !== saved.pageId || entry.shapeId !== saved.shapeId || entry.text !== saved.text;
|
|
3466
|
+
}))
|
|
3467
|
+
textReplaceError("Replace plan is stale. Search the current drawing again.");
|
|
3468
|
+
return plan.edits.map(
|
|
3469
|
+
(edit) => edit.type === "replace-text-ranges" ? { ...edit, ranges: edit.ranges.map((range) => ({ ...range })) } : { ...edit }
|
|
3470
|
+
);
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
// visio/ui/svg-stroke.ts
|
|
3474
|
+
function visioSvgStrokeStyle(style) {
|
|
3475
|
+
return style.lineWidth === 0 ? { ...style, lineWidth: 0.75 / 72 } : style;
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
// visio/ui/page-size.ts
|
|
3479
|
+
var VISIO_PAGE_SIZE_PRESETS = Object.freeze([
|
|
3480
|
+
Object.freeze({ id: "letter", label: "Letter", width: 8.5, height: 11 }),
|
|
3481
|
+
Object.freeze({ id: "a4", label: "A4", width: 210 / 25.4, height: 297 / 25.4 })
|
|
3482
|
+
]);
|
|
3483
|
+
var dimension = (value) => Number.isFinite(value) && value > 0 && value <= 1e6;
|
|
3484
|
+
function visioPageSizeState(page) {
|
|
3485
|
+
const { id: pageId, width, height, drawingSizeType, drawingResizeType } = page;
|
|
3486
|
+
if (!dimension(width) || !dimension(height) || !pageId || pageId.length > 256) return void 0;
|
|
3487
|
+
return Object.freeze({
|
|
3488
|
+
pageId,
|
|
3489
|
+
width,
|
|
3490
|
+
height,
|
|
3491
|
+
orientation: width === height ? "square" : width > height ? "landscape" : "portrait",
|
|
3492
|
+
...drawingSizeType === void 0 ? {} : { drawingSizeType },
|
|
3493
|
+
...drawingResizeType === void 0 ? {} : { drawingResizeType }
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
function visioPageSizeCommand(page, width, height) {
|
|
3497
|
+
const state = visioPageSizeState(page);
|
|
3498
|
+
if (!state || !dimension(width) || !dimension(height)) return void 0;
|
|
3499
|
+
if (width === state.width && height === state.height && state.drawingSizeType === 3 && state.drawingResizeType === 0)
|
|
3500
|
+
return [];
|
|
3501
|
+
return [{ type: "set-page-size", pageId: state.pageId, width, height }];
|
|
3502
|
+
}
|
|
3503
|
+
function visioPageOrientationCommand(page, orientation) {
|
|
3504
|
+
const state = visioPageSizeState(page);
|
|
3505
|
+
if (!state || !["portrait", "landscape"].includes(orientation)) return void 0;
|
|
3506
|
+
const short = Math.min(state.width, state.height), long = Math.max(state.width, state.height);
|
|
3507
|
+
return visioPageSizeCommand(
|
|
3508
|
+
page,
|
|
3509
|
+
orientation === "portrait" ? short : long,
|
|
3510
|
+
orientation === "portrait" ? long : short
|
|
3511
|
+
);
|
|
3512
|
+
}
|
|
3513
|
+
function visioPageSizePresetCommand(page, id) {
|
|
3514
|
+
const state = visioPageSizeState(page), preset = VISIO_PAGE_SIZE_PRESETS.find((item) => item.id === id);
|
|
3515
|
+
if (!state || !preset) return void 0;
|
|
3516
|
+
return visioPageSizeCommand(
|
|
3517
|
+
page,
|
|
3518
|
+
state.orientation === "landscape" ? preset.height : preset.width,
|
|
3519
|
+
state.orientation === "landscape" ? preset.width : preset.height
|
|
3520
|
+
);
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
export { DocumentHistory, EDIT_HISTORY_LIMITS, EMPTY_EDIT_STATE, EMPTY_SELECTION, EMPTY_TEXT_SEARCH, FOREIGN_VECTOR_SCENE_LIMITS, ForeignVectorBudget, MAX_INPUT_BYTES, TEXT_SEARCH_LIMITS, IDENTITY_AFFINE as VISIO_IDENTITY_TRANSFORM, VISIO_PAGE_SIZE_PRESETS, VISIO_RESIZE_HANDLES, VISIO_TEXT_REPLACE_LIMITS, assertShapeDetails, assertViewableDocument, compatibilityNotes, compatibilityText, composeAffine as composeVisioTransform, copySnapshotScene, demoDocument, editErrorMessage, eventKeys, hasVisibleShapeContent, indexDocumentText, inspectForeignVectorResource, isEditCancellation, propertyKeys, sameSelection, searchDocumentText, selectionKey, snapshotEdits, snapshotSelection, textSearchStatus, validateSearchQuery, visioArrangeCommands, visioBoxCreationCommand, visioClipboardShape, visioDrawBounds, visioDrawIsLargeEnough, visioDrawPlan, visioDrawingPoint, visioDuplicateCommand, visioFillPatternTransform, visioFontFamilies, visioFormattingShape, visioGradientInstances, visioLineCreationCommand, visioLineDashLengths, visioLocalRotationShape, visioMarqueeBox, visioMarqueeSelection, visioMoveCommands, visioMovePreviewTransform, visioMovementShape, visioNextShapeId, visioOrderingShape, visioPageDragDelta, visioPageEditToDrawing, visioPageInsertCommand, visioPageOrientationCommand, visioPageSizeCommand, visioPageSizePresetCommand, visioPageSizeState, visioPasteCommand, visioQuarterTurnCommand, visioRenderedGradientStopCount, visioRenderedGradientStops, visioResizeDrag, visioResizeFrame, visioResizeShape, visioRotationPreviewTransform, visioSelectionIsOnPage, visioShapeFormattingState, visioShapePageBox, visioSizePositionCommand, visioSizePositionState, visioStraightLineHandles, visioStrokeGradient, visioStyleFormattingShape, visioSvgStrokeStyle, visioTextFontStepCommand, visioTextFormattingState, visioTextIndentCommand, visioTextOccurrenceSelection, visioTextReplaceCommands, visioTextReplaceFindNext, visioTextReplaceOccurrences, visioTextReplacePlan };
|