@html-graph/html-graph 3.12.0 → 3.13.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 me = Object.defineProperty;
2
- var Ae = (r, e, t) => e in r ? me(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => Ae(r, typeof e != "symbol" ? e + "" : e, t);
4
- const Ee = () => {
1
+ var Ae = Object.defineProperty;
2
+ var Ee = (r, e, t) => e in r ? Ae(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => Ee(r, typeof e != "symbol" ? e + "" : e, t);
4
+ const xe = () => {
5
5
  const r = document.createElement("div");
6
6
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
7
- }, xe = () => {
7
+ }, Se = () => {
8
8
  const r = document.createElement("div");
9
9
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
10
- }, Se = (r) => {
10
+ }, be = (r) => {
11
11
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
12
- }, D = (r, e) => ({
12
+ }, T = (r, e) => ({
13
13
  x: r.scale * e.x + r.x,
14
14
  y: r.scale * e.y + r.y
15
15
  });
16
- class ne {
16
+ class he {
17
17
  constructor(e, t, s) {
18
- o(this, "host", xe());
19
- o(this, "container", Ee());
18
+ o(this, "host", Se());
19
+ o(this, "container", xe());
20
20
  o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
21
  o(this, "applyTransform", () => {
22
22
  const e = this.viewportStore.getContentMatrix();
@@ -26,7 +26,7 @@ class ne {
26
26
  }
27
27
  attachNode(e) {
28
28
  const t = this.graphStore.getNode(e);
29
- Se(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
29
+ be(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
30
  }
31
31
  detachNode(e) {
32
32
  const t = this.graphStore.getNode(e);
@@ -88,7 +88,7 @@ class ne {
88
88
  const h = {
89
89
  x: s.left - i.left,
90
90
  y: s.top - i.top
91
- }, a = D(n, h);
91
+ }, a = T(n, h);
92
92
  return {
93
93
  x: a.x,
94
94
  y: a.y,
@@ -100,7 +100,7 @@ class ne {
100
100
  };
101
101
  }
102
102
  }
103
- class be {
103
+ class Pe {
104
104
  constructor(e) {
105
105
  o(this, "xFrom", 1 / 0);
106
106
  o(this, "yFrom", 1 / 0);
@@ -144,7 +144,7 @@ class Te {
144
144
  this.handleAttachEdge(h);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new be(this.graphStore), this.trigger.subscribe(this.updateViewport);
147
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new Pe(this.graphStore), this.trigger.subscribe(this.updateViewport);
148
148
  }
149
149
  attachNode(e) {
150
150
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -198,7 +198,7 @@ class Te {
198
198
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
199
199
  }
200
200
  }
201
- class he {
201
+ class ae {
202
202
  constructor() {
203
203
  o(this, "callbacks", /* @__PURE__ */ new Set());
204
204
  }
@@ -214,11 +214,11 @@ class he {
214
214
  });
215
215
  }
216
216
  }
217
- const E = () => {
218
- const r = new he();
217
+ const y = () => {
218
+ const r = new ae();
219
219
  return [r, r];
220
220
  };
221
- class Pe {
221
+ class De {
222
222
  constructor(e) {
223
223
  o(this, "onBeforeUpdated");
224
224
  o(this, "onAfterUpdated");
@@ -231,7 +231,7 @@ class Pe {
231
231
  return { ...this.viewportStore.getContentMatrix() };
232
232
  }
233
233
  }
234
- class De {
234
+ class Ne {
235
235
  constructor(e) {
236
236
  o(this, "onAfterNodeAdded");
237
237
  o(this, "onAfterNodeUpdated");
@@ -342,13 +342,13 @@ class W {
342
342
  this.counter = 0;
343
343
  }
344
344
  }
345
- class S extends Error {
345
+ class x extends Error {
346
346
  constructor() {
347
347
  super(...arguments);
348
348
  o(this, "name", "HtmlGraphError");
349
349
  }
350
350
  }
351
- class ae {
351
+ class de {
352
352
  constructor(e, t, s, i, n) {
353
353
  /**
354
354
  * provides api for accessing model of rendered graph
@@ -416,13 +416,13 @@ class ae {
416
416
  * emits event just before destruction of canvas
417
417
  */
418
418
  o(this, "onBeforeDestroy");
419
- this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.defaults = n, this.graph = new De(this.graphStore), this.viewport = new Pe(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
419
+ this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.params = n, this.graph = new Ne(this.graphStore), this.viewport = new De(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
420
420
  this.onAfterNodePriorityUpdated
421
421
  ), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
422
422
  this.onAfterEdgeShapeUpdated
423
423
  ), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
424
424
  this.onAfterEdgePriorityUpdated
425
- ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
425
+ ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = y();
426
426
  }
427
427
  /**
428
428
  * adds new node
@@ -430,9 +430,9 @@ class ae {
430
430
  addNode(e) {
431
431
  const t = this.nodeIdGenerator.create(e.id);
432
432
  if (this.graph.getNode(t) !== null)
433
- throw new S("failed to add node with existing id");
433
+ throw new x("failed to add node with existing id");
434
434
  if (this.graphStore.getElementNodeId(e.element) !== void 0)
435
- throw new S(
435
+ throw new x(
436
436
  "failed to add node with html element already in use by another node"
437
437
  );
438
438
  if (this.graphStore.addNode({
@@ -440,8 +440,8 @@ class ae {
440
440
  element: e.element,
441
441
  x: e.x,
442
442
  y: e.y,
443
- centerFn: e.centerFn ?? this.defaults.nodes.centerFn,
444
- priority: e.priority ?? this.defaults.nodes.priorityFn()
443
+ centerFn: e.centerFn ?? this.params.nodes.centerFn,
444
+ priority: e.priority ?? this.params.nodes.priorityFn()
445
445
  }), e.ports !== void 0)
446
446
  for (const s of e.ports)
447
447
  this.markPort({
@@ -457,7 +457,7 @@ class ae {
457
457
  */
458
458
  updateNode(e, t) {
459
459
  if (this.graph.getNode(e) === null)
460
- throw new S("failed to update non existing node");
460
+ throw new x("failed to update non existing node");
461
461
  return this.graphStore.updateNode(e, t ?? {}), this;
462
462
  }
463
463
  /**
@@ -467,7 +467,7 @@ class ae {
467
467
  */
468
468
  removeNode(e) {
469
469
  if (this.graph.getNode(e) === null)
470
- throw new S("failed to remove non existing node");
470
+ throw new x("failed to remove non existing node");
471
471
  return this.graphStore.removeNode(e), this;
472
472
  }
473
473
  /**
@@ -476,14 +476,14 @@ class ae {
476
476
  markPort(e) {
477
477
  const t = this.portIdGenerator.create(e.id);
478
478
  if (this.graph.getPort(t) !== null)
479
- throw new S("failed to add port with existing id");
479
+ throw new x("failed to add port with existing id");
480
480
  if (this.graph.getNode(e.nodeId) === null)
481
- throw new S("failed to mark port for nonexistent node");
481
+ throw new x("failed to mark port for nonexistent node");
482
482
  return this.graphStore.addPort({
483
483
  id: t,
484
484
  element: e.element,
485
485
  nodeId: e.nodeId,
486
- direction: e.direction ?? this.defaults.ports.direction
486
+ direction: e.direction ?? this.params.ports.direction
487
487
  }), this;
488
488
  }
489
489
  /**
@@ -491,7 +491,7 @@ class ae {
491
491
  */
492
492
  updatePort(e, t) {
493
493
  if (this.graph.getPort(e) === null)
494
- throw new S("failed to update nonexistent port");
494
+ throw new x("failed to update nonexistent port");
495
495
  return this.graphStore.updatePort(e, t ?? {}), this;
496
496
  }
497
497
  /**
@@ -500,7 +500,7 @@ class ae {
500
500
  */
501
501
  unmarkPort(e) {
502
502
  if (this.graph.getPort(e) === null)
503
- throw new S("failed to unmark non existing port");
503
+ throw new x("failed to unmark non existing port");
504
504
  return this.graphStore.removePort(e), this;
505
505
  }
506
506
  /**
@@ -509,17 +509,17 @@ class ae {
509
509
  addEdge(e) {
510
510
  const t = this.edgeIdGenerator.create(e.id);
511
511
  if (this.graph.getEdge(t) !== null)
512
- throw new S("failed to add edge with existing id");
512
+ throw new x("failed to add edge with existing id");
513
513
  if (this.graph.getPort(e.from) === null)
514
- throw new S("failed to add edge from nonexistent port");
514
+ throw new x("failed to add edge from nonexistent port");
515
515
  if (this.graph.getPort(e.to) === null)
516
- throw new S("failed to add edge to nonexistent port");
516
+ throw new x("failed to add edge to nonexistent port");
517
517
  return this.graphStore.addEdge({
518
518
  id: t,
519
519
  from: e.from,
520
520
  to: e.to,
521
- shape: e.shape ?? this.defaults.edges.shapeFactory(t),
522
- priority: e.priority ?? this.defaults.edges.priorityFn()
521
+ shape: e.shape ?? this.params.edges.shapeFactory(t),
522
+ priority: e.priority ?? this.params.edges.priorityFn()
523
523
  }), this;
524
524
  }
525
525
  /**
@@ -527,7 +527,7 @@ class ae {
527
527
  */
528
528
  updateEdge(e, t) {
529
529
  if (this.graph.getEdge(e) === null)
530
- throw new S("failed to update nonexistent edge");
530
+ throw new x("failed to update nonexistent edge");
531
531
  return this.graphStore.updateEdge(e, t ?? {}), this;
532
532
  }
533
533
  /**
@@ -535,7 +535,7 @@ class ae {
535
535
  */
536
536
  removeEdge(e) {
537
537
  if (this.graph.getEdge(e) === null)
538
- throw new S("failed to remove nonexistent edge");
538
+ throw new x("failed to remove nonexistent edge");
539
539
  return this.graphStore.removeEdge(e), this;
540
540
  }
541
541
  /**
@@ -571,7 +571,7 @@ class ae {
571
571
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
572
572
  }
573
573
  }
574
- class Ne {
574
+ class Me {
575
575
  constructor() {
576
576
  o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
577
577
  o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
@@ -611,7 +611,7 @@ class Ne {
611
611
  return this.multiToSingleMap.get(e) !== void 0;
612
612
  }
613
613
  }
614
- class de {
614
+ class ce {
615
615
  constructor() {
616
616
  o(this, "nodes", /* @__PURE__ */ new Map());
617
617
  o(this, "ports", /* @__PURE__ */ new Map());
@@ -620,7 +620,7 @@ class de {
620
620
  o(this, "incomingEdges", /* @__PURE__ */ new Map());
621
621
  o(this, "outcomingEdges", /* @__PURE__ */ new Map());
622
622
  o(this, "cycleEdges", /* @__PURE__ */ new Map());
623
- o(this, "elementPorts", new Ne());
623
+ o(this, "elementPorts", new Me());
624
624
  o(this, "afterNodeAddedEmitter");
625
625
  o(this, "onAfterNodeAdded");
626
626
  o(this, "afterNodeUpdatedEmitter");
@@ -647,7 +647,7 @@ class de {
647
647
  o(this, "onBeforeEdgeRemoved");
648
648
  o(this, "beforeClearEmitter");
649
649
  o(this, "onBeforeClear");
650
- [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = E(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = E(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = E(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = E(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = E(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = E(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = E(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = E(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = E(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = E(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = E(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = E(), [this.beforeClearEmitter, this.onBeforeClear] = E();
650
+ [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = y(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = y(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = y(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = y(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = y(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = y(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = y(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = y(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = y(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = y(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = y(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = y(), [this.beforeClearEmitter, this.onBeforeClear] = y();
651
651
  }
652
652
  addNode(e) {
653
653
  const t = /* @__PURE__ */ new Map(), s = {
@@ -802,7 +802,7 @@ const q = (r) => ({
802
802
  x: 0,
803
803
  y: 0
804
804
  };
805
- class Me {
805
+ class Le {
806
806
  constructor() {
807
807
  o(this, "viewportMatrix", ee);
808
808
  o(this, "contentMatrix", ee);
@@ -810,7 +810,7 @@ class Me {
810
810
  o(this, "onAfterUpdated");
811
811
  o(this, "beforeUpdateEmitter");
812
812
  o(this, "onBeforeUpdated");
813
- [this.afterUpdateEmitter, this.onAfterUpdated] = E(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = E();
813
+ [this.afterUpdateEmitter, this.onAfterUpdated] = y(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = y();
814
814
  }
815
815
  getViewportMatrix() {
816
816
  return this.viewportMatrix;
@@ -866,25 +866,10 @@ class k {
866
866
  this.canvas.updateNode(t);
867
867
  }
868
868
  }
869
- const Le = (r) => {
870
- var p, f, v, A, m, x;
871
- const e = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
872
- }), t = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeNodeDrag) ?? (() => !0), s = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
873
- }), i = (r == null ? void 0 : r.moveOnTop) !== !1, n = (r == null ? void 0 : r.moveEdgesOnTop) !== !1 && i, h = (A = r == null ? void 0 : r.mouse) == null ? void 0 : A.dragCursor, a = h !== void 0 ? h : "grab", d = (m = r == null ? void 0 : r.mouse) == null ? void 0 : m.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, g = (x = r == null ? void 0 : r.mouse) == null ? void 0 : x.mouseUpEventVerifier;
874
- return {
875
- moveOnTop: i,
876
- moveEdgesOnTop: n,
877
- dragCursor: a,
878
- mouseDownEventVerifier: c,
879
- mouseUpEventVerifier: g !== void 0 ? g : (b) => b.button === 0,
880
- onNodeDrag: e,
881
- onBeforeNodeDrag: t,
882
- onNodeDragFinished: s
883
- };
884
- }, Re = (r, e, t) => {
869
+ const Re = (r, e, t) => {
885
870
  const { x: s, y: i, width: n, height: h } = r.getBoundingClientRect();
886
871
  return e >= s && e <= s + n && t >= i && t <= i + h;
887
- }, Ie = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, N = (r, e, t, s) => Re(e, t, s) && Ie(r, t, s), B = (r, e) => {
872
+ }, Ie = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, D = (r, e, t, s) => Re(e, t, s) && Ie(r, t, s), B = (r, e) => {
888
873
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
889
874
  };
890
875
  class z {
@@ -955,7 +940,7 @@ class z {
955
940
  }));
956
941
  });
957
942
  o(this, "onWindowMouseMove", (e) => {
958
- if (!N(
943
+ if (!D(
959
944
  this.window,
960
945
  this.element,
961
946
  e.clientX,
@@ -973,7 +958,7 @@ class z {
973
958
  if (e.touches.length !== 1)
974
959
  return;
975
960
  const t = e.touches[0];
976
- if (!N(
961
+ if (!D(
977
962
  this.window,
978
963
  this.element,
979
964
  t.clientX,
@@ -993,8 +978,7 @@ class z {
993
978
  o(this, "onWindowTouchFinish", () => {
994
979
  this.previousTouchCoordinates = null, this.cancelTouchDrag();
995
980
  });
996
- o(this, "config");
997
- this.canvas = e, this.element = t, this.window = s, this.config = Le(i), this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
981
+ this.canvas = e, this.element = t, this.window = s, this.config = i, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
998
982
  }
999
983
  static configure(e, t, s, i) {
1000
984
  new z(e, t, s, i);
@@ -1003,13 +987,13 @@ class z {
1003
987
  const i = this.graph.getNode(e);
1004
988
  if (i === null)
1005
989
  return;
1006
- const n = this.canvas.viewport.getContentMatrix(), h = D(n, {
990
+ const n = this.canvas.viewport.getContentMatrix(), h = T(n, {
1007
991
  x: i.x,
1008
992
  y: i.y
1009
- }), a = D(
993
+ }), a = T(
1010
994
  { scale: 1, x: t, y: s },
1011
995
  h
1012
- ), d = this.canvas.viewport.getViewportMatrix(), c = D(d, a);
996
+ ), d = this.canvas.viewport.getViewportMatrix(), c = T(d, a);
1013
997
  this.canvas.updateNode(e, { x: c.x, y: c.y }), this.config.onNodeDrag({
1014
998
  nodeId: e,
1015
999
  element: i.element,
@@ -1058,98 +1042,11 @@ class z {
1058
1042
  this.maxNodePriority = Math.max(this.maxNodePriority, t);
1059
1043
  }
1060
1044
  }
1061
- const Be = (r) => {
1062
- const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
1063
- return (n) => {
1064
- let h = n.nextTransform.x, a = n.nextTransform.y;
1065
- h < e && h < n.prevTransform.x && (h = Math.min(n.prevTransform.x, e));
1066
- const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
1067
- h > c && h > n.prevTransform.x && (h = Math.max(n.prevTransform.x, c)), a < s && a < n.prevTransform.y && (a = Math.min(n.prevTransform.y, s));
1068
- const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
1069
- return a > l && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: h, y: a };
1070
- };
1071
- }, Ve = (r) => {
1072
- const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
1073
- return (n) => {
1074
- const h = n.prevTransform, a = n.nextTransform;
1075
- let d = a.scale, c = a.x, g = a.y;
1076
- if (a.scale > i && a.scale > h.scale) {
1077
- d = Math.max(h.scale, i), c = h.x, g = h.y;
1078
- const l = (d - h.scale) / (a.scale - h.scale);
1079
- c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
1080
- }
1081
- if (a.scale < s && a.scale < h.scale) {
1082
- d = Math.min(h.scale, s), c = h.x, g = h.y;
1083
- const l = (d - h.scale) / (a.scale - h.scale);
1084
- c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
1085
- }
1086
- return {
1087
- scale: d,
1088
- x: c,
1089
- y: g
1090
- };
1091
- };
1092
- }, Ue = (r) => (e) => r.reduce(
1093
- (t, s) => s({
1094
- prevTransform: e.prevTransform,
1095
- nextTransform: t,
1096
- canvasWidth: e.canvasWidth,
1097
- canvasHeight: e.canvasHeight
1098
- }),
1099
- e.nextTransform
1100
- ), te = (r) => {
1101
- if (typeof r == "function")
1102
- return r;
1103
- switch (r.type) {
1104
- case "scale-limit":
1105
- return Ve({
1106
- minContentScale: r.minContentScale ?? 0,
1107
- maxContentScale: r.maxContentScale ?? 1 / 0
1108
- });
1109
- case "shift-limit":
1110
- return Be({
1111
- minX: r.minX ?? -1 / 0,
1112
- maxX: r.maxX ?? 1 / 0,
1113
- minY: r.minY ?? -1 / 0,
1114
- maxY: r.maxY ?? 1 / 0
1115
- });
1116
- }
1117
- }, Ce = (r) => {
1118
- var v, A, m, x, b, T, M, L, J, K, Q, _;
1119
- const e = (v = r == null ? void 0 : r.scale) == null ? void 0 : v.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
1120
- let i;
1121
- s !== void 0 ? Array.isArray(s) ? i = Ue(
1122
- s.map(
1123
- (P) => te(P)
1124
- )
1125
- ) : i = te(s) : i = (P) => P.nextTransform;
1126
- const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
1127
- }), a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
1128
- }), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0, p = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, f = p !== void 0 ? p : () => !0;
1129
- return {
1130
- wheelSensitivity: t,
1131
- onTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
1132
- }),
1133
- onTransformFinished: ((J = r == null ? void 0 : r.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
1134
- }),
1135
- onBeforeTransformChange: h,
1136
- onTransformChange: a,
1137
- transformPreprocessor: i,
1138
- shiftCursor: n,
1139
- mouseDownEventVerifier: c,
1140
- mouseUpEventVerifier: l,
1141
- mouseWheelEventVerifier: f,
1142
- scaleWheelFinishTimeout: ((K = r == null ? void 0 : r.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
1143
- onResizeTransformStarted: ((Q = r == null ? void 0 : r.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
1144
- }),
1145
- onResizeTransformFinished: ((_ = r == null ? void 0 : r.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
1146
- })
1147
- };
1148
- }, We = (r, e, t) => ({
1045
+ const Be = (r, e, t) => ({
1149
1046
  scale: r.scale,
1150
1047
  x: r.x + r.scale * e,
1151
1048
  y: r.y + r.scale * t
1152
- }), $e = (r, e, t, s) => ({
1049
+ }), Ve = (r, e, t, s) => ({
1153
1050
  scale: r.scale * e,
1154
1051
  x: r.scale * (1 - e) * t + r.x,
1155
1052
  y: r.scale * (1 - e) * s + r.y
@@ -1182,14 +1079,14 @@ class U {
1182
1079
  this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.observer.unobserve(this.element), this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("wheel", this.onWheelScroll), this.element.removeEventListener("touchstart", this.onTouchStart), this.element.removeEventListener("wheel", this.preventWheelScaleListener), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1183
1080
  });
1184
1081
  o(this, "onMouseDown", (e) => {
1185
- this.element === null || !this.config.mouseDownEventVerifier(e) || (B(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1082
+ this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1186
1083
  passive: !0
1187
1084
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1188
1085
  passive: !0
1189
1086
  }), this.startRegisteredTransform());
1190
1087
  });
1191
1088
  o(this, "onWindowMouseMove", (e) => {
1192
- const t = N(
1089
+ const t = D(
1193
1090
  this.window,
1194
1091
  this.element,
1195
1092
  e.clientX,
@@ -1203,15 +1100,15 @@ class U {
1203
1100
  this.moveViewport(s, i);
1204
1101
  });
1205
1102
  o(this, "onWindowMouseUp", (e) => {
1206
- this.element === null || !this.config.mouseUpEventVerifier(e) || this.stopMouseDrag();
1103
+ this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
1207
1104
  });
1208
1105
  o(this, "onWheelScroll", (e) => {
1209
- if (!this.config.mouseWheelEventVerifier(e))
1106
+ if (!this.params.mouseWheelEventVerifier(e))
1210
1107
  return;
1211
- const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, a = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
1212
- this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(a, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
1213
- this.transformInProgress || this.config.onTransformFinished(), this.wheelFinishTimer = null;
1214
- }, this.config.scaleWheelFinishTimeout);
1108
+ const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, a = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
1109
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(a, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
1110
+ this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
1111
+ }, this.params.scaleWheelFinishTimeout);
1215
1112
  });
1216
1113
  o(this, "onTouchStart", (e) => {
1217
1114
  if (this.prevTouches !== null) {
@@ -1229,7 +1126,7 @@ class U {
1229
1126
  o(this, "onWindowTouchMove", (e) => {
1230
1127
  const t = I(e);
1231
1128
  if (!t.touches.every(
1232
- (i) => N(this.window, this.element, i[0], i[1])
1129
+ (i) => D(this.window, this.element, i[0], i[1])
1233
1130
  )) {
1234
1131
  this.stopTouchDrag();
1235
1132
  return;
@@ -1247,21 +1144,20 @@ class U {
1247
1144
  e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
1248
1145
  });
1249
1146
  o(this, "observer", new ResizeObserver(() => {
1250
- const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.config.transformPreprocessor({
1147
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
1251
1148
  prevTransform: e,
1252
1149
  nextTransform: e,
1253
1150
  canvasWidth: t,
1254
1151
  canvasHeight: s
1255
1152
  });
1256
- this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.config.onResizeTransformFinished();
1153
+ this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
1257
1154
  }));
1258
- o(this, "config");
1259
1155
  o(this, "preventWheelScaleListener", (e) => {
1260
1156
  e.preventDefault();
1261
1157
  });
1262
- this.canvas = e, this.element = t, this.window = s, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
1158
+ this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
1263
1159
  passive: !1
1264
- }), this.config = Ce(i), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
1160
+ }), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
1265
1161
  passive: !0
1266
1162
  }), this.element.addEventListener("wheel", this.onWheelScroll, {
1267
1163
  passive: !0
@@ -1270,15 +1166,10 @@ class U {
1270
1166
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1271
1167
  }
1272
1168
  static configure(e, t, s, i) {
1273
- new U(
1274
- e,
1275
- t,
1276
- s,
1277
- i
1278
- );
1169
+ new U(e, t, s, i);
1279
1170
  }
1280
1171
  moveViewport(e, t) {
1281
- const s = this.viewport.getViewportMatrix(), i = We(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.config.transformPreprocessor({
1172
+ const s = this.viewport.getViewportMatrix(), i = Be(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.params.transformPreprocessor({
1282
1173
  prevTransform: s,
1283
1174
  nextTransform: i,
1284
1175
  canvasWidth: n,
@@ -1287,7 +1178,7 @@ class U {
1287
1178
  this.performTransform(a);
1288
1179
  }
1289
1180
  scaleViewport(e, t, s) {
1290
- const i = this.canvas.viewport.getViewportMatrix(), n = $e(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
1181
+ const i = this.canvas.viewport.getViewportMatrix(), n = Ve(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
1291
1182
  prevTransform: i,
1292
1183
  nextTransform: n,
1293
1184
  canvasWidth: h,
@@ -1308,13 +1199,13 @@ class U {
1308
1199
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
1309
1200
  }
1310
1201
  performTransform(e) {
1311
- this.config.onBeforeTransformChange(), this.canvas.patchViewportMatrix(e), this.config.onTransformChange();
1202
+ this.params.onBeforeTransformChange(), this.canvas.patchViewportMatrix(e), this.params.onTransformChange();
1312
1203
  }
1313
1204
  startRegisteredTransform() {
1314
- this.transformInProgress = !0, this.config.onTransformStarted();
1205
+ this.transformInProgress = !0, this.params.onTransformStarted();
1315
1206
  }
1316
1207
  finishRegisteredTransform() {
1317
- this.transformInProgress = !1, this.config.onTransformFinished();
1208
+ this.transformInProgress = !1, this.params.onTransformFinished();
1318
1209
  }
1319
1210
  }
1320
1211
  class X {
@@ -1349,44 +1240,35 @@ class X {
1349
1240
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
1350
1241
  });
1351
1242
  o(this, "userTransformInProgress", !1);
1352
- var f, v, A, m, x;
1353
- this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.virtualScrollOptions = h, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((b) => {
1354
- const T = b[0];
1355
- this.viewportWidth = T.contentRect.width, this.viewportHeight = T.contentRect.height, this.scheduleLoadAreaAroundViewport();
1243
+ this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = h, this.nodeHorizontal = this.params.nodeContainingRadius.horizontal, this.nodeVertical = this.params.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((d) => {
1244
+ const c = d[0];
1245
+ this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
1356
1246
  }), this.viewport = e.viewport;
1357
- const a = ((f = i == null ? void 0 : i.events) == null ? void 0 : f.onResizeTransformStarted) ?? (() => {
1358
- }), d = ((v = i == null ? void 0 : i.events) == null ? void 0 : v.onResizeTransformFinished) ?? (() => {
1359
- }), c = ((A = i == null ? void 0 : i.events) == null ? void 0 : A.onTransformChange) ?? (() => {
1360
- }), g = ((m = i == null ? void 0 : i.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
1361
- }), l = ((x = i == null ? void 0 : i.events) == null ? void 0 : x.onTransformFinished) ?? (() => {
1362
- }), p = {
1247
+ const a = {
1363
1248
  ...i,
1364
- events: {
1365
- ...i == null ? void 0 : i.events,
1366
- onResizeTransformStarted: () => {
1367
- this.userTransformInProgress = !0, a();
1368
- },
1369
- onResizeTransformFinished: () => {
1370
- this.userTransformInProgress = !1, d();
1371
- },
1372
- onBeforeTransformChange: () => {
1373
- this.userTransformInProgress = !0, g();
1374
- },
1375
- onTransformChange: () => {
1376
- this.userTransformInProgress = !1;
1377
- const b = this.viewportMatrix;
1378
- this.viewportMatrix = this.viewport.getViewportMatrix(), b.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), c();
1379
- },
1380
- onTransformFinished: () => {
1381
- this.scheduleLoadAreaAroundViewport(), l();
1382
- }
1249
+ onResizeTransformStarted: () => {
1250
+ this.userTransformInProgress = !0, i.onResizeTransformStarted();
1251
+ },
1252
+ onResizeTransformFinished: () => {
1253
+ this.userTransformInProgress = !1, i.onResizeTransformFinished();
1254
+ },
1255
+ onBeforeTransformChange: () => {
1256
+ this.userTransformInProgress = !0, i.onBeforeTransformChange();
1257
+ },
1258
+ onTransformChange: () => {
1259
+ this.userTransformInProgress = !1;
1260
+ const d = this.viewportMatrix;
1261
+ this.viewportMatrix = this.viewport.getViewportMatrix(), d.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), i.onTransformChange();
1262
+ },
1263
+ onTransformFinished: () => {
1264
+ this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
1383
1265
  }
1384
1266
  };
1385
1267
  U.configure(
1386
1268
  e,
1387
1269
  this.element,
1388
1270
  this.window,
1389
- p
1271
+ a
1390
1272
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1391
1273
  }
1392
1274
  static configure(e, t, s, i, n, h) {
@@ -1413,41 +1295,24 @@ class X {
1413
1295
  this.trigger.emit({ x: s, y: i, width: n, height: h });
1414
1296
  }
1415
1297
  }
1416
- const Fe = () => {
1298
+ const Ue = () => {
1417
1299
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1418
1300
  return r.style.position = "absolute", r.style.inset = "0", r;
1419
- }, Oe = () => {
1301
+ }, Ce = () => {
1420
1302
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
1421
1303
  return r.setAttribute("fill", "url(#pattern)"), r;
1422
- }, ke = () => {
1304
+ }, We = () => {
1423
1305
  const r = document.createElementNS(
1424
1306
  "http://www.w3.org/2000/svg",
1425
1307
  "pattern"
1426
1308
  );
1427
1309
  return r.setAttribute("id", "pattern"), r;
1428
- }, ze = (r, e) => {
1429
- const t = document.createElementNS(
1430
- "http://www.w3.org/2000/svg",
1431
- "circle"
1432
- );
1433
- return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
1434
- }, Xe = (r) => r instanceof SVGElement ? r : ze(
1435
- (r == null ? void 0 : r.radius) ?? 1.5,
1436
- (r == null ? void 0 : r.color) ?? "#d8d8d8"
1437
- ), Ye = (r) => {
1438
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Xe(r.renderer ?? {});
1439
- return {
1440
- tileWidth: t,
1441
- tileHeight: s,
1442
- renderer: i,
1443
- maxViewportScale: r.maxViewportScale ?? 10
1444
- };
1445
1310
  };
1446
1311
  class Y {
1447
1312
  constructor(e, t, s) {
1448
- o(this, "svg", Fe());
1449
- o(this, "patternRenderingRectangle", Oe());
1450
- o(this, "pattern", ke());
1313
+ o(this, "svg", Ue());
1314
+ o(this, "patternRenderingRectangle", Ce());
1315
+ o(this, "pattern", We());
1451
1316
  o(this, "patternContent");
1452
1317
  o(this, "tileWidth");
1453
1318
  o(this, "tileHeight");
@@ -1470,13 +1335,11 @@ class Y {
1470
1335
  this.onAfterTransformUpdated
1471
1336
  ), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1472
1337
  });
1473
- this.canvas = e, this.host = s;
1474
- const i = Ye(t);
1475
- this.tileWidth = i.tileWidth, this.tileHeight = i.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = i.renderer, this.maxViewportScale = i.maxViewportScale;
1476
- const n = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
1477
- this.patternContent.setAttribute("transform", n), this.pattern.appendChild(this.patternContent);
1478
- const h = document.createElementNS("http://www.w3.org/2000/svg", "defs");
1479
- h.appendChild(this.pattern), this.svg.appendChild(h), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1338
+ this.canvas = e, this.host = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
1339
+ const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
1340
+ this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
1341
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
1342
+ n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1480
1343
  }
1481
1344
  static configure(e, t, s) {
1482
1345
  new Y(e, t, s);
@@ -1486,7 +1349,7 @@ class Y {
1486
1349
  t && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
1487
1350
  }
1488
1351
  }
1489
- const ce = (r, e) => ({
1352
+ const le = (r, e) => ({
1490
1353
  x: r / 2,
1491
1354
  y: e / 2
1492
1355
  });
@@ -1507,14 +1370,14 @@ class H {
1507
1370
  });
1508
1371
  o(this, "onPortMouseDown", (e) => {
1509
1372
  const t = e.currentTarget;
1510
- this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(t) && (e.stopPropagation(), this.grabPort(t, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1373
+ this.params.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(t) && (e.stopPropagation(), this.grabPort(t, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1511
1374
  passive: !0
1512
1375
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1513
1376
  passive: !0
1514
1377
  }));
1515
1378
  });
1516
1379
  o(this, "onWindowMouseMove", (e) => {
1517
- if (!N(
1380
+ if (!D(
1518
1381
  this.window,
1519
1382
  this.overlayLayer,
1520
1383
  e.clientX,
@@ -1526,7 +1389,7 @@ class H {
1526
1389
  this.moveDraggingNode({ x: e.clientX, y: e.clientY });
1527
1390
  });
1528
1391
  o(this, "onWindowMouseUp", (e) => {
1529
- this.config.mouseUpEventVerifier(e) && (this.tryCreateConnection({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
1392
+ this.params.mouseUpEventVerifier(e) && (this.tryCreateConnection({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
1530
1393
  });
1531
1394
  o(this, "onPortTouchStart", (e) => {
1532
1395
  const t = e.currentTarget;
@@ -1544,7 +1407,7 @@ class H {
1544
1407
  });
1545
1408
  o(this, "onWindowTouchMove", (e) => {
1546
1409
  const t = e.touches[0];
1547
- if (!N(
1410
+ if (!D(
1548
1411
  this.window,
1549
1412
  this.overlayLayer,
1550
1413
  t.clientX,
@@ -1571,27 +1434,27 @@ class H {
1571
1434
  ), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1572
1435
  });
1573
1436
  o(this, "onEdgeCreated", (e) => {
1574
- this.config.onAfterEdgeCreated(e);
1437
+ this.params.onAfterEdgeCreated(e);
1575
1438
  });
1576
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config = n;
1577
- const h = new de(), a = new ne(
1439
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n;
1440
+ const h = new ce(), a = new he(
1578
1441
  h,
1579
1442
  this.viewportStore,
1580
1443
  this.overlayLayer
1581
1444
  ), d = {
1582
1445
  nodes: {
1583
- centerFn: ce,
1446
+ centerFn: le,
1584
1447
  priorityFn: () => 0
1585
1448
  },
1586
1449
  edges: {
1587
- shapeFactory: this.config.edgeShapeFactory,
1450
+ shapeFactory: this.params.edgeShapeFactory,
1588
1451
  priorityFn: () => 0
1589
1452
  },
1590
1453
  ports: {
1591
1454
  direction: 0
1592
1455
  }
1593
1456
  };
1594
- this.overlayCanvas = new ae(
1457
+ this.overlayCanvas = new de(
1595
1458
  this.overlayLayer,
1596
1459
  h,
1597
1460
  this.viewportStore,
@@ -1611,10 +1474,10 @@ class H {
1611
1474
  grabPort(e, t) {
1612
1475
  const s = this.canvas.graph.getElementPortsIds(e)[0], i = this.canvas.graph.getPort(s);
1613
1476
  this.staticPortId = s;
1614
- const n = this.config.connectionTypeResolver(this.staticPortId), h = e.getBoundingClientRect(), a = h.x + h.width / 2, d = h.y + h.height / 2, c = this.overlayLayer.getBoundingClientRect(), g = this.canvas.viewport.getViewportMatrix(), l = D(g, {
1477
+ const n = this.params.connectionTypeResolver(this.staticPortId), h = e.getBoundingClientRect(), a = h.x + h.width / 2, d = h.y + h.height / 2, c = this.overlayLayer.getBoundingClientRect(), g = this.canvas.viewport.getViewportMatrix(), l = T(g, {
1615
1478
  x: a - c.x,
1616
1479
  y: d - c.y
1617
- }), p = D(g, {
1480
+ }), p = T(g, {
1618
1481
  x: t.x - c.x,
1619
1482
  y: t.y - c.y
1620
1483
  }), f = {
@@ -1624,11 +1487,11 @@ class H {
1624
1487
  }, v = {
1625
1488
  overlayId: this.draggingOverlayPortId,
1626
1489
  portCoords: p,
1627
- portDirection: this.config.dragPortDirection
1490
+ portDirection: this.params.dragPortDirection
1628
1491
  };
1629
1492
  this.isDirect = n === "direct";
1630
- const A = this.isDirect ? f : v, m = this.isDirect ? v : f;
1631
- this.createOverlayGraph(A, m);
1493
+ const E = this.isDirect ? f : v, A = this.isDirect ? v : f;
1494
+ this.createOverlayGraph(E, A);
1632
1495
  }
1633
1496
  hookPortEvents(e) {
1634
1497
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -1677,17 +1540,17 @@ class H {
1677
1540
  tryCreateConnection(e) {
1678
1541
  const t = this.findPortAtPoint(e);
1679
1542
  if (t === null) {
1680
- this.config.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
1543
+ this.params.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
1681
1544
  return;
1682
1545
  }
1683
- const s = this.isDirect ? this.staticPortId : t, i = this.isDirect ? t : this.staticPortId, n = { from: s, to: i }, h = this.config.connectionPreprocessor(n);
1684
- h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.config.onEdgeCreationPrevented(n);
1546
+ const s = this.isDirect ? this.staticPortId : t, i = this.isDirect ? t : this.staticPortId, n = { from: s, to: i }, h = this.params.connectionPreprocessor(n);
1547
+ h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(n);
1685
1548
  }
1686
1549
  moveDraggingNode(e) {
1687
1550
  const t = this.overlayLayer.getBoundingClientRect(), s = {
1688
1551
  x: e.x - t.x,
1689
1552
  y: e.y - t.y
1690
- }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
1553
+ }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, s);
1691
1554
  this.overlayCanvas.updateNode(this.draggingOverlayPortId, {
1692
1555
  x: n.x,
1693
1556
  y: n.y
@@ -1710,57 +1573,57 @@ class H {
1710
1573
  }
1711
1574
  isPortConnectionAllowed(e) {
1712
1575
  const t = this.canvas.graph.getElementPortsIds(e)[0];
1713
- return this.config.connectionTypeResolver(t) !== null;
1576
+ return this.params.connectionTypeResolver(t) !== null;
1714
1577
  }
1715
1578
  }
1716
- const He = () => {
1579
+ const $e = () => {
1717
1580
  const r = document.createElement("div");
1718
1581
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
1719
1582
  }, $ = () => {
1720
1583
  const r = document.createElement("div");
1721
1584
  return r.style.position = "absolute", r.style.inset = "0", r;
1722
1585
  };
1723
- class je {
1586
+ class Oe {
1724
1587
  constructor(e) {
1725
1588
  o(this, "background", $());
1726
1589
  o(this, "main", $());
1727
1590
  o(this, "overlay", $());
1728
- o(this, "host", He());
1591
+ o(this, "host", $e());
1729
1592
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.overlay.style.pointerEvents = "none", this.host.appendChild(this.overlay);
1730
1593
  }
1731
1594
  destroy() {
1732
1595
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
1733
1596
  }
1734
1597
  }
1735
- const F = (r) => () => r, re = F(0), Ge = () => {
1598
+ const O = (r) => () => r, te = O(0), Fe = () => {
1736
1599
  let r = 0;
1737
1600
  return () => r++;
1738
- }, Ze = (r, e) => {
1739
- let t = re, s = re;
1740
- const i = Ge();
1741
- return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = F(r)), typeof e == "number" && (s = F(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
1601
+ }, ke = (r, e) => {
1602
+ let t = te, s = te;
1603
+ const i = Fe();
1604
+ return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = O(r)), typeof e == "number" && (s = O(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
1742
1605
  nodesPriorityFn: t,
1743
1606
  edgesPriorityFn: s
1744
1607
  };
1745
- }, y = (r, e, t) => ({
1608
+ }, m = (r, e, t) => ({
1746
1609
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
1747
1610
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
1748
1611
  }), w = {
1749
1612
  x: 0,
1750
1613
  y: 0
1751
1614
  };
1752
- class Je {
1615
+ class ze {
1753
1616
  constructor(e) {
1754
1617
  o(this, "path");
1755
- o(this, "median");
1618
+ o(this, "midpoint");
1756
1619
  this.params = e;
1757
1620
  const t = this.params.to;
1758
- this.median = { x: t.x / 2, y: t.y / 2 };
1759
- const s = y(
1621
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1622
+ const s = m(
1760
1623
  { x: this.params.arrowLength, y: w.y },
1761
1624
  this.params.sourceDirection,
1762
1625
  w
1763
- ), i = y(
1626
+ ), i = m(
1764
1627
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
1765
1628
  this.params.targetDirection,
1766
1629
  this.params.to
@@ -1774,34 +1637,34 @@ class Je {
1774
1637
  this.path = `${d}${a}${c}`;
1775
1638
  }
1776
1639
  }
1777
- const le = (r, e, t, s) => ({
1640
+ const ge = (r, e, t, s) => ({
1778
1641
  x: e * r.x + (1 - e) / 2 * s.x,
1779
1642
  y: t * r.y + (1 - t) / 2 * s.y
1780
1643
  });
1781
- class Ke {
1644
+ class Xe {
1782
1645
  constructor(e) {
1783
1646
  o(this, "path");
1784
- o(this, "median");
1647
+ o(this, "midpoint");
1785
1648
  this.params = e;
1786
- const t = this.params.hasSourceArrow ? y(
1649
+ const t = this.params.hasSourceArrow ? m(
1787
1650
  { x: this.params.arrowLength, y: w.y },
1788
1651
  this.params.sourceDirection,
1789
1652
  w
1790
- ) : w, s = this.params.hasTargetArrow ? y(
1653
+ ) : w, s = this.params.hasTargetArrow ? m(
1791
1654
  {
1792
1655
  x: this.params.to.x - this.params.arrowLength,
1793
1656
  y: this.params.to.y
1794
1657
  },
1795
1658
  this.params.targetDirection,
1796
1659
  this.params.to
1797
- ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c = y(
1660
+ ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c = m(
1798
1661
  { x: i, y: w.y },
1799
1662
  this.params.sourceDirection,
1800
1663
  w
1801
1664
  ), g = {
1802
1665
  x: c.x + a,
1803
1666
  y: c.y + d
1804
- }, l = y(
1667
+ }, l = m(
1805
1668
  { x: this.params.to.x - i, y: this.params.to.y },
1806
1669
  this.params.targetDirection,
1807
1670
  this.params.to
@@ -1814,23 +1677,23 @@ class Ke {
1814
1677
  }, v = {
1815
1678
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
1816
1679
  y: c.y + this.params.curvature * this.params.sourceDirection.y
1817
- }, A = {
1680
+ }, E = {
1818
1681
  x: l.x - this.params.curvature * this.params.targetDirection.x,
1819
1682
  y: l.y - this.params.curvature * this.params.targetDirection.y
1820
- }, m = {
1683
+ }, A = {
1821
1684
  x: c.x + a,
1822
1685
  y: c.y + d
1823
- }, x = {
1686
+ }, S = {
1824
1687
  x: l.x + a,
1825
1688
  y: l.y + d
1826
1689
  };
1827
1690
  this.path = [
1828
1691
  `M ${t.x} ${t.y}`,
1829
1692
  `L ${c.x} ${c.y}`,
1830
- `C ${v.x} ${v.y} ${m.x} ${m.y} ${f.x} ${f.y}`,
1831
- `C ${x.x} ${x.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
1693
+ `C ${v.x} ${v.y} ${A.x} ${A.y} ${f.x} ${f.y}`,
1694
+ `C ${S.x} ${S.y} ${E.x} ${E.y} ${l.x} ${l.y}`,
1832
1695
  `L ${s.x} ${s.y}`
1833
- ].join(" "), this.median = le(f, e.flipX, e.flipY, e.to);
1696
+ ].join(" "), this.midpoint = ge(f, e.flipX, e.flipY, e.to);
1834
1697
  }
1835
1698
  }
1836
1699
  const R = (r, e) => {
@@ -1845,37 +1708,37 @@ const R = (r, e) => {
1845
1708
  const L = r[d + 1];
1846
1709
  i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
1847
1710
  }
1848
- const m = h !== 0 ? Math.min((v ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, x = v ? { x: a.x + i * m, y: a.y + n * m } : a, T = l !== 0 ? Math.min((v ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = v ? { x: a.x + c * T, y: a.y + g * T } : a;
1711
+ const A = h !== 0 ? Math.min((v ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, S = v ? { x: a.x + i * A, y: a.y + n * A } : a, N = l !== 0 ? Math.min((v ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = v ? { x: a.x + c * N, y: a.y + g * N } : a;
1849
1712
  d > 0 && t.push(`L ${M.x} ${M.y}`), v && t.push(
1850
- `C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
1713
+ `C ${a.x} ${a.y} ${a.x} ${a.y} ${S.x} ${S.y}`
1851
1714
  );
1852
1715
  });
1853
1716
  }
1854
1717
  return t.join(" ");
1855
1718
  };
1856
- class Qe {
1719
+ class Ye {
1857
1720
  constructor(e) {
1858
1721
  o(this, "path");
1859
- o(this, "median");
1722
+ o(this, "midpoint");
1860
1723
  this.params = e;
1861
1724
  const t = this.params.to;
1862
- this.median = { x: t.x / 2, y: t.y / 2 };
1863
- const s = this.params.hasSourceArrow ? y(
1725
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1726
+ const s = this.params.hasSourceArrow ? m(
1864
1727
  { x: this.params.arrowLength, y: w.y },
1865
1728
  this.params.sourceDirection,
1866
1729
  w
1867
- ) : w, i = this.params.hasTargetArrow ? y(
1730
+ ) : w, i = this.params.hasTargetArrow ? m(
1868
1731
  {
1869
1732
  x: this.params.to.x - this.params.arrowLength,
1870
1733
  y: this.params.to.y
1871
1734
  },
1872
1735
  this.params.targetDirection,
1873
1736
  this.params.to
1874
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
1737
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = m(
1875
1738
  { x: h, y: w.y },
1876
1739
  this.params.sourceDirection,
1877
1740
  w
1878
- ), d = y(
1741
+ ), d = m(
1879
1742
  { x: this.params.to.x - h, y: this.params.to.y },
1880
1743
  this.params.targetDirection,
1881
1744
  this.params.to
@@ -1895,57 +1758,57 @@ class Qe {
1895
1758
  class j {
1896
1759
  constructor(e) {
1897
1760
  o(this, "path");
1898
- o(this, "median");
1761
+ o(this, "midpoint");
1899
1762
  this.params = e;
1900
- const t = this.params.hasSourceArrow ? y(
1763
+ const t = this.params.hasSourceArrow ? m(
1901
1764
  { x: this.params.arrowLength, y: w.y },
1902
1765
  this.params.sourceDirection,
1903
1766
  w
1904
- ) : w, s = this.params.hasTargetArrow ? y(
1767
+ ) : w, s = this.params.hasTargetArrow ? m(
1905
1768
  {
1906
1769
  x: this.params.to.x - this.params.arrowLength,
1907
1770
  y: this.params.to.y
1908
1771
  },
1909
1772
  this.params.targetDirection,
1910
1773
  this.params.to
1911
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1774
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1912
1775
  { x: i, y: w.y },
1913
1776
  this.params.sourceDirection,
1914
1777
  w
1915
- ), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = y(
1778
+ ), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
1916
1779
  { x: this.params.to.x - i, y: this.params.to.y },
1917
1780
  this.params.targetDirection,
1918
1781
  this.params.to
1919
1782
  ), p = { x: l.x + d, y: l.y + c }, f = { x: (g.x + p.x) / 2, y: (g.y + p.y) / 2 };
1920
- this.median = le(f, e.flipX, e.flipY, e.to), this.path = R(
1783
+ this.midpoint = ge(f, e.flipX, e.flipY, e.to), this.path = R(
1921
1784
  [t, n, g, p, l, s],
1922
1785
  this.params.roundness
1923
1786
  );
1924
1787
  }
1925
1788
  }
1926
- class _e {
1789
+ class He {
1927
1790
  constructor(e) {
1928
1791
  o(this, "path");
1929
- o(this, "median");
1792
+ o(this, "midpoint");
1930
1793
  this.params = e;
1931
1794
  const t = this.params.to;
1932
- this.median = { x: t.x / 2, y: t.y / 2 };
1933
- const s = this.params.hasSourceArrow ? y(
1795
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1796
+ const s = this.params.hasSourceArrow ? m(
1934
1797
  { x: this.params.arrowLength, y: w.y },
1935
1798
  this.params.sourceDirection,
1936
1799
  w
1937
- ) : w, i = this.params.hasTargetArrow ? y(
1800
+ ) : w, i = this.params.hasTargetArrow ? m(
1938
1801
  {
1939
1802
  x: this.params.to.x - this.params.arrowLength,
1940
1803
  y: this.params.to.y
1941
1804
  },
1942
1805
  this.params.targetDirection,
1943
1806
  this.params.to
1944
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = y(
1807
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = m(
1945
1808
  { x: n, y: w.y },
1946
1809
  this.params.sourceDirection,
1947
1810
  w
1948
- ), a = y(
1811
+ ), a = m(
1949
1812
  { x: this.params.to.x - n, y: this.params.to.y },
1950
1813
  this.params.targetDirection,
1951
1814
  this.params.to
@@ -1953,29 +1816,29 @@ class _e {
1953
1816
  this.path = R([s, h, a, i], this.params.roundness);
1954
1817
  }
1955
1818
  }
1956
- class qe {
1819
+ class je {
1957
1820
  constructor(e) {
1958
1821
  o(this, "path");
1959
- o(this, "median");
1822
+ o(this, "midpoint");
1960
1823
  this.params = e;
1961
1824
  const t = this.params.to;
1962
- this.median = { x: t.x / 2, y: t.y / 2 };
1963
- const s = this.params.hasSourceArrow ? y(
1825
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1826
+ const s = this.params.hasSourceArrow ? m(
1964
1827
  { x: this.params.arrowLength, y: w.y },
1965
1828
  this.params.sourceDirection,
1966
1829
  w
1967
- ) : w, i = this.params.hasTargetArrow ? y(
1830
+ ) : w, i = this.params.hasTargetArrow ? m(
1968
1831
  {
1969
1832
  x: this.params.to.x - this.params.arrowLength,
1970
1833
  y: this.params.to.y
1971
1834
  },
1972
1835
  this.params.targetDirection,
1973
1836
  this.params.to
1974
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
1837
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = m(
1975
1838
  { x: h, y: w.y },
1976
1839
  this.params.sourceDirection,
1977
1840
  w
1978
- ), d = y(
1841
+ ), d = m(
1979
1842
  { x: this.params.to.x - h, y: this.params.to.y },
1980
1843
  this.params.targetDirection,
1981
1844
  this.params.to
@@ -1995,7 +1858,7 @@ class qe {
1995
1858
  class G {
1996
1859
  constructor(e) {
1997
1860
  o(this, "path");
1998
- o(this, "median");
1861
+ o(this, "midpoint");
1999
1862
  this.params = e;
2000
1863
  const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, a = [
2001
1864
  { x: this.params.arrowLength, y: w.y },
@@ -2007,15 +1870,15 @@ class G {
2007
1870
  { x: i, y: w.y },
2008
1871
  { x: this.params.arrowLength, y: w.y }
2009
1872
  ].map(
2010
- (c) => y(c, this.params.sourceDirection, w)
1873
+ (c) => m(c, this.params.sourceDirection, w)
2011
1874
  ), d = `M ${w.x} ${w.y} L ${a[0].x} ${a[0].y} `;
2012
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(a, this.params.roundness)}`, this.median = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
1875
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(a, this.params.roundness)}`, this.midpoint = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
2013
1876
  }
2014
1877
  }
2015
- class et {
1878
+ class Ge {
2016
1879
  constructor(e) {
2017
1880
  o(this, "path");
2018
- o(this, "median");
1881
+ o(this, "midpoint");
2019
1882
  this.params = e;
2020
1883
  const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, h = Math.sqrt(i * i - t * t), a = h * t / i, d = h + s + this.params.arrowLength, c = this.params.arrowLength + a, l = [
2021
1884
  { x: this.params.arrowLength, y: w.y },
@@ -2023,24 +1886,24 @@ class et {
2023
1886
  { x: c, y: -n },
2024
1887
  { x: d, y: 0 }
2025
1888
  ].map(
2026
- (v) => y(v, this.params.sourceDirection, w)
1889
+ (v) => m(v, this.params.sourceDirection, w)
2027
1890
  ), p = [
2028
1891
  `M ${l[0].x} ${l[0].y}`,
2029
1892
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
2030
1893
  `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
2031
1894
  `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
2032
1895
  ].join(" "), f = `M 0 0 L ${l[0].x} ${l[0].y} `;
2033
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.median = l[3];
1896
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.midpoint = l[3];
2034
1897
  }
2035
1898
  }
2036
- class tt {
1899
+ class Ze {
2037
1900
  constructor(e) {
2038
1901
  o(this, "path");
2039
- o(this, "median");
1902
+ o(this, "midpoint");
2040
1903
  o(this, "diagonalDistance");
2041
1904
  this.params = e;
2042
1905
  const t = this.params.to;
2043
- if (this.median = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
1906
+ if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
2044
1907
  this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
2045
1908
  ), Math.sqrt(
2046
1909
  this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
@@ -2069,23 +1932,23 @@ class tt {
2069
1932
  };
2070
1933
  }
2071
1934
  }
2072
- const ge = (r, e) => {
1935
+ const ue = (r, e) => {
2073
1936
  r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
2074
1937
  }, Z = Object.freeze({
2075
1938
  edgeColor: "--edge-color"
2076
- }), ue = (r) => {
1939
+ }), we = (r) => {
2077
1940
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2078
1941
  return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
2079
1942
  }, V = () => {
2080
1943
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
2081
1944
  return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
2082
- }, we = () => {
1945
+ }, pe = () => {
2083
1946
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2084
1947
  return r.style.transformOrigin = "50% 50%", r;
2085
- }, pe = (r) => {
1948
+ }, fe = (r) => {
2086
1949
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2087
1950
  return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
2088
- }, fe = (r, e) => {
1951
+ }, ve = (r, e) => {
2089
1952
  const t = {
2090
1953
  x: r.x + r.width / 2,
2091
1954
  y: r.y + r.height / 2
@@ -2101,12 +1964,12 @@ const ge = (r, e) => {
2101
1964
  flipX: d,
2102
1965
  flipY: c
2103
1966
  };
2104
- }, O = (r, e, t, s) => {
1967
+ }, F = (r, e, t, s) => {
2105
1968
  const n = [
2106
1969
  w,
2107
1970
  { x: t, y: s },
2108
1971
  { x: t, y: -s }
2109
- ].map((c) => y(c, r, w)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), h = `M ${n[0].x} ${n[0].y}`, a = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
1972
+ ].map((c) => m(c, r, w)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), h = `M ${n[0].x} ${n[0].y}`, a = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
2110
1973
  return `${h} ${a} ${d} Z`;
2111
1974
  }, u = Object.freeze({
2112
1975
  color: "#777777",
@@ -2126,29 +1989,29 @@ const ge = (r, e) => {
2126
1989
  curvature: 90,
2127
1990
  interactiveWidth: 10,
2128
1991
  preOffset: 0
2129
- }), oe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1992
+ }), re = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
2130
1993
  class C {
2131
1994
  constructor(e) {
2132
1995
  o(this, "svg");
2133
- o(this, "group", we());
1996
+ o(this, "group", pe());
2134
1997
  o(this, "line");
2135
1998
  o(this, "sourceArrow", null);
2136
1999
  o(this, "targetArrow", null);
2137
2000
  o(this, "onAfterRender");
2138
2001
  o(this, "afterRenderEmitter");
2139
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg = ue(e.color), this.svg.appendChild(this.group), this.line = pe(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2002
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = y(), this.svg = we(e.color), this.svg.appendChild(this.group), this.line = fe(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2140
2003
  }
2141
2004
  render(e) {
2142
- const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = fe(
2005
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = ve(
2143
2006
  e.from,
2144
2007
  e.to
2145
2008
  );
2146
- ge(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2147
- const d = oe(
2009
+ ue(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2010
+ const d = re(
2148
2011
  e.from.direction,
2149
2012
  h,
2150
2013
  a
2151
- ), c = oe(
2014
+ ), c = re(
2152
2015
  e.to.direction,
2153
2016
  h,
2154
2017
  a
@@ -2166,27 +2029,27 @@ class C {
2166
2029
  a
2167
2030
  );
2168
2031
  this.line.setAttribute("d", v.path);
2169
- let A = null;
2170
- this.sourceArrow && (A = O(
2032
+ let E = null;
2033
+ this.sourceArrow && (E = F(
2171
2034
  d,
2172
2035
  w,
2173
2036
  this.params.arrowLength,
2174
2037
  this.params.arrowWidth
2175
- ), this.sourceArrow.setAttribute("d", A));
2176
- let m = null;
2177
- this.targetArrow && (m = O(
2038
+ ), this.sourceArrow.setAttribute("d", E));
2039
+ let A = null;
2040
+ this.targetArrow && (A = F(
2178
2041
  l,
2179
2042
  g,
2180
2043
  p,
2181
2044
  this.params.arrowWidth
2182
- ), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
2045
+ ), this.targetArrow.setAttribute("d", A)), this.afterRenderEmitter.emit({
2183
2046
  edgePath: v,
2184
- sourceArrowPath: A,
2185
- targetArrowPath: m
2047
+ sourceArrowPath: E,
2048
+ targetArrowPath: A
2186
2049
  });
2187
2050
  }
2188
2051
  }
2189
- class rt {
2052
+ class Je {
2190
2053
  constructor(e) {
2191
2054
  o(this, "svg");
2192
2055
  o(this, "group");
@@ -2204,7 +2067,7 @@ class rt {
2204
2067
  o(this, "hasSourceArrow");
2205
2068
  o(this, "hasTargetArrow");
2206
2069
  o(this, "pathShape");
2207
- o(this, "createCyclePath", (e) => new et({
2070
+ o(this, "createCyclePath", (e) => new Ge({
2208
2071
  sourceDirection: e,
2209
2072
  radius: this.portCycleRadius,
2210
2073
  smallRadius: this.portCycleSmallRadius,
@@ -2212,7 +2075,7 @@ class rt {
2212
2075
  hasSourceArrow: this.hasSourceArrow,
2213
2076
  hasTargetArrow: this.hasTargetArrow
2214
2077
  }));
2215
- o(this, "createDetourPath", (e, t, s, i, n) => new Ke({
2078
+ o(this, "createDetourPath", (e, t, s, i, n) => new Xe({
2216
2079
  to: s,
2217
2080
  sourceDirection: e,
2218
2081
  targetDirection: t,
@@ -2225,7 +2088,7 @@ class rt {
2225
2088
  hasSourceArrow: this.hasSourceArrow,
2226
2089
  hasTargetArrow: this.hasTargetArrow
2227
2090
  }));
2228
- o(this, "createLinePath", (e, t, s) => new Je({
2091
+ o(this, "createLinePath", (e, t, s) => new ze({
2229
2092
  to: s,
2230
2093
  sourceDirection: e,
2231
2094
  targetDirection: t,
@@ -2250,7 +2113,7 @@ class rt {
2250
2113
  this.pathShape.render(e);
2251
2114
  }
2252
2115
  }
2253
- class ot {
2116
+ class Ke {
2254
2117
  constructor(e) {
2255
2118
  o(this, "svg");
2256
2119
  o(this, "group");
@@ -2291,7 +2154,7 @@ class ot {
2291
2154
  hasSourceArrow: this.hasSourceArrow,
2292
2155
  hasTargetArrow: this.hasTargetArrow
2293
2156
  }));
2294
- o(this, "createLinePath", (e, t, s, i) => new Qe({
2157
+ o(this, "createLinePath", (e, t, s, i) => new Ye({
2295
2158
  to: s,
2296
2159
  sourceDirection: e,
2297
2160
  targetDirection: t,
@@ -2324,7 +2187,7 @@ class ot {
2324
2187
  this.pathShape.render(e);
2325
2188
  }
2326
2189
  }
2327
- class st {
2190
+ class Qe {
2328
2191
  constructor(e) {
2329
2192
  o(this, "svg");
2330
2193
  o(this, "group");
@@ -2365,7 +2228,7 @@ class st {
2365
2228
  hasSourceArrow: this.hasSourceArrow,
2366
2229
  hasTargetArrow: this.hasTargetArrow
2367
2230
  }));
2368
- o(this, "createLinePath", (e, t, s) => new _e({
2231
+ o(this, "createLinePath", (e, t, s) => new He({
2369
2232
  to: s,
2370
2233
  sourceDirection: e,
2371
2234
  targetDirection: t,
@@ -2397,7 +2260,7 @@ class st {
2397
2260
  this.pathShape.render(e);
2398
2261
  }
2399
2262
  }
2400
- class it {
2263
+ class _e {
2401
2264
  constructor(e) {
2402
2265
  o(this, "svg");
2403
2266
  o(this, "group");
@@ -2438,7 +2301,7 @@ class it {
2438
2301
  hasSourceArrow: this.hasSourceArrow,
2439
2302
  hasTargetArrow: this.hasTargetArrow
2440
2303
  }));
2441
- o(this, "createLinePath", (e, t, s, i, n) => new qe({
2304
+ o(this, "createLinePath", (e, t, s, i, n) => new je({
2442
2305
  to: s,
2443
2306
  sourceDirection: e,
2444
2307
  targetDirection: t,
@@ -2471,7 +2334,7 @@ class it {
2471
2334
  this.pathShape.render(e);
2472
2335
  }
2473
2336
  }
2474
- const se = (r) => {
2337
+ const oe = (r) => {
2475
2338
  if (r.diagonalDistance === 0)
2476
2339
  return "";
2477
2340
  const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
@@ -2481,17 +2344,17 @@ const se = (r) => {
2481
2344
  x: t / r.diagonalDistance,
2482
2345
  y: s / r.diagonalDistance
2483
2346
  };
2484
- return O(
2347
+ return F(
2485
2348
  n,
2486
2349
  i,
2487
2350
  r.arrowLength,
2488
2351
  r.arrowWidth
2489
2352
  );
2490
2353
  };
2491
- class nt {
2354
+ class qe {
2492
2355
  constructor(e) {
2493
2356
  o(this, "svg");
2494
- o(this, "group", we());
2357
+ o(this, "group", pe());
2495
2358
  o(this, "line");
2496
2359
  o(this, "sourceArrow", null);
2497
2360
  o(this, "targetArrow", null);
@@ -2503,15 +2366,15 @@ class nt {
2503
2366
  o(this, "targetOffset");
2504
2367
  o(this, "onAfterRender");
2505
2368
  o(this, "afterRenderEmitter");
2506
- [this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = ue(this.color), this.svg.appendChild(this.group), this.line = pe(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2369
+ [this.afterRenderEmitter, this.onAfterRender] = y(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = we(this.color), this.svg.appendChild(this.group), this.line = fe(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2507
2370
  }
2508
2371
  render(e) {
2509
- const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = fe(
2372
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = ve(
2510
2373
  e.from,
2511
2374
  e.to
2512
2375
  );
2513
- ge(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2514
- const d = { x: i, y: n }, c = new tt({
2376
+ ue(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2377
+ const d = { x: i, y: n }, c = new Ze({
2515
2378
  to: d,
2516
2379
  sourceOffset: this.sourceOffset,
2517
2380
  targetOffset: this.targetOffset,
@@ -2521,7 +2384,7 @@ class nt {
2521
2384
  });
2522
2385
  this.line.setAttribute("d", c.path);
2523
2386
  let g = null;
2524
- this.sourceArrow && (g = se({
2387
+ this.sourceArrow && (g = oe({
2525
2388
  diagonalDistance: c.diagonalDistance,
2526
2389
  to: d,
2527
2390
  offset: this.sourceOffset,
@@ -2531,7 +2394,7 @@ class nt {
2531
2394
  arrowLength: this.arrowLength
2532
2395
  }), this.sourceArrow.setAttribute("d", g));
2533
2396
  let l = null;
2534
- this.targetArrow && (l = se({
2397
+ this.targetArrow && (l = oe({
2535
2398
  diagonalDistance: c.diagonalDistance,
2536
2399
  to: d,
2537
2400
  offset: this.targetOffset,
@@ -2546,40 +2409,40 @@ class nt {
2546
2409
  });
2547
2410
  }
2548
2411
  }
2549
- const ht = () => {
2412
+ const et = () => {
2550
2413
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2551
2414
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
2552
- }, at = (r) => {
2415
+ }, tt = (r) => {
2553
2416
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2554
2417
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
2555
- }, ie = (r) => {
2418
+ }, se = (r) => {
2556
2419
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2557
2420
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
2558
2421
  };
2559
- class dt extends Error {
2422
+ class rt extends Error {
2560
2423
  constructor(e) {
2561
2424
  super(e), this.name = "InteractiveEdgeError";
2562
2425
  }
2563
2426
  }
2564
- class ve {
2427
+ class me {
2565
2428
  constructor(e, t) {
2566
2429
  o(this, "svg");
2567
2430
  o(this, "group");
2568
2431
  o(this, "line");
2569
2432
  o(this, "sourceArrow");
2570
2433
  o(this, "targetArrow");
2571
- o(this, "handle", ht());
2434
+ o(this, "handle", et());
2572
2435
  o(this, "onAfterRender");
2573
2436
  o(this, "interactiveLine");
2574
2437
  o(this, "interactiveSourceArrow", null);
2575
2438
  o(this, "interactiveTargetArrow", null);
2576
- if (this.baseEdge = e, e instanceof ve)
2577
- throw new dt(
2439
+ if (this.baseEdge = e, e instanceof me)
2440
+ throw new rt(
2578
2441
  "interactive edge can be configured only once"
2579
2442
  );
2580
2443
  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;
2581
2444
  const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
2582
- this.interactiveLine = at(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ie(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ie(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
2445
+ this.interactiveLine = tt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = se(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = se(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
2583
2446
  this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
2584
2447
  });
2585
2448
  }
@@ -2595,9 +2458,14 @@ class ut {
2595
2458
  o(this, "targetArrow");
2596
2459
  o(this, "onAfterRender");
2597
2460
  o(this, "svg");
2598
- this.baseShape = e, this.medianElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.medianElement), this.baseShape.onAfterRender.subscribe((s) => {
2599
- const i = s.edgePath.median, n = `translate(${i.x}px, ${i.y}px)`;
2600
- this.medianElement.style.setProperty("transform", n);
2461
+ /**
2462
+ * @deprecated
2463
+ * use midpointElement instead
2464
+ */
2465
+ o(this, "medianElement");
2466
+ this.baseShape = e, this.midpointElement = t, this.medianElement = this.midpointElement, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
2467
+ const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
2468
+ this.midpointElement.style.setProperty("transform", n);
2601
2469
  });
2602
2470
  }
2603
2471
  render(e) {
@@ -2609,7 +2477,7 @@ const ye = (r) => {
2609
2477
  return r;
2610
2478
  switch (r == null ? void 0 : r.type) {
2611
2479
  case "straight":
2612
- return () => new st({
2480
+ return () => new Qe({
2613
2481
  color: r.color,
2614
2482
  width: r.width,
2615
2483
  arrowLength: r.arrowLength,
@@ -2623,7 +2491,7 @@ const ye = (r) => {
2623
2491
  detourDirection: r.detourDirection
2624
2492
  });
2625
2493
  case "horizontal":
2626
- return () => new ot({
2494
+ return () => new Ke({
2627
2495
  color: r.color,
2628
2496
  width: r.width,
2629
2497
  arrowLength: r.arrowLength,
@@ -2637,7 +2505,7 @@ const ye = (r) => {
2637
2505
  detourDirection: r.detourDirection
2638
2506
  });
2639
2507
  case "vertical":
2640
- return () => new it({
2508
+ return () => new _e({
2641
2509
  color: r.color,
2642
2510
  width: r.width,
2643
2511
  arrowLength: r.arrowLength,
@@ -2651,7 +2519,7 @@ const ye = (r) => {
2651
2519
  detourDirection: r.detourDirection
2652
2520
  });
2653
2521
  case "direct":
2654
- return () => new nt({
2522
+ return () => new qe({
2655
2523
  color: r.color,
2656
2524
  width: r.width,
2657
2525
  arrowLength: r.arrowLength,
@@ -2662,7 +2530,7 @@ const ye = (r) => {
2662
2530
  targetOffset: r.targetOffset
2663
2531
  });
2664
2532
  default:
2665
- return () => new rt({
2533
+ return () => new Je({
2666
2534
  color: r.color,
2667
2535
  width: r.width,
2668
2536
  arrowLength: r.arrowLength,
@@ -2676,15 +2544,15 @@ const ye = (r) => {
2676
2544
  detourDirection: r.detourDirection
2677
2545
  });
2678
2546
  }
2679
- }, ct = (r) => {
2547
+ }, ot = (r) => {
2680
2548
  var t, s, i, n, h;
2681
- const e = Ze(
2549
+ const e = ke(
2682
2550
  (t = r.nodes) == null ? void 0 : t.priority,
2683
2551
  (s = r.edges) == null ? void 0 : s.priority
2684
2552
  );
2685
2553
  return {
2686
2554
  nodes: {
2687
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? ce,
2555
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? le,
2688
2556
  priorityFn: e.nodesPriorityFn
2689
2557
  },
2690
2558
  ports: {
@@ -2695,6 +2563,125 @@ const ye = (r) => {
2695
2563
  priorityFn: e.edgesPriorityFn
2696
2564
  }
2697
2565
  };
2566
+ }, st = (r) => {
2567
+ var p, f, v, E, A, S;
2568
+ const e = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
2569
+ }), t = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeNodeDrag) ?? (() => !0), s = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
2570
+ }), i = (r == null ? void 0 : r.moveOnTop) !== !1, n = (r == null ? void 0 : r.moveEdgesOnTop) !== !1 && i, h = (E = r == null ? void 0 : r.mouse) == null ? void 0 : E.dragCursor, a = h !== void 0 ? h : "grab", d = (A = r == null ? void 0 : r.mouse) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, g = (S = r == null ? void 0 : r.mouse) == null ? void 0 : S.mouseUpEventVerifier;
2571
+ return {
2572
+ moveOnTop: i,
2573
+ moveEdgesOnTop: n,
2574
+ dragCursor: a,
2575
+ mouseDownEventVerifier: c,
2576
+ mouseUpEventVerifier: g !== void 0 ? g : (b) => b.button === 0,
2577
+ onNodeDrag: e,
2578
+ onBeforeNodeDrag: t,
2579
+ onNodeDragFinished: s
2580
+ };
2581
+ }, it = (r) => {
2582
+ const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
2583
+ return (n) => {
2584
+ let h = n.nextTransform.x, a = n.nextTransform.y;
2585
+ h < e && h < n.prevTransform.x && (h = Math.min(n.prevTransform.x, e));
2586
+ const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
2587
+ h > c && h > n.prevTransform.x && (h = Math.max(n.prevTransform.x, c)), a < s && a < n.prevTransform.y && (a = Math.min(n.prevTransform.y, s));
2588
+ const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
2589
+ return a > l && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: h, y: a };
2590
+ };
2591
+ }, nt = (r) => {
2592
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
2593
+ return (n) => {
2594
+ const h = n.prevTransform, a = n.nextTransform;
2595
+ let d = a.scale, c = a.x, g = a.y;
2596
+ if (a.scale > i && a.scale > h.scale) {
2597
+ d = Math.max(h.scale, i), c = h.x, g = h.y;
2598
+ const l = (d - h.scale) / (a.scale - h.scale);
2599
+ c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
2600
+ }
2601
+ if (a.scale < s && a.scale < h.scale) {
2602
+ d = Math.min(h.scale, s), c = h.x, g = h.y;
2603
+ const l = (d - h.scale) / (a.scale - h.scale);
2604
+ c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
2605
+ }
2606
+ return {
2607
+ scale: d,
2608
+ x: c,
2609
+ y: g
2610
+ };
2611
+ };
2612
+ }, ht = (r) => (e) => r.reduce(
2613
+ (t, s) => s({
2614
+ prevTransform: e.prevTransform,
2615
+ nextTransform: t,
2616
+ canvasWidth: e.canvasWidth,
2617
+ canvasHeight: e.canvasHeight
2618
+ }),
2619
+ e.nextTransform
2620
+ ), ie = (r) => {
2621
+ if (typeof r == "function")
2622
+ return r;
2623
+ switch (r.type) {
2624
+ case "scale-limit":
2625
+ return nt({
2626
+ minContentScale: r.minContentScale ?? 0,
2627
+ maxContentScale: r.maxContentScale ?? 1 / 0
2628
+ });
2629
+ case "shift-limit":
2630
+ return it({
2631
+ minX: r.minX ?? -1 / 0,
2632
+ maxX: r.maxX ?? 1 / 0,
2633
+ minY: r.minY ?? -1 / 0,
2634
+ maxY: r.maxY ?? 1 / 0
2635
+ });
2636
+ }
2637
+ }, ne = (r) => {
2638
+ var v, E, A, S, b, N, M, L, J, K, Q, _;
2639
+ const e = (v = r == null ? void 0 : r.scale) == null ? void 0 : v.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
2640
+ let i;
2641
+ s !== void 0 ? Array.isArray(s) ? i = ht(
2642
+ s.map(
2643
+ (P) => ie(P)
2644
+ )
2645
+ ) : i = ie(s) : i = (P) => P.nextTransform;
2646
+ const n = ((E = r == null ? void 0 : r.shift) == null ? void 0 : E.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onBeforeTransformChange) ?? (() => {
2647
+ }), a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onTransformChange) ?? (() => {
2648
+ }), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0, p = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, f = p !== void 0 ? p : () => !0;
2649
+ return {
2650
+ wheelSensitivity: t,
2651
+ onTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
2652
+ }),
2653
+ onTransformFinished: ((J = r == null ? void 0 : r.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
2654
+ }),
2655
+ onBeforeTransformChange: h,
2656
+ onTransformChange: a,
2657
+ transformPreprocessor: i,
2658
+ shiftCursor: n,
2659
+ mouseDownEventVerifier: c,
2660
+ mouseUpEventVerifier: l,
2661
+ mouseWheelEventVerifier: f,
2662
+ scaleWheelFinishTimeout: ((K = r == null ? void 0 : r.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
2663
+ onResizeTransformStarted: ((Q = r == null ? void 0 : r.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
2664
+ }),
2665
+ onResizeTransformFinished: ((_ = r == null ? void 0 : r.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
2666
+ })
2667
+ };
2668
+ }, at = (r, e) => {
2669
+ const t = document.createElementNS(
2670
+ "http://www.w3.org/2000/svg",
2671
+ "circle"
2672
+ );
2673
+ return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
2674
+ }, dt = (r) => r instanceof SVGElement ? r : at(
2675
+ (r == null ? void 0 : r.radius) ?? 1.5,
2676
+ (r == null ? void 0 : r.color) ?? "#d8d8d8"
2677
+ ), ct = (r) => {
2678
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = dt(r.renderer ?? {});
2679
+ return {
2680
+ tileWidth: t,
2681
+ tileHeight: s,
2682
+ renderer: i,
2683
+ maxViewportScale: r.maxViewportScale ?? 10
2684
+ };
2698
2685
  }, lt = (r, e, t) => {
2699
2686
  var c, g, l;
2700
2687
  const s = () => "direct", i = (p) => p, n = (p) => p.button === 0, h = () => {
@@ -2792,36 +2779,34 @@ class wt {
2792
2779
  */
2793
2780
  build() {
2794
2781
  if (this.element === null)
2795
- throw new S(
2782
+ throw new x(
2796
2783
  "unable to build canvas when no attach element specified"
2797
2784
  );
2798
2785
  let e = this.boxRenderingTrigger;
2799
- this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
2800
- const t = new de(), s = new Me(), i = new je(this.element);
2801
- let n = new ne(
2786
+ this.virtualScrollConfig !== void 0 && e === void 0 && (e = new ae());
2787
+ const t = new ce(), s = new Le(), i = new Oe(this.element);
2788
+ let n = new he(
2802
2789
  t,
2803
2790
  s,
2804
2791
  i.main
2805
2792
  );
2806
2793
  e !== void 0 && (n = new Te(n, t, e));
2807
- const h = ct(this.canvasDefaults), a = new ae(
2794
+ const h = ot(this.canvasDefaults), a = new de(
2808
2795
  this.element,
2809
2796
  t,
2810
2797
  s,
2811
2798
  n,
2812
2799
  h
2813
- ), d = () => {
2814
- i.destroy(), a.onBeforeDestroy.unsubscribe(d);
2815
- };
2816
- if (a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
2800
+ );
2801
+ if (this.hasBackground && Y.configure(
2817
2802
  a,
2818
- this.backgroundConfig,
2803
+ ct(this.backgroundConfig),
2819
2804
  i.background
2820
2805
  ), this.hasResizeReactiveNodes && k.configure(a), this.hasDraggableNode && z.configure(
2821
2806
  a,
2822
2807
  i.main,
2823
2808
  this.window,
2824
- this.dragConfig
2809
+ st(this.dragConfig)
2825
2810
  ), this.hasUserConnectablePorts) {
2826
2811
  const c = lt(
2827
2812
  this.connectablePortsConfig,
@@ -2836,19 +2821,23 @@ class wt {
2836
2821
  c
2837
2822
  );
2838
2823
  }
2839
- return this.virtualScrollConfig !== void 0 ? X.configure(
2824
+ this.virtualScrollConfig !== void 0 ? X.configure(
2840
2825
  a,
2841
2826
  i.main,
2842
2827
  this.window,
2843
- this.transformConfig,
2828
+ ne(this.transformConfig),
2844
2829
  e,
2845
2830
  this.virtualScrollConfig
2846
2831
  ) : this.hasTransformableViewport && U.configure(
2847
2832
  a,
2848
2833
  i.main,
2849
2834
  this.window,
2850
- this.transformConfig
2851
- ), this.reset(), a;
2835
+ ne(this.transformConfig)
2836
+ ), this.reset();
2837
+ const d = () => {
2838
+ i.destroy(), a.onBeforeDestroy.unsubscribe(d);
2839
+ };
2840
+ return a.onBeforeDestroy.subscribe(d), a;
2852
2841
  }
2853
2842
  /**
2854
2843
  * @deprecated
@@ -2859,16 +2848,17 @@ class wt {
2859
2848
  }
2860
2849
  }
2861
2850
  export {
2862
- rt as BezierEdgeShape,
2851
+ Je as BezierEdgeShape,
2863
2852
  wt as CanvasBuilder,
2864
- nt as DirectEdgeShape,
2865
- he as EventSubject,
2866
- ot as HorizontalEdgeShape,
2867
- S as HtmlGraphError,
2868
- dt as InteractiveEdgeError,
2869
- ve as InteractiveEdgeShape,
2853
+ qe as DirectEdgeShape,
2854
+ ae as EventSubject,
2855
+ Ke as HorizontalEdgeShape,
2856
+ x as HtmlGraphError,
2857
+ rt as InteractiveEdgeError,
2858
+ me as InteractiveEdgeShape,
2870
2859
  C as LineEdgeShape,
2871
2860
  ut as MedianEdgeShape,
2872
- st as StraightEdgeShape,
2873
- it as VerticalEdgeShape
2861
+ ut as MidpointEdgeShape,
2862
+ Qe as StraightEdgeShape,
2863
+ _e as VerticalEdgeShape
2874
2864
  };