@pixerate/editor 0.54.0 → 0.55.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 (65) hide show
  1. package/dist/agent/index.cjs +6 -6
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.js +6 -6
  4. package/dist/animation/index.cjs +1 -1
  5. package/dist/animation/index.cjs.map +1 -1
  6. package/dist/animation/index.d.cts +2 -1
  7. package/dist/animation/index.d.ts +2 -1
  8. package/dist/animation/index.js +1 -1
  9. package/dist/animation-editor/index.cjs +2221 -0
  10. package/dist/animation-editor/index.cjs.map +1 -0
  11. package/dist/animation-editor/index.d.cts +1117 -0
  12. package/dist/animation-editor/index.d.ts +1117 -0
  13. package/dist/animation-editor/index.js +2221 -0
  14. package/dist/animation-editor/index.js.map +1 -0
  15. package/dist/bezier-BfwIbVTl.d.cts +548 -0
  16. package/dist/bezier-DYBvLgUH.d.ts +548 -0
  17. package/dist/canvas/index.cjs +713 -486
  18. package/dist/canvas/index.cjs.map +1 -1
  19. package/dist/canvas/index.d.cts +105 -5
  20. package/dist/canvas/index.d.ts +105 -5
  21. package/dist/canvas/index.js +710 -483
  22. package/dist/canvas/index.js.map +1 -1
  23. package/dist/chart/index.cjs +1 -1
  24. package/dist/chart/index.cjs.map +1 -1
  25. package/dist/chart/index.js +1 -1
  26. package/dist/{chunk-TO22LX34.js → chunk-GTMJ4Y3S.js} +2208 -2920
  27. package/dist/chunk-GTMJ4Y3S.js.map +1 -0
  28. package/dist/chunk-MLREO6J3.cjs +737 -0
  29. package/dist/chunk-MLREO6J3.cjs.map +1 -0
  30. package/dist/chunk-NONDTTH7.js +5979 -0
  31. package/dist/chunk-NONDTTH7.js.map +1 -0
  32. package/dist/{chunk-YNSK4MGT.cjs → chunk-O2UH7LZE.cjs} +1549 -2261
  33. package/dist/chunk-O2UH7LZE.cjs.map +1 -0
  34. package/dist/chunk-VWZB6BCY.js +737 -0
  35. package/dist/chunk-VWZB6BCY.js.map +1 -0
  36. package/dist/chunk-XCXQDPID.cjs +5979 -0
  37. package/dist/chunk-XCXQDPID.cjs.map +1 -0
  38. package/dist/color-E9pwm--w.d.cts +33 -0
  39. package/dist/color-E9pwm--w.d.ts +33 -0
  40. package/dist/commands/index.cjs +2 -2
  41. package/dist/commands/index.cjs.map +1 -1
  42. package/dist/commands/index.js +3 -3
  43. package/dist/diagram/index.cjs +25 -4
  44. package/dist/diagram/index.cjs.map +1 -1
  45. package/dist/diagram/index.d.cts +23 -0
  46. package/dist/diagram/index.d.ts +23 -0
  47. package/dist/diagram/index.js +33 -12
  48. package/dist/diagram/index.js.map +1 -1
  49. package/dist/pathfinder-BZL8aSu0.d.cts +469 -0
  50. package/dist/pathfinder-CNtsbCRK.d.ts +469 -0
  51. package/dist/{player-DSMjdgQ9.d.cts → player-Dg0FT0UI.d.cts} +1 -33
  52. package/dist/{player-DdfVrKWq.d.ts → player-W-5DX3Go.d.ts} +1 -33
  53. package/dist/svg-CLg2zqZA.d.cts +847 -0
  54. package/dist/svg-CPK82TtU.d.ts +847 -0
  55. package/dist/vector/index.cjs +1328 -6752
  56. package/dist/vector/index.cjs.map +1 -1
  57. package/dist/vector/index.d.cts +6 -846
  58. package/dist/vector/index.d.ts +6 -846
  59. package/dist/vector/index.js +645 -6069
  60. package/dist/vector/index.js.map +1 -1
  61. package/package.json +6 -1
  62. package/dist/chunk-TO22LX34.js.map +0 -1
  63. package/dist/chunk-YNSK4MGT.cjs.map +0 -1
  64. package/dist/pathfinder-B9xh_pCZ.d.ts +0 -1013
  65. package/dist/pathfinder-QdG70sr9.d.cts +0 -1013
@@ -4,6 +4,7 @@
4
4
 
5
5
 
6
6
 
7
+ var _chunkK2UYKJ6Mcjs = require('../chunk-K2UYKJ6M.cjs');
7
8
 
8
9
 
9
10
 
@@ -12,8 +13,10 @@
12
13
 
13
14
 
14
15
 
16
+ var _chunkMLREO6J3cjs = require('../chunk-MLREO6J3.cjs');
15
17
 
16
18
 
19
+ var _chunkH5K77C7Ycjs = require('../chunk-H5K77C7Y.cjs');
17
20
 
18
21
 
19
22
 
@@ -28,9 +31,11 @@
28
31
 
29
32
 
30
33
 
34
+ var _chunkWADCJ7A7cjs = require('../chunk-WADCJ7A7.cjs');
31
35
 
32
36
 
33
37
 
38
+ var _chunk26BVFKHUcjs = require('../chunk-26BVFKHU.cjs');
34
39
 
35
40
 
36
41
 
@@ -87,10 +92,8 @@
87
92
 
88
93
 
89
94
 
90
- var _chunkYNSK4MGTcjs = require('../chunk-YNSK4MGT.cjs');
91
95
 
92
96
 
93
- var _chunkH5K77C7Ycjs = require('../chunk-H5K77C7Y.cjs');
94
97
 
95
98
 
96
99
 
@@ -105,18 +108,17 @@ var _chunkH5K77C7Ycjs = require('../chunk-H5K77C7Y.cjs');
105
108
 
106
109
 
107
110
 
108
- var _chunkWADCJ7A7cjs = require('../chunk-WADCJ7A7.cjs');
109
111
 
110
112
 
111
113
 
112
- var _chunk26BVFKHUcjs = require('../chunk-26BVFKHU.cjs');
113
114
 
114
115
 
115
116
 
116
117
 
117
118
 
118
119
 
119
- var _chunkK2UYKJ6Mcjs = require('../chunk-K2UYKJ6M.cjs');
120
+
121
+ var _chunkO2UH7LZEcjs = require('../chunk-O2UH7LZE.cjs');
120
122
 
121
123
 
122
124
 
@@ -139,6 +141,7 @@ var _chunkO4ONBPZWcjs = require('../chunk-O4ONBPZW.cjs');
139
141
  var _chunkMR3Z4OQIcjs = require('../chunk-MR3Z4OQI.cjs');
140
142
 
141
143
 
144
+ var _chunkA6PHCAGXcjs = require('../chunk-A6PHCAGX.cjs');
142
145
 
143
146
 
144
147
 
@@ -151,10 +154,9 @@ var _chunkMR3Z4OQIcjs = require('../chunk-MR3Z4OQI.cjs');
151
154
 
152
155
 
153
156
 
154
- var _chunkXZ4L3R4Kcjs = require('../chunk-XZ4L3R4K.cjs');
155
157
 
156
158
 
157
- var _chunkA6PHCAGXcjs = require('../chunk-A6PHCAGX.cjs');
159
+ var _chunkXZ4L3R4Kcjs = require('../chunk-XZ4L3R4K.cjs');
158
160
 
159
161
  // src/canvas/trajectory.ts
160
162
  var defaultEasing = (t) => --t * t * t + 1;
@@ -410,7 +412,7 @@ function calculateDirectionalDisplacement(params) {
410
412
  }
