@html-graph/html-graph 8.10.0 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,7 @@ class Ee {
52
52
  this.clear(), this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
53
53
  }
54
54
  updateNodePosition(e) {
55
- const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(o, s), d = a.x - n * h.x, c = a.y - n * h.y;
55
+ const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(), a = this.viewportStore.getViewportMatrix().scale, { payload: n } = t, h = n.centerFn(o, s), d = n.x - a * h.x, c = n.y - a * h.y;
56
56
  t.element.style.transform = `translate(${d}px, ${c}px)`;
57
57
  }
58
58
  updateNodePriority(e) {
@@ -66,12 +66,12 @@ class Ee {
66
66
  this.edgeIdToElementMap.set(e, s), this.container.appendChild(s);
67
67
  }
68
68
  renderEdge(e) {
69
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to), n = o.element.getBoundingClientRect(), a = s.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
69
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to), a = o.element.getBoundingClientRect(), n = s.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
70
70
  o,
71
- n,
71
+ a,
72
72
  h,
73
73
  d
74
- ), g = this.createEdgeRenderPort(s, a, h, d);
74
+ ), g = this.createEdgeRenderPort(s, n, h, d);
75
75
  let u = L.Line;
76
76
  o.element === s.element ? u = L.PortCycle : o.nodeId === s.nodeId && (u = L.NodeCycle), t.payload.shape.render({ from: c, to: g, category: u });
77
77
  }
@@ -80,13 +80,13 @@ class Ee {
80
80
  t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
81
81
  }
