@html-graph/html-graph 3.11.1 → 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 ve = Object.defineProperty;
2
- var ye = (r, e, t) => e in r ? ve(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => ye(r, typeof e != "symbol" ? e + "" : e, t);
4
- const me = () => {
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
- }, Ae = () => {
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
- }, Ee = (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", Ae());
19
- o(this, "container", me());
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
- Ee(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 xe {
103
+ class Pe {
104
104
  constructor(e) {
105
105
  o(this, "xFrom", 1 / 0);
106
106
  o(this, "yFrom", 1 / 0);
@@ -120,7 +120,7 @@ class xe {
120
120
  return a <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
121
121
  }
122
122
  }
123
- class Se {
123
+ class Te {
124
124
  constructor(e, t, s) {
125
125
  o(this, "attachedNodes", /* @__PURE__ */ new Set());
126
126
  o(this, "attachedEdges", /* @__PURE__ */ new Set());
@@ -144,7 +144,7 @@ class Se {
144
144
  this.handleAttachEdge(h);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new xe(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 Se {
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 be {
221
+ class De {
222
222
  constructor(e) {
223
223
  o(this, "onBeforeUpdated");
224
224
  o(this, "onAfterUpdated");
@@ -231,7 +231,7 @@ class be {
231
231
  return { ...this.viewportStore.getContentMatrix() };
232
232
  }
233
233
  }
234
- class Te {
234
+ class Ne {
235
235
  constructor(e) {
236
236
  o(this, "onAfterNodeAdded");
237
237
  o(this, "onAfterNodeUpdated");
@@ -326,7 +326,7 @@ class Te {
326
326
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
327
327
  }
328
328
  }
329
- class $ {
329
+ class W {
330
330
  constructor(e) {
331
331
  o(this, "counter", 0);
332
332
  this.checkExists = e;
@@ -342,13 +342,13 @@ class $ {
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
@@ -358,13 +358,13 @@ class ae {
358
358
  * provides api for accessing viewport state
359
359
  */
360
360
  o(this, "viewport");
361
- o(this, "nodeIdGenerator", new $(
361
+ o(this, "nodeIdGenerator", new W(
362
362
  (e) => this.graph.getNode(e) !== null
363
363
  ));
364
- o(this, "portIdGenerator", new $(
364
+ o(this, "portIdGenerator", new W(
365
365
  (e) => this.graph.getPort(e) !== null
366
366
  ));
367
- o(this, "edgeIdGenerator", new $(
367
+ o(this, "edgeIdGenerator", new W(
368
368
  (e) => this.graph.getEdge(e) !== null
369
369
  ));
370
370
  o(this, "onAfterNodeAdded", (e) => {
@@ -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 Te(this.graphStore), this.viewport = new be(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 Pe {
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 Pe {
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 Pe());
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 De {
805
+ class Le {
806
806
  constructor() {
807
807
  o(this, "viewportMatrix", ee);
808
808
  o(this, "contentMatrix", ee);
@@ -810,7 +810,7 @@ class De {
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 Ne = (r) => {
870
- var v, p, f, A, m, x;
871
- const e = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
872
- }), t = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onBeforeNodeDrag) ?? (() => !0), s = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.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
- }, Me = (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
- }, Le = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, N = (r, e, t, s) => Me(e, t, s) && Le(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 = Ne(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 Re = (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
- }, Ie = (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
- }, Be = (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 Ie({
1106
- minContentScale: r.minContentScale ?? 0,
1107
- maxContentScale: r.maxContentScale ?? 1 / 0
1108
- });
1109
- case "shift-limit":
1110
- return Re({
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
- }, Ve = (r) => {
1118
- var f, A, m, x, b, T, M, L, J, K, Q, _;
1119
- const e = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.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 = Be(
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, v = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, p = v !== void 0 ? v : () => !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: p,
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
- }, Ce = (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
- }), Ue = (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
@@ -1172,7 +1069,7 @@ const Re = (r) => {
1172
1069
  touches: e
1173
1070
  };
1174
1071
  };
1175
- class C {
1072
+ class U {
1176
1073
  constructor(e, t, s, i) {
1177
1074
  o(this, "viewport");
1178
1075
  o(this, "prevTouches", null);
@@ -1182,14 +1079,14 @@ class C {
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 C {
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 C {
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 C {
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 = Ve(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 C {
1270
1166
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1271
1167
  }
1272
1168
  static configure(e, t, s, i) {
1273
- new C(
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 = Ce(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 C {
1287
1178
  this.performTransform(a);
1288
1179
  }
1289
1180
  scaleViewport(e, t, s) {
1290
- const i = this.canvas.viewport.getViewportMatrix(), n = Ue(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 C {
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 p, f, 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 = ((p = i == null ? void 0 : i.events) == null ? void 0 : p.onResizeTransformStarted) ?? (() => {
1358
- }), d = ((f = i == null ? void 0 : i.events) == null ? void 0 : f.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
- }), v = {
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
- C.configure(
1267
+ U.configure(
1386
1268
  e,
1387
1269
  this.element,
1388
1270
  this.window,
1389
- v
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 $e = () => {
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
- }, We = () => {
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
- }, Fe = () => {
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
- }, Oe = (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
- }, ke = (r) => r instanceof SVGElement ? r : Oe(
1435
- (r == null ? void 0 : r.radius) ?? 1.5,
1436
- (r == null ? void 0 : r.color) ?? "#d8d8d8"
1437
- ), ze = (r) => {
1438
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = ke(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", $e());
1449
- o(this, "patternRenderingRectangle", We());
1450
- o(this, "pattern", Fe());
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 = ze(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,26 +1349,12 @@ 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 Xe = (r) => {
1490
- var a, d, c;
1491
- const e = () => "direct", t = (g) => g, s = (g) => g.button === 0, i = () => {
1492
- }, n = () => {
1493
- }, h = () => {
1494
- };
1495
- return {
1496
- connectionTypeResolver: r.connectionTypeResolver ?? e,
1497
- connectionPreprocessor: r.connectionPreprocessor ?? t,
1498
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
1499
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
1500
- onAfterEdgeCreated: ((a = r.events) == null ? void 0 : a.onAfterEdgeCreated) ?? i,
1501
- onEdgeCreationInterrupted: ((d = r.events) == null ? void 0 : d.onEdgeCreationInterrupted) ?? h,
1502
- onEdgeCreationPrevented: ((c = r.events) == null ? void 0 : c.onEdgeCreationPrevented) ?? n,
1503
- dragPortDirection: r.dragPortDirection ?? void 0
1504
- };
1505
- };
1352
+ const le = (r, e) => ({
1353
+ x: r / 2,
1354
+ y: e / 2
1355
+ });
1506
1356
  class H {
1507
- constructor(e, t, s, i, n, h) {
1508
- o(this, "config");
1357
+ constructor(e, t, s, i, n) {
1509
1358
  o(this, "overlayCanvas");
1510
1359
  o(this, "staticOverlayPortId", "static");
1511
1360
  o(this, "draggingOverlayPortId", "dragging");
@@ -1521,14 +1370,14 @@ class H {
1521
1370
  });
1522
1371
  o(this, "onPortMouseDown", (e) => {
1523
1372
  const t = e.currentTarget;
1524
- 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, {
1525
1374
  passive: !0
1526
1375
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1527
1376
  passive: !0
1528
1377
  }));
1529
1378
  });
1530
1379
  o(this, "onWindowMouseMove", (e) => {
1531
- if (!N(
1380
+ if (!D(
1532
1381
  this.window,
1533
1382
  this.overlayLayer,
1534
1383
  e.clientX,
@@ -1540,7 +1389,7 @@ class H {
1540
1389
  this.moveDraggingNode({ x: e.clientX, y: e.clientY });
1541
1390
  });
1542
1391
  o(this, "onWindowMouseUp", (e) => {
1543
- 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());
1544
1393
  });
1545
1394
  o(this, "onPortTouchStart", (e) => {
1546
1395
  const t = e.currentTarget;
@@ -1558,7 +1407,7 @@ class H {
1558
1407
  });
1559
1408
  o(this, "onWindowTouchMove", (e) => {
1560
1409
  const t = e.touches[0];
1561
- if (!N(
1410
+ if (!D(
1562
1411
  this.window,
1563
1412
  this.overlayLayer,
1564
1413
  t.clientX,
@@ -1585,53 +1434,64 @@ class H {
1585
1434
  ), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1586
1435
  });
1587
1436
  o(this, "onEdgeCreated", (e) => {
1588
- this.config.onAfterEdgeCreated(e);
1437
+ this.params.onAfterEdgeCreated(e);
1589
1438
  });
1590
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config = Xe(h);
1591
- const a = new de(), d = new ne(
1592
- a,
1439
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n;
1440
+ const h = new ce(), a = new he(
1441
+ h,
1593
1442
  this.viewportStore,
1594
1443
  this.overlayLayer
1595
- );
1596
- this.overlayCanvas = new ae(
1444
+ ), d = {
1445
+ nodes: {
1446
+ centerFn: le,
1447
+ priorityFn: () => 0
1448
+ },
1449
+ edges: {
1450
+ shapeFactory: this.params.edgeShapeFactory,
1451
+ priorityFn: () => 0
1452
+ },
1453
+ ports: {
1454
+ direction: 0
1455
+ }
1456
+ };
1457
+ this.overlayCanvas = new de(
1597
1458
  this.overlayLayer,
1598
- a,
1459
+ h,
1599
1460
  this.viewportStore,
1600
- d,
1601
- n
1461
+ a,
1462
+ d
1602
1463
  ), this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1603
1464
  }
1604
- static configure(e, t, s, i, n, h) {
1465
+ static configure(e, t, s, i, n) {
1605
1466
  new H(
1606
1467
  e,
1607
1468
  t,
1608
1469
  s,
1609
1470
  i,
1610
- n,
1611
- h
1471
+ n
1612
1472
  );
1613
1473
  }
1614
1474
  grabPort(e, t) {
1615
1475
  const s = this.canvas.graph.getElementPortsIds(e)[0], i = this.canvas.graph.getPort(s);
1616
1476
  this.staticPortId = s;
1617
- 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, {
1618
1478
  x: a - c.x,
1619
1479
  y: d - c.y
1620
- }), v = D(g, {
1480
+ }), p = T(g, {
1621
1481
  x: t.x - c.x,
1622
1482
  y: t.y - c.y
1623
- }), p = {
1483
+ }), f = {
1624
1484
  overlayId: this.staticOverlayPortId,
1625
1485
  portCoords: l,
1626
1486
  portDirection: i.direction
1627
- }, f = {
1487
+ }, v = {
1628
1488
  overlayId: this.draggingOverlayPortId,
1629
- portCoords: v,
1630
- portDirection: this.config.dragPortDirection
1489
+ portCoords: p,
1490
+ portDirection: this.params.dragPortDirection
1631
1491
  };
1632
1492
  this.isDirect = n === "direct";
1633
- const A = this.isDirect ? p : f, m = this.isDirect ? f : p;
1634
- this.createOverlayGraph(A, m);
1493
+ const E = this.isDirect ? f : v, A = this.isDirect ? v : f;
1494
+ this.createOverlayGraph(E, A);
1635
1495
  }
1636
1496
  hookPortEvents(e) {
1637
1497
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -1680,17 +1540,17 @@ class H {
1680
1540
  tryCreateConnection(e) {
1681
1541
  const t = this.findPortAtPoint(e);
1682
1542
  if (t === null) {
1683
- this.config.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
1543
+ this.params.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
1684
1544
  return;
1685
1545
  }
1686
- const s = this.isDirect ? this.staticPortId : t, i = this.isDirect ? t : this.staticPortId, n = { from: s, to: i }, h = this.config.connectionPreprocessor(n);
1687
- 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);
1688
1548
  }
1689
1549
  moveDraggingNode(e) {
1690
1550
  const t = this.overlayLayer.getBoundingClientRect(), s = {
1691
1551
  x: e.x - t.x,
1692
1552
  y: e.y - t.y
1693
- }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
1553
+ }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, s);
1694
1554
  this.overlayCanvas.updateNode(this.draggingOverlayPortId, {
1695
1555
  x: n.x,
1696
1556
  y: n.y
@@ -1713,60 +1573,57 @@ class H {
1713
1573
  }
1714
1574
  isPortConnectionAllowed(e) {
1715
1575
  const t = this.canvas.graph.getElementPortsIds(e)[0];
1716
- return this.config.connectionTypeResolver(t) !== null;
1576
+ return this.params.connectionTypeResolver(t) !== null;
1717
1577
  }
1718
1578
  }
1719
- const Ye = () => {
1579
+ const $e = () => {
1720
1580
  const r = document.createElement("div");
1721
1581
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
1722
- }, W = () => {
1582
+ }, $ = () => {
1723
1583
  const r = document.createElement("div");
1724
1584
  return r.style.position = "absolute", r.style.inset = "0", r;
1725
1585
  };
1726
- class He {
1586
+ class Oe {
1727
1587
  constructor(e) {
1728
- o(this, "background", W());
1729
- o(this, "main", W());
1730
- o(this, "overlay", W());
1731
- o(this, "host", Ye());
1588
+ o(this, "background", $());
1589
+ o(this, "main", $());
1590
+ o(this, "overlay", $());
1591
+ o(this, "host", $e());
1732
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);
1733
1593
  }
1734
1594
  destroy() {
1735
1595
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
1736
1596
  }
1737
1597
  }
1738
- const je = (r, e) => ({
1739
- x: r / 2,
1740
- y: e / 2
1741
- }), F = (r) => () => r, re = F(0), Ge = () => {
1598
+ const O = (r) => () => r, te = O(0), Fe = () => {
1742
1599
  let r = 0;
1743
1600
  return () => r++;
1744
- }, Ze = (r, e) => {
1745
- let t = re, s = re;
1746
- const i = Ge();
1747
- 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), {
1748
1605
  nodesPriorityFn: t,
1749
1606
  edgesPriorityFn: s
1750
1607
  };
1751
- }, y = (r, e, t) => ({
1608
+ }, m = (r, e, t) => ({
1752
1609
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
1753
1610
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
1754
1611
  }), w = {
1755
1612
  x: 0,
1756
1613
  y: 0
1757
1614
  };
1758
- class Je {
1615
+ class ze {
1759
1616
  constructor(e) {
1760
1617
  o(this, "path");
1761
- o(this, "median");
1618
+ o(this, "midpoint");
1762
1619
  this.params = e;
1763
1620
  const t = this.params.to;
1764
- this.median = { x: t.x / 2, y: t.y / 2 };
1765
- const s = y(
1621
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1622
+ const s = m(
1766
1623
  { x: this.params.arrowLength, y: w.y },
1767
1624
  this.params.sourceDirection,
1768
1625
  w
1769
- ), i = y(
1626
+ ), i = m(
1770
1627
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
1771
1628
  this.params.targetDirection,
1772
1629
  this.params.to
@@ -1780,63 +1637,63 @@ class Je {
1780
1637
  this.path = `${d}${a}${c}`;
1781
1638
  }
1782
1639
  }
1783
- const ce = (r, e, t, s) => ({
1640
+ const ge = (r, e, t, s) => ({
1784
1641
  x: e * r.x + (1 - e) / 2 * s.x,
1785
1642
  y: t * r.y + (1 - t) / 2 * s.y
1786
1643
  });
1787
- class Ke {
1644
+ class Xe {
1788
1645
  constructor(e) {
1789
1646
  o(this, "path");
1790
- o(this, "median");
1647
+ o(this, "midpoint");
1791
1648
  this.params = e;
1792
- const t = this.params.hasSourceArrow ? y(
1649
+ const t = this.params.hasSourceArrow ? m(
1793
1650
  { x: this.params.arrowLength, y: w.y },
1794
1651
  this.params.sourceDirection,
1795
1652
  w
1796
- ) : w, s = this.params.hasTargetArrow ? y(
1653
+ ) : w, s = this.params.hasTargetArrow ? m(
1797
1654
  {
1798
1655
  x: this.params.to.x - this.params.arrowLength,
1799
1656
  y: this.params.to.y
1800
1657
  },
1801
1658
  this.params.targetDirection,
1802
1659
  this.params.to
1803
- ) : 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(
1804
1661
  { x: i, y: w.y },
1805
1662
  this.params.sourceDirection,
1806
1663
  w
1807
1664
  ), g = {
1808
1665
  x: c.x + a,
1809
1666
  y: c.y + d
1810
- }, l = y(
1667
+ }, l = m(
1811
1668
  { x: this.params.to.x - i, y: this.params.to.y },
1812
1669
  this.params.targetDirection,
1813
1670
  this.params.to
1814
- ), v = {
1671
+ ), p = {
1815
1672
  x: l.x + a,
1816
1673
  y: l.y + d
1817
- }, p = {
1818
- x: (g.x + v.x) / 2,
1819
- y: (g.y + v.y) / 2
1820
1674
  }, f = {
1675
+ x: (g.x + p.x) / 2,
1676
+ y: (g.y + p.y) / 2
1677
+ }, v = {
1821
1678
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
1822
1679
  y: c.y + this.params.curvature * this.params.sourceDirection.y
1823
- }, A = {
1680
+ }, E = {
1824
1681
  x: l.x - this.params.curvature * this.params.targetDirection.x,
1825
1682
  y: l.y - this.params.curvature * this.params.targetDirection.y
1826
- }, m = {
1683
+ }, A = {
1827
1684
  x: c.x + a,
1828
1685
  y: c.y + d
1829
- }, x = {
1686
+ }, S = {
1830
1687
  x: l.x + a,
1831
1688
  y: l.y + d
1832
1689
  };
1833
1690
  this.path = [
1834
1691
  `M ${t.x} ${t.y}`,
1835
1692
  `L ${c.x} ${c.y}`,
1836
- `C ${f.x} ${f.y} ${m.x} ${m.y} ${p.x} ${p.y}`,
1837
- `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}`,
1838
1695
  `L ${s.x} ${s.y}`
1839
- ].join(" "), this.median = ce(p, e.flipX, e.flipY, e.to);
1696
+ ].join(" "), this.midpoint = ge(f, e.flipX, e.flipY, e.to);
1840
1697
  }
1841
1698
  }
1842
1699
  const R = (r, e) => {
@@ -1846,54 +1703,54 @@ const R = (r, e) => {
1846
1703
  let i = 0, n = 0, h = 0;
1847
1704
  r.forEach((a, d) => {
1848
1705
  let c = 0, g = 0, l = 0;
1849
- const v = d > 0, p = d < s, f = v && p;
1850
- if (v && (c = -i, g = -n, l = h), p) {
1706
+ const p = d > 0, f = d < s, v = p && f;
1707
+ if (p && (c = -i, g = -n, l = h), f) {
1851
1708
  const L = r[d + 1];
1852
1709
  i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
1853
1710
  }
1854
- const m = h !== 0 ? Math.min((f ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, x = f ? { x: a.x + i * m, y: a.y + n * m } : a, T = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = f ? { x: a.x + c * T, y: a.y + g * T } : a;
1855
- d > 0 && t.push(`L ${M.x} ${M.y}`), f && t.push(
1856
- `C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
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;
1712
+ d > 0 && t.push(`L ${M.x} ${M.y}`), v && t.push(
1713
+ `C ${a.x} ${a.y} ${a.x} ${a.y} ${S.x} ${S.y}`
1857
1714
  );
1858
1715
  });
1859
1716
  }
1860
1717
  return t.join(" ");
1861
1718
  };
1862
- class Qe {
1719
+ class Ye {
1863
1720
  constructor(e) {
1864
1721
  o(this, "path");
1865
- o(this, "median");
1722
+ o(this, "midpoint");
1866
1723
  this.params = e;
1867
1724
  const t = this.params.to;
1868
- this.median = { x: t.x / 2, y: t.y / 2 };
1869
- const s = this.params.hasSourceArrow ? y(
1725
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1726
+ const s = this.params.hasSourceArrow ? m(
1870
1727
  { x: this.params.arrowLength, y: w.y },
1871
1728
  this.params.sourceDirection,
1872
1729
  w
1873
- ) : w, i = this.params.hasTargetArrow ? y(
1730
+ ) : w, i = this.params.hasTargetArrow ? m(
1874
1731
  {
1875
1732
  x: this.params.to.x - this.params.arrowLength,
1876
1733
  y: this.params.to.y
1877
1734
  },
1878
1735
  this.params.targetDirection,
1879
1736
  this.params.to
1880
- ) : 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(
1881
1738
  { x: h, y: w.y },
1882
1739
  this.params.sourceDirection,
1883
1740
  w
1884
- ), d = y(
1741
+ ), d = m(
1885
1742
  { x: this.params.to.x - h, y: this.params.to.y },
1886
1743
  this.params.targetDirection,
1887
1744
  this.params.to
1888
1745
  ), c = Math.max((a.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
1889
1746
  x: this.params.flipX > 0 ? c : -n,
1890
1747
  y: a.y
1891
- }, v = { x: l.x, y: g }, p = {
1748
+ }, p = { x: l.x, y: g }, f = {
1892
1749
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1893
1750
  y: d.y
1894
- }, f = { x: p.x, y: g };
1751
+ }, v = { x: f.x, y: g };
1895
1752
  this.path = R(
1896
- [s, a, l, v, f, p, d, i],
1753
+ [s, a, l, p, v, f, d, i],
1897
1754
  this.params.roundness
1898
1755
  );
1899
1756
  }
@@ -1901,57 +1758,57 @@ class Qe {
1901
1758
  class j {
1902
1759
  constructor(e) {
1903
1760
  o(this, "path");
1904
- o(this, "median");
1761
+ o(this, "midpoint");
1905
1762
  this.params = e;
1906
- const t = this.params.hasSourceArrow ? y(
1763
+ const t = this.params.hasSourceArrow ? m(
1907
1764
  { x: this.params.arrowLength, y: w.y },
1908
1765
  this.params.sourceDirection,
1909
1766
  w
1910
- ) : w, s = this.params.hasTargetArrow ? y(
1767
+ ) : w, s = this.params.hasTargetArrow ? m(
1911
1768
  {
1912
1769
  x: this.params.to.x - this.params.arrowLength,
1913
1770
  y: this.params.to.y
1914
1771
  },
1915
1772
  this.params.targetDirection,
1916
1773
  this.params.to
1917
- ) : 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(
1918
1775
  { x: i, y: w.y },
1919
1776
  this.params.sourceDirection,
1920
1777
  w
1921
- ), 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(
1922
1779
  { x: this.params.to.x - i, y: this.params.to.y },
1923
1780
  this.params.targetDirection,
1924
1781
  this.params.to
1925
- ), v = { x: l.x + d, y: l.y + c }, p = { x: (g.x + v.x) / 2, y: (g.y + v.y) / 2 };
1926
- this.median = ce(p, e.flipX, e.flipY, e.to), this.path = R(
1927
- [t, n, g, v, l, s],
1782
+ ), p = { x: l.x + d, y: l.y + c }, f = { x: (g.x + p.x) / 2, y: (g.y + p.y) / 2 };
1783
+ this.midpoint = ge(f, e.flipX, e.flipY, e.to), this.path = R(
1784
+ [t, n, g, p, l, s],
1928
1785
  this.params.roundness
1929
1786
  );
1930
1787
  }
1931
1788
  }
1932
- class _e {
1789
+ class He {
1933
1790
  constructor(e) {
1934
1791
  o(this, "path");
1935
- o(this, "median");
1792
+ o(this, "midpoint");
1936
1793
  this.params = e;
1937
1794
  const t = this.params.to;
1938
- this.median = { x: t.x / 2, y: t.y / 2 };
1939
- const s = this.params.hasSourceArrow ? y(
1795
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1796
+ const s = this.params.hasSourceArrow ? m(
1940
1797
  { x: this.params.arrowLength, y: w.y },
1941
1798
  this.params.sourceDirection,
1942
1799
  w
1943
- ) : w, i = this.params.hasTargetArrow ? y(
1800
+ ) : w, i = this.params.hasTargetArrow ? m(
1944
1801
  {
1945
1802
  x: this.params.to.x - this.params.arrowLength,
1946
1803
  y: this.params.to.y
1947
1804
  },
1948
1805
  this.params.targetDirection,
1949
1806
  this.params.to
1950
- ) : 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(
1951
1808
  { x: n, y: w.y },
1952
1809
  this.params.sourceDirection,
1953
1810
  w
1954
- ), a = y(
1811
+ ), a = m(
1955
1812
  { x: this.params.to.x - n, y: this.params.to.y },
1956
1813
  this.params.targetDirection,
1957
1814
  this.params.to
@@ -1959,41 +1816,41 @@ class _e {
1959
1816
  this.path = R([s, h, a, i], this.params.roundness);
1960
1817
  }
1961
1818
  }
1962
- class qe {
1819
+ class je {
1963
1820
  constructor(e) {
1964
1821
  o(this, "path");
1965
- o(this, "median");
1822
+ o(this, "midpoint");
1966
1823
  this.params = e;
1967
1824
  const t = this.params.to;
1968
- this.median = { x: t.x / 2, y: t.y / 2 };
1969
- const s = this.params.hasSourceArrow ? y(
1825
+ this.midpoint = { x: t.x / 2, y: t.y / 2 };
1826
+ const s = this.params.hasSourceArrow ? m(
1970
1827
  { x: this.params.arrowLength, y: w.y },
1971
1828
  this.params.sourceDirection,
1972
1829
  w
1973
- ) : w, i = this.params.hasTargetArrow ? y(
1830
+ ) : w, i = this.params.hasTargetArrow ? m(
1974
1831
  {
1975
1832
  x: this.params.to.x - this.params.arrowLength,
1976
1833
  y: this.params.to.y
1977
1834
  },
1978
1835
  this.params.targetDirection,
1979
1836
  this.params.to
1980
- ) : 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(
1981
1838
  { x: h, y: w.y },
1982
1839
  this.params.sourceDirection,
1983
1840
  w
1984
- ), d = y(
1841
+ ), d = m(
1985
1842
  { x: this.params.to.x - h, y: this.params.to.y },
1986
1843
  this.params.targetDirection,
1987
1844
  this.params.to
1988
1845
  ), c = Math.max((a.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
1989
1846
  x: a.x,
1990
1847
  y: this.params.flipY > 0 ? c : -n
1991
- }, v = { x: g, y: l.y }, p = {
1848
+ }, p = { x: g, y: l.y }, f = {
1992
1849
  x: d.x,
1993
1850
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1994
- }, f = { x: g, y: p.y };
1851
+ }, v = { x: g, y: f.y };
1995
1852
  this.path = R(
1996
- [s, a, l, v, f, p, d, i],
1853
+ [s, a, l, p, v, f, d, i],
1997
1854
  this.params.roundness
1998
1855
  );
1999
1856
  }
@@ -2001,7 +1858,7 @@ class qe {
2001
1858
  class G {
2002
1859
  constructor(e) {
2003
1860
  o(this, "path");
2004
- o(this, "median");
1861
+ o(this, "midpoint");
2005
1862
  this.params = e;
2006
1863
  const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, a = [
2007
1864
  { x: this.params.arrowLength, y: w.y },
@@ -2013,15 +1870,15 @@ class G {
2013
1870
  { x: i, y: w.y },
2014
1871
  { x: this.params.arrowLength, y: w.y }
2015
1872
  ].map(
2016
- (c) => y(c, this.params.sourceDirection, w)
1873
+ (c) => m(c, this.params.sourceDirection, w)
2017
1874
  ), d = `M ${w.x} ${w.y} L ${a[0].x} ${a[0].y} `;
2018
- 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 };
2019
1876
  }
2020
1877
  }
2021
- class et {
1878
+ class Ge {
2022
1879
  constructor(e) {
2023
1880
  o(this, "path");
2024
- o(this, "median");
1881
+ o(this, "midpoint");
2025
1882
  this.params = e;
2026
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 = [
2027
1884
  { x: this.params.arrowLength, y: w.y },
@@ -2029,24 +1886,24 @@ class et {
2029
1886
  { x: c, y: -n },
2030
1887
  { x: d, y: 0 }
2031
1888
  ].map(
2032
- (f) => y(f, this.params.sourceDirection, w)
2033
- ), v = [
1889
+ (v) => m(v, this.params.sourceDirection, w)
1890
+ ), p = [
2034
1891
  `M ${l[0].x} ${l[0].y}`,
2035
1892
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
2036
1893
  `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
2037
1894
  `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
2038
- ].join(" "), p = `M 0 0 L ${l[0].x} ${l[0].y} `;
2039
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${v}`, this.median = l[3];
1895
+ ].join(" "), f = `M 0 0 L ${l[0].x} ${l[0].y} `;
1896
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.midpoint = l[3];
2040
1897
  }
2041
1898
  }
2042
- class tt {
1899
+ class Ze {
2043
1900
  constructor(e) {
2044
1901
  o(this, "path");
2045
- o(this, "median");
1902
+ o(this, "midpoint");
2046
1903
  o(this, "diagonalDistance");
2047
1904
  this.params = e;
2048
1905
  const t = this.params.to;
2049
- 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(
2050
1907
  this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
2051
1908
  ), Math.sqrt(
2052
1909
  this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
@@ -2075,23 +1932,23 @@ class tt {
2075
1932
  };
2076
1933
  }
2077
1934
  }
2078
- const le = (r, e) => {
1935
+ const ue = (r, e) => {
2079
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`;
2080
1937
  }, Z = Object.freeze({
2081
1938
  edgeColor: "--edge-color"
2082
- }), ge = (r) => {
1939
+ }), we = (r) => {
2083
1940
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2084
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;
2085
1942
  }, V = () => {
2086
1943
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
2087
1944
  return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
2088
- }, ue = () => {
1945
+ }, pe = () => {
2089
1946
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2090
1947
  return r.style.transformOrigin = "50% 50%", r;
2091
- }, we = (r) => {
1948
+ }, fe = (r) => {
2092
1949
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2093
1950
  return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
2094
- }, pe = (r, e) => {
1951
+ }, ve = (r, e) => {
2095
1952
  const t = {
2096
1953
  x: r.x + r.width / 2,
2097
1954
  y: r.y + r.height / 2
@@ -2107,12 +1964,12 @@ const le = (r, e) => {
2107
1964
  flipX: d,
2108
1965
  flipY: c
2109
1966
  };
2110
- }, O = (r, e, t, s) => {
1967
+ }, F = (r, e, t, s) => {
2111
1968
  const n = [
2112
1969
  w,
2113
1970
  { x: t, y: s },
2114
1971
  { x: t, y: -s }
2115
- ].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}`;
2116
1973
  return `${h} ${a} ${d} Z`;
2117
1974
  }, u = Object.freeze({
2118
1975
  color: "#777777",
@@ -2132,29 +1989,29 @@ const le = (r, e) => {
2132
1989
  curvature: 90,
2133
1990
  interactiveWidth: 10,
2134
1991
  preOffset: 0
2135
- }), oe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
2136
- class U {
1992
+ }), re = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1993
+ class C {
2137
1994
  constructor(e) {
2138
1995
  o(this, "svg");
2139
- o(this, "group", ue());
1996
+ o(this, "group", pe());
2140
1997
  o(this, "line");
2141
1998
  o(this, "sourceArrow", null);
2142
1999
  o(this, "targetArrow", null);
2143
2000
  o(this, "onAfterRender");
2144
2001
  o(this, "afterRenderEmitter");
2145
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg = ge(e.color), this.svg.appendChild(this.group), this.line = we(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));
2146
2003
  }
2147
2004
  render(e) {
2148
- const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = pe(
2005
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = ve(
2149
2006
  e.from,
2150
2007
  e.to
2151
2008
  );
2152
- le(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2153
- 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(
2154
2011
  e.from.direction,
2155
2012
  h,
2156
2013
  a
2157
- ), c = oe(
2014
+ ), c = re(
2158
2015
  e.to.direction,
2159
2016
  h,
2160
2017
  a
@@ -2162,37 +2019,37 @@ class U {
2162
2019
  x: i,
2163
2020
  y: n
2164
2021
  };
2165
- let l = c, v = -this.params.arrowLength, p;
2166
- e.from.portId === e.to.portId ? (p = this.params.createCyclePath, l = d, v = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? p = this.params.createDetourPath : p = this.params.createLinePath;
2167
- const f = p(
2022
+ let l = c, p = -this.params.arrowLength, f;
2023
+ e.from.portId === e.to.portId ? (f = this.params.createCyclePath, l = d, p = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? f = this.params.createDetourPath : f = this.params.createLinePath;
2024
+ const v = f(
2168
2025
  d,
2169
2026
  c,
2170
2027
  g,
2171
2028
  h,
2172
2029
  a
2173
2030
  );
2174
- this.line.setAttribute("d", f.path);
2175
- let A = null;
2176
- this.sourceArrow && (A = O(
2031
+ this.line.setAttribute("d", v.path);
2032
+ let E = null;
2033
+ this.sourceArrow && (E = F(
2177
2034
  d,
2178
2035
  w,
2179
2036
  this.params.arrowLength,
2180
2037
  this.params.arrowWidth
2181
- ), this.sourceArrow.setAttribute("d", A));
2182
- let m = null;
2183
- this.targetArrow && (m = O(
2038
+ ), this.sourceArrow.setAttribute("d", E));
2039
+ let A = null;
2040
+ this.targetArrow && (A = F(
2184
2041
  l,
2185
2042
  g,
2186
- v,
2043
+ p,
2187
2044
  this.params.arrowWidth
2188
- ), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
2189
- edgePath: f,
2190
- sourceArrowPath: A,
2191
- targetArrowPath: m
2045
+ ), this.targetArrow.setAttribute("d", A)), this.afterRenderEmitter.emit({
2046
+ edgePath: v,
2047
+ sourceArrowPath: E,
2048
+ targetArrowPath: A
2192
2049
  });
2193
2050
  }
2194
2051
  }
2195
- class rt {
2052
+ class Je {
2196
2053
  constructor(e) {
2197
2054
  o(this, "svg");
2198
2055
  o(this, "group");
@@ -2210,7 +2067,7 @@ class rt {
2210
2067
  o(this, "hasSourceArrow");
2211
2068
  o(this, "hasTargetArrow");
2212
2069
  o(this, "pathShape");
2213
- o(this, "createCyclePath", (e) => new et({
2070
+ o(this, "createCyclePath", (e) => new Ge({
2214
2071
  sourceDirection: e,
2215
2072
  radius: this.portCycleRadius,
2216
2073
  smallRadius: this.portCycleSmallRadius,
@@ -2218,7 +2075,7 @@ class rt {
2218
2075
  hasSourceArrow: this.hasSourceArrow,
2219
2076
  hasTargetArrow: this.hasTargetArrow
2220
2077
  }));
2221
- o(this, "createDetourPath", (e, t, s, i, n) => new Ke({
2078
+ o(this, "createDetourPath", (e, t, s, i, n) => new Xe({
2222
2079
  to: s,
2223
2080
  sourceDirection: e,
2224
2081
  targetDirection: t,
@@ -2231,7 +2088,7 @@ class rt {
2231
2088
  hasSourceArrow: this.hasSourceArrow,
2232
2089
  hasTargetArrow: this.hasTargetArrow
2233
2090
  }));
2234
- o(this, "createLinePath", (e, t, s) => new Je({
2091
+ o(this, "createLinePath", (e, t, s) => new ze({
2235
2092
  to: s,
2236
2093
  sourceDirection: e,
2237
2094
  targetDirection: t,
@@ -2240,7 +2097,7 @@ class rt {
2240
2097
  hasSourceArrow: this.hasSourceArrow,
2241
2098
  hasTargetArrow: this.hasTargetArrow
2242
2099
  }));
2243
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2100
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2244
2101
  color: (e == null ? void 0 : e.color) ?? u.color,
2245
2102
  width: (e == null ? void 0 : e.width) ?? u.width,
2246
2103
  arrowLength: this.arrowLength,
@@ -2256,7 +2113,7 @@ class rt {
2256
2113
  this.pathShape.render(e);
2257
2114
  }
2258
2115
  }
2259
- class ot {
2116
+ class Ke {
2260
2117
  constructor(e) {
2261
2118
  o(this, "svg");
2262
2119
  o(this, "group");
@@ -2297,7 +2154,7 @@ class ot {
2297
2154
  hasSourceArrow: this.hasSourceArrow,
2298
2155
  hasTargetArrow: this.hasTargetArrow
2299
2156
  }));
2300
- o(this, "createLinePath", (e, t, s, i) => new Qe({
2157
+ o(this, "createLinePath", (e, t, s, i) => new Ye({
2301
2158
  to: s,
2302
2159
  sourceDirection: e,
2303
2160
  targetDirection: t,
@@ -2314,7 +2171,7 @@ class ot {
2314
2171
  t,
2315
2172
  this.arrowOffset,
2316
2173
  this.cycleSquareSide / 2
2317
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2174
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2318
2175
  color: (e == null ? void 0 : e.color) ?? u.color,
2319
2176
  width: (e == null ? void 0 : e.width) ?? u.width,
2320
2177
  arrowLength: this.arrowLength,
@@ -2330,7 +2187,7 @@ class ot {
2330
2187
  this.pathShape.render(e);
2331
2188
  }
2332
2189
  }
2333
- class st {
2190
+ class Qe {
2334
2191
  constructor(e) {
2335
2192
  o(this, "svg");
2336
2193
  o(this, "group");
@@ -2371,7 +2228,7 @@ class st {
2371
2228
  hasSourceArrow: this.hasSourceArrow,
2372
2229
  hasTargetArrow: this.hasTargetArrow
2373
2230
  }));
2374
- o(this, "createLinePath", (e, t, s) => new _e({
2231
+ o(this, "createLinePath", (e, t, s) => new He({
2375
2232
  to: s,
2376
2233
  sourceDirection: e,
2377
2234
  targetDirection: t,
@@ -2387,7 +2244,7 @@ class st {
2387
2244
  t,
2388
2245
  this.arrowOffset,
2389
2246
  this.cycleSquareSide / 2
2390
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2247
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2391
2248
  color: (e == null ? void 0 : e.color) ?? u.color,
2392
2249
  width: (e == null ? void 0 : e.width) ?? u.width,
2393
2250
  arrowLength: this.arrowLength,
@@ -2403,7 +2260,7 @@ class st {
2403
2260
  this.pathShape.render(e);
2404
2261
  }
2405
2262
  }
2406
- class it {
2263
+ class _e {
2407
2264
  constructor(e) {
2408
2265
  o(this, "svg");
2409
2266
  o(this, "group");
@@ -2444,7 +2301,7 @@ class it {
2444
2301
  hasSourceArrow: this.hasSourceArrow,
2445
2302
  hasTargetArrow: this.hasTargetArrow
2446
2303
  }));
2447
- o(this, "createLinePath", (e, t, s, i, n) => new qe({
2304
+ o(this, "createLinePath", (e, t, s, i, n) => new je({
2448
2305
  to: s,
2449
2306
  sourceDirection: e,
2450
2307
  targetDirection: t,
@@ -2461,7 +2318,7 @@ class it {
2461
2318
  t,
2462
2319
  this.arrowOffset,
2463
2320
  this.cycleSquareSide / 2
2464
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new U({
2321
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2465
2322
  color: (e == null ? void 0 : e.color) ?? u.color,
2466
2323
  width: (e == null ? void 0 : e.width) ?? u.width,
2467
2324
  arrowLength: this.arrowLength,
@@ -2477,7 +2334,7 @@ class it {
2477
2334
  this.pathShape.render(e);
2478
2335
  }
2479
2336
  }
2480
- const se = (r) => {
2337
+ const oe = (r) => {
2481
2338
  if (r.diagonalDistance === 0)
2482
2339
  return "";
2483
2340
  const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
@@ -2487,17 +2344,17 @@ const se = (r) => {
2487
2344
  x: t / r.diagonalDistance,
2488
2345
  y: s / r.diagonalDistance
2489
2346
  };
2490
- return O(
2347
+ return F(
2491
2348
  n,
2492
2349
  i,
2493
2350
  r.arrowLength,
2494
2351
  r.arrowWidth
2495
2352
  );
2496
2353
  };
2497
- class nt {
2354
+ class qe {
2498
2355
  constructor(e) {
2499
2356
  o(this, "svg");
2500
- o(this, "group", ue());
2357
+ o(this, "group", pe());
2501
2358
  o(this, "line");
2502
2359
  o(this, "sourceArrow", null);
2503
2360
  o(this, "targetArrow", null);
@@ -2509,15 +2366,15 @@ class nt {
2509
2366
  o(this, "targetOffset");
2510
2367
  o(this, "onAfterRender");
2511
2368
  o(this, "afterRenderEmitter");
2512
- [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 = ge(this.color), this.svg.appendChild(this.group), this.line = we(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));
2513
2370
  }
2514
2371
  render(e) {
2515
- const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = pe(
2372
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = ve(
2516
2373
  e.from,
2517
2374
  e.to
2518
2375
  );
2519
- le(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2520
- 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({
2521
2378
  to: d,
2522
2379
  sourceOffset: this.sourceOffset,
2523
2380
  targetOffset: this.targetOffset,
@@ -2527,7 +2384,7 @@ class nt {
2527
2384
  });
2528
2385
  this.line.setAttribute("d", c.path);
2529
2386
  let g = null;
2530
- this.sourceArrow && (g = se({
2387
+ this.sourceArrow && (g = oe({
2531
2388
  diagonalDistance: c.diagonalDistance,
2532
2389
  to: d,
2533
2390
  offset: this.sourceOffset,
@@ -2537,7 +2394,7 @@ class nt {
2537
2394
  arrowLength: this.arrowLength
2538
2395
  }), this.sourceArrow.setAttribute("d", g));
2539
2396
  let l = null;
2540
- this.targetArrow && (l = se({
2397
+ this.targetArrow && (l = oe({
2541
2398
  diagonalDistance: c.diagonalDistance,
2542
2399
  to: d,
2543
2400
  offset: this.targetOffset,
@@ -2552,40 +2409,40 @@ class nt {
2552
2409
  });
2553
2410
  }
2554
2411
  }
2555
- const ht = () => {
2412
+ const et = () => {
2556
2413
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2557
2414
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
2558
- }, at = (r) => {
2415
+ }, tt = (r) => {
2559
2416
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2560
2417
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
2561
- }, ie = (r) => {
2418
+ }, se = (r) => {
2562
2419
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2563
2420
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
2564
2421
  };
2565
- class dt extends Error {
2422
+ class rt extends Error {
2566
2423
  constructor(e) {
2567
2424
  super(e), this.name = "InteractiveEdgeError";
2568
2425
  }
2569
2426
  }
2570
- class fe {
2427
+ class me {
2571
2428
  constructor(e, t) {
2572
2429
  o(this, "svg");
2573
2430
  o(this, "group");
2574
2431
  o(this, "line");
2575
2432
  o(this, "sourceArrow");
2576
2433
  o(this, "targetArrow");
2577
- o(this, "handle", ht());
2434
+ o(this, "handle", et());
2578
2435
  o(this, "onAfterRender");
2579
2436
  o(this, "interactiveLine");
2580
2437
  o(this, "interactiveSourceArrow", null);
2581
2438
  o(this, "interactiveTargetArrow", null);
2582
- if (this.baseEdge = e, e instanceof fe)
2583
- throw new dt(
2439
+ if (this.baseEdge = e, e instanceof me)
2440
+ throw new rt(
2584
2441
  "interactive edge can be configured only once"
2585
2442
  );
2586
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;
2587
2444
  const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
2588
- 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) => {
2589
2446
  this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
2590
2447
  });
2591
2448
  }
@@ -2601,21 +2458,26 @@ class ut {
2601
2458
  o(this, "targetArrow");
2602
2459
  o(this, "onAfterRender");
2603
2460
  o(this, "svg");
2604
- 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) => {
2605
- const i = s.edgePath.median, n = `translate(${i.x}px, ${i.y}px)`;
2606
- 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);
2607
2469
  });
2608
2470
  }
2609
2471
  render(e) {
2610
2472
  this.baseShape.render(e);
2611
2473
  }
2612
2474
  }
2613
- const ct = (r) => {
2475
+ const ye = (r) => {
2614
2476
  if (typeof r == "function")
2615
2477
  return r;
2616
2478
  switch (r == null ? void 0 : r.type) {
2617
2479
  case "straight":
2618
- return () => new st({
2480
+ return () => new Qe({
2619
2481
  color: r.color,
2620
2482
  width: r.width,
2621
2483
  arrowLength: r.arrowLength,
@@ -2629,7 +2491,7 @@ const ct = (r) => {
2629
2491
  detourDirection: r.detourDirection
2630
2492
  });
2631
2493
  case "horizontal":
2632
- return () => new ot({
2494
+ return () => new Ke({
2633
2495
  color: r.color,
2634
2496
  width: r.width,
2635
2497
  arrowLength: r.arrowLength,
@@ -2643,7 +2505,7 @@ const ct = (r) => {
2643
2505
  detourDirection: r.detourDirection
2644
2506
  });
2645
2507
  case "vertical":
2646
- return () => new it({
2508
+ return () => new _e({
2647
2509
  color: r.color,
2648
2510
  width: r.width,
2649
2511
  arrowLength: r.arrowLength,
@@ -2657,7 +2519,7 @@ const ct = (r) => {
2657
2519
  detourDirection: r.detourDirection
2658
2520
  });
2659
2521
  case "direct":
2660
- return () => new nt({
2522
+ return () => new qe({
2661
2523
  color: r.color,
2662
2524
  width: r.width,
2663
2525
  arrowLength: r.arrowLength,
@@ -2668,7 +2530,7 @@ const ct = (r) => {
2668
2530
  targetOffset: r.targetOffset
2669
2531
  });
2670
2532
  default:
2671
- return () => new rt({
2533
+ return () => new Je({
2672
2534
  color: r.color,
2673
2535
  width: r.width,
2674
2536
  arrowLength: r.arrowLength,
@@ -2682,25 +2544,161 @@ const ct = (r) => {
2682
2544
  detourDirection: r.detourDirection
2683
2545
  });
2684
2546
  }
2685
- }, lt = (r) => {
2547
+ }, ot = (r) => {
2686
2548
  var t, s, i, n, h;
2687
- const e = Ze(
2549
+ const e = ke(
2688
2550
  (t = r.nodes) == null ? void 0 : t.priority,
2689
2551
  (s = r.edges) == null ? void 0 : s.priority
2690
2552
  );
2691
2553
  return {
2692
2554
  nodes: {
2693
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? je,
2555
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? le,
2694
2556
  priorityFn: e.nodesPriorityFn
2695
2557
  },
2696
2558
  ports: {
2697
2559
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
2698
2560
  },
2699
2561
  edges: {
2700
- shapeFactory: ct(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
2562
+ shapeFactory: ye(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
2701
2563
  priorityFn: e.edgesPriorityFn
2702
2564
  }
2703
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
+ };
2685
+ }, lt = (r, e, t) => {
2686
+ var c, g, l;
2687
+ const s = () => "direct", i = (p) => p, n = (p) => p.button === 0, h = () => {
2688
+ }, a = () => {
2689
+ }, d = () => {
2690
+ };
2691
+ return {
2692
+ connectionTypeResolver: r.connectionTypeResolver ?? s,
2693
+ connectionPreprocessor: r.connectionPreprocessor ?? i,
2694
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
2695
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
2696
+ onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? h,
2697
+ onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
2698
+ onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? a,
2699
+ dragPortDirection: r.dragPortDirection ?? t,
2700
+ edgeShapeFactory: r.edgeShape !== void 0 ? ye(r.edgeShape) : e
2701
+ };
2704
2702
  };
2705
2703
  class wt {
2706
2704
  constructor(e) {
@@ -2781,56 +2779,65 @@ class wt {
2781
2779
  */
2782
2780
  build() {
2783
2781
  if (this.element === null)
2784
- throw new S(
2782
+ throw new x(
2785
2783
  "unable to build canvas when no attach element specified"
2786
2784
  );
2787
2785
  let e = this.boxRenderingTrigger;
2788
- this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
2789
- const t = new de(), s = new De(), i = new He(this.element);
2790
- 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(
2791
2789
  t,
2792
2790
  s,
2793
2791
  i.main
2794
2792
  );
2795
- e !== void 0 && (n = new Se(n, t, e));
2796
- const h = lt(this.canvasDefaults), a = new ae(
2793
+ e !== void 0 && (n = new Te(n, t, e));
2794
+ const h = ot(this.canvasDefaults), a = new de(
2797
2795
  this.element,
2798
2796
  t,
2799
2797
  s,
2800
2798
  n,
2801
2799
  h
2802
- ), d = () => {
2803
- i.destroy(), a.onBeforeDestroy.unsubscribe(d);
2804
- };
2805
- return a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
2800
+ );
2801
+ if (this.hasBackground && Y.configure(
2806
2802
  a,
2807
- this.backgroundConfig,
2803
+ ct(this.backgroundConfig),
2808
2804
  i.background
2809
2805
  ), this.hasResizeReactiveNodes && k.configure(a), this.hasDraggableNode && z.configure(
2810
2806
  a,
2811
2807
  i.main,
2812
2808
  this.window,
2813
- this.dragConfig
2814
- ), this.hasUserConnectablePorts && H.configure(
2815
- a,
2816
- i.overlay,
2817
- s,
2818
- this.window,
2819
- h,
2820
- this.connectablePortsConfig
2821
- ), this.virtualScrollConfig !== void 0 ? X.configure(
2809
+ st(this.dragConfig)
2810
+ ), this.hasUserConnectablePorts) {
2811
+ const c = lt(
2812
+ this.connectablePortsConfig,
2813
+ h.edges.shapeFactory,
2814
+ h.ports.direction
2815
+ );
2816
+ H.configure(
2817
+ a,
2818
+ i.overlay,
2819
+ s,
2820
+ this.window,
2821
+ c
2822
+ );
2823
+ }
2824
+ this.virtualScrollConfig !== void 0 ? X.configure(
2822
2825
  a,
2823
2826
  i.main,
2824
2827
  this.window,
2825
- this.transformConfig,
2828
+ ne(this.transformConfig),
2826
2829
  e,
2827
2830
  this.virtualScrollConfig
2828
- ) : this.hasTransformableViewport && C.configure(
2831
+ ) : this.hasTransformableViewport && U.configure(
2829
2832
  a,
2830
2833
  i.main,
2831
2834
  this.window,
2832
- this.transformConfig
2833
- ), 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;
2834
2841
  }
2835
2842
  /**
2836
2843
  * @deprecated
@@ -2841,16 +2848,17 @@ class wt {
2841
2848
  }
2842
2849
  }
2843
2850
  export {
2844
- rt as BezierEdgeShape,
2851
+ Je as BezierEdgeShape,
2845
2852
  wt as CanvasBuilder,
2846
- nt as DirectEdgeShape,
2847
- he as EventSubject,
2848
- ot as HorizontalEdgeShape,
2849
- S as HtmlGraphError,
2850
- dt as InteractiveEdgeError,
2851
- fe as InteractiveEdgeShape,
2852
- U as LineEdgeShape,
2853
+ qe as DirectEdgeShape,
2854
+ ae as EventSubject,
2855
+ Ke as HorizontalEdgeShape,
2856
+ x as HtmlGraphError,
2857
+ rt as InteractiveEdgeError,
2858
+ me as InteractiveEdgeShape,
2859
+ C as LineEdgeShape,
2853
2860
  ut as MedianEdgeShape,
2854
- st as StraightEdgeShape,
2855
- it as VerticalEdgeShape
2861
+ ut as MidpointEdgeShape,
2862
+ Qe as StraightEdgeShape,
2863
+ _e as VerticalEdgeShape
2856
2864
  };