@html-graph/html-graph 8.18.0 → 8.18.1

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 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);
1
+ var st = Object.defineProperty;
2
+ var it = (r, e, t) => e in r ? st(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => it(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 ot = () => {
5
+ const nt = () => {
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
- }, st = () => {
8
+ }, at = () => {
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
- }, it = (r) => {
11
+ }, ht = (r) => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
- }, nt = (r) => {
13
+ }, dt = (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
- class Te {
16
+ class Re {
17
17
  constructor(e, t, o) {
18
- i(this, "host", ot());
19
- i(this, "container", st());
18
+ i(this, "host", nt());
19
+ i(this, "container", at());
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
- it(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
+ ht(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
- nt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
34
+ dt(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;
@@ -71,9 +71,9 @@ class Te {
71
71
  n,
72
72
  h,
73
73
  d
74
- ), u = this.createEdgeRenderPort(s, a, h, d);
75
- let g = I.Line;
76
- o.element === s.element ? g = I.PortCycle : o.nodeId === s.nodeId && (g = I.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
74
+ ), l = this.createEdgeRenderPort(s, a, h, d);
75
+ let u = I.Line;
76
+ o.element === s.element ? u = I.PortCycle : o.nodeId === s.nodeId && (u = I.NodeCycle), t.payload.shape.render({ from: c, to: l, category: u });
77
77
  }
78
78
  updateEdgePriority(e) {
79
79
  const t = this.graphStore.getEdge(e);
@@ -93,7 +93,7 @@ class Te {
93
93
  };
94
94
  }
95
95
  }
96
- class at {
96
+ class ct {
97
97
  constructor(e) {
98
98
  i(this, "xFrom", 1 / 0);
99
99
  i(this, "yFrom", 1 / 0);
@@ -109,11 +109,11 @@ class at {
109
109
  return o >= this.xFrom && o <= this.xTo && s >= this.yFrom && s <= this.yTo;
110
110
  }
111
111
  hasEdge(e) {
112
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), u = Math.max(n.y, a.y);
113
- return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
112
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
113
+ return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
114
114
  }
115
115
  }
116
- class ht {
116
+ class lt {
117
117
  constructor(e, t, o, s) {
118
118
  i(this, "attachedNodes", /* @__PURE__ */ new Set());
119
119
  i(this, "attachedEdges", /* @__PURE__ */ new Set());
@@ -125,8 +125,8 @@ class ht {
125
125
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
126
126
  h && !d ? t.add(a) : !h && d && o.add(a);
127
127
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
128
- const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), u = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
129
- h && (this.renderingBox.hasNode(u) || (t.add(u), o.delete(u)), this.renderingBox.hasNode(g) || (t.add(g), o.delete(g))), h && !d ? s.add(a) : !h && d && n.add(a);
128
+ const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), l = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
129
+ h && (this.renderingBox.hasNode(l) || (t.add(l), o.delete(l)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(a) : !h && d && n.add(a);
130
130
  }), n.forEach((a) => {
131
131
  this.handleDetachEdge(a);
132
132
  }), o.forEach((a) => {
@@ -137,7 +137,7 @@ class ht {
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 at(this.graphStore), this.trigger.subscribe(this.updateViewport);
140
+ this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new ct(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 ht {
191
191
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
192
192
  }
193
193
  }
194
- class dt {
194
+ class ut {
195
195
  constructor(e, t) {
196
196
  i(this, "deferredNodes", /* @__PURE__ */ new Set());
197
197
  i(this, "deferredEdges", /* @__PURE__ */ new Set());
@@ -265,7 +265,7 @@ const C = () => {
265
265
  const r = new q();
266
266
  return [r, r];
267
267
  };
268
- class Me {
268
+ class Le {
269
269
  constructor(e, t, o, s) {
270
270
  i(this, "beforeDestroyEmitter");
271
271
  i(this, "destroyed", !1);
@@ -318,7 +318,7 @@ class Me {
318
318
  this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
319
319
  }
320
320
  }
321
- class ct {
321
+ class gt {
322
322
  constructor() {
323
323
  i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
324
324
  i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
@@ -378,7 +378,7 @@ const S = Object.freeze({
378
378
  removeNonexistentPort: (r) => `Failed to remove port with ID ${JSON.stringify(r)} because it does not exist`,
379
379
  accessNonexistentEdge: (r) => `Failed to access edge with ID ${JSON.stringify(r)} because it does not exist`,
380
380
  addEdgeWithExistingId: (r) => `Failed to add edge with ID ${JSON.stringify(r)} because an edge with this ID already exists`,
381
- addEdgeWithElementInUse: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} because its SVG element is already attached to edge with ID ${JSON.stringify(e)}`,
381
+ addEdgeWithElementInUse: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} because its element is already attached to edge with ID ${JSON.stringify(e)}`,
382
382
  addEdgeFromNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} from port with ID ${JSON.stringify(e)} because the port does not exist`,
383
383
  addEdgeToNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} to port with ID ${JSON.stringify(e)} because the port does not exist`,
384
384
  updateNonexistentEdge: (r) => `Failed to update edge with ID ${JSON.stringify(r)} because it does not exist`,
@@ -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 De {
390
+ class Ve {
391
391
  constructor() {
392
392
  i(this, "nodes", /* @__PURE__ */ new Map());
393
393
  i(this, "ports", /* @__PURE__ */ new Map());
@@ -396,7 +396,7 @@ class De {
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 ct());
399
+ i(this, "elementPorts", new gt());
400
400
  i(this, "edgesElementsMap", /* @__PURE__ */ new Map());
401
401
  i(this, "afterNodeAddedEmitter");
402
402
  i(this, "onAfterNodeAdded");
@@ -686,18 +686,18 @@ const me = (r) => ({
686
686
  scale: 1 / r.scale,
687
687
  x: -r.x / r.scale,
688
688
  y: -r.y / r.scale
689
- }), xe = {
689
+ }), Ee = {
690
690
  scale: 1,
691
691
  x: 0,
692
692
  y: 0
693
- }, Ee = (r, e) => ({
693
+ }, xe = (r, e) => ({
694
694
  x: r.scale * e.x + r.x,
695
695
  y: r.scale * e.y + r.y
696
696
  });
697
- class lt {
697
+ class pt {
698
698
  constructor(e) {
699
- i(this, "viewportMatrix", xe);
700
- i(this, "contentMatrix", xe);
699
+ i(this, "viewportMatrix", Ee);
700
+ i(this, "contentMatrix", Ee);
701
701
  i(this, "beforeUpdateEmitter");
702
702
  i(this, "onBeforeUpdated");
703
703
  i(this, "afterUpdateEmitter");
@@ -734,10 +734,10 @@ class lt {
734
734
  return { width: e, height: t };
735
735
  }
736
736
  createContentCoords(e) {
737
- return Ee(this.viewportMatrix, e);
737
+ return xe(this.viewportMatrix, e);
738
738
  }
739
739
  createViewportCoords(e) {
740
- return Ee(this.contentMatrix, e);
740
+ return xe(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 ut = (r, e, t) => {
779
+ const wt = (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
- }, gt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
783
- class pt {
782
+ }, ft = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
783
+ class yt {
784
784
  constructor(e, t) {
785
785
  this.element = e, this.win = t;
786
786
  }
787
787
  verify(e, t) {
788
- return ut(this.element, e, t) && gt(this.win, e, t);
788
+ return wt(this.element, e, t) && ft(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
- }, wt = (r, e) => {
808
+ }, vt = (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* Re(r, e) {
827
+ function* Ie(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 = Re(o.shadowRoot, e);
831
+ const s = Ie(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 Le = (r, e) => {
839
- const t = Re(document, e);
838
+ const Fe = (r, e) => {
839
+ const t = Ie(document, e);
840
840
  for (const o of t) {
841
- const s = wt(r, o);
841
+ const s = vt(r, o);
842
842
  if (s.status === "portFound")
843
843
  return s.portId;
844
844
  if (s.status === "nodeEncountered")
@@ -847,13 +847,13 @@ const Le = (r, e) => {
847
847
  return null;
848
848
  };
849
849
  var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
850
- const Ve = (r, e) => ({
850
+ const Ue = (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
- }), Ie = (r, e, t) => {
856
+ }), $e = (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 Ve = (r, e) => ({
870
870
  to: { x: s.x - n, y: s.y - a }
871
871
  };
872
872
  };
873
- class yt {
873
+ class mt {
874
874
  constructor(e) {
875
875
  i(this, "path");
876
876
  i(this, "midpoint");
@@ -883,9 +883,9 @@ class yt {
883
883
  curvature: h,
884
884
  hasSourceArrow: d,
885
885
  hasTargetArrow: c
886
- } = e, u = (t.x + o.x) / 2, g = (t.y + o.y) / 2;
887
- this.midpoint = { x: u, y: g };
888
- const l = m(
886
+ } = e, l = (t.x + o.x) / 2, u = (t.y + o.y) / 2;
887
+ this.midpoint = { x: l, y: u };
888
+ const g = m(
889
889
  { x: t.x + s, y: t.y },
890
890
  n,
891
891
  t
@@ -894,16 +894,16 @@ class yt {
894
894
  a,
895
895
  o
896
896
  ), w = {
897
- x: l.x + n.x * h,
898
- y: l.y + n.y * h
899
- }, y = {
897
+ x: g.x + n.x * h,
898
+ y: g.y + n.y * h
899
+ }, f = {
900
900
  x: p.x - a.x * h,
901
901
  y: p.y - a.y * h
902
- }, f = `M ${l.x} ${l.y} C ${w.x} ${w.y}, ${y.x} ${y.y}, ${p.x} ${p.y}`, x = d ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, E = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
903
- this.path = `${x}${f}${E}`;
902
+ }, y = `M ${g.x} ${g.y} C ${w.x} ${w.y}, ${f.x} ${f.y}, ${p.x} ${p.y}`, E = d ? "" : `M ${t.x} ${t.y} L ${g.x} ${g.y} `, x = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
903
+ this.path = `${E}${y}${x}`;
904
904
  }
905
905
  }
906
- class ft {
906
+ class Et {
907
907
  constructor(e) {
908
908
  i(this, "path");
909
909
  i(this, "midpoint");
@@ -916,70 +916,70 @@ class ft {
916
916
  detourDir: h,
917
917
  from: d,
918
918
  to: c,
919
- arrowLength: u,
920
- detourDistance: g
921
- } = e, l = t ? m(
922
- { x: d.x + u, y: d.y },
919
+ arrowLength: l,
920
+ detourDistance: u
921
+ } = e, g = t ? m(
922
+ { x: d.x + l, y: d.y },
923
923
  n,
924
924
  d
925
925
  ) : d, p = o ? m(
926
926
  {
927
- x: c.x - u,
927
+ x: c.x - l,
928
928
  y: c.y
929
929
  },
930
930
  a,
931
931
  c
932
- ) : c, w = Math.cos(h) * g, y = Math.sin(h) * g, f = m(
933
- { x: d.x + u, y: d.y },
932
+ ) : c, w = Math.cos(h) * u, f = Math.sin(h) * u, y = m(
933
+ { x: d.x + l, y: d.y },
934
934
  n,
935
935
  d
936
- ), x = {
937
- x: f.x + w,
938
- y: f.y + y
939
- }, E = m(
940
- { x: c.x - u, y: c.y },
936
+ ), E = {
937
+ x: y.x + w,
938
+ y: y.y + f
939
+ }, x = m(
940
+ { x: c.x - l, y: c.y },
941
941
  a,
942
942
  c
943
- ), P = {
944
- x: E.x + w,
945
- y: E.y + y
943
+ ), N = {
944
+ x: x.x + w,
945
+ y: x.y + f
946
946
  }, T = {
947
- x: (x.x + P.x) / 2,
948
- y: (x.y + P.y) / 2
947
+ x: (E.x + N.x) / 2,
948
+ y: (E.y + N.y) / 2
949
949
  }, D = {
950
- x: f.x + s * n.x,
951
- y: f.y + s * n.y
950
+ x: y.x + s * n.x,
951
+ y: y.y + s * n.y
952
952
  }, F = {
953
- x: E.x - s * a.x,
954
- y: E.y - s * a.y
953
+ x: x.x - s * a.x,
954
+ y: x.y - s * a.y
955
955
  }, U = {
956
- x: f.x + w,
957
- y: f.y + y
956
+ x: y.x + w,
957
+ y: y.y + f
958
958
  }, R = {
959
- x: E.x + w,
960
- y: E.y + y
959
+ x: x.x + w,
960
+ y: x.y + f
961
961
  };
962
962
  this.path = [
963
- `M ${l.x} ${l.y}`,
964
- `L ${f.x} ${f.y}`,
963
+ `M ${g.x} ${g.y}`,
964
+ `L ${y.x} ${y.y}`,
965
965
  `C ${D.x} ${D.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
966
- `C ${R.x} ${R.y} ${F.x} ${F.y} ${E.x} ${E.y}`,
966
+ `C ${R.x} ${R.y} ${F.x} ${F.y} ${x.x} ${x.y}`,
967
967
  `L ${p.x} ${p.y}`
968
968
  ].join(" "), this.midpoint = T;
969
969
  }
970
970
  }
971
971
  const te = Object.freeze({
972
972
  edgeColor: "--edge-color"
973
- }), Fe = (r) => {
973
+ }), Be = (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
- }, Ue = (r) => {
976
+ }, Oe = (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
- }, $e = (r, e) => {
982
+ }, We = (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 = [];
@@ -987,56 +987,58 @@ const te = Object.freeze({
987
987
  const o = r.length - 1;
988
988
  let s = 0, n = 0, a = 0;
989
989
  r.forEach((h, d) => {
990
- let c = 0, u = 0, g = 0;
991
- const l = d > 0, p = d < o, w = l && p;
992
- if (l && (c = -s, u = -n, g = a), p) {
990
+ let c = 0, l = 0, u = 0;
991
+ const g = d > 0, p = d < o, w = g && p;
992
+ if (g && (c = -s, l = -n, u = a), p) {
993
993
  const D = r[d + 1];
994
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, 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;
996
+ const y = a !== 0 ? Math.min((w ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, E = w ? { x: h.x + s * y, y: h.y + n * y } : h, N = u !== 0 ? Math.min((w ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, T = w ? { x: h.x + c * N, y: h.y + l * N } : h;
997
997
  d > 0 && t.push(`L ${T.x} ${T.y}`), w && t.push(
998
- `C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
998
+ `C ${h.x} ${h.y} ${h.x} ${h.y} ${E.x} ${E.y}`
999
999
  );
1000
1000
  });
1001
1001
  }
1002
1002
  return t.join(" ");
1003
- }, vt = (r, e) => {
1004
- const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
1005
- if (o === s) {
1006
- const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
1007
- return c ? {
1003
+ }, xt = (r, e) => {
1004
+ const t = r.linePoint, o = e.linePoint, s = o.x - t.x >= 0, n = r.dirX >= 0, a = e.dirX >= 0;
1005
+ if (n === a) {
1006
+ const u = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
1007
+ return u ? {
1008
1008
  points: [
1009
- { x: r.x, y: r.y },
1010
- { x: l.x, y: r.y },
1011
- { x: l.x, y: e.y },
1012
- { x: e.x, y: e.y }
1009
+ r.arrowPoint,
1010
+ { x: w.x, y: t.y },
1011
+ { x: w.x, y: o.y },
1012
+ e.arrowPoint
1013
1013
  ],
1014
- midpoint: l
1014
+ midpoint: w
1015
1015
  } : {
1016
1016
  points: [
1017
- { x: r.x, y: r.y },
1018
- { x: r.x, y: l.y },
1019
- { x: e.x, y: l.y },
1020
- { x: e.x, y: e.y }
1017
+ r.arrowPoint,
1018
+ t,
1019
+ { x: t.x, y: w.y },
1020
+ { x: o.x, y: w.y },
1021
+ o,
1022
+ e.arrowPoint
1021
1023
  ],
1022
- midpoint: l
1024
+ midpoint: w
1023
1025
  };
1024
1026
  }
1025
- const a = o === t, h = (r.y + e.y) / 2;
1026
- if (a) {
1027
- const c = { x: e.x, y: r.y };
1027
+ const d = n === s, c = (t.y + o.y) / 2;
1028
+ if (d) {
1029
+ const u = { x: o.x, y: t.y };
1028
1030
  return {
1029
- points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
1030
- midpoint: { x: c.x, y: h }
1031
+ points: [r.arrowPoint, u, o, e.arrowPoint],
1032
+ midpoint: { x: u.x, y: c }
1031
1033
  };
1032
1034
  }
1033
- const d = { x: r.x, y: e.y };
1035
+ const l = { x: t.x, y: o.y };
1034
1036
  return {
1035
- points: [{ x: r.x, y: r.y }, d, { x: e.x, y: e.y }],
1036
- midpoint: { x: d.x, y: h }
1037
+ points: [r.arrowPoint, t, l, e.arrowPoint],
1038
+ midpoint: { x: l.x, y: c }
1037
1039
  };
1038
1040
  };
1039
- class mt {
1041
+ class At {
1040
1042
  constructor(e) {
1041
1043
  i(this, "path");
1042
1044
  i(this, "midpoint");
@@ -1049,41 +1051,23 @@ class mt {
1049
1051
  arrowOffset: h,
1050
1052
  roundness: d,
1051
1053
  hasSourceArrow: c,
1052
- hasTargetArrow: u
1053
- } = e, g = c ? m(
1054
+ hasTargetArrow: l
1055
+ } = e, u = c ? m(
1054
1056
  { x: t.x + a, y: t.y },
1055
1057
  s,
1056
1058
  t
1057
- ) : t, l = u ? m(
1058
- {
1059
- x: o.x - a,
1060
- y: o.y
1061
- },
1062
- n,
1063
- o
1064
- ) : o, p = a + h, w = m(
1059
+ ) : t, g = l ? m({ x: o.x - a, y: o.y }, n, o) : o, p = a + h, w = m(
1065
1060
  { x: t.x + p, y: t.y },
1066
1061
  s,
1067
1062
  t
1068
- ), y = m({ x: o.x - p, y: o.y }, n, o), f = vt(
1069
- {
1070
- x: w.x,
1071
- y: w.y,
1072
- dirX: s.x
1073
- },
1074
- {
1075
- x: y.x,
1076
- y: y.y,
1077
- dirX: n.x
1078
- }
1063
+ ), f = m({ x: o.x - p, y: o.y }, n, o), y = xt(
1064
+ { arrowPoint: u, linePoint: w, dirX: s.x },
1065
+ { arrowPoint: g, linePoint: f, dirX: n.x }
1079
1066
  );
1080
- this.path = V(
1081
- [g, ...f.points, l],
1082
- d
1083
- ), this.midpoint = f.midpoint;
1067
+ this.path = V(y.points, d), this.midpoint = y.midpoint;
1084
1068
  }
1085
1069
  }
1086
- class xt {
1070
+ class St {
1087
1071
  constructor(e) {
1088
1072
  i(this, "path");
1089
1073
  i(this, "midpoint");
@@ -1096,9 +1080,9 @@ class xt {
1096
1080
  fromDir: h,
1097
1081
  toDir: d,
1098
1082
  arrowOffset: c,
1099
- detourDir: u,
1100
- detourDistance: g,
1101
- roundness: l
1083
+ detourDir: l,
1084
+ detourDistance: u,
1085
+ roundness: g
1102
1086
  } = e, p = t ? m(
1103
1087
  { x: s.x + a, y: s.y },
1104
1088
  h,
@@ -1110,31 +1094,31 @@ class xt {
1110
1094
  },
1111
1095
  d,
1112
1096
  n
1113
- ) : n, y = a + c, f = Math.cos(u) * g, x = Math.sin(u) * g, E = m(
1114
- { x: s.x + y, y: s.y },
1097
+ ) : n, f = a + c, y = Math.cos(l) * u, E = Math.sin(l) * u, x = m(
1098
+ { x: s.x + f, y: s.y },
1115
1099
  h,
1116
1100
  s
1117
- ), P = {
1118
- x: E.x + f,
1119
- y: E.y + x
1101
+ ), N = {
1102
+ x: x.x + y,
1103
+ y: x.y + E
1120
1104
  }, T = m(
1121
- { x: n.x - y, y: n.y },
1105
+ { x: n.x - f, y: n.y },
1122
1106
  d,
1123
1107
  n
1124
1108
  ), D = {
1125
- x: T.x + f,
1126
- y: T.y + x
1109
+ x: T.x + y,
1110
+ y: T.y + E
1127
1111
  };
1128
1112
  this.midpoint = {
1129
- x: (P.x + D.x) / 2,
1130
- y: (P.y + D.y) / 2
1113
+ x: (N.x + D.x) / 2,
1114
+ y: (N.y + D.y) / 2
1131
1115
  }, this.path = V(
1132
- [p, E, P, D, T, w],
1133
- l
1116
+ [p, x, N, D, T, w],
1117
+ g
1134
1118
  );
1135
1119
  }
1136
1120
  }
1137
- class Et {
1121
+ class bt {
1138
1122
  constructor(e) {
1139
1123
  i(this, "path");
1140
1124
  i(this, "midpoint");
@@ -1147,24 +1131,24 @@ class Et {
1147
1131
  fromDir: h,
1148
1132
  toDir: d,
1149
1133
  arrowOffset: c,
1150
- roundness: u
1151
- } = e, g = this.createArrowPoint(
1134
+ roundness: l
1135
+ } = e, u = this.createArrowPoint(
1152
1136
  s,
1153
1137
  h,
1154
1138
  t,
1155
1139
  a
1156
- ), l = this.createArrowPoint(
1140
+ ), g = this.createArrowPoint(
1157
1141
  n,
1158
1142
  d,
1159
1143
  o,
1160
1144
  -a
1161
- ), p = a + c, w = { x: t.x + p, y: t.y }, y = m(w, h, t), f = { x: o.x - p, y: o.y }, x = m(f, d, o);
1145
+ ), p = a + c, w = { x: t.x + p, y: t.y }, f = m(w, h, t), y = { x: o.x - p, y: o.y }, E = m(y, d, o);
1162
1146
  this.path = V(
1163
- [g, y, x, l],
1164
- u
1147
+ [u, f, E, g],
1148
+ l
1165
1149
  );
1166
- const E = (y.x + x.x) / 2, P = (y.y + x.y) / 2;
1167
- this.midpoint = { x: E, y: P };
1150
+ const x = (f.x + E.x) / 2, N = (f.y + E.y) / 2;
1151
+ this.midpoint = { x, y: N };
1168
1152
  }
1169
1153
  createArrowPoint(e, t, o, s) {
1170
1154
  if (!e)
@@ -1176,43 +1160,45 @@ class Et {
1176
1160
  return m(n, t, o);
1177
1161
  }
1178
1162
  }
1179
- const At = (r, e) => {
1180
- const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
1181
- if (o === s) {
1182
- const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
1183
- return c ? {
1163
+ const Pt = (r, e) => {
1164
+ const t = r.linePoint, o = e.linePoint, s = o.y - t.y >= 0, n = r.dirY >= 0, a = e.dirY >= 0;
1165
+ if (n === a) {
1166
+ const u = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
1167
+ return u ? {
1184
1168
  points: [
1185
- { x: r.x, y: r.y },
1186
- { x: r.x, y: l.y },
1187
- { x: e.x, y: l.y },
1188
- { x: e.x, y: e.y }
1169
+ r.arrowPoint,
1170
+ { x: t.x, y: w.y },
1171
+ { x: o.x, y: w.y },
1172
+ e.arrowPoint
1189
1173
  ],
1190
- midpoint: l
1174
+ midpoint: w
1191
1175
  } : {
1192
1176
  points: [
1193
- { x: r.x, y: r.y },
1194
- { x: l.x, y: r.y },
1195
- { x: l.x, y: e.y },
1196
- { x: e.x, y: e.y }
1177
+ r.arrowPoint,
1178
+ t,
1179
+ { x: w.x, y: t.y },
1180
+ { x: w.x, y: o.y },
1181
+ o,
1182
+ e.arrowPoint
1197
1183
  ],
1198
- midpoint: l
1184
+ midpoint: w
1199
1185
  };
1200
1186
  }
1201
- const a = o === t, h = (r.x + e.x) / 2;
1202
- if (a) {
1203
- const c = { x: r.x, y: e.y };
1187
+ const d = n === s, c = (t.x + o.x) / 2;
1188
+ if (d) {
1189
+ const u = { x: t.x, y: o.y };
1204
1190
  return {
1205
- points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
1206
- midpoint: { x: h, y: c.y }
1191
+ points: [r.arrowPoint, u, o, e.arrowPoint],
1192
+ midpoint: { x: c, y: u.y }
1207
1193
  };
1208
1194
  }
1209
- const d = { x: e.x, y: r.y };
1195
+ const l = { x: o.x, y: t.y };
1210
1196
  return {
1211
- points: [{ x: r.x, y: r.y }, d, { x: e.x, y: e.y }],
1212
- midpoint: { x: h, y: d.y }
1197
+ points: [r.arrowPoint, t, l, e.arrowPoint],
1198
+ midpoint: { x: c, y: l.y }
1213
1199
  };
1214
1200
  };
1215
- class St {
1201
+ class Nt {
1216
1202
  constructor(e) {
1217
1203
  i(this, "path");
1218
1204
  i(this, "midpoint");
@@ -1225,45 +1211,27 @@ class St {
1225
1211
  arrowOffset: h,
1226
1212
  fromDir: d,
1227
1213
  toDir: c,
1228
- roundness: u
1229
- } = e, g = s ? m(
1214
+ roundness: l
1215
+ } = e, u = s ? m(
1230
1216
  { x: t.x + a, y: t.y },
1231
1217
  d,
1232
1218
  t
1233
- ) : t, l = n ? m(
1234
- {
1235
- x: o.x - a,
1236
- y: o.y
1237
- },
1238
- c,
1239
- o
1240
- ) : o, p = a + h, w = m(
1219
+ ) : t, g = n ? m({ x: o.x - a, y: o.y }, c, o) : o, p = a + h, w = m(
1241
1220
  { x: t.x + p, y: t.y },
1242
1221
  d,
1243
1222
  t
1244
- ), y = m({ x: o.x - p, y: o.y }, c, o), f = At(
1245
- {
1246
- x: w.x,
1247
- y: w.y,
1248
- dirY: d.y
1249
- },
1250
- {
1251
- x: y.x,
1252
- y: y.y,
1253
- dirY: c.y
1254
- }
1223
+ ), f = m({ x: o.x - p, y: o.y }, c, o), y = Pt(
1224
+ { arrowPoint: u, linePoint: w, dirY: d.y },
1225
+ { arrowPoint: g, linePoint: f, dirY: c.y }
1255
1226
  );
1256
- this.path = V(
1257
- [g, ...f.points, l],
1258
- u
1259
- ), this.midpoint = f.midpoint;
1227
+ this.path = V(y.points, l), this.midpoint = y.midpoint;
1260
1228
  }
1261
1229
  }
1262
1230
  class re {
1263
1231
  constructor(e) {
1264
1232
  i(this, "path");
1265
1233
  i(this, "midpoint");
1266
- const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, g = [
1234
+ const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
1267
1235
  { x: o, y: 0 },
1268
1236
  { x: d, y: 0 },
1269
1237
  { x: d, y: t },
@@ -1272,29 +1240,29 @@ class re {
1272
1240
  { x: d, y: -t },
1273
1241
  { x: d, y: 0 },
1274
1242
  { x: o, y: 0 }
1275
- ].map((p) => m(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), l = `M ${a.x} ${a.y} L ${g[0].x} ${g[0].y} `;
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 };
1243
+ ].map((p) => m(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), g = `M ${a.x} ${a.y} L ${u[0].x} ${u[0].y} `;
1244
+ this.path = `${h ? "" : g}${V(u, e.roundness)}`, this.midpoint = { x: (u[3].x + u[4].x) / 2, y: (u[3].y + u[4].y) / 2 };
1277
1245
  }
1278
1246
  }
1279
- class bt {
1247
+ class Ct {
1280
1248
  constructor(e) {
1281
1249
  i(this, "path");
1282
1250
  i(this, "midpoint");
1283
- const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, u = Math.sqrt(d * d - s * s), g = u * s / d, l = u + o + t, p = t + g, y = [
1251
+ const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, l = Math.sqrt(d * d - s * s), u = l * s / d, g = l + o + t, p = t + u, f = [
1284
1252
  { x: t, y: 0 },
1285
1253
  { x: p, y: c },
1286
1254
  { x: p, y: -c },
1287
- { x: l, y: 0 }
1288
- ].map((E) => m(E, n, { x: 0, y: 0 })).map((E) => ({ x: E.x + a.x, y: E.y + a.y })), f = [
1289
- `M ${y[0].x} ${y[0].y}`,
1290
- `A ${s} ${s} 0 0 1 ${y[1].x} ${y[1].y}`,
1291
- `A ${o} ${o} 0 1 0 ${y[2].x} ${y[2].y}`,
1292
- `A ${s} ${s} 0 0 1 ${y[0].x} ${y[0].y}`
1293
- ].join(" "), x = `M ${a.x} ${a.y} L ${y[0].x} ${y[0].y} `;
1294
- this.path = `${h ? "" : x}${f}`, this.midpoint = y[3];
1255
+ { x: g, y: 0 }
1256
+ ].map((x) => m(x, n, { x: 0, y: 0 })).map((x) => ({ x: x.x + a.x, y: x.y + a.y })), y = [
1257
+ `M ${f[0].x} ${f[0].y}`,
1258
+ `A ${s} ${s} 0 0 1 ${f[1].x} ${f[1].y}`,
1259
+ `A ${o} ${o} 0 1 0 ${f[2].x} ${f[2].y}`,
1260
+ `A ${s} ${s} 0 0 1 ${f[0].x} ${f[0].y}`
1261
+ ].join(" "), E = `M ${a.x} ${a.y} L ${f[0].x} ${f[0].y} `;
1262
+ this.path = `${h ? "" : E}${y}`, this.midpoint = f[3];
1295
1263
  }
1296
1264
  }
1297
- class Nt {
1265
+ class Tt {
1298
1266
  constructor(e) {
1299
1267
  i(this, "path");
1300
1268
  i(this, "midpoint");
@@ -1309,27 +1277,27 @@ class Nt {
1309
1277
  arrowLength: d
1310
1278
  } = e;
1311
1279
  this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
1312
- const c = o.x - t.x, u = o.y - t.y;
1313
- if (this.diagonalDistance = Math.sqrt(c * c + u * u), this.diagonalDistance === 0) {
1280
+ const c = o.x - t.x, l = o.y - t.y;
1281
+ if (this.diagonalDistance = Math.sqrt(c * c + l * l), this.diagonalDistance === 0) {
1314
1282
  this.path = "";
1315
1283
  return;
1316
1284
  }
1317
- const g = { x: c, y: u }, l = this.createDirectLinePoint({
1285
+ const u = { x: c, y: l }, g = this.createDirectLinePoint({
1318
1286
  offset: s,
1319
1287
  hasArrow: a,
1320
1288
  flip: 1,
1321
1289
  shift: t,
1322
1290
  arrowLength: d,
1323
- dir: g
1291
+ dir: u
1324
1292
  }), p = this.createDirectLinePoint({
1325
1293
  offset: n,
1326
1294
  hasArrow: h,
1327
1295
  flip: -1,
1328
1296
  shift: o,
1329
1297
  arrowLength: d,
1330
- dir: g
1298
+ dir: u
1331
1299
  });
1332
- this.path = `M ${l.x} ${l.y} L ${p.x} ${p.y}`;
1300
+ this.path = `M ${g.x} ${g.y} L ${p.x} ${p.y}`;
1333
1301
  }
1334
1302
  createDirectLinePoint(e) {
1335
1303
  const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
@@ -1339,11 +1307,11 @@ class Nt {
1339
1307
  };
1340
1308
  }
1341
1309
  }
1342
- const Pt = (r, e, t) => {
1310
+ const Mt = (r, e, t) => {
1343
1311
  const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
1344
1312
  return (t >= 0 ? o : s) + t;
1345
1313
  };
1346
- class Ct {
1314
+ class Dt {
1347
1315
  constructor(e) {
1348
1316
  i(this, "path");
1349
1317
  i(this, "midpoint");
@@ -1356,9 +1324,9 @@ class Ct {
1356
1324
  fromDir: h,
1357
1325
  toDir: d,
1358
1326
  arrowOffset: c,
1359
- roundness: u,
1360
- detourDistance: g
1361
- } = e, l = t ? m(
1327
+ roundness: l,
1328
+ detourDistance: u
1329
+ } = e, g = t ? m(
1362
1330
  { x: n.x + s, y: n.y },
1363
1331
  h,
1364
1332
  n
@@ -1369,36 +1337,36 @@ class Ct {
1369
1337
  },
1370
1338
  d,
1371
1339
  a
1372
- ) : a, w = s + c, y = m(
1340
+ ) : a, w = s + c, f = m(
1373
1341
  { x: n.x + w, y: n.y },
1374
1342
  h,
1375
1343
  n
1376
- ), f = m(
1344
+ ), y = m(
1377
1345
  { x: a.x - w, y: a.y },
1378
1346
  d,
1379
1347
  a
1380
- ), x = Pt(y, f, g);
1348
+ ), E = Mt(f, y, u);
1381
1349
  this.midpoint = {
1382
- x: (y.x + f.x) / 2,
1383
- y: x
1350
+ x: (f.x + y.x) / 2,
1351
+ y: E
1384
1352
  }, this.path = V(
1385
1353
  [
1386
- l,
1387
- y,
1388
- { x: y.x, y: x },
1389
- { x: f.x, y: x },
1354
+ g,
1390
1355
  f,
1356
+ { x: f.x, y: E },
1357
+ { x: y.x, y: E },
1358
+ y,
1391
1359
  p
1392
1360
  ],
1393
- u
1361
+ l
1394
1362
  );
1395
1363
  }
1396
1364
  }
1397
- const Tt = (r, e, t) => {
1365
+ const Rt = (r, e, t) => {
1398
1366
  const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
1399
1367
  return (t >= 0 ? o : s) + t;
1400
1368
  };
1401
- class Mt {
1369
+ class Lt {
1402
1370
  constructor(e) {
1403
1371
  i(this, "path");
1404
1372
  i(this, "midpoint");
@@ -1411,9 +1379,9 @@ class Mt {
1411
1379
  from: h,
1412
1380
  to: d,
1413
1381
  arrowOffset: c,
1414
- detourDistance: u,
1415
- roundness: g
1416
- } = e, l = t ? m(
1382
+ detourDistance: l,
1383
+ roundness: u
1384
+ } = e, g = t ? m(
1417
1385
  { x: h.x + s, y: h.y },
1418
1386
  n,
1419
1387
  h
@@ -1424,28 +1392,28 @@ class Mt {
1424
1392
  },
1425
1393
  a,
1426
1394
  d
1427
- ) : d, w = s + c, y = m(
1395
+ ) : d, w = s + c, f = m(
1428
1396
  { x: h.x + w, y: h.y },
1429
1397
  n,
1430
1398
  h
1431
- ), f = m(
1399
+ ), y = m(
1432
1400
  { x: d.x - w, y: d.y },
1433
1401
  a,
1434
1402
  d
1435
- ), x = Tt(y, f, u);
1403
+ ), E = Rt(f, y, l);
1436
1404
  this.midpoint = {
1437
- x,
1438
- y: (y.y + f.y) / 2
1405
+ x: E,
1406
+ y: (f.y + y.y) / 2
1439
1407
  }, this.path = V(
1440
1408
  [
1441
- l,
1442
- y,
1443
- { x, y: y.y },
1444
- { x, y: f.y },
1409
+ g,
1445
1410
  f,
1411
+ { x: E, y: f.y },
1412
+ { x: E, y: y.y },
1413
+ y,
1446
1414
  p
1447
1415
  ],
1448
- g
1416
+ u
1449
1417
  );
1450
1418
  }
1451
1419
  }
@@ -1485,20 +1453,20 @@ class G {
1485
1453
  i(this, "onAfterRender");
1486
1454
  i(this, "afterRenderEmitter");
1487
1455
  i(this, "arrowRenderer");
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));
1456
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Be(e.color), this.svg.appendChild(this.group), this.line = Oe(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
1457
  }
1490
1458
  render(e) {
1491
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Ie(
1459
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = $e(
1492
1460
  e.from,
1493
1461
  e.to,
1494
1462
  this.params.padding
1495
1463
  );
1496
- $e(this.svg, { x: t, y: o, width: s, height: n });
1464
+ We(this.svg, { x: t, y: o, width: s, height: n });
1497
1465
  const d = Ae(e.from.direction), c = Ae(e.to.direction);
1498
- let u = { x: -c.x, y: -c.y }, g;
1499
- e.category === I.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === I.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
1500
- const l = g(a, h, d, c);
1501
- this.line.setAttribute("d", l.path);
1466
+ let l = { x: -c.x, y: -c.y }, u;
1467
+ e.category === I.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === I.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1468
+ const g = u(a, h, d, c);
1469
+ this.line.setAttribute("d", g.path);
1502
1470
  let p = null;
1503
1471
  this.sourceArrow && (p = this.arrowRenderer({
1504
1472
  direction: d,
@@ -1507,17 +1475,17 @@ class G {
1507
1475
  }), this.sourceArrow.setAttribute("d", p));
1508
1476
  let w = null;
1509
1477
  this.targetArrow && (w = this.arrowRenderer({
1510
- direction: u,
1478
+ direction: l,
1511
1479
  shift: h,
1512
1480
  arrowLength: this.params.arrowLength
1513
1481
  }), this.targetArrow.setAttribute("d", w)), this.afterRenderEmitter.emit({
1514
- edgePath: l,
1482
+ edgePath: g,
1515
1483
  sourceArrowPath: p,
1516
1484
  targetArrowPath: w
1517
1485
  });
1518
1486
  }
1519
1487
  }
1520
- const Dt = (r) => (e) => {
1488
+ const Vt = (r) => (e) => {
1521
1489
  const o = [
1522
1490
  { x: 0, y: 0 },
1523
1491
  { x: e.arrowLength, y: r.radius },
@@ -1529,7 +1497,7 @@ const Dt = (r) => (e) => {
1529
1497
  y: h.y + e.shift.y
1530
1498
  })), 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
1499
  return `${s} ${n} ${a} Z`;
1532
- }, Rt = (r) => (e) => {
1500
+ }, It = (r) => (e) => {
1533
1501
  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
1502
  { x: 0, y: 0 },
1535
1503
  { x: a, y: -h },
@@ -1539,9 +1507,9 @@ const Dt = (r) => (e) => {
1539
1507
  ).map((w) => ({
1540
1508
  x: w.x + e.shift.x,
1541
1509
  y: w.y + e.shift.y
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
- return `${u} ${g} ${l} ${p}`;
1544
- }, Lt = (r) => (e) => {
1510
+ })), l = `M ${c[0].x} ${c[0].y}`, u = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, g = `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}`;
1511
+ return `${l} ${u} ${g} ${p}`;
1512
+ }, Ft = (r) => (e) => {
1545
1513
  const t = r.smallRadius, o = r.radius, s = m(
1546
1514
  {
1547
1515
  x: e.arrowLength,
@@ -1556,33 +1524,33 @@ const Dt = (r) => (e) => {
1556
1524
  y: 0
1557
1525
  }
1558
1526
  ), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1559
- (g) => m(g, e.direction, { x: 0, y: 0 })
1560
- ).map((g) => ({
1561
- x: g.x + e.shift.x,
1562
- y: g.y + e.shift.y
1563
- })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, u = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1564
- return `${h} ${d} ${c} ${u}`;
1527
+ (u) => m(u, e.direction, { x: 0, y: 0 })
1528
+ ).map((u) => ({
1529
+ x: u.x + e.shift.x,
1530
+ y: u.y + e.shift.y
1531
+ })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, l = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1532
+ return `${h} ${d} ${c} ${l}`;
1565
1533
  }, B = (r) => {
1566
1534
  if (typeof r == "function")
1567
1535
  return r;
1568
1536
  switch (r.type) {
1569
1537
  case "triangle":
1570
- return Dt({
1538
+ return Vt({
1571
1539
  radius: r.radius ?? v.polygonArrowRadius
1572
1540
  });
1573
1541
  case "arc":
1574
- return Rt({
1542
+ return It({
1575
1543
  radius: r.radius ?? v.circleArrowRadius
1576
1544
  });
1577
1545
  default:
1578
- return Lt({
1546
+ return Ft({
1579
1547
  smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
1580
1548
  angle: r.angle ?? v.wedgeArrowAngle,
1581
1549
  radius: r.radius ?? v.wedgeArrowRadius
1582
1550
  });
1583
1551
  }
1584
1552
  }, O = 50;
1585
- class Vt {
1553
+ class Ut {
1586
1554
  constructor(e) {
1587
1555
  i(this, "svg");
1588
1556
  i(this, "group");
@@ -1599,7 +1567,7 @@ class Vt {
1599
1567
  i(this, "hasSourceArrow");
1600
1568
  i(this, "hasTargetArrow");
1601
1569
  i(this, "pathShape");
1602
- i(this, "createCyclePath", (e, t, o) => new bt({
1570
+ i(this, "createCyclePath", (e, t, o) => new Ct({
1603
1571
  origin: e,
1604
1572
  dir: o,
1605
1573
  radius: this.portCycleRadius,
@@ -1607,7 +1575,7 @@ class Vt {
1607
1575
  arrowLength: this.arrowLength,
1608
1576
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1609
1577
  }));
1610
- i(this, "createDetourPath", (e, t, o, s) => new ft({
1578
+ i(this, "createDetourPath", (e, t, o, s) => new Et({
1611
1579
  from: e,
1612
1580
  to: t,
1613
1581
  fromDir: o,
@@ -1619,7 +1587,7 @@ class Vt {
1619
1587
  hasSourceArrow: this.hasSourceArrow,
1620
1588
  hasTargetArrow: this.hasTargetArrow
1621
1589
  }));
1622
- i(this, "createLinePath", (e, t, o, s) => new yt({
1590
+ i(this, "createLinePath", (e, t, o, s) => new mt({
1623
1591
  from: e,
1624
1592
  to: t,
1625
1593
  fromDir: o,
@@ -1646,7 +1614,8 @@ class Vt {
1646
1614
  this.pathShape.render(e);
1647
1615
  }
1648
1616
  }
1649
- class It {
1617
+ const Se = (r) => Math.cos(r) > 0 ? 0 : Math.PI;
1618
+ class $t {
1650
1619
  constructor(e) {
1651
1620
  i(this, "svg");
1652
1621
  i(this, "group");
@@ -1671,7 +1640,7 @@ class It {
1671
1640
  roundness: this.roundness,
1672
1641
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1673
1642
  }));
1674
- i(this, "createDetourPath", (e, t, o, s) => new Ct({
1643
+ i(this, "createDetourPath", (e, t, o, s) => new Dt({
1675
1644
  from: e,
1676
1645
  to: t,
1677
1646
  fromDir: o,
@@ -1683,7 +1652,7 @@ class It {
1683
1652
  hasSourceArrow: this.hasSourceArrow,
1684
1653
  hasTargetArrow: this.hasTargetArrow
1685
1654
  }));
1686
- i(this, "createLinePath", (e, t, o, s) => new mt({
1655
+ i(this, "createLinePath", (e, t, o, s) => new At({
1687
1656
  from: e,
1688
1657
  to: t,
1689
1658
  fromDir: o,
@@ -1714,10 +1683,21 @@ class It {
1714
1683
  }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1715
1684
  }
1716
1685
  render(e) {
1717
- this.pathShape.render(e);
1686
+ const { from: t, to: o, category: s } = e;
1687
+ this.pathShape.render({
1688
+ category: s,
1689
+ from: {
1690
+ ...t,
1691
+ direction: Se(t.direction)
1692
+ },
1693
+ to: {
1694
+ ...o,
1695
+ direction: Se(o.direction)
1696
+ }
1697
+ });
1718
1698
  }
1719
1699
  }
1720
- class Ft {
1700
+ class Bt {
1721
1701
  constructor(e) {
1722
1702
  i(this, "svg");
1723
1703
  i(this, "group");
@@ -1743,7 +1723,7 @@ class Ft {
1743
1723
  roundness: this.roundness,
1744
1724
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1745
1725
  }));
1746
- i(this, "createDetourPath", (e, t, o, s) => new xt({
1726
+ i(this, "createDetourPath", (e, t, o, s) => new St({
1747
1727
  from: e,
1748
1728
  to: t,
1749
1729
  fromDir: o,
@@ -1756,7 +1736,7 @@ class Ft {
1756
1736
  hasSourceArrow: this.hasSourceArrow,
1757
1737
  hasTargetArrow: this.hasTargetArrow
1758
1738
  }));
1759
- i(this, "createLinePath", (e, t, o, s) => new Et({
1739
+ i(this, "createLinePath", (e, t, o, s) => new bt({
1760
1740
  from: e,
1761
1741
  to: t,
1762
1742
  fromDir: o,
@@ -1790,7 +1770,8 @@ class Ft {
1790
1770
  this.pathShape.render(e);
1791
1771
  }
1792
1772
  }
1793
- class Ut {
1773
+ const be = Math.PI / 2, Pe = (r) => Math.sin(r) > 0 ? be : -be;
1774
+ class Ot {
1794
1775
  constructor(e) {
1795
1776
  i(this, "svg");
1796
1777
  i(this, "group");
@@ -1815,7 +1796,7 @@ class Ut {
1815
1796
  roundness: this.roundness,
1816
1797
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1817
1798
  }));
1818
- i(this, "createDetourPath", (e, t, o, s) => new Mt({
1799
+ i(this, "createDetourPath", (e, t, o, s) => new Lt({
1819
1800
  from: e,
1820
1801
  to: t,
1821
1802
  fromDir: o,
@@ -1827,7 +1808,7 @@ class Ut {
1827
1808
  hasSourceArrow: this.hasSourceArrow,
1828
1809
  hasTargetArrow: this.hasTargetArrow
1829
1810
  }));
1830
- i(this, "createLinePath", (e, t, o, s) => new St({
1811
+ i(this, "createLinePath", (e, t, o, s) => new Nt({
1831
1812
  from: e,
1832
1813
  to: t,
1833
1814
  fromDir: o,
@@ -1858,10 +1839,21 @@ class Ut {
1858
1839
  }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1859
1840
  }
1860
1841
  render(e) {
1861
- this.pathShape.render(e);
1842
+ const { from: t, to: o, category: s } = e;
1843
+ this.pathShape.render({
1844
+ category: s,
1845
+ from: {
1846
+ ...t,
1847
+ direction: Pe(t.direction)
1848
+ },
1849
+ to: {
1850
+ ...o,
1851
+ direction: Pe(o.direction)
1852
+ }
1853
+ });
1862
1854
  }
1863
1855
  }
1864
- class Be {
1856
+ class ze {
1865
1857
  constructor(e) {
1866
1858
  i(this, "svg");
1867
1859
  i(this, "group", document.createElementNS(
@@ -1879,16 +1871,16 @@ class Be {
1879
1871
  i(this, "onAfterRender");
1880
1872
  i(this, "afterRenderEmitter");
1881
1873
  i(this, "arrowRenderer");
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));
1874
+ [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 = Be(this.color), this.svg.appendChild(this.group), this.line = Oe(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
1875
  }
1884
1876
  render(e) {
1885
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Ie(
1877
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = $e(
1886
1878
  e.from,
1887
1879
  e.to,
1888
1880
  O
1889
1881
  );
1890
- $e(this.svg, { x: t, y: o, width: s, height: n });
1891
- const d = new Nt({
1882
+ We(this.svg, { x: t, y: o, width: s, height: n });
1883
+ const d = new Tt({
1892
1884
  from: a,
1893
1885
  to: h,
1894
1886
  sourceOffset: this.sourceOffset,
@@ -1898,64 +1890,64 @@ class Be {
1898
1890
  arrowLength: this.arrowLength
1899
1891
  });
1900
1892
  this.line.setAttribute("d", d.path);
1901
- let c = null, u = null;
1902
- const g = d.diagonalDistance;
1903
- if (g === 0)
1904
- this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (u = "", this.targetArrow.setAttribute("d", u));
1893
+ let c = null, l = null;
1894
+ const u = d.diagonalDistance;
1895
+ if (u === 0)
1896
+ this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
1905
1897
  else {
1906
- const l = {
1907
- x: (h.x - a.x) / g,
1908
- y: (h.y - a.y) / g
1898
+ const g = {
1899
+ x: (h.x - a.x) / u,
1900
+ y: (h.y - a.y) / u
1909
1901
  };
1910
1902
  if (this.sourceArrow) {
1911
1903
  const p = {
1912
- x: l.x * this.sourceOffset,
1913
- y: l.y * this.sourceOffset
1904
+ x: g.x * this.sourceOffset,
1905
+ y: g.y * this.sourceOffset
1914
1906
  };
1915
1907
  c = this.arrowRenderer({
1916
- direction: l,
1908
+ direction: g,
1917
1909
  shift: p,
1918
1910
  arrowLength: this.arrowLength
1919
1911
  }), this.sourceArrow.setAttribute("d", c);
1920
1912
  }
1921
1913
  if (this.targetArrow) {
1922
1914
  const p = {
1923
- x: l.x * this.targetOffset,
1924
- y: l.y * this.targetOffset
1915
+ x: g.x * this.targetOffset,
1916
+ y: g.y * this.targetOffset
1925
1917
  };
1926
- u = this.arrowRenderer({
1927
- direction: { x: -l.x, y: -l.y },
1918
+ l = this.arrowRenderer({
1919
+ direction: { x: -g.x, y: -g.y },
1928
1920
  shift: {
1929
1921
  x: h.x - p.x,
1930
1922
  y: h.y - p.y
1931
1923
  },
1932
1924
  arrowLength: this.arrowLength
1933
- }), this.targetArrow.setAttribute("d", u);
1925
+ }), this.targetArrow.setAttribute("d", l);
1934
1926
  }
1935
1927
  }
1936
1928
  this.afterRenderEmitter.emit({
1937
1929
  edgePath: d,
1938
1930
  sourceArrowPath: c,
1939
- targetArrowPath: u
1931
+ targetArrowPath: l
1940
1932
  });
1941
1933
  }
1942
1934
  }
1943
- const $t = () => {
1935
+ const Wt = () => {
1944
1936
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1945
1937
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1946
- }, Bt = (r) => {
1938
+ }, zt = (r) => {
1947
1939
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1948
1940
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1949
- }, Se = (r) => {
1941
+ }, Ne = (r) => {
1950
1942
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1951
1943
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1952
1944
  };
1953
- class Ot extends Error {
1945
+ class kt extends Error {
1954
1946
  constructor(e) {
1955
1947
  super(e), this.name = "InteractiveEdgeError";
1956
1948
  }
1957
1949
  }
1958
- class Oe {
1950
+ class ke {
1959
1951
  constructor(e, t) {
1960
1952
  i(this, "svg");
1961
1953
  i(this, "group");
@@ -1967,18 +1959,18 @@ class Oe {
1967
1959
  * @deprecated
1968
1960
  * do use shape.svg instead
1969
1961
  */
1970
- i(this, "handle", $t());
1962
+ i(this, "handle", Wt());
1971
1963
  i(this, "onAfterRender");
1972
1964
  i(this, "interactiveLine");
1973
1965
  i(this, "interactiveSourceArrow", null);
1974
1966
  i(this, "interactiveTargetArrow", null);
1975
- if (this.baseEdge = e, e instanceof Oe)
1976
- throw new Ot(
1967
+ if (this.baseEdge = e, e instanceof ke)
1968
+ throw new kt(
1977
1969
  "interactive edge can be configured only once"
1978
1970
  );
1979
1971
  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
1972
  const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
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) => {
1973
+ this.interactiveLine = zt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ne(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ne(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1982
1974
  this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
1983
1975
  });
1984
1976
  }
@@ -1986,7 +1978,7 @@ class Oe {
1986
1978
  this.baseEdge.render(e);
1987
1979
  }
1988
1980
  }
1989
- class Jr {
1981
+ class Zr {
1990
1982
  constructor(e, t) {
1991
1983
  i(this, "group");
1992
1984
  i(this, "line");
@@ -2003,7 +1995,7 @@ class Jr {
2003
1995
  this.baseShape.render(e);
2004
1996
  }
2005
1997
  }
2006
- class We {
1998
+ class He {
2007
1999
  constructor(e) {
2008
2000
  i(this, "onAfterNodeAdded");
2009
2001
  i(this, "onAfterNodeUpdated");
@@ -2118,7 +2110,7 @@ class K {
2118
2110
  this.counter = 0;
2119
2111
  }
2120
2112
  }
2121
- class ze {
2113
+ class Ye {
2122
2114
  constructor(e, t, o) {
2123
2115
  i(this, "nodeIdGenerator", new K(
2124
2116
  (e) => this.graphStore.hasNode(e)
@@ -2249,18 +2241,18 @@ class ze {
2249
2241
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
2250
2242
  }
2251
2243
  }
2252
- const Wt = (r) => {
2244
+ const Ht = (r) => {
2253
2245
  setTimeout(() => {
2254
2246
  r();
2255
2247
  });
2256
- }, zt = (r) => {
2248
+ }, Yt = (r) => {
2257
2249
  queueMicrotask(() => {
2258
2250
  r();
2259
2251
  });
2260
2252
  }, oe = (r) => {
2261
2253
  r();
2262
2254
  };
2263
- class ke {
2255
+ class Xe {
2264
2256
  constructor(e) {
2265
2257
  i(this, "onBeforeUpdated");
2266
2258
  i(this, "onAfterUpdated");
@@ -2283,7 +2275,7 @@ class ke {
2283
2275
  return this.viewportStore.createViewportCoords(e);
2284
2276
  }
2285
2277
  }
2286
- const kt = (r, e) => Symbol.iterator in r ? {
2278
+ const Xt = (r, e) => Symbol.iterator in r ? {
2287
2279
  minContentScale: e.focus.minContentScale,
2288
2280
  nodes: r,
2289
2281
  contentPadding: e.focus.contentPadding,
@@ -2293,16 +2285,16 @@ const kt = (r, e) => Symbol.iterator in r ? {
2293
2285
  nodes: r.nodes ?? [],
2294
2286
  contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
2295
2287
  animationDuration: r.animationDuration ?? e.focus.animationDuration
2296
- }, He = (r, e, t) => ({
2288
+ }, Ge = (r, e, t) => ({
2297
2289
  scale: r.scale,
2298
2290
  x: r.x + r.scale * e,
2299
2291
  y: r.y + r.scale * t
2300
- }), Ye = (r, e, t, o) => ({
2292
+ }), je = (r, e, t, o) => ({
2301
2293
  scale: r.scale * e,
2302
2294
  x: r.scale * (1 - e) * t + r.x,
2303
2295
  y: r.scale * (1 - e) * o + r.y
2304
2296
  });
2305
- class Xe {
2297
+ class Je {
2306
2298
  constructor(e, t, o, s) {
2307
2299
  this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
2308
2300
  }
@@ -2314,22 +2306,22 @@ class Xe {
2314
2306
  }
2315
2307
  center(e, t) {
2316
2308
  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 = He(a, d, c);
2318
- const g = t == null ? void 0 : t.contentScale;
2319
- if (g !== void 0) {
2320
- const p = 1 / g;
2321
- u = Ye(
2322
- u,
2309
+ let l = Ge(a, d, c);
2310
+ const u = t == null ? void 0 : t.contentScale;
2311
+ if (u !== void 0) {
2312
+ const p = 1 / u;
2313
+ l = je(
2314
+ l,
2323
2315
  p / a.scale,
2324
2316
  n.x,
2325
2317
  n.y
2326
2318
  );
2327
2319
  }
2328
- const l = (t == null ? void 0 : t.animationDuration) ?? 0;
2329
- l > 0 ? this.animateNavigation(a, u, l) : this.viewportStore.patchViewportMatrix(u);
2320
+ const g = (t == null ? void 0 : t.animationDuration) ?? 0;
2321
+ g > 0 ? this.animateNavigation(a, l, g) : this.viewportStore.patchViewportMatrix(l);
2330
2322
  }
2331
2323
  focus(e) {
2332
- const t = kt(e ?? {}, this.params);
2324
+ const t = Xt(e ?? {}, this.params);
2333
2325
  this.params.focus.schedule(() => {
2334
2326
  this.navigate(t);
2335
2327
  });
@@ -2350,12 +2342,12 @@ class Xe {
2350
2342
  const d = {
2351
2343
  x: (t + o) / 2,
2352
2344
  y: (s + n) / 2
2353
- }, { scale: c } = this.viewportStore.getContentMatrix(), u = (n - s) * c, g = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), w = Math.max(
2354
- g / l,
2355
- u / p
2356
- ), y = w > 1 ? c / w : c, f = Math.max(y, e.minContentScale);
2345
+ }, { scale: c } = this.viewportStore.getContentMatrix(), l = (n - s) * c, u = (o - t) * c, { width: g, height: p } = this.viewportStore.getDimensions(), w = Math.max(
2346
+ u / g,
2347
+ l / p
2348
+ ), f = w > 1 ? c / w : c, y = Math.max(f, e.minContentScale);
2357
2349
  this.center(d, {
2358
- contentScale: f,
2350
+ contentScale: y,
2359
2351
  animationDuration: e.animationDuration
2360
2352
  });
2361
2353
  }
@@ -2369,7 +2361,7 @@ class Xe {
2369
2361
  }, a = (h) => {
2370
2362
  s === void 0 && (s = h);
2371
2363
  const d = Math.min((h - s) / o, 1);
2372
- d <= 1 && this.viewportStore.patchViewportMatrix({
2364
+ this.viewportStore.patchViewportMatrix({
2373
2365
  scale: e.scale + d * n.scale,
2374
2366
  x: e.x + d * n.x,
2375
2367
  y: e.y + d * n.y
@@ -2378,20 +2370,20 @@ class Xe {
2378
2370
  this.win.requestAnimationFrame(a);
2379
2371
  }
2380
2372
  }
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 = {
2373
+ const Ke = (r, e, t) => {
2374
+ const o = new Ve(), s = new He(o), n = new Xe(e), a = new Re(o, e, r), h = {
2383
2375
  nodes: {
2384
- centerFn: Ve,
2376
+ centerFn: Ue,
2385
2377
  priorityFn: () => 0
2386
2378
  },
2387
2379
  edges: {
2388
- shapeFactory: () => new Be(),
2380
+ shapeFactory: () => new ze(),
2389
2381
  priorityFn: () => 0
2390
2382
  },
2391
2383
  ports: {
2392
2384
  direction: 0
2393
2385
  }
2394
- }, d = new ze(
2386
+ }, d = new Ye(
2395
2387
  o,
2396
2388
  a,
2397
2389
  h
@@ -2402,13 +2394,13 @@ const Ge = (r, e, t) => {
2402
2394
  schedule: oe,
2403
2395
  animationDuration: 0
2404
2396
  }
2405
- }, u = new Xe(
2397
+ }, l = new Je(
2406
2398
  o,
2407
2399
  e,
2408
2400
  c,
2409
2401
  t
2410
2402
  );
2411
- return new Me(s, n, d, u);
2403
+ return new Le(s, n, d, l);
2412
2404
  };
2413
2405
  class j {
2414
2406
  constructor(e, t, o, s) {
@@ -2510,7 +2502,7 @@ class j {
2510
2502
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2511
2503
  }
2512
2504
  }
2513
- class Ht {
2505
+ class Gt {
2514
2506
  constructor() {
2515
2507
  i(this, "field", "_htmlGraphTags");
2516
2508
  }
@@ -2618,7 +2610,7 @@ const ne = (r, e) => ({
2618
2610
  from: r.isDirect ? r.staticPortId : e,
2619
2611
  to: r.isDirect ? e : r.staticPortId
2620
2612
  });
2621
- class Yt {
2613
+ class jt {
2622
2614
  constructor(e, t) {
2623
2615
  this.graph = e, this.connectionAllowedVerifier = t;
2624
2616
  }
@@ -2626,18 +2618,18 @@ class Yt {
2626
2618
  let t, o = 1 / 0;
2627
2619
  const { cursor: s } = e;
2628
2620
  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)
2621
+ const { element: a, direction: h, nodeId: d } = this.graph.getPort(n), { x: c, y: l } = this.graph.getNode(d);
2622
+ if (c === null || l === null)
2631
2623
  return;
2632
- const g = ne(e, n);
2633
- if (!this.connectionAllowedVerifier(g))
2624
+ const u = ne(e, n);
2625
+ if (!this.connectionAllowedVerifier(u))
2634
2626
  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);
2627
+ const { top: g, left: p, width: w, height: f } = a.getBoundingClientRect(), y = { x: p + w / 2, y: g + f / 2 }, E = s.x - y.x, x = s.y - y.y, N = Math.sqrt(E * E + x * x);
2628
+ N < o && (o = N, t = h);
2637
2629
  }), t;
2638
2630
  }
2639
2631
  }
2640
- class Xt {
2632
+ class Jt {
2641
2633
  constructor(e) {
2642
2634
  this.direction = e;
2643
2635
  }
@@ -2955,7 +2947,7 @@ class J {
2955
2947
  );
2956
2948
  }
2957
2949
  moveViewport(e, t) {
2958
- const o = this.viewport.getViewportMatrix(), s = He(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2950
+ const o = this.viewport.getViewportMatrix(), s = Ge(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2959
2951
  prevTransform: o,
2960
2952
  nextTransform: s,
2961
2953
  canvasWidth: n,
@@ -2964,7 +2956,7 @@ class J {
2964
2956
  this.performTransform(h);
2965
2957
  }
2966
2958
  scaleViewport(e, t, o) {
2967
- const s = this.canvas.viewport.getViewportMatrix(), n = Ye(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2959
+ const s = this.canvas.viewport.getViewportMatrix(), n = je(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2968
2960
  prevTransform: s,
2969
2961
  nextTransform: n,
2970
2962
  canvasWidth: a,
@@ -3076,27 +3068,27 @@ class he {
3076
3068
  }
3077
3069
  scheduleEnsureViewportAreaLoaded() {
3078
3070
  setTimeout(() => {
3079
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, u = s + a + this.nodeHorizontal, g = n + h + this.nodeVertical;
3080
- this.loadedArea.xFrom < d && this.loadedArea.xTo > u && this.loadedArea.yFrom < c && this.loadedArea.yTo > g || this.loadAreaAroundViewport();
3071
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, l = s + a + this.nodeHorizontal, u = n + h + this.nodeVertical;
3072
+ this.loadedArea.xFrom < d && this.loadedArea.xTo > l && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
3081
3073
  });
3082
3074
  }
3083
3075
  loadAreaAroundViewport() {
3084
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, u = 3 * a + 2 * this.nodeHorizontal, g = 3 * h + 2 * this.nodeVertical;
3076
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, l = 3 * a + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
3085
3077
  this.trigger.emit({
3086
3078
  x: d,
3087
3079
  y: c,
3088
- width: u,
3089
- height: g
3080
+ width: l,
3081
+ height: u
3090
3082
  });
3091
3083
  }
3092
3084
  }
3093
- const Gt = () => {
3085
+ const Kt = () => {
3094
3086
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3095
3087
  return r.style.position = "absolute", r.style.inset = "0", r;
3096
- }, jt = () => {
3088
+ }, Qt = () => {
3097
3089
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
3098
3090
  return r.setAttribute("fill", "url(#pattern)"), r;
3099
- }, Jt = () => {
3091
+ }, Zt = () => {
3100
3092
  const r = document.createElementNS(
3101
3093
  "http://www.w3.org/2000/svg",
3102
3094
  "pattern"
@@ -3105,9 +3097,9 @@ const Gt = () => {
3105
3097
  };
3106
3098
  class de {
3107
3099
  constructor(e, t, o) {
3108
- i(this, "svg", Gt());
3109
- i(this, "patternRenderingRectangle", jt());
3110
- i(this, "pattern", Jt());
3100
+ i(this, "svg", Kt());
3101
+ i(this, "patternRenderingRectangle", Qt());
3102
+ i(this, "pattern", Zt());
3111
3103
  i(this, "patternContent");
3112
3104
  i(this, "tileWidth");
3113
3105
  i(this, "tileHeight");
@@ -3149,7 +3141,7 @@ class ce {
3149
3141
  i(this, "onEdgeCreated", (e) => {
3150
3142
  this.params.onAfterEdgeCreated(e);
3151
3143
  });
3152
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ge(
3144
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ke(
3153
3145
  this.overlayLayer,
3154
3146
  this.viewportStore,
3155
3147
  this.window
@@ -3158,8 +3150,8 @@ class ce {
3158
3150
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3159
3151
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
3160
3152
  onPointerDownVerifier: (d, c) => {
3161
- const u = this.params.connectionTypeResolver(d);
3162
- return u === null ? !1 : (this.grabPort(d, c, u), !0);
3153
+ const l = this.params.connectionTypeResolver(d);
3154
+ return l === null ? !1 : (this.grabPort(d, c, l), !0);
3163
3155
  },
3164
3156
  onPointerMove: (d) => {
3165
3157
  this.moveDraggingPort(d);
@@ -3193,28 +3185,30 @@ class ce {
3193
3185
  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({
3194
3186
  x: a - d.x,
3195
3187
  y: h - d.y
3196
- }), u = this.canvas.viewport.createContentCoords({
3188
+ }), l = this.canvas.viewport.createContentCoords({
3197
3189
  x: t.x - d.x,
3198
3190
  y: t.y - d.y
3199
- }), g = {
3191
+ }), u = {
3200
3192
  overlayNodeId: M.StaticNodeId,
3201
3193
  portCoords: c,
3202
3194
  portDirection: s.direction
3203
- }, l = o === "direct";
3195
+ }, g = o === "direct";
3204
3196
  this.edgeInProgress = {
3205
3197
  staticPortId: e,
3206
- isDirect: l
3198
+ isDirect: g
3207
3199
  };
3208
- const p = {
3209
- overlayNodeId: M.DraggingNodeId,
3210
- portCoords: u,
3211
- portDirection: this.params.draggingPortDirectionResolver.resolve({
3200
+ const p = this.params.draggingPortDirectionResolver.resolve(
3201
+ {
3212
3202
  cursor: t,
3213
3203
  ...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,
3204
+ }
3205
+ ), w = {
3206
+ overlayNodeId: M.DraggingNodeId,
3207
+ portCoords: l,
3208
+ portDirection: p ?? s.direction
3209
+ }, [f, y] = g ? [u, w] : [w, u];
3210
+ this.overlayCanvas.addNode(Y(f)), this.overlayCanvas.addNode(Y(y)), this.overlayCanvas.addEdge({
3211
+ from: f.overlayNodeId,
3218
3212
  to: y.overlayNodeId,
3219
3213
  shape: this.params.edgeShapeFactory(M.EdgeId)
3220
3214
  });
@@ -3223,7 +3217,7 @@ class ce {
3223
3217
  this.edgeInProgress = null, this.overlayCanvas.clear();
3224
3218
  }
3225
3219
  tryCreateConnection(e) {
3226
- const t = Le(this.canvas.graph, e);
3220
+ const t = Fe(this.canvas.graph, e);
3227
3221
  if (t === null) {
3228
3222
  this.params.onEdgeCreationInterrupted(this.edgeInProgress);
3229
3223
  return;
@@ -3259,7 +3253,7 @@ class le {
3259
3253
  i(this, "onEdgeReattached", (e) => {
3260
3254
  this.params.onAfterEdgeReattached(e);
3261
3255
  });
3262
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ge(
3256
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ke(
3263
3257
  this.overlayLayer,
3264
3258
  this.viewportStore,
3265
3259
  this.window
@@ -3308,15 +3302,15 @@ class le {
3308
3302
  return !1;
3309
3303
  const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
3310
3304
  this.edgeInProgress = { staticPortId: h, isDirect: a };
3311
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), g = {
3312
- x: u.x + u.width / 2,
3313
- y: u.y + u.height / 2
3314
- }, l = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
3315
- x: g.x - l.x,
3316
- y: g.y - l.y
3305
+ const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), u = {
3306
+ x: l.x + l.width / 2,
3307
+ y: l.y + l.height / 2
3308
+ }, g = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
3309
+ x: u.x - g.x,
3310
+ y: u.y - g.y
3317
3311
  }), w = this.canvas.viewport.createContentCoords({
3318
- x: t.x - l.x,
3319
- y: t.y - l.y
3312
+ x: t.x - g.x,
3313
+ y: t.y - g.y
3320
3314
  });
3321
3315
  this.draggingEdgePayload = {
3322
3316
  id: o,
@@ -3325,24 +3319,26 @@ class le {
3325
3319
  shape: s.shape,
3326
3320
  priority: s.priority
3327
3321
  }, this.canvas.removeEdge(o);
3328
- const y = {
3322
+ const f = {
3329
3323
  overlayNodeId: M.StaticNodeId,
3330
3324
  portCoords: p,
3331
3325
  portDirection: c.direction
3332
- }, f = this.params.draggingPortDirectionResolver.resolve({
3333
- cursor: t,
3334
- ...this.edgeInProgress
3335
- }), x = {
3326
+ }, y = this.params.draggingPortDirectionResolver.resolve(
3327
+ {
3328
+ cursor: t,
3329
+ ...this.edgeInProgress
3330
+ }
3331
+ ), E = {
3336
3332
  overlayNodeId: M.DraggingNodeId,
3337
3333
  portCoords: w,
3338
- portDirection: f ?? d.direction
3339
- }, [E, P] = a ? [y, x] : [x, y];
3340
- this.overlayCanvas.addNode(Y(E)), this.overlayCanvas.addNode(Y(P));
3334
+ portDirection: y ?? d.direction
3335
+ }, [x, N] = a ? [f, E] : [E, f];
3336
+ this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(N));
3341
3337
  const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
3342
3338
  return this.overlayCanvas.addEdge({
3343
3339
  id: M.EdgeId,
3344
- from: E.overlayNodeId,
3345
- to: P.overlayNodeId,
3340
+ from: x.overlayNodeId,
3341
+ to: N.overlayNodeId,
3346
3342
  shape: T
3347
3343
  }), !0;
3348
3344
  }
@@ -3363,7 +3359,7 @@ class le {
3363
3359
  }).updatePort(M.DraggingNodeId, { direction: n });
3364
3360
  }
3365
3361
  tryCreateConnection(e) {
3366
- const t = Le(this.canvas.graph, e);
3362
+ const t = Fe(this.canvas.graph, e);
3367
3363
  if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
3368
3364
  const c = this.draggingEdgePayload;
3369
3365
  this.params.onEdgeReattachInterrupted({
@@ -3439,7 +3435,7 @@ class ge {
3439
3435
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
3440
3436
  }
3441
3437
  }
3442
- class Kt {
3438
+ class _t {
3443
3439
  constructor(e, t, o) {
3444
3440
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
3445
3441
  }
@@ -3453,9 +3449,9 @@ class Kt {
3453
3449
  }), this.params.onAfterApplied();
3454
3450
  }
3455
3451
  }
3456
- class Qt {
3452
+ class qt {
3457
3453
  static configure(e, t) {
3458
- const o = t.applyOn, s = new Kt(e, t.algorithm, {
3454
+ const o = t.applyOn, s = new _t(e, t.algorithm, {
3459
3455
  staticNodeResolver: t.staticNodeResolver,
3460
3456
  onBeforeApplied: t.onBeforeApplied,
3461
3457
  onAfterApplied: t.onAfterApplied
@@ -3479,7 +3475,7 @@ class Qt {
3479
3475
  }
3480
3476
  }
3481
3477
  }
3482
- class Zt {
3478
+ class er {
3483
3479
  constructor(e, t) {
3484
3480
  i(this, "previousTimeStamp");
3485
3481
  i(this, "step", (e) => {
@@ -3494,7 +3490,7 @@ class Zt {
3494
3490
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3495
3491
  }
3496
3492
  }
3497
- class _t {
3493
+ class tr {
3498
3494
  constructor(e, t, o) {
3499
3495
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
3500
3496
  }
@@ -3515,11 +3511,11 @@ class pe {
3515
3511
  i(this, "step", (e) => {
3516
3512
  this.applier.apply(e);
3517
3513
  });
3518
- this.win = o, this.applier = new _t(e, t.algorithm, {
3514
+ this.win = o, this.applier = new tr(e, t.algorithm, {
3519
3515
  staticNodeResolver: t.staticNodeResolver,
3520
3516
  onBeforeApplied: t.onBeforeApplied,
3521
3517
  onAfterApplied: t.onAfterApplied
3522
- }), new Zt(this.win, this.step);
3518
+ }), new er(this.win, this.step);
3523
3519
  }
3524
3520
  static configure(e, t, o) {
3525
3521
  new pe(e, t, o);
@@ -3568,7 +3564,7 @@ class we {
3568
3564
  );
3569
3565
  }
3570
3566
  }
3571
- class ye {
3567
+ class fe {
3572
3568
  constructor(e, t, o, s, n) {
3573
3569
  i(this, "configurator");
3574
3570
  i(this, "selectionHandledTag", se);
@@ -3602,7 +3598,7 @@ class ye {
3602
3598
  ), 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);
3603
3599
  }
3604
3600
  static configure(e, t, o, s, n) {
3605
- new ye(
3601
+ new fe(
3606
3602
  e,
3607
3603
  t,
3608
3604
  o,
@@ -3611,7 +3607,7 @@ class ye {
3611
3607
  );
3612
3608
  }
3613
3609
  }
3614
- class fe {
3610
+ class ye {
3615
3611
  constructor(e, t, o, s, n, a) {
3616
3612
  i(this, "configurator");
3617
3613
  i(this, "onCanvasSelected");
@@ -3632,7 +3628,7 @@ class fe {
3632
3628
  });
3633
3629
  }
3634
3630
  static configure(e, t, o, s, n, a) {
3635
- new fe(
3631
+ new ye(
3636
3632
  e,
3637
3633
  t,
3638
3634
  o,
@@ -3642,23 +3638,23 @@ class fe {
3642
3638
  );
3643
3639
  }
3644
3640
  }
3645
- const qt = () => {
3641
+ const rr = () => {
3646
3642
  const r = document.createElement("div");
3647
3643
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3648
3644
  }, Q = () => {
3649
3645
  const r = document.createElement("div");
3650
3646
  return r.style.position = "absolute", r.style.inset = "0", r;
3651
- }, be = () => {
3647
+ }, Ce = () => {
3652
3648
  const r = Q();
3653
3649
  return r.style.pointerEvents = "none", r;
3654
3650
  };
3655
- class er {
3651
+ class or {
3656
3652
  constructor(e) {
3657
3653
  i(this, "background", Q());
3658
3654
  i(this, "main", Q());
3659
- i(this, "overlayConnectablePorts", be());
3660
- i(this, "overlayDraggableEdges", be());
3661
- i(this, "host", qt());
3655
+ i(this, "overlayConnectablePorts", Ce());
3656
+ i(this, "overlayDraggableEdges", Ce());
3657
+ i(this, "host", rr());
3662
3658
  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);
3663
3659
  }
3664
3660
  destroy() {
@@ -3683,16 +3679,16 @@ const b = Object.freeze({
3683
3679
  mouseDownEventVerifier: (r) => r.button === 0,
3684
3680
  mouseUpEventVerifier: (r) => r.button === 0,
3685
3681
  movementThreshold: 10
3686
- }), N = () => {
3687
- }, je = (r, e, t) => r === "closest-connectable-port" ? new Yt(
3682
+ }), P = () => {
3683
+ }, Qe = (r, e, t) => r === "closest-connectable-port" ? new jt(
3688
3684
  e,
3689
3685
  t
3690
- ) : new Xt(r), ve = (r) => {
3686
+ ) : new Jt(r), ve = (r) => {
3691
3687
  if (typeof r == "function")
3692
3688
  return r;
3693
3689
  switch (r.type) {
3694
3690
  case "straight":
3695
- return () => new Ft({
3691
+ return () => new Bt({
3696
3692
  color: r.color,
3697
3693
  width: r.width,
3698
3694
  arrowLength: r.arrowLength,
@@ -3706,7 +3702,7 @@ const b = Object.freeze({
3706
3702
  detourDirection: r.detourDirection
3707
3703
  });
3708
3704
  case "horizontal":
3709
- return () => new It({
3705
+ return () => new $t({
3710
3706
  color: r.color,
3711
3707
  width: r.width,
3712
3708
  arrowLength: r.arrowLength,
@@ -3719,7 +3715,7 @@ const b = Object.freeze({
3719
3715
  detourDistance: r.detourDistance
3720
3716
  });
3721
3717
  case "vertical":
3722
- return () => new Ut({
3718
+ return () => new Ot({
3723
3719
  color: r.color,
3724
3720
  width: r.width,
3725
3721
  arrowLength: r.arrowLength,
@@ -3732,7 +3728,7 @@ const b = Object.freeze({
3732
3728
  detourDistance: r.detourDistance
3733
3729
  });
3734
3730
  case "direct":
3735
- return () => new Be({
3731
+ return () => new ze({
3736
3732
  color: r.color,
3737
3733
  width: r.width,
3738
3734
  arrowLength: r.arrowLength,
@@ -3743,7 +3739,7 @@ const b = Object.freeze({
3743
3739
  targetOffset: r.targetOffset
3744
3740
  });
3745
3741
  default:
3746
- return () => new Vt({
3742
+ return () => new Ut({
3747
3743
  color: r.color,
3748
3744
  width: r.width,
3749
3745
  arrowLength: r.arrowLength,
@@ -3757,9 +3753,9 @@ const b = Object.freeze({
3757
3753
  detourDirection: r.detourDirection
3758
3754
  });
3759
3755
  }
3760
- }, tr = (r) => {
3761
- var u, g, l, p, w, y;
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;
3756
+ }, sr = (r) => {
3757
+ var l, u, g, p, w, f;
3758
+ const e = r.nodeDragVerifier ?? (() => !0), t = r.moveOnTop !== !1, o = r.moveEdgesOnTop !== !1 && t, s = (l = r.mouse) == null ? void 0 : l.dragCursor, n = s !== void 0 ? s : "grab", a = (u = r.mouse) == null ? void 0 : u.mouseDownEventVerifier, h = a !== void 0 ? a : (y) => y.button === 0, d = (g = r.mouse) == null ? void 0 : g.mouseUpEventVerifier, c = d !== void 0 ? d : (y) => y.button === 0;
3763
3759
  return {
3764
3760
  moveOnTop: t,
3765
3761
  moveEdgesOnTop: o,
@@ -3767,43 +3763,43 @@ const b = Object.freeze({
3767
3763
  gridSize: r.gridSize ?? null,
3768
3764
  mouseDownEventVerifier: h,
3769
3765
  mouseUpEventVerifier: c,
3770
- onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? N,
3771
- onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? N,
3766
+ onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? P,
3767
+ onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? P,
3772
3768
  nodeDragVerifier: e,
3773
- onNodeDragFinished: ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? N
3769
+ onNodeDragFinished: ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? P
3774
3770
  };
3775
- }, rr = (r) => {
3771
+ }, ir = (r) => {
3776
3772
  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;
3777
3773
  return (n) => {
3778
3774
  let a = n.nextTransform.x, h = n.nextTransform.y;
3779
3775
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3780
3776
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3781
3777
  a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < o && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, o));
3782
- const u = n.canvasHeight * n.prevTransform.scale, g = s - u;
3783
- return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
3778
+ const l = n.canvasHeight * n.prevTransform.scale, u = s - l;
3779
+ return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
3784
3780
  };
3785
- }, or = (r) => {
3781
+ }, nr = (r) => {
3786
3782
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3787
3783
  return (n) => {
3788
3784
  const a = n.prevTransform, h = n.nextTransform;
3789
- let d = h.scale, c = h.x, u = h.y;
3785
+ let d = h.scale, c = h.x, l = h.y;
3790
3786
  if (h.scale > s && h.scale > a.scale) {
3791
- d = Math.max(a.scale, s), c = a.x, u = a.y;
3792
- const g = (d - a.scale) / (h.scale - a.scale);
3793
- c = a.x + (h.x - a.x) * g, u = a.y + (h.y - a.y) * g;
3787
+ d = Math.max(a.scale, s), c = a.x, l = a.y;
3788
+ const u = (d - a.scale) / (h.scale - a.scale);
3789
+ c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
3794
3790
  }
3795
3791
  if (h.scale < o && h.scale < a.scale) {
3796
- d = Math.min(a.scale, o), c = a.x, u = a.y;
3797
- const g = (d - a.scale) / (h.scale - a.scale);
3798
- c = a.x + (h.x - a.x) * g, u = a.y + (h.y - a.y) * g;
3792
+ d = Math.min(a.scale, o), c = a.x, l = a.y;
3793
+ const u = (d - a.scale) / (h.scale - a.scale);
3794
+ c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
3799
3795
  }
3800
3796
  return {
3801
3797
  scale: d,
3802
3798
  x: c,
3803
- y: u
3799
+ y: l
3804
3800
  };
3805
3801
  };
3806
- }, sr = (r) => (e) => r.reduce(
3802
+ }, ar = (r) => (e) => r.reduce(
3807
3803
  (t, o) => o({
3808
3804
  prevTransform: e.prevTransform,
3809
3805
  nextTransform: t,
@@ -3811,59 +3807,59 @@ const b = Object.freeze({
3811
3807
  canvasHeight: e.canvasHeight
3812
3808
  }),
3813
3809
  e.nextTransform
3814
- ), Ne = (r) => {
3810
+ ), Te = (r) => {
3815
3811
  if (typeof r == "function")
3816
3812
  return r;
3817
3813
  switch (r.type) {
3818
3814
  case "scale-limit":
3819
- return or({
3815
+ return nr({
3820
3816
  minContentScale: r.minContentScale ?? 0,
3821
3817
  maxContentScale: r.maxContentScale ?? 1 / 0
3822
3818
  });
3823
3819
  case "shift-limit":
3824
- return rr({
3820
+ return ir({
3825
3821
  minX: r.minX ?? -1 / 0,
3826
3822
  maxX: r.maxX ?? 1 / 0,
3827
3823
  minY: r.minY ?? -1 / 0,
3828
3824
  maxY: r.maxY ?? 1 / 0
3829
3825
  });
3830
3826
  }
3831
- }, Pe = (r) => {
3832
- var l, p, w, y, f, x, E, P, T, D, F, U;
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;
3827
+ }, Me = (r) => {
3828
+ var g, p, w, f, y, E, x, N, T, D, F, U;
3829
+ const e = (g = r == null ? void 0 : r.scale) == null ? void 0 : g.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3834
3830
  let s;
3835
- o !== void 0 ? Array.isArray(o) ? s = sr(
3831
+ o !== void 0 ? Array.isArray(o) ? s = ar(
3836
3832
  o.map(
3837
- (R) => Ne(R)
3833
+ (R) => Te(R)
3838
3834
  )
3839
- ) : s = Ne(o) : s = (R) => R.nextTransform;
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;
3835
+ ) : s = Te(o) : s = (R) => R.nextTransform;
3836
+ 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 = (f = r == null ? void 0 : r.shift) == null ? void 0 : f.mouseUpEventVerifier, c = d !== void 0 ? d : (R) => R.button === 0, l = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelEventVerifier, u = l !== void 0 ? l : () => !0;
3841
3837
  return {
3842
3838
  wheelSensitivity: t,
3843
- onTransformStarted: ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformStarted) ?? N,
3844
- onTransformFinished: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformFinished) ?? 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,
3839
+ onTransformStarted: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformStarted) ?? P,
3840
+ onTransformFinished: ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformFinished) ?? P,
3841
+ onBeforeTransformChange: ((N = r == null ? void 0 : r.events) == null ? void 0 : N.onBeforeTransformChange) ?? P,
3842
+ onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ?? P,
3847
3843
  transformPreprocessor: s,
3848
3844
  shiftCursor: n,
3849
3845
  mouseDownEventVerifier: h,
3850
3846
  mouseUpEventVerifier: c,
3851
- mouseWheelEventVerifier: g,
3847
+ mouseWheelEventVerifier: u,
3852
3848
  scaleWheelFinishTimeout: ((D = r == null ? void 0 : r.scale) == null ? void 0 : D.wheelFinishTimeout) ?? 500,
3853
- onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ?? N,
3854
- onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ?? N
3849
+ onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ?? P,
3850
+ onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ?? P
3855
3851
  };
3856
- }, ir = (r, e) => {
3852
+ }, hr = (r, e) => {
3857
3853
  const t = document.createElementNS(
3858
3854
  "http://www.w3.org/2000/svg",
3859
3855
  "circle"
3860
3856
  );
3861
3857
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3862
- }, nr = (r) => r instanceof SVGElement ? r : ir(
3858
+ }, dr = (r) => r instanceof SVGElement ? r : hr(
3863
3859
  (r == null ? void 0 : r.radius) ?? 1.5,
3864
3860
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
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 ?? {});
3861
+ ), cr = (r) => {
3862
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = dr(r.renderer ?? {});
3867
3863
  return {
3868
3864
  tileWidth: t,
3869
3865
  tileHeight: o,
@@ -3875,13 +3871,13 @@ const b = Object.freeze({
3875
3871
  connectionPreprocessor: (r) => r,
3876
3872
  connectionAllowedVerifier: () => !0,
3877
3873
  mouseEventVerifier: (r) => r.button === 0
3878
- }), hr = (r, e, t) => {
3874
+ }), lr = (r, e, t) => {
3879
3875
  var s, n, a;
3880
3876
  const o = r.connectionAllowedVerifier ?? $.connectionAllowedVerifier;
3881
3877
  return {
3882
3878
  connectionTypeResolver: r.connectionTypeResolver ?? $.connectionTypeResolver,
3883
3879
  connectionAllowedVerifier: o,
3884
- draggingPortDirectionResolver: je(
3880
+ draggingPortDirectionResolver: Qe(
3885
3881
  r.dragPortDirection,
3886
3882
  t,
3887
3883
  o
@@ -3890,9 +3886,9 @@ const b = Object.freeze({
3890
3886
  connectionPreprocessor: r.connectionPreprocessor ?? $.connectionPreprocessor,
3891
3887
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? $.mouseEventVerifier,
3892
3888
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? $.mouseEventVerifier,
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
3889
+ onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ?? P,
3890
+ onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ?? P,
3891
+ onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? P
3896
3892
  };
3897
3893
  }, z = Object.freeze({
3898
3894
  connectionAllowedVerifier: () => !0,
@@ -3900,7 +3896,7 @@ const b = Object.freeze({
3900
3896
  // TODO: remove ctrl key
3901
3897
  mouseDownEventVerifier: (r) => r.button === 0 && r.ctrlKey,
3902
3898
  mouseUpEventVerifier: (r) => r.button === 0
3903
- }), dr = (r, e) => {
3899
+ }), ur = (r, e) => {
3904
3900
  var s, n, a;
3905
3901
  const t = (h) => {
3906
3902
  const d = e.getPortAdjacentEdgeIds(h);
@@ -3913,32 +3909,32 @@ const b = Object.freeze({
3913
3909
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? z.mouseUpEventVerifier,
3914
3910
  draggingEdgeResolver: r.draggingEdgeResolver ?? t,
3915
3911
  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(
3912
+ onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ?? P,
3913
+ onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ?? P,
3914
+ onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ?? P,
3915
+ draggingPortDirectionResolver: Qe(
3920
3916
  r.dragPortDirection,
3921
3917
  e,
3922
3918
  o
3923
3919
  )
3924
3920
  };
3925
- }, cr = (r) => ({
3921
+ }, gr = (r) => ({
3926
3922
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3927
3923
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3928
- }), lr = (r) => {
3924
+ }), pr = (r) => {
3929
3925
  var e, t;
3930
3926
  return {
3931
- onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? N,
3932
- onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? N
3927
+ onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? P,
3928
+ onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? P
3933
3929
  };
3934
3930
  };
3935
- class ur extends Error {
3931
+ class wr extends Error {
3936
3932
  constructor() {
3937
3933
  super(...arguments);
3938
3934
  i(this, "name", "CanvasBuilderError");
3939
3935
  }
3940
3936
  }
3941
- class Je {
3937
+ class Ze {
3942
3938
  constructor(e, t, o) {
3943
3939
  i(this, "dt");
3944
3940
  i(this, "nodeMass");
@@ -3971,12 +3967,12 @@ class Je {
3971
3967
  const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), n = this.graph.getPort(o.to), a = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3972
3968
  a,
3973
3969
  h
3974
- ), u = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, g = d.ex * u, l = d.ey * u, p = e.get(s.nodeId), w = e.get(n.nodeId);
3975
- p.x += g, p.y += l, w.x -= g, w.y -= l;
3970
+ ), l = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * l, g = d.ey * l, p = e.get(s.nodeId), w = e.get(n.nodeId);
3971
+ p.x += u, p.y += g, w.x -= u, w.y -= g;
3976
3972
  });
3977
3973
  }
3978
3974
  }
3979
- class Ke {
3975
+ class _e {
3980
3976
  constructor(e) {
3981
3977
  i(this, "PI2", 2 * Math.PI);
3982
3978
  this.rand = e;
@@ -3995,13 +3991,13 @@ class Ke {
3995
3991
  return { ex: h, ey: d, d: a };
3996
3992
  }
3997
3993
  }
3998
- const Qe = (r) => {
3994
+ const qe = (r) => {
3999
3995
  if (r.distance === 0)
4000
3996
  return r.maxForce;
4001
3997
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
4002
3998
  return Math.min(e, r.maxForce);
4003
3999
  };
4004
- class gr {
4000
+ class fr {
4005
4001
  constructor(e) {
4006
4002
  i(this, "nodeCharge");
4007
4003
  i(this, "distanceVectorGenerator");
@@ -4013,22 +4009,22 @@ class gr {
4013
4009
  for (let n = 0; n < s; n++) {
4014
4010
  const a = o[n];
4015
4011
  for (let h = n + 1; h < s; h++) {
4016
- const d = o[h], c = e.get(a), u = e.get(d), g = this.distanceVectorGenerator.create(
4012
+ const d = o[h], c = e.get(a), l = e.get(d), u = this.distanceVectorGenerator.create(
4017
4013
  c,
4018
- u
4019
- ), l = Qe({
4014
+ l
4015
+ ), g = qe({
4020
4016
  coefficient: 1,
4021
4017
  sourceCharge: this.nodeCharge,
4022
4018
  targetCharge: this.nodeCharge,
4023
- distance: g.d,
4019
+ distance: u.d,
4024
4020
  maxForce: this.maxForce
4025
- }), p = l * g.ex, w = l * g.ey, y = t.get(a), f = t.get(d);
4026
- y.x -= p, y.y -= w, f.x += p, f.y += w;
4021
+ }), p = g * u.ex, w = g * u.ey, f = t.get(a), y = t.get(d);
4022
+ f.x -= p, f.y -= w, y.x += p, y.y += w;
4027
4023
  }
4028
4024
  }
4029
4025
  }
4030
4026
  }
4031
- const pr = (r) => {
4027
+ const yr = (r) => {
4032
4028
  if (r.size === 0)
4033
4029
  return {
4034
4030
  centerX: 0,
@@ -4046,7 +4042,7 @@ const pr = (r) => {
4046
4042
  radius: h / 2
4047
4043
  };
4048
4044
  };
4049
- class wr {
4045
+ class vr {
4050
4046
  constructor(e) {
4051
4047
  i(this, "root");
4052
4048
  i(this, "leaves", /* @__PURE__ */ new Map());
@@ -4100,19 +4096,19 @@ class wr {
4100
4096
  return this.setLeaf(e), [];
4101
4097
  this.sortedParentNodes.push(e);
4102
4098
  const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
4103
- e.nodeIds.forEach((l) => {
4104
- const { x: p, y: w } = this.coords.get(l);
4105
- p < t ? w < o ? d.add(l) : h.add(l) : w < o ? a.add(l) : n.add(l), e.nodeIds.delete(l);
4099
+ e.nodeIds.forEach((g) => {
4100
+ const { x: p, y: w } = this.coords.get(g);
4101
+ p < t ? w < o ? d.add(g) : h.add(g) : w < o ? a.add(g) : n.add(g), e.nodeIds.delete(g);
4106
4102
  });
4107
- const u = {
4103
+ const l = {
4108
4104
  parent: e,
4109
4105
  lb: null,
4110
4106
  lt: null,
4111
4107
  rb: null,
4112
4108
  rt: null
4113
- }, g = [];
4109
+ }, u = [];
4114
4110
  if (n.size > 0) {
4115
- const l = {
4111
+ const g = {
4116
4112
  nodeIds: n,
4117
4113
  totalMass: 0,
4118
4114
  totalCharge: 0,
@@ -4125,12 +4121,12 @@ class wr {
4125
4121
  centerY: o + c,
4126
4122
  radius: c
4127
4123
  },
4128
- ...u
4124
+ ...l
4129
4125
  };
4130
- e.rt = l, g.push(l);
4126
+ e.rt = g, u.push(g);
4131
4127
  }
4132
4128
  if (a.size > 0) {
4133
- const l = {
4129
+ const g = {
4134
4130
  nodeIds: a,
4135
4131
  totalMass: 0,
4136
4132
  totalCharge: 0,
@@ -4143,12 +4139,12 @@ class wr {
4143
4139
  centerY: o - c,
4144
4140
  radius: c
4145
4141
  },
4146
- ...u
4142
+ ...l
4147
4143
  };
4148
- e.rb = l, g.push(l);
4144
+ e.rb = g, u.push(g);
4149
4145
  }
4150
4146
  if (h.size > 0) {
4151
- const l = {
4147
+ const g = {
4152
4148
  nodeIds: h,
4153
4149
  totalMass: 0,
4154
4150
  totalCharge: 0,
@@ -4161,12 +4157,12 @@ class wr {
4161
4157
  centerY: o + c,
4162
4158
  radius: c
4163
4159
  },
4164
- ...u
4160
+ ...l
4165
4161
  };
4166
- e.lt = l, g.push(l);
4162
+ e.lt = g, u.push(g);
4167
4163
  }
4168
4164
  if (d.size > 0) {
4169
- const l = {
4165
+ const g = {
4170
4166
  nodeIds: d,
4171
4167
  totalMass: 0,
4172
4168
  totalCharge: 0,
@@ -4179,11 +4175,11 @@ class wr {
4179
4175
  centerY: o - c,
4180
4176
  radius: c
4181
4177
  },
4182
- ...u
4178
+ ...l
4183
4179
  };
4184
- e.lb = l, g.push(l);
4180
+ e.lb = g, u.push(g);
4185
4181
  }
4186
- return g;
4182
+ return u;
4187
4183
  }
4188
4184
  setLeaf(e) {
4189
4185
  e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
@@ -4203,7 +4199,7 @@ class wr {
4203
4199
  }), { x: t / e.size, y: o / e.size };
4204
4200
  }
4205
4201
  }
4206
- class yr {
4202
+ class mr {
4207
4203
  constructor(e) {
4208
4204
  i(this, "areaRadiusThreshold");
4209
4205
  i(this, "nodeMass");
@@ -4215,7 +4211,7 @@ class yr {
4215
4211
  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;
4216
4212
  }
4217
4213
  apply(e, t) {
4218
- const o = pr(e), s = new wr({
4214
+ const o = yr(e), s = new vr({
4219
4215
  box: o,
4220
4216
  coords: e,
4221
4217
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -4330,7 +4326,7 @@ class yr {
4330
4326
  const t = this.distanceVectorGenerator.create(
4331
4327
  e.sourceCoords,
4332
4328
  e.targetCoords
4333
- ), o = Qe({
4329
+ ), o = qe({
4334
4330
  coefficient: this.nodeForceCoefficient,
4335
4331
  sourceCharge: e.sourceCharge,
4336
4332
  targetCharge: e.targetCharge,
@@ -4365,7 +4361,7 @@ class yr {
4365
4361
  }
4366
4362
  }
4367
4363
  }
4368
- const Ze = (r) => r.theta !== 0 ? new yr({
4364
+ const et = (r) => r.theta !== 0 ? new mr({
4369
4365
  nodeCharge: r.nodeCharge,
4370
4366
  nodeForceCoefficient: r.nodeForceCoefficient,
4371
4367
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -4373,13 +4369,13 @@ const Ze = (r) => r.theta !== 0 ? new yr({
4373
4369
  theta: r.theta,
4374
4370
  nodeMass: r.nodeMass,
4375
4371
  areaRadiusThreshold: r.areaRadiusThreshold
4376
- }) : new gr({
4372
+ }) : new fr({
4377
4373
  nodeCharge: r.nodeCharge,
4378
4374
  nodeForceCoefficient: r.nodeForceCoefficient,
4379
4375
  distanceVectorGenerator: r.distanceVectorGenerator,
4380
4376
  maxForce: r.maxForce
4381
4377
  });
4382
- class _e {
4378
+ class tt {
4383
4379
  constructor(e) {
4384
4380
  i(this, "rand");
4385
4381
  i(this, "sparsity");
@@ -4387,22 +4383,22 @@ class _e {
4387
4383
  }
4388
4384
  calculateCoordinates(e) {
4389
4385
  const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((w) => {
4390
- const y = t.getNode(w);
4391
- return y.x === null || y.y === null;
4392
- }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, u = o.createContentCoords(c), g = a / 2, l = {
4393
- x: u.x - g,
4394
- y: u.y - g
4386
+ const f = t.getNode(w);
4387
+ return f.x === null || f.y === null;
4388
+ }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, l = o.createContentCoords(c), u = a / 2, g = {
4389
+ x: l.x - u,
4390
+ y: l.y - u
4395
4391
  };
4396
4392
  return t.getAllNodeIds().forEach((w) => {
4397
- const y = t.getNode(w);
4393
+ const f = t.getNode(w);
4398
4394
  s.set(w, {
4399
- x: y.x ?? l.x + a * this.rand(),
4400
- y: y.y ?? l.y + a * this.rand()
4395
+ x: f.x ?? g.x + a * this.rand(),
4396
+ y: f.y ?? g.y + a * this.rand()
4401
4397
  });
4402
4398
  }), s;
4403
4399
  }
4404
4400
  }
4405
- class fr {
4401
+ class Er {
4406
4402
  constructor(e) {
4407
4403
  i(this, "distanceVectorGenerator");
4408
4404
  i(this, "nodeForcesApplicationStrategy");
@@ -4413,7 +4409,7 @@ class fr {
4413
4409
  i(this, "edgeEquilibriumLength");
4414
4410
  i(this, "edgeStiffness");
4415
4411
  i(this, "convergenceVelocity");
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({
4412
+ 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 _e(e.rand), this.nodeForcesApplicationStrategy = et({
4417
4413
  distanceVectorGenerator: this.distanceVectorGenerator,
4418
4414
  nodeCharge: e.nodeCharge,
4419
4415
  maxForce: e.maxForce,
@@ -4421,7 +4417,7 @@ class fr {
4421
4417
  theta: e.barnesHutTheta,
4422
4418
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4423
4419
  nodeMass: e.nodeMass
4424
- }), this.fillerLayoutAlgorithm = new _e({
4420
+ }), this.fillerLayoutAlgorithm = new tt({
4425
4421
  rand: e.rand,
4426
4422
  sparsity: e.edgeEquilibriumLength
4427
4423
  });
@@ -4431,7 +4427,7 @@ class fr {
4431
4427
  graph: t,
4432
4428
  viewport: o
4433
4429
  });
4434
- for (let n = 0; n < this.maxIterations && !(new Je(
4430
+ for (let n = 0; n < this.maxIterations && !(new Ze(
4435
4431
  t,
4436
4432
  s,
4437
4433
  {
@@ -4447,7 +4443,7 @@ class fr {
4447
4443
  return s;
4448
4444
  }
4449
4445
  }
4450
- class vr {
4446
+ class xr {
4451
4447
  constructor(e, t) {
4452
4448
  i(this, "forest", /* @__PURE__ */ new Set());
4453
4449
  i(this, "remainingNodeIds");
@@ -4488,7 +4484,7 @@ class vr {
4488
4484
  }
4489
4485
  }
4490
4486
  }
4491
- class mr {
4487
+ class Ar {
4492
4488
  constructor(e) {
4493
4489
  this.params = e;
4494
4490
  }
@@ -4496,17 +4492,17 @@ class mr {
4496
4492
  let t = 0;
4497
4493
  const o = [], s = e.length - 1, n = [];
4498
4494
  e.forEach((h, d) => {
4499
- if (t += this.params.spaceAroundRadius, h.forEach((c, u) => {
4500
- n[u] === void 0 ? n[u] = {
4495
+ if (t += this.params.spaceAroundRadius, h.forEach((c, l) => {
4496
+ n[l] === void 0 ? n[l] = {
4501
4497
  start: t + c.start,
4502
4498
  end: t + c.end
4503
- } : n[u].end = t + c.end;
4499
+ } : n[l].end = t + c.end;
4504
4500
  }), o.push(t), d !== s) {
4505
- const c = e[d + 1], u = n.map((g) => ({
4506
- start: g.start - t,
4507
- end: g.end - t
4501
+ const c = e[d + 1], l = n.map((u) => ({
4502
+ start: u.start - t,
4503
+ end: u.end - t
4508
4504
  }));
4509
- t += this.calculateMaxDiff(u, c);
4505
+ t += this.calculateMaxDiff(l, c);
4510
4506
  }
4511
4507
  t += this.params.spaceAroundRadius;
4512
4508
  });
@@ -4529,12 +4525,12 @@ class mr {
4529
4525
  return o - 2 * this.params.spaceAroundRadius;
4530
4526
  }
4531
4527
  }
4532
- class xr {
4528
+ class Sr {
4533
4529
  constructor(e, t) {
4534
4530
  i(this, "offsets", /* @__PURE__ */ new Map());
4535
4531
  i(this, "treeSpans", /* @__PURE__ */ new Map());
4536
4532
  this.tree = e;
4537
- const o = t.spaceAroundRadius, s = new mr({
4533
+ const o = t.spaceAroundRadius, s = new Ar({
4538
4534
  spaceAroundRadius: o
4539
4535
  });
4540
4536
  [...this.tree.sequence].reverse().forEach((n) => {
@@ -4556,40 +4552,40 @@ class xr {
4556
4552
  return this.offsets;
4557
4553
  }
4558
4554
  }
4559
- class Er {
4555
+ class br {
4560
4556
  constructor(e) {
4561
4557
  this.params = e;
4562
4558
  }
4563
4559
  calculateCoordinates(e) {
4564
- const t = /* @__PURE__ */ new Map(), s = new vr(
4560
+ const t = /* @__PURE__ */ new Map(), s = new xr(
4565
4561
  e.graph,
4566
4562
  this.params.nextLayerNodesResolver
4567
4563
  ).generate();
4568
4564
  let n = 0;
4569
4565
  return s.forEach((a) => {
4570
4566
  t.set(a.root.nodeId, { x: n, y: 0 });
4571
- const d = new xr(a, {
4567
+ const d = new Sr(a, {
4572
4568
  spaceAroundRadius: this.params.layerSpace / 2
4573
4569
  }).generate();
4574
4570
  let c = [a.root];
4575
4571
  for (; c.length > 0; ) {
4576
- const u = [];
4577
- n += this.params.layerWidth, c.forEach((g) => {
4578
- g.children.forEach((l) => {
4579
- const p = t.get(g.nodeId).y;
4580
- t.set(l.nodeId, {
4581
- y: p + d.get(l.nodeId),
4572
+ const l = [];
4573
+ n += this.params.layerWidth, c.forEach((u) => {
4574
+ u.children.forEach((g) => {
4575
+ const p = t.get(u.nodeId).y;
4576
+ t.set(g.nodeId, {
4577
+ y: p + d.get(g.nodeId),
4582
4578
  x: n
4583
- }), u.push(l);
4579
+ }), l.push(g);
4584
4580
  });
4585
- }), c = u;
4581
+ }), c = l;
4586
4582
  }
4587
4583
  }), t.forEach((a, h) => {
4588
4584
  t.set(h, this.params.transform(a));
4589
4585
  }), t;
4590
4586
  }
4591
4587
  }
4592
- const Ar = (r) => {
4588
+ const Pr = (r) => {
4593
4589
  const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
4594
4590
  const a = e.getEdge(n);
4595
4591
  return e.getPort(a.to).nodeId;
@@ -4598,20 +4594,20 @@ const Ar = (r) => {
4598
4594
  return e.getPort(a.from).nodeId;
4599
4595
  });
4600
4596
  return /* @__PURE__ */ new Set([...o, ...s]);
4601
- }, Sr = (r) => {
4597
+ }, Nr = (r) => {
4602
4598
  const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
4603
4599
  const n = e.getEdge(s);
4604
4600
  return e.getPort(n.to).nodeId;
4605
4601
  });
4606
4602
  return new Set(o);
4607
- }, br = (r) => {
4603
+ }, Cr = (r) => {
4608
4604
  const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
4609
4605
  const n = e.getEdge(s);
4610
4606
  return e.getPort(n.from).nodeId;
4611
4607
  });
4612
4608
  return new Set(o);
4613
4609
  };
4614
- class Nr {
4610
+ class Tr {
4615
4611
  constructor(e) {
4616
4612
  i(this, "distanceVectorGenerator");
4617
4613
  i(this, "nodeForcesApplicationStrategy");
@@ -4621,7 +4617,7 @@ class Nr {
4621
4617
  i(this, "edgeEquilibriumLength");
4622
4618
  i(this, "edgeStiffness");
4623
4619
  i(this, "fillerLayoutAlgorithm");
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({
4620
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new _e(e.rand), this.nodeForcesApplicationStrategy = et({
4625
4621
  distanceVectorGenerator: this.distanceVectorGenerator,
4626
4622
  nodeCharge: e.nodeCharge,
4627
4623
  maxForce: e.maxForce,
@@ -4629,7 +4625,7 @@ class Nr {
4629
4625
  theta: e.barnesHutTheta,
4630
4626
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4631
4627
  nodeMass: e.nodeMass
4632
- }), this.fillerLayoutAlgorithm = new _e({
4628
+ }), this.fillerLayoutAlgorithm = new tt({
4633
4629
  rand: e.rand,
4634
4630
  sparsity: e.edgeEquilibriumLength
4635
4631
  });
@@ -4639,7 +4635,7 @@ class Nr {
4639
4635
  graph: t,
4640
4636
  viewport: o
4641
4637
  });
4642
- return new Je(
4638
+ return new Ze(
4643
4639
  t,
4644
4640
  n,
4645
4641
  {
@@ -4651,28 +4647,28 @@ class Nr {
4651
4647
  edgeStiffness: this.edgeStiffness
4652
4648
  }
4653
4649
  ).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
4654
- const u = t.getNode(c);
4655
- return u.x === null || u.y === null;
4650
+ const l = t.getNode(c);
4651
+ return l.x === null || l.y === null;
4656
4652
  }) ? /* @__PURE__ */ new Map() : n;
4657
4653
  }
4658
4654
  }
4659
- const qe = (r) => {
4655
+ const rt = (r) => {
4660
4656
  let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
4661
4657
  for (let n = 0, a; n < r.length; n++)
4662
4658
  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);
4663
4659
  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];
4664
- }, et = (r, e, t, o) => function() {
4660
+ }, ot = (r, e, t, o) => function() {
4665
4661
  r |= 0, e |= 0, t |= 0, o |= 0;
4666
4662
  const s = (r + e | 0) + o | 0;
4667
4663
  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;
4668
- }, Pr = (r) => {
4664
+ }, Mr = (r) => {
4669
4665
  var e, t;
4670
4666
  switch (r == null ? void 0 : r.type) {
4671
4667
  case "custom":
4672
4668
  return r.instance;
4673
4669
  default: {
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({
4670
+ const o = rt((r == null ? void 0 : r.seed) ?? b.seed), s = ot(o[0], o[1], o[2], o[3]);
4671
+ return new Tr({
4676
4672
  rand: s,
4677
4673
  maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? b.maxTimeDeltaSec,
4678
4674
  nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
@@ -4687,25 +4683,25 @@ const qe = (r) => {
4687
4683
  });
4688
4684
  }
4689
4685
  }
4690
- }, Cr = {
4686
+ }, Dr = {
4691
4687
  staticNodeResolver: () => !1
4692
- }, Tr = (r) => {
4688
+ }, Rr = (r) => {
4693
4689
  var t, o;
4694
4690
  return {
4695
- algorithm: Pr((r == null ? void 0 : r.algorithm) ?? {}),
4696
- staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Cr.staticNodeResolver,
4697
- onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? N,
4698
- onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? N
4691
+ algorithm: Mr((r == null ? void 0 : r.algorithm) ?? {}),
4692
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Dr.staticNodeResolver,
4693
+ onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? P,
4694
+ onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? P
4699
4695
  };
4700
- }, Mr = (r) => r instanceof q ? {
4696
+ }, Lr = (r) => r instanceof q ? {
4701
4697
  type: "trigger",
4702
4698
  trigger: r
4703
4699
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
4704
4700
  type: "topologyChangeSchedule",
4705
- schedule: Wt
4701
+ schedule: Ht
4706
4702
  } : {
4707
4703
  type: "topologyChangeSchedule",
4708
- schedule: zt
4704
+ schedule: Yt
4709
4705
  }, Z = Object.freeze({
4710
4706
  staticNodeResolver: () => !1,
4711
4707
  hierarchicalLayout: {
@@ -4719,7 +4715,7 @@ const qe = (r) => {
4719
4715
  d: r.d * e.a + r.e * e.d,
4720
4716
  e: r.d * e.b + r.e * e.e,
4721
4717
  f: r.d * e.c + r.e * e.f + r.f
4722
- }), Dr = (r) => {
4718
+ }), Vr = (r) => {
4723
4719
  const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
4724
4720
  return {
4725
4721
  a: n / h,
@@ -4730,7 +4726,7 @@ const qe = (r) => {
4730
4726
  f: (o * s - e * a) / h
4731
4727
  };
4732
4728
  };
4733
- class Rr {
4729
+ class Ir {
4734
4730
  resolve(e) {
4735
4731
  if ("shift" in e)
4736
4732
  return this.createShiftBaseMatrix(e.shift);
@@ -4774,7 +4770,7 @@ class Rr {
4774
4770
  const o = k(
4775
4771
  t,
4776
4772
  e
4777
- ), s = Dr(t);
4773
+ ), s = Vr(t);
4778
4774
  return k(o, s);
4779
4775
  }
4780
4776
  createShiftBaseMatrix(e) {
@@ -4819,7 +4815,7 @@ class Rr {
4819
4815
  };
4820
4816
  }
4821
4817
  }
4822
- const Lr = (r) => {
4818
+ const Fr = (r) => {
4823
4819
  if (r === void 0)
4824
4820
  return (s) => s;
4825
4821
  if (typeof r == "function")
@@ -4833,7 +4829,7 @@ const Lr = (r) => {
4833
4829
  e: 1,
4834
4830
  f: 0
4835
4831
  };
4836
- const o = new Rr();
4832
+ const o = new Ir();
4837
4833
  return e.forEach((s) => {
4838
4834
  const n = o.resolve(s);
4839
4835
  t = k(t, n);
@@ -4844,34 +4840,34 @@ const Lr = (r) => {
4844
4840
  y: t.d * n + t.e * a + t.f
4845
4841
  };
4846
4842
  };
4847
- }, Vr = (r) => {
4843
+ }, Ur = (r) => {
4848
4844
  if (typeof r == "function")
4849
4845
  return r;
4850
4846
  switch (r) {
4851
4847
  case "outgoing":
4852
- return Sr;
4848
+ return Nr;
4853
4849
  case "incoming":
4854
- return br;
4850
+ return Cr;
4855
4851
  default:
4856
- return Ar;
4852
+ return Pr;
4857
4853
  }
4858
- }, Ir = (r) => {
4854
+ }, $r = (r) => {
4859
4855
  var e, t;
4860
4856
  switch (r == null ? void 0 : r.type) {
4861
4857
  case "custom":
4862
4858
  return r.instance;
4863
4859
  case "hierarchical":
4864
- return new Er({
4860
+ return new br({
4865
4861
  layerWidth: r.layerWidth ?? Z.hierarchicalLayout.layerWidth,
4866
4862
  layerSpace: r.layerSpace ?? Z.hierarchicalLayout.layerSpace,
4867
- transform: Lr(r.transform),
4868
- nextLayerNodesResolver: Vr(
4863
+ transform: Fr(r.transform),
4864
+ nextLayerNodesResolver: Ur(
4869
4865
  r.nextLayerNodesResolver
4870
4866
  )
4871
4867
  });
4872
4868
  default: {
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({
4869
+ const o = rt((r == null ? void 0 : r.seed) ?? b.seed), s = ot(o[0], o[1], o[2], o[3]);
4870
+ return new Er({
4875
4871
  dtSec: (r == null ? void 0 : r.dtSec) ?? b.dtSec,
4876
4872
  maxIterations: (r == null ? void 0 : r.maxIterations) ?? b.maxIterations,
4877
4873
  rand: s,
@@ -4887,16 +4883,16 @@ const Lr = (r) => {
4887
4883
  });
4888
4884
  }
4889
4885
  }
4890
- }, Fr = (r) => {
4886
+ }, Br = (r) => {
4891
4887
  var e, t;
4892
4888
  return {
4893
- algorithm: Ir(r.algorithm),
4894
- applyOn: Mr(r.applyOn),
4889
+ algorithm: $r(r.algorithm),
4890
+ applyOn: Lr(r.applyOn),
4895
4891
  staticNodeResolver: r.staticNodeResolver ?? Z.staticNodeResolver,
4896
- onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? N,
4897
- onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? N
4892
+ onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? P,
4893
+ onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? P
4898
4894
  };
4899
- }, Ur = (r, e) => ({
4895
+ }, Or = (r, e) => ({
4900
4896
  ...r,
4901
4897
  onNodeDragStarted: (t) => {
4902
4898
  e.add(t), r.onNodeDragStarted(t);
@@ -4904,7 +4900,7 @@ const Lr = (r) => {
4904
4900
  onNodeDragFinished: (t) => {
4905
4901
  e.delete(t), r.onNodeDragFinished(t);
4906
4902
  }
4907
- }), $r = (r, e) => {
4903
+ }), Wr = (r, e) => {
4908
4904
  r.graph.onBeforeNodeRemoved.subscribe((t) => {
4909
4905
  e.delete(t);
4910
4906
  }), r.graph.onBeforeClear.subscribe(() => {
@@ -4912,28 +4908,28 @@ const Lr = (r) => {
4912
4908
  }), r.onBeforeDestroy.subscribe(() => {
4913
4909
  e.clear();
4914
4910
  });
4915
- }, Br = (r, e) => ({
4911
+ }, zr = (r, e) => ({
4916
4912
  ...r,
4917
4913
  staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
4918
- }), _ = (r) => () => r, Ce = _(0), Or = () => {
4914
+ }), _ = (r) => () => r, De = _(0), kr = () => {
4919
4915
  let r = 0;
4920
4916
  return () => r++;
4921
- }, Wr = (r, e) => {
4922
- let t = Ce, o = Ce;
4923
- const s = Or();
4917
+ }, Hr = (r, e) => {
4918
+ let t = De, o = De;
4919
+ const s = kr();
4924
4920
  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), {
4925
4921
  nodesPriorityFn: t,
4926
4922
  edgesPriorityFn: o
4927
4923
  };
4928
- }, zr = (r) => {
4924
+ }, Yr = (r) => {
4929
4925
  var t, o, s, n, a;
4930
- const e = Wr(
4926
+ const e = Hr(
4931
4927
  (t = r.nodes) == null ? void 0 : t.priority,
4932
4928
  (o = r.edges) == null ? void 0 : o.priority
4933
4929
  );
4934
4930
  return {
4935
4931
  nodes: {
4936
- centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Ve,
4932
+ centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Ue,
4937
4933
  priorityFn: e.nodesPriorityFn
4938
4934
  },
4939
4935
  ports: {
@@ -4944,9 +4940,9 @@ const Lr = (r) => {
4944
4940
  priorityFn: e.edgesPriorityFn
4945
4941
  }
4946
4942
  };
4947
- }, kr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Hr = (r) => {
4943
+ }, Xr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Gr = (r) => {
4948
4944
  var o, s, n, a;
4949
- const { canvasDefaults: e } = r, t = r.hasLayout ? kr(r.layoutParams) : oe;
4945
+ const { canvasDefaults: e } = r, t = r.hasLayout ? Xr(r.layoutParams) : oe;
4950
4946
  return {
4951
4947
  focus: {
4952
4948
  contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
@@ -4955,23 +4951,23 @@ const Lr = (r) => {
4955
4951
  animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
4956
4952
  }
4957
4953
  };
4958
- }, Yr = (r) => ({
4954
+ }, jr = (r) => ({
4959
4955
  onNodeSelected: r.onNodeSelected,
4960
4956
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4961
4957
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4962
4958
  movementThreshold: r.movementThreshold ?? L.movementThreshold
4963
- }), Xr = (r) => ({
4959
+ }), Jr = (r) => ({
4964
4960
  onCanvasSelected: r.onCanvasSelected,
4965
4961
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4966
4962
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4967
4963
  movementThreshold: r.movementThreshold ?? L.movementThreshold
4968
- }), Gr = (r) => ({
4964
+ }), Kr = (r) => ({
4969
4965
  onEdgeSelected: r.onEdgeSelected,
4970
4966
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4971
4967
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4972
4968
  movementThreshold: r.movementThreshold ?? L.movementThreshold
4973
4969
  });
4974
- class Kr {
4970
+ class _r {
4975
4971
  constructor(e) {
4976
4972
  i(this, "used", !1);
4977
4973
  i(this, "canvasDefaults", {});
@@ -4998,8 +4994,8 @@ class Kr {
4998
4994
  i(this, "window", window);
4999
4995
  i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
5000
4996
  i(this, "pointInsideVerifier");
5001
- i(this, "eventTagger", new Ht());
5002
- this.element = e, this.pointInsideVerifier = new pt(e, this.window);
4997
+ i(this, "eventTagger", new Gt());
4998
+ this.element = e, this.pointInsideVerifier = new yt(e, this.window);
5003
4999
  }
5004
5000
  setDefaults(e) {
5005
5001
  return this.canvasDefaults = e, this;
@@ -5042,45 +5038,45 @@ class Kr {
5042
5038
  }
5043
5039
  build() {
5044
5040
  if (this.used)
5045
- throw new ur(
5041
+ throw new wr(
5046
5042
  "Failed to build Canvas because CanvasBuilder is a single-use object"
5047
5043
  );
5048
5044
  this.used = !0;
5049
- const e = new lt(this.element), t = new De(), o = new er(this.element), s = this.createHtmlView(
5045
+ const e = new pt(this.element), t = new Ve(), o = new or(this.element), s = this.createHtmlView(
5050
5046
  o.main,
5051
5047
  t,
5052
5048
  e
5053
- ), n = zr(
5049
+ ), n = Yr(
5054
5050
  this.canvasDefaults
5055
- ), a = new ze(
5051
+ ), a = new Ye(
5056
5052
  t,
5057
5053
  s,
5058
5054
  n
5059
- ), h = Fr(this.layoutConfig), d = Hr({
5055
+ ), h = Br(this.layoutConfig), d = Gr({
5060
5056
  canvasDefaults: this.canvasDefaults,
5061
5057
  hasLayout: this.hasLayout,
5062
5058
  layoutParams: h
5063
- }), c = new Xe(
5059
+ }), c = new Je(
5064
5060
  t,
5065
5061
  e,
5066
5062
  d,
5067
5063
  this.window
5068
- ), u = new ke(e), g = new We(t), l = new Me(
5069
- g,
5064
+ ), l = new Xe(e), u = new He(t), g = new Le(
5070
5065
  u,
5066
+ l,
5071
5067
  a,
5072
5068
  c
5073
5069
  );
5074
5070
  if (this.hasBackground && de.configure(
5075
- l,
5076
- ar(this.backgroundConfig),
5071
+ g,
5072
+ cr(this.backgroundConfig),
5077
5073
  o.background
5078
- ), this.hasNodeResizeReactiveEdges && ee.configure(l), this.userSelectableEdgesConfig !== void 0) {
5079
- const p = Gr(
5074
+ ), this.hasNodeResizeReactiveEdges && ee.configure(g), this.userSelectableEdgesConfig !== void 0) {
5075
+ const p = Kr(
5080
5076
  this.userSelectableEdgesConfig
5081
5077
  );
5082
- ye.configure(
5083
- l,
5078
+ fe.configure(
5079
+ g,
5084
5080
  this.window,
5085
5081
  this.pointInsideVerifier,
5086
5082
  this.eventTagger,
@@ -5088,11 +5084,11 @@ class Kr {
5088
5084
  );
5089
5085
  }
5090
5086
  if (this.userSelectableNodesConfig !== void 0) {
5091
- const p = Yr(
5087
+ const p = jr(
5092
5088
  this.userSelectableNodesConfig
5093
5089
  );
5094
5090
  we.configure(
5095
- l,
5091
+ g,
5096
5092
  this.window,
5097
5093
  this.pointInsideVerifier,
5098
5094
  this.eventTagger,
@@ -5100,11 +5096,11 @@ class Kr {
5100
5096
  );
5101
5097
  }
5102
5098
  if (this.userSelectableCanvasConfig !== void 0) {
5103
- const p = Xr(
5099
+ const p = Jr(
5104
5100
  this.userSelectableCanvasConfig
5105
5101
  );
5106
- fe.configure(
5107
- l,
5102
+ ye.configure(
5103
+ g,
5108
5104
  o.main,
5109
5105
  this.window,
5110
5106
  this.pointInsideVerifier,
@@ -5113,12 +5109,12 @@ class Kr {
5113
5109
  );
5114
5110
  }
5115
5111
  if (this.hasDraggableNodes) {
5116
- let p = tr(this.dragConfig);
5117
- this.hasAnimatedLayout && (p = Ur(
5112
+ let p = sr(this.dragConfig);
5113
+ this.hasAnimatedLayout && (p = Or(
5118
5114
  p,
5119
5115
  this.animationStaticNodes
5120
5116
  )), ae.configure(
5121
- l,
5117
+ g,
5122
5118
  o.main,
5123
5119
  this.window,
5124
5120
  this.pointInsideVerifier,
@@ -5126,13 +5122,13 @@ class Kr {
5126
5122
  );
5127
5123
  }
5128
5124
  if (this.hasUserConnectablePorts) {
5129
- const p = hr(
5125
+ const p = lr(
5130
5126
  this.connectablePortsConfig,
5131
5127
  n.edges.shapeFactory,
5132
- l.graph
5128
+ g.graph
5133
5129
  );
5134
5130
  ce.configure(
5135
- l,
5131
+ g,
5136
5132
  o.overlayConnectablePorts,
5137
5133
  e,
5138
5134
  this.window,
@@ -5141,12 +5137,12 @@ class Kr {
5141
5137
  );
5142
5138
  }
5143
5139
  if (this.hasUserDraggableEdges) {
5144
- const p = dr(
5140
+ const p = ur(
5145
5141
  this.draggableEdgesConfig,
5146
- l.graph
5142
+ g.graph
5147
5143
  );
5148
5144
  le.configure(
5149
- l,
5145
+ g,
5150
5146
  o.overlayDraggableEdges,
5151
5147
  e,
5152
5148
  this.window,
@@ -5155,55 +5151,55 @@ class Kr {
5155
5151
  );
5156
5152
  }
5157
5153
  if (this.virtualScrollConfig !== void 0 ? he.configure(
5158
- l,
5154
+ g,
5159
5155
  o.main,
5160
5156
  this.window,
5161
- Pe(this.transformConfig),
5157
+ Me(this.transformConfig),
5162
5158
  this.boxRenderingTrigger,
5163
5159
  this.pointInsideVerifier,
5164
- cr(this.virtualScrollConfig)
5160
+ gr(this.virtualScrollConfig)
5165
5161
  ) : this.hasTransformableViewport && J.configure(
5166
- l,
5162
+ g,
5167
5163
  o.main,
5168
5164
  this.window,
5169
5165
  this.pointInsideVerifier,
5170
- Pe(this.transformConfig)
5171
- ), this.hasLayout && Qt.configure(l, h), this.hasAnimatedLayout) {
5172
- let p = Tr(this.animatedLayoutConfig);
5173
- this.hasDraggableNodes && ($r(
5174
- l,
5166
+ Me(this.transformConfig)
5167
+ ), this.hasLayout && qt.configure(g, h), this.hasAnimatedLayout) {
5168
+ let p = Rr(this.animatedLayoutConfig);
5169
+ this.hasDraggableNodes && (Wr(
5170
+ g,
5175
5171
  this.animationStaticNodes
5176
- ), p = Br(
5172
+ ), p = zr(
5177
5173
  p,
5178
5174
  this.animationStaticNodes
5179
- )), pe.configure(l, p, this.window);
5175
+ )), pe.configure(g, p, this.window);
5180
5176
  }
5181
- return l.onBeforeDestroy.subscribe(() => {
5177
+ return g.onBeforeDestroy.subscribe(() => {
5182
5178
  o.destroy();
5183
- }), l;
5179
+ }), g;
5184
5180
  }
5185
5181
  createHtmlView(e, t, o) {
5186
- let s = new Te(t, o, e);
5187
- return this.virtualScrollConfig !== void 0 && (s = new ht(
5182
+ let s = new Re(t, o, e);
5183
+ return this.virtualScrollConfig !== void 0 && (s = new lt(
5188
5184
  s,
5189
5185
  t,
5190
5186
  this.boxRenderingTrigger,
5191
- lr(this.virtualScrollConfig)
5192
- )), s = new dt(s, t), s;
5187
+ pr(this.virtualScrollConfig)
5188
+ )), s = new ut(s, t), s;
5193
5189
  }
5194
5190
  }
5195
5191
  export {
5196
- Vt as BezierEdgeShape,
5197
- Kr as CanvasBuilder,
5198
- ur as CanvasBuilderError,
5192
+ Ut as BezierEdgeShape,
5193
+ _r as CanvasBuilder,
5194
+ wr as CanvasBuilderError,
5199
5195
  A as CanvasError,
5200
5196
  I as ConnectionCategory,
5201
- Be as DirectEdgeShape,
5197
+ ze as DirectEdgeShape,
5202
5198
  q as EventSubject,
5203
- It as HorizontalEdgeShape,
5204
- Ot as InteractiveEdgeError,
5205
- Oe as InteractiveEdgeShape,
5206
- Jr as MidpointEdgeShape,
5207
- Ft as StraightEdgeShape,
5208
- Ut as VerticalEdgeShape
5199
+ $t as HorizontalEdgeShape,
5200
+ kt as InteractiveEdgeError,
5201
+ ke as InteractiveEdgeShape,
5202
+ Zr as MidpointEdgeShape,
5203
+ Bt as StraightEdgeShape,
5204
+ Ot as VerticalEdgeShape
5209
5205
  };