ooxml-core 1.35.0 → 1.36.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.
Files changed (49) hide show
  1. package/dist/automation/index.cjs +1290 -825
  2. package/dist/automation/index.mjs +1290 -825
  3. package/dist/visio/bevel-3d.d.ts +31 -4
  4. package/dist/visio/bevel-3d.d.ts.map +1 -1
  5. package/dist/visio/cff-author.d.ts +14 -0
  6. package/dist/visio/cff-author.d.ts.map +1 -0
  7. package/dist/visio/cff-masters.d.ts +11 -0
  8. package/dist/visio/cff-masters.d.ts.map +1 -1
  9. package/dist/visio/edit-commands.d.ts +7 -0
  10. package/dist/visio/edit-commands.d.ts.map +1 -1
  11. package/dist/visio/edit-formatting-commands.d.ts +6 -0
  12. package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
  13. package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
  14. package/dist/visio/edit-instance-geometry.d.ts.map +1 -1
  15. package/dist/visio/edit-instance-recalculate.d.ts +6 -1
  16. package/dist/visio/edit-instance-recalculate.d.ts.map +1 -1
  17. package/dist/visio/edit-shape-create.d.ts.map +1 -1
  18. package/dist/visio/edit-stencil-connector.d.ts.map +1 -1
  19. package/dist/visio/edit-swimlane-stamp.d.ts +22 -0
  20. package/dist/visio/edit-swimlane-stamp.d.ts.map +1 -0
  21. package/dist/visio/edit.d.ts.map +1 -1
  22. package/dist/visio/index.cjs +1338 -568
  23. package/dist/visio/index.d.ts +3 -1
  24. package/dist/visio/index.d.ts.map +1 -1
  25. package/dist/visio/index.mjs +1331 -569
  26. package/dist/visio/model.d.ts +6 -2
  27. package/dist/visio/model.d.ts.map +1 -1
  28. package/dist/visio/path-segments.d.ts +25 -0
  29. package/dist/visio/path-segments.d.ts.map +1 -0
  30. package/dist/visio/shape-sections.d.ts +4 -3
  31. package/dist/visio/shape-sections.d.ts.map +1 -1
  32. package/dist/visio/solid-3d.d.ts +55 -0
  33. package/dist/visio/solid-3d.d.ts.map +1 -0
  34. package/dist/visio/style.d.ts.map +1 -1
  35. package/dist/visio/theme-solid.d.ts +21 -0
  36. package/dist/visio/theme-solid.d.ts.map +1 -0
  37. package/dist/visio/ui/data-visualizer-edits.d.ts +1 -0
  38. package/dist/visio/ui/data-visualizer-edits.d.ts.map +1 -1
  39. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  40. package/dist/visio/ui/index.cjs +1188 -571
  41. package/dist/visio/ui/index.mjs +1188 -572
  42. package/dist/visio/ui/org-chart-belt.d.ts +20 -0
  43. package/dist/visio/ui/org-chart-belt.d.ts.map +1 -0
  44. package/dist/visio/ui/org-chart-edit.d.ts +8 -1
  45. package/dist/visio/ui/org-chart-edit.d.ts.map +1 -1
  46. package/dist/visio/ui/org-chart-import.d.ts.map +1 -1
  47. package/dist/visio/ui/scene-validation.d.ts.map +1 -1
  48. package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
  49. package/package.json +1 -1
@@ -77,8 +77,8 @@ function sanitizeVisioPresence(raw2) {
77
77
  }
