@miragon/wardley-renderer 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -46,7 +46,6 @@ var E = {
46
46
  linie: "#E6E2E2",
47
47
  kontur: "#8F8A8A",
48
48
  textLeise: "#6B6666",
49
- navy: "#080A20",
50
49
  gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
51
50
  }, D = {
52
51
  width: i.width,
@@ -1145,7 +1144,7 @@ var tn = class {
1145
1144
  };
1146
1145
  // src/WardleyBaseViewer.ts
1147
1146
  function nn(e) {
1148
- let t = e.undoRedoKeys ?? e.keyboard?.undoRedo, n = e.freeArea ? e.freeArea.insets ? { insets: e.freeArea.insets } : { center: e.freeArea.center } : e.freeRectInsets ? { insets: e.freeRectInsets } : void 0;
1147
+ let t = e.undoRedoKeys, n = e.freeArea ? e.freeArea.insets ? { insets: e.freeArea.insets } : { center: e.freeArea.center } : void 0;
1149
1148
  return {
1150
1149
  ...t === void 0 ? {} : { wardleyKeyboard: { undoRedo: t } },
1151
1150
  ...n ? { wardleyFreeRect: n } : {},
@@ -1161,12 +1160,18 @@ function an(e) {
1161
1160
  function on(e) {
1162
1161
  return typeof e == "number" ? `${e}px` : e;
1163
1162
  }
1164
- var sn = class {
1163
+ var sn = /* @__PURE__ */ new Set(["lasso.selection"]), cn = 1e5;
1164
+ function ln(e, t) {
1165
+ let n = e.get("dragging", !1), r = n?.context();
1166
+ n && r && r !== t && (sn.has(r.prefix) || n.cancel(!1));
1167
+ }
1168
+ var un = class {
1165
1169
  _diagram;
1166
1170
  _container;
1167
1171
  _options;
1168
1172
  _labelsBeforePreview;
1169
1173
  _sizePreview;
1174
+ _dropping = null;
1170
1175
  constructor(e = {}) {
1171
1176
  this._options = e, this._container = this._createContainer(e);
1172
1177
  }
@@ -1181,10 +1186,20 @@ var sn = class {
1181
1186
  canvas: { container: this._container },
1182
1187
  modules: t,
1183
1188
  ...nn(this._options)
1184
- }), this._diagram.get("eventBus").on(bt, xt, () => this._putBackSizePreview());
1189
+ }), this._diagram.get("eventBus").on(bt, xt, () => this._putBackSizePreview()), this._markDrops(this._diagram);
1185
1190
  }
1186
1191
  return this._diagram;
1187
1192
  }
1193
+ _markDrops(e) {
1194
+ let t = e.get("dragging", !1);
1195
+ if (!t) return;
1196
+ let n = e.get("eventBus");
1197
+ n.on("drag.end", cn, () => {
1198
+ this._dropping = t.context();
1199
+ }), n.on("drag.cleanup", cn, () => {
1200
+ this._dropping = null;
1201
+ });
1202
+ }
1188
1203
  get(e) {
1189
1204
  return this._ensureDiagram().get(e);
1190
1205
  }
@@ -1196,7 +1211,7 @@ var sn = class {
1196
1211
  }
1197
1212
  async importMap(e) {
1198
1213
  let t = an(e), n = this._ensureDiagram(), r = n.get("eventBus"), i = n.get("wardleyImporter"), a = n.get("commandStack", !1), o = this._rootBusinessObject() ? this.exportMap() : void 0;
1199
- this._labelsBeforePreview = void 0, this._sizePreview = void 0, n.get("dragging", !1)?.cancel(!1), i.clear();
1214
+ this._labelsBeforePreview = void 0, this._sizePreview = void 0, ln(n, this._dropping), i.clear();
1200
1215
  let s;
1201
1216
  try {
1202
1217
  s = i.import(t);
@@ -1344,7 +1359,7 @@ function R(e) {
1344
1359
  y: e.y + e.height / 2
1345
1360
  };
1346
1361
  }
1347
- var cn = class extends ue {
1362
+ var dn = class extends ue {
1348
1363
  layoutConnection(e, t = {}) {
1349
1364
  let n = t.source ?? e.source, r = t.target ?? e.target;
1350
1365
  return super.layoutConnection(e, {
@@ -1353,23 +1368,23 @@ var cn = class extends ue {
1353
1368
  ...r ? { connectionEnd: R(r) } : {}
1354
1369
  });
1355
1370
  }
1356
- }, ln = { layouter: ["type", cn] }, un = /* @__PURE__ */ new Set([
1371
+ }, fn = { layouter: ["type", dn] }, pn = /* @__PURE__ */ new Set([
1357
1372
  "component",
1358
1373
  "anchor",
1359
1374
  "submap",
1360
1375
  "pipeline",
1361
1376
  "accelerator"
1362
1377
  ]);
1363
- function dn(e) {
1364
- return typeof e == "string" && un.has(e);
1378
+ function mn(e) {
1379
+ return typeof e == "string" && pn.has(e);
1365
1380
  }
1366
- function fn(e, t) {
1381
+ function hn(e, t) {
1367
1382
  if (!t.has(e)) return e;
1368
1383
  let n = / (\d+)$/.exec(e), r = n ? e.slice(0, n.index) : e, i = n ? Number(n[1]) + 1 : 2;
1369
1384
  for (; t.has(`${r} ${i}`);) i++;
1370
1385
  return `${r} ${i}`;
1371
1386
  }
1372
- var pn = class {
1387
+ var gn = class {
1373
1388
  elementFactory;
1374
1389
  grid;
1375
1390
  elementRegistry;
@@ -1382,25 +1397,25 @@ var pn = class {
1382
1397
  this.elementFactory = e, this.grid = t, this.elementRegistry = n;
1383
1398
  }
1384
1399
  uniqueLabel(e, t) {
1385
- return fn(e, this.takenLinkableLabels(t, this.pairableTypeFor(t)));
1400
+ return hn(e, this.takenLinkableLabels(t, this.pairableTypeFor(t)));
1386
1401
  }
1387
1402
  uniqueLabels(e) {
1388
1403
  let t = this.takenLinkableLabels();
1389
1404
  return e.map(({ type: e, label: n }) => {
1390
- if (!dn(e)) return n;
1391
- let r = fn(n, t);
1405
+ if (!mn(e)) return n;
1406
+ let r = hn(n, t);
1392
1407
  return t.add(r), r;
1393
1408
  });
1394
1409
  }
1395
1410
  isLinkable(e) {
1396
- return dn(e);
1411
+ return mn(e);
1397
1412
  }
1398
1413
  takenLinkableLabels(e, t) {
1399
1414
  let n = /* @__PURE__ */ new Set();
1400
1415
  for (let r of this.elementRegistry.getAll()) {
1401
1416
  if (e && r.id === e) continue;
1402
1417
  let { wardleyType: i, wardleyLabel: a } = r;
1403
- dn(i) && typeof a == "string" && (i === t && this.isUnpaired(r) || n.add(a));
1418
+ mn(i) && typeof a == "string" && (i === t && this.isUnpaired(r) || n.add(a));
1404
1419
  }
1405
1420
  return n;
1406
1421
  }
@@ -1552,7 +1567,7 @@ var pn = class {
1552
1567
  });
1553
1568
  }
1554
1569
  createNew(e, t, n = {}) {
1555
- let r = e === "attitude" ? n.attitudeKind ?? "pioneers" : dn(e) ? this.uniqueLabel(t) : t;
1570
+ let r = e === "attitude" ? n.attitudeKind ?? "pioneers" : mn(e) ? this.uniqueLabel(t) : t;
1556
1571
  if (e === "pipeline") return this.elementFactory.createShape({
1557
1572
  width: 200,
1558
1573
  height: 30,
@@ -1639,24 +1654,24 @@ var pn = class {
1639
1654
  businessObject: t
1640
1655
  });
1641
1656
  }
1642
- }, mn = { wardleyElementFactory: ["type", pn] }, hn = "wardley-axes", gn = ["Invisible", "Visible"], _n = "wardley-axis", vn = "wardley-axis-text";
1643
- function yn(e) {
1657
+ }, _n = { wardleyElementFactory: ["type", gn] }, vn = "wardley-axes", yn = ["Invisible", "Visible"], bn = "wardley-axis", xn = "wardley-axis-text";
1658
+ function Sn(e) {
1644
1659
  return e < 0 ? 0 : e > 1 ? 1 : e;
1645
1660
  }
1646
- var bn = class {
1661
+ var Cn = class {
1647
1662
  canvas;
1648
1663
  static $inject = ["canvas"];
1649
1664
  boundaries = a;
1650
1665
  labels = n;
1651
1666
  yAxisLabel = "Value Chain";
1652
- yAxisEndLabels = gn;
1667
+ yAxisEndLabels = yn;
1653
1668
  plotWidth = D.width;
1654
1669
  plotHeight = D.height;
1655
1670
  constructor(e) {
1656
1671
  this.canvas = e;
1657
1672
  }
1658
1673
  configure(e) {
1659
- this.boundaries = e.stageBoundaries ?? a, this.labels = e.evolutionLabels ?? n, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ?? gn, this.plotWidth = p(e.size?.width, "width"), this.plotHeight = p(e.size?.height, "height");
1674
+ this.boundaries = e.stageBoundaries ?? a, this.labels = e.evolutionLabels ?? n, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ?? yn, this.plotWidth = p(e.size?.width, "width"), this.plotHeight = p(e.size?.height, "height");
1660
1675
  }
1661
1676
  toCanvas(e) {
1662
1677
  return {
@@ -1666,8 +1681,8 @@ var bn = class {
1666
1681
  }
1667
1682
  fromCanvas(e) {
1668
1683
  return {
1669
- evolution: yn((e.x - D.marginLeft) / this.plotWidth),
1670
- visibility: yn(1 - (e.y - D.marginTop) / this.plotHeight)
1684
+ evolution: Sn((e.x - D.marginLeft) / this.plotWidth),
1685
+ visibility: Sn(1 - (e.y - D.marginTop) / this.plotHeight)
1671
1686
  };
1672
1687
  }
1673
1688
  stageOf(e) {
@@ -1691,10 +1706,10 @@ var bn = class {
1691
1706
  };
1692
1707
  }
1693
1708
  render() {
1694
- let e = this.canvas.getLayer(hn, -1);
1709
+ let e = this.canvas.getLayer(vn, -1);
1695
1710
  oe(e);
1696
1711
  let t = D.marginLeft, n = D.marginTop, r = t + this.plotWidth, i = n + this.plotHeight;
1697
- C(e, xn(t, n, this.plotWidth, this.plotHeight, {
1712
+ C(e, wn(t, n, this.plotWidth, this.plotHeight, {
1698
1713
  fill: k.plotBackground,
1699
1714
  stroke: k.grid
1700
1715
  }));
@@ -1705,51 +1720,51 @@ var bn = class {
1705
1720
  ];
1706
1721
  for (let r = 0; r < 4; r++) {
1707
1722
  let o = t + a[r] * this.plotWidth, s = t + a[r + 1] * this.plotWidth;
1708
- r % 2 == 1 && C(e, xn(o, n, s - o, this.plotHeight, {
1723
+ r % 2 == 1 && C(e, wn(o, n, s - o, this.plotHeight, {
1709
1724
  fill: k.band,
1710
1725
  stroke: "none"
1711
- })), r > 0 && C(e, Sn(o, n, o, i, {
1726
+ })), r > 0 && C(e, Tn(o, n, o, i, {
1712
1727
  stroke: k.grid,
1713
1728
  "stroke-dasharray": "3 5"
1714
1729
  }));
1715
1730
  let c = (o + s) / 2;
1716
- C(e, Cn(this.labels[r].toUpperCase(), c, i + 18, {
1731
+ C(e, En(this.labels[r].toUpperCase(), c, i + 18, {
1717
1732
  "text-anchor": "middle",
1718
1733
  "font-size": A.stage,
1719
1734
  "letter-spacing": "0.08em",
1720
1735
  fill: k.axisText
1721
1736
  }));
1722
1737
  }
1723
- C(e, Sn(t, i, r + 10, i, {
1738
+ C(e, Tn(t, i, r + 10, i, {
1724
1739
  stroke: k.axis,
1725
- class: _n
1726
- })), C(e, wn(r + 10, i, "right")), C(e, Cn("Evolution", r + 6, i + 38, {
1740
+ class: bn
1741
+ })), C(e, Dn(r + 10, i, "right")), C(e, En("Evolution", r + 6, i + 38, {
1727
1742
  "text-anchor": "end",
1728
1743
  "font-size": A.axis,
1729
1744
  fill: k.axisText,
1730
1745
  "font-style": "italic"
1731
- })), C(e, Sn(t, i, t, n - 10, {
1746
+ })), C(e, Tn(t, i, t, n - 10, {
1732
1747
  stroke: k.axis,
1733
- class: _n
1734
- })), C(e, wn(t, n - 10, "up"));
1735
- let o = Cn(this.yAxisLabel, 0, 0, {
1748
+ class: bn
1749
+ })), C(e, Dn(t, n - 10, "up"));
1750
+ let o = En(this.yAxisLabel, 0, 0, {
1736
1751
  "text-anchor": "middle",
1737
1752
  "font-size": A.axis,
1738
1753
  fill: k.axisText,
1739
1754
  "font-style": "italic"
1740
1755
  });
1741
- w(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), C(e, o), C(e, Cn(this.yAxisEndLabels[1], t - 10, n + 11, {
1756
+ w(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), C(e, o), C(e, En(this.yAxisEndLabels[1], t - 10, n + 11, {
1742
1757
  "text-anchor": "end",
1743
1758
  "font-size": A.stage,
1744
1759
  fill: k.axisText
1745
- })), C(e, Cn(this.yAxisEndLabels[0], t - 10, i - 2, {
1760
+ })), C(e, En(this.yAxisEndLabels[0], t - 10, i - 2, {
1746
1761
  "text-anchor": "end",
1747
1762
  "font-size": A.stage,
1748
1763
  fill: k.axisText
1749
1764
  }));
1750
1765
  }
1751
1766
  };
1752
- function xn(e, t, n, r, i) {
1767
+ function wn(e, t, n, r, i) {
1753
1768
  return w(T("rect"), {
1754
1769
  x: e,
1755
1770
  y: t,
@@ -1759,7 +1774,7 @@ function xn(e, t, n, r, i) {
1759
1774
  ...i
1760
1775
  });
1761
1776
  }
1762
- function Sn(e, t, n, r, i) {
1777
+ function Tn(e, t, n, r, i) {
1763
1778
  return w(T("line"), {
1764
1779
  x1: e,
1765
1780
  y1: t,
@@ -1769,30 +1784,30 @@ function Sn(e, t, n, r, i) {
1769
1784
  ...i
1770
1785
  });
1771
1786
  }
1772
- function Cn(e, t, n, r) {
1787
+ function En(e, t, n, r) {
1773
1788
  let i = w(T("text"), {
1774
1789
  x: t,
1775
1790
  y: n,
1776
1791
  "font-family": A.family,
1777
- class: vn,
1792
+ class: xn,
1778
1793
  ...r
1779
1794
  });
1780
1795
  return i.textContent = e, i;
1781
1796
  }
1782
- function wn(e, t, n) {
1797
+ function Dn(e, t, n) {
1783
1798
  let r = n === "right" ? `${e - 5},${t - 5} ${e + 2},${t} ${e - 5},${t + 5}` : `${e - 5},${t + 5} ${e},${t - 2} ${e + 5},${t + 5}`;
1784
1799
  return w(T("polygon"), {
1785
1800
  points: r,
1786
1801
  fill: k.axis,
1787
- class: _n
1802
+ class: bn
1788
1803
  });
1789
1804
  }
1790
1805
  // src/evolve/constants.ts
1791
- var Tn = .005, En = "wardley.evolve", Dn = "wardley-evolve-handle";
1792
- function On(e) {
1806
+ var On = .005, kn = "wardley.evolve", An = "wardley-evolve-handle";
1807
+ function jn(e) {
1793
1808
  return e < 0 ? 0 : e > 1 ? 1 : e;
1794
1809
  }
1795
- var kn = class {
1810
+ var Mn = class {
1796
1811
  dragging;
1797
1812
  injector;
1798
1813
  static $inject = [
@@ -1808,9 +1823,9 @@ var kn = class {
1808
1823
  this.dragging = t, this.injector = o;
1809
1824
  let s = (t, n) => {
1810
1825
  n === void 0 ? delete t.movement : t.movement = n, e.fire("element.changed", { element: t });
1811
- }, c = (e, t) => Math.max(On(t), Math.min(1, e.evolution + Tn)), l = (e, t) => {
1826
+ }, c = (e, t) => Math.max(jn(t), Math.min(1, e.evolution + On)), l = (e, t) => {
1812
1827
  let r = i.getContainer().getBoundingClientRect(), a = i.viewbox(), o = a.x + (e - r.left) * (a.width / r.width);
1813
- return On(n.fromCanvas({
1828
+ return jn(n.fromCanvas({
1814
1829
  x: o,
1815
1830
  y: t
1816
1831
  }).evolution);
@@ -1820,7 +1835,7 @@ var kn = class {
1820
1835
  };
1821
1836
  i.getContainer().addEventListener("mousedown", (e) => {
1822
1837
  let t = e.target;
1823
- if (!t?.closest(`.${Dn}`) || u() || I(o)) return;
1838
+ if (!t?.closest(`.${An}`) || u() || I(o)) return;
1824
1839
  let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), d = n ? a.get(n) : void 0;
1825
1840
  if (!d || d.wardleyType !== "component") return;
1826
1841
  e.stopPropagation(), e.preventDefault(), L(i);
@@ -1833,7 +1848,7 @@ var kn = class {
1833
1848
  document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g), s(d, f), a.get(d.id) === d && m !== void 0 && m > d.evolution + .005 && r.evolveComponent(d, m);
1834
1849
  };
1835
1850
  document.addEventListener("mousemove", h), document.addEventListener("mouseup", g);
1836
- }, !0), e.on(`${En}.move`, (e) => {
1851
+ }, !0), e.on(`${kn}.move`, (e) => {
1837
1852
  let { shape: t } = e.context, r = t.y + t.height / 2, i = c(t, n.fromCanvas({
1838
1853
  x: e.x,
1839
1854
  y: r
@@ -1842,10 +1857,10 @@ var kn = class {
1842
1857
  ...e.context.originalMovement,
1843
1858
  targetEvolution: i
1844
1859
  });
1845
- }), e.on(`${En}.end`, (e) => {
1860
+ }), e.on(`${kn}.end`, (e) => {
1846
1861
  let t = e.context, { shape: n, target: i } = t;
1847
1862
  s(n, t.originalMovement), i !== void 0 && i > n.evolution + .005 && r.evolveComponent(n, i), t.committed = !0;
1848
- }), e.on(`${En}.cleanup`, (e) => {
1863
+ }), e.on(`${kn}.cleanup`, (e) => {
1849
1864
  let t = e.context;
1850
1865
  t && !t.committed && s(t.shape, t.originalMovement);
1851
1866
  });
@@ -1856,14 +1871,14 @@ var kn = class {
1856
1871
  shape: t,
1857
1872
  ...t.movement ? { originalMovement: t.movement } : {}
1858
1873
  };
1859
- this.dragging.init(e, En, {
1874
+ this.dragging.init(e, kn, {
1860
1875
  cursor: "ew-resize",
1861
1876
  data: { context: n }
1862
1877
  });
1863
1878
  }
1864
- }, An = {
1879
+ }, Nn = {
1865
1880
  __init__: ["wardleyEvolveDragging"],
1866
- wardleyEvolveDragging: ["type", kn]
1881
+ wardleyEvolveDragging: ["type", Mn]
1867
1882
  };
1868
1883
  // src/pipeline/pipelineMembership.ts
1869
1884
  function z(e) {
@@ -1872,31 +1887,31 @@ function z(e) {
1872
1887
  y: e.y + e.height / 2
1873
1888
  };
1874
1889
  }
1875
- function jn(e, t) {
1890
+ function Pn(e, t) {
1876
1891
  return t.x >= e.x && t.x <= e.x + e.width && t.y >= e.y && t.y <= e.y + e.height;
1877
1892
  }
1878
- function Mn(e) {
1893
+ function Fn(e) {
1879
1894
  return e.filter((e) => P(e));
1880
1895
  }
1881
- function Nn(e, t) {
1896
+ function In(e, t) {
1882
1897
  return e.filter((e) => N(e) && e.pipelineId === t.id);
1883
1898
  }
1884
- function Pn(e, t) {
1899
+ function Ln(e, t) {
1885
1900
  return e.find((e) => N(e) && e.wardleyLabel === t.wardleyLabel && e.pipelineId !== t.id);
1886
1901
  }
1887
- function Fn(e, t) {
1888
- if (N(t)) return Mn(e).find((e) => e.wardleyLabel === t.wardleyLabel && t.pipelineId !== e.id);
1902
+ function Rn(e, t) {
1903
+ if (N(t)) return Fn(e).find((e) => e.wardleyLabel === t.wardleyLabel && t.pipelineId !== e.id);
1889
1904
  }
1890
- function In(e, t) {
1891
- let n = Pn(e, t);
1892
- return [...Nn(e, t), ...n ? [n] : []];
1905
+ function zn(e, t) {
1906
+ let n = Ln(e, t);
1907
+ return [...In(e, t), ...n ? [n] : []];
1893
1908
  }
1894
- function Ln(e, t, n, r = /* @__PURE__ */ new Set()) {
1895
- let i = Mn(e).filter((e) => !r.has(e) && e.wardleyLabel !== t.wardleyLabel && jn(e, n));
1909
+ function Bn(e, t, n, r = /* @__PURE__ */ new Set()) {
1910
+ let i = Fn(e).filter((e) => !r.has(e) && e.wardleyLabel !== t.wardleyLabel && Pn(e, n));
1896
1911
  return i.find((e) => e.id === t.pipelineId) ?? i[0];
1897
1912
  }
1898
1913
  // src/pipeline/PipelineGroupBehavior.ts
1899
- var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un = 900, Wn = "wardley-drop-target", Gn = class extends de {
1914
+ var Vn = 1400, Hn = 450, Un = 400, Wn = 1500, Gn = "wardley-pipeline-drag", Kn = 900, qn = "wardley-drop-target", Jn = class extends de {
1900
1915
  elementRegistry;
1901
1916
  canvas;
1902
1917
  static $inject = [
@@ -1911,27 +1926,27 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
1911
1926
  this.preExecute("element.updateProperties", (e) => {
1912
1927
  let { context: t } = e, n = t.element, r = t.properties.wardleyLabel;
1913
1928
  if (typeof r != "string" || r === n.wardleyLabel) return;
1914
- let i = P(n) ? Pn(this.elementRegistry, n) : Fn(this.elementRegistry, n);
1929
+ let i = P(n) ? Ln(this.elementRegistry, n) : Rn(this.elementRegistry, n);
1915
1930
  i && (t.renamedCounterpart = i);
1916
1931
  }), this.postExecute("element.updateProperties", (e) => {
1917
1932
  let { context: t } = e, n = t.renamedCounterpart, i = t.properties.wardleyLabel;
1918
1933
  n && typeof i == "string" && n.wardleyLabel !== i && r.get("wardleyModeling").updateProperties(n, { wardleyLabel: i });
1919
- }), e.on("shape.move.start", Rn, (e) => {
1934
+ }), e.on("shape.move.start", Vn, (e) => {
1920
1935
  let { context: t } = e;
1921
1936
  t.shapes = this.withFollowers(t.shapes ?? []);
1922
- }), this.preExecuted("elements.move", Vn, (e) => {
1937
+ }), this.preExecuted("elements.move", Wn, (e) => {
1923
1938
  let t = e.context.closure;
1924
1939
  if (t) {
1925
- for (let e of Object.values(t.allShapes)) if (P(e)) for (let n of In(this.elementRegistry, e)) t.allShapes[n.id] || t.add(n, !!t.topLevel[e.id]);
1940
+ for (let e of Object.values(t.allShapes)) if (P(e)) for (let n of zn(this.elementRegistry, e)) t.allShapes[n.id] || t.add(n, !!t.topLevel[e.id]);
1926
1941
  }
1927
- }), i && e.on("shape.move.start", zn, (e) => {
1942
+ }), i && e.on("shape.move.start", Hn, (e) => {
1928
1943
  let { context: t } = e, n = this.carriedVertically(t.shapes ?? []);
1929
1944
  if (!n.length) return;
1930
1945
  let r = T("g");
1931
- w(r, { class: "djs-drag-group" }), C(this.canvas.getLayer(Hn, Un), r);
1946
+ w(r, { class: "djs-drag-group" }), C(this.canvas.getLayer(Gn, Kn), r);
1932
1947
  for (let e of n) i.addDragger(e, r);
1933
1948
  t.pipelineVerticalPreview = r;
1934
- }), e.on("shape.move.move", Bn, (e) => {
1949
+ }), e.on("shape.move.move", Un, (e) => {
1935
1950
  let { context: t } = e;
1936
1951
  t.pipelineVerticalPreview && fe(t.pipelineVerticalPreview, 0, e.dy), this.markDropTarget(t, this.dropTargetFor(t, e.dx, e.dy));
1937
1952
  }), e.on("shape.move.cleanup", (e) => {
@@ -1941,47 +1956,47 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
1941
1956
  }
1942
1957
  withFollowers(e) {
1943
1958
  let t = new Set(e);
1944
- for (let n of e) if (P(n)) for (let e of In(this.elementRegistry, n)) t.add(e);
1959
+ for (let n of e) if (P(n)) for (let e of zn(this.elementRegistry, n)) t.add(e);
1945
1960
  return [...t];
1946
1961
  }
1947
1962
  carriedVertically(e) {
1948
1963
  let t = new Set(e), n = [];
1949
1964
  for (let r of e) {
1950
1965
  if (!N(r)) continue;
1951
- let e = Fn(this.elementRegistry, r);
1952
- e && !t.has(e) && n.push(e, ...Nn(this.elementRegistry, e).filter((e) => !t.has(e)));
1966
+ let e = Rn(this.elementRegistry, r);
1967
+ e && !t.has(e) && n.push(e, ...In(this.elementRegistry, e).filter((e) => !t.has(e)));
1953
1968
  }
1954
1969
  return n;
1955
1970
  }
1956
1971
  dropTargetFor(e, t, n) {
1957
1972
  let r = e.shape;
1958
- if (!N(r) || Fn(this.elementRegistry, r)) return;
1973
+ if (!N(r) || Rn(this.elementRegistry, r)) return;
1959
1974
  let i = z(r);
1960
- return Ln(this.elementRegistry, r, {
1975
+ return Bn(this.elementRegistry, r, {
1961
1976
  x: i.x + t,
1962
1977
  y: i.y + n
1963
1978
  }, new Set(e.shapes ?? []));
1964
1979
  }
1965
1980
  markDropTarget(e, t) {
1966
1981
  let n = e.pipelineDropTarget;
1967
- n !== t && (n && this.canvas.removeMarker(n, Wn), t && this.canvas.addMarker(t, Wn), t ? e.pipelineDropTarget = t : delete e.pipelineDropTarget);
1982
+ n !== t && (n && this.canvas.removeMarker(n, qn), t && this.canvas.addMarker(t, qn), t ? e.pipelineDropTarget = t : delete e.pipelineDropTarget);
1968
1983
  }
1969
- }, Kn = {
1984
+ }, Yn = {
1970
1985
  __init__: ["pipelineGroupBehavior"],
1971
- pipelineGroupBehavior: ["type", Gn]
1972
- }, qn = [
1986
+ pipelineGroupBehavior: ["type", Jn]
1987
+ }, Xn = [
1973
1988
  "shape.move",
1974
1989
  "shape.create",
1975
1990
  "shape.resize"
1976
- ], Jn = [
1977
- ...qn,
1991
+ ], Zn = [
1992
+ ...Xn,
1978
1993
  "elements.move",
1979
1994
  "elements.create"
1980
- ], Yn = [
1995
+ ], Qn = [
1981
1996
  "shape.create",
1982
1997
  "shape.delete",
1983
1998
  "element.updateProperties"
1984
- ], Xn = 2e3, Zn = 1e3, Qn = 10, $n = 1e-6, er = class extends de {
1999
+ ], $n = 2e3, er = 1e3, tr = 10, nr = 1e-6, rr = class extends de {
1985
2000
  eventBus;
1986
2001
  grid;
1987
2002
  elementRegistry;
@@ -2001,9 +2016,9 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2001
2016
  constructor(e, t, n, r, i, a) {
2002
2017
  super(e), this.eventBus = e, this.grid = t, this.elementRegistry = n, this.canvas = r, this.modeling = i, this.wardleyModeling = a;
2003
2018
  let o = (e) => {
2004
- for (let t of tr(e.context)) this.deriveFromGeometry(t);
2019
+ for (let t of ir(e.context)) this.deriveFromGeometry(t);
2005
2020
  };
2006
- this.executed(qn, o), this.reverted(qn, o), this.preExecute(Jn, Xn, (e) => {
2021
+ this.executed(Xn, o), this.reverted(Xn, o), this.preExecute(Zn, $n, (e) => {
2007
2022
  this.topLevelContext ||= e.context;
2008
2023
  }), e.on("commandStack.changed", () => {
2009
2024
  this.topLevelContext = null;
@@ -2012,18 +2027,18 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2012
2027
  if (!this.isTopLevel(t) || !j(t.shape) || !t.delta) return;
2013
2028
  let n = [t.shape, ...this.followersOf(t.shape)];
2014
2029
  this.rememberEvolutions(t, n), t.delta = this.clampDelta(t.delta, n);
2015
- }), this.preExecuted("elements.move", Zn, (e) => {
2030
+ }), this.preExecuted("elements.move", er, (e) => {
2016
2031
  let { context: t } = e;
2017
2032
  if (!this.isTopLevel(t) || !t.delta) return;
2018
- let n = nr(t);
2033
+ let n = ar(t);
2019
2034
  this.rememberEvolutions(t, n), t.delta = this.clampDelta(t.delta, n);
2020
2035
  }), this.preExecute(["shape.create", "elements.create"], (e) => {
2021
2036
  let { context: t } = e;
2022
- t.parent?.parent && (t.parent = this.canvas.getRootElement()), this.isTopLevel(t) && this.rememberEvolutions(t, tr(t));
2037
+ t.parent?.parent && (t.parent = this.canvas.getRootElement()), this.isTopLevel(t) && this.rememberEvolutions(t, ir(t));
2023
2038
  }), this.preExecute("shape.resize", (e) => {
2024
2039
  let { context: t } = e, n = t.shape;
2025
2040
  j(n) && t.newBounds && (n.wardleyType === "pipeline" ? t.newBounds = this.horizontalPipelineBounds(n, t.newBounds) : n.wardleyType === "attitude" && (t.newBounds = this.boundsInsidePlot(t.newBounds)));
2026
- }), this.postExecuted(Jn, (e) => {
2041
+ }), this.postExecuted(Zn, (e) => {
2027
2042
  if (e.context === this.topLevelContext) try {
2028
2043
  this.applyCorrections(e.command, e.context);
2029
2044
  } finally {
@@ -2037,13 +2052,13 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2037
2052
  ...e.context?.elements ?? []
2038
2053
  ].some((e) => N(e))) for (let e of this.elementRegistry.filter((e) => P(e))) this.eventBus.fire("element.changed", { element: e });
2039
2054
  };
2040
- this.executed(Yn, s), this.reverted(Yn, s);
2055
+ this.executed(Qn, s), this.reverted(Qn, s);
2041
2056
  }
2042
2057
  isTopLevel(e) {
2043
2058
  return e === this.topLevelContext;
2044
2059
  }
2045
2060
  followersOf(e) {
2046
- return P(e) ? In(this.elementRegistry, e) : [];
2061
+ return P(e) ? zn(this.elementRegistry, e) : [];
2047
2062
  }
2048
2063
  rememberEvolutions(e, t) {
2049
2064
  this.evolutionsBefore.set(e, new Map(t.map((e) => [e, e.evolution])));
@@ -2090,9 +2105,9 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2090
2105
  }), n = this.grid.fromCanvas({
2091
2106
  x: e.x + e.width,
2092
2107
  y: e.y
2093
- }), [r, i] = or(t.evolution, n.evolution);
2094
- e.evolutionStart = r, e.evolutionEnd = i, e.evolution = ar((r + i) / 2), e.visibility = t.visibility;
2095
- for (let t of Nn(this.elementRegistry, e)) t.visibility = e.visibility;
2108
+ }), [r, i] = lr(t.evolution, n.evolution);
2109
+ e.evolutionStart = r, e.evolutionEnd = i, e.evolution = cr((r + i) / 2), e.visibility = t.visibility;
2110
+ for (let t of In(this.elementRegistry, e)) t.visibility = e.visibility;
2096
2111
  }
2097
2112
  pipelineOfMember(e) {
2098
2113
  if (!N(e) || !e.pipelineId) return;
@@ -2119,14 +2134,14 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2119
2134
  return;
2120
2135
  }
2121
2136
  case "elements.move":
2122
- this.completeMove(nr(t), t.delta ?? {
2137
+ this.completeMove(ar(t), t.delta ?? {
2123
2138
  x: 0,
2124
2139
  y: 0
2125
2140
  }, t);
2126
2141
  return;
2127
2142
  case "shape.create":
2128
2143
  case "elements.create": {
2129
- let e = tr(t), n = this.clampDelta({
2144
+ let e = ir(t), n = this.clampDelta({
2130
2145
  x: 0,
2131
2146
  y: 0
2132
2147
  }, e);
@@ -2143,12 +2158,12 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2143
2158
  this.carryPipelinesOfMovedAnchors(e, t), this.reconcileMembership(e), this.shiftPassedEvolveTargets(n);
2144
2159
  }
2145
2160
  carryPipelinesOfMovedAnchors(e, t) {
2146
- if (Math.abs(t.y) < $n) return;
2161
+ if (Math.abs(t.y) < nr) return;
2147
2162
  let n = new Set(e);
2148
2163
  for (let r of e) {
2149
- let e = Fn(this.elementRegistry, r);
2164
+ let e = Rn(this.elementRegistry, r);
2150
2165
  if (!e || n.has(e)) continue;
2151
- let i = [e, ...Nn(this.elementRegistry, e).filter((e) => !n.has(e))], a = this.clampDelta({
2166
+ let i = [e, ...In(this.elementRegistry, e).filter((e) => !n.has(e))], a = this.clampDelta({
2152
2167
  x: 0,
2153
2168
  y: t.y
2154
2169
  }, i);
@@ -2157,8 +2172,8 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2157
2172
  }
2158
2173
  reconcileMembership(e) {
2159
2174
  for (let t of e) {
2160
- if (!N(t) || Fn(this.elementRegistry, t)) continue;
2161
- let e = z(t), n = Ln(this.elementRegistry, t, e);
2175
+ if (!N(t) || Rn(this.elementRegistry, t)) continue;
2176
+ let e = z(t), n = Bn(this.elementRegistry, t, e);
2162
2177
  n ? (this.moveBy(t, {
2163
2178
  x: 0,
2164
2179
  y: n.y + n.height / 2 - e.y
@@ -2169,7 +2184,7 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2169
2184
  }
2170
2185
  }
2171
2186
  releaseMembersOutside(e) {
2172
- for (let t of Nn(this.elementRegistry, e)) {
2187
+ for (let t of In(this.elementRegistry, e)) {
2173
2188
  let n = z(t);
2174
2189
  (n.x < e.x || n.x > e.x + e.width) && this.release(t);
2175
2190
  }
@@ -2195,7 +2210,7 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2195
2210
  }
2196
2211
  }
2197
2212
  moveBy(e, t) {
2198
- Math.abs(t.x) < $n && Math.abs(t.y) < $n || this.modeling.moveShape(e, {
2213
+ Math.abs(t.x) < nr && Math.abs(t.y) < nr || this.modeling.moveShape(e, {
2199
2214
  x: t.x,
2200
2215
  y: t.y
2201
2216
  });
@@ -2264,8 +2279,8 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2264
2279
  r.min = Math.max(r.min, n.x - t.x), r.max = Math.min(r.max, n.x + n.width - (t.x + t.width)), i.min = Math.max(i.min, n.y - t.y), i.max = Math.min(i.max, n.y + n.height - (t.y + t.height));
2265
2280
  }
2266
2281
  return {
2267
- x: rr(e.x, r),
2268
- y: rr(e.y, i)
2282
+ x: or(e.x, r),
2283
+ y: or(e.y, i)
2269
2284
  };
2270
2285
  }
2271
2286
  horizontalPipelineBounds(e, t) {
@@ -2287,11 +2302,11 @@ var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un =
2287
2302
  };
2288
2303
  }
2289
2304
  spanInside(e, t, n) {
2290
- let r = this.plotBounds(), i = n === "x" ? r.x : r.y, a = i + (n === "x" ? r.width : r.height), o = Math.max(e, i), s = Math.max(Math.min(e + t, a) - o, Qn);
2305
+ let r = this.plotBounds(), i = n === "x" ? r.x : r.y, a = i + (n === "x" ? r.width : r.height), o = Math.max(e, i), s = Math.max(Math.min(e + t, a) - o, tr);
2291
2306
  return [Math.min(o, a - s), s];
2292
2307
  }
2293
2308
  };
2294
- function tr(e) {
2309
+ function ir(e) {
2295
2310
  let t = [
2296
2311
  ...e.shape ? [e.shape] : [],
2297
2312
  ...e.shapes ?? [],
@@ -2299,36 +2314,36 @@ function tr(e) {
2299
2314
  ];
2300
2315
  return [...new Set(t)].filter(j);
2301
2316
  }
2302
- function nr(e) {
2303
- return e.closure ? Object.values(e.closure.allShapes).filter(j) : tr(e);
2317
+ function ar(e) {
2318
+ return e.closure ? Object.values(e.closure.allShapes).filter(j) : ir(e);
2304
2319
  }
2305
- function rr(e, t) {
2320
+ function or(e, t) {
2306
2321
  return t.min > t.max ? e : Math.min(Math.max(e, t.min), t.max);
2307
2322
  }
2308
- var ir = .001;
2309
- function ar(e) {
2323
+ var sr = .001;
2324
+ function cr(e) {
2310
2325
  return e < 0 ? 0 : e > 1 ? 1 : e;
2311
2326
  }
2312
- function or(e, t) {
2313
- let n = ar(Math.max(t, e + ir));
2314
- return [Math.max(0, Math.min(e, n - ir)), n];
2327
+ function lr(e, t) {
2328
+ let n = cr(Math.max(t, e + sr));
2329
+ return [Math.max(0, Math.min(e, n - sr)), n];
2315
2330
  }
2316
2331
  // src/modeling/cmd/UpdatePropertiesHandler.ts
2317
- function sr(e, t, n) {
2332
+ function ur(e, t, n) {
2318
2333
  n === void 0 ? delete e[t] : e[t] = n;
2319
2334
  }
2320
- var cr = class {
2335
+ var dr = class {
2321
2336
  execute(e) {
2322
2337
  let { element: t, properties: n } = e, r = t, i = {};
2323
- for (let e of Object.keys(n)) i[e] = r[e], sr(r, e, n[e]);
2338
+ for (let e of Object.keys(n)) i[e] = r[e], ur(r, e, n[e]);
2324
2339
  return e.oldProperties = i, [t];
2325
2340
  }
2326
2341
  revert(e) {
2327
2342
  let { element: t, oldProperties: n } = e, r = t;
2328
- if (n) for (let e of Object.keys(n)) sr(r, e, n[e]);
2343
+ if (n) for (let e of Object.keys(n)) ur(r, e, n[e]);
2329
2344
  return [t];
2330
2345
  }
2331
- }, lr = class {
2346
+ }, fr = class {
2332
2347
  projection;
2333
2348
  static $inject = ["wardleyMapProjection"];
2334
2349
  constructor(e) {
@@ -2336,20 +2351,20 @@ var cr = class {
2336
2351
  }
2337
2352
  execute(e) {
2338
2353
  let t = this.projection.root()?.businessObject;
2339
- return t ? (e.oldSize = t.config.size, e.oldRawPassthrough = t.rawPassthrough, this.projection.apply(ur({
2354
+ return t ? (e.oldSize = t.config.size, e.oldRawPassthrough = t.rawPassthrough, this.projection.apply(pr({
2340
2355
  ...t,
2341
2356
  config: ht(t.config, e.size)
2342
2357
  }, _t(t.rawPassthrough)))) : [];
2343
2358
  }
2344
2359
  revert(e) {
2345
2360
  let t = this.projection.root()?.businessObject;
2346
- return t ? this.projection.apply(ur({
2361
+ return t ? this.projection.apply(pr({
2347
2362
  ...t,
2348
2363
  config: ht(t.config, e.oldSize)
2349
2364
  }, e.oldRawPassthrough)) : [];
2350
2365
  }
2351
2366
  };
2352
- function ur(e, t) {
2367
+ function pr(e, t) {
2353
2368
  let { rawPassthrough: n, ...r } = e;
2354
2369
  return t ? {
2355
2370
  ...r,
@@ -2357,34 +2372,34 @@ function ur(e, t) {
2357
2372
  } : r;
2358
2373
  }
2359
2374
  // src/modeling/WardleyModeling.ts
2360
- var dr = "element.updateProperties", fr = "wardley.map.resize", pr = "wardley.config.update";
2361
- function mr(e) {
2375
+ var mr = "element.updateProperties", hr = "wardley.map.resize", gr = "wardley.config.update";
2376
+ function _r(e) {
2362
2377
  let t = {};
2363
2378
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
2364
2379
  return t;
2365
2380
  }
2366
- var hr = class {
2381
+ var vr = class {
2367
2382
  commandStack;
2368
2383
  canvas;
2369
2384
  static $inject = ["commandStack", "canvas"];
2370
2385
  constructor(e, t) {
2371
- this.commandStack = e, this.canvas = t, e.registerHandler(dr, cr), e.registerHandler(fr, lr), e.registerHandler(pr, tn);
2386
+ this.commandStack = e, this.canvas = t, e.registerHandler(mr, dr), e.registerHandler(hr, fr), e.registerHandler(gr, tn);
2372
2387
  }
2373
2388
  resizeMap(e) {
2374
2389
  let t = this.currentConfig();
2375
- t && !gr(t.size, e) && this.commandStack.execute(fr, { size: e });
2390
+ t && !yr(t.size, e) && this.commandStack.execute(hr, { size: e });
2376
2391
  }
2377
2392
  updateConfig(e) {
2378
2393
  let t = this.currentConfig();
2379
2394
  if (!t) return;
2380
2395
  let n = t, r = Object.fromEntries(Object.entries(e).filter(([e, t]) => e !== "size" && JSON.stringify(n[e]) !== JSON.stringify(t)));
2381
- Object.keys(r).length !== 0 && this.commandStack.execute(pr, { properties: r });
2396
+ Object.keys(r).length !== 0 && this.commandStack.execute(gr, { properties: r });
2382
2397
  }
2383
2398
  currentConfig() {
2384
2399
  return gt(this.canvas)?.businessObject?.config;
2385
2400
  }
2386
2401
  updateProperties(e, t) {
2387
- this.commandStack.execute(dr, {
2402
+ this.commandStack.execute(mr, {
2388
2403
  element: e,
2389
2404
  properties: t
2390
2405
  });
@@ -2402,11 +2417,11 @@ var hr = class {
2402
2417
  } else this.updateProperties(e, { wardleyLabel: t });
2403
2418
  }
2404
2419
  evolveComponent(e, t, n = {}) {
2405
- let r = _r(t);
2406
- r <= e.evolution || this.updateProperties(e, { movement: mr({
2420
+ let r = br(t);
2421
+ r <= e.evolution || this.updateProperties(e, { movement: _r({
2407
2422
  ...e.movement,
2408
2423
  targetEvolution: r,
2409
- ...mr({
2424
+ ..._r({
2410
2425
  newLabel: n.newLabel,
2411
2426
  method: n.method
2412
2427
  })
@@ -2431,14 +2446,14 @@ var hr = class {
2431
2446
  this.updateProperties(e, { color: t });
2432
2447
  }
2433
2448
  };
2434
- function gr(e, t) {
2449
+ function yr(e, t) {
2435
2450
  return !e || !t ? e === t : e.width === t.width && e.height === t.height;
2436
2451
  }
2437
- function _r(e) {
2452
+ function br(e) {
2438
2453
  return e < 0 ? 0 : e > 1 ? 1 : e;
2439
2454
  }
2440
2455
  // src/modeling/WardleyCopyPaste.ts
2441
- var vr = 24, yr = [
2456
+ var xr = 24, Sr = [
2442
2457
  "wardleyType",
2443
2458
  "evolution",
2444
2459
  "visibility",
@@ -2455,13 +2470,13 @@ var vr = 24, yr = [
2455
2470
  "drawingPoints",
2456
2471
  "closed",
2457
2472
  "strokeStyle"
2458
- ], br = [
2473
+ ], Cr = [
2459
2474
  "wardleyType",
2460
2475
  "bidirectional",
2461
2476
  "flowValue",
2462
2477
  "linkLabel"
2463
2478
  ];
2464
- function xr(e, t) {
2479
+ function wr(e, t) {
2465
2480
  let n = {};
2466
2481
  for (let r of t) {
2467
2482
  let t = e[r];
@@ -2469,7 +2484,7 @@ function xr(e, t) {
2469
2484
  }
2470
2485
  return n;
2471
2486
  }
2472
- var Sr = class {
2487
+ var Tr = class {
2473
2488
  selection;
2474
2489
  modeling;
2475
2490
  elementFactory;
@@ -2501,14 +2516,14 @@ var Sr = class {
2501
2516
  i !== void 0 && a !== void 0 && (r.add(e), n.push({
2502
2517
  sourceIdx: i,
2503
2518
  targetIdx: a,
2504
- props: xr(e, br)
2519
+ props: wr(e, Cr)
2505
2520
  }));
2506
2521
  }
2507
2522
  return this.clipboard = {
2508
2523
  shapes: e.map((e) => ({
2509
2524
  id: e.id,
2510
2525
  ...e.pipelineId ? { pipelineId: e.pipelineId } : {},
2511
- props: xr(e, yr),
2526
+ props: wr(e, Sr),
2512
2527
  x: e.x,
2513
2528
  y: e.y,
2514
2529
  width: e.width,
@@ -2569,14 +2584,14 @@ var Sr = class {
2569
2584
  }
2570
2585
  insertWithOffset(e) {
2571
2586
  this.pasteCount++;
2572
- let t = vr * this.pasteCount, n = Cr(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
2587
+ let t = xr * this.pasteCount, n = Er(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
2573
2588
  x: n.cx + t,
2574
2589
  y: n.cy + t
2575
2590
  }, this.canvas.getRootElement());
2576
2591
  return this.selection.select(r), !0;
2577
2592
  }
2578
2593
  };
2579
- function Cr(e) {
2594
+ function Er(e) {
2580
2595
  let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x + e.width)), i = Math.max(...e.map((e) => e.y + e.height));
2581
2596
  return {
2582
2597
  cx: (t + r) / 2,
@@ -2584,26 +2599,26 @@ function Cr(e) {
2584
2599
  };
2585
2600
  }
2586
2601
  // src/modeling/index.ts
2587
- var wr = {
2602
+ var Dr = {
2588
2603
  __depends__: [
2589
2604
  me,
2590
2605
  he,
2591
2606
  Qt
2592
2607
  ],
2593
2608
  __init__: ["wardleyModeling"],
2594
- wardleyModeling: ["type", hr],
2595
- wardleyCopyPaste: ["type", Sr]
2596
- }, Tr = { evolutionGrid: ["type", bn] }, Er = {
2609
+ wardleyModeling: ["type", vr],
2610
+ wardleyCopyPaste: ["type", Tr]
2611
+ }, Or = { evolutionGrid: ["type", Cn] }, kr = {
2597
2612
  __init__: ["evolutionConstraintBehavior"],
2598
2613
  __depends__: [
2599
- Tr,
2600
- ln,
2614
+ Or,
2615
+ fn,
2601
2616
  pe,
2602
- wr
2617
+ Dr
2603
2618
  ],
2604
- evolutionConstraintBehavior: ["type", er]
2605
- }, Dr = "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z", Or = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", kr = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Ar = "M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z", jr = "M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z";
2606
- function Mr(e, t, n, r, i) {
2619
+ evolutionConstraintBehavior: ["type", rr]
2620
+ }, Ar = "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z", jr = "M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z", Mr = "M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z";
2621
+ function Nr(e, t, n, r, i) {
2607
2622
  let a = T("g"), o = r / 24;
2608
2623
  return w(a, {
2609
2624
  transform: `translate(${t - r / 2}, ${n - r / 2}) scale(${o})`,
@@ -2611,14 +2626,8 @@ function Mr(e, t, n, r, i) {
2611
2626
  stroke: "none"
2612
2627
  }), C(a, w(T("path"), { d: e })), a;
2613
2628
  }
2614
- function Nr(e) {
2615
- return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2616
- }
2617
- function Pr(e, t = 18) {
2618
- return `<svg viewBox="0 0 24 24" width="${Number(t)}" height="${Number(t)}" fill="currentColor" aria-hidden="true"><path d="${Nr(e)}"/></svg>`;
2619
- }
2620
- var Fr = 7.5;
2621
- function Ir(e, t) {
2629
+ var Pr = 7.5;
2630
+ function Fr(e, t) {
2622
2631
  let n = e.movement;
2623
2632
  if (!n) return;
2624
2633
  let r = t.toCanvas({
@@ -2630,26 +2639,36 @@ function Ir(e, t) {
2630
2639
  evolution: n.targetEvolution
2631
2640
  }).x - r.x;
2632
2641
  }
2642
+ function Ir(e) {
2643
+ return Math.max(...Lr(e).map((e) => e.length)) * Pr;
2644
+ }
2633
2645
  function Lr(e) {
2634
- return (e ?? "").length * Fr;
2646
+ return (e ?? "").split("\n");
2647
+ }
2648
+ function Rr(e, t, n) {
2649
+ let r = (t - 1) * 16;
2650
+ return e - (n === "up" ? r : r / 2);
2651
+ }
2652
+ function zr(e, t, n) {
2653
+ return Rr(e, t, n) + (t - 1) * 16;
2635
2654
  }
2636
- function Rr() {
2655
+ function Br() {
2637
2656
  return {
2638
2657
  x: 22,
2639
2658
  y: -4
2640
2659
  };
2641
2660
  }
2642
- function zr(e, t) {
2643
- return t > 0 && t < Lr(e.wardleyLabel) + 30 + 14;
2661
+ function Vr(e, t) {
2662
+ return t > 0 && t < Ir(e.wardleyLabel) + 30 + 14;
2644
2663
  }
2645
- function Br(e, t) {
2646
- let n = Rr();
2664
+ function Hr(e, t) {
2665
+ let n = Br();
2647
2666
  if (e.labelOffset) return {
2648
2667
  x: n.x + e.labelOffset.dx,
2649
2668
  y: n.y + e.labelOffset.dy,
2650
2669
  anchor: "start"
2651
2670
  };
2652
- if (t !== void 0 && zr(e, t)) return {
2671
+ if (t !== void 0 && Vr(e, t)) return {
2653
2672
  x: -n.x,
2654
2673
  y: n.y,
2655
2674
  anchor: "end"
@@ -2661,14 +2680,14 @@ function Br(e, t) {
2661
2680
  anchor: "start"
2662
2681
  };
2663
2682
  }
2664
- function Vr(e) {
2683
+ function Ur(e) {
2665
2684
  return {
2666
2685
  x: e + 15 + 7,
2667
2686
  y: -4
2668
2687
  };
2669
2688
  }
2670
- function Hr(e, t) {
2671
- let n = Vr(t);
2689
+ function Wr(e, t) {
2690
+ let n = Ur(t);
2672
2691
  return e ? {
2673
2692
  x: n.x + e.dx,
2674
2693
  y: n.y + e.dy,
@@ -2683,21 +2702,21 @@ function Hr(e, t) {
2683
2702
  anchor: "start"
2684
2703
  };
2685
2704
  }
2686
- function Ur() {
2705
+ function Gr() {
2687
2706
  return {
2688
2707
  x: 0,
2689
2708
  y: -17
2690
2709
  };
2691
2710
  }
2692
- function Wr(e) {
2693
- let t = Ur();
2711
+ function Kr(e) {
2712
+ let t = Gr();
2694
2713
  return {
2695
2714
  x: t.x + (e.labelOffset?.dx ?? 0),
2696
2715
  y: t.y + (e.labelOffset?.dy ?? 0),
2697
2716
  anchor: "middle"
2698
2717
  };
2699
2718
  }
2700
- function Gr(e, t) {
2719
+ function qr(e, t) {
2701
2720
  let n = (e) => Math.max(-200, Math.min(200, Math.round(e))), r = {
2702
2721
  dx: n(e) || 0,
2703
2722
  dy: n(t) || 0
@@ -2705,7 +2724,7 @@ function Gr(e, t) {
2705
2724
  return r.dx === 0 && r.dy === 0 ? void 0 : r;
2706
2725
  }
2707
2726
  // src/draw/WardleyRenderer.ts
2708
- var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-label-handle", Yr = "data-label-role", Xr = 6, Zr = class extends ge {
2727
+ var Jr = 1500, B = "wardley-name-label", Yr = "wardley-movement", Xr = "wardley-label-handle", Zr = "data-label-role", Qr = 6, $r = class extends ge {
2709
2728
  grid;
2710
2729
  elementRegistry;
2711
2730
  static $inject = [
@@ -2714,7 +2733,7 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2714
2733
  "elementRegistry"
2715
2734
  ];
2716
2735
  constructor(e, t, n) {
2717
- super(e, Kr), this.grid = t, this.elementRegistry = n;
2736
+ super(e, Jr), this.grid = t, this.elementRegistry = n;
2718
2737
  }
2719
2738
  canRender(e) {
2720
2739
  return j(e) || M(e);
@@ -2746,14 +2765,14 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2746
2765
  return C(e, i), i;
2747
2766
  }
2748
2767
  drawConnection(e, t) {
2749
- let n = t, r = n.wardleyType === "flow", i = r ? k.flow : k.dependency, [a, o] = ii(n), s = w(T("polyline"), {
2768
+ let n = t, r = n.wardleyType === "flow", i = r ? k.flow : k.dependency, [a, o] = oi(n), s = w(T("polyline"), {
2750
2769
  points: `${a.x},${a.y} ${o.x},${o.y}`,
2751
2770
  fill: "none",
2752
2771
  stroke: i,
2753
2772
  "stroke-width": r ? 2.5 : 1.5,
2754
2773
  "stroke-linecap": "round"
2755
2774
  });
2756
- C(e, s), r && (C(e, ni(a, o, i, 11, 5)), n.bidirectional && C(e, ni(o, a, i, 11, 5)));
2775
+ C(e, s), r && (C(e, ii(a, o, i, 11, 5)), n.bidirectional && C(e, ii(o, a, i, 11, 5)));
2757
2776
  let c = (a.x + o.x) / 2, l = (a.y + o.y) / 2;
2758
2777
  return r && n.flowValue && C(e, H(n.flowValue, c, l - 5, {
2759
2778
  "text-anchor": "middle",
@@ -2775,8 +2794,8 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2775
2794
  return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
2776
2795
  }
2777
2796
  drawComponent(e, t) {
2778
- let n = t.width / 2, r = t.height / 2, i = t.decorators, a = Ir(t, this.grid);
2779
- a !== void 0 && this.drawMovement(e, t, n, r, a), i?.inertia && Qr(e, n, r);
2797
+ let n = t.width / 2, r = t.height / 2, i = t.decorators, a = Fr(t, this.grid);
2798
+ a !== void 0 && this.drawMovement(e, t, n, r, a), i?.inertia && ei(e, n, r);
2780
2799
  let o = t.color ?? k.stroke, s = V(n, r, 15, {
2781
2800
  fill: k.componentFill,
2782
2801
  stroke: o,
@@ -2786,24 +2805,24 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2786
2805
  fill: "none",
2787
2806
  stroke: o,
2788
2807
  "stroke-width": 1.5
2789
- })), $r(e, n, r, o, i), ei(e, t, n, r, Br(t, a)), s;
2808
+ })), ti(e, n, r, o, i), ni(e, t, n, r, Hr(t, a), a === void 0 ? "centered" : "up"), s;
2790
2809
  }
2791
2810
  drawMovement(e, t, n, r, i) {
2792
2811
  let a = t.movement;
2793
2812
  if (!a) return;
2794
- let o = w(T("g"), { class: qr });
2813
+ let o = w(T("g"), { class: Yr });
2795
2814
  C(e, o);
2796
2815
  let s = n + i, c = s - (Math.sign(i) || 1) * 17;
2797
- C(o, ti(n, r, c, r, {
2816
+ C(o, ri(n, r, c, r, {
2798
2817
  stroke: k.plotBackground,
2799
2818
  "stroke-width": 4,
2800
2819
  "stroke-linecap": "butt",
2801
2820
  class: "wardley-movement-underlay"
2802
- })), C(o, ti(n, r, c, r, {
2821
+ })), C(o, ri(n, r, c, r, {
2803
2822
  stroke: k.movement,
2804
2823
  "stroke-width": 1.5,
2805
2824
  "stroke-dasharray": "6 4"
2806
- })), C(o, ni({
2825
+ })), C(o, ii({
2807
2826
  x: n,
2808
2827
  y: r
2809
2828
  }, {
@@ -2815,30 +2834,33 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2815
2834
  "stroke-width": 2,
2816
2835
  class: "wardley-evolve-handle"
2817
2836
  }));
2818
- let l = Hr(a.labelOffset, i);
2819
- C(o, H(a.newLabel ?? t.wardleyLabel, n + l.x, r + l.y, {
2837
+ let l = Wr(a.labelOffset, i), u = a.newLabel ?? t.wardleyLabel;
2838
+ if (C(o, H(u, n + l.x, r + l.y, {
2820
2839
  "font-weight": "500",
2821
2840
  fill: k.movement,
2822
2841
  "text-anchor": l.anchor,
2823
- class: `wardley-movement-label ${Jr}`,
2824
- [Yr]: "movement"
2825
- })), a.method && C(o, H(a.method, n + l.x, r + l.y + 15, {
2826
- "font-size": 10.5,
2827
- fill: k.movement,
2828
- "text-anchor": l.anchor
2829
- }));
2842
+ class: `wardley-movement-label ${Xr}`,
2843
+ [Zr]: "movement"
2844
+ }, !0, "centered")), a.method) {
2845
+ let e = zr(r + l.y, Lr(u).length, "centered");
2846
+ C(o, H(a.method, n + l.x, e + 15, {
2847
+ "font-size": 10.5,
2848
+ fill: k.movement,
2849
+ "text-anchor": l.anchor
2850
+ }));
2851
+ }
2830
2852
  }
2831
2853
  drawAnchor(e, t) {
2832
- let n = t.width / 2, r = t.height / 2, i = Mr(Dr, n, r, 26, t.color ?? k.ink);
2854
+ let n = t.width / 2, r = t.height / 2, i = Nr(Ar, n, r, 26, t.color ?? k.ink);
2833
2855
  C(e, i);
2834
- let a = Wr(t);
2856
+ let a = Kr(t);
2835
2857
  return C(e, H(t.wardleyLabel, n + a.x, r + a.y, {
2836
2858
  "text-anchor": a.anchor,
2837
2859
  "font-weight": "700",
2838
- class: `${B} ${Jr}`,
2839
- [Yr]: "name",
2860
+ class: `${B} ${Xr}`,
2861
+ [Zr]: "name",
2840
2862
  ...t.color ? { fill: t.color } : {}
2841
- })), i;
2863
+ }, !0, "up")), i;
2842
2864
  }
2843
2865
  drawPipeline(e, t) {
2844
2866
  let n = Math.max(t.width, 1), r = t.color, i = w(T("rect"), {
@@ -2864,7 +2886,7 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2864
2886
  "font-weight": "500",
2865
2887
  class: B,
2866
2888
  ...r ? { fill: r } : {}
2867
- }))), i;
2889
+ }, !0, "up"))), i;
2868
2890
  }
2869
2891
  drawNote(e, t) {
2870
2892
  let n = t.color, r = (t.wardleyLabel ?? "").split("\n"), i = t.width / 2, a = t.height / 2 - (r.length - 1) * 17 / 2 + 4, o = {
@@ -2895,7 +2917,7 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2895
2917
  let o = this.grid.toCanvas({
2896
2918
  visibility: 1,
2897
2919
  evolution: 0
2898
- }).y, s = t.y - Xr - A.label >= o;
2920
+ }).y, s = t.y - Qr - A.label >= o;
2899
2921
  return C(e, H(ze[n] ?? n, s ? 4 : 10, s ? -6 : 18, {
2900
2922
  fill: i,
2901
2923
  "font-weight": "700",
@@ -2915,15 +2937,16 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2915
2937
  "font-weight": "700"
2916
2938
  }, !1)), t.wardleyLabel && C(e, H(t.wardleyLabel, n + 15, r + 4, {
2917
2939
  "font-size": 12,
2918
- fill: k.noteText
2919
- })), i;
2940
+ fill: k.noteText,
2941
+ class: B
2942
+ }, !0, "centered")), i;
2920
2943
  }
2921
2944
  drawAccelerator(e, t) {
2922
- let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a = Mr(i ? Ar : jr, n, r, 24, t.color ?? (i ? k.accelerator : k.deaccelerator));
2945
+ let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a = Nr(i ? jr : Mr, n, r, 24, t.color ?? (i ? k.accelerator : k.deaccelerator));
2923
2946
  return C(e, a), t.wardleyLabel && C(e, H(t.wardleyLabel, n + 15, r + 5, {
2924
2947
  "font-size": 12,
2925
2948
  class: B
2926
- })), a;
2949
+ }, !0, "centered")), a;
2927
2950
  }
2928
2951
  drawSubmap(e, t) {
2929
2952
  let n = t.width / 2, r = t.height / 2, i = t.color ?? k.stroke, a = w(T("rect"), {
@@ -2949,18 +2972,18 @@ var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-
2949
2972
  "font-weight": "500",
2950
2973
  class: B,
2951
2974
  ...t.color ? { fill: t.color } : {}
2952
- })), a;
2975
+ }, !0, "centered")), a;
2953
2976
  }
2954
2977
  };
2955
- function Qr(e, t, n) {
2978
+ function ei(e, t, n) {
2956
2979
  let r = t + 15 + 3;
2957
- C(e, ti(r, n - 13, r, n + 13, {
2980
+ C(e, ri(r, n - 13, r, n + 13, {
2958
2981
  stroke: k.inertia,
2959
2982
  "stroke-width": 3,
2960
2983
  "stroke-linecap": "round"
2961
2984
  }));
2962
2985
  }
2963
- function $r(e, t, n, r, i) {
2986
+ function ti(e, t, n, r, i) {
2964
2987
  if (i?.ecosystem && C(e, V(t, n, 18.5, {
2965
2988
  fill: "none",
2966
2989
  stroke: r,
@@ -2973,21 +2996,24 @@ function $r(e, t, n, r, i) {
2973
2996
  [3.4, 2.4]
2974
2997
  ]) C(e, V(t + i, n + a, 1.7, { fill: r }));
2975
2998
  }
2976
- function ei(e, t, n, r, i) {
2977
- let a = n + i.x, o = r + i.y;
2978
- C(e, H(t.wardleyLabel, a, o, {
2999
+ function ni(e, t, n, r, i, a) {
3000
+ let o = n + i.x, s = r + i.y;
3001
+ C(e, H(t.wardleyLabel, o, s, {
2979
3002
  "font-weight": "500",
2980
3003
  "text-anchor": i.anchor,
2981
- class: `${B} ${Jr}`,
2982
- [Yr]: "name",
3004
+ class: `${B} ${Xr}`,
3005
+ [Zr]: "name",
2983
3006
  ...t.color ? { fill: t.color } : {}
2984
- }));
2985
- let s = t.decorators?.method;
2986
- s && C(e, H(s, a, o + 15, {
2987
- "font-size": 10.5,
2988
- "text-anchor": i.anchor,
2989
- fill: k.axisText
2990
- }));
3007
+ }, !0, a));
3008
+ let c = t.decorators?.method;
3009
+ if (c) {
3010
+ let n = zr(s, Lr(t.wardleyLabel).length, a);
3011
+ C(e, H(c, o, n + 15, {
3012
+ "font-size": 10.5,
3013
+ "text-anchor": i.anchor,
3014
+ fill: k.axisText
3015
+ }));
3016
+ }
2991
3017
  }
2992
3018
  function V(e, t, n, r) {
2993
3019
  return w(T("circle"), {
@@ -2998,7 +3024,7 @@ function V(e, t, n, r) {
2998
3024
  ...r
2999
3025
  });
3000
3026
  }
3001
- function ti(e, t, n, r, i) {
3027
+ function ri(e, t, n, r, i) {
3002
3028
  return w(T("line"), {
3003
3029
  x1: e,
3004
3030
  y1: t,
@@ -3007,34 +3033,40 @@ function ti(e, t, n, r, i) {
3007
3033
  ...i
3008
3034
  });
3009
3035
  }
3010
- function H(e, t, n, r = {}, i = !0) {
3011
- let a = i ? {
3036
+ function H(e, t, n, r = {}, i = !0, a) {
3037
+ let o = a ? Lr(e) : [e], s = a ? Rr(n, o.length, a) : n, c = i ? {
3012
3038
  stroke: k.paper,
3013
3039
  "stroke-width": 3.5,
3014
3040
  "paint-order": "stroke",
3015
3041
  "stroke-linejoin": "round"
3016
- } : {}, o = w(T("text"), {
3042
+ } : {}, l = w(T("text"), {
3017
3043
  x: t,
3018
- y: n,
3044
+ y: s,
3019
3045
  "font-family": A.family,
3020
3046
  "font-size": A.label,
3021
3047
  fill: k.ink,
3022
- ...a,
3048
+ ...c,
3023
3049
  ...r
3024
3050
  });
3025
- return o.textContent = e, o;
3051
+ return o.length === 1 ? (l.textContent = o[0], l) : (o.forEach((e, n) => {
3052
+ let r = w(T("tspan"), {
3053
+ x: t,
3054
+ y: s + n * 16
3055
+ });
3056
+ r.textContent = e, C(l, r);
3057
+ }), l);
3026
3058
  }
3027
- function ni(e, t, n, r = 10, i = 5) {
3059
+ function ii(e, t, n, r = 10, i = 5) {
3028
3060
  let a = Math.atan2(t.y - e.y, t.x - e.x), o = t.x - r * Math.cos(a), s = t.y - r * Math.sin(a), c = `${t.x},${t.y} ${o - i * Math.sin(a)},${s + i * Math.cos(a)} ${o + i * Math.sin(a)},${s - i * Math.cos(a)}`;
3029
3061
  return w(T("polygon"), {
3030
3062
  points: c,
3031
3063
  fill: n
3032
3064
  });
3033
3065
  }
3034
- function ri(e) {
3066
+ function ai(e) {
3035
3067
  return e.wardleyType === "component" ? 17 : e.wardleyType === "anchor" ? 14 : e.wardleyType === "pipeline" ? 10 : Math.min(e.width, e.height) / 2;
3036
3068
  }
3037
- function ii(e) {
3069
+ function oi(e) {
3038
3070
  let t = e.source, n = e.target, r = e.waypoints;
3039
3071
  if (!t || !n) {
3040
3072
  let e = r[0] ?? {
@@ -3043,7 +3075,7 @@ function ii(e) {
3043
3075
  };
3044
3076
  return [e, r[r.length - 1] ?? e];
3045
3077
  }
3046
- let i = R(t), a = R(n), o = a.x - i.x, s = a.y - i.y, c = Math.hypot(o, s) || 1, l = o / c, u = s / c, d = ri(t), f = ri(n);
3078
+ let i = R(t), a = R(n), o = a.x - i.x, s = a.y - i.y, c = Math.hypot(o, s) || 1, l = o / c, u = s / c, d = ai(t), f = ai(n);
3047
3079
  return c <= d + f + 2 ? [i, a] : [{
3048
3080
  x: i.x + l * d,
3049
3081
  y: i.y + u * d
@@ -3053,35 +3085,35 @@ function ii(e) {
3053
3085
  }];
3054
3086
  }
3055
3087
  // src/draw/index.ts
3056
- var ai = {
3088
+ var si = {
3057
3089
  __init__: ["wardleyRenderer"],
3058
- wardleyRenderer: ["type", Zr]
3059
- }, oi = class extends sn {
3090
+ wardleyRenderer: ["type", $r]
3091
+ }, ci = class extends un {
3060
3092
  _getModules() {
3061
3093
  return [
3062
- mn,
3063
- Tr,
3064
- ai,
3094
+ _n,
3095
+ Or,
3096
+ si,
3065
3097
  mt
3066
3098
  ];
3067
3099
  }
3068
- }, si = 180, ci = 80, li = 120, ui = 96, di = .5, fi = (e, t, n) => e < t ? t : e > n ? n : e;
3069
- function pi(e, t, n, r) {
3100
+ }, li = 180, ui = 80, di = 120, fi = 96, pi = .5, mi = (e, t, n) => e < t ? t : e > n ? n : e;
3101
+ function hi(e, t, n, r) {
3070
3102
  let i = n.min - n.padBefore, a = n.max + n.padAfter;
3071
- return !r && t >= n.max - n.min ? fi(e, Math.min(n.max - t, i), Math.max(n.min, a - t)) : t <= a - i ? fi(e, i, a - t) : (i + a) / 2 - t / 2;
3103
+ return !r && t >= n.max - n.min ? mi(e, Math.min(n.max - t, i), Math.max(n.min, a - t)) : t <= a - i ? mi(e, i, a - t) : (i + a) / 2 - t / 2;
3072
3104
  }
3073
- function mi(e, t, n) {
3105
+ function gi(e, t, n) {
3074
3106
  let r = e - n.after;
3075
3107
  return {
3076
3108
  lowest: Math.min(t.min - n.before - n.slack, t.max - r - n.slack),
3077
3109
  highest: Math.max(t.max - r + n.slack, t.min - n.before + n.slack)
3078
3110
  };
3079
3111
  }
3080
- function hi(e, t, n, r, i) {
3081
- let a = mi(t, n, i), o = mi(t, r, i);
3082
- return fi(e, Math.min(a.lowest, o.lowest), Math.max(a.highest, o.highest));
3112
+ function _i(e, t, n, r, i) {
3113
+ let a = gi(t, n, i), o = gi(t, r, i);
3114
+ return mi(e, Math.min(a.lowest, o.lowest), Math.max(a.highest, o.highest));
3083
3115
  }
3084
- var gi = class {
3116
+ var vi = class {
3085
3117
  canvas;
3086
3118
  grid;
3087
3119
  static $inject = [
@@ -3113,7 +3145,7 @@ var gi = class {
3113
3145
  freeArea(e) {
3114
3146
  let t = this.freeRect?.insets(), n = t ? e.scale ?? this.canvas.zoom() : 0;
3115
3147
  if (!t || !(n > 0)) return;
3116
- let r = ui / n, i = (e, t, i) => e * n - t - i > 0 ? {
3148
+ let r = fi / n, i = (e, t, i) => e * n - t - i > 0 ? {
3117
3149
  before: t / n,
3118
3150
  after: i / n,
3119
3151
  slack: r
@@ -3138,26 +3170,26 @@ var gi = class {
3138
3170
  min: r.y,
3139
3171
  max: r.y + r.height
3140
3172
  }, o = this.freeArea(n), s = this.grid.outerBounds(), c = {
3141
- top: si,
3142
- right: li,
3143
- bottom: ci,
3144
- left: li
3145
- }, l = o ? hi(n.x, n.width, i, {
3173
+ top: li,
3174
+ right: di,
3175
+ bottom: ui,
3176
+ left: di
3177
+ }, l = o ? _i(n.x, n.width, i, {
3146
3178
  min: s.x,
3147
3179
  max: s.x + s.width
3148
- }, o.x) : pi(n.x, n.width, {
3180
+ }, o.x) : hi(n.x, n.width, {
3149
3181
  ...i,
3150
3182
  padBefore: c.left,
3151
3183
  padAfter: c.right
3152
- }, t), u = o ? hi(n.y, n.height, a, {
3184
+ }, t), u = o ? _i(n.y, n.height, a, {
3153
3185
  min: s.y,
3154
3186
  max: s.y + s.height
3155
- }, o.y) : pi(n.y, n.height, {
3187
+ }, o.y) : hi(n.y, n.height, {
3156
3188
  ...a,
3157
3189
  padBefore: c.top,
3158
3190
  padAfter: c.bottom
3159
3191
  }, t);
3160
- if (!(Math.abs(l - n.x) < di && Math.abs(u - n.y) < di)) {
3192
+ if (!(Math.abs(l - n.x) < pi && Math.abs(u - n.y) < pi)) {
3161
3193
  this.applying = !0;
3162
3194
  try {
3163
3195
  this.canvas.viewbox({
@@ -3171,10 +3203,10 @@ var gi = class {
3171
3203
  }
3172
3204
  }
3173
3205
  }
3174
- }, _i = {
3206
+ }, yi = {
3175
3207
  __init__: ["panConstraint"],
3176
- panConstraint: ["type", gi]
3177
- }, vi = class {
3208
+ panConstraint: ["type", vi]
3209
+ }, bi = class {
3178
3210
  canvas;
3179
3211
  config;
3180
3212
  static $inject = ["canvas", "config.wardleyFreeRect"];
@@ -3204,7 +3236,7 @@ var gi = class {
3204
3236
  y: t.y + a(i, n.top, n.bottom) / t.scale
3205
3237
  };
3206
3238
  }
3207
- }, yi = { wardleyFreeRect: ["type", vi] }, bi = class extends oi {
3239
+ }, xi = { wardleyFreeRect: ["type", bi] }, Si = class extends ci {
3208
3240
  _getModules() {
3209
3241
  return [
3210
3242
  ...super._getModules(),
@@ -3212,11 +3244,11 @@ var gi = class {
3212
3244
  ve,
3213
3245
  ye,
3214
3246
  be,
3215
- yi,
3216
- _i
3247
+ xi,
3248
+ yi
3217
3249
  ];
3218
3250
  }
3219
- }, xi = class {
3251
+ }, Ci = class {
3220
3252
  static $inject = [
3221
3253
  "eventBus",
3222
3254
  "canvas",
@@ -3235,37 +3267,37 @@ var gi = class {
3235
3267
  if (e.element === i) return n.activateLasso(r), !1;
3236
3268
  });
3237
3269
  }
3238
- }, Si = {
3270
+ }, wi = {
3239
3271
  __depends__: [Ae],
3240
3272
  __init__: ["wardleyLassoBehavior"],
3241
- wardleyLassoBehavior: ["type", xi]
3242
- }, Ci = /* @__PURE__ */ new Set([
3273
+ wardleyLassoBehavior: ["type", Ci]
3274
+ }, Ti = /* @__PURE__ */ new Set([
3243
3275
  "component",
3244
3276
  "anchor",
3245
3277
  "submap",
3246
3278
  "pipeline"
3247
- ]), wi = /* @__PURE__ */ new Set(["e", "w"]);
3248
- function Ti(e) {
3249
- return j(e) && Ci.has(e.wardleyType);
3279
+ ]), Ei = /* @__PURE__ */ new Set(["e", "w"]);
3280
+ function Di(e) {
3281
+ return j(e) && Ti.has(e.wardleyType);
3250
3282
  }
3251
- function Ei(e, t) {
3283
+ function Oi(e, t) {
3252
3284
  return (e.outgoing ?? []).some((e) => e.target === t) || (e.incoming ?? []).some((e) => e.source === t);
3253
3285
  }
3254
- var Di = class extends ce {
3286
+ var ki = class extends ce {
3255
3287
  static $inject = ["eventBus"];
3256
3288
  constructor(e) {
3257
3289
  super(e);
3258
3290
  }
3259
3291
  init() {
3260
- this.addRule("connection.start", (e) => Ti(e.source)), this.addRule("connection.create", (e) => {
3292
+ this.addRule("connection.start", (e) => Di(e.source)), this.addRule("connection.create", (e) => {
3261
3293
  let { source: t, target: n } = e;
3262
- return !Ti(t) || !Ti(n) || t === n || Ei(t, n) ? !1 : { wardleyType: "dependency" };
3263
- }), this.addRule("shape.move", () => !0), this.addRule("elements.move", (e) => !e.target?.parent || null), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => P(e.shape) ? !e.direction || wi.has(e.direction) : tt(e.shape));
3294
+ return !Di(t) || !Di(n) || t === n || Oi(t, n) ? !1 : { wardleyType: "dependency" };
3295
+ }), this.addRule("shape.move", () => !0), this.addRule("elements.move", (e) => !e.target?.parent || null), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => P(e.shape) ? !e.direction || Ei.has(e.direction) : tt(e.shape));
3264
3296
  }
3265
- }, Oi = {
3297
+ }, Ai = {
3266
3298
  __init__: ["wardleyRules"],
3267
- wardleyRules: ["type", Di]
3268
- }, ki = {
3299
+ wardleyRules: ["type", ki]
3300
+ }, ji = {
3269
3301
  __init__: ["stageSnapping"],
3270
3302
  stageSnapping: ["type", class {
3271
3303
  static $inject = [
@@ -3305,20 +3337,20 @@ var Di = class extends ce {
3305
3337
  });
3306
3338
  }
3307
3339
  }]
3308
- }, U = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="wardley-palette-svg">${e}</svg>`, Ai = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="wardley-palette-svg">${e}</svg>`, ji = "<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\"/><path d=\"M5 3a2 2 0 0 0-2 2\"/><path d=\"M19 3a2 2 0 0 1 2 2\"/><path d=\"M5 21a2 2 0 0 1-2-2\"/><path d=\"M9 3h1\"/><path d=\"M9 21h2\"/><path d=\"M14 3h1\"/><path d=\"M3 9v1\"/><path d=\"M21 9v2\"/><path d=\"M3 14v1\"/>", Mi = "<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>", Ni = (e = "") => `<circle cx="12" cy="12" r="7" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="2"/>${e}`, Pi = (e, t) => `<text x="12" text-anchor="middle" font-family="${A.family}" ${t}>${e}</text>`, W = {
3309
- draw: Ai(Mi),
3310
- lasso: Ai(ji),
3311
- component: U(Ni()),
3312
- market: U(Ni(`<circle cx="12" cy="10" r="1.4" fill="${k.stroke}"/><circle cx="10.2" cy="13.4" r="1.4" fill="${k.stroke}"/><circle cx="13.8" cy="13.4" r="1.4" fill="${k.stroke}"/>`)),
3313
- ecosystem: U(Ni(`<circle cx="12" cy="12" r="10" fill="none" stroke="${k.stroke}" stroke-width="1.25" stroke-dasharray="1.5 3" stroke-linecap="round"/>`)),
3314
- anchor: U(`<path d="${Dr}" fill="${k.ink}"/>`),
3340
+ }, U = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="wardley-palette-svg">${e}</svg>`, Mi = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="wardley-palette-svg">${e}</svg>`, Ni = "<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\"/><path d=\"M5 3a2 2 0 0 0-2 2\"/><path d=\"M19 3a2 2 0 0 1 2 2\"/><path d=\"M5 21a2 2 0 0 1-2-2\"/><path d=\"M9 3h1\"/><path d=\"M9 21h2\"/><path d=\"M14 3h1\"/><path d=\"M3 9v1\"/><path d=\"M21 9v2\"/><path d=\"M3 14v1\"/>", Pi = "<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>", Fi = (e = "") => `<circle cx="12" cy="12" r="7" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="2"/>${e}`, Ii = (e, t) => `<text x="12" text-anchor="middle" font-family="${A.family}" ${t}>${e}</text>`, W = {
3341
+ draw: Mi(Pi),
3342
+ lasso: Mi(Ni),
3343
+ component: U(Fi()),
3344
+ market: U(Fi(`<circle cx="12" cy="10" r="1.4" fill="${k.stroke}"/><circle cx="10.2" cy="13.4" r="1.4" fill="${k.stroke}"/><circle cx="13.8" cy="13.4" r="1.4" fill="${k.stroke}"/>`)),
3345
+ ecosystem: U(Fi(`<circle cx="12" cy="12" r="10" fill="none" stroke="${k.stroke}" stroke-width="1.25" stroke-dasharray="1.5 3" stroke-linecap="round"/>`)),
3346
+ anchor: U(`<path d="${Ar}" fill="${k.ink}"/>`),
3315
3347
  pipeline: U(`<rect x="9.5" y="2.5" width="5.5" height="5.5" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="1.5"/><rect x="2" y="10" width="20" height="9" rx="2" fill="none" stroke="${k.pipeline}" stroke-width="1.25" stroke-dasharray="3 2"/><circle cx="7" cy="14.5" r="2.2" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="1.2"/><circle cx="17" cy="14.5" r="2.2" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="1.2"/>`),
3316
3348
  note: U(`<g fill="none" stroke="${k.noteText}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4h14v11l-5 5H5z" fill="${k.componentFill}"/><path d="M14 20v-5h5"/><line x1="8" y1="8.5" x2="16" y2="8.5"/><line x1="8" y1="12" x2="13" y2="12"/></g>`),
3317
- annotation: U(`<circle cx="12" cy="12" r="8" fill="${k.annotationFill}" stroke="${k.stroke}" stroke-width="1.25"/>` + Pi("1", `y="16" font-size="11" font-weight="700" fill="${k.stroke}"`)),
3318
- accelerator: U(`<path d="${Ar}" fill="${k.accelerator}"/>`),
3319
- deaccelerator: U(`<path d="${jr}" fill="${k.deaccelerator}"/>`),
3349
+ annotation: U(`<circle cx="12" cy="12" r="8" fill="${k.annotationFill}" stroke="${k.stroke}" stroke-width="1.25"/>` + Ii("1", `y="16" font-size="11" font-weight="700" fill="${k.stroke}"`)),
3350
+ accelerator: U(`<path d="${jr}" fill="${k.accelerator}"/>`),
3351
+ deaccelerator: U(`<path d="${Mr}" fill="${k.deaccelerator}"/>`),
3320
3352
  submap: U(`<rect x="4" y="4" width="16" height="16" rx="3" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="2"/><rect x="7.5" y="7.5" width="9" height="9" rx="1.5" fill="none" stroke="${k.stroke}" stroke-width="1"/>`)
3321
- }, Fi = {
3353
+ }, Li = {
3322
3354
  pioneers: "P",
3323
3355
  settlers: "S",
3324
3356
  townplanners: "T"
@@ -3327,15 +3359,15 @@ var Di = class extends ce {
3327
3359
  * straight segment. Lucide (lucide-static 1.59.0) @license ISC
3328
3360
  * Copyright (c) 2026 Lucide Icons and Contributors
3329
3361
  * Full notice: README.md of @miragon/wardley-renderer */
3330
- function Ii(e) {
3362
+ function Ri(e) {
3331
3363
  let t = Re[e] ?? {
3332
3364
  fill: k.band,
3333
3365
  stroke: k.dependency
3334
- }, n = Fi[e] ?? "";
3335
- return U(`<rect x="2" y="6" width="20" height="12" rx="3" fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5" stroke-dasharray="3 2"/>` + Pi(n, `y="15.3" font-size="9" font-weight="700" fill="${k.ink}"`));
3366
+ }, n = Li[e] ?? "";
3367
+ return U(`<rect x="2" y="6" width="20" height="12" rx="3" fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5" stroke-dasharray="3 2"/>` + Ii(n, `y="15.3" font-size="9" font-weight="700" fill="${k.ink}"`));
3336
3368
  }
3337
3369
  // src/palette/WardleyPaletteProvider.ts
3338
- var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3370
+ var G = "wardley-1-blocks", zi = "wardley-2-strategy", Bi = [
3339
3371
  {
3340
3372
  key: "component",
3341
3373
  type: "component",
@@ -3394,8 +3426,8 @@ var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3394
3426
  type: "attitude",
3395
3427
  label: "Pioneers",
3396
3428
  title: "Pioneers region",
3397
- icon: Ii("pioneers"),
3398
- group: Li,
3429
+ icon: Ri("pioneers"),
3430
+ group: zi,
3399
3431
  extra: { attitudeKind: "pioneers" }
3400
3432
  },
3401
3433
  {
@@ -3403,8 +3435,8 @@ var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3403
3435
  type: "attitude",
3404
3436
  label: "Settlers",
3405
3437
  title: "Settlers region",
3406
- icon: Ii("settlers"),
3407
- group: Li,
3438
+ icon: Ri("settlers"),
3439
+ group: zi,
3408
3440
  extra: { attitudeKind: "settlers" }
3409
3441
  },
3410
3442
  {
@@ -3412,8 +3444,8 @@ var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3412
3444
  type: "attitude",
3413
3445
  label: "Town Planners",
3414
3446
  title: "Town Planners region",
3415
- icon: Ii("townplanners"),
3416
- group: Li,
3447
+ icon: Ri("townplanners"),
3448
+ group: zi,
3417
3449
  extra: { attitudeKind: "townplanners" }
3418
3450
  },
3419
3451
  {
@@ -3422,7 +3454,7 @@ var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3422
3454
  label: "Accelerate",
3423
3455
  title: "Accelerator",
3424
3456
  icon: W.accelerator,
3425
- group: Li,
3457
+ group: zi,
3426
3458
  extra: { acceleratorDirection: "accelerate" }
3427
3459
  },
3428
3460
  {
@@ -3431,7 +3463,7 @@ var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3431
3463
  label: "Deaccelerate",
3432
3464
  title: "Deaccelerator",
3433
3465
  icon: W.deaccelerator,
3434
- group: Li,
3466
+ group: zi,
3435
3467
  extra: { acceleratorDirection: "deaccelerate" }
3436
3468
  },
3437
3469
  {
@@ -3448,18 +3480,18 @@ var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
3448
3480
  title: "Lasso",
3449
3481
  shortcut: "L",
3450
3482
  icon: W.lasso
3451
- }, zi = {
3483
+ }, Vi = {
3452
3484
  key: "draw-tool",
3453
3485
  title: "Draw",
3454
3486
  icon: W.draw
3455
- }, Bi = 24, Vi = 24, Hi = 12;
3456
- function Ui(e) {
3487
+ }, Hi = 24, Ui = 24, Wi = 12;
3488
+ function Gi(e) {
3457
3489
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
3458
3490
  }
3459
- function Wi(e) {
3491
+ function Ki(e) {
3460
3492
  return e.type === "click" && e.detail === 0;
3461
3493
  }
3462
- var Gi = class {
3494
+ var qi = class {
3463
3495
  create;
3464
3496
  factory;
3465
3497
  lassoTool;
@@ -3486,19 +3518,19 @@ var Gi = class {
3486
3518
  action: { click: (e) => {
3487
3519
  this.lassoTool.activateSelection(e), this.focusCanvasAfterPointer(e);
3488
3520
  } }
3489
- }, e[zi.key] = {
3521
+ }, e[Vi.key] = {
3490
3522
  group: "tools",
3491
- ...this.describe(zi.title, zi.shortcut),
3492
- html: this.entryHtml(zi.title, zi.icon, zi.shortcut),
3523
+ ...this.describe(Vi.title, Vi.shortcut),
3524
+ html: this.entryHtml(Vi.title, Vi.icon, Vi.shortcut),
3493
3525
  action: { click: (e) => {
3494
3526
  this.drawTool.toggle(), this.focusCanvasAfterPointer(e);
3495
3527
  } }
3496
3528
  };
3497
- for (let t of Ri) {
3529
+ for (let t of Bi) {
3498
3530
  let n = (e) => {
3499
3531
  this.create.start(e, this.createShapeFor(t)), this.focusCanvasAfterPointer(e);
3500
3532
  }, r = (e) => {
3501
- Wi(e) ? this.createAtFreeCenter(`create.${t.key}`) : n(e);
3533
+ Ki(e) ? this.createAtFreeCenter(`create.${t.key}`) : n(e);
3502
3534
  };
3503
3535
  e[`create.${t.key}`] = {
3504
3536
  group: t.group,
@@ -3513,13 +3545,13 @@ var Gi = class {
3513
3545
  return e;
3514
3546
  }
3515
3547
  createAtFreeCenter(e) {
3516
- let t = Ri.find((t) => `create.${t.key}` === e);
3548
+ let t = Bi.find((t) => `create.${t.key}` === e);
3517
3549
  if (!t) return;
3518
3550
  let n = this.injector.get("modeling"), r = this.injector.get("canvas"), i = this.injector.get("evolutionGrid"), a = this.createShapeFor(t), o = this.freeCenterPosition(a, r, i);
3519
3551
  return n.createShape(a, o, r.getRootElement()), this.injector.get("selection", !1)?.select(a), r.focus(), t.type !== "attitude" && this.injector.get("wardleyLabelEditing", !1)?.activate(a), a;
3520
3552
  }
3521
3553
  focusCanvasAfterPointer(e) {
3522
- Wi(e) || L(this.injector.get("canvas"));
3554
+ Ki(e) || L(this.injector.get("canvas"));
3523
3555
  }
3524
3556
  createShapeFor(e) {
3525
3557
  return this.factory.createNew(e.type, e.label, e.extra ?? {});
@@ -3535,13 +3567,13 @@ var Gi = class {
3535
3567
  evolution: 1,
3536
3568
  visibility: 0
3537
3569
  }), o = (e, t, n, r) => {
3538
- let i = t + r / 2 + Bi, a = n - r / 2 - Bi;
3570
+ let i = t + r / 2 + Hi, a = n - r / 2 - Hi;
3539
3571
  return i > a ? (t + n) / 2 : Math.min(a, Math.max(i, e));
3540
3572
  }, s = (t) => ({
3541
- x: o(r.x + t * Vi, i.x, a.x, e.width),
3542
- y: o(r.y + t * Vi, i.y, a.y, e.height)
3573
+ x: o(r.x + t * Ui, i.x, a.x, e.width),
3574
+ y: o(r.y + t * Ui, i.y, a.y, e.height)
3543
3575
  }), c = this.injector.get("elementRegistry"), l = (t) => c.find((n) => j(n) && n.wardleyType !== "attitude" && n.wardleyType !== "drawing" && Math.abs(n.x + n.width / 2 - t.x) < (n.width + e.width) / 2 && Math.abs(n.y + n.height / 2 - t.y) < (n.height + e.height) / 2) !== void 0;
3544
- for (let e = 0; e < Hi; e++) {
3576
+ for (let e = 0; e < Wi; e++) {
3545
3577
  let t = s(e);
3546
3578
  if (!l(t)) return t;
3547
3579
  }
@@ -3554,12 +3586,12 @@ var Gi = class {
3554
3586
  } : { title: e };
3555
3587
  }
3556
3588
  entryHtml(e, t, n, r = !1) {
3557
- let i = this.needsNativeTitle ? ` title="${Ui(n ? `${e} (${n})` : e)}"` : "", a = n ? ` aria-keyshortcuts="${Ui(n)}"` : "";
3589
+ let i = this.needsNativeTitle ? ` title="${Gi(n ? `${e} (${n})` : e)}"` : "", a = n ? ` aria-keyshortcuts="${Gi(n)}"` : "";
3558
3590
  return `<div class="entry wardley-palette-entry"${r ? " draggable=\"true\"" : ""}${i}${a}>${t}</div>`;
3559
3591
  }
3560
- }, Ki = ".djs-palette-entries .entry", qi = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), Ji = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), Yi = /* @__PURE__ */ new Set(["Enter", " "]), Xi = {
3592
+ }, Ji = ".djs-palette-entries .entry", Yi = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), Xi = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), Zi = /* @__PURE__ */ new Set(["Enter", " "]), Qi = {
3561
3593
  __init__: ["wardleyPaletteProvider", "wardleyPaletteKeyboard"],
3562
- wardleyPaletteProvider: ["type", Gi],
3594
+ wardleyPaletteProvider: ["type", qi],
3563
3595
  wardleyPaletteKeyboard: ["type", class {
3564
3596
  palette;
3565
3597
  provider;
@@ -3584,7 +3616,7 @@ var Gi = class {
3584
3616
  }), this.updateTabStops());
3585
3617
  }
3586
3618
  entries() {
3587
- return this.container ? Array.from(this.container.querySelectorAll(Ki)) : [];
3619
+ return this.container ? Array.from(this.container.querySelectorAll(Ji)) : [];
3588
3620
  }
3589
3621
  entryOf(e) {
3590
3622
  if (!(e instanceof Element) || !this.container) return null;
@@ -3601,7 +3633,7 @@ var Gi = class {
3601
3633
  let t = this.entryOf(e.target);
3602
3634
  if (!t || e.altKey || e.ctrlKey || e.metaKey) return;
3603
3635
  let n = this.entries(), r = n.indexOf(t), i;
3604
- qi.has(e.key) ? i = n[(r - 1 + n.length) % n.length] : Ji.has(e.key) ? i = n[(r + 1) % n.length] : e.key === "Home" ? i = n[0] : e.key === "End" && (i = n[n.length - 1]), i ? (e.preventDefault(), e.stopPropagation(), i.focus()) : Yi.has(e.key) && (e.preventDefault(), e.stopPropagation(), this.activate(t));
3636
+ Yi.has(e.key) ? i = n[(r - 1 + n.length) % n.length] : Xi.has(e.key) ? i = n[(r + 1) % n.length] : e.key === "Home" ? i = n[0] : e.key === "End" && (i = n[n.length - 1]), i ? (e.preventDefault(), e.stopPropagation(), i.focus()) : Zi.has(e.key) && (e.preventDefault(), e.stopPropagation(), this.activate(t));
3605
3637
  }
3606
3638
  activate(e) {
3607
3639
  let t = e.getAttribute("data-action");
@@ -3614,29 +3646,29 @@ var Gi = class {
3614
3646
  this.palette.triggerEntry(t, "click", r);
3615
3647
  }
3616
3648
  }]
3617
- }, Zi = 8, Qi = 134, $i = class extends je {
3649
+ }, $i = 8, ea = 134, ta = class extends je {
3618
3650
  _getTargetBounds(e) {
3619
3651
  let t = Array.isArray(e) ? e : [e], n = t.flatMap((e) => this.visualRects(e, "node"));
3620
3652
  if (!n.length) return je.prototype._getTargetBounds.call(this, e);
3621
- let r = ea(n), i = r.right + this.padWidth() + Zi * this.internals()._canvas.zoom(), a = t.flatMap((e) => this.visualRects(e, "movement"));
3622
- return t.flatMap((e) => this.movementTargetRects(e)).some((e) => e.right > r.right && e.left < i) ? ea([...n, ...a]) : r;
3653
+ let r = na(n), i = r.right + this.padWidth() + $i * this.internals()._canvas.zoom(), a = t.flatMap((e) => this.visualRects(e, "movement"));
3654
+ return t.flatMap((e) => this.movementTargetRects(e)).some((e) => e.right > r.right && e.left < i) ? na([...n, ...a]) : r;
3623
3655
  }
3624
3656
  internals() {
3625
3657
  return this;
3626
3658
  }
3627
3659
  padWidth() {
3628
- return this.internals()._current?.html?.getBoundingClientRect().width || Qi;
3660
+ return this.internals()._current?.html?.getBoundingClientRect().width || ea;
3629
3661
  }
3630
3662
  movementTargetRects(e) {
3631
- let t = this.internals()._canvas.getGraphics(e)?.querySelectorAll(`.djs-visual > .${qr} > :is(.wardley-evolve-handle, text)`);
3663
+ let t = this.internals()._canvas.getGraphics(e)?.querySelectorAll(`.djs-visual > .${Yr} > :is(.wardley-evolve-handle, text)`);
3632
3664
  return Array.from(t ?? []).map((e) => e.getBoundingClientRect());
3633
3665
  }
3634
3666
  visualRects(e, t) {
3635
3667
  let n = this.internals()._canvas.getGraphics(e);
3636
- return n ? Array.from(n.children).flatMap((e) => e.classList.contains("djs-visual") ? Array.from(e.children).filter((e) => e.classList.contains(qr) === (t === "movement")) : t === "node" ? [e] : []).map((e) => e.getBoundingClientRect()).filter((e) => e.width > 0 || e.height > 0) : [];
3668
+ return n ? Array.from(n.children).flatMap((e) => e.classList.contains("djs-visual") ? Array.from(e.children).filter((e) => e.classList.contains(Yr) === (t === "movement")) : t === "node" ? [e] : []).map((e) => e.getBoundingClientRect()).filter((e) => e.width > 0 || e.height > 0) : [];
3637
3669
  }
3638
3670
  };
3639
- function ea(e) {
3671
+ function na(e) {
3640
3672
  let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.right)), i = Math.max(...e.map((e) => e.bottom));
3641
3673
  return {
3642
3674
  left: t,
@@ -3650,7 +3682,7 @@ function ea(e) {
3650
3682
  };
3651
3683
  }
3652
3684
  // src/label-editing/fieldError.ts
3653
- function ta(e, t, n, r) {
3685
+ function ra(e, t, n, r) {
3654
3686
  let i;
3655
3687
  return {
3656
3688
  get caption() {
@@ -3665,31 +3697,37 @@ function ta(e, t, n, r) {
3665
3697
  };
3666
3698
  }
3667
3699
  // src/label-editing/WardleyLabelEditing.ts
3668
- function na(e, t) {
3700
+ function ia(e, t) {
3669
3701
  if (e.focus(), t.selection) {
3670
3702
  let n = e.value.length;
3671
3703
  e.setSelectionRange(Math.min(t.selection.start, n), Math.min(t.selection.end, n));
3672
3704
  } else e.select();
3673
3705
  }
3674
- var ra = "wardley-name-label", ia = "wardley-label-editing", aa = /* @__PURE__ */ new Set(["attitude", "drawing"]), oa = 500, sa = 6, ca = 2, la = 1.5, ua = 1.25, da = 11, fa = 4, pa = "Cmd/Ctrl+Enter to save · Esc to cancel";
3675
- function ma(e) {
3706
+ var aa = "wardley-name-label", oa = "wardley-label-editing", sa = /* @__PURE__ */ new Set(["attitude", "drawing"]), ca = 500, la = 6, ua = 2, da = 1.5, fa = 1.25, pa = 11, ma = 4;
3707
+ function ha(e) {
3708
+ return e.isComposing || e.keyCode === 229;
3709
+ }
3710
+ var ga = "Cmd/Ctrl+Enter to save · Esc to cancel";
3711
+ function _a(e) {
3676
3712
  return `“${e}” already exists. Names must be unique because links refer to them.`;
3677
3713
  }
3678
- function ha(e) {
3679
- return e.replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
3714
+ function va(e) {
3715
+ return e.replace(/\r\n?/g, "\n").replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
3680
3716
  }
3681
- var ga;
3682
- function _a(e, t, n) {
3683
- return ga === void 0 && (ga = document.createElement("canvas").getContext("2d")), ga ? (ga.font = t, ga.measureText(e).width) : e.length * n * .6;
3717
+ var ya;
3718
+ function ba(e, t, n) {
3719
+ return ya === void 0 && (ya = document.createElement("canvas").getContext("2d")), ya ? (ya.font = t, ya.measureText(e).width) : e.length * n * .6;
3684
3720
  }
3685
- var va = class {
3721
+ var xa = class {
3686
3722
  eventBus;
3687
3723
  canvas;
3724
+ elementRegistry;
3688
3725
  modeling;
3689
3726
  factory;
3690
3727
  static $inject = [
3691
3728
  "eventBus",
3692
3729
  "canvas",
3730
+ "elementRegistry",
3693
3731
  "wardleyModeling",
3694
3732
  "wardleyElementFactory",
3695
3733
  "injector"
@@ -3699,41 +3737,41 @@ var va = class {
3699
3737
  contextPad;
3700
3738
  selection;
3701
3739
  locked;
3702
- constructor(e, t, n, r, i) {
3703
- this.eventBus = e, this.canvas = t, this.modeling = n, this.factory = r, jt(), this.contextPad = i.get("contextPad", !1) ?? null, this.selection = i.get("selection", !1) ?? null, this.locked = () => I(i), e.on("element.dblclick", (e) => {
3740
+ constructor(e, t, n, r, i, a) {
3741
+ this.eventBus = e, this.canvas = t, this.elementRegistry = n, this.modeling = r, this.factory = i, jt(), this.contextPad = a.get("contextPad", !1) ?? null, this.selection = a.get("selection", !1) ?? null, this.locked = () => I(a), e.on("element.dblclick", (e) => {
3704
3742
  j(e.element) ? this.activate(e.element) : M(e.element) && this.activateConnection(e.element);
3705
- }), e.on(["element.mousedown", "drag.init"], () => this.active?.commit("outside")), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on(["shape.changed", "connection.changed"], oa, (e) => {
3743
+ }), e.on(["element.mousedown", "drag.init"], () => this.active?.commit("outside")), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on(["shape.changed", "connection.changed"], ca, (e) => {
3706
3744
  this.active && e.element?.id === this.active.elementId && this.active.relayout();
3707
3745
  }), e.on(["shape.remove", "connection.remove"], (e) => {
3708
3746
  this.active && e.element?.id === this.active.elementId && this.cancel();
3709
3747
  }), e.on("diagram.destroy", () => this.cancel());
3710
3748
  }
3711
3749
  activate(e, t = {}) {
3712
- if (!j(e) || aa.has(e.wardleyType) || this.locked()) return;
3750
+ if (!j(e) || sa.has(e.wardleyType) || this.locked() || this.elementRegistry.get(e.id) !== e) return;
3713
3751
  this.active?.commit("outside");
3714
- let n = this.canvas.getContainer(), r = e.wardleyType === "note", i = Mt(), a = this.factory.isLinkable(e.wardleyType), o = this.nameLabelElements(e), s = [...o.classedByFallback], c = this.labelGeometry(e, o.labelElements), l = (e) => Math.max(e * ua, r ? 17 * this.canvas.zoom() : 0), u = l(c.fontSize), d = ya(r, t.value ?? e.wardleyLabel ?? "", c, u), f = r ? xa("wardley-label-hint", pa) : void 0, p = () => {
3715
- let { left: e, top: t, width: n, height: i } = ba(d.value, c, u, r);
3752
+ let n = this.canvas.getContainer(), r = e.wardleyType === "note", i = Mt(), a = this.factory.isLinkable(e.wardleyType), o = this.nameLabelElements(e), s = [...o.classedByFallback], c = this.labelGeometry(e, o.labelElements), l = (e) => Math.max(e * fa, r ? 17 * this.canvas.zoom() : 0), u = l(c.fontSize), d = Sa(r, t.value ?? e.wardleyLabel ?? "", c, u), f = r ? wa("wardley-label-hint", ga) : void 0, p = () => {
3753
+ let { left: e, top: t, width: n, height: i } = Ca(d.value, c, u, r);
3716
3754
  Object.assign(d.style, {
3717
3755
  left: `${e}px`,
3718
3756
  top: `${t}px`,
3719
3757
  width: `${n}px`,
3720
3758
  height: `${i}px`
3721
- });
3722
- let a = t + i + fa;
3723
- for (let t of [m.caption, f]) t && (t.style.left = `${e}px`, t.style.top = `${a}px`, a += t.offsetHeight + fa);
3724
- }, m = ta(n, d, `wardley-label-error-${e.id}`, () => p()), h = (e) => {
3725
- m.show(ma(e)), d.select();
3759
+ }), d.scrollTop = 0;
3760
+ let a = t + i + ma;
3761
+ for (let t of [m.caption, f]) t && (t.style.left = `${e}px`, t.style.top = `${a}px`, a += t.offsetHeight + ma);
3762
+ }, m = ra(n, d, `wardley-label-error-${e.id}`, () => p()), h = (e) => {
3763
+ m.show(_a(e)), d.select();
3726
3764
  }, g = () => m.clear();
3727
- this.contextPad?.close(), this.canvas.addMarker(e, ia), n.appendChild(d), f && n.appendChild(f), p(), na(d, t);
3765
+ this.contextPad?.close(), this.canvas.addMarker(e, oa), n.appendChild(d), f && n.appendChild(f), p(), ia(d, t);
3728
3766
  let _ = !1, v = () => {
3729
3767
  if (!_) {
3730
- _ = !0, d.removeEventListener("keydown", ee), d.removeEventListener("blur", ne), d.removeEventListener("input", te), d.remove(), f?.remove(), m.clear(), this.canvas.removeMarker(e, ia);
3731
- for (let e of s) e.classList.remove(ra), e.classList.length || e.removeAttribute("class");
3768
+ _ = !0, d.removeEventListener("keydown", ee), d.removeEventListener("blur", ne), d.removeEventListener("input", te), d.remove(), f?.remove(), m.clear(), this.canvas.removeMarker(e, oa);
3769
+ for (let e of s) e.classList.remove(aa), e.classList.length || e.removeAttribute("class");
3732
3770
  this.active = null;
3733
3771
  }
3734
3772
  }, y = (t) => {
3735
3773
  if (_) return;
3736
- let n = ha(d.value);
3774
+ let n = va(d.value);
3737
3775
  if (!n || n === e.wardleyLabel) {
3738
3776
  v();
3739
3777
  return;
@@ -3745,10 +3783,12 @@ var va = class {
3745
3783
  applied: r
3746
3784
  }));
3747
3785
  }, ee = (t) => {
3748
- if (t.key === "Escape") t.preventDefault(), v(), this.returnToCanvas(e, i);
3749
- else if (t.key === "Enter") {
3750
- if (r && !(t.metaKey || t.ctrlKey)) return;
3751
- t.preventDefault(), y("enter"), _ && this.returnToCanvas(e, i);
3786
+ if (!ha(t)) {
3787
+ if (t.key === "Escape") t.preventDefault(), v(), this.returnToCanvas(e, i);
3788
+ else if (t.key === "Enter") {
3789
+ if (r ? !(t.metaKey || t.ctrlKey) : t.shiftKey) return;
3790
+ t.preventDefault(), y("enter"), _ && this.returnToCanvas(e, i);
3791
+ }
3752
3792
  }
3753
3793
  }, te = () => {
3754
3794
  g(), p();
@@ -3783,7 +3823,7 @@ var va = class {
3783
3823
  let r = this.canvas.zoom(), i = this.canvas.viewbox();
3784
3824
  a.style.left = `${((t.x + n.x) / 2 - 60 - i.x) * r}px`, a.style.top = `${((t.y + n.y) / 2 - 26 - i.y) * r}px`;
3785
3825
  };
3786
- o(), n.appendChild(a), na(a, t);
3826
+ o(), n.appendChild(a), ia(a, t);
3787
3827
  let s = !1, c = () => {
3788
3828
  s || (s = !0, a.removeEventListener("keydown", u), a.removeEventListener("blur", d), a.remove(), this.active = null);
3789
3829
  }, l = () => {
@@ -3852,20 +3892,20 @@ var va = class {
3852
3892
  labelElements: [],
3853
3893
  classedByFallback: []
3854
3894
  };
3855
- let n = [...t.querySelectorAll(`.${ra}`)];
3895
+ let n = [...t.querySelectorAll(`.${aa}`)];
3856
3896
  if (n.length) return {
3857
3897
  labelElements: n,
3858
3898
  classedByFallback: []
3859
3899
  };
3860
- let r = [...t.querySelectorAll("text")].filter((e) => !e.closest(".wardley-movement")), i = e.wardleyType === "note" ? r : r.filter((t) => t.textContent === e.wardleyLabel).slice(-1);
3861
- for (let e of i) e.classList.add(ra);
3900
+ let r = [...t.querySelectorAll("text")].filter((e) => !e.closest(".wardley-movement")), i = (e.wardleyLabel ?? "").split("\n").join(""), a = e.wardleyType === "note" ? r : r.filter((e) => e.textContent === i).slice(-1);
3901
+ for (let e of a) e.classList.add(aa);
3862
3902
  return {
3863
- labelElements: i,
3864
- classedByFallback: i
3903
+ labelElements: a,
3904
+ classedByFallback: a
3865
3905
  };
3866
3906
  }
3867
3907
  labelGeometry(e, t) {
3868
- let n = this.canvas.zoom(), r = this.canvas.viewbox(), i = this.canvas.getContainer().getBoundingClientRect(), a = t[0], o = a ? getComputedStyle(a) : void 0, s = Math.max(da, (Number.parseFloat(o?.fontSize ?? "") || A.label) * n), c = {
3908
+ let n = this.canvas.zoom(), r = this.canvas.viewbox(), i = this.canvas.getContainer().getBoundingClientRect(), a = t[0], o = a ? getComputedStyle(a) : void 0, s = Math.max(pa, (Number.parseFloat(o?.fontSize ?? "") || A.label) * n), c = {
3869
3909
  fontSize: s,
3870
3910
  fontWeight: o?.fontWeight || "normal",
3871
3911
  fontStyle: o?.fontStyle || "normal",
@@ -3900,64 +3940,64 @@ var va = class {
3900
3940
  };
3901
3941
  }
3902
3942
  };
3903
- function ya(e, t, n, r) {
3904
- let i = e ? document.createElement("textarea") : document.createElement("input");
3905
- return i.className = e ? "wardley-label-input wardley-label-input--name wardley-label-textarea" : "wardley-label-input wardley-label-input--name", i.value = t, i.setAttribute("aria-label", e ? "Note text" : "Name"), i.spellcheck = !1, i instanceof HTMLTextAreaElement ? i.wrap = "off" : i.type = "text", Object.assign(i.style, {
3943
+ function Sa(e, t, n, r) {
3944
+ let i = document.createElement("textarea");
3945
+ return i.className = "wardley-label-input wardley-label-input--name wardley-label-textarea", i.value = t, i.rows = 1, i.setAttribute("aria-label", e ? "Note text" : "Name"), i.spellcheck = !1, i.wrap = "off", Object.assign(i.style, {
3906
3946
  position: "absolute",
3907
3947
  fontFamily: n.fontFamily,
3908
3948
  fontSize: `${n.fontSize}px`,
3909
3949
  fontWeight: n.fontWeight,
3910
3950
  fontStyle: n.fontStyle,
3911
3951
  lineHeight: `${r}px`,
3912
- padding: `${ca}px ${sa}px`,
3952
+ padding: `${ua}px ${la}px`,
3913
3953
  textAlign: n.centered ? "center" : "left"
3914
3954
  }), i;
3915
3955
  }
3916
- function ba(e, t, n, r) {
3917
- let i = `${t.fontStyle} ${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`, a = (e || " ").split("\n"), o = Math.max(...a.map((e) => _a(e, i, t.fontSize))), s = Math.max(o + 17, t.fontSize * 2 + 17, r ? t.width : 0), c = Math.max(a.length * n + 7, r ? t.height : 0);
3956
+ function Ca(e, t, n, r) {
3957
+ let i = `${t.fontStyle} ${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`, a = (e || " ").split("\n"), o = Math.max(...a.map((e) => ba(e, i, t.fontSize))), s = Math.max(o + 17, t.fontSize * 2 + 17, r ? t.width : 0), c = Math.max(a.length * n + 7, r ? t.height : 0);
3918
3958
  return {
3919
- left: t.centered ? t.left + t.width / 2 - s / 2 : t.left - sa - la,
3959
+ left: t.centered ? t.left + t.width / 2 - s / 2 : t.left - la - da,
3920
3960
  top: t.top + t.height / 2 - c / 2,
3921
3961
  width: s,
3922
3962
  height: c
3923
3963
  };
3924
3964
  }
3925
- function xa(e, t) {
3965
+ function wa(e, t) {
3926
3966
  let n = document.createElement("div");
3927
3967
  return n.className = `wardley-label-caption ${e}`, n.textContent = t, n;
3928
3968
  }
3929
3969
  // src/label-editing/index.ts
3930
- var Sa = {
3970
+ var Ta = {
3931
3971
  __init__: ["wardleyLabelEditing"],
3932
- wardleyLabelEditing: ["type", va]
3933
- }, Ca = /* @__PURE__ */ new Set([
3972
+ wardleyLabelEditing: ["type", xa]
3973
+ }, Ea = /* @__PURE__ */ new Set([
3934
3974
  "http:",
3935
3975
  "https:",
3936
3976
  "mailto:"
3937
- ]), wa = /^([a-z][a-z0-9+.-]*):/i, Ta = /[\u0000-\u001f\u007f]/g;
3938
- function Ea(e) {
3939
- return e.replace(Ta, "").replace(/[[\]]/g, "").trim();
3977
+ ]), Da = /^([a-z][a-z0-9+.-]*):/i, Oa = /[\u0000-\u001f\u007f]/g;
3978
+ function ka(e) {
3979
+ return e.replace(Oa, "").replace(/[[\]]/g, "").trim();
3940
3980
  }
3941
- function Da(e) {
3942
- let t = wa.exec(e)?.[1];
3943
- return t === void 0 || Ca.has(`${t.toLowerCase()}:`);
3981
+ function Aa(e) {
3982
+ let t = Da.exec(e)?.[1];
3983
+ return t === void 0 || Ea.has(`${t.toLowerCase()}:`);
3944
3984
  }
3945
- function Oa(e) {
3985
+ function ja(e) {
3946
3986
  if (e === void 0) return;
3947
- let t = Ea(e);
3948
- return t && Da(t) ? t : void 0;
3987
+ let t = ka(e);
3988
+ return t && Aa(t) ? t : void 0;
3949
3989
  }
3950
3990
  // src/link-editing/WardleyLinkEditing.ts
3951
- var ka = 72, Aa = 500, ja = 4, Ma = "Use an http(s) or mailto address, or a relative path such as ./other.wmap";
3952
- function Na(e) {
3991
+ var Ma = 72, Na = 500, Pa = 4, Fa = "Use an http(s) or mailto address, or a relative path such as ./other.wmap";
3992
+ function Ia(e) {
3953
3993
  return e.wardleyType === "component" || e.wardleyType === "submap";
3954
3994
  }
3955
- function Pa(e) {
3995
+ function La(e) {
3956
3996
  let t = e.businessObject;
3957
3997
  if (e.wardleyType === "submap") return t?.urlRef;
3958
3998
  if (e.wardleyType === "component") return t?.url;
3959
3999
  }
3960
- var Fa = class {
4000
+ var Ra = class {
3961
4001
  canvas;
3962
4002
  modeling;
3963
4003
  injector;
@@ -3970,15 +4010,15 @@ var Fa = class {
3970
4010
  active = null;
3971
4011
  relayoutPending = !1;
3972
4012
  constructor(e, t, n, r) {
3973
- this.canvas = t, this.modeling = n, this.injector = r, e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on("shape.changed", Aa, (e) => {
4013
+ this.canvas = t, this.modeling = n, this.injector = r, e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on("shape.changed", Na, (e) => {
3974
4014
  this.active && e.element?.id === this.active.elementId && this.active.relayout();
3975
4015
  }), e.on(["diagram.clear", "diagram.destroy"], () => this.cancel());
3976
4016
  }
3977
4017
  setLink(e, t) {
3978
- if (!Na(e)) return !1;
3979
- let n = Ea(t ?? "");
3980
- if (n && !Da(n)) return !1;
3981
- if ((Pa(e) ?? "") === n) return !0;
4018
+ if (!Ia(e)) return !1;
4019
+ let n = ka(t ?? "");
4020
+ if (n && !Aa(n)) return !1;
4021
+ if ((La(e) ?? "") === n) return !0;
3982
4022
  let r = e.wardleyType === "submap" ? "urlRef" : "url";
3983
4023
  e.businessObject ||= {
3984
4024
  id: e.id,
@@ -3993,23 +4033,23 @@ var Fa = class {
3993
4033
  return n ? i[r] = n : delete i[r], this.modeling.updateProperties(e, { businessObject: i }), !0;
3994
4034
  }
3995
4035
  activate(e, t = {}) {
3996
- if (!Na(e) || I(this.injector)) return;
4036
+ if (!Ia(e) || I(this.injector)) return;
3997
4037
  this.active?.commit();
3998
4038
  let n = this.canvas.getContainer(), r = document.createElement("input");
3999
- r.type = "text", r.inputMode = "url", r.spellcheck = !1, r.autocomplete = "off", r.className = "wardley-label-input wardley-link-input", r.placeholder = "https://… or ./other.wmap", r.setAttribute("aria-label", `Link of ${e.wardleyLabel || e.wardleyType}`), r.value = t.value ?? Pa(e) ?? "", r.style.position = "absolute";
4039
+ r.type = "text", r.inputMode = "url", r.spellcheck = !1, r.autocomplete = "off", r.className = "wardley-label-input wardley-link-input", r.placeholder = "https://… or ./other.wmap", r.setAttribute("aria-label", `Link of ${e.wardleyLabel || e.wardleyType}`), r.value = t.value ?? La(e) ?? "", r.style.position = "absolute";
4000
4040
  let i = () => {
4001
4041
  let t = this.canvas.zoom(), n = this.canvas.viewbox();
4002
- r.style.left = `${(e.x - n.x) * t}px`, r.style.top = `${(e.y - n.y) * t + ka}px`;
4042
+ r.style.left = `${(e.x - n.x) * t}px`, r.style.top = `${(e.y - n.y) * t + Ma}px`;
4003
4043
  };
4004
- i(), n.appendChild(r), na(r, t);
4044
+ i(), n.appendChild(r), ia(r, t);
4005
4045
  let a = !1, o = () => {
4006
4046
  a || (a = !0, r.removeEventListener("keydown", p), r.removeEventListener("blur", m), r.removeEventListener("input", u), c.clear(), r.remove(), this.active = null);
4007
4047
  }, s = (e) => {
4008
- e.style.left = r.style.left, e.style.top = `${r.offsetTop + r.offsetHeight + ja}px`;
4009
- }, c = ta(n, r, `wardley-link-error-${e.id}`, s), l = () => c.show(Ma), u = () => c.clear(), d = () => {
4048
+ e.style.left = r.style.left, e.style.top = `${r.offsetTop + r.offsetHeight + Pa}px`;
4049
+ }, c = ra(n, r, `wardley-link-error-${e.id}`, s), l = () => c.show(Fa), u = () => c.clear(), d = () => {
4010
4050
  if (a) return !0;
4011
- let t = Ea(r.value);
4012
- return t && !Da(t) ? (l(), !1) : (o(), this.setLink(e, t), !0);
4051
+ let t = ka(r.value);
4052
+ return t && !Aa(t) ? (l(), !1) : (o(), this.setLink(e, t), !0);
4013
4053
  }, f = () => {
4014
4054
  d() || o();
4015
4055
  }, p = (e) => {
@@ -4050,26 +4090,26 @@ var Fa = class {
4050
4090
  }
4051
4091
  };
4052
4092
  }
4053
- }, Ia = {
4093
+ }, za = {
4054
4094
  __init__: ["wardleyLinkEditing"],
4055
- wardleyLinkEditing: ["type", Fa]
4056
- }, La = "wardley-element-settings", Ra = {
4095
+ wardleyLinkEditing: ["type", Ra]
4096
+ }, Ba = "wardley-element-settings", Va = {
4057
4097
  id: "type",
4058
4098
  name: "Type"
4059
- }, za = {
4099
+ }, Ha = {
4060
4100
  id: "method",
4061
4101
  name: "Sourcing"
4062
- }, Ba = {
4102
+ }, Ua = {
4063
4103
  id: "props",
4064
4104
  name: "Properties"
4065
4105
  };
4066
- function Va(e) {
4106
+ function Wa(e) {
4067
4107
  e.key !== "Escape" && e.stopPropagation();
4068
4108
  }
4069
4109
  function q(e, t) {
4070
4110
  return e ? `✓ ${t}` : t;
4071
4111
  }
4072
- var Ha = class {
4112
+ var Ga = class {
4073
4113
  modeling;
4074
4114
  static $inject = [
4075
4115
  "popupMenu",
@@ -4077,9 +4117,9 @@ var Ha = class {
4077
4117
  "eventBus"
4078
4118
  ];
4079
4119
  constructor(e, t, n) {
4080
- this.modeling = t, e.registerProvider(La, this), n.on("popupMenu.open", () => {
4120
+ this.modeling = t, e.registerProvider(Ba, this), n.on("popupMenu.open", () => {
4081
4121
  let t = e._current?.container;
4082
- t?.getAttribute("data-popup") === "wardley-element-settings" && t.addEventListener("keydown", Va);
4122
+ t?.getAttribute("data-popup") === "wardley-element-settings" && t.addEventListener("keydown", Wa);
4083
4123
  });
4084
4124
  }
4085
4125
  getPopupMenuEntries(e) {
@@ -4091,50 +4131,50 @@ var Ha = class {
4091
4131
  return {
4092
4132
  "type-normal": {
4093
4133
  label: q(n === "normal", "Normal"),
4094
- group: Ra,
4134
+ group: Va,
4095
4135
  action: () => this.modeling.setMarketEcosystem(e, void 0)
4096
4136
  },
4097
4137
  "type-market": {
4098
4138
  label: q(n === "market", "Market"),
4099
- group: Ra,
4139
+ group: Va,
4100
4140
  action: () => this.modeling.setMarketEcosystem(e, "market")
4101
4141
  },
4102
4142
  "type-ecosystem": {
4103
4143
  label: q(n === "ecosystem", "Ecosystem"),
4104
- group: Ra,
4144
+ group: Va,
4105
4145
  action: () => this.modeling.setMarketEcosystem(e, "ecosystem")
4106
4146
  },
4107
4147
  "method-none": {
4108
4148
  label: q(!r, "None"),
4109
- group: za,
4149
+ group: Ha,
4110
4150
  action: () => this.modeling.setMethod(e, void 0)
4111
4151
  },
4112
4152
  "method-build": {
4113
4153
  label: q(r === "build", "Build"),
4114
- group: za,
4154
+ group: Ha,
4115
4155
  action: () => this.modeling.setMethod(e, "build")
4116
4156
  },
4117
4157
  "method-buy": {
4118
4158
  label: q(r === "buy", "Buy"),
4119
- group: za,
4159
+ group: Ha,
4120
4160
  action: () => this.modeling.setMethod(e, "buy")
4121
4161
  },
4122
4162
  "method-outsource": {
4123
4163
  label: q(r === "outsource", "Outsource"),
4124
- group: za,
4164
+ group: Ha,
4125
4165
  action: () => this.modeling.setMethod(e, "outsource")
4126
4166
  },
4127
4167
  "prop-inertia": {
4128
4168
  label: q(!!t.inertia, "Inertia"),
4129
- group: Ba,
4169
+ group: Ua,
4130
4170
  action: () => this.modeling.toggleInertia(e)
4131
4171
  }
4132
4172
  };
4133
4173
  }
4134
- }, Ua = {
4174
+ }, Ka = {
4135
4175
  __init__: ["wardleyElementSettings"],
4136
- wardleyElementSettings: ["type", Ha]
4137
- }, Wa = {
4176
+ wardleyElementSettings: ["type", Ga]
4177
+ }, qa = {
4138
4178
  pencil: "<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\"/><path d=\"m15 5 4 4\"/>",
4139
4179
  trash: "<path d=\"M10 11v6\"/><path d=\"M14 11v6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\"/><path d=\"M3 6h18\"/><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/>",
4140
4180
  "circle-plus": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M8 12h8\"/><path d=\"M12 8v8\"/>",
@@ -4153,22 +4193,22 @@ var Ha = class {
4153
4193
  * @license MIT, Copyright (c) 2013-present Cole Bemis
4154
4194
  * Full notices: README.md of @miragon/wardley-renderer */
4155
4195
  function J(e) {
4156
- return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${Wa[e]}</svg>`;
4196
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${qa[e]}</svg>`;
4157
4197
  }
4158
4198
  // src/context-pad/WardleyContextPadProvider.ts
4159
- var Ga = "edit", Ka = "wardley", qa = "danger", Ja = 80, Ya = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), Xa = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
4160
- function Za(e) {
4199
+ var Ja = "edit", Ya = "wardley", Xa = "danger", Za = 80, Qa = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), $a = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
4200
+ function eo(e) {
4161
4201
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
4162
4202
  }
4163
4203
  function Y(e, t, n = !1) {
4164
- let r = Za(t);
4204
+ let r = eo(t);
4165
4205
  return `<div class="entry wardley-cp-entry" role="button" tabindex="0" aria-label="${r}"${n ? " draggable=\"true\"" : ""} title="${r}">${e}</div>`;
4166
4206
  }
4167
4207
  // src/context-pad/index.ts
4168
- var Qa = {
4208
+ var to = {
4169
4209
  __depends__: [we],
4170
4210
  __init__: ["wardleyContextPadProvider"],
4171
- contextPad: ["type", $i],
4211
+ contextPad: ["type", ta],
4172
4212
  wardleyContextPadProvider: ["type", class {
4173
4213
  contextPad;
4174
4214
  modeling;
@@ -4209,7 +4249,7 @@ var Qa = {
4209
4249
  if (!j(e)) return {};
4210
4250
  let t = e, n = {};
4211
4251
  return this.addPrimaryEntries(t, n), this.addPropertyEntries(t, n), n.delete = {
4212
- group: qa,
4252
+ group: Xa,
4213
4253
  title: "Delete",
4214
4254
  html: Y(J("trash"), "Delete"),
4215
4255
  action: { click: this.focusingCanvas(() => this.modeling.removeElements([t])) }
@@ -4219,13 +4259,13 @@ var Qa = {
4219
4259
  let t = e.wardleyType === "flow" ? "Edit flow value" : "Edit link annotation";
4220
4260
  return {
4221
4261
  "edit-value": {
4222
- group: Ga,
4262
+ group: Ja,
4223
4263
  title: t,
4224
4264
  html: Y(J("pencil"), t),
4225
4265
  action: { click: () => this.labelEditing.activateConnection(e) }
4226
4266
  },
4227
4267
  delete: {
4228
- group: qa,
4268
+ group: Xa,
4229
4269
  title: "Delete connection",
4230
4270
  html: Y(J("trash"), "Delete connection"),
4231
4271
  action: { click: this.focusingCanvas(() => this.modeling.removeElements([e])) }
@@ -4234,7 +4274,7 @@ var Qa = {
4234
4274
  }
4235
4275
  addPrimaryEntries(e, t) {
4236
4276
  if (e.wardleyType !== "drawing" && e.wardleyType !== "attitude" && (t["edit-label"] = {
4237
- group: Ga,
4277
+ group: Ja,
4238
4278
  title: "Edit label",
4239
4279
  html: Y(J("pencil"), "Edit label"),
4240
4280
  action: { click: () => this.labelEditing.activate(e) }
@@ -4248,7 +4288,7 @@ var Qa = {
4248
4288
  this.create.start(t, n, { source: e });
4249
4289
  });
4250
4290
  t.append = {
4251
- group: Ga,
4291
+ group: Ja,
4252
4292
  title: "Append component (auto-connect)",
4253
4293
  html: Y(J("circle-plus"), "Append component", !0),
4254
4294
  action: {
@@ -4260,7 +4300,7 @@ var Qa = {
4260
4300
  this.connect.start(t, e);
4261
4301
  });
4262
4302
  t.connect = {
4263
- group: Ga,
4303
+ group: Ja,
4264
4304
  title: "Connect to existing element (A)",
4265
4305
  html: Y(J("arrow-right"), "Connect to existing element (A)", !0),
4266
4306
  action: {
@@ -4271,7 +4311,7 @@ var Qa = {
4271
4311
  }
4272
4312
  if (e.wardleyType === "component") {
4273
4313
  if (e.movement) t["evolve-clear"] = {
4274
- group: Ga,
4314
+ group: Ja,
4275
4315
  title: "Remove evolve",
4276
4316
  html: Y(J("chevrons-right-x"), "Remove evolve"),
4277
4317
  action: { click: this.focusingCanvas(() => this.wardleyModeling.clearMovement(e)) }
@@ -4279,7 +4319,7 @@ var Qa = {
4279
4319
  else if (e.evolution < .999) {
4280
4320
  let n = this.focusingCanvas((t) => this.evolveDragging.start(t, e));
4281
4321
  t.evolve = {
4282
- group: Ga,
4322
+ group: Ja,
4283
4323
  title: "Evolve: drag to set the target maturity",
4284
4324
  html: Y(J("chevrons-right"), "Evolve: drag to set the target maturity", !0),
4285
4325
  action: {
@@ -4292,12 +4332,12 @@ var Qa = {
4292
4332
  }
4293
4333
  addPropertyEntries(e, t) {
4294
4334
  if (e.wardleyType === "component" && (t.settings = {
4295
- group: Ka,
4335
+ group: Ya,
4296
4336
  title: "Settings (type, sourcing, inertia)",
4297
4337
  html: Y(J("sliders-horizontal"), "Settings (type, sourcing, inertia)"),
4298
4338
  action: { click: (t) => {
4299
4339
  let n = t;
4300
- this.popupMenu.open(e, La, {
4340
+ this.popupMenu.open(e, Ba, {
4301
4341
  x: n.clientX,
4302
4342
  y: n.clientY
4303
4343
  });
@@ -4305,14 +4345,14 @@ var Qa = {
4305
4345
  }), e.wardleyType === "drawing") {
4306
4346
  let n = e.strokeStyle === "dashed" ? "dotted" : e.strokeStyle === "dotted" ? void 0 : "dashed", r = `Line style: ${e.strokeStyle ?? "solid"} (click to change)`;
4307
4347
  t["stroke-style"] = {
4308
- group: Ka,
4348
+ group: Ya,
4309
4349
  title: r,
4310
4350
  html: Y(J("line-style"), r),
4311
4351
  action: { click: this.focusingCanvas(() => this.wardleyModeling.updateProperties(e, { strokeStyle: n })) }
4312
4352
  };
4313
4353
  }
4314
4354
  t.color = {
4315
- group: Ka,
4355
+ group: Ya,
4316
4356
  title: "Color",
4317
4357
  html: Y(J("palette"), "Color"),
4318
4358
  action: { click: (t) => {
@@ -4320,19 +4360,19 @@ var Qa = {
4320
4360
  this.colorPicker.open(e, n.clientX, n.clientY);
4321
4361
  } }
4322
4362
  };
4323
- let n = this.injector.get("wardleyLinkEditing", !1), r = Pa(e);
4324
- if (n && Na(e)) {
4363
+ let n = this.injector.get("wardleyLinkEditing", !1), r = La(e);
4364
+ if (n && Ia(e)) {
4325
4365
  let i = r ? "Edit link…" : "Set link…";
4326
4366
  t.link = {
4327
- group: Ka,
4367
+ group: Ya,
4328
4368
  title: i,
4329
4369
  html: Y(J("link"), i),
4330
4370
  action: { click: () => n.activate(e) }
4331
4371
  };
4332
4372
  }
4333
- let i = Oa(r);
4373
+ let i = ja(r);
4334
4374
  i && (t["open-link"] = {
4335
- group: Ka,
4375
+ group: Ya,
4336
4376
  title: `Open link (${i})`,
4337
4377
  html: Y(J("external-link"), `Open link (${i})`),
4338
4378
  action: { click: this.focusingCanvas(() => window.open(i, "_blank", "noopener,noreferrer")) }
@@ -4348,7 +4388,7 @@ var Qa = {
4348
4388
  let n = e.target?.closest?.(".entry"), r = n?.getAttribute("data-action");
4349
4389
  if (!n || !r || !t.contains(n)) return;
4350
4390
  let i = Array.from(t.querySelectorAll(".entry")), a = i.indexOf(n), o;
4351
- if (Ya.has(e.key) ? o = i[(a - 1 + i.length) % i.length] : Xa.has(e.key) ? o = i[(a + 1) % i.length] : e.key === "Home" ? o = i[0] : e.key === "End" && (o = i[i.length - 1]), o || e.key === "Escape") {
4391
+ if (Qa.has(e.key) ? o = i[(a - 1 + i.length) % i.length] : $a.has(e.key) ? o = i[(a + 1) % i.length] : e.key === "Home" ? o = i[0] : e.key === "End" && (o = i[i.length - 1]), o || e.key === "Escape") {
4352
4392
  e.preventDefault(), e.stopPropagation(), o ? o.focus() : this.canvas.focus();
4353
4393
  return;
4354
4394
  }
@@ -4389,12 +4429,12 @@ var Qa = {
4389
4429
  visibility: 0
4390
4430
  }).y, n = this.factory.createNew("component", "Component"), r = {
4391
4431
  x: e.x + e.width / 2,
4392
- y: Math.min(e.y + e.height / 2 + Ja, t - n.height / 2)
4432
+ y: Math.min(e.y + e.height / 2 + Za, t - n.height / 2)
4393
4433
  }, i = this.modeling.appendShape(e, n, r, e.parent, { connection: { wardleyType: "dependency" } });
4394
4434
  this.injector.get("selection", !1)?.select(i ?? n), this.labelEditing.activate(i ?? n);
4395
4435
  }
4396
4436
  }]
4397
- }, $a = 2, eo = 10, to = {
4437
+ }, no = 2, ro = 10, io = {
4398
4438
  arrowleft: {
4399
4439
  x: -1,
4400
4440
  y: 0
@@ -4411,7 +4451,7 @@ var Qa = {
4411
4451
  x: 0,
4412
4452
  y: 1
4413
4453
  }
4414
- }, no = {
4454
+ }, ao = {
4415
4455
  c: {
4416
4456
  type: "component",
4417
4457
  label: "Component"
@@ -4428,15 +4468,15 @@ var Qa = {
4428
4468
  type: "pipeline",
4429
4469
  label: "Pipeline"
4430
4470
  }
4431
- }, ro = 40, io = 56, ao = 160, oo = {
4471
+ }, oo = 40, so = 56, co = 160, lo = {
4432
4472
  x: 48,
4433
4473
  y: 40
4434
- }, so = 40;
4435
- function co(e, t) {
4474
+ }, uo = 40;
4475
+ function fo(e, t) {
4436
4476
  let n = e.target;
4437
4477
  return typeof e.key == "string" && !e.defaultPrevented && !e.isComposing && n instanceof Node && !!t?.contains(n);
4438
4478
  }
4439
- var lo = class {
4479
+ var po = class {
4440
4480
  canvas;
4441
4481
  selection;
4442
4482
  modeling;
@@ -4492,9 +4532,9 @@ var lo = class {
4492
4532
  if (!(oe() && t !== "escape" && t !== "l")) {
4493
4533
  if (t === "escape") !re && n.get().length && n.select(null);
4494
4534
  else if (t === "delete" || t === "backspace") ae(e);
4495
- else if (i && t in no) {
4535
+ else if (i && t in ao) {
4496
4536
  e.preventDefault();
4497
- let { type: n, label: r } = no[t];
4537
+ let { type: n, label: r } = ao[t];
4498
4538
  this.quickCreate(n, r);
4499
4539
  } else if (i && t === "a") {
4500
4540
  let t = this.singleSelectedShape();
@@ -4506,11 +4546,11 @@ var lo = class {
4506
4546
  };
4507
4547
  g.start(this.pointerEventOr(n), t, n, !0);
4508
4548
  } else if (i && t === "l") e.preventDefault(), c.activateSelection(s.getLastMoveEvent(), !0);
4509
- else if (t in to) {
4549
+ else if (t in io) {
4510
4550
  let i = n.get();
4511
4551
  if (!i.length) return;
4512
4552
  e.preventDefault();
4513
- let a = e.shiftKey ? eo : $a, o = to[t];
4553
+ let a = e.shiftKey ? ro : no, o = io[t];
4514
4554
  r.moveElements(i, {
4515
4555
  x: o.x * a,
4516
4556
  y: o.y * a
@@ -4518,7 +4558,7 @@ var lo = class {
4518
4558
  }
4519
4559
  }
4520
4560
  }, ce = (e) => {
4521
- if (!co(e, ee)) return;
4561
+ if (!fo(e, ee)) return;
4522
4562
  let t = e.key.toLowerCase();
4523
4563
  e.ctrlKey || e.metaKey ? T(e, t) : se(e, t);
4524
4564
  };
@@ -4545,10 +4585,10 @@ var lo = class {
4545
4585
  evolution: 1
4546
4586
  });
4547
4587
  return {
4548
- left: e.x + ro,
4549
- top: e.y + ro,
4550
- right: t.x - ro,
4551
- bottom: t.y - ro
4588
+ left: e.x + oo,
4589
+ top: e.y + oo,
4590
+ right: t.x - oo,
4591
+ bottom: t.y - oo
4552
4592
  };
4553
4593
  }
4554
4594
  visiblePlotCenter(e) {
@@ -4557,17 +4597,17 @@ var lo = class {
4557
4597
  y: t.y + t.height / 2
4558
4598
  };
4559
4599
  return e ? {
4560
- x: uo(n.x, e.left, e.right),
4561
- y: uo(n.y, e.top, e.bottom)
4600
+ x: mo(n.x, e.left, e.right),
4601
+ y: mo(n.y, e.top, e.bottom)
4562
4602
  } : n;
4563
4603
  }
4564
4604
  freeSpotNear(e, t) {
4565
- let n = (e) => !!this.elementRegistry.find((t) => j(t) && Math.abs(t.x + t.width / 2 - e.x) < oo.x && Math.abs(t.y + t.height / 2 - e.y) < oo.y), r = e;
4566
- for (let i = 0; i < so && n(r); i++) if (r = {
4605
+ let n = (e) => !!this.elementRegistry.find((t) => j(t) && Math.abs(t.x + t.width / 2 - e.x) < lo.x && Math.abs(t.y + t.height / 2 - e.y) < lo.y), r = e;
4606
+ for (let i = 0; i < uo && n(r); i++) if (r = {
4567
4607
  x: r.x,
4568
- y: r.y + io
4608
+ y: r.y + so
4569
4609
  }, t && r.y > t.bottom && (r = {
4570
- x: r.x + ao,
4610
+ x: r.x + co,
4571
4611
  y: e.y
4572
4612
  }, r.x > t.right)) return e;
4573
4613
  return r;
@@ -4585,21 +4625,21 @@ var lo = class {
4585
4625
  });
4586
4626
  }
4587
4627
  };
4588
- function uo(e, t, n) {
4628
+ function mo(e, t, n) {
4589
4629
  return t > n ? (t + n) / 2 : Math.min(Math.max(e, t), n);
4590
4630
  }
4591
4631
  // src/keyboard/index.ts
4592
- var fo = {
4632
+ var ho = {
4593
4633
  __init__: ["wardleyKeyboard"],
4594
- wardleyKeyboard: ["type", lo]
4595
- }, po = /* @__PURE__ */ new Set([
4634
+ wardleyKeyboard: ["type", po]
4635
+ }, go = /* @__PURE__ */ new Set([
4596
4636
  "component",
4597
4637
  "anchor",
4598
4638
  "submap",
4599
4639
  "pipeline",
4600
4640
  "accelerator",
4601
4641
  "note"
4602
- ]), mo = 500, ho = class {
4642
+ ]), _o = 500, vo = class {
4603
4643
  static $inject = ["injector", "eventBus"];
4604
4644
  constructor(e, t) {
4605
4645
  let n = e.get("connectionPreview", !1), r = e.get("wardleyLabelEditing", !1);
@@ -4624,21 +4664,21 @@ var fo = {
4624
4664
  "create.cleanup"
4625
4665
  ], (e) => {
4626
4666
  n.cleanUp(e.context);
4627
- })), r && t.on("create.end", mo, (e) => {
4667
+ })), r && t.on("create.end", _o, (e) => {
4628
4668
  let { context: t } = e, n = t.shape;
4629
- t.canExecute && n && !t.wardleyPaste && (t.elements?.length ?? 1) === 1 && po.has(n.wardleyType) && setTimeout(() => r.activate(n), 0);
4669
+ t.canExecute && n && !t.wardleyPaste && (t.elements?.length ?? 1) === 1 && go.has(n.wardleyType) && setTimeout(() => r.activate(n), 0);
4630
4670
  });
4631
4671
  }
4632
- }, go = {
4672
+ }, yo = {
4633
4673
  __depends__: [Me],
4634
4674
  __init__: ["wardleyAppendBehavior"],
4635
- wardleyAppendBehavior: ["type", ho]
4636
- }, _o = {
4675
+ wardleyAppendBehavior: ["type", vo]
4676
+ }, bo = {
4637
4677
  ArrowLeft: -1,
4638
4678
  ArrowRight: 1,
4639
4679
  ArrowUp: -3,
4640
4680
  ArrowDown: 3
4641
- }, vo = class {
4681
+ }, xo = class {
4642
4682
  canvas;
4643
4683
  modeling;
4644
4684
  injector;
@@ -4699,18 +4739,18 @@ var fo = {
4699
4739
  this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0), (e.restoreFocus || t) && this.canvas.focus();
4700
4740
  }
4701
4741
  onGridKeydown(e, t) {
4702
- let n = _o[e.key], r = t.indexOf(document.activeElement), i;
4742
+ let n = bo[e.key], r = t.indexOf(document.activeElement), i;
4703
4743
  n === void 0 ? e.key === "Home" ? i = 0 : e.key === "End" ? i = t.length - 1 : e.key === "Tab" && (i = r + (e.shiftKey ? -1 : 1), i = (i + t.length) % t.length) : i = r < 0 ? 0 : r + n, i !== void 0 && (e.preventDefault(), e.stopPropagation(), t[Math.min(t.length - 1, Math.max(0, i))]?.focus());
4704
4744
  }
4705
- }, yo = {
4745
+ }, So = {
4706
4746
  __init__: ["wardleyColorPicker"],
4707
- wardleyColorPicker: ["type", vo]
4747
+ wardleyColorPicker: ["type", xo]
4708
4748
  };
4709
4749
  // src/ordering/WardleyOrderingProvider.ts
4710
- function bo(e) {
4750
+ function Co(e) {
4711
4751
  return j(e) && (e.wardleyType === "attitude" || e.wardleyType === "pipeline");
4712
4752
  }
4713
- var xo = class extends Ne {
4753
+ var wo = class extends Ne {
4714
4754
  static $inject = ["eventBus"];
4715
4755
  constructor(e) {
4716
4756
  super(e);
@@ -4721,18 +4761,18 @@ var xo = class extends Ne {
4721
4761
  let r = e.wardleyType === "flow";
4722
4762
  return {
4723
4763
  parent: t,
4724
- index: n.filter((t) => t !== e && (bo(t) || M(t) && (r || t.wardleyType !== "flow"))).length
4764
+ index: n.filter((t) => t !== e && (Co(t) || M(t) && (r || t.wardleyType !== "flow"))).length
4725
4765
  };
4726
4766
  }
4727
- return bo(e) ? {
4767
+ return Co(e) ? {
4728
4768
  parent: t,
4729
- index: n.filter((t) => t !== e && bo(t)).length
4769
+ index: n.filter((t) => t !== e && Co(t)).length
4730
4770
  } : { parent: t };
4731
4771
  }
4732
- }, So = {
4772
+ }, To = {
4733
4773
  __init__: ["wardleyOrderingProvider"],
4734
- wardleyOrderingProvider: ["type", xo]
4735
- }, Co = 12, wo = "input, textarea, select, .monaco-editor", To = class {
4774
+ wardleyOrderingProvider: ["type", wo]
4775
+ }, Eo = 12, Do = ".djs-palette .entry[data-action=\"draw-tool\"]", Oo = class {
4736
4776
  canvas;
4737
4777
  eventBus;
4738
4778
  modeling;
@@ -4812,12 +4852,12 @@ var xo = class extends Ne {
4812
4852
  if (e.button !== 0 || this.isChromeTarget(e)) return;
4813
4853
  e.preventDefault(), e.stopPropagation(), L(this.canvas);
4814
4854
  let t = this.toCanvasPoint(e), n = this.points[0];
4815
- if (n && this.points.length >= 3 && Eo(t, n) <= Co) {
4855
+ if (n && this.points.length >= 3 && ko(t, n) <= Eo) {
4816
4856
  this.finishClosed();
4817
4857
  return;
4818
4858
  }
4819
4859
  let r = this.points[this.points.length - 1];
4820
- r && Eo(t, r) <= Co ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
4860
+ r && ko(t, r) <= Eo ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
4821
4861
  };
4822
4862
  onDblClick = (e) => {
4823
4863
  this.isChromeTarget(e) || (e.preventDefault(), e.stopPropagation(), this.finish());
@@ -4827,7 +4867,10 @@ var xo = class extends Ne {
4827
4867
  };
4828
4868
  ownsKey(e) {
4829
4869
  let t = e.target;
4830
- return typeof e.key != "string" || e.defaultPrevented || e.isComposing || !(t instanceof globalThis.Element) || !this.canvas.getContainer().contains(t) ? !1 : !Do(t);
4870
+ if (typeof e.key != "string" || e.defaultPrevented || e.isComposing || !(t instanceof globalThis.Element)) return !1;
4871
+ if (Ot(this.canvas)?.contains(t)) return !0;
4872
+ let n = t.closest(Do);
4873
+ return !!n && this.canvas.getContainer().contains(n);
4831
4874
  }
4832
4875
  onKeyDown = (e) => {
4833
4876
  this.ownsKey(e) && (e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), this.points.length >= 2 ? this.finish() : this.cancel()) : e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), this.finish()));
@@ -4869,14 +4912,11 @@ var xo = class extends Ne {
4869
4912
  this.layer &&= (se(this.layer), null);
4870
4913
  }
4871
4914
  };
4872
- function Eo(e, t) {
4915
+ function ko(e, t) {
4873
4916
  return Math.hypot(e.x - t.x, e.y - t.y);
4874
4917
  }
4875
- function Do(e) {
4876
- return e instanceof HTMLElement && e.isContentEditable || e.editContext ? !0 : e.closest(wo) !== null;
4877
- }
4878
4918
  // src/draw-tool/WardleyDrawingHandles.ts
4879
- var Oo = class {
4919
+ var Ao = class {
4880
4920
  eventBus;
4881
4921
  canvas;
4882
4922
  modeling;
@@ -4892,13 +4932,18 @@ var Oo = class {
4892
4932
  shape = null;
4893
4933
  group = null;
4894
4934
  dragPreview = null;
4935
+ pointDrag = null;
4895
4936
  constructor(e, t, n, r, i) {
4896
4937
  this.eventBus = e, this.canvas = t, this.modeling = n, this.grid = r, this.injector = i, e.on("selection.changed", (e) => {
4897
4938
  let t = e.newSelection ?? [], n = t.length === 1 ? t[0] : null;
4898
4939
  this.attach(j(n) && n.wardleyType === "drawing" ? n : null);
4899
4940
  }), e.on("element.changed", (e) => {
4900
4941
  this.shape && e.element === this.shape && this.render();
4901
- }), e.on(["diagram.clear", "diagram.destroy"], () => this.attach(null));
4942
+ }), e.on("shape.remove", (e) => {
4943
+ this.pointDrag?.shape === e.element && this.endPointDrag();
4944
+ }), e.on(["diagram.clear", "diagram.destroy"], () => {
4945
+ this.endPointDrag(), this.attach(null);
4946
+ });
4902
4947
  }
4903
4948
  attach(e) {
4904
4949
  this.shape = e, this.render();
@@ -4928,13 +4973,22 @@ var Oo = class {
4928
4973
  }
4929
4974
  startDrag(e, t) {
4930
4975
  if (e.button !== 0 || !this.shape || I(this.injector)) return;
4931
- e.preventDefault(), e.stopPropagation(), L(this.canvas);
4976
+ e.preventDefault(), e.stopPropagation(), L(this.canvas), this.endPointDrag();
4932
4977
  let n = this.shape, r = this.absolutePoints(), i = (e) => {
4933
4978
  r[t] = this.toCanvasPoint(e), this.renderDragPreview(r, !!n.closed);
4934
4979
  }, a = (e) => {
4935
- document.removeEventListener("mousemove", i, !0), document.removeEventListener("mouseup", a, !0), r[t] = this.toCanvasPoint(e), this.clearDragPreview(), this.commit(n, r);
4980
+ r[t] = this.toCanvasPoint(e), this.endPointDrag(), this.commit(n, r);
4936
4981
  };
4937
- document.addEventListener("mousemove", i, !0), document.addEventListener("mouseup", a, !0);
4982
+ document.addEventListener("mousemove", i, !0), document.addEventListener("mouseup", a, !0), this.pointDrag = {
4983
+ shape: n,
4984
+ unbind: () => {
4985
+ document.removeEventListener("mousemove", i, !0), document.removeEventListener("mouseup", a, !0);
4986
+ }
4987
+ };
4988
+ }
4989
+ endPointDrag() {
4990
+ let e = this.pointDrag;
4991
+ e && (this.pointDrag = null, e.unbind(), this.clearDragPreview());
4938
4992
  }
4939
4993
  commit(e, t) {
4940
4994
  let n = t.map((e) => e.x), r = t.map((e) => e.y), i = Math.min(...n), a = Math.min(...r), o = this.grid.fromCanvas(t[0]);
@@ -4978,20 +5032,20 @@ var Oo = class {
4978
5032
  }
4979
5033
  };
4980
5034
  // src/draw-tool/WardleyDrawingHitProvider.ts
4981
- function ko(e) {
5035
+ function jo(e) {
4982
5036
  return j(e) && e.wardleyType === "drawing";
4983
5037
  }
4984
- var Ao = class {
5038
+ var Mo = class {
4985
5039
  static $inject = ["eventBus", "interactionEvents"];
4986
5040
  constructor(e, t) {
4987
5041
  e.on("interactionEvents.createHit", (e) => {
4988
- if (ko(e.element) && e.gfx) return jo(e.element, e.gfx), !1;
5042
+ if (jo(e.element) && e.gfx) return No(e.element, e.gfx), !1;
4989
5043
  }), e.on("interactionEvents.updateHit", (e) => {
4990
- if (ko(e.element) && e.gfx) return t.removeHits(e.gfx), jo(e.element, e.gfx), !1;
5044
+ if (jo(e.element) && e.gfx) return t.removeHits(e.gfx), No(e.element, e.gfx), !1;
4991
5045
  });
4992
5046
  }
4993
5047
  };
4994
- function jo(e, t) {
5048
+ function No(e, t) {
4995
5049
  let n = e.drawingPoints ?? [], r = T(e.closed ? "polygon" : "polyline");
4996
5050
  w(r, {
4997
5051
  points: n.map((e) => `${e.x},${e.y}`).join(" "),
@@ -5003,16 +5057,16 @@ function jo(e, t) {
5003
5057
  }), C(t, r);
5004
5058
  }
5005
5059
  // src/draw-tool/index.ts
5006
- var Mo = {
5060
+ var Po = {
5007
5061
  __init__: [
5008
5062
  "wardleyDrawTool",
5009
5063
  "wardleyDrawingHandles",
5010
5064
  "wardleyDrawingHitProvider"
5011
5065
  ],
5012
- wardleyDrawTool: ["type", To],
5013
- wardleyDrawingHandles: ["type", Oo],
5014
- wardleyDrawingHitProvider: ["type", Ao]
5015
- }, No = 3, Po = 4, Fo = "wardley-labels-draggable", Io = "wardley-label-dragging", Lo = class {
5066
+ wardleyDrawTool: ["type", Oo],
5067
+ wardleyDrawingHandles: ["type", Ao],
5068
+ wardleyDrawingHitProvider: ["type", Mo]
5069
+ }, Fo = 3, Io = 4, Lo = "wardley-labels-draggable", Ro = "wardley-label-dragging", zo = class {
5016
5070
  eventBus;
5017
5071
  canvas;
5018
5072
  elementRegistry;
@@ -5033,7 +5087,7 @@ var Mo = {
5033
5087
  constructor(e, t, n, r, i, a, o) {
5034
5088
  this.eventBus = e, this.canvas = t, this.elementRegistry = n, this.modeling = r, this.selection = i, this.grid = a, this.injector = o;
5035
5089
  let s = t.getContainer();
5036
- this.outerContainer().classList.add(Fo), s.addEventListener("mousedown", this.onMouseDown, !0), s.addEventListener("dblclick", this.onDoubleClick, !0), e.on("shape.remove", ({ element: e }) => {
5090
+ this.outerContainer().classList.add(Lo), s.addEventListener("mousedown", this.onMouseDown, !0), s.addEventListener("dblclick", this.onDoubleClick, !0), e.on("shape.remove", ({ element: e }) => {
5037
5091
  this.active?.shape === e && this.cancel();
5038
5092
  }), e.on("diagram.destroy", () => {
5039
5093
  this.cancel(), s.removeEventListener("mousedown", this.onMouseDown, !0), s.removeEventListener("dblclick", this.onDoubleClick, !0);
@@ -5070,8 +5124,8 @@ var Mo = {
5070
5124
  if (!t) return;
5071
5125
  let n = e.clientX - t.startClient.x, r = e.clientY - t.startClient.y;
5072
5126
  if (!t.dragging) {
5073
- if (Math.hypot(n, r) < No) return;
5074
- t.dragging = !0, this.outerContainer().classList.add(Io);
5127
+ if (Math.hypot(n, r) < Fo) return;
5128
+ t.dragging = !0, this.outerContainer().classList.add(Ro);
5075
5129
  }
5076
5130
  t.latest = {
5077
5131
  dx: Math.round(t.startOffset.dx + n / t.zoom),
@@ -5082,7 +5136,7 @@ var Mo = {
5082
5136
  let e = this.active;
5083
5137
  if (!e || (this.finish(), !e.dragging || !e.latest) || this.elementRegistry.get(e.shape.id) !== e.shape) return;
5084
5138
  let t = this.snapHome(e.latest, e.homeOffset);
5085
- zo(t, e.role === "name" ? e.originalOffset : e.originalMovement?.labelOffset) || (e.role === "name" ? this.commitNameOffset(e.shape, t) : this.commitMovementOffset(e.shape, t)), this.suppressNextClick(), this.selection.select(e.shape);
5139
+ Vo(t, e.role === "name" ? e.originalOffset : e.originalMovement?.labelOffset) || (e.role === "name" ? this.commitNameOffset(e.shape, t) : this.commitMovementOffset(e.shape, t)), this.suppressNextClick(), this.selection.select(e.shape);
5086
5140
  };
5087
5141
  suppressNextClick() {
5088
5142
  let e = this.canvas.getContainer(), t = (e) => e.stopPropagation();
@@ -5104,7 +5158,7 @@ var Mo = {
5104
5158
  }
5105
5159
  finish() {
5106
5160
  let e = this.active;
5107
- e && (this.active = null, document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("keydown", this.onKeyDown, !0), this.outerContainer().classList.remove(Io), e.dragging && (e.originalOffset ? e.shape.labelOffset = e.originalOffset : delete e.shape.labelOffset, e.originalMovement && (e.shape.movement = e.originalMovement), this.eventBus.fire("element.changed", { element: e.shape })));
5161
+ e && (this.active = null, document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("keydown", this.onKeyDown, !0), this.outerContainer().classList.remove(Ro), e.dragging && (e.originalOffset ? e.shape.labelOffset = e.originalOffset : delete e.shape.labelOffset, e.originalMovement && (e.shape.movement = e.originalMovement), this.eventBus.fire("element.changed", { element: e.shape })));
5108
5162
  }
5109
5163
  preview(e, t) {
5110
5164
  e.role === "name" ? e.shape.labelOffset = t : e.originalMovement && (e.shape.movement = {
@@ -5113,7 +5167,7 @@ var Mo = {
5113
5167
  }), this.eventBus.fire("element.changed", { element: e.shape });
5114
5168
  }
5115
5169
  snapHome(e, t) {
5116
- return Math.abs(e.dx - t.dx) <= Po && Math.abs(e.dy - t.dy) <= Po ? void 0 : Gr(e.dx, e.dy);
5170
+ return Math.abs(e.dx - t.dx) <= Io && Math.abs(e.dy - t.dy) <= Io ? void 0 : qr(e.dx, e.dy);
5117
5171
  }
5118
5172
  commitNameOffset(e, t) {
5119
5173
  let n = { labelOffset: t }, r = e.businessObject;
@@ -5140,17 +5194,17 @@ var Mo = {
5140
5194
  dx: 0,
5141
5195
  dy: 0
5142
5196
  };
5143
- let r = Ir(e, this.grid);
5197
+ let r = Fr(e, this.grid);
5144
5198
  return t === "movement" ? r === void 0 ? {
5145
5199
  dx: 0,
5146
5200
  dy: 0
5147
- } : Ro(Hr(void 0, r), Vr(r), n, e) : Ro(Br({
5201
+ } : Bo(Wr(void 0, r), Ur(r), n, e) : Bo(Hr({
5148
5202
  ...e,
5149
5203
  labelOffset: void 0
5150
- }, r), Rr(), n, e);
5204
+ }, r), Br(), n, e);
5151
5205
  }
5152
5206
  labelTarget(e) {
5153
- let t = e.target?.closest?.(`.${Jr}`);
5207
+ let t = e.target?.closest?.(`.${Xr}`);
5154
5208
  if (!(t instanceof SVGTextElement)) return null;
5155
5209
  let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), r = n ? this.elementRegistry.get(n) : void 0;
5156
5210
  if (!j(r)) return null;
@@ -5166,30 +5220,30 @@ var Mo = {
5166
5220
  return e.closest(".wardley-container") ?? e;
5167
5221
  }
5168
5222
  };
5169
- function Ro(e, t, n, r) {
5223
+ function Bo(e, t, n, r) {
5170
5224
  let i = r.width / 2, a = e.anchor === "end" ? n.getBBox().x - i : e.x;
5171
5225
  return {
5172
5226
  dx: Math.round(a - t.x),
5173
5227
  dy: Math.round(e.y - t.y)
5174
5228
  };
5175
5229
  }
5176
- function zo(e, t) {
5230
+ function Vo(e, t) {
5177
5231
  return !e || !t ? !e && !t : e.dx === t.dx && e.dy === t.dy;
5178
5232
  }
5179
5233
  // src/label-drag/index.ts
5180
- var Bo = {
5234
+ var Ho = {
5181
5235
  __init__: ["wardleyLabelDragging"],
5182
- wardleyLabelDragging: ["type", Lo]
5183
- }, Vo = { autoScroll: ["type", Zt] }, Ho = class extends bi {
5236
+ wardleyLabelDragging: ["type", zo]
5237
+ }, Uo = { autoScroll: ["type", Zt] }, Wo = class extends Si {
5184
5238
  _getModules() {
5185
5239
  return [
5186
5240
  ...super._getModules(),
5187
5241
  pe,
5188
- ln,
5242
+ fn,
5189
5243
  Ee,
5190
5244
  xe,
5191
5245
  Se,
5192
- Vo,
5246
+ Uo,
5193
5247
  he,
5194
5248
  Ce,
5195
5249
  we,
@@ -5197,26 +5251,26 @@ var Bo = {
5197
5251
  De,
5198
5252
  Oe,
5199
5253
  ke,
5200
- wr,
5201
- Oi,
5202
- Er,
5203
- ki,
5204
- Xi,
5205
- Qa,
5206
- Sa,
5207
- fo,
5208
- An,
5209
- Ua,
5210
- go,
5254
+ Dr,
5255
+ Ai,
5256
+ kr,
5257
+ ji,
5258
+ Qi,
5259
+ to,
5260
+ Ta,
5261
+ ho,
5262
+ Nn,
5263
+ Ka,
5211
5264
  yo,
5212
- Si,
5213
5265
  So,
5214
- Mo,
5215
- Kn,
5266
+ wi,
5267
+ To,
5268
+ Po,
5269
+ Yn,
5216
5270
  $t,
5217
- Ia,
5271
+ za,
5218
5272
  Pt,
5219
- Bo,
5273
+ Ho,
5220
5274
  Dt
5221
5275
  ];
5222
5276
  }
@@ -5237,7 +5291,7 @@ var Bo = {
5237
5291
  }
5238
5292
  };
5239
5293
  // src/editor-state.ts
5240
- function Uo(e) {
5294
+ function Go(e) {
5241
5295
  let t;
5242
5296
  try {
5243
5297
  t = ae(e.exportMap());
@@ -5246,18 +5300,18 @@ function Uo(e) {
5246
5300
  }
5247
5301
  return (e) => t.get(e) ?? e;
5248
5302
  }
5249
- function Wo(e, t = (e) => e) {
5303
+ function Ko(e, t = (e) => e) {
5250
5304
  return {
5251
5305
  sourceId: t(e.source?.id ?? ""),
5252
5306
  targetId: t(e.target?.id ?? ""),
5253
5307
  wardleyType: e.wardleyType
5254
5308
  };
5255
5309
  }
5256
- function Go(e, t) {
5310
+ function qo(e, t) {
5257
5311
  return e.find((e) => M(e) && e.source?.id === t.sourceId && e.target?.id === t.targetId && e.wardleyType === t.wardleyType);
5258
5312
  }
5259
- function Ko(e) {
5260
- let t = e.get("selection").get(), n = e.get("elementRegistry"), r = e.get("wardleyLabelEditing"), i = e.get("wardleyLinkEditing"), a = /* @__PURE__ */ new Map(), o = Uo(e), s = (e) => {
5313
+ function Jo(e) {
5314
+ let t = e.get("selection").get(), n = e.get("elementRegistry"), r = e.get("wardleyLabelEditing"), i = e.get("wardleyLinkEditing"), a = /* @__PURE__ */ new Map(), o = Go(e), s = (e) => {
5261
5315
  let t = o(e);
5262
5316
  return a.set(t, e), t;
5263
5317
  }, c, l = r.getActiveEdit(), u = i.getActiveEdit();
@@ -5265,7 +5319,7 @@ function Ko(e) {
5265
5319
  let e = n.get(l.elementId);
5266
5320
  M(e) && (c = {
5267
5321
  kind: "connection",
5268
- key: Wo(e, s),
5322
+ key: Ko(e, s),
5269
5323
  value: l.value,
5270
5324
  ...l.selection ? { selection: l.selection } : {}
5271
5325
  });
@@ -5282,13 +5336,13 @@ function Ko(e) {
5282
5336
  });
5283
5337
  return r.cancel(), i.cancel(), {
5284
5338
  shapeIds: t.filter(j).map((e) => s(e.id)),
5285
- connections: t.filter(M).map((e) => Wo(e, s)),
5339
+ connections: t.filter(M).map((e) => Ko(e, s)),
5286
5340
  ...c ? { edit: c } : {},
5287
5341
  canvasIds: a
5288
5342
  };
5289
5343
  }
5290
- function qo(e, t, n = {}) {
5291
- let r = e.get("elementRegistry"), i = (e) => n.importRejected ? t.canvasIds?.get(e) ?? e : e, a = (e) => r.get(i(e)), o = (e) => Go(r, {
5344
+ function Yo(e, t, n = {}) {
5345
+ let r = e.get("elementRegistry"), i = (e) => n.importRejected ? t.canvasIds?.get(e) ?? e : e, a = (e) => r.get(i(e)), o = (e) => qo(r, {
5292
5346
  ...e,
5293
5347
  sourceId: i(e.sourceId),
5294
5348
  targetId: i(e.targetId)
@@ -5316,37 +5370,35 @@ function qo(e, t, n = {}) {
5316
5370
  })() || L(e.get("canvas"));
5317
5371
  }
5318
5372
  // src/collaborative/CollaborativeWardley.ts
5319
- var Jo = "wardley", Yo = /* @__PURE__ */ new Set([
5373
+ var Xo = "wardley", Zo = /* @__PURE__ */ new Set([
5320
5374
  "component",
5321
5375
  "anchor",
5322
5376
  "pipeline",
5323
5377
  "submap",
5324
5378
  "accelerator"
5325
5379
  ]);
5326
- function Xo(e) {
5327
- return j(e) && Yo.has(e.wardleyType);
5328
- }
5329
- function Zo(e = {}) {
5330
- return ts(new Ho({
5331
- ...$o(e),
5332
- undoRedoKeys: e.undoRedoKeys,
5333
- keyboard: e.keyboard
5380
+ function Qo(e) {
5381
+ return j(e) && Zo.has(e.wardleyType);
5382
+ }
5383
+ function $o(e = {}) {
5384
+ return rs(new Wo({
5385
+ ...ts(e),
5386
+ undoRedoKeys: e.undoRedoKeys
5334
5387
  }), !0);
5335
5388
  }
5336
- function Qo(e = {}) {
5337
- return ts(new bi($o(e)), !1);
5389
+ function es(e = {}) {
5390
+ return rs(new Si(ts(e)), !1);
5338
5391
  }
5339
- function $o(e) {
5392
+ function ts(e) {
5340
5393
  return {
5341
5394
  width: "100%",
5342
5395
  height: "100%",
5343
5396
  additionalModules: e.additionalModules ?? [],
5344
5397
  freeArea: e.freeArea,
5345
- freeRectInsets: e.freeRectInsets,
5346
5398
  fitOnImport: e.fitOnImport
5347
5399
  };
5348
5400
  }
5349
- function es(e, t) {
5401
+ function ns(e, t) {
5350
5402
  let n, r;
5351
5403
  t.on([
5352
5404
  "elements.changed",
@@ -5373,16 +5425,16 @@ function es(e, t) {
5373
5425
  canvasIdOf: (e) => i().byDocumentId.get(e) ?? e
5374
5426
  };
5375
5427
  }
5376
- function ts(e, t) {
5377
- let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = e.get("panConstraint"), s = es(e, n), c = t ? e.get("wardleyLivePreview") : void 0, l = /* @__PURE__ */ new Set(), u = 0, d = !1, f = !1, p = "", m = {
5378
- notation: Jo,
5428
+ function rs(e, t) {
5429
+ let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = e.get("panConstraint"), s = ns(e, n), c = t ? e.get("wardleyLivePreview") : void 0, l = /* @__PURE__ */ new Set(), u = 0, d = !1, f = !1, p = "", m = {
5430
+ notation: Xo,
5379
5431
  apiVersion: Pe,
5380
5432
  editable: t
5381
5433
  };
5382
5434
  t && n.on("commandStack.changed", () => {
5383
5435
  if (!(u > 0)) for (let e of [...l]) e();
5384
5436
  });
5385
- let h = (e) => e.filter(Xo).map((e) => s.of(e.id)), g = (e) => {
5437
+ let h = (e) => e.filter(Qo).map((e) => s.of(e.id)), g = (e) => {
5386
5438
  let t = s.of(e.id);
5387
5439
  return e.wardleyLabel ? {
5388
5440
  id: t,
@@ -5391,13 +5443,13 @@ function ts(e, t) {
5391
5443
  }, _ = (e) => {
5392
5444
  if (f) return;
5393
5445
  let t = i.get(s.canvasIdOf(e));
5394
- return Xo(t) && s.of(t.id) === e ? t : void 0;
5446
+ return Qo(t) && s.of(t.id) === e ? t : void 0;
5395
5447
  }, v = {
5396
- list: () => f ? [] : i.getAll().filter(Xo).map(g),
5448
+ list: () => f ? [] : i.getAll().filter(Qo).map(g),
5397
5449
  reveal(e) {
5398
5450
  if (f) return !1;
5399
5451
  let t = i.get(s.canvasIdOf(e));
5400
- return Xo(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
5452
+ return Qo(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
5401
5453
  },
5402
5454
  selection: () => f ? [] : h(a.get()),
5403
5455
  onSelection(e) {
@@ -5422,12 +5474,12 @@ function ts(e, t) {
5422
5474
  async function ee(n) {
5423
5475
  if (f) throw Error("The modeler was destroyed.");
5424
5476
  u += 1;
5425
- let r = t && d ? Ko(e) : void 0;
5477
+ let r = t && d ? Jo(e) : void 0;
5426
5478
  try {
5427
5479
  let { warnings: t } = await e.importDSL(n);
5428
- return d = !0, r && qo(e, r), { warnings: t.map((e) => e.message) };
5480
+ return d = !0, r && Yo(e, r), { warnings: t.map((e) => e.message) };
5429
5481
  } catch (t) {
5430
- throw r && qo(e, r, { importRejected: !0 }), t;
5482
+ throw r && Yo(e, r, { importRejected: !0 }), t;
5431
5483
  } finally {
5432
5484
  --u;
5433
5485
  }
@@ -5454,13 +5506,13 @@ function ts(e, t) {
5454
5506
  width: n,
5455
5507
  height: i
5456
5508
  };
5457
- return ns(a) ? a : void 0;
5509
+ return is(a) ? a : void 0;
5458
5510
  } catch {
5459
5511
  return;
5460
5512
  }
5461
5513
  },
5462
5514
  setViewState(e) {
5463
- !f && ns(e) && r.viewbox({
5515
+ !f && is(e) && r.viewbox({
5464
5516
  x: e.x,
5465
5517
  y: e.y,
5466
5518
  width: e.width,
@@ -5489,12 +5541,12 @@ function ts(e, t) {
5489
5541
  }
5490
5542
  };
5491
5543
  }
5492
- function ns(e) {
5544
+ function is(e) {
5493
5545
  if (typeof e != "object" || !e) return !1;
5494
5546
  let { x: t, y: n, width: r, height: i } = e;
5495
- return rs(t) && rs(n) && rs(r) && rs(i) && r > 0 && i > 0;
5547
+ return as(t) && as(n) && as(r) && as(i) && r > 0 && i > 0;
5496
5548
  }
5497
- function rs(e) {
5549
+ function as(e) {
5498
5550
  return typeof e == "number" && Number.isFinite(e);
5499
5551
  }
5500
5552
  // src/map-menu/menu.ts
@@ -5505,7 +5557,7 @@ var X = {
5505
5557
  json: "Export as JSON",
5506
5558
  wmap: "Export as .wmap"
5507
5559
  };
5508
- function is(e, t, n, r) {
5560
+ function os(e, t, n, r) {
5509
5561
  return {
5510
5562
  kind: "action",
5511
5563
  id: e,
@@ -5515,11 +5567,11 @@ function is(e, t, n, r) {
5515
5567
  onSelect: () => n.onSelect()
5516
5568
  };
5517
5569
  }
5518
- function as(e) {
5519
- let t = [is("export-png", X.png, e.png, "file-image"), is("export-svg", X.svg, e.svg, "file-code-corner")];
5520
- return e.transparentPng && t.push(is("export-png-transparent", X.transparentPng, e.transparentPng)), e.json && t.push(is("export-json", X.json, e.json)), e.wmap && t.push(is("export-wmap", X.wmap, e.wmap)), t;
5570
+ function ss(e) {
5571
+ let t = [os("export-png", X.png, e.png, "file-image"), os("export-svg", X.svg, e.svg, "file-code-corner")];
5572
+ return e.transparentPng && t.push(os("export-png-transparent", X.transparentPng, e.transparentPng)), e.json && t.push(os("export-json", X.json, e.json)), e.wmap && t.push(os("export-wmap", X.wmap, e.wmap)), t;
5521
5573
  }
5522
- function os(e) {
5574
+ function cs(e) {
5523
5575
  let { mapTitle: t, shortcutsKey: n } = e;
5524
5576
  return {
5525
5577
  model: [
@@ -5542,7 +5594,7 @@ function os(e) {
5542
5594
  onSelect: () => e.axisLabels()
5543
5595
  }
5544
5596
  ],
5545
- export: as(e.exports),
5597
+ export: ss(e.exports),
5546
5598
  help: [{
5547
5599
  kind: "dialog",
5548
5600
  id: "keyboard-shortcuts",
@@ -5554,15 +5606,15 @@ function os(e) {
5554
5606
  };
5555
5607
  }
5556
5608
  // src/map-menu/shortcuts.ts
5557
- var ss = "←↑→↓";
5558
- function cs(e) {
5609
+ var ls = "←↑→↓";
5610
+ function us(e) {
5559
5611
  try {
5560
5612
  return new Intl.NumberFormat(e, { style: "percent" }).format(1);
5561
5613
  } catch {
5562
5614
  return new Intl.NumberFormat("en", { style: "percent" }).format(1);
5563
5615
  }
5564
5616
  }
5565
- function ls(e, t) {
5617
+ function ds(e, t) {
5566
5618
  if (e === "mac") return {
5567
5619
  command: (e) => `⌘${e}`,
5568
5620
  shiftCommand: (e) => `⌘⇧${e}`,
@@ -5573,7 +5625,8 @@ function ls(e, t) {
5573
5625
  zoomToActual: "⌘0",
5574
5626
  fit: "⇧1",
5575
5627
  remove: ["⌫"],
5576
- enter: "↵"
5628
+ enter: "↵",
5629
+ breakLine: "⇧↵"
5577
5630
  };
5578
5631
  let { ctrl: n, shift: r, plus: i, minus: a } = t;
5579
5632
  return {
@@ -5586,10 +5639,11 @@ function ls(e, t) {
5586
5639
  zoomToActual: `${n}+0`,
5587
5640
  fit: `${r}+1`,
5588
5641
  remove: ["Del", "Backspace"],
5589
- enter: "Enter"
5642
+ enter: "Enter",
5643
+ breakLine: `${r}+Enter`
5590
5644
  };
5591
5645
  }
5592
- function us(e, t) {
5646
+ function fs(e, t) {
5593
5647
  return {
5594
5648
  title: "File",
5595
5649
  rows: [
@@ -5608,10 +5662,10 @@ function us(e, t) {
5608
5662
  ]
5609
5663
  };
5610
5664
  }
5611
- function ds(e, t = {}) {
5612
- let { platform: n, messages: r } = e, i = ls(n, r.keyNames);
5665
+ function ps(e, t = {}) {
5666
+ let { platform: n, messages: r } = e, i = ds(n, r.keyNames);
5613
5667
  return [
5614
- ...t.fileKeys ? [us(e, i.command)] : [],
5668
+ ...t.fileKeys ? [fs(e, i.command)] : [],
5615
5669
  {
5616
5670
  title: "View",
5617
5671
  rows: [
@@ -5624,7 +5678,7 @@ function ds(e, t = {}) {
5624
5678
  keys: [i.zoomOut]
5625
5679
  },
5626
5680
  {
5627
- action: r.zoomToActual(cs(e.lang)),
5681
+ action: r.zoomToActual(us(e.lang)),
5628
5682
  keys: [i.zoomToActual]
5629
5683
  },
5630
5684
  {
@@ -5652,6 +5706,10 @@ function ds(e, t = {}) {
5652
5706
  action: "Rename",
5653
5707
  keys: ["Double-click"]
5654
5708
  },
5709
+ {
5710
+ action: "Break the line in a name",
5711
+ keys: [i.breakLine]
5712
+ },
5655
5713
  {
5656
5714
  action: "Save a note while editing",
5657
5715
  keys: [i.command(i.enter)]
@@ -5674,11 +5732,11 @@ function ds(e, t = {}) {
5674
5732
  },
5675
5733
  {
5676
5734
  action: "Move the selection",
5677
- keys: [ss]
5735
+ keys: [ls]
5678
5736
  },
5679
5737
  {
5680
5738
  action: "Move the selection further",
5681
- keys: [i.shift(ss)]
5739
+ keys: [i.shift(ls)]
5682
5740
  },
5683
5741
  {
5684
5742
  action: "Select all",
@@ -5775,33 +5833,33 @@ function ds(e, t = {}) {
5775
5833
  * Copyright (c) 2026 Lucide Icons and Contributors
5776
5834
  * Derived from Feather @license MIT, Copyright (c) 2013-present Cole Bemis
5777
5835
  * Full notices: README.md of @miragon/wardley-renderer */
5778
- var fs = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
5836
+ var ms = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
5779
5837
  function Z(e, t, n) {
5780
5838
  let r = document.createElement(e);
5781
5839
  return r.className = t, n !== void 0 && (r.textContent = n), r;
5782
5840
  }
5783
- var ps = 0;
5784
- function ms(e) {
5785
- return ps += 1, `${e}-${ps}`;
5841
+ var hs = 0;
5842
+ function gs(e) {
5843
+ return hs += 1, `${e}-${hs}`;
5786
5844
  }
5787
5845
  // src/map-menu/dialog.ts
5788
5846
  function Q(e, t) {
5789
5847
  let n = Z("button", "wardley-button", e);
5790
5848
  return n.type = "button", n.dataset.variant = t, n;
5791
5849
  }
5792
- function hs(e, t, n, r) {
5850
+ function _s(e, t, n, r) {
5793
5851
  let i = Z("header", "wardley-dialog-header"), a = Z("h3", "wardley-dialog-title", t);
5794
5852
  a.id = n;
5795
5853
  let o = Z("button", "wardley-dialog-close");
5796
- return o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = fs, o.addEventListener("click", r), i.append(a, o), i;
5854
+ return o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = ms, o.addEventListener("click", r), i.append(a, o), i;
5797
5855
  }
5798
- function gs(e, t) {
5856
+ function vs(e, t) {
5799
5857
  let n;
5800
5858
  function r() {
5801
- let n = ms(`${t.className}-title`), r = Z("dialog", `wardley-dialog ${t.className}`);
5859
+ let n = gs(`${t.className}-title`), r = Z("dialog", `wardley-dialog ${t.className}`);
5802
5860
  r.setAttribute("aria-labelledby", n);
5803
5861
  let i = () => r.close(), a = Z("div", "wardley-dialog-panel");
5804
- a.append(hs(e, t.title, n, i), ...t.content(i)), r.append(a);
5862
+ a.append(_s(e, t.title, n, i), ...t.content(i)), r.append(a);
5805
5863
  let o = !1;
5806
5864
  return r.addEventListener("pointerdown", (e) => {
5807
5865
  o = e.target === r;
@@ -5826,7 +5884,7 @@ function gs(e, t) {
5826
5884
  }
5827
5885
  // src/map-menu/ShortcutsDialog.ts
5828
5886
  var $ = "wardley-shortcuts";
5829
- function _s(e, t) {
5887
+ function ys(e, t) {
5830
5888
  let n = Z("section", `${$}-group`), r = Z("h4", `${$}-group-title`, e.title);
5831
5889
  r.id = t;
5832
5890
  let i = Z("table", `${$}-table`);
@@ -5841,28 +5899,28 @@ function _s(e, t) {
5841
5899
  }
5842
5900
  return n.append(r, i), n;
5843
5901
  }
5844
- function vs(e, t = {}) {
5845
- return gs(e, {
5902
+ function bs(e, t = {}) {
5903
+ return vs(e, {
5846
5904
  className: $,
5847
5905
  title: "Keyboard shortcuts",
5848
5906
  content() {
5849
- let n = Z("div", `wardley-dialog-body ${$}-body`), r = ms(`${$}-group`);
5850
- return n.append(...ds(e, t).map((e, t) => _s(e, `${r}-${t}`))), [n];
5907
+ let n = Z("div", `wardley-dialog-body ${$}-body`), r = gs(`${$}-group`);
5908
+ return n.append(...ps(e, t).map((e, t) => ys(e, `${r}-${t}`))), [n];
5851
5909
  }
5852
5910
  });
5853
5911
  }
5854
5912
  // src/map-menu/TitleDialog.ts
5855
- function ys(e) {
5913
+ function xs(e) {
5856
5914
  return e.exportMap().config.title ?? r;
5857
5915
  }
5858
- function bs(e, t) {
5916
+ function Ss(e, t) {
5859
5917
  let n = Z("input", "wardley-field-input");
5860
- n.id = ms("wardley-title-field"), n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.maxLength = 120, n.autofocus = !0;
5861
- let i = gs(e, {
5918
+ n.id = gs("wardley-title-field"), n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.maxLength = 120, n.autofocus = !0;
5919
+ let i = vs(e, {
5862
5920
  className: "wardley-title-dialog",
5863
5921
  title: "Map title",
5864
5922
  beforeOpen() {
5865
- n.value = ys(t);
5923
+ n.value = xs(t);
5866
5924
  },
5867
5925
  afterOpen() {
5868
5926
  n.select();
@@ -5878,7 +5936,7 @@ function bs(e, t) {
5878
5936
  return u.type = "submit", c.append(l, u), i.append(a, c), i.addEventListener("submit", (i) => {
5879
5937
  i.preventDefault();
5880
5938
  let a = n.value.replace(/\s+/g, " ").trim() || r;
5881
- e(), a !== ys(t) && t.setTitle(a);
5939
+ e(), a !== xs(t) && t.setTitle(a);
5882
5940
  }), [i];
5883
5941
  }
5884
5942
  }), a = (e) => {
@@ -5894,14 +5952,14 @@ function bs(e, t) {
5894
5952
  };
5895
5953
  }
5896
5954
  // src/map-menu/popover.ts
5897
- function xs(e, t) {
5955
+ function Cs(e, t) {
5898
5956
  let n, r = (e) => {
5899
5957
  n && !n.contains(e.target) && s("done");
5900
5958
  }, i = () => s("done"), a = (e) => {
5901
5959
  e.key !== "Escape" || e.isComposing || (e.preventDefault(), e.stopPropagation(), s("done", { returnFocus: !0 }));
5902
5960
  };
5903
5961
  function o() {
5904
- let n = ms(`${t.className}-title`), r = Z("div", `wardley-popover ${t.className}`);
5962
+ let n = gs(`${t.className}-title`), r = Z("div", `wardley-popover ${t.className}`);
5905
5963
  r.setAttribute("role", "dialog"), r.setAttribute("aria-labelledby", n), r.hidden = !0;
5906
5964
  let i = Z("h2", "wardley-popover-title", t.title);
5907
5965
  i.id = n;
@@ -5926,8 +5984,8 @@ function xs(e, t) {
5926
5984
  }
5927
5985
  };
5928
5986
  }
5929
- function Ss(e, t) {
5930
- let n = Z("div", "wardley-field"), r = ms("wardley-field"), i = Z("label", "wardley-field-label", e);
5987
+ function ws(e, t) {
5988
+ let n = Z("div", "wardley-field"), r = gs("wardley-field"), i = Z("label", "wardley-field-label", e);
5931
5989
  i.htmlFor = r, t.id = r, t.classList.add("wardley-field-input"), n.append(i, t);
5932
5990
  let a;
5933
5991
  return {
@@ -5940,7 +5998,7 @@ function Ss(e, t) {
5940
5998
  }
5941
5999
  };
5942
6000
  }
5943
- function Cs(e, t) {
6001
+ function Ts(e, t) {
5944
6002
  let n = () => t.end("import"), r = (e) => {
5945
6003
  e.readOnly && t.end("cancel");
5946
6004
  };
@@ -5954,21 +6012,21 @@ function Cs(e, t) {
5954
6012
  };
5955
6013
  }
5956
6014
  // src/map-menu/MapSizePopover.ts
5957
- var ws = "custom";
5958
- function Ts(e, t) {
6015
+ var Es = "custom";
6016
+ function Ds(e, t) {
5959
6017
  let n = Z("input", "");
5960
6018
  return n.type = "number", n.inputMode = "numeric", n.min = String(e), n.max = String(t), n.step = "10", n;
5961
6019
  }
5962
- function Es(e, t) {
6020
+ function Os(e, t) {
5963
6021
  let n = Z("select", "");
5964
6022
  for (let e of c) {
5965
6023
  let t = Z("option", "", `${e.name} (${e.width} × ${e.height})`);
5966
6024
  t.value = e.id, n.append(t);
5967
6025
  }
5968
6026
  let r = Z("option", "", "Custom");
5969
- r.value = ws, n.append(r);
5970
- let i = Ts(f.width, u.width), a = Ts(f.height, u.height), o = Q("Reset to default", "ghost"), s = Ss("Size", n), l = Ss("Width", i), d = Ss("Height", a), p, m, h = (e) => {
5971
- n.value = e.presetId ?? ws, i.value = String(e.width), a.value = String(e.height), o.disabled = !e.isExplicit, l.clearError(), d.clearError();
6027
+ r.value = Es, n.append(r);
6028
+ let i = Ds(f.width, u.width), a = Ds(f.height, u.height), o = Q("Reset to default", "ghost"), s = ws("Size", n), l = ws("Width", i), d = ws("Height", a), p, m, h = (e) => {
6029
+ n.value = e.presetId ?? Es, i.value = String(e.width), a.value = String(e.height), o.disabled = !e.isExplicit, l.clearError(), d.clearError();
5972
6030
  }, g = (e) => {
5973
6031
  m = { size: e }, (e ? t.setMapSize(e.width, e.height, { transient: !0 }) : t.resetMapSize({ transient: !0 })).then(() => h(t.getMapSize()));
5974
6032
  }, _ = (e, n) => {
@@ -5985,7 +6043,7 @@ function Es(e, t) {
5985
6043
  [n]: i
5986
6044
  });
5987
6045
  };
5988
- return Cs(t, xs(e, {
6046
+ return Ts(t, Cs(e, {
5989
6047
  className: "wardley-map-size",
5990
6048
  title: "Map size",
5991
6049
  build(e, t, r) {
@@ -6010,30 +6068,30 @@ function Es(e, t) {
6010
6068
  closed(e) {
6011
6069
  let n = m;
6012
6070
  if (m = void 0, !n || e === "import") return;
6013
- let r = e === "done" ? n.size : Ds(p);
6071
+ let r = e === "done" ? n.size : ks(p);
6014
6072
  r ? t.setMapSize(r.width, r.height) : t.resetMapSize();
6015
6073
  }
6016
6074
  }));
6017
6075
  }
6018
- function Ds(e) {
6076
+ function ks(e) {
6019
6077
  return e?.isExplicit ? {
6020
6078
  width: e.width,
6021
6079
  height: e.height
6022
6080
  } : void 0;
6023
6081
  }
6024
6082
  // src/map-menu/AxisLabelsPopover.ts
6025
- var Os = "custom";
6026
- function ks(e) {
6027
- return o.find((t) => t.labels.every((t, n) => t === e[n]))?.id ?? Os;
6083
+ var As = "custom";
6084
+ function js(e) {
6085
+ return o.find((t) => t.labels.every((t, n) => t === e[n]))?.id ?? As;
6028
6086
  }
6029
- function As(e, t) {
6087
+ function Ms(e, t) {
6030
6088
  let r = Z("select", "");
6031
6089
  for (let e of o) {
6032
6090
  let t = Z("option", "", e.name);
6033
6091
  t.value = e.id, t.title = e.labels.join(" · "), r.append(t);
6034
6092
  }
6035
6093
  let i = Z("option", "", "Custom");
6036
- i.value = Os, r.append(i);
6094
+ i.value = As, r.append(i);
6037
6095
  let a = [
6038
6096
  1,
6039
6097
  2,
@@ -6043,18 +6101,18 @@ function As(e, t) {
6043
6101
  let e = Z("input", "");
6044
6102
  return e.type = "text", e.autocomplete = "off", e.spellcheck = !1, e;
6045
6103
  }), s = n, c = !1, l = (e) => {
6046
- a.forEach((t, n) => t.value = e[n] ?? ""), r.value = ks(e);
6104
+ a.forEach((t, n) => t.value = e[n] ?? ""), r.value = js(e);
6047
6105
  }, u = () => h(a.map((e) => e.value)), d = () => {
6048
6106
  c = !0;
6049
6107
  let e = u();
6050
- t.setEvolutionLabels(e, { transient: !0 }), r.value = ks(e ?? n);
6108
+ t.setEvolutionLabels(e, { transient: !0 }), r.value = js(e ?? n);
6051
6109
  };
6052
- return Cs(t, xs(e, {
6110
+ return Ts(t, Cs(e, {
6053
6111
  className: "wardley-axis-labels",
6054
6112
  title: "X-axis labels",
6055
6113
  build(e, t, i) {
6056
6114
  let s = Z("p", "wardley-popover-hint"), c = Z("a", "wardley-popover-link", "Learn Wardley Mapping");
6057
- c.href = "https://learnwardleymapping.com/landscape/", c.target = "_blank", c.rel = "noopener noreferrer", s.append("Label sets from ", c, ". Pick a set, or name each stage."), e.append(Ss("Preset", r).wrapper, s), a.forEach((t, n) => e.append(Ss(`Stage ${n + 1}`, t).wrapper));
6115
+ c.href = "https://learnwardleymapping.com/landscape/", c.target = "_blank", c.rel = "noopener noreferrer", s.append("Label sets from ", c, ". Pick a set, or name each stage."), e.append(ws("Preset", r).wrapper, s), a.forEach((t, n) => e.append(ws(`Stage ${n + 1}`, t).wrapper));
6058
6116
  let u = Q("Reset to default", "ghost"), f = Q("Done", "secondary");
6059
6117
  t.append(u, f), r.addEventListener("change", () => {
6060
6118
  let e = o.find((e) => e.id === r.value);
@@ -6075,11 +6133,6 @@ function As(e, t) {
6075
6133
  }
6076
6134
  }));
6077
6135
  }
6078
- // src/draw/deprecated-icons.ts
6079
- var js = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z", Ms = "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z", Ns = "M4 7v2c0 .55-.45 1-1 1H2v2h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h1v-2H7c-.55 0-1-.45-1-1v-2c0-.84-.35-1.61-.92-2.18L4.85 12l.23-.82C5.65 10.61 6 9.84 6 9V7c0-.55.45-1 1-1h1V4H7C5.35 4 4 5.35 4 7zm16 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-1v2h1c.55 0 1 .45 1 1v2c0 .84.35 1.61.92 2.18l.23.82-.23.82c-.57.57-.92 1.34-.92 2.18v2c0 .55-.45 1-1 1h-1v2h1c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-2h-1z", Ps = "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z", Fs = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", Is = "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z", Ls = "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", Rs = "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z", zs = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z", Bs = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z", Vs = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", Hs = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", Us = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z", Ws = Dr, Gs = Or, Ks = kr;
6080
- function qs(e, t) {
6081
- return Pr(e, t);
6082
- }
6083
- export { k as COLORS, X as EXPORT_LABELS, bn as EvolutionGrid, vi as FreeRect, Hs as ICON_ADD, Bs as ICON_ASPECT_RATIO, Ps as ICON_CODE, Ns as ICON_DATA_OBJECT, Ks as ICON_DELETE, Fs as ICON_DOWNLOAD, Gs as ICON_EDIT, Ls as ICON_FOLDER_OPEN, Rs as ICON_IMAGE, Vs as ICON_MENU, zs as ICON_NEW, Ws as ICON_PERSON, Ms as ICON_REDO, Is as ICON_SHARE, js as ICON_UNDO, Us as ICON_VISIBILITY, s as MAP_SIZE_PRESETS, E as MIRAGON, vt as MapProjection, Xt as MapResizeHandles, Ho as Modeler, Le as NOTE_COLORS, bi as NavigatedViewer, D as PLOT, l as PLOT_MAX, d as PLOT_MIN, La as POPUP_PROVIDER_ID, gi as PanConstraint, _i as PanConstraintModule, Gn as PipelineGroupBehavior, F as READ_ONLY_CHANGED, fr as RESIZE_MAP, Ke as ROOT_ID, Zt as ResizeAwareAutoScroll, pr as UPDATE_CONFIG, oi as Viewer, Jo as WARDLEY_NOTATION, ho as WardleyAppendBehavior, sn as WardleyBaseViewer, vo as WardleyColorPicker, To as WardleyDrawTool, pn as WardleyElementFactory, Ha as WardleyElementSettingsProvider, kn as WardleyEvolveDragging, rt as WardleyExporter, Qe as WardleyImporter, Lo as WardleyLabelDragging, va as WardleyLabelEditing, xi as WardleyLassoBehavior, cn as WardleyLayouter, Fa as WardleyLinkEditing, hr as WardleyModeling, xo as WardleyOrderingProvider, Et as WardleyReadOnly, Zr as WardleyRenderer, Di as WardleyRules, it as WardleySourceOrder, dt as blobToBase64, Na as canHaveLink, Pt as canvasAccessibilityModule, As as createAxisLabelsPopover, Zo as createCollaborativeModeler, Qo as createCollaborativeViewer, gs as createMapDialog, Es as createMapSizePopover, vs as createShortcutsDialog, bs as createTitleDialog, Q as dialogButton, Er as evolutionConstraintModule, Tr as evolutionGridModule, Ue as exportBounds, yi as freeRectModule, qs as iconMarkup, mt as ioModule, N as isComponent, P as isPipeline, M as isWardleyConnection, j as isWardleyShape, Sa as labelEditingModule, Ia as linkEditingModule, Pa as linkOf, os as mapMenu, $t as mapResizeModule, ds as mapShortcuts, g as normalizeMapSize, Kn as pipelineGroupModule, ee as presetIdForSize, Dt as readOnlyModule, qo as restoreEditorState, Be as saveSVG, Ko as setAsideEditorState, ki as stageSnappingModule, lt as svgToPng, go as wardleyAppendModule, yo as wardleyColorPickerModule, Qa as wardleyContextPadModule, ai as wardleyDrawModule, Mo as wardleyDrawToolModule, An as wardleyEvolveModule, fo as wardleyKeyboardModule, Bo as wardleyLabelDragModule, Si as wardleyLassoModule, ln as wardleyLayoutModule, mn as wardleyModelModule, wr as wardleyModelingModule, So as wardleyOrderingModule, Xi as wardleyPaletteModule, Ua as wardleyPopupModule, Oi as wardleyRulesModule };
6136
+ export { k as COLORS, X as EXPORT_LABELS, Cn as EvolutionGrid, bi as FreeRect, s as MAP_SIZE_PRESETS, E as MIRAGON, vt as MapProjection, Xt as MapResizeHandles, Wo as Modeler, Le as NOTE_COLORS, Si as NavigatedViewer, D as PLOT, l as PLOT_MAX, d as PLOT_MIN, Ba as POPUP_PROVIDER_ID, vi as PanConstraint, yi as PanConstraintModule, Jn as PipelineGroupBehavior, F as READ_ONLY_CHANGED, hr as RESIZE_MAP, Ke as ROOT_ID, Zt as ResizeAwareAutoScroll, gr as UPDATE_CONFIG, ci as Viewer, Xo as WARDLEY_NOTATION, vo as WardleyAppendBehavior, un as WardleyBaseViewer, xo as WardleyColorPicker, Oo as WardleyDrawTool, gn as WardleyElementFactory, Ga as WardleyElementSettingsProvider, Mn as WardleyEvolveDragging, rt as WardleyExporter, Qe as WardleyImporter, zo as WardleyLabelDragging, xa as WardleyLabelEditing, Ci as WardleyLassoBehavior, dn as WardleyLayouter, Ra as WardleyLinkEditing, vr as WardleyModeling, wo as WardleyOrderingProvider, Et as WardleyReadOnly, $r as WardleyRenderer, ki as WardleyRules, it as WardleySourceOrder, dt as blobToBase64, Ia as canHaveLink, Pt as canvasAccessibilityModule, Ms as createAxisLabelsPopover, $o as createCollaborativeModeler, es as createCollaborativeViewer, vs as createMapDialog, Os as createMapSizePopover, bs as createShortcutsDialog, Ss as createTitleDialog, Q as dialogButton, kr as evolutionConstraintModule, Or as evolutionGridModule, Ue as exportBounds, xi as freeRectModule, mt as ioModule, N as isComponent, P as isPipeline, M as isWardleyConnection, j as isWardleyShape, Ta as labelEditingModule, za as linkEditingModule, La as linkOf, cs as mapMenu, $t as mapResizeModule, ps as mapShortcuts, g as normalizeMapSize, Yn as pipelineGroupModule, ee as presetIdForSize, Dt as readOnlyModule, Yo as restoreEditorState, Be as saveSVG, Jo as setAsideEditorState, ji as stageSnappingModule, lt as svgToPng, yo as wardleyAppendModule, So as wardleyColorPickerModule, to as wardleyContextPadModule, si as wardleyDrawModule, Po as wardleyDrawToolModule, Nn as wardleyEvolveModule, ho as wardleyKeyboardModule, Ho as wardleyLabelDragModule, wi as wardleyLassoModule, fn as wardleyLayoutModule, _n as wardleyModelModule, Dr as wardleyModelingModule, To as wardleyOrderingModule, Qi as wardleyPaletteModule, Ka as wardleyPopupModule, Ai as wardleyRulesModule };
6084
6137
 
6085
6138
  //# sourceMappingURL=index.js.map