@html-graph/html-graph 8.9.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.
@@ -71,9 +71,9 @@ class Ee {
71
71
  a,
72
72
  h,
73
73
  d
74
- ), u = this.createEdgeRenderPort(s, n, h, d);
75
- let g = L.Line;
76
- o.element === s.element ? g = L.PortCycle : o.nodeId === s.nodeId && (g = L.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
74
+ ), g = this.createEdgeRenderPort(s, n, h, d);
75
+ let u = L.Line;
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
  }
78
78
  updateEdgePriority(e) {
79
79
  const t = this.graphStore.getEdge(e);
@@ -109,8 +109,8 @@ 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, 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), u = Math.max(a.y, n.y);
113
- return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
112
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, 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
+ return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
114
114
  }
115
115
  }
116
116
  class tt {
@@ -125,8 +125,8 @@ class tt {
125
125
  const h = this.renderingBox.hasNode(n), d = this.attachedNodes.has(n);
126
126
  h && !d ? t.add(n) : !h && d && o.add(n);
127
127
  }), this.graphStore.getAllEdgeIds().forEach((n) => {
128
- const h = this.renderingBox.hasEdge(n), d = this.attachedEdges.has(n), c = this.graphStore.getEdge(n), u = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
129
- h && (this.renderingBox.hasNode(u) || (t.add(u), o.delete(u)), this.renderingBox.hasNode(g) || (t.add(g), o.delete(g))), h && !d ? s.add(n) : !h && d && a.add(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
130
  }), a.forEach((n) => {
131
131
  this.handleDetachEdge(n);
132
132
  }), o.forEach((n) => {
@@ -864,8 +864,8 @@ class ht {
864
864
  curvature: h,
865
865
  hasSourceArrow: d,
866
866
  hasTargetArrow: c
867
- } = e, u = (t.x + o.x) / 2, g = (t.y + o.y) / 2;
868
- this.midpoint = { x: u, y: g };
867
+ } = e, g = (t.x + o.x) / 2, u = (t.y + o.y) / 2;
868
+ this.midpoint = { x: g, y: u };
869
869
  const l = x(
870
870
  { x: t.x + s, y: t.y },
871
871
  a,
@@ -897,28 +897,28 @@ class dt {
897
897
  detourDir: h,
898
898
  from: d,
899
899
  to: c,
900
- arrowLength: u,
901
- detourDistance: g
900
+ arrowLength: g,
901
+ detourDistance: u
902
902
  } = e, l = t ? x(
903
- { x: d.x + u, y: d.y },
903
+ { x: d.x + g, y: d.y },
904
904
  a,
905
905
  d
906
906
  ) : d, p = o ? x(
907
907
  {
908
- x: c.x - u,
908
+ x: c.x - g,
909
909
  y: c.y
910
910
  },
911
911
  n,
912
912
  c
913
- ) : c, y = Math.cos(h) * g, w = Math.sin(h) * g, f = x(
914
- { x: d.x + u, y: d.y },
913
+ ) : c, y = Math.cos(h) * u, w = Math.sin(h) * u, f = x(
914
+ { x: d.x + g, y: d.y },
915
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
- { x: c.x - u, y: c.y },
921
+ { x: c.x - g, y: c.y },
922
922
  n,
923
923
  c
924
924
  ), N = {
@@ -930,10 +930,10 @@ class dt {
930
930
  }, T = {
931
931
  x: f.x + s * a.x,
932
932
  y: f.y + s * a.y
933
- }, V = {
933
+ }, I = {
934
934
  x: A.x - s * n.x,
935
935
  y: A.y - s * n.y
936
- }, I = {
936
+ }, V = {
937
937
  x: f.x + y,
938
938
  y: f.y + w
939
939
  }, $ = {
@@ -943,8 +943,8 @@ class dt {
943
943
  this.path = [
944
944
  `M ${l.x} ${l.y}`,
945
945
  `L ${f.x} ${f.y}`,
946
- `C ${T.x} ${T.y} ${I.x} ${I.y} ${C.x} ${C.y}`,
947
- `C ${$.x} ${$.y} ${V.x} ${V.y} ${A.x} ${A.y}`,
946
+ `C ${T.x} ${T.y} ${V.x} ${V.y} ${C.x} ${C.y}`,
947
+ `C ${$.x} ${$.y} ${I.x} ${I.y} ${A.x} ${A.y}`,
948
948
  `L ${p.x} ${p.y}`
949
949
  ].join(" "), this.midpoint = C;
950
950
  }
@@ -968,13 +968,13 @@ const ee = Object.freeze({
968
968
  const o = r.length - 1;
969
969
  let s = 0, a = 0, n = 0;
970
970
  r.forEach((h, d) => {
971
- let c = 0, u = 0, g = 0;
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, u = -a, g = n), p) {
973
+ if (l && (c = -s, g = -a, u = n), p) {
974
974
  const T = r[d + 1];
975
975
  s = T.x - h.x, a = T.y - h.y, n = Math.sqrt(s * s + a * a);
976
976
  }
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 = g !== 0 ? Math.min((y ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, C = y ? { x: h.x + c * N, y: h.y + u * 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
  );
@@ -984,7 +984,7 @@ const ee = Object.freeze({
984
984
  }, ct = (r, e) => {
985
985
  const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
986
986
  if (o === s) {
987
- const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
987
+ const c = o === t, g = (r.x + e.x) / 2, u = (r.y + e.y) / 2, l = { x: g, y: u };
988
988
  return c ? {
989
989
  points: [
990
990
  { x: r.x, y: r.y },
@@ -1030,12 +1030,12 @@ class lt {
1030
1030
  arrowOffset: h,
1031
1031
  roundness: d,
1032
1032
  hasSourceArrow: c,
1033
- hasTargetArrow: u
1034
- } = e, g = c ? x(
1033
+ hasTargetArrow: g
1034
+ } = e, u = c ? x(
1035
1035
  { x: t.x + n, y: t.y },
1036
1036
  s,
1037
1037
  t
1038
- ) : t, l = u ? x(
1038
+ ) : t, l = g ? x(
1039
1039
  {
1040
1040
  x: o.x - n,
1041
1041
  y: o.y
@@ -1059,7 +1059,7 @@ class lt {
1059
1059
  }
1060
1060
  );
1061
1061
  this.path = R(
1062
- [g, ...f.points, l],
1062
+ [u, ...f.points, l],
1063
1063
  d
1064
1064
  ), this.midpoint = f.midpoint;
1065
1065
  }
@@ -1077,8 +1077,8 @@ class gt {
1077
1077
  fromDir: h,
1078
1078
  toDir: d,
1079
1079
  arrowOffset: c,
1080
- detourDir: u,
1081
- detourDistance: g,
1080
+ detourDir: g,
1081
+ detourDistance: u,
1082
1082
  roundness: l
1083
1083
  } = e, p = t ? x(
1084
1084
  { x: s.x + n, y: s.y },
@@ -1091,7 +1091,7 @@ class gt {
1091
1091
  },
1092
1092
  d,
1093
1093
  a
1094
- ) : a, w = n + c, f = Math.cos(u) * g, m = Math.sin(u) * g, A = x(
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
@@ -1128,8 +1128,8 @@ class ut {
1128
1128
  fromDir: h,
1129
1129
  toDir: d,
1130
1130
  arrowOffset: c,
1131
- roundness: u
1132
- } = e, g = this.createArrowPoint(
1131
+ roundness: g
1132
+ } = e, u = this.createArrowPoint(
1133
1133
  s,
1134
1134
  h,
1135
1135
  t,
@@ -1141,8 +1141,8 @@ class ut {
1141
1141
  -n
1142
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
- [g, w, m, l],
1145
- u
1144
+ [u, w, m, l],
1145
+ g
1146
1146
  );
1147
1147
  const A = (w.x + m.x) / 2, N = (w.y + m.y) / 2;
1148
1148
  this.midpoint = { x: A, y: N };
@@ -1160,7 +1160,7 @@ class ut {
1160
1160
  const pt = (r, e) => {
1161
1161
  const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
1162
1162
  if (o === s) {
1163
- const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
1163
+ const c = o === t, g = (r.x + e.x) / 2, u = (r.y + e.y) / 2, l = { x: g, y: u };
1164
1164
  return c ? {
1165
1165
  points: [
1166
1166
  { x: r.x, y: r.y },
@@ -1206,8 +1206,8 @@ class yt {
1206
1206
  arrowOffset: h,
1207
1207
  fromDir: d,
1208
1208
  toDir: c,
1209
- roundness: u
1210
- } = e, g = s ? x(
1209
+ roundness: g
1210
+ } = e, u = s ? x(
1211
1211
  { x: t.x + n, y: t.y },
1212
1212
  d,
1213
1213
  t
@@ -1235,8 +1235,8 @@ class yt {
1235
1235
  }
1236
1236
  );
1237
1237
  this.path = R(
1238
- [g, ...f.points, l],
1239
- u
1238
+ [u, ...f.points, l],
1239
+ g
1240
1240
  ), this.midpoint = f.midpoint;
1241
1241
  }
1242
1242
  }
@@ -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: a, origin: n, hasArrow: h } = e, d = o + s, c = d + 2 * t, g = [
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,15 +1253,15 @@ 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, a, { x: 0, y: 0 })).map((p) => ({ x: p.x + n.x, y: p.y + n.y })), l = `M ${n.x} ${n.y} L ${g[0].x} ${g[0].y} `;
1257
- this.path = `${h ? "" : l}${R(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
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
+ 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
  }
1260
1260
  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: a, origin: n, hasArrow: h } = e, d = s + o, c = s * o / d, u = Math.sqrt(d * d - s * s), g = u * s / d, l = u + o + t, p = t + g, 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 },
@@ -1290,25 +1290,25 @@ class ft {
1290
1290
  arrowLength: d
1291
1291
  } = e;
1292
1292
  this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
1293
- const c = o.x - t.x, u = o.y - t.y;
1294
- if (this.diagonalDistance = Math.sqrt(c * c + u * u), this.diagonalDistance === 0) {
1293
+ const c = o.x - t.x, g = o.y - t.y;
1294
+ if (this.diagonalDistance = Math.sqrt(c * c + g * g), this.diagonalDistance === 0) {
1295
1295
  this.path = "";
1296
1296
  return;
1297
1297
  }
1298
- const g = { x: c, y: u }, l = this.createDirectLinePoint({
1298
+ const u = { x: c, y: g }, l = this.createDirectLinePoint({
1299
1299
  offset: s,
1300
1300
  hasArrow: n,
1301
1301
  flip: 1,
1302
1302
  shift: t,
1303
1303
  arrowLength: d,
1304
- dir: g
1304
+ dir: u
1305
1305
  }), p = this.createDirectLinePoint({
1306
1306
  offset: a,
1307
1307
  hasArrow: h,
1308
1308
  flip: -1,
1309
1309
  shift: o,
1310
1310
  arrowLength: d,
1311
- dir: g
1311
+ dir: u
1312
1312
  });
1313
1313
  this.path = `M ${l.x} ${l.y} L ${p.x} ${p.y}`;
1314
1314
  }
@@ -1337,8 +1337,8 @@ class xt {
1337
1337
  fromDir: h,
1338
1338
  toDir: d,
1339
1339
  arrowOffset: c,
1340
- roundness: u,
1341
- detourDistance: g
1340
+ roundness: g,
1341
+ detourDistance: u
1342
1342
  } = e, l = t ? x(
1343
1343
  { x: a.x + s, y: a.y },
1344
1344
  h,
@@ -1358,7 +1358,7 @@ class xt {
1358
1358
  { x: n.x - y, y: n.y },
1359
1359
  d,
1360
1360
  n
1361
- ), m = vt(w, f, g);
1361
+ ), m = vt(w, f, u);
1362
1362
  this.midpoint = {
1363
1363
  x: (w.x + f.x) / 2,
1364
1364
  y: m
@@ -1371,7 +1371,7 @@ class xt {
1371
1371
  f,
1372
1372
  p
1373
1373
  ],
1374
- u
1374
+ g
1375
1375
  );
1376
1376
  }
1377
1377
  }
@@ -1392,8 +1392,8 @@ class At {
1392
1392
  from: h,
1393
1393
  to: d,
1394
1394
  arrowOffset: c,
1395
- detourDistance: u,
1396
- roundness: g
1395
+ detourDistance: g,
1396
+ roundness: u
1397
1397
  } = e, l = t ? x(
1398
1398
  { x: h.x + s, y: h.y },
1399
1399
  a,
@@ -1413,7 +1413,7 @@ class At {
1413
1413
  { x: d.x - y, y: d.y },
1414
1414
  n,
1415
1415
  d
1416
- ), m = mt(w, f, u);
1416
+ ), m = mt(w, f, g);
1417
1417
  this.midpoint = {
1418
1418
  x: m,
1419
1419
  y: (w.y + f.y) / 2
@@ -1426,7 +1426,7 @@ class At {
1426
1426
  f,
1427
1427
  p
1428
1428
  ],
1429
- g
1429
+ u
1430
1430
  );
1431
1431
  }
1432
1432
  }
@@ -1476,9 +1476,9 @@ class X {
1476
1476
  );
1477
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
- let u = { x: -c.x, y: -c.y }, g;
1480
- e.category === L.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === L.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
1481
- const l = g(n, h, d, c);
1479
+ let g = { x: -c.x, y: -c.y }, u;
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(n, h, d, c);
1482
1482
  this.line.setAttribute("d", l.path);
1483
1483
  let p = null;
1484
1484
  this.sourceArrow && (p = this.arrowRenderer({
@@ -1488,7 +1488,7 @@ class X {
1488
1488
  }), this.sourceArrow.setAttribute("d", p));
1489
1489
  let y = null;
1490
1490
  this.targetArrow && (y = this.arrowRenderer({
1491
- direction: u,
1491
+ direction: g,
1492
1492
  shift: h,
1493
1493
  arrowLength: this.params.arrowLength
1494
1494
  }), this.targetArrow.setAttribute("d", y)), this.afterRenderEmitter.emit({
@@ -1520,8 +1520,8 @@ const Et = (r) => (e) => {
1520
1520
  ).map((y) => ({
1521
1521
  x: y.x + e.shift.x,
1522
1522
  y: y.y + e.shift.y
1523
- })), u = `M ${c[0].x} ${c[0].y}`, g = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1524
- return `${u} ${g} ${l} ${p}`;
1523
+ })), g = `M ${c[0].x} ${c[0].y}`, u = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1524
+ return `${g} ${u} ${l} ${p}`;
1525
1525
  }, bt = (r) => (e) => {
1526
1526
  const t = r.smallRadius, o = r.radius, s = x(
1527
1527
  {
@@ -1537,12 +1537,12 @@ const Et = (r) => (e) => {
1537
1537
  y: 0
1538
1538
  }
1539
1539
  ), n = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1540
- (g) => x(g, e.direction, { x: 0, y: 0 })
1541
- ).map((g) => ({
1542
- x: g.x + e.shift.x,
1543
- y: g.y + e.shift.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}`, u = `A ${o} ${o} 0 0 1 ${n[0].x} ${n[0].y}`;
1545
- return `${h} ${d} ${c} ${u}`;
1540
+ (u) => x(u, e.direction, { x: 0, y: 0 })
1541
+ ).map((u) => ({
1542
+ x: u.x + e.shift.x,
1543
+ y: u.y + e.shift.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
+ return `${h} ${d} ${c} ${g}`;
1546
1546
  }, U = (r) => {
1547
1547
  if (typeof r == "function")
1548
1548
  return r;
@@ -1879,14 +1879,14 @@ class Le {
1879
1879
  arrowLength: this.arrowLength
1880
1880
  });
1881
1881
  this.line.setAttribute("d", d.path);
1882
- let c = null, u = null;
1883
- const g = d.diagonalDistance;
1884
- if (g === 0)
1885
- this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (u = "", this.targetArrow.setAttribute("d", u));
1882
+ let c = null, g = null;
1883
+ const u = d.diagonalDistance;
1884
+ if (u === 0)
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 - n.x) / g,
1889
- y: (h.y - n.y) / g
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 = {
@@ -1904,20 +1904,20 @@ class Le {
1904
1904
  x: l.x * this.targetOffset,
1905
1905
  y: l.y * this.targetOffset
1906
1906
  };
1907
- u = this.arrowRenderer({
1907
+ g = this.arrowRenderer({
1908
1908
  direction: { x: -l.x, y: -l.y },
1909
1909
  shift: {
1910
1910
  x: h.x - p.x,
1911
1911
  y: h.y - p.y
1912
1912
  },
1913
1913
  arrowLength: this.arrowLength
1914
- }), this.targetArrow.setAttribute("d", u);
1914
+ }), this.targetArrow.setAttribute("d", g);
1915
1915
  }
1916
1916
  }
1917
1917
  this.afterRenderEmitter.emit({
1918
1918
  edgePath: d,
1919
1919
  sourceArrowPath: c,
1920
- targetArrowPath: u
1920
+ targetArrowPath: g
1921
1921
  });
1922
1922
  }
1923
1923
  }
@@ -1979,7 +1979,7 @@ class Mr {
1979
1979
  this.baseShape.render(e);
1980
1980
  }
1981
1981
  }
1982
- class Ve {
1982
+ class Ie {
1983
1983
  constructor(e) {
1984
1984
  i(this, "onAfterNodeAdded");
1985
1985
  i(this, "onAfterNodeUpdated");
@@ -2091,7 +2091,7 @@ class J {
2091
2091
  this.counter = 0;
2092
2092
  }
2093
2093
  }
2094
- class Ie {
2094
+ class Ve {
2095
2095
  constructor(e, t, o) {
2096
2096
  i(this, "nodeIdGenerator", new J(
2097
2097
  (e) => this.graphStore.hasNode(e)
@@ -2256,14 +2256,16 @@ class $e {
2256
2256
  return this.viewportStore.createViewportCoords(e);
2257
2257
  }
2258
2258
  }
2259
- const Vt = (r, e) => Symbol.iterator in r ? {
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
+ animationDuration: e.focus.animationDuration
2263
2264
  } : {
2264
2265
  minContentScale: r.minContentScale ?? e.focus.minContentScale,
2265
2266
  nodes: r.nodes ?? [],
2266
- contentOffset: r.contentOffset ?? e.focus.contentOffset
2267
+ contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
2268
+ animationDuration: r.animationDuration ?? e.focus.animationDuration
2267
2269
  }, Be = (r, e, t) => ({
2268
2270
  scale: r.scale,
2269
2271
  x: r.x + r.scale * e,
@@ -2274,8 +2276,8 @@ const Vt = (r, e) => Symbol.iterator in r ? {
2274
2276
  y: r.scale * (1 - e) * o + r.y
2275
2277
  });
2276
2278
  class Oe {
2277
- constructor(e, t, o) {
2278
- this.graphStore = e, this.viewportStore = t, this.params = o;
2279
+ constructor(e, t, o, s) {
2280
+ this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
2279
2281
  }
2280
2282
  patchViewportMatrix(e) {
2281
2283
  this.viewportStore.patchViewportMatrix(e);
@@ -2285,21 +2287,22 @@ class Oe {
2285
2287
  }
2286
2288
  center(e, t) {
2287
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;
2288
- let u = Be(n, d, c);
2289
- const g = t == null ? void 0 : t.contentScale;
2290
- if (g !== void 0) {
2291
- const l = 1 / g;
2292
- u = Ue(
2293
- u,
2294
- l / n.scale,
2290
+ let g = Be(n, d, c);
2291
+ const u = t == null ? void 0 : t.contentScale;
2292
+ if (u !== void 0) {
2293
+ const p = 1 / u;
2294
+ g = Ue(
2295
+ g,
2296
+ p / n.scale,
2295
2297
  a.x,
2296
2298
  a.y
2297
2299
  );
2298
2300
  }
2299
- this.viewportStore.patchViewportMatrix(u);
2301
+ const l = (t == null ? void 0 : t.animationDuration) ?? 0;
2302
+ l > 0 ? this.animateNavigation(n, g, l) : this.viewportStore.patchViewportMatrix(g);
2300
2303
  }
2301
2304
  focus(e) {
2302
- const t = Vt(e ?? {}, this.params);
2305
+ const t = It(e ?? {}, this.params);
2303
2306
  this.params.focus.schedule(() => {
2304
2307
  this.navigate(t);
2305
2308
  });
@@ -2316,20 +2319,40 @@ class Oe {
2316
2319
  const { payload: c } = this.graphStore.getNode(d);
2317
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++);
2318
2321
  }), n > 0) {
2319
- t -= e.contentOffset, s -= e.contentOffset, o += e.contentOffset, a += e.contentOffset;
2322
+ t -= e.contentPadding, s -= e.contentPadding, o += e.contentPadding, a += e.contentPadding;
2320
2323
  const d = {
2321
2324
  x: (t + o) / 2,
2322
2325
  y: (s + a) / 2
2323
- }, { scale: c } = this.viewportStore.getContentMatrix(), u = (a - s) * c, g = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), y = Math.max(
2324
- g / l,
2325
- u / p
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
+ u / l,
2328
+ g / p
2326
2329
  ), w = y > 1 ? c / y : c, f = Math.max(w, e.minContentScale);
2327
- this.center(d, { contentScale: f });
2330
+ this.center(d, {
2331
+ contentScale: f,
2332
+ animationDuration: e.animationDuration
2333
+ });
2328
2334
  }
2329
2335
  }
2336
+ animateNavigation(e, t, o) {
2337
+ let s;
2338
+ const a = {
2339
+ scale: t.scale - e.scale,
2340
+ x: t.x - e.x,
2341
+ y: t.y - e.y
2342
+ }, n = (h) => {
2343
+ s === void 0 && (s = h);
2344
+ const d = Math.min((h - s) / o, 1);
2345
+ d <= 1 && this.viewportStore.patchViewportMatrix({
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
+ };
2351
+ this.win.requestAnimationFrame(n);
2352
+ }
2330
2353
  }
2331
- const We = (r, e) => {
2332
- const t = new be(), o = new Ve(t), s = new $e(e), a = new Ee(t, e, r), n = {
2354
+ const We = (r, e, t) => {
2355
+ const o = new be(), s = new Ie(o), a = new $e(e), n = new Ee(o, e, r), h = {
2333
2356
  nodes: {
2334
2357
  centerFn: Ce,
2335
2358
  priorityFn: () => 0
@@ -2341,22 +2364,24 @@ const We = (r, e) => {
2341
2364
  ports: {
2342
2365
  direction: 0
2343
2366
  }
2344
- }, h = new Ie(
2345
- t,
2346
- a,
2347
- n
2348
- ), d = {
2367
+ }, d = new Ve(
2368
+ o,
2369
+ n,
2370
+ h
2371
+ ), c = {
2349
2372
  focus: {
2350
- contentOffset: 0,
2373
+ contentPadding: 0,
2351
2374
  minContentScale: 0,
2352
- schedule: re
2375
+ schedule: re,
2376
+ animationDuration: 0
2353
2377
  }
2354
- }, c = new Oe(
2355
- t,
2378
+ }, g = new Oe(
2379
+ o,
2356
2380
  e,
2357
- d
2381
+ c,
2382
+ t
2358
2383
  );
2359
- return new Se(o, s, h, c);
2384
+ return new Se(s, a, d, g);
2360
2385
  };
2361
2386
  class G {
2362
2387
  constructor(e, t, o, s) {
@@ -2467,7 +2492,7 @@ class G {
2467
2492
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2468
2493
  }
2469
2494
  }
2470
- class It {
2495
+ class Vt {
2471
2496
  constructor(e, t, o) {
2472
2497
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
2473
2498
  }
@@ -2919,17 +2944,17 @@ class se {
2919
2944
  }
2920
2945
  scheduleEnsureViewportAreaLoaded() {
2921
2946
  setTimeout(() => {
2922
- 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, u = s + n + this.nodeHorizontal, g = a + h + this.nodeVertical;
2923
- this.loadedArea.xFrom < d && this.loadedArea.xTo > u && this.loadedArea.yFrom < c && this.loadedArea.yTo > g || this.loadAreaAroundViewport();
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
+ this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
2924
2949
  });
2925
2950
  }
2926
2951
  loadAreaAroundViewport() {
2927
- 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, u = 3 * n + 2 * this.nodeHorizontal, g = 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;
2928
2953
  this.trigger.emit({
2929
2954
  x: d,
2930
2955
  y: c,
2931
- width: u,
2932
- height: g
2956
+ width: g,
2957
+ height: u
2933
2958
  });
2934
2959
  }
2935
2960
  }
@@ -2994,7 +3019,8 @@ class ne {
2994
3019
  });
2995
3020
  this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = a, this.overlayCanvas = We(
2996
3021
  this.overlayLayer,
2997
- this.viewportStore
3022
+ this.viewportStore,
3023
+ this.window
2998
3024
  ), G.configure(
2999
3025
  this.canvas,
3000
3026
  this.overlayLayer,
@@ -3033,20 +3059,20 @@ class ne {
3033
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({
3034
3060
  x: n - d.x,
3035
3061
  y: h - d.y
3036
- }), u = this.canvas.viewport.createContentCoords({
3062
+ }), g = this.canvas.viewport.createContentCoords({
3037
3063
  x: t.x - d.x,
3038
3064
  y: t.y - d.y
3039
- }), g = {
3065
+ }), u = {
3040
3066
  overlayNodeId: M.StaticNodeId,
3041
3067
  portCoords: c,
3042
3068
  portDirection: s.direction
3043
3069
  }, l = {
3044
3070
  overlayNodeId: M.DraggingNodeId,
3045
- portCoords: u,
3071
+ portCoords: g,
3046
3072
  portDirection: this.params.dragPortDirection
3047
3073
  };
3048
3074
  this.isTargetDragging = o === "direct";
3049
- const [p, y] = this.isTargetDragging ? [g, l] : [l, g];
3075
+ const [p, y] = this.isTargetDragging ? [u, l] : [l, u];
3050
3076
  this.overlayCanvas.addNode(H(p)), this.overlayCanvas.addNode(H(y)), this.overlayCanvas.addEdge({
3051
3077
  from: p.overlayNodeId,
3052
3078
  to: y.overlayNodeId,
@@ -3090,7 +3116,8 @@ class ae {
3090
3116
  });
3091
3117
  this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = a, this.overlayCanvas = We(
3092
3118
  this.overlayLayer,
3093
- this.viewportStore
3119
+ this.viewportStore,
3120
+ this.window
3094
3121
  ), G.configure(
3095
3122
  this.canvas,
3096
3123
  this.overlayLayer,
@@ -3126,12 +3153,12 @@ class ae {
3126
3153
  return !1;
3127
3154
  const s = this.canvas.graph.getEdge(o), a = e === s.from, n = e === s.to, h = a ? s.to : s.from;
3128
3155
  this.staticPortId = h, this.isTargetDragging = n;
3129
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), g = {
3130
- x: u.x + u.width / 2,
3131
- y: u.y + u.height / 2
3156
+ const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), u = {
3157
+ x: g.x + g.width / 2,
3158
+ y: g.y + g.height / 2
3132
3159
  }, l = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
3133
- x: g.x - l.x,
3134
- y: g.y - l.y
3160
+ x: u.x - l.x,
3161
+ y: u.y - l.y
3135
3162
  }), y = this.canvas.viewport.createContentCoords({
3136
3163
  x: t.x - l.x,
3137
3164
  y: t.y - l.y
@@ -3247,7 +3274,7 @@ class de {
3247
3274
  }
3248
3275
  class Wt {
3249
3276
  static configure(e, t) {
3250
- const o = t.applyOn, s = new It(e, t.algorithm, {
3277
+ const o = t.applyOn, s = new Vt(e, t.algorithm, {
3251
3278
  staticNodeResolver: t.staticNodeResolver,
3252
3279
  onBeforeApplied: t.onBeforeApplied,
3253
3280
  onAfterApplied: t.onAfterApplied
@@ -3330,13 +3357,13 @@ const Yt = (r) => {
3330
3357
  const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
3331
3358
  }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3332
3359
  }), o = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
3333
- }), 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, u = c !== void 0 ? c : (N) => N.button === 0, g = (A = r.mouse) == null ? void 0 : A.mouseUpEventVerifier, l = g !== void 0 ? g : (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;
3334
3361
  return {
3335
3362
  moveOnTop: a,
3336
3363
  moveEdgesOnTop: n,
3337
3364
  dragCursor: d,
3338
3365
  gridSize: r.gridSize ?? null,
3339
- mouseDownEventVerifier: u,
3366
+ mouseDownEventVerifier: g,
3340
3367
  mouseUpEventVerifier: l,
3341
3368
  onNodeDragStarted: e,
3342
3369
  onNodeDrag: t,
@@ -3350,28 +3377,28 @@ const Yt = (r) => {
3350
3377
  n < e && n < a.prevTransform.x && (n = Math.min(a.prevTransform.x, e));
3351
3378
  const d = a.canvasWidth * a.prevTransform.scale, c = t - d;
3352
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));
3353
- const u = a.canvasHeight * a.prevTransform.scale, g = s - u;
3354
- return h > g && h > a.prevTransform.y && (h = Math.max(a.prevTransform.y, g)), { scale: a.nextTransform.scale, x: n, y: h };
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 };
3355
3382
  };
3356
3383
  }, Gt = (r) => {
3357
3384
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3358
3385
  return (a) => {
3359
3386
  const n = a.prevTransform, h = a.nextTransform;
3360
- let d = h.scale, c = h.x, u = h.y;
3387
+ let d = h.scale, c = h.x, g = h.y;
3361
3388
  if (h.scale > s && h.scale > n.scale) {
3362
- d = Math.max(n.scale, s), c = n.x, u = n.y;
3363
- const g = (d - n.scale) / (h.scale - n.scale);
3364
- c = n.x + (h.x - n.x) * g, u = n.y + (h.y - n.y) * g;
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;
3365
3392
  }
3366
3393
  if (h.scale < o && h.scale < n.scale) {
3367
- d = Math.min(n.scale, o), c = n.x, u = n.y;
3368
- const g = (d - n.scale) / (h.scale - n.scale);
3369
- c = n.x + (h.x - n.x) * g, u = n.y + (h.y - n.y) * g;
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;
3370
3397
  }
3371
3398
  return {
3372
3399
  scale: d,
3373
3400
  x: c,
3374
- y: u
3401
+ y: g
3375
3402
  };
3376
3403
  };
3377
3404
  }, jt = (r) => (e) => r.reduce(
@@ -3400,7 +3427,7 @@ const Yt = (r) => {
3400
3427
  });
3401
3428
  }
3402
3429
  }, me = (r) => {
3403
- var y, w, f, m, A, N, C, T, V, I, $, ge;
3430
+ var y, w, f, m, A, N, C, T, I, V, $, ge;
3404
3431
  const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3405
3432
  let s;
3406
3433
  o !== void 0 ? Array.isArray(o) ? s = jt(
@@ -3410,21 +3437,21 @@ const Yt = (r) => {
3410
3437
  ) : s = xe(o) : s = (D) => D.nextTransform;
3411
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) ?? (() => {
3412
3439
  }), h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onTransformChange) ?? (() => {
3413
- }), d = (A = r == null ? void 0 : r.shift) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, u = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, g = u !== void 0 ? u : (D) => D.button === 0, l = (C = r == null ? void 0 : r.scale) == null ? void 0 : C.mouseWheelEventVerifier, p = l !== void 0 ? l : () => !0;
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;
3414
3441
  return {
3415
3442
  wheelSensitivity: t,
3416
3443
  onTransformStarted: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformStarted) ?? (() => {
3417
3444
  }),
3418
- onTransformFinished: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformFinished) ?? (() => {
3445
+ onTransformFinished: ((I = r == null ? void 0 : r.events) == null ? void 0 : I.onTransformFinished) ?? (() => {
3419
3446
  }),
3420
3447
  onBeforeTransformChange: n,
3421
3448
  onTransformChange: h,
3422
3449
  transformPreprocessor: s,
3423
3450
  shiftCursor: a,
3424
3451
  mouseDownEventVerifier: c,
3425
- mouseUpEventVerifier: g,
3452
+ mouseUpEventVerifier: u,
3426
3453
  mouseWheelEventVerifier: p,
3427
- scaleWheelFinishTimeout: ((I = r == null ? void 0 : r.scale) == null ? void 0 : I.wheelFinishTimeout) ?? 500,
3454
+ scaleWheelFinishTimeout: ((V = r == null ? void 0 : r.scale) == null ? void 0 : V.wheelFinishTimeout) ?? 500,
3428
3455
  onResizeTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onResizeTransformStarted) ?? (() => {
3429
3456
  }),
3430
3457
  onResizeTransformFinished: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformFinished) ?? (() => {
@@ -3518,7 +3545,7 @@ const Yt = (r) => {
3518
3545
  });
3519
3546
  }
3520
3547
  }, Zt = (r, e, t) => {
3521
- var c, u, g;
3548
+ var c, g, u;
3522
3549
  const o = () => "direct", s = (l) => l, a = (l) => l.button === 0, n = () => {
3523
3550
  }, h = () => {
3524
3551
  }, d = () => {
@@ -3529,13 +3556,13 @@ const Yt = (r) => {
3529
3556
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? a,
3530
3557
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? a,
3531
3558
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? n,
3532
- onEdgeCreationInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeCreationInterrupted) ?? d,
3533
- onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
3559
+ onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3560
+ onEdgeCreationPrevented: ((u = r.events) == null ? void 0 : u.onEdgeCreationPrevented) ?? h,
3534
3561
  dragPortDirection: r.dragPortDirection ?? t,
3535
3562
  edgeShapeFactory: r.edgeShape !== void 0 ? le(r.edgeShape) : e
3536
3563
  };
3537
3564
  }, _t = (r, e) => {
3538
- var c, u, g;
3565
+ var c, g, u;
3539
3566
  const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, a = (l) => {
3540
3567
  const p = e.getPortAdjacentEdgeIds(l);
3541
3568
  return p.length > 0 ? p[p.length - 1] : null;
@@ -3550,8 +3577,8 @@ const Yt = (r) => {
3550
3577
  draggingEdgeResolver: r.draggingEdgeResolver ?? a,
3551
3578
  draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? le(r.draggingEdgeShape) : null,
3552
3579
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? n,
3553
- onEdgeReattachInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeReattachInterrupted) ?? d,
3554
- onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
3580
+ onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3581
+ onEdgeReattachPrevented: ((u = r.events) == null ? void 0 : u.onEdgeReattachPrevented) ?? h
3555
3582
  };
3556
3583
  }, qt = (r) => ({
3557
3584
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
@@ -3604,8 +3631,8 @@ class ze {
3604
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(
3605
3632
  n,
3606
3633
  h
3607
- ), u = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, g = d.ex * u, l = d.ey * u, p = e.get(s.nodeId), y = e.get(a.nodeId);
3608
- p.x += g, p.y += l, y.x -= g, y.y -= l;
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
+ p.x += u, p.y += l, y.x -= u, y.y -= l;
3609
3636
  });
3610
3637
  }
3611
3638
  }
@@ -3646,16 +3673,16 @@ class rr {
3646
3673
  for (let a = 0; a < s; a++) {
3647
3674
  const n = o[a];
3648
3675
  for (let h = a + 1; h < s; h++) {
3649
- const d = o[h], c = e.get(n), u = e.get(d), g = this.distanceVectorGenerator.create(
3676
+ const d = o[h], c = e.get(n), g = e.get(d), u = this.distanceVectorGenerator.create(
3650
3677
  c,
3651
- u
3678
+ g
3652
3679
  ), l = He({
3653
3680
  coefficient: 1,
3654
3681
  sourceCharge: this.nodeCharge,
3655
3682
  targetCharge: this.nodeCharge,
3656
- distance: g.d,
3683
+ distance: u.d,
3657
3684
  maxForce: this.maxForce
3658
- }), p = l * g.ex, y = l * g.ey, w = t.get(n), f = t.get(d);
3685
+ }), p = l * u.ex, y = l * u.ey, w = t.get(n), f = t.get(d);
3659
3686
  w.x -= p, w.y -= y, f.x += p, f.y += y;
3660
3687
  }
3661
3688
  }
@@ -3737,13 +3764,13 @@ class sr {
3737
3764
  const { x: p, y } = this.coords.get(l);
3738
3765
  p < t ? y < o ? d.add(l) : h.add(l) : y < o ? n.add(l) : a.add(l), e.nodeIds.delete(l);
3739
3766
  });
3740
- const u = {
3767
+ const g = {
3741
3768
  parent: e,
3742
3769
  lb: null,
3743
3770
  lt: null,
3744
3771
  rb: null,
3745
3772
  rt: null
3746
- }, g = [];
3773
+ }, u = [];
3747
3774
  if (a.size > 0) {
3748
3775
  const l = {
3749
3776
  nodeIds: a,
@@ -3758,9 +3785,9 @@ class sr {
3758
3785
  centerY: o + c,
3759
3786
  radius: c
3760
3787
  },
3761
- ...u
3788
+ ...g
3762
3789
  };
3763
- e.rt = l, g.push(l);
3790
+ e.rt = l, u.push(l);
3764
3791
  }
3765
3792
  if (n.size > 0) {
3766
3793
  const l = {
@@ -3776,9 +3803,9 @@ class sr {
3776
3803
  centerY: o - c,
3777
3804
  radius: c
3778
3805
  },
3779
- ...u
3806
+ ...g
3780
3807
  };
3781
- e.rb = l, g.push(l);
3808
+ e.rb = l, u.push(l);
3782
3809
  }
3783
3810
  if (h.size > 0) {
3784
3811
  const l = {
@@ -3794,9 +3821,9 @@ class sr {
3794
3821
  centerY: o + c,
3795
3822
  radius: c
3796
3823
  },
3797
- ...u
3824
+ ...g
3798
3825
  };
3799
- e.lt = l, g.push(l);
3826
+ e.lt = l, u.push(l);
3800
3827
  }
3801
3828
  if (d.size > 0) {
3802
3829
  const l = {
@@ -3812,11 +3839,11 @@ class sr {
3812
3839
  centerY: o - c,
3813
3840
  radius: c
3814
3841
  },
3815
- ...u
3842
+ ...g
3816
3843
  };
3817
- e.lb = l, g.push(l);
3844
+ e.lb = l, u.push(l);
3818
3845
  }
3819
- return g;
3846
+ return u;
3820
3847
  }
3821
3848
  setLeaf(e) {
3822
3849
  e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
@@ -4022,9 +4049,9 @@ class Xe {
4022
4049
  const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), a = t.getAllNodeIds().filter((y) => {
4023
4050
  const w = t.getNode(y);
4024
4051
  return w.x === null || w.y === null;
4025
- }), n = Math.sqrt(a.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, u = o.createContentCoords(c), g = n / 2, l = {
4026
- x: u.x - g,
4027
- y: u.y - g
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
+ x: g.x - u,
4054
+ y: g.y - u
4028
4055
  };
4029
4056
  return t.getAllNodeIds().forEach((y) => {
4030
4057
  const w = t.getNode(y);
@@ -4103,25 +4130,25 @@ class ar {
4103
4130
  const a = [];
4104
4131
  s.forEach((n) => {
4105
4132
  o.push(n);
4106
- const h = this.graph.getNodeOutgoingEdgeIds(n.nodeId).map((u) => {
4107
- const g = this.graph.getEdge(u);
4108
- return this.graph.getPort(g.to).nodeId;
4109
- }), d = this.graph.getNodeIncomingEdgeIds(n.nodeId).map((u) => {
4110
- const g = this.graph.getEdge(u);
4111
- return this.graph.getPort(g.from).nodeId;
4133
+ const h = this.graph.getNodeOutgoingEdgeIds(n.nodeId).map((g) => {
4134
+ const u = this.graph.getEdge(g);
4135
+ return this.graph.getPort(u.to).nodeId;
4136
+ }), d = this.graph.getNodeIncomingEdgeIds(n.nodeId).map((g) => {
4137
+ const u = this.graph.getEdge(g);
4138
+ return this.graph.getPort(u.from).nodeId;
4112
4139
  });
4113
4140
  (/* @__PURE__ */ new Set([
4114
4141
  ...h,
4115
4142
  ...d
4116
- ])).forEach((u) => {
4117
- if (!this.remainingNodeIds.has(u))
4143
+ ])).forEach((g) => {
4144
+ if (!this.remainingNodeIds.has(g))
4118
4145
  return;
4119
- this.remainingNodeIds.delete(u);
4120
- const g = {
4121
- nodeId: u,
4146
+ this.remainingNodeIds.delete(g);
4147
+ const u = {
4148
+ nodeId: g,
4122
4149
  children: /* @__PURE__ */ new Set()
4123
4150
  };
4124
- n.children.add(g), a.push(g);
4151
+ n.children.add(u), a.push(u);
4125
4152
  });
4126
4153
  }), s = a;
4127
4154
  }
@@ -4135,17 +4162,17 @@ class hr {
4135
4162
  let t = 0;
4136
4163
  const o = [], s = e.length - 1, a = [];
4137
4164
  e.forEach((h, d) => {
4138
- if (t += this.params.spaceAroundRadius, h.forEach((c, u) => {
4139
- a[u] === void 0 ? a[u] = {
4165
+ if (t += this.params.spaceAroundRadius, h.forEach((c, g) => {
4166
+ a[g] === void 0 ? a[g] = {
4140
4167
  start: t + c.start,
4141
4168
  end: t + c.end
4142
- } : a[u].end = t + c.end;
4169
+ } : a[g].end = t + c.end;
4143
4170
  }), o.push(t), d !== s) {
4144
- const c = e[d + 1], u = a.map((g) => ({
4145
- start: g.start - t,
4146
- end: g.end - t
4171
+ const c = e[d + 1], g = a.map((u) => ({
4172
+ start: u.start - t,
4173
+ end: u.end - t
4147
4174
  }));
4148
- t += this.calculateMaxDiff(u, c);
4175
+ t += this.calculateMaxDiff(g, c);
4149
4176
  }
4150
4177
  t += this.params.spaceAroundRadius;
4151
4178
  });
@@ -4209,16 +4236,16 @@ class cr {
4209
4236
  }).generate();
4210
4237
  let c = [n.root];
4211
4238
  for (; c.length > 0; ) {
4212
- const u = [];
4213
- a += this.params.layerWidth, c.forEach((g) => {
4214
- g.children.forEach((l) => {
4215
- const p = t.get(g.nodeId).y;
4239
+ const g = [];
4240
+ a += this.params.layerWidth, c.forEach((u) => {
4241
+ u.children.forEach((l) => {
4242
+ const p = t.get(u.nodeId).y;
4216
4243
  t.set(l.nodeId, {
4217
4244
  y: p + d.get(l.nodeId),
4218
4245
  x: a
4219
- }), u.push(l);
4246
+ }), g.push(l);
4220
4247
  });
4221
- }), c = u;
4248
+ }), c = g;
4222
4249
  }
4223
4250
  }), t.forEach((n, h) => {
4224
4251
  t.set(h, this.params.transform(n));
@@ -4265,8 +4292,8 @@ class lr {
4265
4292
  edgeStiffness: this.edgeStiffness
4266
4293
  }
4267
4294
  ).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
4268
- const u = t.getNode(c);
4269
- return u.x === null || u.y === null;
4295
+ const g = t.getNode(c);
4296
+ return g.x === null || g.y === null;
4270
4297
  }) ? /* @__PURE__ */ new Map() : a;
4271
4298
  }
4272
4299
  }
@@ -4567,13 +4594,14 @@ const fr = (r) => {
4567
4594
  }
4568
4595
  };
4569
4596
  }, Pr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : re, Cr = (r) => {
4570
- var o, s;
4597
+ var o, s, a, n;
4571
4598
  const { canvasDefaults: e } = r, t = r.hasLayout ? Pr(r.layoutParams) : re;
4572
4599
  return {
4573
4600
  focus: {
4574
- contentOffset: ((o = e.focus) == null ? void 0 : o.contentOffset) ?? 100,
4575
- minContentScale: ((s = e.focus) == null ? void 0 : s.minContentScale) ?? 0,
4576
- schedule: t
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
+ schedule: t,
4604
+ animationDuration: ((n = e.focus) == null ? void 0 : n.animationDuration) ?? 0
4577
4605
  }
4578
4606
  };
4579
4607
  };
@@ -4644,7 +4672,7 @@ class Dr {
4644
4672
  e
4645
4673
  ), a = Nr(
4646
4674
  this.canvasDefaults
4647
- ), n = new Ie(
4675
+ ), n = new Ve(
4648
4676
  t,
4649
4677
  s,
4650
4678
  a
@@ -4655,10 +4683,11 @@ class Dr {
4655
4683
  }), c = new Oe(
4656
4684
  t,
4657
4685
  e,
4658
- d
4659
- ), u = new $e(e), g = new Ve(t), l = new Se(
4660
- g,
4686
+ d,
4687
+ this.window
4688
+ ), g = new $e(e), u = new Ie(t), l = new Se(
4661
4689
  u,
4690
+ g,
4662
4691
  n,
4663
4692
  c
4664
4693
  );