78
78
  if (Array.isArray(raw2.selection)) {
79
79
  const ids = /* @__PURE__ */ new Set();
80
- for (const entry3 of raw2.selection) {
81
- const id4 = clean(entry3);
80
+ for (const entry4 of raw2.selection) {
81
+ const id4 = clean(entry4);
82
82
  if (id4) ids.add(id4);
83
83
  if (ids.size >= VISIO_PRESENCE_MAX_SELECTION) break;
84
84
  }
@@ -327,7 +327,7 @@ var DocumentHistory = class {
327
327
  }
328
328
  #trim() {
329
329
  const retained = () => /* @__PURE__ */ new Set([this.original, ...this.#entries]);
330
- while (this.#entries.length > this.#maxEntries || [...retained()].reduce((sum, entry3) => sum + entry3.bytes.byteLength, 0) > EDIT_HISTORY_LIMITS.maxBytes) {
330
+ while (this.#entries.length > this.#maxEntries || [...retained()].reduce((sum, entry4) => sum + entry4.bytes.byteLength, 0) > EDIT_HISTORY_LIMITS.maxBytes) {
331
331
  if (this.#index === 0) throw new Error("Source snapshots exceed the retained history limit.");
332
332
  this.#entries.shift();
333
333
  this.#index--;
@@ -427,13 +427,13 @@ function searchDocumentText(index3, query) {
427
427
  let resultsTruncated = false;
428
428
  if (query.trim()) {
429
429
  const folded = query.toLowerCase();
430
- for (const entry3 of index3.entries) {
431
- if (!entry3.foldedText.includes(folded)) continue;
430
+ for (const entry4 of index3.entries) {
431
+ if (!entry4.foldedText.includes(folded)) continue;
432
432
  if (results.length === TEXT_SEARCH_LIMITS.results) {
433
433
  resultsTruncated = true;
434
434
  break;
435
435
  }
436
- results.push(entry3.result);
436
+ results.push(entry4.result);
437
437
  }
438
438
  }
439
439
  return Object.freeze({
@@ -1810,8 +1810,8 @@ var VisioPackage = class _VisioPackage {
1810
1810
  this.entries = entries;
1811
1811
  this.limits = limits;
1812
1812
  this.deadline = deadline;
1813
- for (const entry3 of entries.values())
1814
- if (!entry3.directory) this.decodedNames.set(decodePath(entry3.name), entry3.name);
1813
+ for (const entry4 of entries.values())
1814
+ if (!entry4.directory) this.decodedNames.set(decodePath(entry4.name), entry4.name);
1815
1815
  }
1816
1816
  zip;
1817
1817
  entries;
@@ -1871,15 +1871,15 @@ var VisioPackage = class _VisioPackage {
1871
1871
  }
1872
1872
  /** The declared CRC-32 and size of a part, or an empty string when the package lacks it. */
1873
1873
  printOf(path3) {
1874
- const entry3 = this.entries.get(path3);
1875
- return entry3 && !entry3.directory ? `${entry3.crc}:${entry3.size}` : "";
1874
+ const entry4 = this.entries.get(path3);
1875
+ return entry4 && !entry4.directory ? `${entry4.crc}:${entry4.size}` : "";
1876
1876
  }
1877
1877
  has(path3) {
1878
1878
  this.noted?.add(path3);
1879
1879
  return this.entries.get(path3)?.directory === false;
1880
1880
  }
1881
1881
  paths() {
1882
- return [...this.entries.values()].filter((entry3) => !entry3.directory).map((entry3) => entry3.name);
1882
+ return [...this.entries.values()].filter((entry4) => !entry4.directory).map((entry4) => entry4.name);
1883
1883
  }
1884
1884
  async readXml(path3, expectedRoot) {
1885
1885
  this.check();
@@ -1901,9 +1901,9 @@ var VisioPackage = class _VisioPackage {
1901
1901
  this.check();
1902
1902
  this.noted?.add(path3);
1903
1903
  safePath(path3);
1904
- const entry3 = this.entries.get(path3);
1905
- if (!entry3 || entry3.directory) fail("MISSING_PART", `Missing package part: ${path3}`);
1906
- return entry3.size;
1904
+ const entry4 = this.entries.get(path3);
1905
+ if (!entry4 || entry4.directory) fail("MISSING_PART", `Missing package part: ${path3}`);
1906
+ return entry4.size;
1907
1907
  }
1908
1908
  /** Shared package-owned bytes. Treat the returned buffer as immutable. */
1909
1909
  async readBytes(path3) {
@@ -1920,8 +1920,8 @@ var VisioPackage = class _VisioPackage {
1920
1920
  return bytes;
1921
1921
  }
1922
1922
  async loadBytes(path3) {
1923
- const entry3 = this.entries.get(path3), file = this.zip.file(path3);
1924
- if (!entry3 || entry3.directory || !file)
1923
+ const entry4 = this.entries.get(path3), file = this.zip.file(path3);
1924
+ if (!entry4 || entry4.directory || !file)
1925
1925
  return fail("MISSING_PART", `Missing package part: ${path3}`);
1926
1926
  return new Promise((resolve, reject) => {
1927
1927
  const stream = file.internalStream("uint8array");
@@ -1952,9 +1952,9 @@ var VisioPackage = class _VisioPackage {
1952
1952
  fail("LIMIT_ENTRY", `Actual inflated entry exceeds limit: ${path3}`);
1953
1953
  if (this.totalOutput > this.limits.maxTotalBytes)
1954
1954
  fail("LIMIT_TOTAL", "Actual inflated ZIP total exceeds limit");
1955
- if (size3 > Math.max(1, entry3.compressed) * this.limits.maxCompressionRatio)
1955
+ if (size3 > Math.max(1, entry4.compressed) * this.limits.maxCompressionRatio)
1956
1956
  fail("LIMIT_RATIO", `Actual ZIP compression ratio exceeds limit: ${path3}`);
1957
- if (size3 > entry3.size)
1957
+ if (size3 > entry4.size)
1958
1958
  fail("ZIP_MISMATCH", `Actual ZIP entry exceeds declared size: ${path3}`);
1959
1959
  crc = crc32(chunk, crc);
1960
1960
  chunks.push(chunk);
@@ -1963,7 +1963,7 @@ var VisioPackage = class _VisioPackage {
1963
1963
  }
1964
1964
  }).on("error", abort).on("end", () => {
1965
1965
  if (settled) return;
1966
- if (size3 !== entry3.size || (crc ^ 4294967295) >>> 0 !== entry3.crc) {
1966
+ if (size3 !== entry4.size || (crc ^ 4294967295) >>> 0 !== entry4.crc) {
1967
1967
  abort(new VisioPackageError("ZIP_MISMATCH", `Inflated size or CRC mismatch: ${path3}`));
1968
1968
  return;
1969
1969
  }
@@ -4590,9 +4590,28 @@ function createLine(root2, document, edit) {
4590
4590
  setCell(row2, "Y", 0);
4591
4591
  section3.appendChild(row2);
4592
4592
  }
4593
+ if (edit.text !== void 0) appendLineTextCells(shape, width);
4593
4594
  shape.appendChild(section3);
4595
+ if (edit.text !== void 0) {
4596
+ const text9 = root2.ownerDocument.createElementNS(root2.namespaceURI, "Text");
4597
+ text9.appendChild(root2.ownerDocument.createTextNode(encodeVisioPlainText(edit.text)));
4598
+ shape.appendChild(text9);
4599
+ }
4594
4600
  return shape;
4595
4601
  }
4602
+ function appendLineTextCells(shape, width) {
4603
+ const box6 = Math.max(0.5, Math.min(width, 1.2));
4604
+ const entries = [
4605
+ ["TxtPinX", width / 2, "Width*0.5"],
4606
+ ["TxtPinY", 0, "Height*0.5"],
4607
+ ["TxtWidth", box6],
4608
+ ["TxtHeight", 0.25],
4609
+ ["TxtLocPinX", box6 / 2, "TxtWidth*0.5"],
4610
+ ["TxtLocPinY", 0.125, "TxtHeight*0.5"],
4611
+ ["TxtAngle", 0, "-Angle"]
4612
+ ];
4613
+ for (const [name3, value3, formula2] of entries) setCell(shape, name3, value3, formula2);
4614
+ }
4596
4615
 
4597
4616
  // visio/path-fit.ts
4598
4617
  var finite = (point2) => Number.isFinite(point2.x) && Number.isFinite(point2.y);
@@ -7359,9 +7378,9 @@ function roundedRectanglePath(points2, rounding, point2) {
7359
7378
  const sweep = a2[0] * b[1] - a2[1] * b[0] > 0 ? 1 : 0;
7360
7379
  const start = after[0], commands = [`M ${point2(start[0], start[1])}`];
7361
7380
  for (let i = 1; i <= 4; i++) {
7362
- const entry3 = before[i % 4], exit2 = after[i % 4];
7381
+ const entry4 = before[i % 4], exit2 = after[i % 4];
7363
7382
  commands.push(
7364
- `L ${point2(entry3[0], entry3[1])}`,
7383
+ `L ${point2(entry4[0], entry4[1])}`,
7365
7384
  `A ${point2(radius, radius)} 0 0 ${sweep} ${point2(exit2[0], exit2[1])}`
7366
7385
  );
7367
7386
  }
@@ -7407,7 +7426,7 @@ function roundedOrthogonalPath(points2, radius, point2) {
7407
7426
  const radius2 = radii[i];
7408
7427
  if (!Number.isFinite(radius2) || radius2 < 1e-9) return void 0;
7409
7428
  const incoming = directions[i - 1], outgoing = directions[i];
7410
- const entry3 = [
7429
+ const entry4 = [
7411
7430
  vertex[0] - incoming[0] * radius2,
7412
7431
  vertex[1] - incoming[1] * radius2
7413
7432
  ];
@@ -7415,11 +7434,11 @@ function roundedOrthogonalPath(points2, radius, point2) {
7415
7434
  vertex[0] + outgoing[0] * radius2,
7416
7435
  vertex[1] + outgoing[1] * radius2
7417
7436
  ];
7418
- if (!entry3.every(Number.isFinite) || !exit2.every(Number.isFinite) || point2(...entry3) === point2(...vertex) || point2(...exit2) === point2(...vertex))
7437
+ if (!entry4.every(Number.isFinite) || !exit2.every(Number.isFinite) || point2(...entry4) === point2(...vertex) || point2(...exit2) === point2(...vertex))
7419
7438
  return void 0;
7420
7439
  const sweep = incoming[0] * outgoing[1] - incoming[1] * outgoing[0] > 0 ? 1 : 0;
7421
7440
  commands.push(
7422
- `L ${point2(...entry3)}`,
7441
+ `L ${point2(...entry4)}`,
7423
7442
  `A ${point2(radius2, radius2)} 0 0 ${sweep} ${point2(...exit2)}`
7424
7443
  );
7425
7444
  extraCommands++;
@@ -7735,13 +7754,17 @@ function effectiveNumber(cells4, name3, fallback) {
7735
7754
  fail("UNSUPPORTED_GEOMETRY_EDIT", `${name3} of the stencil shape is out of range.`);
7736
7755
  return value3;
7737
7756
  }
7738
- var sectionRows2 = (shape, name3) => children2(shape, "Section").filter((section3) => attribute2(section3, "N") === name3 && !deleted(section3)).flatMap((section3) => children2(section3, "Row"));
7757
+ var sectionRows2 = (shape, name3) => children2(shape, "Section").filter((section3) => attribute2(section3, "N") === name3 && !deleted(section3)).flatMap(
7758
+ (section3) => children2(section3, "Row").map((row2, position) => ({
7759
+ row: row2,
7760
+ index: attribute2(row2, "IX") === void 0 ? position : Number(attribute2(row2, "IX"))
7761
+ }))
7762
+ );
7739
7763
  function effectiveRows(shape, section3) {
7740
7764
  const rows = /* @__PURE__ */ new Map();
7741
7765
  const gone = /* @__PURE__ */ new Set();
7742
7766
  for (const source of [templates.get(shape), shape])
7743
- for (const row2 of sectionRows2(source, section3)) {
7744
- const index3 = Number(attribute2(row2, "IX") ?? "0");
7767
+ for (const { row: row2, index: index3 } of sectionRows2(source, section3)) {
7745
7768
  if (deleted(row2)) {
7746
7769
  gone.add(index3);
7747
7770
  continue;
@@ -8233,7 +8256,7 @@ var PASSIVE = /* @__PURE__ */ new Set([
8233
8256
  "Reviewer",
8234
8257
  "Annotation"
8235
8258
  ]);
8236
- var LENGTHS = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy)$/;
8259
+ var LENGTHS = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy|lineweight|imgoffsetx|imgoffsety|imgwidth|imgheight)$/;
8237
8260
  function expectedUnit(cell) {
8238
8261
  const unit4 = attribute2(cell.local, "U") ?? attribute2(cell.inherited, "U");
8239
8262
  if (unit4 === void 0 && cell.section && PASSIVE.has(cell.section.name)) return void 0;
@@ -8251,7 +8274,12 @@ function expectedUnit(cell) {
8251
8274
  return "length";
8252
8275
  return !cell.relative && /^(geometry\d+|connections|controls)\.[xy]\d+$/.test(name3) ? "length" : "scalar";
8253
8276
  }
8254
- function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__ */ new Map(), text9) {
8277
+ function untaggedLength(cell) {
8278
+ if (cell.section?.name !== "User") return void 0;
8279
+ const formula2 = effectiveFormula(cell);
8280
+ return formula2 && /^\s*[\d.]+\s*(?:MM|CM|IN|FT|M)/i.test(formula2) ? "length" : void 0;
8281
+ }
8282
+ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__ */ new Map(), text9, keepTextSize = false) {
8255
8283
  const scope2 = "sheets" in target2 ? target2 : singleScope(target2);
8256
8284
  const overrides = new Map(changed);
8257
8285
  const pinned = /* @__PURE__ */ new Map();
@@ -8273,11 +8301,11 @@ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__
8273
8301
  try {
8274
8302
  const ast = parseVisioFormula(source);
8275
8303
  const analysis = analyzeVisioFormula(ast);
8276
- const sized = text9 && analysis.dynamic ? textSizeFormula(ast) : void 0;
8304
+ const sized = analysis.dynamic && (text9 || keepTextSize) ? textSizeFormula(ast) : void 0;
8277
8305
  result2 = sized ? {
8278
8306
  ast,
8279
8307
  local,
8280
- text: true,
8308
+ ...text9 ? { text: true } : { deferText: true },
8281
8309
  references: sized.references.flatMap((ref) => found(ref.cell, ref.shapeId))
8282
8310
  } : analysis.dynamic ? { local, references: mentioned() } : {
8283
8311
  ast,
@@ -8323,22 +8351,42 @@ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__
8323
8351
  if (!node3 || node3.hasAttribute("E")) throw new Unevaluable();
8324
8352
  try {
8325
8353
  const value3 = visioFormulaCachedValue(attribute2(node3, "V") ?? "", attribute2(node3, "U"));
8326
- const unit4 = expectedUnit(cell);
8354
+ const unit4 = expectedUnit(cell) ?? untaggedLength(cell);
8327
8355
  return value3.unit === "scalar" && unit4 && unit4 !== "scalar" ? { ...value3, unit: unit4 } : value3;
8328
8356
  } catch {
8329
8357
  throw new Unevaluable();
8330
8358
  }
8331
8359
  };
8360
+ const tainted = /* @__PURE__ */ new Set();
8361
+ let sawDeferred = false;
8332
8362
  const evaluate = (cell) => {
8363
+ const outer = sawDeferred;
8364
+ sawDeferred = false;
8365
+ try {
8366
+ const result2 = evaluateCell(cell);
8367
+ if (sawDeferred) tainted.add(cell);
8368
+ return result2;
8369
+ } finally {
8370
+ sawDeferred = sawDeferred || outer;
8371
+ }
8372
+ };
8373
+ const evaluateCell = (cell) => {
8333
8374
  check();
8334
8375
  if (--steps < 0)
8335
8376
  fail("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
8336
8377
  const override = overrides.get(cell);
8337
8378
  if (override !== void 0) return { value: override, unit: expectedUnit(cell) ?? "scalar" };
8338
8379
  const known = values.get(cell);
8339
- if (known) return known;
8380
+ if (known) {
8381
+ if (tainted.has(cell)) sawDeferred = true;
8382
+ return known;
8383
+ }
8340
8384
  if (!isAffected(cell, /* @__PURE__ */ new Set())) return cached5(cell);
8341
8385
  const own = dependenciesOf(cell);
8386
+ if (own?.deferText) {
8387
+ sawDeferred = true;
8388
+ return cached5(cell);
8389
+ }
8342
8390
  const ast = own?.ast;
8343
8391
  if (!ast || evaluating.has(cell)) throw new Unevaluable();
8344
8392
  evaluating.add(cell);
@@ -8382,9 +8430,11 @@ function recalculateInstanceCaches(target2, changed, check, pins = /* @__PURE__
8382
8430
  let value3;
8383
8431
  let length;
8384
8432
  try {
8433
+ sawDeferred = false;
8385
8434
  const result2 = evaluate(cell);
8386
8435
  value3 = result2.value;
8387
8436
  length = result2.unit === "length";
8437
+ if (tainted.has(cell) && cell.section && PASSIVE.has(cell.section.name)) continue;
8388
8438
  } catch (error) {
8389
8439
  if (!(error instanceof Unevaluable)) throw error;
8390
8440
  if (cell.section && PASSIVE.has(cell.section.name)) continue;
@@ -9767,12 +9817,12 @@ function pathVertices(sheet, width, height, writes) {
9767
9817
  return refuse();
9768
9818
  }
9769
9819
  }
9770
- const entry3 = rows.get(item2.row) ?? { relative: item2.relative };
9771
- entry3[item2.name === "X" ? "x" : "y"] = number6;
9772
- rows.set(item2.row, entry3);
9820
+ const entry4 = rows.get(item2.row) ?? { relative: item2.relative };
9821
+ entry4[item2.name === "X" ? "x" : "y"] = number6;
9822
+ rows.set(item2.row, entry4);
9773
9823
  }
9774
- return [...rows.values()].filter((entry3) => entry3.x !== void 0 && entry3.y !== void 0).map(
9775
- (entry3) => entry3.relative ? { x: entry3.x * width, y: entry3.y * height } : { x: entry3.x, y: entry3.y }
9824
+ return [...rows.values()].filter((entry4) => entry4.x !== void 0 && entry4.y !== void 0).map(
9825
+ (entry4) => entry4.relative ? { x: entry4.x * width, y: entry4.y * height } : { x: entry4.x, y: entry4.y }
9776
9826
  );
9777
9827
  }
9778
9828
  function layoutStencilLine(root2, pageId2, shape, ends, check) {
@@ -10652,7 +10702,9 @@ async function applyInstanceGeometryEdit(roots2, edit, template, check) {
10652
10702
  scope2,
10653
10703
  overrides,
10654
10704
  check,
10655
- new Map(pins.map((item2) => [item2, item2 === cell("Width") ? width : height]))
10705
+ new Map(pins.map((item2) => [item2, item2 === cell("Width") ? width : height])),
10706
+ void 0,
10707
+ true
10656
10708
  );
10657
10709
  for (const [item2, value3] of pinned) {
10658
10710
  assertOverridable(item2, "The size");
@@ -11371,7 +11423,7 @@ var VISIO_BUILT_IN_THEMES = [
11371
11423
  )
11372
11424
  ];
11373
11425
  function visioBuiltInTheme(id4) {
11374
- return VISIO_BUILT_IN_THEMES.find((entry3) => entry3.id === id4);
11426
+ return VISIO_BUILT_IN_THEMES.find((entry4) => entry4.id === id4);
11375
11427
  }
11376
11428
  function visioThemeVariantColors(source, variant) {
11377
11429
  const accents = source.colors.slice(4, 10);
@@ -11427,8 +11479,8 @@ var VISIO_COMMENT_LIMIT = 1e4;
11427
11479
  var VISIO_COMMENT_TEXT_LIMIT = 16384;
11428
11480
  var VISIO_COMMENT_AUTHOR_LIMIT = 256;
11429
11481
  var unsigned = (value3) => value3 !== void 0 && /^(0|[1-9]\d{0,9})$/.test(value3) && Number(value3) <= 4294967295 ? value3 : void 0;
11430
- function visioCommentId(entry3, index3) {
11431
- return unsigned(attribute2(entry3, "CommentID")) ?? `n${index3}`;
11482
+ function visioCommentId(entry4, index3) {
11483
+ return unsigned(attribute2(entry4, "CommentID")) ?? `n${index3}`;
11432
11484
  }
11433
11485
  async function readVisioComments(pkg, documentPart2, report) {
11434
11486
  const path3 = await related(pkg, documentPart2, "comments", false);
@@ -11453,10 +11505,10 @@ async function readVisioComments(pkg, documentPart2, report) {
11453
11505
  const comments = [];
11454
11506
  const ids = /* @__PURE__ */ new Set();
11455
11507
  let characters = 0;
11456
- entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry3, index3) => {
11457
- const pageId2 = unsigned(attribute2(entry3, "PageID"));
11458
- const id4 = visioCommentId(entry3, index3);
11459
- const text9 = entry3.textContent ?? "";
11508
+ entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry4, index3) => {
11509
+ const pageId2 = unsigned(attribute2(entry4, "PageID"));
11510
+ const id4 = visioCommentId(entry4, index3);
11511
+ const text9 = entry4.textContent ?? "";
11460
11512
  characters += text9.length;
11461
11513
  if (pageId2 === void 0 || ids.has(id4) || characters > 1e6) {
11462
11514
  report(
@@ -11469,10 +11521,10 @@ async function readVisioComments(pkg, documentPart2, report) {
11469
11521
  return;
11470
11522
  }
11471
11523
  ids.add(id4);
11472
- const shapeId2 = unsigned(attribute2(entry3, "ShapeID"));
11473
- const author = authors.get(attribute2(entry3, "AuthorID") ?? "");
11474
- const date2 = attribute2(entry3, "Date");
11475
- const editDate = attribute2(entry3, "EditDate");
11524
+ const shapeId2 = unsigned(attribute2(entry4, "ShapeID"));
11525
+ const author = authors.get(attribute2(entry4, "AuthorID") ?? "");
11526
+ const date2 = attribute2(entry4, "Date");
11527
+ const editDate = attribute2(entry4, "EditDate");
11476
11528
  comments.push({
11477
11529
  id: id4,
11478
11530
  pageId: pageId2,
@@ -11482,7 +11534,7 @@ async function readVisioComments(pkg, documentPart2, report) {
11482
11534
  ...date2 ? { date: date2.slice(0, 64) } : {},
11483
11535
  ...editDate ? { editDate: editDate.slice(0, 64) } : {},
11484
11536
  text: text9.slice(0, VISIO_COMMENT_TEXT_LIMIT),
11485
- ...yes(attribute2(entry3, "Done")) ? { done: true } : {}
11537
+ ...yes(attribute2(entry4, "Done")) ? { done: true } : {}
11486
11538
  });
11487
11539
  });
11488
11540
  return comments;
@@ -14950,12 +15002,12 @@ function sigmaGradientStops(stops) {
14950
15002
  // color/hex-rgb.ts
14951
15003
  function parseArgbHex(hex2) {
14952
15004
  const clean6 = hex2.replace(/^#/, "");
14953
- const rgb6 = clean6.length === 8 ? clean6.slice(2) : clean6;
14954
- if (!/^[0-9a-fA-F]{6}$/.test(rgb6)) return void 0;
14955
- return [0, 2, 4].map((i) => parseInt(rgb6.slice(i, i + 2), 16));
15005
+ const rgb7 = clean6.length === 8 ? clean6.slice(2) : clean6;
15006
+ if (!/^[0-9a-fA-F]{6}$/.test(rgb7)) return void 0;
15007
+ return [0, 2, 4].map((i) => parseInt(rgb7.slice(i, i + 2), 16));
14956
15008
  }
14957
15009
  var clamp255 = (v) => Math.max(0, Math.min(255, v));
14958
- var rgbToUpperHex = (rgb6) => `#${rgb6.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
15010
+ var rgbToUpperHex = (rgb7) => `#${rgb7.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
14959
15011
 
14960
15012
  // color/theme-palette.ts
14961
15013
  function themePaletteVariantLuminance(variant) {
@@ -14964,9 +15016,9 @@ function themePaletteVariantLuminance(variant) {
14964
15016
  return variant.kind === "lighter" ? { lumMod, lumOff: fraction } : { lumMod };
14965
15017
  }
14966
15018
  function applyThemePaletteVariant(hex2, variant) {
14967
- const rgb6 = hexToRgbChannels(hex2);
14968
- if (!rgb6) return hex2;
14969
- const { h, s, l } = rgbToHsl(rgb6.r, rgb6.g, rgb6.b);
15019
+ const rgb7 = hexToRgbChannels(hex2);
15020
+ if (!rgb7) return hex2;
15021
+ const { h, s, l } = rgbToHsl(rgb7.r, rgb7.g, rgb7.b);
14970
15022
  const { lumMod, lumOff } = themePaletteVariantLuminance(variant);
14971
15023
  const next = hslToRgb(h, s, l * lumMod + (lumOff ?? 0), (value3) => Math.floor(value3 + 1e-6));
14972
15024
  return `#${toHex(next.r)}${toHex(next.g)}${toHex(next.b)}`.toLowerCase();
@@ -15164,10 +15216,10 @@ var APPLIED = /* @__PURE__ */ new Set([
15164
15216
  ]);
15165
15217
  function resolveDrawingColor(color2, theme2, options2) {
15166
15218
  const base2 = baseHex(color2, theme2);
15167
- const rgb6 = base2 ? hexToRgbChannels(base2) : null;
15168
- if (!rgb6) return void 0;
15219
+ const rgb7 = base2 ? hexToRgbChannels(base2) : null;
15220
+ if (!rgb7) return void 0;
15169
15221
  if (options2?.transformOrder === "document") {
15170
- const value3 = orderedColorTransforms(rgb6, color2.transforms);
15222
+ const value3 = orderedColorTransforms(rgb7, color2.transforms);
15171
15223
  const round6 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
15172
15224
  return {
15173
15225
  hex: `#${toHex(round6(value3.r))}${toHex(round6(value3.g))}${toHex(round6(value3.b))}`,
@@ -15177,9 +15229,9 @@ function resolveDrawingColor(color2, theme2, options2) {
15177
15229
  )
15178
15230
  };
15179
15231
  }
15180
- let { r, g, b } = rgb6;
15181
- const find = (name3) => color2.transforms.find((entry3) => entry3.name === name3)?.value;
15182
- const has = (name3) => color2.transforms.some((entry3) => entry3.name === name3);
15232
+ let { r, g, b } = rgb7;
15233
+ const find = (name3) => color2.transforms.find((entry4) => entry4.name === name3)?.value;
15234
+ const has = (name3) => color2.transforms.some((entry4) => entry4.name === name3);
15183
15235
  if (has("comp")) {
15184
15236
  const hsl = rgbToHsl(r, g, b);
15185
15237
  ({ r, g, b } = hslToRgb((hsl.h + 180) % 360, hsl.s, hsl.l));
@@ -15230,7 +15282,7 @@ function resolveDrawingColor(color2, theme2, options2) {
15230
15282
  return {
15231
15283
  hex: `#${toHex(r)}${toHex(g)}${toHex(b)}`,
15232
15284
  alpha,
15233
- unapplied: [...new Set(color2.transforms.map((entry3) => entry3.name))].filter(
15285
+ unapplied: [...new Set(color2.transforms.map((entry4) => entry4.name))].filter(
15234
15286
  (name3) => !APPLIED.has(name3)
15235
15287
  )
15236
15288
  };
@@ -16719,8 +16771,8 @@ function sortKeys(value3) {
16719
16771
  if (value3 && typeof value3 === "object") {
16720
16772
  const out = {};
16721
16773
  for (const key2 of Object.keys(value3).sort()) {
16722
- const entry3 = value3[key2];
16723
- if (entry3 !== void 0) out[key2] = sortKeys(entry3);
16774
+ const entry4 = value3[key2];
16775
+ if (entry4 !== void 0) out[key2] = sortKeys(entry4);
16724
16776
  }
16725
16777
  return out;
16726
16778
  }
@@ -17932,10 +17984,10 @@ function hls240ToRgb({ h, l, s }) {
17932
17984
  var parseHex = parseArgbHex;
17933
17985
  var toHexColor = rgbToUpperHex;
17934
17986
  function applyTint(hex2, tint) {
17935
- const rgb6 = parseHex(hex2) ?? [0, 0, 0];
17936
- if (!tint) return toHexColor(rgb6);
17987
+ const rgb7 = parseHex(hex2) ?? [0, 0, 0];
17988
+ if (!tint) return toHexColor(rgb7);
17937
17989
  const t = Math.max(-1, Math.min(1, tint));
17938
- const hls = rgbToHls240(...rgb6);
17990
+ const hls = rgbToHls240(...rgb7);
17939
17991
  const l = t < 0 ? Math.trunc(hls.l * (1 + t)) : Math.round(hls.l * (1 - t) + HLSMAX * t);
17940
17992
  return toHexColor(hls240ToRgb({ ...hls, l: Math.max(0, Math.min(HLSMAX, l)) }));
17941
17993
  }
@@ -18851,7 +18903,7 @@ function countDerived(pivot) {
18851
18903
  }
18852
18904
  var pivotAxisFieldNames = (pivot) => [
18853
18905
  ...pivot.fields,
18854
- ...derivedDateFields(pivot).filter((entry3) => !pivot.fields.includes(entry3.name)).map((entry3) => entry3.name)
18906
+ ...derivedDateFields(pivot).filter((entry4) => !pivot.fields.includes(entry4.name)).map((entry4) => entry4.name)
18855
18907
  ];
18856
18908
  function resolveDateGroups(pivot) {
18857
18909
  return (pivot.dateGroups ?? []).map((group2) => {
@@ -18862,11 +18914,11 @@ function resolveDateGroups(pivot) {
18862
18914
  });
18863
18915
  }
18864
18916
  function derivedDateLabels(pivot, name3) {
18865
- const entry3 = derivedDateFields(pivot).find((candidate) => candidate.name === name3);
18866
- if (!entry3) return void 0;
18867
- const [group2] = resolveDateGroups({ ...pivot, dateGroups: [entry3.group] });
18917
+ const entry4 = derivedDateFields(pivot).find((candidate) => candidate.name === name3);
18918
+ if (!entry4) return void 0;
18919
+ const [group2] = resolveDateGroups({ ...pivot, dateGroups: [entry4.group] });
18868
18920
  const range2 = { start: group2.start, end: group2.end };
18869
- return dateUnitLabels(entry3.unit, range2, dateGroupDays(group2), pivot.date1904 ?? false, group2);
18921
+ return dateUnitLabels(entry4.unit, range2, dateGroupDays(group2), pivot.date1904 ?? false, group2);
18870
18922
  }
18871
18923
  function validateDateGroups(pivot) {
18872
18924
  const groups = pivot.dateGroups;
@@ -18902,19 +18954,19 @@ function expandDateGroups(pivot) {
18902
18954
  const resolved = { ...pivot, dateGroups: groups };
18903
18955
  const derived = derivedDateFields(resolved);
18904
18956
  const date1904 = pivot.date1904 ?? false;
18905
- const tables = derived.map((entry3) => {
18906
- const range2 = { start: entry3.group.start, end: entry3.group.end };
18907
- const days = dateGroupDays(entry3.group);
18908
- const labels = dateUnitLabels(entry3.unit, range2, days, date1904, entry3.group);
18957
+ const tables = derived.map((entry4) => {
18958
+ const range2 = { start: entry4.group.start, end: entry4.group.end };
18959
+ const days = dateGroupDays(entry4.group);
18960
+ const labels = dateUnitLabels(entry4.unit, range2, days, date1904, entry4.group);
18909
18961
  return {
18910
- base: pivot.fields.indexOf(entry3.group.field),
18962
+ base: pivot.fields.indexOf(entry4.group.field),
18911
18963
  labels,
18912
- index: (serial) => dateUnitIndex(entry3.unit, range2, days, date1904, serial, labels.length)
18964
+ index: (serial) => dateUnitIndex(entry4.unit, range2, days, date1904, serial, labels.length)
18913
18965
  };
18914
18966
  });
18915
18967
  return {
18916
18968
  ...resolved,
18917
- fields: [...pivot.fields, ...derived.map((entry3) => entry3.name)],
18969
+ fields: [...pivot.fields, ...derived.map((entry4) => entry4.name)],
18918
18970
  records: pivot.records.map((record2) => [
18919
18971
  ...record2,
18920
18972
  ...tables.map((table2) => {
@@ -18959,7 +19011,7 @@ function validateFieldGroups(pivot) {
18959
19011
  if (!group2 || typeof group2 !== "object" || index3 < 0 || seen.has(group2.field) || ![group2.start, group2.end, group2.by].every(Number.isInteger) || group2.by < 1 || group2.start >= group2.end || groupBucketCount(group2) > MAX_BUCKETS)
18960
19012
  throw new Error("Choose a valid number group.");
18961
19013
  seen.add(group2.field);
18962
- if (pivot.pageFilter?.field === group2.field || pivot.valueField === group2.field || (pivot.additionalValues ?? []).some((measure3) => measure3.field === group2.field) || (pivot.dateFields ?? []).includes(group2.field) || (pivot.itemFilters ?? []).some((filter) => filter.field === group2.field))
19014
+ if (pivot.pageFilter?.field === group2.field || pivot.valueField === group2.field || (pivot.additionalValues ?? []).some((measure4) => measure4.field === group2.field) || (pivot.dateFields ?? []).includes(group2.field) || (pivot.itemFilters ?? []).some((filter) => filter.field === group2.field))
18963
19015
  throw new Error("A grouped field cannot also be a filter, date field or value field.");
18964
19016
  for (const record2 of pivot.records) {
18965
19017
  const value3 = record2[index3];
@@ -19024,8 +19076,8 @@ var PIVOT_SUBTOTAL_ORDER = [
19024
19076
  "varp"
19025
19077
  ];
19026
19078
  function fieldSubtotalFunctions(pivot, field3) {
19027
- const entry3 = pivot.fieldSubtotals?.find((item2) => item2.field === field3);
19028
- if (entry3) return PIVOT_SUBTOTAL_ORDER.filter((fn) => entry3.functions.includes(fn));
19079
+ const entry4 = pivot.fieldSubtotals?.find((item2) => item2.field === field3);
19080
+ if (entry4) return PIVOT_SUBTOTAL_ORDER.filter((fn) => entry4.functions.includes(fn));
19029
19081
  return field3 === pivot.rowField && pivot.subtotals === false ? [] : "auto";
19030
19082
  }
19031
19083
  function validateFieldSubtotals(pivot, axisFields) {
@@ -19033,22 +19085,22 @@ function validateFieldSubtotals(pivot, axisFields) {
19033
19085
  if (entries === void 0) return;
19034
19086
  if (!Array.isArray(entries)) throw new Error("Choose valid field subtotals.");
19035
19087
  const seen = /* @__PURE__ */ new Set();
19036
- for (const entry3 of entries) {
19037
- if (!entry3 || typeof entry3 !== "object" || !axisFields.includes(entry3.field) || seen.has(entry3.field) || !Array.isArray(entry3.functions) || entry3.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry3.functions).size !== entry3.functions.length)
19088
+ for (const entry4 of entries) {
19089
+ if (!entry4 || typeof entry4 !== "object" || !axisFields.includes(entry4.field) || seen.has(entry4.field) || !Array.isArray(entry4.functions) || entry4.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry4.functions).size !== entry4.functions.length)
19038
19090
  throw new Error("Choose valid field subtotals.");
19039
- seen.add(entry3.field);
19091
+ seen.add(entry4.field);
19040
19092
  }
19041
19093
  }
19042
19094
 
19043
19095
  // xlsx/pivot/item-filters.ts
19044
19096
  function applyPivotItemFilters(pivot) {
19045
- const active = (pivot.itemFilters ?? []).filter((entry3) => entry3.hidden.length);
19097
+ const active = (pivot.itemFilters ?? []).filter((entry4) => entry4.hidden.length);
19046
19098
  const range2 = pivot.dateFilter;
19047
19099
  if (!active.length && !range2) return pivot;
19048
19100
  const dateIndex = range2 ? pivot.fields.indexOf(range2.field) : -1;
19049
- const tests = active.map((entry3) => ({
19050
- index: pivot.fields.indexOf(entry3.field),
19051
- hidden: new Set(entry3.hidden.map(pivotValueKey))
19101
+ const tests = active.map((entry4) => ({
19102
+ index: pivot.fields.indexOf(entry4.field),
19103
+ hidden: new Set(entry4.hidden.map(pivotValueKey))
19052
19104
  }));
19053
19105
  return {
19054
19106
  ...pivot,
@@ -19091,7 +19143,7 @@ function validatePivotItemFilters(pivot) {
19091
19143
  var keyOf = (field3, item2) => `${field3}\0${pivotValueKey(item2)}`;
19092
19144
  function pivotItemLabeler(pivot) {
19093
19145
  const blank = pivotCaptions(pivot).blank;
19094
- const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry3) => [keyOf(entry3.field, entry3.item), entry3.name])) : void 0;
19146
+ const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry4) => [keyOf(entry4.field, entry4.item), entry4.name])) : void 0;
19095
19147
  return (field3, value3) => names?.get(keyOf(field3, value3)) ?? (value3 === null || value3 === "" ? blank : pivotItemLabel(value3));
19096
19148
  }
19097
19149
 
@@ -19259,9 +19311,9 @@ function validatePivotFields(pivot) {
19259
19311
  if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
19260
19312
  throw new Error("This PivotTable uses unsupported Values header captions.");
19261
19313
  if (!Array.isArray(extras) || extras.length > 15 || extras.some(
19262
- (measure3) => !measure3 || !pivot.fields.includes(measure3.field) || !PIVOT_AGGREGATES.includes(measure3.aggregate) || typeof measure3.caption !== "string" || !measure3.caption.trim() || measure3.caption.length > 255 || pivot.fields.some((field3) => field3.toLowerCase() === measure3.caption.toLowerCase())
19314
+ (measure4) => !measure4 || !pivot.fields.includes(measure4.field) || !PIVOT_AGGREGATES.includes(measure4.aggregate) || typeof measure4.caption !== "string" || !measure4.caption.trim() || measure4.caption.length > 255 || pivot.fields.some((field3) => field3.toLowerCase() === measure4.caption.toLowerCase())
19263
19315
  ) || new Set(
19264
- [pivot.valueCaption, ...extras.map((measure3) => measure3.caption)].map(
19316
+ [pivot.valueCaption, ...extras.map((measure4) => measure4.caption)].map(
19265
19317
  (caption) => caption?.toLowerCase()
19266
19318
  )
19267
19319
  ).size !== extras.length + 1)
@@ -19302,7 +19354,7 @@ function aggregateValues(records2, field3, type) {
19302
19354
  const sum = numbers.reduce((total, value3) => total + value3, 0);
19303
19355
  return type === "average" ? sum / numbers.length : sum;
19304
19356
  }
19305
- var pivotMeasureNumber = (pivot, records2, measure3) => aggregateValues(records2, pivot.fields.indexOf(measure3.field), measure3.aggregate);
19357
+ var pivotMeasureNumber = (pivot, records2, measure4) => aggregateValues(records2, pivot.fields.indexOf(measure4.field), measure4.aggregate);
19306
19358
 
19307
19359
  // xlsx/pivot/columns.ts
19308
19360
  var SEPARATOR = "";
@@ -19339,17 +19391,17 @@ function pivotColumnEntries(pivot) {
19339
19391
  values: [...values, child3[1].value],
19340
19392
  keys: [...keys, child3[0]]
19341
19393
  };
19342
- const entry3 = {
19394
+ const entry4 = {
19343
19395
  path: here.path,
19344
19396
  key: columnKey(here.keys, here.keys.length),
19345
19397
  values: here.values
19346
19398
  };
19347
- if (level3 === names.length - 1) entries.push({ kind: "leaf", ...entry3 });
19399
+ if (level3 === names.length - 1) entries.push({ kind: "leaf", ...entry4 });
19348
19400
  else {
19349
19401
  visit(child3[1], level3 + 1, here.path, here.values, here.keys);
19350
19402
  const own = functions[level3];
19351
- if (own === "auto") entries.push({ kind: "subtotal", ...entry3 });
19352
- else for (const fn of own) entries.push({ kind: "subtotal", ...entry3, fn });
19403
+ if (own === "auto") entries.push({ kind: "subtotal", ...entry4 });
19404
+ else for (const fn of own) entries.push({ kind: "subtotal", ...entry4, fn });
19353
19405
  }
19354
19406
  }
19355
19407
  };
@@ -19372,7 +19424,7 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
19372
19424
  const levels = columns.names.length;
19373
19425
  if (!levels)
19374
19426
  return [
19375
- [...rowLabels, ...valuesOnRows ? [null] : measures2.map((measure3) => measure3.caption)]
19427
+ [...rowLabels, ...valuesOnRows ? [null] : measures2.map((measure4) => measure4.caption)]
19376
19428
  ];
19377
19429
  const compact = pivot.layout === "compact";
19378
19430
  const labelColumns = rowLabels.length;
@@ -19390,22 +19442,22 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
19390
19442
  grid[rows - 1][i] = text9;
19391
19443
  });
19392
19444
  let previous = [];
19393
- columns.entries.forEach((entry3, j) => {
19445
+ columns.entries.forEach((entry4, j) => {
19394
19446
  const at3 = labelColumns + j * count;
19395
- if (entry3.kind === "leaf") {
19396
- entry3.path.forEach((_index, level3) => {
19397
- const continued = entry3.path.slice(0, level3 + 1).every((p, i) => p === previous[i]);
19398
- if (!continued) grid[1 + level3][at3] = labelOf(columns.names[level3], entry3.values[level3]);
19447
+ if (entry4.kind === "leaf") {
19448
+ entry4.path.forEach((_index, level3) => {
19449
+ const continued = entry4.path.slice(0, level3 + 1).every((p, i) => p === previous[i]);
19450
+ if (!continued) grid[1 + level3][at3] = labelOf(columns.names[level3], entry4.values[level3]);
19399
19451
  });
19400
- previous = entry3.path;
19401
- if (count > 1) measures2.forEach((measure3, m) => grid[rows - 1][at3 + m] = measure3.caption);
19452
+ previous = entry4.path;
19453
+ if (count > 1) measures2.forEach((measure4, m) => grid[rows - 1][at3 + m] = measure4.caption);
19402
19454
  return;
19403
19455
  }
19404
- const row2 = entry3.kind === "grand" ? 1 : entry3.path.length;
19405
- const name3 = entry3.kind === "grand" ? "" : String(labelOf(columns.names[entry3.path.length - 1], entry3.values.at(-1)));
19406
- measures2.forEach((measure3, m) => {
19407
- const custom = entry3.fn ? caps.functions[entry3.fn] : void 0;
19408
- grid[row2][at3 + m] = custom ? count === 1 ? `${name3} ${custom}` : `${name3} ${custom} of ${measure3.field}` : count === 1 ? entry3.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name3) : entry3.kind === "grand" ? fillCaption(caps.measureTotal, measure3.caption) : `${name3} ${measure3.caption}`;
19456
+ const row2 = entry4.kind === "grand" ? 1 : entry4.path.length;
19457
+ const name3 = entry4.kind === "grand" ? "" : String(labelOf(columns.names[entry4.path.length - 1], entry4.values.at(-1)));
19458
+ measures2.forEach((measure4, m) => {
19459
+ const custom = entry4.fn ? caps.functions[entry4.fn] : void 0;
19460
+ grid[row2][at3 + m] = custom ? count === 1 ? `${name3} ${custom}` : `${name3} ${custom} of ${measure4.field}` : count === 1 ? entry4.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name3) : entry4.kind === "grand" ? fillCaption(caps.measureTotal, measure4.caption) : `${name3} ${measure4.caption}`;
19409
19461
  });
19410
19462
  });
19411
19463
  return grid;
@@ -19477,11 +19529,11 @@ function nestedPivotGrid(pivot) {
19477
19529
  let rowCount = 0;
19478
19530
  const width = dimensions3.width - labelColumns;
19479
19531
  const blanks = () => Array(width).fill(null);
19480
- const cells4 = (group2, rowFn, measure3) => columns.entries.flatMap((entry3) => {
19481
- const records2 = entry3.kind === "grand" ? group2.records : group2.columns.get(entry3.key) ?? [];
19482
- const picked = measure3 === void 0 ? measures2 : [measures2[measure3]];
19483
- if (rowFn && entry3.fn && rowFn !== entry3.fn) return picked.map(() => null);
19484
- const fn = rowFn ?? entry3.fn;
19532
+ const cells4 = (group2, rowFn, measure4) => columns.entries.flatMap((entry4) => {
19533
+ const records2 = entry4.kind === "grand" ? group2.records : group2.columns.get(entry4.key) ?? [];
19534
+ const picked = measure4 === void 0 ? measures2 : [measures2[measure4]];
19535
+ if (rowFn && entry4.fn && rowFn !== entry4.fn) return picked.map(() => null);
19536
+ const fn = rowFn ?? entry4.fn;
19485
19537
  return picked.map(
19486
19538
  (one) => fn ? aggregateValues(records2, pivot.fields.indexOf(one.field), fn) : pivotMeasureNumber(pivot, records2, one)
19487
19539
  );
@@ -19501,17 +19553,17 @@ function nestedPivotGrid(pivot) {
19501
19553
  throw new Error("The PivotTable result is too large.");
19502
19554
  return;
19503
19555
  }
19504
- const [cells5, numbers, entry3] = build2();
19556
+ const [cells5, numbers, entry4] = build2();
19505
19557
  values.push([...cells5, ...numbers]);
19506
- rowEntries.push(entry3);
19558
+ rowEntries.push(entry4);
19507
19559
  indents.push(compact ? indent : 0);
19508
19560
  };
19509
- const entryOf = (indices, measure3, type) => ({
19561
+ const entryOf = (indices, measure4, type) => ({
19510
19562
  indices,
19511
- ...measure3 !== void 0 ? { measure: measure3 } : {},
19563
+ ...measure4 !== void 0 ? { measure: measure4 } : {},
19512
19564
  ...type ? { type } : {}
19513
19565
  });
19514
- const walk = (level3, group2, measure3, path3) => {
19566
+ const walk = (level3, group2, measure4, path3) => {
19515
19567
  const field3 = fieldOf(level3);
19516
19568
  const last = level3 === levels - 1;
19517
19569
  const repeated = Array.from(
@@ -19556,16 +19608,16 @@ function nestedPivotGrid(pivot) {
19556
19608
  if (last)
19557
19609
  return push(level3, () => [
19558
19610
  labelCells(path3, leafShown(here.firsts), level3, text9),
19559
- cells4(child3, void 0, measure3),
19560
- entryOf(here.indices, measure3)
19611
+ cells4(child3, void 0, measure4),
19612
+ entryOf(here.indices, measure4)
19561
19613
  ]);
19562
19614
  if (!tabular)
19563
19615
  push(level3, () => [
19564
19616
  labelCells(path3, repeated, level3, text9),
19565
- showsValue ? cells4(child3, void 0, measure3) : blanks(),
19566
- entryOf(here.indices, measure3)
19617
+ showsValue ? cells4(child3, void 0, measure4) : blanks(),
19618
+ entryOf(here.indices, measure4)
19567
19619
  ]);
19568
- walk(level3 + 1, child3, measure3, here);
19620
+ walk(level3 + 1, child3, measure4, here);
19569
19621
  if (field3 === depth - 1) return;
19570
19622
  const caption = String(text9);
19571
19623
  const subtotal = (title, fn, one) => push(level3, () => [
@@ -19575,21 +19627,21 @@ function nestedPivotGrid(pivot) {
19575
19627
  ]);
19576
19628
  if (own === "auto") {
19577
19629
  if (showsValue) return;
19578
- if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure3);
19630
+ if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure4);
19579
19631
  else measures2.forEach((one, m) => subtotal(`${caption} ${one.caption}`, void 0, m));
19580
19632
  } else
19581
19633
  for (const fn of own)
19582
- if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure3);
19634
+ if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure4);
19583
19635
  else
19584
19636
  measures2.forEach(
19585
19637
  (one, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one.field}`, fn, m)
19586
19638
  );
19587
19639
  });
19588
19640
  };
19589
- const grand = (text9, measure3) => push(0, () => [
19641
+ const grand = (text9, measure4) => push(0, () => [
19590
19642
  compact ? [text9] : [text9, ...Array(levels - 1).fill(null)],
19591
- cells4(root2, void 0, measure3),
19592
- entryOf([0], measure3, "grand")
19643
+ cells4(root2, void 0, measure4),
19644
+ entryOf([0], measure4, "grand")
19593
19645
  ]);
19594
19646
  const build = () => {
19595
19647
  walk(0, root2, void 0, { labels: [], indices: [], firsts: [] });
@@ -19796,8 +19848,8 @@ function isSafePartName(name3) {
19796
19848
  if (body.startsWith("/")) return false;
19797
19849
  return !body.split("/").some((segment) => segment === "..");
19798
19850
  }
19799
- function declaredEntrySize(entry3) {
19800
- const data = entry3._data;
19851
+ function declaredEntrySize(entry4) {
19852
+ const data = entry4._data;
19801
19853
  const size3 = Number(data?.uncompressedSize ?? 0);
19802
19854
  return Number.isFinite(size3) && size3 > 0 ? size3 : 0;
19803
19855
  }
@@ -19811,10 +19863,10 @@ function resolveLimits(limits) {
19811
19863
  fail: (message, limit2, kind, actual) => create3 ? create3(message, { limit: limit2, kind, actual }) : new ZipLimitError(message, { limit: limit2, kind, actual })
19812
19864
  };
19813
19865
  }
19814
- async function inflateEntryGuarded(entry3, alreadyRead, limits) {
19866
+ async function inflateEntryGuarded(entry4, alreadyRead, limits) {
19815
19867
  const chunks = [];
19816
19868
  let size3 = 0;
19817
- for await (const chunk of streamEntryGuarded(entry3, alreadyRead, limits)) {
19869
+ for await (const chunk of streamEntryGuarded(entry4, alreadyRead, limits)) {
19818
19870
  chunks.push(chunk);
19819
19871
  size3 += chunk.byteLength;
19820
19872
  }
@@ -19828,10 +19880,10 @@ async function inflateEntryGuarded(entry3, alreadyRead, limits) {
19828
19880
  return out;
19829
19881
  }
19830
19882
  var AHEAD = 8;
19831
- async function* streamEntryGuarded(entry3, alreadyRead, limits) {
19883
+ async function* streamEntryGuarded(entry4, alreadyRead, limits) {
19832
19884
  const r = resolveLimits(limits);
19833
- const declared = declaredEntrySize(entry3);
19834
- const stream = entry3.internalStream("uint8array");
19885
+ const declared = declaredEntrySize(entry4);
19886
+ const stream = entry4.internalStream("uint8array");
19835
19887
  const queue = [];
19836
19888
  let size3 = 0;
19837
19889
  let ended = false;
@@ -19861,7 +19913,7 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
19861
19913
  if (size3 > declared || size3 > r.maxEntryBytes)
19862
19914
  return fail3(
19863
19915
  r.fail(
19864
- `${r.label} part ${entry3.name} inflates past its declared size`,
19916
+ `${r.label} part ${entry4.name} inflates past its declared size`,
19865
19917
  r.maxEntryBytes,
19866
19918
  size3 > declared ? "declaredSize" : "maxEntryBytes",
19867
19919
  size3
@@ -19924,15 +19976,15 @@ function guardZip(zip, limits = {}) {
19924
19976
  entries.length
19925
19977
  );
19926
19978
  let declared = 0;
19927
- for (const entry3 of entries) {
19928
- const original = entry3.unsafeOriginalName;
19929
- if (!isSafePartName(entry3.name) || original !== void 0 && !isSafePartName(original))
19979
+ for (const entry4 of entries) {
19980
+ const original = entry4.unsafeOriginalName;
19981
+ if (!isSafePartName(entry4.name) || original !== void 0 && !isSafePartName(original))
19930
19982
  throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
19931
- if (entry3.dir) continue;
19932
- const size3 = declaredEntrySize(entry3);
19983
+ if (entry4.dir) continue;
19984
+ const size3 = declaredEntrySize(entry4);
19933
19985
  if (size3 > r.maxEntryBytes)
19934
19986
  throw r.fail(
19935
- `${r.label} part ${entry3.name} exceeds the uncompressed part size limit`,
19987
+ `${r.label} part ${entry4.name} exceeds the uncompressed part size limit`,
19936
19988
  r.maxEntryBytes,
19937
19989
  "maxEntryBytes",
19938
19990
  size3
@@ -19948,15 +20000,15 @@ function guardZip(zip, limits = {}) {
19948
20000
  );
19949
20001
  const produced = /* @__PURE__ */ new Map();
19950
20002
  let total = 0;
19951
- for (const entry3 of entries) {
19952
- if (entry3.dir) continue;
19953
- const inflateOriginal = entry3.async.bind(entry3);
19954
- entry3.async = async (type, onUpdate) => {
19955
- const previous = produced.get(entry3.name) ?? 0;
19956
- const bytes = await inflateEntryGuarded(entry3, total - previous, limits);
20003
+ for (const entry4 of entries) {
20004
+ if (entry4.dir) continue;
20005
+ const inflateOriginal = entry4.async.bind(entry4);
20006
+ entry4.async = async (type, onUpdate) => {
20007
+ const previous = produced.get(entry4.name) ?? 0;
20008
+ const bytes = await inflateEntryGuarded(entry4, total - previous, limits);
19957
20009
  if (bytes.byteLength > previous) {
19958
20010
  total += bytes.byteLength - previous;
19959
- produced.set(entry3.name, bytes.byteLength);
20011
+ produced.set(entry4.name, bytes.byteLength);
19960
20012
  }
19961
20013
  switch (type) {
19962
20014
  case "uint8array":
@@ -20534,15 +20586,15 @@ function readPivotCaptionAttributes(root2) {
20534
20586
  }
20535
20587
  function aggregateCaptionsOf(pivot) {
20536
20588
  const out = {};
20537
- for (const measure3 of [
20589
+ for (const measure4 of [
20538
20590
  { field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
20539
20591
  ...pivot.additionalValues ?? []
20540
20592
  ]) {
20541
- const at3 = measure3.caption.indexOf(measure3.field);
20542
- if (at3 < 0 || measure3.caption === measure3.field) continue;
20543
- const template = `${measure3.caption.slice(0, at3)}{0}${measure3.caption.slice(at3 + measure3.field.length)}`;
20544
- if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure3.aggregate])
20545
- out[measure3.aggregate] = template;
20593
+ const at3 = measure4.caption.indexOf(measure4.field);
20594
+ if (at3 < 0 || measure4.caption === measure4.field) continue;
20595
+ const template = `${measure4.caption.slice(0, at3)}{0}${measure4.caption.slice(at3 + measure4.field.length)}`;
20596
+ if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure4.aggregate])
20597
+ out[measure4.aggregate] = template;
20546
20598
  }
20547
20599
  return Object.keys(out).length ? out : void 0;
20548
20600
  }
@@ -20925,17 +20977,17 @@ function settleSlicers(workbook, warn) {
20925
20977
  const book = workbook.slicers;
20926
20978
  if (!book) return;
20927
20979
  const pivotAt = (tabId, name3) => {
20928
- const sheet = workbook.sheets.find((entry3) => entry3.sheetId === tabId);
20929
- const pivot = sheet?.pivotTables?.find((entry3) => entry3.name === name3);
20980
+ const sheet = workbook.sheets.find((entry4) => entry4.sheetId === tabId);
20981
+ const pivot = sheet?.pivotTables?.find((entry4) => entry4.name === name3);
20930
20982
  return sheet && pivot ? { sheet, pivot } : void 0;
20931
20983
  };
20932
20984
  const good = (cache2) => {
20933
20985
  if (cache2.source.kind === "table") {
20934
20986
  const { tableId, column } = cache2.source;
20935
20987
  for (const sheet of workbook.sheets) {
20936
- const table2 = sheet.tables.find((entry3) => entry3.id === tableId);
20988
+ const table2 = sheet.tables.find((entry4) => entry4.id === tableId);
20937
20989
  if (table2)
20938
- return table2.headerRow && !table2.filterNotModeled && table2.columns.some((entry3) => entry3.sourceId === column);
20990
+ return table2.headerRow && !table2.filterNotModeled && table2.columns.some((entry4) => entry4.sourceId === column);
20939
20991
  }
20940
20992
  return false;
20941
20993
  }
@@ -21104,13 +21156,13 @@ function readDateGroups(fields2, count, names, dateFields, records2, date1904) {
21104
21156
  for (const [base2, list3] of members3) {
21105
21157
  const field3 = names[base2] ?? "";
21106
21158
  const parent = first(fields2[base2], "fieldGroup", NS.x);
21107
- const units3 = list3.map((entry3) => entry3.unit);
21159
+ const units3 = list3.map((entry4) => entry4.unit);
21108
21160
  if (!dateFields.includes(field3) || Number(att(parent, "par")) !== list3.at(-1).index || units3.some(
21109
21161
  (unit4, i) => i > 0 && PIVOT_DATE_UNITS.indexOf(unit4) <= PIVOT_DATE_UNITS.indexOf(units3[i - 1])
21110
21162
  ))
21111
21163
  throw unsupported4("group parent");
21112
21164
  const ranges = list3.map(
21113
- (entry3) => first(first(entry3.node, "fieldGroup", NS.x), "rangePr", NS.x)
21165
+ (entry4) => first(first(entry4.node, "fieldGroup", NS.x), "rangePr", NS.x)
21114
21166
  );
21115
21167
  const sample = ranges[0];
21116
21168
  const autoStart = att(sample, "autoStart") !== "0";
@@ -21138,15 +21190,15 @@ function readDateGroups(fields2, count, names, dateFields, records2, date1904) {
21138
21190
  if (!close2(expected.start, start) || !close2(expected.end, end))
21139
21191
  throw unsupported4("stale range");
21140
21192
  const localized = {};
21141
- for (const entry3 of list3) {
21142
- const labels = englishDateUnitLabels(entry3.unit, expected, dateGroupDays(group2), date1904);
21143
- const node3 = first(first(entry3.node, "fieldGroup", NS.x), "groupItems", NS.x);
21193
+ for (const entry4 of list3) {
21194
+ const labels = englishDateUnitLabels(entry4.unit, expected, dateGroupDays(group2), date1904);
21195
+ const node3 = first(first(entry4.node, "fieldGroup", NS.x), "groupItems", NS.x);
21144
21196
  const actual = children(node3, "s", NS.x).map((item2) => decodeEscapes(att(item2, "v") ?? ""));
21145
- const name3 = decodeEscapes(att(entry3.node, "name") ?? "");
21197
+ const name3 = decodeEscapes(att(entry4.node, "name") ?? "");
21146
21198
  if (!name3 || elements(node3).length !== actual.length || actual.length !== labels.length || actual.some((label2) => !label2) || new Set(actual).size !== actual.length)
21147
21199
  throw unsupported4("group items");
21148
- if (name3 !== dateGroupFieldName(entry3.unit, field3) || actual.some((l, i) => l !== labels[i]))
21149
- localized[entry3.unit] = { name: name3, labels: actual };
21200
+ if (name3 !== dateGroupFieldName(entry4.unit, field3) || actual.some((l, i) => l !== labels[i]))
21201
+ localized[entry4.unit] = { name: name3, labels: actual };
21150
21202
  }
21151
21203
  groups.push(Object.keys(localized).length ? { ...group2, localized } : group2);
21152
21204
  }
@@ -21223,9 +21275,9 @@ function readItemNames(tableFields, names, shared) {
21223
21275
  // xlsx/pivot/values-axis.ts
21224
21276
  function remapPivotRowEntries(entries, axes) {
21225
21277
  return entries.map(
21226
- (entry3) => entry3.type === "grand" ? entry3 : {
21227
- ...entry3,
21228
- indices: entry3.indices.map((item2, axis) => {
21278
+ (entry4) => entry4.type === "grand" ? entry4 : {
21279
+ ...entry4,
21280
+ indices: entry4.indices.map((item2, axis) => {
21229
21281
  if (axes[axis] === null) return item2;
21230
21282
  const index3 = axes[axis]?.[item2];
21231
21283
  if (index3 === void 0) throw new Error("Invalid report row axis item");
@@ -21361,9 +21413,9 @@ function assertPageAxisItems(root2, pivot, shared, cache2, recordRoot) {
21361
21413
  throw new Error("Invalid page column items");
21362
21414
  let previous = [];
21363
21415
  colItems.forEach((item2, i) => {
21364
- const grand = i >= expected.length, measure3 = grand ? i - expected.length : i % measures2;
21416
+ const grand = i >= expected.length, measure4 = grand ? i - expected.length : i % measures2;
21365
21417
  const xs = children(item2, "x", NS.x).map((x) => integer2(x.getAttribute("v"), 0)), prefix2 = integer2(item2.getAttribute("r"), 0);
21366
- if (integer2(item2.getAttribute("i"), 0) !== measure3 || !Number.isInteger(prefix2) || prefix2 < 0 || prefix2 > Math.max(0, previous.length - 1))
21418
+ if (integer2(item2.getAttribute("i"), 0) !== measure4 || !Number.isInteger(prefix2) || prefix2 < 0 || prefix2 > Math.max(0, previous.length - 1))
21367
21419
  throw new Error("Invalid page column prefix");
21368
21420
  if (grand) {
21369
21421
  if (item2.getAttribute("t") !== "grand" || prefix2 !== 0 || xs.length !== 1 || xs[0] !== 0)
@@ -21405,12 +21457,12 @@ function readOne(workbook, source, part) {
21405
21457
  const cachePart = source.targetOfType(part, RELATIONSHIP_TYPES.pivotCacheDefinition);
21406
21458
  if (!cachePart) throw new Error("Missing pivot cache");
21407
21459
  const bookPart = source.workbookPart();
21408
- const entry3 = children(
21460
+ const entry4 = children(
21409
21461
  first(parseXml(source.text(bookPart)).documentElement, "pivotCaches", NS.x),
21410
21462
  "pivotCache",
21411
21463
  NS.x
21412
21464
  ).find((node3) => Number(att(node3, "cacheId")) === cacheId);
21413
- const relationship2 = entry3 && source.rels(bookPart).get(relAttr(entry3, "id") ?? "");
21465
+ const relationship2 = entry4 && source.rels(bookPart).get(relAttr(entry4, "id") ?? "");
21414
21466
  if (!relationship2 || source.target(bookPart, relationship2) !== cachePart)
21415
21467
  throw new Error("Inconsistent pivot cache identity");
21416
21468
  const cache2 = parseXml(source.text(cachePart)).documentElement;
@@ -21465,7 +21517,7 @@ function readOne(workbook, source, part) {
21465
21517
  if (rowFields.length < 1 || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || root2.getAttribute("rowGrandTotals") === "0" || root2.getAttribute("colGrandTotals") === "0")
21466
21518
  throw new Error("Unsupported pivot layout");
21467
21519
  const valueIndex = pivotValueIndex(root2, rowsAxis ? rowFields : colFields);
21468
- const measure3 = dataFields[0];
21520
+ const measure4 = dataFields[0];
21469
21521
  const definition = elements(first(root2, "extLst", NS.x) ?? parseXml("<root/>").documentElement).map(
21470
21522
  (extension2) => first(
21471
21523
  extension2,
@@ -21489,8 +21541,8 @@ function readOne(workbook, source, part) {
21489
21541
  throw new Error("Unsupported Values axis item");
21490
21542
  }
21491
21543
  }
21492
- const aggregate = att(measure3, "subtotal") ?? "sum";
21493
- if (!PIVOT_AGGREGATES.includes(aggregate) || att(measure3, "showDataAs") && att(measure3, "showDataAs") !== "normal")
21544
+ const aggregate = att(measure4, "subtotal") ?? "sum";
21545
+ if (!PIVOT_AGGREGATES.includes(aggregate) || att(measure4, "showDataAs") && att(measure4, "showDataAs") !== "normal")
21494
21546
  throw new Error("Unsupported pivot aggregate");
21495
21547
  const names = fields2.map((field3) => decodeEscapes(att(field3, "name") ?? ""));
21496
21548
  const axisNames = allFields.map((field3) => decodeEscapes(att(field3, "name") ?? ""));
@@ -21511,7 +21563,7 @@ function readOne(workbook, source, part) {
21511
21563
  const rowDefinitions = realRows.map((field3) => tableFields[Number(att(field3, "x"))]);
21512
21564
  const subtotalSettings = fieldSubtotalsOf(rowDefinitions, [row2, second, ...more]);
21513
21565
  const subtotal = !subtotalSettings.some(
21514
- (entry4) => entry4.field === row2 && entry4.functions.length === 0
21566
+ (entry5) => entry5.field === row2 && entry5.functions.length === 0
21515
21567
  );
21516
21568
  const repeat = realRows.map((field3) => {
21517
21569
  const node3 = tableFields[Number(att(field3, "x"))];
@@ -21525,7 +21577,7 @@ function readOne(workbook, source, part) {
21525
21577
  "fillDownLabels"
21526
21578
  ) === "1";
21527
21579
  });
21528
- if (repeat.some((entry4) => entry4 !== repeat[0])) throw new Error("Mixed field label repetition");
21580
+ if (repeat.some((entry5) => entry5 !== repeat[0])) throw new Error("Mixed field label repetition");
21529
21581
  const columnDefs = dataFields.length > 1 && !rowsAxis ? colFields.slice(0, -1) : colFields;
21530
21582
  const columnNames = columnDefs.map((field3) => axisNames[Number(att(field3, "x"))]);
21531
21583
  const hasColumn = columnDefs.length > 0;
@@ -21534,7 +21586,7 @@ function readOne(workbook, source, part) {
21534
21586
  const columnDefinitions = columnDefs.map((field3) => tableFields[Number(att(field3, "x"))]);
21535
21587
  if (columnNames.some((name3) => !name3)) throw new Error("Invalid pivot column fields");
21536
21588
  const columnSubtotals = fieldSubtotalsOf(columnDefinitions, columnNames);
21537
- const data = names[Number(att(measure3, "fld"))];
21589
+ const data = names[Number(att(measure4, "fld"))];
21538
21590
  const location = parseRange(att(first(root2, "location", NS.x), "ref") ?? "");
21539
21591
  if (!row2 || !data || !location || hasColumn && !col || realRows.length === 2 && !second)
21540
21592
  throw new Error("Invalid pivot fields");
@@ -21576,7 +21628,7 @@ function readOne(workbook, source, part) {
21576
21628
  if (dateFields.some((field3) => onAxis.has(field3)))
21577
21629
  throw new Error("Date fields used as rows, columns or values are preserved");
21578
21630
  const fieldSubtotals = [
21579
- ...subtotalSettings.filter((entry4) => entry4.field !== row2 || entry4.functions.length),
21631
+ ...subtotalSettings.filter((entry5) => entry5.field !== row2 || entry5.functions.length),
21580
21632
  ...columnSubtotals
21581
21633
  ];
21582
21634
  const pivot = {
@@ -21606,14 +21658,14 @@ function readOne(workbook, source, part) {
21606
21658
  },
21607
21659
  valueField: data,
21608
21660
  aggregate,
21609
- valueCaption: decodeEscapes(att(measure3, "name") ?? data),
21661
+ valueCaption: decodeEscapes(att(measure4, "name") ?? data),
21610
21662
  ...dataFields.length > 1 ? {
21611
- additionalValues: dataFields.slice(1).map((measure4) => {
21612
- const field3 = names[Number(att(measure4, "fld"))];
21613
- const aggregate2 = att(measure4, "subtotal") ?? "sum";
21614
- if (!field3 || !PIVOT_AGGREGATES.includes(aggregate2) || att(measure4, "showDataAs") && att(measure4, "showDataAs") !== "normal")
21663
+ additionalValues: dataFields.slice(1).map((measure5) => {
21664
+ const field3 = names[Number(att(measure5, "fld"))];
21665
+ const aggregate2 = att(measure5, "subtotal") ?? "sum";
21666
+ if (!field3 || !PIVOT_AGGREGATES.includes(aggregate2) || att(measure5, "showDataAs") && att(measure5, "showDataAs") !== "normal")
21615
21667
  throw new Error("Unsupported pivot measure");
21616
- return { field: field3, aggregate: aggregate2, caption: decodeEscapes(att(measure4, "name") ?? field3) };
21668
+ return { field: field3, aggregate: aggregate2, caption: decodeEscapes(att(measure5, "name") ?? field3) };
21617
21669
  })
21618
21670
  } : {},
21619
21671
  fields: names,
@@ -21919,9 +21971,9 @@ async function openPackage(input, limits) {
21919
21971
  async function readZipParts(input, limits = {}) {
21920
21972
  const zip = await openPackage(input, resolveLoadLimits(limits));
21921
21973
  const parts = /* @__PURE__ */ new Map();
21922
- for (const entry3 of Object.values(zip.files)) {
21923
- if (entry3.dir) continue;
21924
- parts.set(entry3.name.replace(/^\//, ""), await entry3.async("uint8array"));
21974
+ for (const entry4 of Object.values(zip.files)) {
21975
+ if (entry4.dir) continue;
21976
+ parts.set(entry4.name.replace(/^\//, ""), await entry4.async("uint8array"));
21925
21977
  }
21926
21978
  return parts;
21927
21979
  }
@@ -22045,10 +22097,10 @@ function splitSheetData(xml) {
22045
22097
  function parseColor(element2, palette) {
22046
22098
  if (!element2) return void 0;
22047
22099
  const color2 = {};
22048
- const rgb6 = att(element2, "rgb");
22100
+ const rgb7 = att(element2, "rgb");
22049
22101
  const theme2 = numAttr(element2, "theme");
22050
22102
  const indexed = numAttr(element2, "indexed");
22051
- if (rgb6 && /^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(rgb6)) color2.rgb = rgb6.toUpperCase();
22103
+ if (rgb7 && /^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(rgb7)) color2.rgb = rgb7.toUpperCase();
22052
22104
  else if (theme2 !== void 0) color2.theme = theme2;
22053
22105
  else if (indexed !== void 0) {
22054
22106
  const override = palette?.[indexed];
@@ -22332,15 +22384,15 @@ function parseStyles(xml, warnings) {
22332
22384
  const xfId = numAttr(node3, "xfId") ?? 0;
22333
22385
  const name3 = att(node3, "name") ?? `Style ${xfId}`;
22334
22386
  const style3 = styleXfs[xfId] ?? fallback;
22335
- const entry3 = { name: name3, style: structuredClone(style3) };
22387
+ const entry4 = { name: name3, style: structuredClone(style3) };
22336
22388
  const builtinId = numAttr(node3, "builtinId");
22337
- if (builtinId !== void 0) entry3.builtinId = builtinId;
22389
+ if (builtinId !== void 0) entry4.builtinId = builtinId;
22338
22390
  if (!namesByXf.has(xfId)) namesByXf.set(xfId, name3);
22339
- namedStyles.push(entry3);
22391
+ namedStyles.push(entry4);
22340
22392
  }
22341
- const normalAt = namedStyles.findIndex((entry3) => entry3.builtinId === 0);
22393
+ const normalAt = namedStyles.findIndex((entry4) => entry4.builtinId === 0);
22342
22394
  if (normalAt > 0) namedStyles.unshift(...namedStyles.splice(normalAt, 1));
22343
- if (!namedStyles.some((entry3) => entry3.name === "Normal"))
22395
+ if (!namedStyles.some((entry4) => entry4.name === "Normal"))
22344
22396
  namedStyles.unshift({ name: "Normal", style: styleXfs[0] ?? defaultCellStyle(), builtinId: 0 });
22345
22397
  const styles = [];
22346
22398
  const keys = /* @__PURE__ */ new Map();
@@ -22426,13 +22478,13 @@ function readDateGroup(node3) {
22426
22478
  return item2;
22427
22479
  }
22428
22480
  function readFilterColumn(column, dxfs) {
22429
- const entry3 = { offset: numAttr(column, "colId") ?? 0 };
22481
+ const entry4 = { offset: numAttr(column, "colId") ?? 0 };
22430
22482
  const filters = xFirst(column, "filters");
22431
22483
  if (filters) {
22432
- entry3.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
22433
- if (boolAttr(filters, "blank")) entry3.blank = true;
22484
+ entry4.values = xChildren(filters, "filter").map((f) => att(f, "val") ?? "");
22485
+ if (boolAttr(filters, "blank")) entry4.blank = true;
22434
22486
  const groups = xChildren(filters, "dateGroupItem").map(readDateGroup).filter((g) => g !== void 0);
22435
- if (groups.length) entry3.dateGroups = groups;
22487
+ if (groups.length) entry4.dateGroups = groups;
22436
22488
  }
22437
22489
  const custom = xFirst(column, "customFilters");
22438
22490
  if (custom) {
@@ -22443,12 +22495,12 @@ function readFilterColumn(column, dxfs) {
22443
22495
  value: att(c2, "val") ?? ""
22444
22496
  };
22445
22497
  });
22446
- entry3.custom = { ...boolAttr(custom, "and") ? { and: true } : {}, conditions };
22498
+ entry4.custom = { ...boolAttr(custom, "and") ? { and: true } : {}, conditions };
22447
22499
  }
22448
22500
  const top = xFirst(column, "top10");
22449
22501
  if (top) {
22450
22502
  const filterValue = numAttr(top, "filterVal");
22451
- entry3.top10 = {
22503
+ entry4.top10 = {
22452
22504
  top: boolAttr(top, "top", true),
22453
22505
  percent: boolAttr(top, "percent", false),
22454
22506
  value: numAttr(top, "val") ?? 10,
@@ -22459,7 +22511,7 @@ function readFilterColumn(column, dxfs) {
22459
22511
  if (dynamic2) {
22460
22512
  const value3 = numAttr(dynamic2, "val");
22461
22513
  const maxValue = numAttr(dynamic2, "maxVal");
22462
- entry3.dynamic = {
22514
+ entry4.dynamic = {
22463
22515
  type: att(dynamic2, "type") ?? "null",
22464
22516
  ...value3 !== void 0 ? { value: value3 } : {},
22465
22517
  ...maxValue !== void 0 ? { maxValue } : {}
@@ -22469,7 +22521,7 @@ function readFilterColumn(column, dxfs) {
22469
22521
  if (color2) {
22470
22522
  const dxfId = numAttr(color2, "dxfId");
22471
22523
  const style3 = dxfId === void 0 ? void 0 : dxfs?.[dxfId];
22472
- entry3.color = {
22524
+ entry4.color = {
22473
22525
  cellColor: boolAttr(color2, "cellColor", true),
22474
22526
  ...dxfId !== void 0 ? { dxfId } : {},
22475
22527
  ...style3 ? { style: structuredClone(style3) } : {}
@@ -22479,11 +22531,11 @@ function readFilterColumn(column, dxfs) {
22479
22531
  const iconSet = att(icon, "iconSet");
22480
22532
  if (iconSet) {
22481
22533
  const iconId = numAttr(icon, "iconId");
22482
- entry3.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
22534
+ entry4.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
22483
22535
  }
22484
- if (boolAttr(column, "hiddenButton")) entry3.hiddenButton = true;
22485
- entry3.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
22486
- return entry3;
22536
+ if (boolAttr(column, "hiddenButton")) entry4.hiddenButton = true;
22537
+ entry4.sourceXml = outerXml(column).replace(MAIN_NS_DECL, "");
22538
+ return entry4;
22487
22539
  }
22488
22540
 
22489
22541
  // xlsx/read/sort-state.ts
@@ -23872,7 +23924,7 @@ function diagramNodesInTreeOrder(data) {
23872
23924
  nodes.sort(
23873
23925
  (a2, b) => (order.get(a2.node.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.node.id) ?? Number.MAX_SAFE_INTEGER) || a2.index - b.index
23874
23926
  );
23875
- return treeOrderDiagramNodes(nodes.map((entry3) => entry3.node));
23927
+ return treeOrderDiagramNodes(nodes.map((entry4) => entry4.node));
23876
23928
  }
23877
23929
 
23878
23930
  // units/constants.ts
@@ -23882,7 +23934,7 @@ var EMU_PER_POINT = 12700;
23882
23934
  // drawingml/drawing-shadow.ts
23883
23935
  function resolveDrawingShadow(effects, theme2) {
23884
23936
  const effect = parseDrawingEffects(effects)?.effects.find(
23885
- (entry3) => entry3.kind === "outerShadow"
23937
+ (entry4) => entry4.kind === "outerShadow"
23886
23938
  );
23887
23939
  return effect?.kind === "outerShadow" ? resolveDrawingOuterShadow(effect, theme2) : void 0;
23888
23940
  }
@@ -24433,12 +24485,12 @@ function captureDiagramPictures(model, dataXml, dataParts, drawing2) {
24433
24485
  id4 = `ooxmlDiagramPicture${index3}`;
24434
24486
  parts[id4] = part;
24435
24487
  }
24436
- const entry3 = { ...source, fill: remapFill(source.fill, id4) };
24488
+ const entry4 = { ...source, fill: remapFill(source.fill, id4) };
24437
24489
  const existing = pictures.findIndex(
24438
- (item2) => item2.nodeId === entry3.nodeId && (item2.role === entry3.role && item2.styleLabel === entry3.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry3.fill.relId)
24490
+ (item2) => item2.nodeId === entry4.nodeId && (item2.role === entry4.role && item2.styleLabel === entry4.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry4.fill.relId)
24439
24491
  );
24440
- if (existing < 0) pictures.push(entry3);
24441
- else pictures[existing] = entry3;
24492
+ if (existing < 0) pictures.push(entry4);
24493
+ else pictures[existing] = entry4;
24442
24494
  };
24443
24495
  const root2 = parseXml(dataXml).documentElement;
24444
24496
  const saved2 = root2.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
@@ -24514,7 +24566,7 @@ async function resolveDiagramDrawingPart(hostPart, dataRelId, drawingExtensionRe
24514
24566
  const entries = await host.readRelationshipEntries(diagramRelationshipsPart(dataPath));
24515
24567
  if (!entries) return void 0;
24516
24568
  const drawing2 = entries.find(
24517
- (entry3) => (!drawingExtensionRelId || entry3.id.trim() === drawingExtensionRelId) && entry3.type.endsWith("/diagramDrawing")
24569
+ (entry4) => (!drawingExtensionRelId || entry4.id.trim() === drawingExtensionRelId) && entry4.type.endsWith("/diagramDrawing")
24518
24570
  );
24519
24571
  const id4 = drawing2?.id.trim() ?? "";
24520
24572
  const target2 = drawing2?.target.trim() ?? "";
@@ -24953,13 +25005,13 @@ async function loadDiagram(hostPart, relationshipIds, host) {
24953
25005
  diagramRelationshipsPart(drawingResolution.path)
24954
25006
  );
24955
25007
  const pictures = (entries ?? []).filter(
24956
- (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
25008
+ (entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
24957
25009
  );
24958
25010
  if (pictures.length)
24959
25011
  drawing2.pictureParts = Object.fromEntries(
24960
- pictures.map((entry3) => [
24961
- entry3.id,
24962
- host.resolvePath(drawingResolution.path, entry3.target)
25012
+ pictures.map((entry4) => [
25013
+ entry4.id,
25014
+ host.resolvePath(drawingResolution.path, entry4.target)
24963
25015
  ])
24964
25016
  );
24965
25017
  } catch {
@@ -24983,8 +25035,8 @@ async function loadDiagram(hostPart, relationshipIds, host) {
24983
25035
  const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
24984
25036
  pictureParts = Object.fromEntries(
24985
25037
  (entries ?? []).filter(
24986
- (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
24987
- ).map((entry3) => [entry3.id, host.resolvePath(owner, entry3.target)])
25038
+ (entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
25039
+ ).map((entry4) => [entry4.id, host.resolvePath(owner, entry4.target)])
24988
25040
  );
24989
25041
  } catch {
24990
25042
  issues.push({
@@ -26451,12 +26503,12 @@ var LEGEND = /* @__PURE__ */ new Set(["legendPos", "legendEntry", "layout", "ove
26451
26503
  function parseLegend(context, element2) {
26452
26504
  reportUnmodelled(context, element2, LEGEND);
26453
26505
  const entries = children(element2, "legendEntry", NS.c).map(
26454
- (entry3) => assignDefined(
26506
+ (entry4) => assignDefined(
26455
26507
  {},
26456
26508
  {
26457
- index: cNumber(context, entry3, "idx"),
26458
- deleted: cBool(context, entry3, "delete"),
26459
- txPr: textProperties(entry3)
26509
+ index: cNumber(context, entry4, "idx"),
26510
+ deleted: cBool(context, entry4, "delete"),
26511
+ txPr: textProperties(entry4)
26460
26512
  }
26461
26513
  )
26462
26514
  );
@@ -26940,9 +26992,9 @@ function view3DXml(view) {
26940
26992
  function legendXml(context, legend) {
26941
26993
  if (!legend) return "";
26942
26994
  const entries = legend.entries.map(
26943
- (entry3) => elementXml(
26995
+ (entry4) => elementXml(
26944
26996
  "legendEntry",
26945
- valXml("idx", entry3.index) + valXml("delete", entry3.deleted) + textBodyXml(context, entry3.txPr)
26997
+ valXml("idx", entry4.index) + valXml("delete", entry4.deleted) + textBodyXml(context, entry4.txPr)
26946
26998
  )
26947
26999
  ).join("");
26948
27000
  return elementXml(
@@ -27093,8 +27145,8 @@ function summaryErrorBars(source) {
27093
27145
  return out;
27094
27146
  }
27095
27147
  function summaryAnalysis(series) {
27096
- const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((entry3) => entry3 !== void 0);
27097
- const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((entry3) => entry3 !== void 0);
27148
+ const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((entry4) => entry4 !== void 0);
27149
+ const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((entry4) => entry4 !== void 0);
27098
27150
  return {
27099
27151
  ...trendlines.length ? { trendlines } : {},
27100
27152
  ...errorBars.length ? { errorBars } : {}
@@ -27504,7 +27556,7 @@ function extraGroups(chartSpace, firstType) {
27504
27556
  const stockOverColumns = group2.kind === "stock" && firstType === "column";
27505
27557
  if (group2.is3D || !(["bar", "line", "area"].includes(group2.kind) || stockOverColumns)) continue;
27506
27558
  const type = group2.kind === "bar" ? "column" : group2.kind;
27507
- const entry3 = {
27559
+ const entry4 = {
27508
27560
  chartType: type,
27509
27561
  series: group2.series.map((source, index3) => ({
27510
27562
  ...chartSummarySeries(
@@ -27518,13 +27570,13 @@ function extraGroups(chartSpace, firstType) {
27518
27570
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
27519
27571
  };
27520
27572
  if (group2.grouping && GROUPINGS.has(group2.grouping))
27521
- entry3.grouping = group2.grouping;
27522
- if (type === "stock") entry3.stock = stockStyle(group2);
27573
+ entry4.grouping = group2.grouping;
27574
+ if (type === "stock") entry4.stock = stockStyle(group2);
27523
27575
  if (type === "column") {
27524
- if (group2.gapWidth !== void 0) entry3.barGapWidth = group2.gapWidth;
27525
- if (group2.overlap !== void 0) entry3.barOverlap = group2.overlap;
27576
+ if (group2.gapWidth !== void 0) entry4.barGapWidth = group2.gapWidth;
27577
+ if (group2.overlap !== void 0) entry4.barOverlap = group2.overlap;
27526
27578
  }
27527
- if (entry3.series.length) out.push(entry3);
27579
+ if (entry4.series.length) out.push(entry4);
27528
27580
  }
27529
27581
  return out;
27530
27582
  }
@@ -28228,20 +28280,20 @@ function resolveChartStyleDefinition(style3, resolve) {
28228
28280
  for (const name3 of CHART_STYLE_PARTS) {
28229
28281
  const source = style3.entries[name3];
28230
28282
  if (!source) continue;
28231
- const entry3 = {};
28283
+ const entry4 = {};
28232
28284
  for (const key2 of ["fontSize", "bold", "italic", "underline"]) {
28233
28285
  const value3 = source[key2];
28234
- if (value3 !== void 0) Object.assign(entry3, { [key2]: value3 });
28286
+ if (value3 !== void 0) Object.assign(entry4, { [key2]: value3 });
28235
28287
  }
28236
28288
  const line2 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
28237
28289
  const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
28238
28290
  const color2 = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
28239
- if (color2 !== void 0) entry3.color = color2;
28240
- if (line2 !== void 0) entry3.lineColor = line2;
28241
- if (fill !== void 0) entry3.fillColor = fill;
28291
+ if (color2 !== void 0) entry4.color = color2;
28292
+ if (line2 !== void 0) entry4.lineColor = line2;
28293
+ if (fill !== void 0) entry4.fillColor = fill;
28242
28294
  if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
28243
- entry3.lineWidth = source.line.widthEmu / 12700;
28244
- if (Object.keys(entry3).length) out[name3] = entry3;
28295
+ entry4.lineWidth = source.line.widthEmu / 12700;
28296
+ if (Object.keys(entry4).length) out[name3] = entry4;
28245
28297
  }
28246
28298
  return Object.keys(out).length ? out : void 0;
28247
28299
  }
@@ -28388,9 +28440,9 @@ var TEXT_PARTS = [
28388
28440
  "legend",
28389
28441
  "dataLabel"
28390
28442
  ];
28391
- function inheritChartText(part, entry3, builtIn, root2) {
28392
- if (!root2 || !TEXT_PARTS.includes(part)) return entry3;
28393
- const out = { ...entry3 };
28443
+ function inheritChartText(part, entry4, builtIn, root2) {
28444
+ if (!root2 || !TEXT_PARTS.includes(part)) return entry4;
28445
+ const out = { ...entry4 };
28394
28446
  for (const key2 of TEXT_KEYS) {
28395
28447
  delete out[key2];
28396
28448
  const value3 = root2[key2] ?? builtIn?.[key2];
@@ -28403,11 +28455,11 @@ function inheritChartText(part, entry3, builtIn, root2) {
28403
28455
 
28404
28456
  // chart/render/chart-appearance.ts
28405
28457
  var chartPointsToPixels = (points2) => points2 * EMU_PER_POINT / EMU_PER_PIXEL;
28406
- function typeface(entry3, theme2) {
28407
- const name3 = entry3.typeface;
28458
+ function typeface(entry4, theme2) {
28459
+ const name3 = entry4.typeface;
28408
28460
  if (name3?.startsWith("+mj-")) return theme2.majorFont;
28409
28461
  if (name3?.startsWith("+mn-")) return theme2.minorFont;
28410
- return name3 ?? (entry3.fontRef?.index === "major" ? theme2.majorFont : entry3.fontRef?.index === "minor" ? theme2.minorFont : void 0);
28462
+ return name3 ?? (entry4.fontRef?.index === "major" ? theme2.majorFont : entry4.fontRef?.index === "minor" ? theme2.minorFont : void 0);
28411
28463
  }
28412
28464
  function chartAppearance(chart, theme2) {
28413
28465
  const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
@@ -28416,7 +28468,7 @@ function chartAppearance(chart, theme2) {
28416
28468
  const base2 = chart.styleDefinition?.entries[part];
28417
28469
  const direct = chart.formatting?.entries[part];
28418
28470
  if (!defaults[part] && !base2 && !direct) continue;
28419
- const entry3 = {
28471
+ const entry4 = {
28420
28472
  ...inheritChartText(
28421
28473
  part,
28422
28474
  { ...defaults[part], ...base2, sourceXml: base2?.sourceXml ?? "" },
@@ -28426,8 +28478,8 @@ function chartAppearance(chart, theme2) {
28426
28478
  ...direct,
28427
28479
  sourceXml: direct?.sourceXml ?? base2?.sourceXml ?? ""
28428
28480
  };
28429
- if (base2?.line || direct?.line) entry3.line = { ...base2?.line, ...direct?.line };
28430
- entries[part] = entry3;
28481
+ if (base2?.line || direct?.line) entry4.line = { ...base2?.line, ...direct?.line };
28482
+ entries[part] = entry4;
28431
28483
  }
28432
28484
  const scheme = chartColorScheme(theme2);
28433
28485
  const resolve = (color2) => resolveDrawingColor(
@@ -28440,19 +28492,19 @@ function chartAppearance(chart, theme2) {
28440
28492
  (color2) => drawingColorCss(resolve(color2))
28441
28493
  ) ?? {};
28442
28494
  for (const part of CHART_STYLE_PARTS) {
28443
- const entry3 = entries[part];
28444
- if (!entry3) continue;
28445
- const family = typeface(entry3, theme2);
28446
- const shadow = resolveDrawingShadowXml(entry3.textEffectsXml, {
28495
+ const entry4 = entries[part];
28496
+ if (!entry4) continue;
28497
+ const family = typeface(entry4, theme2);
28498
+ const shadow = resolveDrawingShadowXml(entry4.textEffectsXml, {
28447
28499
  scheme: (name3) => scheme[name3]
28448
28500
  });
28449
28501
  if (shadow) (out[part] ??= {}).textShadow = shadow;
28450
28502
  if (family) (out[part] ??= {}).typeface = family;
28451
- if (entry3.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry3.axisVisible;
28452
- if (entry3.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry3.labelsVisible;
28453
- if (entry3.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
28454
- if (entry3.fill?.kind === "gradient") {
28455
- (out[part] ??= {}).gradient = resolveChartGradient(entry3.fill, resolve);
28503
+ if (entry4.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry4.axisVisible;
28504
+ if (entry4.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry4.labelsVisible;
28505
+ if (entry4.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
28506
+ if (entry4.fill?.kind === "gradient") {
28507
+ (out[part] ??= {}).gradient = resolveChartGradient(entry4.fill, resolve);
28456
28508
  }
28457
28509
  }
28458
28510
  return out;
@@ -28471,8 +28523,8 @@ function chartRunStyle(run2) {
28471
28523
  }
28472
28524
  function chartTitleText(chart, theme2) {
28473
28525
  const formatting = chart.formatting;
28474
- const entry3 = formatting?.entries.title;
28475
- const body = entry3?.textBody;
28526
+ const entry4 = formatting?.entries.title;
28527
+ const body = entry4?.textBody;
28476
28528
  if (!formatting || !body || body.text !== chart.title) return void 0;
28477
28529
  if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
28478
28530
  return void 0;
@@ -28485,7 +28537,7 @@ function chartTitleText(chart, theme2) {
28485
28537
  runs: paragraph2.runs.map((run2) => {
28486
28538
  const direct = {
28487
28539
  sourceXml: "",
28488
- ...entry3.textBodyStyle,
28540
+ ...entry4.textBodyStyle,
28489
28541
  ...chartRunStyle(paragraph2.defaultProperties ?? {}),
28490
28542
  ...chartRunStyle(run2)
28491
28543
  };
@@ -29311,23 +29363,23 @@ function readValue2(ctx, c2, cell) {
29311
29363
  const raw2 = v ? v.textContent ?? "" : void 0;
29312
29364
  switch (type) {
29313
29365
  case "s": {
29314
- const entry3 = ctx.sharedStrings[Number(raw2)];
29315
- if (!entry3) {
29366
+ const entry4 = ctx.sharedStrings[Number(raw2)];
29367
+ if (!entry4) {
29316
29368
  if (raw2 !== void 0) ctx.warn("A cell refers to a missing shared string.");
29317
29369
  return;
29318
29370
  }
29319
- cell.value = entry3.text;
29320
- if (entry3.runs) cell.richText = entry3.runs.map((run2) => ({ ...run2 }));
29321
- if (entry3.phonetic) cell.phonetic = structuredClone(entry3.phonetic);
29371
+ cell.value = entry4.text;
29372
+ if (entry4.runs) cell.richText = entry4.runs.map((run2) => ({ ...run2 }));
29373
+ if (entry4.phonetic) cell.phonetic = structuredClone(entry4.phonetic);
29322
29374
  return;
29323
29375
  }
29324
29376
  case "inlineStr": {
29325
29377
  const is = xFirst(c2, "is");
29326
29378
  if (!is) return;
29327
- const entry3 = parseRichString(is, ctx.palette);
29328
- cell.value = entry3.text;
29329
- if (entry3.runs) cell.richText = entry3.runs;
29330
- if (entry3.phonetic) cell.phonetic = entry3.phonetic;
29379
+ const entry4 = parseRichString(is, ctx.palette);
29380
+ cell.value = entry4.text;
29381
+ if (entry4.runs) cell.richText = entry4.runs;
29382
+ if (entry4.phonetic) cell.phonetic = entry4.phonetic;
29331
29383
  return;
29332
29384
  }
29333
29385
  case "str":
@@ -29820,13 +29872,13 @@ async function loadXlsx(input, options2 = {}) {
29820
29872
  const warn = (message) => {
29821
29873
  if (!warnings.includes(message)) warnings.push(message);
29822
29874
  };
29823
- const partOf = (type) => source.targetOfType(workbookPart, type);
29824
- const stylesPart = partOf(RELATIONSHIP_TYPES.styles);
29875
+ const partOf2 = (type) => source.targetOfType(workbookPart, type);
29876
+ const stylesPart = partOf2(RELATIONSHIP_TYPES.styles);
29825
29877
  const styles = parseStyles(stylesPart ? source.text(stylesPart) : void 0, warnings);
29826
- const themePart = partOf(RELATIONSHIP_TYPES.theme);
29827
- const stringsPart = partOf(RELATIONSHIP_TYPES.sharedStrings);
29828
- const personsPart = partOf(RELATIONSHIP_TYPES.person);
29829
- const metadataPart = partOf(RELATIONSHIP_TYPES.sheetMetadata);
29878
+ const themePart = partOf2(RELATIONSHIP_TYPES.theme);
29879
+ const stringsPart = partOf2(RELATIONSHIP_TYPES.sharedStrings);
29880
+ const personsPart = partOf2(RELATIONSHIP_TYPES.person);
29881
+ const metadataPart = partOf2(RELATIONSHIP_TYPES.sheetMetadata);
29830
29882
  const ctx = {
29831
29883
  source,
29832
29884
  sharedStrings: parseSharedStrings(
@@ -29844,24 +29896,24 @@ async function loadXlsx(input, options2 = {}) {
29844
29896
  maxXmlElements: limits.maxXmlElements
29845
29897
  };
29846
29898
  const rels = source.rels(workbookPart);
29847
- const sheets = book.sheets.map((entry3) => {
29848
- const rel = rels.get(entry3.relId);
29899
+ const sheets = book.sheets.map((entry4) => {
29900
+ const rel = rels.get(entry4.relId);
29849
29901
  const target2 = rel ? source.target(workbookPart, rel) : void 0;
29850
29902
  let sheet;
29851
29903
  if (rel?.type === RELATIONSHIP_TYPES.worksheet && target2) {
29852
- sheet = parseWorksheet(ctx, target2, entry3.name, entry3.sheetId);
29904
+ sheet = parseWorksheet(ctx, target2, entry4.name, entry4.sheetId);
29853
29905
  } else {
29854
- sheet = createWorksheet(entry3.name, entry3.sheetId);
29906
+ sheet = createWorksheet(entry4.name, entry4.sheetId);
29855
29907
  if (target2) sheet.partName = target2;
29856
29908
  const kind = rel?.type.split("/").pop() ?? "sheet";
29857
- warn(`Sheet "${entry3.name}" is a ${kind}; it is kept on save but cannot be shown or edited.`);
29909
+ warn(`Sheet "${entry4.name}" is a ${kind}; it is kept on save but cannot be shown or edited.`);
29858
29910
  }
29859
- sheet.state = entry3.state;
29911
+ sheet.state = entry4.state;
29860
29912
  return sheet;
29861
29913
  });
29862
- if (source.has("xl/vbaProject.bin") || partOf(RELATIONSHIP_TYPES.vbaProject))
29914
+ if (source.has("xl/vbaProject.bin") || partOf2(RELATIONSHIP_TYPES.vbaProject))
29863
29915
  warn("The workbook contains VBA macros; they are kept on save but never run.");
29864
- if (partOf(RELATIONSHIP_TYPES.externalLink))
29916
+ if (partOf2(RELATIONSHIP_TYPES.externalLink))
29865
29917
  warn("External workbook links are kept but not updated.");
29866
29918
  const signatures = detectDigitalSignatures([...parts.keys()]);
29867
29919
  if (signatures.hasSignatures)
@@ -30585,14 +30637,14 @@ function strokeOf(line2, fallback, resolve) {
30585
30637
  }
30586
30638
  function analysisView(source, seriesColor, resolve) {
30587
30639
  const plain3 = seriesColor === "none" || seriesColor.startsWith("url(") ? TEXT_COLOR : seriesColor;
30588
- const trendlines = (source.trendlines ?? []).flatMap((entry3) => {
30589
- const { name: _name, line: line2, ...fit3 } = entry3;
30640
+ const trendlines = (source.trendlines ?? []).flatMap((entry4) => {
30641
+ const { name: _name, line: line2, ...fit3 } = entry4;
30590
30642
  const fallback = { color: plain3, width: chartPointsToPixels(1.5), dash: "sysDot" };
30591
30643
  const stroke = strokeOf(line2, fallback, resolve);
30592
30644
  return stroke ? [{ fit: fit3, stroke }] : [];
30593
30645
  });
30594
- const errorBars = (source.errorBars ?? []).flatMap((entry3) => {
30595
- const { direction: direction2, barType, noEndCap, line: line2, ...amount } = entry3;
30646
+ const errorBars = (source.errorBars ?? []).flatMap((entry4) => {
30647
+ const { direction: direction2, barType, noEndCap, line: line2, ...amount } = entry4;
30596
30648
  const stroke = strokeOf(line2, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve);
30597
30649
  return stroke ? [{ direction: direction2, barType, amount, endCap: noEndCap !== true, stroke }] : [];
30598
30650
  });
@@ -31827,20 +31879,20 @@ function drawingPaint(node3, colors, placeholder3, depth = 0) {
31827
31879
  (transform2) => !SUPPORTED_TRANSFORMS.has(transform2.name) || (integer4(transform2.value) ?? 100001) > 1e5
31828
31880
  ))
31829
31881
  return void 0;
31830
- let rgb6;
31882
+ let rgb7;
31831
31883
  let inherited;
31832
- if (color2.kind === "srgb") rgb6 = color2.value;
31833
- else if (color2.kind === "system") rgb6 = color2.fallback;
31884
+ if (color2.kind === "srgb") rgb7 = color2.value;
31885
+ else if (color2.kind === "system") rgb7 = color2.fallback;
31834
31886
  else if (color2.kind === "scheme") {
31835
- if (color2.value === "phClr") rgb6 = placeholder3;
31887
+ if (color2.value === "phClr") rgb7 = placeholder3;
31836
31888
  else {
31837
31889
  inherited = drawingPaint(colors.get(color2.value), colors, placeholder3, depth + 1);
31838
- rgb6 = inherited?.color;
31890
+ rgb7 = inherited?.color;
31839
31891
  }
31840
31892
  }
31841
- if (!rgb6 || !/^#?[\da-f]{6}$/i.test(rgb6)) return void 0;
31893
+ if (!rgb7 || !/^#?[\da-f]{6}$/i.test(rgb7)) return void 0;
31842
31894
  const resolved = resolveDrawingColor(
31843
- { kind: "srgb", value: rgb6.replace(/^#/, ""), transforms },
31895
+ { kind: "srgb", value: rgb7.replace(/^#/, ""), transforms },
31844
31896
  void 0,
31845
31897
  { transformOrder: "document" }
31846
31898
  );
@@ -32869,7 +32921,7 @@ function shapeShadow(cells4, color2, report, themed) {
32869
32921
  "approximate-shadow-offset",
32870
32922
  "A shadow without a shape offset uses Visio's default 0.125 inch page offset."
32871
32923
  );
32872
- const clamp3 = (value3, limit2) => Math.max(-limit2, Math.min(limit2, value3));
32924
+ const clamp4 = (value3, limit2) => Math.max(-limit2, Math.min(limit2, value3));
32873
32925
  const transparency = number(cells4, "ShdwForegndTrans", 0, report);
32874
32926
  report(
32875
32927
  "unverified-shadow",
@@ -32878,8 +32930,8 @@ function shapeShadow(cells4, color2, report, themed) {
32878
32930
  return {
32879
32931
  color: color2("ShdwForegnd", "#000000"),
32880
32932
  opacity: Math.max(0, Math.min(1, 1 - transparency)),
32881
- offsetX: clamp3(hasOffset ? number(cells4, "ShapeShdwOffsetX", 0.125, report) : 0.125, 1e3),
32882
- offsetY: clamp3(hasOffset ? number(cells4, "ShapeShdwOffsetY", -0.125, report) : -0.125, 1e3),
32933
+ offsetX: clamp4(hasOffset ? number(cells4, "ShapeShdwOffsetX", 0.125, report) : 0.125, 1e3),
32934
+ offsetY: clamp4(hasOffset ? number(cells4, "ShapeShdwOffsetY", -0.125, report) : -0.125, 1e3),
32883
32935
  blur: Math.max(0, Math.min(10, number(cells4, "ShapeShdwBlur", 0, report)))
32884
32936
  };
32885
32937
  }
@@ -32887,30 +32939,30 @@ function shapeShadow(cells4, color2, report, themed) {
32887
32939
  // visio/effects.ts
32888
32940
  function shapeEffects(cells4, color2, report, themed) {
32889
32941
  const explicit = (name3) => cells4.has(name3) && cells4.get(name3)?.value !== "Themed";
32890
- const clamp3 = (value3, maximum) => Math.max(0, Math.min(maximum, value3));
32942
+ const clamp4 = (value3, maximum) => Math.max(0, Math.min(maximum, value3));
32891
32943
  const result2 = {};
32892
- const glow = explicit("GlowSize") ? clamp3(number(cells4, "GlowSize", 0, report), 2.5) : 0;
32944
+ const glow = explicit("GlowSize") ? clamp4(number(cells4, "GlowSize", 0, report), 2.5) : 0;
32893
32945
  if (glow > 0) {
32894
- const opacity2 = 1 - clamp3(number(cells4, "GlowColorTrans", 0, report), 1);
32946
+ const opacity2 = 1 - clamp4(number(cells4, "GlowColorTrans", 0, report), 1);
32895
32947
  if (opacity2 > 0) result2.glow = { color: color2("GlowColor", "#000000"), opacity: opacity2, size: glow };
32896
32948
  }
32897
- const soft = explicit("SoftEdgesSize") ? clamp3(number(cells4, "SoftEdgesSize", 0, report), 2) : 0;
32949
+ const soft = explicit("SoftEdgesSize") ? clamp4(number(cells4, "SoftEdgesSize", 0, report), 2) : 0;
32898
32950
  if (soft > 0) result2.softEdges = soft;
32899
- const size3 = explicit("ReflectionSize") ? clamp3(number(cells4, "ReflectionSize", 0, report), 1) : 0;
32951
+ const size3 = explicit("ReflectionSize") ? clamp4(number(cells4, "ReflectionSize", 0, report), 1) : 0;
32900
32952
  if (size3 > 0) {
32901
- const opacity2 = 1 - clamp3(number(cells4, "ReflectionTrans", 0, report), 1);
32953
+ const opacity2 = 1 - clamp4(number(cells4, "ReflectionTrans", 0, report), 1);
32902
32954
  if (opacity2 > 0)
32903
32955
  result2.reflection = {
32904
32956
  opacity: opacity2,
32905
32957
  size: size3,
32906
- distance: clamp3(number(cells4, "ReflectionDist", 0, report), 2),
32907
- blur: clamp3(number(cells4, "ReflectionBlur", 0, report), 2)
32958
+ distance: clamp4(number(cells4, "ReflectionDist", 0, report), 2),
32959
+ blur: clamp4(number(cells4, "ReflectionBlur", 0, report), 2)
32908
32960
  };
32909
32961
  }
32910
- const themedCell = (...names) => names.some((name3) => cells4.get(name3)?.value === "Themed");
32911
- if (themed?.glow && themedCell("GlowSize")) result2.glow = themed.glow;
32912
- if (themed?.softEdges && themedCell("SoftEdgesSize")) result2.softEdges = themed.softEdges;
32913
- if (themed?.reflection && themedCell("ReflectionSize", "ReflectionTrans"))
32962
+ const themedCell2 = (...names) => names.some((name3) => cells4.get(name3)?.value === "Themed");
32963
+ if (themed?.glow && themedCell2("GlowSize")) result2.glow = themed.glow;
32964
+ if (themed?.softEdges && themedCell2("SoftEdgesSize")) result2.softEdges = themed.softEdges;
32965
+ if (themed?.reflection && themedCell2("ReflectionSize", "ReflectionTrans"))
32914
32966
  result2.reflection = themed.reflection;
32915
32967
  if (result2.glow || result2.softEdges || result2.reflection)
32916
32968
  report(
@@ -32946,7 +32998,11 @@ var VISIO_ROTATION_PRESETS = [
32946
32998
  ["off-axis-right", "Off Axis Right", 30, 20, 0, 0],
32947
32999
  ["perspective-left", "Perspective Left", -35, 0, 0, 60],
32948
33000
  ["perspective-right", "Perspective Right", 35, 0, 0, 60],
32949
- ["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60]
33001
+ ["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60],
33002
+ ["perspective-above", "Perspective Above", 0, -25, 0, 60],
33003
+ ["perspective-below", "Perspective Below", 0, 25, 0, 60],
33004
+ ["perspective-heroic-left", "Perspective Heroic Left", -45, -20, 0, 90],
33005
+ ["perspective-heroic-right", "Perspective Heroic Right", 45, -20, 0, 90]
32950
33006
  ].map(([id4, label2, x, y, z, perspective]) => ({
32951
33007
  id: id4,
32952
33008
  label: label2,
@@ -32971,6 +33027,39 @@ function rotationWrites(id4, add) {
32971
33027
  add("RotationZAngle", radians(preset.z), "FillStyle", "DEG");
32972
33028
  add("Perspective", radians(preset.perspective), "FillStyle", "DEG");
32973
33029
  }
33030
+ var rgb = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
33031
+ function solidWrites(edit, add) {
33032
+ if (edit.extrusionDepth !== void 0)
33033
+ add("BevelDepthSize", edit.extrusionDepth / 72, "FillStyle", "PT");
33034
+ if (edit.extrusionColor !== void 0)
33035
+ add("BevelDepthColor", edit.extrusionColor, "FillStyle", void 0, rgb(edit.extrusionColor));
33036
+ if (edit.contourSize !== void 0)
33037
+ add("BevelContourSize", edit.contourSize / 72, "FillStyle", "PT");
33038
+ if (edit.contourColor !== void 0)
33039
+ add("BevelContourColor", edit.contourColor, "FillStyle", void 0, rgb(edit.contourColor));
33040
+ }
33041
+ function snapshotSolid(edit) {
33042
+ const length = (value3, high2, what) => {
33043
+ if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0 || value3 > high2)
33044
+ fail("INVALID_EDIT", `${what} must be 0 to ${high2} points.`);
33045
+ return Math.round(value3 * 100) / 100;
33046
+ };
33047
+ const color2 = (value3, what) => {
33048
+ if (typeof value3 !== "string" || !/^#[0-9a-f]{6}$/i.test(value3))
33049
+ fail("INVALID_EDIT", `${what} requires six hexadecimal digits.`);
33050
+ return value3.toLowerCase();
33051
+ };
33052
+ const result2 = {};
33053
+ if (edit.extrusionDepth !== void 0)
33054
+ result2.extrusionDepth = length(edit.extrusionDepth, 288, "Extrusion depth");
33055
+ if (edit.extrusionColor !== void 0)
33056
+ result2.extrusionColor = color2(edit.extrusionColor, "The extrusion colour");
33057
+ if (edit.contourSize !== void 0)
33058
+ result2.contourSize = length(edit.contourSize, 72, "Contour size");
33059
+ if (edit.contourColor !== void 0)
33060
+ result2.contourColor = color2(edit.contourColor, "The contour colour");
33061
+ return result2;
33062
+ }
32974
33063
  function snapshotBevel(value3) {
32975
33064
  if (!isVisioBevelPreset(value3)) fail("INVALID_EDIT", "Unknown bevel preset.");
32976
33065
  return value3;
@@ -32979,14 +33068,29 @@ function snapshotRotation(value3) {
32979
33068
  if (!isVisioRotationPreset(value3)) fail("INVALID_EDIT", "Unknown 3-D rotation preset.");
32980
33069
  return value3;
32981
33070
  }
32982
- var saved = (cells4, name3) => cells4.has(name3) && cells4.get(name3)?.value !== "Themed" ? number(cells4, name3, 0) : 0;
32983
- function shapeBevel(cells4) {
32984
- const type = Math.trunc(saved(cells4, "BevelTopType"));
32985
- const width = Math.max(0, Math.min(2, saved(cells4, "BevelTopWidth")));
32986
- const height = Math.max(0, Math.min(2, saved(cells4, "BevelTopHeight")));
32987
- return type >= 1 && type <= 12 && (width > 0 || height > 0) ? { type, width, height } : void 0;
32988
- }
32989
- var hasUndrawnBevel = (cells4) => saved(cells4, "BevelBottomType") > 0 || saved(cells4, "BevelContourSize") > 0;
33071
+ var themedCell = (cells4, name3) => cells4.get(name3)?.value === "Themed";
33072
+ var saved = (cells4, name3) => cells4.has(name3) && !themedCell(cells4, name3) ? number(cells4, name3, 0) : 0;
33073
+ var clamp2 = (value3, high2) => Math.max(0, Math.min(high2, value3));
33074
+ function shapeBevel(cells4, themed) {
33075
+ const read = (name3, themeValue) => themedCell(cells4, name3) ? themeValue ?? 0 : saved(cells4, name3);
33076
+ const type = Math.trunc(read("BevelTopType", themed?.bevel?.type));
33077
+ const width = clamp2(read("BevelTopWidth", themed?.bevel?.width), 2);
33078
+ const height = clamp2(read("BevelTopHeight", themed?.bevel?.height), 2);
33079
+ return type >= 1 && type <= 12 ? { type, width, height } : void 0;
33080
+ }
33081
+ function shapeExtrusion(cells4, solid2, colorOf) {
33082
+ const depth = clamp2(saved(cells4, "BevelDepthSize"), 4);
33083
+ return solid2 && depth > 0 ? { depth, color: colorOf("BevelDepthColor", "#ffffff") } : void 0;
33084
+ }
33085
+ function shapeContour(cells4, solid2, themed, colorOf) {
33086
+ const size3 = clamp2(
33087
+ themedCell(cells4, "BevelContourSize") ? themed?.contour?.size ?? 0 : saved(cells4, "BevelContourSize"),
33088
+ 1
33089
+ );
33090
+ const color2 = themedCell(cells4, "BevelContourColor") ? themed?.contour?.color ?? colorOf("BevelContourColor", "#000000") : colorOf("BevelContourColor", "#000000");
33091
+ return solid2 && size3 > 0 ? { size: size3, color: color2 } : void 0;
33092
+ }
33093
+ var hasUndrawnBevel = (cells4) => saved(cells4, "BevelBottomType") > 0;
32990
33094
  function shapeRotation3d(cells4) {
32991
33095
  const angle = (name3) => Math.max(-Math.PI, Math.min(Math.PI, saved(cells4, name3)));
32992
33096
  const x = angle("RotationXAngle"), y = angle("RotationYAngle"), z = angle("RotationZAngle");
@@ -33001,6 +33105,52 @@ function shapeRotation3d(cells4) {
33001
33105
  };
33002
33106
  }
33003
33107
 
33108
+ // visio/theme-solid.ts
33109
+ var PRESETS = [
33110
+ "circle",
33111
+ "relaxedInset",
33112
+ "cross",
33113
+ "coolSlant",
33114
+ "angle",
33115
+ "softRound",
33116
+ "convex",
33117
+ "slope",
33118
+ "divot",
33119
+ "riblet",
33120
+ "hardEdge",
33121
+ "artDeco"
33122
+ ];
33123
+ var EMU2 = 914400;
33124
+ var measure2 = (node3, name3, fallback) => {
33125
+ const raw2 = node3.getAttribute(name3);
33126
+ return raw2 !== null && /^\d{1,10}$/.test(raw2) ? Number(raw2) / EMU2 : fallback;
33127
+ };
33128
+ function themeSolid(cells4, resources, placeholder3) {
33129
+ const solid2 = themeChild(themeFormat(cells4, "Effects", resources), "sp3d");
33130
+ if (!solid2) return void 0;
33131
+ const result2 = {};
33132
+ const top = themeChild(solid2, "bevelT");
33133
+ if (top) {
33134
+ const type = PRESETS.indexOf(top.getAttribute("prst") ?? "circle") + 1;
33135
+ if (type > 0)
33136
+ result2.bevel = {
33137
+ type,
33138
+ width: measure2(top, "w", 76200 / EMU2),
33139
+ height: measure2(top, "h", 76200 / EMU2)
33140
+ };
33141
+ }
33142
+ const size3 = measure2(solid2, "contourW", 0);
33143
+ if (size3 > 0) {
33144
+ const paint3 = drawingPaint(
33145
+ colorChoice(themeChild(solid2, "contourClr")),
33146
+ /* @__PURE__ */ new Map(),
33147
+ placeholder3
33148
+ );
33149
+ result2.contour = { size: size3, ...paint3 ? { color: paint3.color } : {} };
33150
+ }
33151
+ return result2;
33152
+ }
33153
+
33004
33154
  // visio/text-background.ts
33005
33155
  function textBackground(cells4, resources, report) {
33006
33156
  const raw2 = cells4.get("TextBkgnd")?.value;
@@ -33646,8 +33796,8 @@ function color(cells4, name3, fallback, resources, report, themeCells = cells4,
33646
33796
  if (value3 === void 0) return fallback;
33647
33797
  if (/^#[0-9a-f]{6}$/i.test(value3)) return value3;
33648
33798
  if (/^\d+$/.test(value3)) {
33649
- const entry3 = resources.colors.get(value3) ?? PALETTE[Number(value3)];
33650
- if (entry3 && /^#[0-9a-f]{6}$/i.test(entry3)) return entry3;
33799
+ const entry4 = resources.colors.get(value3) ?? PALETTE[Number(value3)];
33800
+ if (entry4 && /^#[0-9a-f]{6}$/i.test(entry4)) return entry4;
33651
33801
  }
33652
33802
  if (value3 === "Themed") {
33653
33803
  const resolved = themeColor2(themeCells, name3, resources, report, gradientRendered);
@@ -33715,15 +33865,27 @@ function shapeStyle(sheet, resources, report, width = number(sheet.cells, "Width
33715
33865
  report,
33716
33866
  themedEffects
33717
33867
  );
33718
- const bevel = shapeBevel(cells4);
33868
+ const themedSolid = themeSolid(
33869
+ cells4,
33870
+ resources,
33871
+ color(cells4, "FillForegnd", "#ffffff", resources, () => {
33872
+ })
33873
+ );
33874
+ const bevel = shapeBevel(cells4, themedSolid);
33875
+ const solidColor2 = (name3, fallback) => color(cells4, name3, fallback, resources, report);
33876
+ const extrusion = shapeExtrusion(cells4, !!bevel, solidColor2);
33877
+ const contour = shapeContour(cells4, !!bevel, themedSolid, solidColor2);
33719
33878
  const rotation3d = shapeRotation3d(cells4);
33720
- if (bevel || rotation3d)
33879
+ if (bevel && (bevel.width > 0 || bevel.height > 0) || rotation3d || extrusion || contour)
33721
33880
  report(
33722
33881
  "approximated-3d",
33723
- "Bevel and 3-D rotation are approximated by a lighting overlay and a parallel projection; perspective and extrusion are not drawn."
33882
+ "Bevel, 3-D rotation, perspective, extrusion and contour are approximations: a lighting overlay, a projection and flat-shaded side faces, not Visio's renderer."
33724
33883
  );
33725
33884
  if (hasUndrawnBevel(cells4))
33726
- report("unsupported-bevel", "Bottom bevels and bevel contours are not drawn.");
33885
+ report(
33886
+ "unsupported-bevel",
33887
+ "Bottom bevels are not drawn (Visio 16 shows no change on the front of a shape)."
33888
+ );
33727
33889
  const themedBegin = themeArrow(cells4, resources, "Begin");
33728
33890
  const themedEnd = themeArrow(cells4, resources, "End");
33729
33891
  const cap = lineCap(cells4, resources, report);
@@ -33751,6 +33913,8 @@ function shapeStyle(sheet, resources, report, width = number(sheet.cells, "Width
33751
33913
  ...shadow ? { shadow } : {},
33752
33914
  ...effects,
33753
33915
  ...bevel ? { bevel } : {},
33916
+ ...extrusion ? { extrusion } : {},
33917
+ ...contour ? { contour } : {},
33754
33918
  ...rotation3d ? { rotation3d } : {}
33755
33919
  };
33756
33920
  }
@@ -34000,7 +34164,7 @@ function visioPageTheme(themes, pageCells) {
34000
34164
  const light = drawingColor(theme2.colors.get("lt1"), theme2.colors);
34001
34165
  const dark = drawingColor(theme2.colors.get("dk1"), theme2.colors);
34002
34166
  const builtIn = VISIO_BUILT_IN_THEMES.find(
34003
- (entry3) => entry3.schemeId === id4 && entry3.name === theme2.name
34167
+ (entry4) => entry4.schemeId === id4 && entry4.name === theme2.name
34004
34168
  );
34005
34169
  return {
34006
34170
  name: theme2.name ?? `Theme ${id4}`,
@@ -34029,7 +34193,7 @@ function visioPageThemeSchemes(themes, pageCells) {
34029
34193
  if (!themes || id4 === void 0 || id4 === 0 || id4 >= 65534) continue;
34030
34194
  const matches2 = themes.filter((theme2) => theme2[field3] === id4);
34031
34195
  const builtIn = matches2.length === 1 ? VISIO_BUILT_IN_THEMES.find(
34032
- (entry3) => entry3.schemeId === id4 && entry3.name === matches2[0].name
34196
+ (entry4) => entry4.schemeId === id4 && entry4.name === matches2[0].name
34033
34197
  ) : void 0;
34034
34198
  if (builtIn) result2[key2] = builtIn.id;
34035
34199
  }
@@ -34365,7 +34529,7 @@ function optionsKey(options2) {
34365
34529
  const { metafileConverter: _converter, pages: _pages, documentCache: _cache, ...rest } = options2;
34366
34530
  return JSON.stringify(rest);
34367
34531
  }
34368
- var cacheMatches = (entry3, pkg, options2) => entry3 !== void 0 && entry3.options === optionsKey(options2) && entry3.converter === options2.metafileConverter && entry3.reads.every(([path3, print]) => pkg.printOf(path3) === print);
34532
+ var cacheMatches = (entry4, pkg, options2) => entry4 !== void 0 && entry4.options === optionsKey(options2) && entry4.converter === options2.metafileConverter && entry4.reads.every(([path3, print]) => pkg.printOf(path3) === print);
34369
34533
  async function readDocumentLevel(pkg, documentPart2, options2, checkTime, forward) {
34370
34534
  const reports = [];
34371
34535
  const report = (...args) => {
@@ -36129,13 +36293,13 @@ function masterMediaParts(media, directory, taken, types, existing) {
36129
36293
  node3.setAttribute("Target", `../media/${part.slice(folder.length)}`);
36130
36294
  rels.appendChild(node3);
36131
36295
  const known = Array.from(types.getElementsByTagNameNS(types.namespaceURI, "Default")).some(
36132
- (entry3) => entry3.getAttribute("Extension")?.toLowerCase() === extension2
36296
+ (entry4) => entry4.getAttribute("Extension")?.toLowerCase() === extension2
36133
36297
  );
36134
36298
  if (!known) {
36135
- const entry3 = types.ownerDocument.createElementNS(types.namespaceURI, "Default");
36136
- entry3.setAttribute("Extension", extension2);
36137
- entry3.setAttribute("ContentType", MEDIA_TYPES[extension2] ?? "application/octet-stream");
36138
- types.insertBefore(entry3, types.firstChild);
36299
+ const entry4 = types.ownerDocument.createElementNS(types.namespaceURI, "Default");
36300
+ entry4.setAttribute("Extension", extension2);
36301
+ entry4.setAttribute("ContentType", MEDIA_TYPES[extension2] ?? "application/octet-stream");
36302
+ types.insertBefore(entry4, types.firstChild);
36139
36303
  }
36140
36304
  }
36141
36305
  return { rels, parts };
@@ -36164,17 +36328,17 @@ async function addMasterToDrawing(source, spec, limits, maxOutput, deadline, che
36164
36328
  if (entries.length >= MAX_MASTERS)
36165
36329
  fail("LIMIT_EDITS", "The drawing holds too many masters to add another.");
36166
36330
  const same8 = (value3, other) => value3?.toLowerCase() === other.toLowerCase();
36167
- const ours = spec.uniqueId && entries.find((entry3) => same8(attribute2(entry3, "UniqueID"), spec.uniqueId));
36331
+ const ours = spec.uniqueId && entries.find((entry4) => same8(attribute2(entry4, "UniqueID"), spec.uniqueId));
36168
36332
  if (ours) return { bytes: source, masterId: attribute2(ours, "ID") ?? "", changedParts: [] };
36169
36333
  const name3 = spec.name;
36170
36334
  const reused = await spec.reuse?.({ pkg, existingPart, entries, check });
36171
36335
  if (reused !== void 0) return { bytes: source, masterId: reused, changedParts: [] };
36172
- const ids = entries.map((entry3) => Number(attribute2(entry3, "ID")));
36336
+ const ids = entries.map((entry4) => Number(attribute2(entry4, "ID")));
36173
36337
  if (ids.some((id5) => !Number.isSafeInteger(id5) || id5 < 0))
36174
36338
  fail("UNSUPPORTED_EDIT_PACKAGE", "The drawing has masters without canonical IDs.");
36175
36339
  const id4 = String(Math.max(1, ...ids.map((value3) => value3 + 1)));
36176
36340
  const names = new Set(
36177
- entries.flatMap((entry3) => [attribute2(entry3, "NameU"), attribute2(entry3, "Name")])
36341
+ entries.flatMap((entry4) => [attribute2(entry4, "NameU"), attribute2(entry4, "Name")])
36178
36342
  );
36179
36343
  const unique2 = names.has(name3) ? `${name3}.${id4}` : name3;
36180
36344
  const relsPart = relationshipsPartFor(mastersPart);
@@ -36214,11 +36378,11 @@ async function addMasterToDrawing(source, spec, limits, maxOutput, deadline, che
36214
36378
  spec.entry(masters, id4, unique2, relId);
36215
36379
  const documentCopy = copy2(document);
36216
36380
  let documentTouched = false;
36217
- const contents = await spec.contents(documentCopy, () => documentTouched = true);
36381
+ const contents2 = await spec.contents(documentCopy, () => documentTouched = true);
36218
36382
  const dirty = /* @__PURE__ */ new Map([
36219
36383
  [mastersPart, masters],
36220
36384
  [relsPart, rels],
36221
- [masterPart, contents],
36385
+ [masterPart, contents2],
36222
36386
  ["[Content_Types].xml", types]
36223
36387
  ]);
36224
36388
  if (documentTouched) dirty.set(documentPart2, documentCopy);
@@ -36526,18 +36690,18 @@ async function ensureStencilMaster(source, master2, limits, maxOutput, deadline,
36526
36690
  uniqueId: builtIn.uniqueId,
36527
36691
  name: name3,
36528
36692
  async reuse({ pkg, existingPart, entries, check: tick }) {
36529
- for (const entry3 of entries) {
36693
+ for (const entry4 of entries) {
36530
36694
  tick();
36531
- if (!existingPart || !same8(attribute2(entry3, "NameU") ?? attribute2(entry3, "Name"), name3))
36695
+ if (!existingPart || !same8(attribute2(entry4, "NameU") ?? attribute2(entry4, "Name"), name3))
36532
36696
  continue;
36533
36697
  try {
36534
- const part = await indexedPart(pkg, existingPart, entry3, "master");
36698
+ const part = await indexedPart(pkg, existingPart, entry4, "master");
36535
36699
  const roots2 = shapesOf2(await visioXml(pkg, part, "MasterContents")).filter(
36536
36700
  (shape) => attribute2(shape, "Del") !== "1"
36537
36701
  );
36538
36702
  const cells4 = new Set(children2(roots2[0], "Cell").map((cell) => attribute2(cell, "N")));
36539
36703
  if (roots2.length === 1 && !cells4.has("BeginX") && !roots2[0].hasAttribute("Master"))
36540
- return attribute2(entry3, "ID") ?? "";
36704
+ return attribute2(entry4, "ID") ?? "";
36541
36705
  } catch {
36542
36706
  }
36543
36707
  }
@@ -36629,26 +36793,26 @@ async function importStencilMaster(source, stencil, stencilMasterId, limits, max
36629
36793
  const stencilDocument = await visioXml(pkg, documentPart2, "VisioDocument");
36630
36794
  const mastersPart = await related(pkg, documentPart2, "masters", false);
36631
36795
  if (!mastersPart) fail("EDIT_TARGET_NOT_FOUND", "The stencil has no masters.");
36632
- const entry3 = children2(await visioXml(pkg, mastersPart, "Masters"), "Master").find(
36796
+ const entry4 = children2(await visioXml(pkg, mastersPart, "Masters"), "Master").find(
36633
36797
  (node3) => attribute2(node3, "ID") === stencilMasterId
36634
36798
  );
36635
- if (!entry3) fail("EDIT_TARGET_NOT_FOUND", "The stencil has no such master.");
36636
- const part = await indexedPart(pkg, mastersPart, entry3, "master");
36799
+ if (!entry4) fail("EDIT_TARGET_NOT_FOUND", "The stencil has no such master.");
36800
+ const part = await indexedPart(pkg, mastersPart, entry4, "master");
36637
36801
  const media = await masterPictures(pkg, part);
36638
- const contents = await visioXml(pkg, part, "MasterContents");
36639
- const name3 = attribute2(entry3, "NameU") ?? attribute2(entry3, "Name") ?? `Master ${stencilMasterId}`;
36802
+ const contents2 = await visioXml(pkg, part, "MasterContents");
36803
+ const name3 = attribute2(entry4, "NameU") ?? attribute2(entry4, "Name") ?? `Master ${stencilMasterId}`;
36640
36804
  return addMasterToDrawing(
36641
36805
  source,
36642
36806
  {
36643
- uniqueId: attribute2(entry3, "UniqueID") ?? "",
36807
+ uniqueId: attribute2(entry4, "UniqueID") ?? "",
36644
36808
  name: name3,
36645
36809
  entry(masters, id4, unique2, relationshipId) {
36646
- const node3 = masters.ownerDocument.importNode(entry3, true);
36810
+ const node3 = masters.ownerDocument.importNode(entry4, true);
36647
36811
  if (node3.namespaceURI !== masters.namespaceURI)
36648
36812
  fail("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
36649
36813
  node3.setAttribute("ID", id4);
36650
36814
  node3.setAttribute("NameU", unique2);
36651
- if (node3.hasAttribute("Name") && attribute2(entry3, "Name") === name3)
36815
+ if (node3.hasAttribute("Name") && attribute2(entry4, "Name") === name3)
36652
36816
  node3.setAttribute("Name", unique2);
36653
36817
  for (const sheet of children2(node3, "PageSheet"))
36654
36818
  for (const style3 of STYLE_ATTRIBUTES)
@@ -36659,7 +36823,7 @@ async function importStencilMaster(source, stencil, stencilMasterId, limits, max
36659
36823
  media,
36660
36824
  contents(document, touch) {
36661
36825
  const map = styleMapper(stencilDocument, document, touch);
36662
- const root2 = copy2(contents);
36826
+ const root2 = copy2(contents2);
36663
36827
  if (root2.namespaceURI !== document.namespaceURI)
36664
36828
  fail("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
36665
36829
  for (const shape of Array.from(root2.getElementsByTagNameNS(root2.namespaceURI, "Shape")))
@@ -39528,7 +39692,7 @@ function visioFallbackQuickStyle(style3) {
39528
39692
  return { fill: mix2(base2, 0, 0.5), line: mix2(base2, 0, 0.5), font: light };
39529
39693
  }
39530
39694
  }
39531
- var rgb = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
39695
+ var rgb2 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
39532
39696
  function shadowWrites(preset, add) {
39533
39697
  if (preset === "none") {
39534
39698
  add("ShdwPattern", 0, "FillStyle");
@@ -39536,7 +39700,7 @@ function shadowWrites(preset, add) {
39536
39700
  }
39537
39701
  const { x, y, blur } = visioShadowPresetGeometry(preset);
39538
39702
  add("ShdwPattern", 1, "FillStyle");
39539
- add("ShdwForegnd", "#000000", "FillStyle", void 0, rgb("#000000"));
39703
+ add("ShdwForegnd", "#000000", "FillStyle", void 0, rgb2("#000000"));
39540
39704
  add("ShdwForegndTrans", 0.6, "FillStyle");
39541
39705
  add("ShapeShdwType", 1, "FillStyle");
39542
39706
  add("ShapeShdwOffsetX", x / 72, "FillStyle", "PT");
@@ -39565,7 +39729,7 @@ async function quickStyleWrites(pkg, document, shape, pageId2, style3, add, chec
39565
39729
  );
39566
39730
  for (const [name3, value3, category] of selectors2) add(name3, value3, category);
39567
39731
  const fallback = visioFallbackQuickStyle(style3);
39568
- const paint3 = (name3, category, color2) => themed ? add(name3, "Themed", category, void 0, "THEMEVAL()") : add(name3, color2, category, void 0, rgb(color2));
39732
+ const paint3 = (name3, category, color2) => themed ? add(name3, "Themed", category, void 0, "THEMEVAL()") : add(name3, color2, category, void 0, rgb2(color2));
39569
39733
  add("FillPattern", 1, "FillStyle");
39570
39734
  add("FillForegndTrans", 0, "FillStyle");
39571
39735
  add("LinePattern", 1, "LineStyle");
@@ -39630,12 +39794,12 @@ function snapshotReflection(value3) {
39630
39794
  blur: bounded3(value3.blur, 100, "Reflection blur must be 0 to 100 points.")
39631
39795
  };
39632
39796
  }
39633
- var rgb2 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
39797
+ var rgb3 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
39634
39798
  function effectWrites(edit, add) {
39635
39799
  if (edit.glow) {
39636
39800
  add("GlowSize", edit.glow.size / 72, "FillStyle", "PT");
39637
39801
  if (edit.glow.size > 0) {
39638
- add("GlowColor", edit.glow.color, "FillStyle", void 0, rgb2(edit.glow.color));
39802
+ add("GlowColor", edit.glow.color, "FillStyle", void 0, rgb3(edit.glow.color));
39639
39803
  add("GlowColorTrans", edit.glow.transparency / 100, "FillStyle");
39640
39804
  }
39641
39805
  }
@@ -39859,7 +40023,11 @@ function snapshotFormatting(edit) {
39859
40023
  "softEdges",
39860
40024
  "reflection",
39861
40025
  "bevel",
39862
- "rotation3d"
40026
+ "rotation3d",
40027
+ "extrusionDepth",
40028
+ "extrusionColor",
40029
+ "contourSize",
40030
+ "contourColor"
39863
40031
  ].includes(key2) && edit[key2] !== void 0
39864
40032
  ))
39865
40033
  fail("INVALID_EDIT", "A Quick Style replaces fill, line and font paint as a whole.");
@@ -39873,6 +40041,7 @@ function snapshotFormatting(edit) {
39873
40041
  if (edit.reflection !== void 0) result2.reflection = snapshotReflection(edit.reflection);
39874
40042
  if (edit.bevel !== void 0) result2.bevel = snapshotBevel(edit.bevel);
39875
40043
  if (edit.rotation3d !== void 0) result2.rotation3d = snapshotRotation(edit.rotation3d);
40044
+ Object.assign(result2, snapshotSolid(edit));
39876
40045
  if (result2.fillColor === "none" && result2.fillPattern !== void 0 && result2.fillPattern !== 0)
39877
40046
  fail("INVALID_EDIT", "No fill conflicts with a visible fill pattern.");
39878
40047
  }
@@ -40045,7 +40214,8 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
40045
40214
  endX,
40046
40215
  endY,
40047
40216
  ...connect ? { connect } : {},
40048
- ...route ? { route } : {}
40217
+ ...route ? { route } : {},
40218
+ ...edit.text !== void 0 ? { text: text9(edit.text) } : {}
40049
40219
  };
40050
40220
  }
40051
40221
  case "create-rectangle":
@@ -40094,7 +40264,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
40094
40264
  };
40095
40265
  }
40096
40266
  case "delete-shape":
40097
- return { ...target2, type: edit.type };
40267
+ return { ...target2, type: edit.type, ...edit.deferred ? { deferred: true } : {} };
40098
40268
  default:
40099
40269
  return fail("INVALID_EDIT", "Unsupported edit command.");
40100
40270
  }
@@ -40212,7 +40382,8 @@ function snapshotEdits(edits) {
40212
40382
  endX: command2.endX,
40213
40383
  endY: command2.endY,
40214
40384
  ...connect ? { connect } : {},
40215
- ...route ? { route } : {}
40385
+ ...route ? { route } : {},
40386
+ ...command2.text !== void 0 ? { text: text9(command2.text) } : {}
40216
40387
  };
40217
40388
  }
40218
40389
  case "replace-plain-text":
@@ -40224,7 +40395,11 @@ function snapshotEdits(edits) {
40224
40395
  case "update-text-field":
40225
40396
  return snapshotTextFieldUpdate(command2);
40226
40397
  case "delete-shape":
40227
- return { type: command2.type, ...target2 };
40398
+ return {
40399
+ type: command2.type,
40400
+ ...target2,
40401
+ ...command2.deferred ? { deferred: true } : {}
40402
+ };
40228
40403
  case "rotate-shape":
40229
40404
  numbers(command2.angle);
40230
40405
  return { type: command2.type, ...target2, angle: command2.angle };
@@ -41319,7 +41494,7 @@ var designTextMeasurer = {
41319
41494
  return em === void 0 ? void 0 : em * style3.fontSize + (style3.letterSpacing ?? 0) * text9.length;
41320
41495
  }
41321
41496
  };
41322
- function measure2(text9, style3) {
41497
+ function measure3(text9, style3) {
41323
41498
  for (const measurer of [designTextMeasurer]) {
41324
41499
  const width = measurer.width(text9, style3);
41325
41500
  if (width !== void 0 && Number.isFinite(width) && width >= 0)
@@ -41363,7 +41538,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
41363
41538
  for (const piece of pieces) {
41364
41539
  for (const token of piece.text.match(/ +|[^ ]+/g) ?? []) {
41365
41540
  if (UNSUPPORTED2.test(token)) return void 0;
41366
- const measured = measure2(token, piece.run);
41541
+ const measured = measure3(token, piece.run);
41367
41542
  if (!measured) return void 0;
41368
41543
  if (token.startsWith(" ")) {
41369
41544
  if (width > 0) pending2 += measured.width;
@@ -41379,7 +41554,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
41379
41554
  pending2 = 0;
41380
41555
  if (start === 0 && Number.isFinite(room()) && measured.width > room()) {
41381
41556
  for (const character of token) {
41382
- const one = measure2(character, piece.run);
41557
+ const one = measure3(character, piece.run);
41383
41558
  if (!one) return void 0;
41384
41559
  const edge = room();
41385
41560
  if (width > 0) {
@@ -41431,7 +41606,7 @@ function visioTextExtents(text9) {
41431
41606
  width(maximum) {
41432
41607
  const inner = maximum === void 0 ? Infinity : maximum - text9.margins.left - text9.margins.right;
41433
41608
  const laid = layout(inner);
41434
- const mark = measure2(" ", text9.runs.at(-1) ?? fallback);
41609
+ const mark = measure3(" ", text9.runs.at(-1) ?? fallback);
41435
41610
  if (!laid || !mark) return void 0;
41436
41611
  let widest = 0;
41437
41612
  laid.forEach((lines3, index3) => {
@@ -43804,13 +43979,13 @@ function createVisioPagePart(parts, pages, pageId2, check) {
43804
43979
  override.setAttribute("PartName", `/${path3}`);
43805
43980
  override.setAttribute("ContentType", contentType);
43806
43981
  parts.types.appendChild(override);
43807
- const contents = parseXml(`<PageContents xmlns="${pages.namespaceURI}"/>`).documentElement;
43808
- contents.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
43809
- parts.dirty.set(path3, contents);
43982
+ const contents2 = parseXml(`<PageContents xmlns="${pages.namespaceURI}"/>`).documentElement;
43983
+ contents2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
43984
+ parts.dirty.set(path3, contents2);
43810
43985
  parts.dirty.set(parts.pagesPart, pages);
43811
43986
  parts.dirty.set(parts.relsPart, parts.rels);
43812
43987
  parts.dirty.set("[Content_Types].xml", parts.types);
43813
- return { page, contents };
43988
+ return { page, contents: contents2 };
43814
43989
  }
43815
43990
 
43816
43991
  // visio/edit-page-decoration.ts
@@ -44212,7 +44387,7 @@ function formattingFont(document, family) {
44212
44387
  var hasCharacterExtras = (edit) => textExtraCharacterKeys.some((key2) => edit[key2] !== void 0);
44213
44388
  var hasParagraphExtras = (edit) => textExtraParagraphKeys.some((key2) => edit[key2] !== void 0);
44214
44389
  var quoted = (text9) => `"${text9.replaceAll('"', '""')}"`;
44215
- var rgb3 = (color2) => `RGB(${[1, 3, 5].map((i) => parseInt(color2.slice(i, i + 2), 16)).join(",")})`;
44390
+ var rgb4 = (color2) => `RGB(${[1, 3, 5].map((i) => parseInt(color2.slice(i, i + 2), 16)).join(",")})`;
44216
44391
  var inches = (value3) => Number(value3.toFixed(10));
44217
44392
  function characterExtraWrites(edit, name3, add) {
44218
44393
  if (edit.fontTransparency !== void 0) add(name3("ColorTrans"), edit.fontTransparency / 100);
@@ -44265,7 +44440,7 @@ function textBlockWrites(shape, edit, add) {
44265
44440
  }
44266
44441
  if (edit.textBackground !== void 0) {
44267
44442
  if (edit.textBackground === "none") add("TextBkgnd", 0);
44268
- else add("TextBkgnd", edit.textBackground, void 0, `${rgb3(edit.textBackground)}+1`);
44443
+ else add("TextBkgnd", edit.textBackground, void 0, `${rgb4(edit.textBackground)}+1`);
44269
44444
  }
44270
44445
  if (edit.textBackgroundTransparency !== void 0)
44271
44446
  add("TextBkgndTrans", edit.textBackgroundTransparency / 100);
@@ -44429,7 +44604,7 @@ function shapeFormattingWrites(edit) {
44429
44604
  edit.fillColor,
44430
44605
  "FillStyle",
44431
44606
  void 0,
44432
- edit.fillColorTheme ? visioThemeColorFormula(edit.fillColorTheme) : rgb4(edit.fillColor)
44607
+ edit.fillColorTheme ? visioThemeColorFormula(edit.fillColorTheme) : rgb5(edit.fillColor)
44433
44608
  );
44434
44609
  add("FillForegndTrans", 0, "FillStyle");
44435
44610
  }
@@ -44444,7 +44619,7 @@ function shapeFormattingWrites(edit) {
44444
44619
  edit.fillBackgroundColor,
44445
44620
  "FillStyle",
44446
44621
  void 0,
44447
- rgb4(edit.fillBackgroundColor)
44622
+ rgb5(edit.fillBackgroundColor)
44448
44623
  );
44449
44624
  }
44450
44625
  if (edit.fillTransparency !== void 0) {
@@ -44457,7 +44632,7 @@ function shapeFormattingWrites(edit) {
44457
44632
  edit.lineColor,
44458
44633
  "LineStyle",
44459
44634
  void 0,
44460
- edit.lineColorTheme ? visioThemeColorFormula(edit.lineColorTheme) : rgb4(edit.lineColor)
44635
+ edit.lineColorTheme ? visioThemeColorFormula(edit.lineColorTheme) : rgb5(edit.lineColor)
44461
44636
  );
44462
44637
  add("LineColorTrans", 0, "LineStyle");
44463
44638
  add("LineGradientEnabled", 0, "LineStyle");
@@ -44496,6 +44671,7 @@ async function shapeFormattingPlan(pkg, document, shape, edit, check) {
44496
44671
  effectWrites(edit, add);
44497
44672
  if (edit.bevel !== void 0) bevelWrites(edit.bevel, add);
44498
44673
  if (edit.rotation3d !== void 0) rotationWrites(edit.rotation3d, add);
44674
+ solidWrites(edit, add);
44499
44675
  return { writes: [...writes.values()], ...rows ? { rows } : {} };
44500
44676
  }
44501
44677
  async function assertShapeFormattingPaintScope(pkg, document, shape, edit, changed, check) {
@@ -44505,7 +44681,7 @@ async function assertShapeFormattingPaintScope(pkg, document, shape, edit, chang
44505
44681
  if (edit.lineColor === void 0 && changed.has("LineColorTrans"))
44506
44682
  await assertNonGradientPaint(pkg, document, shape, edit.pageId, "Line", check);
44507
44683
  }
44508
- function rgb4(color2) {
44684
+ function rgb5(color2) {
44509
44685
  return `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
44510
44686
  }
44511
44687
 
@@ -45190,11 +45366,11 @@ async function masterEntry(pkg, masterId) {
45190
45366
  async function masterIdentities(pkg, masterIds) {
45191
45367
  const result2 = [];
45192
45368
  for (const id4 of masterIds) {
45193
- const entry3 = await masterEntry(pkg, id4);
45194
- if (!entry3) fail("UNSUPPORTED_CLIPBOARD", "The master of a stencil shape cannot be resolved.");
45369
+ const entry4 = await masterEntry(pkg, id4);
45370
+ if (!entry4) fail("UNSUPPORTED_CLIPBOARD", "The master of a stencil shape cannot be resolved.");
45195
45371
  result2.push({
45196
45372
  id: id4,
45197
- identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute2(entry3.master, name3) ?? "").join("|")
45373
+ identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute2(entry4.master, name3) ?? "").join("|")
45198
45374
  });
45199
45375
  }
45200
45376
  return result2;
@@ -45202,11 +45378,11 @@ async function masterIdentities(pkg, masterIds) {
45202
45378
  async function assertClipboardMasters(pkg, pagePath, source, captured) {
45203
45379
  for (const id4 of instanceMasterIds(source)) {
45204
45380
  const known = captured?.find((master2) => master2.id === id4);
45205
- const entry3 = await masterEntry(pkg, id4);
45206
- if (!known || !entry3) fail("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
45381
+ const entry4 = await masterEntry(pkg, id4);
45382
+ if (!known || !entry4) fail("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
45207
45383
  const [actual] = await masterIdentities(pkg, [id4]);
45208
45384
  if (actual.identity !== known.identity) fail("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
45209
- const masterPart = await indexedPart(pkg, entry3.mastersPart, entry3.master, "master");
45385
+ const masterPart = await indexedPart(pkg, entry4.mastersPart, entry4.master, "master");
45210
45386
  const linked = [...(await pkg.relationships(pagePath)).values()].some(
45211
45387
  (rel) => rel.type === MASTER_RELATIONSHIP3 && rel.target === masterPart
45212
45388
  );
@@ -45804,14 +45980,14 @@ async function editVsdxPicture(pkg, parts, pages, edit, limits, maxOutput, deadl
45804
45980
  (node3) => node3.getAttribute("Extension")?.toLowerCase() === format6.extension
45805
45981
  );
45806
45982
  if (!declared || declared.getAttribute("ContentType") !== info.mimeType) {
45807
- const entry3 = types.ownerDocument.createElementNS(
45983
+ const entry4 = types.ownerDocument.createElementNS(
45808
45984
  types.namespaceURI,
45809
45985
  declared ? "Override" : "Default"
45810
45986
  );
45811
- if (declared) entry3.setAttribute("PartName", `/${media}`);
45812
- else entry3.setAttribute("Extension", format6.extension);
45813
- entry3.setAttribute("ContentType", info.mimeType);
45814
- types.insertBefore(entry3, declared ? null : types.firstElementChild ?? null);
45987
+ if (declared) entry4.setAttribute("PartName", `/${media}`);
45988
+ else entry4.setAttribute("Extension", format6.extension);
45989
+ entry4.setAttribute("ContentType", info.mimeType);
45990
+ types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
45815
45991
  }
45816
45992
  const dirty = /* @__PURE__ */ new Map([
45817
45993
  [path3, root2],
@@ -45870,14 +46046,14 @@ function declareType(types, extension2, contentType2, partName) {
45870
46046
  (node3) => node3.getAttribute("Extension")?.toLowerCase() === extension2
45871
46047
  );
45872
46048
  if (declared?.getAttribute("ContentType") === contentType2) return;
45873
- const entry3 = types.ownerDocument.createElementNS(
46049
+ const entry4 = types.ownerDocument.createElementNS(
45874
46050
  types.namespaceURI,
45875
46051
  declared ? "Override" : "Default"
45876
46052
  );
45877
- if (declared) entry3.setAttribute("PartName", `/${partName}`);
45878
- else entry3.setAttribute("Extension", extension2);
45879
- entry3.setAttribute("ContentType", contentType2);
45880
- types.insertBefore(entry3, declared ? null : types.firstElementChild ?? null);
46053
+ if (declared) entry4.setAttribute("PartName", `/${partName}`);
46054
+ else entry4.setAttribute("Extension", extension2);
46055
+ entry4.setAttribute("ContentType", contentType2);
46056
+ types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
45881
46057
  }
45882
46058
  async function stage(pkg, parts) {
45883
46059
  const types = cloneRoot(await pkg.readXml("[Content_Types].xml", "Types"));
@@ -46064,7 +46240,7 @@ function refreshThemeColorCaches(root2, colors, check) {
46064
46240
  }
46065
46241
 
46066
46242
  // visio/edit-page-theme-recolor.ts
46067
- var rgb5 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
46243
+ var rgb6 = (color2) => `RGB(${[1, 3, 5].map((index3) => parseInt(color2.slice(index3, index3 + 2), 16)).join(",")})`;
46068
46244
  function formattingCell2(sheet, name3) {
46069
46245
  const matches2 = children2(sheet, "Cell").filter((cell) => attribute2(cell, "N") === name3);
46070
46246
  return matches2.length === 1 ? matches2[0] : void 0;
@@ -46088,14 +46264,14 @@ function style2(shape, kind) {
46088
46264
  function convert(cell, fallback, mode) {
46089
46265
  if (!cell || cell.hasAttribute("E")) return false;
46090
46266
  if (mode === "themed") {
46091
- if (normal2(attribute2(cell, "F")) !== rgb5(fallback)) return false;
46267
+ if (normal2(attribute2(cell, "F")) !== rgb6(fallback)) return false;
46092
46268
  cell.setAttribute("V", "Themed");
46093
46269
  cell.setAttribute("F", "THEMEVAL()");
46094
46270
  } else {
46095
46271
  if (normal2(attribute2(cell, "F")) !== "THEMEVAL()" || attribute2(cell, "V") !== "Themed")
46096
46272
  return false;
46097
46273
  cell.setAttribute("V", fallback);
46098
- cell.setAttribute("F", rgb5(fallback));
46274
+ cell.setAttribute("F", rgb6(fallback));
46099
46275
  }
46100
46276
  cell.removeAttribute("U");
46101
46277
  return true;
@@ -46314,7 +46490,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
46314
46490
  });
46315
46491
  const dirty = /* @__PURE__ */ new Map([[pagesPath, pagesRoot]]);
46316
46492
  const created = /* @__PURE__ */ new Map();
46317
- const contents = copy6(await visioXml(pkg, contentsPath, "PageContents"));
46493
+ const contents2 = copy6(await visioXml(pkg, contentsPath, "PageContents"));
46318
46494
  let recolored = false;
46319
46495
  const part = PAGE_THEME_PARTS.find((name3) => edit[name3] !== void 0);
46320
46496
  if (edit.embellishment !== void 0)
@@ -46327,8 +46503,8 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
46327
46503
  (style3) => attribute2(style3, "ID") === "0"
46328
46504
  );
46329
46505
  if (attribute2(root2, "NameU") !== "No Style")
46330
- recolored = recolorQuickStyledShapes(contents, "fallback", check);
46331
- recolored = refreshThemeColorCaches(contents, VISIO_UNTHEMED_COLORS, check) || recolored;
46506
+ recolored = recolorQuickStyledShapes(contents2, "fallback", check);
46507
+ recolored = refreshThemeColorCaches(contents2, VISIO_UNTHEMED_COLORS, check) || recolored;
46332
46508
  } else if (edit.theme || part) {
46333
46509
  const source = visioBuiltInTheme(edit.theme ?? edit[part]);
46334
46510
  await ensureBuiltInThemePart(pkg, parts, documentPath, themes, source, dirty, created, check);
@@ -46337,7 +46513,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
46337
46513
  if (!part || part === "colors") {
46338
46514
  for (const name3 of ["VariationColorIndex", "VariationStyleIndex"])
46339
46515
  setCell(sheet, name3, edit.variant ?? 0);
46340
- recolored = recolorQuickStyledShapes(contents, "themed", check);
46516
+ recolored = recolorQuickStyledShapes(contents2, "themed", check);
46341
46517
  }
46342
46518
  const hex2 = (index3) => `#${source.colors[index3].toLowerCase()}`;
46343
46519
  const variant = visioThemeVariantColors(source, edit.variant ?? 0);
@@ -46346,7 +46522,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
46346
46522
  for (let index3 = 1; index3 <= 7; index3++)
46347
46523
  colors[`variant${index3}`] = `#${variant[index3 - 1].toLowerCase()}`;
46348
46524
  if (!part || part === "colors")
46349
- recolored = refreshThemeColorCaches(contents, colors, check) || recolored;
46525
+ recolored = refreshThemeColorCaches(contents2, colors, check) || recolored;
46350
46526
  } else if (edit.variant !== void 0) {
46351
46527
  const current = pageSelectedTheme(themes, sheet);
46352
46528
  if (!current || current.variants.length <= edit.variant)
@@ -46366,9 +46542,9 @@ async function editVsdxPageTheme(pkg, parts, pages, edit, limits, maxOutput, dea
46366
46542
  const color2 = drawingColor(current.colors.get(key2), current.colors);
46367
46543
  if (color2) colors[slot2] = color2;
46368
46544
  }
46369
- recolored = refreshThemeColorCaches(contents, colors, check);
46545
+ recolored = refreshThemeColorCaches(contents2, colors, check);
46370
46546
  }
46371
- if (recolored) dirty.set(contentsPath, contents);
46547
+ if (recolored) dirty.set(contentsPath, contents2);
46372
46548
  if ((/* @__PURE__ */ new Set([...parts.keys(), ...dirty.keys(), ...created.keys()])).size > limits.maxEntries)
46373
46549
  fail("LIMIT_ENTRIES", "The theme exceeds the package entry limit.");
46374
46550
  let total = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0);
@@ -46459,7 +46635,7 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
46459
46635
  const authors = list(root2, "AuthorList");
46460
46636
  const comments = list(root2, "CommentList");
46461
46637
  const byId = new Map(
46462
- children2(comments, "CommentEntry").map((entry3, index3) => [visioCommentId(entry3, index3), entry3])
46638
+ children2(comments, "CommentEntry").map((entry4, index3) => [visioCommentId(entry4, index3), entry4])
46463
46639
  );
46464
46640
  const removed = /* @__PURE__ */ new Set();
46465
46641
  for (const edit of edits) {
@@ -46482,29 +46658,29 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
46482
46658
  if (edit.initials) author.setAttribute("Initials", edit.initials);
46483
46659
  authors.appendChild(author);
46484
46660
  }
46485
- const entry4 = root2.ownerDocument.createElementNS(root2.namespaceURI, "CommentEntry");
46486
- entry4.setAttribute("AuthorID", attribute2(author, "ID"));
46487
- entry4.setAttribute("PageID", edit.pageId);
46488
- if (edit.shapeId !== void 0) entry4.setAttribute("ShapeID", edit.shapeId);
46489
- entry4.setAttribute("Date", edit.date);
46490
- entry4.setAttribute("CommentID", nextId(children2(comments, "CommentEntry"), "CommentID"));
46491
- entry4.textContent = edit.text;
46492
- comments.appendChild(entry4);
46661
+ const entry5 = root2.ownerDocument.createElementNS(root2.namespaceURI, "CommentEntry");
46662
+ entry5.setAttribute("AuthorID", attribute2(author, "ID"));
46663
+ entry5.setAttribute("PageID", edit.pageId);
46664
+ if (edit.shapeId !== void 0) entry5.setAttribute("ShapeID", edit.shapeId);
46665
+ entry5.setAttribute("Date", edit.date);
46666
+ entry5.setAttribute("CommentID", nextId(children2(comments, "CommentEntry"), "CommentID"));
46667
+ entry5.textContent = edit.text;
46668
+ comments.appendChild(entry5);
46493
46669
  continue;
46494
46670
  }
46495
- const entry3 = byId.get(edit.commentId);
46496
- if (!entry3 || removed.has(entry3) || attribute2(entry3, "PageID") !== edit.pageId)
46671
+ const entry4 = byId.get(edit.commentId);
46672
+ if (!entry4 || removed.has(entry4) || attribute2(entry4, "PageID") !== edit.pageId)
46497
46673
  fail("EDIT_TARGET_NOT_FOUND", "Comment does not exist on the page.");
46498
46674
  if (edit.type === "delete-comment") {
46499
- entry3.parentNode.removeChild(entry3);
46500
- removed.add(entry3);
46675
+ entry4.parentNode.removeChild(entry4);
46676
+ removed.add(entry4);
46501
46677
  continue;
46502
46678
  }
46503
46679
  if (edit.text !== void 0) {
46504
- entry3.textContent = edit.text;
46505
- entry3.setAttribute("EditDate", edit.date);
46680
+ entry4.textContent = edit.text;
46681
+ entry4.setAttribute("EditDate", edit.date);
46506
46682
  }
46507
- if (edit.done !== void 0) entry3.setAttribute("Done", edit.done ? "1" : "0");
46683
+ if (edit.done !== void 0) entry4.setAttribute("Done", edit.done ? "1" : "0");
46508
46684
  }
46509
46685
  const dirty = /* @__PURE__ */ new Map([[path3, root2]]);
46510
46686
  if (created) {
@@ -46967,9 +47143,21 @@ var ROLES = {
46967
47143
  "swimlane list": "swimlane-list",
46968
47144
  "phase list": "phase-list"
46969
47145
  };
47146
+ var CFF_AUTHORED_IDS = {
47147
+ frame: "{0F0C7A10-0001-0000-8E40-00608CF305B2}",
47148
+ "swimlane-list": "{0F0C7A10-0002-0000-8E40-00608CF305B2}",
47149
+ "phase-list": "{0F0C7A10-0003-0000-8E40-00608CF305B2}",
47150
+ lane: "{0F0C7A10-0004-0000-8E40-00608CF305B2}",
47151
+ separator: "{0F0C7A10-0005-0000-8E40-00608CF305B2}"
47152
+ };
47153
+ var AUTHORED_ROLES = new Map(
47154
+ Object.entries(CFF_AUTHORED_IDS).map(([role, id4]) => [id4, role])
47155
+ );
46970
47156
  var noCffMasters = {
46971
47157
  get: () => void 0,
46972
47158
  roleOf: () => void 0,
47159
+ authoredId: () => void 0,
47160
+ authoredPart: () => void 0,
46973
47161
  empty: true
46974
47162
  };
46975
47163
  async function loadCffMasters(pkg) {
@@ -46979,25 +47167,31 @@ async function loadCffMasters(pkg) {
46979
47167
  const list3 = await visioXml(pkg, mastersPart, "Masters");
46980
47168
  const shapes = /* @__PURE__ */ new Map();
46981
47169
  const roles = /* @__PURE__ */ new Map();
47170
+ const authored = /* @__PURE__ */ new Map();
46982
47171
  for (const master2 of children2(list3, "Master")) {
46983
47172
  const id4 = attribute2(master2, "ID");
46984
47173
  const role = ROLES[(attribute2(master2, "NameU") ?? attribute2(master2, "Name") ?? "").toLowerCase()];
46985
- if (!id4 || !role) continue;
46986
- const root2 = await visioXml(
46987
- pkg,
46988
- await indexedPart(pkg, mastersPart, master2, "master"),
46989
- "MasterContents"
46990
- );
47174
+ if (!id4) continue;
47175
+ const own = AUTHORED_ROLES.get((attribute2(master2, "UniqueID") ?? "").toUpperCase());
47176
+ if (!role && !own) continue;
47177
+ const part = await indexedPart(pkg, mastersPart, master2, "master");
47178
+ if (own) {
47179
+ authored.set(own, { id: id4, part });
47180
+ continue;
47181
+ }
47182
+ const root2 = await visioXml(pkg, part, "MasterContents");
46991
47183
  const top = children2(children2(root2, "Shapes")[0], "Shape");
46992
47184
  if (top.length !== 1) continue;
46993
47185
  shapes.set(id4, top[0]);
46994
47186
  roles.set(id4, role);
46995
47187
  }
46996
- if (!shapes.size) return noCffMasters;
47188
+ if (!shapes.size && !authored.size) return noCffMasters;
46997
47189
  return {
46998
47190
  get: (id4) => shapes.get(id4),
46999
47191
  roleOf: (id4) => id4 ? roles.get(id4) : void 0,
47000
- empty: false
47192
+ authoredId: (role) => authored.get(role)?.id,
47193
+ authoredPart: (role) => authored.get(role)?.part,
47194
+ empty: !shapes.size
47001
47195
  };
47002
47196
  }
47003
47197
 
@@ -47020,10 +47214,10 @@ function turnSwimlanes(from, frame, showTitle, lanes) {
47020
47214
  box: horizontal3 ? { minX: 0, maxX: size3, minY: 0, maxY: cross } : { minX: 0, maxX: cross, minY: 0, maxY: size3 }
47021
47215
  }))
47022
47216
  );
47023
- const turned = stacking.lanes.map((entry3, index3) => ({
47024
- id: entry3.id,
47217
+ const turned = stacking.lanes.map((entry4, index3) => ({
47218
+ id: entry4.id,
47025
47219
  from: lanes[index3].box,
47026
- to: entry3.target
47220
+ to: entry4.target
47027
47221
  }));
47028
47222
  return {
47029
47223
  direction: direction2,
@@ -47767,13 +47961,13 @@ function relayout(scope2, frame, order) {
47767
47961
  const titleSize2 = native && options2.title && Number.isFinite(laneTop) ? Math.max(0, frameBox.maxY - laneTop) : void 0;
47768
47962
  const stacking = stackSwimlanes(options2.direction, frameBox, options2.title, boxes, titleSize2);
47769
47963
  const carried = new Map(
47770
- stacking.lanes.map((entry3, index3) => [index3, [...containerClosure(scope2.root, lanes[index3])]])
47964
+ stacking.lanes.map((entry4, index3) => [index3, [...containerClosure(scope2.root, lanes[index3])]])
47771
47965
  );
47772
47966
  if (scope2.contents === "move") for (const ids of carried.values()) assertMovable(scope2.root, ids);
47773
- stacking.lanes.forEach((entry3, index3) => {
47967
+ stacking.lanes.forEach((entry4, index3) => {
47774
47968
  scope2.check();
47775
- place(scope2, lanes[index3], entry3.target);
47776
- if (scope2.contents === "move") shift3(scope2, carried.get(index3), entry3.dx, entry3.dy);
47969
+ place(scope2, lanes[index3], entry4.target);
47970
+ if (scope2.contents === "move") shift3(scope2, carried.get(index3), entry4.dx, entry4.dy);
47777
47971
  });
47778
47972
  const bars = separatorsOf(scope2, frame);
47779
47973
  for (const shape of bars) {
@@ -48126,8 +48320,8 @@ function applySwimlaneEdit(roots2, document, edit, check, instances = /* @__PURE
48126
48320
  check();
48127
48321
  const root2 = roots2.get(edit.pageId);
48128
48322
  if (!root2) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
48129
- const contents = "contents" in edit && edit.contents === "leave" ? "leave" : "move";
48130
- const scope2 = { roots: roots2, document, root: root2, pageId: edit.pageId, check, contents, masters };
48323
+ const contents2 = "contents" in edit && edit.contents === "leave" ? "leave" : "move";
48324
+ const scope2 = { roots: roots2, document, root: root2, pageId: edit.pageId, check, contents: contents2, masters };
48131
48325
  refuseBuiltByVisio(scope2, edit);
48132
48326
  if (edit.type === "create-swimlanes") createSwimlanes(scope2, edit);
48133
48327
  else if (edit.type === "insert-swimlane") insertSwimlane(scope2, edit);
@@ -48137,6 +48331,251 @@ function applySwimlaneEdit(roots2, document, edit, check, instances = /* @__PURE
48137
48331
  else setOptions(scope2, edit);
48138
48332
  }
48139
48333
 
48334
+ // visio/edit-swimlane-stamp.ts
48335
+ var MASTER_RELATIONSHIP4 = "http://schemas.microsoft.com/visio/2010/relationships/master";
48336
+ var CFF_ROLES = Object.keys(CFF_AUTHORED_IDS);
48337
+ function partOf(shape) {
48338
+ if (userValue(shape, VISIO_SWIMLANE_FRAME_ROW) === "1") return "frame";
48339
+ if (userValue(shape, VISIO_SWIMLANE_LANE_ROW) === "1") return "lane";
48340
+ if (userValue(shape, VISIO_SEPARATOR_ROW) === "1") return "separator";
48341
+ if (userValue(shape, "msvStructureType")?.toLowerCase() !== "list") return void 0;
48342
+ const kind = userValue(shape, "msvSDListRequiredCategories");
48343
+ return kind === "Swimlane" ? "swimlane-list" : kind === "Phase" ? "phase-list" : void 0;
48344
+ }
48345
+ function unstampCffMasters(root2, masters) {
48346
+ const ids = new Set(CFF_ROLES.map((role) => masters.authoredId(role)).filter(Boolean));
48347
+ if (!ids.size) return;
48348
+ for (const shape of topLevelShapes(root2))
48349
+ if (ids.has(attribute2(shape, "Master"))) shape.removeAttribute("Master");
48350
+ }
48351
+ function stampCffMasters(root2, masters) {
48352
+ const used = /* @__PURE__ */ new Set();
48353
+ for (const shape of topLevelShapes(root2)) {
48354
+ const id4 = attribute2(shape, "Master");
48355
+ const role = CFF_ROLES.find((item2) => masters.authoredId(item2) === id4);
48356
+ if (role && id4) used.add(role);
48357
+ }
48358
+ for (const shape of topLevelShapes(root2)) {
48359
+ if (attribute2(shape, "Master") || !shapeIdOf(shape)) continue;
48360
+ const role = partOf(shape);
48361
+ const id4 = role && masters.authoredId(role);
48362
+ if (!id4) continue;
48363
+ shape.setAttribute("Master", id4);
48364
+ used.add(role);
48365
+ }
48366
+ return used;
48367
+ }
48368
+ async function relateCffMasters(pkg, parts, pagePath, roles, masters) {
48369
+ const part = relationshipsPartFor(pagePath);
48370
+ const rels = parts.has(part) ? copy2(await pkg.readXml(part, "Relationships")) : parseXml(`<Relationships xmlns="${NS.rels}"/>`).documentElement;
48371
+ const existing = () => Array.from(rels.getElementsByTagNameNS(rels.namespaceURI, "Relationship"));
48372
+ let changed = false;
48373
+ for (const role of roles) {
48374
+ const target2 = masters.authoredPart(role);
48375
+ if (!target2) continue;
48376
+ const linked = existing().some(
48377
+ (rel) => rel.getAttribute("Type") === MASTER_RELATIONSHIP4 && rel.getAttribute("TargetMode") !== "External" && resolvePartPath(pagePath, rel.getAttribute("Target") ?? "") === target2
48378
+ );
48379
+ if (linked) continue;
48380
+ const ids = new Set(existing().map((rel) => rel.getAttribute("Id") ?? ""));
48381
+ let index3 = 1;
48382
+ while (ids.has(`rId${index3}`)) index3++;
48383
+ const relationship2 = rels.ownerDocument.createElementNS(rels.namespaceURI, "Relationship");
48384
+ relationship2.setAttribute("Id", `rId${index3}`);
48385
+ relationship2.setAttribute("Type", MASTER_RELATIONSHIP4);
48386
+ const from = pagePath.split("/").slice(0, -1);
48387
+ const to = target2.split("/");
48388
+ let shared = 0;
48389
+ while (shared < from.length && shared < to.length - 1 && from[shared] === to[shared]) shared++;
48390
+ relationship2.setAttribute(
48391
+ "Target",
48392
+ [...from.slice(shared).map(() => ".."), ...to.slice(shared)].join("/")
48393
+ );
48394
+ rels.appendChild(relationship2);
48395
+ changed = true;
48396
+ }
48397
+ return changed ? { part, rels } : void 0;
48398
+ }
48399
+
48400
+ // visio/cff-author.ts
48401
+ var MM = 1 / 25.4;
48402
+ var STENCIL = ["visMasterStencil", "xfunc_m.vss"];
48403
+ var VERSION = ["visVersion", "15", ""];
48404
+ var HIDDEN_LAYER = ["msvSDMembersOnHiddenLayer", "1", "BOOL"];
48405
+ var QUIET = [
48406
+ ["msvSDContainerNoHighlight", "1", "BOOL"],
48407
+ ["msvSDContainerNoRibbon", "1", "BOOL"]
48408
+ ];
48409
+ var ALL_PARTS = "CFF Container;CFF List;Swimlane;Phase;NonCFF";
48410
+ var DEFINITIONS = {
48411
+ frame: {
48412
+ name: "CFF Container",
48413
+ size: { width: 150 * MM, height: 100 * MM },
48414
+ rows: [
48415
+ ["msvShapeCategories", "CFF Container;DoNotContain"],
48416
+ ["msvStructureType", "Container"],
48417
+ ...QUIET,
48418
+ ["msvSDContainerRequiredCategories", "CFF List"],
48419
+ ["msvSDContainerExcludedCategories", ""],
48420
+ STENCIL,
48421
+ VERSION
48422
+ ]
48423
+ },
48424
+ "swimlane-list": {
48425
+ name: "Swimlane List",
48426
+ size: { width: 125 * MM, height: 100 * MM },
48427
+ rows: [
48428
+ ["msvStructureType", "List"],
48429
+ ["msvShapeCategories", "CFF List;DoNotContain"],
48430
+ ["msvSDListRequiredCategories", "Swimlane"],
48431
+ ["msvSDContainerExcludedCategories", "CFF Container;CFF List;Phase;NonCFF"],
48432
+ ...QUIET,
48433
+ ["msvSDListDirection", "2", ""],
48434
+ HIDDEN_LAYER,
48435
+ STENCIL,
48436
+ VERSION
48437
+ ]
48438
+ },
48439
+ "phase-list": {
48440
+ name: "Phase List",
48441
+ size: { width: 100 * MM, height: 150 * MM },
48442
+ rows: [
48443
+ ["msvStructureType", "List"],
48444
+ ["msvShapeCategories", "CFF List;DoNotContain"],
48445
+ ["msvSDContainerRequiredCategories", "Phase"],
48446
+ ["msvSDListRequiredCategories", "Phase"],
48447
+ ...QUIET,
48448
+ ["msvSDListDirection", "0", ""],
48449
+ HIDDEN_LAYER,
48450
+ STENCIL,
48451
+ VERSION
48452
+ ]
48453
+ },
48454
+ lane: {
48455
+ name: "Swimlane",
48456
+ size: { width: 125 * MM, height: 30 * MM },
48457
+ rows: [
48458
+ ["msvShapeCategories", "Swimlane;DoNotContain"],
48459
+ ["msvStructureType", "Container"],
48460
+ ["msvSDContainerNoRibbon", "1", "BOOL"],
48461
+ ["msvSDContainerExcludedCategories", ALL_PARTS],
48462
+ HIDDEN_LAYER,
48463
+ STENCIL,
48464
+ VERSION
48465
+ ]
48466
+ },
48467
+ separator: {
48468
+ name: "Separator",
48469
+ size: { width: 0.1, height: 100 * MM },
48470
+ rows: [
48471
+ ["msvStructureType", "Container"],
48472
+ ["msvShapeCategories", "Phase;DoNotContain"],
48473
+ ["msvSDContainerExcludedCategories", ALL_PARTS],
48474
+ ...QUIET,
48475
+ HIDDEN_LAYER,
48476
+ STENCIL,
48477
+ VERSION
48478
+ ]
48479
+ }
48480
+ };
48481
+ var CFF_ROLES2 = [
48482
+ "frame",
48483
+ "swimlane-list",
48484
+ "phase-list",
48485
+ "lane",
48486
+ "separator"
48487
+ ];
48488
+ var baseId = (uniqueId) => uniqueId.replace(/^\{[0-9A-F]{8}/, "{4F0C7A10");
48489
+ function entry3(role) {
48490
+ return (masters, id4, name3, relationshipId) => {
48491
+ const doc = masters.ownerDocument;
48492
+ const node3 = (parent, tag) => parent.appendChild(doc.createElementNS(masters.namespaceURI, tag));
48493
+ const master2 = node3(masters, "Master");
48494
+ const { size: size3 } = DEFINITIONS[role];
48495
+ for (const [attribute4, value3] of [
48496
+ ["ID", id4],
48497
+ ["NameU", name3],
48498
+ ["IsCustomNameU", "1"],
48499
+ ["Name", name3],
48500
+ ["IsCustomName", "1"],
48501
+ ["Prompt", ""],
48502
+ ["IconSize", "1"],
48503
+ ["AlignName", "2"],
48504
+ ["MatchByName", "0"],
48505
+ ["IconUpdate", "1"],
48506
+ ["UniqueID", CFF_AUTHORED_IDS[role]],
48507
+ ["BaseID", baseId(CFF_AUTHORED_IDS[role])],
48508
+ ["PatternFlags", "0"],
48509
+ ["Hidden", "1"],
48510
+ ["MasterType", "34"]
48511
+ ])
48512
+ master2.setAttribute(attribute4, value3);
48513
+ const sheet = node3(master2, "PageSheet");
48514
+ for (const style3 of ["LineStyle", "FillStyle", "TextStyle"]) sheet.setAttribute(style3, "0");
48515
+ for (const [cell, value3] of [
48516
+ ["PageWidth", size3.width],
48517
+ ["PageHeight", size3.height],
48518
+ ["PageScale", 1],
48519
+ ["DrawingScale", 1],
48520
+ ["DrawingSizeType", 4],
48521
+ ["DrawingScaleType", 0]
48522
+ ])
48523
+ setCell(sheet, cell, value3);
48524
+ node3(master2, "Rel").setAttributeNS(NS.r, "r:id", relationshipId);
48525
+ };
48526
+ }
48527
+ function contents(role) {
48528
+ return (document) => {
48529
+ const namespace = document.namespaceURI;
48530
+ const root2 = parseXml(`<MasterContents xmlns="${namespace}"/>`).documentElement;
48531
+ root2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
48532
+ const doc = root2.ownerDocument;
48533
+ const shapes = root2.appendChild(doc.createElementNS(namespace, "Shapes"));
48534
+ const shape = shapes.appendChild(doc.createElementNS(namespace, "Shape"));
48535
+ shape.setAttribute("ID", "5");
48536
+ shape.setAttribute("Type", "Shape");
48537
+ applyShapeCreationStyles(shape, document);
48538
+ const { width, height } = DEFINITIONS[role].size;
48539
+ for (const [name3, value3, formula2] of [
48540
+ ["PinX", width / 2],
48541
+ ["PinY", height / 2],
48542
+ ["Width", width],
48543
+ ["Height", height],
48544
+ ["LocPinX", width / 2, "Width*0.5"],
48545
+ ["LocPinY", height / 2, "Height*0.5"],
48546
+ ["Angle", 0],
48547
+ ["FlipX", 0],
48548
+ ["FlipY", 0],
48549
+ ["ResizeMode", 0]
48550
+ ])
48551
+ setCell(shape, name3, value3, formula2);
48552
+ shape.appendChild(userSection(shape, DEFINITIONS[role].rows));
48553
+ return root2;
48554
+ };
48555
+ }
48556
+ async function ensureCffMasters(source, limits, maxOutput, deadline, check) {
48557
+ let bytes = source;
48558
+ const changedParts = /* @__PURE__ */ new Set();
48559
+ for (const role of CFF_ROLES2) {
48560
+ const added = await addMasterToDrawing(
48561
+ bytes,
48562
+ {
48563
+ uniqueId: CFF_AUTHORED_IDS[role],
48564
+ name: DEFINITIONS[role].name,
48565
+ entry: entry3(role),
48566
+ contents: contents(role)
48567
+ },
48568
+ limits,
48569
+ maxOutput,
48570
+ deadline,
48571
+ check
48572
+ );
48573
+ bytes = added.bytes;
48574
+ for (const part of added.changedParts) changedParts.add(part);
48575
+ }
48576
+ return { bytes, changedParts: [...changedParts] };
48577
+ }
48578
+
48140
48579
  // visio/edit-layers.ts
48141
48580
  var copy8 = (root2) => root2.ownerDocument.cloneNode(true).documentElement;
48142
48581
  var cellValue2 = (owner, name3) => attribute2(
@@ -48498,11 +48937,33 @@ async function editVsdx(input, edits, options2 = {}) {
48498
48937
  ] : [],
48499
48938
  ...prepared2.templateConverted ? [{ code: "TEMPLATE_SAVED_AS_DRAWING", message: "The template was saved as a drawing." }] : []
48500
48939
  ];
48501
- const final = await editVisioPrepared(prepared2.bytes, snapshot, options2, clock);
48940
+ const final = await editWithDeletionsLast(prepared2.bytes, snapshot, options2, clock);
48502
48941
  return notes.length ? { ...final, diagnostics: [...notes, ...final.diagnostics] } : final;
48503
48942
  }
48943
+ async function editWithDeletionsLast(input, edits, options2, clock) {
48944
+ const deferred2 = edits.filter((edit) => edit.type === "delete-shape" && edit.deferred);
48945
+ if (!deferred2.length) return editVisioPrepared(input, edits, options2, clock);
48946
+ const rest = edits.filter((edit) => !deferred2.includes(edit));
48947
+ const first2 = rest.length ? await editVsdx(input, rest, options2) : { bytes: input, changedParts: [], diagnostics: [] };
48948
+ const plain3 = deferred2.map((edit) => ({ ...edit, deferred: false }));
48949
+ const second = await editVsdx(first2.bytes, plain3, options2);
48950
+ return {
48951
+ bytes: second.bytes,
48952
+ changedParts: [.../* @__PURE__ */ new Set([...first2.changedParts, ...second.changedParts])],
48953
+ diagnostics: [...first2.diagnostics, ...second.diagnostics]
48954
+ };
48955
+ }
48504
48956
  async function editVisioPrepared(input, edits, options2, clock) {
48505
- const edited = await editVsdxTransaction(input, edits, options2, clock);
48957
+ const limits = { ...DEFAULTS, ...options2.limits };
48958
+ const cff = edits.some((edit) => edit.type === "create-swimlanes") ? await ensureCffMasters(
48959
+ input,
48960
+ limits,
48961
+ positive2(options2.maxOutputBytes ?? limits.maxInputBytes),
48962
+ Date.now() + limits.maxRuntimeMs,
48963
+ () => void 0
48964
+ ) : void 0;
48965
+ const first2 = await editVsdxTransaction(cff?.bytes ?? input, edits, options2, clock);
48966
+ const edited = cff ? { ...first2, changedParts: [.../* @__PURE__ */ new Set([...cff.changedParts, ...first2.changedParts])] } : first2;
48506
48967
  const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
48507
48968
  const result2 = await refreshLineJumpCaches(
48508
48969
  clock.jumpPages,
@@ -48689,7 +49150,7 @@ async function editVsdxTransaction(input, edits, options2, clock = {
48689
49150
  (command2) => command2.type !== "replace-plain-text" && command2.type !== "replace-text-ranges" && command2.type !== "insert-text-field" && command2.type !== "update-text-field" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && command2.type !== "change-shape" && command2.type !== "insert-picture" && !isVisioChartObjectEdit(command2) && command2.type !== "set-page-theme" && !isVisioMetadataEdit(command2) && command2.type !== "set-shape-data" && !isVisioControlEdit(command2) && !isVisioActionEdit(command2) && !isVisioGroupEdit(command2) && !isVisioDiagramPartEdit(command2) && !isVisioContainerEdit(command2) && !isVisioPictureEdit(command2) && !isVisioGuideEdit(command2) && !isVisioFormatEdit(command2)
48690
49151
  );
48691
49152
  let document;
48692
- const cffMasters = commands.some(isVisioSwimlaneEdit) ? await loadCffMasters(pkg) : noCffMasters;
49153
+ const cffMasters = await loadCffMasters(pkg);
48693
49154
  let masterMovePins = emptyMasterMoveProof();
48694
49155
  const instanceCommands = /* @__PURE__ */ new Set();
48695
49156
  let instanceDeletes = /* @__PURE__ */ new Set();
@@ -48699,7 +49160,9 @@ async function editVsdxTransaction(input, edits, options2, clock = {
48699
49160
  )) {
48700
49161
  for (const [pageId2, path4] of pages) {
48701
49162
  const sourceRoot = await visioXml(pkg, path4, "PageContents");
48702
- roots2.set(pageId2, sourceRoot.ownerDocument.cloneNode(true).documentElement);
49163
+ const root2 = sourceRoot.ownerDocument.cloneNode(true).documentElement;
49164
+ unstampCffMasters(root2, cffMasters);
49165
+ roots2.set(pageId2, root2);
48703
49166
  }
48704
49167
  for (const [pageId2, root2] of roots2) {
48705
49168
  const ids = new Set(
@@ -48963,12 +49426,18 @@ async function editVsdxTransaction(input, edits, options2, clock = {
48963
49426
  for (const shapeId2 of takeDeferredTextSizes(root2)) clock.textSizes.push({ pageId: pageId2, shapeId: shapeId2 });
48964
49427
  let totalBytes = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0);
48965
49428
  let nodes = 0;
49429
+ for (const [path3, root2] of [...dirty]) {
49430
+ if (![...pages.values()].includes(path3)) continue;
49431
+ const used = stampCffMasters(root2, cffMasters);
49432
+ const related2 = used.size ? await relateCffMasters(pkg, parts, path3, used, cffMasters) : void 0;
49433
+ if (related2) dirty.set(related2.part, related2.rels);
49434
+ }
48966
49435
  for (const [path3, root2] of dirty) {
48967
49436
  const serialized = serializeEditedXml(root2, limits, check);
48968
49437
  nodes += serialized.nodes;
48969
49438
  if (nodes > limits.maxTotalXmlNodes)
48970
49439
  fail("LIMIT_XML_TOTAL", "Edited XML node total exceeds limit.");
48971
- totalBytes += serialized.bytes.length - parts.get(path3).length;
49440
+ totalBytes += serialized.bytes.length - (parts.get(path3)?.length ?? 0);
48972
49441
  if (totalBytes > limits.maxTotalBytes)
48973
49442
  fail("LIMIT_TOTAL", "Edited package total exceeds limit.");
48974
49443
  parts.set(path3, serialized.bytes);
@@ -48984,7 +49453,8 @@ async function editVsdxTransaction(input, edits, options2, clock = {
48984
49453
  { ...limits, maxInputBytes: maxOutput, maxRuntimeMs: Math.max(1, deadline - Date.now()) },
48985
49454
  check
48986
49455
  );
48987
- for (const path3 of dirty.keys()) await visioXml(verified.pkg, path3, "PageContents");
49456
+ for (const path3 of dirty.keys())
49457
+ if (!path3.endsWith(".rels")) await visioXml(verified.pkg, path3, "PageContents");
48988
49458
  check();
48989
49459
  }
48990
49460
  return {
@@ -49711,6 +50181,16 @@ function assertViewableDocument(model) {
49711
50181
  finite6(bevel.width, "bevel width", 0, 10);
49712
50182
  finite6(bevel.height, "bevel height", 0, 10);
49713
50183
  }
50184
+ const { extrusion, contour } = shape.style;
50185
+ for (const [item2, label3, size3] of [
50186
+ [extrusion, "extrusion", extrusion?.depth],
50187
+ [contour, "contour", contour?.size]
50188
+ ]) {
50189
+ if (!item2) continue;
50190
+ if (typeof item2.color !== "string" || !/^#[0-9a-f]{6}$/i.test(item2.color))
50191
+ throw new Error(`The scene has an invalid ${label3} color.`);
50192
+ finite6(size3 ?? Number.NaN, `${label3} size`, 0, 10);
50193
+ }
49714
50194
  if (rotation3d)
49715
50195
  for (const key2 of ["x", "y", "z", "perspective"])
49716
50196
  finite6(rotation3d[key2], "3-D rotation", -7, 7);
@@ -50002,6 +50482,8 @@ function copySnapshotScene(model) {
50002
50482
  ...source.softEdges === void 0 ? {} : { softEdges: source.softEdges },
50003
50483
  ...source.rounding === void 0 ? {} : { rounding: source.rounding },
50004
50484
  ...source.bevel ? { bevel: fields(source.bevel, ["type", "width", "height"]) } : {},
50485
+ ...source.extrusion ? { extrusion: fields(source.extrusion, ["depth", "color"]) } : {},
50486
+ ...source.contour ? { contour: fields(source.contour, ["size", "color"]) } : {},
50005
50487
  ...source.rotation3d ? { rotation3d: fields(source.rotation3d, ["x", "y", "z", "perspective", "keepTextFlat"]) } : {},
50006
50488
  ...source.reflection ? { reflection: fields(source.reflection, ["opacity", "size", "distance", "blur"]) } : {},
50007
50489
  ...source.fillPattern ? {
@@ -50425,7 +50907,7 @@ function visioStencilInstanceShape(page, shapeId2) {
50425
50907
  const candidates2 = page.shapes.filter((shape2) => shape2.id === shapeId2);
50426
50908
  const shape = candidates2.length === 1 ? candidates2[0] : void 0;
50427
50909
  if (!shape?.masterId || shape.hidden || (shape.kind === "group" ? !shape.children.length : shape.kind !== "shape") || shape.kind === "shape" && shape.children.length > 0 || holdsForeign(shape) || shape.layerIds?.some(
50428
- (layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked !== false
50910
+ (layer) => page.layers?.find((entry4) => entry4.id === layer)?.locked !== false
50429
50911
  ))
50430
50912
  return void 0;
50431
50913
  return shape;
@@ -50450,7 +50932,7 @@ function visioStencilShape(page, shapeId2) {
50450
50932
  const candidates2 = page.shapes.filter((shape2) => shape2.id === shapeId2);
50451
50933
  const shape = candidates2.length === 1 ? candidates2[0] : void 0;
50452
50934
  if (!shape?.masterId || shape.hidden || !["shape", "group"].includes(shape.kind) || shape.image || shape.foreignVector || shape.layerIds?.some(
50453
- (layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked !== false
50935
+ (layer) => page.layers?.find((entry4) => entry4.id === layer)?.locked !== false
50454
50936
  ))
50455
50937
  return void 0;
50456
50938
  return shape;
@@ -50675,7 +51157,7 @@ function visioOrderingShape(page, shapeId2) {
50675
51157
  if (!shape || shape.hidden) return void 0;
50676
51158
  if (shape.masterId)
50677
51159
  return shape.layerIds?.some(
50678
- (layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked !== false
51160
+ (layer) => page.layers?.find((entry4) => entry4.id === layer)?.locked !== false
50679
51161
  ) ? void 0 : shape;
50680
51162
  return shape.kind === "shape" && !shape.children.length && !shape.image && !shape.foreignVector && !shape.layerIds?.length ? shape : void 0;
50681
51163
  }
@@ -51020,7 +51502,7 @@ function drawingBox(page, box6) {
51020
51502
  height: box6.height / ratio
51021
51503
  };
51022
51504
  }
51023
- var clamp2 = (value3, low2, high2) => Math.min(Math.max(value3, low2), Math.max(low2, high2));
51505
+ var clamp3 = (value3, low2, high2) => Math.min(Math.max(value3, low2), Math.max(low2, high2));
51024
51506
  function visioContainerCommand(page, shapeIds2, style3, heading = "Container") {
51025
51507
  if (shapeIds2.length > 1e3 || new Set(shapeIds2).size !== shapeIds2.length) return void 0;
51026
51508
  const members3 = shapeIds2.map((id4) => topLevel2(page, id4));
@@ -51064,8 +51546,8 @@ function visioCalloutCommand(page, shapeIds2, style3, text9 = "") {
51064
51546
  if (Number(shapeId2) >= 4294967295) return void 0;
51065
51547
  const box6 = visioShapePageBounds(target2);
51066
51548
  const { width, height } = CALLOUT;
51067
- const x = clamp2(box6.maxX + CALLOUT_OFFSET + width / 2, width / 2, page.width - width / 2);
51068
- const y = clamp2(box6.maxY + CALLOUT_OFFSET + height / 2, height / 2, page.height - height / 2);
51549
+ const x = clamp3(box6.maxX + CALLOUT_OFFSET + width / 2, width / 2, page.width - width / 2);
51550
+ const y = clamp3(box6.maxY + CALLOUT_OFFSET + height / 2, height / 2, page.height - height / 2);
51069
51551
  return {
51070
51552
  type: "insert-callout",
51071
51553
  pageId: page.id,
@@ -51163,7 +51645,7 @@ function layeredShape(page, id4) {
51163
51645
  const unlayered = { ...page, shapes: [{ ...shape, layerIds: [] }] };
51164
51646
  const plain3 = visioStyleFormattingShape(unlayered, id4) ?? visioMovableGroup(unlayered, id4, true);
51165
51647
  const locked = shape.layerIds.some(
51166
- (layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked !== false
51648
+ (layer) => page.layers?.find((entry4) => entry4.id === layer)?.locked !== false
51167
51649
  );
51168
51650
  return plain3 && !locked ? shape : void 0;
51169
51651
  }
@@ -51363,9 +51845,9 @@ function visioMasterDropCommand(page, master2, centre2) {
51363
51845
  if (!(ratio > 0) || !Number.isFinite(ratio) || !(page.width > 0) || !(page.height > 0))
51364
51846
  throw new Error("The page size or drawing scale is unusable for dropping a shape.");
51365
51847
  const size3 = visioMasterDropSize(master2);
51366
- const clamp3 = (value3, half, extent2) => extent2 > 2 * half ? Math.min(extent2 - half, Math.max(half, value3)) : extent2 / 2;
51367
- const x = clamp3(centre2?.x ?? page.width / 2, size3.width * ratio / 2, page.width);
51368
- const y = clamp3(centre2?.y ?? page.height / 2, size3.height * ratio / 2, page.height);
51848
+ const clamp4 = (value3, half, extent2) => extent2 > 2 * half ? Math.min(extent2 - half, Math.max(half, value3)) : extent2 / 2;
51849
+ const x = clamp4(centre2?.x ?? page.width / 2, size3.width * ratio / 2, page.width);
51850
+ const y = clamp4(centre2?.y ?? page.height / 2, size3.height * ratio / 2, page.height);
51369
51851
  if (!Number.isFinite(x) || !Number.isFinite(y)) throw new Error("Invalid drop point.");
51370
51852
  return {
51371
51853
  type: "insert-master-instance",
@@ -51383,9 +51865,9 @@ function visioStencilDropCommand(page, master2, centre2, keepOnPage = true) {
51383
51865
  if (!(ratio > 0) || !Number.isFinite(ratio) || !(page.width > 0) || !(page.height > 0))
51384
51866
  throw new Error("The page size or drawing scale is unusable for dropping a shape.");
51385
51867
  const { width, height } = builtIn.master.size;
51386
- const clamp3 = (value3, half, extent2) => !keepOnPage ? value3 : extent2 > 2 * half ? Math.min(extent2 - half, Math.max(half, value3)) : extent2 / 2;
51387
- const x = clamp3(centre2?.x ?? page.width / 2, width * ratio / 2, page.width);
51388
- const y = clamp3(centre2?.y ?? page.height / 2, height * ratio / 2, page.height);
51868
+ const clamp4 = (value3, half, extent2) => !keepOnPage ? value3 : extent2 > 2 * half ? Math.min(extent2 - half, Math.max(half, value3)) : extent2 / 2;
51869
+ const x = clamp4(centre2?.x ?? page.width / 2, width * ratio / 2, page.width);
51870
+ const y = clamp4(centre2?.y ?? page.height / 2, height * ratio / 2, page.height);
51389
51871
  if (!Number.isFinite(x) || !Number.isFinite(y)) throw new Error("Invalid drop point.");
51390
51872
  return {
51391
51873
  type: "drop-stencil-master",
@@ -51634,7 +52116,7 @@ function visioAutoConnectPlan(page, shapeId2, direction2, target2, route = "righ
51634
52116
  // visio/ui/shape-resize.ts
51635
52117
  function unlockedLayers(page, shape) {
51636
52118
  return (shape.layerIds ?? []).every(
51637
- (layer) => page.layers?.find((entry3) => entry3.id === layer)?.locked === false
52119
+ (layer) => page.layers?.find((entry4) => entry4.id === layer)?.locked === false
51638
52120
  );
51639
52121
  }
51640
52122
  function resizableLocalGroup(page, shape) {
@@ -52437,11 +52919,11 @@ function replaceEntries(model, scope2, requirePage = true) {
52437
52919
  if (names > VISIO_TEXT_REPLACE_LIMITS.names) textReplaceError("Replace shape names exceed aggregate limits.");
52438
52920
  characters += text9.length;
52439
52921
  if (characters > VISIO_TEXT_REPLACE_LIMITS.text) textReplaceError("Replace text exceeds aggregate limits.");
52440
- const entry3 = { pageId: pageId2, shapeId: shapeId2, name: name3, pageIndex, text: text9, end: 0 };
52922
+ const entry4 = { pageId: pageId2, shapeId: shapeId2, name: name3, pageIndex, text: text9, end: 0 };
52441
52923
  identities.set(JSON.stringify([pageId2, shapeId2]), all.length);
52442
- all.push(entry3);
52924
+ all.push(entry4);
52443
52925
  walk(shape.children, depth + 1);
52444
- entry3.end = all.length;
52926
+ entry4.end = all.length;
52445
52927
  }
52446
52928
  };
52447
52929
  walk(page.shapes, 0);
@@ -52449,20 +52931,20 @@ function replaceEntries(model, scope2, requirePage = true) {
52449
52931
  if (requirePage && !pageIds2.has(scope2.pageId))
52450
52932
  textReplaceError("Replace current page does not exist.");
52451
52933
  if (scope2.scope === "all-pages") return all;
52452
- if (scope2.scope === "current-page") return all.filter((entry3) => entry3.pageId === scope2.pageId);
52934
+ if (scope2.scope === "current-page") return all.filter((entry4) => entry4.pageId === scope2.pageId);
52453
52935
  const result2 = [], added = /* @__PURE__ */ new Set();
52454
52936
  for (const selected2 of scope2.selection ?? []) {
52455
52937
  const pageId2 = selected2.pageId ?? scope2.pageId;
52456
52938
  const start = identities.get(JSON.stringify([pageId2, selected2.id]));
52457
52939
  if (start === void 0) return textReplaceError("Replace selected shape does not exist.");
52458
52940
  for (let index3 = start; index3 < all[start].end; index3++) {
52459
- const entry3 = all[index3];
52460
- if (added.has(entry3)) {
52461
- index3 = entry3.end - 1;
52941
+ const entry4 = all[index3];
52942
+ if (added.has(entry4)) {
52943
+ index3 = entry4.end - 1;
52462
52944
  continue;
52463
52945
  }
52464
- result2.push(entry3);
52465
- added.add(entry3);
52946
+ result2.push(entry4);
52947
+ added.add(entry4);
52466
52948
  }
52467
52949
  }
52468
52950
  return result2;
@@ -52478,31 +52960,31 @@ function visioTextOccurrenceSelection(model, occurrence) {
52478
52960
  { pageId: pageId2, scope: "all-pages"},
52479
52961
  false
52480
52962
  );
52481
- const entry3 = entries.find((item2) => item2.pageId === pageId2 && item2.shapeId === shapeId2);
52482
- if (!entry3 || end > entry3.text.length) return void 0;
52963
+ const entry4 = entries.find((item2) => item2.pageId === pageId2 && item2.shapeId === shapeId2);
52964
+ if (!entry4 || end > entry4.text.length) return void 0;
52483
52965
  return Object.freeze({
52484
- pageIndex: entry3.pageIndex,
52485
- selection: Object.freeze({ id: shapeId2, name: entry3.name, pageId: pageId2 })
52966
+ pageIndex: entry4.pageIndex,
52967
+ selection: Object.freeze({ id: shapeId2, name: entry4.name, pageId: pageId2 })
52486
52968
  });
52487
52969
  }
52488
52970
 
52489
52971
  // visio/ui/text-replace.ts
52490
52972
  function occurrences(entries, query) {
52491
52973
  const result2 = [];
52492
- for (const entry3 of entries) {
52493
- let start = entry3.text.indexOf(query);
52974
+ for (const entry4 of entries) {
52975
+ let start = entry4.text.indexOf(query);
52494
52976
  while (start >= 0) {
52495
52977
  if (result2.length >= VISIO_TEXT_REPLACE_LIMITS.matches)
52496
52978
  textReplaceError("Replace occurrence count exceeds limits.");
52497
52979
  result2.push(
52498
52980
  Object.freeze({
52499
- pageId: entry3.pageId,
52500
- shapeId: entry3.shapeId,
52981
+ pageId: entry4.pageId,
52982
+ shapeId: entry4.shapeId,
52501
52983
  start,
52502
52984
  end: start + query.length
52503
52985
  })
52504
52986
  );
52505
- start = entry3.text.indexOf(query, start + query.length);
52987
+ start = entry4.text.indexOf(query, start + query.length);
52506
52988
  }
52507
52989
  }
52508
52990
  return Object.freeze(result2);
@@ -52521,7 +53003,7 @@ function visioTextReplaceFindNext(model, input, current) {
52521
53003
  }
52522
53004
  var records = /* @__PURE__ */ new WeakMap();
52523
53005
  var sameOccurrence = (a2, b) => a2.pageId === b.pageId && a2.shapeId === b.shapeId && a2.start === b.start && a2.end === b.end;
52524
- var sameTarget = (entry3, match) => entry3.pageId === match.pageId && entry3.shapeId === match.shapeId;
53006
+ var sameTarget = (entry4, match) => entry4.pageId === match.pageId && entry4.shapeId === match.shapeId;
52525
53007
  function snapshotOccurrence(original) {
52526
53008
  if (original === void 0) return void 0;
52527
53009
  const current = {
@@ -52556,9 +53038,9 @@ function visioTextReplacePlan(model, input) {
52556
53038
  if (targets.size > VISIO_TEXT_REPLACE_LIMITS.commands) textReplaceError("Replace command count exceeds limits.");
52557
53039
  const edits = [], updated = [];
52558
53040
  let outputCharacters = 0, commandCharacters = 0;
52559
- for (const entry3 of entries) {
52560
- const matches2 = targets.get(JSON.stringify([entry3.pageId, entry3.shapeId]));
52561
- let text9 = entry3.text;
53041
+ for (const entry4 of entries) {
53042
+ const matches2 = targets.get(JSON.stringify([entry4.pageId, entry4.shapeId]));
53043
+ let text9 = entry4.text;
52562
53044
  if (matches2) {
52563
53045
  const length = text9.length + matches2.length * (replacement2.length - scope2.query.length);
52564
53046
  outputCharacters += length;
@@ -52572,17 +53054,17 @@ function visioTextReplacePlan(model, input) {
52572
53054
  }
52573
53055
  parts.push(text9.slice(from));
52574
53056
  text9 = parts.join("");
52575
- const target2 = { pageId: entry3.pageId, shapeId: entry3.shapeId };
53057
+ const target2 = { pageId: entry4.pageId, shapeId: entry4.shapeId };
52576
53058
  if (replacement2.includes("\n") || scope2.query.includes("\n")) {
52577
53059
  commandCharacters += text9.length;
52578
53060
  edits.push(Object.freeze({ type: "replace-plain-text", ...target2, text: text9 }));
52579
53061
  } else {
52580
- commandCharacters += entry3.text.length + matches2.length * replacement2.length;
53062
+ commandCharacters += entry4.text.length + matches2.length * replacement2.length;
52581
53063
  edits.push(
52582
53064
  Object.freeze({
52583
53065
  type: "replace-text-ranges",
52584
53066
  ...target2,
52585
- expectedText: entry3.text,
53067
+ expectedText: entry4.text,
52586
53068
  ranges: Object.freeze(
52587
53069
  matches2.map(
52588
53070
  (match) => Object.freeze({ start: match.start, end: match.end, text: replacement2 })
@@ -52594,12 +53076,12 @@ function visioTextReplacePlan(model, input) {
52594
53076
  if (commandCharacters > VISIO_TEXT_REPLACE_LIMITS.output)
52595
53077
  textReplaceError("Replace input exceeds aggregate command text limits.");
52596
53078
  }
52597
- updated.push({ ...entry3, text: text9 });
53079
+ updated.push({ ...entry4, text: text9 });
52598
53080
  }
52599
53081
  const remaining = mode === "current" ? occurrences(updated, scope2.query) : [];
52600
- const activeEntry = active ? entries.findIndex((entry3) => sameTarget(entry3, active)) : -1;
53082
+ const activeEntry = active ? entries.findIndex((entry4) => sameTarget(entry4, active)) : -1;
52601
53083
  const entryIndices = new Map(
52602
- entries.map((entry3, index3) => [JSON.stringify([entry3.pageId, entry3.shapeId]), index3])
53084
+ entries.map((entry4, index3) => [JSON.stringify([entry4.pageId, entry4.shapeId]), index3])
52603
53085
  );
52604
53086
  const nextOccurrence = active ? remaining.find((match) => {
52605
53087
  const index3 = entryIndices.get(JSON.stringify([match.pageId, match.shapeId]));
@@ -52618,9 +53100,9 @@ function visioTextReplaceCommands(model, plan) {
52618
53100
  const record2 = records.get(plan);
52619
53101
  if (!record2) return textReplaceError("Replace plan was not produced by this planner.");
52620
53102
  const current = replaceEntries(model, record2.scope);
52621
- if (current.length !== record2.entries.length || current.some((entry3, index3) => {
53103
+ if (current.length !== record2.entries.length || current.some((entry4, index3) => {
52622
53104
  const saved2 = record2.entries[index3];
52623
- return entry3.pageId !== saved2.pageId || entry3.shapeId !== saved2.shapeId || entry3.text !== saved2.text;
53105
+ return entry4.pageId !== saved2.pageId || entry4.shapeId !== saved2.shapeId || entry4.text !== saved2.text;
52624
53106
  }))
52625
53107
  textReplaceError("Replace plan is stale. Search the current drawing again.");
52626
53108
  return plan.edits.map(
@@ -53384,12 +53866,12 @@ function contentClosure(page, lane) {
53384
53866
  function carryContents(page, stacked) {
53385
53867
  const ratio = scale(page);
53386
53868
  const edits = [];
53387
- for (const entry3 of stacked) {
53388
- const lane = topLevel3(page, entry3.id);
53389
- if (!lane || Math.abs(entry3.dx) < 1e-9 && Math.abs(entry3.dy) < 1e-9) continue;
53869
+ for (const entry4 of stacked) {
53870
+ const lane = topLevel3(page, entry4.id);
53871
+ if (!lane || Math.abs(entry4.dx) < 1e-9 && Math.abs(entry4.dy) < 1e-9) continue;
53390
53872
  const ids = contentIds(page, lane);
53391
53873
  if (!ids.length) continue;
53392
- const moves2 = visioMoveCommands(page, ids, { x: entry3.dx * ratio, y: entry3.dy * ratio });
53874
+ const moves2 = visioMoveCommands(page, ids, { x: entry4.dx * ratio, y: entry4.dy * ratio });
53393
53875
  if (!moves2) return void 0;
53394
53876
  edits.push(...moves2);
53395
53877
  }
@@ -53490,11 +53972,11 @@ function visioResizeSwimlane(page, laneId, size3) {
53490
53972
  if (!info || !lane || !Number.isFinite(size3)) return void 0;
53491
53973
  const drawingSize = Math.max(VISIO_SWIMLANE_MIN, size3 / scale(page));
53492
53974
  const horizontal3 = info.options.direction === "horizontal";
53493
- const inputs = stackInput(page, info.lanes).map((entry3) => {
53494
- if (entry3.id !== laneId) return entry3;
53495
- const box6 = entry3.box;
53975
+ const inputs = stackInput(page, info.lanes).map((entry4) => {
53976
+ if (entry4.id !== laneId) return entry4;
53977
+ const box6 = entry4.box;
53496
53978
  return {
53497
- id: entry3.id,
53979
+ id: entry4.id,
53498
53980
  box: horizontal3 ? { ...box6, minY: box6.maxY - drawingSize } : { ...box6, maxX: box6.minX + drawingSize }
53499
53981
  };
53500
53982
  });
@@ -53734,7 +54216,7 @@ function components(graph) {
53734
54216
  }
53735
54217
  if (ids.length === 1) isolated.push(node3.id);
53736
54218
  else {
53737
- const order = new Map(graph.nodes.map((entry3, index3) => [entry3.id, index3]));
54219
+ const order = new Map(graph.nodes.map((entry4, index3) => [entry4.id, index3]));
53738
54220
  connected.push(ids.sort((a2, b) => order.get(a2) - order.get(b)));
53739
54221
  }
53740
54222
  }
@@ -54027,9 +54509,9 @@ function visioConnectorEdges(page) {
54027
54509
  for (const connection of page.connectors) {
54028
54510
  const end = /^Begin/i.test(connection.fromCell) ? "begin" : /^End/i.test(connection.fromCell) ? "end" : void 0;
54029
54511
  if (!end) continue;
54030
- const entry3 = ends.get(connection.fromShapeId) ?? {};
54031
- entry3[end] ??= connection.toShapeId;
54032
- ends.set(connection.fromShapeId, entry3);
54512
+ const entry4 = ends.get(connection.fromShapeId) ?? {};
54513
+ entry4[end] ??= connection.toShapeId;
54514
+ ends.set(connection.fromShapeId, entry4);
54033
54515
  }
54034
54516
  const edges = [];
54035
54517
  for (const { begin, end } of ends.values())
@@ -54436,6 +54918,56 @@ function visioOrgReLayout(page) {
54436
54918
  return result2 && result2.moves.length ? result2.moves : void 0;
54437
54919
  }
54438
54920
 
54921
+ // visio/ui/org-chart-belt.ts
54922
+ function visioOrgSwapMaster(page, old, newId, drop2) {
54923
+ const ratio = page.drawingToPageScale ?? 1;
54924
+ const box6 = visioShapePageBounds(old);
54925
+ const data = {};
54926
+ for (const { row: row2 } of VISIO_ORG_ROWS) {
54927
+ const value3 = old.shapeData?.find((item2) => item2.name === row2)?.rawValue;
54928
+ if (value3 !== void 0) data[row2] = String(value3);
54929
+ }
54930
+ const rest = [
54931
+ {
54932
+ type: "replace-plain-text",
54933
+ pageId: page.id,
54934
+ shapeId: newId,
54935
+ text: old.text.plainText.trim() ? old.text.plainText : visioOrgText(data)
54936
+ },
54937
+ ...VISIO_ORG_ROWS.filter(({ row: row2 }) => data[row2] !== void 0).map(
54938
+ ({ row: row2, label: label2 }) => ({
54939
+ type: "set-shape-data",
54940
+ pageId: page.id,
54941
+ shapeId: newId,
54942
+ row: row2,
54943
+ data: { label: label2, prompt: "", type: "string", format: "", value: data[row2] ?? "" }
54944
+ })
54945
+ )
54946
+ ];
54947
+ for (const connection of page.connectors) {
54948
+ if (connection.toShapeId !== old.id) continue;
54949
+ const endpoint = /^Begin/i.test(connection.fromCell) ? "begin" : /^End/i.test(connection.fromCell) ? "end" : void 0;
54950
+ if (!endpoint) continue;
54951
+ const point2 = /^Connections\.X(\d+)$/.exec(connection.toCell);
54952
+ rest.push({
54953
+ type: "glue-connector",
54954
+ pageId: page.id,
54955
+ shapeId: connection.fromShapeId,
54956
+ endpoint,
54957
+ target: newId,
54958
+ ...point2 ? { point: Number(point2[1]) - 1 } : {}
54959
+ });
54960
+ }
54961
+ return {
54962
+ drop: drop2({
54963
+ x: (box6.minX + box6.maxX) / 2 / ratio,
54964
+ y: (box6.minY + box6.maxY) / 2 / ratio
54965
+ }),
54966
+ rest,
54967
+ removal: { type: "delete-shape", pageId: page.id, shapeId: old.id }
54968
+ };
54969
+ }
54970
+
54439
54971
  // visio/ui/org-chart-stencil-data.ts
54440
54972
  var ORG_STENCIL_MASTER_IDS = {
54441
54973
  "Executive Belt": "2",
@@ -54743,7 +55275,8 @@ function visioOrgDropPosition(pageId2, shapeId2, master2, at3) {
54743
55275
  y: at3.y
54744
55276
  };
54745
55277
  }
54746
- function visioOrgReportingLine(pageId2, lineId, manager, subordinate, between) {
55278
+ var ORG_POINT = { top: 0, bottom: 3 };
55279
+ function visioOrgReportingLine(pageId2, lineId, manager, subordinate, between, assistant = false) {
54747
55280
  return {
54748
55281
  drop: {
54749
55282
  type: "drop-stencil-master",
@@ -54755,8 +55288,24 @@ function visioOrgReportingLine(pageId2, lineId, manager, subordinate, between) {
54755
55288
  y: between.y
54756
55289
  },
54757
55290
  glue: [
54758
- { type: "glue-connector", pageId: pageId2, shapeId: lineId, endpoint: "begin", target: manager },
54759
- { type: "glue-connector", pageId: pageId2, shapeId: lineId, endpoint: "end", target: subordinate }
55291
+ // Visio's org chart glues the line to the manager's Bottom and the subordinate's Top
55292
+ // connection points, so the line keeps those points when a position moves.
55293
+ {
55294
+ type: "glue-connector",
55295
+ pageId: pageId2,
55296
+ shapeId: lineId,
55297
+ endpoint: "begin",
55298
+ target: manager,
55299
+ ...assistant ? {} : { point: ORG_POINT.bottom }
55300
+ },
55301
+ {
55302
+ type: "glue-connector",
55303
+ pageId: pageId2,
55304
+ shapeId: lineId,
55305
+ endpoint: "end",
55306
+ target: subordinate,
55307
+ ...assistant ? {} : { point: ORG_POINT.top }
55308
+ }
54760
55309
  ]
54761
55310
  };
54762
55311
  }
@@ -54771,10 +55320,11 @@ function visioOrgAddPosition(page, shapeId2, kind) {
54771
55320
  if (!selected2) return void 0;
54772
55321
  const managerId = kind === "peer" ? hierarchy.parentOf(shapeId2) : shapeId2;
54773
55322
  const manager = hierarchy.positions.find((shape) => shape.id === managerId);
54774
- const ids = visioOrgFreeIds(page, 1, 1);
55323
+ const promote = !!manager && kind !== "assistant" && masterOf(manager) === "Position Belt" && !hierarchy.childrenOf(manager.id).length;
55324
+ const ids = visioOrgFreeIds(page, promote ? 2 : 1, 1);
54775
55325
  if (!manager || !ids) return void 0;
54776
55326
  const newId = ids.positions[0];
54777
- const master2 = kind === "assistant" ? "Assistant Belt" : kind === "peer" ? masterOf(selected2) : "Position Belt";
55327
+ const master2 = kind === "assistant" || kind === "peer" && visioIsOrgAssistant(selected2) ? "Assistant Belt" : "Position Belt";
54778
55328
  const assistant = master2 === "Assistant Belt";
54779
55329
  const planned = layoutOrgPage(page, [
54780
55330
  { id: newId, ...VISIO_ORG_SIZE, parent: manager.id, ...assistant ? { assistant } : {} }
@@ -54783,20 +55333,40 @@ function visioOrgAddPosition(page, shapeId2, kind) {
54783
55333
  if (!planned || !centre2) return void 0;
54784
55334
  const data = { Name: "Name", Title: assistant ? "Assistant" : "Position" };
54785
55335
  const managerBox = drawingBox3(page, manager);
54786
- const line2 = visioOrgReportingLine(page.id, ids.lines[0], manager.id, newId, {
54787
- x: (managerBox.minX + managerBox.maxX + centre2.x * 2) / 4,
54788
- y: (managerBox.minY + centre2.y) / 2
54789
- });
55336
+ const promotedId = ids.positions[1];
55337
+ const swap = promote && promotedId ? visioOrgSwapMaster(
55338
+ page,
55339
+ manager,
55340
+ promotedId,
55341
+ (at3) => visioOrgDropPosition(page.id, promotedId, "Manager Belt", at3)
55342
+ ) : void 0;
55343
+ const line2 = visioOrgReportingLine(
55344
+ page.id,
55345
+ ids.lines[0],
55346
+ swap ? promotedId : manager.id,
55347
+ newId,
55348
+ {
55349
+ x: (managerBox.minX + managerBox.maxX + centre2.x * 2) / 4,
55350
+ y: (managerBox.minY + centre2.y) / 2
55351
+ },
55352
+ assistant
55353
+ );
54790
55354
  const pageId2 = page.id;
55355
+ const moves2 = planned.moves.map(
55356
+ (move) => swap && "shapeId" in move && move.shapeId === manager.id ? { ...move, shapeId: promotedId } : move
55357
+ );
54791
55358
  return {
54792
55359
  newId,
54793
55360
  edits: [
55361
+ ...swap ? [swap.drop] : [],
54794
55362
  visioOrgDropPosition(pageId2, newId, master2, centre2),
54795
55363
  line2.drop,
54796
55364
  { type: "replace-plain-text", pageId: pageId2, shapeId: newId, text: visioOrgText(data) },
54797
55365
  ...visioOrgDataEdits(pageId2, newId, data),
54798
- ...planned.moves,
54799
- ...line2.glue
55366
+ ...moves2,
55367
+ ...swap ? swap.rest : [],
55368
+ ...line2.glue,
55369
+ ...swap ? [swap.removal] : []
54800
55370
  ]
54801
55371
  };
54802
55372
  }
@@ -54815,10 +55385,17 @@ function visioOrgDeletePosition(page, shapeId2) {
54815
55385
  const joins = manager ? children3.map((child3, index3) => {
54816
55386
  const a2 = drawingBox3(page, manager);
54817
55387
  const b = drawingBox3(page, child3);
54818
- return visioOrgReportingLine(page.id, ids.lines[index3], manager.id, child3.id, {
54819
- x: (a2.minX + a2.maxX + b.minX + b.maxX) / 4,
54820
- y: (a2.minY + b.maxY) / 2
54821
- });
55388
+ return visioOrgReportingLine(
55389
+ page.id,
55390
+ ids.lines[index3],
55391
+ manager.id,
55392
+ child3.id,
55393
+ {
55394
+ x: (a2.minX + a2.maxX + b.minX + b.maxX) / 4,
55395
+ y: (a2.minY + b.maxY) / 2
55396
+ },
55397
+ visioIsOrgAssistant(child3)
55398
+ );
54822
55399
  }) : [];
54823
55400
  const removal = [...connectors, shapeId2].map((id4) => ({
54824
55401
  type: "delete-shape",
@@ -54947,7 +55524,8 @@ function visioOrgImportEdits(page, people) {
54947
55524
  ids.lines[index3],
54948
55525
  ids.positions[node3.parent],
54949
55526
  ids.positions[node3.index],
54950
- { x: (a2.x + b.x) / 2, y: (a2.y + b.y) / 2 }
55527
+ { x: (a2.x + b.x) / 2, y: (a2.y + b.y) / 2 },
55528
+ !!node3.person.assistant
54951
55529
  );
54952
55530
  });
54953
55531
  const edits = [
@@ -55661,17 +56239,23 @@ var LANE = 1.4;
55661
56239
  var TITLE3 = 0.35;
55662
56240
  var LEFT = 0.6;
55663
56241
  var GUTTER = 1.5;
56242
+ var norm2 = (value3) => value3.toLowerCase().replace(/[^a-z0-9]/g, "");
55664
56243
  var rowName = (name3) => name3.replace(/[^A-Za-z0-9]/g, "") || "Column";
55665
56244
  function visioVisualizerShapes(page) {
55666
56245
  const steps = /* @__PURE__ */ new Map();
55667
56246
  const links2 = [];
56247
+ const linkKeys = /* @__PURE__ */ new Map();
55668
56248
  for (const shape of page.shapes) {
55669
56249
  const row2 = shape.shapeData?.find((item2) => item2.name === VISIO_VISUALIZER_ROW);
55670
56250
  if (!row2) continue;
55671
- if (row2.label === "step") steps.set(String(row2.value ?? row2.rawValue ?? ""), shape.id);
55672
- else links2.push(shape.id);
56251
+ const value3 = String(row2.value ?? row2.rawValue ?? "");
56252
+ if (row2.label === "step") steps.set(value3, shape.id);
56253
+ else {
56254
+ links2.push(shape.id);
56255
+ if (!value3.endsWith(":label")) linkKeys.set(value3, shape.id);
56256
+ }
55673
56257
  }
55674
- return { steps, links: links2 };
56258
+ return { steps, links: links2, linkKeys };
55675
56259
  }
55676
56260
  var hidden2 = (label2, value3, invisible = true) => ({
55677
56261
  label: label2,
@@ -55690,10 +56274,31 @@ function visioDataVisualizerEdits(page, steps, variant) {
55690
56274
  if (shape?.rotation)
55691
56275
  centre2.set(stepId, { x: shape.rotation.pinX / ratio, y: shape.rotation.pinY / ratio });
55692
56276
  }
55693
- const removals = [...old.links, ...old.steps.values()].map((shapeId2) => ({
56277
+ const byId = new Map(page.shapes.map((shape) => [shape.id, shape]));
56278
+ const kept = /* @__PURE__ */ new Map();
56279
+ for (const step4 of steps) {
56280
+ const shapeId2 = old.steps.get(step4.id);
56281
+ const shape = shapeId2 ? byId.get(shapeId2) : void 0;
56282
+ const type = shape?.shapeData?.find((row2) => row2.name === "ShapeType");
56283
+ if (shapeId2 && shape && norm2(String(type?.value ?? "Process")) === norm2(step4.shapeType))
56284
+ kept.set(step4.id, shapeId2);
56285
+ }
56286
+ const wanted = new Set(steps.flatMap((step4) => step4.next.map((link) => `${step4.id}>${link.id}`)));
56287
+ const keptLinks = /* @__PURE__ */ new Map();
56288
+ for (const [key2, shapeId2] of old.linkKeys) {
56289
+ const [from, to] = key2.split(">");
56290
+ if (wanted.has(key2) && kept.has(from) && kept.has(to)) keptLinks.set(key2, shapeId2);
56291
+ }
56292
+ const gone = new Set(keptLinks.values());
56293
+ const goneSteps = new Set(kept.values());
56294
+ const removals = [
56295
+ ...old.links.filter((shapeId2) => !gone.has(shapeId2)),
56296
+ ...[...old.steps.values()].filter((shapeId2) => !goneSteps.has(shapeId2))
56297
+ ].map((shapeId2) => ({
55694
56298
  type: "delete-shape",
55695
56299
  pageId: page.id,
55696
- shapeId: shapeId2
56300
+ shapeId: shapeId2,
56301
+ deferred: true
55697
56302
  }));
55698
56303
  const edits = [];
55699
56304
  const notes = [];
@@ -55757,10 +56362,10 @@ function visioDataVisualizerEdits(page, steps, variant) {
55757
56362
  return { name: lane.text.plainText.trim(), y: (box6.minY + box6.maxY) / 2 / ratio };
55758
56363
  });
55759
56364
  for (const step4 of steps) {
55760
- const wanted = step4.lane || "Unassigned";
55761
- const lane = lanes.find((item2) => item2.name === wanted) ?? lanes[0];
55762
- if (lane.name !== wanted)
55763
- notes.push(`Step ${step4.id}: there is no "${wanted}" lane; placed in "${lane.name}".`);
56365
+ const wanted2 = step4.lane || "Unassigned";
56366
+ const lane = lanes.find((item2) => item2.name === wanted2) ?? lanes[0];
56367
+ if (lane.name !== wanted2)
56368
+ notes.push(`Step ${step4.id}: there is no "${wanted2}" lane; placed in "${lane.name}".`);
55764
56369
  at3.set(step4.id, {
55765
56370
  x: centre2.get(step4.id)?.x ?? left + GUTTER + depth.get(step4.id) * COLUMN - 0.4,
55766
56371
  y: lane.y
@@ -55796,10 +56401,40 @@ function visioDataVisualizerEdits(page, steps, variant) {
55796
56401
  y: bottom + frameHeight - TITLE3 - (names.indexOf(step4.lane || "Unassigned") + 0.5) * LANE
55797
56402
  });
55798
56403
  }
55799
- const shapeIds2 = new Map(steps.map((step4) => [step4.id, id4()]));
56404
+ const shapeIds2 = new Map(steps.map((step4) => [step4.id, kept.get(step4.id) ?? id4()]));
56405
+ const data = (shapeId2, step4) => [
56406
+ ...step4.values.map((value3) => ({
56407
+ type: "set-shape-data",
56408
+ pageId: page.id,
56409
+ shapeId: shapeId2,
56410
+ row: rowName(value3.name),
56411
+ data: hidden2(value3.label, value3.value, false)
56412
+ })),
56413
+ {
56414
+ type: "set-shape-data",
56415
+ pageId: page.id,
56416
+ shapeId: shapeId2,
56417
+ row: VISIO_VISUALIZER_ROW,
56418
+ data: hidden2("step", step4.id)
56419
+ }
56420
+ ];
55800
56421
  for (const step4 of steps) {
55801
56422
  const shapeId2 = shapeIds2.get(step4.id);
55802
56423
  const place2 = at3.get(step4.id);
56424
+ if (kept.has(step4.id)) {
56425
+ const before = centre2.get(step4.id);
56426
+ if (!before || Math.hypot(before.x - place2.x, before.y - place2.y) > 0.01)
56427
+ edits.push({ type: "move-shape", pageId: page.id, shapeId: shapeId2, x: place2.x, y: place2.y });
56428
+ if (byId.get(shapeId2)?.text.plainText !== step4.description)
56429
+ edits.push({
56430
+ type: "replace-plain-text",
56431
+ pageId: page.id,
56432
+ shapeId: shapeId2,
56433
+ text: step4.description
56434
+ });
56435
+ edits.push(...data(shapeId2, step4));
56436
+ continue;
56437
+ }
55803
56438
  edits.push(
55804
56439
  {
55805
56440
  type: "drop-stencil-master",
@@ -55818,24 +56453,23 @@ function visioDataVisualizerEdits(page, steps, variant) {
55818
56453
  fillColor: FILLS3[step4.master] ?? "#D8EFEB",
55819
56454
  lineColor: LINE2
55820
56455
  },
55821
- ...step4.values.map((value3) => ({
55822
- type: "set-shape-data",
55823
- pageId: page.id,
55824
- shapeId: shapeId2,
55825
- row: rowName(value3.name),
55826
- data: hidden2(value3.label, value3.value, false)
55827
- })),
55828
- {
55829
- type: "set-shape-data",
55830
- pageId: page.id,
55831
- shapeId: shapeId2,
55832
- row: VISIO_VISUALIZER_ROW,
55833
- data: hidden2("step", step4.id)
55834
- }
56456
+ ...data(shapeId2, step4)
55835
56457
  );
55836
56458
  }
55837
56459
  for (const step4 of steps)
55838
56460
  for (const link of step4.next) {
56461
+ const key2 = `${step4.id}>${link.id}`;
56462
+ const existing = keptLinks.get(key2);
56463
+ if (existing) {
56464
+ if (byId.get(existing)?.text.plainText !== link.label)
56465
+ edits.push({
56466
+ type: "replace-plain-text",
56467
+ pageId: page.id,
56468
+ shapeId: existing,
56469
+ text: link.label
56470
+ });
56471
+ continue;
56472
+ }
55839
56473
  const from = at3.get(step4.id);
55840
56474
  const to = at3.get(link.id);
55841
56475
  const shapeId2 = id4();
@@ -55848,7 +56482,8 @@ function visioDataVisualizerEdits(page, steps, variant) {
55848
56482
  beginY: from.y,
55849
56483
  endX: to.x,
55850
56484
  endY: to.y,
55851
- connect: { begin: shapeIds2.get(step4.id), end: shapeIds2.get(link.id) }
56485
+ connect: { begin: shapeIds2.get(step4.id), end: shapeIds2.get(link.id) },
56486
+ text: link.label
55852
56487
  },
55853
56488
  { type: "format-shape", pageId: page.id, shapeId: shapeId2, lineColor: LINE2 },
55854
56489
  {
@@ -55856,35 +56491,16 @@ function visioDataVisualizerEdits(page, steps, variant) {
55856
56491
  pageId: page.id,
55857
56492
  shapeId: shapeId2,
55858
56493
  row: VISIO_VISUALIZER_ROW,
55859
- data: hidden2("link", `${step4.id}>${link.id}`)
56494
+ data: hidden2("link", key2)
55860
56495
  }
55861
56496
  );
55862
- if (link.label) {
55863
- const labelId = id4();
55864
- edits.push(
55865
- {
55866
- type: "create-text-box",
55867
- pageId: page.id,
55868
- shapeId: labelId,
55869
- x: (from.x + to.x) / 2 + 0.05,
55870
- y: (from.y + to.y) / 2,
55871
- width: 0.7,
55872
- height: 0.25,
55873
- text: link.label
55874
- },
55875
- {
55876
- type: "set-shape-data",
55877
- pageId: page.id,
55878
- shapeId: labelId,
55879
- row: VISIO_VISUALIZER_ROW,
55880
- data: hidden2("link", `${step4.id}>${link.id}:label`)
55881
- }
55882
- );
55883
- }
55884
56497
  }
55885
56498
  if (variant === "cross-functional")
55886
56499
  edits.push({ type: "reconcile-containers", pageId: page.id, shapeIds: [...shapeIds2.values()] });
55887
- return { batches: [pageEdits, removals, edits].filter((batch) => batch.length), notes };
56500
+ return {
56501
+ batches: [[...pageEdits, ...edits, ...removals]].filter((batch) => batch.length),
56502
+ notes
56503
+ };
55888
56504
  }
55889
56505
 
55890
56506
  // visio/ui/select-by-type.ts
@@ -55914,8 +56530,8 @@ function visioPageMasters(page) {
55914
56530
  const masters = /* @__PURE__ */ new Map();
55915
56531
  for (const shape of page.shapes) {
55916
56532
  if (shape.masterId === void 0) continue;
55917
- const entry3 = masters.get(shape.masterId);
55918
- if (entry3) ++entry3.count;
56533
+ const entry4 = masters.get(shape.masterId);
56534
+ if (entry4) ++entry4.count;
55919
56535
  else masters.set(shape.masterId, { id: shape.masterId, example: shape.name, count: 1 });
55920
56536
  }
55921
56537
  return [...masters.values()];
@@ -56723,4 +57339,4 @@ async function createTemplateVsdx(id4) {
56723
57339
  return (await editVsdx(named2.bytes, shapeEdits(page))).bytes;
56724
57340
  }
56725
57341
 
56726
- export { DocumentHistory, EDIT_HISTORY_LIMITS, EMPTY_EDIT_STATE, EMPTY_SELECTION, EMPTY_TEXT_SEARCH, FOREIGN_VECTOR_SCENE_LIMITS, ForeignVectorBudget, MAX_INPUT_BYTES, TEXT_SEARCH_LIMITS, VISIO_AUTO_CONNECT_DIRECTIONS, VISIO_AUTO_CONNECT_GAP, VISIO_AUTO_CONNECT_REACH, VISIO_BULLET_STYLES, VISIO_CAPABILITY_BACKSTAGE_PAGES, VISIO_CAPABILITY_COMMANDS, VISIO_CAPABILITY_IDS, VISIO_CHART_OBJECT_SIZE, VISIO_DATA_GRAPHIC_DEFAULT_POSITION, VISIO_DATA_GRAPHIC_FILL_ROW, VISIO_DATA_GRAPHIC_ICONS, VISIO_DATA_GRAPHIC_POSITIONS, VISIO_DATA_GRAPHIC_ROW, VISIO_DIAGRAM_RULE_SETS, VISIO_FIELD_CATEGORIES, VISIO_FORMAT_PAINTER_LIMITS, VISIO_GRID_DENSITY_CHOICES, IDENTITY_AFFINE as VISIO_IDENTITY_TRANSFORM, VISIO_INITIAL_PRESENCE, VISIO_LAYOUT_LABELS, VISIO_LAYOUT_STYLES, VISIO_ORG_ROWS, VISIO_ORG_SIZE, VISIO_PAGE_SIZE_PRESETS, VISIO_PAPER_SIZES, VISIO_PASTE_TEXT_LIMIT, VISIO_PATH_CLOSE_DISTANCE, VISIO_PATH_TOLERANCE, VISIO_PICTURE_DPI, VISIO_PRESENCE_MAX_COORDINATE, VISIO_PRESENCE_MAX_ID, VISIO_PRESENCE_MAX_SELECTION, VISIO_RESIZE_HANDLES, VISIO_RULER_DENSITY_CHOICES, VISIO_SELECT_TYPES, VISIO_SELECT_TYPE_LABELS, VISIO_SUBPROCESS_SHAPE, VISIO_TEMPLATES, VISIO_TEXT_BLOCK_HANDLES, VISIO_TEXT_LANGUAGES, VISIO_TEXT_REPLACE_LIMITS, VISIO_VISUALIZER_COLUMNS, VISIO_VISUALIZER_ROW, VisioTextDraftError, assertShapeDetails, assertViewableDocument, assertVisioGeometryExpectation, checkVisioDiagram, clampHistoryEntries, compatibilityNotes, compatibilityText, composeAffine as composeVisioTransform, copySnapshotScene, createSampleVsdx, createTemplateVsdx, demoDocument, editErrorMessage, encodeDataGraphicConfig, eventKeys, excelSerialToIso, hasVisibleShapeContent, indexDocumentText, inspectForeignVectorResource, isEditCancellation, isVisioPathTool, isVisioTemplateId, layoutOrgPage, normalizeVisioHyperlinkAddress, planOrgLayout, propertyKeys, sameSelection, sanitizeVisioPresence, searchDocumentText, selectionKey, shapeEdits, snapshotEdits, snapshotSelection, snapshotVisioGeometryExpectation, textSearchStatus, validateSearchQuery, visioAddConnectionPointCommand, visioArrangeCommands, visioAutoAlignCommands, visioAutoConnectArrows, visioAutoConnectNeighbor, visioAutoConnectPlacement, visioAutoConnectPlan, visioAutoConnectShape, visioAutoConnectSidePoint, visioAutoSpaceDataGraphicEdits, visioBoxCreationCommand, visioCalloutCommand, visioChangeCaseCommand, visioChangeCaseShape, visioChangeMasterCommand, visioChangeMasterTargets, visioChangeShapeCommand, visioChangeShapeRefusal, visioChartObjectInsertCommand, visioClipboardShape, visioColorRules, visioConnectableShape, visioConnectorCreationCommand, visioConnectorEdges, visioConnectorEndHandles, visioConnectorMovePreviews, visioConnectorPreviewPath, visioConnectorRouteOf, visioContainerCommand, visioContainerUpkeep, visioCopyableShape, visioCreateSwimlanes, visioDataGraphicCenter, visioDataGraphicConfigs, visioDataGraphicEdits, visioDataGraphicFields, visioDataGraphicItems, visioDataGraphicMarker, visioDataGraphicParts, visioDataTable, visioDataVisualizerEdits, visioDeleteDataGraphicItemEdits, visioDeleteSwimlane, visioDrawBounds, visioDrawIsLargeEnough, visioDrawPlan, visioDrawingPoint, visioDuplicateCommand, visioFileMasterDropCommand, visioFillPatternTransform, visioFitToDrawingEdits, visioFollowTarget, visioFontFamilies, visioFormatPainterEdits, visioFormatPainterSnapshot, visioFormatTargetShape, visioFormattingShape, visioGlowKey, visioGlueableShape, visioGradientInstances, visioGridSteps, visioGroupCommand, visioGuideCreateCommand, visioGuideMoveCommand, visioInsertSeparator, visioInsertSwimlane, visioIsOrgAssistant, visioIsOrgPosition, visioIsSwimlaneShape, visioKeepAutoSize, visioLayerAssignCommand, visioLayerAssignCommands, visioLayerAssignState, visioLegendEdits, visioLineCreationCommand, visioLineDashLengths, visioLocalFormattingShape, visioLocalRotationShape, visioMarqueeBox, visioMarqueeSelection, visioMasterDropCommand, visioMasterDropRefusal, visioMasterDropSize, visioMasterPreviewBox, visioMatchingPaperSize, visioMovableGroup, visioMoveCommands, visioMovePreviewTransform, visioMoveTargets, visioMovementShape, visioNearestConnectionPoint, visioNewLayerNames, visioNewPageId, visioNextShapeId, visioNudgeCommands, visioOrderingShape, visioOrgAddPosition, visioOrgDataEdits, visioOrgDeletePosition, visioOrgDropPosition, visioOrgFollowData, visioOrgFreeIds, visioOrgHierarchy, visioOrgImportEdits, visioOrgPeople, visioOrgPosition, visioOrgReLayout, visioOrgReportingLine, visioOrgText, visioOrientationEdits, visioPageBreaks, visioPageConnectionPoints, visioPageDecorationState, visioPageDragDelta, visioPageEditToDrawing, visioPageGuides, visioPageInsertCommand, visioPageMasters, visioPageOrientationCommand, visioPageSizeCommand, visioPageSizePresetCommand, visioPageSizePresetEdits, visioPageSizeState, visioPaperSize, visioParseRange, visioParseVisualizerTable, visioPasteCommand, visioPasteTextCommand, visioPasteTextValue, visioPathDrawPlan, visioPathPreview, visioPictureInsertCommand, visioPositionDataGraphicEdits, visioPrintTile, visioProportionalSize, visioQuarterTurnCommand, visioReLayoutCommands, visioReflectionKey, visioRemoveDataGraphicEdits, visioRenderedGradientStopCount, visioRenderedGradientStops, visioResizeDrag, visioResizeFrame, visioResizeHandlePoint, visioResizeKeepsProportions, visioResizeSelectionDrag, visioResizeSelectionFrame, visioResizeShape, visioResizeSizeMatches, visioResizeSwimlane, visioRespaceDataGraphicEdits, visioRotationPreviewTransform, visioRotationShape, visioRulerDensityFactor, visioRulerGridEdits, visioRulerGridValues, visioSceneToLocal, visioSelectByType, visioSelectionIsOnPage, visioSetDataGraphicItemEdits, visioShadowPreset, visioShapeDataNumber, visioShapeDataRow, visioShapeDataText, visioShapeEffectValues, visioShapeFormattingState, visioShapeFrame, visioShapeLocalPoint, visioShapePageBounds, visioShapePageBox, visioShapeReport, visioShapeReportCsv, visioShapeReportTable, visioShapeReportText, visioShapeSelectType, visioShapeSnapBox, visioSizePositionCommand, visioSizePositionState, visioSnapMoveDelta, visioSnapResizeDrag, visioSnapTargets, visioStencilDropCommand, visioStencilInstanceShape, visioStencilShape, visioStencilSubShape, visioStraightLineHandles, visioStrokeGradient, visioStyleFormattingShape, visioSubprocessCommand, visioSvgStrokeStyle, visioSwimlaneInfo, visioSwimlaneOptions, visioTextAppendEdit, visioTextBlockDrag, visioTextBlockEdit, visioTextBlockFrame, visioTextBlockMatrix, visioTextBlockShape, visioTextDialogPatch, visioTextDialogValues, visioTextDraftEdit, visioTextFontStepCommand, visioTextFormattingState, visioTextIndentCommand, visioTextOccurrenceSelection, visioTextReplaceCommands, visioTextReplaceFindNext, visioTextReplaceOccurrences, visioTextReplacePlan, visioTextShape, visioTextSource, visioUngroupCommand, visioVisualizerDepths, visioVisualizerShapes, visioVisualizerSize, visioWithCalloutLeaders, visioWithContainerMembers, visioWithDataGraphics, visioWorkbookGrid };
57342
+ export { DocumentHistory, EDIT_HISTORY_LIMITS, EMPTY_EDIT_STATE, EMPTY_SELECTION, EMPTY_TEXT_SEARCH, FOREIGN_VECTOR_SCENE_LIMITS, ForeignVectorBudget, MAX_INPUT_BYTES, ORG_POINT, TEXT_SEARCH_LIMITS, VISIO_AUTO_CONNECT_DIRECTIONS, VISIO_AUTO_CONNECT_GAP, VISIO_AUTO_CONNECT_REACH, VISIO_BULLET_STYLES, VISIO_CAPABILITY_BACKSTAGE_PAGES, VISIO_CAPABILITY_COMMANDS, VISIO_CAPABILITY_IDS, VISIO_CHART_OBJECT_SIZE, VISIO_DATA_GRAPHIC_DEFAULT_POSITION, VISIO_DATA_GRAPHIC_FILL_ROW, VISIO_DATA_GRAPHIC_ICONS, VISIO_DATA_GRAPHIC_POSITIONS, VISIO_DATA_GRAPHIC_ROW, VISIO_DIAGRAM_RULE_SETS, VISIO_FIELD_CATEGORIES, VISIO_FORMAT_PAINTER_LIMITS, VISIO_GRID_DENSITY_CHOICES, IDENTITY_AFFINE as VISIO_IDENTITY_TRANSFORM, VISIO_INITIAL_PRESENCE, VISIO_LAYOUT_LABELS, VISIO_LAYOUT_STYLES, VISIO_ORG_ROWS, VISIO_ORG_SIZE, VISIO_PAGE_SIZE_PRESETS, VISIO_PAPER_SIZES, VISIO_PASTE_TEXT_LIMIT, VISIO_PATH_CLOSE_DISTANCE, VISIO_PATH_TOLERANCE, VISIO_PICTURE_DPI, VISIO_PRESENCE_MAX_COORDINATE, VISIO_PRESENCE_MAX_ID, VISIO_PRESENCE_MAX_SELECTION, VISIO_RESIZE_HANDLES, VISIO_RULER_DENSITY_CHOICES, VISIO_SELECT_TYPES, VISIO_SELECT_TYPE_LABELS, VISIO_SUBPROCESS_SHAPE, VISIO_TEMPLATES, VISIO_TEXT_BLOCK_HANDLES, VISIO_TEXT_LANGUAGES, VISIO_TEXT_REPLACE_LIMITS, VISIO_VISUALIZER_COLUMNS, VISIO_VISUALIZER_ROW, VisioTextDraftError, assertShapeDetails, assertViewableDocument, assertVisioGeometryExpectation, checkVisioDiagram, clampHistoryEntries, compatibilityNotes, compatibilityText, composeAffine as composeVisioTransform, copySnapshotScene, createSampleVsdx, createTemplateVsdx, demoDocument, editErrorMessage, encodeDataGraphicConfig, eventKeys, excelSerialToIso, hasVisibleShapeContent, indexDocumentText, inspectForeignVectorResource, isEditCancellation, isVisioPathTool, isVisioTemplateId, layoutOrgPage, normalizeVisioHyperlinkAddress, planOrgLayout, propertyKeys, sameSelection, sanitizeVisioPresence, searchDocumentText, selectionKey, shapeEdits, snapshotEdits, snapshotSelection, snapshotVisioGeometryExpectation, textSearchStatus, validateSearchQuery, visioAddConnectionPointCommand, visioArrangeCommands, visioAutoAlignCommands, visioAutoConnectArrows, visioAutoConnectNeighbor, visioAutoConnectPlacement, visioAutoConnectPlan, visioAutoConnectShape, visioAutoConnectSidePoint, visioAutoSpaceDataGraphicEdits, visioBoxCreationCommand, visioCalloutCommand, visioChangeCaseCommand, visioChangeCaseShape, visioChangeMasterCommand, visioChangeMasterTargets, visioChangeShapeCommand, visioChangeShapeRefusal, visioChartObjectInsertCommand, visioClipboardShape, visioColorRules, visioConnectableShape, visioConnectorCreationCommand, visioConnectorEdges, visioConnectorEndHandles, visioConnectorMovePreviews, visioConnectorPreviewPath, visioConnectorRouteOf, visioContainerCommand, visioContainerUpkeep, visioCopyableShape, visioCreateSwimlanes, visioDataGraphicCenter, visioDataGraphicConfigs, visioDataGraphicEdits, visioDataGraphicFields, visioDataGraphicItems, visioDataGraphicMarker, visioDataGraphicParts, visioDataTable, visioDataVisualizerEdits, visioDeleteDataGraphicItemEdits, visioDeleteSwimlane, visioDrawBounds, visioDrawIsLargeEnough, visioDrawPlan, visioDrawingPoint, visioDuplicateCommand, visioFileMasterDropCommand, visioFillPatternTransform, visioFitToDrawingEdits, visioFollowTarget, visioFontFamilies, visioFormatPainterEdits, visioFormatPainterSnapshot, visioFormatTargetShape, visioFormattingShape, visioGlowKey, visioGlueableShape, visioGradientInstances, visioGridSteps, visioGroupCommand, visioGuideCreateCommand, visioGuideMoveCommand, visioInsertSeparator, visioInsertSwimlane, visioIsOrgAssistant, visioIsOrgPosition, visioIsSwimlaneShape, visioKeepAutoSize, visioLayerAssignCommand, visioLayerAssignCommands, visioLayerAssignState, visioLegendEdits, visioLineCreationCommand, visioLineDashLengths, visioLocalFormattingShape, visioLocalRotationShape, visioMarqueeBox, visioMarqueeSelection, visioMasterDropCommand, visioMasterDropRefusal, visioMasterDropSize, visioMasterPreviewBox, visioMatchingPaperSize, visioMovableGroup, visioMoveCommands, visioMovePreviewTransform, visioMoveTargets, visioMovementShape, visioNearestConnectionPoint, visioNewLayerNames, visioNewPageId, visioNextShapeId, visioNudgeCommands, visioOrderingShape, visioOrgAddPosition, visioOrgDataEdits, visioOrgDeletePosition, visioOrgDropPosition, visioOrgFollowData, visioOrgFreeIds, visioOrgHierarchy, visioOrgImportEdits, visioOrgPeople, visioOrgPosition, visioOrgReLayout, visioOrgReportingLine, visioOrgText, visioOrientationEdits, visioPageBreaks, visioPageConnectionPoints, visioPageDecorationState, visioPageDragDelta, visioPageEditToDrawing, visioPageGuides, visioPageInsertCommand, visioPageMasters, visioPageOrientationCommand, visioPageSizeCommand, visioPageSizePresetCommand, visioPageSizePresetEdits, visioPageSizeState, visioPaperSize, visioParseRange, visioParseVisualizerTable, visioPasteCommand, visioPasteTextCommand, visioPasteTextValue, visioPathDrawPlan, visioPathPreview, visioPictureInsertCommand, visioPositionDataGraphicEdits, visioPrintTile, visioProportionalSize, visioQuarterTurnCommand, visioReLayoutCommands, visioReflectionKey, visioRemoveDataGraphicEdits, visioRenderedGradientStopCount, visioRenderedGradientStops, visioResizeDrag, visioResizeFrame, visioResizeHandlePoint, visioResizeKeepsProportions, visioResizeSelectionDrag, visioResizeSelectionFrame, visioResizeShape, visioResizeSizeMatches, visioResizeSwimlane, visioRespaceDataGraphicEdits, visioRotationPreviewTransform, visioRotationShape, visioRulerDensityFactor, visioRulerGridEdits, visioRulerGridValues, visioSceneToLocal, visioSelectByType, visioSelectionIsOnPage, visioSetDataGraphicItemEdits, visioShadowPreset, visioShapeDataNumber, visioShapeDataRow, visioShapeDataText, visioShapeEffectValues, visioShapeFormattingState, visioShapeFrame, visioShapeLocalPoint, visioShapePageBounds, visioShapePageBox, visioShapeReport, visioShapeReportCsv, visioShapeReportTable, visioShapeReportText, visioShapeSelectType, visioShapeSnapBox, visioSizePositionCommand, visioSizePositionState, visioSnapMoveDelta, visioSnapResizeDrag, visioSnapTargets, visioStencilDropCommand, visioStencilInstanceShape, visioStencilShape, visioStencilSubShape, visioStraightLineHandles, visioStrokeGradient, visioStyleFormattingShape, visioSubprocessCommand, visioSvgStrokeStyle, visioSwimlaneInfo, visioSwimlaneOptions, visioTextAppendEdit, visioTextBlockDrag, visioTextBlockEdit, visioTextBlockFrame, visioTextBlockMatrix, visioTextBlockShape, visioTextDialogPatch, visioTextDialogValues, visioTextDraftEdit, visioTextFontStepCommand, visioTextFormattingState, visioTextIndentCommand, visioTextOccurrenceSelection, visioTextReplaceCommands, visioTextReplaceFindNext, visioTextReplaceOccurrences, visioTextReplacePlan, visioTextShape, visioTextSource, visioUngroupCommand, visioVisualizerDepths, visioVisualizerShapes, visioVisualizerSize, visioWithCalloutLeaders, visioWithContainerMembers, visioWithDataGraphics, visioWorkbookGrid };