411
413
  if (spreadSiblingLanes && (direction === "right" || direction === "left")) {
412
414
  for (const [nodeId, pos] of displacedMap.entries()) {
413
- const node = existingNodes.find((n2) => n2.id === nodeId);
415
+ const node = existingNodes.find((n3) => n3.id === nodeId);
414
416
  if (node && Math.abs(node.position.y - originNode.position.y) < siblingTolerance) {
415
417
  const isAbove = node.position.y < originNode.position.y;
416
418
  displacedMap.set(nodeId, {
@@ -444,12 +446,12 @@ function calculateDagreReflowDisplacement(params) {
444
446
  defaultNodeWidth = 200,
445
447
  defaultNodeHeight = 60
446
448
  } = options;
447
- const anchorNode = currentNodes.find((n2) => n2.id === anchorNodeId);
449
+ const anchorNode = currentNodes.find((n3) => n3.id === anchorNodeId);
448
450
  if (!anchorNode) return /* @__PURE__ */ new Map();
449
451
  const g = new _dagre2.default.graphlib.Graph();
450
452
  g.setDefaultEdgeLabel(() => ({}));
451
453
  g.setGraph({ rankdir: direction, ranksep, nodesep });
452
- const nodeIds = new Set(futureNodes.map((n2) => n2.id));
454
+ const nodeIds = new Set(futureNodes.map((n3) => n3.id));
453
455
  futureNodes.forEach((node) => {
454
456
  const nodeWidth = _nullishCoalesce(_nullishCoalesce(_optionalChain([node, 'access', _14 => _14.measured, 'optionalAccess', _15 => _15.width]), () => ( node.width)), () => ( defaultNodeWidth));
455
457
  const nodeHeight = _nullishCoalesce(_nullishCoalesce(_optionalChain([node, 'access', _16 => _16.measured, 'optionalAccess', _17 => _17.height]), () => ( node.height)), () => ( defaultNodeHeight));
@@ -578,15 +580,15 @@ function remapPastedNodes(nodes, edges = [], offset = { x: 30, y: 30 }, idGenera
578
580
  }
579
581
  function repositionNodesTo(nodes, targetOrigin) {
580
582
  if (nodes.length === 0) return [];
581
- const minX = Math.min(...nodes.map((n2) => n2.position.x));
582
- const minY = Math.min(...nodes.map((n2) => n2.position.y));
583
+ const minX = Math.min(...nodes.map((n3) => n3.position.x));
584
+ const minY = Math.min(...nodes.map((n3) => n3.position.y));
583
585
  const deltaX = targetOrigin.x - minX;
584
586
  const deltaY = targetOrigin.y - minY;
585
- return nodes.map((n2) => ({
586
- ...n2,
587
+ return nodes.map((n3) => ({
588
+ ...n3,
587
589
  position: {
588
- x: n2.position.x + deltaX,
589
- y: n2.position.y + deltaY
590
+ x: n3.position.x + deltaX,
591
+ y: n3.position.y + deltaY
590
592
  }
591
593
  }));
592
594
  }
@@ -629,7 +631,7 @@ function mix(a, b, t) {
629
631
  }
630
632
  function blendLayout(from, to, t) {
631
633
  if (t >= 1) return to;
632
- const fromMap = new Map(from.map((n2) => [n2.id, n2]));
634
+ const fromMap = new Map(from.map((n3) => [n3.id, n3]));
633
635
  return to.map((target) => {
634
636
  const origin = fromMap.get(target.id);
635
637
  if (!origin) return target;
@@ -857,7 +859,7 @@ function getAbsolutePosition(node, lookup) {
857
859
  return { x, y };
858
860
  }
859
861
  function createNodeLookup(nodes) {
860
- return new Map(nodes.map((n2) => [n2.id, n2]));
862
+ return new Map(nodes.map((n3) => [n3.id, n3]));
861
863
  }
862
864
  function getNodeRect(node, lookup, options) {
863
865
  const { x, y } = node.parentId && lookup ? getAbsolutePosition(node, lookup) : node.position;
@@ -900,7 +902,7 @@ function unlockNodes(nodes, ids) {
900
902
  }
901
903
  function toggleLockNodes(nodes, ids) {
902
904
  const idSet = new Set(ids);
903
- const anyUnlocked = nodes.some((n2) => idSet.has(n2.id) && !isLocked(n2));
905
+ const anyUnlocked = nodes.some((n3) => idSet.has(n3.id) && !isLocked(n3));
904
906
  return anyUnlocked ? lockNodes(nodes, idSet) : unlockNodes(nodes, idSet);
905
907
  }
906
908
  function collect(nodes, ids, options) {
@@ -972,7 +974,7 @@ function distributeAxis(items, horizontal, mode, gapOverride, targets) {
972
974
  );
973
975
  const first = sorted[0].rect;
974
976
  const last = sorted[sorted.length - 1].rect;
975
- const n2 = sorted.length;
977
+ const n3 = sorted.length;
976
978
  const set = (item, value) => {
977
979
  if (item.locked) return;
978
980
  const current = _nullishCoalesce(targets.get(item.node.id), () => ( { x: item.rect.x, y: item.rect.y }));
@@ -981,13 +983,13 @@ function distributeAxis(items, horizontal, mode, gapOverride, targets) {
981
983
  if (mode === "centres") {
982
984
  const c0 = start(first) + size(first) / 2;
983
985
  const c1 = start(last) + size(last) / 2;
984
- const step = (c1 - c0) / (n2 - 1);
986
+ const step = (c1 - c0) / (n3 - 1);
985
987
  sorted.forEach((item, i) => set(item, c0 + step * i - size(item.rect) / 2));
986
988
  return;
987
989
  }
988
990
  const span = start(last) + size(last) - start(first);
989
991
  const total = sorted.reduce((sum, item) => sum + size(item.rect), 0);
990
- const gap = _nullishCoalesce(gapOverride, () => ( (span - total) / (n2 - 1)));
992
+ const gap = _nullishCoalesce(gapOverride, () => ( (span - total) / (n3 - 1)));
991
993
  let cursor = start(first);
992
994
  for (const item of sorted) {
993
995
  set(item, cursor);
@@ -1049,18 +1051,18 @@ function reorderNodes(nodes, ids, operation, options = {}) {
1049
1051
  }
1050
1052
  const updates = [];
1051
1053
  for (const siblings of groups.values()) {
1052
- if (!siblings.some((n2) => targetIds.has(n2.id))) continue;
1054
+ if (!siblings.some((n3) => targetIds.has(n3.id))) continue;
1053
1055
  const order = siblings.map((node, index) => ({ node, index, z: typeof node.zIndex === "number" ? node.zIndex : 0 })).sort((a, b) => a.z - b.z || a.index - b.index).map((entry) => entry.node);
1054
- const isTarget = (n2) => targetIds.has(n2.id);
1056
+ const isTarget = (n3) => targetIds.has(n3.id);
1055
1057
  let next;
1056
1058
  if (operation === "bringToFront") {
1057
- next = [...order.filter((n2) => !isTarget(n2)), ...order.filter(isTarget)];
1059
+ next = [...order.filter((n3) => !isTarget(n3)), ...order.filter(isTarget)];
1058
1060
  } else if (operation === "sendToBack") {
1059
- next = [...order.filter(isTarget), ...order.filter((n2) => !isTarget(n2))];
1061
+ next = [...order.filter(isTarget), ...order.filter((n3) => !isTarget(n3))];
1060
1062
  } else {
1061
1063
  next = [...order];
1062
1064
  const forward = operation === "bringForward";
1063
- const rects = new Map(next.map((n2) => [n2.id, getNodeRect(n2, lookup, options)]));
1065
+ const rects = new Map(next.map((n3) => [n3.id, getNodeRect(n3, lookup, options)]));
1064
1066
  const intersects = (a, b) => a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
1065
1067
  const indices = next.map((_, i) => i);
1066
1068
  if (forward) indices.reverse();
@@ -1377,7 +1379,7 @@ function createNodeGuideIndex(nodes, draggingIds, options = {}) {
1377
1379
  function snapNodeDrag(nodes, draggingIds, options = {}) {
1378
1380
  const ids = new Set(draggingIds);
1379
1381
  const lookup = createNodeLookup(nodes);
1380
- const dragged = [...ids].map((id) => lookup.get(id)).filter((n2) => !!n2);
1382
+ const dragged = [...ids].map((id) => lookup.get(id)).filter((n3) => !!n3);
1381
1383
  const empty = {
1382
1384
  position: { x: 0, y: 0 },
1383
1385
  offset: { x: 0, y: 0 },
@@ -1387,7 +1389,7 @@ function snapNodeDrag(nodes, draggingIds, options = {}) {
1387
1389
  updates: []
1388
1390
  };
1389
1391
  if (dragged.length === 0) return empty;
1390
- const bounds = _chunkWADCJ7A7cjs.boundsOf.call(void 0, dragged.map((n2) => getNodeRect(n2, lookup, options)));
1392
+ const bounds = _chunkWADCJ7A7cjs.boundsOf.call(void 0, dragged.map((n3) => getNodeRect(n3, lookup, options)));
1391
1393
  const index = _nullishCoalesce(options.index, () => ( createNodeGuideIndex(nodes, ids, options)));
1392
1394
  const result = computeSnapGuides(bounds, index, options);
1393
1395
  const { x: dx, y: dy } = result.offset;
@@ -1598,9 +1600,9 @@ var CanvasScenesStore = (_class2 = class {
1598
1600
  /** First unused "Scene N" name. */
1599
1601
  nextDefaultName() {
1600
1602
  const names = new Set(this.scenes.map((s) => s.name));
1601
- let n2 = this.scenes.length + 1;
1602
- while (names.has(`Scene ${n2}`)) n2 += 1;
1603
- return `Scene ${n2}`;
1603
+ let n3 = this.scenes.length + 1;
1604
+ while (names.has(`Scene ${n3}`)) n3 += 1;
1605
+ return `Scene ${n3}`;
1604
1606
  }
1605
1607
  /**
1606
1608
  * Adds a scene (appended, or inserted at `index`) and makes it current.
@@ -1732,7 +1734,7 @@ function fitViewportToRect(rect2, size, options = {}) {
1732
1734
  function fitViewportToNodes(nodes, size, ids, options = {}) {
1733
1735
  const lookup = createNodeLookup(nodes);
1734
1736
  const wanted = ids ? new Set(ids) : null;
1735
- const rects = nodes.filter((n2) => wanted ? wanted.has(n2.id) : true).map((n2) => getNodeRect(n2, lookup, options));
1737
+ const rects = nodes.filter((n3) => wanted ? wanted.has(n3.id) : true).map((n3) => getNodeRect(n3, lookup, options));
1736
1738
  const bounds = _chunkWADCJ7A7cjs.boundsOf.call(void 0, rects);
1737
1739
  return bounds ? fitViewportToRect(bounds, size, options) : null;
1738
1740
  }
@@ -1748,18 +1750,18 @@ var BOOLEAN_FOR = {
1748
1750
  exclude: "xor"
1749
1751
  };
1750
1752
  function isShapeNode(node) {
1751
- return !!node && _chunkYNSK4MGTcjs.isShapeDescription.call(void 0, _optionalChain([node, 'access', _55 => _55.data, 'optionalAccess', _56 => _56[SHAPE_DATA_KEY]]));
1753
+ return !!node && _chunkO2UH7LZEcjs.isShapeDescription.call(void 0, _optionalChain([node, 'access', _55 => _55.data, 'optionalAccess', _56 => _56[SHAPE_DATA_KEY]]));
1752
1754
  }
1753
1755
  function getNodeShape(node) {
1754
1756
  const shape = _optionalChain([node, 'optionalAccess', _57 => _57.data, 'optionalAccess', _58 => _58[SHAPE_DATA_KEY]]);
1755
- return _chunkYNSK4MGTcjs.isShapeDescription.call(void 0, shape) ? shape : null;
1757
+ return _chunkO2UH7LZEcjs.isShapeDescription.call(void 0, shape) ? shape : null;
1756
1758
  }
1757
1759
  function shapeNodeToPolygon(node, lookup, options = {}) {
1758
1760
  const shape = getNodeShape(node);
1759
1761
  if (!shape) return null;
1760
1762
  const size = getNodeSize(node, options);
1761
1763
  const origin = node.parentId && lookup ? getAbsolutePosition(node, lookup) : node.position;
1762
- const { rings, fillRule } = _chunkYNSK4MGTcjs.shapeToPolygon.call(void 0, shape, size, { tolerance: options.tolerance });
1764
+ const { rings, fillRule } = _chunkO2UH7LZEcjs.shapeToPolygon.call(void 0, shape, size, { tolerance: options.tolerance });
1763
1765
  return {
1764
1766
  rings: rings.map((ring) => ring.map(([x, y]) => [x + origin.x, y + origin.y])),
1765
1767
  fillRule
@@ -1768,14 +1770,14 @@ function shapeNodeToPolygon(node, lookup, options = {}) {
1768
1770
  function shapeToBezierPath(shape, size) {
1769
1771
  const { width: w, height: h } = size;
1770
1772
  if (!(w > 0) || !(h > 0)) return { path: [], fillRule: "nonzero" };
1771
- const svg = _chunkYNSK4MGTcjs.getShapeSvg.call(void 0, { ...shape, rotation: 0 }, size);
1772
- let path = _chunkYNSK4MGTcjs.toBezierPath.call(void 0, svg.d);
1773
+ const svg = _chunkO2UH7LZEcjs.getShapeSvg.call(void 0, { ...shape, rotation: 0 }, size);
1774
+ let path = _chunkO2UH7LZEcjs.toBezierPath.call(void 0, svg.d);
1773
1775
  if (shape.kind === "path" && shape.viewBox) {
1774
1776
  const vb = shape.viewBox;
1775
1777
  if (vb.length === 4 && vb.every(Number.isFinite) && vb[2] > 0 && vb[3] > 0) {
1776
1778
  const sx = w / vb[2];
1777
1779
  const sy = h / vb[3];
1778
- path = _chunkYNSK4MGTcjs.transformBezierPath.call(void 0, path, [sx, 0, 0, sy, -vb[0] * sx, -vb[1] * sy]);
1780
+ path = _chunkO2UH7LZEcjs.transformBezierPath.call(void 0, path, [sx, 0, 0, sy, -vb[0] * sx, -vb[1] * sy]);
1779
1781
  }
1780
1782
  }
1781
1783
  const deg = _nullishCoalesce(shape.rotation, () => ( 0));
@@ -1786,7 +1788,7 @@ function shapeToBezierPath(shape, size) {
1786
1788
  const cx = w / 2;
1787
1789
  const cy = h / 2;
1788
1790
  const m = [cos, sin, -sin, cos, cx - cx * cos + cy * sin, cy - cx * sin - cy * cos];
1789
- path = _chunkYNSK4MGTcjs.transformBezierPath.call(void 0, path, m);
1791
+ path = _chunkO2UH7LZEcjs.transformBezierPath.call(void 0, path, m);
1790
1792
  }
1791
1793
  return { path, fillRule: svg.fillRule };
1792
1794
  }
@@ -1796,7 +1798,7 @@ function shapeNodeToBezierPath(node, lookup, options = {}) {
1796
1798
  const size = getNodeSize(node, options);
1797
1799
  const origin = node.parentId && lookup ? getAbsolutePosition(node, lookup) : node.position;
1798
1800
  const { path, fillRule } = shapeToBezierPath(shape, size);
1799
- return { path: _chunkYNSK4MGTcjs.transformBezierPath.call(void 0, path, [1, 0, 0, 1, origin.x, origin.y]), fillRule };
1801
+ return { path: _chunkO2UH7LZEcjs.transformBezierPath.call(void 0, path, [1, 0, 0, 1, origin.x, origin.y]), fillRule };
1800
1802
  }
1801
1803
  var idCounter = 0;
1802
1804
  function defaultId2(index) {
@@ -1809,10 +1811,10 @@ function stackOrder(nodes, ids) {
1809
1811
  }
1810
1812
  function canCombineShapeNodes(nodes, ids) {
1811
1813
  const idSet = new Set(ids);
1812
- const shapes = nodes.filter((n2) => idSet.has(n2.id) && isShapeNode(n2));
1813
- if (shapes.some((n2) => isLocked(n2))) return { ok: false, reason: "locked" };
1814
+ const shapes = nodes.filter((n3) => idSet.has(n3.id) && isShapeNode(n3));
1815
+ if (shapes.some((n3) => isLocked(n3))) return { ok: false, reason: "locked" };
1814
1816
  if (shapes.length < 2) return { ok: false, reason: "too-few" };
1815
- return { ok: true, shapeIds: shapes.map((n2) => n2.id) };
1817
+ return { ok: true, shapeIds: shapes.map((n3) => n3.id) };
1816
1818
  }
1817
1819
  function combineShapeNodes(nodes, ids, operation, options = {}) {
1818
1820
  const idList = [...ids];
@@ -1821,7 +1823,7 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1821
1823
  const lookup = createNodeLookup(nodes);
1822
1824
  const shapeIds = new Set(check.shapeIds);
1823
1825
  const ordered = stackOrder(nodes, shapeIds);
1824
- const parentIds = new Set(ordered.map((n2) => _nullishCoalesce(n2.parentId, () => ( ""))));
1826
+ const parentIds = new Set(ordered.map((n3) => _nullishCoalesce(n3.parentId, () => ( ""))));
1825
1827
  const sharedParent = parentIds.size === 1 ? ordered[0].parentId : void 0;
1826
1828
  const parentOrigin = sharedParent && lookup.get(sharedParent) ? getAbsolutePosition(lookup.get(sharedParent), lookup) : { x: 0, y: 0 };
1827
1829
  const pickSource = () => {
@@ -1849,7 +1851,7 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1849
1851
  const operands = ordered.map((node) => shapeNodeToBezierPath(node, lookup, options));
1850
1852
  const pathOptions = { epsilon: options.epsilon, onFallback: options.onFallback, fallbackTolerance: options.tolerance };
1851
1853
  if (operation === "divide") {
1852
- const result = _chunkYNSK4MGTcjs.dividePaths.call(void 0, operands, pathOptions);
1854
+ const result = _chunkO2UH7LZEcjs.dividePaths.call(void 0, operands, pathOptions);
1853
1855
  report = result;
1854
1856
  for (const piece of result.pieces) {
1855
1857
  const source = ordered[piece.operands[piece.operands.length - 1]];
@@ -1857,7 +1859,7 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1857
1859
  if (node) created.push(node);
1858
1860
  }
1859
1861
  } else {
1860
- const result = _chunkYNSK4MGTcjs.pathBoolean.call(void 0, BOOLEAN_FOR[operation], operands, pathOptions);
1862
+ const result = _chunkO2UH7LZEcjs.pathBoolean.call(void 0, BOOLEAN_FOR[operation], operands, pathOptions);
1861
1863
  report = result;
1862
1864
  const node = buildPathNode(result.path, pickSource(), createId(0), buildOptions);
1863
1865
  if (node) created.push(node);
@@ -1865,8 +1867,8 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1865
1867
  } else {
1866
1868
  report = { engine: "polygon" };
1867
1869
  const operands = ordered.map((node) => shapeNodeToPolygon(node, lookup, options));
1868
- const write = (polygon) => _chunkYNSK4MGTcjs.toBezierPath.call(void 0,
1869
- _chunkYNSK4MGTcjs.polygonToSvgPath.call(void 0, polygon, {
1870
+ const write = (polygon) => _chunkO2UH7LZEcjs.toBezierPath.call(void 0,
1871
+ _chunkO2UH7LZEcjs.polygonToSvgPath.call(void 0, polygon, {
1870
1872
  precision: 9,
1871
1873
  simplify: options.simplify,
1872
1874
  curves: _nullishCoalesce(options.curves, () => ( "fit")),
@@ -1875,13 +1877,13 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1875
1877
  })
1876
1878
  );
1877
1879
  if (operation === "divide") {
1878
- for (const piece of _chunkYNSK4MGTcjs.dividePolygons.call(void 0, operands, { epsilon: options.epsilon })) {
1880
+ for (const piece of _chunkO2UH7LZEcjs.dividePolygons.call(void 0, operands, { epsilon: options.epsilon })) {
1879
1881
  const source = ordered[piece.operands[piece.operands.length - 1]];
1880
1882
  const node = buildPathNode(write([piece.polygon]), source, createId(created.length), buildOptions);
1881
1883
  if (node) created.push(node);
1882
1884
  }
1883
1885
  } else {
1884
- const result = _chunkYNSK4MGTcjs.polygonBoolean.call(void 0, BOOLEAN_FOR[operation], operands, { epsilon: options.epsilon });
1886
+ const result = _chunkO2UH7LZEcjs.polygonBoolean.call(void 0, BOOLEAN_FOR[operation], operands, { epsilon: options.epsilon });
1885
1887
  const node = buildPathNode(write(result), pickSource(), createId(0), buildOptions);
1886
1888
  if (node) created.push(node);
1887
1889
  }
@@ -1890,7 +1892,7 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1890
1892
  const done2 = {
1891
1893
  ok: true,
1892
1894
  operation,
1893
- removeIds: ordered.map((n2) => n2.id),
1895
+ removeIds: ordered.map((n3) => n3.id),
1894
1896
  nodes: created,
1895
1897
  engine: report.engine
1896
1898
  };
@@ -1898,12 +1900,12 @@ function combineShapeNodes(nodes, ids, operation, options = {}) {
1898
1900
  return done2;
1899
1901
  }
1900
1902
  function buildPathNode(path, source, id, options) {
1901
- const bounds = _chunkYNSK4MGTcjs.bezierPathBounds.call(void 0, path);
1903
+ const bounds = _chunkO2UH7LZEcjs.bezierPathBounds.call(void 0, path);
1902
1904
  if (!bounds) return null;
1903
1905
  const width = bounds.maxX - bounds.minX;
1904
1906
  const height = bounds.maxY - bounds.minY;
1905
1907
  if (!(width > 0) || !(height > 0)) return null;
1906
- const d = _chunkYNSK4MGTcjs.bezierPathToSvg.call(void 0, path, { precision: _nullishCoalesce(options.precision, () => ( 3)), offset: { x: -bounds.minX, y: -bounds.minY } });
1908
+ const d = _chunkO2UH7LZEcjs.bezierPathToSvg.call(void 0, path, { precision: _nullishCoalesce(options.precision, () => ( 3)), offset: { x: -bounds.minX, y: -bounds.minY } });
1907
1909
  if (!d) return null;
1908
1910
  const sourceShape = getNodeShape(source);
1909
1911
  const shape = {
@@ -1952,8 +1954,8 @@ function roundSize(value) {
1952
1954
  }
1953
1955
  function applyShapeCombination(nodes, change, options = {}) {
1954
1956
  const remove = new Set(change.removeIds);
1955
- const insertAt = nodes.findIndex((n2) => remove.has(n2.id));
1956
- const deselect = options.deselect !== false && change.nodes.some((n2) => n2.selected);
1957
+ const insertAt = nodes.findIndex((n3) => remove.has(n3.id));
1958
+ const deselect = options.deselect !== false && change.nodes.some((n3) => n3.selected);
1957
1959
  const out = [];
1958
1960
  nodes.forEach((node, index) => {
1959
1961
  if (index === insertAt) out.push(...change.nodes);
@@ -1964,11 +1966,11 @@ function applyShapeCombination(nodes, change, options = {}) {
1964
1966
  return out;
1965
1967
  }
1966
1968
  function revertShapeCombination(nodes, change, previous) {
1967
- const created = new Set(change.nodes.map((n2) => n2.id));
1969
+ const created = new Set(change.nodes.map((n3) => n3.id));
1968
1970
  const removed = new Set(change.removeIds);
1969
- const out = nodes.filter((n2) => !created.has(n2.id));
1971
+ const out = nodes.filter((n3) => !created.has(n3.id));
1970
1972
  previous.forEach((node, index) => {
1971
- if (!removed.has(node.id) || out.some((n2) => n2.id === node.id)) return;
1973
+ if (!removed.has(node.id) || out.some((n3) => n3.id === node.id)) return;
1972
1974
  out.splice(Math.min(index, out.length), 0, node);
1973
1975
  });
1974
1976
  return out;
@@ -1990,21 +1992,21 @@ function hasVisibleFill(shape) {
1990
1992
  }
1991
1993
  function shapeTargets(nodes, ids) {
1992
1994
  const idSet = new Set(ids);
1993
- return nodes.filter((n2) => idSet.has(n2.id) && isShapeNode(n2));
1995
+ return nodes.filter((n3) => idSet.has(n3.id) && isShapeNode(n3));
1994
1996
  }
1995
1997
  function canOffsetShapeNodes(nodes, ids) {
1996
1998
  const shapes = shapeTargets(nodes, ids);
1997
- if (shapes.some((n2) => isLocked(n2))) return { ok: false, reason: "locked" };
1999
+ if (shapes.some((n3) => isLocked(n3))) return { ok: false, reason: "locked" };
1998
2000
  if (shapes.length === 0) return { ok: false, reason: "no-shapes" };
1999
- return { ok: true, shapeIds: shapes.map((n2) => n2.id) };
2001
+ return { ok: true, shapeIds: shapes.map((n3) => n3.id) };
2000
2002
  }
2001
2003
  function canOutlineShapeNodeStrokes(nodes, ids) {
2002
2004
  const shapes = shapeTargets(nodes, ids);
2003
- if (shapes.some((n2) => isLocked(n2))) return { ok: false, reason: "locked" };
2005
+ if (shapes.some((n3) => isLocked(n3))) return { ok: false, reason: "locked" };
2004
2006
  if (shapes.length === 0) return { ok: false, reason: "no-shapes" };
2005
- const stroked = shapes.filter((n2) => hasVisibleStroke(getNodeShape(n2)));
2007
+ const stroked = shapes.filter((n3) => hasVisibleStroke(getNodeShape(n3)));
2006
2008
  if (stroked.length === 0) return { ok: false, reason: "no-stroke" };
2007
- return { ok: true, shapeIds: stroked.map((n2) => n2.id) };
2009
+ return { ok: true, shapeIds: stroked.map((n3) => n3.id) };
2008
2010
  }
2009
2011
  function editPlacement(node, lookup) {
2010
2012
  const parent = node.parentId ? lookup.get(node.parentId) : void 0;
@@ -2035,7 +2037,7 @@ function offsetShapeNodes(nodes, ids, distance, options = {}) {
2035
2037
  for (const id of check.shapeIds) {
2036
2038
  const node = lookup.get(id);
2037
2039
  const outline = shapeNodeToBezierPath(node, lookup, options);
2038
- const path = _chunkYNSK4MGTcjs.offsetPath.call(void 0, outline.path, distance, {
2040
+ const path = _chunkO2UH7LZEcjs.offsetPath.call(void 0, outline.path, distance, {
2039
2041
  join: options.join,
2040
2042
  miterLimit: options.miterLimit,
2041
2043
  fillRule: outline.fillRule,
@@ -2071,7 +2073,7 @@ function outlineShapeNodeStrokes(nodes, ids, options = {}) {
2071
2073
  const node = lookup.get(id);
2072
2074
  const shape = getNodeShape(node);
2073
2075
  const outline = shapeNodeToBezierPath(node, lookup, options);
2074
- const path = _chunkYNSK4MGTcjs.outlineStroke.call(void 0, outline.path, {
2076
+ const path = _chunkO2UH7LZEcjs.outlineStroke.call(void 0, outline.path, {
2075
2077
  width: _nullishCoalesce(_nullishCoalesce(options.width, () => ( shape.strokeWidth)), () => ( 1)),
2076
2078
  join: options.join,
2077
2079
  cap: options.cap,
@@ -2107,8 +2109,8 @@ function outlineShapeNodeStrokes(nodes, ids, options = {}) {
2107
2109
  }
2108
2110
  function applyShapeReplacement(nodes, change, options = {}) {
2109
2111
  const byId = new Map(change.replacements.map((r) => [r.id, r.nodes]));
2110
- const created = new Set(change.replacements.flatMap((r) => r.nodes.map((n2) => n2.id)));
2111
- const deselect = options.deselect !== false && change.replacements.some((r) => r.nodes.some((n2) => n2.selected));
2112
+ const created = new Set(change.replacements.flatMap((r) => r.nodes.map((n3) => n3.id)));
2113
+ const deselect = options.deselect !== false && change.replacements.some((r) => r.nodes.some((n3) => n3.selected));
2112
2114
  const out = [];
2113
2115
  for (const node of nodes) {
2114
2116
  const replacement = byId.get(node.id);
@@ -2434,8 +2436,8 @@ function flowChildren(s, frame) {
2434
2436
  const f = s.boxes.get(frame);
2435
2437
  if (!f) return [];
2436
2438
  return f.kids.filter((k) => {
2437
- const n2 = s.boxes.get(k).node;
2438
- return n2.hidden !== true && !getChildLayout(n2).absolute;
2439
+ const n3 = s.boxes.get(k).node;
2440
+ return n3.hidden !== true && !getChildLayout(n3).absolute;
2439
2441
  });
2440
2442
  }
2441
2443
  function fitHugText(s, id) {
@@ -2491,17 +2493,17 @@ function resizeChild(s, id, w, h) {
2491
2493
  if (b.kids.length > 0) constrain(s, id, ow, oh);
2492
2494
  if (getAutoLayout(b.node)) layout(s, id);
2493
2495
  }
2494
- function mainOffsets(align, inner, total, n2, gap) {
2495
- const gaps = gap * Math.max(n2 - 1, 0);
2496
+ function mainOffsets(align, inner, total, n3, gap) {
2497
+ const gaps = gap * Math.max(n3 - 1, 0);
2496
2498
  const free = inner - total;
2497
- const k = Math.max(n2, 1);
2499
+ const k = Math.max(n3, 1);
2498
2500
  switch (align) {
2499
2501
  case "center":
2500
2502
  return [(free - gaps) / 2, gap];
2501
2503
  case "end":
2502
2504
  return [free - gaps, gap];
2503
2505
  case "space-between":
2504
- return [0, n2 > 1 ? Math.max(free / (n2 - 1), 0) : 0];
2506
+ return [0, n3 > 1 ? Math.max(free / (n3 - 1), 0) : 0];
2505
2507
  case "space-around": {
2506
2508
  const g = Math.max(free / k, 0);
2507
2509
  return [g / 2, g];
@@ -2720,8 +2722,8 @@ function parseTrack(track) {
2720
2722
  }
2721
2723
  function trackList(spec, fallback) {
2722
2724
  if (Array.isArray(spec)) return { count: Math.min(Math.max(spec.length, 1), MAX_TRACKS), tracks: spec.map(parseTrack) };
2723
- const n2 = typeof spec === "number" && Number.isFinite(spec) ? Math.floor(spec) : fallback;
2724
- return { count: Math.min(Math.max(n2, 1), MAX_TRACKS), tracks: [] };
2725
+ const n3 = typeof spec === "number" && Number.isFinite(spec) ? Math.floor(spec) : fallback;
2726
+ return { count: Math.min(Math.max(n3, 1), MAX_TRACKS), tracks: [] };
2725
2727
  }
2726
2728
  function trackSpec(tracks, i) {
2727
2729
  const t = _nullishCoalesce(tracks[i], () => ( { sizing: "fill", value: 1 }));
@@ -2841,21 +2843,21 @@ function resolveTracks(tracks, content, avail) {
2841
2843
  }
2842
2844
  return out;
2843
2845
  }
2844
- function trackContent(cells, sizes, tracks, n2, gap, columns, hug) {
2846
+ function trackContent(cells, sizes, tracks, n3, gap, columns, hug) {
2845
2847
  const byContent = (i) => trackSpec(tracks, i).sizing !== "fixed";
2846
- const content = Array.from({ length: n2 }, (_, i) => {
2848
+ const content = Array.from({ length: n3 }, (_, i) => {
2847
2849
  const t = trackSpec(tracks, i);
2848
2850
  return t.sizing === "fixed" ? t.value : 0;
2849
2851
  });
2850
2852
  const span = (c) => columns ? [c.column, c.columnSpan] : [c.row, c.rowSpan];
2851
2853
  cells.forEach((c, k) => {
2852
2854
  const [start, len] = span(c);
2853
- if (len === 1 && byContent(start) && start < n2) content[start] = Math.max(content[start], sizes[k]);
2855
+ if (len === 1 && byContent(start) && start < n3) content[start] = Math.max(content[start], sizes[k]);
2854
2856
  });
2855
2857
  cells.forEach((c, k) => {
2856
2858
  const [start, len] = span(c);
2857
2859
  if (len < 2) return;
2858
- const range = Array.from({ length: len }, (_, j) => start + j).filter((i) => i < n2);
2860
+ const range = Array.from({ length: len }, (_, j) => start + j).filter((i) => i < n3);
2859
2861
  if (!hug && range.some((i) => trackSpec(tracks, i).sizing === "fill")) return;
2860
2862
  const have = range.reduce((sum, i) => sum + content[i], 0) + gap * (len - 1);
2861
2863
  const grow = range.filter(byContent);
@@ -3044,9 +3046,9 @@ function postOrder(s, nodes) {
3044
3046
  for (const k of _nullishCoalesce(_optionalChain([s, 'access', _128 => _128.boxes, 'access', _129 => _129.get, 'call', _130 => _130(id), 'optionalAccess', _131 => _131.kids]), () => ( []))) visit(k);
3045
3047
  out.push(id);
3046
3048
  };
3047
- const roots = nodes.filter((n2) => !n2.parentId || !s.boxes.has(n2.parentId));
3049
+ const roots = nodes.filter((n3) => !n3.parentId || !s.boxes.has(n3.parentId));
3048
3050
  for (const r of roots) visit(r.id);
3049
- for (const n2 of nodes) visit(n2.id);
3051
+ for (const n3 of nodes) visit(n3.id);
3050
3052
  return out;
3051
3053
  }
3052
3054
  function layoutAll(nodes, options = {}) {
@@ -3075,7 +3077,7 @@ function getAutoLayoutGrid(nodes, frameId, options = {}) {
3075
3077
  return gridGeometryOf(new LayoutState(nodes, options), frameId);
3076
3078
  }
3077
3079
  function getFlowChildren(nodes, frameId) {
3078
- return nodes.filter((n2) => n2.parentId === frameId && n2.id !== frameId && n2.hidden !== true && !getChildLayout(n2).absolute).map((n2) => n2.id);
3080
+ return nodes.filter((n3) => n3.parentId === frameId && n3.id !== frameId && n3.hidden !== true && !getChildLayout(n3).absolute).map((n3) => n3.id);
3079
3081
  }
3080
3082
  function getLayoutParent(nodes, id) {
3081
3083
  const lookup = createNodeLookup(nodes);
@@ -3086,7 +3088,7 @@ function getLayoutParent(nodes, id) {
3086
3088
  }
3087
3089
  function makeSizingCoherent(nodes, id, options = {}) {
3088
3090
  const lookup = createNodeLookup(nodes);
3089
- const targets = /* @__PURE__ */ new Set([id, ...nodes.filter((n2) => n2.parentId === id).map((n2) => n2.id)]);
3091
+ const targets = /* @__PURE__ */ new Set([id, ...nodes.filter((n3) => n3.parentId === id).map((n3) => n3.id)]);
3090
3092
  if (!lookup.has(id)) return nodes;
3091
3093
  let changed = false;
3092
3094
  const next = nodes.map((node) => {
@@ -3155,42 +3157,42 @@ function getAutoLayoutInsertTarget(nodes, frameId, point, options = {}) {
3155
3157
  return { frameId, index, guide };
3156
3158
  }
3157
3159
  function moveLayoutChild(nodes, childId, index) {
3158
- const child = nodes.find((n2) => n2.id === childId);
3160
+ const child = nodes.find((n3) => n3.id === childId);
3159
3161
  if (!_optionalChain([child, 'optionalAccess', _136 => _136.parentId])) return nodes;
3160
- const siblings = nodes.filter((n2) => n2.parentId === child.parentId && n2.id !== child.parentId);
3161
- const flow = siblings.filter((n2) => n2.hidden !== true && !getChildLayout(n2).absolute && n2.id !== childId);
3162
+ const siblings = nodes.filter((n3) => n3.parentId === child.parentId && n3.id !== child.parentId);
3163
+ const flow = siblings.filter((n3) => n3.hidden !== true && !getChildLayout(n3).absolute && n3.id !== childId);
3162
3164
  const clamped = Math.min(Math.max(Math.floor(Number.isFinite(index) ? index : 0), 0), flow.length);
3163
- const order = siblings.filter((n2) => n2.id !== childId);
3165
+ const order = siblings.filter((n3) => n3.id !== childId);
3164
3166
  const anchor = flow[clamped];
3165
3167
  const at = anchor ? order.indexOf(anchor) : flow.length > 0 ? order.indexOf(flow[flow.length - 1]) + 1 : order.length;
3166
3168
  order.splice(at, 0, child);
3167
- if (order.every((n2, i) => n2 === siblings[i])) return nodes;
3169
+ if (order.every((n3, i) => n3 === siblings[i])) return nodes;
3168
3170
  let k = 0;
3169
3171
  const parentId = child.parentId;
3170
- const placed = nodes.map((n2) => n2.parentId === parentId && n2.id !== parentId ? order[k++] : n2);
3172
+ const placed = nodes.map((n3) => n3.parentId === parentId && n3.id !== parentId ? order[k++] : n3);
3171
3173
  return parentsFirst(placed);
3172
3174
  }
3173
3175
  function parentsFirst(nodes) {
3174
- const ids = new Set(nodes.map((n2) => n2.id));
3176
+ const ids = new Set(nodes.map((n3) => n3.id));
3175
3177
  const pending = /* @__PURE__ */ new Map();
3176
3178
  const done2 = /* @__PURE__ */ new Set();
3177
3179
  const out = [];
3178
- const emit = (n2) => {
3179
- out.push(n2);
3180
- done2.add(n2.id);
3181
- const waiting = pending.get(n2.id);
3180
+ const emit = (n3) => {
3181
+ out.push(n3);
3182
+ done2.add(n3.id);
3183
+ const waiting = pending.get(n3.id);
3182
3184
  if (waiting) {
3183
- pending.delete(n2.id);
3185
+ pending.delete(n3.id);
3184
3186
  for (const w of waiting) emit(w);
3185
3187
  }
3186
3188
  };
3187
- for (const n2 of nodes) {
3188
- if (n2.parentId && ids.has(n2.parentId) && !done2.has(n2.parentId) && n2.parentId !== n2.id) {
3189
- if (!pending.has(n2.parentId)) pending.set(n2.parentId, []);
3190
- pending.get(n2.parentId).push(n2);
3191
- } else emit(n2);
3189
+ for (const n3 of nodes) {
3190
+ if (n3.parentId && ids.has(n3.parentId) && !done2.has(n3.parentId) && n3.parentId !== n3.id) {
3191
+ if (!pending.has(n3.parentId)) pending.set(n3.parentId, []);
3192
+ pending.get(n3.parentId).push(n3);
3193
+ } else emit(n3);
3192
3194
  }
3193
- for (const waiting of pending.values()) for (const n2 of waiting) if (!done2.has(n2.id)) emit(n2);
3195
+ for (const waiting of pending.values()) for (const n3 of waiting) if (!done2.has(n3.id)) emit(n3);
3194
3196
  return out;
3195
3197
  }
3196
3198
 
@@ -3204,7 +3206,7 @@ function createCanvasArrangeController(options) {
3204
3206
  let resizeStart = null;
3205
3207
  let resizeIndex = null;
3206
3208
  let lastResized = null;
3207
- const selectedIds = (ids) => ids ? [...ids] : _nullishCoalesce(_optionalChain([options, 'access', _137 => _137.getSelectedIds, 'optionalCall', _138 => _138()]), () => ( options.getNodes().filter((n2) => n2.selected).map((n2) => n2.id)));
3209
+ const selectedIds = (ids) => ids ? [...ids] : _nullishCoalesce(_optionalChain([options, 'access', _137 => _137.getSelectedIds, 'optionalCall', _138 => _138()]), () => ( options.getNodes().filter((n3) => n3.selected).map((n3) => n3.id)));
3208
3210
  const setGuides = (next) => {
3209
3211
  if (next.length === 0 && guides.length === 0) return;
3210
3212
  guides = next;
@@ -3234,7 +3236,7 @@ function createCanvasArrangeController(options) {
3234
3236
  function setLocked(name, ids, locked) {
3235
3237
  const nodes = options.getNodes();
3236
3238
  const set = new Set(ids);
3237
- const changed = nodes.filter((n2) => set.has(n2.id) && isLocked(n2) !== locked).map((n2) => n2.id);
3239
+ const changed = nodes.filter((n3) => set.has(n3.id) && isLocked(n3) !== locked).map((n3) => n3.id);
3238
3240
  if (changed.length === 0) return changed;
3239
3241
  const lock = () => options.setNodes(lockNodes(options.getNodes(), changed));
3240
3242
  const unlock = () => options.setNodes(unlockNodes(options.getNodes(), changed));
@@ -3277,10 +3279,10 @@ function createCanvasArrangeController(options) {
3277
3279
  toggleLock(ids) {
3278
3280
  const list = selectedIds(ids);
3279
3281
  const set = new Set(list);
3280
- const anyUnlocked = options.getNodes().some((n2) => set.has(n2.id) && !isLocked(n2));
3282
+ const anyUnlocked = options.getNodes().some((n3) => set.has(n3.id) && !isLocked(n3));
3281
3283
  return anyUnlocked ? controller.lock(list) : controller.unlock(list);
3282
3284
  },
3283
- isLocked: (id) => isLocked(options.getNodes().find((n2) => n2.id === id)),
3285
+ isLocked: (id) => isLocked(options.getNodes().find((n3) => n3.id === id)),
3284
3286
  /**
3285
3287
  * Freeform shape operation (Unite / Intersect / Subtract / Exclude / Divide) on the
3286
3288
  * shape nodes among `ids` (default: the selection). Replaces them with the result as
@@ -3445,7 +3447,7 @@ function createCanvasArrangeController(options) {
3445
3447
  const key = ids.slice().sort().join("\0");
3446
3448
  if (!dragIndex || key !== dragKey) controller.beginDrag(ids);
3447
3449
  const proposed = new Map(dragging.map((c) => [c.id, c.position]));
3448
- const nodes = options.getNodes().map((n2) => proposed.has(n2.id) ? { ...n2, position: proposed.get(n2.id) } : n2);
3450
+ const nodes = options.getNodes().map((n3) => proposed.has(n3.id) ? { ...n3, position: proposed.get(n3.id) } : n3);
3449
3451
  const result = snapNodeDrag(nodes, ids, {
3450
3452
  ...rect2(),
3451
3453
  ...options.guides,
@@ -3456,7 +3458,7 @@ function createCanvasArrangeController(options) {
3456
3458
  const { x: dx, y: dy } = result.offset;
3457
3459
  lastSnapped = /* @__PURE__ */ new Map();
3458
3460
  if (dx === 0 && dy === 0) return changes;
3459
- const parents = new Map(nodes.map((n2) => [n2.id, n2.parentId]));
3461
+ const parents = new Map(nodes.map((n3) => [n3.id, n3.parentId]));
3460
3462
  const shift = new Set(ids.filter((id) => !proposed.has(_nullishCoalesce(parents.get(id), () => ( "")))));
3461
3463
  return changes.map((c) => {
3462
3464
  if (!(c.type === "position" && c.position && c.dragging && c.id !== void 0 && shift.has(c.id))) return c;
@@ -3536,7 +3538,7 @@ function createCanvasArrangeController(options) {
3536
3538
  setGuides([]);
3537
3539
  const update = _optionalChain([last, 'optionalAccess', _147 => _147.updates, 'access', _148 => _148[0]]);
3538
3540
  if (!update) return;
3539
- const node = options.getNodes().find((n2) => n2.id === update.id);
3541
+ const node = options.getNodes().find((n3) => n3.id === update.id);
3540
3542
  if (!node) return;
3541
3543
  const drift = node.position.x !== update.position.x || node.position.y !== update.position.y || node.width !== update.width || node.height !== update.height;
3542
3544
  if (drift) options.setNodes(applyNodeUpdates(options.getNodes(), [update]));
@@ -3622,9 +3624,9 @@ function createCanvasArrangeController(options) {
3622
3624
  setGuides([]);
3623
3625
  if (snapped.size === 0) return;
3624
3626
  const nodes = options.getNodes();
3625
- const drift = nodes.some((n2) => {
3626
- const p = snapped.get(n2.id);
3627
- return !!p && (n2.position.x !== p.x || n2.position.y !== p.y);
3627
+ const drift = nodes.some((n3) => {
3628
+ const p = snapped.get(n3.id);
3629
+ return !!p && (n3.position.x !== p.x || n3.position.y !== p.y);
3628
3630
  });
3629
3631
  if (drift) {
3630
3632
  options.setNodes(applyNodeUpdates(nodes, [...snapped].map(([id, position]) => ({ id, position }))));
@@ -3729,15 +3731,15 @@ function measureToLine(a, orientation, at) {
3729
3731
  function measureSelection(nodes, selectedIds, hoveredId, options = {}) {
3730
3732
  const none = (selection2 = null) => ({ guides: [], target: null, selection: selection2 });
3731
3733
  const lookup = createNodeLookup(nodes);
3732
- const selected = [...new Set(selectedIds)].map((id) => lookup.get(id)).filter((n2) => !!n2 && n2.hidden !== true);
3734
+ const selected = [...new Set(selectedIds)].map((id) => lookup.get(id)).filter((n3) => !!n3 && n3.hidden !== true);
3733
3735
  if (selected.length === 0) return none();
3734
- const selection = _chunkWADCJ7A7cjs.boundsOf.call(void 0, selected.map((n2) => getNodeRect(n2, lookup, options)));
3736
+ const selection = _chunkWADCJ7A7cjs.boundsOf.call(void 0, selected.map((n3) => getNodeRect(n3, lookup, options)));
3735
3737
  if (!selection) return none();
3736
- const selectedSet = new Set(selected.map((n2) => n2.id));
3738
+ const selectedSet = new Set(selected.map((n3) => n3.id));
3737
3739
  let targetId = _nullishCoalesce(hoveredId, () => ( null));
3738
3740
  if (targetId === null || selectedSet.has(targetId)) {
3739
3741
  const parentId = selected[0].parentId;
3740
- const sameParent = selected.every((n2) => n2.parentId === parentId);
3742
+ const sameParent = selected.every((n3) => n3.parentId === parentId);
3741
3743
  targetId = parentId && sameParent && !selectedSet.has(parentId) ? parentId : null;
3742
3744
  }
3743
3745
  const target = targetId !== null ? lookup.get(targetId) : void 0;
@@ -3828,12 +3830,12 @@ function createCanvasAutoLayoutController(options) {
3828
3830
  */
3829
3831
  addNode(node, addOptions = {}) {
3830
3832
  const forward = (nodes) => {
3831
- if (nodes.some((n2) => n2.id === node.id)) return nodes;
3833
+ if (nodes.some((n3) => n3.id === node.id)) return nodes;
3832
3834
  let next = [...nodes, node];
3833
3835
  if (addOptions.index !== void 0 && node.parentId) next = moveLayoutChild(next, node.id, addOptions.index);
3834
3836
  return next;
3835
3837
  };
3836
- const backward = (nodes) => nodes.filter((n2) => n2.id !== node.id);
3838
+ const backward = (nodes) => nodes.filter((n3) => n3.id !== node.id);
3837
3839
  return run("Add Node", forward, backward, () => [node.id]);
3838
3840
  },
3839
3841
  /** Removes nodes (and their descendants) and lays out the frames they leave, as one step. */
@@ -3843,20 +3845,20 @@ function createCanvasAutoLayoutController(options) {
3843
3845
  let grew = true;
3844
3846
  while (grew) {
3845
3847
  grew = false;
3846
- for (const n2 of before) {
3847
- if (n2.parentId && remove.has(n2.parentId) && !remove.has(n2.id)) {
3848
- remove.add(n2.id);
3848
+ for (const n3 of before) {
3849
+ if (n3.parentId && remove.has(n3.parentId) && !remove.has(n3.id)) {
3850
+ remove.add(n3.id);
3849
3851
  grew = true;
3850
3852
  }
3851
3853
  }
3852
3854
  }
3853
- const removed = before.map((n2, i) => [i, n2]).filter(([, n2]) => remove.has(n2.id));
3855
+ const removed = before.map((n3, i) => [i, n3]).filter(([, n3]) => remove.has(n3.id));
3854
3856
  if (removed.length === 0) return [];
3855
- const parents = [...new Set(removed.map(([, n2]) => n2.parentId).filter((p) => !!p && !remove.has(p)))];
3856
- const forward = (nodes) => nodes.filter((n2) => !remove.has(n2.id));
3857
+ const parents = [...new Set(removed.map(([, n3]) => n3.parentId).filter((p) => !!p && !remove.has(p)))];
3858
+ const forward = (nodes) => nodes.filter((n3) => !remove.has(n3.id));
3857
3859
  const backward = (nodes) => {
3858
3860
  const next = [...nodes];
3859
- for (const [i, n2] of removed) next.splice(Math.min(i, next.length), 0, n2);
3861
+ for (const [i, n3] of removed) next.splice(Math.min(i, next.length), 0, n3);
3860
3862
  return next;
3861
3863
  };
3862
3864
  return run("Delete", forward, backward, () => parents);
@@ -3867,7 +3869,7 @@ function createCanvasAutoLayoutController(options) {
3867
3869
  */
3868
3870
  resizeNode(id, size) {
3869
3871
  const nodes = options.getNodes();
3870
- const node = nodes.find((n2) => n2.id === id);
3872
+ const node = nodes.find((n3) => n3.id === id);
3871
3873
  if (!node) return [];
3872
3874
  const old = getNodeSize(node, options.rectOptions);
3873
3875
  const update = { id };
@@ -3880,7 +3882,7 @@ function createCanvasAutoLayoutController(options) {
3880
3882
  /** Moves flow child `childId` to flow index `index` in its frame and lays it out, as one step. */
3881
3883
  moveChild(childId, index) {
3882
3884
  const before = options.getNodes();
3883
- const order = before.map((n2) => n2.id);
3885
+ const order = before.map((n3) => n3.id);
3884
3886
  const forward = (nodes) => moveLayoutChild(nodes, childId, index);
3885
3887
  const backward = (nodes) => restoreOrder(nodes, order);
3886
3888
  if (forward(before) === before) return [];
@@ -3898,7 +3900,7 @@ function createCanvasAutoLayoutController(options) {
3898
3900
  },
3899
3901
  /** Records the start position of a reorder drag. Optional: `dragReorder` records it lazily. */
3900
3902
  beginReorderDrag(id) {
3901
- const node = options.getNodes().find((n2) => n2.id === id);
3903
+ const node = options.getNodes().find((n3) => n3.id === id);
3902
3904
  if (node && getLayoutParent(options.getNodes(), id)) dragStarts.set(id, { ...node.position });
3903
3905
  },
3904
3906
  /**
@@ -3924,7 +3926,7 @@ function createCanvasAutoLayoutController(options) {
3924
3926
  const target = controller.getInsertTarget(id, point);
3925
3927
  if (!target) return [];
3926
3928
  const before = options.getNodes();
3927
- const order = before.map((n2) => n2.id);
3929
+ const order = before.map((n3) => n3.id);
3928
3930
  const forward = (nodes) => moveLayoutChild(nodes, id, target.index);
3929
3931
  const backward = (nodes) => restoreOrder(nodes, order);
3930
3932
  return run("Reorder", forward, backward, () => [id], [], start && { id, position: start });
@@ -3979,8 +3981,8 @@ function createCanvasAutoLayoutController(options) {
3979
3981
  noteRemoved(removed) {
3980
3982
  const gone = /* @__PURE__ */ new Set();
3981
3983
  const list = [...removed];
3982
- for (const n2 of list) gone.add(n2.id);
3983
- for (const n2 of list) if (n2.parentId && !gone.has(n2.parentId)) pendingIds.add(n2.parentId);
3984
+ for (const n3 of list) gone.add(n3.id);
3985
+ for (const n3 of list) if (n3.parentId && !gone.has(n3.parentId)) pendingIds.add(n3.parentId);
3984
3986
  },
3985
3987
  /** Whether `noteChanges` left work for `flush`. */
3986
3988
  get hasPending() {
@@ -4005,12 +4007,12 @@ function createCanvasAutoLayoutController(options) {
4005
4007
  let nodes = options.getNodes();
4006
4008
  let updates = [];
4007
4009
  for (const [id, previous] of pendingResizes) {
4008
- if (!nodes.some((n2) => n2.id === id)) continue;
4010
+ if (!nodes.some((n3) => n3.id === id)) continue;
4009
4011
  const constrained = applyConstraints(nodes, id, previous, layoutOptions());
4010
4012
  nodes = applyNodeUpdates(nodes, constrained);
4011
4013
  updates = mergeNodeUpdates(updates, constrained);
4012
4014
  }
4013
- const layout2 = pendingAll ? layoutAll(nodes, layoutOptions()) : relayoutUpdates(nodes, [...pendingIds].filter((id) => nodes.some((n2) => n2.id === id)), layoutOptions());
4015
+ const layout2 = pendingAll ? layoutAll(nodes, layoutOptions()) : relayoutUpdates(nodes, [...pendingIds].filter((id) => nodes.some((n3) => n3.id === id)), layoutOptions());
4014
4016
  updates = mergeNodeUpdates(updates, layout2);
4015
4017
  pendingIds.clear();
4016
4018
  pendingResizes.clear();
@@ -4019,13 +4021,13 @@ function createCanvasAutoLayoutController(options) {
4019
4021
  return mergeNodeUpdates(applied, updates);
4020
4022
  },
4021
4023
  /** Whether `id` is an auto layout frame. */
4022
- isFrame: (id) => isAutoLayoutFrame(options.getNodes().find((n2) => n2.id === id))
4024
+ isFrame: (id) => isAutoLayoutFrame(options.getNodes().find((n3) => n3.id === id))
4023
4025
  };
4024
4026
  return controller;
4025
4027
  }
4026
4028
  function restoreOrder(nodes, order) {
4027
4029
  const rank = new Map(order.map((id, i) => [id, i]));
4028
- const indexed = nodes.map((n2, i) => ({ n: n2, r: _nullishCoalesce(rank.get(n2.id), () => ( order.length + i)) }));
4030
+ const indexed = nodes.map((n3, i) => ({ n: n3, r: _nullishCoalesce(rank.get(n3.id), () => ( order.length + i)) }));
4029
4031
  indexed.sort((a, b) => a.r - b.r);
4030
4032
  return indexed.every((e, i) => e.n === nodes[i]) ? nodes : indexed.map((e) => e.n);
4031
4033
  }
@@ -4097,8 +4099,8 @@ function writeNodeStyleProperty(style, prop, value, unitless = false) {
4097
4099
  function px(value) {
4098
4100
  if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
4099
4101
  if (typeof value === "string") {
4100
- const n2 = parseFloat(value);
4101
- return Number.isFinite(n2) ? n2 : void 0;
4102
+ const n3 = parseFloat(value);
4103
+ return Number.isFinite(n3) ? n3 : void 0;
4102
4104
  }
4103
4105
  return void 0;
4104
4106
  }
@@ -4110,7 +4112,7 @@ function withStyle(node, prop, value, unitless = false) {
4110
4112
  }
4111
4113
  function shapeOf(node) {
4112
4114
  const shape = _optionalChain([node, 'access', _161 => _161.data, 'optionalAccess', _162 => _162.shape]);
4113
- return _chunkYNSK4MGTcjs.isShapeDescription.call(void 0, shape) ? shape : null;
4115
+ return _chunkO2UH7LZEcjs.isShapeDescription.call(void 0, shape) ? shape : null;
4114
4116
  }
4115
4117
  function withShape(node, key, value) {
4116
4118
  const shape = shapeOf(node);
@@ -4297,7 +4299,7 @@ function getTokensForProperty(state, property, node) {
4297
4299
  return state.variables.filter((v) => v.type === property.type && _chunkK2UYKJ6Mcjs.isTokenInScope.call(void 0, v, scope));
4298
4300
  }
4299
4301
  function lookupOf(nodes) {
4300
- return new Map(nodes.map((n2) => [n2.id, n2]));
4302
+ return new Map(nodes.map((n3) => [n3.id, n3]));
4301
4303
  }
4302
4304
  function validModes(state, modes, into) {
4303
4305
  for (const [collectionId, modeId] of Object.entries(modes)) {
@@ -4476,8 +4478,8 @@ var ANIMATION_DATA_KEY = "animation";
4476
4478
  var num = (value) => {
4477
4479
  if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
4478
4480
  if (typeof value === "string") {
4479
- const n2 = parseFloat(value);
4480
- return Number.isFinite(n2) ? n2 : void 0;
4481
+ const n3 = parseFloat(value);
4482
+ return Number.isFinite(n3) ? n3 : void 0;
4481
4483
  }
4482
4484
  return void 0;
4483
4485
  };
@@ -4517,8 +4519,8 @@ function motionPathPoint(node, progress) {
4517
4519
  const path = _optionalChain([getNodeAnimation, 'call', _173 => _173(node), 'optionalAccess', _174 => _174.motionPath]);
4518
4520
  if (!path || typeof path.d !== "string") return null;
4519
4521
  try {
4520
- const length = _chunkYNSK4MGTcjs.bezierPathLength.call(void 0, path.d);
4521
- return _chunkYNSK4MGTcjs.bezierPathPointAtLength.call(void 0, path.d, Math.min(1, Math.max(0, progress)) * length);
4522
+ const length = _chunkO2UH7LZEcjs.bezierPathLength.call(void 0, path.d);
4523
+ return _chunkO2UH7LZEcjs.bezierPathPointAtLength.call(void 0, path.d, Math.min(1, Math.max(0, progress)) * length);
4522
4524
  } catch (e5) {
4523
4525
  return null;
4524
4526
  }
@@ -4726,9 +4728,9 @@ function coerceValue(property, value) {
4726
4728
  if (color === null) throw new AnimationEditError("invalid_value", `"${String(value)}" is not a colour.`);
4727
4729
  return color;
4728
4730
  }
4729
- const n2 = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
4730
- if (typeof n2 !== "number" || !Number.isFinite(n2)) throw new AnimationEditError("invalid_value", `"${String(value)}" is not a number.`);
4731
- return clampAnimationValue(property, n2);
4731
+ const n3 = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
4732
+ if (typeof n3 !== "number" || !Number.isFinite(n3)) throw new AnimationEditError("invalid_value", `"${String(value)}" is not a number.`);
4733
+ return clampAnimationValue(property, n3);
4732
4734
  }
4733
4735
  function coerceEasing(easing) {
4734
4736
  if (typeof easing === "string") {
@@ -4745,7 +4747,7 @@ var Draft = (_class4 = class {
4745
4747
  constructor(nodes, options = {}) {;_class4.prototype.__init11.call(this);_class4.prototype.__init12.call(this);
4746
4748
  this.nodes = nodes;
4747
4749
  this.options = options;
4748
- this.byId = new Map(nodes.map((n2) => [n2.id, n2]));
4750
+ this.byId = new Map(nodes.map((n3) => [n3.id, n3]));
4749
4751
  }
4750
4752
 
4751
4753
 
@@ -4919,7 +4921,7 @@ function deleteKeyframes(nodes, refs, options = {}) {
4919
4921
  if (left.length === 0) {
4920
4922
  const p = draft.property(property);
4921
4923
  const last = _nullishCoalesce(keys.find((k) => sameTime(k.time, lane[lane.length - 1].time)), () => ( keys[keys.length - 1]));
4922
- if (p && property !== "motionPath") draft.writeNode(nodeId, (n2) => p.write(n2, last.value));
4924
+ if (p && property !== "motionPath") draft.writeNode(nodeId, (n3) => p.write(n3, last.value));
4923
4925
  }
4924
4926
  draft.setKeys(nodeId, property, left);
4925
4927
  }
@@ -4939,7 +4941,7 @@ function removeTrack(nodes, nodeId, property, options = {}) {
4939
4941
  const p = draft.property(property);
4940
4942
  if (options.keepValueAt !== void 0 && p && property !== "motionPath") {
4941
4943
  const value = _chunkO4ONBPZWcjs.evaluateTrack.call(void 0, track, options.keepValueAt, p.type);
4942
- if (value !== void 0) draft.writeNode(nodeId, (n2) => p.write(n2, value));
4944
+ if (value !== void 0) draft.writeNode(nodeId, (n3) => p.write(n3, value));
4943
4945
  }
4944
4946
  draft.setKeys(nodeId, property, []);
4945
4947
  if (property === "motionPath") draft.setMotionPath(nodeId, void 0);
@@ -5110,8 +5112,8 @@ function pasteKeyframes(nodes, clipboard, time, options = {}) {
5110
5112
  var sameValue = (a, b) => typeof a === "number" && typeof b === "number" ? Math.abs(a - b) <= 1e-9 : a === b;
5111
5113
  function recordAnimationChanges(base, before, after, time, options = {}) {
5112
5114
  const properties = (_nullishCoalesce(options.properties, () => ( ANIMATABLE_PROPERTIES))).filter((p) => p.key !== "motionPath");
5113
- const baseById = new Map(base.map((n2) => [n2.id, n2]));
5114
- const beforeById = new Map(before.map((n2) => [n2.id, n2]));
5115
+ const baseById = new Map(base.map((n3) => [n3.id, n3]));
5116
+ const beforeById = new Map(before.map((n3) => [n3.id, n3]));
5115
5117
  const t = coerceTime(time);
5116
5118
  const keyed = [];
5117
5119
  const out = after.map((next) => {
@@ -5261,7 +5263,7 @@ function sampledStops(duration, fps, keyTimes, valueAt) {
5261
5263
  return [...times].sort((a, b) => a - b).map((t) => ({ offset: Math.min(1, t / duration), value: valueAt(t), easing: "linear" }));
5262
5264
  }
5263
5265
  function getCssPropertyAnimations(nodes, nodeId, options = {}) {
5264
- const node = nodes.find((n2) => n2.id === nodeId);
5266
+ const node = nodes.find((n3) => n3.id === nodeId);
5265
5267
  const animation = getNodeAnimation(node);
5266
5268
  if (!node || !animation) return [];
5267
5269
  const duration = _nullishCoalesce(options.duration, () => ( getAnimationDuration([node])));
@@ -5331,7 +5333,7 @@ function timing(options, duration) {
5331
5333
  }
5332
5334
  var cssIdent = (text) => text.replace(/[^A-Za-z0-9_-]/g, "-").replace(/^(\d)/, "_$1");
5333
5335
  function exportCssAnimation(nodes, nodeId, options = {}) {
5334
- const duration = _nullishCoalesce(options.duration, () => ( getAnimationDuration(nodes.filter((n2) => n2.id === nodeId))));
5336
+ const duration = _nullishCoalesce(options.duration, () => ( getAnimationDuration(nodes.filter((n3) => n3.id === nodeId))));
5335
5337
  const props = getCssPropertyAnimations(nodes, nodeId, { ...options, duration });
5336
5338
  const base = cssIdent(_nullishCoalesce(options.name, () => ( `anim-${nodeId}`)));
5337
5339
  const t = timing(options, duration);
@@ -5362,7 +5364,7 @@ ${selector} {
5362
5364
  return { css, animation, animations, exact: props.every((p) => p.exact) };
5363
5365
  }
5364
5366
  function toWebAnimations(nodes, nodeId, options = {}) {
5365
- const duration = _nullishCoalesce(options.duration, () => ( getAnimationDuration(nodes.filter((n2) => n2.id === nodeId))));
5367
+ const duration = _nullishCoalesce(options.duration, () => ( getAnimationDuration(nodes.filter((n3) => n3.id === nodeId))));
5366
5368
  const t = timing(options, duration);
5367
5369
  return getCssPropertyAnimations(nodes, nodeId, { ...options, duration }).map((prop) => ({
5368
5370
  property: prop.property,
@@ -5384,7 +5386,7 @@ function isKeyframeSelected(selection, ref) {
5384
5386
  }
5385
5387
  var defaultLabel = (node) => typeof _optionalChain([node, 'access', _208 => _208.data, 'optionalAccess', _209 => _209.label]) === "string" && node.data.label.trim() ? node.data.label : node.id;
5386
5388
  function getTimelineRows(nodes, ids, options = {}) {
5387
- const byId = new Map(nodes.map((n2) => [n2.id, n2]));
5389
+ const byId = new Map(nodes.map((n3) => [n3.id, n3]));
5388
5390
  const selection = _nullishCoalesce(options.selection, () => ( []));
5389
5391
  const labelOf = _nullishCoalesce(options.labelOf, () => ( defaultLabel));
5390
5392
  const rows = [];
@@ -5492,7 +5494,7 @@ function createCanvasAnimationController(options) {
5492
5494
  for (const listener of listeners) listener(state);
5493
5495
  };
5494
5496
  player.subscribe(notify);
5495
- const selectedIds = () => _nullishCoalesce(_optionalChain([options, 'access', _217 => _217.getSelectedIds, 'optionalCall', _218 => _218()]), () => ( options.getNodes().filter((n2) => n2.selected).map((n2) => n2.id)));
5497
+ const selectedIds = () => _nullishCoalesce(_optionalChain([options, 'access', _217 => _217.getSelectedIds, 'optionalCall', _218 => _218()]), () => ( options.getNodes().filter((n3) => n3.selected).map((n3) => n3.id)));
5496
5498
  const KEEP_FIELDS = ["selected", "dragging", "measured"];
5497
5499
  const replaceNodes = (nodes, replacements, animationOnly = false) => nodes.map((node) => {
5498
5500
  const replacement = replacements.get(node.id);
@@ -5515,7 +5517,7 @@ function createCanvasAnimationController(options) {
5515
5517
  const before = options.getNodes();
5516
5518
  const after = edit(before);
5517
5519
  if (after === before) return false;
5518
- const beforeById = new Map(before.map((n2) => [n2.id, n2]));
5520
+ const beforeById = new Map(before.map((n3) => [n3.id, n3]));
5519
5521
  const undoMap = /* @__PURE__ */ new Map();
5520
5522
  const redoMap = /* @__PURE__ */ new Map();
5521
5523
  for (const node of after) {
@@ -5537,7 +5539,7 @@ function createCanvasAnimationController(options) {
5537
5539
  }
5538
5540
  function pruneSelection() {
5539
5541
  if (selection.length === 0) return;
5540
- const byId = new Map(options.getNodes().map((n2) => [n2.id, n2]));
5542
+ const byId = new Map(options.getNodes().map((n3) => [n3.id, n3]));
5541
5543
  const kept = selection.filter((ref) => {
5542
5544
  const track = _optionalChain([getNodeAnimation, 'call', _222 => _222(byId.get(ref.nodeId)), 'optionalAccess', _223 => _223.tracks, 'access', _224 => _224[ref.property]]);
5543
5545
  return !!track && _chunkO4ONBPZWcjs.normalizeKeyframes.call(void 0, track.keyframes).some((k) => Math.abs(k.time - ref.time) <= _chunkO4ONBPZWcjs.ANIMATION_TIME_EPSILON);
@@ -5643,27 +5645,27 @@ function createCanvasAnimationController(options) {
5643
5645
  return [];
5644
5646
  }
5645
5647
  const ids = new Set(keyed.map((k) => k.nodeId));
5646
- const baseById = new Map(base.map((n2) => [n2.id, n2]));
5647
- const staticNodes = nodes.map((n2) => {
5648
- if (!ids.has(n2.id)) return n2;
5649
- const old = _optionalChain([baseById, 'access', _225 => _225.get, 'call', _226 => _226(n2.id), 'optionalAccess', _227 => _227.data, 'optionalAccess', _228 => _228[ANIMATION_DATA_KEY]]);
5650
- const data = { ..._nullishCoalesce(n2.data, () => ( {})) };
5648
+ const baseById = new Map(base.map((n3) => [n3.id, n3]));
5649
+ const staticNodes = nodes.map((n3) => {
5650
+ if (!ids.has(n3.id)) return n3;
5651
+ const old = _optionalChain([baseById, 'access', _225 => _225.get, 'call', _226 => _226(n3.id), 'optionalAccess', _227 => _227.data, 'optionalAccess', _228 => _228[ANIMATION_DATA_KEY]]);
5652
+ const data = { ..._nullishCoalesce(n3.data, () => ( {})) };
5651
5653
  if (old === void 0) delete data[ANIMATION_DATA_KEY];
5652
5654
  else data[ANIMATION_DATA_KEY] = old;
5653
- return { ...n2, data };
5655
+ return { ...n3, data };
5654
5656
  });
5655
- const animationOf = new Map(nodes.filter((n2) => ids.has(n2.id)).map((n2) => [n2.id, _optionalChain([n2, 'access', _229 => _229.data, 'optionalAccess', _230 => _230[ANIMATION_DATA_KEY]])]));
5657
+ const animationOf = new Map(nodes.filter((n3) => ids.has(n3.id)).map((n3) => [n3.id, _optionalChain([n3, 'access', _229 => _229.data, 'optionalAccess', _230 => _230[ANIMATION_DATA_KEY]])]));
5656
5658
  options.setNodes(staticNodes);
5657
5659
  const tag = `animation.record:${[...ids].sort().join(",")}`;
5658
5660
  commit(
5659
5661
  "Record Keyframe",
5660
- (current) => current.map((n2) => {
5661
- if (!animationOf.has(n2.id)) return n2;
5662
- const data = { ..._nullishCoalesce(n2.data, () => ( {})) };
5663
- const value = animationOf.get(n2.id);
5662
+ (current) => current.map((n3) => {
5663
+ if (!animationOf.has(n3.id)) return n3;
5664
+ const data = { ..._nullishCoalesce(n3.data, () => ( {})) };
5665
+ const value = animationOf.get(n3.id);
5664
5666
  if (value === void 0) delete data[ANIMATION_DATA_KEY];
5665
5667
  else data[ANIMATION_DATA_KEY] = value;
5666
- return { ...n2, data };
5668
+ return { ...n3, data };
5667
5669
  }),
5668
5670
  { tag, animationOnly: true }
5669
5671
  );
@@ -6160,12 +6162,12 @@ function fieldGroup(field) {
6160
6162
  var Graph = (_class5 = class {
6161
6163
  constructor(nodes) {;_class5.prototype.__init13.call(this);
6162
6164
  this.nodes = nodes;
6163
- this.byId = new Map(nodes.map((n2) => [n2.id, n2]));
6164
- for (const n2 of nodes) {
6165
- if (!n2.parentId || !this.byId.has(n2.parentId)) continue;
6166
- let list = this.kids.get(n2.parentId);
6167
- if (!list) this.kids.set(n2.parentId, list = []);
6168
- list.push(n2.id);
6165
+ this.byId = new Map(nodes.map((n3) => [n3.id, n3]));
6166
+ for (const n3 of nodes) {
6167
+ if (!n3.parentId || !this.byId.has(n3.parentId)) continue;
6168
+ let list = this.kids.get(n3.parentId);
6169
+ if (!list) this.kids.set(n3.parentId, list = []);
6170
+ list.push(n3.id);
6169
6171
  }
6170
6172
  }
6171
6173
 
@@ -6195,7 +6197,7 @@ var Graph = (_class5 = class {
6195
6197
  }
6196
6198
  /** Whether `a` is a strict ancestor of `b`. */
6197
6199
  isAncestor(a, b) {
6198
- return this.chain(b, false).some((n2) => n2.id === a);
6200
+ return this.chain(b, false).some((n3) => n3.id === a);
6199
6201
  }
6200
6202
  /** `id` and its descendants, pre-order. */
6201
6203
  subtree(id) {
@@ -6325,7 +6327,7 @@ function componentDepsIn(g, componentId) {
6325
6327
  }
6326
6328
  function createsCycleIn(g, componentId, parentId) {
6327
6329
  if (!parentId) return false;
6328
- const hosts = g.chain(parentId).filter(isCanvasComponent).map((n2) => n2.id);
6330
+ const hosts = g.chain(parentId).filter(isCanvasComponent).map((n3) => n3.id);
6329
6331
  if (hosts.length === 0) return false;
6330
6332
  const deps = componentDepsIn(g, componentId);
6331
6333
  deps.add(componentId);
@@ -6348,7 +6350,7 @@ function isInsideInstance(nodes, id) {
6348
6350
  return enclosingInstanceIn(new Graph(nodes), id) !== void 0;
6349
6351
  }
6350
6352
  function getComponentInstances(nodes, componentId) {
6351
- return nodes.filter((n2) => _optionalChain([getInstanceData, 'call', _263 => _263(n2), 'optionalAccess', _264 => _264.componentId]) === componentId).map((n2) => n2.id);
6353
+ return nodes.filter((n3) => _optionalChain([getInstanceData, 'call', _263 => _263(n3), 'optionalAccess', _264 => _264.componentId]) === componentId).map((n3) => n3.id);
6352
6354
  }
6353
6355
  function getInstanceStatus(nodes, id) {
6354
6356
  const g = new Graph(nodes);
@@ -6387,19 +6389,19 @@ function getInstanceProperties(nodes, id) {
6387
6389
  function listCanvasComponents(nodes) {
6388
6390
  const g = new Graph(nodes);
6389
6391
  const counts = /* @__PURE__ */ new Map();
6390
- for (const n2 of nodes) {
6391
- const c = _optionalChain([getInstanceData, 'call', _267 => _267(n2), 'optionalAccess', _268 => _268.componentId]);
6392
+ for (const n3 of nodes) {
6393
+ const c = _optionalChain([getInstanceData, 'call', _267 => _267(n3), 'optionalAccess', _268 => _268.componentId]);
6392
6394
  if (c) counts.set(c, (_nullishCoalesce(counts.get(c), () => ( 0))) + 1);
6393
6395
  }
6394
6396
  const components = [];
6395
- for (const n2 of nodes) {
6396
- if (!isCanvasComponent(n2)) continue;
6397
- const set = variantSetIn(g, n2.id);
6397
+ for (const n3 of nodes) {
6398
+ if (!isCanvasComponent(n3)) continue;
6399
+ const set = variantSetIn(g, n3.id);
6398
6400
  components.push({
6399
- id: n2.id,
6400
- name: getLayerName(n2) || n2.id,
6401
- ...set ? { setId: set.id, variant: getVariantValues(n2) } : {},
6402
- instanceCount: _nullishCoalesce(counts.get(n2.id), () => ( 0))
6401
+ id: n3.id,
6402
+ name: getLayerName(n3) || n3.id,
6403
+ ...set ? { setId: set.id, variant: getVariantValues(n3) } : {},
6404
+ instanceCount: _nullishCoalesce(counts.get(n3.id), () => ( 0))
6403
6405
  });
6404
6406
  }
6405
6407
  const sets = nodes.filter(isCanvasComponentSet).map((s) => ({
@@ -6466,15 +6468,15 @@ function clearRuntime(node, old) {
6466
6468
  else delete node[k];
6467
6469
  }
6468
6470
  }
6469
- function tokenDrivenGroups(n2, options) {
6470
- const mine = stringRecord2(dataOf(n2).tokenBindings);
6471
+ function tokenDrivenGroups(n3, options) {
6472
+ const mine = stringRecord2(dataOf(n3).tokenBindings);
6471
6473
  const out = [];
6472
6474
  for (const key of Object.keys(mine)) {
6473
6475
  const property = getCanvasTokenProperty(key, options);
6474
- if (!property || !property.appliesTo(n2)) continue;
6475
- const current = property.read(n2);
6476
+ if (!property || !property.appliesTo(n3)) continue;
6477
+ const current = property.read(n3);
6476
6478
  const probe = typeof current === "number" ? current + 1 : typeof current === "boolean" ? !current : `${_nullishCoalesce(current, () => ( ""))}`;
6477
- for (const g of diffOverrideGroups(n2, property.write(n2, probe))) if (!out.includes(g)) out.push(g);
6479
+ for (const g of diffOverrideGroups(n3, property.write(n3, probe))) if (!out.includes(g)) out.push(g);
6478
6480
  }
6479
6481
  return out;
6480
6482
  }
@@ -6538,9 +6540,9 @@ function buildInstance(g, instId, opts, taken) {
6538
6540
  const byParentSource = /* @__PURE__ */ new Map();
6539
6541
  const bySource = /* @__PURE__ */ new Map();
6540
6542
  for (const id of oldIds) {
6541
- const n2 = old.get(id);
6542
- const s = getComponentSourceId(n2);
6543
- const key = `${n2.parentId}\0${s}`;
6543
+ const n3 = old.get(id);
6544
+ const s = getComponentSourceId(n3);
6545
+ const key = `${n3.parentId}\0${s}`;
6544
6546
  if (!byParentSource.has(key)) byParentSource.set(key, id);
6545
6547
  bySource.set(s, bySource.has(s) ? null : id);
6546
6548
  }
@@ -6550,10 +6552,10 @@ function buildInstance(g, instId, opts, taken) {
6550
6552
  const walk = (parent, prefix) => {
6551
6553
  const counts = /* @__PURE__ */ new Map();
6552
6554
  for (const c of g.children(parent)) {
6553
- const n2 = g.get(c);
6554
- const src = getComponentSourceId(n2);
6555
+ const n3 = g.get(c);
6556
+ const src = getComponentSourceId(n3);
6555
6557
  if (src === void 0) continue;
6556
- const name = getLayerName(_nullishCoalesce(g.get(src), () => ( n2)));
6558
+ const name = getLayerName(_nullishCoalesce(g.get(src), () => ( n3)));
6557
6559
  const k = _nullishCoalesce(counts.get(name), () => ( 0));
6558
6560
  counts.set(name, k + 1);
6559
6561
  const path = `${prefix}/${k === 0 ? name : `${name}#${k}`}`;
@@ -6574,7 +6576,7 @@ function buildInstance(g, instId, opts, taken) {
6574
6576
  };
6575
6577
  const instProps = /* @__PURE__ */ new Map();
6576
6578
  const out = [];
6577
- const isText2 = (n2) => typeof n2.type === "string" && opts.textTypes.includes(n2.type);
6579
+ const isText2 = (n3) => typeof n3.type === "string" && opts.textTypes.includes(n3.type);
6578
6580
  const copyLayer = (s, o, id, parentId) => {
6579
6581
  const next = { ...s, id, parentId };
6580
6582
  const data = stripLook(dataOf(s));
@@ -6582,7 +6584,7 @@ function buildInstance(g, instId, opts, taken) {
6582
6584
  data[COMPONENT_SOURCE_DATA_KEY] = s.id;
6583
6585
  next.data = data;
6584
6586
  clearRuntime(next, o);
6585
- let n2 = next;
6587
+ let n3 = next;
6586
6588
  if (o) {
6587
6589
  let groups = [...getNodeOverrides(o)];
6588
6590
  const from = g.get(getComponentSourceId(o));
@@ -6590,16 +6592,16 @@ function buildInstance(g, instId, opts, taken) {
6590
6592
  const differs = new Set(diffOverrideGroups(from, s));
6591
6593
  groups = groups.filter((gr) => !differs.has(gr));
6592
6594
  }
6593
- n2 = copyGroups(o, n2, groups);
6594
- n2 = keepLaidOut(s, o, n2, groups);
6595
- n2 = setOverrides(n2, groups);
6595
+ n3 = copyGroups(o, n3, groups);
6596
+ n3 = keepLaidOut(s, o, n3, groups);
6597
+ n3 = setOverrides(n3, groups);
6596
6598
  }
6597
- return fixMeasured(n2, o);
6599
+ return fixMeasured(n3, o);
6598
6600
  };
6599
- const keepLaidOut = (s, o, n2, groups) => {
6600
- if (o.parentId !== n2.parentId || groups.includes("size") || groups.includes("position")) return n2;
6601
- const flows = !getChildLayout(n2).absolute && !!getAutoLayout(g.get(s.parentId));
6602
- let next = n2;
6601
+ const keepLaidOut = (s, o, n3, groups) => {
6602
+ if (o.parentId !== n3.parentId || groups.includes("size") || groups.includes("position")) return n3;
6603
+ const flows = !getChildLayout(n3).absolute && !!getAutoLayout(g.get(s.parentId));
6604
+ let next = n3;
6603
6605
  if (flows) next = writeOverrideGroup(next, "position", o.position);
6604
6606
  const derived = (axis) => {
6605
6607
  const sizing = getLayoutSizing(next, axis);
@@ -6628,27 +6630,27 @@ function buildInstance(g, instId, opts, taken) {
6628
6630
  data[COMPONENT_SOURCE_DATA_KEY] = sourceId;
6629
6631
  next.data = data;
6630
6632
  clearRuntime(next, old2);
6631
- let n2 = next;
6633
+ let n3 = next;
6632
6634
  const own = /* @__PURE__ */ new Set();
6633
6635
  listGroups(place2, own);
6634
- listGroups(n2, own);
6635
- n2 = copyGroups(place2, n2, [...own].filter((gr) => isOwnRootGroup(gr) && gr !== "component" && gr !== "props"));
6636
+ listGroups(n3, own);
6637
+ n3 = copyGroups(place2, n3, [...own].filter((gr) => isOwnRootGroup(gr) && gr !== "component" && gr !== "props"));
6636
6638
  let groups = old2 ? getNodeOverrides(old2).filter((gr) => !topLevel || !isOwnRootGroup(gr)) : [];
6637
6639
  if (old2 && previousComponent && siblingVariants(g, previousComponent, look.id)) {
6638
6640
  const differs = new Set(diffOverrideGroups(g.get(previousComponent), look));
6639
6641
  groups = groups.filter((gr) => gr === "data.label" || gr === "data.name" || !differs.has(gr));
6640
6642
  }
6641
- if (old2) n2 = copyGroups(old2, n2, groups.filter((gr) => gr !== "component" && gr !== "props"));
6642
- return fixMeasured(setOverrides(n2, groups), old2);
6643
+ if (old2) n3 = copyGroups(old2, n3, groups.filter((gr) => gr !== "component" && gr !== "props"));
6644
+ return fixMeasured(setOverrides(n3, groups), old2);
6643
6645
  };
6644
- const applyChainProps = (n2, s, enc) => {
6646
+ const applyChainProps = (n3, s, enc) => {
6645
6647
  const chain = [s];
6646
6648
  while (chain.length < enc.length) {
6647
6649
  const next2 = g.get(getComponentSourceId(chain[chain.length - 1]));
6648
6650
  if (!next2) break;
6649
6651
  chain.push(next2);
6650
6652
  }
6651
- let next = n2;
6653
+ let next = n3;
6652
6654
  for (let j = chain.length - 1; j >= 0; j--) {
6653
6655
  const props = instProps.get(enc[j]);
6654
6656
  if (!props) continue;
@@ -6682,8 +6684,8 @@ function buildInstance(g, instId, opts, taken) {
6682
6684
  if (oid !== void 0) used.add(oid);
6683
6685
  const o = oid !== void 0 ? old.get(oid) : void 0;
6684
6686
  const id = _nullishCoalesce(oid, () => ( fresh(sid)));
6685
- let n2 = applyChainProps(copyLayer(s, o, id, newParent), s, enc);
6686
- const nested = getInstanceData(n2);
6687
+ let n3 = applyChainProps(copyLayer(s, o, id, newParent), s, enc);
6688
+ const nested = getInstanceData(n3);
6687
6689
  if (nested && depth2 < MAX_DEPTH) {
6688
6690
  const target = nested.componentId;
6689
6691
  instProps.set(id, effectivePropsIn(g, target, nested.properties));
@@ -6691,30 +6693,30 @@ function buildInstance(g, instId, opts, taken) {
6691
6693
  const main = g.get(target);
6692
6694
  if (isCanvasComponent(main) && !expanding.includes(target) && !g.isAncestor(target, instId)) {
6693
6695
  const previousComponent = o ? _optionalChain([getInstanceData, 'call', _272 => _272(o), 'optionalAccess', _273 => _273.componentId]) : void 0;
6694
- n2 = applyChainProps(instanceRoot(main, s, o, id, newParent, sid, nested, previousComponent, false), s, enc);
6695
- out.push(n2);
6696
+ n3 = applyChainProps(instanceRoot(main, s, o, id, newParent, sid, nested, previousComponent, false), s, enc);
6697
+ out.push(n3);
6696
6698
  copyChildren(target, id, path, [id], [...expanding, target], depth2 + 1);
6697
6699
  continue;
6698
6700
  }
6699
6701
  }
6700
- out.push(n2);
6702
+ out.push(n3);
6701
6703
  copyChildren(sid, id, path, [...enc, id], expanding, depth2);
6702
6704
  continue;
6703
6705
  }
6704
- out.push(n2);
6706
+ out.push(n3);
6705
6707
  copyChildren(sid, id, path, enc, expanding, depth2);
6706
6708
  }
6707
6709
  };
6708
6710
  const root = instanceRoot(comp, inst, inst, instId, inst.parentId, compId, instData, getComponentSourceId(inst), true);
6709
6711
  instProps.set(instId, effectivePropsIn(g, compId, instData.properties));
6710
6712
  copyChildren(compId, instId, "", [instId], [compId], 0);
6711
- const placed = /* @__PURE__ */ new Set([instId, ...out.map((n2) => n2.id)]);
6713
+ const placed = /* @__PURE__ */ new Set([instId, ...out.map((n3) => n3.id)]);
6712
6714
  const keptForeign = [];
6713
6715
  for (const id of foreign) {
6714
- const n2 = g.get(id);
6715
- if (n2.parentId && placed.has(n2.parentId)) {
6716
+ const n3 = g.get(id);
6717
+ if (n3.parentId && placed.has(n3.parentId)) {
6716
6718
  placed.add(id);
6717
- keptForeign.push(n2);
6719
+ keptForeign.push(n3);
6718
6720
  }
6719
6721
  }
6720
6722
  const removed = /* @__PURE__ */ new Set([instId, ...oldIds, ...foreign]);
@@ -6722,17 +6724,17 @@ function buildInstance(g, instId, opts, taken) {
6722
6724
  const compSize = getNodeSize(comp);
6723
6725
  const rootSize = getNodeSize(root);
6724
6726
  if (!getAutoLayout(root) && (Math.abs(compSize.width - rootSize.width) > 1e-9 || Math.abs(compSize.height - rootSize.height) > 1e-9)) {
6725
- const fixed = new Set(out.filter((n2) => getNodeOverrides(n2).some((gr) => gr === "size" || gr === "position")).map((n2) => n2.id));
6727
+ const fixed = new Set(out.filter((n3) => getNodeOverrides(n3).some((gr) => gr === "size" || gr === "position")).map((n3) => n3.id));
6726
6728
  const updates = applyConstraints(block, instId, compSize, opts.layout || {}).filter((u) => !fixed.has(u.id));
6727
6729
  block = applyNodeUpdates(block, updates);
6728
6730
  }
6729
6731
  if (opts.layout) {
6730
- const frames = block.filter((n2) => getAutoLayout(n2)).map((n2) => n2.id);
6732
+ const frames = block.filter((n3) => getAutoLayout(n3)).map((n3) => n3.id);
6731
6733
  if (frames.length) block = applyNodeUpdates(block, layoutUpMany(block, frames, opts.layout));
6732
6734
  }
6733
- block = block.map((n2) => {
6734
- const prev = g.get(n2.id);
6735
- return prev && prev !== n2 && same(prev, n2) ? prev : n2;
6735
+ block = block.map((n3) => {
6736
+ const prev = g.get(n3.id);
6737
+ return prev && prev !== n3 && same(prev, n3) ? prev : n3;
6736
6738
  });
6737
6739
  return { block, removed };
6738
6740
  }
@@ -6750,20 +6752,20 @@ function rebuildBatch(nodes, ids, opts) {
6750
6752
  const removed = /* @__PURE__ */ new Set();
6751
6753
  for (const b of built.values()) for (const id of b.removed) removed.add(id);
6752
6754
  let result = [];
6753
- for (const n2 of nodes) {
6754
- const b = built.get(n2.id);
6755
+ for (const n3 of nodes) {
6756
+ const b = built.get(n3.id);
6755
6757
  if (b) result.push(...b.block);
6756
- else if (!removed.has(n2.id)) result.push(n2);
6758
+ else if (!removed.has(n3.id)) result.push(n3);
6757
6759
  }
6758
6760
  if (opts.layout) {
6759
- const lookup = new Map(result.map((n2) => [n2.id, n2]));
6761
+ const lookup = new Map(result.map((n3) => [n3.id, n3]));
6760
6762
  const inFrames = [...built.keys()].filter((r) => {
6761
6763
  const parent = lookup.get(_nullishCoalesce(_optionalChain([lookup, 'access', _274 => _274.get, 'call', _275 => _275(r), 'optionalAccess', _276 => _276.parentId]), () => ( "")));
6762
6764
  return !!getAutoLayout(parent);
6763
6765
  });
6764
6766
  if (inFrames.length) result = applyNodeUpdates(result, layoutUpMany(result, inFrames, opts.layout));
6765
6767
  }
6766
- return result.length === nodes.length && result.every((n2, i) => n2 === nodes[i]) ? nodes : result;
6768
+ return result.length === nodes.length && result.every((n3, i) => n3 === nodes[i]) ? nodes : result;
6767
6769
  }
6768
6770
  function rebuildInstances(nodes, comps, resync, opts) {
6769
6771
  let current = nodes;
@@ -6778,10 +6780,10 @@ function rebuildInstances(nodes, comps, resync, opts) {
6778
6780
  if (comps.size === 0) return current;
6779
6781
  const g = new Graph(current);
6780
6782
  const rootsOf = /* @__PURE__ */ new Map();
6781
- for (const n2 of current) {
6782
- const inst = getInstanceData(n2);
6783
+ for (const n3 of current) {
6784
+ const inst = getInstanceData(n3);
6783
6785
  if (!inst) continue;
6784
- const root = _nullishCoalesce(rootInstanceIn(g, n2.id), () => ( n2.id));
6786
+ const root = _nullishCoalesce(rootInstanceIn(g, n3.id), () => ( n3.id));
6785
6787
  let set = rootsOf.get(inst.componentId);
6786
6788
  if (!set) rootsOf.set(inst.componentId, set = /* @__PURE__ */ new Set());
6787
6789
  set.add(root);
@@ -6815,7 +6817,7 @@ function rebuildInstances(nodes, comps, resync, opts) {
6815
6817
  function finish(original, result, opts) {
6816
6818
  let out = result;
6817
6819
  if (_optionalChain([opts, 'access', _277 => _277.tokens, 'optionalAccess', _278 => _278.state])) out = resolveCanvasTokens(out, opts.tokens.state, opts.tokens);
6818
- if (out.length === original.length && out.every((n2, i) => n2 === original[i])) return original;
6820
+ if (out.length === original.length && out.every((n3, i) => n3 === original[i])) return original;
6819
6821
  return out;
6820
6822
  }
6821
6823
  function syncCanvasInstance(nodes, instanceId, options = {}) {
@@ -6824,7 +6826,7 @@ function syncCanvasInstance(nodes, instanceId, options = {}) {
6824
6826
  }
6825
6827
  function syncAllCanvasInstances(nodes, options = {}) {
6826
6828
  const opts = resolveSync(options);
6827
- const comps = new Set(nodes.filter(isCanvasComponent).map((n2) => n2.id));
6829
+ const comps = new Set(nodes.filter(isCanvasComponent).map((n3) => n3.id));
6828
6830
  return finish(nodes, rebuildInstances([...nodes], comps, /* @__PURE__ */ new Set(), opts), opts);
6829
6831
  }
6830
6832
  function rebaseInstance(nodes, instId, tokens) {
@@ -6839,8 +6841,8 @@ function rebaseInstance(nodes, instId, tokens) {
6839
6841
  const walk = (parent, prefix) => {
6840
6842
  const counts = /* @__PURE__ */ new Map();
6841
6843
  for (const c of g.children(parent)) {
6842
- const n2 = g.get(c);
6843
- const name = getLayerName(viaSource && g.get(getComponentSourceId(n2)) || n2);
6844
+ const n3 = g.get(c);
6845
+ const name = getLayerName(viaSource && g.get(getComponentSourceId(n3)) || n3);
6844
6846
  const k = _nullishCoalesce(counts.get(name), () => ( 0));
6845
6847
  counts.set(name, k + 1);
6846
6848
  const path = `${prefix}/${k === 0 ? name : `${name}#${k}`}`;
@@ -6856,9 +6858,9 @@ function rebaseInstance(nodes, instId, tokens) {
6856
6858
  paths(instId, true, mine, false);
6857
6859
  const updates = /* @__PURE__ */ new Map();
6858
6860
  for (const [id, path] of mine) {
6859
- const n2 = g.get(id);
6861
+ const n3 = g.get(id);
6860
6862
  let main;
6861
- let cur = getComponentSourceId(n2);
6863
+ let cur = getComponentSourceId(n3);
6862
6864
  for (let i = 0; cur && i < MAX_DEPTH; i++) {
6863
6865
  if (cur !== compId && g.get(cur) && g.isAncestor(compId, cur)) {
6864
6866
  main = cur;
@@ -6868,15 +6870,15 @@ function rebaseInstance(nodes, instId, tokens) {
6868
6870
  }
6869
6871
  main ??= comp ? theirs.get(path) : void 0;
6870
6872
  const m = g.get(main);
6871
- let next = n2;
6873
+ let next = n3;
6872
6874
  if (m) {
6873
- const bound = /* @__PURE__ */ new Set([...propertyDrivenGroups(g, m), ...tokenDrivenGroups(n2, tokens)]);
6874
- const groups = new Set(getNodeOverrides(n2).filter((gr) => gr !== "component" && gr !== "props"));
6875
- for (const gr of diffOverrideGroups(m, n2)) if (gr !== "size" && gr !== "position" && !bound.has(gr)) groups.add(gr);
6876
- if (isCanvasInstance(m) && isCanvasInstance(n2) && getInstanceData(m).componentId !== getInstanceData(n2).componentId) groups.add("component");
6877
- next = setOverrides(withData(n2, { ...dataOf(n2), [COMPONENT_SOURCE_DATA_KEY]: m.id }), groups);
6878
- } else next = unlinked(n2);
6879
- if (next !== n2) updates.set(id, next);
6875
+ const bound = /* @__PURE__ */ new Set([...propertyDrivenGroups(g, m), ...tokenDrivenGroups(n3, tokens)]);
6876
+ const groups = new Set(getNodeOverrides(n3).filter((gr) => gr !== "component" && gr !== "props"));
6877
+ for (const gr of diffOverrideGroups(m, n3)) if (gr !== "size" && gr !== "position" && !bound.has(gr)) groups.add(gr);
6878
+ if (isCanvasInstance(m) && isCanvasInstance(n3) && getInstanceData(m).componentId !== getInstanceData(n3).componentId) groups.add("component");
6879
+ next = setOverrides(withData(n3, { ...dataOf(n3), [COMPONENT_SOURCE_DATA_KEY]: m.id }), groups);
6880
+ } else next = unlinked(n3);
6881
+ if (next !== n3) updates.set(id, next);
6880
6882
  }
6881
6883
  const root = g.get(instId);
6882
6884
  let nextRoot = withData(root, { ...dataOf(root), [COMPONENT_SOURCE_DATA_KEY]: compId });
@@ -6888,7 +6890,7 @@ function rebaseInstance(nodes, instId, tokens) {
6888
6890
  nextRoot = setOverrides(nextRoot, groups);
6889
6891
  }
6890
6892
  updates.set(instId, nextRoot);
6891
- return nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
6893
+ return nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
6892
6894
  }
6893
6895
  function sizeFromLayout(g, node) {
6894
6896
  const parentFlows = !!getAutoLayout(g.get(node.parentId)) && !getChildLayout(node).absolute;
@@ -6903,7 +6905,7 @@ function syncCanvasComponents(before, after, options = {}) {
6903
6905
  const prev = new Graph(before);
6904
6906
  let nodes = [...after];
6905
6907
  const resync = /* @__PURE__ */ new Set();
6906
- const afterIds = new Set(after.map((n2) => n2.id));
6908
+ const afterIds = new Set(after.map((n3) => n3.id));
6907
6909
  const restore = [];
6908
6910
  for (const b of before) {
6909
6911
  if (afterIds.has(b.id) || getComponentSourceId(b) === void 0 || isCanvasInstance(b) && !enclosingInstanceIn(prev, b.id)) continue;
@@ -6912,7 +6914,7 @@ function syncCanvasComponents(before, after, options = {}) {
6912
6914
  restore.push(b);
6913
6915
  }
6914
6916
  if (restore.length) {
6915
- const restoring = new Set(restore.map((n2) => n2.id));
6917
+ const restoring = new Set(restore.map((n3) => n3.id));
6916
6918
  for (const b of restore) nodes.push(b.parentId && restoring.has(b.parentId) ? b : writeOverrideGroup(b, "hidden", true));
6917
6919
  for (const b of restore) {
6918
6920
  const r = rootInstanceIn(prev, b.id);
@@ -6920,104 +6922,104 @@ function syncCanvasComponents(before, after, options = {}) {
6920
6922
  }
6921
6923
  }
6922
6924
  let g = new Graph(nodes);
6923
- const added = nodes.filter((n2) => !prev.byId.has(n2.id));
6925
+ const added = nodes.filter((n3) => !prev.byId.has(n3.id));
6924
6926
  if (added.length) {
6925
- const addedIds = new Set(added.map((n2) => n2.id));
6927
+ const addedIds = new Set(added.map((n3) => n3.id));
6926
6928
  const moves = /* @__PURE__ */ new Map();
6927
- for (const n2 of added) {
6928
- if (!n2.parentId || addedIds.has(n2.parentId)) continue;
6929
- const r = rootInstanceIn(g, n2.parentId);
6929
+ for (const n3 of added) {
6930
+ if (!n3.parentId || addedIds.has(n3.parentId)) continue;
6931
+ const r = rootInstanceIn(g, n3.parentId);
6930
6932
  if (!r || addedIds.has(r)) continue;
6931
6933
  const rootNode = g.get(r);
6932
- const abs = getAbsolutePosition(n2, g.byId);
6934
+ const abs = getAbsolutePosition(n3, g.byId);
6933
6935
  const parent = g.get(rootNode.parentId);
6934
6936
  const base = parent ? getAbsolutePosition(parent, g.byId) : { x: 0, y: 0 };
6935
- const moved = { ...n2, position: { x: abs.x - base.x, y: abs.y - base.y } };
6937
+ const moved = { ...n3, position: { x: abs.x - base.x, y: abs.y - base.y } };
6936
6938
  if (rootNode.parentId) moved.parentId = rootNode.parentId;
6937
6939
  else delete moved.parentId;
6938
- moves.set(n2.id, moved);
6940
+ moves.set(n3.id, moved);
6939
6941
  }
6940
6942
  if (moves.size) {
6941
- nodes = nodes.map((n2) => _nullishCoalesce(moves.get(n2.id), () => ( n2)));
6943
+ nodes = nodes.map((n3) => _nullishCoalesce(moves.get(n3.id), () => ( n3)));
6942
6944
  g = new Graph(nodes);
6943
6945
  }
6944
6946
  const rebase = [];
6945
6947
  const strips = /* @__PURE__ */ new Map();
6946
- for (const n2 of added) {
6947
- const cur = g.get(n2.id);
6948
+ for (const n3 of added) {
6949
+ const cur = g.get(n3.id);
6948
6950
  if (isCanvasInstance(cur)) {
6949
- if (enclosingInstanceIn(g, n2.id) === void 0 && getComponentSourceId(cur) !== getInstanceData(cur).componentId) rebase.push(n2.id);
6951
+ if (enclosingInstanceIn(g, n3.id) === void 0 && getComponentSourceId(cur) !== getInstanceData(cur).componentId) rebase.push(n3.id);
6950
6952
  continue;
6951
6953
  }
6952
6954
  if (getComponentSourceId(cur) === void 0 && getNodeOverrides(cur).length === 0) continue;
6953
- const r = rootInstanceIn(g, n2.id);
6954
- if (!r || !addedIds.has(r) || moves.has(n2.id)) strips.set(n2.id, unlinked(cur, true));
6955
+ const r = rootInstanceIn(g, n3.id);
6956
+ if (!r || !addedIds.has(r) || moves.has(n3.id)) strips.set(n3.id, unlinked(cur, true));
6955
6957
  }
6956
- if (strips.size) nodes = nodes.map((n2) => _nullishCoalesce(strips.get(n2.id), () => ( n2)));
6958
+ if (strips.size) nodes = nodes.map((n3) => _nullishCoalesce(strips.get(n3.id), () => ( n3)));
6957
6959
  for (const id of rebase) nodes = rebaseInstance(nodes, id, opts.tokens);
6958
6960
  g = new Graph(nodes);
6959
6961
  }
6960
6962
  const overrideUpdates = /* @__PURE__ */ new Map();
6961
- for (const n2 of nodes) {
6962
- const b = prev.get(n2.id);
6963
- if (!b || b === n2) continue;
6964
- const inst = owningInstanceIn(g, n2.id);
6965
- if (!inst || getComponentSourceId(n2) === void 0 && inst !== n2.id) continue;
6966
- const topRoot = inst === n2.id && enclosingInstanceIn(g, n2.id) === void 0;
6963
+ for (const n3 of nodes) {
6964
+ const b = prev.get(n3.id);
6965
+ if (!b || b === n3) continue;
6966
+ const inst = owningInstanceIn(g, n3.id);
6967
+ if (!inst || getComponentSourceId(n3) === void 0 && inst !== n3.id) continue;
6968
+ const topRoot = inst === n3.id && enclosingInstanceIn(g, n3.id) === void 0;
6967
6969
  const bi = getInstanceData(b);
6968
- const ni = getInstanceData(n2);
6969
- const raw = diffOverrideGroups(b, n2);
6970
+ const ni = getInstanceData(n3);
6971
+ const raw = diffOverrideGroups(b, n3);
6970
6972
  if (topRoot) {
6971
- if (bi && ni && (bi.componentId !== ni.componentId || !same(_nullishCoalesce(bi.properties, () => ( {})), _nullishCoalesce(ni.properties, () => ( {}))))) resync.add(n2.id);
6972
- if (raw.includes("size")) resync.add(n2.id);
6973
+ if (bi && ni && (bi.componentId !== ni.componentId || !same(_nullishCoalesce(bi.properties, () => ( {})), _nullishCoalesce(ni.properties, () => ( {}))))) resync.add(n3.id);
6974
+ if (raw.includes("size")) resync.add(n3.id);
6973
6975
  }
6974
- let groups = raw.filter((gr) => gr !== "position" && (gr !== "size" || topRoot && !sizeFromLayout(g, n2)));
6976
+ let groups = raw.filter((gr) => gr !== "position" && (gr !== "size" || topRoot && !sizeFromLayout(g, n3)));
6975
6977
  if (topRoot) groups = groups.filter((gr) => !isOwnRootGroup(gr));
6976
6978
  let cleared = [];
6977
- const srcId = topRoot ? _optionalChain([ni, 'optionalAccess', _279 => _279.componentId]) : getComponentSourceId(n2);
6979
+ const srcId = topRoot ? _optionalChain([ni, 'optionalAccess', _279 => _279.componentId]) : getComponentSourceId(n3);
6978
6980
  const src = g.get(srcId);
6979
6981
  if (src) {
6980
6982
  const reference = topRoot ? rootReference(g, src) : src;
6981
- const differs = new Set(diffOverrideGroups(reference, n2));
6982
- const driven = new Set(tokenDrivenGroups(n2, opts.tokens));
6983
+ const differs = new Set(diffOverrideGroups(reference, n3));
6984
+ const driven = new Set(tokenDrivenGroups(n3, opts.tokens));
6983
6985
  groups = groups.filter((gr) => differs.has(gr) && !driven.has(gr));
6984
- cleared = raw.filter((gr) => gr !== "size" && gr !== "position" && !differs.has(gr) && getNodeOverrides(n2).includes(gr));
6986
+ cleared = raw.filter((gr) => gr !== "size" && gr !== "position" && !differs.has(gr) && getNodeOverrides(n3).includes(gr));
6985
6987
  if (topRoot) cleared = cleared.filter((gr) => !isOwnRootGroup(gr));
6986
6988
  }
6987
- const lost = getNodeOverrides(b).some((gr) => !getNodeOverrides(n2).includes(gr));
6989
+ const lost = getNodeOverrides(b).some((gr) => !getNodeOverrides(n3).includes(gr));
6988
6990
  const nestedSwitch = !topRoot && raw.some((gr) => gr === "component" || gr === "props");
6989
6991
  if (groups.length || cleared.length) {
6990
- const set = new Set(getNodeOverrides(n2));
6992
+ const set = new Set(getNodeOverrides(n3));
6991
6993
  for (const gr of groups) set.add(gr);
6992
6994
  for (const gr of cleared) set.delete(gr);
6993
- const updated = setOverrides(n2, set);
6994
- if (updated !== n2) overrideUpdates.set(n2.id, updated);
6995
+ const updated = setOverrides(n3, set);
6996
+ if (updated !== n3) overrideUpdates.set(n3.id, updated);
6995
6997
  }
6996
6998
  if (lost || nestedSwitch) {
6997
- const r = rootInstanceIn(g, n2.id);
6999
+ const r = rootInstanceIn(g, n3.id);
6998
7000
  if (r) resync.add(r);
6999
7001
  }
7000
7002
  }
7001
7003
  if (overrideUpdates.size) {
7002
- nodes = nodes.map((n2) => _nullishCoalesce(overrideUpdates.get(n2.id), () => ( n2)));
7004
+ nodes = nodes.map((n3) => _nullishCoalesce(overrideUpdates.get(n3.id), () => ( n3)));
7003
7005
  g = new Graph(nodes);
7004
7006
  }
7005
7007
  const comps = /* @__PURE__ */ new Set();
7006
- for (const n2 of nodes) {
7007
- const b = prev.get(n2.id);
7008
- if (b === n2) continue;
7009
- const c = owningComponentIn(g, n2.id);
7010
- if (isCanvasComponentSet(n2) && (!b || !same(dataOf(b)[COMPONENT_SET_DATA_KEY], dataOf(n2)[COMPONENT_SET_DATA_KEY]))) {
7011
- for (const v of variantsIn(g, n2.id)) comps.add(v.id);
7008
+ for (const n3 of nodes) {
7009
+ const b = prev.get(n3.id);
7010
+ if (b === n3) continue;
7011
+ const c = owningComponentIn(g, n3.id);
7012
+ if (isCanvasComponentSet(n3) && (!b || !same(dataOf(b)[COMPONENT_SET_DATA_KEY], dataOf(n3)[COMPONENT_SET_DATA_KEY]))) {
7013
+ for (const v of variantsIn(g, n3.id)) comps.add(v.id);
7012
7014
  }
7013
7015
  if (!c) continue;
7014
7016
  if (!b) {
7015
7017
  comps.add(c);
7016
7018
  continue;
7017
7019
  }
7018
- const structural = b.parentId !== n2.parentId || !same(dataOf(b)[COMPONENT_DATA_KEY], dataOf(n2)[COMPONENT_DATA_KEY]) || !same(getComponentPropertyRefs(b), getComponentPropertyRefs(n2)) || getComponentSourceId(b) !== getComponentSourceId(n2) || !same(getNodeOverrides(b), getNodeOverrides(n2));
7019
- const diff = diffOverrideGroups(b, n2);
7020
- if (!structural && (diff.length === 0 || n2.id === c && diff.every(isOwnRootGroup))) continue;
7020
+ const structural = b.parentId !== n3.parentId || !same(dataOf(b)[COMPONENT_DATA_KEY], dataOf(n3)[COMPONENT_DATA_KEY]) || !same(getComponentPropertyRefs(b), getComponentPropertyRefs(n3)) || getComponentSourceId(b) !== getComponentSourceId(n3) || !same(getNodeOverrides(b), getNodeOverrides(n3));
7021
+ const diff = diffOverrideGroups(b, n3);
7022
+ if (!structural && (diff.length === 0 || n3.id === c && diff.every(isOwnRootGroup))) continue;
7021
7023
  comps.add(c);
7022
7024
  }
7023
7025
  for (const b of before) {
@@ -7028,7 +7030,7 @@ function syncCanvasComponents(before, after, options = {}) {
7028
7030
  {
7029
7031
  const order = (list) => {
7030
7032
  const m = /* @__PURE__ */ new Map();
7031
- for (const n2 of list) if (n2.parentId) m.set(n2.parentId, [..._nullishCoalesce(m.get(n2.parentId), () => ( [])), n2.id]);
7033
+ for (const n3 of list) if (n3.parentId) m.set(n3.parentId, [..._nullishCoalesce(m.get(n3.parentId), () => ( [])), n3.id]);
7032
7034
  return m;
7033
7035
  };
7034
7036
  const ob = order(before);
@@ -7063,12 +7065,12 @@ function wrapInFrame(nodes, ids, frame) {
7063
7065
  let minY = Infinity;
7064
7066
  let maxX = -Infinity;
7065
7067
  let maxY = -Infinity;
7066
- for (const n2 of roots) {
7067
- const { width: width2, height: height2 } = getNodeSize(n2);
7068
- minX = Math.min(minX, n2.position.x);
7069
- minY = Math.min(minY, n2.position.y);
7070
- maxX = Math.max(maxX, n2.position.x + width2);
7071
- maxY = Math.max(maxY, n2.position.y + height2);
7068
+ for (const n3 of roots) {
7069
+ const { width: width2, height: height2 } = getNodeSize(n3);
7070
+ minX = Math.min(minX, n3.position.x);
7071
+ minY = Math.min(minY, n3.position.y);
7072
+ maxX = Math.max(maxX, n3.position.x + width2);
7073
+ maxY = Math.max(maxY, n3.position.y + height2);
7072
7074
  }
7073
7075
  minX -= frame.padding;
7074
7076
  minY -= frame.padding;
@@ -7088,11 +7090,11 @@ function wrapInFrame(nodes, ids, frame) {
7088
7090
  ...parentId ? { parentId } : {}
7089
7091
  };
7090
7092
  const selected = new Set(ids);
7091
- const firstIndex = nodes.findIndex((n2) => selected.has(n2.id));
7093
+ const firstIndex = nodes.findIndex((n3) => selected.has(n3.id));
7092
7094
  const out = [];
7093
- nodes.forEach((n2, i) => {
7095
+ nodes.forEach((n3, i) => {
7094
7096
  if (i === firstIndex) out.push(wrapper);
7095
- out.push(selected.has(n2.id) ? { ...n2, parentId: frame.id, position: { x: n2.position.x - minX, y: n2.position.y - minY } } : n2);
7097
+ out.push(selected.has(n3.id) ? { ...n3, parentId: frame.id, position: { x: n3.position.x - minX, y: n3.position.y - minY } } : n3);
7096
7098
  });
7097
7099
  return out;
7098
7100
  }
@@ -7113,7 +7115,7 @@ function createCanvasComponent(nodes, ids, options = {}) {
7113
7115
  const node = g.get(roots[0]);
7114
7116
  const frameLike = !isCanvasInstance(node) && (g.children(node.id).length > 0 || typeof node.type === "string" && frameTypes.includes(node.type) || !!getAutoLayout(node));
7115
7117
  if (frameLike) {
7116
- const after2 = nodes.map((n2) => n2.id === node.id ? withData(n2, { ...dataOf(n2), [COMPONENT_DATA_KEY]: {} }) : n2);
7118
+ const after2 = nodes.map((n3) => n3.id === node.id ? withData(n3, { ...dataOf(n3), [COMPONENT_DATA_KEY]: {} }) : n3);
7117
7119
  return done(nodes, after2, [node.id], options);
7118
7120
  }
7119
7121
  }
@@ -7130,7 +7132,7 @@ function combineCanvasComponentsAsVariants(nodes, ids, options = {}) {
7130
7132
  if (picked.some((id2) => variantSetIn(g, id2))) return fail(nodes, "invalid", "A component is already a variant of a set.");
7131
7133
  if (picked.some((id2) => owningInstanceIn(g, id2))) return fail(nodes, "inside-instance", "Components inside an instance can't be combined.");
7132
7134
  if (new Set(picked.map((id2) => _nullishCoalesce(g.get(id2).parentId, () => ( "")))).size > 1) return fail(nodes, "invalid", "Select components that share a parent.");
7133
- const ordered = nodes.filter((n2) => picked.includes(n2.id)).map((n2) => n2.id);
7135
+ const ordered = nodes.filter((n3) => picked.includes(n3.id)).map((n3) => n3.id);
7134
7136
  const first = g.get(ordered[0]);
7135
7137
  const firstName = getLayerName(first);
7136
7138
  const name = _nullishCoalesce(options.name, () => ( (firstName && !firstName.includes("=") ? firstName.split("/")[0].trim() : "Component")));
@@ -7143,13 +7145,13 @@ function combineCanvasComponentsAsVariants(nodes, ids, options = {}) {
7143
7145
  });
7144
7146
  const order = [];
7145
7147
  for (const vid of ordered) for (const k of Object.keys(getVariantValues(g.get(vid)))) if (!order.includes(k)) order.push(k);
7146
- after = after.map((n2) => {
7147
- const k = ordered.indexOf(n2.id);
7148
- if (k < 0) return n2;
7149
- let variant = getVariantValues(n2);
7148
+ after = after.map((n3) => {
7149
+ const k = ordered.indexOf(n3.id);
7150
+ if (k < 0) return n3;
7151
+ let variant = getVariantValues(n3);
7150
7152
  if (Object.keys(variant).length === 0) variant = { "Property 1": k === 0 ? "Default" : `Variant${k + 1}` };
7151
- const comp = { ..._nullishCoalesce(getComponentData(n2), () => ( {})), variant };
7152
- return withData(n2, { ...dataOf(n2), [COMPONENT_DATA_KEY]: comp, label: formatVariantName(variant, order) });
7153
+ const comp = { ..._nullishCoalesce(getComponentData(n3), () => ( {})), variant };
7154
+ return withData(n3, { ...dataOf(n3), [COMPONENT_DATA_KEY]: comp, label: formatVariantName(variant, order) });
7153
7155
  });
7154
7156
  return done(nodes, after, [id], options);
7155
7157
  }
@@ -7210,7 +7212,7 @@ function detachCanvasInstance(nodes, ids, options = {}) {
7210
7212
  delete data[COMPONENT_SOURCE_DATA_KEY];
7211
7213
  delete data[COMPONENT_OVERRIDES_DATA_KEY];
7212
7214
  updates.set(id, withData(root, data));
7213
- current = current.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
7215
+ current = current.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
7214
7216
  for (const nn of nested) current = rebaseInstance(current, nn, options.tokens);
7215
7217
  doneIds.push(id);
7216
7218
  }
@@ -7224,10 +7226,10 @@ function resetCanvasInstanceOverrides(nodes, id, group, options = {}) {
7224
7226
  if (!node || !inst) return fail(nodes, "not-found", "Select an instance or a layer inside one.");
7225
7227
  const top = inst === id && enclosingInstanceIn(g, id) === void 0;
7226
7228
  const updates = /* @__PURE__ */ new Map();
7227
- const resetProps = (n2) => {
7228
- const data = getInstanceData(n2);
7229
+ const resetProps = (n3) => {
7230
+ const data = getInstanceData(n3);
7229
7231
  const defaults = effectivePropsIn(g, data.componentId, void 0);
7230
- return same(_nullishCoalesce(data.properties, () => ( {})), defaults) ? n2 : withData(n2, { ...dataOf(n2), [INSTANCE_DATA_KEY]: { ...data, properties: defaults } });
7232
+ return same(_nullishCoalesce(data.properties, () => ( {})), defaults) ? n3 : withData(n3, { ...dataOf(n3), [INSTANCE_DATA_KEY]: { ...data, properties: defaults } });
7231
7233
  };
7232
7234
  if (group !== void 0) {
7233
7235
  let next = setOverrides(node, getNodeOverrides(node).filter((gr) => gr !== group));
@@ -7235,14 +7237,14 @@ function resetCanvasInstanceOverrides(nodes, id, group, options = {}) {
7235
7237
  updates.set(id, next);
7236
7238
  } else if (inst === id) {
7237
7239
  for (const d of g.subtree(id)) {
7238
- const n2 = g.get(d);
7239
- const keep = d === id && top ? getNodeOverrides(n2).filter((gr) => gr === "size") : [];
7240
- updates.set(d, setOverrides(n2, keep));
7240
+ const n3 = g.get(d);
7241
+ const keep = d === id && top ? getNodeOverrides(n3).filter((gr) => gr === "size") : [];
7242
+ updates.set(d, setOverrides(n3, keep));
7241
7243
  }
7242
7244
  if (top) updates.set(id, resetProps(updates.get(id)));
7243
7245
  } else updates.set(id, setOverrides(node, []));
7244
- const after = nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
7245
- const changed = after.some((n2, i) => n2 !== nodes[i]);
7246
+ const after = nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
7247
+ const changed = after.some((n3, i) => n3 !== nodes[i]);
7246
7248
  if (!changed) return { ok: true, nodes, ids: [] };
7247
7249
  const synced = syncCanvasComponents(nodes, after, options);
7248
7250
  return { ok: true, nodes: synced, ids: [inst] };
@@ -7256,21 +7258,21 @@ function pushCanvasInstanceOverrides(nodes, id, options = {}) {
7256
7258
  const updates = /* @__PURE__ */ new Map();
7257
7259
  let pushed = 0;
7258
7260
  for (const d of g.subtree(inst)) {
7259
- const n2 = g.get(d);
7260
- const overrides = getNodeOverrides(n2);
7261
+ const n3 = g.get(d);
7262
+ const overrides = getNodeOverrides(n3);
7261
7263
  if (overrides.length === 0) continue;
7262
- const src = d === inst ? compId : getComponentSourceId(n2);
7264
+ const src = d === inst ? compId : getComponentSourceId(n3);
7263
7265
  if (!src || !g.get(src) || src !== compId && !g.isAncestor(compId, src)) continue;
7264
7266
  const groups = overrides.filter(
7265
7267
  (gr) => gr !== "size" && gr !== "position" && gr !== "component" && gr !== "props" && !(d === inst && (gr === "data.label" || gr === "data.name" || isOwnRootGroup(gr)))
7266
7268
  );
7267
7269
  if (groups.length === 0) continue;
7268
7270
  pushed++;
7269
- updates.set(src, copyGroups(n2, _nullishCoalesce(updates.get(src), () => ( g.get(src))), groups));
7270
- updates.set(d, setOverrides(n2, overrides.filter((gr) => !groups.includes(gr))));
7271
+ updates.set(src, copyGroups(n3, _nullishCoalesce(updates.get(src), () => ( g.get(src))), groups));
7272
+ updates.set(d, setOverrides(n3, overrides.filter((gr) => !groups.includes(gr))));
7271
7273
  }
7272
7274
  if (pushed === 0) return fail(nodes, "no-overrides", "The instance has no changes to push.");
7273
- const after = nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
7275
+ const after = nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
7274
7276
  return done(nodes, after, [inst], options);
7275
7277
  }
7276
7278
  function swapCanvasInstance(nodes, ids, componentId, options = {}) {
@@ -7280,14 +7282,14 @@ function swapCanvasInstance(nodes, ids, componentId, options = {}) {
7280
7282
  const updates = /* @__PURE__ */ new Map();
7281
7283
  const list = [...new Set(ids)];
7282
7284
  for (const id of list) {
7283
- const n2 = g.get(id);
7284
- const inst = getInstanceData(n2);
7285
- if (!n2 || !inst) return fail(nodes, "invalid", `"${id}" is not an instance.`);
7286
- if (g.isAncestor(main, id) || createsCycleIn(g, main, n2.parentId)) return fail(nodes, "cycle", "An instance can't show the component it is inside.");
7285
+ const n3 = g.get(id);
7286
+ const inst = getInstanceData(n3);
7287
+ if (!n3 || !inst) return fail(nodes, "invalid", `"${id}" is not an instance.`);
7288
+ if (g.isAncestor(main, id) || createsCycleIn(g, main, n3.parentId)) return fail(nodes, "cycle", "An instance can't show the component it is inside.");
7287
7289
  const defaults = effectivePropsIn(g, main, void 0);
7288
7290
  const properties = {};
7289
7291
  for (const [k, d] of Object.entries(defaults)) properties[k] = _optionalChain([inst, 'access', _280 => _280.properties, 'optionalAccess', _281 => _281[k]]) !== void 0 && typeof inst.properties[k] === typeof d ? inst.properties[k] : d;
7290
- updates.set(id, withData(n2, { ...dataOf(n2), [INSTANCE_DATA_KEY]: { ...inst, componentId: main, properties } }));
7292
+ updates.set(id, withData(n3, { ...dataOf(n3), [INSTANCE_DATA_KEY]: { ...inst, componentId: main, properties } }));
7291
7293
  if (options.keepTextOverridesOnly) {
7292
7294
  for (const d of g.subtree(id)) {
7293
7295
  const layer = _nullishCoalesce(updates.get(d), () => ( g.get(d)));
@@ -7298,7 +7300,7 @@ function swapCanvasInstance(nodes, ids, componentId, options = {}) {
7298
7300
  }
7299
7301
  }
7300
7302
  if (list.length === 0) return fail(nodes, "invalid", "Select an instance.");
7301
- const after = nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
7303
+ const after = nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
7302
7304
  return done(nodes, after, list, options);
7303
7305
  }
7304
7306
  function setCanvasInstanceProperties(nodes, ids, properties, options = {}) {
@@ -7307,9 +7309,9 @@ function setCanvasInstanceProperties(nodes, ids, properties, options = {}) {
7307
7309
  const list = [...new Set(ids)];
7308
7310
  if (list.length === 0) return fail(nodes, "invalid", "Select an instance.");
7309
7311
  for (const id of list) {
7310
- const n2 = g.get(id);
7311
- const inst = getInstanceData(n2);
7312
- if (!n2 || !inst) return fail(nodes, "invalid", `"${id}" is not an instance.`);
7312
+ const n3 = g.get(id);
7313
+ const inst = getInstanceData(n3);
7314
+ if (!n3 || !inst) return fail(nodes, "invalid", `"${id}" is not an instance.`);
7313
7315
  const set = variantSetIn(g, inst.componentId);
7314
7316
  const options_ = set ? variantOptionsIn(g, set.id) : [];
7315
7317
  const wanted = { ...getVariantValues(g.get(inst.componentId)) };
@@ -7342,16 +7344,16 @@ function setCanvasInstanceProperties(nodes, ids, properties, options = {}) {
7342
7344
  } else {
7343
7345
  const main = typeof v === "string" ? mainOfIn(g, v) : void 0;
7344
7346
  if (!main) return fail(nodes, "type-mismatch", `"${k}" takes a component id.`);
7345
- if (main === target || componentDepsIn(g, main).has(target) || createsCycleIn(g, main, n2.parentId)) {
7347
+ if (main === target || componentDepsIn(g, main).has(target) || createsCycleIn(g, main, n3.parentId)) {
7346
7348
  return fail(nodes, "cycle", `"${k}" can't show a component that contains this one.`);
7347
7349
  }
7348
7350
  values[k] = main;
7349
7351
  }
7350
7352
  }
7351
7353
  const properties2 = effectivePropsIn(g, target, values);
7352
- updates.set(id, withData(n2, { ...dataOf(n2), [INSTANCE_DATA_KEY]: { ...inst, componentId: target, properties: properties2 } }));
7354
+ updates.set(id, withData(n3, { ...dataOf(n3), [INSTANCE_DATA_KEY]: { ...inst, componentId: target, properties: properties2 } }));
7353
7355
  }
7354
- const after = nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
7356
+ const after = nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
7355
7357
  return done(nodes, after, list, options);
7356
7358
  }
7357
7359
  function setCanvasComponentProperty(nodes, componentId, name, def, options = {}) {
@@ -7387,8 +7389,8 @@ function setCanvasComponentProperty(nodes, componentId, name, def, options = {})
7387
7389
  if (renamed !== name) {
7388
7390
  for (const c of comps) {
7389
7391
  for (const d of g.subtree(c)) {
7390
- const n2 = _nullishCoalesce(updates.get(d), () => ( g.get(d)));
7391
- const refs = { ...getComponentPropertyRefs(n2) };
7392
+ const n3 = _nullishCoalesce(updates.get(d), () => ( g.get(d)));
7393
+ const refs = { ...getComponentPropertyRefs(n3) };
7392
7394
  let touched = false;
7393
7395
  for (const [field, prop] of Object.entries(refs)) {
7394
7396
  if (prop !== name) continue;
@@ -7397,23 +7399,23 @@ function setCanvasComponentProperty(nodes, componentId, name, def, options = {})
7397
7399
  else refs[field] = renamed;
7398
7400
  }
7399
7401
  if (!touched) continue;
7400
- const data = { ...dataOf(n2), [COMPONENT_PROPERTY_REFS_DATA_KEY]: refs };
7402
+ const data = { ...dataOf(n3), [COMPONENT_PROPERTY_REFS_DATA_KEY]: refs };
7401
7403
  if (Object.keys(refs).length === 0) delete data[COMPONENT_PROPERTY_REFS_DATA_KEY];
7402
- updates.set(d, withData(n2, data));
7404
+ updates.set(d, withData(n3, data));
7403
7405
  }
7404
7406
  }
7405
- for (const n2 of nodes) {
7406
- const inst = getInstanceData(n2);
7407
+ for (const n3 of nodes) {
7408
+ const inst = getInstanceData(n3);
7407
7409
  if (!inst || !comps.includes(inst.componentId) || !inst.properties || !(name in inst.properties)) continue;
7408
7410
  const props = { ...inst.properties };
7409
7411
  const v = props[name];
7410
7412
  delete props[name];
7411
7413
  if (renamed !== null) props[renamed] = v;
7412
- const cur = _nullishCoalesce(updates.get(n2.id), () => ( n2));
7413
- updates.set(n2.id, withData(cur, { ...dataOf(cur), [INSTANCE_DATA_KEY]: { ...inst, properties: props } }));
7414
+ const cur = _nullishCoalesce(updates.get(n3.id), () => ( n3));
7415
+ updates.set(n3.id, withData(cur, { ...dataOf(cur), [INSTANCE_DATA_KEY]: { ...inst, properties: props } }));
7414
7416
  }
7415
7417
  }
7416
- const after = nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2)));
7418
+ const after = nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3)));
7417
7419
  return done(nodes, after, [owner.id], options);
7418
7420
  }
7419
7421
  function bindCanvasComponentProperty(nodes, layerId, field, name, options = {}) {
@@ -7435,7 +7437,7 @@ function bindCanvasComponentProperty(nodes, layerId, field, name, options = {})
7435
7437
  const data = { ...dataOf(layer) };
7436
7438
  if (Object.keys(refs).length) data[COMPONENT_PROPERTY_REFS_DATA_KEY] = refs;
7437
7439
  else delete data[COMPONENT_PROPERTY_REFS_DATA_KEY];
7438
- const after = nodes.map((n2) => n2.id === layerId ? withData(n2, data) : n2);
7440
+ const after = nodes.map((n3) => n3.id === layerId ? withData(n3, data) : n3);
7439
7441
  return done(nodes, after, [layerId], options);
7440
7442
  }
7441
7443
  function restoreCanvasMainComponent(nodes, id, options = {}) {
@@ -7447,7 +7449,7 @@ function restoreCanvasMainComponent(nodes, id, options = {}) {
7447
7449
  const compId = inst.componentId;
7448
7450
  const sub = g.subtree(id);
7449
7451
  const map = /* @__PURE__ */ new Map([[id, compId]]);
7450
- const taken = new Set(nodes.map((n2) => n2.id));
7452
+ const taken = new Set(nodes.map((n3) => n3.id));
7451
7453
  taken.add(compId);
7452
7454
  for (const d of sub) {
7453
7455
  if (d === id) continue;
@@ -7460,10 +7462,10 @@ function restoreCanvasMainComponent(nodes, id, options = {}) {
7460
7462
  const nested = [];
7461
7463
  const replaced = /* @__PURE__ */ new Map();
7462
7464
  for (const d of sub) {
7463
- let n2 = g.get(d);
7465
+ let n3 = g.get(d);
7464
7466
  const nid = _nullishCoalesce(map.get(d), () => ( d));
7465
- const parentId = n2.parentId !== void 0 ? _nullishCoalesce(map.get(n2.parentId), () => ( n2.parentId)) : void 0;
7466
- n2 = { ...n2, id: nid, ...parentId !== void 0 ? { parentId } : {} };
7467
+ const parentId = n3.parentId !== void 0 ? _nullishCoalesce(map.get(n3.parentId), () => ( n3.parentId)) : void 0;
7468
+ n3 = { ...n3, id: nid, ...parentId !== void 0 ? { parentId } : {} };
7467
7469
  if (d === id) {
7468
7470
  const defs = {};
7469
7471
  for (const [k, v] of Object.entries(_nullishCoalesce(inst.properties, () => ( {})))) {
@@ -7471,19 +7473,19 @@ function restoreCanvasMainComponent(nodes, id, options = {}) {
7471
7473
  else if (typeof v === "string" && isCanvasComponent(g.get(v))) defs[k] = { type: "instanceSwap", default: v };
7472
7474
  else if (typeof v === "string") defs[k] = { type: "text", default: v };
7473
7475
  }
7474
- const data = { ...dataOf(n2) };
7476
+ const data = { ...dataOf(n3) };
7475
7477
  delete data[INSTANCE_DATA_KEY];
7476
7478
  delete data[COMPONENT_SOURCE_DATA_KEY];
7477
7479
  delete data[COMPONENT_OVERRIDES_DATA_KEY];
7478
7480
  data[COMPONENT_DATA_KEY] = Object.keys(defs).length ? { properties: defs } : {};
7479
- n2 = withData(n2, data);
7481
+ n3 = withData(n3, data);
7480
7482
  } else if (enclosingInstanceIn(g, d) === id) {
7481
- if (isCanvasInstance(n2)) nested.push(nid);
7482
- else n2 = unlinked(n2);
7483
+ if (isCanvasInstance(n3)) nested.push(nid);
7484
+ else n3 = unlinked(n3);
7483
7485
  }
7484
- replaced.set(d, n2);
7486
+ replaced.set(d, n3);
7485
7487
  }
7486
- let after = nodes.map((n2) => _nullishCoalesce(replaced.get(n2.id), () => ( n2)));
7488
+ let after = nodes.map((n3) => _nullishCoalesce(replaced.get(n3.id), () => ( n3)));
7487
7489
  for (const nn of nested) after = rebaseInstance(after, nn, options.tokens);
7488
7490
  return done(nodes, after, [compId], options);
7489
7491
  }
@@ -7591,7 +7593,7 @@ function getNextVariantValues(nodes, setId, from) {
7591
7593
  return nextVariantValuesIn(g, setId, _nullishCoalesce(from, () => ( defaultVariantIn(g, setId))));
7592
7594
  }
7593
7595
  function relayoutSet(nodes, setId, options) {
7594
- if (options.layout === false || !getAutoLayout(nodes.find((n2) => n2.id === setId))) return nodes;
7596
+ if (options.layout === false || !getAutoLayout(nodes.find((n3) => n3.id === setId))) return nodes;
7595
7597
  return applyNodeUpdates(nodes, layoutUpMany(nodes, [setId], typeof options.layout === "object" ? options.layout : {}));
7596
7598
  }
7597
7599
  function addCanvasVariant(nodes, setId, options = {}) {
@@ -7635,23 +7637,23 @@ function addCanvasVariant(nodes, setId, options = {}) {
7635
7637
  }
7636
7638
  const order = variantOrder([...edit.variants.map((v) => v.id), id], edit.values);
7637
7639
  const subSet = new Set(sub);
7638
- const copies = nodes.filter((n2) => subSet.has(n2.id)).map((n2) => {
7639
- const next = { ...n2, id: map.get(n2.id) };
7640
- if (n2.parentId !== void 0 && n2.id !== fromId) next.parentId = _nullishCoalesce(map.get(n2.parentId), () => ( n2.parentId));
7640
+ const copies = nodes.filter((n3) => subSet.has(n3.id)).map((n3) => {
7641
+ const next = { ...n3, id: map.get(n3.id) };
7642
+ if (n3.parentId !== void 0 && n3.id !== fromId) next.parentId = _nullishCoalesce(map.get(n3.parentId), () => ( n3.parentId));
7641
7643
  for (const k of RUNTIME_KEYS) delete next[k];
7642
- if (n2.id !== fromId) return next;
7644
+ if (n3.id !== fromId) return next;
7643
7645
  next.position = position;
7644
7646
  return withVariantValues(next, edit.values.get(id), order);
7645
7647
  });
7646
7648
  const updates = writeVariantEdit(edit, [id]);
7647
7649
  const inSet = new Set(g.subtree(setId));
7648
7650
  let last = -1;
7649
- nodes.forEach((n2, i) => {
7650
- if (inSet.has(n2.id)) last = i;
7651
+ nodes.forEach((n3, i) => {
7652
+ if (inSet.has(n3.id)) last = i;
7651
7653
  });
7652
7654
  let after = [];
7653
- nodes.forEach((n2, i) => {
7654
- after.push(_nullishCoalesce(updates.get(n2.id), () => ( n2)));
7655
+ nodes.forEach((n3, i) => {
7656
+ after.push(_nullishCoalesce(updates.get(n3.id), () => ( n3)));
7655
7657
  if (i === last) after.push(...copies);
7656
7658
  });
7657
7659
  if (autoLayout && !options.position) after = relayoutSet(after, setId, options);
@@ -7672,10 +7674,10 @@ function removeCanvasVariant(nodes, variantId, options = {}) {
7672
7674
  if (others.length === 0) return fail(nodes, "invalid", "A component set needs at least one variant: delete the set instead.");
7673
7675
  const replacement = closestVariant(others, getVariantValues(g.get(variantId)));
7674
7676
  const swap = (v) => v === variantId ? replacement : v;
7675
- const repointed = nodes.map((n2) => {
7676
- const data = dataOf(n2);
7677
+ const repointed = nodes.map((n3) => {
7678
+ const data = dataOf(n3);
7677
7679
  let next;
7678
- const inst = getInstanceData(n2);
7680
+ const inst = getInstanceData(n3);
7679
7681
  if (inst) {
7680
7682
  const moved = { ...inst, componentId: swap(inst.componentId) };
7681
7683
  if (inst.properties) moved.properties = Object.fromEntries(Object.entries(inst.properties).map(([k, v]) => [k, swap(v)]));
@@ -7690,12 +7692,12 @@ function removeCanvasVariant(nodes, variantId, options = {}) {
7690
7692
  }
7691
7693
  if (!same(defs, owner.properties)) next = { ..._nullishCoalesce(next, () => ( data)), [key]: { ...owner, properties: defs } };
7692
7694
  }
7693
- return next ? withData(n2, next) : n2;
7695
+ return next ? withData(n3, next) : n3;
7694
7696
  });
7695
7697
  const mid = syncCanvasComponents(nodes, repointed, options);
7696
7698
  const gone = new Set(new Graph(mid).subtree(variantId));
7697
7699
  const after = relayoutSet(
7698
- mid.filter((n2) => !gone.has(n2.id)),
7700
+ mid.filter((n3) => !gone.has(n3.id)),
7699
7701
  set.id,
7700
7702
  options
7701
7703
  );
@@ -7716,17 +7718,17 @@ function setCanvasVariantProperties(nodes, variantId, values, options = {}) {
7716
7718
  if (dup) return fail(nodes, "invalid", `A variant with ${dup} exists already.`);
7717
7719
  const updates = writeVariantEdit(edit);
7718
7720
  if (updates.size === 0) return { ok: true, nodes, ids: [variantId] };
7719
- return done(nodes, nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2))), [variantId], options);
7721
+ return done(nodes, nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3))), [variantId], options);
7720
7722
  }
7721
7723
  function updateInstanceValues(g, setId, updates, fn) {
7722
7724
  const ids = new Set(variantsIn(g, setId).map((v) => v.id));
7723
- for (const n2 of g.nodes) {
7724
- const inst = getInstanceData(n2);
7725
+ for (const n3 of g.nodes) {
7726
+ const inst = getInstanceData(n3);
7725
7727
  if (!_optionalChain([inst, 'optionalAccess', _290 => _290.properties]) || !ids.has(inst.componentId)) continue;
7726
7728
  const props = fn({ ...inst.properties });
7727
7729
  if (same(props, inst.properties)) continue;
7728
- const cur = _nullishCoalesce(updates.get(n2.id), () => ( n2));
7729
- updates.set(n2.id, withData(cur, { ...dataOf(cur), [INSTANCE_DATA_KEY]: { ...inst, properties: props } }));
7730
+ const cur = _nullishCoalesce(updates.get(n3.id), () => ( n3));
7731
+ updates.set(n3.id, withData(cur, { ...dataOf(cur), [INSTANCE_DATA_KEY]: { ...inst, properties: props } }));
7730
7732
  }
7731
7733
  }
7732
7734
  function renameCanvasVariantProperty(nodes, setId, name, newName, options = {}) {
@@ -7745,7 +7747,7 @@ function renameCanvasVariantProperty(nodes, setId, name, newName, options = {})
7745
7747
  for (const [id, v] of edit.values) edit.values.set(id, rename(v));
7746
7748
  const updates = writeVariantEdit(edit);
7747
7749
  updateInstanceValues(g, setId, updates, (props) => name in props ? rename(props) : props);
7748
- return done(nodes, nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2))), [setId], options);
7750
+ return done(nodes, nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3))), [setId], options);
7749
7751
  }
7750
7752
  function renameCanvasVariantValue(nodes, setId, property, value, newValue, options = {}) {
7751
7753
  const g = new Graph(nodes);
@@ -7768,34 +7770,34 @@ function renameCanvasVariantValue(nodes, setId, property, value, newValue, optio
7768
7770
  if (dup) return fail(nodes, "invalid", `A variant with ${dup} exists already.`);
7769
7771
  const updates = writeVariantEdit(edit);
7770
7772
  updateInstanceValues(g, setId, updates, (props) => props[property] === value ? { ...props, [property]: to } : props);
7771
- return done(nodes, nodes.map((n2) => _nullishCoalesce(updates.get(n2.id), () => ( n2))), [setId], options);
7773
+ return done(nodes, nodes.map((n3) => _nullishCoalesce(updates.get(n3.id), () => ( n3))), [setId], options);
7772
7774
  }
7773
7775
 
7774
7776
  // src/canvas/componentsController.ts
7775
7777
  function makePatch(from, to) {
7776
- const fromIds = new Map(from.map((n2) => [n2.id, n2]));
7777
- const toIds = new Set(to.map((n2) => n2.id));
7778
+ const fromIds = new Map(from.map((n3) => [n3.id, n3]));
7779
+ const toIds = new Set(to.map((n3) => n3.id));
7778
7780
  const changes = /* @__PURE__ */ new Map();
7779
- for (const n2 of to) if (fromIds.get(n2.id) !== n2) changes.set(n2.id, n2);
7780
- for (const n2 of from) if (!toIds.has(n2.id)) changes.set(n2.id, null);
7781
- return { changes, order: to.map((n2) => n2.id) };
7781
+ for (const n3 of to) if (fromIds.get(n3.id) !== n3) changes.set(n3.id, n3);
7782
+ for (const n3 of from) if (!toIds.has(n3.id)) changes.set(n3.id, null);
7783
+ return { changes, order: to.map((n3) => n3.id) };
7782
7784
  }
7783
7785
  function applyPatch(current, patch) {
7784
- const byId = new Map(current.map((n2) => [n2.id, n2]));
7785
- for (const [id, n2] of patch.changes) {
7786
- if (n2) byId.set(id, n2);
7786
+ const byId = new Map(current.map((n3) => [n3.id, n3]));
7787
+ for (const [id, n3] of patch.changes) {
7788
+ if (n3) byId.set(id, n3);
7787
7789
  else byId.delete(id);
7788
7790
  }
7789
7791
  const out = [];
7790
7792
  const placed = /* @__PURE__ */ new Set();
7791
7793
  for (const id of patch.order) {
7792
- const n2 = byId.get(id);
7793
- if (n2 && !placed.has(id)) {
7794
- out.push(n2);
7794
+ const n3 = byId.get(id);
7795
+ if (n3 && !placed.has(id)) {
7796
+ out.push(n3);
7795
7797
  placed.add(id);
7796
7798
  }
7797
7799
  }
7798
- for (const n2 of current) if (!placed.has(n2.id) && byId.has(n2.id)) out.push(byId.get(n2.id));
7800
+ for (const n3 of current) if (!placed.has(n3.id) && byId.has(n3.id)) out.push(byId.get(n3.id));
7799
7801
  return out;
7800
7802
  }
7801
7803
  function createCanvasComponentsController(options) {
@@ -7806,7 +7808,7 @@ function createCanvasComponentsController(options) {
7806
7808
  layout: options.layout,
7807
7809
  tokens: options.tokens
7808
7810
  });
7809
- const selection = (ids) => ids ? [...ids] : _nullishCoalesce(_optionalChain([options, 'access', _291 => _291.getSelectedIds, 'optionalCall', _292 => _292()]), () => ( options.getNodes().filter((n2) => n2.selected).map((n2) => n2.id)));
7811
+ const selection = (ids) => ids ? [...ids] : _nullishCoalesce(_optionalChain([options, 'access', _291 => _291.getSelectedIds, 'optionalCall', _292 => _292()]), () => ( options.getNodes().filter((n3) => n3.selected).map((n3) => n3.id)));
7810
7812
  const target = (id) => _nullishCoalesce(id, () => ( selection()[0]));
7811
7813
  function set(next) {
7812
7814
  synced = next;
@@ -7840,7 +7842,7 @@ function createCanvasComponentsController(options) {
7840
7842
  const refused = (why) => ({ ok: false, nodes: nodes(), code: "not-found", reason: why });
7841
7843
  const setOf = (id) => {
7842
7844
  const at = target(id);
7843
- const node = at ? nodes().find((n2) => n2.id === at) : void 0;
7845
+ const node = at ? nodes().find((n3) => n3.id === at) : void 0;
7844
7846
  if (!node) return void 0;
7845
7847
  return isCanvasComponentSet(node) ? node.id : getVariantSet(nodes(), node.id);
7846
7848
  };
@@ -7867,22 +7869,22 @@ function createCanvasComponentsController(options) {
7867
7869
  /** Create Component from `ids` (default: the selection). */
7868
7870
  createComponent(ids, createOptions = {}) {
7869
7871
  const list = selection(ids);
7870
- return run("Create Component", (n2) => createCanvasComponent(n2, list, { ...syncOptions(), ...createOptions }));
7872
+ return run("Create Component", (n3) => createCanvasComponent(n3, list, { ...syncOptions(), ...createOptions }));
7871
7873
  },
7872
7874
  canCreateComponent: (ids) => reason(createCanvasComponent(nodes(), selection(ids), { layout: false })),
7873
7875
  /** Combine as Variants: wraps the selected components in a component set. */
7874
7876
  combineAsVariants(ids, combineOptions = {}) {
7875
7877
  const list = selection(ids);
7876
- return run("Combine as Variants", (n2) => combineCanvasComponentsAsVariants(n2, list, { ...syncOptions(), ...combineOptions }));
7878
+ return run("Combine as Variants", (n3) => combineCanvasComponentsAsVariants(n3, list, { ...syncOptions(), ...combineOptions }));
7877
7879
  },
7878
7880
  canCombineAsVariants: (ids) => reason(combineCanvasComponentsAsVariants(nodes(), selection(ids), { layout: false })),
7879
7881
  /** Create Instance of a component or component set. */
7880
7882
  createInstance(componentId, createOptions = {}) {
7881
- return run("Create Instance", (n2) => createCanvasInstance(n2, componentId, { ...syncOptions(), ...createOptions }));
7883
+ return run("Create Instance", (n3) => createCanvasInstance(n3, componentId, { ...syncOptions(), ...createOptions }));
7882
7884
  },
7883
7885
  canCreateInstance(componentId, parentId) {
7884
7886
  const list = nodes();
7885
- const target2 = componentId ? list.find((n2) => n2.id === componentId) : void 0;
7887
+ const target2 = componentId ? list.find((n3) => n3.id === componentId) : void 0;
7886
7888
  if (!target2 || !isCanvasComponent(target2) && !isCanvasComponentSet(target2)) return "Choose a component or component set.";
7887
7889
  if (wouldCreateComponentCycle(list, componentId, parentId)) return "An instance can't be placed inside its own main component.";
7888
7890
  if (parentId && getOwningInstance(list, parentId)) return "Instances can't gain layers: place it outside the instance.";
@@ -7891,11 +7893,11 @@ function createCanvasComponentsController(options) {
7891
7893
  /** Detach Instance (default: the selected instances). */
7892
7894
  detachInstance(ids) {
7893
7895
  const list = selection(ids);
7894
- return run("Detach Instance", (n2) => detachCanvasInstance(n2, list, syncOptions()));
7896
+ return run("Detach Instance", (n3) => detachCanvasInstance(n3, list, syncOptions()));
7895
7897
  },
7896
7898
  canDetachInstance(ids) {
7897
7899
  const list = nodes();
7898
- const instances = selection(ids).filter((id) => getInstanceData(list.find((n2) => n2.id === id)));
7900
+ const instances = selection(ids).filter((id) => getInstanceData(list.find((n3) => n3.id === id)));
7899
7901
  if (instances.length === 0) return "Select an instance.";
7900
7902
  if (instances.some((id) => isInsideInstance(list, id))) return "A nested instance can't be detached on its own: detach the outer instance first.";
7901
7903
  return true;
@@ -7904,21 +7906,21 @@ function createCanvasComponentsController(options) {
7904
7906
  resetOverrides(id, group) {
7905
7907
  const at = target(id);
7906
7908
  if (!at) return { ok: false, nodes: nodes(), code: "not-found", reason: "Select an instance or a layer inside one." };
7907
- return run(group ? "Reset Override" : "Reset All Changes", (n2) => resetCanvasInstanceOverrides(n2, at, group, syncOptions()));
7909
+ return run(group ? "Reset Override" : "Reset All Changes", (n3) => resetCanvasInstanceOverrides(n3, at, group, syncOptions()));
7908
7910
  },
7909
7911
  canResetOverrides(id) {
7910
7912
  const at = target(id);
7911
7913
  const info = at ? inspectCanvasInstance(nodes(), at) : void 0;
7912
7914
  if (!info) return "Select an instance or a layer inside one.";
7913
7915
  const changedProps = !info.nested && info.properties.some((p) => p.value !== p.default);
7914
- const own = info.id === at ? info.overrides.length > 0 : getNodeOverrides(nodes().find((n2) => n2.id === at)).length > 0;
7916
+ const own = info.id === at ? info.overrides.length > 0 : getNodeOverrides(nodes().find((n3) => n3.id === at)).length > 0;
7915
7917
  return own || info.id === at && changedProps ? true : "No overrides to reset.";
7916
7918
  },
7917
7919
  /** Push the (outermost) instance's overrides to its main component. */
7918
7920
  pushOverrides(id) {
7919
7921
  const at = target(id);
7920
7922
  if (!at) return { ok: false, nodes: nodes(), code: "not-found", reason: "Select an instance." };
7921
- return run("Push Changes to Main Component", (n2) => pushCanvasInstanceOverrides(n2, at, syncOptions()));
7923
+ return run("Push Changes to Main Component", (n3) => pushCanvasInstanceOverrides(n3, at, syncOptions()));
7922
7924
  },
7923
7925
  canPushOverrides(id) {
7924
7926
  const at = target(id);
@@ -7927,17 +7929,17 @@ function createCanvasComponentsController(options) {
7927
7929
  /** Swap the selected instances to another component (or a set's default variant). */
7928
7930
  swapInstance(componentId, ids, swapOptions = {}) {
7929
7931
  const list = selection(ids);
7930
- return run("Swap Instance", (n2) => swapCanvasInstance(n2, list, componentId, { ...syncOptions(), ...swapOptions }));
7932
+ return run("Swap Instance", (n3) => swapCanvasInstance(n3, list, componentId, { ...syncOptions(), ...swapOptions }));
7931
7933
  },
7932
7934
  canSwapInstance(componentId, ids) {
7933
7935
  const list = nodes();
7934
- const instances = selection(ids).filter((id) => getInstanceData(list.find((n2) => n2.id === id)));
7936
+ const instances = selection(ids).filter((id) => getInstanceData(list.find((n3) => n3.id === id)));
7935
7937
  if (instances.length === 0) return "Select an instance.";
7936
7938
  if (componentId === void 0) return true;
7937
- const main = list.find((n2) => n2.id === componentId);
7939
+ const main = list.find((n3) => n3.id === componentId);
7938
7940
  if (!main || !isCanvasComponent(main) && !isCanvasComponentSet(main)) return "Choose a component or component set.";
7939
7941
  for (const id of instances) {
7940
- const node = list.find((n2) => n2.id === id);
7942
+ const node = list.find((n3) => n3.id === id);
7941
7943
  if (wouldCreateComponentCycle(list, componentId, node.parentId)) return "An instance can't show the component it is inside.";
7942
7944
  }
7943
7945
  return true;
@@ -7945,18 +7947,18 @@ function createCanvasComponentsController(options) {
7945
7947
  /** Set variant / component property values on the selected instances (one step). */
7946
7948
  setInstanceProperties(properties, ids) {
7947
7949
  const list = selection(ids);
7948
- return run("Set Instance Properties", (n2) => setCanvasInstanceProperties(n2, list, properties, syncOptions()));
7950
+ return run("Set Instance Properties", (n3) => setCanvasInstanceProperties(n3, list, properties, syncOptions()));
7949
7951
  },
7950
7952
  canSetInstanceProperties(ids) {
7951
7953
  const list = nodes();
7952
7954
  const sel = selection(ids);
7953
- return sel.length > 0 && sel.every((id) => getInstanceData(list.find((n2) => n2.id === id))) ? true : "Select instances.";
7955
+ return sel.length > 0 && sel.every((id) => getInstanceData(list.find((n3) => n3.id === id))) ? true : "Select instances.";
7954
7956
  },
7955
7957
  /** Restore Main Component from an instance whose main was deleted. */
7956
7958
  restoreMainComponent(id) {
7957
7959
  const at = target(id);
7958
7960
  if (!at) return { ok: false, nodes: nodes(), code: "not-found", reason: "Select an instance." };
7959
- return run("Restore Main Component", (n2) => restoreCanvasMainComponent(n2, at, syncOptions()));
7961
+ return run("Restore Main Component", (n3) => restoreCanvasMainComponent(n3, at, syncOptions()));
7960
7962
  },
7961
7963
  canRestoreMainComponent(id) {
7962
7964
  const at = target(id);
@@ -7966,7 +7968,7 @@ function createCanvasComponentsController(options) {
7966
7968
  setComponentProperty(componentId, name, def, propertyOptions = {}) {
7967
7969
  return run(
7968
7970
  def ? "Edit Component Property" : "Delete Component Property",
7969
- (n2) => setCanvasComponentProperty(n2, componentId, name, def, { ...syncOptions(), ...propertyOptions })
7971
+ (n3) => setCanvasComponentProperty(n3, componentId, name, def, { ...syncOptions(), ...propertyOptions })
7970
7972
  );
7971
7973
  },
7972
7974
  /**
@@ -7977,7 +7979,7 @@ function createCanvasComponentsController(options) {
7977
7979
  const set2 = setOf(setId);
7978
7980
  if (!set2) return refused(NO_SET);
7979
7981
  const opts = addOptions(setId, variantOptions);
7980
- return run("Add Variant", (n2) => addCanvasVariant(n2, set2, { ...syncOptions(), ...opts }));
7982
+ return run("Add Variant", (n3) => addCanvasVariant(n3, set2, { ...syncOptions(), ...opts }));
7981
7983
  },
7982
7984
  canAddVariant(setId, variantOptions = {}) {
7983
7985
  const set2 = setOf(setId);
@@ -7987,7 +7989,7 @@ function createCanvasComponentsController(options) {
7987
7989
  removeVariant(variantId) {
7988
7990
  const v = variantOf(variantId);
7989
7991
  if (!v) return refused(NO_VARIANT);
7990
- return run("Remove Variant", (n2) => removeCanvasVariant(n2, v, syncOptions()));
7992
+ return run("Remove Variant", (n3) => removeCanvasVariant(n3, v, syncOptions()));
7991
7993
  },
7992
7994
  canRemoveVariant(variantId) {
7993
7995
  const v = variantOf(variantId);
@@ -7997,7 +7999,7 @@ function createCanvasComponentsController(options) {
7997
7999
  setVariantProperties(values, variantId, variantOptions = {}) {
7998
8000
  const v = variantOf(variantId);
7999
8001
  if (!v) return refused(NO_VARIANT);
8000
- return run("Edit Variant", (n2) => setCanvasVariantProperties(n2, v, values, { ...syncOptions(), ...variantOptions }));
8002
+ return run("Edit Variant", (n3) => setCanvasVariantProperties(n3, v, values, { ...syncOptions(), ...variantOptions }));
8001
8003
  },
8002
8004
  canSetVariantProperties(values, variantId) {
8003
8005
  const v = variantOf(variantId);
@@ -8008,7 +8010,7 @@ function createCanvasComponentsController(options) {
8008
8010
  renameVariantProperty(name, newName, setId) {
8009
8011
  const set2 = setOf(setId);
8010
8012
  if (!set2) return refused(NO_SET);
8011
- return run("Rename Variant Property", (n2) => renameCanvasVariantProperty(n2, set2, name, newName, syncOptions()));
8013
+ return run("Rename Variant Property", (n3) => renameCanvasVariantProperty(n3, set2, name, newName, syncOptions()));
8012
8014
  },
8013
8015
  canRenameVariantProperty(name, newName, setId) {
8014
8016
  const set2 = setOf(setId);
@@ -8019,7 +8021,7 @@ function createCanvasComponentsController(options) {
8019
8021
  renameVariantValue(property, value, newValue, setId) {
8020
8022
  const set2 = setOf(setId);
8021
8023
  if (!set2) return refused(NO_SET);
8022
- return run("Rename Variant Value", (n2) => renameCanvasVariantValue(n2, set2, property, value, newValue, syncOptions()));
8024
+ return run("Rename Variant Value", (n3) => renameCanvasVariantValue(n3, set2, property, value, newValue, syncOptions()));
8023
8025
  },
8024
8026
  canRenameVariantValue(property, value, newValue, setId) {
8025
8027
  const set2 = setOf(setId);
@@ -8028,19 +8030,19 @@ function createCanvasComponentsController(options) {
8028
8030
  },
8029
8031
  /** Binds (or with `null` unbinds) a main layer's field to a component property. */
8030
8032
  bindComponentProperty(layerId, field, name) {
8031
- return run("Bind Component Property", (n2) => bindCanvasComponentProperty(n2, layerId, field, name, syncOptions()));
8033
+ return run("Bind Component Property", (n3) => bindCanvasComponentProperty(n3, layerId, field, name, syncOptions()));
8032
8034
  },
8033
8035
  /** Selects the main component of an instance (or of the instance a layer is in). */
8034
8036
  goToMainComponent(id) {
8035
8037
  const at = target(id);
8036
8038
  const list = sync();
8037
8039
  const inst = at ? getOwningInstance(list, at) : void 0;
8038
- const main = inst ? _optionalChain([getInstanceData, 'call', _293 => _293(list.find((n2) => n2.id === inst)), 'optionalAccess', _294 => _294.componentId]) : void 0;
8039
- const node = main ? list.find((n2) => n2.id === main) : void 0;
8040
+ const main = inst ? _optionalChain([getInstanceData, 'call', _293 => _293(list.find((n3) => n3.id === inst)), 'optionalAccess', _294 => _294.componentId]) : void 0;
8041
+ const node = main ? list.find((n3) => n3.id === main) : void 0;
8040
8042
  if (!node) return void 0;
8041
- const next = list.map((n2) => !!n2.selected === (n2.id === main) ? n2 : { ...n2, selected: n2.id === main });
8043
+ const next = list.map((n3) => !!n3.selected === (n3.id === main) ? n3 : { ...n3, selected: n3.id === main });
8042
8044
  set(next);
8043
- _optionalChain([options, 'access', _295 => _295.onReveal, 'optionalCall', _296 => _296(next.find((n2) => n2.id === main))]);
8045
+ _optionalChain([options, 'access', _295 => _295.onReveal, 'optionalCall', _296 => _296(next.find((n3) => n3.id === main))]);
8044
8046
  return main;
8045
8047
  },
8046
8048
  canGoToMainComponent(id) {
@@ -8048,8 +8050,8 @@ function createCanvasComponentsController(options) {
8048
8050
  const list = nodes();
8049
8051
  const inst = at ? getOwningInstance(list, at) : void 0;
8050
8052
  if (!inst) return "Select an instance.";
8051
- const main = getInstanceData(list.find((n2) => n2.id === inst)).componentId;
8052
- return list.some((n2) => n2.id === main) ? true : "The main component was deleted.";
8053
+ const main = getInstanceData(list.find((n3) => n3.id === inst)).componentId;
8054
+ return list.some((n3) => n3.id === main) ? true : "The main component was deleted.";
8053
8055
  },
8054
8056
  /** Components and component sets, for a components panel. */
8055
8057
  list: () => listCanvasComponents(nodes()),
@@ -8135,7 +8137,7 @@ function strokePointsToPathData(points, options = {}) {
8135
8137
  const [p0, p1] = points;
8136
8138
  return `M ${p0[0]} ${p0[1]} L ${p1[0]} ${p1[1]}`;
8137
8139
  }
8138
- const fitted = _chunkYNSK4MGTcjs.fitFreehandPath.call(void 0, points, options);
8140
+ const fitted = _chunkO2UH7LZEcjs.fitFreehandPath.call(void 0, points, options);
8139
8141
  return fitted.length > 0 ? fitted : `M ${points[0][0]} ${points[0][1]}`;
8140
8142
  }
8141
8143
  function strokeToShapeNode(stroke, options = {}) {
@@ -8193,7 +8195,7 @@ function findStrokesAtPoint(point, nodes, radius = 12) {
8193
8195
  }
8194
8196
  const localPoint = [point[0] - rect2.x, point[1] - rect2.y];
8195
8197
  try {
8196
- const dist = _chunkYNSK4MGTcjs.distanceToBezierPath.call(void 0, shape.d, localPoint);
8198
+ const dist = _chunkO2UH7LZEcjs.distanceToBezierPath.call(void 0, shape.d, localPoint);
8197
8199
  if (dist <= effectiveRadius) {
8198
8200
  matches2.push(node);
8199
8201
  }
@@ -8272,7 +8274,7 @@ function createCanvasDrawController(options) {
8272
8274
  options.history.execute({
8273
8275
  name: "Erase strokes",
8274
8276
  execute: () => {
8275
- const remaining = options.getNodes().filter((n2) => !erasedIds.has(n2.id));
8277
+ const remaining = options.getNodes().filter((n3) => !erasedIds.has(n3.id));
8276
8278
  options.setNodes(remaining);
8277
8279
  },
8278
8280
  undo: () => {
@@ -8304,7 +8306,7 @@ function createCanvasDrawController(options) {
8304
8306
  options.setNodes([...options.getNodes(), node]);
8305
8307
  },
8306
8308
  undo: () => {
8307
- options.setNodes(options.getNodes().filter((n2) => n2.id !== node.id));
8309
+ options.setNodes(options.getNodes().filter((n3) => n3.id !== node.id));
8308
8310
  }
8309
8311
  });
8310
8312
  } else {
@@ -8336,15 +8338,15 @@ function createCanvasDrawController(options) {
8336
8338
  const newlyErased = [];
8337
8339
  for (const candidate of candidates) {
8338
8340
  if (erasedInDrag.has(candidate.id) || isLocked(candidate)) continue;
8339
- const index = nodes.findIndex((n2) => n2.id === candidate.id);
8341
+ const index = nodes.findIndex((n3) => n3.id === candidate.id);
8340
8342
  if (index !== -1) {
8341
8343
  erasedInDrag.set(candidate.id, { node: candidate, index });
8342
8344
  newlyErased.push(candidate);
8343
8345
  }
8344
8346
  }
8345
8347
  if (newlyErased.length > 0) {
8346
- const erasedSet = new Set(newlyErased.map((n2) => n2.id));
8347
- const nextNodes = nodes.filter((n2) => !erasedSet.has(n2.id));
8348
+ const erasedSet = new Set(newlyErased.map((n3) => n3.id));
8349
+ const nextNodes = nodes.filter((n3) => !erasedSet.has(n3.id));
8348
8350
  options.setNodes(nextNodes);
8349
8351
  _optionalChain([options, 'access', _317 => _317.onNodesErase, 'optionalCall', _318 => _318(newlyErased)]);
8350
8352
  }
@@ -8478,9 +8480,9 @@ function autoLayoutDiagram(graph, options = {}) {
8478
8480
  const pad = _nullishCoalesce(options.groupPadding, () => ( 24));
8479
8481
  const titleH = _nullishCoalesce(options.groupTitleHeight, () => ( 32));
8480
8482
  const childrenOf = /* @__PURE__ */ new Map();
8481
- for (const n2 of graph.nodes) push(childrenOf, n2.parentId, { id: n2.id, isGroup: false });
8483
+ for (const n3 of graph.nodes) push(childrenOf, n3.parentId, { id: n3.id, isGroup: false });
8482
8484
  for (const g of graph.groups) push(childrenOf, g.parentId, { id: g.id, isGroup: true });
8483
- const nodeById = new Map(graph.nodes.map((n2) => [n2.id, n2]));
8485
+ const nodeById = new Map(graph.nodes.map((n3) => [n3.id, n3]));
8484
8486
  const groupById = new Map(graph.groups.map((g) => [g.id, g]));
8485
8487
  const sizes = {};
8486
8488
  const relative = {};
@@ -8529,11 +8531,11 @@ function autoLayoutDiagram(graph, options = {}) {
8529
8531
  let maxX = -Infinity;
8530
8532
  let maxY = -Infinity;
8531
8533
  for (const c of children) {
8532
- const n2 = g.node(c.id);
8534
+ const n3 = g.node(c.id);
8533
8535
  const w = sizes[c.id].width;
8534
8536
  const h = sizes[c.id].height;
8535
- const x = n2.x - w / 2;
8536
- const y = n2.y - h / 2;
8537
+ const x = n3.x - w / 2;
8538
+ const y = n3.y - h / 2;
8537
8539
  relative[c.id] = [x, y];
8538
8540
  minX = Math.min(minX, x);
8539
8541
  minY = Math.min(minY, y);
@@ -8560,7 +8562,7 @@ function autoLayoutDiagram(graph, options = {}) {
8560
8562
  }
8561
8563
  return positions[id];
8562
8564
  };
8563
- for (const n2 of graph.nodes) absolute(n2.id);
8565
+ for (const n3 of graph.nodes) absolute(n3.id);
8564
8566
  for (const g of graph.groups) absolute(g.id);
8565
8567
  return { positions, sizes };
8566
8568
  }
@@ -8572,11 +8574,11 @@ function push(map, key, value) {
8572
8574
  function ensureDiagramLayout(graph, meta, options) {
8573
8575
  const measure = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _335 => _335.measure]), () => ( estimateDiagramNodeSize));
8574
8576
  const stored = _nullishCoalesce(meta.layout, () => ( {}));
8575
- const allIds = [...graph.nodes.map((n2) => n2.id), ...graph.groups.map((g) => g.id)];
8577
+ const allIds = [...graph.nodes.map((n3) => n3.id), ...graph.groups.map((g) => g.id)];
8576
8578
  const missing = allIds.filter((id) => !stored[id]);
8577
8579
  const sizes = {};
8578
- for (const n2 of graph.nodes)
8579
- sizes[n2.id] = _optionalChain([meta, 'access', _336 => _336.sizes, 'optionalAccess', _337 => _337[n2.id]]) ? { width: meta.sizes[n2.id][0], height: meta.sizes[n2.id][1] } : measure(n2);
8580
+ for (const n3 of graph.nodes)
8581
+ sizes[n3.id] = _optionalChain([meta, 'access', _336 => _336.sizes, 'optionalAccess', _337 => _337[n3.id]]) ? { width: meta.sizes[n3.id][0], height: meta.sizes[n3.id][1] } : measure(n3);
8580
8582
  if (!missing.length) {
8581
8583
  const positions2 = {};
8582
8584
  for (const id of allIds) positions2[id] = stored[id];
@@ -8607,7 +8609,7 @@ function diagramGroupSize(groupId, graph, positions, sizes, meta, pad = 24, titl
8607
8609
  if (_optionalChain([meta, 'access', _338 => _338.sizes, 'optionalAccess', _339 => _339[groupId]]))
8608
8610
  return { width: meta.sizes[groupId][0], height: meta.sizes[groupId][1] };
8609
8611
  const members = [
8610
- ...graph.nodes.filter((n2) => n2.parentId === groupId).map((n2) => n2.id),
8612
+ ...graph.nodes.filter((n3) => n3.parentId === groupId).map((n3) => n3.id),
8611
8613
  ...graph.groups.filter((g) => g.parentId === groupId).map((g) => g.id)
8612
8614
  ];
8613
8615
  if (!members.length) return { width: 200, height: 100 };
@@ -8657,7 +8659,7 @@ function mermaidFlowNodes(graph, layout2, options = {}) {
8657
8659
  const positions = { ...layout2.positions, ..._nullishCoalesce(options.positions, () => ( {})) };
8658
8660
  const sizes = { ...layout2.sizes, ..._nullishCoalesce(options.sizes, () => ( {})) };
8659
8661
  const parents = /* @__PURE__ */ new Map();
8660
- for (const n2 of graph.nodes) parents.set(n2.id, n2.parentId);
8662
+ for (const n3 of graph.nodes) parents.set(n3.id, n3.parentId);
8661
8663
  for (const g of graph.groups) parents.set(g.id, g.parentId);
8662
8664
  const rel = (id, parentId) => {
8663
8665
  const [x, y] = _nullishCoalesce(positions[id], () => ( [0, 0]));
@@ -8687,26 +8689,26 @@ function mermaidFlowNodes(graph, layout2, options = {}) {
8687
8689
  zIndex: depth(g.id, parents)
8688
8690
  };
8689
8691
  });
8690
- const nodes = graph.nodes.map((n2) => {
8691
- const size = _nullishCoalesce(sizes[n2.id], () => ( { width: 160, height: 56 }));
8692
+ const nodes = graph.nodes.map((n3) => {
8693
+ const size = _nullishCoalesce(sizes[n3.id], () => ( { width: 160, height: 56 }));
8692
8694
  return {
8693
- id: n2.id,
8695
+ id: n3.id,
8694
8696
  type: "mermaid-node",
8695
- position: rel(n2.id, n2.parentId),
8696
- parentId: n2.parentId,
8697
+ position: rel(n3.id, n3.parentId),
8698
+ parentId: n3.parentId,
8697
8699
  data: {
8698
- node: n2,
8700
+ node: n3,
8699
8701
  family: "",
8700
- resolvedStyles: resolveMermaidStyles(n2.classes, n2.styles, graph.classDefs),
8702
+ resolvedStyles: resolveMermaidStyles(n3.classes, n3.styles, graph.classDefs),
8701
8703
  editable
8702
8704
  },
8703
8705
  width: size.width,
8704
8706
  height: size.height,
8705
8707
  style: { width: size.width, height: size.height },
8706
- draggable: editable && !_optionalChain([n2, 'access', _344 => _344.data, 'optionalAccess', _345 => _345.locked]),
8708
+ draggable: editable && !_optionalChain([n3, 'access', _344 => _344.data, 'optionalAccess', _345 => _345.locked]),
8707
8709
  selectable: editable,
8708
- connectable: editable && !_optionalChain([n2, 'access', _346 => _346.data, 'optionalAccess', _347 => _347.locked]) && !_optionalChain([n2, 'access', _348 => _348.data, 'optionalAccess', _349 => _349.synthetic]),
8709
- zIndex: depth(n2.id, parents) + 100
8710
+ connectable: editable && !_optionalChain([n3, 'access', _346 => _346.data, 'optionalAccess', _347 => _347.locked]) && !_optionalChain([n3, 'access', _348 => _348.data, 'optionalAccess', _349 => _349.synthetic]),
8711
+ zIndex: depth(n3.id, parents) + 100
8710
8712
  };
8711
8713
  });
8712
8714
  const order = (a, b) => depth(a.id, parents) - depth(b.id, parents);
@@ -8802,7 +8804,7 @@ function connectedDiagramOnly(graph) {
8802
8804
  linked.add(edge.source);
8803
8805
  linked.add(edge.target);
8804
8806
  }
8805
- const nodes = graph.nodes.filter((n2) => linked.has(n2.id));
8807
+ const nodes = graph.nodes.filter((n3) => linked.has(n3.id));
8806
8808
  if (nodes.length === graph.nodes.length) return graph;
8807
8809
  const parentOf = new Map(graph.groups.map((g) => [g.id, g.parentId]));
8808
8810
  const keep = /* @__PURE__ */ new Set();
@@ -8821,7 +8823,7 @@ function connectedDiagramOnly(graph) {
8821
8823
  function fingerprint(graph) {
8822
8824
  return JSON.stringify([
8823
8825
  graph.direction,
8824
- graph.nodes.map((n2) => [n2.id, _nullishCoalesce(n2.parentId, () => ( "")), n2.shape, String(n2.label).length > 24 ? 1 : 0]),
8826
+ graph.nodes.map((n3) => [n3.id, _nullishCoalesce(n3.parentId, () => ( "")), n3.shape, String(n3.label).length > 24 ? 1 : 0]),
8825
8827
  graph.edges.map((e) => [e.source, e.target]),
8826
8828
  graph.groups.map((g) => [g.id, _nullishCoalesce(g.parentId, () => ( "")), _nullishCoalesce(g.direction, () => ( ""))])
8827
8829
  ]);
@@ -8837,13 +8839,13 @@ var DiagramStream = (_class6 = class {
8837
8839
  update(source, complete = false) {
8838
8840
  const text = streamedDiagramText(source);
8839
8841
  const parsed = _chunkH5K77C7Ycjs.parseMermaid.call(void 0, text);
8840
- const document = !complete ? { ...parsed, graph: connectedDiagramOnly(parsed.graph) } : parsed;
8841
- if (document.tier !== "editable" || !document.graph.nodes.length) return { document, layout: this.layout && complete ? null : this.layout, relaid: false };
8842
- const key = fingerprint(document.graph);
8843
- if (key === this.lastKey && this.layout) return { document, layout: this.layout, relaid: false };
8842
+ const document2 = !complete ? { ...parsed, graph: connectedDiagramOnly(parsed.graph) } : parsed;
8843
+ if (document2.tier !== "editable" || !document2.graph.nodes.length) return { document: document2, layout: this.layout && complete ? null : this.layout, relaid: false };
8844
+ const key = fingerprint(document2.graph);
8845
+ if (key === this.lastKey && this.layout) return { document: document2, layout: this.layout, relaid: false };
8844
8846
  this.lastKey = key;
8845
- this.layout = ensureDiagramLayout(document.graph, document.meta, this.options);
8846
- return { document, layout: this.layout, relaid: true };
8847
+ this.layout = ensureDiagramLayout(document2.graph, document2.meta, this.options);
8848
+ return { document: document2, layout: this.layout, relaid: true };
8847
8849
  }
8848
8850
  /** Forgets the previous layout (a new source). */
8849
8851
  reset() {
@@ -9080,6 +9082,222 @@ function mermaidNodeMembers(data) {
9080
9082
  return list.map((m) => _nullishCoalesce(m.raw, () => ( "")));
9081
9083
  }
9082
9084
 
9085
+ // src/canvas/mermaid/export.ts
9086
+ var DIAGRAM_SVG_LIGHT_THEME = {
9087
+ background: "#ffffff",
9088
+ nodeFill: "#ffffff",
9089
+ nodeStroke: "#0f172a",
9090
+ text: "#0f172a",
9091
+ edge: "#64748b",
9092
+ edgeLabelBackground: "#ffffff",
9093
+ groupFill: "#f8fafc",
9094
+ groupStroke: "#cbd5e1",
9095
+ groupText: "#475569",
9096
+ fontFamily: 'system-ui, -apple-system, "Segoe UI", sans-serif',
9097
+ fontSize: 13
9098
+ };
9099
+ var DIAGRAM_SVG_DARK_THEME = {
9100
+ background: "#0f172a",
9101
+ nodeFill: "#1e293b",
9102
+ nodeStroke: "#e2e8f0",
9103
+ text: "#f1f5f9",
9104
+ edge: "#94a3b8",
9105
+ edgeLabelBackground: "#0f172a",
9106
+ groupFill: "#111c33",
9107
+ groupStroke: "#334155",
9108
+ groupText: "#94a3b8",
9109
+ fontFamily: 'system-ui, -apple-system, "Segoe UI", sans-serif',
9110
+ fontSize: 13
9111
+ };
9112
+ var esc = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
9113
+ var n2 = (v) => String(Math.round(v * 100) / 100);
9114
+ function exitPoint(box, to) {
9115
+ const cx = box.x + box.width / 2;
9116
+ const cy = box.y + box.height / 2;
9117
+ const dx = to.x - cx;
9118
+ const dy = to.y - cy;
9119
+ if (dx === 0 && dy === 0) return { x: cx, y: cy };
9120
+ const sx = dx === 0 ? Infinity : box.width / 2 / Math.abs(dx);
9121
+ const sy = dy === 0 ? Infinity : box.height / 2 / Math.abs(dy);
9122
+ const t = Math.min(sx, sy);
9123
+ return { x: cx + dx * t, y: cy + dy * t };
9124
+ }
9125
+ function mermaidToSvg(doc, options = {}) {
9126
+ const theme = { ...DIAGRAM_SVG_LIGHT_THEME, ...options.theme };
9127
+ const pad = _nullishCoalesce(options.padding, () => ( 16));
9128
+ const graph = doc.graph;
9129
+ const layout2 = _nullishCoalesce(options.layout, () => ( ensureDiagramLayout(graph, doc.meta, options)));
9130
+ const boxOf = (id) => {
9131
+ const p = layout2.positions[id];
9132
+ if (!p) return null;
9133
+ const s = _nullishCoalesce(layout2.sizes[id], () => ( { width: 160, height: 56 }));
9134
+ return { x: p[0], y: p[1], width: s.width, height: s.height };
9135
+ };
9136
+ let minX = Infinity;
9137
+ let minY = Infinity;
9138
+ let maxX = -Infinity;
9139
+ let maxY = -Infinity;
9140
+ for (const id of Object.keys(layout2.positions)) {
9141
+ const b = boxOf(id);
9142
+ minX = Math.min(minX, b.x);
9143
+ minY = Math.min(minY, b.y);
9144
+ maxX = Math.max(maxX, b.x + b.width);
9145
+ maxY = Math.max(maxY, b.y + b.height);
9146
+ }
9147
+ if (minX === Infinity) minX = minY = maxX = maxY = 0;
9148
+ const naturalWidth = Math.max(1, Math.ceil(maxX - minX + pad * 2));
9149
+ const naturalHeight = Math.max(1, Math.ceil(maxY - minY + pad * 2));
9150
+ const fit = Math.min(1, (_nullishCoalesce(options.maxWidth, () => ( Infinity))) / naturalWidth, (_nullishCoalesce(options.maxHeight, () => ( Infinity))) / naturalHeight);
9151
+ const width = Math.max(1, Math.round(naturalWidth * fit));
9152
+ const height = Math.max(1, Math.round(naturalHeight * fit));
9153
+ const ox = pad - minX;
9154
+ const oy = pad - minY;
9155
+ const fs = theme.fontSize;
9156
+ const title = _nullishCoalesce(_nullishCoalesce(options.title, () => ( graph.title)), () => ( `${doc.family} diagram`));
9157
+ const out = [];
9158
+ out.push(
9159
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${naturalWidth} ${naturalHeight}" role="img" aria-label="${esc(title)}" font-family="${esc(theme.fontFamily)}" font-size="${fs}">`,
9160
+ `<title>${esc(title)}</title>`,
9161
+ "<defs>",
9162
+ `<marker id="pd-arrow-closed" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 Z" fill="${esc(theme.edge)}"/></marker>`,
9163
+ `<marker id="pd-arrow-open" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10" fill="none" stroke="${esc(theme.edge)}" stroke-width="1.5"/></marker>`,
9164
+ "</defs>"
9165
+ );
9166
+ if (!options.transparent) out.push(`<rect width="${naturalWidth}" height="${naturalHeight}" fill="${esc(theme.background)}"/>`);
9167
+ out.push(`<g transform="translate(${n2(ox)} ${n2(oy)})">`);
9168
+ const depth2 = (id) => {
9169
+ let d = 0;
9170
+ let cur = _optionalChain([graph, 'access', _354 => _354.groups, 'access', _355 => _355.find, 'call', _356 => _356((g) => g.id === id), 'optionalAccess', _357 => _357.parentId]);
9171
+ while (cur && d < 50) {
9172
+ d++;
9173
+ cur = _optionalChain([graph, 'access', _358 => _358.groups, 'access', _359 => _359.find, 'call', _360 => _360((g) => g.id === cur), 'optionalAccess', _361 => _361.parentId]);
9174
+ }
9175
+ return d;
9176
+ };
9177
+ for (const g of [...graph.groups].sort((a, b) => depth2(a.id) - depth2(b.id))) {
9178
+ const b = boxOf(g.id);
9179
+ if (!b) continue;
9180
+ const st = resolveMermaidStyles(g.classes, g.styles, graph.classDefs);
9181
+ out.push(
9182
+ `<g data-group="${esc(g.id)}"><rect x="${n2(b.x)}" y="${n2(b.y)}" width="${n2(b.width)}" height="${n2(b.height)}" rx="8" fill="${esc(_nullishCoalesce(st.fill, () => ( theme.groupFill)))}" stroke="${esc(_nullishCoalesce(st.stroke, () => ( theme.groupStroke)))}" stroke-dasharray="4 3"/>`,
9183
+ `<text x="${n2(b.x + 10)}" y="${n2(b.y + 18)}" fill="${esc(_nullishCoalesce(st.color, () => ( theme.groupText)))}" font-size="${fs - 1}" font-weight="600">${esc(mermaidLabelLines(g.label).join(" "))}</text></g>`
9184
+ );
9185
+ }
9186
+ for (const e of graph.edges) {
9187
+ const a = boxOf(e.source);
9188
+ const b = boxOf(e.target);
9189
+ if (!a || !b || e.pattern === "invisible") continue;
9190
+ const ca = { x: a.x + a.width / 2, y: a.y + a.height / 2 };
9191
+ const cb = { x: b.x + b.width / 2, y: b.y + b.height / 2 };
9192
+ const p = exitPoint(a, cb);
9193
+ const q = exitPoint(b, ca);
9194
+ const st = resolveMermaidStyles(e.classes, e.styles, graph.classDefs);
9195
+ const end = mermaidEdgeMarker(e.arrowEnd);
9196
+ const start = mermaidEdgeMarker(e.arrowStart);
9197
+ const marker = (m) => m === "arrow" ? "url(#pd-arrow-open)" : m ? "url(#pd-arrow-closed)" : "";
9198
+ const dash = mermaidEdgeDash(e.pattern);
9199
+ out.push(
9200
+ `<line data-edge="${esc(e.id)}" x1="${n2(p.x)}" y1="${n2(p.y)}" x2="${n2(q.x)}" y2="${n2(q.y)}" stroke="${esc(_nullishCoalesce(st.stroke, () => ( theme.edge)))}" stroke-width="${e.pattern === "thick" ? 3 : 1.5}"${dash ? ` stroke-dasharray="${dash}"` : ""}${end ? ` marker-end="${marker(end)}"` : ""}${start ? ` marker-start="${marker(start)}"` : ""}/>`
9201
+ );
9202
+ if (e.label) {
9203
+ const text = mermaidLabelLines(e.label).join(" ");
9204
+ const w = text.length * fs * 0.55 + 10;
9205
+ const mx = (p.x + q.x) / 2;
9206
+ const my = (p.y + q.y) / 2;
9207
+ out.push(
9208
+ `<rect x="${n2(mx - w / 2)}" y="${n2(my - fs * 0.75)}" width="${n2(w)}" height="${n2(fs * 1.5)}" rx="3" fill="${esc(theme.edgeLabelBackground)}"/>`,
9209
+ `<text x="${n2(mx)}" y="${n2(my)}" text-anchor="middle" dominant-baseline="central" fill="${esc(_nullishCoalesce(st.color, () => ( theme.text)))}" font-size="${fs - 1}">${esc(text)}</text>`
9210
+ );
9211
+ }
9212
+ }
9213
+ for (const node of graph.nodes) {
9214
+ const b = boxOf(node.id);
9215
+ if (!b) continue;
9216
+ const st = resolveMermaidStyles(node.classes, node.styles, graph.classDefs);
9217
+ const fill = _nullishCoalesce(st.fill, () => ( theme.nodeFill));
9218
+ const stroke = _nullishCoalesce(st.stroke, () => ( theme.nodeStroke));
9219
+ const color = _nullishCoalesce(st.color, () => ( theme.text));
9220
+ const strokeWidth = _nullishCoalesce(_optionalChain([st, 'access', _362 => _362["stroke-width"], 'optionalAccess', _363 => _363.replace, 'call', _364 => _364("px", "")]), () => ( "1.25"));
9221
+ const paint = (kind) => kind === "shape" ? `fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${esc(strokeWidth)}"` : kind === "line" ? `fill="none" stroke="${esc(stroke)}" stroke-width="${esc(strokeWidth)}"` : kind === "filled" ? `fill="${esc(stroke)}" stroke="${esc(stroke)}"` : 'fill="none" stroke="none"';
9222
+ out.push(`<g data-node="${esc(node.id)}" transform="translate(${n2(b.x)} ${n2(b.y)})">`);
9223
+ for (const path of mermaidShapePaths(node.shape, b.width, b.height)) out.push(`<path d="${path.d}" ${paint(path.paint)}/>`);
9224
+ const lines = mermaidLabelLines(node.label).filter((l, i, all) => l || all.length === 1);
9225
+ const members = mermaidNodeMembers(node.data);
9226
+ const lh = fs * 1.3;
9227
+ if (members.length) {
9228
+ lines.forEach((line3, i) => out.push(`<text x="${n2(b.width / 2)}" y="${n2(14 + lh * i)}" text-anchor="middle" dominant-baseline="central" fill="${esc(color)}" font-weight="600">${esc(line3)}</text>`));
9229
+ const top = 14 + lh * lines.length - lh / 2 + 4;
9230
+ out.push(`<line x1="0" y1="${n2(top)}" x2="${n2(b.width)}" y2="${n2(top)}" stroke="${esc(stroke)}" stroke-width="1"/>`);
9231
+ members.forEach((m, i) => out.push(`<text x="8" y="${n2(top + 4 + lh * (i + 0.5))}" dominant-baseline="central" fill="${esc(color)}" font-size="${fs - 1}">${esc(m)}</text>`));
9232
+ } else {
9233
+ const first = b.height / 2 - (lines.length - 1) * lh / 2;
9234
+ lines.forEach((line3, i) => out.push(`<text x="${n2(b.width / 2)}" y="${n2(first + lh * i)}" text-anchor="middle" dominant-baseline="central" fill="${esc(color)}">${esc(line3)}</text>`));
9235
+ }
9236
+ out.push("</g>");
9237
+ }
9238
+ out.push("</g></svg>");
9239
+ return { svg: out.join(""), width, height, naturalWidth, naturalHeight };
9240
+ }
9241
+ function mermaidThumbnailSvg(doc, options = {}) {
9242
+ return mermaidToSvg(doc, { maxWidth: 240, maxHeight: 160, padding: 8, ...options });
9243
+ }
9244
+ var DIAGRAM_RASTER_MAX_SIZE = 2048;
9245
+ function rasterSize(width, height, scale = 2, maxSize = DIAGRAM_RASTER_MAX_SIZE) {
9246
+ if (!(width > 0) || !(height > 0)) throw new Error(`An image needs a positive width and height; got ${width} \xD7 ${height}.`);
9247
+ const factor = Math.min(scale > 0 ? scale : 1, maxSize / Math.max(width, height));
9248
+ return { width: Math.max(1, Math.round(width * factor)), height: Math.max(1, Math.round(height * factor)), scale: factor };
9249
+ }
9250
+ var NO_DOM = 'Rasterizing needs a browser DOM (document, Image and a 2D canvas). Outside a browser, use the SVG (mermaidToSvg, or render_diagram with format "svg") with an SVG renderer.';
9251
+ async function rasterizeSvg(svg, options) {
9252
+ const doc = _nullishCoalesce(options.document, () => ( globalThis.document));
9253
+ const ImageCtor = _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _365 => _365.defaultView, 'optionalAccess', _366 => _366.Image]), () => ( globalThis.Image));
9254
+ if (!doc || typeof doc.createElement !== "function" || !ImageCtor) throw new Error(NO_DOM);
9255
+ const size = rasterSize(options.width, options.height, options.scale, options.maxSize);
9256
+ const canvas = doc.createElement("canvas");
9257
+ canvas.width = size.width;
9258
+ canvas.height = size.height;
9259
+ let context = null;
9260
+ try {
9261
+ context = canvas.getContext("2d");
9262
+ } catch (e9) {
9263
+ context = null;
9264
+ }
9265
+ if (!context) throw new Error(NO_DOM);
9266
+ const image = new ImageCtor();
9267
+ await new Promise((resolve, reject) => {
9268
+ image.onload = () => resolve();
9269
+ image.onerror = () => reject(new Error("The SVG could not be loaded as an image; check that it is a complete <svg> document with the SVG namespace."));
9270
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
9271
+ });
9272
+ const background = _nullishCoalesce(options.background, () => ( "#ffffff"));
9273
+ if (background !== "transparent") {
9274
+ context.fillStyle = background;
9275
+ context.fillRect(0, 0, size.width, size.height);
9276
+ }
9277
+ context.drawImage(image, 0, 0, size.width, size.height);
9278
+ const url = canvas.toDataURL("image/png");
9279
+ if (!url.startsWith("data:image/png")) throw new Error("This canvas cannot export PNG (toDataURL returned no image).");
9280
+ return { data: url.slice(url.indexOf(",") + 1), mimeType: "image/png", width: size.width, height: size.height };
9281
+ }
9282
+ function diagramFileName(doc, extension2) {
9283
+ const base = (_nullishCoalesce(doc.graph.title, () => ( ""))).toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").slice(0, 60);
9284
+ return `${base || `${doc.family}-diagram`}.${extension2}`;
9285
+ }
9286
+ async function downloadDiagramPng(doc, options = {}) {
9287
+ const drawn = mermaidToSvg(doc, options);
9288
+ const background = _nullishCoalesce(options.background, () => ( (options.transparent ? "transparent" : _nullishCoalesce(_optionalChain([options, 'access', _367 => _367.theme, 'optionalAccess', _368 => _368.background]), () => ( DIAGRAM_SVG_LIGHT_THEME.background)))));
9289
+ const image = await rasterizeSvg(drawn.svg, { ...options, width: drawn.width, height: drawn.height, background });
9290
+ const filename = _nullishCoalesce(options.filename, () => ( diagramFileName(doc, "png")));
9291
+ const page = _nullishCoalesce(options.document, () => ( document));
9292
+ const link = page.createElement("a");
9293
+ link.href = `data:image/png;base64,${image.data}`;
9294
+ link.download = filename;
9295
+ page.body.appendChild(link);
9296
+ link.click();
9297
+ link.remove();
9298
+ return { ...image, filename };
9299
+ }
9300
+
9083
9301
  // src/canvas/mermaid/index.ts
9084
9302
  function mermaidToCanvas(doc, options = {}) {
9085
9303
  const layout2 = _nullishCoalesce(options.layout, () => ( ensureDiagramLayout(doc.graph, doc.meta, options)));
@@ -9090,7 +9308,7 @@ function mermaidToCanvas(doc, options = {}) {
9090
9308
  };
9091
9309
  }
9092
9310
  function mermaidMovesFromCanvas(layout2, moved, all = moved, options = {}) {
9093
- const byId = new Map([...all, ...moved].map((n2) => [n2.id, n2]));
9311
+ const byId = new Map([...all, ...moved].map((n3) => [n3.id, n3]));
9094
9312
  const absolute = (id, seen = /* @__PURE__ */ new Set()) => {
9095
9313
  const node = byId.get(id);
9096
9314
  if (!node) return _nullishCoalesce(layout2.positions[id], () => ( [0, 0]));
@@ -9099,16 +9317,16 @@ function mermaidMovesFromCanvas(layout2, moved, all = moved, options = {}) {
9099
9317
  const [px2, py] = absolute(node.parentId, seen);
9100
9318
  return [px2 + node.position.x, py + node.position.y];
9101
9319
  };
9102
- const moves = moved.map((n2) => ({ id: n2.id, position: absolute(n2.id) })).filter(({ id, position: [x, y] }) => {
9320
+ const moves = moved.map((n3) => ({ id: n3.id, position: absolute(n3.id) })).filter(({ id, position: [x, y] }) => {
9103
9321
  const before = layout2.positions[id];
9104
9322
  return !before || Math.abs(before[0] - x) >= 0.5 || Math.abs(before[1] - y) >= 0.5;
9105
9323
  });
9106
9324
  const movedIds = new Set(moves.map((m) => m.id));
9107
- for (const n2 of all) {
9108
- if (movedIds.has(n2.id)) continue;
9109
- let parent = n2.parentId;
9110
- while (parent && !movedIds.has(parent)) parent = _optionalChain([byId, 'access', _354 => _354.get, 'call', _355 => _355(parent), 'optionalAccess', _356 => _356.parentId]);
9111
- if (parent) moves.push({ id: n2.id, position: absolute(n2.id) });
9325
+ for (const n3 of all) {
9326
+ if (movedIds.has(n3.id)) continue;
9327
+ let parent = n3.parentId;
9328
+ while (parent && !movedIds.has(parent)) parent = _optionalChain([byId, 'access', _369 => _369.get, 'call', _370 => _370(parent), 'optionalAccess', _371 => _371.parentId]);
9329
+ if (parent) moves.push({ id: n3.id, position: absolute(n3.id) });
9112
9330
  }
9113
9331
  if (!moves.length) return null;
9114
9332
  if (options.stored) {
@@ -9143,10 +9361,10 @@ function getAgentCardAnchor(agentId = "agent", nodeId = "node", zone = 0, option
9143
9361
  const seed = hashString(`${agentId}:${nodeId}:${zoneName}`);
9144
9362
  const offsetX = seed % 17 - 8;
9145
9363
  const offsetY = (seed >> 4) % 9 - 4;
9146
- const jitterX = _optionalChain([options, 'optionalAccess', _357 => _357.randomJitter]) ? (Math.random() - 0.5) * 24 : 0;
9147
- const jitterY = _optionalChain([options, 'optionalAccess', _358 => _358.randomJitter]) ? (Math.random() - 0.5) * 16 : 0;
9148
- const maxX = _optionalChain([options, 'optionalAccess', _359 => _359.width]) ? Math.max(24, options.width - 20) : 230;
9149
- const maxY = _optionalChain([options, 'optionalAccess', _360 => _360.height]) ? Math.max(20, options.height - 15) : 145;
9364
+ const jitterX = _optionalChain([options, 'optionalAccess', _372 => _372.randomJitter]) ? (Math.random() - 0.5) * 24 : 0;
9365
+ const jitterY = _optionalChain([options, 'optionalAccess', _373 => _373.randomJitter]) ? (Math.random() - 0.5) * 16 : 0;
9366
+ const maxX = _optionalChain([options, 'optionalAccess', _374 => _374.width]) ? Math.max(24, options.width - 20) : 230;
9367
+ const maxY = _optionalChain([options, 'optionalAccess', _375 => _375.height]) ? Math.max(20, options.height - 15) : 145;
9150
9368
  return {
9151
9369
  x: Math.max(16, Math.min(maxX, Math.round(base.x + offsetX + jitterX))),
9152
9370
  y: Math.max(14, Math.min(maxY, Math.round(base.y + offsetY + jitterY))),
@@ -9155,8 +9373,8 @@ function getAgentCardAnchor(agentId = "agent", nodeId = "node", zone = 0, option
9155
9373
  }
9156
9374
  function calculateCurvedPath(fromX, fromY, toX, toY, progress, options) {
9157
9375
  const p = Math.max(0, Math.min(1, progress));
9158
- const arcHeight = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _361 => _361.arcHeight]), () => ( -30));
9159
- const wobble = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _362 => _362.wobble]), () => ( 0));
9376
+ const arcHeight = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _376 => _376.arcHeight]), () => ( -30));
9377
+ const wobble = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _377 => _377.wobble]), () => ( 0));
9160
9378
  const arc = Math.sin(p * Math.PI) * arcHeight;
9161
9379
  const sway = Math.sin(p * Math.PI * 2) * wobble;
9162
9380
  const currentX = fromX + (toX - fromX) * p + sway;
@@ -9183,7 +9401,7 @@ function getNaturalMovementTiming(distance, seedStr = "drag") {
9183
9401
  function getCursorTransitionDuration(distance, seedStr = "cursor", options) {
9184
9402
  const seed = hashString(seedStr);
9185
9403
  const jitter = seed % 60 - 30;
9186
- const variance = _optionalChain([options, 'optionalAccess', _363 => _363.naturalVariance]) ? 0.85 + Math.random() * 0.3 : 1;
9404
+ const variance = _optionalChain([options, 'optionalAccess', _378 => _378.naturalVariance]) ? 0.85 + Math.random() * 0.3 : 1;
9187
9405
  let baseDuration = 560;
9188
9406
  if (distance < 60) {
9189
9407
  baseDuration = 340;
@@ -9220,10 +9438,10 @@ function formatAgentCursorName(nameOrUsername) {
9220
9438
  }
9221
9439
  function isAgentCursor(cursor) {
9222
9440
  if (cursor.isAgent) return true;
9223
- if (_optionalChain([cursor, 'access', _364 => _364.userId, 'optionalAccess', _365 => _365.startsWith, 'call', _366 => _366("agent_")]) || _optionalChain([cursor, 'access', _367 => _367.userId, 'optionalAccess', _368 => _368.startsWith, 'call', _369 => _369("agent-")])) return true;
9224
- if (_optionalChain([cursor, 'access', _370 => _370.id, 'optionalAccess', _371 => _371.startsWith, 'call', _372 => _372("agent-")]) || _optionalChain([cursor, 'access', _373 => _373.id, 'optionalAccess', _374 => _374.startsWith, 'call', _375 => _375("agent_")])) return true;
9225
- if (_optionalChain([cursor, 'access', _376 => _376.username, 'optionalAccess', _377 => _377.startsWith, 'call', _378 => _378("@agent_")]) || _optionalChain([cursor, 'access', _379 => _379.username, 'optionalAccess', _380 => _380.startsWith, 'call', _381 => _381("agent_")])) return true;
9226
- const roleLower = _optionalChain([cursor, 'access', _382 => _382.role, 'optionalAccess', _383 => _383.toLowerCase, 'call', _384 => _384()]) || "";
9441
+ if (_optionalChain([cursor, 'access', _379 => _379.userId, 'optionalAccess', _380 => _380.startsWith, 'call', _381 => _381("agent_")]) || _optionalChain([cursor, 'access', _382 => _382.userId, 'optionalAccess', _383 => _383.startsWith, 'call', _384 => _384("agent-")])) return true;
9442
+ if (_optionalChain([cursor, 'access', _385 => _385.id, 'optionalAccess', _386 => _386.startsWith, 'call', _387 => _387("agent-")]) || _optionalChain([cursor, 'access', _388 => _388.id, 'optionalAccess', _389 => _389.startsWith, 'call', _390 => _390("agent_")])) return true;
9443
+ if (_optionalChain([cursor, 'access', _391 => _391.username, 'optionalAccess', _392 => _392.startsWith, 'call', _393 => _393("@agent_")]) || _optionalChain([cursor, 'access', _394 => _394.username, 'optionalAccess', _395 => _395.startsWith, 'call', _396 => _396("agent_")])) return true;
9444
+ const roleLower = _optionalChain([cursor, 'access', _397 => _397.role, 'optionalAccess', _398 => _398.toLowerCase, 'call', _399 => _399()]) || "";
9227
9445
  if (roleLower.includes("agent") || roleLower.includes("specialist") || roleLower === "planner" || roleLower === "coordinator" || roleLower === "executor" || roleLower === "validator" || roleLower === "supervisor") {
9228
9446
  return true;
9229
9447
  }
@@ -9654,5 +9872,14 @@ function isAgentCursor(cursor) {
9654
9872
 
9655
9873
 
9656
9874
 
9657
- exports.ANIMATABLE_PROPERTIES = ANIMATABLE_PROPERTIES; exports.ANIMATION_DATA_KEY = ANIMATION_DATA_KEY; exports.ANIMATION_EASING_LABELS = _chunkXZ4L3R4Kcjs.ANIMATION_EASING_LABELS; exports.ANIMATION_EASING_PRESETS = _chunkXZ4L3R4Kcjs.ANIMATION_EASING_PRESETS; exports.ANIMATION_TIME_EPSILON = _chunkO4ONBPZWcjs.ANIMATION_TIME_EPSILON; exports.AUTO_LAYOUT_DATA_KEY = AUTO_LAYOUT_DATA_KEY; exports.AnimationEditError = AnimationEditError; exports.AnimationPlayer = _chunkO4ONBPZWcjs.AnimationPlayer; exports.CANVAS_COMPONENT_DRAG_TYPE = CANVAS_COMPONENT_DRAG_TYPE; exports.CANVAS_GRADIENT_PRESETS = _chunkYNSK4MGTcjs.CANVAS_GRADIENT_PRESETS; exports.CANVAS_TOKEN_PROPERTIES = CANVAS_TOKEN_PROPERTIES; exports.CARD_INSPECTION_ZONES = CARD_INSPECTION_ZONES; exports.CHILD_LAYOUT_DATA_KEY = CHILD_LAYOUT_DATA_KEY; exports.COMPONENT_DATA_KEY = COMPONENT_DATA_KEY; exports.COMPONENT_OVERRIDES_DATA_KEY = COMPONENT_OVERRIDES_DATA_KEY; exports.COMPONENT_PROPERTY_REFS_DATA_KEY = COMPONENT_PROPERTY_REFS_DATA_KEY; exports.COMPONENT_SET_DATA_KEY = COMPONENT_SET_DATA_KEY; exports.COMPONENT_SOURCE_DATA_KEY = COMPONENT_SOURCE_DATA_KEY; exports.CONNECTION_LINE_TYPES = CONNECTION_LINE_TYPES; exports.CSS_ANIMATION_PROPERTIES = CSS_ANIMATION_PROPERTIES; exports.CUBIC_BEZIER_PRESETS = _chunkXZ4L3R4Kcjs.CUBIC_BEZIER_PRESETS; exports.CanvasScenesStore = CanvasScenesStore; exports.DEFAULT_ARRANGE_SHORTCUTS = _chunk26BVFKHUcjs.DEFAULT_ARRANGE_SHORTCUTS; exports.DEFAULT_CURSOR_INACTIVITY_MS = DEFAULT_CURSOR_INACTIVITY_MS; exports.DEFAULT_DIAGRAM_NODE_HEIGHT = DEFAULT_DIAGRAM_NODE_HEIGHT; exports.DEFAULT_DIAGRAM_NODE_WIDTH = DEFAULT_DIAGRAM_NODE_WIDTH; exports.DEFAULT_NODE_HEIGHT = _chunkWADCJ7A7cjs.DEFAULT_NODE_HEIGHT; exports.DEFAULT_NODE_WIDTH = _chunkWADCJ7A7cjs.DEFAULT_NODE_WIDTH; exports.DEFAULT_PLACEMENT_GAP = _chunkWADCJ7A7cjs.DEFAULT_PLACEMENT_GAP; exports.DiagramStream = DiagramStream; exports.INSTANCE_DATA_KEY = INSTANCE_DATA_KEY; exports.LOCKED_DATA_KEY = LOCKED_DATA_KEY; exports.LOCKED_PREVIOUS_FLAGS_KEY = LOCKED_PREVIOUS_FLAGS_KEY; exports.MAX_KEYFRAME_REFS = MAX_KEYFRAME_REFS; exports.MERMAID_SHAPE_PAINT = MERMAID_SHAPE_PAINT; exports.ManualClock = _chunkO4ONBPZWcjs.ManualClock; exports.PATHFINDER_OPERATIONS = _chunkYNSK4MGTcjs.PATHFINDER_OPERATIONS; exports.PIXERATE_BRAND_GRADIENT = _chunkYNSK4MGTcjs.PIXERATE_BRAND_GRADIENT; exports.PathOpsError = _chunkYNSK4MGTcjs.PathOpsError; exports.PlanarMap = _chunkYNSK4MGTcjs.PlanarMap; exports.RESIZE_HANDLES = RESIZE_HANDLES; exports.SHAPE_DATA_KEY = SHAPE_DATA_KEY; exports.SHAPE_KINDS = _chunkYNSK4MGTcjs.SHAPE_KINDS; exports.SHAPE_NODE_TYPE = SHAPE_NODE_TYPE; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.StreamingLayoutManager = StreamingLayoutManager; exports.TOKEN_BINDINGS_DATA_KEY = TOKEN_BINDINGS_DATA_KEY; exports.TOKEN_MODES_DATA_KEY = TOKEN_MODES_DATA_KEY; exports.addCanvasVariant = addCanvasVariant; exports.addKeyframesAtTime = addKeyframesAtTime; exports.alignNodes = alignNodes; exports.angleToSvgLinearCoords = _chunkYNSK4MGTcjs.angleToSvgLinearCoords; exports.animateNode = animateNode; exports.applyAnimation = applyAnimation; exports.applyAnimationOverrides = applyAnimationOverrides; exports.applyConstraints = applyConstraints; exports.applyNodeUpdates = applyNodeUpdates; exports.applyShapeCombination = applyShapeCombination; exports.applyShapeReplacement = applyShapeReplacement; exports.arcToCubics = _chunkYNSK4MGTcjs.arcToCubics; exports.autoLayoutDiagram = autoLayoutDiagram; exports.bezierPathArea = _chunkYNSK4MGTcjs.bezierPathArea; exports.bezierPathBounds = _chunkYNSK4MGTcjs.bezierPathBounds; exports.bezierPathLength = _chunkYNSK4MGTcjs.bezierPathLength; exports.bezierPathPointAtLength = _chunkYNSK4MGTcjs.bezierPathPointAtLength; exports.bezierPathSignedArea = _chunkYNSK4MGTcjs.bezierPathSignedArea; exports.bezierPathToSvg = _chunkYNSK4MGTcjs.bezierPathToSvg; exports.bindCanvasComponentProperty = bindCanvasComponentProperty; exports.bindCanvasToken = bindCanvasToken; exports.blendDiagramLayout = blendDiagramLayout; exports.blendLayout = blendLayout; exports.boundsOf = _chunkWADCJ7A7cjs.boundsOf; exports.calculateCursorArrowRotation = calculateCursorArrowRotation; exports.calculateCurvedPath = calculateCurvedPath; exports.calculateDagreReflowDisplacement = calculateDagreReflowDisplacement; exports.calculateDirectionalDisplacement = calculateDirectionalDisplacement; exports.canCombineShapeNodes = canCombineShapeNodes; exports.canOffsetShapeNodes = canOffsetShapeNodes; exports.canOutlineShapeNodeStrokes = canOutlineShapeNodeStrokes; exports.canvasHeight = canvasHeight; exports.centerNodes = _chunkWADCJ7A7cjs.centerNodes; exports.centre = _chunkWADCJ7A7cjs.centre; exports.clampAnimationValue = clampAnimationValue; exports.clampLayoutSize = clampLayoutSize; exports.closeContour = _chunkYNSK4MGTcjs.closeContour; exports.collectDescendantIds = collectDescendantIds; exports.combineCanvasComponentsAsVariants = combineCanvasComponentsAsVariants; exports.combineShapeNodes = combineShapeNodes; exports.computeNodesBoundingBox = computeNodesBoundingBox; exports.computeSnapGuides = computeSnapGuides; exports.connectedDiagramOnly = connectedDiagramOnly; exports.connectedOnly = connectedOnly; exports.contourEnclosesArea = _chunkYNSK4MGTcjs.contourEnclosesArea; exports.contourSignedArea = _chunkYNSK4MGTcjs.contourSignedArea; exports.contoursToPath = _chunkYNSK4MGTcjs.contoursToPath; exports.copyKeyframes = copyKeyframes; exports.countPathSegments = _chunkYNSK4MGTcjs.countPathSegments; exports.createAnimationPlayer = _chunkO4ONBPZWcjs.createAnimationPlayer; exports.createBezierTrajectory = createBezierTrajectory; exports.createCanvasAnimationController = createCanvasAnimationController; exports.createCanvasArrangeController = createCanvasArrangeController; exports.createCanvasAutoLayoutController = createCanvasAutoLayoutController; exports.createCanvasComponent = createCanvasComponent; exports.createCanvasComponentsController = createCanvasComponentsController; exports.createCanvasDrawController = createCanvasDrawController; exports.createCanvasInstance = createCanvasInstance; exports.createCanvasScenesStore = createCanvasScenesStore; exports.createDefaultStrokeStyle = createDefaultStrokeStyle; exports.createFanOutTrajectory = createFanOutTrajectory; exports.createGuideIndex = createGuideIndex; exports.createNodeGuideIndex = createNodeGuideIndex; exports.createNodeLookup = createNodeLookup; exports.cubicBezierAt = _chunkXZ4L3R4Kcjs.cubicBezierAt; exports.cubicPointAt = _chunkYNSK4MGTcjs.cubicPointAt; exports.cubicsToPathData = _chunkYNSK4MGTcjs.cubicsToPathData; exports.cutOutPiece = _chunkYNSK4MGTcjs.cutOutPiece; exports.dashContours = _chunkYNSK4MGTcjs.dashContours; exports.defaultEasing = defaultEasing; exports.deleteKeyframes = deleteKeyframes; exports.detachCanvasInstance = detachCanvasInstance; exports.detachTokenBindings = detachTokenBindings; exports.diagramCanvasHeight = diagramCanvasHeight; exports.diagramGroupSize = diagramGroupSize; exports.diagramImageSize = diagramImageSize; exports.diagramLayoutBounds = diagramLayoutBounds; exports.diffOverrideGroups = diffOverrideGroups; exports.distanceToBezierPath = _chunkYNSK4MGTcjs.distanceToBezierPath; exports.distributeNodes = distributeNodes; exports.dividePaths = _chunkYNSK4MGTcjs.dividePaths; exports.dividePolygons = _chunkYNSK4MGTcjs.dividePolygons; exports.easeDiagramTween = easeDiagramTween; exports.easingFromInfluence = _chunkXZ4L3R4Kcjs.easingFromInfluence; exports.easingLabel = _chunkXZ4L3R4Kcjs.easingLabel; exports.easingToCss = _chunkXZ4L3R4Kcjs.easingToCss; exports.elasticAt = _chunkXZ4L3R4Kcjs.elasticAt; exports.ensureDiagramLayout = ensureDiagramLayout; exports.ensureLayout = _chunkWADCJ7A7cjs.ensureLayout; exports.estimateCanvasHeight = estimateCanvasHeight; exports.estimateDiagramCanvasHeight = estimateDiagramCanvasHeight; exports.estimateDiagramNodeSize = estimateDiagramNodeSize; exports.estimateNodeSize = _chunkWADCJ7A7cjs.estimateNodeSize; exports.evaluateAnimation = evaluateAnimation; exports.evaluateEasing = _chunkXZ4L3R4Kcjs.evaluateEasing; exports.evaluateTrack = _chunkO4ONBPZWcjs.evaluateTrack; exports.excludePaths = _chunkYNSK4MGTcjs.excludePaths; exports.exportCssAnimation = exportCssAnimation; exports.findConnectorSnap = findConnectorSnap; exports.findStrokesAtPoint = findStrokesAtPoint; exports.findVariant = findVariant; exports.fitCubicRun = _chunkYNSK4MGTcjs.fitCubicRun; exports.fitCubicWithTangents = _chunkYNSK4MGTcjs.fitCubicWithTangents; exports.fitCubics = _chunkYNSK4MGTcjs.fitCubics; exports.fitFreehandPath = _chunkYNSK4MGTcjs.fitFreehandPath; exports.fitPathData = _chunkYNSK4MGTcjs.fitPathData; exports.fitViewportToNodes = fitViewportToNodes; exports.fitViewportToRect = fitViewportToRect; exports.flattenSvgPath = _chunkYNSK4MGTcjs.flattenSvgPath; exports.flowSide = _chunkWADCJ7A7cjs.flowSide; exports.formatAgentCursorName = formatAgentCursorName; exports.formatAnimationTime = formatAnimationTime; exports.formatNumber = _chunkYNSK4MGTcjs.formatNumber; exports.formatOklab = _chunkMR3Z4OQIcjs.formatOklab; exports.formatVariantName = formatVariantName; exports.getAbsolutePosition = getAbsolutePosition; exports.getAgentCardAnchor = getAgentCardAnchor; exports.getAnimatableProperty = getAnimatableProperty; exports.getAnimatedProperties = getAnimatedProperties; exports.getAnimatedValue = getAnimatedValue; exports.getAnimationDuration = getAnimationDuration; exports.getAnimationTrack = getAnimationTrack; exports.getAutoLayout = getAutoLayout; exports.getAutoLayoutGrid = getAutoLayoutGrid; exports.getAutoLayoutInsertTarget = getAutoLayoutInsertTarget; exports.getBindableTokenProperties = getBindableTokenProperties; exports.getCanvasComponentDragId = getCanvasComponentDragId; exports.getCanvasTokenProperty = getCanvasTokenProperty; exports.getCenteredNodePosition = _chunkWADCJ7A7cjs.getCenteredNodePosition; exports.getChildLayout = getChildLayout; exports.getComponentData = getComponentData; exports.getComponentInstances = getComponentInstances; exports.getComponentPropertyDefs = getComponentPropertyDefs; exports.getComponentPropertyRefs = getComponentPropertyRefs; exports.getComponentSourceId = getComponentSourceId; exports.getCssPropertyAnimations = getCssPropertyAnimations; exports.getCursorTransitionDuration = getCursorTransitionDuration; exports.getDefaultVariant = getDefaultVariant; exports.getEffectiveTokenModes = getEffectiveTokenModes; exports.getFlowChildren = getFlowChildren; exports.getInstanceData = getInstanceData; exports.getInstanceProperties = getInstanceProperties; exports.getInstanceStatus = getInstanceStatus; exports.getKeyframeTimes = getKeyframeTimes; exports.getLayerName = getLayerName; exports.getLayoutParent = getLayoutParent; exports.getLayoutSizing = getLayoutSizing; exports.getLayoutedNodes = _chunkWADCJ7A7cjs.getLayoutedNodes; exports.getNaturalMovementTiming = getNaturalMovementTiming; exports.getNextVariantValues = getNextVariantValues; exports.getNodeAnimation = getNodeAnimation; exports.getNodeOverrides = getNodeOverrides; exports.getNodeRect = getNodeRect; exports.getNodeShape = getNodeShape; exports.getNodeSize = getNodeSize; exports.getNodeTokenBindings = getNodeTokenBindings; exports.getNodeTokenModes = getNodeTokenModes; exports.getOwningComponent = getOwningComponent; exports.getOwningInstance = getOwningInstance; exports.getResizingNodeRect = getResizingNodeRect; exports.getRootInstance = getRootInstance; exports.getShapeRenderData = _chunkYNSK4MGTcjs.getShapeRenderData; exports.getShapeSvg = _chunkYNSK4MGTcjs.getShapeSvg; exports.getTimelineRows = getTimelineRows; exports.getTimelineTicks = getTimelineTicks; exports.getTokenPropertyScope = getTokenPropertyScope; exports.getTokensForProperty = getTokensForProperty; exports.getVariantConflicts = getVariantConflicts; exports.getVariantOptions = getVariantOptions; exports.getVariantSet = getVariantSet; exports.getVariantValues = getVariantValues; exports.gradientToSvgDef = _chunkYNSK4MGTcjs.gradientToSvgDef; exports.handlePoint = handlePoint; exports.hasVisibleStroke = hasVisibleStroke; exports.hashString = hashString; exports.hatchPath = _chunkYNSK4MGTcjs.hatchPath; exports.inferResizeHandle = inferResizeHandle; exports.inspectCanvasInstance = inspectCanvasInstance; exports.inspectNodeTokens = inspectNodeTokens; exports.interiorPoint = _chunkYNSK4MGTcjs.interiorPoint; exports.interpolateAnimationValue = _chunkO4ONBPZWcjs.interpolateAnimationValue; exports.intersectPaths = _chunkYNSK4MGTcjs.intersectPaths; exports.intersectPolygons = _chunkYNSK4MGTcjs.intersectPolygons; exports.invertNodeUpdates = invertNodeUpdates; exports.isAgentCursor = isAgentCursor; exports.isAnimationEasing = _chunkXZ4L3R4Kcjs.isAnimationEasing; exports.isAnimationKeyframe = _chunkO4ONBPZWcjs.isAnimationKeyframe; exports.isAutoLayoutFrame = isAutoLayoutFrame; exports.isCanvasComponent = isCanvasComponent; exports.isCanvasComponentSet = isCanvasComponentSet; exports.isCanvasGradient = _chunkYNSK4MGTcjs.isCanvasGradient; exports.isCanvasInstance = isCanvasInstance; exports.isCssExportExact = isCssExportExact; exports.isEventFromTextInput = isEventFromTextInput; exports.isInsideInstance = isInsideInstance; exports.isKeyframeSelected = isKeyframeSelected; exports.isLocked = isLocked; exports.isMeasureModifierHeld = isMeasureModifierHeld; exports.isNodeAnimated = isNodeAnimated; exports.isShapeDescription = _chunkYNSK4MGTcjs.isShapeDescription; exports.isShapeNode = isShapeNode; exports.isStraightCubic = _chunkYNSK4MGTcjs.isStraightCubic; exports.isValidCanvasEdge = isValidCanvasEdge; exports.isValidCanvasNode = isValidCanvasNode; exports.isValidCanvasScene = isValidCanvasScene; exports.isValidUrl = isValidUrl; exports.layoutAll = layoutAll; exports.layoutBounds = layoutBounds; exports.layoutFrame = layoutFrame; exports.layoutUp = layoutUp; exports.layoutUpMany = layoutUpMany; exports.linearPositionTrajectory = linearPositionTrajectory; exports.linearTrajectory = linearTrajectory; exports.listCanvasComponents = listCanvasComponents; exports.lockNodes = lockNodes; exports.makeSizingCoherent = makeSizingCoherent; exports.matchArrangeShortcut = _chunk26BVFKHUcjs.matchArrangeShortcut; exports.matchSize = matchSize; exports.measureBetween = measureBetween; exports.measureLabel = measureLabel; exports.measureSelection = measureSelection; exports.measureToLine = measureToLine; exports.mergeNodeUpdates = mergeNodeUpdates; exports.mermaidEdgeDash = mermaidEdgeDash; exports.mermaidEdgeMarker = mermaidEdgeMarker; exports.mermaidEdgeWidth = mermaidEdgeWidth; exports.mermaidFlowEdges = mermaidFlowEdges; exports.mermaidFlowNodes = mermaidFlowNodes; exports.mermaidLabelLines = mermaidLabelLines; exports.mermaidMarkerId = mermaidMarkerId; exports.mermaidMovesFromCanvas = mermaidMovesFromCanvas; exports.mermaidNodeMembers = mermaidNodeMembers; exports.mermaidNodePaint = mermaidNodePaint; exports.mermaidShapePaths = mermaidShapePaths; exports.mermaidToCanvas = mermaidToCanvas; exports.mixColorsOklab = _chunkMR3Z4OQIcjs.mixColorsOklab; exports.moveKeyframes = moveKeyframes; exports.moveLayoutChild = moveLayoutChild; exports.multiPolygonArea = _chunkYNSK4MGTcjs.multiPolygonArea; exports.multiPolygonBounds = _chunkYNSK4MGTcjs.multiPolygonBounds; exports.nearestHandlePositions = nearestHandlePositions; exports.normalizeBezierPath = _chunkYNSK4MGTcjs.normalizeBezierPath; exports.normalizeKeyframes = _chunkO4ONBPZWcjs.normalizeKeyframes; exports.offsetPath = _chunkYNSK4MGTcjs.offsetPath; exports.offsetShapeNodes = offsetShapeNodes; exports.oklabToRgb = _chunkMR3Z4OQIcjs.oklabToRgb; exports.oppositePosition = oppositePosition; exports.outlineShapeNodeStrokes = outlineShapeNodeStrokes; exports.outlineStroke = _chunkYNSK4MGTcjs.outlineStroke; exports.overlaps = _chunkWADCJ7A7cjs.overlaps; exports.pageHidden = _chunkO4ONBPZWcjs.pageHidden; exports.parseCanvasClipboardData = parseCanvasClipboardData; exports.parseCanvasScenes = parseCanvasScenes; exports.parseCssEasing = _chunkXZ4L3R4Kcjs.parseCssEasing; exports.parseCssGradient = _chunkYNSK4MGTcjs.parseCssGradient; exports.parseKeyframeClipboard = parseKeyframeClipboard; exports.parseMermaidStyles = parseMermaidStyles; exports.parseNodeStyleDeclarations = parseNodeStyleDeclarations; exports.parseOklab = _chunkMR3Z4OQIcjs.parseOklab; exports.parseSvgPath = _chunkYNSK4MGTcjs.parseSvgPath; exports.parseVariantName = parseVariantName; exports.pasteKeyframes = pasteKeyframes; exports.pathBoolean = _chunkYNSK4MGTcjs.pathBoolean; exports.pathBooleanSelect = _chunkYNSK4MGTcjs.pathBooleanSelect; exports.pathToContours = _chunkYNSK4MGTcjs.pathToContours; exports.pathfinder = _chunkYNSK4MGTcjs.pathfinder; exports.placeBeside = _chunkWADCJ7A7cjs.placeBeside; exports.planarSplit = _chunkYNSK4MGTcjs.planarSplit; exports.playWebAnimations = playWebAnimations; exports.pointInBezierPath = _chunkYNSK4MGTcjs.pointInBezierPath; exports.pointInMultiPolygon = _chunkYNSK4MGTcjs.pointInMultiPolygon; exports.pointInRings = _chunkYNSK4MGTcjs.pointInRings; exports.polygonArea = _chunkYNSK4MGTcjs.polygonArea; exports.polygonBoolean = _chunkYNSK4MGTcjs.polygonBoolean; exports.polygonToSvgPath = _chunkYNSK4MGTcjs.polygonToSvgPath; exports.positionToSide = positionToSide; exports.pruneCanvasTokenModes = pruneCanvasTokenModes; exports.pushCanvasInstanceOverrides = pushCanvasInstanceOverrides; exports.readAnimatableValue = readAnimatableValue; exports.readNodeStyleProperty = readNodeStyleProperty; exports.readOverrideGroup = readOverrideGroup; exports.readStyleSize = readStyleSize; exports.realClock = _chunkO4ONBPZWcjs.realClock; exports.recordAnimationChanges = recordAnimationChanges; exports.relayoutUpdates = relayoutUpdates; exports.remapPastedNodes = remapPastedNodes; exports.removeCanvasVariant = removeCanvasVariant; exports.removeTrack = removeTrack; exports.renameCanvasVariantProperty = renameCanvasVariantProperty; exports.renameCanvasVariantValue = renameCanvasVariantValue; exports.reorderNodes = reorderNodes; exports.repositionNodesTo = repositionNodesTo; exports.resetCanvasInstanceOverrides = resetCanvasInstanceOverrides; exports.resizeHandleAxes = resizeHandleAxes; exports.resolveCanvasGradient = _chunkYNSK4MGTcjs.resolveCanvasGradient; exports.resolveCanvasTokens = resolveCanvasTokens; exports.resolveEasing = _chunkXZ4L3R4Kcjs.resolveEasing; exports.resolveMermaidStyles = resolveMermaidStyles; exports.resolvePadding = resolvePadding; exports.restoreCanvasMainComponent = restoreCanvasMainComponent; exports.revertShapeCombination = revertShapeCombination; exports.rgbToOklab = _chunkMR3Z4OQIcjs.rgbToOklab; exports.ringSignedArea = _chunkYNSK4MGTcjs.ringSignedArea; exports.runMultiNodeTransition = runMultiNodeTransition; exports.sampleAnimationFrames = sampleAnimationFrames; exports.scaleKeyframes = scaleKeyframes; exports.segmentBounds = _chunkYNSK4MGTcjs.segmentBounds; exports.segmentCurvature = _chunkYNSK4MGTcjs.segmentCurvature; exports.segmentDerivative = _chunkYNSK4MGTcjs.segmentDerivative; exports.segmentExtrema = _chunkYNSK4MGTcjs.segmentExtrema; exports.segmentIntersections = _chunkYNSK4MGTcjs.segmentIntersections; exports.segmentLength = _chunkYNSK4MGTcjs.segmentLength; exports.segmentNearest = _chunkYNSK4MGTcjs.segmentNearest; exports.segmentParamAtLength = _chunkYNSK4MGTcjs.segmentParamAtLength; exports.segmentPoint = _chunkYNSK4MGTcjs.segmentPoint; exports.segmentTangent = _chunkYNSK4MGTcjs.segmentTangent; exports.serializeCanvasNodes = serializeCanvasNodes; exports.setCanvasComponentProperty = setCanvasComponentProperty; exports.setCanvasInstanceProperties = setCanvasInstanceProperties; exports.setCanvasTokenMode = setCanvasTokenMode; exports.setCanvasVariantProperties = setCanvasVariantProperties; exports.setKeyframe = setKeyframe; exports.setKeyframeEasing = setKeyframeEasing; exports.setMotionPath = setMotionPath; exports.setTrackEnabled = setTrackEnabled; exports.shapeNodeToBezierPath = shapeNodeToBezierPath; exports.shapeNodeToPolygon = shapeNodeToPolygon; exports.shapeToBezierPath = shapeToBezierPath; exports.shapeToPolygon = _chunkYNSK4MGTcjs.shapeToPolygon; exports.sideToPosition = sideToPosition; exports.simplifyRing = _chunkYNSK4MGTcjs.simplifyRing; exports.snapKeyframeDelta = snapKeyframeDelta; exports.snapNodeDrag = snapNodeDrag; exports.snapNodeResize = snapNodeResize; exports.snapResize = snapResize; exports.snapTimeToFrame = snapTimeToFrame; exports.snapToGrid = snapToGrid; exports.splitSegment = _chunkYNSK4MGTcjs.splitSegment; exports.springAt = _chunkXZ4L3R4Kcjs.springAt; exports.streamedDiagramText = streamedDiagramText; exports.streamlinePoints = streamlinePoints; exports.strokeBoundingBox = strokeBoundingBox; exports.strokeOutlineRings = _chunkYNSK4MGTcjs.strokeOutlineRings; exports.strokePointsToPathData = strokePointsToPathData; exports.strokeToShapeNode = strokeToShapeNode; exports.subSegment = _chunkYNSK4MGTcjs.subSegment; exports.subtractPaths = _chunkYNSK4MGTcjs.subtractPaths; exports.subtractPolygons = _chunkYNSK4MGTcjs.subtractPolygons; exports.swapCanvasInstance = swapCanvasInstance; exports.syncAllCanvasInstances = syncAllCanvasInstances; exports.syncCanvasComponents = syncCanvasComponents; exports.syncCanvasInstance = syncCanvasInstance; exports.timeToX = timeToX; exports.toBezierPath = _chunkYNSK4MGTcjs.toBezierPath; exports.toWebAnimations = toWebAnimations; exports.toggleLockNodes = toggleLockNodes; exports.transformBezierPath = _chunkYNSK4MGTcjs.transformBezierPath; exports.trimSegments = _chunkYNSK4MGTcjs.trimSegments; exports.unionPolygons = _chunkYNSK4MGTcjs.unionPolygons; exports.unitePaths = _chunkYNSK4MGTcjs.unitePaths; exports.unlockNodes = unlockNodes; exports.updateKeyframe = updateKeyframe; exports.windingNumber = _chunkYNSK4MGTcjs.windingNumber; exports.withNodeAnimation = withNodeAnimation; exports.withStyleOpacity = withStyleOpacity; exports.withStyleSize = withStyleSize; exports.wouldCreateComponentCycle = wouldCreateComponentCycle; exports.wrapAnimationTime = _chunkO4ONBPZWcjs.wrapAnimationTime; exports.writeNodeStyleProperty = writeNodeStyleProperty; exports.writeOverrideGroup = writeOverrideGroup; exports.xToTime = xToTime; exports.xorPolygons = _chunkYNSK4MGTcjs.xorPolygons;
9875
+
9876
+
9877
+
9878
+
9879
+
9880
+
9881
+
9882
+
9883
+
9884
+ exports.ANIMATABLE_PROPERTIES = ANIMATABLE_PROPERTIES; exports.ANIMATION_DATA_KEY = ANIMATION_DATA_KEY; exports.ANIMATION_EASING_LABELS = _chunkXZ4L3R4Kcjs.ANIMATION_EASING_LABELS; exports.ANIMATION_EASING_PRESETS = _chunkXZ4L3R4Kcjs.ANIMATION_EASING_PRESETS; exports.ANIMATION_TIME_EPSILON = _chunkO4ONBPZWcjs.ANIMATION_TIME_EPSILON; exports.AUTO_LAYOUT_DATA_KEY = AUTO_LAYOUT_DATA_KEY; exports.AnimationEditError = AnimationEditError; exports.AnimationPlayer = _chunkO4ONBPZWcjs.AnimationPlayer; exports.CANVAS_COMPONENT_DRAG_TYPE = CANVAS_COMPONENT_DRAG_TYPE; exports.CANVAS_GRADIENT_PRESETS = _chunkO2UH7LZEcjs.CANVAS_GRADIENT_PRESETS; exports.CANVAS_TOKEN_PROPERTIES = CANVAS_TOKEN_PROPERTIES; exports.CARD_INSPECTION_ZONES = CARD_INSPECTION_ZONES; exports.CHILD_LAYOUT_DATA_KEY = CHILD_LAYOUT_DATA_KEY; exports.COMPONENT_DATA_KEY = COMPONENT_DATA_KEY; exports.COMPONENT_OVERRIDES_DATA_KEY = COMPONENT_OVERRIDES_DATA_KEY; exports.COMPONENT_PROPERTY_REFS_DATA_KEY = COMPONENT_PROPERTY_REFS_DATA_KEY; exports.COMPONENT_SET_DATA_KEY = COMPONENT_SET_DATA_KEY; exports.COMPONENT_SOURCE_DATA_KEY = COMPONENT_SOURCE_DATA_KEY; exports.CONNECTION_LINE_TYPES = CONNECTION_LINE_TYPES; exports.CSS_ANIMATION_PROPERTIES = CSS_ANIMATION_PROPERTIES; exports.CUBIC_BEZIER_PRESETS = _chunkXZ4L3R4Kcjs.CUBIC_BEZIER_PRESETS; exports.CanvasScenesStore = CanvasScenesStore; exports.DEFAULT_ARRANGE_SHORTCUTS = _chunk26BVFKHUcjs.DEFAULT_ARRANGE_SHORTCUTS; exports.DEFAULT_CURSOR_INACTIVITY_MS = DEFAULT_CURSOR_INACTIVITY_MS; exports.DEFAULT_DIAGRAM_NODE_HEIGHT = DEFAULT_DIAGRAM_NODE_HEIGHT; exports.DEFAULT_DIAGRAM_NODE_WIDTH = DEFAULT_DIAGRAM_NODE_WIDTH; exports.DEFAULT_NODE_HEIGHT = _chunkWADCJ7A7cjs.DEFAULT_NODE_HEIGHT; exports.DEFAULT_NODE_WIDTH = _chunkWADCJ7A7cjs.DEFAULT_NODE_WIDTH; exports.DEFAULT_PLACEMENT_GAP = _chunkWADCJ7A7cjs.DEFAULT_PLACEMENT_GAP; exports.DIAGRAM_RASTER_MAX_SIZE = DIAGRAM_RASTER_MAX_SIZE; exports.DIAGRAM_SVG_DARK_THEME = DIAGRAM_SVG_DARK_THEME; exports.DIAGRAM_SVG_LIGHT_THEME = DIAGRAM_SVG_LIGHT_THEME; exports.DiagramStream = DiagramStream; exports.INSTANCE_DATA_KEY = INSTANCE_DATA_KEY; exports.LOCKED_DATA_KEY = LOCKED_DATA_KEY; exports.LOCKED_PREVIOUS_FLAGS_KEY = LOCKED_PREVIOUS_FLAGS_KEY; exports.MAX_KEYFRAME_REFS = MAX_KEYFRAME_REFS; exports.MERMAID_SHAPE_PAINT = MERMAID_SHAPE_PAINT; exports.ManualClock = _chunkO4ONBPZWcjs.ManualClock; exports.PATHFINDER_OPERATIONS = _chunkMLREO6J3cjs.PATHFINDER_OPERATIONS; exports.PIXERATE_BRAND_GRADIENT = _chunkO2UH7LZEcjs.PIXERATE_BRAND_GRADIENT; exports.PathOpsError = _chunkO2UH7LZEcjs.PathOpsError; exports.PlanarMap = _chunkMLREO6J3cjs.PlanarMap; exports.RESIZE_HANDLES = RESIZE_HANDLES; exports.SHAPE_DATA_KEY = SHAPE_DATA_KEY; exports.SHAPE_KINDS = _chunkO2UH7LZEcjs.SHAPE_KINDS; exports.SHAPE_NODE_TYPE = SHAPE_NODE_TYPE; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.StreamingLayoutManager = StreamingLayoutManager; exports.TOKEN_BINDINGS_DATA_KEY = TOKEN_BINDINGS_DATA_KEY; exports.TOKEN_MODES_DATA_KEY = TOKEN_MODES_DATA_KEY; exports.addCanvasVariant = addCanvasVariant; exports.addKeyframesAtTime = addKeyframesAtTime; exports.alignNodes = alignNodes; exports.angleToSvgLinearCoords = _chunkO2UH7LZEcjs.angleToSvgLinearCoords; exports.animateNode = animateNode; exports.applyAnimation = applyAnimation; exports.applyAnimationOverrides = applyAnimationOverrides; exports.applyConstraints = applyConstraints; exports.applyNodeUpdates = applyNodeUpdates; exports.applyShapeCombination = applyShapeCombination; exports.applyShapeReplacement = applyShapeReplacement; exports.arcToCubics = _chunkO2UH7LZEcjs.arcToCubics; exports.autoLayoutDiagram = autoLayoutDiagram; exports.bezierPathArea = _chunkO2UH7LZEcjs.bezierPathArea; exports.bezierPathBounds = _chunkO2UH7LZEcjs.bezierPathBounds; exports.bezierPathLength = _chunkO2UH7LZEcjs.bezierPathLength; exports.bezierPathPointAtLength = _chunkO2UH7LZEcjs.bezierPathPointAtLength; exports.bezierPathSignedArea = _chunkO2UH7LZEcjs.bezierPathSignedArea; exports.bezierPathToSvg = _chunkO2UH7LZEcjs.bezierPathToSvg; exports.bindCanvasComponentProperty = bindCanvasComponentProperty; exports.bindCanvasToken = bindCanvasToken; exports.blendDiagramLayout = blendDiagramLayout; exports.blendLayout = blendLayout; exports.boundsOf = _chunkWADCJ7A7cjs.boundsOf; exports.calculateCursorArrowRotation = calculateCursorArrowRotation; exports.calculateCurvedPath = calculateCurvedPath; exports.calculateDagreReflowDisplacement = calculateDagreReflowDisplacement; exports.calculateDirectionalDisplacement = calculateDirectionalDisplacement; exports.canCombineShapeNodes = canCombineShapeNodes; exports.canOffsetShapeNodes = canOffsetShapeNodes; exports.canOutlineShapeNodeStrokes = canOutlineShapeNodeStrokes; exports.canvasHeight = canvasHeight; exports.centerNodes = _chunkWADCJ7A7cjs.centerNodes; exports.centre = _chunkWADCJ7A7cjs.centre; exports.clampAnimationValue = clampAnimationValue; exports.clampLayoutSize = clampLayoutSize; exports.closeContour = _chunkO2UH7LZEcjs.closeContour; exports.collectDescendantIds = collectDescendantIds; exports.combineCanvasComponentsAsVariants = combineCanvasComponentsAsVariants; exports.combineShapeNodes = combineShapeNodes; exports.computeNodesBoundingBox = computeNodesBoundingBox; exports.computeSnapGuides = computeSnapGuides; exports.connectedDiagramOnly = connectedDiagramOnly; exports.connectedOnly = connectedOnly; exports.contourEnclosesArea = _chunkMLREO6J3cjs.contourEnclosesArea; exports.contourSignedArea = _chunkO2UH7LZEcjs.contourSignedArea; exports.contoursToPath = _chunkO2UH7LZEcjs.contoursToPath; exports.copyKeyframes = copyKeyframes; exports.countPathSegments = _chunkO2UH7LZEcjs.countPathSegments; exports.createAnimationPlayer = _chunkO4ONBPZWcjs.createAnimationPlayer; exports.createBezierTrajectory = createBezierTrajectory; exports.createCanvasAnimationController = createCanvasAnimationController; exports.createCanvasArrangeController = createCanvasArrangeController; exports.createCanvasAutoLayoutController = createCanvasAutoLayoutController; exports.createCanvasComponent = createCanvasComponent; exports.createCanvasComponentsController = createCanvasComponentsController; exports.createCanvasDrawController = createCanvasDrawController; exports.createCanvasInstance = createCanvasInstance; exports.createCanvasScenesStore = createCanvasScenesStore; exports.createDefaultStrokeStyle = createDefaultStrokeStyle; exports.createFanOutTrajectory = createFanOutTrajectory; exports.createGuideIndex = createGuideIndex; exports.createNodeGuideIndex = createNodeGuideIndex; exports.createNodeLookup = createNodeLookup; exports.cubicBezierAt = _chunkXZ4L3R4Kcjs.cubicBezierAt; exports.cubicPointAt = _chunkO2UH7LZEcjs.cubicPointAt; exports.cubicsToPathData = _chunkO2UH7LZEcjs.cubicsToPathData; exports.cutOutPiece = _chunkMLREO6J3cjs.cutOutPiece; exports.dashContours = _chunkO2UH7LZEcjs.dashContours; exports.defaultEasing = defaultEasing; exports.deleteKeyframes = deleteKeyframes; exports.detachCanvasInstance = detachCanvasInstance; exports.detachTokenBindings = detachTokenBindings; exports.diagramCanvasHeight = diagramCanvasHeight; exports.diagramFileName = diagramFileName; exports.diagramGroupSize = diagramGroupSize; exports.diagramImageSize = diagramImageSize; exports.diagramLayoutBounds = diagramLayoutBounds; exports.diffOverrideGroups = diffOverrideGroups; exports.distanceToBezierPath = _chunkO2UH7LZEcjs.distanceToBezierPath; exports.distributeNodes = distributeNodes; exports.dividePaths = _chunkO2UH7LZEcjs.dividePaths; exports.dividePolygons = _chunkO2UH7LZEcjs.dividePolygons; exports.downloadDiagramPng = downloadDiagramPng; exports.easeDiagramTween = easeDiagramTween; exports.easingFromInfluence = _chunkXZ4L3R4Kcjs.easingFromInfluence; exports.easingLabel = _chunkXZ4L3R4Kcjs.easingLabel; exports.easingToCss = _chunkXZ4L3R4Kcjs.easingToCss; exports.elasticAt = _chunkXZ4L3R4Kcjs.elasticAt; exports.ensureDiagramLayout = ensureDiagramLayout; exports.ensureLayout = _chunkWADCJ7A7cjs.ensureLayout; exports.estimateCanvasHeight = estimateCanvasHeight; exports.estimateDiagramCanvasHeight = estimateDiagramCanvasHeight; exports.estimateDiagramNodeSize = estimateDiagramNodeSize; exports.estimateNodeSize = _chunkWADCJ7A7cjs.estimateNodeSize; exports.evaluateAnimation = evaluateAnimation; exports.evaluateEasing = _chunkXZ4L3R4Kcjs.evaluateEasing; exports.evaluateTrack = _chunkO4ONBPZWcjs.evaluateTrack; exports.excludePaths = _chunkO2UH7LZEcjs.excludePaths; exports.exportCssAnimation = exportCssAnimation; exports.findConnectorSnap = findConnectorSnap; exports.findStrokesAtPoint = findStrokesAtPoint; exports.findVariant = findVariant; exports.fitCubicRun = _chunkO2UH7LZEcjs.fitCubicRun; exports.fitCubicWithTangents = _chunkO2UH7LZEcjs.fitCubicWithTangents; exports.fitCubics = _chunkO2UH7LZEcjs.fitCubics; exports.fitFreehandPath = _chunkO2UH7LZEcjs.fitFreehandPath; exports.fitPathData = _chunkO2UH7LZEcjs.fitPathData; exports.fitViewportToNodes = fitViewportToNodes; exports.fitViewportToRect = fitViewportToRect; exports.flattenSvgPath = _chunkO2UH7LZEcjs.flattenSvgPath; exports.flowSide = _chunkWADCJ7A7cjs.flowSide; exports.formatAgentCursorName = formatAgentCursorName; exports.formatAnimationTime = formatAnimationTime; exports.formatNumber = _chunkO2UH7LZEcjs.formatNumber; exports.formatOklab = _chunkMR3Z4OQIcjs.formatOklab; exports.formatVariantName = formatVariantName; exports.getAbsolutePosition = getAbsolutePosition; exports.getAgentCardAnchor = getAgentCardAnchor; exports.getAnimatableProperty = getAnimatableProperty; exports.getAnimatedProperties = getAnimatedProperties; exports.getAnimatedValue = getAnimatedValue; exports.getAnimationDuration = getAnimationDuration; exports.getAnimationTrack = getAnimationTrack; exports.getAutoLayout = getAutoLayout; exports.getAutoLayoutGrid = getAutoLayoutGrid; exports.getAutoLayoutInsertTarget = getAutoLayoutInsertTarget; exports.getBindableTokenProperties = getBindableTokenProperties; exports.getCanvasComponentDragId = getCanvasComponentDragId; exports.getCanvasTokenProperty = getCanvasTokenProperty; exports.getCenteredNodePosition = _chunkWADCJ7A7cjs.getCenteredNodePosition; exports.getChildLayout = getChildLayout; exports.getComponentData = getComponentData; exports.getComponentInstances = getComponentInstances; exports.getComponentPropertyDefs = getComponentPropertyDefs; exports.getComponentPropertyRefs = getComponentPropertyRefs; exports.getComponentSourceId = getComponentSourceId; exports.getCssPropertyAnimations = getCssPropertyAnimations; exports.getCursorTransitionDuration = getCursorTransitionDuration; exports.getDefaultVariant = getDefaultVariant; exports.getEffectiveTokenModes = getEffectiveTokenModes; exports.getFlowChildren = getFlowChildren; exports.getInstanceData = getInstanceData; exports.getInstanceProperties = getInstanceProperties; exports.getInstanceStatus = getInstanceStatus; exports.getKeyframeTimes = getKeyframeTimes; exports.getLayerName = getLayerName; exports.getLayoutParent = getLayoutParent; exports.getLayoutSizing = getLayoutSizing; exports.getLayoutedNodes = _chunkWADCJ7A7cjs.getLayoutedNodes; exports.getNaturalMovementTiming = getNaturalMovementTiming; exports.getNextVariantValues = getNextVariantValues; exports.getNodeAnimation = getNodeAnimation; exports.getNodeOverrides = getNodeOverrides; exports.getNodeRect = getNodeRect; exports.getNodeShape = getNodeShape; exports.getNodeSize = getNodeSize; exports.getNodeTokenBindings = getNodeTokenBindings; exports.getNodeTokenModes = getNodeTokenModes; exports.getOwningComponent = getOwningComponent; exports.getOwningInstance = getOwningInstance; exports.getResizingNodeRect = getResizingNodeRect; exports.getRootInstance = getRootInstance; exports.getShapeRenderData = _chunkO2UH7LZEcjs.getShapeRenderData; exports.getShapeSvg = _chunkO2UH7LZEcjs.getShapeSvg; exports.getTimelineRows = getTimelineRows; exports.getTimelineTicks = getTimelineTicks; exports.getTokenPropertyScope = getTokenPropertyScope; exports.getTokensForProperty = getTokensForProperty; exports.getVariantConflicts = getVariantConflicts; exports.getVariantOptions = getVariantOptions; exports.getVariantSet = getVariantSet; exports.getVariantValues = getVariantValues; exports.gradientToSvgDef = _chunkO2UH7LZEcjs.gradientToSvgDef; exports.handlePoint = handlePoint; exports.hasVisibleStroke = hasVisibleStroke; exports.hashString = hashString; exports.hatchPath = _chunkMLREO6J3cjs.hatchPath; exports.inferResizeHandle = inferResizeHandle; exports.inspectCanvasInstance = inspectCanvasInstance; exports.inspectNodeTokens = inspectNodeTokens; exports.interiorPoint = _chunkMLREO6J3cjs.interiorPoint; exports.interpolateAnimationValue = _chunkO4ONBPZWcjs.interpolateAnimationValue; exports.intersectPaths = _chunkO2UH7LZEcjs.intersectPaths; exports.intersectPolygons = _chunkO2UH7LZEcjs.intersectPolygons; exports.invertNodeUpdates = invertNodeUpdates; exports.isAgentCursor = isAgentCursor; exports.isAnimationEasing = _chunkXZ4L3R4Kcjs.isAnimationEasing; exports.isAnimationKeyframe = _chunkO4ONBPZWcjs.isAnimationKeyframe; exports.isAutoLayoutFrame = isAutoLayoutFrame; exports.isCanvasComponent = isCanvasComponent; exports.isCanvasComponentSet = isCanvasComponentSet; exports.isCanvasGradient = _chunkO2UH7LZEcjs.isCanvasGradient; exports.isCanvasInstance = isCanvasInstance; exports.isCssExportExact = isCssExportExact; exports.isEventFromTextInput = isEventFromTextInput; exports.isInsideInstance = isInsideInstance; exports.isKeyframeSelected = isKeyframeSelected; exports.isLocked = isLocked; exports.isMeasureModifierHeld = isMeasureModifierHeld; exports.isNodeAnimated = isNodeAnimated; exports.isShapeDescription = _chunkO2UH7LZEcjs.isShapeDescription; exports.isShapeNode = isShapeNode; exports.isStraightCubic = _chunkO2UH7LZEcjs.isStraightCubic; exports.isValidCanvasEdge = isValidCanvasEdge; exports.isValidCanvasNode = isValidCanvasNode; exports.isValidCanvasScene = isValidCanvasScene; exports.isValidUrl = isValidUrl; exports.layoutAll = layoutAll; exports.layoutBounds = layoutBounds; exports.layoutFrame = layoutFrame; exports.layoutUp = layoutUp; exports.layoutUpMany = layoutUpMany; exports.linearPositionTrajectory = linearPositionTrajectory; exports.linearTrajectory = linearTrajectory; exports.listCanvasComponents = listCanvasComponents; exports.lockNodes = lockNodes; exports.makeSizingCoherent = makeSizingCoherent; exports.matchArrangeShortcut = _chunk26BVFKHUcjs.matchArrangeShortcut; exports.matchSize = matchSize; exports.measureBetween = measureBetween; exports.measureLabel = measureLabel; exports.measureSelection = measureSelection; exports.measureToLine = measureToLine; exports.mergeNodeUpdates = mergeNodeUpdates; exports.mermaidEdgeDash = mermaidEdgeDash; exports.mermaidEdgeMarker = mermaidEdgeMarker; exports.mermaidEdgeWidth = mermaidEdgeWidth; exports.mermaidFlowEdges = mermaidFlowEdges; exports.mermaidFlowNodes = mermaidFlowNodes; exports.mermaidLabelLines = mermaidLabelLines; exports.mermaidMarkerId = mermaidMarkerId; exports.mermaidMovesFromCanvas = mermaidMovesFromCanvas; exports.mermaidNodeMembers = mermaidNodeMembers; exports.mermaidNodePaint = mermaidNodePaint; exports.mermaidShapePaths = mermaidShapePaths; exports.mermaidThumbnailSvg = mermaidThumbnailSvg; exports.mermaidToCanvas = mermaidToCanvas; exports.mermaidToSvg = mermaidToSvg; exports.mixColorsOklab = _chunkMR3Z4OQIcjs.mixColorsOklab; exports.moveKeyframes = moveKeyframes; exports.moveLayoutChild = moveLayoutChild; exports.multiPolygonArea = _chunkO2UH7LZEcjs.multiPolygonArea; exports.multiPolygonBounds = _chunkO2UH7LZEcjs.multiPolygonBounds; exports.nearestHandlePositions = nearestHandlePositions; exports.normalizeBezierPath = _chunkO2UH7LZEcjs.normalizeBezierPath; exports.normalizeKeyframes = _chunkO4ONBPZWcjs.normalizeKeyframes; exports.offsetPath = _chunkO2UH7LZEcjs.offsetPath; exports.offsetShapeNodes = offsetShapeNodes; exports.oklabToRgb = _chunkMR3Z4OQIcjs.oklabToRgb; exports.oppositePosition = oppositePosition; exports.outlineShapeNodeStrokes = outlineShapeNodeStrokes; exports.outlineStroke = _chunkO2UH7LZEcjs.outlineStroke; exports.overlaps = _chunkWADCJ7A7cjs.overlaps; exports.pageHidden = _chunkO4ONBPZWcjs.pageHidden; exports.parseCanvasClipboardData = parseCanvasClipboardData; exports.parseCanvasScenes = parseCanvasScenes; exports.parseCssEasing = _chunkXZ4L3R4Kcjs.parseCssEasing; exports.parseCssGradient = _chunkO2UH7LZEcjs.parseCssGradient; exports.parseKeyframeClipboard = parseKeyframeClipboard; exports.parseMermaidStyles = parseMermaidStyles; exports.parseNodeStyleDeclarations = parseNodeStyleDeclarations; exports.parseOklab = _chunkMR3Z4OQIcjs.parseOklab; exports.parseSvgPath = _chunkO2UH7LZEcjs.parseSvgPath; exports.parseVariantName = parseVariantName; exports.pasteKeyframes = pasteKeyframes; exports.pathBoolean = _chunkO2UH7LZEcjs.pathBoolean; exports.pathBooleanSelect = _chunkO2UH7LZEcjs.pathBooleanSelect; exports.pathToContours = _chunkO2UH7LZEcjs.pathToContours; exports.pathfinder = _chunkMLREO6J3cjs.pathfinder; exports.placeBeside = _chunkWADCJ7A7cjs.placeBeside; exports.planarSplit = _chunkO2UH7LZEcjs.planarSplit; exports.playWebAnimations = playWebAnimations; exports.pointInBezierPath = _chunkO2UH7LZEcjs.pointInBezierPath; exports.pointInMultiPolygon = _chunkO2UH7LZEcjs.pointInMultiPolygon; exports.pointInRings = _chunkO2UH7LZEcjs.pointInRings; exports.polygonArea = _chunkO2UH7LZEcjs.polygonArea; exports.polygonBoolean = _chunkO2UH7LZEcjs.polygonBoolean; exports.polygonToSvgPath = _chunkO2UH7LZEcjs.polygonToSvgPath; exports.positionToSide = positionToSide; exports.pruneCanvasTokenModes = pruneCanvasTokenModes; exports.pushCanvasInstanceOverrides = pushCanvasInstanceOverrides; exports.rasterSize = rasterSize; exports.rasterizeSvg = rasterizeSvg; exports.readAnimatableValue = readAnimatableValue; exports.readNodeStyleProperty = readNodeStyleProperty; exports.readOverrideGroup = readOverrideGroup; exports.readStyleSize = readStyleSize; exports.realClock = _chunkO4ONBPZWcjs.realClock; exports.recordAnimationChanges = recordAnimationChanges; exports.relayoutUpdates = relayoutUpdates; exports.remapPastedNodes = remapPastedNodes; exports.removeCanvasVariant = removeCanvasVariant; exports.removeTrack = removeTrack; exports.renameCanvasVariantProperty = renameCanvasVariantProperty; exports.renameCanvasVariantValue = renameCanvasVariantValue; exports.reorderNodes = reorderNodes; exports.repositionNodesTo = repositionNodesTo; exports.resetCanvasInstanceOverrides = resetCanvasInstanceOverrides; exports.resizeHandleAxes = resizeHandleAxes; exports.resolveCanvasGradient = _chunkO2UH7LZEcjs.resolveCanvasGradient; exports.resolveCanvasTokens = resolveCanvasTokens; exports.resolveEasing = _chunkXZ4L3R4Kcjs.resolveEasing; exports.resolveMermaidStyles = resolveMermaidStyles; exports.resolvePadding = resolvePadding; exports.restoreCanvasMainComponent = restoreCanvasMainComponent; exports.revertShapeCombination = revertShapeCombination; exports.rgbToOklab = _chunkMR3Z4OQIcjs.rgbToOklab; exports.ringSignedArea = _chunkO2UH7LZEcjs.ringSignedArea; exports.runMultiNodeTransition = runMultiNodeTransition; exports.sampleAnimationFrames = sampleAnimationFrames; exports.scaleKeyframes = scaleKeyframes; exports.segmentBounds = _chunkO2UH7LZEcjs.segmentBounds; exports.segmentCurvature = _chunkO2UH7LZEcjs.segmentCurvature; exports.segmentDerivative = _chunkO2UH7LZEcjs.segmentDerivative; exports.segmentExtrema = _chunkO2UH7LZEcjs.segmentExtrema; exports.segmentIntersections = _chunkO2UH7LZEcjs.segmentIntersections; exports.segmentLength = _chunkO2UH7LZEcjs.segmentLength; exports.segmentNearest = _chunkO2UH7LZEcjs.segmentNearest; exports.segmentParamAtLength = _chunkO2UH7LZEcjs.segmentParamAtLength; exports.segmentPoint = _chunkO2UH7LZEcjs.segmentPoint; exports.segmentTangent = _chunkO2UH7LZEcjs.segmentTangent; exports.serializeCanvasNodes = serializeCanvasNodes; exports.setCanvasComponentProperty = setCanvasComponentProperty; exports.setCanvasInstanceProperties = setCanvasInstanceProperties; exports.setCanvasTokenMode = setCanvasTokenMode; exports.setCanvasVariantProperties = setCanvasVariantProperties; exports.setKeyframe = setKeyframe; exports.setKeyframeEasing = setKeyframeEasing; exports.setMotionPath = setMotionPath; exports.setTrackEnabled = setTrackEnabled; exports.shapeNodeToBezierPath = shapeNodeToBezierPath; exports.shapeNodeToPolygon = shapeNodeToPolygon; exports.shapeToBezierPath = shapeToBezierPath; exports.shapeToPolygon = _chunkO2UH7LZEcjs.shapeToPolygon; exports.sideToPosition = sideToPosition; exports.simplifyRing = _chunkO2UH7LZEcjs.simplifyRing; exports.snapKeyframeDelta = snapKeyframeDelta; exports.snapNodeDrag = snapNodeDrag; exports.snapNodeResize = snapNodeResize; exports.snapResize = snapResize; exports.snapTimeToFrame = snapTimeToFrame; exports.snapToGrid = snapToGrid; exports.splitSegment = _chunkO2UH7LZEcjs.splitSegment; exports.springAt = _chunkXZ4L3R4Kcjs.springAt; exports.streamedDiagramText = streamedDiagramText; exports.streamlinePoints = streamlinePoints; exports.strokeBoundingBox = strokeBoundingBox; exports.strokeOutlineRings = _chunkO2UH7LZEcjs.strokeOutlineRings; exports.strokePointsToPathData = strokePointsToPathData; exports.strokeToShapeNode = strokeToShapeNode; exports.subSegment = _chunkO2UH7LZEcjs.subSegment; exports.subtractPaths = _chunkO2UH7LZEcjs.subtractPaths; exports.subtractPolygons = _chunkO2UH7LZEcjs.subtractPolygons; exports.swapCanvasInstance = swapCanvasInstance; exports.syncAllCanvasInstances = syncAllCanvasInstances; exports.syncCanvasComponents = syncCanvasComponents; exports.syncCanvasInstance = syncCanvasInstance; exports.timeToX = timeToX; exports.toBezierPath = _chunkO2UH7LZEcjs.toBezierPath; exports.toWebAnimations = toWebAnimations; exports.toggleLockNodes = toggleLockNodes; exports.transformBezierPath = _chunkO2UH7LZEcjs.transformBezierPath; exports.trimSegments = _chunkO2UH7LZEcjs.trimSegments; exports.unionPolygons = _chunkO2UH7LZEcjs.unionPolygons; exports.unitePaths = _chunkO2UH7LZEcjs.unitePaths; exports.unlockNodes = unlockNodes; exports.updateKeyframe = updateKeyframe; exports.windingNumber = _chunkO2UH7LZEcjs.windingNumber; exports.withNodeAnimation = withNodeAnimation; exports.withStyleOpacity = withStyleOpacity; exports.withStyleSize = withStyleSize; exports.wouldCreateComponentCycle = wouldCreateComponentCycle; exports.wrapAnimationTime = _chunkO4ONBPZWcjs.wrapAnimationTime; exports.writeNodeStyleProperty = writeNodeStyleProperty; exports.writeOverrideGroup = writeOverrideGroup; exports.xToTime = xToTime; exports.xorPolygons = _chunkO2UH7LZEcjs.xorPolygons;
9658
9885
  //# sourceMappingURL=index.cjs.map