@html-graph/html-graph 8.17.0 → 8.18.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.
@@ -1,22 +1,22 @@
1
- var qe = Object.defineProperty;
2
- var et = (r, e, t) => e in r ? qe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => et(r, typeof e != "symbol" ? e + "" : e, t);
1
+ var tt = Object.defineProperty;
2
+ var rt = (r, e, t) => e in r ? tt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => rt(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  var I = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(I || {});
5
- const tt = () => {
5
+ const ot = () => {
6
6
  const r = document.createElement("div");
7
7
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
8
- }, rt = () => {
8
+ }, st = () => {
9
9
  const r = document.createElement("div");
10
10
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
11
- }, ot = (r) => {
11
+ }, it = (r) => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
- }, st = (r) => {
13
+ }, nt = (r) => {
14
14
  r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
15
15
  };
16
16
  class Te {
17
17
  constructor(e, t, o) {
18
- i(this, "host", tt());
19
- i(this, "container", rt());
18
+ i(this, "host", ot());
19
+ i(this, "container", st());
20
20
  i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
21
  i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
22
22
  i(this, "applyTransform", () => {
@@ -27,11 +27,11 @@ class Te {
27
27
  }
28
28
  attachNode(e) {
29
29
  const t = this.graphStore.getNode(e);
30
- ot(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
+ it(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
31
31
  }
32
32
  detachNode(e) {
33
33
  const t = this.graphStore.getNode(e);
34
- st(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
34
+ nt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
35
35
  }
36
36
  attachEdge(e) {
37
37
  const t = this.graphStore.getEdge(e).payload.shape.svg;
@@ -93,7 +93,7 @@ class Te {
93
93
  };
94
94
  }
95
95
  }
96
- class it {
96
+ class at {
97
97
  constructor(e) {
98
98
  i(this, "xFrom", 1 / 0);
99
99
  i(this, "yFrom", 1 / 0);
@@ -113,7 +113,7 @@ class it {
113
113
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
114
114
  }
115
115
  }
116
- class nt {
116
+ class ht {
117
117
  constructor(e, t, o, s) {
118
118
  i(this, "attachedNodes", /* @__PURE__ */ new Set());
119
119
  i(this, "attachedEdges", /* @__PURE__ */ new Set());
@@ -137,7 +137,7 @@ class nt {
137
137
  this.handleAttachEdge(a);
138
138
  });
139
139
  });
140
- this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new it(this.graphStore), this.trigger.subscribe(this.updateViewport);
140
+ this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new at(this.graphStore), this.trigger.subscribe(this.updateViewport);
141
141
  }
142
142
  attachNode(e) {
143
143
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -191,7 +191,7 @@ class nt {
191
191
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
192
192
  }
193
193
  }
194
- class at {
194
+ class dt {
195
195
  constructor(e, t) {
196
196
  i(this, "deferredNodes", /* @__PURE__ */ new Set());
197
197
  i(this, "deferredEdges", /* @__PURE__ */ new Set());
@@ -261,16 +261,16 @@ class q {
261
261
  });
262
262
  }
263
263
  }
264
- const P = () => {
264
+ const C = () => {
265
265
  const r = new q();
266
266
  return [r, r];
267
267
  };
268
- class Ce {
268
+ class Me {
269
269
  constructor(e, t, o, s) {
270
270
  i(this, "beforeDestroyEmitter");
271
271
  i(this, "destroyed", !1);
272
272
  i(this, "onBeforeDestroy");
273
- this.graph = e, this.viewport = t, this.graphController = o, this.viewportController = s, [this.beforeDestroyEmitter, this.onBeforeDestroy] = P();
273
+ this.graph = e, this.viewport = t, this.graphController = o, this.viewportController = s, [this.beforeDestroyEmitter, this.onBeforeDestroy] = C();
274
274
  }
275
275
  addNode(e) {
276
276
  return this.graphController.addNode(e), this;
@@ -318,7 +318,7 @@ class Ce {
318
318
  this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
319
319
  }
320
320
  }
321
- class ht {
321
+ class ct {
322
322
  constructor() {
323
323
  i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
324
324
  i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
@@ -387,7 +387,7 @@ const S = Object.freeze({
387
387
  removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
388
388
  accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
389
389
  });
390
- class Me {
390
+ class De {
391
391
  constructor() {
392
392
  i(this, "nodes", /* @__PURE__ */ new Map());
393
393
  i(this, "ports", /* @__PURE__ */ new Map());
@@ -396,7 +396,7 @@ class Me {
396
396
  i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
397
397
  i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
398
398
  i(this, "portCycleEdges", /* @__PURE__ */ new Map());
399
- i(this, "elementPorts", new ht());
399
+ i(this, "elementPorts", new ct());
400
400
  i(this, "edgesElementsMap", /* @__PURE__ */ new Map());
401
401
  i(this, "afterNodeAddedEmitter");
402
402
  i(this, "onAfterNodeAdded");
@@ -424,7 +424,7 @@ class Me {
424
424
  i(this, "onBeforeEdgeRemoved");
425
425
  i(this, "beforeClearEmitter");
426
426
  i(this, "onBeforeClear");
427
- [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = P(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = P(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = P(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = P(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = P(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = P(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = P(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = P(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = P(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = P(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = P(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = P(), [this.beforeClearEmitter, this.onBeforeClear] = P();
427
+ [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = C(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = C(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = C(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = C(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = C(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = C(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = C(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = C(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = C(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = C(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = C(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = C(), [this.beforeClearEmitter, this.onBeforeClear] = C();
428
428
  }
429
429
  hasNode(e) {
430
430
  return this.nodes.has(e);
@@ -682,22 +682,22 @@ class Me {
682
682
  this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(s.shape.svg);
683
683
  }
684
684
  }
685
- const ve = (r) => ({
685
+ const me = (r) => ({
686
686
  scale: 1 / r.scale,
687
687
  x: -r.x / r.scale,
688
688
  y: -r.y / r.scale
689
- }), me = {
689
+ }), xe = {
690
690
  scale: 1,
691
691
  x: 0,
692
692
  y: 0
693
- }, xe = (r, e) => ({
693
+ }, Ee = (r, e) => ({
694
694
  x: r.scale * e.x + r.x,
695
695
  y: r.scale * e.y + r.y
696
696
  });
697
- class dt {
697
+ class lt {
698
698
  constructor(e) {
699
- i(this, "viewportMatrix", me);
700
- i(this, "contentMatrix", me);
699
+ i(this, "viewportMatrix", xe);
700
+ i(this, "contentMatrix", xe);
701
701
  i(this, "beforeUpdateEmitter");
702
702
  i(this, "onBeforeUpdated");
703
703
  i(this, "afterUpdateEmitter");
@@ -707,7 +707,7 @@ class dt {
707
707
  i(this, "observer", new ResizeObserver(() => {
708
708
  this.afterResizeEmitter.emit();
709
709
  }));
710
- this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = P(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = P(), [this.afterResizeEmitter, this.onAfterResize] = P(), this.observer.observe(this.host);
710
+ this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = C(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = C(), [this.afterResizeEmitter, this.onAfterResize] = C(), this.observer.observe(this.host);
711
711
  }
712
712
  getViewportMatrix() {
713
713
  return this.viewportMatrix;
@@ -720,24 +720,24 @@ class dt {
720
720
  scale: e.scale ?? this.viewportMatrix.scale,
721
721
  x: e.x ?? this.viewportMatrix.x,
722
722
  y: e.y ?? this.viewportMatrix.y
723
- }, this.beforeUpdateEmitter.emit(), this.contentMatrix = ve(this.viewportMatrix), this.afterUpdateEmitter.emit();
723
+ }, this.beforeUpdateEmitter.emit(), this.contentMatrix = me(this.viewportMatrix), this.afterUpdateEmitter.emit();
724
724
  }
725
725
  patchContentMatrix(e) {
726
726
  this.contentMatrix = {
727
727
  scale: e.scale ?? this.contentMatrix.scale,
728
728
  x: e.x ?? this.contentMatrix.x,
729
729
  y: e.y ?? this.contentMatrix.y
730
- }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ve(this.contentMatrix), this.afterUpdateEmitter.emit();
730
+ }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = me(this.contentMatrix), this.afterUpdateEmitter.emit();
731
731
  }
732
732
  getDimensions() {
733
733
  const { width: e, height: t } = this.host.getBoundingClientRect();
734
734
  return { width: e, height: t };
735
735
  }
736
736
  createContentCoords(e) {
737
- return xe(this.viewportMatrix, e);
737
+ return Ee(this.viewportMatrix, e);
738
738
  }
739
739
  createViewportCoords(e) {
740
- return xe(this.contentMatrix, e);
740
+ return Ee(this.contentMatrix, e);
741
741
  }
742
742
  destroy() {
743
743
  this.observer.disconnect();
@@ -776,16 +776,16 @@ class ee {
776
776
  this.canvas.updateNode(t);
777
777
  }
778
778
  }
779
- const ct = (r, e, t) => {
779
+ const ut = (r, e, t) => {
780
780
  const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
781
781
  return e >= o && e <= o + n && t >= s && t <= s + a;
782
- }, lt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
783
- class ut {
782
+ }, gt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
783
+ class pt {
784
784
  constructor(e, t) {
785
785
  this.element = e, this.win = t;
786
786
  }
787
787
  verify(e, t) {
788
- return ct(this.element, e, t) && lt(this.win, e, t);
788
+ return ut(this.element, e, t) && gt(this.win, e, t);
789
789
  }
790
790
  }
791
791
  const H = (r, e) => {
@@ -805,7 +805,7 @@ const H = (r, e) => {
805
805
  }
806
806
  ]
807
807
  };
808
- }, gt = (r, e) => {
808
+ }, wt = (r, e) => {
809
809
  let t = e;
810
810
  for (; t !== null; ) {
811
811
  const o = r.findPortIdsByElement(t)[0] ?? null;
@@ -824,21 +824,21 @@ const H = (r, e) => {
824
824
  status: "notFound"
825
825
  };
826
826
  };
827
- function* De(r, e) {
827
+ function* Re(r, e) {
828
828
  const t = r.elementsFromPoint(e.x, e.y);
829
829
  for (const o of t) {
830
830
  if (o.shadowRoot !== null) {
831
- const s = De(o.shadowRoot, e);
831
+ const s = Re(o.shadowRoot, e);
832
832
  for (const n of s)
833
833
  yield n;
834
834
  }
835
835
  yield o;
836
836
  }
837
837
  }
838
- const Re = (r, e) => {
839
- const t = De(document, e);
838
+ const Le = (r, e) => {
839
+ const t = Re(document, e);
840
840
  for (const o of t) {
841
- const s = gt(r, o);
841
+ const s = wt(r, o);
842
842
  if (s.status === "portFound")
843
843
  return s.portId;
844
844
  if (s.status === "nodeEncountered")
@@ -846,14 +846,14 @@ const Re = (r, e) => {
846
846
  }
847
847
  return null;
848
848
  };
849
- var D = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(D || {});
850
- const Le = (r, e) => ({
849
+ var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
850
+ const Ve = (r, e) => ({
851
851
  x: r / 2,
852
852
  y: e / 2
853
853
  }), m = (r, e, t) => ({
854
854
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
855
855
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
856
- }), Ve = (r, e, t) => {
856
+ }), Ie = (r, e, t) => {
857
857
  const o = {
858
858
  x: r.x + r.width / 2,
859
859
  y: r.y + r.height / 2
@@ -870,7 +870,7 @@ const Le = (r, e) => ({
870
870
  to: { x: s.x - n, y: s.y - a }
871
871
  };
872
872
  };
873
- class pt {
873
+ class yt {
874
874
  constructor(e) {
875
875
  i(this, "path");
876
876
  i(this, "midpoint");
@@ -903,7 +903,7 @@ class pt {
903
903
  this.path = `${x}${f}${E}`;
904
904
  }
905
905
  }
906
- class wt {
906
+ class ft {
907
907
  constructor(e) {
908
908
  i(this, "path");
909
909
  i(this, "midpoint");
@@ -940,13 +940,13 @@ class wt {
940
940
  { x: c.x - u, y: c.y },
941
941
  a,
942
942
  c
943
- ), T = {
943
+ ), P = {
944
944
  x: E.x + w,
945
945
  y: E.y + y
946
- }, C = {
947
- x: (x.x + T.x) / 2,
948
- y: (x.y + T.y) / 2
949
- }, M = {
946
+ }, T = {
947
+ x: (x.x + P.x) / 2,
948
+ y: (x.y + P.y) / 2
949
+ }, D = {
950
950
  x: f.x + s * n.x,
951
951
  y: f.y + s * n.y
952
952
  }, F = {
@@ -962,24 +962,24 @@ class wt {
962
962
  this.path = [
963
963
  `M ${l.x} ${l.y}`,
964
964
  `L ${f.x} ${f.y}`,
965
- `C ${M.x} ${M.y} ${U.x} ${U.y} ${C.x} ${C.y}`,
965
+ `C ${D.x} ${D.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
966
966
  `C ${R.x} ${R.y} ${F.x} ${F.y} ${E.x} ${E.y}`,
967
967
  `L ${p.x} ${p.y}`
968
- ].join(" "), this.midpoint = C;
968
+ ].join(" "), this.midpoint = T;
969
969
  }
970
970
  }
971
971
  const te = Object.freeze({
972
972
  edgeColor: "--edge-color"
973
- }), Ie = (r) => {
973
+ }), Fe = (r) => {
974
974
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
975
975
  return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(te.edgeColor, r), e;
976
- }, Fe = (r) => {
976
+ }, Ue = (r) => {
977
977
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
978
978
  return e.setAttribute("stroke", `var(${te.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
979
979
  }, X = () => {
980
980
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
981
981
  return r.setAttribute("fill", `var(${te.edgeColor})`), r;
982
- }, Ue = (r, e) => {
982
+ }, $e = (r, e) => {
983
983
  r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
984
984
  }, V = (r, e) => {
985
985
  const t = [];
@@ -990,17 +990,17 @@ const te = Object.freeze({
990
990
  let c = 0, u = 0, g = 0;
991
991
  const l = d > 0, p = d < o, w = l && p;
992
992
  if (l && (c = -s, u = -n, g = a), p) {
993
- const M = r[d + 1];
994
- s = M.x - h.x, n = M.y - h.y, a = Math.sqrt(s * s + n * n);
993
+ const D = r[d + 1];
994
+ s = D.x - h.x, n = D.y - h.y, a = Math.sqrt(s * s + n * n);
995
995
  }
996
- const f = a !== 0 ? Math.min((w ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, x = w ? { x: h.x + s * f, y: h.y + n * f } : h, T = g !== 0 ? Math.min((w ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, C = w ? { x: h.x + c * T, y: h.y + u * T } : h;
997
- d > 0 && t.push(`L ${C.x} ${C.y}`), w && t.push(
996
+ const f = a !== 0 ? Math.min((w ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, x = w ? { x: h.x + s * f, y: h.y + n * f } : h, P = g !== 0 ? Math.min((w ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, T = w ? { x: h.x + c * P, y: h.y + u * P } : h;
997
+ d > 0 && t.push(`L ${T.x} ${T.y}`), w && t.push(
998
998
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
999
999
  );
1000
1000
  });
1001
1001
  }
1002
1002
  return t.join(" ");
1003
- }, yt = (r, e) => {
1003
+ }, vt = (r, e) => {
1004
1004
  const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
1005
1005
  if (o === s) {
1006
1006
  const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
@@ -1036,7 +1036,7 @@ const te = Object.freeze({
1036
1036
  midpoint: { x: d.x, y: h }
1037
1037
  };
1038
1038
  };
1039
- class ft {
1039
+ class mt {
1040
1040
  constructor(e) {
1041
1041
  i(this, "path");
1042
1042
  i(this, "midpoint");
@@ -1065,7 +1065,7 @@ class ft {
1065
1065
  { x: t.x + p, y: t.y },
1066
1066
  s,
1067
1067
  t
1068
- ), y = m({ x: o.x - p, y: o.y }, n, o), f = yt(
1068
+ ), y = m({ x: o.x - p, y: o.y }, n, o), f = vt(
1069
1069
  {
1070
1070
  x: w.x,
1071
1071
  y: w.y,
@@ -1083,7 +1083,7 @@ class ft {
1083
1083
  ), this.midpoint = f.midpoint;
1084
1084
  }
1085
1085
  }
1086
- class vt {
1086
+ class xt {
1087
1087
  constructor(e) {
1088
1088
  i(this, "path");
1089
1089
  i(this, "midpoint");
@@ -1114,27 +1114,27 @@ class vt {
1114
1114
  { x: s.x + y, y: s.y },
1115
1115
  h,
1116
1116
  s
1117
- ), T = {
1117
+ ), P = {
1118
1118
  x: E.x + f,
1119
1119
  y: E.y + x
1120
- }, C = m(
1120
+ }, T = m(
1121
1121
  { x: n.x - y, y: n.y },
1122
1122
  d,
1123
1123
  n
1124
- ), M = {
1125
- x: C.x + f,
1126
- y: C.y + x
1124
+ ), D = {
1125
+ x: T.x + f,
1126
+ y: T.y + x
1127
1127
  };
1128
1128
  this.midpoint = {
1129
- x: (T.x + M.x) / 2,
1130
- y: (T.y + M.y) / 2
1129
+ x: (P.x + D.x) / 2,
1130
+ y: (P.y + D.y) / 2
1131
1131
  }, this.path = V(
1132
- [p, E, T, M, C, w],
1132
+ [p, E, P, D, T, w],
1133
1133
  l
1134
1134
  );
1135
1135
  }
1136
1136
  }
1137
- class mt {
1137
+ class Et {
1138
1138
  constructor(e) {
1139
1139
  i(this, "path");
1140
1140
  i(this, "midpoint");
@@ -1163,8 +1163,8 @@ class mt {
1163
1163
  [g, y, x, l],
1164
1164
  u
1165
1165
  );
1166
- const E = (y.x + x.x) / 2, T = (y.y + x.y) / 2;
1167
- this.midpoint = { x: E, y: T };
1166
+ const E = (y.x + x.x) / 2, P = (y.y + x.y) / 2;
1167
+ this.midpoint = { x: E, y: P };
1168
1168
  }
1169
1169
  createArrowPoint(e, t, o, s) {
1170
1170
  if (!e)
@@ -1176,7 +1176,7 @@ class mt {
1176
1176
  return m(n, t, o);
1177
1177
  }
1178
1178
  }
1179
- const xt = (r, e) => {
1179
+ const At = (r, e) => {
1180
1180
  const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
1181
1181
  if (o === s) {
1182
1182
  const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
@@ -1212,7 +1212,7 @@ const xt = (r, e) => {
1212
1212
  midpoint: { x: h, y: d.y }
1213
1213
  };
1214
1214
  };
1215
- class Et {
1215
+ class St {
1216
1216
  constructor(e) {
1217
1217
  i(this, "path");
1218
1218
  i(this, "midpoint");
@@ -1241,7 +1241,7 @@ class Et {
1241
1241
  { x: t.x + p, y: t.y },
1242
1242
  d,
1243
1243
  t
1244
- ), y = m({ x: o.x - p, y: o.y }, c, o), f = xt(
1244
+ ), y = m({ x: o.x - p, y: o.y }, c, o), f = At(
1245
1245
  {
1246
1246
  x: w.x,
1247
1247
  y: w.y,
@@ -1276,7 +1276,7 @@ class re {
1276
1276
  this.path = `${h ? "" : l}${V(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
1277
1277
  }
1278
1278
  }
1279
- class At {
1279
+ class bt {
1280
1280
  constructor(e) {
1281
1281
  i(this, "path");
1282
1282
  i(this, "midpoint");
@@ -1294,7 +1294,7 @@ class At {
1294
1294
  this.path = `${h ? "" : x}${f}`, this.midpoint = y[3];
1295
1295
  }
1296
1296
  }
1297
- class St {
1297
+ class Nt {
1298
1298
  constructor(e) {
1299
1299
  i(this, "path");
1300
1300
  i(this, "midpoint");
@@ -1339,11 +1339,11 @@ class St {
1339
1339
  };
1340
1340
  }
1341
1341
  }
1342
- const bt = (r, e, t) => {
1342
+ const Pt = (r, e, t) => {
1343
1343
  const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
1344
1344
  return (t >= 0 ? o : s) + t;
1345
1345
  };
1346
- class Nt {
1346
+ class Ct {
1347
1347
  constructor(e) {
1348
1348
  i(this, "path");
1349
1349
  i(this, "midpoint");
@@ -1377,7 +1377,7 @@ class Nt {
1377
1377
  { x: a.x - w, y: a.y },
1378
1378
  d,
1379
1379
  a
1380
- ), x = bt(y, f, g);
1380
+ ), x = Pt(y, f, g);
1381
1381
  this.midpoint = {
1382
1382
  x: (y.x + f.x) / 2,
1383
1383
  y: x
@@ -1394,11 +1394,11 @@ class Nt {
1394
1394
  );
1395
1395
  }
1396
1396
  }
1397
- const Pt = (r, e, t) => {
1397
+ const Tt = (r, e, t) => {
1398
1398
  const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
1399
1399
  return (t >= 0 ? o : s) + t;
1400
1400
  };
1401
- class Tt {
1401
+ class Mt {
1402
1402
  constructor(e) {
1403
1403
  i(this, "path");
1404
1404
  i(this, "midpoint");
@@ -1432,7 +1432,7 @@ class Tt {
1432
1432
  { x: d.x - w, y: d.y },
1433
1433
  a,
1434
1434
  d
1435
- ), x = Pt(y, f, u);
1435
+ ), x = Tt(y, f, u);
1436
1436
  this.midpoint = {
1437
1437
  x,
1438
1438
  y: (y.y + f.y) / 2
@@ -1471,7 +1471,7 @@ const v = Object.freeze({
1471
1471
  curvature: 90,
1472
1472
  interactiveWidth: 10,
1473
1473
  preOffset: 0
1474
- }), Ee = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
1474
+ }), Ae = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
1475
1475
  class G {
1476
1476
  constructor(e) {
1477
1477
  i(this, "svg");
@@ -1485,16 +1485,16 @@ class G {
1485
1485
  i(this, "onAfterRender");
1486
1486
  i(this, "afterRenderEmitter");
1487
1487
  i(this, "arrowRenderer");
1488
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Ie(e.color), this.svg.appendChild(this.group), this.line = Fe(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1488
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Fe(e.color), this.svg.appendChild(this.group), this.line = Ue(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1489
1489
  }
1490
1490
  render(e) {
1491
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Ve(
1491
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = Ie(
1492
1492
  e.from,
1493
1493
  e.to,
1494
1494
  this.params.padding
1495
1495
  );
1496
- Ue(this.svg, { x: t, y: o, width: s, height: n });
1497
- const d = Ee(e.from.direction), c = Ee(e.to.direction);
1496
+ $e(this.svg, { x: t, y: o, width: s, height: n });
1497
+ const d = Ae(e.from.direction), c = Ae(e.to.direction);
1498
1498
  let u = { x: -c.x, y: -c.y }, g;
1499
1499
  e.category === I.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === I.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
1500
1500
  const l = g(a, h, d, c);
@@ -1517,7 +1517,7 @@ class G {
1517
1517
  });
1518
1518
  }
1519
1519
  }
1520
- const Ct = (r) => (e) => {
1520
+ const Dt = (r) => (e) => {
1521
1521
  const o = [
1522
1522
  { x: 0, y: 0 },
1523
1523
  { x: e.arrowLength, y: r.radius },
@@ -1529,7 +1529,7 @@ const Ct = (r) => (e) => {
1529
1529
  y: h.y + e.shift.y
1530
1530
  })), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1531
1531
  return `${s} ${n} ${a} Z`;
1532
- }, Mt = (r) => (e) => {
1532
+ }, Rt = (r) => (e) => {
1533
1533
  const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), n = s + t, a = o + t - t * (o + t) / n, h = t * s / n, c = [
1534
1534
  { x: 0, y: 0 },
1535
1535
  { x: a, y: -h },
@@ -1541,7 +1541,7 @@ const Ct = (r) => (e) => {
1541
1541
  y: w.y + e.shift.y
1542
1542
  })), u = `M ${c[0].x} ${c[0].y}`, g = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1543
1543
  return `${u} ${g} ${l} ${p}`;
1544
- }, Dt = (r) => (e) => {
1544
+ }, Lt = (r) => (e) => {
1545
1545
  const t = r.smallRadius, o = r.radius, s = m(
1546
1546
  {
1547
1547
  x: e.arrowLength,
@@ -1567,22 +1567,22 @@ const Ct = (r) => (e) => {
1567
1567
  return r;
1568
1568
  switch (r.type) {
1569
1569
  case "triangle":
1570
- return Ct({
1570
+ return Dt({
1571
1571
  radius: r.radius ?? v.polygonArrowRadius
1572
1572
  });
1573
1573
  case "arc":
1574
- return Mt({
1574
+ return Rt({
1575
1575
  radius: r.radius ?? v.circleArrowRadius
1576
1576
  });
1577
1577
  default:
1578
- return Dt({
1578
+ return Lt({
1579
1579
  smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
1580
1580
  angle: r.angle ?? v.wedgeArrowAngle,
1581
1581
  radius: r.radius ?? v.wedgeArrowRadius
1582
1582
  });
1583
1583
  }
1584
1584
  }, O = 50;
1585
- class Rt {
1585
+ class Vt {
1586
1586
  constructor(e) {
1587
1587
  i(this, "svg");
1588
1588
  i(this, "group");
@@ -1599,7 +1599,7 @@ class Rt {
1599
1599
  i(this, "hasSourceArrow");
1600
1600
  i(this, "hasTargetArrow");
1601
1601
  i(this, "pathShape");
1602
- i(this, "createCyclePath", (e, t, o) => new At({
1602
+ i(this, "createCyclePath", (e, t, o) => new bt({
1603
1603
  origin: e,
1604
1604
  dir: o,
1605
1605
  radius: this.portCycleRadius,
@@ -1607,7 +1607,7 @@ class Rt {
1607
1607
  arrowLength: this.arrowLength,
1608
1608
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1609
1609
  }));
1610
- i(this, "createDetourPath", (e, t, o, s) => new wt({
1610
+ i(this, "createDetourPath", (e, t, o, s) => new ft({
1611
1611
  from: e,
1612
1612
  to: t,
1613
1613
  fromDir: o,
@@ -1619,7 +1619,7 @@ class Rt {
1619
1619
  hasSourceArrow: this.hasSourceArrow,
1620
1620
  hasTargetArrow: this.hasTargetArrow
1621
1621
  }));
1622
- i(this, "createLinePath", (e, t, o, s) => new pt({
1622
+ i(this, "createLinePath", (e, t, o, s) => new yt({
1623
1623
  from: e,
1624
1624
  to: t,
1625
1625
  fromDir: o,
@@ -1646,7 +1646,7 @@ class Rt {
1646
1646
  this.pathShape.render(e);
1647
1647
  }
1648
1648
  }
1649
- class Lt {
1649
+ class It {
1650
1650
  constructor(e) {
1651
1651
  i(this, "svg");
1652
1652
  i(this, "group");
@@ -1671,7 +1671,7 @@ class Lt {
1671
1671
  roundness: this.roundness,
1672
1672
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1673
1673
  }));
1674
- i(this, "createDetourPath", (e, t, o, s) => new Nt({
1674
+ i(this, "createDetourPath", (e, t, o, s) => new Ct({
1675
1675
  from: e,
1676
1676
  to: t,
1677
1677
  fromDir: o,
@@ -1683,7 +1683,7 @@ class Lt {
1683
1683
  hasSourceArrow: this.hasSourceArrow,
1684
1684
  hasTargetArrow: this.hasTargetArrow
1685
1685
  }));
1686
- i(this, "createLinePath", (e, t, o, s) => new ft({
1686
+ i(this, "createLinePath", (e, t, o, s) => new mt({
1687
1687
  from: e,
1688
1688
  to: t,
1689
1689
  fromDir: o,
@@ -1717,7 +1717,7 @@ class Lt {
1717
1717
  this.pathShape.render(e);
1718
1718
  }
1719
1719
  }
1720
- class Vt {
1720
+ class Ft {
1721
1721
  constructor(e) {
1722
1722
  i(this, "svg");
1723
1723
  i(this, "group");
@@ -1743,7 +1743,7 @@ class Vt {
1743
1743
  roundness: this.roundness,
1744
1744
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1745
1745
  }));
1746
- i(this, "createDetourPath", (e, t, o, s) => new vt({
1746
+ i(this, "createDetourPath", (e, t, o, s) => new xt({
1747
1747
  from: e,
1748
1748
  to: t,
1749
1749
  fromDir: o,
@@ -1756,7 +1756,7 @@ class Vt {
1756
1756
  hasSourceArrow: this.hasSourceArrow,
1757
1757
  hasTargetArrow: this.hasTargetArrow
1758
1758
  }));
1759
- i(this, "createLinePath", (e, t, o, s) => new mt({
1759
+ i(this, "createLinePath", (e, t, o, s) => new Et({
1760
1760
  from: e,
1761
1761
  to: t,
1762
1762
  fromDir: o,
@@ -1790,7 +1790,7 @@ class Vt {
1790
1790
  this.pathShape.render(e);
1791
1791
  }
1792
1792
  }
1793
- class It {
1793
+ class Ut {
1794
1794
  constructor(e) {
1795
1795
  i(this, "svg");
1796
1796
  i(this, "group");
@@ -1815,7 +1815,7 @@ class It {
1815
1815
  roundness: this.roundness,
1816
1816
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1817
1817
  }));
1818
- i(this, "createDetourPath", (e, t, o, s) => new Tt({
1818
+ i(this, "createDetourPath", (e, t, o, s) => new Mt({
1819
1819
  from: e,
1820
1820
  to: t,
1821
1821
  fromDir: o,
@@ -1827,7 +1827,7 @@ class It {
1827
1827
  hasSourceArrow: this.hasSourceArrow,
1828
1828
  hasTargetArrow: this.hasTargetArrow
1829
1829
  }));
1830
- i(this, "createLinePath", (e, t, o, s) => new Et({
1830
+ i(this, "createLinePath", (e, t, o, s) => new St({
1831
1831
  from: e,
1832
1832
  to: t,
1833
1833
  fromDir: o,
@@ -1861,7 +1861,7 @@ class It {
1861
1861
  this.pathShape.render(e);
1862
1862
  }
1863
1863
  }
1864
- class $e {
1864
+ class Be {
1865
1865
  constructor(e) {
1866
1866
  i(this, "svg");
1867
1867
  i(this, "group", document.createElementNS(
@@ -1879,16 +1879,16 @@ class $e {
1879
1879
  i(this, "onAfterRender");
1880
1880
  i(this, "afterRenderEmitter");
1881
1881
  i(this, "arrowRenderer");
1882
- [this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Ie(this.color), this.svg.appendChild(this.group), this.line = Fe(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1882
+ [this.afterRenderEmitter, this.onAfterRender] = C(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Fe(this.color), this.svg.appendChild(this.group), this.line = Ue(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1883
1883
  }
1884
1884
  render(e) {
1885
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Ve(
1885
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = Ie(
1886
1886
  e.from,
1887
1887
  e.to,
1888
1888
  O
1889
1889
  );
1890
- Ue(this.svg, { x: t, y: o, width: s, height: n });
1891
- const d = new St({
1890
+ $e(this.svg, { x: t, y: o, width: s, height: n });
1891
+ const d = new Nt({
1892
1892
  from: a,
1893
1893
  to: h,
1894
1894
  sourceOffset: this.sourceOffset,
@@ -1940,22 +1940,22 @@ class $e {
1940
1940
  });
1941
1941
  }
1942
1942
  }
1943
- const Ft = () => {
1943
+ const $t = () => {
1944
1944
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1945
1945
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1946
- }, Ut = (r) => {
1946
+ }, Bt = (r) => {
1947
1947
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1948
1948
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1949
- }, Ae = (r) => {
1949
+ }, Se = (r) => {
1950
1950
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1951
1951
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1952
1952
  };
1953
- class $t extends Error {
1953
+ class Ot extends Error {
1954
1954
  constructor(e) {
1955
1955
  super(e), this.name = "InteractiveEdgeError";
1956
1956
  }
1957
1957
  }
1958
- class Be {
1958
+ class Oe {
1959
1959
  constructor(e, t) {
1960
1960
  i(this, "svg");
1961
1961
  i(this, "group");
@@ -1967,18 +1967,18 @@ class Be {
1967
1967
  * @deprecated
1968
1968
  * do use shape.svg instead
1969
1969
  */
1970
- i(this, "handle", Ft());
1970
+ i(this, "handle", $t());
1971
1971
  i(this, "onAfterRender");
1972
1972
  i(this, "interactiveLine");
1973
1973
  i(this, "interactiveSourceArrow", null);
1974
1974
  i(this, "interactiveTargetArrow", null);
1975
- if (this.baseEdge = e, e instanceof Be)
1976
- throw new $t(
1975
+ if (this.baseEdge = e, e instanceof Oe)
1976
+ throw new Ot(
1977
1977
  "interactive edge can be configured only once"
1978
1978
  );
1979
1979
  this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
1980
1980
  const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
1981
- this.interactiveLine = Ut(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ae(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ae(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1981
+ this.interactiveLine = Bt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Se(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Se(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1982
1982
  this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
1983
1983
  });
1984
1984
  }
@@ -1986,7 +1986,7 @@ class Be {
1986
1986
  this.baseEdge.render(e);
1987
1987
  }
1988
1988
  }
1989
- class Yr {
1989
+ class Jr {
1990
1990
  constructor(e, t) {
1991
1991
  i(this, "group");
1992
1992
  i(this, "line");
@@ -2003,7 +2003,7 @@ class Yr {
2003
2003
  this.baseShape.render(e);
2004
2004
  }
2005
2005
  }
2006
- class Oe {
2006
+ class We {
2007
2007
  constructor(e) {
2008
2008
  i(this, "onAfterNodeAdded");
2009
2009
  i(this, "onAfterNodeUpdated");
@@ -2118,7 +2118,7 @@ class K {
2118
2118
  this.counter = 0;
2119
2119
  }
2120
2120
  }
2121
- class We {
2121
+ class ze {
2122
2122
  constructor(e, t, o) {
2123
2123
  i(this, "nodeIdGenerator", new K(
2124
2124
  (e) => this.graphStore.hasNode(e)
@@ -2249,18 +2249,18 @@ class We {
2249
2249
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
2250
2250
  }
2251
2251
  }
2252
- const Bt = (r) => {
2252
+ const Wt = (r) => {
2253
2253
  setTimeout(() => {
2254
2254
  r();
2255
2255
  });
2256
- }, Ot = (r) => {
2256
+ }, zt = (r) => {
2257
2257
  queueMicrotask(() => {
2258
2258
  r();
2259
2259
  });
2260
2260
  }, oe = (r) => {
2261
2261
  r();
2262
2262
  };
2263
- class ze {
2263
+ class ke {
2264
2264
  constructor(e) {
2265
2265
  i(this, "onBeforeUpdated");
2266
2266
  i(this, "onAfterUpdated");
@@ -2283,7 +2283,7 @@ class ze {
2283
2283
  return this.viewportStore.createViewportCoords(e);
2284
2284
  }
2285
2285
  }
2286
- const Wt = (r, e) => Symbol.iterator in r ? {
2286
+ const kt = (r, e) => Symbol.iterator in r ? {
2287
2287
  minContentScale: e.focus.minContentScale,
2288
2288
  nodes: r,
2289
2289
  contentPadding: e.focus.contentPadding,
@@ -2293,16 +2293,16 @@ const Wt = (r, e) => Symbol.iterator in r ? {
2293
2293
  nodes: r.nodes ?? [],
2294
2294
  contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
2295
2295
  animationDuration: r.animationDuration ?? e.focus.animationDuration
2296
- }, ke = (r, e, t) => ({
2296
+ }, He = (r, e, t) => ({
2297
2297
  scale: r.scale,
2298
2298
  x: r.x + r.scale * e,
2299
2299
  y: r.y + r.scale * t
2300
- }), He = (r, e, t, o) => ({
2300
+ }), Ye = (r, e, t, o) => ({
2301
2301
  scale: r.scale * e,
2302
2302
  x: r.scale * (1 - e) * t + r.x,
2303
2303
  y: r.scale * (1 - e) * o + r.y
2304
2304
  });
2305
- class Ye {
2305
+ class Xe {
2306
2306
  constructor(e, t, o, s) {
2307
2307
  this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
2308
2308
  }
@@ -2314,11 +2314,11 @@ class Ye {
2314
2314
  }
2315
2315
  center(e, t) {
2316
2316
  const { width: o, height: s } = this.viewportStore.getDimensions(), n = { x: o / 2, y: s / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
2317
- let u = ke(a, d, c);
2317
+ let u = He(a, d, c);
2318
2318
  const g = t == null ? void 0 : t.contentScale;
2319
2319
  if (g !== void 0) {
2320
2320
  const p = 1 / g;
2321
- u = He(
2321
+ u = Ye(
2322
2322
  u,
2323
2323
  p / a.scale,
2324
2324
  n.x,
@@ -2329,7 +2329,7 @@ class Ye {
2329
2329
  l > 0 ? this.animateNavigation(a, u, l) : this.viewportStore.patchViewportMatrix(u);
2330
2330
  }
2331
2331
  focus(e) {
2332
- const t = Wt(e ?? {}, this.params);
2332
+ const t = kt(e ?? {}, this.params);
2333
2333
  this.params.focus.schedule(() => {
2334
2334
  this.navigate(t);
2335
2335
  });
@@ -2378,20 +2378,20 @@ class Ye {
2378
2378
  this.win.requestAnimationFrame(a);
2379
2379
  }
2380
2380
  }
2381
- const Xe = (r, e, t) => {
2382
- const o = new Me(), s = new Oe(o), n = new ze(e), a = new Te(o, e, r), h = {
2381
+ const Ge = (r, e, t) => {
2382
+ const o = new De(), s = new We(o), n = new ke(e), a = new Te(o, e, r), h = {
2383
2383
  nodes: {
2384
- centerFn: Le,
2384
+ centerFn: Ve,
2385
2385
  priorityFn: () => 0
2386
2386
  },
2387
2387
  edges: {
2388
- shapeFactory: () => new $e(),
2388
+ shapeFactory: () => new Be(),
2389
2389
  priorityFn: () => 0
2390
2390
  },
2391
2391
  ports: {
2392
2392
  direction: 0
2393
2393
  }
2394
- }, d = new We(
2394
+ }, d = new ze(
2395
2395
  o,
2396
2396
  a,
2397
2397
  h
@@ -2402,13 +2402,13 @@ const Xe = (r, e, t) => {
2402
2402
  schedule: oe,
2403
2403
  animationDuration: 0
2404
2404
  }
2405
- }, u = new Ye(
2405
+ }, u = new Xe(
2406
2406
  o,
2407
2407
  e,
2408
2408
  c,
2409
2409
  t
2410
2410
  );
2411
- return new Ce(s, n, d, u);
2411
+ return new Me(s, n, d, u);
2412
2412
  };
2413
2413
  class j {
2414
2414
  constructor(e, t, o, s) {
@@ -2425,7 +2425,7 @@ class j {
2425
2425
  if (!this.params.mouseDownEventVerifier(t))
2426
2426
  return;
2427
2427
  const o = e.currentTarget, s = this.canvas.graph.findPortIdsByElement(o)[0];
2428
- this.params.portDragAllowedVerifier(s, {
2428
+ this.params.onPointerDownVerifier(s, {
2429
2429
  x: t.clientX,
2430
2430
  y: t.clientY
2431
2431
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
@@ -2452,7 +2452,7 @@ class j {
2452
2452
  if (t.touches.length !== 1)
2453
2453
  return;
2454
2454
  const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(s)[0];
2455
- this.params.portDragAllowedVerifier(n, {
2455
+ this.params.onPointerDownVerifier(n, {
2456
2456
  x: o.clientX,
2457
2457
  y: o.clientY
2458
2458
  }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
@@ -2510,7 +2510,7 @@ class j {
2510
2510
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2511
2511
  }
2512
2512
  }
2513
- class zt {
2513
+ class Ht {
2514
2514
  constructor() {
2515
2515
  i(this, "field", "_htmlGraphTags");
2516
2516
  }
@@ -2614,7 +2614,38 @@ class ie {
2614
2614
  this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
2615
2615
  }
2616
2616
  }
2617
- class ne {
2617
+ const ne = (r, e) => ({
2618
+ from: r.isDirect ? r.staticPortId : e,
2619
+ to: r.isDirect ? e : r.staticPortId
2620
+ });
2621
+ class Yt {
2622
+ constructor(e, t) {
2623
+ this.graph = e, this.connectionAllowedVerifier = t;
2624
+ }
2625
+ resolve(e) {
2626
+ let t, o = 1 / 0;
2627
+ const { cursor: s } = e;
2628
+ return this.graph.getAllPortIds().forEach((n) => {
2629
+ const { element: a, direction: h, nodeId: d } = this.graph.getPort(n), { x: c, y: u } = this.graph.getNode(d);
2630
+ if (c === null || u === null)
2631
+ return;
2632
+ const g = ne(e, n);
2633
+ if (!this.connectionAllowedVerifier(g))
2634
+ return;
2635
+ const { top: l, left: p, width: w, height: y } = a.getBoundingClientRect(), f = { x: p + w / 2, y: l + y / 2 }, x = s.x - f.x, E = s.y - f.y, P = Math.sqrt(x * x + E * E);
2636
+ P < o && (o = P, t = h);
2637
+ }), t;
2638
+ }
2639
+ }
2640
+ class Xt {
2641
+ constructor(e) {
2642
+ this.direction = e;
2643
+ }
2644
+ resolve() {
2645
+ return this.direction;
2646
+ }
2647
+ }
2648
+ class ae {
2618
2649
  constructor(e, t, o, s, n) {
2619
2650
  i(this, "grabbedNode", null);
2620
2651
  i(this, "maxNodePriority", 0);
@@ -2733,7 +2764,7 @@ class ne {
2733
2764
  this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.params = n, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
2734
2765
  }
2735
2766
  static configure(e, t, o, s, n) {
2736
- new ne(
2767
+ new ae(
2737
2768
  e,
2738
2769
  t,
2739
2770
  o,
@@ -2924,7 +2955,7 @@ class J {
2924
2955
  );
2925
2956
  }
2926
2957
  moveViewport(e, t) {
2927
- const o = this.viewport.getViewportMatrix(), s = ke(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2958
+ const o = this.viewport.getViewportMatrix(), s = He(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2928
2959
  prevTransform: o,
2929
2960
  nextTransform: s,
2930
2961
  canvasWidth: n,
@@ -2933,7 +2964,7 @@ class J {
2933
2964
  this.performTransform(h);
2934
2965
  }
2935
2966
  scaleViewport(e, t, o) {
2936
- const s = this.canvas.viewport.getViewportMatrix(), n = He(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2967
+ const s = this.canvas.viewport.getViewportMatrix(), n = Ye(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2937
2968
  prevTransform: s,
2938
2969
  nextTransform: n,
2939
2970
  canvasWidth: a,
@@ -2972,7 +3003,7 @@ class J {
2972
3003
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
2973
3004
  }
2974
3005
  }
2975
- class ae {
3006
+ class he {
2976
3007
  constructor(e, t, o, s, n, a, h) {
2977
3008
  i(this, "nodeHorizontal");
2978
3009
  i(this, "nodeVertical");
@@ -3028,7 +3059,7 @@ class ae {
3028
3059
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
3029
3060
  }
3030
3061
  static configure(e, t, o, s, n, a, h) {
3031
- new ae(
3062
+ new he(
3032
3063
  e,
3033
3064
  t,
3034
3065
  o,
@@ -3059,24 +3090,24 @@ class ae {
3059
3090
  });
3060
3091
  }
3061
3092
  }
3062
- const kt = () => {
3093
+ const Gt = () => {
3063
3094
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3064
3095
  return r.style.position = "absolute", r.style.inset = "0", r;
3065
- }, Ht = () => {
3096
+ }, jt = () => {
3066
3097
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
3067
3098
  return r.setAttribute("fill", "url(#pattern)"), r;
3068
- }, Yt = () => {
3099
+ }, Jt = () => {
3069
3100
  const r = document.createElementNS(
3070
3101
  "http://www.w3.org/2000/svg",
3071
3102
  "pattern"
3072
3103
  );
3073
3104
  return r.setAttribute("id", "pattern"), r;
3074
3105
  };
3075
- class he {
3106
+ class de {
3076
3107
  constructor(e, t, o) {
3077
- i(this, "svg", kt());
3078
- i(this, "patternRenderingRectangle", Ht());
3079
- i(this, "pattern", Yt());
3108
+ i(this, "svg", Gt());
3109
+ i(this, "patternRenderingRectangle", jt());
3110
+ i(this, "pattern", Jt());
3080
3111
  i(this, "patternContent");
3081
3112
  i(this, "tileWidth");
3082
3113
  i(this, "tileHeight");
@@ -3097,7 +3128,7 @@ class he {
3097
3128
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
3098
3129
  }
3099
3130
  static configure(e, t, o) {
3100
- new he(e, t, o);
3131
+ new de(e, t, o);
3101
3132
  }
3102
3133
  updateVisibility() {
3103
3134
  const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
@@ -3111,15 +3142,14 @@ class he {
3111
3142
  }
3112
3143
  }
3113
3144
  }
3114
- class de {
3145
+ class ce {
3115
3146
  constructor(e, t, o, s, n, a) {
3116
3147
  i(this, "overlayCanvas");
3117
- i(this, "staticPortId", null);
3118
- i(this, "isTargetDragging", !0);
3148
+ i(this, "edgeInProgress", null);
3119
3149
  i(this, "onEdgeCreated", (e) => {
3120
3150
  this.params.onAfterEdgeCreated(e);
3121
3151
  });
3122
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Xe(
3152
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ge(
3123
3153
  this.overlayLayer,
3124
3154
  this.viewportStore,
3125
3155
  this.window
@@ -3127,7 +3157,7 @@ class de {
3127
3157
  const h = {
3128
3158
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3129
3159
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
3130
- portDragAllowedVerifier: (d, c) => {
3160
+ onPointerDownVerifier: (d, c) => {
3131
3161
  const u = this.params.connectionTypeResolver(d);
3132
3162
  return u === null ? !1 : (this.grabPort(d, c, u), !0);
3133
3163
  },
@@ -3138,11 +3168,8 @@ class de {
3138
3168
  this.tryCreateConnection(d), this.resetDragState();
3139
3169
  },
3140
3170
  onPointerOutside: () => {
3141
- const d = this.staticPortId, c = this.isTargetDragging;
3142
- this.resetDragState(), this.params.onEdgeCreationInterrupted({
3143
- staticPortId: d,
3144
- isDirect: c
3145
- });
3171
+ const d = this.edgeInProgress;
3172
+ this.resetDragState(), this.params.onEdgeCreationInterrupted(d);
3146
3173
  }
3147
3174
  };
3148
3175
  j.configure(
@@ -3153,7 +3180,7 @@ class de {
3153
3180
  );
3154
3181
  }
3155
3182
  static configure(e, t, o, s, n, a) {
3156
- new de(
3183
+ new ce(
3157
3184
  e,
3158
3185
  t,
3159
3186
  o,
@@ -3163,67 +3190,76 @@ class de {
3163
3190
  );
3164
3191
  }
3165
3192
  grabPort(e, t, o) {
3166
- const s = this.canvas.graph.getPort(e);
3167
- this.staticPortId = e;
3168
- const n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3193
+ const s = this.canvas.graph.getPort(e), n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3169
3194
  x: a - d.x,
3170
3195
  y: h - d.y
3171
3196
  }), u = this.canvas.viewport.createContentCoords({
3172
3197
  x: t.x - d.x,
3173
3198
  y: t.y - d.y
3174
3199
  }), g = {
3175
- overlayNodeId: D.StaticNodeId,
3200
+ overlayNodeId: M.StaticNodeId,
3176
3201
  portCoords: c,
3177
3202
  portDirection: s.direction
3178
- }, l = {
3179
- overlayNodeId: D.DraggingNodeId,
3180
- portCoords: u,
3181
- portDirection: this.params.dragPortDirection
3203
+ }, l = o === "direct";
3204
+ this.edgeInProgress = {
3205
+ staticPortId: e,
3206
+ isDirect: l
3182
3207
  };
3183
- this.isTargetDragging = o === "direct";
3184
- const [p, w] = this.isTargetDragging ? [g, l] : [l, g];
3185
- this.overlayCanvas.addNode(Y(p)), this.overlayCanvas.addNode(Y(w)), this.overlayCanvas.addEdge({
3186
- from: p.overlayNodeId,
3187
- to: w.overlayNodeId,
3188
- shape: this.params.edgeShapeFactory(D.EdgeId)
3208
+ const p = {
3209
+ overlayNodeId: M.DraggingNodeId,
3210
+ portCoords: u,
3211
+ portDirection: this.params.draggingPortDirectionResolver.resolve({
3212
+ cursor: t,
3213
+ ...this.edgeInProgress
3214
+ }) ?? s.direction
3215
+ }, [w, y] = l ? [g, p] : [p, g];
3216
+ this.overlayCanvas.addNode(Y(w)), this.overlayCanvas.addNode(Y(y)), this.overlayCanvas.addEdge({
3217
+ from: w.overlayNodeId,
3218
+ to: y.overlayNodeId,
3219
+ shape: this.params.edgeShapeFactory(M.EdgeId)
3189
3220
  });
3190
3221
  }
3191
3222
  resetDragState() {
3192
- this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
3223
+ this.edgeInProgress = null, this.overlayCanvas.clear();
3193
3224
  }
3194
3225
  tryCreateConnection(e) {
3195
- const t = Re(this.canvas.graph, e);
3226
+ const t = Le(this.canvas.graph, e);
3196
3227
  if (t === null) {
3197
- this.params.onEdgeCreationInterrupted({
3198
- staticPortId: this.staticPortId,
3199
- isDirect: this.isTargetDragging
3200
- });
3228
+ this.params.onEdgeCreationInterrupted(this.edgeInProgress);
3201
3229
  return;
3202
3230
  }
3203
- const o = this.staticPortId, s = this.isTargetDragging ? o : t, n = this.isTargetDragging ? t : o, a = { from: s, to: n }, h = this.params.connectionAllowedVerifier(a), d = this.params.connectionPreprocessor(a);
3204
- h && d !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(d), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
3231
+ const o = ne(
3232
+ this.edgeInProgress,
3233
+ t
3234
+ ), s = this.params.connectionAllowedVerifier(o), n = this.params.connectionPreprocessor({
3235
+ from: o.from,
3236
+ to: o.to
3237
+ });
3238
+ s && n !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(n), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(o);
3205
3239
  }
3206
3240
  moveDraggingPort(e) {
3207
3241
  const t = this.overlayLayer.getBoundingClientRect(), o = this.canvas.viewport.createContentCoords({
3208
3242
  x: e.x - t.x,
3209
3243
  y: e.y - t.y
3244
+ }), s = this.params.draggingPortDirectionResolver.resolve({
3245
+ cursor: e,
3246
+ ...this.edgeInProgress
3210
3247
  });
3211
- this.overlayCanvas.updateNode(D.DraggingNodeId, {
3248
+ this.overlayCanvas.updateNode(M.DraggingNodeId, {
3212
3249
  x: o.x,
3213
3250
  y: o.y
3214
- });
3251
+ }).updatePort(M.DraggingNodeId, { direction: s });
3215
3252
  }
3216
3253
  }
3217
- class ce {
3254
+ class le {
3218
3255
  constructor(e, t, o, s, n, a) {
3219
3256
  i(this, "overlayCanvas");
3220
- i(this, "staticPortId", null);
3221
- i(this, "isTargetDragging", !0);
3257
+ i(this, "edgeInProgress", null);
3222
3258
  i(this, "draggingEdgePayload", null);
3223
3259
  i(this, "onEdgeReattached", (e) => {
3224
3260
  this.params.onAfterEdgeReattached(e);
3225
3261
  });
3226
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Xe(
3262
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ge(
3227
3263
  this.overlayLayer,
3228
3264
  this.viewportStore,
3229
3265
  this.window
@@ -3231,7 +3267,7 @@ class ce {
3231
3267
  const h = {
3232
3268
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3233
3269
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
3234
- portDragAllowedVerifier: (d, c) => this.tryStartEdgeDragging(d, c),
3270
+ onPointerDownVerifier: (d, c) => this.tryStartEdgeDragging(d, c),
3235
3271
  onPointerMove: (d) => {
3236
3272
  this.moveDraggingPort(d);
3237
3273
  },
@@ -3257,7 +3293,7 @@ class ce {
3257
3293
  );
3258
3294
  }
3259
3295
  static configure(e, t, o, s, n, a) {
3260
- new ce(
3296
+ new le(
3261
3297
  e,
3262
3298
  t,
3263
3299
  o,
@@ -3271,7 +3307,7 @@ class ce {
3271
3307
  if (o === null)
3272
3308
  return !1;
3273
3309
  const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
3274
- this.staticPortId = h, this.isTargetDragging = a;
3310
+ this.edgeInProgress = { staticPortId: h, isDirect: a };
3275
3311
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), g = {
3276
3312
  x: u.x + u.width / 2,
3277
3313
  y: u.y + u.height / 2
@@ -3290,43 +3326,59 @@ class ce {
3290
3326
  priority: s.priority
3291
3327
  }, this.canvas.removeEdge(o);
3292
3328
  const y = {
3293
- overlayNodeId: D.StaticNodeId,
3329
+ overlayNodeId: M.StaticNodeId,
3294
3330
  portCoords: p,
3295
3331
  portDirection: c.direction
3296
- }, f = {
3297
- overlayNodeId: D.DraggingNodeId,
3332
+ }, f = this.params.draggingPortDirectionResolver.resolve({
3333
+ cursor: t,
3334
+ ...this.edgeInProgress
3335
+ }), x = {
3336
+ overlayNodeId: M.DraggingNodeId,
3298
3337
  portCoords: w,
3299
- portDirection: d.direction
3300
- }, [x, E] = this.isTargetDragging ? [y, f] : [f, y];
3301
- this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(E));
3302
- const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(D.EdgeId) : s.shape;
3338
+ portDirection: f ?? d.direction
3339
+ }, [E, P] = a ? [y, x] : [x, y];
3340
+ this.overlayCanvas.addNode(Y(E)), this.overlayCanvas.addNode(Y(P));
3341
+ const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
3303
3342
  return this.overlayCanvas.addEdge({
3304
- id: D.EdgeId,
3305
- from: x.overlayNodeId,
3306
- to: E.overlayNodeId,
3343
+ id: M.EdgeId,
3344
+ from: E.overlayNodeId,
3345
+ to: P.overlayNodeId,
3307
3346
  shape: T
3308
3347
  }), !0;
3309
3348
  }
3310
3349
  resetDragState() {
3311
- this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
3350
+ this.draggingEdgePayload = null, this.edgeInProgress = null, this.overlayCanvas.clear();
3312
3351
  }
3313
3352
  moveDraggingPort(e) {
3314
3353
  const t = this.overlayLayer.getBoundingClientRect(), o = {
3315
3354
  x: e.x - t.x,
3316
3355
  y: e.y - t.y
3317
- }, s = this.canvas.viewport.createContentCoords(o);
3318
- this.overlayCanvas.updateNode(D.DraggingNodeId, {
3356
+ }, s = this.canvas.viewport.createContentCoords(o), n = this.params.draggingPortDirectionResolver.resolve({
3357
+ cursor: e,
3358
+ ...this.edgeInProgress
3359
+ });
3360
+ this.overlayCanvas.updateNode(M.DraggingNodeId, {
3319
3361
  x: s.x,
3320
3362
  y: s.y
3321
- });
3363
+ }).updatePort(M.DraggingNodeId, { direction: n });
3322
3364
  }
3323
3365
  tryCreateConnection(e) {
3324
- const t = Re(this.canvas.graph, e);
3325
- if (this.overlayCanvas.removeEdge(D.EdgeId), t === null) {
3326
- this.handleEdgeReattachInterrupted();
3366
+ const t = Le(this.canvas.graph, e);
3367
+ if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
3368
+ const c = this.draggingEdgePayload;
3369
+ this.params.onEdgeReattachInterrupted({
3370
+ id: c.id,
3371
+ from: c.from,
3372
+ to: c.to,
3373
+ shape: c.shape,
3374
+ priority: c.priority
3375
+ });
3327
3376
  return;
3328
3377
  }
3329
- const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
3378
+ const { from: o, to: s } = ne(
3379
+ this.edgeInProgress,
3380
+ t
3381
+ ), n = this.draggingEdgePayload, a = {
3330
3382
  id: n.id,
3331
3383
  from: o,
3332
3384
  to: s,
@@ -3349,28 +3401,18 @@ class ce {
3349
3401
  });
3350
3402
  }
3351
3403
  }
3352
- handleEdgeReattachInterrupted() {
3353
- const e = this.draggingEdgePayload;
3354
- this.params.onEdgeReattachInterrupted({
3355
- id: e.id,
3356
- from: e.from,
3357
- to: e.to,
3358
- shape: e.shape,
3359
- priority: e.priority
3360
- });
3361
- }
3362
3404
  }
3363
- class le {
3405
+ class ue {
3364
3406
  constructor(e, t) {
3365
3407
  this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
3366
3408
  this.applier.apply();
3367
3409
  });
3368
3410
  }
3369
3411
  static configure(e, t) {
3370
- new le(e, t);
3412
+ new ue(e, t);
3371
3413
  }
3372
3414
  }
3373
- class ue {
3415
+ class ge {
3374
3416
  constructor(e, t, o) {
3375
3417
  i(this, "applyScheduled", !1);
3376
3418
  i(this, "apply", () => {
@@ -3387,7 +3429,7 @@ class ue {
3387
3429
  });
3388
3430
  }
3389
3431
  static configure(e, t, o) {
3390
- new ue(
3432
+ new ge(
3391
3433
  e,
3392
3434
  t,
3393
3435
  o
@@ -3397,7 +3439,7 @@ class ue {
3397
3439
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
3398
3440
  }
3399
3441
  }
3400
- class Xt {
3442
+ class Kt {
3401
3443
  constructor(e, t, o) {
3402
3444
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
3403
3445
  }
@@ -3411,23 +3453,23 @@ class Xt {
3411
3453
  }), this.params.onAfterApplied();
3412
3454
  }
3413
3455
  }
3414
- class Gt {
3456
+ class Qt {
3415
3457
  static configure(e, t) {
3416
- const o = t.applyOn, s = new Xt(e, t.algorithm, {
3458
+ const o = t.applyOn, s = new Kt(e, t.algorithm, {
3417
3459
  staticNodeResolver: t.staticNodeResolver,
3418
3460
  onBeforeApplied: t.onBeforeApplied,
3419
3461
  onAfterApplied: t.onAfterApplied
3420
3462
  });
3421
3463
  switch (o.type) {
3422
3464
  case "trigger": {
3423
- le.configure(
3465
+ ue.configure(
3424
3466
  s,
3425
3467
  o.trigger
3426
3468
  );
3427
3469
  break;
3428
3470
  }
3429
3471
  case "topologyChangeSchedule": {
3430
- ue.configure(
3472
+ ge.configure(
3431
3473
  e.graph,
3432
3474
  s,
3433
3475
  o.schedule
@@ -3437,7 +3479,7 @@ class Gt {
3437
3479
  }
3438
3480
  }
3439
3481
  }
3440
- class jt {
3482
+ class Zt {
3441
3483
  constructor(e, t) {
3442
3484
  i(this, "previousTimeStamp");
3443
3485
  i(this, "step", (e) => {
@@ -3452,7 +3494,7 @@ class jt {
3452
3494
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3453
3495
  }
3454
3496
  }
3455
- class Jt {
3497
+ class _t {
3456
3498
  constructor(e, t, o) {
3457
3499
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
3458
3500
  }
@@ -3467,23 +3509,23 @@ class Jt {
3467
3509
  }), this.params.onAfterApplied();
3468
3510
  }
3469
3511
  }
3470
- class ge {
3512
+ class pe {
3471
3513
  constructor(e, t, o) {
3472
3514
  i(this, "applier");
3473
3515
  i(this, "step", (e) => {
3474
3516
  this.applier.apply(e);
3475
3517
  });
3476
- this.win = o, this.applier = new Jt(e, t.algorithm, {
3518
+ this.win = o, this.applier = new _t(e, t.algorithm, {
3477
3519
  staticNodeResolver: t.staticNodeResolver,
3478
3520
  onBeforeApplied: t.onBeforeApplied,
3479
3521
  onAfterApplied: t.onAfterApplied
3480
- }), new jt(this.win, this.step);
3522
+ }), new Zt(this.win, this.step);
3481
3523
  }
3482
3524
  static configure(e, t, o) {
3483
- new ge(e, t, o);
3525
+ new pe(e, t, o);
3484
3526
  }
3485
3527
  }
3486
- class pe {
3528
+ class we {
3487
3529
  constructor(e, t, o, s, n) {
3488
3530
  i(this, "configurator");
3489
3531
  i(this, "onNodeSelected");
@@ -3517,7 +3559,7 @@ class pe {
3517
3559
  ), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
3518
3560
  }
3519
3561
  static configure(e, t, o, s, n) {
3520
- new pe(
3562
+ new we(
3521
3563
  e,
3522
3564
  t,
3523
3565
  o,
@@ -3526,7 +3568,7 @@ class pe {
3526
3568
  );
3527
3569
  }
3528
3570
  }
3529
- class we {
3571
+ class ye {
3530
3572
  constructor(e, t, o, s, n) {
3531
3573
  i(this, "configurator");
3532
3574
  i(this, "selectionHandledTag", se);
@@ -3560,7 +3602,7 @@ class we {
3560
3602
  ), this.canvas.graph.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.canvas.graph.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
3561
3603
  }
3562
3604
  static configure(e, t, o, s, n) {
3563
- new we(
3605
+ new ye(
3564
3606
  e,
3565
3607
  t,
3566
3608
  o,
@@ -3569,7 +3611,7 @@ class we {
3569
3611
  );
3570
3612
  }
3571
3613
  }
3572
- class ye {
3614
+ class fe {
3573
3615
  constructor(e, t, o, s, n, a) {
3574
3616
  i(this, "configurator");
3575
3617
  i(this, "onCanvasSelected");
@@ -3590,7 +3632,7 @@ class ye {
3590
3632
  });
3591
3633
  }
3592
3634
  static configure(e, t, o, s, n, a) {
3593
- new ye(
3635
+ new fe(
3594
3636
  e,
3595
3637
  t,
3596
3638
  o,
@@ -3600,23 +3642,23 @@ class ye {
3600
3642
  );
3601
3643
  }
3602
3644
  }
3603
- const Kt = () => {
3645
+ const qt = () => {
3604
3646
  const r = document.createElement("div");
3605
3647
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3606
3648
  }, Q = () => {
3607
3649
  const r = document.createElement("div");
3608
3650
  return r.style.position = "absolute", r.style.inset = "0", r;
3609
- }, Se = () => {
3651
+ }, be = () => {
3610
3652
  const r = Q();
3611
3653
  return r.style.pointerEvents = "none", r;
3612
3654
  };
3613
- class Qt {
3655
+ class er {
3614
3656
  constructor(e) {
3615
3657
  i(this, "background", Q());
3616
3658
  i(this, "main", Q());
3617
- i(this, "overlayConnectablePorts", Se());
3618
- i(this, "overlayDraggableEdges", Se());
3619
- i(this, "host", Kt());
3659
+ i(this, "overlayConnectablePorts", be());
3660
+ i(this, "overlayDraggableEdges", be());
3661
+ i(this, "host", qt());
3620
3662
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3621
3663
  }
3622
3664
  destroy() {
@@ -3642,7 +3684,80 @@ const b = Object.freeze({
3642
3684
  mouseUpEventVerifier: (r) => r.button === 0,
3643
3685
  movementThreshold: 10
3644
3686
  }), N = () => {
3645
- }, Zt = (r) => {
3687
+ }, je = (r, e, t) => r === "closest-connectable-port" ? new Yt(
3688
+ e,
3689
+ t
3690
+ ) : new Xt(r), ve = (r) => {
3691
+ if (typeof r == "function")
3692
+ return r;
3693
+ switch (r.type) {
3694
+ case "straight":
3695
+ return () => new Ft({
3696
+ color: r.color,
3697
+ width: r.width,
3698
+ arrowLength: r.arrowLength,
3699
+ arrowOffset: r.arrowOffset,
3700
+ arrowRenderer: r.arrowRenderer,
3701
+ hasSourceArrow: r.hasSourceArrow,
3702
+ hasTargetArrow: r.hasTargetArrow,
3703
+ cycleSquareSide: r.cycleSquareSide,
3704
+ roundness: r.roundness,
3705
+ detourDistance: r.detourDistance,
3706
+ detourDirection: r.detourDirection
3707
+ });
3708
+ case "horizontal":
3709
+ return () => new It({
3710
+ color: r.color,
3711
+ width: r.width,
3712
+ arrowLength: r.arrowLength,
3713
+ arrowOffset: r.arrowOffset,
3714
+ arrowRenderer: r.arrowRenderer,
3715
+ hasSourceArrow: r.hasSourceArrow,
3716
+ hasTargetArrow: r.hasTargetArrow,
3717
+ cycleSquareSide: r.cycleSquareSide,
3718
+ roundness: r.roundness,
3719
+ detourDistance: r.detourDistance
3720
+ });
3721
+ case "vertical":
3722
+ return () => new Ut({
3723
+ color: r.color,
3724
+ width: r.width,
3725
+ arrowLength: r.arrowLength,
3726
+ arrowOffset: r.arrowOffset,
3727
+ arrowRenderer: r.arrowRenderer,
3728
+ hasSourceArrow: r.hasSourceArrow,
3729
+ hasTargetArrow: r.hasTargetArrow,
3730
+ cycleSquareSide: r.cycleSquareSide,
3731
+ roundness: r.roundness,
3732
+ detourDistance: r.detourDistance
3733
+ });
3734
+ case "direct":
3735
+ return () => new Be({
3736
+ color: r.color,
3737
+ width: r.width,
3738
+ arrowLength: r.arrowLength,
3739
+ arrowRenderer: r.arrowRenderer,
3740
+ hasSourceArrow: r.hasSourceArrow,
3741
+ hasTargetArrow: r.hasTargetArrow,
3742
+ sourceOffset: r.sourceOffset,
3743
+ targetOffset: r.targetOffset
3744
+ });
3745
+ default:
3746
+ return () => new Vt({
3747
+ color: r.color,
3748
+ width: r.width,
3749
+ arrowLength: r.arrowLength,
3750
+ arrowRenderer: r.arrowRenderer,
3751
+ hasSourceArrow: r.hasSourceArrow,
3752
+ hasTargetArrow: r.hasTargetArrow,
3753
+ cycleRadius: r.cycleRadius,
3754
+ smallCycleRadius: r.smallCycleRadius,
3755
+ curvature: r.curvature,
3756
+ detourDistance: r.detourDistance,
3757
+ detourDirection: r.detourDirection
3758
+ });
3759
+ }
3760
+ }, tr = (r) => {
3646
3761
  var u, g, l, p, w, y;
3647
3762
  const e = r.nodeDragVerifier ?? (() => !0), t = r.moveOnTop !== !1, o = r.moveEdgesOnTop !== !1 && t, s = (u = r.mouse) == null ? void 0 : u.dragCursor, n = s !== void 0 ? s : "grab", a = (g = r.mouse) == null ? void 0 : g.mouseDownEventVerifier, h = a !== void 0 ? a : (f) => f.button === 0, d = (l = r.mouse) == null ? void 0 : l.mouseUpEventVerifier, c = d !== void 0 ? d : (f) => f.button === 0;
3648
3763
  return {
@@ -3657,7 +3772,7 @@ const b = Object.freeze({
3657
3772
  nodeDragVerifier: e,
3658
3773
  onNodeDragFinished: ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? N
3659
3774
  };
3660
- }, _t = (r) => {
3775
+ }, rr = (r) => {
3661
3776
  const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, s = r.maxY !== null ? r.maxY : 1 / 0;
3662
3777
  return (n) => {
3663
3778
  let a = n.nextTransform.x, h = n.nextTransform.y;
@@ -3667,7 +3782,7 @@ const b = Object.freeze({
3667
3782
  const u = n.canvasHeight * n.prevTransform.scale, g = s - u;
3668
3783
  return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
3669
3784
  };
3670
- }, qt = (r) => {
3785
+ }, or = (r) => {
3671
3786
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3672
3787
  return (n) => {
3673
3788
  const a = n.prevTransform, h = n.nextTransform;
@@ -3688,7 +3803,7 @@ const b = Object.freeze({
3688
3803
  y: u
3689
3804
  };
3690
3805
  };
3691
- }, er = (r) => (e) => r.reduce(
3806
+ }, sr = (r) => (e) => r.reduce(
3692
3807
  (t, o) => o({
3693
3808
  prevTransform: e.prevTransform,
3694
3809
  nextTransform: t,
@@ -3696,193 +3811,134 @@ const b = Object.freeze({
3696
3811
  canvasHeight: e.canvasHeight
3697
3812
  }),
3698
3813
  e.nextTransform
3699
- ), be = (r) => {
3814
+ ), Ne = (r) => {
3700
3815
  if (typeof r == "function")
3701
3816
  return r;
3702
3817
  switch (r.type) {
3703
3818
  case "scale-limit":
3704
- return qt({
3819
+ return or({
3705
3820
  minContentScale: r.minContentScale ?? 0,
3706
3821
  maxContentScale: r.maxContentScale ?? 1 / 0
3707
3822
  });
3708
3823
  case "shift-limit":
3709
- return _t({
3824
+ return rr({
3710
3825
  minX: r.minX ?? -1 / 0,
3711
3826
  maxX: r.maxX ?? 1 / 0,
3712
3827
  minY: r.minY ?? -1 / 0,
3713
3828
  maxY: r.maxY ?? 1 / 0
3714
3829
  });
3715
3830
  }
3716
- }, Ne = (r) => {
3717
- var l, p, w, y, f, x, E, T, C, M, F, U;
3831
+ }, Pe = (r) => {
3832
+ var l, p, w, y, f, x, E, P, T, D, F, U;
3718
3833
  const e = (l = r == null ? void 0 : r.scale) == null ? void 0 : l.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3719
3834
  let s;
3720
- o !== void 0 ? Array.isArray(o) ? s = er(
3835
+ o !== void 0 ? Array.isArray(o) ? s = sr(
3721
3836
  o.map(
3722
- (R) => be(R)
3837
+ (R) => Ne(R)
3723
3838
  )
3724
- ) : s = be(o) : s = (R) => R.nextTransform;
3839
+ ) : s = Ne(o) : s = (R) => R.nextTransform;
3725
3840
  const n = ((p = r == null ? void 0 : r.shift) == null ? void 0 : p.cursor) !== void 0 ? r.shift.cursor : "grab", a = (w = r == null ? void 0 : r.shift) == null ? void 0 : w.mouseDownEventVerifier, h = a !== void 0 ? a : (R) => R.button === 0, d = (y = r == null ? void 0 : r.shift) == null ? void 0 : y.mouseUpEventVerifier, c = d !== void 0 ? d : (R) => R.button === 0, u = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelEventVerifier, g = u !== void 0 ? u : () => !0;
3726
3841
  return {
3727
3842
  wheelSensitivity: t,
3728
3843
  onTransformStarted: ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformStarted) ?? N,
3729
3844
  onTransformFinished: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformFinished) ?? N,
3730
- onBeforeTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onBeforeTransformChange) ?? N,
3731
- onTransformChange: ((C = r == null ? void 0 : r.events) == null ? void 0 : C.onTransformChange) ?? N,
3845
+ onBeforeTransformChange: ((P = r == null ? void 0 : r.events) == null ? void 0 : P.onBeforeTransformChange) ?? N,
3846
+ onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ?? N,
3732
3847
  transformPreprocessor: s,
3733
3848
  shiftCursor: n,
3734
3849
  mouseDownEventVerifier: h,
3735
3850
  mouseUpEventVerifier: c,
3736
3851
  mouseWheelEventVerifier: g,
3737
- scaleWheelFinishTimeout: ((M = r == null ? void 0 : r.scale) == null ? void 0 : M.wheelFinishTimeout) ?? 500,
3852
+ scaleWheelFinishTimeout: ((D = r == null ? void 0 : r.scale) == null ? void 0 : D.wheelFinishTimeout) ?? 500,
3738
3853
  onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ?? N,
3739
3854
  onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ?? N
3740
3855
  };
3741
- }, tr = (r, e) => {
3856
+ }, ir = (r, e) => {
3742
3857
  const t = document.createElementNS(
3743
3858
  "http://www.w3.org/2000/svg",
3744
3859
  "circle"
3745
3860
  );
3746
3861
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3747
- }, rr = (r) => r instanceof SVGElement ? r : tr(
3862
+ }, nr = (r) => r instanceof SVGElement ? r : ir(
3748
3863
  (r == null ? void 0 : r.radius) ?? 1.5,
3749
3864
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3750
- ), or = (r) => {
3751
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = rr(r.renderer ?? {});
3865
+ ), ar = (r) => {
3866
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = nr(r.renderer ?? {});
3752
3867
  return {
3753
3868
  tileWidth: t,
3754
3869
  tileHeight: o,
3755
3870
  renderer: s,
3756
3871
  maxViewportScale: r.maxViewportScale ?? 10
3757
3872
  };
3758
- }, fe = (r) => {
3759
- if (typeof r == "function")
3760
- return r;
3761
- switch (r.type) {
3762
- case "straight":
3763
- return () => new Vt({
3764
- color: r.color,
3765
- width: r.width,
3766
- arrowLength: r.arrowLength,
3767
- arrowOffset: r.arrowOffset,
3768
- arrowRenderer: r.arrowRenderer,
3769
- hasSourceArrow: r.hasSourceArrow,
3770
- hasTargetArrow: r.hasTargetArrow,
3771
- cycleSquareSide: r.cycleSquareSide,
3772
- roundness: r.roundness,
3773
- detourDistance: r.detourDistance,
3774
- detourDirection: r.detourDirection
3775
- });
3776
- case "horizontal":
3777
- return () => new Lt({
3778
- color: r.color,
3779
- width: r.width,
3780
- arrowLength: r.arrowLength,
3781
- arrowOffset: r.arrowOffset,
3782
- arrowRenderer: r.arrowRenderer,
3783
- hasSourceArrow: r.hasSourceArrow,
3784
- hasTargetArrow: r.hasTargetArrow,
3785
- cycleSquareSide: r.cycleSquareSide,
3786
- roundness: r.roundness,
3787
- detourDistance: r.detourDistance
3788
- });
3789
- case "vertical":
3790
- return () => new It({
3791
- color: r.color,
3792
- width: r.width,
3793
- arrowLength: r.arrowLength,
3794
- arrowOffset: r.arrowOffset,
3795
- arrowRenderer: r.arrowRenderer,
3796
- hasSourceArrow: r.hasSourceArrow,
3797
- hasTargetArrow: r.hasTargetArrow,
3798
- cycleSquareSide: r.cycleSquareSide,
3799
- roundness: r.roundness,
3800
- detourDistance: r.detourDistance
3801
- });
3802
- case "direct":
3803
- return () => new $e({
3804
- color: r.color,
3805
- width: r.width,
3806
- arrowLength: r.arrowLength,
3807
- arrowRenderer: r.arrowRenderer,
3808
- hasSourceArrow: r.hasSourceArrow,
3809
- hasTargetArrow: r.hasTargetArrow,
3810
- sourceOffset: r.sourceOffset,
3811
- targetOffset: r.targetOffset
3812
- });
3813
- default:
3814
- return () => new Rt({
3815
- color: r.color,
3816
- width: r.width,
3817
- arrowLength: r.arrowLength,
3818
- arrowRenderer: r.arrowRenderer,
3819
- hasSourceArrow: r.hasSourceArrow,
3820
- hasTargetArrow: r.hasTargetArrow,
3821
- cycleRadius: r.cycleRadius,
3822
- smallCycleRadius: r.smallCycleRadius,
3823
- curvature: r.curvature,
3824
- detourDistance: r.detourDistance,
3825
- detourDirection: r.detourDirection
3826
- });
3827
- }
3828
3873
  }, $ = Object.freeze({
3829
3874
  connectionTypeResolver: () => "direct",
3830
3875
  connectionPreprocessor: (r) => r,
3831
3876
  connectionAllowedVerifier: () => !0,
3832
3877
  mouseEventVerifier: (r) => r.button === 0
3833
- }), sr = (r, e, t) => {
3834
- var o, s, n;
3878
+ }), hr = (r, e, t) => {
3879
+ var s, n, a;
3880
+ const o = r.connectionAllowedVerifier ?? $.connectionAllowedVerifier;
3835
3881
  return {
3836
3882
  connectionTypeResolver: r.connectionTypeResolver ?? $.connectionTypeResolver,
3883
+ connectionAllowedVerifier: o,
3884
+ draggingPortDirectionResolver: je(
3885
+ r.dragPortDirection,
3886
+ t,
3887
+ o
3888
+ ),
3889
+ edgeShapeFactory: r.edgeShape !== void 0 ? ve(r.edgeShape) : e,
3837
3890
  connectionPreprocessor: r.connectionPreprocessor ?? $.connectionPreprocessor,
3838
- connectionAllowedVerifier: r.connectionAllowedVerifier ?? $.connectionAllowedVerifier,
3839
3891
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? $.mouseEventVerifier,
3840
3892
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? $.mouseEventVerifier,
3841
- onAfterEdgeCreated: ((o = r.events) == null ? void 0 : o.onAfterEdgeCreated) ?? N,
3842
- onEdgeCreationInterrupted: ((s = r.events) == null ? void 0 : s.onEdgeCreationInterrupted) ?? N,
3843
- onEdgeCreationPrevented: ((n = r.events) == null ? void 0 : n.onEdgeCreationPrevented) ?? N,
3844
- dragPortDirection: r.dragPortDirection ?? t,
3845
- edgeShapeFactory: r.edgeShape !== void 0 ? fe(r.edgeShape) : e
3893
+ onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ?? N,
3894
+ onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ?? N,
3895
+ onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? N
3846
3896
  };
3847
3897
  }, z = Object.freeze({
3848
3898
  connectionAllowedVerifier: () => !0,
3849
3899
  connectionPreprocessor: (r) => r,
3900
+ // TODO: remove ctrl key
3850
3901
  mouseDownEventVerifier: (r) => r.button === 0 && r.ctrlKey,
3851
3902
  mouseUpEventVerifier: (r) => r.button === 0
3852
- }), ir = (r, e) => {
3853
- var o, s, n;
3854
- const t = (a) => {
3855
- const h = e.getPortAdjacentEdgeIds(a);
3856
- return h.length > 0 ? h[h.length - 1] : null;
3857
- };
3903
+ }), dr = (r, e) => {
3904
+ var s, n, a;
3905
+ const t = (h) => {
3906
+ const d = e.getPortAdjacentEdgeIds(h);
3907
+ return d.length > 0 ? d[d.length - 1] : null;
3908
+ }, o = r.connectionAllowedVerifier ?? z.connectionAllowedVerifier;
3858
3909
  return {
3859
3910
  connectionPreprocessor: r.connectionPreprocessor ?? z.connectionPreprocessor,
3860
- connectionAllowedVerifier: r.connectionAllowedVerifier ?? z.connectionAllowedVerifier,
3911
+ connectionAllowedVerifier: o,
3861
3912
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? z.mouseDownEventVerifier,
3862
3913
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? z.mouseUpEventVerifier,
3863
3914
  draggingEdgeResolver: r.draggingEdgeResolver ?? t,
3864
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? fe(r.draggingEdgeShape) : null,
3865
- onAfterEdgeReattached: ((o = r.events) == null ? void 0 : o.onAfterEdgeReattached) ?? N,
3866
- onEdgeReattachInterrupted: ((s = r.events) == null ? void 0 : s.onEdgeReattachInterrupted) ?? N,
3867
- onEdgeReattachPrevented: ((n = r.events) == null ? void 0 : n.onEdgeReattachPrevented) ?? N
3915
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ve(r.draggingEdgeShape) : null,
3916
+ onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ?? N,
3917
+ onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ?? N,
3918
+ onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ?? N,
3919
+ draggingPortDirectionResolver: je(
3920
+ r.dragPortDirection,
3921
+ e,
3922
+ o
3923
+ )
3868
3924
  };
3869
- }, nr = (r) => ({
3925
+ }, cr = (r) => ({
3870
3926
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3871
3927
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3872
- }), ar = (r) => {
3928
+ }), lr = (r) => {
3873
3929
  var e, t;
3874
3930
  return {
3875
3931
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? N,
3876
3932
  onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? N
3877
3933
  };
3878
3934
  };
3879
- class hr extends Error {
3935
+ class ur extends Error {
3880
3936
  constructor() {
3881
3937
  super(...arguments);
3882
3938
  i(this, "name", "CanvasBuilderError");
3883
3939
  }
3884
3940
  }
3885
- class Ge {
3941
+ class Je {
3886
3942
  constructor(e, t, o) {
3887
3943
  i(this, "dt");
3888
3944
  i(this, "nodeMass");
@@ -3920,7 +3976,7 @@ class Ge {
3920
3976
  });
3921
3977
  }
3922
3978
  }
3923
- class je {
3979
+ class Ke {
3924
3980
  constructor(e) {
3925
3981
  i(this, "PI2", 2 * Math.PI);
3926
3982
  this.rand = e;
@@ -3939,13 +3995,13 @@ class je {
3939
3995
  return { ex: h, ey: d, d: a };
3940
3996
  }
3941
3997
  }
3942
- const Je = (r) => {
3998
+ const Qe = (r) => {
3943
3999
  if (r.distance === 0)
3944
4000
  return r.maxForce;
3945
4001
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
3946
4002
  return Math.min(e, r.maxForce);
3947
4003
  };
3948
- class dr {
4004
+ class gr {
3949
4005
  constructor(e) {
3950
4006
  i(this, "nodeCharge");
3951
4007
  i(this, "distanceVectorGenerator");
@@ -3960,7 +4016,7 @@ class dr {
3960
4016
  const d = o[h], c = e.get(a), u = e.get(d), g = this.distanceVectorGenerator.create(
3961
4017
  c,
3962
4018
  u
3963
- ), l = Je({
4019
+ ), l = Qe({
3964
4020
  coefficient: 1,
3965
4021
  sourceCharge: this.nodeCharge,
3966
4022
  targetCharge: this.nodeCharge,
@@ -3972,7 +4028,7 @@ class dr {
3972
4028
  }
3973
4029
  }
3974
4030
  }
3975
- const cr = (r) => {
4031
+ const pr = (r) => {
3976
4032
  if (r.size === 0)
3977
4033
  return {
3978
4034
  centerX: 0,
@@ -3990,7 +4046,7 @@ const cr = (r) => {
3990
4046
  radius: h / 2
3991
4047
  };
3992
4048
  };
3993
- class lr {
4049
+ class wr {
3994
4050
  constructor(e) {
3995
4051
  i(this, "root");
3996
4052
  i(this, "leaves", /* @__PURE__ */ new Map());
@@ -4147,7 +4203,7 @@ class lr {
4147
4203
  }), { x: t / e.size, y: o / e.size };
4148
4204
  }
4149
4205
  }
4150
- class ur {
4206
+ class yr {
4151
4207
  constructor(e) {
4152
4208
  i(this, "areaRadiusThreshold");
4153
4209
  i(this, "nodeMass");
@@ -4159,7 +4215,7 @@ class ur {
4159
4215
  this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
4160
4216
  }
4161
4217
  apply(e, t) {
4162
- const o = cr(e), s = new lr({
4218
+ const o = pr(e), s = new wr({
4163
4219
  box: o,
4164
4220
  coords: e,
4165
4221
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -4274,7 +4330,7 @@ class ur {
4274
4330
  const t = this.distanceVectorGenerator.create(
4275
4331
  e.sourceCoords,
4276
4332
  e.targetCoords
4277
- ), o = Je({
4333
+ ), o = Qe({
4278
4334
  coefficient: this.nodeForceCoefficient,
4279
4335
  sourceCharge: e.sourceCharge,
4280
4336
  targetCharge: e.targetCharge,
@@ -4309,7 +4365,7 @@ class ur {
4309
4365
  }
4310
4366
  }
4311
4367
  }
4312
- const Ke = (r) => r.theta !== 0 ? new ur({
4368
+ const Ze = (r) => r.theta !== 0 ? new yr({
4313
4369
  nodeCharge: r.nodeCharge,
4314
4370
  nodeForceCoefficient: r.nodeForceCoefficient,
4315
4371
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -4317,13 +4373,13 @@ const Ke = (r) => r.theta !== 0 ? new ur({
4317
4373
  theta: r.theta,
4318
4374
  nodeMass: r.nodeMass,
4319
4375
  areaRadiusThreshold: r.areaRadiusThreshold
4320
- }) : new dr({
4376
+ }) : new gr({
4321
4377
  nodeCharge: r.nodeCharge,
4322
4378
  nodeForceCoefficient: r.nodeForceCoefficient,
4323
4379
  distanceVectorGenerator: r.distanceVectorGenerator,
4324
4380
  maxForce: r.maxForce
4325
4381
  });
4326
- class Qe {
4382
+ class _e {
4327
4383
  constructor(e) {
4328
4384
  i(this, "rand");
4329
4385
  i(this, "sparsity");
@@ -4346,7 +4402,7 @@ class Qe {
4346
4402
  }), s;
4347
4403
  }
4348
4404
  }
4349
- class gr {
4405
+ class fr {
4350
4406
  constructor(e) {
4351
4407
  i(this, "distanceVectorGenerator");
4352
4408
  i(this, "nodeForcesApplicationStrategy");
@@ -4357,7 +4413,7 @@ class gr {
4357
4413
  i(this, "edgeEquilibriumLength");
4358
4414
  i(this, "edgeStiffness");
4359
4415
  i(this, "convergenceVelocity");
4360
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new je(e.rand), this.nodeForcesApplicationStrategy = Ke({
4416
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Ke(e.rand), this.nodeForcesApplicationStrategy = Ze({
4361
4417
  distanceVectorGenerator: this.distanceVectorGenerator,
4362
4418
  nodeCharge: e.nodeCharge,
4363
4419
  maxForce: e.maxForce,
@@ -4365,7 +4421,7 @@ class gr {
4365
4421
  theta: e.barnesHutTheta,
4366
4422
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4367
4423
  nodeMass: e.nodeMass
4368
- }), this.fillerLayoutAlgorithm = new Qe({
4424
+ }), this.fillerLayoutAlgorithm = new _e({
4369
4425
  rand: e.rand,
4370
4426
  sparsity: e.edgeEquilibriumLength
4371
4427
  });
@@ -4375,7 +4431,7 @@ class gr {
4375
4431
  graph: t,
4376
4432
  viewport: o
4377
4433
  });
4378
- for (let n = 0; n < this.maxIterations && !(new Ge(
4434
+ for (let n = 0; n < this.maxIterations && !(new Je(
4379
4435
  t,
4380
4436
  s,
4381
4437
  {
@@ -4391,7 +4447,7 @@ class gr {
4391
4447
  return s;
4392
4448
  }
4393
4449
  }
4394
- class pr {
4450
+ class vr {
4395
4451
  constructor(e, t) {
4396
4452
  i(this, "forest", /* @__PURE__ */ new Set());
4397
4453
  i(this, "remainingNodeIds");
@@ -4432,7 +4488,7 @@ class pr {
4432
4488
  }
4433
4489
  }
4434
4490
  }
4435
- class wr {
4491
+ class mr {
4436
4492
  constructor(e) {
4437
4493
  this.params = e;
4438
4494
  }
@@ -4473,12 +4529,12 @@ class wr {
4473
4529
  return o - 2 * this.params.spaceAroundRadius;
4474
4530
  }
4475
4531
  }
4476
- class yr {
4532
+ class xr {
4477
4533
  constructor(e, t) {
4478
4534
  i(this, "offsets", /* @__PURE__ */ new Map());
4479
4535
  i(this, "treeSpans", /* @__PURE__ */ new Map());
4480
4536
  this.tree = e;
4481
- const o = t.spaceAroundRadius, s = new wr({
4537
+ const o = t.spaceAroundRadius, s = new mr({
4482
4538
  spaceAroundRadius: o
4483
4539
  });
4484
4540
  [...this.tree.sequence].reverse().forEach((n) => {
@@ -4500,19 +4556,19 @@ class yr {
4500
4556
  return this.offsets;
4501
4557
  }
4502
4558
  }
4503
- class fr {
4559
+ class Er {
4504
4560
  constructor(e) {
4505
4561
  this.params = e;
4506
4562
  }
4507
4563
  calculateCoordinates(e) {
4508
- const t = /* @__PURE__ */ new Map(), s = new pr(
4564
+ const t = /* @__PURE__ */ new Map(), s = new vr(
4509
4565
  e.graph,
4510
4566
  this.params.nextLayerNodesResolver
4511
4567
  ).generate();
4512
4568
  let n = 0;
4513
4569
  return s.forEach((a) => {
4514
4570
  t.set(a.root.nodeId, { x: n, y: 0 });
4515
- const d = new yr(a, {
4571
+ const d = new xr(a, {
4516
4572
  spaceAroundRadius: this.params.layerSpace / 2
4517
4573
  }).generate();
4518
4574
  let c = [a.root];
@@ -4533,7 +4589,7 @@ class fr {
4533
4589
  }), t;
4534
4590
  }
4535
4591
  }
4536
- const vr = (r) => {
4592
+ const Ar = (r) => {
4537
4593
  const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
4538
4594
  const a = e.getEdge(n);
4539
4595
  return e.getPort(a.to).nodeId;
@@ -4542,20 +4598,20 @@ const vr = (r) => {
4542
4598
  return e.getPort(a.from).nodeId;
4543
4599
  });
4544
4600
  return /* @__PURE__ */ new Set([...o, ...s]);
4545
- }, mr = (r) => {
4601
+ }, Sr = (r) => {
4546
4602
  const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
4547
4603
  const n = e.getEdge(s);
4548
4604
  return e.getPort(n.to).nodeId;
4549
4605
  });
4550
4606
  return new Set(o);
4551
- }, xr = (r) => {
4607
+ }, br = (r) => {
4552
4608
  const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
4553
4609
  const n = e.getEdge(s);
4554
4610
  return e.getPort(n.from).nodeId;
4555
4611
  });
4556
4612
  return new Set(o);
4557
4613
  };
4558
- class Er {
4614
+ class Nr {
4559
4615
  constructor(e) {
4560
4616
  i(this, "distanceVectorGenerator");
4561
4617
  i(this, "nodeForcesApplicationStrategy");
@@ -4565,7 +4621,7 @@ class Er {
4565
4621
  i(this, "edgeEquilibriumLength");
4566
4622
  i(this, "edgeStiffness");
4567
4623
  i(this, "fillerLayoutAlgorithm");
4568
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new je(e.rand), this.nodeForcesApplicationStrategy = Ke({
4624
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ke(e.rand), this.nodeForcesApplicationStrategy = Ze({
4569
4625
  distanceVectorGenerator: this.distanceVectorGenerator,
4570
4626
  nodeCharge: e.nodeCharge,
4571
4627
  maxForce: e.maxForce,
@@ -4573,7 +4629,7 @@ class Er {
4573
4629
  theta: e.barnesHutTheta,
4574
4630
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4575
4631
  nodeMass: e.nodeMass
4576
- }), this.fillerLayoutAlgorithm = new Qe({
4632
+ }), this.fillerLayoutAlgorithm = new _e({
4577
4633
  rand: e.rand,
4578
4634
  sparsity: e.edgeEquilibriumLength
4579
4635
  });
@@ -4583,7 +4639,7 @@ class Er {
4583
4639
  graph: t,
4584
4640
  viewport: o
4585
4641
  });
4586
- return new Ge(
4642
+ return new Je(
4587
4643
  t,
4588
4644
  n,
4589
4645
  {
@@ -4600,23 +4656,23 @@ class Er {
4600
4656
  }) ? /* @__PURE__ */ new Map() : n;
4601
4657
  }
4602
4658
  }
4603
- const Ze = (r) => {
4659
+ const qe = (r) => {
4604
4660
  let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
4605
4661
  for (let n = 0, a; n < r.length; n++)
4606
4662
  a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = o ^ Math.imul(t ^ a, 2869860233), o = s ^ Math.imul(o ^ a, 951274213), s = e ^ Math.imul(s ^ a, 2716044179);
4607
4663
  return e = Math.imul(o ^ e >>> 18, 597399067), t = Math.imul(s ^ t >>> 22, 2869860233), o = Math.imul(e ^ o >>> 17, 951274213), s = Math.imul(t ^ s >>> 19, 2716044179), e ^= t ^ o ^ s, t ^= e, o ^= e, s ^= e, [e >>> 0, t >>> 0, o >>> 0, s >>> 0];
4608
- }, _e = (r, e, t, o) => function() {
4664
+ }, et = (r, e, t, o) => function() {
4609
4665
  r |= 0, e |= 0, t |= 0, o |= 0;
4610
4666
  const s = (r + e | 0) + o | 0;
4611
4667
  return o = o + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + s | 0, (s >>> 0) / 4294967296;
4612
- }, Ar = (r) => {
4668
+ }, Pr = (r) => {
4613
4669
  var e, t;
4614
4670
  switch (r == null ? void 0 : r.type) {
4615
4671
  case "custom":
4616
4672
  return r.instance;
4617
4673
  default: {
4618
- const o = Ze((r == null ? void 0 : r.seed) ?? b.seed), s = _e(o[0], o[1], o[2], o[3]);
4619
- return new Er({
4674
+ const o = qe((r == null ? void 0 : r.seed) ?? b.seed), s = et(o[0], o[1], o[2], o[3]);
4675
+ return new Nr({
4620
4676
  rand: s,
4621
4677
  maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? b.maxTimeDeltaSec,
4622
4678
  nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
@@ -4631,25 +4687,25 @@ const Ze = (r) => {
4631
4687
  });
4632
4688
  }
4633
4689
  }
4634
- }, Sr = {
4690
+ }, Cr = {
4635
4691
  staticNodeResolver: () => !1
4636
- }, br = (r) => {
4692
+ }, Tr = (r) => {
4637
4693
  var t, o;
4638
4694
  return {
4639
- algorithm: Ar((r == null ? void 0 : r.algorithm) ?? {}),
4640
- staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Sr.staticNodeResolver,
4695
+ algorithm: Pr((r == null ? void 0 : r.algorithm) ?? {}),
4696
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Cr.staticNodeResolver,
4641
4697
  onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? N,
4642
4698
  onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? N
4643
4699
  };
4644
- }, Nr = (r) => r instanceof q ? {
4700
+ }, Mr = (r) => r instanceof q ? {
4645
4701
  type: "trigger",
4646
4702
  trigger: r
4647
4703
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
4648
4704
  type: "topologyChangeSchedule",
4649
- schedule: Bt
4705
+ schedule: Wt
4650
4706
  } : {
4651
4707
  type: "topologyChangeSchedule",
4652
- schedule: Ot
4708
+ schedule: zt
4653
4709
  }, Z = Object.freeze({
4654
4710
  staticNodeResolver: () => !1,
4655
4711
  hierarchicalLayout: {
@@ -4663,7 +4719,7 @@ const Ze = (r) => {
4663
4719
  d: r.d * e.a + r.e * e.d,
4664
4720
  e: r.d * e.b + r.e * e.e,
4665
4721
  f: r.d * e.c + r.e * e.f + r.f
4666
- }), Pr = (r) => {
4722
+ }), Dr = (r) => {
4667
4723
  const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
4668
4724
  return {
4669
4725
  a: n / h,
@@ -4674,7 +4730,7 @@ const Ze = (r) => {
4674
4730
  f: (o * s - e * a) / h
4675
4731
  };
4676
4732
  };
4677
- class Tr {
4733
+ class Rr {
4678
4734
  resolve(e) {
4679
4735
  if ("shift" in e)
4680
4736
  return this.createShiftBaseMatrix(e.shift);
@@ -4718,7 +4774,7 @@ class Tr {
4718
4774
  const o = k(
4719
4775
  t,
4720
4776
  e
4721
- ), s = Pr(t);
4777
+ ), s = Dr(t);
4722
4778
  return k(o, s);
4723
4779
  }
4724
4780
  createShiftBaseMatrix(e) {
@@ -4763,7 +4819,7 @@ class Tr {
4763
4819
  };
4764
4820
  }
4765
4821
  }
4766
- const Cr = (r) => {
4822
+ const Lr = (r) => {
4767
4823
  if (r === void 0)
4768
4824
  return (s) => s;
4769
4825
  if (typeof r == "function")
@@ -4777,7 +4833,7 @@ const Cr = (r) => {
4777
4833
  e: 1,
4778
4834
  f: 0
4779
4835
  };
4780
- const o = new Tr();
4836
+ const o = new Rr();
4781
4837
  return e.forEach((s) => {
4782
4838
  const n = o.resolve(s);
4783
4839
  t = k(t, n);
@@ -4788,34 +4844,34 @@ const Cr = (r) => {
4788
4844
  y: t.d * n + t.e * a + t.f
4789
4845
  };
4790
4846
  };
4791
- }, Mr = (r) => {
4847
+ }, Vr = (r) => {
4792
4848
  if (typeof r == "function")
4793
4849
  return r;
4794
4850
  switch (r) {
4795
4851
  case "outgoing":
4796
- return mr;
4852
+ return Sr;
4797
4853
  case "incoming":
4798
- return xr;
4854
+ return br;
4799
4855
  default:
4800
- return vr;
4856
+ return Ar;
4801
4857
  }
4802
- }, Dr = (r) => {
4858
+ }, Ir = (r) => {
4803
4859
  var e, t;
4804
4860
  switch (r == null ? void 0 : r.type) {
4805
4861
  case "custom":
4806
4862
  return r.instance;
4807
4863
  case "hierarchical":
4808
- return new fr({
4864
+ return new Er({
4809
4865
  layerWidth: r.layerWidth ?? Z.hierarchicalLayout.layerWidth,
4810
4866
  layerSpace: r.layerSpace ?? Z.hierarchicalLayout.layerSpace,
4811
- transform: Cr(r.transform),
4812
- nextLayerNodesResolver: Mr(
4867
+ transform: Lr(r.transform),
4868
+ nextLayerNodesResolver: Vr(
4813
4869
  r.nextLayerNodesResolver
4814
4870
  )
4815
4871
  });
4816
4872
  default: {
4817
- const o = Ze((r == null ? void 0 : r.seed) ?? b.seed), s = _e(o[0], o[1], o[2], o[3]);
4818
- return new gr({
4873
+ const o = qe((r == null ? void 0 : r.seed) ?? b.seed), s = et(o[0], o[1], o[2], o[3]);
4874
+ return new fr({
4819
4875
  dtSec: (r == null ? void 0 : r.dtSec) ?? b.dtSec,
4820
4876
  maxIterations: (r == null ? void 0 : r.maxIterations) ?? b.maxIterations,
4821
4877
  rand: s,
@@ -4831,16 +4887,16 @@ const Cr = (r) => {
4831
4887
  });
4832
4888
  }
4833
4889
  }
4834
- }, Rr = (r) => {
4890
+ }, Fr = (r) => {
4835
4891
  var e, t;
4836
4892
  return {
4837
- algorithm: Dr(r.algorithm),
4838
- applyOn: Nr(r.applyOn),
4893
+ algorithm: Ir(r.algorithm),
4894
+ applyOn: Mr(r.applyOn),
4839
4895
  staticNodeResolver: r.staticNodeResolver ?? Z.staticNodeResolver,
4840
4896
  onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? N,
4841
4897
  onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? N
4842
4898
  };
4843
- }, Lr = (r, e) => ({
4899
+ }, Ur = (r, e) => ({
4844
4900
  ...r,
4845
4901
  onNodeDragStarted: (t) => {
4846
4902
  e.add(t), r.onNodeDragStarted(t);
@@ -4848,7 +4904,7 @@ const Cr = (r) => {
4848
4904
  onNodeDragFinished: (t) => {
4849
4905
  e.delete(t), r.onNodeDragFinished(t);
4850
4906
  }
4851
- }), Vr = (r, e) => {
4907
+ }), $r = (r, e) => {
4852
4908
  r.graph.onBeforeNodeRemoved.subscribe((t) => {
4853
4909
  e.delete(t);
4854
4910
  }), r.graph.onBeforeClear.subscribe(() => {
@@ -4856,41 +4912,41 @@ const Cr = (r) => {
4856
4912
  }), r.onBeforeDestroy.subscribe(() => {
4857
4913
  e.clear();
4858
4914
  });
4859
- }, Ir = (r, e) => ({
4915
+ }, Br = (r, e) => ({
4860
4916
  ...r,
4861
4917
  staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
4862
- }), _ = (r) => () => r, Pe = _(0), Fr = () => {
4918
+ }), _ = (r) => () => r, Ce = _(0), Or = () => {
4863
4919
  let r = 0;
4864
4920
  return () => r++;
4865
- }, Ur = (r, e) => {
4866
- let t = Pe, o = Pe;
4867
- const s = Fr();
4921
+ }, Wr = (r, e) => {
4922
+ let t = Ce, o = Ce;
4923
+ const s = Or();
4868
4924
  return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = _(r)), typeof e == "number" && (o = _(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
4869
4925
  nodesPriorityFn: t,
4870
4926
  edgesPriorityFn: o
4871
4927
  };
4872
- }, $r = (r) => {
4928
+ }, zr = (r) => {
4873
4929
  var t, o, s, n, a;
4874
- const e = Ur(
4930
+ const e = Wr(
4875
4931
  (t = r.nodes) == null ? void 0 : t.priority,
4876
4932
  (o = r.edges) == null ? void 0 : o.priority
4877
4933
  );
4878
4934
  return {
4879
4935
  nodes: {
4880
- centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Le,
4936
+ centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Ve,
4881
4937
  priorityFn: e.nodesPriorityFn
4882
4938
  },
4883
4939
  ports: {
4884
4940
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
4885
4941
  },
4886
4942
  edges: {
4887
- shapeFactory: fe(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
4943
+ shapeFactory: ve(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
4888
4944
  priorityFn: e.edgesPriorityFn
4889
4945
  }
4890
4946
  };
4891
- }, Br = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Or = (r) => {
4947
+ }, kr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Hr = (r) => {
4892
4948
  var o, s, n, a;
4893
- const { canvasDefaults: e } = r, t = r.hasLayout ? Br(r.layoutParams) : oe;
4949
+ const { canvasDefaults: e } = r, t = r.hasLayout ? kr(r.layoutParams) : oe;
4894
4950
  return {
4895
4951
  focus: {
4896
4952
  contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
@@ -4899,23 +4955,23 @@ const Cr = (r) => {
4899
4955
  animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
4900
4956
  }
4901
4957
  };
4902
- }, Wr = (r) => ({
4958
+ }, Yr = (r) => ({
4903
4959
  onNodeSelected: r.onNodeSelected,
4904
4960
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4905
4961
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4906
4962
  movementThreshold: r.movementThreshold ?? L.movementThreshold
4907
- }), zr = (r) => ({
4963
+ }), Xr = (r) => ({
4908
4964
  onCanvasSelected: r.onCanvasSelected,
4909
4965
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4910
4966
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4911
4967
  movementThreshold: r.movementThreshold ?? L.movementThreshold
4912
- }), kr = (r) => ({
4968
+ }), Gr = (r) => ({
4913
4969
  onEdgeSelected: r.onEdgeSelected,
4914
4970
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4915
4971
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4916
4972
  movementThreshold: r.movementThreshold ?? L.movementThreshold
4917
4973
  });
4918
- class Xr {
4974
+ class Kr {
4919
4975
  constructor(e) {
4920
4976
  i(this, "used", !1);
4921
4977
  i(this, "canvasDefaults", {});
@@ -4942,8 +4998,8 @@ class Xr {
4942
4998
  i(this, "window", window);
4943
4999
  i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
4944
5000
  i(this, "pointInsideVerifier");
4945
- i(this, "eventTagger", new zt());
4946
- this.element = e, this.pointInsideVerifier = new ut(e, this.window);
5001
+ i(this, "eventTagger", new Ht());
5002
+ this.element = e, this.pointInsideVerifier = new pt(e, this.window);
4947
5003
  }
4948
5004
  setDefaults(e) {
4949
5005
  return this.canvasDefaults = e, this;
@@ -4986,44 +5042,44 @@ class Xr {
4986
5042
  }
4987
5043
  build() {
4988
5044
  if (this.used)
4989
- throw new hr(
5045
+ throw new ur(
4990
5046
  "Failed to build Canvas because CanvasBuilder is a single-use object"
4991
5047
  );
4992
5048
  this.used = !0;
4993
- const e = new dt(this.element), t = new Me(), o = new Qt(this.element), s = this.createHtmlView(
5049
+ const e = new lt(this.element), t = new De(), o = new er(this.element), s = this.createHtmlView(
4994
5050
  o.main,
4995
5051
  t,
4996
5052
  e
4997
- ), n = $r(
5053
+ ), n = zr(
4998
5054
  this.canvasDefaults
4999
- ), a = new We(
5055
+ ), a = new ze(
5000
5056
  t,
5001
5057
  s,
5002
5058
  n
5003
- ), h = Rr(this.layoutConfig), d = Or({
5059
+ ), h = Fr(this.layoutConfig), d = Hr({
5004
5060
  canvasDefaults: this.canvasDefaults,
5005
5061
  hasLayout: this.hasLayout,
5006
5062
  layoutParams: h
5007
- }), c = new Ye(
5063
+ }), c = new Xe(
5008
5064
  t,
5009
5065
  e,
5010
5066
  d,
5011
5067
  this.window
5012
- ), u = new ze(e), g = new Oe(t), l = new Ce(
5068
+ ), u = new ke(e), g = new We(t), l = new Me(
5013
5069
  g,
5014
5070
  u,
5015
5071
  a,
5016
5072
  c
5017
5073
  );
5018
- if (this.hasBackground && he.configure(
5074
+ if (this.hasBackground && de.configure(
5019
5075
  l,
5020
- or(this.backgroundConfig),
5076
+ ar(this.backgroundConfig),
5021
5077
  o.background
5022
5078
  ), this.hasNodeResizeReactiveEdges && ee.configure(l), this.userSelectableEdgesConfig !== void 0) {
5023
- const p = kr(
5079
+ const p = Gr(
5024
5080
  this.userSelectableEdgesConfig
5025
5081
  );
5026
- we.configure(
5082
+ ye.configure(
5027
5083
  l,
5028
5084
  this.window,
5029
5085
  this.pointInsideVerifier,
@@ -5032,10 +5088,10 @@ class Xr {
5032
5088
  );
5033
5089
  }
5034
5090
  if (this.userSelectableNodesConfig !== void 0) {
5035
- const p = Wr(
5091
+ const p = Yr(
5036
5092
  this.userSelectableNodesConfig
5037
5093
  );
5038
- pe.configure(
5094
+ we.configure(
5039
5095
  l,
5040
5096
  this.window,
5041
5097
  this.pointInsideVerifier,
@@ -5044,10 +5100,10 @@ class Xr {
5044
5100
  );
5045
5101
  }
5046
5102
  if (this.userSelectableCanvasConfig !== void 0) {
5047
- const p = zr(
5103
+ const p = Xr(
5048
5104
  this.userSelectableCanvasConfig
5049
5105
  );
5050
- ye.configure(
5106
+ fe.configure(
5051
5107
  l,
5052
5108
  o.main,
5053
5109
  this.window,
@@ -5057,11 +5113,11 @@ class Xr {
5057
5113
  );
5058
5114
  }
5059
5115
  if (this.hasDraggableNodes) {
5060
- let p = Zt(this.dragConfig);
5061
- this.hasAnimatedLayout && (p = Lr(
5116
+ let p = tr(this.dragConfig);
5117
+ this.hasAnimatedLayout && (p = Ur(
5062
5118
  p,
5063
5119
  this.animationStaticNodes
5064
- )), ne.configure(
5120
+ )), ae.configure(
5065
5121
  l,
5066
5122
  o.main,
5067
5123
  this.window,
@@ -5070,12 +5126,12 @@ class Xr {
5070
5126
  );
5071
5127
  }
5072
5128
  if (this.hasUserConnectablePorts) {
5073
- const p = sr(
5129
+ const p = hr(
5074
5130
  this.connectablePortsConfig,
5075
5131
  n.edges.shapeFactory,
5076
- n.ports.direction
5132
+ l.graph
5077
5133
  );
5078
- de.configure(
5134
+ ce.configure(
5079
5135
  l,
5080
5136
  o.overlayConnectablePorts,
5081
5137
  e,
@@ -5085,11 +5141,11 @@ class Xr {
5085
5141
  );
5086
5142
  }
5087
5143
  if (this.hasUserDraggableEdges) {
5088
- const p = ir(
5144
+ const p = dr(
5089
5145
  this.draggableEdgesConfig,
5090
5146
  l.graph
5091
5147
  );
5092
- ce.configure(
5148
+ le.configure(
5093
5149
  l,
5094
5150
  o.overlayDraggableEdges,
5095
5151
  e,
@@ -5098,29 +5154,29 @@ class Xr {
5098
5154
  p
5099
5155
  );
5100
5156
  }
5101
- if (this.virtualScrollConfig !== void 0 ? ae.configure(
5157
+ if (this.virtualScrollConfig !== void 0 ? he.configure(
5102
5158
  l,
5103
5159
  o.main,
5104
5160
  this.window,
5105
- Ne(this.transformConfig),
5161
+ Pe(this.transformConfig),
5106
5162
  this.boxRenderingTrigger,
5107
5163
  this.pointInsideVerifier,
5108
- nr(this.virtualScrollConfig)
5164
+ cr(this.virtualScrollConfig)
5109
5165
  ) : this.hasTransformableViewport && J.configure(
5110
5166
  l,
5111
5167
  o.main,
5112
5168
  this.window,
5113
5169
  this.pointInsideVerifier,
5114
- Ne(this.transformConfig)
5115
- ), this.hasLayout && Gt.configure(l, h), this.hasAnimatedLayout) {
5116
- let p = br(this.animatedLayoutConfig);
5117
- this.hasDraggableNodes && (Vr(
5170
+ Pe(this.transformConfig)
5171
+ ), this.hasLayout && Qt.configure(l, h), this.hasAnimatedLayout) {
5172
+ let p = Tr(this.animatedLayoutConfig);
5173
+ this.hasDraggableNodes && ($r(
5118
5174
  l,
5119
5175
  this.animationStaticNodes
5120
- ), p = Ir(
5176
+ ), p = Br(
5121
5177
  p,
5122
5178
  this.animationStaticNodes
5123
- )), ge.configure(l, p, this.window);
5179
+ )), pe.configure(l, p, this.window);
5124
5180
  }
5125
5181
  return l.onBeforeDestroy.subscribe(() => {
5126
5182
  o.destroy();
@@ -5128,26 +5184,26 @@ class Xr {
5128
5184
  }
5129
5185
  createHtmlView(e, t, o) {
5130
5186
  let s = new Te(t, o, e);
5131
- return this.virtualScrollConfig !== void 0 && (s = new nt(
5187
+ return this.virtualScrollConfig !== void 0 && (s = new ht(
5132
5188
  s,
5133
5189
  t,
5134
5190
  this.boxRenderingTrigger,
5135
- ar(this.virtualScrollConfig)
5136
- )), s = new at(s, t), s;
5191
+ lr(this.virtualScrollConfig)
5192
+ )), s = new dt(s, t), s;
5137
5193
  }
5138
5194
  }
5139
5195
  export {
5140
- Rt as BezierEdgeShape,
5141
- Xr as CanvasBuilder,
5142
- hr as CanvasBuilderError,
5196
+ Vt as BezierEdgeShape,
5197
+ Kr as CanvasBuilder,
5198
+ ur as CanvasBuilderError,
5143
5199
  A as CanvasError,
5144
5200
  I as ConnectionCategory,
5145
- $e as DirectEdgeShape,
5201
+ Be as DirectEdgeShape,
5146
5202
  q as EventSubject,
5147
- Lt as HorizontalEdgeShape,
5148
- $t as InteractiveEdgeError,
5149
- Be as InteractiveEdgeShape,
5150
- Yr as MidpointEdgeShape,
5151
- Vt as StraightEdgeShape,
5152
- It as VerticalEdgeShape
5203
+ It as HorizontalEdgeShape,
5204
+ Ot as InteractiveEdgeError,
5205
+ Oe as InteractiveEdgeShape,
5206
+ Jr as MidpointEdgeShape,
5207
+ Ft as StraightEdgeShape,
5208
+ Ut as VerticalEdgeShape
5153
5209
  };