@html-graph/html-graph 7.0.1 → 7.1.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,24 +1,24 @@
1
- var Be = Object.defineProperty;
2
- var Fe = (r, e, t) => e in r ? Be(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => Fe(r, typeof e != "symbol" ? e + "" : e, t);
1
+ var Fe = Object.defineProperty;
2
+ var Oe = (r, e, t) => e in r ? Fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => Oe(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  const D = (r, e) => ({
5
5
  x: r.scale * e.x + r.x,
6
6
  y: r.scale * e.y + r.y
7
7
  });
8
8
  var C = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(C || {});
9
- const Oe = () => {
9
+ const We = () => {
10
10
  const r = document.createElement("div");
11
11
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
12
- }, We = () => {
12
+ }, ke = () => {
13
13
  const r = document.createElement("div");
14
14
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
15
- }, ke = (r) => {
15
+ }, ze = (r) => {
16
16
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
17
17
  };
18
- class me {
18
+ class ye {
19
19
  constructor(e, t, s) {
20
- o(this, "host", Oe());
21
- o(this, "container", We());
20
+ o(this, "host", We());
21
+ o(this, "container", ke());
22
22
  o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
23
  o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
24
24
  o(this, "applyTransform", () => {
@@ -29,7 +29,7 @@ class me {
29
29
  }
30
30
  attachNode(e) {
31
31
  const t = this.graphStore.getNode(e);
32
- ke(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
32
+ ze(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
33
33
  }
34
34
  detachNode(e) {
35
35
  const t = this.graphStore.getNode(e);
@@ -100,7 +100,7 @@ class me {
100
100
  };
101
101
  }
102
102
  }
103
- class ze {
103
+ class Xe {
104
104
  constructor(e) {
105
105
  o(this, "xFrom", 1 / 0);
106
106
  o(this, "yFrom", 1 / 0);
@@ -120,7 +120,7 @@ class ze {
120
120
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
121
121
  }
122
122
  }
123
- class Xe {
123
+ class Ye {
124
124
  constructor(e, t, s, i) {
125
125
  o(this, "attachedNodes", /* @__PURE__ */ new Set());
126
126
  o(this, "attachedEdges", /* @__PURE__ */ new Set());
@@ -144,7 +144,7 @@ class Xe {
144
144
  this.handleAttachEdge(a);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new ze(this.graphStore), this.trigger.subscribe(this.updateViewport);
147
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Xe(this.graphStore), this.trigger.subscribe(this.updateViewport);
148
148
  }
149
149
  attachNode(e) {
150
150
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -198,7 +198,7 @@ class Xe {
198
198
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
199
199
  }
200
200
  }
201
- class Ye {
201
+ class He {
202
202
  constructor(e, t) {
203
203
  o(this, "deferredNodes", /* @__PURE__ */ new Set());
204
204
  o(this, "deferredEdges", /* @__PURE__ */ new Set());
@@ -510,7 +510,7 @@ class ve {
510
510
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
511
511
  }
512
512
  }
513
- class He {
513
+ class je {
514
514
  constructor() {
515
515
  o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
516
516
  o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
@@ -559,7 +559,7 @@ class Ee {
559
559
  o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
560
560
  o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
561
561
  o(this, "portCycleEdges", /* @__PURE__ */ new Map());
562
- o(this, "elementPorts", new He());
562
+ o(this, "elementPorts", new je());
563
563
  o(this, "afterNodeAddedEmitter");
564
564
  o(this, "onAfterNodeAdded");
565
565
  o(this, "afterNodeUpdatedEmitter");
@@ -766,7 +766,7 @@ const ce = (r) => ({
766
766
  x: 0,
767
767
  y: 0
768
768
  };
769
- class je {
769
+ class Ge {
770
770
  constructor() {
771
771
  o(this, "viewportMatrix", le);
772
772
  o(this, "contentMatrix", le);
@@ -825,10 +825,10 @@ class K {
825
825
  this.canvas.updateNode(t);
826
826
  }
827
827
  }
828
- const Ge = (r, e, t) => {
828
+ const Ke = (r, e, t) => {
829
829
  const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
830
830
  return e >= s && e <= s + n && t >= i && t <= i + a;
831
- }, Ke = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, V = (r, e, t, s) => Ge(e, t, s) && Ke(r, t, s), B = (r, e) => {
831
+ }, Ze = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, V = (r, e, t, s) => Ke(e, t, s) && Ze(r, t, s), B = (r, e) => {
832
832
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
833
833
  }, F = (r) => {
834
834
  const e = document.createElement("div");
@@ -845,31 +845,58 @@ const Ge = (r, e, t) => {
845
845
  }
846
846
  ]
847
847
  };
848
- }, Ze = (r, e) => {
849
- let t = e, s = null;
850
- for (; t !== null && (s = r.getElementPortIds(t)[0] ?? null, s === null); )
848
+ }, Je = (r, e) => {
849
+ let t = e;
850
+ for (; t !== null; ) {
851
+ const s = r.getElementPortIds(t)[0] ?? null;
852
+ if (s !== null)
853
+ return {
854
+ status: "portFound",
855
+ portId: s
856
+ };
857
+ if (r.getElementNodeId(t) !== null)
858
+ return {
859
+ status: "nodeEncountered"
860
+ };
851
861
  t = t.parentElement;
852
- return s;
853
- }, Ae = (r, e) => {
854
- const t = document.elementsFromPoint(e.x, e.y);
862
+ }
863
+ return {
864
+ status: "notFound"
865
+ };
866
+ };
867
+ function* Ae(r, e) {
868
+ const t = r.elementsFromPoint(e.x, e.y);
855
869
  for (const s of t) {
856
- const i = Ze(r, s);
857
- if (i !== null)
858
- return i;
870
+ if (s.shadowRoot !== null) {
871
+ const i = Ae(s.shadowRoot, e);
872
+ for (const n of i)
873
+ yield n;
874
+ }
875
+ yield s;
876
+ }
877
+ }
878
+ const xe = (r, e) => {
879
+ const t = Ae(document, e);
880
+ for (const s of t) {
881
+ const i = Je(r, s);
882
+ if (i.status === "portFound")
883
+ return i.portId;
884
+ if (i.status === "nodeEncountered")
885
+ return null;
859
886
  }
860
887
  return null;
861
888
  };
862
889
  var b = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(b || {});
863
- const xe = (r, e) => ({
890
+ const Se = (r, e) => ({
864
891
  x: r / 2,
865
892
  y: e / 2
866
893
  }), p = {
867
894
  x: 0,
868
895
  y: 0
869
- }, m = (r, e, t) => ({
896
+ }, y = (r, e, t) => ({
870
897
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
871
898
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
872
- }), Se = (r, e) => {
899
+ }), Pe = (r, e) => {
873
900
  const t = {
874
901
  x: r.x + r.width / 2,
875
902
  y: r.y + r.height / 2
@@ -889,18 +916,18 @@ const xe = (r, e) => ({
889
916
  x: e * r.x + (1 - e) / 2 * s.x,
890
917
  y: t * r.y + (1 - t) / 2 * s.y
891
918
  });
892
- class Je {
919
+ class Qe {
893
920
  constructor(e) {
894
921
  o(this, "path");
895
922
  o(this, "midpoint");
896
923
  this.params = e;
897
924
  const t = this.params.to;
898
925
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
899
- const s = m(
926
+ const s = y(
900
927
  { x: this.params.arrowLength, y: p.y },
901
928
  this.params.sourceDirection,
902
929
  p
903
- ), i = m(
930
+ ), i = y(
904
931
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
905
932
  this.params.targetDirection,
906
933
  this.params.to
@@ -914,30 +941,30 @@ class Je {
914
941
  this.path = `${d}${h}${c}`;
915
942
  }
916
943
  }
917
- class Qe {
944
+ class qe {
918
945
  constructor(e) {
919
946
  o(this, "path");
920
947
  o(this, "midpoint");
921
948
  this.params = e;
922
- const t = this.params.hasSourceArrow ? m(
949
+ const t = this.params.hasSourceArrow ? y(
923
950
  { x: this.params.arrowLength, y: p.y },
924
951
  this.params.sourceDirection,
925
952
  p
926
- ) : p, s = this.params.hasTargetArrow ? m(
953
+ ) : p, s = this.params.hasTargetArrow ? y(
927
954
  {
928
955
  x: this.params.to.x - this.params.arrowLength,
929
956
  y: this.params.to.y
930
957
  },
931
958
  this.params.targetDirection,
932
959
  this.params.to
933
- ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
960
+ ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = y(
934
961
  { x: i, y: p.y },
935
962
  this.params.sourceDirection,
936
963
  p
937
964
  ), g = {
938
965
  x: c.x + h,
939
966
  y: c.y + d
940
- }, l = m(
967
+ }, l = y(
941
968
  { x: this.params.to.x - i, y: this.params.to.y },
942
969
  this.params.targetDirection,
943
970
  this.params.to
@@ -947,7 +974,7 @@ class Qe {
947
974
  }, w = {
948
975
  x: (g.x + u.x) / 2,
949
976
  y: (g.y + u.y) / 2
950
- }, y = {
977
+ }, m = {
951
978
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
952
979
  y: c.y + this.params.curvature * this.params.sourceDirection.y
953
980
  }, v = {
@@ -963,7 +990,7 @@ class Qe {
963
990
  this.path = [
964
991
  `M ${t.x} ${t.y}`,
965
992
  `L ${c.x} ${c.y}`,
966
- `C ${y.x} ${y.y} ${E.x} ${E.y} ${w.x} ${w.y}`,
993
+ `C ${m.x} ${m.y} ${E.x} ${E.y} ${w.x} ${w.y}`,
967
994
  `C ${A.x} ${A.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
968
995
  `L ${s.x} ${s.y}`
969
996
  ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
@@ -971,19 +998,19 @@ class Qe {
971
998
  }
972
999
  const Z = Object.freeze({
973
1000
  edgeColor: "--edge-color"
974
- }), Pe = (r) => {
1001
+ }), be = (r) => {
975
1002
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
976
1003
  return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
977
- }, be = (r) => {
1004
+ }, Te = (r) => {
978
1005
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
979
1006
  return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
980
1007
  }, O = () => {
981
1008
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
982
1009
  return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
983
- }, Te = () => {
1010
+ }, De = () => {
984
1011
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
985
1012
  return r.style.transformOrigin = "50% 50%", r;
986
- }, De = (r, e) => {
1013
+ }, Ne = (r, e) => {
987
1014
  r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
988
1015
  }, L = (r, e) => {
989
1016
  const t = [];
@@ -992,42 +1019,42 @@ const Z = Object.freeze({
992
1019
  let i = 0, n = 0, a = 0;
993
1020
  r.forEach((h, d) => {
994
1021
  let c = 0, g = 0, l = 0;
995
- const u = d > 0, w = d < s, y = u && w;
1022
+ const u = d > 0, w = d < s, m = u && w;
996
1023
  if (u && (c = -i, g = -n, l = a), w) {
997
1024
  const $ = r[d + 1];
998
1025
  i = $.x - h.x, n = $.y - h.y, a = Math.sqrt(i * i + n * n);
999
1026
  }
1000
- const E = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, A = y ? { x: h.x + i * E, y: h.y + n * E } : h, T = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * T, y: h.y + g * T } : h;
1001
- d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
1027
+ const E = a !== 0 ? Math.min((m ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, A = m ? { x: h.x + i * E, y: h.y + n * E } : h, T = l !== 0 ? Math.min((m ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = m ? { x: h.x + c * T, y: h.y + g * T } : h;
1028
+ d > 0 && t.push(`L ${N.x} ${N.y}`), m && t.push(
1002
1029
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
1003
1030
  );
1004
1031
  });
1005
1032
  }
1006
1033
  return t.join(" ");
1007
1034
  };
1008
- class qe {
1035
+ class _e {
1009
1036
  constructor(e) {
1010
1037
  o(this, "path");
1011
1038
  o(this, "midpoint");
1012
1039
  this.params = e;
1013
1040
  const t = this.params.to;
1014
1041
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1015
- const s = this.params.hasSourceArrow ? m(
1042
+ const s = this.params.hasSourceArrow ? y(
1016
1043
  { x: this.params.arrowLength, y: p.y },
1017
1044
  this.params.sourceDirection,
1018
1045
  p
1019
- ) : p, i = this.params.hasTargetArrow ? m(
1046
+ ) : p, i = this.params.hasTargetArrow ? y(
1020
1047
  {
1021
1048
  x: this.params.to.x - this.params.arrowLength,
1022
1049
  y: this.params.to.y
1023
1050
  },
1024
1051
  this.params.targetDirection,
1025
1052
  this.params.to
1026
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1053
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1027
1054
  { x: a, y: p.y },
1028
1055
  this.params.sourceDirection,
1029
1056
  p
1030
- ), d = m(
1057
+ ), d = y(
1031
1058
  { x: this.params.to.x - a, y: this.params.to.y },
1032
1059
  this.params.targetDirection,
1033
1060
  this.params.to
@@ -1037,34 +1064,34 @@ class qe {
1037
1064
  }, u = { x: l.x, y: g }, w = {
1038
1065
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1039
1066
  y: d.y
1040
- }, y = { x: w.x, y: g };
1067
+ }, m = { x: w.x, y: g };
1041
1068
  this.path = L(
1042
- [s, h, l, u, y, w, d, i],
1069
+ [s, h, l, u, m, w, d, i],
1043
1070
  this.params.roundness
1044
1071
  );
1045
1072
  }
1046
1073
  }
1047
- class _e {
1074
+ class et {
1048
1075
  constructor(e) {
1049
1076
  o(this, "path");
1050
1077
  o(this, "midpoint");
1051
1078
  this.params = e;
1052
- const t = this.params.hasSourceArrow ? m(
1079
+ const t = this.params.hasSourceArrow ? y(
1053
1080
  { x: this.params.arrowLength, y: p.y },
1054
1081
  this.params.sourceDirection,
1055
1082
  p
1056
- ) : p, s = this.params.hasTargetArrow ? m(
1083
+ ) : p, s = this.params.hasTargetArrow ? y(
1057
1084
  {
1058
1085
  x: this.params.to.x - this.params.arrowLength,
1059
1086
  y: this.params.to.y
1060
1087
  },
1061
1088
  this.params.targetDirection,
1062
1089
  this.params.to
1063
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1090
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1064
1091
  { x: i, y: p.y },
1065
1092
  this.params.sourceDirection,
1066
1093
  p
1067
- ), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
1094
+ ), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = y(
1068
1095
  { x: this.params.to.x - i, y: this.params.to.y },
1069
1096
  this.params.targetDirection,
1070
1097
  this.params.to
@@ -1075,29 +1102,29 @@ class _e {
1075
1102
  );
1076
1103
  }
1077
1104
  }
1078
- class et {
1105
+ class tt {
1079
1106
  constructor(e) {
1080
1107
  o(this, "path");
1081
1108
  o(this, "midpoint");
1082
1109
  this.params = e;
1083
1110
  const t = this.params.to;
1084
1111
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1085
- const s = this.params.hasSourceArrow ? m(
1112
+ const s = this.params.hasSourceArrow ? y(
1086
1113
  { x: this.params.arrowLength, y: p.y },
1087
1114
  this.params.sourceDirection,
1088
1115
  p
1089
- ) : p, i = this.params.hasTargetArrow ? m(
1116
+ ) : p, i = this.params.hasTargetArrow ? y(
1090
1117
  {
1091
1118
  x: this.params.to.x - this.params.arrowLength,
1092
1119
  y: this.params.to.y
1093
1120
  },
1094
1121
  this.params.targetDirection,
1095
1122
  this.params.to
1096
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
1123
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
1097
1124
  { x: n, y: p.y },
1098
1125
  this.params.sourceDirection,
1099
1126
  p
1100
- ), h = m(
1127
+ ), h = y(
1101
1128
  { x: this.params.to.x - n, y: this.params.to.y },
1102
1129
  this.params.targetDirection,
1103
1130
  this.params.to
@@ -1105,29 +1132,29 @@ class et {
1105
1132
  this.path = L([s, a, h, i], this.params.roundness);
1106
1133
  }
1107
1134
  }
1108
- class tt {
1135
+ class rt {
1109
1136
  constructor(e) {
1110
1137
  o(this, "path");
1111
1138
  o(this, "midpoint");
1112
1139
  this.params = e;
1113
1140
  const t = this.params.to;
1114
1141
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1115
- const s = this.params.hasSourceArrow ? m(
1142
+ const s = this.params.hasSourceArrow ? y(
1116
1143
  { x: this.params.arrowLength, y: p.y },
1117
1144
  this.params.sourceDirection,
1118
1145
  p
1119
- ) : p, i = this.params.hasTargetArrow ? m(
1146
+ ) : p, i = this.params.hasTargetArrow ? y(
1120
1147
  {
1121
1148
  x: this.params.to.x - this.params.arrowLength,
1122
1149
  y: this.params.to.y
1123
1150
  },
1124
1151
  this.params.targetDirection,
1125
1152
  this.params.to
1126
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1153
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1127
1154
  { x: a, y: p.y },
1128
1155
  this.params.sourceDirection,
1129
1156
  p
1130
- ), d = m(
1157
+ ), d = y(
1131
1158
  { x: this.params.to.x - a, y: this.params.to.y },
1132
1159
  this.params.targetDirection,
1133
1160
  this.params.to
@@ -1137,9 +1164,9 @@ class tt {
1137
1164
  }, u = { x: g, y: l.y }, w = {
1138
1165
  x: d.x,
1139
1166
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1140
- }, y = { x: g, y: w.y };
1167
+ }, m = { x: g, y: w.y };
1141
1168
  this.path = L(
1142
- [s, h, l, u, y, w, d, i],
1169
+ [s, h, l, u, m, w, d, i],
1143
1170
  this.params.roundness
1144
1171
  );
1145
1172
  }
@@ -1159,12 +1186,12 @@ class J {
1159
1186
  { x: i, y: p.y },
1160
1187
  { x: this.params.arrowLength, y: p.y }
1161
1188
  ].map(
1162
- (c) => m(c, this.params.sourceDirection, p)
1189
+ (c) => y(c, this.params.sourceDirection, p)
1163
1190
  ), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
1164
1191
  this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${L(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1165
1192
  }
1166
1193
  }
1167
- class rt {
1194
+ class st {
1168
1195
  constructor(e) {
1169
1196
  o(this, "path");
1170
1197
  o(this, "midpoint");
@@ -1175,7 +1202,7 @@ class rt {
1175
1202
  { x: c, y: -n },
1176
1203
  { x: d, y: 0 }
1177
1204
  ].map(
1178
- (y) => m(y, this.params.sourceDirection, p)
1205
+ (m) => y(m, this.params.sourceDirection, p)
1179
1206
  ), u = [
1180
1207
  `M ${l[0].x} ${l[0].y}`,
1181
1208
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
@@ -1185,7 +1212,7 @@ class rt {
1185
1212
  this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
1186
1213
  }
1187
1214
  }
1188
- class st {
1215
+ class ot {
1189
1216
  constructor(e) {
1190
1217
  o(this, "path");
1191
1218
  o(this, "midpoint");
@@ -1221,27 +1248,27 @@ class st {
1221
1248
  };
1222
1249
  }
1223
1250
  }
1224
- class ot {
1251
+ class it {
1225
1252
  constructor(e) {
1226
1253
  o(this, "path");
1227
1254
  o(this, "midpoint");
1228
1255
  this.params = e;
1229
- const t = this.params.hasSourceArrow ? m(
1256
+ const t = this.params.hasSourceArrow ? y(
1230
1257
  { x: this.params.arrowLength, y: p.y },
1231
1258
  this.params.sourceDirection,
1232
1259
  p
1233
- ) : p, s = this.params.hasTargetArrow ? m(
1260
+ ) : p, s = this.params.hasTargetArrow ? y(
1234
1261
  {
1235
1262
  x: this.params.to.x - this.params.arrowLength,
1236
1263
  y: this.params.to.y
1237
1264
  },
1238
1265
  this.params.targetDirection,
1239
1266
  this.params.to
1240
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1267
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1241
1268
  { x: i, y: p.y },
1242
1269
  this.params.sourceDirection,
1243
1270
  p
1244
- ), a = m(
1271
+ ), a = y(
1245
1272
  { x: this.params.to.x - i, y: this.params.to.y },
1246
1273
  this.params.targetDirection,
1247
1274
  this.params.to
@@ -1262,27 +1289,27 @@ class ot {
1262
1289
  );
1263
1290
  }
1264
1291
  }
1265
- class it {
1292
+ class nt {
1266
1293
  constructor(e) {
1267
1294
  o(this, "path");
1268
1295
  o(this, "midpoint");
1269
1296
  this.params = e;
1270
- const t = this.params.hasSourceArrow ? m(
1297
+ const t = this.params.hasSourceArrow ? y(
1271
1298
  { x: this.params.arrowLength, y: p.y },
1272
1299
  this.params.sourceDirection,
1273
1300
  p
1274
- ) : p, s = this.params.hasTargetArrow ? m(
1301
+ ) : p, s = this.params.hasTargetArrow ? y(
1275
1302
  {
1276
1303
  x: this.params.to.x - this.params.arrowLength,
1277
1304
  y: this.params.to.y
1278
1305
  },
1279
1306
  this.params.targetDirection,
1280
1307
  this.params.to
1281
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1308
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1282
1309
  { x: i, y: p.y },
1283
1310
  this.params.sourceDirection,
1284
1311
  p
1285
- ), a = m(
1312
+ ), a = y(
1286
1313
  { x: this.params.to.x - i, y: this.params.to.y },
1287
1314
  this.params.targetDirection,
1288
1315
  this.params.to
@@ -1329,21 +1356,21 @@ const f = Object.freeze({
1329
1356
  class k {
1330
1357
  constructor(e) {
1331
1358
  o(this, "svg");
1332
- o(this, "group", Te());
1359
+ o(this, "group", De());
1333
1360
  o(this, "line");
1334
1361
  o(this, "sourceArrow", null);
1335
1362
  o(this, "targetArrow", null);
1336
1363
  o(this, "onAfterRender");
1337
1364
  o(this, "afterRenderEmitter");
1338
1365
  o(this, "arrowRenderer");
1339
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = be(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1366
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = be(e.color), this.svg.appendChild(this.group), this.line = Te(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1340
1367
  }
1341
1368
  render(e) {
1342
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
1369
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Pe(
1343
1370
  e.from,
1344
1371
  e.to
1345
1372
  );
1346
- De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1373
+ Ne(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1347
1374
  const d = ge(
1348
1375
  e.from.direction,
1349
1376
  a,
@@ -1366,12 +1393,12 @@ class k {
1366
1393
  h
1367
1394
  );
1368
1395
  this.line.setAttribute("d", w.path);
1369
- let y = null;
1370
- this.sourceArrow && (y = this.arrowRenderer({
1396
+ let m = null;
1397
+ this.sourceArrow && (m = this.arrowRenderer({
1371
1398
  direction: d,
1372
1399
  shift: p,
1373
1400
  arrowLength: this.params.arrowLength
1374
- }), this.sourceArrow.setAttribute("d", y));
1401
+ }), this.sourceArrow.setAttribute("d", m));
1375
1402
  let v = null;
1376
1403
  this.targetArrow && (v = this.arrowRenderer({
1377
1404
  direction: l,
@@ -1379,33 +1406,33 @@ class k {
1379
1406
  arrowLength: this.params.arrowLength
1380
1407
  }), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
1381
1408
  edgePath: w,
1382
- sourceArrowPath: y,
1409
+ sourceArrowPath: m,
1383
1410
  targetArrowPath: v
1384
1411
  });
1385
1412
  }
1386
1413
  }
1387
- const nt = (r) => (e) => {
1414
+ const at = (r) => (e) => {
1388
1415
  const s = [
1389
1416
  p,
1390
1417
  { x: e.arrowLength, y: r.radius },
1391
1418
  { x: e.arrowLength, y: -r.radius }
1392
1419
  ].map(
1393
- (h) => m(h, e.direction, p)
1420
+ (h) => y(h, e.direction, p)
1394
1421
  ).map((h) => ({
1395
1422
  x: h.x + e.shift.x,
1396
1423
  y: h.y + e.shift.y
1397
1424
  })), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1398
1425
  return `${i} ${n} ${a} Z`;
1399
- }, at = (r) => (e) => {
1426
+ }, ht = (r) => (e) => {
1400
1427
  const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
1401
- (y) => m(y, e.direction, p)
1402
- ).map((y) => ({
1403
- x: y.x + e.shift.x,
1404
- y: y.y + e.shift.y
1428
+ (m) => y(m, e.direction, p)
1429
+ ).map((m) => ({
1430
+ x: m.x + e.shift.x,
1431
+ y: m.y + e.shift.y
1405
1432
  })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
1406
1433
  return `${g} ${l} ${u} ${w}`;
1407
- }, ht = (r) => (e) => {
1408
- const t = r.smallRadius, s = r.radius, i = m(
1434
+ }, dt = (r) => (e) => {
1435
+ const t = r.smallRadius, s = r.radius, i = y(
1409
1436
  {
1410
1437
  x: e.arrowLength,
1411
1438
  y: 0
@@ -1419,7 +1446,7 @@ const nt = (r) => (e) => {
1419
1446
  y: 0
1420
1447
  }
1421
1448
  ), a = [p, { x: i.x, y: -i.y }, i].map(
1422
- (l) => m(l, e.direction, p)
1449
+ (l) => y(l, e.direction, p)
1423
1450
  ).map((l) => ({
1424
1451
  x: l.x + e.shift.x,
1425
1452
  y: l.y + e.shift.y
@@ -1430,22 +1457,22 @@ const nt = (r) => (e) => {
1430
1457
  return r;
1431
1458
  switch (r.type) {
1432
1459
  case "triangle":
1433
- return nt({
1460
+ return at({
1434
1461
  radius: r.radius ?? f.polygonArrowRadius
1435
1462
  });
1436
1463
  case "arc":
1437
- return at({
1464
+ return ht({
1438
1465
  radius: r.radius ?? f.circleArrowRadius
1439
1466
  });
1440
1467
  default:
1441
- return ht({
1468
+ return dt({
1442
1469
  smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
1443
1470
  angle: r.angle ?? f.wedgeArrowAngle,
1444
1471
  radius: r.radius ?? f.wedgeArrowRadius
1445
1472
  });
1446
1473
  }
1447
1474
  };
1448
- class dt {
1475
+ class ct {
1449
1476
  constructor(e) {
1450
1477
  o(this, "svg");
1451
1478
  o(this, "group");
@@ -1462,7 +1489,7 @@ class dt {
1462
1489
  o(this, "hasSourceArrow");
1463
1490
  o(this, "hasTargetArrow");
1464
1491
  o(this, "pathShape");
1465
- o(this, "createCyclePath", (e) => new rt({
1492
+ o(this, "createCyclePath", (e) => new st({
1466
1493
  sourceDirection: e,
1467
1494
  radius: this.portCycleRadius,
1468
1495
  smallRadius: this.portCycleSmallRadius,
@@ -1470,7 +1497,7 @@ class dt {
1470
1497
  hasSourceArrow: this.hasSourceArrow,
1471
1498
  hasTargetArrow: this.hasTargetArrow
1472
1499
  }));
1473
- o(this, "createDetourPath", (e, t, s, i, n) => new Qe({
1500
+ o(this, "createDetourPath", (e, t, s, i, n) => new qe({
1474
1501
  to: s,
1475
1502
  sourceDirection: e,
1476
1503
  targetDirection: t,
@@ -1483,7 +1510,7 @@ class dt {
1483
1510
  hasSourceArrow: this.hasSourceArrow,
1484
1511
  hasTargetArrow: this.hasTargetArrow
1485
1512
  }));
1486
- o(this, "createLinePath", (e, t, s) => new Je({
1513
+ o(this, "createLinePath", (e, t, s) => new Qe({
1487
1514
  to: s,
1488
1515
  sourceDirection: e,
1489
1516
  targetDirection: t,
@@ -1508,7 +1535,7 @@ class dt {
1508
1535
  this.pathShape.render(e);
1509
1536
  }
1510
1537
  }
1511
- class ct {
1538
+ class lt {
1512
1539
  constructor(e) {
1513
1540
  o(this, "svg");
1514
1541
  o(this, "group");
@@ -1533,7 +1560,7 @@ class ct {
1533
1560
  hasSourceArrow: this.hasSourceArrow,
1534
1561
  hasTargetArrow: this.hasTargetArrow
1535
1562
  }));
1536
- o(this, "createDetourPath", (e, t, s, i, n) => new ot({
1563
+ o(this, "createDetourPath", (e, t, s, i, n) => new it({
1537
1564
  to: s,
1538
1565
  sourceDirection: e,
1539
1566
  targetDirection: t,
@@ -1546,7 +1573,7 @@ class ct {
1546
1573
  hasSourceArrow: this.hasSourceArrow,
1547
1574
  hasTargetArrow: this.hasTargetArrow
1548
1575
  }));
1549
- o(this, "createLinePath", (e, t, s, i) => new qe({
1576
+ o(this, "createLinePath", (e, t, s, i) => new _e({
1550
1577
  to: s,
1551
1578
  sourceDirection: e,
1552
1579
  targetDirection: t,
@@ -1579,7 +1606,7 @@ class ct {
1579
1606
  this.pathShape.render(e);
1580
1607
  }
1581
1608
  }
1582
- class lt {
1609
+ class gt {
1583
1610
  constructor(e) {
1584
1611
  o(this, "svg");
1585
1612
  o(this, "group");
@@ -1605,7 +1632,7 @@ class lt {
1605
1632
  hasSourceArrow: this.hasSourceArrow,
1606
1633
  hasTargetArrow: this.hasTargetArrow
1607
1634
  }));
1608
- o(this, "createDetourPath", (e, t, s, i, n) => new _e({
1635
+ o(this, "createDetourPath", (e, t, s, i, n) => new et({
1609
1636
  to: s,
1610
1637
  sourceDirection: e,
1611
1638
  targetDirection: t,
@@ -1619,7 +1646,7 @@ class lt {
1619
1646
  hasSourceArrow: this.hasSourceArrow,
1620
1647
  hasTargetArrow: this.hasTargetArrow
1621
1648
  }));
1622
- o(this, "createLinePath", (e, t, s) => new et({
1649
+ o(this, "createLinePath", (e, t, s) => new tt({
1623
1650
  to: s,
1624
1651
  sourceDirection: e,
1625
1652
  targetDirection: t,
@@ -1651,7 +1678,7 @@ class lt {
1651
1678
  this.pathShape.render(e);
1652
1679
  }
1653
1680
  }
1654
- class gt {
1681
+ class ut {
1655
1682
  constructor(e) {
1656
1683
  o(this, "svg");
1657
1684
  o(this, "group");
@@ -1676,7 +1703,7 @@ class gt {
1676
1703
  hasSourceArrow: this.hasSourceArrow,
1677
1704
  hasTargetArrow: this.hasTargetArrow
1678
1705
  }));
1679
- o(this, "createDetourPath", (e, t, s, i, n) => new it({
1706
+ o(this, "createDetourPath", (e, t, s, i, n) => new nt({
1680
1707
  to: s,
1681
1708
  sourceDirection: e,
1682
1709
  targetDirection: t,
@@ -1689,7 +1716,7 @@ class gt {
1689
1716
  hasSourceArrow: this.hasSourceArrow,
1690
1717
  hasTargetArrow: this.hasTargetArrow
1691
1718
  }));
1692
- o(this, "createLinePath", (e, t, s, i, n) => new tt({
1719
+ o(this, "createLinePath", (e, t, s, i, n) => new rt({
1693
1720
  to: s,
1694
1721
  sourceDirection: e,
1695
1722
  targetDirection: t,
@@ -1722,10 +1749,10 @@ class gt {
1722
1749
  this.pathShape.render(e);
1723
1750
  }
1724
1751
  }
1725
- class Ne {
1752
+ class Me {
1726
1753
  constructor(e) {
1727
1754
  o(this, "svg");
1728
- o(this, "group", Te());
1755
+ o(this, "group", De());
1729
1756
  o(this, "line");
1730
1757
  o(this, "sourceArrow", null);
1731
1758
  o(this, "targetArrow", null);
@@ -1737,15 +1764,15 @@ class Ne {
1737
1764
  o(this, "onAfterRender");
1738
1765
  o(this, "afterRenderEmitter");
1739
1766
  o(this, "arrowRenderer");
1740
- [this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Pe(this.color), this.svg.appendChild(this.group), this.line = be(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1767
+ [this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = be(this.color), this.svg.appendChild(this.group), this.line = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1741
1768
  }
1742
1769
  render(e) {
1743
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
1770
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Pe(
1744
1771
  e.from,
1745
1772
  e.to
1746
1773
  );
1747
- De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1748
- const d = { x: i, y: n }, c = new st({
1774
+ Ne(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1775
+ const d = { x: i, y: n }, c = new ot({
1749
1776
  to: d,
1750
1777
  sourceOffset: this.sourceOffset,
1751
1778
  targetOffset: this.targetOffset,
@@ -1764,26 +1791,26 @@ class Ne {
1764
1791
  y: d.y / u
1765
1792
  };
1766
1793
  if (this.sourceArrow) {
1767
- const y = {
1794
+ const m = {
1768
1795
  x: w.x * this.sourceOffset,
1769
1796
  y: w.y * this.sourceOffset
1770
1797
  };
1771
1798
  g = this.arrowRenderer({
1772
1799
  direction: w,
1773
- shift: y,
1800
+ shift: m,
1774
1801
  arrowLength: this.arrowLength
1775
1802
  }), this.sourceArrow.setAttribute("d", g);
1776
1803
  }
1777
1804
  if (this.targetArrow) {
1778
- const y = {
1805
+ const m = {
1779
1806
  x: w.x * this.targetOffset,
1780
1807
  y: w.y * this.targetOffset
1781
1808
  };
1782
1809
  l = this.arrowRenderer({
1783
1810
  direction: { x: -w.x, y: -w.y },
1784
1811
  shift: {
1785
- x: d.x - y.x,
1786
- y: d.y - y.y
1812
+ x: d.x - m.x,
1813
+ y: d.y - m.y
1787
1814
  },
1788
1815
  arrowLength: this.arrowLength
1789
1816
  }), this.targetArrow.setAttribute("d", l);
@@ -1796,40 +1823,40 @@ class Ne {
1796
1823
  });
1797
1824
  }
1798
1825
  }
1799
- const ut = () => {
1826
+ const pt = () => {
1800
1827
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1801
1828
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1802
- }, pt = (r) => {
1829
+ }, wt = (r) => {
1803
1830
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1804
1831
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1805
1832
  }, ue = (r) => {
1806
1833
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1807
1834
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1808
1835
  };
1809
- class wt extends Error {
1836
+ class ft extends Error {
1810
1837
  constructor(e) {
1811
1838
  super(e), this.name = "InteractiveEdgeError";
1812
1839
  }
1813
1840
  }
1814
- class Me {
1841
+ class Le {
1815
1842
  constructor(e, t) {
1816
1843
  o(this, "svg");
1817
1844
  o(this, "group");
1818
1845
  o(this, "line");
1819
1846
  o(this, "sourceArrow");
1820
1847
  o(this, "targetArrow");
1821
- o(this, "handle", ut());
1848
+ o(this, "handle", pt());
1822
1849
  o(this, "onAfterRender");
1823
1850
  o(this, "interactiveLine");
1824
1851
  o(this, "interactiveSourceArrow", null);
1825
1852
  o(this, "interactiveTargetArrow", null);
1826
- if (this.baseEdge = e, e instanceof Me)
1827
- throw new wt(
1853
+ if (this.baseEdge = e, e instanceof Le)
1854
+ throw new ft(
1828
1855
  "interactive edge can be configured only once"
1829
1856
  );
1830
1857
  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;
1831
1858
  const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1832
- this.interactiveLine = pt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1859
+ this.interactiveLine = wt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1833
1860
  this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1834
1861
  });
1835
1862
  }
@@ -1837,7 +1864,7 @@ class Me {
1837
1864
  this.baseEdge.render(e);
1838
1865
  }
1839
1866
  }
1840
- class Jt {
1867
+ class Qt {
1841
1868
  constructor(e, t) {
1842
1869
  o(this, "group");
1843
1870
  o(this, "line");
@@ -1854,7 +1881,7 @@ class Jt {
1854
1881
  this.baseShape.render(e);
1855
1882
  }
1856
1883
  }
1857
- class Le {
1884
+ class Re {
1858
1885
  constructor(e) {
1859
1886
  o(this, "onAfterNodeAdded");
1860
1887
  o(this, "onAfterNodeUpdated");
@@ -1947,7 +1974,7 @@ class Le {
1947
1974
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
1948
1975
  }
1949
1976
  }
1950
- class Re {
1977
+ class Ce {
1951
1978
  constructor(e) {
1952
1979
  o(this, "onAfterUpdated");
1953
1980
  this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
@@ -1959,14 +1986,14 @@ class Re {
1959
1986
  return { ...this.viewportStore.getContentMatrix() };
1960
1987
  }
1961
1988
  }
1962
- const Ce = (r, e) => {
1963
- const t = new Ee(), s = new Le(t), i = new Re(e), n = new me(t, e, r), a = {
1989
+ const Ve = (r, e) => {
1990
+ const t = new Ee(), s = new Re(t), i = new Ce(e), n = new ye(t, e, r), a = {
1964
1991
  nodes: {
1965
- centerFn: xe,
1992
+ centerFn: Se,
1966
1993
  priorityFn: () => 0
1967
1994
  },
1968
1995
  edges: {
1969
- shapeFactory: () => new Ne(),
1996
+ shapeFactory: () => new Me(),
1970
1997
  priorityFn: () => 0
1971
1998
  },
1972
1999
  ports: {
@@ -2279,7 +2306,7 @@ class Q {
2279
2306
  return e;
2280
2307
  }
2281
2308
  }
2282
- const ft = (r, e, t) => ({
2309
+ const mt = (r, e, t) => ({
2283
2310
  scale: r.scale,
2284
2311
  x: r.x + r.scale * e,
2285
2312
  y: r.y + r.scale * t
@@ -2406,7 +2433,7 @@ class X {
2406
2433
  new X(e, t, s, i);
2407
2434
  }
2408
2435
  moveViewport(e, t) {
2409
- const s = this.viewport.getViewportMatrix(), i = ft(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2436
+ const s = this.viewport.getViewportMatrix(), i = mt(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2410
2437
  prevTransform: s,
2411
2438
  nextTransform: i,
2412
2439
  canvasWidth: n,
@@ -2527,13 +2554,13 @@ class q {
2527
2554
  this.trigger.emit({ x: s, y: i, width: n, height: a });
2528
2555
  }
2529
2556
  }
2530
- const mt = () => {
2557
+ const vt = () => {
2531
2558
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2532
2559
  return r.style.position = "absolute", r.style.inset = "0", r;
2533
- }, vt = () => {
2560
+ }, Et = () => {
2534
2561
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2535
2562
  return r.setAttribute("fill", "url(#pattern)"), r;
2536
- }, Et = () => {
2563
+ }, At = () => {
2537
2564
  const r = document.createElementNS(
2538
2565
  "http://www.w3.org/2000/svg",
2539
2566
  "pattern"
@@ -2542,9 +2569,9 @@ const mt = () => {
2542
2569
  };
2543
2570
  class _ {
2544
2571
  constructor(e, t, s) {
2545
- o(this, "svg", mt());
2546
- o(this, "patternRenderingRectangle", vt());
2547
- o(this, "pattern", Et());
2572
+ o(this, "svg", vt());
2573
+ o(this, "patternRenderingRectangle", Et());
2574
+ o(this, "pattern", At());
2548
2575
  o(this, "patternContent");
2549
2576
  o(this, "tileWidth");
2550
2577
  o(this, "tileHeight");
@@ -2584,7 +2611,7 @@ class ee {
2584
2611
  o(this, "onEdgeCreated", (e) => {
2585
2612
  this.params.onAfterEdgeCreated(e);
2586
2613
  });
2587
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
2614
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ve(
2588
2615
  this.overlayLayer,
2589
2616
  this.viewportStore
2590
2617
  ), z.configure(
@@ -2638,9 +2665,9 @@ class ee {
2638
2665
  portDirection: this.params.dragPortDirection
2639
2666
  };
2640
2667
  this.isTargetDragging = s === "direct";
2641
- const [y, v] = this.isTargetDragging ? [u, w] : [w, u];
2642
- this.overlayCanvas.addNode(F(y)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
2643
- from: y.overlayId,
2668
+ const [m, v] = this.isTargetDragging ? [u, w] : [w, u];
2669
+ this.overlayCanvas.addNode(F(m)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
2670
+ from: m.overlayId,
2644
2671
  to: v.overlayId,
2645
2672
  shape: this.params.edgeShapeFactory(b.Edge)
2646
2673
  });
@@ -2649,7 +2676,7 @@ class ee {
2649
2676
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2650
2677
  }
2651
2678
  tryCreateConnection(e) {
2652
- const t = Ae(this.canvas.graph, e), s = this.staticPortId;
2679
+ const t = xe(this.canvas.graph, e), s = this.staticPortId;
2653
2680
  if (t === null) {
2654
2681
  this.params.onEdgeCreationInterrupted({
2655
2682
  staticPortId: s,
@@ -2680,7 +2707,7 @@ class te {
2680
2707
  o(this, "onEdgeReattached", (e) => {
2681
2708
  this.params.onAfterEdgeReattached(e);
2682
2709
  });
2683
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
2710
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ve(
2684
2711
  this.overlayLayer,
2685
2712
  this.viewportStore
2686
2713
  ), z.configure(
@@ -2724,7 +2751,7 @@ class te {
2724
2751
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2725
2752
  x: g.x + g.width / 2,
2726
2753
  y: g.y + g.height / 2
2727
- }, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), y = D(u, {
2754
+ }, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), m = D(u, {
2728
2755
  x: l.x - w.x,
2729
2756
  y: l.y - w.y
2730
2757
  }), v = D(u, {
@@ -2740,7 +2767,7 @@ class te {
2740
2767
  }, this.canvas.removeEdge(s);
2741
2768
  const E = {
2742
2769
  overlayId: b.Static,
2743
- portCoords: y,
2770
+ portCoords: m,
2744
2771
  portDirection: c.direction
2745
2772
  }, A = {
2746
2773
  overlayId: b.Dragging,
@@ -2770,7 +2797,7 @@ class te {
2770
2797
  });
2771
2798
  }
2772
2799
  tryCreateConnection(e) {
2773
- const t = Ae(this.canvas.graph, e);
2800
+ const t = xe(this.canvas.graph, e);
2774
2801
  if (this.overlayCanvas.removeEdge(b.Edge), t === null) {
2775
2802
  const d = this.draggingEdgePayload;
2776
2803
  this.params.onEdgeReattachInterrupted({
@@ -2852,7 +2879,7 @@ class se {
2852
2879
  });
2853
2880
  }
2854
2881
  }
2855
- class At {
2882
+ class xt {
2856
2883
  static configure(e, t) {
2857
2884
  const s = t.applyOn;
2858
2885
  switch (s.type) {
@@ -2874,7 +2901,7 @@ class At {
2874
2901
  }
2875
2902
  }
2876
2903
  }
2877
- class xt {
2904
+ class St {
2878
2905
  constructor(e, t) {
2879
2906
  o(this, "previousTimeStamp");
2880
2907
  o(this, "step", (e) => {
@@ -2899,13 +2926,13 @@ class oe {
2899
2926
  this.staticNodes.has(i) || this.canvas.updateNode(i, { x: s.x, y: s.y });
2900
2927
  });
2901
2928
  });
2902
- this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new xt(this.win, this.step);
2929
+ this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new St(this.win, this.step);
2903
2930
  }
2904
2931
  static configure(e, t, s, i) {
2905
2932
  new oe(e, t, s, i);
2906
2933
  }
2907
2934
  }
2908
- const St = () => {
2935
+ const Pt = () => {
2909
2936
  const r = document.createElement("div");
2910
2937
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
2911
2938
  }, H = () => {
@@ -2915,25 +2942,25 @@ const St = () => {
2915
2942
  const r = H();
2916
2943
  return r.style.pointerEvents = "none", r;
2917
2944
  };
2918
- class Pt {
2945
+ class bt {
2919
2946
  constructor(e) {
2920
2947
  o(this, "background", H());
2921
2948
  o(this, "main", H());
2922
2949
  o(this, "overlayConnectablePorts", pe());
2923
2950
  o(this, "overlayDraggableEdges", pe());
2924
- o(this, "host", St());
2951
+ o(this, "host", Pt());
2925
2952
  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);
2926
2953
  }
2927
2954
  destroy() {
2928
2955
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
2929
2956
  }
2930
2957
  }
2931
- const j = (r) => () => r, we = j(0), bt = () => {
2958
+ const j = (r) => () => r, we = j(0), Tt = () => {
2932
2959
  let r = 0;
2933
2960
  return () => r++;
2934
- }, Tt = (r, e) => {
2961
+ }, Dt = (r, e) => {
2935
2962
  let t = we, s = we;
2936
- const i = bt();
2963
+ const i = Tt();
2937
2964
  return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = j(r)), typeof e == "number" && (s = j(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
2938
2965
  nodesPriorityFn: t,
2939
2966
  edgesPriorityFn: s
@@ -2943,7 +2970,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
2943
2970
  return r;
2944
2971
  switch (r.type) {
2945
2972
  case "straight":
2946
- return () => new lt({
2973
+ return () => new gt({
2947
2974
  color: r.color,
2948
2975
  width: r.width,
2949
2976
  arrowLength: r.arrowLength,
@@ -2957,7 +2984,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
2957
2984
  detourDirection: r.detourDirection
2958
2985
  });
2959
2986
  case "horizontal":
2960
- return () => new ct({
2987
+ return () => new lt({
2961
2988
  color: r.color,
2962
2989
  width: r.width,
2963
2990
  arrowLength: r.arrowLength,
@@ -2970,7 +2997,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
2970
2997
  detourDistance: r.detourDistance
2971
2998
  });
2972
2999
  case "vertical":
2973
- return () => new gt({
3000
+ return () => new ut({
2974
3001
  color: r.color,
2975
3002
  width: r.width,
2976
3003
  arrowLength: r.arrowLength,
@@ -2983,7 +3010,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
2983
3010
  detourDistance: r.detourDistance
2984
3011
  });
2985
3012
  case "direct":
2986
- return () => new Ne({
3013
+ return () => new Me({
2987
3014
  color: r.color,
2988
3015
  width: r.width,
2989
3016
  arrowLength: r.arrowLength,
@@ -2994,7 +3021,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
2994
3021
  targetOffset: r.targetOffset
2995
3022
  });
2996
3023
  default:
2997
- return () => new dt({
3024
+ return () => new ct({
2998
3025
  color: r.color,
2999
3026
  width: r.width,
3000
3027
  arrowLength: r.arrowLength,
@@ -3008,15 +3035,15 @@ const j = (r) => () => r, we = j(0), bt = () => {
3008
3035
  detourDirection: r.detourDirection
3009
3036
  });
3010
3037
  }
3011
- }, Dt = (r) => {
3038
+ }, Nt = (r) => {
3012
3039
  var t, s, i, n, a;
3013
- const e = Tt(
3040
+ const e = Dt(
3014
3041
  (t = r.nodes) == null ? void 0 : t.priority,
3015
3042
  (s = r.edges) == null ? void 0 : s.priority
3016
3043
  );
3017
3044
  return {
3018
3045
  nodes: {
3019
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? xe,
3046
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Se,
3020
3047
  priorityFn: e.nodesPriorityFn
3021
3048
  },
3022
3049
  ports: {
@@ -3027,11 +3054,11 @@ const j = (r) => () => r, we = j(0), bt = () => {
3027
3054
  priorityFn: e.edgesPriorityFn
3028
3055
  }
3029
3056
  };
3030
- }, Nt = (r) => {
3031
- var u, w, y, v, E;
3057
+ }, Mt = (r) => {
3058
+ var u, w, m, v, E;
3032
3059
  const e = ((u = r.events) == null ? void 0 : u.onNodeDrag) ?? (() => {
3033
3060
  }), t = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
3034
- }), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (y = r.mouse) == null ? void 0 : y.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (A) => A.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (A) => A.button === 0;
3061
+ }), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (m = r.mouse) == null ? void 0 : m.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (A) => A.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (A) => A.button === 0;
3035
3062
  return {
3036
3063
  moveOnTop: i,
3037
3064
  moveEdgesOnTop: n,
@@ -3043,7 +3070,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
3043
3070
  nodeDragVerifier: t,
3044
3071
  onNodeDragFinished: s
3045
3072
  };
3046
- }, Mt = (r) => {
3073
+ }, Lt = (r) => {
3047
3074
  const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
3048
3075
  return (n) => {
3049
3076
  let a = n.nextTransform.x, h = n.nextTransform.y;
@@ -3053,7 +3080,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
3053
3080
  const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
3054
3081
  return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3055
3082
  };
3056
- }, Lt = (r) => {
3083
+ }, Rt = (r) => {
3057
3084
  const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3058
3085
  return (n) => {
3059
3086
  const a = n.prevTransform, h = n.nextTransform;
@@ -3074,7 +3101,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
3074
3101
  y: g
3075
3102
  };
3076
3103
  };
3077
- }, Rt = (r) => (e) => r.reduce(
3104
+ }, Ct = (r) => (e) => r.reduce(
3078
3105
  (t, s) => s({
3079
3106
  prevTransform: e.prevTransform,
3080
3107
  nextTransform: t,
@@ -3087,23 +3114,23 @@ const j = (r) => () => r, we = j(0), bt = () => {
3087
3114
  return r;
3088
3115
  switch (r.type) {
3089
3116
  case "scale-limit":
3090
- return Lt({
3117
+ return Rt({
3091
3118
  minContentScale: r.minContentScale ?? 0,
3092
3119
  maxContentScale: r.maxContentScale ?? 1 / 0
3093
3120
  });
3094
3121
  case "shift-limit":
3095
- return Mt({
3122
+ return Lt({
3096
3123
  minX: r.minX ?? -1 / 0,
3097
3124
  maxX: r.maxX ?? 1 / 0,
3098
3125
  minY: r.minY ?? -1 / 0,
3099
3126
  maxY: r.maxY ?? 1 / 0
3100
3127
  });
3101
3128
  }
3102
- }, ye = (r) => {
3103
- var y, v, E, A, R, T, N, $, ne, ae, he, de;
3104
- const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
3129
+ }, me = (r) => {
3130
+ var m, v, E, A, R, T, N, $, ne, ae, he, de;
3131
+ const e = (m = r == null ? void 0 : r.scale) == null ? void 0 : m.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
3105
3132
  let i;
3106
- s !== void 0 ? Array.isArray(s) ? i = Rt(
3133
+ s !== void 0 ? Array.isArray(s) ? i = Ct(
3107
3134
  s.map(
3108
3135
  (M) => fe(M)
3109
3136
  )
@@ -3130,24 +3157,24 @@ const j = (r) => () => r, we = j(0), bt = () => {
3130
3157
  onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
3131
3158
  })
3132
3159
  };
3133
- }, Ct = (r, e) => {
3160
+ }, Vt = (r, e) => {
3134
3161
  const t = document.createElementNS(
3135
3162
  "http://www.w3.org/2000/svg",
3136
3163
  "circle"
3137
3164
  );
3138
3165
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3139
- }, Vt = (r) => r instanceof SVGElement ? r : Ct(
3166
+ }, $t = (r) => r instanceof SVGElement ? r : Vt(
3140
3167
  (r == null ? void 0 : r.radius) ?? 1.5,
3141
3168
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3142
- ), $t = (r) => {
3143
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Vt(r.renderer ?? {});
3169
+ ), It = (r) => {
3170
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = $t(r.renderer ?? {});
3144
3171
  return {
3145
3172
  tileWidth: t,
3146
3173
  tileHeight: s,
3147
3174
  renderer: i,
3148
3175
  maxViewportScale: r.maxViewportScale ?? 10
3149
3176
  };
3150
- }, It = (r, e, t) => {
3177
+ }, Ut = (r, e, t) => {
3151
3178
  var c, g, l;
3152
3179
  const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
3153
3180
  }, h = () => {
@@ -3164,7 +3191,7 @@ const j = (r) => () => r, we = j(0), bt = () => {
3164
3191
  dragPortDirection: r.dragPortDirection ?? t,
3165
3192
  edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
3166
3193
  };
3167
- }, Ut = (r, e) => {
3194
+ }, Bt = (r, e) => {
3168
3195
  var c, g, l;
3169
3196
  const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
3170
3197
  const w = e.getPortAdjacentEdgeIds(u);
@@ -3183,10 +3210,10 @@ const j = (r) => () => r, we = j(0), bt = () => {
3183
3210
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3184
3211
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3185
3212
  };
3186
- }, Bt = (r) => ({
3213
+ }, Ft = (r) => ({
3187
3214
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3188
3215
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3189
- }), Ft = (r) => {
3216
+ }), Ot = (r) => {
3190
3217
  var e, t;
3191
3218
  return {
3192
3219
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3195,13 +3222,13 @@ const j = (r) => () => r, we = j(0), bt = () => {
3195
3222
  })
3196
3223
  };
3197
3224
  };
3198
- class Ot extends Error {
3225
+ class Wt extends Error {
3199
3226
  constructor() {
3200
3227
  super(...arguments);
3201
3228
  o(this, "name", "CanvasBuilderError");
3202
3229
  }
3203
3230
  }
3204
- class Wt {
3231
+ class kt {
3205
3232
  constructor(e, t) {
3206
3233
  this.coordinates = e, this.rand = t;
3207
3234
  }
@@ -3215,7 +3242,7 @@ class Wt {
3215
3242
  return { ex: c, ey: g, d2: h, d };
3216
3243
  }
3217
3244
  }
3218
- class Ve {
3245
+ class $e {
3219
3246
  constructor(e, t, s) {
3220
3247
  o(this, "dtSec");
3221
3248
  o(this, "k");
@@ -3231,7 +3258,7 @@ class Ve {
3231
3258
  s.forEach((a) => {
3232
3259
  t.set(a, { x: 0, y: 0 });
3233
3260
  });
3234
- const i = new Wt(
3261
+ const i = new kt(
3235
3262
  this.currentCoords,
3236
3263
  this.params.rand
3237
3264
  ), n = s.length;
@@ -3241,13 +3268,13 @@ class Ve {
3241
3268
  const c = s[d], g = i.getVector(h, c);
3242
3269
  if (g.d > this.effectiveDistance)
3243
3270
  continue;
3244
- const l = this.k / g.d2, u = l * g.ex, w = l * g.ey, y = u / 2, v = w / 2, E = t.get(h), A = t.get(c);
3245
- E.x -= y, E.y -= v, A.x += y, A.y += v;
3271
+ const l = this.k / g.d2, u = l * g.ex, w = l * g.ey, m = u / 2, v = w / 2, E = t.get(h), A = t.get(c);
3272
+ E.x -= m, E.y -= v, A.x += m, A.y += v;
3246
3273
  }
3247
3274
  }
3248
3275
  return this.graph.getAllEdgeIds().forEach((a) => {
3249
- const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId), u = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * u, y = g.ey * u, v = t.get(d.nodeId), E = t.get(c.nodeId);
3250
- v.x += w, v.y += y, E.x -= w, E.y -= y;
3276
+ const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId), u = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * u, m = g.ey * u, v = t.get(d.nodeId), E = t.get(c.nodeId);
3277
+ v.x += w, v.y += m, E.x -= w, E.y -= m;
3251
3278
  }), this.currentCoords.forEach((a, h) => {
3252
3279
  const d = t.get(h), c = {
3253
3280
  x: d.x / this.nodeMass * this.dtSec,
@@ -3257,7 +3284,7 @@ class Ve {
3257
3284
  }), e;
3258
3285
  }
3259
3286
  }
3260
- const $e = (r, e, t) => {
3287
+ const Ie = (r, e, t) => {
3261
3288
  const s = /* @__PURE__ */ new Map(), i = r.getAllNodeIds(), n = Math.sqrt(i.length) * t;
3262
3289
  return i.forEach((a) => {
3263
3290
  const h = r.getNode(a);
@@ -3267,17 +3294,17 @@ const $e = (r, e, t) => {
3267
3294
  });
3268
3295
  }), s;
3269
3296
  };
3270
- class kt {
3297
+ class zt {
3271
3298
  constructor(e) {
3272
3299
  this.params = e;
3273
3300
  }
3274
3301
  calculateCoordinates(e) {
3275
- const t = $e(
3302
+ const t = Ie(
3276
3303
  e,
3277
3304
  this.params.rand,
3278
3305
  this.params.edgeEquilibriumLength
3279
3306
  );
3280
- for (let s = 0; s < this.params.maxIterations && !(new Ve(e, t, {
3307
+ for (let s = 0; s < this.params.maxIterations && !(new $e(e, t, {
3281
3308
  rand: this.params.rand,
3282
3309
  dtSec: this.params.dtSec,
3283
3310
  nodeMass: this.params.nodeMass,
@@ -3290,17 +3317,17 @@ class kt {
3290
3317
  return t;
3291
3318
  }
3292
3319
  }
3293
- class zt {
3320
+ class Xt {
3294
3321
  constructor(e) {
3295
3322
  this.params = e;
3296
3323
  }
3297
3324
  calculateNextCoordinates(e, t) {
3298
- const s = $e(
3325
+ const s = Ie(
3299
3326
  e,
3300
3327
  this.params.rand,
3301
3328
  this.params.edgeEquilibriumLength
3302
3329
  );
3303
- return new Ve(e, s, {
3330
+ return new $e(e, s, {
3304
3331
  rand: this.params.rand,
3305
3332
  dtSec: Math.min(t, this.params.maxTimeDeltaSec),
3306
3333
  nodeMass: this.params.nodeMass,
@@ -3314,12 +3341,12 @@ class zt {
3314
3341
  }) ? /* @__PURE__ */ new Map() : s;
3315
3342
  }
3316
3343
  }
3317
- const Ie = (r) => {
3344
+ const Ue = (r) => {
3318
3345
  let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
3319
3346
  for (let n = 0, a; n < r.length; n++)
3320
3347
  a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = i ^ Math.imul(s ^ a, 951274213), i = e ^ Math.imul(i ^ a, 2716044179);
3321
3348
  return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(i ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), i = Math.imul(t ^ i >>> 19, 2716044179), e ^= t ^ s ^ i, t ^= e, s ^= e, i ^= e, [e >>> 0, t >>> 0, s >>> 0, i >>> 0];
3322
- }, Ue = (r, e, t, s) => function() {
3349
+ }, Be = (r, e, t, s) => function() {
3323
3350
  r |= 0, e |= 0, t |= 0, s |= 0;
3324
3351
  const i = (r + e | 0) + s | 0;
3325
3352
  return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + i | 0, (i >>> 0) / 4294967296;
@@ -3334,14 +3361,14 @@ const Ie = (r) => {
3334
3361
  dtSec: 0.02,
3335
3362
  maxIterations: 100,
3336
3363
  convergenceDelta: 1e-3
3337
- }), Xt = (r) => {
3364
+ }), Yt = (r) => {
3338
3365
  var e;
3339
3366
  switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
3340
3367
  case "custom":
3341
3368
  return r.algorithm.instance;
3342
3369
  default: {
3343
- const t = r == null ? void 0 : r.algorithm, s = Ie((t == null ? void 0 : t.seed) ?? S.seed), i = Ue(s[0], s[1], s[2], s[3]);
3344
- return new zt({
3370
+ const t = r == null ? void 0 : r.algorithm, s = Ue((t == null ? void 0 : t.seed) ?? S.seed), i = Be(s[0], s[1], s[2], s[3]);
3371
+ return new Xt({
3345
3372
  rand: i,
3346
3373
  maxTimeDeltaSec: (t == null ? void 0 : t.maxTimeDeltaSec) ?? S.maxTimeDeltaSec,
3347
3374
  nodeCharge: (t == null ? void 0 : t.nodeCharge) ?? S.nodeCharge,
@@ -3353,18 +3380,18 @@ const Ie = (r) => {
3353
3380
  });
3354
3381
  }
3355
3382
  }
3356
- }, Yt = (r) => r instanceof G ? {
3383
+ }, Ht = (r) => r instanceof G ? {
3357
3384
  type: "manual",
3358
3385
  trigger: r
3359
3386
  } : {
3360
3387
  type: "topologyChangeTimeout"
3361
- }, Ht = (r) => {
3388
+ }, jt = (r) => {
3362
3389
  switch (r == null ? void 0 : r.type) {
3363
3390
  case "custom":
3364
3391
  return r.instance;
3365
3392
  default: {
3366
- const e = Ie((r == null ? void 0 : r.seed) ?? S.seed), t = Ue(e[0], e[1], e[2], e[3]);
3367
- return new kt({
3393
+ const e = Ue((r == null ? void 0 : r.seed) ?? S.seed), t = Be(e[0], e[1], e[2], e[3]);
3394
+ return new zt({
3368
3395
  dtSec: (r == null ? void 0 : r.dtSec) ?? S.dtSec,
3369
3396
  maxIterations: (r == null ? void 0 : r.maxIterations) ?? S.maxIterations,
3370
3397
  rand: t,
@@ -3377,23 +3404,23 @@ const Ie = (r) => {
3377
3404
  });
3378
3405
  }
3379
3406
  }
3380
- }, jt = (r) => ({
3381
- algorithm: Ht(r == null ? void 0 : r.algorithm),
3382
- applyOn: Yt(r == null ? void 0 : r.applyOn)
3383
- }), Gt = (r, e) => ({
3407
+ }, Gt = (r) => ({
3408
+ algorithm: jt(r == null ? void 0 : r.algorithm),
3409
+ applyOn: Ht(r == null ? void 0 : r.applyOn)
3410
+ }), Kt = (r, e) => ({
3384
3411
  ...r,
3385
3412
  nodeDragVerifier: (t) => (e.add(t), r.nodeDragVerifier(t)),
3386
3413
  onNodeDragFinished: (t) => {
3387
3414
  e.delete(t), r.onNodeDragFinished(t);
3388
3415
  }
3389
- }), Kt = (r, e) => {
3416
+ }), Zt = (r, e) => {
3390
3417
  r.onBeforeNodeRemoved.subscribe((t) => {
3391
3418
  e.delete(t);
3392
3419
  }), r.onBeforeClear.subscribe(() => {
3393
3420
  e.clear();
3394
3421
  });
3395
3422
  };
3396
- class Qt {
3423
+ class qt {
3397
3424
  constructor(e) {
3398
3425
  o(this, "used", !1);
3399
3426
  o(this, "canvasDefaults", {});
@@ -3403,8 +3430,8 @@ class Qt {
3403
3430
  o(this, "connectablePortsConfig", {});
3404
3431
  o(this, "draggableEdgesConfig", {});
3405
3432
  o(this, "virtualScrollConfig");
3406
- o(this, "layoutConfig");
3407
- o(this, "animatedLayoutConfig");
3433
+ o(this, "layoutConfig", {});
3434
+ o(this, "animatedLayoutConfig", {});
3408
3435
  o(this, "hasDraggableNodes", !1);
3409
3436
  o(this, "hasTransformableViewport", !1);
3410
3437
  o(this, "hasNodeResizeReactiveEdges", !1);
@@ -3415,9 +3442,9 @@ class Qt {
3415
3442
  o(this, "hasLayout", !1);
3416
3443
  o(this, "boxRenderingTrigger", new G());
3417
3444
  o(this, "graphStore", new Ee());
3418
- o(this, "viewportStore", new je());
3419
- o(this, "graph", new Le(this.graphStore));
3420
- o(this, "viewport", new Re(this.viewportStore));
3445
+ o(this, "viewportStore", new Ge());
3446
+ o(this, "graph", new Re(this.graphStore));
3447
+ o(this, "viewport", new Ce(this.viewportStore));
3421
3448
  o(this, "window", window);
3422
3449
  o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3423
3450
  this.element = e;
@@ -3475,34 +3502,34 @@ class Qt {
3475
3502
  * enables nodes positioning with specified layout
3476
3503
  */
3477
3504
  enableLayout(e) {
3478
- return this.layoutConfig = e, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
3505
+ return this.layoutConfig = e ?? {}, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
3479
3506
  }
3480
3507
  /**
3481
3508
  * enables animated nodes positioning with specified layout
3482
3509
  */
3483
3510
  enableAnimatedLayout(e) {
3484
- return this.animatedLayoutConfig = e, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
3511
+ return this.animatedLayoutConfig = e ?? {}, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
3485
3512
  }
3486
3513
  /**
3487
3514
  * builds final canvas
3488
3515
  */
3489
3516
  build() {
3490
3517
  if (this.used)
3491
- throw new Ot("CanvasBuilder is a single use object");
3518
+ throw new Wt("CanvasBuilder is a single use object");
3492
3519
  this.used = !0;
3493
- const e = new Pt(this.element);
3494
- let t = new me(
3520
+ const e = new bt(this.element);
3521
+ let t = new ye(
3495
3522
  this.graphStore,
3496
3523
  this.viewportStore,
3497
3524
  e.main
3498
3525
  );
3499
- this.virtualScrollConfig !== void 0 && (t = new Xe(
3526
+ this.virtualScrollConfig !== void 0 && (t = new Ye(
3500
3527
  t,
3501
3528
  this.graphStore,
3502
3529
  this.boxRenderingTrigger,
3503
- Ft(this.virtualScrollConfig)
3504
- )), t = new Ye(t, this.graphStore);
3505
- const s = Dt(this.canvasDefaults), i = new ve(
3530
+ Ot(this.virtualScrollConfig)
3531
+ )), t = new He(t, this.graphStore);
3532
+ const s = Nt(this.canvasDefaults), i = new ve(
3506
3533
  this.graph,
3507
3534
  this.viewport,
3508
3535
  this.graphStore,
@@ -3512,11 +3539,11 @@ class Qt {
3512
3539
  );
3513
3540
  if (this.hasBackground && _.configure(
3514
3541
  i,
3515
- $t(this.backgroundConfig),
3542
+ It(this.backgroundConfig),
3516
3543
  e.background
3517
3544
  ), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
3518
- let a = Nt(this.dragConfig);
3519
- this.hasAnimatedLayout && (a = Gt(
3545
+ let a = Mt(this.dragConfig);
3546
+ this.hasAnimatedLayout && (a = Kt(
3520
3547
  a,
3521
3548
  this.animationStaticNodes
3522
3549
  )), Q.configure(
@@ -3527,7 +3554,7 @@ class Qt {
3527
3554
  );
3528
3555
  }
3529
3556
  if (this.hasUserConnectablePorts) {
3530
- const a = It(
3557
+ const a = Ut(
3531
3558
  this.connectablePortsConfig,
3532
3559
  s.edges.shapeFactory,
3533
3560
  s.ports.direction
@@ -3541,7 +3568,7 @@ class Qt {
3541
3568
  );
3542
3569
  }
3543
3570
  if (this.hasUserDraggableEdges) {
3544
- const a = Ut(
3571
+ const a = Bt(
3545
3572
  this.draggableEdgesConfig,
3546
3573
  i.graph
3547
3574
  );
@@ -3557,23 +3584,23 @@ class Qt {
3557
3584
  i,
3558
3585
  e.main,
3559
3586
  this.window,
3560
- ye(this.transformConfig),
3587
+ me(this.transformConfig),
3561
3588
  this.boxRenderingTrigger,
3562
- Bt(this.virtualScrollConfig)
3589
+ Ft(this.virtualScrollConfig)
3563
3590
  ) : this.hasTransformableViewport && X.configure(
3564
3591
  i,
3565
3592
  e.main,
3566
3593
  this.window,
3567
- ye(this.transformConfig)
3568
- ), this.hasLayout && At.configure(
3594
+ me(this.transformConfig)
3595
+ ), this.hasLayout && xt.configure(
3569
3596
  i,
3570
- jt(this.layoutConfig)
3571
- ), this.hasAnimatedLayout && (Kt(
3597
+ Gt(this.layoutConfig)
3598
+ ), this.hasAnimatedLayout && (Zt(
3572
3599
  i.graph,
3573
3600
  this.animationStaticNodes
3574
3601
  ), oe.configure(
3575
3602
  i,
3576
- Xt(this.animatedLayoutConfig),
3603
+ Yt(this.animatedLayoutConfig),
3577
3604
  this.animationStaticNodes,
3578
3605
  this.window
3579
3606
  ));
@@ -3584,16 +3611,16 @@ class Qt {
3584
3611
  }
3585
3612
  }
3586
3613
  export {
3587
- dt as BezierEdgeShape,
3588
- Qt as CanvasBuilder,
3589
- Ot as CanvasBuilderError,
3614
+ ct as BezierEdgeShape,
3615
+ qt as CanvasBuilder,
3616
+ Wt as CanvasBuilderError,
3590
3617
  P as CanvasError,
3591
- Ne as DirectEdgeShape,
3618
+ Me as DirectEdgeShape,
3592
3619
  G as EventSubject,
3593
- ct as HorizontalEdgeShape,
3594
- wt as InteractiveEdgeError,
3595
- Me as InteractiveEdgeShape,
3596
- Jt as MidpointEdgeShape,
3597
- lt as StraightEdgeShape,
3598
- gt as VerticalEdgeShape
3620
+ lt as HorizontalEdgeShape,
3621
+ ft as InteractiveEdgeError,
3622
+ Le as InteractiveEdgeShape,
3623
+ Qt as MidpointEdgeShape,
3624
+ gt as StraightEdgeShape,
3625
+ ut as VerticalEdgeShape
3599
3626
  };