82
82
  createEdgeRenderPort(e, t, o, s) {
83
- const n = this.viewportStore.createContentCoords({
83
+ const a = this.viewportStore.createContentCoords({
84
84
  x: t.left - o.left,
85
85
  y: t.top - o.top
86
86
  });
87
87
  return {
88
- x: n.x,
89
- y: n.y,
88
+ x: a.x,
89
+ y: a.y,
90
90
  width: t.width * s,
91
91
  height: t.height * s,
92
92
  direction: e.payload.direction
@@ -109,7 +109,7 @@ class et {
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), g = Math.max(n.y, a.y);
112
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, a = this.graphStore.getNode(o).payload, n = this.graphStore.getNode(s).payload, h = Math.min(a.x, n.x), d = Math.max(a.x, n.x), c = Math.min(a.y, n.y), g = Math.max(a.y, n.y);
113
113
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
114
114
  }
115
115
  }
@@ -120,21 +120,21 @@ class tt {
120
120
  i(this, "renderingBox");
121
121
  i(this, "updateViewport", (e) => {
122
122
  this.renderingBox.setRenderingBox(e);
123
- const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
124
- this.graphStore.getAllNodeIds().forEach((a) => {
125
- const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
126
- h && !d ? t.add(a) : !h && d && o.add(a);
127
- }), this.graphStore.getAllEdgeIds().forEach((a) => {
128
- const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
129
- h && (this.renderingBox.hasNode(g) || (t.add(g), o.delete(g)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(a) : !h && d && n.add(a);
130
- }), n.forEach((a) => {
131
- this.handleDetachEdge(a);
132
- }), o.forEach((a) => {
133
- this.handleDetachNode(a);
134
- }), t.forEach((a) => {
135
- this.attachedNodes.has(a) || this.handleAttachNode(a);
136
- }), s.forEach((a) => {
137
- this.handleAttachEdge(a);
123
+ const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
124
+ this.graphStore.getAllNodeIds().forEach((n) => {
125
+ const h = this.renderingBox.hasNode(n), d = this.attachedNodes.has(n);
126
+ h && !d ? t.add(n) : !h && d && o.add(n);
127
+ }), this.graphStore.getAllEdgeIds().forEach((n) => {
128
+ const h = this.renderingBox.hasEdge(n), d = this.attachedEdges.has(n), c = this.graphStore.getEdge(n), g = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
129
+ h && (this.renderingBox.hasNode(g) || (t.add(g), o.delete(g)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(n) : !h && d && a.add(n);
130
+ }), a.forEach((n) => {
131
+ this.handleDetachEdge(n);
132
+ }), o.forEach((n) => {
133
+ this.handleDetachNode(n);
134
+ }), t.forEach((n) => {
135
+ this.attachedNodes.has(n) || this.handleAttachNode(n);
136
+ }), s.forEach((n) => {
137
+ this.handleAttachEdge(n);
138
138
  });
139
139
  });
140
140
  this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new et(this.graphStore), this.trigger.subscribe(this.updateViewport);
@@ -556,13 +556,13 @@ class be {
556
556
  throw new S(
557
557
  b.updateNonexistentEdgeTarget(e, t.to)
558
558
  );
559
- const s = this.getEdge(e), n = s.payload;
559
+ const s = this.getEdge(e), a = s.payload;
560
560
  this.removeEdgeInternal(e), this.addEdgeInternal({
561
561
  id: e,
562
562
  from: t.from ?? s.from,
563
563
  to: t.to ?? s.to,
564
- shape: n.shape,
565
- priority: n.priority
564
+ shape: a.shape,
565
+ priority: a.priority
566
566
  });
567
567
  }
568
568
  const o = this.edges.get(e);
@@ -613,47 +613,47 @@ class be {
613
613
  getNodeIncomingEdgeIds(e) {
614
614
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
615
615
  return t.forEach((s) => {
616
- this.getPortIncomingEdgeIds(s).filter((n) => {
617
- const a = this.getEdge(n);
618
- return this.getPort(a.from).nodeId !== e;
619
- }).forEach((n) => {
620
- o.push(n);
616
+ this.getPortIncomingEdgeIds(s).filter((a) => {
617
+ const n = this.getEdge(a);
618
+ return this.getPort(n.from).nodeId !== e;
619
+ }).forEach((a) => {
620
+ o.push(a);
621
621
  });
622
622
  }), o;
623
623
  }
624
624
  getNodeOutgoingEdgeIds(e) {
625
625
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
626
626
  return t.forEach((s) => {
627
- this.getPortOutgoingEdgeIds(s).filter((n) => {
628
- const a = this.getEdge(n);
629
- return this.getPort(a.to).nodeId !== e;
630
- }).forEach((n) => {
631
- o.push(n);
627
+ this.getPortOutgoingEdgeIds(s).filter((a) => {
628
+ const n = this.getEdge(a);
629
+ return this.getPort(n.to).nodeId !== e;
630
+ }).forEach((a) => {
631
+ o.push(a);
632
632
  });
633
633
  }), o;
634
634
  }
635
635
  getNodeCycleEdgeIds(e) {
636
636
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
637
637
  return t.forEach((s) => {
638
- this.getPortCycleEdgeIds(s).forEach((n) => {
639
- o.push(n);
640
- }), this.getPortIncomingEdgeIds(s).filter((n) => {
641
- const a = this.getEdge(n);
642
- return this.getPort(a.to).nodeId === e;
643
- }).forEach((n) => {
644
- o.push(n);
638
+ this.getPortCycleEdgeIds(s).forEach((a) => {
639
+ o.push(a);
640
+ }), this.getPortIncomingEdgeIds(s).filter((a) => {
641
+ const n = this.getEdge(a);
642
+ return this.getPort(n.to).nodeId === e;
643
+ }).forEach((a) => {
644
+ o.push(a);
645
645
  });
646
646
  }), o;
647
647
  }
648
648
  getNodeAdjacentEdgeIds(e) {
649
649
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
650
650
  return t.forEach((s) => {
651
- this.getPortIncomingEdgeIds(s).forEach((n) => {
652
- o.push(n);
653
- }), this.getPortOutgoingEdgeIds(s).forEach((n) => {
654
- o.push(n);
655
- }), this.getPortCycleEdgeIds(s).forEach((n) => {
656
- o.push(n);
651
+ this.getPortIncomingEdgeIds(s).forEach((a) => {
652
+ o.push(a);
653
+ }), this.getPortOutgoingEdgeIds(s).forEach((a) => {
654
+ o.push(a);
655
+ }), this.getPortCycleEdgeIds(s).forEach((a) => {
656
+ o.push(a);
657
657
  });
658
658
  }), o;
659
659
  }
@@ -767,8 +767,8 @@ class q {
767
767
  }
768
768
  }
769
769
  const it = (r, e, t) => {
770
- const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
771
- return e >= o && e <= o + n && t >= s && t <= s + a;
770
+ const { x: o, y: s, width: a, height: n } = r.getBoundingClientRect();
771
+ return e >= o && e <= o + a && t >= s && t <= s + n;
772
772
  }, nt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, F = (r, e, t, o) => it(e, t, o) && nt(r, t, o), k = (r, e) => {
773
773
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
774
774
  }, H = (r) => {
@@ -810,8 +810,8 @@ function* Ne(r, e) {
810
810
  for (const o of t) {
811
811
  if (o.shadowRoot !== null) {
812
812
  const s = Ne(o.shadowRoot, e);
813
- for (const n of s)
814
- yield n;
813
+ for (const a of s)
814
+ yield a;
815
815
  }
816
816
  yield o;
817
817
  }
@@ -841,14 +841,14 @@ const Ce = (r, e) => ({
841
841
  }, s = {
842
842
  x: e.x + e.width / 2,
843
843
  y: e.y + e.height / 2
844
- }, n = Math.min(o.x, s.x) - t, a = Math.min(o.y, s.y) - t, h = 2 * t, d = Math.abs(s.x - o.x) + h, c = Math.abs(s.y - o.y) + h;
844
+ }, a = Math.min(o.x, s.x) - t, n = Math.min(o.y, s.y) - t, h = 2 * t, d = Math.abs(s.x - o.x) + h, c = Math.abs(s.y - o.y) + h;
845
845
  return {
846
- x: n,
847
- y: a,
846
+ x: a,
847
+ y: n,
848
848
  width: d,
849
849
  height: c,
850
- from: { x: o.x - n, y: o.y - a },
851
- to: { x: s.x - n, y: s.y - a }
850
+ from: { x: o.x - a, y: o.y - n },
851
+ to: { x: s.x - a, y: s.y - n }
852
852
  };
853
853
  };
854
854
  class ht {
@@ -859,8 +859,8 @@ class ht {
859
859
  from: t,
860
860
  to: o,
861
861
  arrowLength: s,
862
- fromDir: n,
863
- toDir: a,
862
+ fromDir: a,
863
+ toDir: n,
864
864
  curvature: h,
865
865
  hasSourceArrow: d,
866
866
  hasTargetArrow: c
@@ -868,18 +868,18 @@ class ht {
868
868
  this.midpoint = { x: g, y: u };
869
869
  const l = x(
870
870
  { x: t.x + s, y: t.y },
871
- n,
871
+ a,
872
872
  t
873
873
  ), p = x(
874
874
  { x: o.x - s, y: o.y },
875
- a,
875
+ n,
876
876
  o
877
877
  ), y = {
878
- x: l.x + n.x * h,
879
- y: l.y + n.y * h
878
+ x: l.x + a.x * h,
879
+ y: l.y + a.y * h
880
880
  }, w = {
881
- x: p.x - a.x * h,
882
- y: p.y - a.y * h
881
+ x: p.x - n.x * h,
882
+ y: p.y - n.y * h
883
883
  }, f = `M ${l.x} ${l.y} C ${y.x} ${y.y}, ${w.x} ${w.y}, ${p.x} ${p.y}`, m = d ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, A = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
884
884
  this.path = `${m}${f}${A}`;
885
885
  }
@@ -892,8 +892,8 @@ class dt {
892
892
  hasSourceArrow: t,
893
893
  hasTargetArrow: o,
894
894
  curvature: s,
895
- fromDir: n,
896
- toDir: a,
895
+ fromDir: a,
896
+ toDir: n,
897
897
  detourDir: h,
898
898
  from: d,
899
899
  to: c,
@@ -901,25 +901,25 @@ class dt {
901
901
  detourDistance: u
902
902
  } = e, l = t ? x(
903
903
  { x: d.x + g, y: d.y },
904
- n,
904
+ a,
905
905
  d
906
906
  ) : d, p = o ? x(
907
907
  {
908
908
  x: c.x - g,
909
909
  y: c.y
910
910
  },
911
- a,
911
+ n,
912
912
  c
913
913
  ) : c, y = Math.cos(h) * u, w = Math.sin(h) * u, f = x(
914
914
  { x: d.x + g, y: d.y },
915
- n,
915
+ a,
916
916
  d
917
917
  ), m = {
918
918
  x: f.x + y,
919
919
  y: f.y + w
920
920
  }, A = x(
921
921
  { x: c.x - g, y: c.y },
922
- a,
922
+ n,
923
923
  c
924
924
  ), N = {
925
925
  x: A.x + y,
@@ -928,11 +928,11 @@ class dt {
928
928
  x: (m.x + N.x) / 2,
929
929
  y: (m.y + N.y) / 2
930
930
  }, T = {
931
- x: f.x + s * n.x,
932
- y: f.y + s * n.y
931
+ x: f.x + s * a.x,
932
+ y: f.y + s * a.y
933
933
  }, I = {
934
- x: A.x - s * a.x,
935
- y: A.y - s * a.y
934
+ x: A.x - s * n.x,
935
+ y: A.y - s * n.y
936
936
  }, V = {
937
937
  x: f.x + y,
938
938
  y: f.y + w
@@ -966,15 +966,15 @@ const ee = Object.freeze({
966
966
  const t = [];
967
967
  if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
968
968
  const o = r.length - 1;
969
- let s = 0, n = 0, a = 0;
969
+ let s = 0, a = 0, n = 0;
970
970
  r.forEach((h, d) => {
971
971
  let c = 0, g = 0, u = 0;
972
972
  const l = d > 0, p = d < o, y = l && p;
973
- if (l && (c = -s, g = -n, u = a), p) {
973
+ if (l && (c = -s, g = -a, u = n), p) {
974
974
  const T = r[d + 1];
975
- s = T.x - h.x, n = T.y - h.y, a = Math.sqrt(s * s + n * n);
975
+ s = T.x - h.x, a = T.y - h.y, n = Math.sqrt(s * s + a * a);
976
976
  }
977
- const f = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, m = y ? { x: h.x + s * f, y: h.y + n * f } : h, N = u !== 0 ? Math.min((y ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, C = y ? { x: h.x + c * N, y: h.y + g * N } : h;
977
+ const f = n !== 0 ? Math.min((y ? e : 0) / n, d < o - 1 ? 0.5 : 1) : 0, m = y ? { x: h.x + s * f, y: h.y + a * f } : h, N = u !== 0 ? Math.min((y ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, C = y ? { x: h.x + c * N, y: h.y + g * N } : h;
978
978
  d > 0 && t.push(`L ${C.x} ${C.y}`), y && t.push(
979
979
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${m.x} ${m.y}`
980
980
  );
@@ -1003,8 +1003,8 @@ const ee = Object.freeze({
1003
1003
  midpoint: l
1004
1004
  };
1005
1005
  }
1006
- const a = o === t, h = (r.y + e.y) / 2;
1007
- if (a) {
1006
+ const n = o === t, h = (r.y + e.y) / 2;
1007
+ if (n) {
1008
1008
  const c = { x: e.x, y: r.y };
1009
1009
  return {
1010
1010
  points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
@@ -1025,28 +1025,28 @@ class lt {
1025
1025
  from: t,
1026
1026
  to: o,
1027
1027
  fromDir: s,
1028
- toDir: n,
1029
- arrowLength: a,
1028
+ toDir: a,
1029
+ arrowLength: n,
1030
1030
  arrowOffset: h,
1031
1031
  roundness: d,
1032
1032
  hasSourceArrow: c,
1033
1033
  hasTargetArrow: g
1034
1034
  } = e, u = c ? x(
1035
- { x: t.x + a, y: t.y },
1035
+ { x: t.x + n, y: t.y },
1036
1036
  s,
1037
1037
  t
1038
1038
  ) : t, l = g ? x(
1039
1039
  {
1040
- x: o.x - a,
1040
+ x: o.x - n,
1041
1041
  y: o.y
1042
1042
  },
1043
- n,
1043
+ a,
1044
1044
  o
1045
- ) : o, p = a + h, y = x(
1045
+ ) : o, p = n + h, y = x(
1046
1046
  { x: t.x + p, y: t.y },
1047
1047
  s,
1048
1048
  t
1049
- ), w = x({ x: o.x - p, y: o.y }, n, o), f = ct(
1049
+ ), w = x({ x: o.x - p, y: o.y }, a, o), f = ct(
1050
1050
  {
1051
1051
  x: y.x,
1052
1052
  y: y.y,
@@ -1055,7 +1055,7 @@ class lt {
1055
1055
  {
1056
1056
  x: w.x,
1057
1057
  y: w.y,
1058
- dirX: n.x
1058
+ dirX: a.x
1059
1059
  }
1060
1060
  );
1061
1061
  this.path = R(
@@ -1072,8 +1072,8 @@ class gt {
1072
1072
  hasSourceArrow: t,
1073
1073
  hasTargetArrow: o,
1074
1074
  from: s,
1075
- to: n,
1076
- arrowLength: a,
1075
+ to: a,
1076
+ arrowLength: n,
1077
1077
  fromDir: h,
1078
1078
  toDir: d,
1079
1079
  arrowOffset: c,
@@ -1081,17 +1081,17 @@ class gt {
1081
1081
  detourDistance: u,
1082
1082
  roundness: l
1083
1083
  } = e, p = t ? x(
1084
- { x: s.x + a, y: s.y },
1084
+ { x: s.x + n, y: s.y },
1085
1085
  h,
1086
1086
  s
1087
1087
  ) : s, y = o ? x(
1088
1088
  {
1089
- x: n.x - a,
1090
- y: n.y
1089
+ x: a.x - n,
1090
+ y: a.y
1091
1091
  },
1092
1092
  d,
1093
- n
1094
- ) : n, w = a + c, f = Math.cos(g) * u, m = Math.sin(g) * u, A = x(
1093
+ a
1094
+ ) : a, w = n + c, f = Math.cos(g) * u, m = Math.sin(g) * u, A = x(
1095
1095
  { x: s.x + w, y: s.y },
1096
1096
  h,
1097
1097
  s
@@ -1099,9 +1099,9 @@ class gt {
1099
1099
  x: A.x + f,
1100
1100
  y: A.y + m
1101
1101
  }, C = x(
1102
- { x: n.x - w, y: n.y },
1102
+ { x: a.x - w, y: a.y },
1103
1103
  d,
1104
- n
1104
+ a
1105
1105
  ), T = {
1106
1106
  x: C.x + f,
1107
1107
  y: C.y + m
@@ -1123,8 +1123,8 @@ class ut {
1123
1123
  from: t,
1124
1124
  to: o,
1125
1125
  hasSourceArrow: s,
1126
- hasTargetArrow: n,
1127
- arrowLength: a,
1126
+ hasTargetArrow: a,
1127
+ arrowLength: n,
1128
1128
  fromDir: h,
1129
1129
  toDir: d,
1130
1130
  arrowOffset: c,
@@ -1133,13 +1133,13 @@ class ut {
1133
1133
  s,
1134
1134
  h,
1135
1135
  t,
1136
- a
1136
+ n
1137
1137
  ), l = this.createArrowPoint(
1138
- n,
1138
+ a,
1139
1139
  d,
1140
1140
  o,
1141
- -a
1142
- ), p = a + c, y = { x: t.x + p, y: t.y }, w = x(y, h, t), f = { x: o.x - p, y: o.y }, m = x(f, d, o);
1141
+ -n
1142
+ ), p = n + c, y = { x: t.x + p, y: t.y }, w = x(y, h, t), f = { x: o.x - p, y: o.y }, m = x(f, d, o);
1143
1143
  this.path = R(
1144
1144
  [u, w, m, l],
1145
1145
  g
@@ -1150,11 +1150,11 @@ class ut {
1150
1150
  createArrowPoint(e, t, o, s) {
1151
1151
  if (!e)
1152
1152
  return o;
1153
- const n = {
1153
+ const a = {
1154
1154
  x: o.x + s,
1155
1155
  y: o.y
1156
1156
  };
1157
- return x(n, t, o);
1157
+ return x(a, t, o);
1158
1158
  }
1159
1159
  }
1160
1160
  const pt = (r, e) => {
@@ -1179,8 +1179,8 @@ const pt = (r, e) => {
1179
1179
  midpoint: l
1180
1180
  };
1181
1181
  }
1182
- const a = o === t, h = (r.x + e.x) / 2;
1183
- if (a) {
1182
+ const n = o === t, h = (r.x + e.x) / 2;
1183
+ if (n) {
1184
1184
  const c = { x: r.x, y: e.y };
1185
1185
  return {
1186
1186
  points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
@@ -1201,24 +1201,24 @@ class yt {
1201
1201
  from: t,
1202
1202
  to: o,
1203
1203
  hasSourceArrow: s,
1204
- hasTargetArrow: n,
1205
- arrowLength: a,
1204
+ hasTargetArrow: a,
1205
+ arrowLength: n,
1206
1206
  arrowOffset: h,
1207
1207
  fromDir: d,
1208
1208
  toDir: c,
1209
1209
  roundness: g
1210
1210
  } = e, u = s ? x(
1211
- { x: t.x + a, y: t.y },
1211
+ { x: t.x + n, y: t.y },
1212
1212
  d,
1213
1213
  t
1214
- ) : t, l = n ? x(
1214
+ ) : t, l = a ? x(
1215
1215
  {
1216
- x: o.x - a,
1216
+ x: o.x - n,
1217
1217
  y: o.y
1218
1218
  },
1219
1219
  c,
1220
1220
  o
1221
- ) : o, p = a + h, y = x(
1221
+ ) : o, p = n + h, y = x(
1222
1222
  { x: t.x + p, y: t.y },
1223
1223
  d,
1224
1224
  t
@@ -1244,7 +1244,7 @@ class te {
1244
1244
  constructor(e) {
1245
1245
  i(this, "path");
1246
1246
  i(this, "midpoint");
1247
- const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
1247
+ const { side: t, arrowLength: o, arrowOffset: s, dir: a, origin: n, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
1248
1248
  { x: o, y: 0 },
1249
1249
  { x: d, y: 0 },
1250
1250
  { x: d, y: t },
@@ -1253,7 +1253,7 @@ class te {
1253
1253
  { x: d, y: -t },
1254
1254
  { x: d, y: 0 },
1255
1255
  { x: o, y: 0 }
1256
- ].map((p) => x(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 ${u[0].x} ${u[0].y} `;
1256
+ ].map((p) => x(p, a, { x: 0, y: 0 })).map((p) => ({ x: p.x + n.x, y: p.y + n.y })), l = `M ${n.x} ${n.y} L ${u[0].x} ${u[0].y} `;
1257
1257
  this.path = `${h ? "" : l}${R(u, e.roundness)}`, this.midpoint = { x: (u[3].x + u[4].x) / 2, y: (u[3].y + u[4].y) / 2 };
1258
1258
  }
1259
1259
  }
@@ -1261,17 +1261,17 @@ class wt {
1261
1261
  constructor(e) {
1262
1262
  i(this, "path");
1263
1263
  i(this, "midpoint");
1264
- const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, g = Math.sqrt(d * d - s * s), u = g * s / d, l = g + o + t, p = t + u, w = [
1264
+ const { arrowLength: t, radius: o, smallRadius: s, dir: a, origin: n, hasArrow: h } = e, d = s + o, c = s * o / d, g = Math.sqrt(d * d - s * s), u = g * s / d, l = g + o + t, p = t + u, w = [
1265
1265
  { x: t, y: 0 },
1266
1266
  { x: p, y: c },
1267
1267
  { x: p, y: -c },
1268
1268
  { x: l, y: 0 }
1269
- ].map((A) => x(A, n, { x: 0, y: 0 })).map((A) => ({ x: A.x + a.x, y: A.y + a.y })), f = [
1269
+ ].map((A) => x(A, a, { x: 0, y: 0 })).map((A) => ({ x: A.x + n.x, y: A.y + n.y })), f = [
1270
1270
  `M ${w[0].x} ${w[0].y}`,
1271
1271
  `A ${s} ${s} 0 0 1 ${w[1].x} ${w[1].y}`,
1272
1272
  `A ${o} ${o} 0 1 0 ${w[2].x} ${w[2].y}`,
1273
1273
  `A ${s} ${s} 0 0 1 ${w[0].x} ${w[0].y}`
1274
- ].join(" "), m = `M ${a.x} ${a.y} L ${w[0].x} ${w[0].y} `;
1274
+ ].join(" "), m = `M ${n.x} ${n.y} L ${w[0].x} ${w[0].y} `;
1275
1275
  this.path = `${h ? "" : m}${f}`, this.midpoint = w[3];
1276
1276
  }
1277
1277
  }
@@ -1284,8 +1284,8 @@ class ft {
1284
1284
  from: t,
1285
1285
  to: o,
1286
1286
  sourceOffset: s,
1287
- targetOffset: n,
1288
- hasSourceArrow: a,
1287
+ targetOffset: a,
1288
+ hasSourceArrow: n,
1289
1289
  hasTargetArrow: h,
1290
1290
  arrowLength: d
1291
1291
  } = e;
@@ -1297,13 +1297,13 @@ class ft {
1297
1297
  }
1298
1298
  const u = { x: c, y: g }, l = this.createDirectLinePoint({
1299
1299
  offset: s,
1300
- hasArrow: a,
1300
+ hasArrow: n,
1301
1301
  flip: 1,
1302
1302
  shift: t,
1303
1303
  arrowLength: d,
1304
1304
  dir: u
1305
1305
  }), p = this.createDirectLinePoint({
1306
- offset: n,
1306
+ offset: a,
1307
1307
  hasArrow: h,
1308
1308
  flip: -1,
1309
1309
  shift: o,
@@ -1313,10 +1313,10 @@ class ft {
1313
1313
  this.path = `M ${l.x} ${l.y} L ${p.x} ${p.y}`;
1314
1314
  }
1315
1315
  createDirectLinePoint(e) {
1316
- const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
1316
+ const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: a, shift: n } = e;
1317
1317
  return {
1318
- x: n.x * s + a.x,
1319
- y: n.y * s + a.y
1318
+ x: a.x * s + n.x,
1319
+ y: a.y * s + n.y
1320
1320
  };
1321
1321
  }
1322
1322
  }
@@ -1332,32 +1332,32 @@ class xt {
1332
1332
  hasSourceArrow: t,
1333
1333
  hasTargetArrow: o,
1334
1334
  arrowLength: s,
1335
- from: n,
1336
- to: a,
1335
+ from: a,
1336
+ to: n,
1337
1337
  fromDir: h,
1338
1338
  toDir: d,
1339
1339
  arrowOffset: c,
1340
1340
  roundness: g,
1341
1341
  detourDistance: u
1342
1342
  } = e, l = t ? x(
1343
- { x: n.x + s, y: n.y },
1343
+ { x: a.x + s, y: a.y },
1344
1344
  h,
1345
- n
1346
- ) : n, p = o ? x(
1345
+ a
1346
+ ) : a, p = o ? x(
1347
1347
  {
1348
- x: a.x - s,
1349
- y: a.y
1348
+ x: n.x - s,
1349
+ y: n.y
1350
1350
  },
1351
1351
  d,
1352
- a
1353
- ) : a, y = s + c, w = x(
1354
- { x: n.x + y, y: n.y },
1355
- h,
1356
1352
  n
1353
+ ) : n, y = s + c, w = x(
1354
+ { x: a.x + y, y: a.y },
1355
+ h,
1356
+ a
1357
1357
  ), f = x(
1358
- { x: a.x - y, y: a.y },
1358
+ { x: n.x - y, y: n.y },
1359
1359
  d,
1360
- a
1360
+ n
1361
1361
  ), m = vt(w, f, u);
1362
1362
  this.midpoint = {
1363
1363
  x: (w.x + f.x) / 2,
@@ -1387,8 +1387,8 @@ class At {
1387
1387
  hasSourceArrow: t,
1388
1388
  hasTargetArrow: o,
1389
1389
  arrowLength: s,
1390
- fromDir: n,
1391
- toDir: a,
1390
+ fromDir: a,
1391
+ toDir: n,
1392
1392
  from: h,
1393
1393
  to: d,
1394
1394
  arrowOffset: c,
@@ -1396,22 +1396,22 @@ class At {
1396
1396
  roundness: u
1397
1397
  } = e, l = t ? x(
1398
1398
  { x: h.x + s, y: h.y },
1399
- n,
1399
+ a,
1400
1400
  h
1401
1401
  ) : h, p = o ? x(
1402
1402
  {
1403
1403
  x: d.x - s,
1404
1404
  y: d.y
1405
1405
  },
1406
- a,
1406
+ n,
1407
1407
  d
1408
1408
  ) : d, y = s + c, w = x(
1409
1409
  { x: h.x + y, y: h.y },
1410
- n,
1410
+ a,
1411
1411
  h
1412
1412
  ), f = x(
1413
1413
  { x: d.x - y, y: d.y },
1414
- a,
1414
+ n,
1415
1415
  d
1416
1416
  ), m = mt(w, f, g);
1417
1417
  this.midpoint = {
@@ -1469,21 +1469,21 @@ class X {
1469
1469
  this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line = De(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
1470
1470
  }
1471
1471
  render(e) {
1472
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Te(
1472
+ const { x: t, y: o, width: s, height: a, from: n, to: h } = Te(
1473
1473
  e.from,
1474
1474
  e.to,
1475
1475
  this.params.padding
1476
1476
  );
1477
- Re(this.svg, { x: t, y: o, width: s, height: n });
1477
+ Re(this.svg, { x: t, y: o, width: s, height: a });
1478
1478
  const d = we(e.from.direction), c = we(e.to.direction);
1479
1479
  let g = { x: -c.x, y: -c.y }, u;
1480
1480
  e.category === L.PortCycle ? (u = this.params.createCyclePath, g = d) : e.category === L.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1481
- const l = u(a, h, d, c);
1481
+ const l = u(n, h, d, c);
1482
1482
  this.line.setAttribute("d", l.path);
1483
1483
  let p = null;
1484
1484
  this.sourceArrow && (p = this.arrowRenderer({
1485
1485
  direction: d,
1486
- shift: a,
1486
+ shift: n,
1487
1487
  arrowLength: this.params.arrowLength
1488
1488
  }), this.sourceArrow.setAttribute("d", p));
1489
1489
  let y = null;
@@ -1508,13 +1508,13 @@ const Et = (r) => (e) => {
1508
1508
  ).map((h) => ({
1509
1509
  x: h.x + e.shift.x,
1510
1510
  y: h.y + e.shift.y
1511
- })), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1512
- return `${s} ${n} ${a} Z`;
1511
+ })), s = `M ${o[0].x} ${o[0].y}`, a = `L ${o[1].x} ${o[1].y}`, n = `L ${o[2].x} ${o[2].y}`;
1512
+ return `${s} ${a} ${n} Z`;
1513
1513
  }, St = (r) => (e) => {
1514
- 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 = [
1514
+ const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), a = s + t, n = o + t - t * (o + t) / a, h = t * s / a, c = [
1515
1515
  { x: 0, y: 0 },
1516
- { x: a, y: -h },
1517
- { x: a, y: h }
1516
+ { x: n, y: -h },
1517
+ { x: n, y: h }
1518
1518
  ].map(
1519
1519
  (y) => x(y, e.direction, { x: 0, y: 0 })
1520
1520
  ).map((y) => ({
@@ -1536,12 +1536,12 @@ const Et = (r) => (e) => {
1536
1536
  x: e.arrowLength + r.smallRadius,
1537
1537
  y: 0
1538
1538
  }
1539
- ), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1539
+ ), n = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1540
1540
  (u) => x(u, e.direction, { x: 0, y: 0 })
1541
1541
  ).map((u) => ({
1542
1542
  x: u.x + e.shift.x,
1543
1543
  y: u.y + e.shift.y
1544
- })), 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}`, g = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1544
+ })), h = `M ${n[0].x} ${n[0].y}`, d = `A ${o} ${o} 0 0 1 ${n[1].x} ${n[1].y}`, c = `A ${t} ${t} 0 0 1 ${n[2].x} ${n[2].y}`, g = `A ${o} ${o} 0 0 1 ${n[0].x} ${n[0].y}`;
1545
1545
  return `${h} ${d} ${c} ${g}`;
1546
1546
  }, U = (r) => {
1547
1547
  if (typeof r == "function")
@@ -1863,14 +1863,14 @@ class Le {
1863
1863
  [this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = U((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 = Me(this.color), this.svg.appendChild(this.group), this.line = De(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
1864
1864
  }
1865
1865
  render(e) {
1866
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Te(
1866
+ const { x: t, y: o, width: s, height: a, from: n, to: h } = Te(
1867
1867
  e.from,
1868
1868
  e.to,
1869
1869
  O
1870
1870
  );
1871
- Re(this.svg, { x: t, y: o, width: s, height: n });
1871
+ Re(this.svg, { x: t, y: o, width: s, height: a });
1872
1872
  const d = new ft({
1873
- from: a,
1873
+ from: n,
1874
1874
  to: h,
1875
1875
  sourceOffset: this.sourceOffset,
1876
1876
  targetOffset: this.targetOffset,
@@ -1885,8 +1885,8 @@ class Le {
1885
1885
  this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (g = "", this.targetArrow.setAttribute("d", g));
1886
1886
  else {
1887
1887
  const l = {
1888
- x: (h.x - a.x) / u,
1889
- y: (h.y - a.y) / u
1888
+ x: (h.x - n.x) / u,
1889
+ y: (h.y - n.y) / u
1890
1890
  };
1891
1891
  if (this.sourceArrow) {
1892
1892
  const p = {
@@ -1971,8 +1971,8 @@ class Mr {
1971
1971
  i(this, "onAfterRender");
1972
1972
  i(this, "svg");
1973
1973
  this.baseShape = e, this.midpointElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((o) => {
1974
- const s = o.edgePath.midpoint, n = `translate(${s.x}px, ${s.y}px)`;
1975
- this.midpointElement.style.setProperty("transform", n);
1974
+ const s = o.edgePath.midpoint, a = `translate(${s.x}px, ${s.y}px)`;
1975
+ this.midpointElement.style.setProperty("transform", a);
1976
1976
  });
1977
1977
  }
1978
1978
  render(e) {
@@ -2259,12 +2259,12 @@ class $e {
2259
2259
  const It = (r, e) => Symbol.iterator in r ? {
2260
2260
  minContentScale: e.focus.minContentScale,
2261
2261
  nodes: r,
2262
- contentOffset: e.focus.contentOffset,
2262
+ contentPadding: e.focus.contentPadding,
2263
2263
  animationDuration: e.focus.animationDuration
2264
2264
  } : {
2265
2265
  minContentScale: r.minContentScale ?? e.focus.minContentScale,
2266
2266
  nodes: r.nodes ?? [],
2267
- contentOffset: r.contentOffset ?? e.focus.contentOffset,
2267
+ contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
2268
2268
  animationDuration: r.animationDuration ?? e.focus.animationDuration
2269
2269
  }, Be = (r, e, t) => ({
2270
2270
  scale: r.scale,
@@ -2286,20 +2286,20 @@ class Oe {
2286
2286
  this.viewportStore.patchContentMatrix(e);
2287
2287
  }
2288
2288
  center(e, t) {
2289
- 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;
2290
- let g = Be(a, d, c);
2289
+ const { width: o, height: s } = this.viewportStore.getDimensions(), a = { x: o / 2, y: s / 2 }, n = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - a.x, c = h.y - a.y;
2290
+ let g = Be(n, d, c);
2291
2291
  const u = t == null ? void 0 : t.contentScale;
2292
2292
  if (u !== void 0) {
2293
2293
  const p = 1 / u;
2294
2294
  g = Ue(
2295
2295
  g,
2296
- p / a.scale,
2297
- n.x,
2298
- n.y
2296
+ p / n.scale,
2297
+ a.x,
2298
+ a.y
2299
2299
  );
2300
2300
  }
2301
2301
  const l = (t == null ? void 0 : t.animationDuration) ?? 0;
2302
- l > 0 ? this.animateNavigation(a, g, l) : this.viewportStore.patchViewportMatrix(g);
2302
+ l > 0 ? this.animateNavigation(n, g, l) : this.viewportStore.patchViewportMatrix(g);
2303
2303
  }
2304
2304
  focus(e) {
2305
2305
  const t = It(e ?? {}, this.params);
@@ -2311,19 +2311,19 @@ class Oe {
2311
2311
  this.viewportStore.destroy();
2312
2312
  }
2313
2313
  navigate(e) {
2314
- let t = 1 / 0, o = -1 / 0, s = 1 / 0, n = -1 / 0, a = 0;
2314
+ let t = 1 / 0, o = -1 / 0, s = 1 / 0, a = -1 / 0, n = 0;
2315
2315
  const h = /* @__PURE__ */ new Set();
2316
2316
  for (const d of e.nodes)
2317
2317
  h.add(d);
2318
2318
  if (this.graphStore.getAllNodeIds().forEach((d) => {
2319
2319
  const { payload: c } = this.graphStore.getNode(d);
2320
- c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s), n = Math.max(c.y, n), a++);
2321
- }), a > 0) {
2322
- t -= e.contentOffset, s -= e.contentOffset, o += e.contentOffset, n += e.contentOffset;
2320
+ c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s), a = Math.max(c.y, a), n++);
2321
+ }), n > 0) {
2322
+ t -= e.contentPadding, s -= e.contentPadding, o += e.contentPadding, a += e.contentPadding;
2323
2323
  const d = {
2324
2324
  x: (t + o) / 2,
2325
- y: (s + n) / 2
2326
- }, { scale: c } = this.viewportStore.getContentMatrix(), g = (n - s) * c, u = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), y = Math.max(
2325
+ y: (s + a) / 2
2326
+ }, { scale: c } = this.viewportStore.getContentMatrix(), g = (a - s) * c, u = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), y = Math.max(
2327
2327
  u / l,
2328
2328
  g / p
2329
2329
  ), w = y > 1 ? c / y : c, f = Math.max(w, e.minContentScale);
@@ -2335,24 +2335,24 @@ class Oe {
2335
2335
  }
2336
2336
  animateNavigation(e, t, o) {
2337
2337
  let s;
2338
- const n = {
2338
+ const a = {
2339
2339
  scale: t.scale - e.scale,
2340
2340
  x: t.x - e.x,
2341
2341
  y: t.y - e.y
2342
- }, a = (h) => {
2342
+ }, n = (h) => {
2343
2343
  s === void 0 && (s = h);
2344
2344
  const d = Math.min((h - s) / o, 1);
2345
2345
  d <= 1 && this.viewportStore.patchViewportMatrix({
2346
- scale: e.scale + d * n.scale,
2347
- x: e.x + d * n.x,
2348
- y: e.y + d * n.y
2349
- }), d < 1 && this.win.requestAnimationFrame(a);
2346
+ scale: e.scale + d * a.scale,
2347
+ x: e.x + d * a.x,
2348
+ y: e.y + d * a.y
2349
+ }), d < 1 && this.win.requestAnimationFrame(n);
2350
2350
  };
2351
- this.win.requestAnimationFrame(a);
2351
+ this.win.requestAnimationFrame(n);
2352
2352
  }
2353
2353
  }
2354
2354
  const We = (r, e, t) => {
2355
- const o = new be(), s = new Ie(o), n = new $e(e), a = new Ee(o, e, r), h = {
2355
+ const o = new be(), s = new Ie(o), a = new $e(e), n = new Ee(o, e, r), h = {
2356
2356
  nodes: {
2357
2357
  centerFn: Ce,
2358
2358
  priorityFn: () => 0
@@ -2366,11 +2366,11 @@ const We = (r, e, t) => {
2366
2366
  }
2367
2367
  }, d = new Ve(
2368
2368
  o,
2369
- a,
2369
+ n,
2370
2370
  h
2371
2371
  ), c = {
2372
2372
  focus: {
2373
- contentOffset: 0,
2373
+ contentPadding: 0,
2374
2374
  minContentScale: 0,
2375
2375
  schedule: re,
2376
2376
  animationDuration: 0
@@ -2381,7 +2381,7 @@ const We = (r, e, t) => {
2381
2381
  c,
2382
2382
  t
2383
2383
  );
2384
- return new Se(s, n, d, g);
2384
+ return new Se(s, a, d, g);
2385
2385
  };
2386
2386
  class G {
2387
2387
  constructor(e, t, o, s) {
@@ -2426,8 +2426,8 @@ class G {
2426
2426
  const t = e;
2427
2427
  if (t.touches.length !== 1)
2428
2428
  return;
2429
- const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(s)[0];
2430
- this.params.onPortPointerDown(n, {
2429
+ const o = t.touches[0], s = e.currentTarget, a = this.canvas.graph.findPortIdsByElement(s)[0];
2430
+ this.params.onPortPointerDown(a, {
2431
2431
  x: o.clientX,
2432
2432
  y: o.clientY
2433
2433
  }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
@@ -2546,7 +2546,7 @@ class oe {
2546
2546
  const t = e;
2547
2547
  if (!this.params.mouseDownEventVerifier(t))
2548
2548
  return;
2549
- const o = e.currentTarget, s = this.graph.findNodeIdByElement(o), n = this.graph.getNode(s);
2549
+ const o = e.currentTarget, s = this.graph.findNodeIdByElement(o), a = this.graph.getNode(s);
2550
2550
  if (!this.params.nodeDragVerifier(s))
2551
2551
  return;
2552
2552
  this.params.onNodeDragStarted(s), e.stopPropagation();
@@ -2556,8 +2556,8 @@ class oe {
2556
2556
  });
2557
2557
  this.grabbedNode = {
2558
2558
  nodeId: s,
2559
- dx: h.x - n.x,
2560
- dy: h.y - n.y
2559
+ dx: h.x - a.x,
2560
+ dy: h.y - a.y
2561
2561
  }, k(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2562
2562
  passive: !0
2563
2563
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
@@ -2569,12 +2569,12 @@ class oe {
2569
2569
  if (t.touches.length !== 1)
2570
2570
  return;
2571
2571
  e.stopPropagation();
2572
- const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(s), a = this.graph.getNode(n);
2572
+ const o = t.touches[0], s = e.currentTarget, a = this.canvas.graph.findNodeIdByElement(s), n = this.graph.getNode(a);
2573
2573
  if (!this.params.nodeDragVerifier({
2574
- nodeId: n,
2575
- element: a.element,
2576
- x: a.x,
2577
- y: a.y
2574
+ nodeId: a,
2575
+ element: n.element,
2576
+ x: n.x,
2577
+ y: n.y
2578
2578
  }))
2579
2579
  return;
2580
2580
  const d = this.calculateContentPoint({
@@ -2582,10 +2582,10 @@ class oe {
2582
2582
  y: o.clientY
2583
2583
  });
2584
2584
  this.grabbedNode = {
2585
- nodeId: n,
2586
- dx: d.x - a.x,
2587
- dy: d.y - a.y
2588
- }, this.moveNodeOnTop(n), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2585
+ nodeId: a,
2586
+ dx: d.x - n.x,
2587
+ dy: d.y - n.y
2588
+ }, this.moveNodeOnTop(a), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2589
2589
  passive: !0
2590
2590
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2591
2591
  passive: !0
@@ -2652,10 +2652,10 @@ class oe {
2652
2652
  const o = this.calculateContentPoint(t), s = {
2653
2653
  x: o.x - e.dx,
2654
2654
  y: o.y - e.dy
2655
- }, n = this.adjustNodeCoords(s);
2655
+ }, a = this.adjustNodeCoords(s);
2656
2656
  this.canvas.updateNode(e.nodeId, {
2657
- x: n.x,
2658
- y: n.y
2657
+ x: a.x,
2658
+ y: a.y
2659
2659
  }), this.params.onNodeDrag(e.nodeId);
2660
2660
  }
2661
2661
  moveNodeOnTop(e) {
@@ -2720,14 +2720,14 @@ const W = (r) => {
2720
2720
  const o = e.reduce(
2721
2721
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2722
2722
  [0, 0]
2723
- ), s = [o[0] / t, o[1] / t], a = e.map((h) => [h[0] - s[0], h[1] - s[1]]).reduce(
2723
+ ), s = [o[0] / t, o[1] / t], n = e.map((h) => [h[0] - s[0], h[1] - s[1]]).reduce(
2724
2724
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2725
2725
  0
2726
2726
  );
2727
2727
  return {
2728
2728
  x: s[0],
2729
2729
  y: s[1],
2730
- scale: a / t,
2730
+ scale: n / t,
2731
2731
  touchesCnt: t,
2732
2732
  touches: e
2733
2733
  };
@@ -2768,8 +2768,8 @@ class j {
2768
2768
  i(this, "onWheelScroll", (e) => {
2769
2769
  if (!this.params.mouseWheelEventVerifier(e))
2770
2770
  return;
2771
- const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t, n = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2772
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2771
+ const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t, a = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2772
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s, a), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2773
2773
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2774
2774
  }, this.params.scaleWheelFinishTimeout);
2775
2775
  });
@@ -2798,8 +2798,8 @@ class j {
2798
2798
  -(t.x - this.prevTouches.x),
2799
2799
  -(t.y - this.prevTouches.y)
2800
2800
  ), t.touchesCnt === 2) {
2801
- const { left: s, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - s, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2802
- this.scaleViewport(c, a, h);
2801
+ const { left: s, top: a } = this.element.getBoundingClientRect(), n = this.prevTouches.x - s, h = this.prevTouches.y - a, c = 1 / (t.scale / this.prevTouches.scale);
2802
+ this.scaleViewport(c, n, h);
2803
2803
  }
2804
2804
  this.prevTouches = t;
2805
2805
  });
@@ -2825,19 +2825,19 @@ class j {
2825
2825
  new j(e, t, o, s);
2826
2826
  }
2827
2827
  moveViewport(e, t) {
2828
- const o = this.viewport.getViewportMatrix(), s = Be(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2828
+ const o = this.viewport.getViewportMatrix(), s = Be(o, e, t), { width: a, height: n } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2829
2829
  prevTransform: o,
2830
2830
  nextTransform: s,
2831
- canvasWidth: n,
2832
- canvasHeight: a
2831
+ canvasWidth: a,
2832
+ canvasHeight: n
2833
2833
  });
2834
2834
  this.performTransform(h);
2835
2835
  }
2836
2836
  scaleViewport(e, t, o) {
2837
- const s = this.canvas.viewport.getViewportMatrix(), n = Ue(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2837
+ const s = this.canvas.viewport.getViewportMatrix(), a = Ue(s, e, t, o), { width: n, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2838
2838
  prevTransform: s,
2839
- nextTransform: n,
2840
- canvasWidth: a,
2839
+ nextTransform: a,
2840
+ canvasWidth: n,
2841
2841
  canvasHeight: h
2842
2842
  });
2843
2843
  this.performTransform(d);
@@ -2874,7 +2874,7 @@ class j {
2874
2874
  }
2875
2875
  }
2876
2876
  class se {
2877
- constructor(e, t, o, s, n, a) {
2877
+ constructor(e, t, o, s, a, n) {
2878
2878
  i(this, "nodeHorizontal");
2879
2879
  i(this, "nodeVertical");
2880
2880
  i(this, "viewport");
@@ -2897,7 +2897,7 @@ class se {
2897
2897
  this.userTransformInProgress || this.loadAreaAroundViewport();
2898
2898
  });
2899
2899
  i(this, "userTransformInProgress", !1);
2900
- this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2900
+ this.canvas = e, this.element = t, this.window = o, this.trigger = a, this.params = n, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2901
2901
  this.scheduleLoadAreaAroundViewport();
2902
2902
  });
2903
2903
  const h = {
@@ -2927,14 +2927,14 @@ class se {
2927
2927
  h
2928
2928
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2929
2929
  }
2930
- static configure(e, t, o, s, n, a) {
2930
+ static configure(e, t, o, s, a, n) {
2931
2931
  new se(
2932
2932
  e,
2933
2933
  t,
2934
2934
  o,
2935
2935
  s,
2936
- n,
2937
- a
2936
+ a,
2937
+ n
2938
2938
  );
2939
2939
  }
2940
2940
  scheduleLoadAreaAroundViewport() {
@@ -2944,12 +2944,12 @@ class se {
2944
2944
  }
2945
2945
  scheduleEnsureViewportAreaLoaded() {
2946
2946
  setTimeout(() => {
2947
- 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, g = s + a + this.nodeHorizontal, u = n + h + this.nodeVertical;
2947
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: a } = this.viewport.getViewportMatrix(), n = e * o, h = t * o, d = s - this.nodeHorizontal, c = a - this.nodeVertical, g = s + n + this.nodeHorizontal, u = a + h + this.nodeVertical;
2948
2948
  this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
2949
2949
  });
2950
2950
  }
2951
2951
  loadAreaAroundViewport() {
2952
- 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, g = 3 * a + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
2952
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: a } = this.viewport.getViewportMatrix(), n = e * o, h = t * o, d = s - n - this.nodeHorizontal, c = a - h - this.nodeVertical, g = 3 * n + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
2953
2953
  this.trigger.emit({
2954
2954
  x: d,
2955
2955
  y: c,
@@ -2990,8 +2990,8 @@ class ie {
2990
2990
  this.canvas = e, this.backgroundHost = o, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
2991
2991
  const s = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2992
2992
  this.patternContent.setAttribute("transform", s), this.pattern.appendChild(this.patternContent);
2993
- const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2994
- n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2993
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2994
+ a.appendChild(this.pattern), this.svg.appendChild(a), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2995
2995
  this.updateDimensions();
2996
2996
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2997
2997
  }
@@ -3010,14 +3010,14 @@ class ie {
3010
3010
  }
3011
3011
  }
3012
3012
  class ne {
3013
- constructor(e, t, o, s, n) {
3013
+ constructor(e, t, o, s, a) {
3014
3014
  i(this, "overlayCanvas");
3015
3015
  i(this, "staticPortId", null);
3016
3016
  i(this, "isTargetDragging", !0);
3017
3017
  i(this, "onEdgeCreated", (e) => {
3018
3018
  this.params.onAfterEdgeCreated(e);
3019
3019
  });
3020
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = We(
3020
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = a, this.overlayCanvas = We(
3021
3021
  this.overlayLayer,
3022
3022
  this.viewportStore,
3023
3023
  this.window
@@ -3031,33 +3031,33 @@ class ne {
3031
3031
  onStopDrag: () => {
3032
3032
  this.resetDragState();
3033
3033
  },
3034
- onPortPointerDown: (a, h) => {
3035
- const d = this.params.connectionTypeResolver(a);
3036
- return d === null ? !1 : (this.grabPort(a, h, d), !0);
3034
+ onPortPointerDown: (n, h) => {
3035
+ const d = this.params.connectionTypeResolver(n);
3036
+ return d === null ? !1 : (this.grabPort(n, h, d), !0);
3037
3037
  },
3038
- onPointerMove: (a) => {
3039
- this.moveDraggingPort(a);
3038
+ onPointerMove: (n) => {
3039
+ this.moveDraggingPort(n);
3040
3040
  },
3041
- onPointerUp: (a) => {
3042
- this.tryCreateConnection(a);
3041
+ onPointerUp: (n) => {
3042
+ this.tryCreateConnection(n);
3043
3043
  }
3044
3044
  }
3045
3045
  );
3046
3046
  }
3047
- static configure(e, t, o, s, n) {
3047
+ static configure(e, t, o, s, a) {
3048
3048
  new ne(
3049
3049
  e,
3050
3050
  t,
3051
3051
  o,
3052
3052
  s,
3053
- n
3053
+ a
3054
3054
  );
3055
3055
  }
3056
3056
  grabPort(e, t, o) {
3057
3057
  const s = this.canvas.graph.getPort(e);
3058
3058
  this.staticPortId = e;
3059
- const n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3060
- x: a - d.x,
3059
+ const a = s.element.getBoundingClientRect(), n = a.x + a.width / 2, h = a.y + a.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3060
+ x: n - d.x,
3061
3061
  y: h - d.y
3062
3062
  }), g = this.canvas.viewport.createContentCoords({
3063
3063
  x: t.x - d.x,
@@ -3091,8 +3091,8 @@ class ne {
3091
3091
  });
3092
3092
  return;
3093
3093
  }
3094
- const s = this.isTargetDragging ? o : t, n = this.isTargetDragging ? t : o, a = { from: s, to: n }, h = this.params.connectionPreprocessor(a);
3095
- h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
3094
+ const s = this.isTargetDragging ? o : t, a = this.isTargetDragging ? t : o, n = { from: s, to: a }, h = this.params.connectionPreprocessor(n);
3095
+ h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(n);
3096
3096
  }
3097
3097
  moveDraggingPort(e) {
3098
3098
  const t = this.overlayLayer.getBoundingClientRect(), o = this.canvas.viewport.createContentCoords({
@@ -3106,7 +3106,7 @@ class ne {
3106
3106
  }
3107
3107
  }
3108
3108
  class ae {
3109
- constructor(e, t, o, s, n) {
3109
+ constructor(e, t, o, s, a) {
3110
3110
  i(this, "overlayCanvas");
3111
3111
  i(this, "staticPortId", null);
3112
3112
  i(this, "isTargetDragging", !0);
@@ -3114,7 +3114,7 @@ class ae {
3114
3114
  i(this, "onEdgeReattached", (e) => {
3115
3115
  this.params.onAfterEdgeReattached(e);
3116
3116
  });
3117
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = We(
3117
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = a, this.overlayCanvas = We(
3118
3118
  this.overlayLayer,
3119
3119
  this.viewportStore,
3120
3120
  this.window
@@ -3128,31 +3128,31 @@ class ae {
3128
3128
  onStopDrag: () => {
3129
3129
  this.resetDragState();
3130
3130
  },
3131
- onPortPointerDown: (a, h) => this.tryStartEdgeDragging(a, h),
3132
- onPointerMove: (a) => {
3133
- this.moveDraggingPort(a);
3131
+ onPortPointerDown: (n, h) => this.tryStartEdgeDragging(n, h),
3132
+ onPointerMove: (n) => {
3133
+ this.moveDraggingPort(n);
3134
3134
  },
3135
- onPointerUp: (a) => {
3136
- this.tryCreateConnection(a);
3135
+ onPointerUp: (n) => {
3136
+ this.tryCreateConnection(n);
3137
3137
  }
3138
3138
  }
3139
3139
  );
3140
3140
  }
3141
- static configure(e, t, o, s, n) {
3141
+ static configure(e, t, o, s, a) {
3142
3142
  new ae(
3143
3143
  e,
3144
3144
  t,
3145
3145
  o,
3146
3146
  s,
3147
- n
3147
+ a
3148
3148
  );
3149
3149
  }
3150
3150
  tryStartEdgeDragging(e, t) {
3151
3151
  const o = this.params.draggingEdgeResolver(e);
3152
3152
  if (o === null || !this.canvas.graph.hasEdge(o))
3153
3153
  return !1;
3154
- const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
3155
- this.staticPortId = h, this.isTargetDragging = a;
3154
+ const s = this.canvas.graph.getEdge(o), a = e === s.from, n = e === s.to, h = a ? s.to : s.from;
3155
+ this.staticPortId = h, this.isTargetDragging = n;
3156
3156
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), u = {
3157
3157
  x: g.x + g.width / 2,
3158
3158
  y: g.y + g.height / 2
@@ -3214,13 +3214,13 @@ class ae {
3214
3214
  });
3215
3215
  return;
3216
3216
  }
3217
- const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
3218
- id: n.id,
3217
+ const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], a = this.draggingEdgePayload, n = {
3218
+ id: a.id,
3219
3219
  from: o,
3220
3220
  to: s,
3221
- shape: n.shape,
3222
- priority: n.priority
3223
- }, h = this.params.connectionPreprocessor(a);
3221
+ shape: a.shape,
3222
+ priority: a.priority
3223
+ }, h = this.params.connectionPreprocessor(n);
3224
3224
  if (h !== null)
3225
3225
  this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeReattached), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeReattached);
3226
3226
  else {
@@ -3357,10 +3357,10 @@ const Yt = (r) => {
3357
3357
  const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
3358
3358
  }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3359
3359
  }), o = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
3360
- }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (m = r.mouse) == null ? void 0 : m.mouseDownEventVerifier, g = c !== void 0 ? c : (N) => N.button === 0, u = (A = r.mouse) == null ? void 0 : A.mouseUpEventVerifier, l = u !== void 0 ? u : (N) => N.button === 0;
3360
+ }), a = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && a, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (m = r.mouse) == null ? void 0 : m.mouseDownEventVerifier, g = c !== void 0 ? c : (N) => N.button === 0, u = (A = r.mouse) == null ? void 0 : A.mouseUpEventVerifier, l = u !== void 0 ? u : (N) => N.button === 0;
3361
3361
  return {
3362
- moveOnTop: n,
3363
- moveEdgesOnTop: a,
3362
+ moveOnTop: a,
3363
+ moveEdgesOnTop: n,
3364
3364
  dragCursor: d,
3365
3365
  gridSize: r.gridSize ?? null,
3366
3366
  mouseDownEventVerifier: g,
@@ -3372,28 +3372,28 @@ const Yt = (r) => {
3372
3372
  };
3373
3373
  }, Xt = (r) => {
3374
3374
  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;
3375
- return (n) => {
3376
- let a = n.nextTransform.x, h = n.nextTransform.y;
3377
- a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3378
- const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3379
- 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));
3380
- const g = n.canvasHeight * n.prevTransform.scale, u = s - g;
3381
- return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
3375
+ return (a) => {
3376
+ let n = a.nextTransform.x, h = a.nextTransform.y;
3377
+ n < e && n < a.prevTransform.x && (n = Math.min(a.prevTransform.x, e));
3378
+ const d = a.canvasWidth * a.prevTransform.scale, c = t - d;
3379
+ n > c && n > a.prevTransform.x && (n = Math.max(a.prevTransform.x, c)), h < o && h < a.prevTransform.y && (h = Math.min(a.prevTransform.y, o));
3380
+ const g = a.canvasHeight * a.prevTransform.scale, u = s - g;
3381
+ return h > u && h > a.prevTransform.y && (h = Math.max(a.prevTransform.y, u)), { scale: a.nextTransform.scale, x: n, y: h };
3382
3382
  };
3383
3383
  }, Gt = (r) => {
3384
3384
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3385
- return (n) => {
3386
- const a = n.prevTransform, h = n.nextTransform;
3385
+ return (a) => {
3386
+ const n = a.prevTransform, h = a.nextTransform;
3387
3387
  let d = h.scale, c = h.x, g = h.y;
3388
- if (h.scale > s && h.scale > a.scale) {
3389
- d = Math.max(a.scale, s), c = a.x, g = a.y;
3390
- const u = (d - a.scale) / (h.scale - a.scale);
3391
- c = a.x + (h.x - a.x) * u, g = a.y + (h.y - a.y) * u;
3388
+ if (h.scale > s && h.scale > n.scale) {
3389
+ d = Math.max(n.scale, s), c = n.x, g = n.y;
3390
+ const u = (d - n.scale) / (h.scale - n.scale);
3391
+ c = n.x + (h.x - n.x) * u, g = n.y + (h.y - n.y) * u;
3392
3392
  }
3393
- if (h.scale < o && h.scale < a.scale) {
3394
- d = Math.min(a.scale, o), c = a.x, g = a.y;
3395
- const u = (d - a.scale) / (h.scale - a.scale);
3396
- c = a.x + (h.x - a.x) * u, g = a.y + (h.y - a.y) * u;
3393
+ if (h.scale < o && h.scale < n.scale) {
3394
+ d = Math.min(n.scale, o), c = n.x, g = n.y;
3395
+ const u = (d - n.scale) / (h.scale - n.scale);
3396
+ c = n.x + (h.x - n.x) * u, g = n.y + (h.y - n.y) * u;
3397
3397
  }
3398
3398
  return {
3399
3399
  scale: d,
@@ -3435,7 +3435,7 @@ const Yt = (r) => {
3435
3435
  (D) => xe(D)
3436
3436
  )
3437
3437
  ) : s = xe(o) : s = (D) => D.nextTransform;
3438
- const n = ((w = r == null ? void 0 : r.shift) == null ? void 0 : w.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
3438
+ const a = ((w = r == null ? void 0 : r.shift) == null ? void 0 : w.cursor) !== void 0 ? r.shift.cursor : "grab", n = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
3439
3439
  }), h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onTransformChange) ?? (() => {
3440
3440
  }), d = (A = r == null ? void 0 : r.shift) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, g = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, u = g !== void 0 ? g : (D) => D.button === 0, l = (C = r == null ? void 0 : r.scale) == null ? void 0 : C.mouseWheelEventVerifier, p = l !== void 0 ? l : () => !0;
3441
3441
  return {
@@ -3444,10 +3444,10 @@ const Yt = (r) => {
3444
3444
  }),
3445
3445
  onTransformFinished: ((I = r == null ? void 0 : r.events) == null ? void 0 : I.onTransformFinished) ?? (() => {
3446
3446
  }),
3447
- onBeforeTransformChange: a,
3447
+ onBeforeTransformChange: n,
3448
3448
  onTransformChange: h,
3449
3449
  transformPreprocessor: s,
3450
- shiftCursor: n,
3450
+ shiftCursor: a,
3451
3451
  mouseDownEventVerifier: c,
3452
3452
  mouseUpEventVerifier: u,
3453
3453
  mouseWheelEventVerifier: p,
@@ -3546,16 +3546,16 @@ const Yt = (r) => {
3546
3546
  }
3547
3547
  }, Zt = (r, e, t) => {
3548
3548
  var c, g, u;
3549
- const o = () => "direct", s = (l) => l, n = (l) => l.button === 0, a = () => {
3549
+ const o = () => "direct", s = (l) => l, a = (l) => l.button === 0, n = () => {
3550
3550
  }, h = () => {
3551
3551
  }, d = () => {
3552
3552
  };
3553
3553
  return {
3554
3554
  connectionTypeResolver: r.connectionTypeResolver ?? o,
3555
3555
  connectionPreprocessor: r.connectionPreprocessor ?? s,
3556
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3557
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3558
- onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3556
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? a,
3557
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? a,
3558
+ onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? n,
3559
3559
  onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3560
3560
  onEdgeCreationPrevented: ((u = r.events) == null ? void 0 : u.onEdgeCreationPrevented) ?? h,
3561
3561
  dragPortDirection: r.dragPortDirection ?? t,
@@ -3563,10 +3563,10 @@ const Yt = (r) => {
3563
3563
  };
3564
3564
  }, _t = (r, e) => {
3565
3565
  var c, g, u;
3566
- const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, n = (l) => {
3566
+ const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, a = (l) => {
3567
3567
  const p = e.getPortAdjacentEdgeIds(l);
3568
3568
  return p.length > 0 ? p[p.length - 1] : null;
3569
- }, a = () => {
3569
+ }, n = () => {
3570
3570
  }, h = () => {
3571
3571
  }, d = () => {
3572
3572
  };
@@ -3574,9 +3574,9 @@ const Yt = (r) => {
3574
3574
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3575
3575
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
3576
3576
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
3577
- draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3577
+ draggingEdgeResolver: r.draggingEdgeResolver ?? a,
3578
3578
  draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? le(r.draggingEdgeShape) : null,
3579
- onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3579
+ onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? n,
3580
3580
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3581
3581
  onEdgeReattachPrevented: ((u = r.events) == null ? void 0 : u.onEdgeReattachPrevented) ?? h
3582
3582
  };
@@ -3613,10 +3613,10 @@ class ze {
3613
3613
  const t = /* @__PURE__ */ new Map();
3614
3614
  return this.graph.getAllNodeIds().forEach((s) => {
3615
3615
  t.set(s, { x: 0, y: 0 });
3616
- }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((s, n) => {
3617
- const a = t.get(n), h = {
3618
- x: a.x / this.nodeMass * this.dt,
3619
- y: a.y / this.nodeMass * this.dt
3616
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((s, a) => {
3617
+ const n = t.get(a), h = {
3618
+ x: n.x / this.nodeMass * this.dt,
3619
+ y: n.y / this.nodeMass * this.dt
3620
3620
  };
3621
3621
  e = Math.max(
3622
3622
  e,
@@ -3628,10 +3628,10 @@ class ze {
3628
3628
  }
3629
3629
  applyEdgeForces(e) {
3630
3630
  this.graph.getAllEdgeIds().forEach((t) => {
3631
- 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(
3632
- a,
3631
+ const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), a = this.graph.getPort(o.to), n = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(a.nodeId), d = this.distanceVectorGenerator.create(
3632
+ n,
3633
3633
  h
3634
- ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * g, l = d.ey * g, p = e.get(s.nodeId), y = e.get(n.nodeId);
3634
+ ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * g, l = d.ey * g, p = e.get(s.nodeId), y = e.get(a.nodeId);
3635
3635
  p.x += u, p.y += l, y.x -= u, y.y -= l;
3636
3636
  });
3637
3637
  }
@@ -3642,8 +3642,8 @@ class ke {
3642
3642
  this.rand = e;
3643
3643
  }
3644
3644
  create(e, t) {
3645
- const o = t.x - e.x, s = t.y - e.y, n = o * o + s * s;
3646
- if (n === 0) {
3645
+ const o = t.x - e.x, s = t.y - e.y, a = o * o + s * s;
3646
+ if (a === 0) {
3647
3647
  const c = this.PI2 * this.rand();
3648
3648
  return {
3649
3649
  ex: Math.cos(c),
@@ -3651,8 +3651,8 @@ class ke {
3651
3651
  d: 0
3652
3652
  };
3653
3653
  }
3654
- const a = Math.sqrt(n), h = o / a, d = s / a;
3655
- return { ex: h, ey: d, d: a };
3654
+ const n = Math.sqrt(a), h = o / n, d = s / n;
3655
+ return { ex: h, ey: d, d: n };
3656
3656
  }
3657
3657
  }
3658
3658
  const He = (r) => {
@@ -3670,10 +3670,10 @@ class rr {
3670
3670
  }
3671
3671
  apply(e, t) {
3672
3672
  const o = Array.from(t.keys()), s = o.length;
3673
- for (let n = 0; n < s; n++) {
3674
- const a = o[n];
3675
- for (let h = n + 1; h < s; h++) {
3676
- const d = o[h], c = e.get(a), g = e.get(d), u = this.distanceVectorGenerator.create(
3673
+ for (let a = 0; a < s; a++) {
3674
+ const n = o[a];
3675
+ for (let h = a + 1; h < s; h++) {
3676
+ const d = o[h], c = e.get(n), g = e.get(d), u = this.distanceVectorGenerator.create(
3677
3677
  c,
3678
3678
  g
3679
3679
  ), l = He({
@@ -3682,7 +3682,7 @@ class rr {
3682
3682
  targetCharge: this.nodeCharge,
3683
3683
  distance: u.d,
3684
3684
  maxForce: this.maxForce
3685
- }), p = l * u.ex, y = l * u.ey, w = t.get(a), f = t.get(d);
3685
+ }), p = l * u.ex, y = l * u.ey, w = t.get(n), f = t.get(d);
3686
3686
  w.x -= p, w.y -= y, f.x += p, f.y += y;
3687
3687
  }
3688
3688
  }
@@ -3699,7 +3699,7 @@ const or = (r) => {
3699
3699
  r.forEach((d) => {
3700
3700
  e = Math.min(e, d.x), t = Math.max(t, d.x), o = Math.min(o, d.y), s = Math.max(s, d.y);
3701
3701
  });
3702
- const n = t - e, a = s - o, h = Math.max(n, a);
3702
+ const a = t - e, n = s - o, h = Math.max(a, n);
3703
3703
  return {
3704
3704
  centerX: (e + t) / 2,
3705
3705
  centerY: (o + s) / 2,
@@ -3735,15 +3735,15 @@ class sr {
3735
3735
  const o = [];
3736
3736
  for (; t.length > 0; ) {
3737
3737
  const s = t.pop();
3738
- this.processNode(s).forEach((a) => {
3739
- o.push(a);
3738
+ this.processNode(s).forEach((n) => {
3739
+ o.push(n);
3740
3740
  });
3741
3741
  }
3742
3742
  t = o;
3743
3743
  }
3744
3744
  this.sortedParentNodes.reverse().forEach((o) => {
3745
- let s = 0, n = 0, a = 0, h = 0;
3746
- o.lb !== null && (a += o.lb.totalMass, h += o.lb.totalCharge, s += o.lb.chargeCenter.x * o.lb.totalCharge, n += o.lb.chargeCenter.y * o.lb.totalCharge), o.lt !== null && (a += o.lt.totalMass, h += o.lt.totalCharge, s += o.lt.chargeCenter.x * o.lt.totalCharge, n += o.lt.chargeCenter.y * o.lt.totalCharge), o.rb !== null && (a += o.rb.totalMass, h += o.rb.totalCharge, s += o.rb.chargeCenter.x * o.rb.totalCharge, n += o.rb.chargeCenter.y * o.rb.totalCharge), o.rt !== null && (a += o.rt.totalMass, h += o.rt.totalCharge, s += o.rt.chargeCenter.x * o.rt.totalCharge, n += o.rt.chargeCenter.y * o.rt.totalCharge), o.totalMass = a, o.totalCharge = h, o.chargeCenter.x = s / h, o.chargeCenter.y = n / h;
3745
+ let s = 0, a = 0, n = 0, h = 0;
3746
+ o.lb !== null && (n += o.lb.totalMass, h += o.lb.totalCharge, s += o.lb.chargeCenter.x * o.lb.totalCharge, a += o.lb.chargeCenter.y * o.lb.totalCharge), o.lt !== null && (n += o.lt.totalMass, h += o.lt.totalCharge, s += o.lt.chargeCenter.x * o.lt.totalCharge, a += o.lt.chargeCenter.y * o.lt.totalCharge), o.rb !== null && (n += o.rb.totalMass, h += o.rb.totalCharge, s += o.rb.chargeCenter.x * o.rb.totalCharge, a += o.rb.chargeCenter.y * o.rb.totalCharge), o.rt !== null && (n += o.rt.totalMass, h += o.rt.totalCharge, s += o.rt.chargeCenter.x * o.rt.totalCharge, a += o.rt.chargeCenter.y * o.rt.totalCharge), o.totalMass = n, o.totalCharge = h, o.chargeCenter.x = s / h, o.chargeCenter.y = a / h;
3747
3747
  });
3748
3748
  }
3749
3749
  getRoot() {
@@ -3759,10 +3759,10 @@ class sr {
3759
3759
  if (s < this.areaRadiusThreshold)
3760
3760
  return this.setLeaf(e), [];
3761
3761
  this.sortedParentNodes.push(e);
3762
- const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
3762
+ const a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
3763
3763
  e.nodeIds.forEach((l) => {
3764
3764
  const { x: p, y } = this.coords.get(l);
3765
- p < t ? y < o ? d.add(l) : h.add(l) : y < o ? a.add(l) : n.add(l), e.nodeIds.delete(l);
3765
+ p < t ? y < o ? d.add(l) : h.add(l) : y < o ? n.add(l) : a.add(l), e.nodeIds.delete(l);
3766
3766
  });
3767
3767
  const g = {
3768
3768
  parent: e,
@@ -3771,9 +3771,9 @@ class sr {
3771
3771
  rb: null,
3772
3772
  rt: null
3773
3773
  }, u = [];
3774
- if (n.size > 0) {
3774
+ if (a.size > 0) {
3775
3775
  const l = {
3776
- nodeIds: n,
3776
+ nodeIds: a,
3777
3777
  totalMass: 0,
3778
3778
  totalCharge: 0,
3779
3779
  chargeCenter: {
@@ -3789,9 +3789,9 @@ class sr {
3789
3789
  };
3790
3790
  e.rt = l, u.push(l);
3791
3791
  }
3792
- if (a.size > 0) {
3792
+ if (n.size > 0) {
3793
3793
  const l = {
3794
- nodeIds: a,
3794
+ nodeIds: n,
3795
3795
  totalMass: 0,
3796
3796
  totalCharge: 0,
3797
3797
  chargeCenter: {
@@ -3858,8 +3858,8 @@ class sr {
3858
3858
  };
3859
3859
  let t = 0, o = 0;
3860
3860
  return e.forEach((s) => {
3861
- const n = this.coords.get(s);
3862
- t += n.x, o += n.y;
3861
+ const a = this.coords.get(s);
3862
+ t += a.x, o += a.y;
3863
3863
  }), { x: t / e.size, y: o / e.size };
3864
3864
  }
3865
3865
  }
@@ -3882,17 +3882,17 @@ class ir {
3882
3882
  nodeMass: this.nodeMass,
3883
3883
  nodeCharge: this.nodeCharge
3884
3884
  });
3885
- e.forEach((n, a) => {
3885
+ e.forEach((a, n) => {
3886
3886
  const h = this.calculateForceForNode(
3887
- s.getLeaf(a),
3888
- a,
3887
+ s.getLeaf(n),
3888
+ n,
3889
3889
  e
3890
- ), d = t.get(a);
3890
+ ), d = t.get(n);
3891
3891
  this.applyForce(d, h);
3892
3892
  });
3893
3893
  }
3894
3894
  calculateForceForNode(e, t, o) {
3895
- const s = o.get(t), n = { x: 0, y: 0 };
3895
+ const s = o.get(t), a = { x: 0, y: 0 };
3896
3896
  e.nodeIds.forEach((h) => {
3897
3897
  if (h !== t) {
3898
3898
  const d = o.get(h), c = this.calculateNodeRepulsiveForce({
@@ -3901,72 +3901,72 @@ class ir {
3901
3901
  sourceCoords: d,
3902
3902
  targetCoords: s
3903
3903
  });
3904
- this.applyForce(n, c);
3904
+ this.applyForce(a, c);
3905
3905
  }
3906
3906
  });
3907
- let a = e;
3908
- for (; a !== null; ) {
3909
- const h = a.parent;
3907
+ let n = e;
3908
+ for (; n !== null; ) {
3909
+ const h = n.parent;
3910
3910
  if (h !== null) {
3911
3911
  const d = this.distanceVectorGenerator.create(
3912
3912
  h.chargeCenter,
3913
3913
  s
3914
3914
  );
3915
3915
  h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3916
- totalForce: n,
3916
+ totalForce: a,
3917
3917
  targetCoords: s,
3918
3918
  target: h.lb,
3919
- current: a
3919
+ current: n
3920
3920
  }), this.tryApplyFarForce({
3921
- totalForce: n,
3921
+ totalForce: a,
3922
3922
  targetCoords: s,
3923
3923
  target: h.rb,
3924
- current: a
3924
+ current: n
3925
3925
  }), this.tryApplyFarForce({
3926
- totalForce: n,
3926
+ totalForce: a,
3927
3927
  targetCoords: s,
3928
3928
  target: h.rt,
3929
- current: a
3929
+ current: n
3930
3930
  }), this.tryApplyFarForce({
3931
- totalForce: n,
3931
+ totalForce: a,
3932
3932
  targetCoords: s,
3933
3933
  target: h.lt,
3934
- current: a
3934
+ current: n
3935
3935
  })) : (this.tryApplyNearForce({
3936
- totalForce: n,
3936
+ totalForce: a,
3937
3937
  targetCoords: s,
3938
3938
  target: h.lb,
3939
- current: a,
3939
+ current: n,
3940
3940
  nodesCoords: o
3941
3941
  }), this.tryApplyNearForce({
3942
- totalForce: n,
3942
+ totalForce: a,
3943
3943
  targetCoords: s,
3944
3944
  target: h.rb,
3945
- current: a,
3945
+ current: n,
3946
3946
  nodesCoords: o
3947
3947
  }), this.tryApplyNearForce({
3948
- totalForce: n,
3948
+ totalForce: a,
3949
3949
  targetCoords: s,
3950
3950
  target: h.rt,
3951
- current: a,
3951
+ current: n,
3952
3952
  nodesCoords: o
3953
3953
  }), this.tryApplyNearForce({
3954
- totalForce: n,
3954
+ totalForce: a,
3955
3955
  targetCoords: s,
3956
3956
  target: h.lt,
3957
- current: a,
3957
+ current: n,
3958
3958
  nodesCoords: o
3959
3959
  }));
3960
3960
  }
3961
- a = a.parent;
3961
+ n = n.parent;
3962
3962
  }
3963
- return n;
3963
+ return a;
3964
3964
  }
3965
3965
  calculateExactForce(e, t, o) {
3966
- const s = { x: 0, y: 0 }, n = [e];
3967
- for (; n.length > 0; ) {
3968
- const a = n.pop();
3969
- a.nodeIds.forEach((h) => {
3966
+ const s = { x: 0, y: 0 }, a = [e];
3967
+ for (; a.length > 0; ) {
3968
+ const n = a.pop();
3969
+ n.nodeIds.forEach((h) => {
3970
3970
  const d = o.get(h), c = this.calculateNodeRepulsiveForce({
3971
3971
  sourceCharge: this.nodeCharge,
3972
3972
  targetCharge: this.nodeCharge,
@@ -3974,7 +3974,7 @@ class ir {
3974
3974
  targetCoords: t
3975
3975
  });
3976
3976
  this.applyForce(s, c);
3977
- }), a.lb !== null && n.push(a.lb), a.rb !== null && n.push(a.rb), a.lt !== null && n.push(a.lt), a.rt !== null && n.push(a.rt);
3977
+ }), n.lb !== null && a.push(n.lb), n.rb !== null && a.push(n.rb), n.lt !== null && a.push(n.lt), n.rt !== null && a.push(n.rt);
3978
3978
  }
3979
3979
  return s;
3980
3980
  }
@@ -4046,18 +4046,18 @@ class Xe {
4046
4046
  this.rand = e.rand, this.sparsity = e.sparsity;
4047
4047
  }
4048
4048
  calculateCoordinates(e) {
4049
- const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((y) => {
4049
+ const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), a = t.getAllNodeIds().filter((y) => {
4050
4050
  const w = t.getNode(y);
4051
4051
  return w.x === null || w.y === null;
4052
- }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, g = o.createContentCoords(c), u = a / 2, l = {
4052
+ }), n = Math.sqrt(a.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, g = o.createContentCoords(c), u = n / 2, l = {
4053
4053
  x: g.x - u,
4054
4054
  y: g.y - u
4055
4055
  };
4056
4056
  return t.getAllNodeIds().forEach((y) => {
4057
4057
  const w = t.getNode(y);
4058
4058
  s.set(y, {
4059
- x: w.x ?? l.x + a * this.rand(),
4060
- y: w.y ?? l.y + a * this.rand()
4059
+ x: w.x ?? l.x + n * this.rand(),
4060
+ y: w.y ?? l.y + n * this.rand()
4061
4061
  });
4062
4062
  }), s;
4063
4063
  }
@@ -4091,7 +4091,7 @@ class nr {
4091
4091
  graph: t,
4092
4092
  viewport: o
4093
4093
  });
4094
- for (let n = 0; n < this.maxIterations && !(new ze(
4094
+ for (let a = 0; a < this.maxIterations && !(new ze(
4095
4095
  t,
4096
4096
  s,
4097
4097
  {
@@ -4102,7 +4102,7 @@ class nr {
4102
4102
  edgeEquilibriumLength: this.edgeEquilibriumLength,
4103
4103
  edgeStiffness: this.edgeStiffness
4104
4104
  }
4105
- ).apply() < this.convergenceVelocity); n++)
4105
+ ).apply() < this.convergenceVelocity); a++)
4106
4106
  ;
4107
4107
  return s;
4108
4108
  }
@@ -4127,13 +4127,13 @@ class ar {
4127
4127
  this.forest.add({ root: t, sequence: o });
4128
4128
  let s = [t];
4129
4129
  for (this.remainingNodeIds.delete(t.nodeId); s.length > 0; ) {
4130
- const n = [];
4131
- s.forEach((a) => {
4132
- o.push(a);
4133
- const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
4130
+ const a = [];
4131
+ s.forEach((n) => {
4132
+ o.push(n);
4133
+ const h = this.graph.getNodeOutgoingEdgeIds(n.nodeId).map((g) => {
4134
4134
  const u = this.graph.getEdge(g);
4135
4135
  return this.graph.getPort(u.to).nodeId;
4136
- }), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((g) => {
4136
+ }), d = this.graph.getNodeIncomingEdgeIds(n.nodeId).map((g) => {
4137
4137
  const u = this.graph.getEdge(g);
4138
4138
  return this.graph.getPort(u.from).nodeId;
4139
4139
  });
@@ -4148,9 +4148,9 @@ class ar {
4148
4148
  nodeId: g,
4149
4149
  children: /* @__PURE__ */ new Set()
4150
4150
  };
4151
- a.children.add(u), n.push(u);
4151
+ n.children.add(u), a.push(u);
4152
4152
  });
4153
- }), s = n;
4153
+ }), s = a;
4154
4154
  }
4155
4155
  }
4156
4156
  }
@@ -4160,15 +4160,15 @@ class hr {
4160
4160
  }
4161
4161
  generate(e) {
4162
4162
  let t = 0;
4163
- const o = [], s = e.length - 1, n = [];
4163
+ const o = [], s = e.length - 1, a = [];
4164
4164
  e.forEach((h, d) => {
4165
4165
  if (t += this.params.spaceAroundRadius, h.forEach((c, g) => {
4166
- n[g] === void 0 ? n[g] = {
4166
+ a[g] === void 0 ? a[g] = {
4167
4167
  start: t + c.start,
4168
4168
  end: t + c.end
4169
- } : n[g].end = t + c.end;
4169
+ } : a[g].end = t + c.end;
4170
4170
  }), o.push(t), d !== s) {
4171
- const c = e[d + 1], g = n.map((u) => ({
4171
+ const c = e[d + 1], g = a.map((u) => ({
4172
4172
  start: u.start - t,
4173
4173
  end: u.end - t
4174
4174
  }));
@@ -4176,21 +4176,21 @@ class hr {
4176
4176
  }
4177
4177
  t += this.params.spaceAroundRadius;
4178
4178
  });
4179
- const a = t / 2;
4179
+ const n = t / 2;
4180
4180
  return {
4181
- childOffsets: o.map((h) => h - a),
4182
- subtreeSpans: n.map((h) => ({
4183
- start: h.start - a,
4184
- end: h.end - a
4181
+ childOffsets: o.map((h) => h - n),
4182
+ subtreeSpans: a.map((h) => ({
4183
+ start: h.start - n,
4184
+ end: h.end - n
4185
4185
  }))
4186
4186
  };
4187
4187
  }
4188
4188
  calculateMaxDiff(e, t) {
4189
4189
  let o = 0;
4190
4190
  const s = Math.min(e.length, t.length);
4191
- for (let n = 0; n < s; n++) {
4192
- const a = e[n].end - t[n].start;
4193
- o = Math.max(o, a);
4191
+ for (let a = 0; a < s; a++) {
4192
+ const n = e[a].end - t[a].start;
4193
+ o = Math.max(o, n);
4194
4194
  }
4195
4195
  return o - 2 * this.params.spaceAroundRadius;
4196
4196
  }
@@ -4203,17 +4203,17 @@ class dr {
4203
4203
  const o = t.spaceAroundRadius, s = new hr({
4204
4204
  spaceAroundRadius: o
4205
4205
  });
4206
- [...this.tree.sequence].reverse().forEach((n) => {
4207
- const a = Array.from(n.children).map(
4206
+ [...this.tree.sequence].reverse().forEach((a) => {
4207
+ const n = Array.from(a.children).map(
4208
4208
  (c) => this.treeSpans.get(c.nodeId)
4209
- ), h = s.generate(a);
4209
+ ), h = s.generate(n);
4210
4210
  let d = 0;
4211
- n.children.forEach((c) => {
4211
+ a.children.forEach((c) => {
4212
4212
  this.offsets.set(c.nodeId, h.childOffsets[d]), d++;
4213
- }), this.treeSpans.set(n.nodeId, [
4213
+ }), this.treeSpans.set(a.nodeId, [
4214
4214
  { start: -o, end: o },
4215
4215
  ...h.subtreeSpans
4216
- ]), n.children.forEach((c) => {
4216
+ ]), a.children.forEach((c) => {
4217
4217
  this.treeSpans.delete(c.nodeId);
4218
4218
  });
4219
4219
  }), this.offsets.set(this.tree.root.nodeId, 0);
@@ -4228,27 +4228,27 @@ class cr {
4228
4228
  }
4229
4229
  calculateCoordinates(e) {
4230
4230
  const t = /* @__PURE__ */ new Map(), s = new ar(e.graph).generate();
4231
- let n = 0;
4232
- return s.forEach((a) => {
4233
- t.set(a.root.nodeId, { x: n, y: 0 });
4234
- const d = new dr(a, {
4231
+ let a = 0;
4232
+ return s.forEach((n) => {
4233
+ t.set(n.root.nodeId, { x: a, y: 0 });
4234
+ const d = new dr(n, {
4235
4235
  spaceAroundRadius: this.params.layerSpace / 2
4236
4236
  }).generate();
4237
- let c = [a.root];
4237
+ let c = [n.root];
4238
4238
  for (; c.length > 0; ) {
4239
4239
  const g = [];
4240
- n += this.params.layerWidth, c.forEach((u) => {
4240
+ a += this.params.layerWidth, c.forEach((u) => {
4241
4241
  u.children.forEach((l) => {
4242
4242
  const p = t.get(u.nodeId).y;
4243
4243
  t.set(l.nodeId, {
4244
4244
  y: p + d.get(l.nodeId),
4245
- x: n
4245
+ x: a
4246
4246
  }), g.push(l);
4247
4247
  });
4248
4248
  }), c = g;
4249
4249
  }
4250
- }), t.forEach((a, h) => {
4251
- t.set(h, this.params.transform(a));
4250
+ }), t.forEach((n, h) => {
4251
+ t.set(h, this.params.transform(n));
4252
4252
  }), t;
4253
4253
  }
4254
4254
  }
@@ -4276,13 +4276,13 @@ class lr {
4276
4276
  });
4277
4277
  }
4278
4278
  calculateNextCoordinates(e) {
4279
- const { graph: t, viewport: o, dt: s } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
4279
+ const { graph: t, viewport: o, dt: s } = e, a = this.fillerLayoutAlgorithm.calculateCoordinates({
4280
4280
  graph: t,
4281
4281
  viewport: o
4282
4282
  });
4283
4283
  return new ze(
4284
4284
  t,
4285
- n,
4285
+ a,
4286
4286
  {
4287
4287
  distanceVectorGenerator: this.distanceVectorGenerator,
4288
4288
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -4294,13 +4294,13 @@ class lr {
4294
4294
  ).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
4295
4295
  const g = t.getNode(c);
4296
4296
  return g.x === null || g.y === null;
4297
- }) ? /* @__PURE__ */ new Map() : n;
4297
+ }) ? /* @__PURE__ */ new Map() : a;
4298
4298
  }
4299
4299
  }
4300
4300
  const Ge = (r) => {
4301
4301
  let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
4302
- for (let n = 0, a; n < r.length; n++)
4303
- 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);
4302
+ for (let a = 0, n; a < r.length; a++)
4303
+ n = r.charCodeAt(a), e = t ^ Math.imul(e ^ n, 597399067), t = o ^ Math.imul(t ^ n, 2869860233), o = s ^ Math.imul(o ^ n, 951274213), s = e ^ Math.imul(s ^ n, 2716044179);
4304
4304
  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];
4305
4305
  }, je = (r, e, t, o) => function() {
4306
4306
  r |= 0, e |= 0, t |= 0, o |= 0;
@@ -4383,14 +4383,14 @@ const Ge = (r) => {
4383
4383
  e: r.d * e.b + r.e * e.e,
4384
4384
  f: r.d * e.c + r.e * e.f + r.f
4385
4385
  }), yr = (r) => {
4386
- const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
4386
+ const { a: e, b: t, c: o, d: s, e: a, f: n } = r, h = e * a - t * s;
4387
4387
  return {
4388
- a: n / h,
4388
+ a: a / h,
4389
4389
  b: -t / h,
4390
- c: (t * a - o * n) / h,
4390
+ c: (t * n - o * a) / h,
4391
4391
  d: -s / h,
4392
4392
  e: e / h,
4393
- f: (o * s - e * a) / h
4393
+ f: (o * s - e * n) / h
4394
4394
  };
4395
4395
  };
4396
4396
  class wr {
@@ -4498,13 +4498,13 @@ const fr = (r) => {
4498
4498
  };
4499
4499
  const o = new wr();
4500
4500
  return e.forEach((s) => {
4501
- const n = o.resolve(s);
4502
- t = z(t, n);
4501
+ const a = o.resolve(s);
4502
+ t = z(t, a);
4503
4503
  }), (s) => {
4504
- const { x: n, y: a } = s;
4504
+ const { x: a, y: n } = s;
4505
4505
  return {
4506
- x: t.a * n + t.b * a + t.c,
4507
- y: t.d * n + t.e * a + t.f
4506
+ x: t.a * a + t.b * n + t.c,
4507
+ y: t.d * a + t.e * n + t.f
4508
4508
  };
4509
4509
  };
4510
4510
  }, vr = (r) => {
@@ -4575,7 +4575,7 @@ const fr = (r) => {
4575
4575
  edgesPriorityFn: o
4576
4576
  };
4577
4577
  }, Nr = (r) => {
4578
- var t, o, s, n, a;
4578
+ var t, o, s, a, n;
4579
4579
  const e = br(
4580
4580
  (t = r.nodes) == null ? void 0 : t.priority,
4581
4581
  (o = r.edges) == null ? void 0 : o.priority
@@ -4586,20 +4586,20 @@ const fr = (r) => {
4586
4586
  priorityFn: e.nodesPriorityFn
4587
4587
  },
4588
4588
  ports: {
4589
- direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
4589
+ direction: ((a = r.ports) == null ? void 0 : a.direction) ?? 0
4590
4590
  },
4591
4591
  edges: {
4592
- shapeFactory: le(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
4592
+ shapeFactory: le(((n = r.edges) == null ? void 0 : n.shape) ?? {}),
4593
4593
  priorityFn: e.edgesPriorityFn
4594
4594
  }
4595
4595
  };
4596
4596
  }, Pr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : re, Cr = (r) => {
4597
- var o, s, n;
4597
+ var o, s, a, n;
4598
4598
  const { canvasDefaults: e } = r, t = r.hasLayout ? Pr(r.layoutParams) : re;
4599
4599
  return {
4600
4600
  focus: {
4601
- contentOffset: ((o = e.focus) == null ? void 0 : o.contentOffset) ?? 100,
4602
- minContentScale: ((s = e.focus) == null ? void 0 : s.minContentScale) ?? 0,
4601
+ contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
4602
+ minContentScale: ((a = e.focus) == null ? void 0 : a.minContentScale) ?? 0,
4603
4603
  schedule: t,
4604
4604
  animationDuration: ((n = e.focus) == null ? void 0 : n.animationDuration) ?? 0
4605
4605
  }
@@ -4670,12 +4670,12 @@ class Dr {
4670
4670
  o.main,
4671
4671
  t,
4672
4672
  e
4673
- ), n = Nr(
4673
+ ), a = Nr(
4674
4674
  this.canvasDefaults
4675
- ), a = new Ve(
4675
+ ), n = new Ve(
4676
4676
  t,
4677
4677
  s,
4678
- n
4678
+ a
4679
4679
  ), h = xr(this.layoutConfig), d = Cr({
4680
4680
  canvasDefaults: this.canvasDefaults,
4681
4681
  hasLayout: this.hasLayout,
@@ -4688,7 +4688,7 @@ class Dr {
4688
4688
  ), g = new $e(e), u = new Ie(t), l = new Se(
4689
4689
  u,
4690
4690
  g,
4691
- a,
4691
+ n,
4692
4692
  c
4693
4693
  );
4694
4694
  if (this.hasBackground && ie.configure(
@@ -4710,8 +4710,8 @@ class Dr {
4710
4710
  if (this.hasUserConnectablePorts) {
4711
4711
  const y = Zt(
4712
4712
  this.connectablePortsConfig,
4713
- n.edges.shapeFactory,
4714
- n.ports.direction
4713
+ a.edges.shapeFactory,
4714
+ a.ports.direction
4715
4715
  );
4716
4716
  ne.configure(
4717
4717
  l,