@html-graph/html-graph 8.19.1 → 8.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- var nt = Object.defineProperty;
2
- var at = (r, e, t) => e in r ? nt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => at(r, typeof e != "symbol" ? e + "" : e, t);
4
- var I = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(I || {});
5
- const ht = () => {
1
+ var ht = Object.defineProperty;
2
+ var dt = (r, e, t) => e in r ? ht(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => dt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ var U = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(U || {});
5
+ const ct = () => {
6
6
  const r = document.createElement("div");
7
7
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
8
- }, dt = () => {
8
+ }, lt = () => {
9
9
  const r = document.createElement("div");
10
10
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
11
- }, ct = (r) => {
11
+ }, ut = (r) => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
- }, lt = (r) => {
13
+ }, gt = (r) => {
14
14
  r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
15
15
  };
16
- class Ve {
16
+ class Fe {
17
17
  constructor(e, t, o) {
18
- i(this, "host", ht());
19
- i(this, "container", dt());
18
+ i(this, "host", ct());
19
+ i(this, "container", lt());
20
20
  i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
21
  i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
22
22
  i(this, "applyTransform", () => {
@@ -27,11 +27,11 @@ class Ve {
27
27
  }
28
28
  attachNode(e) {
29
29
  const t = this.graphStore.getNode(e);
30
- ct(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
+ ut(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
31
31
  }
32
32
  detachNode(e) {
33
33
  const t = this.graphStore.getNode(e);
34
- lt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
34
+ gt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
35
35
  }
36
36
  attachEdge(e) {
37
37
  const t = this.graphStore.getEdge(e).payload.shape.svg;
@@ -71,9 +71,9 @@ class Ve {
71
71
  n,
72
72
  h,
73
73
  d
74
- ), l = this.createEdgeRenderPort(s, a, h, d);
75
- let u = I.Line;
76
- o.element === s.element ? u = I.PortCycle : o.nodeId === s.nodeId && (u = I.NodeCycle), t.payload.shape.render({ from: c, to: l, category: u });
74
+ ), u = this.createEdgeRenderPort(s, a, h, d);
75
+ let l = U.Line;
76
+ o.element === s.element ? l = U.PortCycle : o.nodeId === s.nodeId && (l = U.NodeCycle), t.payload.shape.render({ from: c, to: u, category: l });
77
77
  }
78
78
  updateEdgePriority(e) {
79
79
  const t = this.graphStore.getEdge(e);
@@ -93,7 +93,7 @@ class Ve {
93
93
  };
94
94
  }
95
95
  }
96
- class ut {
96
+ class pt {
97
97
  constructor(e) {
98
98
  i(this, "xFrom", 1 / 0);
99
99
  i(this, "yFrom", 1 / 0);
@@ -109,11 +109,11 @@ class ut {
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), l = Math.max(n.y, a.y);
113
- return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
112
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), u = Math.max(n.y, a.y);
113
+ return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
114
114
  }
115
115
  }
116
- class gt {
116
+ class wt {
117
117
  constructor(e, t, o, s) {
118
118
  i(this, "attachedNodes", /* @__PURE__ */ new Set());
119
119
  i(this, "attachedEdges", /* @__PURE__ */ new Set());
@@ -125,8 +125,8 @@ class gt {
125
125
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
126
126
  h && !d ? t.add(a) : !h && d && o.add(a);
127
127
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
128
- const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), l = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
129
- h && (this.renderingBox.hasNode(l) || (t.add(l), o.delete(l)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(a) : !h && d && n.add(a);
128
+ const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), u = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
129
+ h && (this.renderingBox.hasNode(u) || (t.add(u), o.delete(u)), this.renderingBox.hasNode(l) || (t.add(l), o.delete(l))), h && !d ? s.add(a) : !h && d && n.add(a);
130
130
  }), n.forEach((a) => {
131
131
  this.handleDetachEdge(a);
132
132
  }), o.forEach((a) => {
@@ -137,7 +137,7 @@ class gt {
137
137
  this.handleAttachEdge(a);
138
138
  });
139
139
  });
140
- this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new ut(this.graphStore), this.trigger.subscribe(this.updateViewport);
140
+ this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new pt(this.graphStore), this.trigger.subscribe(this.updateViewport);
141
141
  }
142
142
  attachNode(e) {
143
143
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -191,7 +191,7 @@ class gt {
191
191
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
192
192
  }
193
193
  }
194
- class pt {
194
+ class yt {
195
195
  constructor(e, t) {
196
196
  i(this, "deferredNodes", /* @__PURE__ */ new Set());
197
197
  i(this, "deferredEdges", /* @__PURE__ */ new Set());
@@ -265,7 +265,7 @@ const C = () => {
265
265
  const r = new q();
266
266
  return [r, r];
267
267
  };
268
- class Ie {
268
+ class Ue {
269
269
  constructor(e, t, o, s) {
270
270
  i(this, "beforeDestroyEmitter");
271
271
  i(this, "destroyed", !1);
@@ -318,7 +318,7 @@ class Ie {
318
318
  this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
319
319
  }
320
320
  }
321
- class wt {
321
+ class ft {
322
322
  constructor() {
323
323
  i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
324
324
  i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
@@ -358,13 +358,13 @@ class wt {
358
358
  return this.multiToSingleMap.get(e) !== void 0;
359
359
  }
360
360
  }
361
- class A extends Error {
361
+ class S extends Error {
362
362
  constructor() {
363
363
  super(...arguments);
364
364
  i(this, "name", "CanvasError");
365
365
  }
366
366
  }
367
- const S = Object.freeze({
367
+ const b = Object.freeze({
368
368
  accessNonexistingNode: (r) => `Failed to access node with ID ${JSON.stringify(r)} because it does not exist`,
369
369
  addNodeWithExistingId: (r) => `Failed to add node with ID ${JSON.stringify(r)} because a node with this ID already exists`,
370
370
  addNodeWithElementInUse: (r, e) => `Failed to add node with ID ${JSON.stringify(r)} because its HTML element is already attached to node with ID ${JSON.stringify(e)}`,
@@ -387,7 +387,7 @@ const S = Object.freeze({
387
387
  removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
388
388
  accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
389
389
  });
390
- class Fe {
390
+ class $e {
391
391
  constructor() {
392
392
  i(this, "nodes", /* @__PURE__ */ new Map());
393
393
  i(this, "ports", /* @__PURE__ */ new Map());
@@ -396,7 +396,7 @@ class Fe {
396
396
  i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
397
397
  i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
398
398
  i(this, "portCycleEdges", /* @__PURE__ */ new Map());
399
- i(this, "elementPorts", new wt());
399
+ i(this, "elementPorts", new ft());
400
400
  i(this, "edgesElementsMap", /* @__PURE__ */ new Map());
401
401
  i(this, "afterNodeAddedEmitter");
402
402
  i(this, "onAfterNodeAdded");
@@ -432,16 +432,16 @@ class Fe {
432
432
  getNode(e) {
433
433
  const t = this.nodes.get(e);
434
434
  if (t === void 0)
435
- throw new A(S.accessNonexistingNode(e));
435
+ throw new S(b.accessNonexistingNode(e));
436
436
  return t;
437
437
  }
438
438
  addNode(e) {
439
439
  if (this.hasNode(e.id))
440
- throw new A(S.addNodeWithExistingId(e.id));
440
+ throw new S(b.addNodeWithExistingId(e.id));
441
441
  const t = this.findNodeIdByElement(e.element);
442
442
  if (t !== void 0)
443
- throw new A(
444
- S.addNodeWithElementInUse(e.id, t)
443
+ throw new S(
444
+ b.addNodeWithElementInUse(e.id, t)
445
445
  );
446
446
  const o = /* @__PURE__ */ new Map(), s = {
447
447
  element: e.element,
@@ -463,13 +463,13 @@ class Fe {
463
463
  }
464
464
  updateNode(e, t) {
465
465
  if (!this.hasNode(e))
466
- throw new A(S.updateNonexistentNode(e));
466
+ throw new S(b.updateNonexistentNode(e));
467
467
  const { payload: o } = this.nodes.get(e);
468
468
  o.x = t.x ?? o.x, o.y = t.y ?? o.y, o.centerFn = t.centerFn ?? o.centerFn, t.priority !== void 0 && (o.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
469
469
  }
470
470
  removeNode(e) {
471
471
  if (!this.hasNode(e))
472
- throw new A(S.removeNonexistentNode(e));
472
+ throw new S(b.removeNonexistentNode(e));
473
473
  this.beforeNodeRemovedEmitter.emit(e);
474
474
  const t = this.getNode(e);
475
475
  this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
@@ -480,15 +480,15 @@ class Fe {
480
480
  getPort(e) {
481
481
  const t = this.ports.get(e);
482
482
  if (t === void 0)
483
- throw new A(S.accessNonexistentPort(e));
483
+ throw new S(b.accessNonexistentPort(e));
484
484
  return t;
485
485
  }
486
486
  addPort(e) {
487
487
  if (this.hasPort(e.id))
488
- throw new A(S.addPortWithExistingId(e.id));
488
+ throw new S(b.addPortWithExistingId(e.id));
489
489
  if (!this.hasNode(e.nodeId))
490
- throw new A(
491
- S.addPortToNonexistentNode(e.id, e.nodeId)
490
+ throw new S(
491
+ b.addPortToNonexistentNode(e.id, e.nodeId)
492
492
  );
493
493
  this.ports.set(e.id, {
494
494
  element: e.element,
@@ -500,7 +500,7 @@ class Fe {
500
500
  }
501
501
  updatePort(e, t) {
502
502
  if (!this.hasPort(e))
503
- throw new A(S.updateNonexistentPort(e));
503
+ throw new S(b.updateNonexistentPort(e));
504
504
  const o = this.getPort(e).payload;
505
505
  o.direction = t.direction ?? o.direction, this.afterPortUpdatedEmitter.emit(e);
506
506
  }
@@ -513,14 +513,14 @@ class Fe {
513
513
  getNodePortIds(e) {
514
514
  const t = this.nodes.get(e);
515
515
  if (t === void 0)
516
- throw new A(
517
- S.accessPortsOfNonexistentNode(e)
516
+ throw new S(
517
+ b.accessPortsOfNonexistentNode(e)
518
518
  );
519
519
  return Array.from(t.ports.keys());
520
520
  }
521
521
  removePort(e) {
522
522
  if (!this.hasPort(e))
523
- throw new A(S.removeNonexistentPort(e));
523
+ throw new S(b.removeNonexistentPort(e));
524
524
  const t = this.getPort(e).nodeId;
525
525
  this.beforePortRemovedEmitter.emit(e), this.getNode(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
526
526
  }
@@ -530,7 +530,7 @@ class Fe {
530
530
  getEdge(e) {
531
531
  const t = this.edges.get(e);
532
532
  if (t === void 0)
533
- throw new A(S.accessNonexistentEdge(e));
533
+ throw new S(b.accessNonexistentEdge(e));
534
534
  return t;
535
535
  }
536
536
  findEdgeIdByElement(e) {
@@ -538,33 +538,33 @@ class Fe {
538
538
  }
539
539
  addEdge(e) {
540
540
  if (this.hasEdge(e.id))
541
- throw new A(S.addEdgeWithExistingId(e.id));
541
+ throw new S(b.addEdgeWithExistingId(e.id));
542
542
  if (!this.hasPort(e.from))
543
- throw new A(
544
- S.addEdgeFromNonexistentPort(e.id, e.from)
543
+ throw new S(
544
+ b.addEdgeFromNonexistentPort(e.id, e.from)
545
545
  );
546
546
  if (!this.hasPort(e.to))
547
- throw new A(
548
- S.addEdgeToNonexistentPort(e.id, e.to)
547
+ throw new S(
548
+ b.addEdgeToNonexistentPort(e.id, e.to)
549
549
  );
550
550
  const t = this.findEdgeIdByElement(e.shape.svg);
551
551
  if (t !== void 0)
552
- throw new A(
553
- S.addEdgeWithElementInUse(e.id, t)
552
+ throw new S(
553
+ b.addEdgeWithElementInUse(e.id, t)
554
554
  );
555
555
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
556
556
  }
557
557
  updateEdge(e, t) {
558
558
  if (!this.hasEdge(e))
559
- throw new A(S.updateNonexistentEdge(e));
559
+ throw new S(b.updateNonexistentEdge(e));
560
560
  if (t.from !== void 0 || t.to !== void 0) {
561
561
  if (t.from !== void 0 && !this.hasPort(t.from))
562
- throw new A(
563
- S.updateNonexistentEdgeSource(e, t.from)
562
+ throw new S(
563
+ b.updateNonexistentEdgeSource(e, t.from)
564
564
  );
565
565
  if (t.to !== void 0 && !this.hasPort(t.to))
566
- throw new A(
567
- S.updateNonexistentEdgeTarget(e, t.to)
566
+ throw new S(
567
+ b.updateNonexistentEdgeTarget(e, t.to)
568
568
  );
569
569
  const s = this.getEdge(e), n = s.payload;
570
570
  this.removeEdgeInternal(e), this.addEdgeInternal({
@@ -583,7 +583,7 @@ class Fe {
583
583
  }
584
584
  removeEdge(e) {
585
585
  if (!this.hasEdge(e))
586
- throw new A(S.removeNonexistentEdge(e));
586
+ throw new S(b.removeNonexistentEdge(e));
587
587
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
588
588
  }
589
589
  clear() {
@@ -592,24 +592,24 @@ class Fe {
592
592
  getPortIncomingEdgeIds(e) {
593
593
  const t = this.portIncomingEdges.get(e);
594
594
  if (t === void 0)
595
- throw new A(
596
- S.accessEdgesForNonexistentPort(e)
595
+ throw new S(
596
+ b.accessEdgesForNonexistentPort(e)
597
597
  );
598
598
  return Array.from(t);
599
599
  }
600
600
  getPortOutgoingEdgeIds(e) {
601
601
  const t = this.portOutgoingEdges.get(e);
602
602
  if (t === void 0)
603
- throw new A(
604
- S.accessEdgesForNonexistentPort(e)
603
+ throw new S(
604
+ b.accessEdgesForNonexistentPort(e)
605
605
  );
606
606
  return Array.from(t);
607
607
  }
608
608
  getPortCycleEdgeIds(e) {
609
609
  const t = this.portCycleEdges.get(e);
610
610
  if (t === void 0)
611
- throw new A(
612
- S.accessEdgesForNonexistentPort(e)
611
+ throw new S(
612
+ b.accessEdgesForNonexistentPort(e)
613
613
  );
614
614
  return Array.from(t);
615
615
  }
@@ -686,18 +686,18 @@ const me = (r) => ({
686
686
  scale: 1 / r.scale,
687
687
  x: -r.x / r.scale,
688
688
  y: -r.y / r.scale
689
- }), Ee = {
689
+ }), xe = {
690
690
  scale: 1,
691
691
  x: 0,
692
692
  y: 0
693
- }, xe = (r, e) => ({
693
+ }, Ee = (r, e) => ({
694
694
  x: r.scale * e.x + r.x,
695
695
  y: r.scale * e.y + r.y
696
696
  });
697
- class ft {
697
+ class vt {
698
698
  constructor(e) {
699
- i(this, "viewportMatrix", Ee);
700
- i(this, "contentMatrix", Ee);
699
+ i(this, "viewportMatrix", xe);
700
+ i(this, "contentMatrix", xe);
701
701
  i(this, "beforeUpdateEmitter");
702
702
  i(this, "onBeforeUpdated");
703
703
  i(this, "afterUpdateEmitter");
@@ -734,10 +734,10 @@ class ft {
734
734
  return { width: e, height: t };
735
735
  }
736
736
  createContentCoords(e) {
737
- return xe(this.viewportMatrix, e);
737
+ return Ee(this.viewportMatrix, e);
738
738
  }
739
739
  createViewportCoords(e) {
740
- return xe(this.contentMatrix, e);
740
+ return Ee(this.contentMatrix, e);
741
741
  }
742
742
  destroy() {
743
743
  this.observer.disconnect();
@@ -776,16 +776,16 @@ class ee {
776
776
  this.canvas.updateNode(t);
777
777
  }
778
778
  }
779
- const yt = (r, e, t) => {
779
+ const mt = (r, e, t) => {
780
780
  const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
781
781
  return e >= o && e <= o + n && t >= s && t <= s + a;
782
- }, vt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
783
- class mt {
782
+ }, xt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
783
+ class Et {
784
784
  constructor(e, t) {
785
785
  this.element = e, this.win = t;
786
786
  }
787
787
  verify(e, t) {
788
- return yt(this.element, e, t) && vt(this.win, e, t);
788
+ return mt(this.element, e, t) && xt(this.win, e, t);
789
789
  }
790
790
  }
791
791
  const H = (r, e) => {
@@ -805,7 +805,7 @@ const H = (r, e) => {
805
805
  }
806
806
  ]
807
807
  };
808
- }, Et = (r, e) => {
808
+ }, At = (r, e) => {
809
809
  let t = e;
810
810
  for (; t !== null; ) {
811
811
  const o = r.findPortIdsByElement(t)[0] ?? null;
@@ -824,21 +824,21 @@ const H = (r, e) => {
824
824
  status: "notFound"
825
825
  };
826
826
  };
827
- function* Ue(r, e) {
827
+ function* Be(r, e) {
828
828
  const t = r.elementsFromPoint(e.x, e.y);
829
829
  for (const o of t) {
830
830
  if (o.shadowRoot !== null) {
831
- const s = Ue(o.shadowRoot, e);
831
+ const s = Be(o.shadowRoot, e);
832
832
  for (const n of s)
833
833
  yield n;
834
834
  }
835
835
  yield o;
836
836
  }
837
837
  }
838
- const $e = (r, e) => {
839
- const t = Ue(document, e);
838
+ const Oe = (r, e) => {
839
+ const t = Be(document, e);
840
840
  for (const o of t) {
841
- const s = Et(r, o);
841
+ const s = At(r, o);
842
842
  if (s.status === "portFound")
843
843
  return s.portId;
844
844
  if (s.status === "nodeEncountered")
@@ -846,14 +846,14 @@ const $e = (r, e) => {
846
846
  }
847
847
  return null;
848
848
  };
849
- var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
850
- const Be = (r, e) => ({
849
+ var R = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(R || {});
850
+ const We = (r, e) => ({
851
851
  x: r / 2,
852
852
  y: e / 2
853
- }), m = (r, e, t) => ({
853
+ }), x = (r, e, t) => ({
854
854
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
855
855
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
856
- }), Oe = (r, e, t) => {
856
+ }), ze = (r, e, t) => {
857
857
  const o = {
858
858
  x: r.x + r.width / 2,
859
859
  y: r.y + r.height / 2
@@ -870,7 +870,7 @@ const Be = (r, e) => ({
870
870
  to: { x: s.x - n, y: s.y - a }
871
871
  };
872
872
  };
873
- class xt {
873
+ class St {
874
874
  constructor(e) {
875
875
  i(this, "path");
876
876
  i(this, "midpoint");
@@ -883,27 +883,27 @@ class xt {
883
883
  curvature: h,
884
884
  hasSourceArrow: d,
885
885
  hasTargetArrow: c
886
- } = e, l = (t.x + o.x) / 2, u = (t.y + o.y) / 2;
887
- this.midpoint = { x: l, y: u };
888
- const g = m(
886
+ } = e, u = (t.x + o.x) / 2, l = (t.y + o.y) / 2;
887
+ this.midpoint = { x: u, y: l };
888
+ const g = x(
889
889
  { x: t.x + s, y: t.y },
890
890
  n,
891
891
  t
892
- ), p = m(
892
+ ), p = x(
893
893
  { x: o.x - s, y: o.y },
894
894
  a,
895
895
  o
896
896
  ), w = {
897
897
  x: g.x + n.x * h,
898
898
  y: g.y + n.y * h
899
- }, f = {
899
+ }, y = {
900
900
  x: p.x - a.x * h,
901
901
  y: p.y - a.y * h
902
- }, y = `M ${g.x} ${g.y} C ${w.x} ${w.y}, ${f.x} ${f.y}, ${p.x} ${p.y}`, E = d ? "" : `M ${t.x} ${t.y} L ${g.x} ${g.y} `, x = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
903
- this.path = `${E}${y}${x}`;
902
+ }, f = `M ${g.x} ${g.y} C ${w.x} ${w.y}, ${y.x} ${y.y}, ${p.x} ${p.y}`, m = d ? "" : `M ${t.x} ${t.y} L ${g.x} ${g.y} `, E = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
903
+ this.path = `${m}${f}${E}`;
904
904
  }
905
905
  }
906
- class At {
906
+ class bt {
907
907
  constructor(e) {
908
908
  i(this, "path");
909
909
  i(this, "midpoint");
@@ -916,95 +916,95 @@ class At {
916
916
  detourDir: h,
917
917
  from: d,
918
918
  to: c,
919
- arrowLength: l,
920
- detourDistance: u
921
- } = e, g = t ? m(
922
- { x: d.x + l, y: d.y },
919
+ arrowLength: u,
920
+ detourDistance: l
921
+ } = e, g = t ? x(
922
+ { x: d.x + u, y: d.y },
923
923
  n,
924
924
  d
925
- ) : d, p = o ? m(
925
+ ) : d, p = o ? x(
926
926
  {
927
- x: c.x - l,
927
+ x: c.x - u,
928
928
  y: c.y
929
929
  },
930
930
  a,
931
931
  c
932
- ) : c, w = Math.cos(h) * u, f = Math.sin(h) * u, y = m(
933
- { x: d.x + l, y: d.y },
932
+ ) : c, w = Math.cos(h) * l, y = Math.sin(h) * l, f = x(
933
+ { x: d.x + u, y: d.y },
934
934
  n,
935
935
  d
936
- ), E = {
937
- x: y.x + w,
938
- y: y.y + f
939
- }, x = m(
940
- { x: c.x - l, y: c.y },
936
+ ), m = {
937
+ x: f.x + w,
938
+ y: f.y + y
939
+ }, E = x(
940
+ { x: c.x - u, y: c.y },
941
941
  a,
942
942
  c
943
- ), N = {
944
- x: x.x + w,
945
- y: x.y + f
943
+ ), A = {
944
+ x: E.x + w,
945
+ y: E.y + y
946
946
  }, T = {
947
- x: (E.x + N.x) / 2,
948
- y: (E.y + N.y) / 2
947
+ x: (m.x + A.x) / 2,
948
+ y: (m.y + A.y) / 2
949
+ }, M = {
950
+ x: f.x + s * n.x,
951
+ y: f.y + s * n.y
952
+ }, L = {
953
+ x: E.x - s * a.x,
954
+ y: E.y - s * a.y
955
+ }, V = {
956
+ x: f.x + w,
957
+ y: f.y + y
949
958
  }, D = {
950
- x: y.x + s * n.x,
951
- y: y.y + s * n.y
952
- }, F = {
953
- x: x.x - s * a.x,
954
- y: x.y - s * a.y
955
- }, U = {
956
- x: y.x + w,
957
- y: y.y + f
958
- }, R = {
959
- x: x.x + w,
960
- y: x.y + f
959
+ x: E.x + w,
960
+ y: E.y + y
961
961
  };
962
962
  this.path = [
963
963
  `M ${g.x} ${g.y}`,
964
- `L ${y.x} ${y.y}`,
965
- `C ${D.x} ${D.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
966
- `C ${R.x} ${R.y} ${F.x} ${F.y} ${x.x} ${x.y}`,
964
+ `L ${f.x} ${f.y}`,
965
+ `C ${M.x} ${M.y} ${V.x} ${V.y} ${T.x} ${T.y}`,
966
+ `C ${D.x} ${D.y} ${L.x} ${L.y} ${E.x} ${E.y}`,
967
967
  `L ${p.x} ${p.y}`
968
968
  ].join(" "), this.midpoint = T;
969
969
  }
970
970
  }
971
971
  const te = Object.freeze({
972
972
  edgeColor: "--edge-color"
973
- }), We = (r) => {
973
+ }), ke = (r) => {
974
974
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
975
975
  return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(te.edgeColor, r), e;
976
- }, ze = (r) => {
976
+ }, He = (r) => {
977
977
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
978
978
  return e.setAttribute("stroke", `var(${te.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
979
979
  }, X = () => {
980
980
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
981
981
  return r.setAttribute("fill", `var(${te.edgeColor})`), r;
982
- }, ke = (r, e) => {
982
+ }, Ye = (r, e) => {
983
983
  r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
984
- }, V = (r, e) => {
984
+ }, F = (r, e) => {
985
985
  const t = [];
986
986
  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) {
987
987
  const o = r.length - 1;
988
988
  let s = 0, n = 0, a = 0;
989
989
  r.forEach((h, d) => {
990
- let c = 0, l = 0, u = 0;
990
+ let c = 0, u = 0, l = 0;
991
991
  const g = d > 0, p = d < o, w = g && p;
992
- if (g && (c = -s, l = -n, u = a), p) {
993
- const D = r[d + 1];
994
- s = D.x - h.x, n = D.y - h.y, a = Math.sqrt(s * s + n * n);
992
+ if (g && (c = -s, u = -n, l = a), p) {
993
+ const M = r[d + 1];
994
+ s = M.x - h.x, n = M.y - h.y, a = Math.sqrt(s * s + n * n);
995
995
  }
996
- const y = a !== 0 ? Math.min((w ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, E = w ? { x: h.x + s * y, y: h.y + n * y } : h, N = u !== 0 ? Math.min((w ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, T = w ? { x: h.x + c * N, y: h.y + l * N } : h;
996
+ const f = a !== 0 ? Math.min((w ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, m = w ? { x: h.x + s * f, y: h.y + n * f } : h, A = l !== 0 ? Math.min((w ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, T = w ? { x: h.x + c * A, y: h.y + u * A } : h;
997
997
  d > 0 && t.push(`L ${T.x} ${T.y}`), w && t.push(
998
- `C ${h.x} ${h.y} ${h.x} ${h.y} ${E.x} ${E.y}`
998
+ `C ${h.x} ${h.y} ${h.x} ${h.y} ${m.x} ${m.y}`
999
999
  );
1000
1000
  });
1001
1001
  }
1002
1002
  return t.join(" ");
1003
- }, St = (r, e) => {
1003
+ }, Pt = (r, e) => {
1004
1004
  const t = r.linePoint, o = e.linePoint, s = o.x - t.x >= 0, n = r.dirX >= 0, a = e.dirX >= 0;
1005
1005
  if (n === a) {
1006
- const u = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
1007
- return u ? {
1006
+ const l = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
1007
+ return l ? {
1008
1008
  points: [
1009
1009
  r.arrowPoint,
1010
1010
  { x: w.x, y: t.y },
@@ -1026,19 +1026,19 @@ const te = Object.freeze({
1026
1026
  }
1027
1027
  const d = n === s, c = (t.y + o.y) / 2;
1028
1028
  if (d) {
1029
- const u = { x: o.x, y: t.y };
1029
+ const l = { x: o.x, y: t.y };
1030
1030
  return {
1031
- points: [r.arrowPoint, u, o, e.arrowPoint],
1032
- midpoint: { x: u.x, y: c }
1031
+ points: [r.arrowPoint, l, o, e.arrowPoint],
1032
+ midpoint: { x: l.x, y: c }
1033
1033
  };
1034
1034
  }
1035
- const l = { x: t.x, y: o.y };
1035
+ const u = { x: t.x, y: o.y };
1036
1036
  return {
1037
- points: [r.arrowPoint, t, l, e.arrowPoint],
1038
- midpoint: { x: l.x, y: c }
1037
+ points: [r.arrowPoint, t, u, e.arrowPoint],
1038
+ midpoint: { x: u.x, y: c }
1039
1039
  };
1040
1040
  };
1041
- class bt {
1041
+ class Nt {
1042
1042
  constructor(e) {
1043
1043
  i(this, "path");
1044
1044
  i(this, "midpoint");
@@ -1051,23 +1051,23 @@ class bt {
1051
1051
  arrowOffset: h,
1052
1052
  roundness: d,
1053
1053
  hasSourceArrow: c,
1054
- hasTargetArrow: l
1055
- } = e, u = c ? m(
1054
+ hasTargetArrow: u
1055
+ } = e, l = c ? x(
1056
1056
  { x: t.x + a, y: t.y },
1057
1057
  s,
1058
1058
  t
1059
- ) : t, g = l ? m({ x: o.x - a, y: o.y }, n, o) : o, p = a + h, w = m(
1059
+ ) : t, g = u ? x({ x: o.x - a, y: o.y }, n, o) : o, p = a + h, w = x(
1060
1060
  { x: t.x + p, y: t.y },
1061
1061
  s,
1062
1062
  t
1063
- ), f = m({ x: o.x - p, y: o.y }, n, o), y = St(
1064
- { arrowPoint: u, linePoint: w, dirX: s.x },
1065
- { arrowPoint: g, linePoint: f, dirX: n.x }
1063
+ ), y = x({ x: o.x - p, y: o.y }, n, o), f = Pt(
1064
+ { arrowPoint: l, linePoint: w, dirX: s.x },
1065
+ { arrowPoint: g, linePoint: y, dirX: n.x }
1066
1066
  );
1067
- this.path = V(y.points, d), this.midpoint = y.midpoint;
1067
+ this.path = F(f.points, d), this.midpoint = f.midpoint;
1068
1068
  }
1069
1069
  }
1070
- class Pt {
1070
+ class Ct {
1071
1071
  constructor(e) {
1072
1072
  i(this, "path");
1073
1073
  i(this, "midpoint");
@@ -1080,45 +1080,45 @@ class Pt {
1080
1080
  fromDir: h,
1081
1081
  toDir: d,
1082
1082
  arrowOffset: c,
1083
- detourDir: l,
1084
- detourDistance: u,
1083
+ detourDir: u,
1084
+ detourDistance: l,
1085
1085
  roundness: g
1086
- } = e, p = t ? m(
1086
+ } = e, p = t ? x(
1087
1087
  { x: s.x + a, y: s.y },
1088
1088
  h,
1089
1089
  s
1090
- ) : s, w = o ? m(
1090
+ ) : s, w = o ? x(
1091
1091
  {
1092
1092
  x: n.x - a,
1093
1093
  y: n.y
1094
1094
  },
1095
1095
  d,
1096
1096
  n
1097
- ) : n, f = a + c, y = Math.cos(l) * u, E = Math.sin(l) * u, x = m(
1098
- { x: s.x + f, y: s.y },
1097
+ ) : n, y = a + c, f = Math.cos(u) * l, m = Math.sin(u) * l, E = x(
1098
+ { x: s.x + y, y: s.y },
1099
1099
  h,
1100
1100
  s
1101
- ), N = {
1102
- x: x.x + y,
1103
- y: x.y + E
1104
- }, T = m(
1105
- { x: n.x - f, y: n.y },
1101
+ ), A = {
1102
+ x: E.x + f,
1103
+ y: E.y + m
1104
+ }, T = x(
1105
+ { x: n.x - y, y: n.y },
1106
1106
  d,
1107
1107
  n
1108
- ), D = {
1109
- x: T.x + y,
1110
- y: T.y + E
1108
+ ), M = {
1109
+ x: T.x + f,
1110
+ y: T.y + m
1111
1111
  };
1112
1112
  this.midpoint = {
1113
- x: (N.x + D.x) / 2,
1114
- y: (N.y + D.y) / 2
1115
- }, this.path = V(
1116
- [p, x, N, D, T, w],
1113
+ x: (A.x + M.x) / 2,
1114
+ y: (A.y + M.y) / 2
1115
+ }, this.path = F(
1116
+ [p, E, A, M, T, w],
1117
1117
  g
1118
1118
  );
1119
1119
  }
1120
1120
  }
1121
- class Nt {
1121
+ class Tt {
1122
1122
  constructor(e) {
1123
1123
  i(this, "path");
1124
1124
  i(this, "midpoint");
@@ -1131,8 +1131,8 @@ class Nt {
1131
1131
  fromDir: h,
1132
1132
  toDir: d,
1133
1133
  arrowOffset: c,
1134
- roundness: l
1135
- } = e, u = this.createArrowPoint(
1134
+ roundness: u
1135
+ } = e, l = this.createArrowPoint(
1136
1136
  s,
1137
1137
  h,
1138
1138
  t,
@@ -1142,13 +1142,13 @@ class Nt {
1142
1142
  d,
1143
1143
  o,
1144
1144
  -a
1145
- ), p = a + c, w = { x: t.x + p, y: t.y }, f = m(w, h, t), y = { x: o.x - p, y: o.y }, E = m(y, d, o);
1146
- this.path = V(
1147
- [u, f, E, g],
1148
- l
1145
+ ), p = a + c, w = { x: t.x + p, y: t.y }, y = x(w, h, t), f = { x: o.x - p, y: o.y }, m = x(f, d, o);
1146
+ this.path = F(
1147
+ [l, y, m, g],
1148
+ u
1149
1149
  );
1150
- const x = (f.x + E.x) / 2, N = (f.y + E.y) / 2;
1151
- this.midpoint = { x, y: N };
1150
+ const E = (y.x + m.x) / 2, A = (y.y + m.y) / 2;
1151
+ this.midpoint = { x: E, y: A };
1152
1152
  }
1153
1153
  createArrowPoint(e, t, o, s) {
1154
1154
  if (!e)
@@ -1157,14 +1157,14 @@ class Nt {
1157
1157
  x: o.x + s,
1158
1158
  y: o.y
1159
1159
  };
1160
- return m(n, t, o);
1160
+ return x(n, t, o);
1161
1161
  }
1162
1162
  }
1163
- const Ct = (r, e) => {
1163
+ const Mt = (r, e) => {
1164
1164
  const t = r.linePoint, o = e.linePoint, s = o.y - t.y >= 0, n = r.dirY >= 0, a = e.dirY >= 0;
1165
1165
  if (n === a) {
1166
- const u = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
1167
- return u ? {
1166
+ const l = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
1167
+ return l ? {
1168
1168
  points: [
1169
1169
  r.arrowPoint,
1170
1170
  { x: t.x, y: w.y },
@@ -1186,19 +1186,19 @@ const Ct = (r, e) => {
1186
1186
  }
1187
1187
  const d = n === s, c = (t.x + o.x) / 2;
1188
1188
  if (d) {
1189
- const u = { x: t.x, y: o.y };
1189
+ const l = { x: t.x, y: o.y };
1190
1190
  return {
1191
- points: [r.arrowPoint, u, o, e.arrowPoint],
1192
- midpoint: { x: c, y: u.y }
1191
+ points: [r.arrowPoint, l, o, e.arrowPoint],
1192
+ midpoint: { x: c, y: l.y }
1193
1193
  };
1194
1194
  }
1195
- const l = { x: o.x, y: t.y };
1195
+ const u = { x: o.x, y: t.y };
1196
1196
  return {
1197
- points: [r.arrowPoint, t, l, e.arrowPoint],
1198
- midpoint: { x: c, y: l.y }
1197
+ points: [r.arrowPoint, t, u, e.arrowPoint],
1198
+ midpoint: { x: c, y: u.y }
1199
1199
  };
1200
1200
  };
1201
- class Tt {
1201
+ class Dt {
1202
1202
  constructor(e) {
1203
1203
  i(this, "path");
1204
1204
  i(this, "midpoint");
@@ -1211,27 +1211,27 @@ class Tt {
1211
1211
  arrowOffset: h,
1212
1212
  fromDir: d,
1213
1213
  toDir: c,
1214
- roundness: l
1215
- } = e, u = s ? m(
1214
+ roundness: u
1215
+ } = e, l = s ? x(
1216
1216
  { x: t.x + a, y: t.y },
1217
1217
  d,
1218
1218
  t
1219
- ) : t, g = n ? m({ x: o.x - a, y: o.y }, c, o) : o, p = a + h, w = m(
1219
+ ) : t, g = n ? x({ x: o.x - a, y: o.y }, c, o) : o, p = a + h, w = x(
1220
1220
  { x: t.x + p, y: t.y },
1221
1221
  d,
1222
1222
  t
1223
- ), f = m({ x: o.x - p, y: o.y }, c, o), y = Ct(
1224
- { arrowPoint: u, linePoint: w, dirY: d.y },
1225
- { arrowPoint: g, linePoint: f, dirY: c.y }
1223
+ ), y = x({ x: o.x - p, y: o.y }, c, o), f = Mt(
1224
+ { arrowPoint: l, linePoint: w, dirY: d.y },
1225
+ { arrowPoint: g, linePoint: y, dirY: c.y }
1226
1226
  );
1227
- this.path = V(y.points, l), this.midpoint = y.midpoint;
1227
+ this.path = F(f.points, u), this.midpoint = f.midpoint;
1228
1228
  }
1229
1229
  }
1230
1230
  class re {
1231
1231
  constructor(e) {
1232
1232
  i(this, "path");
1233
1233
  i(this, "midpoint");
1234
- const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
1234
+ const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, l = [
1235
1235
  { x: o, y: 0 },
1236
1236
  { x: d, y: 0 },
1237
1237
  { x: d, y: t },
@@ -1240,78 +1240,33 @@ class re {
1240
1240
  { x: d, y: -t },
1241
1241
  { x: d, y: 0 },
1242
1242
  { x: o, y: 0 }
1243
- ].map((p) => m(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), g = `M ${a.x} ${a.y} L ${u[0].x} ${u[0].y} `;
1244
- this.path = `${h ? "" : g}${V(u, e.roundness)}`, this.midpoint = { x: (u[3].x + u[4].x) / 2, y: (u[3].y + u[4].y) / 2 };
1243
+ ].map((p) => x(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), g = `M ${a.x} ${a.y} L ${l[0].x} ${l[0].y} `;
1244
+ this.path = `${h ? "" : g}${F(l, e.roundness)}`, this.midpoint = { x: (l[3].x + l[4].x) / 2, y: (l[3].y + l[4].y) / 2 };
1245
1245
  }
1246
1246
  }
1247
- class Mt {
1247
+ class Rt {
1248
1248
  constructor(e) {
1249
1249
  i(this, "path");
1250
1250
  i(this, "midpoint");
1251
- const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, l = Math.sqrt(d * d - s * s), u = l * s / d, g = l + o + t, p = t + u, f = [
1251
+ const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, u = Math.sqrt(d * d - s * s), l = u * s / d, g = u + o + t, p = t + l, y = [
1252
1252
  { x: t, y: 0 },
1253
1253
  { x: p, y: c },
1254
1254
  { x: p, y: -c },
1255
1255
  { x: g, y: 0 }
1256
- ].map((x) => m(x, n, { x: 0, y: 0 })).map((x) => ({ x: x.x + a.x, y: x.y + a.y })), y = [
1257
- `M ${f[0].x} ${f[0].y}`,
1258
- `A ${s} ${s} 0 0 1 ${f[1].x} ${f[1].y}`,
1259
- `A ${o} ${o} 0 1 0 ${f[2].x} ${f[2].y}`,
1260
- `A ${s} ${s} 0 0 1 ${f[0].x} ${f[0].y}`
1261
- ].join(" "), E = `M ${a.x} ${a.y} L ${f[0].x} ${f[0].y} `;
1262
- this.path = `${h ? "" : E}${y}`, this.midpoint = f[3];
1263
- }
1264
- }
1265
- class Dt {
1266
- constructor(e) {
1267
- i(this, "path");
1268
- i(this, "midpoint");
1269
- i(this, "diagonalDistance");
1270
- const {
1271
- from: t,
1272
- to: o,
1273
- sourceOffset: s,
1274
- targetOffset: n,
1275
- hasSourceArrow: a,
1276
- hasTargetArrow: h,
1277
- arrowLength: d
1278
- } = e;
1279
- this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
1280
- const c = o.x - t.x, l = o.y - t.y;
1281
- if (this.diagonalDistance = Math.sqrt(c * c + l * l), this.diagonalDistance === 0) {
1282
- this.path = "";
1283
- return;
1284
- }
1285
- const u = { x: c, y: l }, g = this.createDirectLinePoint({
1286
- offset: s,
1287
- hasArrow: a,
1288
- flip: 1,
1289
- shift: t,
1290
- arrowLength: d,
1291
- dir: u
1292
- }), p = this.createDirectLinePoint({
1293
- offset: n,
1294
- hasArrow: h,
1295
- flip: -1,
1296
- shift: o,
1297
- arrowLength: d,
1298
- dir: u
1299
- });
1300
- this.path = `M ${g.x} ${g.y} L ${p.x} ${p.y}`;
1301
- }
1302
- createDirectLinePoint(e) {
1303
- const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
1304
- return {
1305
- x: n.x * s + a.x,
1306
- y: n.y * s + a.y
1307
- };
1256
+ ].map((E) => x(E, n, { x: 0, y: 0 })).map((E) => ({ x: E.x + a.x, y: E.y + a.y })), f = [
1257
+ `M ${y[0].x} ${y[0].y}`,
1258
+ `A ${s} ${s} 0 0 1 ${y[1].x} ${y[1].y}`,
1259
+ `A ${o} ${o} 0 1 0 ${y[2].x} ${y[2].y}`,
1260
+ `A ${s} ${s} 0 0 1 ${y[0].x} ${y[0].y}`
1261
+ ].join(" "), m = `M ${a.x} ${a.y} L ${y[0].x} ${y[0].y} `;
1262
+ this.path = `${h ? "" : m}${f}`, this.midpoint = y[3];
1308
1263
  }
1309
1264
  }
1310
- const Rt = (r, e, t) => {
1265
+ const Lt = (r, e, t) => {
1311
1266
  const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
1312
1267
  return (t >= 0 ? o : s) + t;
1313
1268
  };
1314
- class Lt {
1269
+ class Vt {
1315
1270
  constructor(e) {
1316
1271
  i(this, "path");
1317
1272
  i(this, "midpoint");
@@ -1324,49 +1279,49 @@ class Lt {
1324
1279
  fromDir: h,
1325
1280
  toDir: d,
1326
1281
  arrowOffset: c,
1327
- roundness: l,
1328
- detourDistance: u
1329
- } = e, g = t ? m(
1282
+ roundness: u,
1283
+ detourDistance: l
1284
+ } = e, g = t ? x(
1330
1285
  { x: n.x + s, y: n.y },
1331
1286
  h,
1332
1287
  n
1333
- ) : n, p = o ? m(
1288
+ ) : n, p = o ? x(
1334
1289
  {
1335
1290
  x: a.x - s,
1336
1291
  y: a.y
1337
1292
  },
1338
1293
  d,
1339
1294
  a
1340
- ) : a, w = s + c, f = m(
1295
+ ) : a, w = s + c, y = x(
1341
1296
  { x: n.x + w, y: n.y },
1342
1297
  h,
1343
1298
  n
1344
- ), y = m(
1299
+ ), f = x(
1345
1300
  { x: a.x - w, y: a.y },
1346
1301
  d,
1347
1302
  a
1348
- ), E = Rt(f, y, u);
1303
+ ), m = Lt(y, f, l);
1349
1304
  this.midpoint = {
1350
- x: (f.x + y.x) / 2,
1351
- y: E
1352
- }, this.path = V(
1305
+ x: (y.x + f.x) / 2,
1306
+ y: m
1307
+ }, this.path = F(
1353
1308
  [
1354
1309
  g,
1355
- f,
1356
- { x: f.x, y: E },
1357
- { x: y.x, y: E },
1358
1310
  y,
1311
+ { x: y.x, y: m },
1312
+ { x: f.x, y: m },
1313
+ f,
1359
1314
  p
1360
1315
  ],
1361
- l
1316
+ u
1362
1317
  );
1363
1318
  }
1364
1319
  }
1365
- const Vt = (r, e, t) => {
1320
+ const It = (r, e, t) => {
1366
1321
  const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
1367
1322
  return (t >= 0 ? o : s) + t;
1368
1323
  };
1369
- class It {
1324
+ class Ft {
1370
1325
  constructor(e) {
1371
1326
  i(this, "path");
1372
1327
  i(this, "midpoint");
@@ -1379,41 +1334,41 @@ class It {
1379
1334
  from: h,
1380
1335
  to: d,
1381
1336
  arrowOffset: c,
1382
- detourDistance: l,
1383
- roundness: u
1384
- } = e, g = t ? m(
1337
+ detourDistance: u,
1338
+ roundness: l
1339
+ } = e, g = t ? x(
1385
1340
  { x: h.x + s, y: h.y },
1386
1341
  n,
1387
1342
  h
1388
- ) : h, p = o ? m(
1343
+ ) : h, p = o ? x(
1389
1344
  {
1390
1345
  x: d.x - s,
1391
1346
  y: d.y
1392
1347
  },
1393
1348
  a,
1394
1349
  d
1395
- ) : d, w = s + c, f = m(
1350
+ ) : d, w = s + c, y = x(
1396
1351
  { x: h.x + w, y: h.y },
1397
1352
  n,
1398
1353
  h
1399
- ), y = m(
1354
+ ), f = x(
1400
1355
  { x: d.x - w, y: d.y },
1401
1356
  a,
1402
1357
  d
1403
- ), E = Vt(f, y, l);
1358
+ ), m = It(y, f, u);
1404
1359
  this.midpoint = {
1405
- x: E,
1406
- y: (f.y + y.y) / 2
1407
- }, this.path = V(
1360
+ x: m,
1361
+ y: (y.y + f.y) / 2
1362
+ }, this.path = F(
1408
1363
  [
1409
1364
  g,
1410
- f,
1411
- { x: E, y: f.y },
1412
- { x: E, y: y.y },
1413
1365
  y,
1366
+ { x: m, y: y.y },
1367
+ { x: m, y: f.y },
1368
+ f,
1414
1369
  p
1415
1370
  ],
1416
- u
1371
+ l
1417
1372
  );
1418
1373
  }
1419
1374
  }
@@ -1438,7 +1393,7 @@ const v = Object.freeze({
1438
1393
  smallCycleRadius: 15,
1439
1394
  curvature: 90,
1440
1395
  interactiveWidth: 10,
1441
- preOffset: 0
1396
+ portOffset: 0
1442
1397
  }), Ae = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
1443
1398
  class G {
1444
1399
  constructor(e) {
@@ -1453,19 +1408,19 @@ class G {
1453
1408
  i(this, "onAfterRender");
1454
1409
  i(this, "afterRenderEmitter");
1455
1410
  i(this, "arrowRenderer");
1456
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg = We(e.color), this.svg.appendChild(this.group), this.line = ze(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1411
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg = ke(e.color), this.svg.appendChild(this.group), this.line = He(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1457
1412
  }
1458
1413
  render(e) {
1459
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Oe(
1414
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = ze(
1460
1415
  e.from,
1461
1416
  e.to,
1462
1417
  this.params.padding
1463
1418
  );
1464
- ke(this.svg, { x: t, y: o, width: s, height: n });
1419
+ Ye(this.svg, { x: t, y: o, width: s, height: n });
1465
1420
  const d = Ae(e.from.direction), c = Ae(e.to.direction);
1466
- let l = { x: -c.x, y: -c.y }, u;
1467
- e.category === I.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === I.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1468
- const g = u(a, h, d, c);
1421
+ let u = { x: -c.x, y: -c.y }, l;
1422
+ e.category === U.PortCycle ? (l = this.params.createCyclePath, u = d) : e.category === U.NodeCycle ? l = this.params.createDetourPath : l = this.params.createLinePath;
1423
+ const g = l(a, h, d, c);
1469
1424
  this.line.setAttribute("d", g.path);
1470
1425
  let p = null;
1471
1426
  this.sourceArrow && (p = this.arrowRenderer({
@@ -1475,7 +1430,7 @@ class G {
1475
1430
  }), this.sourceArrow.setAttribute("d", p));
1476
1431
  let w = null;
1477
1432
  this.targetArrow && (w = this.arrowRenderer({
1478
- direction: l,
1433
+ direction: u,
1479
1434
  shift: h,
1480
1435
  arrowLength: this.params.arrowLength
1481
1436
  }), this.targetArrow.setAttribute("d", w)), this.afterRenderEmitter.emit({
@@ -1485,32 +1440,32 @@ class G {
1485
1440
  });
1486
1441
  }
1487
1442
  }
1488
- const Ft = (r) => (e) => {
1443
+ const Ut = (r) => (e) => {
1489
1444
  const o = [
1490
1445
  { x: 0, y: 0 },
1491
1446
  { x: e.arrowLength, y: r.radius },
1492
1447
  { x: e.arrowLength, y: -r.radius }
1493
1448
  ].map(
1494
- (h) => m(h, e.direction, { x: 0, y: 0 })
1449
+ (h) => x(h, e.direction, { x: 0, y: 0 })
1495
1450
  ).map((h) => ({
1496
1451
  x: h.x + e.shift.x,
1497
1452
  y: h.y + e.shift.y
1498
1453
  })), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1499
1454
  return `${s} ${n} ${a} Z`;
1500
- }, Ut = (r) => (e) => {
1455
+ }, $t = (r) => (e) => {
1501
1456
  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 = [
1502
1457
  { x: 0, y: 0 },
1503
1458
  { x: a, y: -h },
1504
1459
  { x: a, y: h }
1505
1460
  ].map(
1506
- (w) => m(w, e.direction, { x: 0, y: 0 })
1461
+ (w) => x(w, e.direction, { x: 0, y: 0 })
1507
1462
  ).map((w) => ({
1508
1463
  x: w.x + e.shift.x,
1509
1464
  y: w.y + e.shift.y
1510
- })), l = `M ${c[0].x} ${c[0].y}`, u = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, g = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1511
- return `${l} ${u} ${g} ${p}`;
1512
- }, $t = (r) => (e) => {
1513
- const t = r.smallRadius, o = r.radius, s = m(
1465
+ })), u = `M ${c[0].x} ${c[0].y}`, l = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, g = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1466
+ return `${u} ${l} ${g} ${p}`;
1467
+ }, Bt = (r) => (e) => {
1468
+ const t = r.smallRadius, o = r.radius, s = x(
1514
1469
  {
1515
1470
  x: e.arrowLength,
1516
1471
  y: 0
@@ -1524,33 +1479,33 @@ const Ft = (r) => (e) => {
1524
1479
  y: 0
1525
1480
  }
1526
1481
  ), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1527
- (u) => m(u, e.direction, { x: 0, y: 0 })
1528
- ).map((u) => ({
1529
- x: u.x + e.shift.x,
1530
- y: u.y + e.shift.y
1531
- })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, l = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1532
- return `${h} ${d} ${c} ${l}`;
1482
+ (l) => x(l, e.direction, { x: 0, y: 0 })
1483
+ ).map((l) => ({
1484
+ x: l.x + e.shift.x,
1485
+ y: l.y + e.shift.y
1486
+ })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, u = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1487
+ return `${h} ${d} ${c} ${u}`;
1533
1488
  }, B = (r) => {
1534
1489
  if (typeof r == "function")
1535
1490
  return r;
1536
1491
  switch (r.type) {
1537
1492
  case "triangle":
1538
- return Ft({
1493
+ return Ut({
1539
1494
  radius: r.radius ?? v.polygonArrowRadius
1540
1495
  });
1541
1496
  case "arc":
1542
- return Ut({
1497
+ return $t({
1543
1498
  radius: r.radius ?? v.circleArrowRadius
1544
1499
  });
1545
1500
  default:
1546
- return $t({
1501
+ return Bt({
1547
1502
  smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
1548
1503
  angle: r.angle ?? v.wedgeArrowAngle,
1549
1504
  radius: r.radius ?? v.wedgeArrowRadius
1550
1505
  });
1551
1506
  }
1552
1507
  }, O = 50;
1553
- class Bt {
1508
+ class Ot {
1554
1509
  constructor(e) {
1555
1510
  i(this, "svg");
1556
1511
  i(this, "group");
@@ -1567,7 +1522,7 @@ class Bt {
1567
1522
  i(this, "hasSourceArrow");
1568
1523
  i(this, "hasTargetArrow");
1569
1524
  i(this, "pathShape");
1570
- i(this, "createCyclePath", (e, t, o) => new Mt({
1525
+ i(this, "createCyclePath", (e, t, o) => new Rt({
1571
1526
  origin: e,
1572
1527
  dir: o,
1573
1528
  radius: this.portCycleRadius,
@@ -1575,7 +1530,7 @@ class Bt {
1575
1530
  arrowLength: this.arrowLength,
1576
1531
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1577
1532
  }));
1578
- i(this, "createDetourPath", (e, t, o, s) => new At({
1533
+ i(this, "createDetourPath", (e, t, o, s) => new bt({
1579
1534
  from: e,
1580
1535
  to: t,
1581
1536
  fromDir: o,
@@ -1587,7 +1542,7 @@ class Bt {
1587
1542
  hasSourceArrow: this.hasSourceArrow,
1588
1543
  hasTargetArrow: this.hasTargetArrow
1589
1544
  }));
1590
- i(this, "createLinePath", (e, t, o, s) => new xt({
1545
+ i(this, "createLinePath", (e, t, o, s) => new St({
1591
1546
  from: e,
1592
1547
  to: t,
1593
1548
  fromDir: o,
@@ -1615,7 +1570,7 @@ class Bt {
1615
1570
  }
1616
1571
  }
1617
1572
  const Se = (r) => Math.cos(r) > 0 ? 0 : Math.PI;
1618
- class Ot {
1573
+ class Wt {
1619
1574
  constructor(e) {
1620
1575
  i(this, "svg");
1621
1576
  i(this, "group");
@@ -1640,7 +1595,7 @@ class Ot {
1640
1595
  roundness: this.roundness,
1641
1596
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1642
1597
  }));
1643
- i(this, "createDetourPath", (e, t, o, s) => new Lt({
1598
+ i(this, "createDetourPath", (e, t, o, s) => new Vt({
1644
1599
  from: e,
1645
1600
  to: t,
1646
1601
  fromDir: o,
@@ -1652,7 +1607,7 @@ class Ot {
1652
1607
  hasSourceArrow: this.hasSourceArrow,
1653
1608
  hasTargetArrow: this.hasTargetArrow
1654
1609
  }));
1655
- i(this, "createLinePath", (e, t, o, s) => new bt({
1610
+ i(this, "createLinePath", (e, t, o, s) => new Nt({
1656
1611
  from: e,
1657
1612
  to: t,
1658
1613
  fromDir: o,
@@ -1697,7 +1652,7 @@ class Ot {
1697
1652
  });
1698
1653
  }
1699
1654
  }
1700
- class Wt {
1655
+ class zt {
1701
1656
  constructor(e) {
1702
1657
  i(this, "svg");
1703
1658
  i(this, "group");
@@ -1723,7 +1678,7 @@ class Wt {
1723
1678
  roundness: this.roundness,
1724
1679
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1725
1680
  }));
1726
- i(this, "createDetourPath", (e, t, o, s) => new Pt({
1681
+ i(this, "createDetourPath", (e, t, o, s) => new Ct({
1727
1682
  from: e,
1728
1683
  to: t,
1729
1684
  fromDir: o,
@@ -1736,7 +1691,7 @@ class Wt {
1736
1691
  hasSourceArrow: this.hasSourceArrow,
1737
1692
  hasTargetArrow: this.hasTargetArrow
1738
1693
  }));
1739
- i(this, "createLinePath", (e, t, o, s) => new Nt({
1694
+ i(this, "createLinePath", (e, t, o, s) => new Tt({
1740
1695
  from: e,
1741
1696
  to: t,
1742
1697
  fromDir: o,
@@ -1771,7 +1726,7 @@ class Wt {
1771
1726
  }
1772
1727
  }
1773
1728
  const be = Math.PI / 2, Pe = (r) => Math.sin(r) > 0 ? be : -be;
1774
- class zt {
1729
+ class kt {
1775
1730
  constructor(e) {
1776
1731
  i(this, "svg");
1777
1732
  i(this, "group");
@@ -1796,7 +1751,7 @@ class zt {
1796
1751
  roundness: this.roundness,
1797
1752
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1798
1753
  }));
1799
- i(this, "createDetourPath", (e, t, o, s) => new It({
1754
+ i(this, "createDetourPath", (e, t, o, s) => new Ft({
1800
1755
  from: e,
1801
1756
  to: t,
1802
1757
  fromDir: o,
@@ -1808,7 +1763,7 @@ class zt {
1808
1763
  hasSourceArrow: this.hasSourceArrow,
1809
1764
  hasTargetArrow: this.hasTargetArrow
1810
1765
  }));
1811
- i(this, "createLinePath", (e, t, o, s) => new Tt({
1766
+ i(this, "createLinePath", (e, t, o, s) => new Dt({
1812
1767
  from: e,
1813
1768
  to: t,
1814
1769
  fromDir: o,
@@ -1853,7 +1808,11 @@ class zt {
1853
1808
  });
1854
1809
  }
1855
1810
  }
1856
- class He {
1811
+ const Ht = (r) => {
1812
+ const { direction: e, radius: t } = r, { x: o, y: s } = e, { horizontal: n, vertical: a } = t, h = s / o, d = Math.abs(a / h), c = Math.abs(n * h), u = Math.min(n, d), l = Math.min(a, c);
1813
+ return Math.sqrt(u * u + l * l);
1814
+ }, Ne = (r) => typeof r == "number" ? () => r : r === "box" ? Ht : r, Ce = v.portOffset;
1815
+ class Xe {
1857
1816
  constructor(e) {
1858
1817
  i(this, "svg");
1859
1818
  i(this, "group", document.createElementNS(
@@ -1866,88 +1825,116 @@ class He {
1866
1825
  i(this, "color");
1867
1826
  i(this, "width");
1868
1827
  i(this, "arrowLength");
1869
- i(this, "sourceOffset");
1870
- i(this, "targetOffset");
1828
+ i(this, "sourceOffsetFn");
1829
+ i(this, "targetOffsetFn");
1871
1830
  i(this, "onAfterRender");
1872
1831
  i(this, "afterRenderEmitter");
1873
1832
  i(this, "arrowRenderer");
1874
- [this.afterRenderEmitter, this.onAfterRender] = C(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = We(this.color), this.svg.appendChild(this.group), this.line = ze(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1833
+ [this.afterRenderEmitter, this.onAfterRender] = C(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffsetFn = Ne(
1834
+ (e == null ? void 0 : e.sourceOffset) ?? Ce
1835
+ ), this.targetOffsetFn = Ne(
1836
+ (e == null ? void 0 : e.targetOffset) ?? Ce
1837
+ ), this.svg = ke(this.color), this.svg.appendChild(this.group), this.line = He(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
1875
1838
  }
1876
1839
  render(e) {
1877
- const { x: t, y: o, width: s, height: n, from: a, to: h } = Oe(
1840
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = ze(
1878
1841
  e.from,
1879
1842
  e.to,
1880
1843
  O
1881
1844
  );
1882
- ke(this.svg, { x: t, y: o, width: s, height: n });
1883
- const d = new Dt({
1884
- from: a,
1885
- to: h,
1886
- sourceOffset: this.sourceOffset,
1887
- targetOffset: this.targetOffset,
1888
- hasSourceArrow: this.sourceArrow !== null,
1889
- hasTargetArrow: this.targetArrow !== null,
1890
- arrowLength: this.arrowLength
1891
- });
1892
- this.line.setAttribute("d", d.path);
1893
- let c = null, l = null;
1894
- const u = d.diagonalDistance;
1895
- if (u === 0)
1896
- this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
1897
- else {
1898
- const g = {
1899
- x: (h.x - a.x) / u,
1900
- y: (h.y - a.y) / u
1901
- };
1902
- if (this.sourceArrow) {
1903
- const p = {
1904
- x: g.x * this.sourceOffset + a.x,
1905
- y: g.y * this.sourceOffset + a.y
1906
- };
1907
- c = this.arrowRenderer({
1908
- direction: g,
1909
- shift: p,
1910
- arrowLength: this.arrowLength
1911
- }), this.sourceArrow.setAttribute("d", c);
1845
+ Ye(this.svg, { x: t, y: o, width: s, height: n });
1846
+ const d = h.x - a.x, c = h.y - a.y, u = Math.sqrt(d * d + c * c);
1847
+ if (u === 0) {
1848
+ this.renderEmpty(a);
1849
+ return;
1850
+ }
1851
+ const l = { x: d / u, y: c / u }, g = this.sourceOffsetFn({
1852
+ direction: { x: l.x, y: l.y },
1853
+ radius: {
1854
+ horizontal: e.from.width / 2,
1855
+ vertical: e.from.height / 2
1912
1856
  }
1913
- if (this.targetArrow) {
1914
- const p = {
1915
- x: g.x * this.targetOffset,
1916
- y: g.y * this.targetOffset
1917
- };
1918
- l = this.arrowRenderer({
1919
- direction: { x: -g.x, y: -g.y },
1920
- shift: {
1921
- x: h.x - p.x,
1922
- y: h.y - p.y
1923
- },
1924
- arrowLength: this.arrowLength
1925
- }), this.targetArrow.setAttribute("d", l);
1857
+ }), p = this.targetOffsetFn({
1858
+ direction: { x: -l.x, y: -l.y },
1859
+ radius: {
1860
+ horizontal: e.to.width / 2,
1861
+ vertical: e.to.height / 2
1926
1862
  }
1863
+ }), w = {
1864
+ x: a.x + g * l.x,
1865
+ y: a.y + g * l.y
1866
+ }, y = {
1867
+ x: h.x - p * l.x,
1868
+ y: h.y - p * l.y
1869
+ }, f = this.sourceArrow !== null ? this.arrowLength : 0, m = {
1870
+ x: w.x + f * l.x,
1871
+ y: w.y + f * l.y
1872
+ }, E = this.targetArrow !== null ? this.arrowLength : 0, A = {
1873
+ x: y.x - E * l.x,
1874
+ y: y.y - E * l.y
1875
+ }, T = {
1876
+ x: (w.x + y.x) / 2,
1877
+ y: (w.y + y.y) / 2
1878
+ }, M = `M ${m.x} ${m.y} L ${A.x} ${A.y}`;
1879
+ this.line.setAttribute("d", M);
1880
+ let L = null, V = null;
1881
+ if (this.sourceArrow) {
1882
+ const D = {
1883
+ x: l.x * g + a.x,
1884
+ y: l.y * g + a.y
1885
+ };
1886
+ L = this.arrowRenderer({
1887
+ direction: l,
1888
+ shift: D,
1889
+ arrowLength: this.arrowLength
1890
+ }), this.sourceArrow.setAttribute("d", L);
1891
+ }
1892
+ if (this.targetArrow) {
1893
+ const D = {
1894
+ x: l.x * p,
1895
+ y: l.y * p
1896
+ };
1897
+ V = this.arrowRenderer({
1898
+ direction: { x: -l.x, y: -l.y },
1899
+ shift: {
1900
+ x: h.x - D.x,
1901
+ y: h.y - D.y
1902
+ },
1903
+ arrowLength: this.arrowLength
1904
+ }), this.targetArrow.setAttribute("d", V);
1927
1905
  }
1928
1906
  this.afterRenderEmitter.emit({
1929
- edgePath: d,
1930
- sourceArrowPath: c,
1931
- targetArrowPath: l
1907
+ edgePath: { path: M, midpoint: T },
1908
+ sourceArrowPath: L,
1909
+ targetArrowPath: V
1910
+ });
1911
+ }
1912
+ renderEmpty(e) {
1913
+ const t = "";
1914
+ let o = null, s = null;
1915
+ this.line.setAttribute("d", t), this.sourceArrow !== null && (o = "", this.sourceArrow.setAttribute("d", o)), this.targetArrow !== null && (s = "", this.targetArrow.setAttribute("d", s)), this.afterRenderEmitter.emit({
1916
+ edgePath: { path: t, midpoint: e },
1917
+ sourceArrowPath: o,
1918
+ targetArrowPath: s
1932
1919
  });
1933
1920
  }
1934
1921
  }
1935
- const kt = () => {
1922
+ const Yt = () => {
1936
1923
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1937
1924
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1938
- }, Ht = (r) => {
1925
+ }, Xt = (r) => {
1939
1926
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1940
1927
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1941
- }, Ne = (r) => {
1928
+ }, Te = (r) => {
1942
1929
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1943
1930
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1944
1931
  };
1945
- class Yt extends Error {
1932
+ class Gt extends Error {
1946
1933
  constructor(e) {
1947
1934
  super(e), this.name = "InteractiveEdgeError";
1948
1935
  }
1949
1936
  }
1950
- class Ye {
1937
+ class Ge {
1951
1938
  constructor(e, t) {
1952
1939
  i(this, "svg");
1953
1940
  i(this, "group");
@@ -1959,18 +1946,18 @@ class Ye {
1959
1946
  * @deprecated
1960
1947
  * use shape.svg instead
1961
1948
  */
1962
- i(this, "handle", kt());
1949
+ i(this, "handle", Yt());
1963
1950
  i(this, "onAfterRender");
1964
1951
  i(this, "interactiveLine");
1965
1952
  i(this, "interactiveSourceArrow", null);
1966
1953
  i(this, "interactiveTargetArrow", null);
1967
- if (this.baseEdge = e, e instanceof Ye)
1968
- throw new Yt(
1954
+ if (this.baseEdge = e, e instanceof Ge)
1955
+ throw new Gt(
1969
1956
  "interactive edge can be configured only once"
1970
1957
  );
1971
1958
  this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
1972
1959
  const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
1973
- this.interactiveLine = Ht(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ne(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ne(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1960
+ this.interactiveLine = Xt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Te(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Te(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
1974
1961
  this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
1975
1962
  });
1976
1963
  }
@@ -1978,7 +1965,7 @@ class Ye {
1978
1965
  this.baseEdge.render(e);
1979
1966
  }
1980
1967
  }
1981
- class Zr {
1968
+ class qr {
1982
1969
  constructor(e, t) {
1983
1970
  i(this, "group");
1984
1971
  i(this, "line");
@@ -1995,7 +1982,7 @@ class Zr {
1995
1982
  this.baseShape.render(e);
1996
1983
  }
1997
1984
  }
1998
- class Xe {
1985
+ class je {
1999
1986
  constructor(e) {
2000
1987
  i(this, "onAfterNodeAdded");
2001
1988
  i(this, "onAfterNodeUpdated");
@@ -2110,7 +2097,7 @@ class K {
2110
2097
  this.counter = 0;
2111
2098
  }
2112
2099
  }
2113
- class Ge {
2100
+ class Je {
2114
2101
  constructor(e, t, o) {
2115
2102
  i(this, "nodeIdGenerator", new K(
2116
2103
  (e) => this.graphStore.hasNode(e)
@@ -2241,18 +2228,18 @@ class Ge {
2241
2228
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
2242
2229
  }
2243
2230
  }
2244
- const Xt = (r) => {
2231
+ const jt = (r) => {
2245
2232
  setTimeout(() => {
2246
2233
  r();
2247
2234
  });
2248
- }, Ce = (r) => {
2235
+ }, Me = (r) => {
2249
2236
  queueMicrotask(() => {
2250
2237
  r();
2251
2238
  });
2252
2239
  }, oe = (r) => {
2253
2240
  r();
2254
2241
  };
2255
- class je {
2242
+ class Ke {
2256
2243
  constructor(e) {
2257
2244
  i(this, "onBeforeUpdated");
2258
2245
  i(this, "onAfterUpdated");
@@ -2275,7 +2262,7 @@ class je {
2275
2262
  return this.viewportStore.createViewportCoords(e);
2276
2263
  }
2277
2264
  }
2278
- const Gt = (r, e) => Symbol.iterator in r ? {
2265
+ const Jt = (r, e) => Symbol.iterator in r ? {
2279
2266
  minContentScale: e.focus.minContentScale,
2280
2267
  nodes: r,
2281
2268
  contentPadding: e.focus.contentPadding,
@@ -2285,16 +2272,16 @@ const Gt = (r, e) => Symbol.iterator in r ? {
2285
2272
  nodes: r.nodes ?? [],
2286
2273
  contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
2287
2274
  animationDuration: r.animationDuration ?? e.focus.animationDuration
2288
- }, Je = (r, e, t) => ({
2275
+ }, Qe = (r, e, t) => ({
2289
2276
  scale: r.scale,
2290
2277
  x: r.x + r.scale * e,
2291
2278
  y: r.y + r.scale * t
2292
- }), Ke = (r, e, t, o) => ({
2279
+ }), Ze = (r, e, t, o) => ({
2293
2280
  scale: r.scale * e,
2294
2281
  x: r.scale * (1 - e) * t + r.x,
2295
2282
  y: r.scale * (1 - e) * o + r.y
2296
2283
  });
2297
- class Qe {
2284
+ class _e {
2298
2285
  constructor(e, t, o, s) {
2299
2286
  this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
2300
2287
  }
@@ -2306,22 +2293,22 @@ class Qe {
2306
2293
  }
2307
2294
  center(e, t) {
2308
2295
  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;
2309
- let l = Je(a, d, c);
2310
- const u = t == null ? void 0 : t.contentScale;
2311
- if (u !== void 0) {
2312
- const p = 1 / u;
2313
- l = Ke(
2314
- l,
2296
+ let u = Qe(a, d, c);
2297
+ const l = t == null ? void 0 : t.contentScale;
2298
+ if (l !== void 0) {
2299
+ const p = 1 / l;
2300
+ u = Ze(
2301
+ u,
2315
2302
  p / a.scale,
2316
2303
  n.x,
2317
2304
  n.y
2318
2305
  );
2319
2306
  }
2320
2307
  const g = (t == null ? void 0 : t.animationDuration) ?? 0;
2321
- g > 0 ? this.animateNavigation(a, l, g) : this.viewportStore.patchViewportMatrix(l);
2308
+ g > 0 ? this.animateNavigation(a, u, g) : this.viewportStore.patchViewportMatrix(u);
2322
2309
  }
2323
2310
  focus(e) {
2324
- const t = Gt(e ?? {}, this.params);
2311
+ const t = Jt(e ?? {}, this.params);
2325
2312
  this.params.focus.schedule(() => {
2326
2313
  this.navigate(t);
2327
2314
  });
@@ -2342,12 +2329,12 @@ class Qe {
2342
2329
  const d = {
2343
2330
  x: (t + o) / 2,
2344
2331
  y: (s + n) / 2
2345
- }, { scale: c } = this.viewportStore.getContentMatrix(), l = (n - s) * c, u = (o - t) * c, { width: g, height: p } = this.viewportStore.getDimensions(), w = Math.max(
2346
- u / g,
2347
- l / p
2348
- ), f = w > 1 ? c / w : c, y = Math.max(f, e.minContentScale);
2332
+ }, { scale: c } = this.viewportStore.getContentMatrix(), u = (n - s) * c, l = (o - t) * c, { width: g, height: p } = this.viewportStore.getDimensions(), w = Math.max(
2333
+ l / g,
2334
+ u / p
2335
+ ), y = w > 1 ? c / w : c, f = Math.max(y, e.minContentScale);
2349
2336
  this.center(d, {
2350
- contentScale: y,
2337
+ contentScale: f,
2351
2338
  animationDuration: e.animationDuration
2352
2339
  });
2353
2340
  }
@@ -2370,20 +2357,20 @@ class Qe {
2370
2357
  this.win.requestAnimationFrame(a);
2371
2358
  }
2372
2359
  }
2373
- const Ze = (r, e, t) => {
2374
- const o = new Fe(), s = new Xe(o), n = new je(e), a = new Ve(o, e, r), h = {
2360
+ const qe = (r, e, t) => {
2361
+ const o = new $e(), s = new je(o), n = new Ke(e), a = new Fe(o, e, r), h = {
2375
2362
  nodes: {
2376
- centerFn: Be,
2363
+ centerFn: We,
2377
2364
  priorityFn: () => 0
2378
2365
  },
2379
2366
  edges: {
2380
- shapeFactory: () => new He(),
2367
+ shapeFactory: () => new Xe(),
2381
2368
  priorityFn: () => 0
2382
2369
  },
2383
2370
  ports: {
2384
2371
  direction: 0
2385
2372
  }
2386
- }, d = new Ge(
2373
+ }, d = new Je(
2387
2374
  o,
2388
2375
  a,
2389
2376
  h
@@ -2394,13 +2381,13 @@ const Ze = (r, e, t) => {
2394
2381
  schedule: oe,
2395
2382
  animationDuration: 0
2396
2383
  }
2397
- }, l = new Qe(
2384
+ }, u = new _e(
2398
2385
  o,
2399
2386
  e,
2400
2387
  c,
2401
2388
  t
2402
2389
  );
2403
- return new Ie(s, n, d, l);
2390
+ return new Ue(s, n, d, u);
2404
2391
  };
2405
2392
  class j {
2406
2393
  constructor(e, t, o, s) {
@@ -2502,7 +2489,7 @@ class j {
2502
2489
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2503
2490
  }
2504
2491
  }
2505
- class jt {
2492
+ class Kt {
2506
2493
  constructor() {
2507
2494
  i(this, "field", "_htmlGraphTags");
2508
2495
  }
@@ -2610,7 +2597,7 @@ const ne = (r, e) => ({
2610
2597
  from: r.isDirect ? r.staticPortId : e,
2611
2598
  to: r.isDirect ? e : r.staticPortId
2612
2599
  });
2613
- class Te {
2600
+ class De {
2614
2601
  constructor(e, t) {
2615
2602
  this.graph = e, this.connectionAllowedVerifier = t;
2616
2603
  }
@@ -2618,18 +2605,18 @@ class Te {
2618
2605
  let t, o = 1 / 0;
2619
2606
  const { cursor: s } = e;
2620
2607
  return this.graph.getAllPortIds().forEach((n) => {
2621
- const { element: a, direction: h, nodeId: d } = this.graph.getPort(n), { x: c, y: l } = this.graph.getNode(d);
2622
- if (c === null || l === null)
2608
+ const { element: a, direction: h, nodeId: d } = this.graph.getPort(n), { x: c, y: u } = this.graph.getNode(d);
2609
+ if (c === null || u === null)
2623
2610
  return;
2624
- const u = ne(e, n);
2625
- if (!this.connectionAllowedVerifier(u))
2611
+ const l = ne(e, n);
2612
+ if (!this.connectionAllowedVerifier(l))
2626
2613
  return;
2627
- const { top: g, left: p, width: w, height: f } = a.getBoundingClientRect(), y = { x: p + w / 2, y: g + f / 2 }, E = s.x - y.x, x = s.y - y.y, N = Math.sqrt(E * E + x * x);
2628
- N < o && (o = N, t = h);
2614
+ const { top: g, left: p, width: w, height: y } = a.getBoundingClientRect(), f = { x: p + w / 2, y: g + y / 2 }, m = s.x - f.x, E = s.y - f.y, A = Math.sqrt(m * m + E * E);
2615
+ A < o && (o = A, t = h);
2629
2616
  }), t;
2630
2617
  }
2631
2618
  }
2632
- class Jt {
2619
+ class Qt {
2633
2620
  constructor(e) {
2634
2621
  this.direction = e;
2635
2622
  }
@@ -2947,7 +2934,7 @@ class J {
2947
2934
  );
2948
2935
  }
2949
2936
  moveViewport(e, t) {
2950
- const o = this.viewport.getViewportMatrix(), s = Je(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2937
+ const o = this.viewport.getViewportMatrix(), s = Qe(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2951
2938
  prevTransform: o,
2952
2939
  nextTransform: s,
2953
2940
  canvasWidth: n,
@@ -2956,7 +2943,7 @@ class J {
2956
2943
  this.performTransform(h);
2957
2944
  }
2958
2945
  scaleViewport(e, t, o) {
2959
- const s = this.canvas.viewport.getViewportMatrix(), n = Ke(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2946
+ const s = this.canvas.viewport.getViewportMatrix(), n = Ze(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2960
2947
  prevTransform: s,
2961
2948
  nextTransform: n,
2962
2949
  canvasWidth: a,
@@ -3068,27 +3055,27 @@ class he {
3068
3055
  }
3069
3056
  scheduleEnsureViewportAreaLoaded() {
3070
3057
  setTimeout(() => {
3071
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, l = s + a + this.nodeHorizontal, u = n + h + this.nodeVertical;
3072
- this.loadedArea.xFrom < d && this.loadedArea.xTo > l && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
3058
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, u = s + a + this.nodeHorizontal, l = n + h + this.nodeVertical;
3059
+ this.loadedArea.xFrom < d && this.loadedArea.xTo > u && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
3073
3060
  });
3074
3061
  }
3075
3062
  loadAreaAroundViewport() {
3076
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, l = 3 * a + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
3063
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, u = 3 * a + 2 * this.nodeHorizontal, l = 3 * h + 2 * this.nodeVertical;
3077
3064
  this.trigger.emit({
3078
3065
  x: d,
3079
3066
  y: c,
3080
- width: l,
3081
- height: u
3067
+ width: u,
3068
+ height: l
3082
3069
  });
3083
3070
  }
3084
3071
  }
3085
- const Kt = () => {
3072
+ const Zt = () => {
3086
3073
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3087
3074
  return r.style.position = "absolute", r.style.inset = "0", r;
3088
- }, Qt = () => {
3075
+ }, _t = () => {
3089
3076
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
3090
3077
  return r.setAttribute("fill", "url(#pattern)"), r;
3091
- }, Zt = () => {
3078
+ }, qt = () => {
3092
3079
  const r = document.createElementNS(
3093
3080
  "http://www.w3.org/2000/svg",
3094
3081
  "pattern"
@@ -3097,9 +3084,9 @@ const Kt = () => {
3097
3084
  };
3098
3085
  class de {
3099
3086
  constructor(e, t, o) {
3100
- i(this, "svg", Kt());
3101
- i(this, "patternRenderingRectangle", Qt());
3102
- i(this, "pattern", Zt());
3087
+ i(this, "svg", Zt());
3088
+ i(this, "patternRenderingRectangle", _t());
3089
+ i(this, "pattern", qt());
3103
3090
  i(this, "patternContent");
3104
3091
  i(this, "tileWidth");
3105
3092
  i(this, "tileHeight");
@@ -3141,7 +3128,7 @@ class ce {
3141
3128
  i(this, "onEdgeCreated", (e) => {
3142
3129
  this.params.onAfterEdgeCreated(e);
3143
3130
  });
3144
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ze(
3131
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = qe(
3145
3132
  this.overlayLayer,
3146
3133
  this.viewportStore,
3147
3134
  this.window
@@ -3150,8 +3137,8 @@ class ce {
3150
3137
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3151
3138
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
3152
3139
  onPointerDownVerifier: (d, c) => {
3153
- const l = this.params.connectionTypeResolver(d);
3154
- return l === null ? !1 : (this.grabPort(d, c, l), !0);
3140
+ const u = this.params.connectionTypeResolver(d);
3141
+ return u === null ? !1 : (this.grabPort(d, c, u), !0);
3155
3142
  },
3156
3143
  onPointerMove: (d) => {
3157
3144
  this.moveDraggingPort(d);
@@ -3185,11 +3172,11 @@ class ce {
3185
3172
  const s = this.canvas.graph.getPort(e), n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3186
3173
  x: a - d.x,
3187
3174
  y: h - d.y
3188
- }), l = this.canvas.viewport.createContentCoords({
3175
+ }), u = this.canvas.viewport.createContentCoords({
3189
3176
  x: t.x - d.x,
3190
3177
  y: t.y - d.y
3191
- }), u = {
3192
- overlayNodeId: M.StaticNodeId,
3178
+ }), l = {
3179
+ overlayNodeId: R.StaticNodeId,
3193
3180
  portCoords: c,
3194
3181
  portDirection: s.direction
3195
3182
  }, g = o === "direct";
@@ -3203,21 +3190,21 @@ class ce {
3203
3190
  ...this.edgeInProgress
3204
3191
  }
3205
3192
  ), w = {
3206
- overlayNodeId: M.DraggingNodeId,
3207
- portCoords: l,
3193
+ overlayNodeId: R.DraggingNodeId,
3194
+ portCoords: u,
3208
3195
  portDirection: p ?? s.direction
3209
- }, [f, y] = g ? [u, w] : [w, u];
3210
- this.overlayCanvas.addNode(Y(f)), this.overlayCanvas.addNode(Y(y)), this.overlayCanvas.addEdge({
3211
- from: f.overlayNodeId,
3212
- to: y.overlayNodeId,
3213
- shape: this.params.edgeShapeFactory(M.EdgeId)
3196
+ }, [y, f] = g ? [l, w] : [w, l];
3197
+ this.overlayCanvas.addNode(Y(y)), this.overlayCanvas.addNode(Y(f)), this.overlayCanvas.addEdge({
3198
+ from: y.overlayNodeId,
3199
+ to: f.overlayNodeId,
3200
+ shape: this.params.edgeShapeFactory(R.EdgeId)
3214
3201
  });
3215
3202
  }
3216
3203
  resetDragState() {
3217
3204
  this.edgeInProgress = null, this.overlayCanvas.clear();
3218
3205
  }
3219
3206
  tryCreateConnection(e) {
3220
- const t = $e(this.canvas.graph, e);
3207
+ const t = Oe(this.canvas.graph, e);
3221
3208
  if (t === null) {
3222
3209
  this.params.onEdgeCreationInterrupted(this.edgeInProgress);
3223
3210
  return;
@@ -3239,10 +3226,10 @@ class ce {
3239
3226
  cursor: e,
3240
3227
  ...this.edgeInProgress
3241
3228
  });
3242
- this.overlayCanvas.updateNode(M.DraggingNodeId, {
3229
+ this.overlayCanvas.updateNode(R.DraggingNodeId, {
3243
3230
  x: o.x,
3244
3231
  y: o.y
3245
- }).updatePort(M.DraggingNodeId, { direction: s });
3232
+ }).updatePort(R.DraggingNodeId, { direction: s });
3246
3233
  }
3247
3234
  }
3248
3235
  class le {
@@ -3253,7 +3240,7 @@ class le {
3253
3240
  i(this, "onEdgeReattached", (e) => {
3254
3241
  this.params.onAfterEdgeReattached(e);
3255
3242
  });
3256
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ze(
3243
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = qe(
3257
3244
  this.overlayLayer,
3258
3245
  this.viewportStore,
3259
3246
  this.window
@@ -3302,12 +3289,12 @@ class le {
3302
3289
  return !1;
3303
3290
  const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
3304
3291
  this.edgeInProgress = { staticPortId: h, isDirect: a };
3305
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), u = {
3306
- x: l.x + l.width / 2,
3307
- y: l.y + l.height / 2
3292
+ const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), l = {
3293
+ x: u.x + u.width / 2,
3294
+ y: u.y + u.height / 2
3308
3295
  }, g = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
3309
- x: u.x - g.x,
3310
- y: u.y - g.y
3296
+ x: l.x - g.x,
3297
+ y: l.y - g.y
3311
3298
  }), w = this.canvas.viewport.createContentCoords({
3312
3299
  x: t.x - g.x,
3313
3300
  y: t.y - g.y
@@ -3319,26 +3306,26 @@ class le {
3319
3306
  shape: s.shape,
3320
3307
  priority: s.priority
3321
3308
  }, this.canvas.removeEdge(o);
3322
- const f = {
3323
- overlayNodeId: M.StaticNodeId,
3309
+ const y = {
3310
+ overlayNodeId: R.StaticNodeId,
3324
3311
  portCoords: p,
3325
3312
  portDirection: c.direction
3326
- }, y = this.params.draggingPortDirectionResolver.resolve(
3313
+ }, f = this.params.draggingPortDirectionResolver.resolve(
3327
3314
  {
3328
3315
  cursor: t,
3329
3316
  ...this.edgeInProgress
3330
3317
  }
3331
- ), E = {
3332
- overlayNodeId: M.DraggingNodeId,
3318
+ ), m = {
3319
+ overlayNodeId: R.DraggingNodeId,
3333
3320
  portCoords: w,
3334
- portDirection: y ?? d.direction
3335
- }, [x, N] = a ? [f, E] : [E, f];
3336
- this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(N));
3337
- const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
3321
+ portDirection: f ?? d.direction
3322
+ }, [E, A] = a ? [y, m] : [m, y];
3323
+ this.overlayCanvas.addNode(Y(E)), this.overlayCanvas.addNode(Y(A));
3324
+ const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(R.EdgeId) : s.shape;
3338
3325
  return this.overlayCanvas.addEdge({
3339
- id: M.EdgeId,
3340
- from: x.overlayNodeId,
3341
- to: N.overlayNodeId,
3326
+ id: R.EdgeId,
3327
+ from: E.overlayNodeId,
3328
+ to: A.overlayNodeId,
3342
3329
  shape: T
3343
3330
  }), !0;
3344
3331
  }
@@ -3353,14 +3340,14 @@ class le {
3353
3340
  cursor: e,
3354
3341
  ...this.edgeInProgress
3355
3342
  });
3356
- this.overlayCanvas.updateNode(M.DraggingNodeId, {
3343
+ this.overlayCanvas.updateNode(R.DraggingNodeId, {
3357
3344
  x: s.x,
3358
3345
  y: s.y
3359
- }).updatePort(M.DraggingNodeId, { direction: n });
3346
+ }).updatePort(R.DraggingNodeId, { direction: n });
3360
3347
  }
3361
3348
  tryCreateConnection(e) {
3362
- const t = $e(this.canvas.graph, e);
3363
- if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
3349
+ const t = Oe(this.canvas.graph, e);
3350
+ if (this.overlayCanvas.removeEdge(R.EdgeId), t === null) {
3364
3351
  const c = this.draggingEdgePayload;
3365
3352
  this.params.onEdgeReattachInterrupted({
3366
3353
  id: c.id,
@@ -3435,7 +3422,7 @@ class ge {
3435
3422
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
3436
3423
  }
3437
3424
  }
3438
- class _t {
3425
+ class er {
3439
3426
  constructor(e, t, o) {
3440
3427
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
3441
3428
  }
@@ -3449,9 +3436,9 @@ class _t {
3449
3436
  }), this.params.onAfterApplied();
3450
3437
  }
3451
3438
  }
3452
- class qt {
3439
+ class tr {
3453
3440
  static configure(e, t) {
3454
- const o = t.applyOn, s = new _t(e, t.algorithm, {
3441
+ const o = t.applyOn, s = new er(e, t.algorithm, {
3455
3442
  staticNodeResolver: t.staticNodeResolver,
3456
3443
  onBeforeApplied: t.onBeforeApplied,
3457
3444
  onAfterApplied: t.onAfterApplied
@@ -3475,7 +3462,7 @@ class qt {
3475
3462
  }
3476
3463
  }
3477
3464
  }
3478
- class er {
3465
+ class rr {
3479
3466
  constructor(e, t) {
3480
3467
  i(this, "previousTimeStamp");
3481
3468
  i(this, "step", (e) => {
@@ -3490,7 +3477,7 @@ class er {
3490
3477
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3491
3478
  }
3492
3479
  }
3493
- class tr {
3480
+ class or {
3494
3481
  constructor(e, t, o) {
3495
3482
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
3496
3483
  }
@@ -3511,11 +3498,11 @@ class pe {
3511
3498
  i(this, "step", (e) => {
3512
3499
  this.applier.apply(e);
3513
3500
  });
3514
- this.win = o, this.applier = new tr(e, t.algorithm, {
3501
+ this.win = o, this.applier = new or(e, t.algorithm, {
3515
3502
  staticNodeResolver: t.staticNodeResolver,
3516
3503
  onBeforeApplied: t.onBeforeApplied,
3517
3504
  onAfterApplied: t.onAfterApplied
3518
- }), new er(this.win, this.step);
3505
+ }), new rr(this.win, this.step);
3519
3506
  }
3520
3507
  static configure(e, t, o) {
3521
3508
  new pe(e, t, o);
@@ -3564,7 +3551,7 @@ class we {
3564
3551
  );
3565
3552
  }
3566
3553
  }
3567
- class fe {
3554
+ class ye {
3568
3555
  constructor(e, t, o, s, n) {
3569
3556
  i(this, "configurator");
3570
3557
  i(this, "selectionHandledTag", se);
@@ -3598,7 +3585,7 @@ class fe {
3598
3585
  ), this.canvas.graph.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.canvas.graph.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
3599
3586
  }
3600
3587
  static configure(e, t, o, s, n) {
3601
- new fe(
3588
+ new ye(
3602
3589
  e,
3603
3590
  t,
3604
3591
  o,
@@ -3607,7 +3594,7 @@ class fe {
3607
3594
  );
3608
3595
  }
3609
3596
  }
3610
- class ye {
3597
+ class fe {
3611
3598
  constructor(e, t, o, s, n, a) {
3612
3599
  i(this, "configurator");
3613
3600
  i(this, "onCanvasSelected");
@@ -3628,7 +3615,7 @@ class ye {
3628
3615
  });
3629
3616
  }
3630
3617
  static configure(e, t, o, s, n, a) {
3631
- new ye(
3618
+ new fe(
3632
3619
  e,
3633
3620
  t,
3634
3621
  o,
@@ -3638,30 +3625,30 @@ class ye {
3638
3625
  );
3639
3626
  }
3640
3627
  }
3641
- const rr = () => {
3628
+ const sr = () => {
3642
3629
  const r = document.createElement("div");
3643
3630
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3644
3631
  }, Q = () => {
3645
3632
  const r = document.createElement("div");
3646
3633
  return r.style.position = "absolute", r.style.inset = "0", r;
3647
- }, Me = () => {
3634
+ }, Re = () => {
3648
3635
  const r = Q();
3649
3636
  return r.style.pointerEvents = "none", r;
3650
3637
  };
3651
- class or {
3638
+ class ir {
3652
3639
  constructor(e) {
3653
3640
  i(this, "background", Q());
3654
3641
  i(this, "main", Q());
3655
- i(this, "overlayConnectablePorts", Me());
3656
- i(this, "overlayDraggableEdges", Me());
3657
- i(this, "host", rr());
3642
+ i(this, "overlayConnectablePorts", Re());
3643
+ i(this, "overlayDraggableEdges", Re());
3644
+ i(this, "host", sr());
3658
3645
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3659
3646
  }
3660
3647
  destroy() {
3661
3648
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
3662
3649
  }
3663
3650
  }
3664
- const b = Object.freeze({
3651
+ const P = Object.freeze({
3665
3652
  seed: "HTMLGraph is awesome",
3666
3653
  maxTimeDeltaSec: 0.01,
3667
3654
  nodeCharge: 1e5,
@@ -3675,23 +3662,23 @@ const b = Object.freeze({
3675
3662
  nodeForceCoefficient: 1,
3676
3663
  barnesHutAreaRadiusThreshold: 0.01,
3677
3664
  barnesHutTheta: 1
3678
- }), L = Object.freeze({
3665
+ }), I = Object.freeze({
3679
3666
  mouseDownEventVerifier: (r) => r.button === 0,
3680
3667
  mouseUpEventVerifier: (r) => r.button === 0,
3681
3668
  movementThreshold: 10
3682
- }), P = () => {
3683
- }, _e = (r, e, t) => r === "closest-connectable-port" ? new Te(
3669
+ }), N = () => {
3670
+ }, et = (r, e, t) => r === "closest-connectable-port" ? new De(
3684
3671
  e,
3685
3672
  t
3686
- ) : r === "nearest-connectable-port" ? new Te(
3673
+ ) : r === "nearest-connectable-port" ? new De(
3687
3674
  e,
3688
3675
  t
3689
- ) : new Jt(r), ve = (r) => {
3676
+ ) : new Qt(r), ve = (r) => {
3690
3677
  if (typeof r == "function")
3691
3678
  return r;
3692
3679
  switch (r.type) {
3693
3680
  case "straight":
3694
- return () => new Wt({
3681
+ return () => new zt({
3695
3682
  color: r.color,
3696
3683
  width: r.width,
3697
3684
  arrowLength: r.arrowLength,
@@ -3705,7 +3692,7 @@ const b = Object.freeze({
3705
3692
  detourDirection: r.detourDirection
3706
3693
  });
3707
3694
  case "horizontal":
3708
- return () => new Ot({
3695
+ return () => new Wt({
3709
3696
  color: r.color,
3710
3697
  width: r.width,
3711
3698
  arrowLength: r.arrowLength,
@@ -3718,7 +3705,7 @@ const b = Object.freeze({
3718
3705
  detourDistance: r.detourDistance
3719
3706
  });
3720
3707
  case "vertical":
3721
- return () => new zt({
3708
+ return () => new kt({
3722
3709
  color: r.color,
3723
3710
  width: r.width,
3724
3711
  arrowLength: r.arrowLength,
@@ -3731,7 +3718,7 @@ const b = Object.freeze({
3731
3718
  detourDistance: r.detourDistance
3732
3719
  });
3733
3720
  case "direct":
3734
- return () => new He({
3721
+ return () => new Xe({
3735
3722
  color: r.color,
3736
3723
  width: r.width,
3737
3724
  arrowLength: r.arrowLength,
@@ -3742,7 +3729,7 @@ const b = Object.freeze({
3742
3729
  targetOffset: r.targetOffset
3743
3730
  });
3744
3731
  default:
3745
- return () => new Bt({
3732
+ return () => new Ot({
3746
3733
  color: r.color,
3747
3734
  width: r.width,
3748
3735
  arrowLength: r.arrowLength,
@@ -3756,9 +3743,9 @@ const b = Object.freeze({
3756
3743
  detourDirection: r.detourDirection
3757
3744
  });
3758
3745
  }
3759
- }, sr = (r) => {
3760
- var l, u, g, p, w, f;
3761
- const e = r.nodeDragVerifier ?? (() => !0), t = r.moveOnTop !== !1, o = r.moveEdgesOnTop !== !1 && t, s = (l = r.mouse) == null ? void 0 : l.dragCursor, n = s !== void 0 ? s : "grab", a = (u = r.mouse) == null ? void 0 : u.mouseDownEventVerifier, h = a !== void 0 ? a : (y) => y.button === 0, d = (g = r.mouse) == null ? void 0 : g.mouseUpEventVerifier, c = d !== void 0 ? d : (y) => y.button === 0;
3746
+ }, nr = (r) => {
3747
+ var u, l, g, p, w, y;
3748
+ const e = r.nodeDragVerifier ?? (() => !0), t = r.moveOnTop !== !1, o = r.moveEdgesOnTop !== !1 && t, s = (u = r.mouse) == null ? void 0 : u.dragCursor, n = s !== void 0 ? s : "grab", a = (l = r.mouse) == null ? void 0 : l.mouseDownEventVerifier, h = a !== void 0 ? a : (f) => f.button === 0, d = (g = r.mouse) == null ? void 0 : g.mouseUpEventVerifier, c = d !== void 0 ? d : (f) => f.button === 0;
3762
3749
  return {
3763
3750
  moveOnTop: t,
3764
3751
  moveEdgesOnTop: o,
@@ -3766,43 +3753,43 @@ const b = Object.freeze({
3766
3753
  gridSize: r.gridSize ?? null,
3767
3754
  mouseDownEventVerifier: h,
3768
3755
  mouseUpEventVerifier: c,
3769
- onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? P,
3770
- onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? P,
3756
+ onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? N,
3757
+ onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? N,
3771
3758
  nodeDragVerifier: e,
3772
- onNodeDragFinished: ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? P
3759
+ onNodeDragFinished: ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? N
3773
3760
  };
3774
- }, ir = (r) => {
3761
+ }, ar = (r) => {
3775
3762
  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;
3776
3763
  return (n) => {
3777
3764
  let a = n.nextTransform.x, h = n.nextTransform.y;
3778
3765
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3779
3766
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3780
3767
  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));
3781
- const l = n.canvasHeight * n.prevTransform.scale, u = s - l;
3782
- return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
3768
+ const u = n.canvasHeight * n.prevTransform.scale, l = s - u;
3769
+ return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3783
3770
  };
3784
- }, nr = (r) => {
3771
+ }, hr = (r) => {
3785
3772
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3786
3773
  return (n) => {
3787
3774
  const a = n.prevTransform, h = n.nextTransform;
3788
- let d = h.scale, c = h.x, l = h.y;
3775
+ let d = h.scale, c = h.x, u = h.y;
3789
3776
  if (h.scale > s && h.scale > a.scale) {
3790
- d = Math.max(a.scale, s), c = a.x, l = a.y;
3791
- const u = (d - a.scale) / (h.scale - a.scale);
3792
- c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
3777
+ d = Math.max(a.scale, s), c = a.x, u = a.y;
3778
+ const l = (d - a.scale) / (h.scale - a.scale);
3779
+ c = a.x + (h.x - a.x) * l, u = a.y + (h.y - a.y) * l;
3793
3780
  }
3794
3781
  if (h.scale < o && h.scale < a.scale) {
3795
- d = Math.min(a.scale, o), c = a.x, l = a.y;
3796
- const u = (d - a.scale) / (h.scale - a.scale);
3797
- c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
3782
+ d = Math.min(a.scale, o), c = a.x, u = a.y;
3783
+ const l = (d - a.scale) / (h.scale - a.scale);
3784
+ c = a.x + (h.x - a.x) * l, u = a.y + (h.y - a.y) * l;
3798
3785
  }
3799
3786
  return {
3800
3787
  scale: d,
3801
3788
  x: c,
3802
- y: l
3789
+ y: u
3803
3790
  };
3804
3791
  };
3805
- }, ar = (r) => (e) => r.reduce(
3792
+ }, dr = (r) => (e) => r.reduce(
3806
3793
  (t, o) => o({
3807
3794
  prevTransform: e.prevTransform,
3808
3795
  nextTransform: t,
@@ -3810,59 +3797,59 @@ const b = Object.freeze({
3810
3797
  canvasHeight: e.canvasHeight
3811
3798
  }),
3812
3799
  e.nextTransform
3813
- ), De = (r) => {
3800
+ ), Le = (r) => {
3814
3801
  if (typeof r == "function")
3815
3802
  return r;
3816
3803
  switch (r.type) {
3817
3804
  case "scale-limit":
3818
- return nr({
3805
+ return hr({
3819
3806
  minContentScale: r.minContentScale ?? 0,
3820
3807
  maxContentScale: r.maxContentScale ?? 1 / 0
3821
3808
  });
3822
3809
  case "shift-limit":
3823
- return ir({
3810
+ return ar({
3824
3811
  minX: r.minX ?? -1 / 0,
3825
3812
  maxX: r.maxX ?? 1 / 0,
3826
3813
  minY: r.minY ?? -1 / 0,
3827
3814
  maxY: r.maxY ?? 1 / 0
3828
3815
  });
3829
3816
  }
3830
- }, Re = (r) => {
3831
- var g, p, w, f, y, E, x, N, T, D, F, U;
3817
+ }, Ve = (r) => {
3818
+ var g, p, w, y, f, m, E, A, T, M, L, V;
3832
3819
  const e = (g = r == null ? void 0 : r.scale) == null ? void 0 : g.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3833
3820
  let s;
3834
- o !== void 0 ? Array.isArray(o) ? s = ar(
3821
+ o !== void 0 ? Array.isArray(o) ? s = dr(
3835
3822
  o.map(
3836
- (R) => De(R)
3823
+ (D) => Le(D)
3837
3824
  )
3838
- ) : s = De(o) : s = (R) => R.nextTransform;
3839
- const n = ((p = r == null ? void 0 : r.shift) == null ? void 0 : p.cursor) !== void 0 ? r.shift.cursor : "grab", a = (w = r == null ? void 0 : r.shift) == null ? void 0 : w.mouseDownEventVerifier, h = a !== void 0 ? a : (R) => R.button === 0, d = (f = r == null ? void 0 : r.shift) == null ? void 0 : f.mouseUpEventVerifier, c = d !== void 0 ? d : (R) => R.button === 0, l = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelEventVerifier, u = l !== void 0 ? l : () => !0;
3825
+ ) : s = Le(o) : s = (D) => D.nextTransform;
3826
+ const n = ((p = r == null ? void 0 : r.shift) == null ? void 0 : p.cursor) !== void 0 ? r.shift.cursor : "grab", a = (w = r == null ? void 0 : r.shift) == null ? void 0 : w.mouseDownEventVerifier, h = a !== void 0 ? a : (D) => D.button === 0, d = (y = r == null ? void 0 : r.shift) == null ? void 0 : y.mouseUpEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, u = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelEventVerifier, l = u !== void 0 ? u : () => !0;
3840
3827
  return {
3841
3828
  wheelSensitivity: t,
3842
- onTransformStarted: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformStarted) ?? P,
3843
- onTransformFinished: ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformFinished) ?? P,
3844
- onBeforeTransformChange: ((N = r == null ? void 0 : r.events) == null ? void 0 : N.onBeforeTransformChange) ?? P,
3845
- onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ?? P,
3829
+ onTransformStarted: ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onTransformStarted) ?? N,
3830
+ onTransformFinished: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformFinished) ?? N,
3831
+ onBeforeTransformChange: ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onBeforeTransformChange) ?? N,
3832
+ onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ?? N,
3846
3833
  transformPreprocessor: s,
3847
3834
  shiftCursor: n,
3848
3835
  mouseDownEventVerifier: h,
3849
3836
  mouseUpEventVerifier: c,
3850
- mouseWheelEventVerifier: u,
3851
- scaleWheelFinishTimeout: ((D = r == null ? void 0 : r.scale) == null ? void 0 : D.wheelFinishTimeout) ?? 500,
3852
- onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ?? P,
3853
- onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ?? P
3837
+ mouseWheelEventVerifier: l,
3838
+ scaleWheelFinishTimeout: ((M = r == null ? void 0 : r.scale) == null ? void 0 : M.wheelFinishTimeout) ?? 500,
3839
+ onResizeTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onResizeTransformStarted) ?? N,
3840
+ onResizeTransformFinished: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onResizeTransformFinished) ?? N
3854
3841
  };
3855
- }, hr = (r, e) => {
3842
+ }, cr = (r, e) => {
3856
3843
  const t = document.createElementNS(
3857
3844
  "http://www.w3.org/2000/svg",
3858
3845
  "circle"
3859
3846
  );
3860
3847
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3861
- }, dr = (r) => r instanceof SVGElement ? r : hr(
3848
+ }, lr = (r) => r instanceof SVGElement ? r : cr(
3862
3849
  (r == null ? void 0 : r.radius) ?? 1.5,
3863
3850
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3864
- ), cr = (r) => {
3865
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = dr(r.renderer ?? {});
3851
+ ), ur = (r) => {
3852
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = lr(r.renderer ?? {});
3866
3853
  return {
3867
3854
  tileWidth: t,
3868
3855
  tileHeight: o,
@@ -3874,13 +3861,13 @@ const b = Object.freeze({
3874
3861
  connectionPreprocessor: (r) => r,
3875
3862
  connectionAllowedVerifier: () => !0,
3876
3863
  mouseEventVerifier: (r) => r.button === 0
3877
- }), lr = (r, e, t) => {
3864
+ }), gr = (r, e, t) => {
3878
3865
  var s, n, a;
3879
3866
  const o = r.connectionAllowedVerifier ?? $.connectionAllowedVerifier;
3880
3867
  return {
3881
3868
  connectionTypeResolver: r.connectionTypeResolver ?? $.connectionTypeResolver,
3882
3869
  connectionAllowedVerifier: o,
3883
- draggingPortDirectionResolver: _e(
3870
+ draggingPortDirectionResolver: et(
3884
3871
  r.dragPortDirection,
3885
3872
  t,
3886
3873
  o
@@ -3889,9 +3876,9 @@ const b = Object.freeze({
3889
3876
  connectionPreprocessor: r.connectionPreprocessor ?? $.connectionPreprocessor,
3890
3877
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? $.mouseEventVerifier,
3891
3878
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? $.mouseEventVerifier,
3892
- onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ?? P,
3893
- onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ?? P,
3894
- onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? P
3879
+ onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ?? N,
3880
+ onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ?? N,
3881
+ onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? N
3895
3882
  };
3896
3883
  }, z = Object.freeze({
3897
3884
  connectionAllowedVerifier: () => !0,
@@ -3899,7 +3886,7 @@ const b = Object.freeze({
3899
3886
  // TODO: remove ctrl key
3900
3887
  mouseDownEventVerifier: (r) => r.button === 0 && r.ctrlKey,
3901
3888
  mouseUpEventVerifier: (r) => r.button === 0
3902
- }), ur = (r, e) => {
3889
+ }), pr = (r, e) => {
3903
3890
  var s, n, a;
3904
3891
  const t = (h) => {
3905
3892
  const d = e.getPortAdjacentEdgeIds(h);
@@ -3912,32 +3899,32 @@ const b = Object.freeze({
3912
3899
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? z.mouseUpEventVerifier,
3913
3900
  draggingEdgeResolver: r.draggingEdgeResolver ?? t,
3914
3901
  draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ve(r.draggingEdgeShape) : null,
3915
- onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ?? P,
3916
- onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ?? P,
3917
- onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ?? P,
3918
- draggingPortDirectionResolver: _e(
3902
+ onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ?? N,
3903
+ onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ?? N,
3904
+ onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ?? N,
3905
+ draggingPortDirectionResolver: et(
3919
3906
  r.dragPortDirection,
3920
3907
  e,
3921
3908
  o
3922
3909
  )
3923
3910
  };
3924
- }, gr = (r) => ({
3911
+ }, wr = (r) => ({
3925
3912
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3926
3913
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3927
- }), pr = (r) => {
3914
+ }), yr = (r) => {
3928
3915
  var e, t;
3929
3916
  return {
3930
- onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? P,
3931
- onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? P
3917
+ onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? N,
3918
+ onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? N
3932
3919
  };
3933
3920
  };
3934
- class wr extends Error {
3921
+ class fr extends Error {
3935
3922
  constructor() {
3936
3923
  super(...arguments);
3937
3924
  i(this, "name", "CanvasBuilderError");
3938
3925
  }
3939
3926
  }
3940
- class qe {
3927
+ class tt {
3941
3928
  constructor(e, t, o) {
3942
3929
  i(this, "dt");
3943
3930
  i(this, "nodeMass");
@@ -3970,12 +3957,12 @@ class qe {
3970
3957
  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(
3971
3958
  a,
3972
3959
  h
3973
- ), l = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * l, g = d.ey * l, p = e.get(s.nodeId), w = e.get(n.nodeId);
3974
- p.x += u, p.y += g, w.x -= u, w.y -= g;
3960
+ ), u = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * u, g = d.ey * u, p = e.get(s.nodeId), w = e.get(n.nodeId);
3961
+ p.x += l, p.y += g, w.x -= l, w.y -= g;
3975
3962
  });
3976
3963
  }
3977
3964
  }
3978
- class et {
3965
+ class rt {
3979
3966
  constructor(e) {
3980
3967
  i(this, "PI2", 2 * Math.PI);
3981
3968
  this.rand = e;
@@ -3994,13 +3981,13 @@ class et {
3994
3981
  return { ex: h, ey: d, d: a };
3995
3982
  }
3996
3983
  }
3997
- const tt = (r) => {
3984
+ const ot = (r) => {
3998
3985
  if (r.distance === 0)
3999
3986
  return r.maxForce;
4000
3987
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
4001
3988
  return Math.min(e, r.maxForce);
4002
3989
  };
4003
- class fr {
3990
+ class vr {
4004
3991
  constructor(e) {
4005
3992
  i(this, "nodeCharge");
4006
3993
  i(this, "distanceVectorGenerator");
@@ -4012,22 +3999,22 @@ class fr {
4012
3999
  for (let n = 0; n < s; n++) {
4013
4000
  const a = o[n];
4014
4001
  for (let h = n + 1; h < s; h++) {
4015
- const d = o[h], c = e.get(a), l = e.get(d), u = this.distanceVectorGenerator.create(
4002
+ const d = o[h], c = e.get(a), u = e.get(d), l = this.distanceVectorGenerator.create(
4016
4003
  c,
4017
- l
4018
- ), g = tt({
4004
+ u
4005
+ ), g = ot({
4019
4006
  coefficient: 1,
4020
4007
  sourceCharge: this.nodeCharge,
4021
4008
  targetCharge: this.nodeCharge,
4022
- distance: u.d,
4009
+ distance: l.d,
4023
4010
  maxForce: this.maxForce
4024
- }), p = g * u.ex, w = g * u.ey, f = t.get(a), y = t.get(d);
4025
- f.x -= p, f.y -= w, y.x += p, y.y += w;
4011
+ }), p = g * l.ex, w = g * l.ey, y = t.get(a), f = t.get(d);
4012
+ y.x -= p, y.y -= w, f.x += p, f.y += w;
4026
4013
  }
4027
4014
  }
4028
4015
  }
4029
4016
  }
4030
- const yr = (r) => {
4017
+ const mr = (r) => {
4031
4018
  if (r.size === 0)
4032
4019
  return {
4033
4020
  centerX: 0,
@@ -4045,7 +4032,7 @@ const yr = (r) => {
4045
4032
  radius: h / 2
4046
4033
  };
4047
4034
  };
4048
- class vr {
4035
+ class xr {
4049
4036
  constructor(e) {
4050
4037
  i(this, "root");
4051
4038
  i(this, "leaves", /* @__PURE__ */ new Map());
@@ -4103,13 +4090,13 @@ class vr {
4103
4090
  const { x: p, y: w } = this.coords.get(g);
4104
4091
  p < t ? w < o ? d.add(g) : h.add(g) : w < o ? a.add(g) : n.add(g), e.nodeIds.delete(g);
4105
4092
  });
4106
- const l = {
4093
+ const u = {
4107
4094
  parent: e,
4108
4095
  lb: null,
4109
4096
  lt: null,
4110
4097
  rb: null,
4111
4098
  rt: null
4112
- }, u = [];
4099
+ }, l = [];
4113
4100
  if (n.size > 0) {
4114
4101
  const g = {
4115
4102
  nodeIds: n,
@@ -4124,9 +4111,9 @@ class vr {
4124
4111
  centerY: o + c,
4125
4112
  radius: c
4126
4113
  },
4127
- ...l
4114
+ ...u
4128
4115
  };
4129
- e.rt = g, u.push(g);
4116
+ e.rt = g, l.push(g);
4130
4117
  }
4131
4118
  if (a.size > 0) {
4132
4119
  const g = {
@@ -4142,9 +4129,9 @@ class vr {
4142
4129
  centerY: o - c,
4143
4130
  radius: c
4144
4131
  },
4145
- ...l
4132
+ ...u
4146
4133
  };
4147
- e.rb = g, u.push(g);
4134
+ e.rb = g, l.push(g);
4148
4135
  }
4149
4136
  if (h.size > 0) {
4150
4137
  const g = {
@@ -4160,9 +4147,9 @@ class vr {
4160
4147
  centerY: o + c,
4161
4148
  radius: c
4162
4149
  },
4163
- ...l
4150
+ ...u
4164
4151
  };
4165
- e.lt = g, u.push(g);
4152
+ e.lt = g, l.push(g);
4166
4153
  }
4167
4154
  if (d.size > 0) {
4168
4155
  const g = {
@@ -4178,11 +4165,11 @@ class vr {
4178
4165
  centerY: o - c,
4179
4166
  radius: c
4180
4167
  },
4181
- ...l
4168
+ ...u
4182
4169
  };
4183
- e.lb = g, u.push(g);
4170
+ e.lb = g, l.push(g);
4184
4171
  }
4185
- return u;
4172
+ return l;
4186
4173
  }
4187
4174
  setLeaf(e) {
4188
4175
  e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
@@ -4202,7 +4189,7 @@ class vr {
4202
4189
  }), { x: t / e.size, y: o / e.size };
4203
4190
  }
4204
4191
  }
4205
- class mr {
4192
+ class Er {
4206
4193
  constructor(e) {
4207
4194
  i(this, "areaRadiusThreshold");
4208
4195
  i(this, "nodeMass");
@@ -4214,7 +4201,7 @@ class mr {
4214
4201
  this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
4215
4202
  }
4216
4203
  apply(e, t) {
4217
- const o = yr(e), s = new vr({
4204
+ const o = mr(e), s = new xr({
4218
4205
  box: o,
4219
4206
  coords: e,
4220
4207
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -4329,7 +4316,7 @@ class mr {
4329
4316
  const t = this.distanceVectorGenerator.create(
4330
4317
  e.sourceCoords,
4331
4318
  e.targetCoords
4332
- ), o = tt({
4319
+ ), o = ot({
4333
4320
  coefficient: this.nodeForceCoefficient,
4334
4321
  sourceCharge: e.sourceCharge,
4335
4322
  targetCharge: e.targetCharge,
@@ -4364,7 +4351,7 @@ class mr {
4364
4351
  }
4365
4352
  }
4366
4353
  }
4367
- const rt = (r) => r.theta !== 0 ? new mr({
4354
+ const st = (r) => r.theta !== 0 ? new Er({
4368
4355
  nodeCharge: r.nodeCharge,
4369
4356
  nodeForceCoefficient: r.nodeForceCoefficient,
4370
4357
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -4372,13 +4359,13 @@ const rt = (r) => r.theta !== 0 ? new mr({
4372
4359
  theta: r.theta,
4373
4360
  nodeMass: r.nodeMass,
4374
4361
  areaRadiusThreshold: r.areaRadiusThreshold
4375
- }) : new fr({
4362
+ }) : new vr({
4376
4363
  nodeCharge: r.nodeCharge,
4377
4364
  nodeForceCoefficient: r.nodeForceCoefficient,
4378
4365
  distanceVectorGenerator: r.distanceVectorGenerator,
4379
4366
  maxForce: r.maxForce
4380
4367
  });
4381
- class ot {
4368
+ class it {
4382
4369
  constructor(e) {
4383
4370
  i(this, "rand");
4384
4371
  i(this, "sparsity");
@@ -4386,22 +4373,22 @@ class ot {
4386
4373
  }
4387
4374
  calculateCoordinates(e) {
4388
4375
  const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((w) => {
4389
- const f = t.getNode(w);
4390
- return f.x === null || f.y === null;
4391
- }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, l = o.createContentCoords(c), u = a / 2, g = {
4392
- x: l.x - u,
4393
- y: l.y - u
4376
+ const y = t.getNode(w);
4377
+ return y.x === null || y.y === null;
4378
+ }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, u = o.createContentCoords(c), l = a / 2, g = {
4379
+ x: u.x - l,
4380
+ y: u.y - l
4394
4381
  };
4395
4382
  return t.getAllNodeIds().forEach((w) => {
4396
- const f = t.getNode(w);
4383
+ const y = t.getNode(w);
4397
4384
  s.set(w, {
4398
- x: f.x ?? g.x + a * this.rand(),
4399
- y: f.y ?? g.y + a * this.rand()
4385
+ x: y.x ?? g.x + a * this.rand(),
4386
+ y: y.y ?? g.y + a * this.rand()
4400
4387
  });
4401
4388
  }), s;
4402
4389
  }
4403
4390
  }
4404
- class Er {
4391
+ class Ar {
4405
4392
  constructor(e) {
4406
4393
  i(this, "distanceVectorGenerator");
4407
4394
  i(this, "nodeForcesApplicationStrategy");
@@ -4412,7 +4399,7 @@ class Er {
4412
4399
  i(this, "edgeEquilibriumLength");
4413
4400
  i(this, "edgeStiffness");
4414
4401
  i(this, "convergenceVelocity");
4415
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new et(e.rand), this.nodeForcesApplicationStrategy = rt({
4402
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new rt(e.rand), this.nodeForcesApplicationStrategy = st({
4416
4403
  distanceVectorGenerator: this.distanceVectorGenerator,
4417
4404
  nodeCharge: e.nodeCharge,
4418
4405
  maxForce: e.maxForce,
@@ -4420,7 +4407,7 @@ class Er {
4420
4407
  theta: e.barnesHutTheta,
4421
4408
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4422
4409
  nodeMass: e.nodeMass
4423
- }), this.fillerLayoutAlgorithm = new ot({
4410
+ }), this.fillerLayoutAlgorithm = new it({
4424
4411
  rand: e.rand,
4425
4412
  sparsity: e.edgeEquilibriumLength
4426
4413
  });
@@ -4430,7 +4417,7 @@ class Er {
4430
4417
  graph: t,
4431
4418
  viewport: o
4432
4419
  });
4433
- for (let n = 0; n < this.maxIterations && !(new qe(
4420
+ for (let n = 0; n < this.maxIterations && !(new tt(
4434
4421
  t,
4435
4422
  s,
4436
4423
  {
@@ -4446,7 +4433,7 @@ class Er {
4446
4433
  return s;
4447
4434
  }
4448
4435
  }
4449
- class xr {
4436
+ class Sr {
4450
4437
  constructor(e, t) {
4451
4438
  i(this, "forest", /* @__PURE__ */ new Set());
4452
4439
  i(this, "remainingNodeIds");
@@ -4487,7 +4474,7 @@ class xr {
4487
4474
  }
4488
4475
  }
4489
4476
  }
4490
- class Ar {
4477
+ class br {
4491
4478
  constructor(e) {
4492
4479
  this.params = e;
4493
4480
  }
@@ -4495,17 +4482,17 @@ class Ar {
4495
4482
  let t = 0;
4496
4483
  const o = [], s = e.length - 1, n = [];
4497
4484
  e.forEach((h, d) => {
4498
- if (t += this.params.spaceAroundRadius, h.forEach((c, l) => {
4499
- n[l] === void 0 ? n[l] = {
4485
+ if (t += this.params.spaceAroundRadius, h.forEach((c, u) => {
4486
+ n[u] === void 0 ? n[u] = {
4500
4487
  start: t + c.start,
4501
4488
  end: t + c.end
4502
- } : n[l].end = t + c.end;
4489
+ } : n[u].end = t + c.end;
4503
4490
  }), o.push(t), d !== s) {
4504
- const c = e[d + 1], l = n.map((u) => ({
4505
- start: u.start - t,
4506
- end: u.end - t
4491
+ const c = e[d + 1], u = n.map((l) => ({
4492
+ start: l.start - t,
4493
+ end: l.end - t
4507
4494
  }));
4508
- t += this.calculateMaxDiff(l, c);
4495
+ t += this.calculateMaxDiff(u, c);
4509
4496
  }
4510
4497
  t += this.params.spaceAroundRadius;
4511
4498
  });
@@ -4528,12 +4515,12 @@ class Ar {
4528
4515
  return o - 2 * this.params.spaceAroundRadius;
4529
4516
  }
4530
4517
  }
4531
- class Sr {
4518
+ class Pr {
4532
4519
  constructor(e, t) {
4533
4520
  i(this, "offsets", /* @__PURE__ */ new Map());
4534
4521
  i(this, "treeSpans", /* @__PURE__ */ new Map());
4535
4522
  this.tree = e;
4536
- const o = t.spaceAroundRadius, s = new Ar({
4523
+ const o = t.spaceAroundRadius, s = new br({
4537
4524
  spaceAroundRadius: o
4538
4525
  });
4539
4526
  [...this.tree.sequence].reverse().forEach((n) => {
@@ -4555,40 +4542,40 @@ class Sr {
4555
4542
  return this.offsets;
4556
4543
  }
4557
4544
  }
4558
- class br {
4545
+ class Nr {
4559
4546
  constructor(e) {
4560
4547
  this.params = e;
4561
4548
  }
4562
4549
  calculateCoordinates(e) {
4563
- const t = /* @__PURE__ */ new Map(), s = new xr(
4550
+ const t = /* @__PURE__ */ new Map(), s = new Sr(
4564
4551
  e.graph,
4565
4552
  this.params.nextLayerNodesResolver
4566
4553
  ).generate();
4567
4554
  let n = 0;
4568
4555
  return s.forEach((a) => {
4569
4556
  t.set(a.root.nodeId, { x: n, y: 0 });
4570
- const d = new Sr(a, {
4557
+ const d = new Pr(a, {
4571
4558
  spaceAroundRadius: this.params.layerSpace / 2
4572
4559
  }).generate();
4573
4560
  let c = [a.root];
4574
4561
  for (; c.length > 0; ) {
4575
- const l = [];
4576
- n += this.params.layerWidth, c.forEach((u) => {
4577
- u.children.forEach((g) => {
4578
- const p = t.get(u.nodeId).y;
4562
+ const u = [];
4563
+ n += this.params.layerWidth, c.forEach((l) => {
4564
+ l.children.forEach((g) => {
4565
+ const p = t.get(l.nodeId).y;
4579
4566
  t.set(g.nodeId, {
4580
4567
  y: p + d.get(g.nodeId),
4581
4568
  x: n
4582
- }), l.push(g);
4569
+ }), u.push(g);
4583
4570
  });
4584
- }), c = l;
4571
+ }), c = u;
4585
4572
  }
4586
4573
  }), t.forEach((a, h) => {
4587
4574
  t.set(h, this.params.transform(a));
4588
4575
  }), t;
4589
4576
  }
4590
4577
  }
4591
- const Pr = (r) => {
4578
+ const Cr = (r) => {
4592
4579
  const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
4593
4580
  const a = e.getEdge(n);
4594
4581
  return e.getPort(a.to).nodeId;
@@ -4597,20 +4584,20 @@ const Pr = (r) => {
4597
4584
  return e.getPort(a.from).nodeId;
4598
4585
  });
4599
4586
  return /* @__PURE__ */ new Set([...o, ...s]);
4600
- }, Nr = (r) => {
4587
+ }, Tr = (r) => {
4601
4588
  const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
4602
4589
  const n = e.getEdge(s);
4603
4590
  return e.getPort(n.to).nodeId;
4604
4591
  });
4605
4592
  return new Set(o);
4606
- }, Cr = (r) => {
4593
+ }, Mr = (r) => {
4607
4594
  const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
4608
4595
  const n = e.getEdge(s);
4609
4596
  return e.getPort(n.from).nodeId;
4610
4597
  });
4611
4598
  return new Set(o);
4612
4599
  };
4613
- class Tr {
4600
+ class Dr {
4614
4601
  constructor(e) {
4615
4602
  i(this, "distanceVectorGenerator");
4616
4603
  i(this, "nodeForcesApplicationStrategy");
@@ -4620,7 +4607,7 @@ class Tr {
4620
4607
  i(this, "edgeEquilibriumLength");
4621
4608
  i(this, "edgeStiffness");
4622
4609
  i(this, "fillerLayoutAlgorithm");
4623
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new et(e.rand), this.nodeForcesApplicationStrategy = rt({
4610
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new rt(e.rand), this.nodeForcesApplicationStrategy = st({
4624
4611
  distanceVectorGenerator: this.distanceVectorGenerator,
4625
4612
  nodeCharge: e.nodeCharge,
4626
4613
  maxForce: e.maxForce,
@@ -4628,7 +4615,7 @@ class Tr {
4628
4615
  theta: e.barnesHutTheta,
4629
4616
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4630
4617
  nodeMass: e.nodeMass
4631
- }), this.fillerLayoutAlgorithm = new ot({
4618
+ }), this.fillerLayoutAlgorithm = new it({
4632
4619
  rand: e.rand,
4633
4620
  sparsity: e.edgeEquilibriumLength
4634
4621
  });
@@ -4638,7 +4625,7 @@ class Tr {
4638
4625
  graph: t,
4639
4626
  viewport: o
4640
4627
  });
4641
- return new qe(
4628
+ return new tt(
4642
4629
  t,
4643
4630
  n,
4644
4631
  {
@@ -4650,65 +4637,65 @@ class Tr {
4650
4637
  edgeStiffness: this.edgeStiffness
4651
4638
  }
4652
4639
  ).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
4653
- const l = t.getNode(c);
4654
- return l.x === null || l.y === null;
4640
+ const u = t.getNode(c);
4641
+ return u.x === null || u.y === null;
4655
4642
  }) ? /* @__PURE__ */ new Map() : n;
4656
4643
  }
4657
4644
  }
4658
- const st = (r) => {
4645
+ const nt = (r) => {
4659
4646
  let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
4660
4647
  for (let n = 0, a; n < r.length; n++)
4661
4648
  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);
4662
4649
  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];
4663
- }, it = (r, e, t, o) => function() {
4650
+ }, at = (r, e, t, o) => function() {
4664
4651
  r |= 0, e |= 0, t |= 0, o |= 0;
4665
4652
  const s = (r + e | 0) + o | 0;
4666
4653
  return o = o + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + s | 0, (s >>> 0) / 4294967296;
4667
- }, Mr = (r) => {
4654
+ }, Rr = (r) => {
4668
4655
  var e, t;
4669
4656
  switch (r == null ? void 0 : r.type) {
4670
4657
  case "custom":
4671
4658
  return r.instance;
4672
4659
  default: {
4673
- const o = st((r == null ? void 0 : r.seed) ?? b.seed), s = it(o[0], o[1], o[2], o[3]);
4674
- return new Tr({
4660
+ const o = nt((r == null ? void 0 : r.seed) ?? P.seed), s = at(o[0], o[1], o[2], o[3]);
4661
+ return new Dr({
4675
4662
  rand: s,
4676
- maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? b.maxTimeDeltaSec,
4677
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
4678
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? b.nodeMass,
4679
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? b.edgeEquilibriumLength,
4680
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? b.edgeStiffness,
4663
+ maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? P.maxTimeDeltaSec,
4664
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? P.nodeCharge,
4665
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? P.nodeMass,
4666
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? P.edgeEquilibriumLength,
4667
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? P.edgeStiffness,
4681
4668
  // TODO: rename no `minVelocity`
4682
- convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? b.convergenceVelocity,
4683
- maxForce: (r == null ? void 0 : r.maxForce) ?? b.maxForce,
4684
- nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? b.nodeForceCoefficient,
4685
- barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? b.barnesHutTheta,
4686
- barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? b.barnesHutAreaRadiusThreshold
4669
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? P.convergenceVelocity,
4670
+ maxForce: (r == null ? void 0 : r.maxForce) ?? P.maxForce,
4671
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? P.nodeForceCoefficient,
4672
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? P.barnesHutTheta,
4673
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? P.barnesHutAreaRadiusThreshold
4687
4674
  });
4688
4675
  }
4689
4676
  }
4690
- }, Dr = {
4677
+ }, Lr = {
4691
4678
  staticNodeResolver: () => !1
4692
- }, Rr = (r) => {
4679
+ }, Vr = (r) => {
4693
4680
  var t, o;
4694
4681
  return {
4695
- algorithm: Mr((r == null ? void 0 : r.algorithm) ?? {}),
4696
- staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Dr.staticNodeResolver,
4697
- onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? P,
4698
- onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? P
4682
+ algorithm: Rr((r == null ? void 0 : r.algorithm) ?? {}),
4683
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Lr.staticNodeResolver,
4684
+ onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? N,
4685
+ onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? N
4699
4686
  };
4700
- }, Lr = (r) => r instanceof q ? {
4687
+ }, Ir = (r) => r instanceof q ? {
4701
4688
  type: "trigger",
4702
4689
  trigger: r
4703
4690
  } : r === "topologyChangeMicrotask" ? {
4704
4691
  type: "topologyChangeSchedule",
4705
- schedule: Ce
4692
+ schedule: Me
4706
4693
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
4707
4694
  type: "topologyChangeSchedule",
4708
- schedule: Xt
4695
+ schedule: jt
4709
4696
  } : {
4710
4697
  type: "topologyChangeSchedule",
4711
- schedule: Ce
4698
+ schedule: Me
4712
4699
  }, Z = Object.freeze({
4713
4700
  staticNodeResolver: () => !1,
4714
4701
  hierarchicalLayout: {
@@ -4722,7 +4709,7 @@ const st = (r) => {
4722
4709
  d: r.d * e.a + r.e * e.d,
4723
4710
  e: r.d * e.b + r.e * e.e,
4724
4711
  f: r.d * e.c + r.e * e.f + r.f
4725
- }), Vr = (r) => {
4712
+ }), Fr = (r) => {
4726
4713
  const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
4727
4714
  return {
4728
4715
  a: n / h,
@@ -4733,7 +4720,7 @@ const st = (r) => {
4733
4720
  f: (o * s - e * a) / h
4734
4721
  };
4735
4722
  };
4736
- class Ir {
4723
+ class Ur {
4737
4724
  resolve(e) {
4738
4725
  if ("shift" in e)
4739
4726
  return this.createShiftBaseMatrix(e.shift);
@@ -4777,7 +4764,7 @@ class Ir {
4777
4764
  const o = k(
4778
4765
  t,
4779
4766
  e
4780
- ), s = Vr(t);
4767
+ ), s = Fr(t);
4781
4768
  return k(o, s);
4782
4769
  }
4783
4770
  createShiftBaseMatrix(e) {
@@ -4822,7 +4809,7 @@ class Ir {
4822
4809
  };
4823
4810
  }
4824
4811
  }
4825
- const Fr = (r) => {
4812
+ const $r = (r) => {
4826
4813
  if (r === void 0)
4827
4814
  return (s) => s;
4828
4815
  if (typeof r == "function")
@@ -4836,7 +4823,7 @@ const Fr = (r) => {
4836
4823
  e: 1,
4837
4824
  f: 0
4838
4825
  };
4839
- const o = new Ir();
4826
+ const o = new Ur();
4840
4827
  return e.forEach((s) => {
4841
4828
  const n = o.resolve(s);
4842
4829
  t = k(t, n);
@@ -4847,59 +4834,59 @@ const Fr = (r) => {
4847
4834
  y: t.d * n + t.e * a + t.f
4848
4835
  };
4849
4836
  };
4850
- }, Ur = (r) => {
4837
+ }, Br = (r) => {
4851
4838
  if (typeof r == "function")
4852
4839
  return r;
4853
4840
  switch (r) {
4854
4841
  case "outgoing":
4855
- return Nr;
4842
+ return Tr;
4856
4843
  case "incoming":
4857
- return Cr;
4844
+ return Mr;
4858
4845
  default:
4859
- return Pr;
4846
+ return Cr;
4860
4847
  }
4861
- }, $r = (r) => {
4848
+ }, Or = (r) => {
4862
4849
  var e, t;
4863
4850
  switch (r == null ? void 0 : r.type) {
4864
4851
  case "custom":
4865
4852
  return r.instance;
4866
4853
  case "hierarchical":
4867
- return new br({
4854
+ return new Nr({
4868
4855
  layerWidth: r.layerWidth ?? Z.hierarchicalLayout.layerWidth,
4869
4856
  layerSpace: r.layerSpace ?? Z.hierarchicalLayout.layerSpace,
4870
- transform: Fr(r.transform),
4871
- nextLayerNodesResolver: Ur(
4857
+ transform: $r(r.transform),
4858
+ nextLayerNodesResolver: Br(
4872
4859
  r.nextLayerNodesResolver
4873
4860
  )
4874
4861
  });
4875
4862
  default: {
4876
- const o = st((r == null ? void 0 : r.seed) ?? b.seed), s = it(o[0], o[1], o[2], o[3]);
4877
- return new Er({
4878
- dtSec: (r == null ? void 0 : r.dtSec) ?? b.dtSec,
4879
- maxIterations: (r == null ? void 0 : r.maxIterations) ?? b.maxIterations,
4863
+ const o = nt((r == null ? void 0 : r.seed) ?? P.seed), s = at(o[0], o[1], o[2], o[3]);
4864
+ return new Ar({
4865
+ dtSec: (r == null ? void 0 : r.dtSec) ?? P.dtSec,
4866
+ maxIterations: (r == null ? void 0 : r.maxIterations) ?? P.maxIterations,
4880
4867
  rand: s,
4881
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
4882
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? b.nodeMass,
4883
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? b.edgeEquilibriumLength,
4884
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? b.edgeStiffness,
4885
- convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? b.convergenceVelocity,
4886
- maxForce: (r == null ? void 0 : r.maxForce) ?? b.maxForce,
4887
- nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? b.nodeForceCoefficient,
4888
- barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? b.barnesHutTheta,
4889
- barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? b.barnesHutAreaRadiusThreshold
4868
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? P.nodeCharge,
4869
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? P.nodeMass,
4870
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? P.edgeEquilibriumLength,
4871
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? P.edgeStiffness,
4872
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? P.convergenceVelocity,
4873
+ maxForce: (r == null ? void 0 : r.maxForce) ?? P.maxForce,
4874
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? P.nodeForceCoefficient,
4875
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? P.barnesHutTheta,
4876
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? P.barnesHutAreaRadiusThreshold
4890
4877
  });
4891
4878
  }
4892
4879
  }
4893
- }, Br = (r) => {
4880
+ }, Wr = (r) => {
4894
4881
  var e, t;
4895
4882
  return {
4896
- algorithm: $r(r.algorithm),
4897
- applyOn: Lr(r.applyOn),
4883
+ algorithm: Or(r.algorithm),
4884
+ applyOn: Ir(r.applyOn),
4898
4885
  staticNodeResolver: r.staticNodeResolver ?? Z.staticNodeResolver,
4899
- onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? P,
4900
- onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? P
4886
+ onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? N,
4887
+ onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? N
4901
4888
  };
4902
- }, Or = (r, e) => ({
4889
+ }, zr = (r, e) => ({
4903
4890
  ...r,
4904
4891
  onNodeDragStarted: (t) => {
4905
4892
  e.add(t), r.onNodeDragStarted(t);
@@ -4907,7 +4894,7 @@ const Fr = (r) => {
4907
4894
  onNodeDragFinished: (t) => {
4908
4895
  e.delete(t), r.onNodeDragFinished(t);
4909
4896
  }
4910
- }), Wr = (r, e) => {
4897
+ }), kr = (r, e) => {
4911
4898
  r.graph.onBeforeNodeRemoved.subscribe((t) => {
4912
4899
  e.delete(t);
4913
4900
  }), r.graph.onBeforeClear.subscribe(() => {
@@ -4915,28 +4902,28 @@ const Fr = (r) => {
4915
4902
  }), r.onBeforeDestroy.subscribe(() => {
4916
4903
  e.clear();
4917
4904
  });
4918
- }, zr = (r, e) => ({
4905
+ }, Hr = (r, e) => ({
4919
4906
  ...r,
4920
4907
  staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
4921
- }), _ = (r) => () => r, Le = _(0), kr = () => {
4908
+ }), _ = (r) => () => r, Ie = _(0), Yr = () => {
4922
4909
  let r = 0;
4923
4910
  return () => r++;
4924
- }, Hr = (r, e) => {
4925
- let t = Le, o = Le;
4926
- const s = kr();
4911
+ }, Xr = (r, e) => {
4912
+ let t = Ie, o = Ie;
4913
+ const s = Yr();
4927
4914
  return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = _(r)), typeof e == "number" && (o = _(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
4928
4915
  nodesPriorityFn: t,
4929
4916
  edgesPriorityFn: o
4930
4917
  };
4931
- }, Yr = (r) => {
4918
+ }, Gr = (r) => {
4932
4919
  var t, o, s, n, a;
4933
- const e = Hr(
4920
+ const e = Xr(
4934
4921
  (t = r.nodes) == null ? void 0 : t.priority,
4935
4922
  (o = r.edges) == null ? void 0 : o.priority
4936
4923
  );
4937
4924
  return {
4938
4925
  nodes: {
4939
- centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Be,
4926
+ centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? We,
4940
4927
  priorityFn: e.nodesPriorityFn
4941
4928
  },
4942
4929
  ports: {
@@ -4947,9 +4934,9 @@ const Fr = (r) => {
4947
4934
  priorityFn: e.edgesPriorityFn
4948
4935
  }
4949
4936
  };
4950
- }, Xr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Gr = (r) => {
4937
+ }, jr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Jr = (r) => {
4951
4938
  var o, s, n, a;
4952
- const { canvasDefaults: e } = r, t = r.hasLayout ? Xr(r.layoutParams) : oe;
4939
+ const { canvasDefaults: e } = r, t = r.hasLayout ? jr(r.layoutParams) : oe;
4953
4940
  return {
4954
4941
  focus: {
4955
4942
  contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
@@ -4958,23 +4945,23 @@ const Fr = (r) => {
4958
4945
  animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
4959
4946
  }
4960
4947
  };
4961
- }, jr = (r) => ({
4948
+ }, Kr = (r) => ({
4962
4949
  onNodeSelected: r.onNodeSelected,
4963
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4964
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4965
- movementThreshold: r.movementThreshold ?? L.movementThreshold
4966
- }), Jr = (r) => ({
4950
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? I.mouseDownEventVerifier,
4951
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? I.mouseUpEventVerifier,
4952
+ movementThreshold: r.movementThreshold ?? I.movementThreshold
4953
+ }), Qr = (r) => ({
4967
4954
  onCanvasSelected: r.onCanvasSelected,
4968
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4969
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4970
- movementThreshold: r.movementThreshold ?? L.movementThreshold
4971
- }), Kr = (r) => ({
4955
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? I.mouseDownEventVerifier,
4956
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? I.mouseUpEventVerifier,
4957
+ movementThreshold: r.movementThreshold ?? I.movementThreshold
4958
+ }), Zr = (r) => ({
4972
4959
  onEdgeSelected: r.onEdgeSelected,
4973
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
4974
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
4975
- movementThreshold: r.movementThreshold ?? L.movementThreshold
4960
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? I.mouseDownEventVerifier,
4961
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? I.mouseUpEventVerifier,
4962
+ movementThreshold: r.movementThreshold ?? I.movementThreshold
4976
4963
  });
4977
- class _r {
4964
+ class eo {
4978
4965
  constructor(e) {
4979
4966
  i(this, "used", !1);
4980
4967
  i(this, "canvasDefaults", {});
@@ -5001,8 +4988,8 @@ class _r {
5001
4988
  i(this, "window", window);
5002
4989
  i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
5003
4990
  i(this, "pointInsideVerifier");
5004
- i(this, "eventTagger", new jt());
5005
- this.element = e, this.pointInsideVerifier = new mt(e, this.window);
4991
+ i(this, "eventTagger", new Kt());
4992
+ this.element = e, this.pointInsideVerifier = new Et(e, this.window);
5006
4993
  }
5007
4994
  setDefaults(e) {
5008
4995
  return this.canvasDefaults = e, this;
@@ -5045,44 +5032,44 @@ class _r {
5045
5032
  }
5046
5033
  build() {
5047
5034
  if (this.used)
5048
- throw new wr(
5035
+ throw new fr(
5049
5036
  "Failed to build Canvas because CanvasBuilder is a single-use object"
5050
5037
  );
5051
5038
  this.used = !0;
5052
- const e = new ft(this.element), t = new Fe(), o = new or(this.element), s = this.createHtmlView(
5039
+ const e = new vt(this.element), t = new $e(), o = new ir(this.element), s = this.createHtmlView(
5053
5040
  o.main,
5054
5041
  t,
5055
5042
  e
5056
- ), n = Yr(
5043
+ ), n = Gr(
5057
5044
  this.canvasDefaults
5058
- ), a = new Ge(
5045
+ ), a = new Je(
5059
5046
  t,
5060
5047
  s,
5061
5048
  n
5062
- ), h = Br(this.layoutConfig), d = Gr({
5049
+ ), h = Wr(this.layoutConfig), d = Jr({
5063
5050
  canvasDefaults: this.canvasDefaults,
5064
5051
  hasLayout: this.hasLayout,
5065
5052
  layoutParams: h
5066
- }), c = new Qe(
5053
+ }), c = new _e(
5067
5054
  t,
5068
5055
  e,
5069
5056
  d,
5070
5057
  this.window
5071
- ), l = new je(e), u = new Xe(t), g = new Ie(
5072
- u,
5058
+ ), u = new Ke(e), l = new je(t), g = new Ue(
5073
5059
  l,
5060
+ u,
5074
5061
  a,
5075
5062
  c
5076
5063
  );
5077
5064
  if (this.hasBackground && de.configure(
5078
5065
  g,
5079
- cr(this.backgroundConfig),
5066
+ ur(this.backgroundConfig),
5080
5067
  o.background
5081
5068
  ), this.hasNodeResizeReactiveEdges && ee.configure(g), this.userSelectableEdgesConfig !== void 0) {
5082
- const p = Kr(
5069
+ const p = Zr(
5083
5070
  this.userSelectableEdgesConfig
5084
5071
  );
5085
- fe.configure(
5072
+ ye.configure(
5086
5073
  g,
5087
5074
  this.window,
5088
5075
  this.pointInsideVerifier,
@@ -5091,7 +5078,7 @@ class _r {
5091
5078
  );
5092
5079
  }
5093
5080
  if (this.userSelectableNodesConfig !== void 0) {
5094
- const p = jr(
5081
+ const p = Kr(
5095
5082
  this.userSelectableNodesConfig
5096
5083
  );
5097
5084
  we.configure(
@@ -5103,10 +5090,10 @@ class _r {
5103
5090
  );
5104
5091
  }
5105
5092
  if (this.userSelectableCanvasConfig !== void 0) {
5106
- const p = Jr(
5093
+ const p = Qr(
5107
5094
  this.userSelectableCanvasConfig
5108
5095
  );
5109
- ye.configure(
5096
+ fe.configure(
5110
5097
  g,
5111
5098
  o.main,
5112
5099
  this.window,
@@ -5116,8 +5103,8 @@ class _r {
5116
5103
  );
5117
5104
  }
5118
5105
  if (this.hasDraggableNodes) {
5119
- let p = sr(this.dragConfig);
5120
- this.hasAnimatedLayout && (p = Or(
5106
+ let p = nr(this.dragConfig);
5107
+ this.hasAnimatedLayout && (p = zr(
5121
5108
  p,
5122
5109
  this.animationStaticNodes
5123
5110
  )), ae.configure(
@@ -5129,7 +5116,7 @@ class _r {
5129
5116
  );
5130
5117
  }
5131
5118
  if (this.hasUserConnectablePorts) {
5132
- const p = lr(
5119
+ const p = gr(
5133
5120
  this.connectablePortsConfig,
5134
5121
  n.edges.shapeFactory,
5135
5122
  g.graph
@@ -5144,7 +5131,7 @@ class _r {
5144
5131
  );
5145
5132
  }
5146
5133
  if (this.hasUserDraggableEdges) {
5147
- const p = ur(
5134
+ const p = pr(
5148
5135
  this.draggableEdgesConfig,
5149
5136
  g.graph
5150
5137
  );
@@ -5161,22 +5148,22 @@ class _r {
5161
5148
  g,
5162
5149
  o.main,
5163
5150
  this.window,
5164
- Re(this.transformConfig),
5151
+ Ve(this.transformConfig),
5165
5152
  this.boxRenderingTrigger,
5166
5153
  this.pointInsideVerifier,
5167
- gr(this.virtualScrollConfig)
5154
+ wr(this.virtualScrollConfig)
5168
5155
  ) : this.hasTransformableViewport && J.configure(
5169
5156
  g,
5170
5157
  o.main,
5171
5158
  this.window,
5172
5159
  this.pointInsideVerifier,
5173
- Re(this.transformConfig)
5174
- ), this.hasLayout && qt.configure(g, h), this.hasAnimatedLayout) {
5175
- let p = Rr(this.animatedLayoutConfig);
5176
- this.hasDraggableNodes && (Wr(
5160
+ Ve(this.transformConfig)
5161
+ ), this.hasLayout && tr.configure(g, h), this.hasAnimatedLayout) {
5162
+ let p = Vr(this.animatedLayoutConfig);
5163
+ this.hasDraggableNodes && (kr(
5177
5164
  g,
5178
5165
  this.animationStaticNodes
5179
- ), p = zr(
5166
+ ), p = Hr(
5180
5167
  p,
5181
5168
  this.animationStaticNodes
5182
5169
  )), pe.configure(g, p, this.window);
@@ -5186,27 +5173,28 @@ class _r {
5186
5173
  }), g;
5187
5174
  }
5188
5175
  createHtmlView(e, t, o) {
5189
- let s = new Ve(t, o, e);
5190
- return this.virtualScrollConfig !== void 0 && (s = new gt(
5176
+ let s = new Fe(t, o, e);
5177
+ return this.virtualScrollConfig !== void 0 && (s = new wt(
5191
5178
  s,
5192
5179
  t,
5193
5180
  this.boxRenderingTrigger,
5194
- pr(this.virtualScrollConfig)
5195
- )), s = new pt(s, t), s;
5181
+ yr(this.virtualScrollConfig)
5182
+ )), s = new yt(s, t), s;
5196
5183
  }
5197
5184
  }
5198
5185
  export {
5199
- Bt as BezierEdgeShape,
5200
- _r as CanvasBuilder,
5201
- wr as CanvasBuilderError,
5202
- A as CanvasError,
5203
- I as ConnectionCategory,
5204
- He as DirectEdgeShape,
5186
+ Ot as BezierEdgeShape,
5187
+ eo as CanvasBuilder,
5188
+ fr as CanvasBuilderError,
5189
+ S as CanvasError,
5190
+ U as ConnectionCategory,
5191
+ Xe as DirectEdgeShape,
5205
5192
  q as EventSubject,
5206
- Ot as HorizontalEdgeShape,
5207
- Yt as InteractiveEdgeError,
5208
- Ye as InteractiveEdgeShape,
5209
- Zr as MidpointEdgeShape,
5210
- Wt as StraightEdgeShape,
5211
- zt as VerticalEdgeShape
5193
+ Wt as HorizontalEdgeShape,
5194
+ Gt as InteractiveEdgeError,
5195
+ Ge as InteractiveEdgeShape,
5196
+ qr as MidpointEdgeShape,
5197
+ zt as StraightEdgeShape,
5198
+ kt as VerticalEdgeShape,
5199
+ Ht as boxPortOffsetFn
5212
5200
  };