@html-graph/html-graph 8.3.0 → 8.5.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,23 +1,23 @@
1
- var He = Object.defineProperty;
2
- var Xe = (r, e, t) => e in r ? He(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => Xe(r, typeof e != "symbol" ? e + "" : e, t);
4
- var M = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(M || {});
5
- const Ye = () => {
1
+ var Ye = Object.defineProperty;
2
+ var Xe = (r, e, t) => e in r ? Ye(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var i = (r, e, t) => Xe(r, typeof e != "symbol" ? e + "" : e, t);
4
+ var D = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(D || {});
5
+ const Ge = () => {
6
6
  const r = document.createElement("div");
7
7
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
8
- }, Ge = () => {
8
+ }, je = () => {
9
9
  const r = document.createElement("div");
10
10
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
11
- }, je = (r) => {
11
+ }, qe = (r) => {
12
12
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
13
13
  };
14
- class Ae {
14
+ class xe {
15
15
  constructor(e, t, s) {
16
- o(this, "host", Ye());
17
- o(this, "container", Ge());
18
- o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
19
- o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
20
- o(this, "applyTransform", () => {
16
+ i(this, "host", Ge());
17
+ i(this, "container", je());
18
+ i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
19
+ i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
20
+ i(this, "applyTransform", () => {
21
21
  const e = this.viewportStore.getContentMatrix();
22
22
  this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
23
23
  });
@@ -25,7 +25,7 @@ class Ae {
25
25
  }
26
26
  attachNode(e) {
27
27
  const t = this.graphStore.getNode(e);
28
- je(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
28
+ qe(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
29
29
  }
30
30
  detachNode(e) {
31
31
  const t = this.graphStore.getNode(e);
@@ -50,7 +50,7 @@ class Ae {
50
50
  this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
51
51
  }
52
52
  updateNodePosition(e) {
53
- const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, i), d = a.x - n * h.x, c = a.y - n * h.y;
53
+ const t = this.graphStore.getNode(e), { width: s, height: o } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, o), d = a.x - n * h.x, c = a.y - n * h.y;
54
54
  t.element.style.transform = `translate(${d}px, ${c}px)`;
55
55
  }
56
56
  updateNodePriority(e) {
@@ -60,24 +60,24 @@ class Ae {
60
60
  updateEdgeShape(e) {
61
61
  const t = this.edgeIdToElementMap.get(e);
62
62
  this.container.removeChild(t);
63
- const i = this.graphStore.getEdge(e).payload.shape.svg;
64
- this.edgeIdToElementMap.set(e, i), this.container.appendChild(i);
63
+ const o = this.graphStore.getEdge(e).payload.shape.svg;
64
+ this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
65
65
  }
66
66
  renderEdge(e) {
67
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
67
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = o.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
68
68
  s,
69
69
  n,
70
70
  h,
71
71
  d
72
- ), g = this.createEdgeRenderPort(i, a, h, d);
73
- let l = M.Line;
74
- s.element === i.element ? l = M.PortCycle : s.nodeId === i.nodeId && (l = M.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
72
+ ), g = this.createEdgeRenderPort(o, a, h, d);
73
+ let l = D.Line;
74
+ s.element === o.element ? l = D.PortCycle : s.nodeId === o.nodeId && (l = D.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
75
75
  }
76
76
  updateEdgePriority(e) {
77
77
  const t = this.graphStore.getEdge(e);
78
78
  t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
79
79
  }
80
- createEdgeRenderPort(e, t, s, i) {
80
+ createEdgeRenderPort(e, t, s, o) {
81
81
  const n = this.viewportStore.createContentCoords({
82
82
  x: t.left - s.left,
83
83
  y: t.top - s.top
@@ -85,57 +85,57 @@ class Ae {
85
85
  return {
86
86
  x: n.x,
87
87
  y: n.y,
88
- width: t.width * i,
89
- height: t.height * i,
88
+ width: t.width * o,
89
+ height: t.height * o,
90
90
  direction: e.payload.direction
91
91
  };
92
92
  }
93
93
  }
94
94
  class Ke {
95
95
  constructor(e) {
96
- o(this, "xFrom", 1 / 0);
97
- o(this, "yFrom", 1 / 0);
98
- o(this, "xTo", 1 / 0);
99
- o(this, "yTo", 1 / 0);
96
+ i(this, "xFrom", 1 / 0);
97
+ i(this, "yFrom", 1 / 0);
98
+ i(this, "xTo", 1 / 0);
99
+ i(this, "yTo", 1 / 0);
100
100
  this.graphStore = e;
101
101
  }
102
102
  setRenderingBox(e) {
103
103
  this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
104
104
  }
105
105
  hasNode(e) {
106
- const t = this.graphStore.getNode(e).payload, { x: s, y: i } = t;
107
- return s >= this.xFrom && s <= this.xTo && i >= this.yFrom && i <= this.yTo;
106
+ const t = this.graphStore.getNode(e).payload, { x: s, y: o } = t;
107
+ return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
108
108
  }
109
109
  hasEdge(e) {
110
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(i).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), g = Math.max(n.y, a.y);
110
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(o).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), g = Math.max(n.y, a.y);
111
111
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
112
112
  }
113
113
  }
114
114
  class Qe {
115
- constructor(e, t, s, i) {
116
- o(this, "attachedNodes", /* @__PURE__ */ new Set());
117
- o(this, "attachedEdges", /* @__PURE__ */ new Set());
118
- o(this, "renderingBox");
119
- o(this, "updateViewport", (e) => {
115
+ constructor(e, t, s, o) {
116
+ i(this, "attachedNodes", /* @__PURE__ */ new Set());
117
+ i(this, "attachedEdges", /* @__PURE__ */ new Set());
118
+ i(this, "renderingBox");
119
+ i(this, "updateViewport", (e) => {
120
120
  this.renderingBox.setRenderingBox(e);
121
- const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
121
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
122
122
  this.graphStore.getAllNodeIds().forEach((a) => {
123
123
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
124
124
  h && !d ? t.add(a) : !h && d && s.add(a);
125
125
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
126
126
  const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
127
- h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? i.add(a) : !h && d && n.add(a);
127
+ h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? o.add(a) : !h && d && n.add(a);
128
128
  }), n.forEach((a) => {
129
129
  this.handleDetachEdge(a);
130
130
  }), s.forEach((a) => {
131
131
  this.handleDetachNode(a);
132
132
  }), t.forEach((a) => {
133
133
  this.attachedNodes.has(a) || this.handleAttachNode(a);
134
- }), i.forEach((a) => {
134
+ }), o.forEach((a) => {
135
135
  this.handleAttachEdge(a);
136
136
  });
137
137
  });
138
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Ke(this.graphStore), this.trigger.subscribe(this.updateViewport);
138
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ke(this.graphStore), this.trigger.subscribe(this.updateViewport);
139
139
  }
140
140
  attachNode(e) {
141
141
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -173,8 +173,8 @@ class Qe {
173
173
  this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
174
174
  }
175
175
  attachEdgeEntities(e) {
176
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
177
- this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
176
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId;
177
+ this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(o) || this.handleAttachNode(o), this.handleAttachEdge(e);
178
178
  }
179
179
  handleAttachNode(e) {
180
180
  this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -191,8 +191,8 @@ class Qe {
191
191
  }
192
192
  class Ze {
193
193
  constructor(e, t) {
194
- o(this, "deferredNodes", /* @__PURE__ */ new Set());
195
- o(this, "deferredEdges", /* @__PURE__ */ new Set());
194
+ i(this, "deferredNodes", /* @__PURE__ */ new Set());
195
+ i(this, "deferredEdges", /* @__PURE__ */ new Set());
196
196
  this.htmlView = e, this.graphStore = t;
197
197
  }
198
198
  attachNode(e) {
@@ -236,8 +236,8 @@ class Ze {
236
236
  this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
237
237
  }
238
238
  isEdgeValid(e) {
239
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to);
240
- return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(i.nodeId));
239
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to);
240
+ return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
241
241
  }
242
242
  tryAttachEdge(e) {
243
243
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
@@ -245,7 +245,7 @@ class Ze {
245
245
  }
246
246
  class Q {
247
247
  constructor() {
248
- o(this, "callbacks", /* @__PURE__ */ new Set());
248
+ i(this, "callbacks", /* @__PURE__ */ new Set());
249
249
  }
250
250
  subscribe(e) {
251
251
  this.callbacks.add(e);
@@ -259,13 +259,13 @@ class Q {
259
259
  });
260
260
  }
261
261
  }
262
- const x = () => {
262
+ const E = () => {
263
263
  const r = new Q();
264
264
  return [r, r];
265
265
  };
266
- class X {
266
+ class G {
267
267
  constructor(e) {
268
- o(this, "counter", 0);
268
+ i(this, "counter", 0);
269
269
  this.checkExists = e;
270
270
  }
271
271
  create(e) {
@@ -280,73 +280,73 @@ class X {
280
280
  }
281
281
  }
282
282
  class Ee {
283
- constructor(e, t, s, i, n, a) {
284
- o(this, "nodeIdGenerator", new X(
283
+ constructor(e, t, s, o, n, a) {
284
+ i(this, "nodeIdGenerator", new G(
285
285
  (e) => this.graphStore.hasNode(e)
286
286
  ));
287
- o(this, "portIdGenerator", new X(
287
+ i(this, "portIdGenerator", new G(
288
288
  (e) => this.graphStore.hasPort(e)
289
289
  ));
290
- o(this, "edgeIdGenerator", new X(
290
+ i(this, "edgeIdGenerator", new G(
291
291
  (e) => this.graphStore.hasEdge(e)
292
292
  ));
293
- o(this, "onAfterNodeAdded", (e) => {
293
+ i(this, "onAfterNodeAdded", (e) => {
294
294
  this.htmlView.attachNode(e);
295
295
  });
296
- o(this, "onAfterNodeUpdated", (e) => {
296
+ i(this, "onAfterNodeUpdated", (e) => {
297
297
  this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
298
298
  this.htmlView.renderEdge(t);
299
299
  });
300
300
  });
301
- o(this, "onAfterNodePriorityUpdated", (e) => {
301
+ i(this, "onAfterNodePriorityUpdated", (e) => {
302
302
  this.htmlView.updateNodePriority(e);
303
303
  });
304
- o(this, "onBeforeNodeRemoved", (e) => {
304
+ i(this, "onBeforeNodeRemoved", (e) => {
305
305
  this.graphStore.getNodePortIds(e).forEach((t) => {
306
306
  this.unmarkPort(t);
307
307
  }), this.htmlView.detachNode(e);
308
308
  });
309
- o(this, "onAfterPortUpdated", (e) => {
309
+ i(this, "onAfterPortUpdated", (e) => {
310
310
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
311
311
  this.htmlView.renderEdge(t);
312
312
  });
313
313
  });
314
- o(this, "onBeforePortUnmarked", (e) => {
314
+ i(this, "onBeforePortUnmarked", (e) => {
315
315
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
316
316
  this.removeEdge(t);
317
317
  });
318
318
  });
319
- o(this, "onAfterEdgeAdded", (e) => {
319
+ i(this, "onAfterEdgeAdded", (e) => {
320
320
  this.htmlView.attachEdge(e);
321
321
  });
322
- o(this, "onAfterEdgeShapeUpdated", (e) => {
322
+ i(this, "onAfterEdgeShapeUpdated", (e) => {
323
323
  this.htmlView.updateEdgeShape(e);
324
324
  });
325
- o(this, "onAfterEdgeUpdated", (e) => {
325
+ i(this, "onAfterEdgeUpdated", (e) => {
326
326
  this.htmlView.renderEdge(e);
327
327
  });
328
- o(this, "onAfterEdgePriorityUpdated", (e) => {
328
+ i(this, "onAfterEdgePriorityUpdated", (e) => {
329
329
  this.htmlView.updateEdgePriority(e);
330
330
  });
331
- o(this, "onBeforeEdgeRemoved", (e) => {
331
+ i(this, "onBeforeEdgeRemoved", (e) => {
332
332
  this.htmlView.detachEdge(e);
333
333
  });
334
- o(this, "onBeforeClear", () => {
334
+ i(this, "onBeforeClear", () => {
335
335
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
336
336
  });
337
- o(this, "onBeforeDestroyEmitter");
338
- o(this, "destroyed", !1);
337
+ i(this, "onBeforeDestroyEmitter");
338
+ i(this, "destroyed", !1);
339
339
  /**
340
340
  * emits event just before destruction of canvas
341
341
  */
342
- o(this, "onBeforeDestroy");
343
- this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = i, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
342
+ i(this, "onBeforeDestroy");
343
+ this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = o, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
344
344
  this.onAfterNodePriorityUpdated
345
345
  ), 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(
346
346
  this.onAfterEdgeShapeUpdated
347
347
  ), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
348
348
  this.onAfterEdgePriorityUpdated
349
- ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = x();
349
+ ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
350
350
  }
351
351
  /**
352
352
  * adds new node
@@ -467,10 +467,10 @@ class Ee {
467
467
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
468
468
  }
469
469
  }
470
- class qe {
470
+ class Je {
471
471
  constructor() {
472
- o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
473
- o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
472
+ i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
473
+ i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
474
474
  }
475
475
  addRecord(e, t) {
476
476
  const s = this.singleToMultiMap.get(e);
@@ -507,49 +507,49 @@ class qe {
507
507
  return this.multiToSingleMap.get(e) !== void 0;
508
508
  }
509
509
  }
510
- class A extends Error {
510
+ class x extends Error {
511
511
  constructor() {
512
512
  super(...arguments);
513
- o(this, "name", "CanvasError");
513
+ i(this, "name", "CanvasError");
514
514
  }
515
515
  }
516
- class xe {
516
+ class Se {
517
517
  constructor() {
518
- o(this, "nodes", /* @__PURE__ */ new Map());
519
- o(this, "ports", /* @__PURE__ */ new Map());
520
- o(this, "edges", /* @__PURE__ */ new Map());
521
- o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
522
- o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
523
- o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
524
- o(this, "portCycleEdges", /* @__PURE__ */ new Map());
525
- o(this, "elementPorts", new qe());
526
- o(this, "afterNodeAddedEmitter");
527
- o(this, "onAfterNodeAdded");
528
- o(this, "afterNodeUpdatedEmitter");
529
- o(this, "onAfterNodeUpdated");
530
- o(this, "afterNodePriorityUpdatedEmitter");
531
- o(this, "onAfterNodePriorityUpdated");
532
- o(this, "beforeNodeRemovedEmitter");
533
- o(this, "onBeforeNodeRemoved");
534
- o(this, "afterPortAddedEmitter");
535
- o(this, "onAfterPortAdded");
536
- o(this, "afterPortUpdatedEmitter");
537
- o(this, "onAfterPortUpdated");
538
- o(this, "beforePortRemovedEmitter");
539
- o(this, "onBeforePortRemoved");
540
- o(this, "afterEdgeAddedEmitter");
541
- o(this, "onAfterEdgeAdded");
542
- o(this, "afterEdgeShapeUpdatedEmitter");
543
- o(this, "onAfterEdgeShapeUpdated");
544
- o(this, "afterEdgeUpdatedEmitter");
545
- o(this, "onAfterEdgeUpdated");
546
- o(this, "afterEdgePriorityUpdatedEmitter");
547
- o(this, "onAfterEdgePriorityUpdated");
548
- o(this, "beforeEdgeRemovedEmitter");
549
- o(this, "onBeforeEdgeRemoved");
550
- o(this, "beforeClearEmitter");
551
- o(this, "onBeforeClear");
552
- [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = x(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = x(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = x(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = x(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = x(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = x(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = x(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = x(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = x(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = x(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = x(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = x(), [this.beforeClearEmitter, this.onBeforeClear] = x();
518
+ i(this, "nodes", /* @__PURE__ */ new Map());
519
+ i(this, "ports", /* @__PURE__ */ new Map());
520
+ i(this, "edges", /* @__PURE__ */ new Map());
521
+ i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
522
+ i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
523
+ i(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
524
+ i(this, "portCycleEdges", /* @__PURE__ */ new Map());
525
+ i(this, "elementPorts", new Je());
526
+ i(this, "afterNodeAddedEmitter");
527
+ i(this, "onAfterNodeAdded");
528
+ i(this, "afterNodeUpdatedEmitter");
529
+ i(this, "onAfterNodeUpdated");
530
+ i(this, "afterNodePriorityUpdatedEmitter");
531
+ i(this, "onAfterNodePriorityUpdated");
532
+ i(this, "beforeNodeRemovedEmitter");
533
+ i(this, "onBeforeNodeRemoved");
534
+ i(this, "afterPortAddedEmitter");
535
+ i(this, "onAfterPortAdded");
536
+ i(this, "afterPortUpdatedEmitter");
537
+ i(this, "onAfterPortUpdated");
538
+ i(this, "beforePortRemovedEmitter");
539
+ i(this, "onBeforePortRemoved");
540
+ i(this, "afterEdgeAddedEmitter");
541
+ i(this, "onAfterEdgeAdded");
542
+ i(this, "afterEdgeShapeUpdatedEmitter");
543
+ i(this, "onAfterEdgeShapeUpdated");
544
+ i(this, "afterEdgeUpdatedEmitter");
545
+ i(this, "onAfterEdgeUpdated");
546
+ i(this, "afterEdgePriorityUpdatedEmitter");
547
+ i(this, "onAfterEdgePriorityUpdated");
548
+ i(this, "beforeEdgeRemovedEmitter");
549
+ i(this, "onBeforeEdgeRemoved");
550
+ i(this, "beforeClearEmitter");
551
+ i(this, "onBeforeClear");
552
+ [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();
553
553
  }
554
554
  hasNode(e) {
555
555
  return this.nodes.has(e);
@@ -557,14 +557,14 @@ class xe {
557
557
  getNode(e) {
558
558
  const t = this.nodes.get(e);
559
559
  if (t === void 0)
560
- throw new A("failed to access nonexistent node");
560
+ throw new x("failed to access nonexistent node");
561
561
  return t;
562
562
  }
563
563
  addNode(e) {
564
564
  if (this.hasNode(e.id))
565
- throw new A("failed to add node with existing id");
565
+ throw new x("failed to add node with existing id");
566
566
  if (this.findNodeIdByElement(e.element) !== void 0)
567
- throw new A(
567
+ throw new x(
568
568
  "failed to add node with html element already in use by another node"
569
569
  );
570
570
  const t = /* @__PURE__ */ new Map(), s = {
@@ -587,13 +587,13 @@ class xe {
587
587
  }
588
588
  updateNode(e, t) {
589
589
  if (!this.hasNode(e))
590
- throw new A("failed to update nonexistent node");
590
+ throw new x("failed to update nonexistent node");
591
591
  const { payload: s } = this.nodes.get(e);
592
592
  s.x = t.x ?? s.x, s.y = t.y ?? s.y, s.centerFn = t.centerFn ?? s.centerFn, t.priority !== void 0 && (s.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
593
593
  }
594
594
  removeNode(e) {
595
595
  if (!this.hasNode(e))
596
- throw new A("failed to remove nonexistent node");
596
+ throw new x("failed to remove nonexistent node");
597
597
  this.beforeNodeRemovedEmitter.emit(e);
598
598
  const t = this.nodes.get(e);
599
599
  this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
@@ -604,14 +604,14 @@ class xe {
604
604
  getPort(e) {
605
605
  const t = this.ports.get(e);
606
606
  if (t === void 0)
607
- throw new A("failed to access nonexistent port");
607
+ throw new x("failed to access nonexistent port");
608
608
  return t;
609
609
  }
610
610
  addPort(e) {
611
611
  if (this.hasPort(e.id))
612
- throw new A("failed to add port with existing id");
612
+ throw new x("failed to add port with existing id");
613
613
  if (!this.hasNode(e.nodeId))
614
- throw new A("failed to add port to nonexistent node");
614
+ throw new x("failed to add port to nonexistent node");
615
615
  this.ports.set(e.id, {
616
616
  element: e.element,
617
617
  payload: {
@@ -622,7 +622,7 @@ class xe {
622
622
  }
623
623
  updatePort(e, t) {
624
624
  if (!this.hasPort(e))
625
- throw new A("failed to update nonexistent port");
625
+ throw new x("failed to update nonexistent port");
626
626
  const s = this.ports.get(e).payload;
627
627
  s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
628
628
  }
@@ -635,12 +635,12 @@ class xe {
635
635
  getNodePortIds(e) {
636
636
  const t = this.nodes.get(e);
637
637
  if (t === void 0)
638
- throw new A("failed to access port ids of nonexistent node");
638
+ throw new x("failed to access port ids of nonexistent node");
639
639
  return Array.from(t.ports.keys());
640
640
  }
641
641
  removePort(e) {
642
642
  if (!this.hasPort(e))
643
- throw new A("failed to remove nonexistent port");
643
+ throw new x("failed to remove nonexistent port");
644
644
  const t = this.ports.get(e).nodeId;
645
645
  this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
646
646
  }
@@ -650,27 +650,27 @@ class xe {
650
650
  getEdge(e) {
651
651
  const t = this.edges.get(e);
652
652
  if (t === void 0)
653
- throw new A("failed to access nonexistent edge");
653
+ throw new x("failed to access nonexistent edge");
654
654
  return t;
655
655
  }
656
656
  addEdge(e) {
657
657
  if (this.hasEdge(e.id))
658
- throw new A("failed to add edge with existing id");
658
+ throw new x("failed to add edge with existing id");
659
659
  if (!this.hasPort(e.from))
660
- throw new A("failed to add edge from nonexistent port");
660
+ throw new x("failed to add edge from nonexistent port");
661
661
  if (!this.hasPort(e.to))
662
- throw new A("failed to add edge to nonexistent port");
662
+ throw new x("failed to add edge to nonexistent port");
663
663
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
664
664
  }
665
665
  updateEdge(e, t) {
666
666
  if (!this.hasEdge(e))
667
- throw new A("failed to update nonexistent edge");
667
+ throw new x("failed to update nonexistent edge");
668
668
  if (t.from !== void 0 || t.to !== void 0) {
669
- const i = this.edges.get(e), n = i.payload;
669
+ const o = this.edges.get(e), n = o.payload;
670
670
  this.removeEdgeInternal(e), this.addEdgeInternal({
671
671
  id: e,
672
- from: t.from ?? i.from,
673
- to: t.to ?? i.to,
672
+ from: t.from ?? o.from,
673
+ to: t.to ?? o.to,
674
674
  shape: n.shape,
675
675
  priority: n.priority
676
676
  });
@@ -683,7 +683,7 @@ class xe {
683
683
  }
684
684
  removeEdge(e) {
685
685
  if (!this.hasEdge(e))
686
- throw new A("failed to remove nonexistent edge");
686
+ throw new x("failed to remove nonexistent edge");
687
687
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
688
688
  }
689
689
  clear() {
@@ -692,19 +692,19 @@ class xe {
692
692
  getPortIncomingEdgeIds(e) {
693
693
  const t = this.portIncomingEdges.get(e);
694
694
  if (t === void 0)
695
- throw new A("failed to access edges for nonexistent port");
695
+ throw new x("failed to access edges for nonexistent port");
696
696
  return Array.from(t);
697
697
  }
698
698
  getPortOutgoingEdgeIds(e) {
699
699
  const t = this.portOutcomingEdges.get(e);
700
700
  if (t === void 0)
701
- throw new A("failed to access edges for nonexistent port");
701
+ throw new x("failed to access edges for nonexistent port");
702
702
  return Array.from(t);
703
703
  }
704
704
  getPortCycleEdgeIds(e) {
705
705
  const t = this.portCycleEdges.get(e);
706
706
  if (t === void 0)
707
- throw new A("failed to access edges for nonexistent port");
707
+ throw new x("failed to access edges for nonexistent port");
708
708
  return Array.from(t);
709
709
  }
710
710
  getPortAdjacentEdgeIds(e) {
@@ -716,8 +716,8 @@ class xe {
716
716
  }
717
717
  getNodeIncomingEdgeIds(e) {
718
718
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
719
- return t.forEach((i) => {
720
- this.getPortIncomingEdgeIds(i).filter((n) => {
719
+ return t.forEach((o) => {
720
+ this.getPortIncomingEdgeIds(o).filter((n) => {
721
721
  const a = this.getEdge(n);
722
722
  return this.getPort(a.from).nodeId !== e;
723
723
  }).forEach((n) => {
@@ -727,8 +727,8 @@ class xe {
727
727
  }
728
728
  getNodeOutgoingEdgeIds(e) {
729
729
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
730
- return t.forEach((i) => {
731
- this.getPortOutgoingEdgeIds(i).filter((n) => {
730
+ return t.forEach((o) => {
731
+ this.getPortOutgoingEdgeIds(o).filter((n) => {
732
732
  const a = this.getEdge(n);
733
733
  return this.getPort(a.to).nodeId !== e;
734
734
  }).forEach((n) => {
@@ -738,10 +738,10 @@ class xe {
738
738
  }
739
739
  getNodeCycleEdgeIds(e) {
740
740
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
741
- return t.forEach((i) => {
742
- this.getPortCycleEdgeIds(i).forEach((n) => {
741
+ return t.forEach((o) => {
742
+ this.getPortCycleEdgeIds(o).forEach((n) => {
743
743
  s.push(n);
744
- }), this.getPortIncomingEdgeIds(i).filter((n) => {
744
+ }), this.getPortIncomingEdgeIds(o).filter((n) => {
745
745
  const a = this.getEdge(n);
746
746
  return this.getPort(a.to).nodeId === e;
747
747
  }).forEach((n) => {
@@ -751,12 +751,12 @@ class xe {
751
751
  }
752
752
  getNodeAdjacentEdgeIds(e) {
753
753
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
754
- return t.forEach((i) => {
755
- this.getPortIncomingEdgeIds(i).forEach((n) => {
754
+ return t.forEach((o) => {
755
+ this.getPortIncomingEdgeIds(o).forEach((n) => {
756
756
  s.push(n);
757
- }), this.getPortOutgoingEdgeIds(i).forEach((n) => {
757
+ }), this.getPortOutgoingEdgeIds(o).forEach((n) => {
758
758
  s.push(n);
759
- }), this.getPortCycleEdgeIds(i).forEach((n) => {
759
+ }), this.getPortCycleEdgeIds(o).forEach((n) => {
760
760
  s.push(n);
761
761
  });
762
762
  }), s;
@@ -772,36 +772,36 @@ class xe {
772
772
  }), e.from !== e.to ? (this.portOutcomingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
773
773
  }
774
774
  removeEdgeInternal(e) {
775
- const t = this.edges.get(e), s = t.from, i = t.to;
776
- this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(i).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(i).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(i).delete(e), this.edges.delete(e);
775
+ const t = this.edges.get(e), s = t.from, o = t.to;
776
+ this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(o).delete(e), this.edges.delete(e);
777
777
  }
778
778
  }
779
- const le = (r) => ({
779
+ const ge = (r) => ({
780
780
  scale: 1 / r.scale,
781
781
  x: -r.x / r.scale,
782
782
  y: -r.y / r.scale
783
- }), ge = {
783
+ }), ue = {
784
784
  scale: 1,
785
785
  x: 0,
786
786
  y: 0
787
- }, ue = (r, e) => ({
787
+ }, pe = (r, e) => ({
788
788
  x: r.scale * e.x + r.x,
789
789
  y: r.scale * e.y + r.y
790
790
  });
791
- class Je {
791
+ class _e {
792
792
  constructor(e) {
793
- o(this, "viewportMatrix", ge);
794
- o(this, "contentMatrix", ge);
795
- o(this, "beforeUpdateEmitter");
796
- o(this, "onBeforeUpdated");
797
- o(this, "afterUpdateEmitter");
798
- o(this, "onAfterUpdated");
799
- o(this, "afterResizeEmitter");
800
- o(this, "onAfterResize");
801
- o(this, "observer", new ResizeObserver(() => {
793
+ i(this, "viewportMatrix", ue);
794
+ i(this, "contentMatrix", ue);
795
+ i(this, "beforeUpdateEmitter");
796
+ i(this, "onBeforeUpdated");
797
+ i(this, "afterUpdateEmitter");
798
+ i(this, "onAfterUpdated");
799
+ i(this, "afterResizeEmitter");
800
+ i(this, "onAfterResize");
801
+ i(this, "observer", new ResizeObserver(() => {
802
802
  this.afterResizeEmitter.emit();
803
803
  }));
804
- this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = x(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = x(), [this.afterResizeEmitter, this.onAfterResize] = x(), this.observer.observe(this.host);
804
+ this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = E(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = E(), [this.afterResizeEmitter, this.onAfterResize] = E(), this.observer.observe(this.host);
805
805
  }
806
806
  getViewportMatrix() {
807
807
  return this.viewportMatrix;
@@ -814,24 +814,24 @@ class Je {
814
814
  scale: e.scale ?? this.viewportMatrix.scale,
815
815
  x: e.x ?? this.viewportMatrix.x,
816
816
  y: e.y ?? this.viewportMatrix.y
817
- }, this.beforeUpdateEmitter.emit(), this.contentMatrix = le(this.viewportMatrix), this.afterUpdateEmitter.emit();
817
+ }, this.beforeUpdateEmitter.emit(), this.contentMatrix = ge(this.viewportMatrix), this.afterUpdateEmitter.emit();
818
818
  }
819
819
  patchContentMatrix(e) {
820
820
  this.contentMatrix = {
821
821
  scale: e.scale ?? this.contentMatrix.scale,
822
822
  x: e.x ?? this.contentMatrix.x,
823
823
  y: e.y ?? this.contentMatrix.y
824
- }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = le(this.contentMatrix), this.afterUpdateEmitter.emit();
824
+ }, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ge(this.contentMatrix), this.afterUpdateEmitter.emit();
825
825
  }
826
826
  getDimensions() {
827
827
  const { width: e, height: t } = this.host.getBoundingClientRect();
828
828
  return { width: e, height: t };
829
829
  }
830
830
  createContentCoords(e) {
831
- return ue(this.viewportMatrix, e);
831
+ return pe(this.viewportMatrix, e);
832
832
  }
833
833
  createViewportCoords(e) {
834
- return ue(this.contentMatrix, e);
834
+ return pe(this.contentMatrix, e);
835
835
  }
836
836
  destroy() {
837
837
  this.observer.disconnect();
@@ -839,23 +839,23 @@ class Je {
839
839
  }
840
840
  class Z {
841
841
  constructor(e) {
842
- o(this, "elementToNodeId", /* @__PURE__ */ new Map());
843
- o(this, "nodesResizeObserver");
844
- o(this, "onAfterNodeAdded", (e) => {
842
+ i(this, "elementToNodeId", /* @__PURE__ */ new Map());
843
+ i(this, "nodesResizeObserver");
844
+ i(this, "onAfterNodeAdded", (e) => {
845
845
  const t = this.canvas.graph.getNode(e);
846
846
  this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
847
847
  });
848
- o(this, "onBeforeNodeRemoved", (e) => {
848
+ i(this, "onBeforeNodeRemoved", (e) => {
849
849
  const t = this.canvas.graph.getNode(e);
850
850
  this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
851
851
  });
852
- o(this, "onBeforeClear", () => {
852
+ i(this, "onBeforeClear", () => {
853
853
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
854
854
  });
855
855
  this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
856
856
  t.forEach((s) => {
857
- const i = s.target;
858
- this.handleNodeResize(i);
857
+ const o = s.target;
858
+ this.handleNodeResize(o);
859
859
  });
860
860
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
861
861
  }
@@ -867,12 +867,12 @@ class Z {
867
867
  this.canvas.updateNode(t);
868
868
  }
869
869
  }
870
- const _e = (r, e, t) => {
871
- const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
872
- return e >= s && e <= s + n && t >= i && t <= i + a;
873
- }, et = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => _e(e, t, s) && et(r, t, s), B = (r, e) => {
870
+ const et = (r, e, t) => {
871
+ const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
872
+ return e >= s && e <= s + n && t >= o && t <= o + a;
873
+ }, tt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => et(e, t, s) && tt(r, t, s), U = (r, e) => {
874
874
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
875
- }, $ = (r) => {
875
+ }, O = (r) => {
876
876
  const e = document.createElement("div");
877
877
  return {
878
878
  id: r.overlayNodeId,
@@ -887,7 +887,7 @@ const _e = (r, e, t) => {
887
887
  }
888
888
  ]
889
889
  };
890
- }, tt = (r, e) => {
890
+ }, rt = (r, e) => {
891
891
  let t = e;
892
892
  for (; t !== null; ) {
893
893
  const s = r.findPortIdsByElement(t)[0] ?? null;
@@ -906,30 +906,30 @@ const _e = (r, e, t) => {
906
906
  status: "notFound"
907
907
  };
908
908
  };
909
- function* Se(r, e) {
909
+ function* be(r, e) {
910
910
  const t = r.elementsFromPoint(e.x, e.y);
911
911
  for (const s of t) {
912
912
  if (s.shadowRoot !== null) {
913
- const i = Se(s.shadowRoot, e);
914
- for (const n of i)
913
+ const o = be(s.shadowRoot, e);
914
+ for (const n of o)
915
915
  yield n;
916
916
  }
917
917
  yield s;
918
918
  }
919
919
  }
920
- const be = (r, e) => {
921
- const t = Se(document, e);
920
+ const Pe = (r, e) => {
921
+ const t = be(document, e);
922
922
  for (const s of t) {
923
- const i = tt(r, s);
924
- if (i.status === "portFound")
925
- return i.portId;
926
- if (i.status === "nodeEncountered")
923
+ const o = rt(r, s);
924
+ if (o.status === "portFound")
925
+ return o.portId;
926
+ if (o.status === "nodeEncountered")
927
927
  return null;
928
928
  }
929
929
  return null;
930
930
  };
931
931
  var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(N || {});
932
- const Pe = (r, e) => ({
932
+ const Ne = (r, e) => ({
933
933
  x: r / 2,
934
934
  y: e / 2
935
935
  }), p = {
@@ -938,30 +938,30 @@ const Pe = (r, e) => ({
938
938
  }, m = (r, e, t) => ({
939
939
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
940
940
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
941
- }), Ne = (r, e) => {
941
+ }), Te = (r, e) => {
942
942
  const t = {
943
943
  x: r.x + r.width / 2,
944
944
  y: r.y + r.height / 2
945
945
  }, s = {
946
946
  x: e.x + e.width / 2,
947
947
  y: e.y + e.height / 2
948
- }, i = Math.min(t.x, s.x), n = Math.min(t.y, s.y), a = Math.abs(s.x - t.x), h = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
948
+ }, o = Math.min(t.x, s.x), n = Math.min(t.y, s.y), a = Math.abs(s.x - t.x), h = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
949
949
  return {
950
- x: i,
950
+ x: o,
951
951
  y: n,
952
952
  width: a,
953
953
  height: h,
954
954
  flipX: d,
955
955
  flipY: c
956
956
  };
957
- }, W = (r, e, t, s) => ({
957
+ }, k = (r, e, t, s) => ({
958
958
  x: e * r.x + (1 - e) / 2 * s.x,
959
959
  y: t * r.y + (1 - t) / 2 * s.y
960
960
  });
961
- class rt {
961
+ class st {
962
962
  constructor(e) {
963
- o(this, "path");
964
- o(this, "midpoint");
963
+ i(this, "path");
964
+ i(this, "midpoint");
965
965
  this.params = e;
966
966
  const t = this.params.to;
967
967
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -969,7 +969,7 @@ class rt {
969
969
  { x: this.params.arrowLength, y: p.y },
970
970
  this.params.sourceDirection,
971
971
  p
972
- ), i = m(
972
+ ), o = m(
973
973
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
974
974
  this.params.targetDirection,
975
975
  this.params.to
@@ -977,16 +977,16 @@ class rt {
977
977
  x: s.x + this.params.sourceDirection.x * this.params.curvature,
978
978
  y: s.y + this.params.sourceDirection.y * this.params.curvature
979
979
  }, a = {
980
- x: i.x - this.params.targetDirection.x * this.params.curvature,
981
- y: i.y - this.params.targetDirection.y * this.params.curvature
982
- }, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
980
+ x: o.x - this.params.targetDirection.x * this.params.curvature,
981
+ y: o.y - this.params.targetDirection.y * this.params.curvature
982
+ }, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${this.params.to.x} ${this.params.to.y}`;
983
983
  this.path = `${d}${h}${c}`;
984
984
  }
985
985
  }
986
- class st {
986
+ class ot {
987
987
  constructor(e) {
988
- o(this, "path");
989
- o(this, "midpoint");
988
+ i(this, "path");
989
+ i(this, "midpoint");
990
990
  this.params = e;
991
991
  const t = this.params.hasSourceArrow ? m(
992
992
  { x: this.params.arrowLength, y: p.y },
@@ -999,15 +999,15 @@ class st {
999
999
  },
1000
1000
  this.params.targetDirection,
1001
1001
  this.params.to
1002
- ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
1003
- { x: i, y: p.y },
1002
+ ) : this.params.to, o = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
1003
+ { x: o, y: p.y },
1004
1004
  this.params.sourceDirection,
1005
1005
  p
1006
1006
  ), g = {
1007
1007
  x: c.x + h,
1008
1008
  y: c.y + d
1009
1009
  }, l = m(
1010
- { x: this.params.to.x - i, y: this.params.to.y },
1010
+ { x: this.params.to.x - o, y: this.params.to.y },
1011
1011
  this.params.targetDirection,
1012
1012
  this.params.to
1013
1013
  ), u = {
@@ -1016,10 +1016,10 @@ class st {
1016
1016
  }, w = {
1017
1017
  x: (g.x + u.x) / 2,
1018
1018
  y: (g.y + u.y) / 2
1019
- }, y = {
1019
+ }, f = {
1020
1020
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
1021
1021
  y: c.y + this.params.curvature * this.params.sourceDirection.y
1022
- }, E = {
1022
+ }, v = {
1023
1023
  x: l.x - this.params.curvature * this.params.targetDirection.x,
1024
1024
  y: l.y - this.params.curvature * this.params.targetDirection.y
1025
1025
  }, S = {
@@ -1032,52 +1032,52 @@ class st {
1032
1032
  this.path = [
1033
1033
  `M ${t.x} ${t.y}`,
1034
1034
  `L ${c.x} ${c.y}`,
1035
- `C ${y.x} ${y.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
1036
- `C ${b.x} ${b.y} ${E.x} ${E.y} ${l.x} ${l.y}`,
1035
+ `C ${f.x} ${f.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
1036
+ `C ${b.x} ${b.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
1037
1037
  `L ${s.x} ${s.y}`
1038
- ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
1038
+ ].join(" "), this.midpoint = k(w, e.flipX, e.flipY, e.to);
1039
1039
  }
1040
1040
  }
1041
- const q = Object.freeze({
1041
+ const J = Object.freeze({
1042
1042
  edgeColor: "--edge-color"
1043
- }), Te = (r) => {
1043
+ }), Ce = (r) => {
1044
1044
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1045
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(q.edgeColor, r), e;
1046
- }, Ce = (r) => {
1045
+ return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(J.edgeColor, r), e;
1046
+ }, Me = (r) => {
1047
1047
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1048
- return e.setAttribute("stroke", `var(${q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1049
- }, U = () => {
1048
+ return e.setAttribute("stroke", `var(${J.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1049
+ }, W = () => {
1050
1050
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
1051
- return r.setAttribute("fill", `var(${q.edgeColor})`), r;
1051
+ return r.setAttribute("fill", `var(${J.edgeColor})`), r;
1052
1052
  }, De = () => {
1053
1053
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1054
1054
  return r.style.transformOrigin = "50% 50%", r;
1055
- }, Me = (r, e) => {
1055
+ }, Re = (r, e) => {
1056
1056
  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`;
1057
- }, D = (r, e) => {
1057
+ }, M = (r, e) => {
1058
1058
  const t = [];
1059
1059
  if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
1060
1060
  const s = r.length - 1;
1061
- let i = 0, n = 0, a = 0;
1061
+ let o = 0, n = 0, a = 0;
1062
1062
  r.forEach((h, d) => {
1063
1063
  let c = 0, g = 0, l = 0;
1064
- const u = d > 0, w = d < s, y = u && w;
1065
- if (u && (c = -i, g = -n, l = a), w) {
1064
+ const u = d > 0, w = d < s, f = u && w;
1065
+ if (u && (c = -o, g = -n, l = a), w) {
1066
1066
  const V = r[d + 1];
1067
- i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
1067
+ o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
1068
1068
  }
1069
- const S = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = y ? { x: h.x + i * S, y: h.y + n * S } : h, P = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, R = y ? { x: h.x + c * P, y: h.y + g * P } : h;
1070
- d > 0 && t.push(`L ${R.x} ${R.y}`), y && t.push(
1069
+ const S = a !== 0 ? Math.min((f ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = f ? { x: h.x + o * S, y: h.y + n * S } : h, P = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = f ? { x: h.x + c * P, y: h.y + g * P } : h;
1070
+ d > 0 && t.push(`L ${L.x} ${L.y}`), f && t.push(
1071
1071
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
1072
1072
  );
1073
1073
  });
1074
1074
  }
1075
1075
  return t.join(" ");
1076
1076
  };
1077
- class ot {
1077
+ class it {
1078
1078
  constructor(e) {
1079
- o(this, "path");
1080
- o(this, "midpoint");
1079
+ i(this, "path");
1080
+ i(this, "midpoint");
1081
1081
  this.params = e;
1082
1082
  const t = this.params.to;
1083
1083
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -1085,7 +1085,7 @@ class ot {
1085
1085
  { x: this.params.arrowLength, y: p.y },
1086
1086
  this.params.sourceDirection,
1087
1087
  p
1088
- ) : p, i = this.params.hasTargetArrow ? m(
1088
+ ) : p, o = this.params.hasTargetArrow ? m(
1089
1089
  {
1090
1090
  x: this.params.to.x - this.params.arrowLength,
1091
1091
  y: this.params.to.y
@@ -1106,17 +1106,17 @@ class ot {
1106
1106
  }, u = { x: l.x, y: g }, w = {
1107
1107
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1108
1108
  y: d.y
1109
- }, y = { x: w.x, y: g };
1110
- this.path = D(
1111
- [s, h, l, u, y, w, d, i],
1109
+ }, f = { x: w.x, y: g };
1110
+ this.path = M(
1111
+ [s, h, l, u, f, w, d, o],
1112
1112
  this.params.roundness
1113
1113
  );
1114
1114
  }
1115
1115
  }
1116
- class it {
1116
+ class nt {
1117
1117
  constructor(e) {
1118
- o(this, "path");
1119
- o(this, "midpoint");
1118
+ i(this, "path");
1119
+ i(this, "midpoint");
1120
1120
  this.params = e;
1121
1121
  const t = this.params.hasSourceArrow ? m(
1122
1122
  { x: this.params.arrowLength, y: p.y },
@@ -1129,25 +1129,25 @@ class it {
1129
1129
  },
1130
1130
  this.params.targetDirection,
1131
1131
  this.params.to
1132
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1133
- { x: i, y: p.y },
1132
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1133
+ { x: o, y: p.y },
1134
1134
  this.params.sourceDirection,
1135
1135
  p
1136
1136
  ), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
1137
- { x: this.params.to.x - i, y: this.params.to.y },
1137
+ { x: this.params.to.x - o, y: this.params.to.y },
1138
1138
  this.params.targetDirection,
1139
1139
  this.params.to
1140
1140
  ), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
1141
- this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = D(
1141
+ this.midpoint = k(w, e.flipX, e.flipY, e.to), this.path = M(
1142
1142
  [t, n, g, u, l, s],
1143
1143
  this.params.roundness
1144
1144
  );
1145
1145
  }
1146
1146
  }
1147
- class nt {
1147
+ class at {
1148
1148
  constructor(e) {
1149
- o(this, "path");
1150
- o(this, "midpoint");
1149
+ i(this, "path");
1150
+ i(this, "midpoint");
1151
1151
  this.params = e;
1152
1152
  const t = this.params.to;
1153
1153
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -1155,7 +1155,7 @@ class nt {
1155
1155
  { x: this.params.arrowLength, y: p.y },
1156
1156
  this.params.sourceDirection,
1157
1157
  p
1158
- ) : p, i = this.params.hasTargetArrow ? m(
1158
+ ) : p, o = this.params.hasTargetArrow ? m(
1159
1159
  {
1160
1160
  x: this.params.to.x - this.params.arrowLength,
1161
1161
  y: this.params.to.y
@@ -1171,13 +1171,13 @@ class nt {
1171
1171
  this.params.targetDirection,
1172
1172
  this.params.to
1173
1173
  );
1174
- this.path = D([s, a, h, i], this.params.roundness);
1174
+ this.path = M([s, a, h, o], this.params.roundness);
1175
1175
  }
1176
1176
  }
1177
- class at {
1177
+ class ht {
1178
1178
  constructor(e) {
1179
- o(this, "path");
1180
- o(this, "midpoint");
1179
+ i(this, "path");
1180
+ i(this, "midpoint");
1181
1181
  this.params = e;
1182
1182
  const t = this.params.to;
1183
1183
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
@@ -1185,7 +1185,7 @@ class at {
1185
1185
  { x: this.params.arrowLength, y: p.y },
1186
1186
  this.params.sourceDirection,
1187
1187
  p
1188
- ) : p, i = this.params.hasTargetArrow ? m(
1188
+ ) : p, o = this.params.hasTargetArrow ? m(
1189
1189
  {
1190
1190
  x: this.params.to.x - this.params.arrowLength,
1191
1191
  y: this.params.to.y
@@ -1206,45 +1206,45 @@ class at {
1206
1206
  }, u = { x: g, y: l.y }, w = {
1207
1207
  x: d.x,
1208
1208
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1209
- }, y = { x: g, y: w.y };
1210
- this.path = D(
1211
- [s, h, l, u, y, w, d, i],
1209
+ }, f = { x: g, y: w.y };
1210
+ this.path = M(
1211
+ [s, h, l, u, f, w, d, o],
1212
1212
  this.params.roundness
1213
1213
  );
1214
1214
  }
1215
1215
  }
1216
- class J {
1216
+ class _ {
1217
1217
  constructor(e) {
1218
- o(this, "path");
1219
- o(this, "midpoint");
1218
+ i(this, "path");
1219
+ i(this, "midpoint");
1220
1220
  this.params = e;
1221
- const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
1221
+ const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
1222
1222
  { x: this.params.arrowLength, y: p.y },
1223
- { x: i, y: p.y },
1224
- { x: i, y: this.params.side },
1223
+ { x: o, y: p.y },
1224
+ { x: o, y: this.params.side },
1225
1225
  { x: n, y: this.params.side },
1226
1226
  { x: n, y: -this.params.side },
1227
- { x: i, y: -this.params.side },
1228
- { x: i, y: p.y },
1227
+ { x: o, y: -this.params.side },
1228
+ { x: o, y: p.y },
1229
1229
  { x: this.params.arrowLength, y: p.y }
1230
1230
  ].map(
1231
1231
  (c) => m(c, this.params.sourceDirection, p)
1232
1232
  ), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
1233
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${D(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1233
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1234
1234
  }
1235
1235
  }
1236
- class ht {
1236
+ class dt {
1237
1237
  constructor(e) {
1238
- o(this, "path");
1239
- o(this, "midpoint");
1238
+ i(this, "path");
1239
+ i(this, "midpoint");
1240
1240
  this.params = e;
1241
- const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
1241
+ const t = this.params.smallRadius, s = this.params.radius, o = t + s, n = t * s / o, a = Math.sqrt(o * o - t * t), h = a * t / o, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
1242
1242
  { x: this.params.arrowLength, y: p.y },
1243
1243
  { x: c, y: n },
1244
1244
  { x: c, y: -n },
1245
1245
  { x: d, y: 0 }
1246
1246
  ].map(
1247
- (y) => m(y, this.params.sourceDirection, p)
1247
+ (f) => m(f, this.params.sourceDirection, p)
1248
1248
  ), u = [
1249
1249
  `M ${l[0].x} ${l[0].y}`,
1250
1250
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
@@ -1254,11 +1254,11 @@ class ht {
1254
1254
  this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
1255
1255
  }
1256
1256
  }
1257
- class dt {
1257
+ class ct {
1258
1258
  constructor(e) {
1259
- o(this, "path");
1260
- o(this, "midpoint");
1261
- o(this, "diagonalDistance");
1259
+ i(this, "path");
1260
+ i(this, "midpoint");
1261
+ i(this, "diagonalDistance");
1262
1262
  this.params = e;
1263
1263
  const t = this.params.to;
1264
1264
  if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
@@ -1269,7 +1269,7 @@ class dt {
1269
1269
  this.path = "";
1270
1270
  return;
1271
1271
  }
1272
- const i = this.createDirectLinePoint({
1272
+ const o = this.createDirectLinePoint({
1273
1273
  offset: this.params.sourceOffset,
1274
1274
  hasArrow: this.params.hasSourceArrow,
1275
1275
  flip: 1,
@@ -1280,20 +1280,20 @@ class dt {
1280
1280
  flip: -1,
1281
1281
  shift: this.params.to
1282
1282
  });
1283
- this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
1283
+ this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
1284
1284
  }
1285
1285
  createDirectLinePoint(e) {
1286
- const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
1286
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
1287
1287
  return {
1288
- x: this.params.to.x * i + e.shift.x,
1289
- y: this.params.to.y * i + e.shift.y
1288
+ x: this.params.to.x * o + e.shift.x,
1289
+ y: this.params.to.y * o + e.shift.y
1290
1290
  };
1291
1291
  }
1292
1292
  }
1293
- class ct {
1293
+ class lt {
1294
1294
  constructor(e) {
1295
- o(this, "path");
1296
- o(this, "midpoint");
1295
+ i(this, "path");
1296
+ i(this, "midpoint");
1297
1297
  this.params = e;
1298
1298
  const t = this.params.hasSourceArrow ? m(
1299
1299
  { x: this.params.arrowLength, y: p.y },
@@ -1306,19 +1306,19 @@ class ct {
1306
1306
  },
1307
1307
  this.params.targetDirection,
1308
1308
  this.params.to
1309
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1310
- { x: i, y: p.y },
1309
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1310
+ { x: o, y: p.y },
1311
1311
  this.params.sourceDirection,
1312
1312
  p
1313
1313
  ), a = m(
1314
- { x: this.params.to.x - i, y: this.params.to.y },
1314
+ { x: this.params.to.x - o, y: this.params.to.y },
1315
1315
  this.params.targetDirection,
1316
1316
  this.params.to
1317
1317
  ), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.y / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipY * h, l = {
1318
1318
  x: (n.x + a.x) / 2,
1319
1319
  y: g
1320
1320
  };
1321
- this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = D(
1321
+ this.midpoint = k(l, e.flipX, e.flipY, e.to), this.path = M(
1322
1322
  [
1323
1323
  t,
1324
1324
  n,
@@ -1331,10 +1331,10 @@ class ct {
1331
1331
  );
1332
1332
  }
1333
1333
  }
1334
- class lt {
1334
+ class gt {
1335
1335
  constructor(e) {
1336
- o(this, "path");
1337
- o(this, "midpoint");
1336
+ i(this, "path");
1337
+ i(this, "midpoint");
1338
1338
  this.params = e;
1339
1339
  const t = this.params.hasSourceArrow ? m(
1340
1340
  { x: this.params.arrowLength, y: p.y },
@@ -1347,19 +1347,19 @@ class lt {
1347
1347
  },
1348
1348
  this.params.targetDirection,
1349
1349
  this.params.to
1350
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1351
- { x: i, y: p.y },
1350
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1351
+ { x: o, y: p.y },
1352
1352
  this.params.sourceDirection,
1353
1353
  p
1354
1354
  ), a = m(
1355
- { x: this.params.to.x - i, y: this.params.to.y },
1355
+ { x: this.params.to.x - o, y: this.params.to.y },
1356
1356
  this.params.targetDirection,
1357
1357
  this.params.to
1358
1358
  ), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipX * h, l = {
1359
1359
  x: g,
1360
1360
  y: (n.y + a.y) / 2
1361
1361
  };
1362
- this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = D(
1362
+ this.midpoint = k(l, e.flipX, e.flipY, e.to), this.path = M(
1363
1363
  [
1364
1364
  t,
1365
1365
  n,
@@ -1372,7 +1372,7 @@ class lt {
1372
1372
  );
1373
1373
  }
1374
1374
  }
1375
- const f = Object.freeze({
1375
+ const y = Object.freeze({
1376
1376
  color: "#777777",
1377
1377
  width: 1,
1378
1378
  arrowLength: 20,
@@ -1394,39 +1394,39 @@ const f = Object.freeze({
1394
1394
  curvature: 90,
1395
1395
  interactiveWidth: 10,
1396
1396
  preOffset: 0
1397
- }), pe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1398
- class z {
1397
+ }), we = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1398
+ class H {
1399
1399
  constructor(e) {
1400
- o(this, "svg");
1401
- o(this, "group", De());
1402
- o(this, "line");
1403
- o(this, "sourceArrow", null);
1404
- o(this, "targetArrow", null);
1405
- o(this, "onAfterRender");
1406
- o(this, "afterRenderEmitter");
1407
- o(this, "arrowRenderer");
1408
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Te(e.color), this.svg.appendChild(this.group), this.line = Ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = U(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = U(), this.group.appendChild(this.targetArrow));
1400
+ i(this, "svg");
1401
+ i(this, "group", De());
1402
+ i(this, "line");
1403
+ i(this, "sourceArrow", null);
1404
+ i(this, "targetArrow", null);
1405
+ i(this, "onAfterRender");
1406
+ i(this, "afterRenderEmitter");
1407
+ i(this, "arrowRenderer");
1408
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Ce(e.color), this.svg.appendChild(this.group), this.line = Me(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
1409
1409
  }
1410
1410
  render(e) {
1411
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
1411
+ const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
1412
1412
  e.from,
1413
1413
  e.to
1414
1414
  );
1415
- Me(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1416
- const d = pe(
1415
+ Re(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1416
+ const d = we(
1417
1417
  e.from.direction,
1418
1418
  a,
1419
1419
  h
1420
- ), c = pe(
1420
+ ), c = we(
1421
1421
  e.to.direction,
1422
1422
  a,
1423
1423
  h
1424
1424
  ), g = {
1425
- x: i,
1425
+ x: o,
1426
1426
  y: n
1427
1427
  };
1428
1428
  let l = { x: -c.x, y: -c.y }, u;
1429
- e.category === M.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === M.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1429
+ e.category === D.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === D.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1430
1430
  const w = u(
1431
1431
  d,
1432
1432
  c,
@@ -1435,25 +1435,25 @@ class z {
1435
1435
  h
1436
1436
  );
1437
1437
  this.line.setAttribute("d", w.path);
1438
- let y = null;
1439
- this.sourceArrow && (y = this.arrowRenderer({
1438
+ let f = null;
1439
+ this.sourceArrow && (f = this.arrowRenderer({
1440
1440
  direction: d,
1441
1441
  shift: p,
1442
1442
  arrowLength: this.params.arrowLength
1443
- }), this.sourceArrow.setAttribute("d", y));
1444
- let E = null;
1445
- this.targetArrow && (E = this.arrowRenderer({
1443
+ }), this.sourceArrow.setAttribute("d", f));
1444
+ let v = null;
1445
+ this.targetArrow && (v = this.arrowRenderer({
1446
1446
  direction: l,
1447
1447
  shift: g,
1448
1448
  arrowLength: this.params.arrowLength
1449
- }), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
1449
+ }), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
1450
1450
  edgePath: w,
1451
- sourceArrowPath: y,
1452
- targetArrowPath: E
1451
+ sourceArrowPath: f,
1452
+ targetArrowPath: v
1453
1453
  });
1454
1454
  }
1455
1455
  }
1456
- const gt = (r) => (e) => {
1456
+ const ut = (r) => (e) => {
1457
1457
  const s = [
1458
1458
  p,
1459
1459
  { x: e.arrowLength, y: r.radius },
@@ -1463,18 +1463,18 @@ const gt = (r) => (e) => {
1463
1463
  ).map((h) => ({
1464
1464
  x: h.x + e.shift.x,
1465
1465
  y: h.y + e.shift.y
1466
- })), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1467
- return `${i} ${n} ${a} Z`;
1468
- }, ut = (r) => (e) => {
1469
- const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
1470
- (y) => m(y, e.direction, p)
1471
- ).map((y) => ({
1472
- x: y.x + e.shift.x,
1473
- y: y.y + e.shift.y
1474
- })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
1475
- return `${g} ${l} ${u} ${w}`;
1466
+ })), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1467
+ return `${o} ${n} ${a} Z`;
1476
1468
  }, pt = (r) => (e) => {
1477
- const t = r.smallRadius, s = r.radius, i = m(
1469
+ const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
1470
+ (f) => m(f, e.direction, p)
1471
+ ).map((f) => ({
1472
+ x: f.x + e.shift.x,
1473
+ y: f.y + e.shift.y
1474
+ })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
1475
+ return `${g} ${l} ${u} ${w}`;
1476
+ }, wt = (r) => (e) => {
1477
+ const t = r.smallRadius, s = r.radius, o = m(
1478
1478
  {
1479
1479
  x: e.arrowLength,
1480
1480
  y: 0
@@ -1487,51 +1487,51 @@ const gt = (r) => (e) => {
1487
1487
  x: e.arrowLength + r.smallRadius,
1488
1488
  y: 0
1489
1489
  }
1490
- ), a = [p, { x: i.x, y: -i.y }, i].map(
1490
+ ), a = [p, { x: o.x, y: -o.y }, o].map(
1491
1491
  (l) => m(l, e.direction, p)
1492
1492
  ).map((l) => ({
1493
1493
  x: l.x + e.shift.x,
1494
1494
  y: l.y + e.shift.y
1495
1495
  })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${s} ${s} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${s} ${s} 0 0 1 ${a[0].x} ${a[0].y}`;
1496
1496
  return `${h} ${d} ${c} ${g}`;
1497
- }, F = (r) => {
1497
+ }, I = (r) => {
1498
1498
  if (typeof r == "function")
1499
1499
  return r;
1500
1500
  switch (r.type) {
1501
1501
  case "triangle":
1502
- return gt({
1503
- radius: r.radius ?? f.polygonArrowRadius
1502
+ return ut({
1503
+ radius: r.radius ?? y.polygonArrowRadius
1504
1504
  });
1505
1505
  case "arc":
1506
- return ut({
1507
- radius: r.radius ?? f.circleArrowRadius
1506
+ return pt({
1507
+ radius: r.radius ?? y.circleArrowRadius
1508
1508
  });
1509
1509
  default:
1510
- return pt({
1511
- smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
1512
- angle: r.angle ?? f.wedgeArrowAngle,
1513
- radius: r.radius ?? f.wedgeArrowRadius
1510
+ return wt({
1511
+ smallRadius: r.smallRadius ?? y.wedgeArrowSmallRadius,
1512
+ angle: r.angle ?? y.wedgeArrowAngle,
1513
+ radius: r.radius ?? y.wedgeArrowRadius
1514
1514
  });
1515
1515
  }
1516
1516
  };
1517
- class wt {
1517
+ class ft {
1518
1518
  constructor(e) {
1519
- o(this, "svg");
1520
- o(this, "group");
1521
- o(this, "line");
1522
- o(this, "sourceArrow");
1523
- o(this, "targetArrow");
1524
- o(this, "onAfterRender");
1525
- o(this, "arrowLength");
1526
- o(this, "curvature");
1527
- o(this, "portCycleRadius");
1528
- o(this, "portCycleSmallRadius");
1529
- o(this, "detourDirection");
1530
- o(this, "detourDistance");
1531
- o(this, "hasSourceArrow");
1532
- o(this, "hasTargetArrow");
1533
- o(this, "pathShape");
1534
- o(this, "createCyclePath", (e) => new ht({
1519
+ i(this, "svg");
1520
+ i(this, "group");
1521
+ i(this, "line");
1522
+ i(this, "sourceArrow");
1523
+ i(this, "targetArrow");
1524
+ i(this, "onAfterRender");
1525
+ i(this, "arrowLength");
1526
+ i(this, "curvature");
1527
+ i(this, "portCycleRadius");
1528
+ i(this, "portCycleSmallRadius");
1529
+ i(this, "detourDirection");
1530
+ i(this, "detourDistance");
1531
+ i(this, "hasSourceArrow");
1532
+ i(this, "hasTargetArrow");
1533
+ i(this, "pathShape");
1534
+ i(this, "createCyclePath", (e) => new dt({
1535
1535
  sourceDirection: e,
1536
1536
  radius: this.portCycleRadius,
1537
1537
  smallRadius: this.portCycleSmallRadius,
@@ -1539,11 +1539,11 @@ class wt {
1539
1539
  hasSourceArrow: this.hasSourceArrow,
1540
1540
  hasTargetArrow: this.hasTargetArrow
1541
1541
  }));
1542
- o(this, "createDetourPath", (e, t, s, i, n) => new st({
1542
+ i(this, "createDetourPath", (e, t, s, o, n) => new ot({
1543
1543
  to: s,
1544
1544
  sourceDirection: e,
1545
1545
  targetDirection: t,
1546
- flipX: i,
1546
+ flipX: o,
1547
1547
  flipY: n,
1548
1548
  arrowLength: this.arrowLength,
1549
1549
  detourDirection: this.detourDirection,
@@ -1552,7 +1552,7 @@ class wt {
1552
1552
  hasSourceArrow: this.hasSourceArrow,
1553
1553
  hasTargetArrow: this.hasTargetArrow
1554
1554
  }));
1555
- o(this, "createLinePath", (e, t, s) => new rt({
1555
+ i(this, "createLinePath", (e, t, s) => new st({
1556
1556
  to: s,
1557
1557
  sourceDirection: e,
1558
1558
  targetDirection: t,
@@ -1561,10 +1561,10 @@ class wt {
1561
1561
  hasSourceArrow: this.hasSourceArrow,
1562
1562
  hasTargetArrow: this.hasTargetArrow
1563
1563
  }));
1564
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1565
- color: (e == null ? void 0 : e.color) ?? f.color,
1566
- width: (e == null ? void 0 : e.width) ?? f.width,
1567
- arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1564
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? y.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? y.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? y.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
1565
+ color: (e == null ? void 0 : e.color) ?? y.color,
1566
+ width: (e == null ? void 0 : e.width) ?? y.width,
1567
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1568
1568
  arrowLength: this.arrowLength,
1569
1569
  hasSourceArrow: this.hasSourceArrow,
1570
1570
  hasTargetArrow: this.hasTargetArrow,
@@ -1579,21 +1579,21 @@ class wt {
1579
1579
  }
1580
1580
  class yt {
1581
1581
  constructor(e) {
1582
- o(this, "svg");
1583
- o(this, "group");
1584
- o(this, "line");
1585
- o(this, "sourceArrow");
1586
- o(this, "targetArrow");
1587
- o(this, "onAfterRender");
1588
- o(this, "arrowLength");
1589
- o(this, "arrowOffset");
1590
- o(this, "roundness");
1591
- o(this, "cycleSquareSide");
1592
- o(this, "detourDistance");
1593
- o(this, "hasSourceArrow");
1594
- o(this, "hasTargetArrow");
1595
- o(this, "pathShape");
1596
- o(this, "createCyclePath", (e) => new J({
1582
+ i(this, "svg");
1583
+ i(this, "group");
1584
+ i(this, "line");
1585
+ i(this, "sourceArrow");
1586
+ i(this, "targetArrow");
1587
+ i(this, "onAfterRender");
1588
+ i(this, "arrowLength");
1589
+ i(this, "arrowOffset");
1590
+ i(this, "roundness");
1591
+ i(this, "cycleSquareSide");
1592
+ i(this, "detourDistance");
1593
+ i(this, "hasSourceArrow");
1594
+ i(this, "hasTargetArrow");
1595
+ i(this, "pathShape");
1596
+ i(this, "createCyclePath", (e) => new _({
1597
1597
  sourceDirection: e,
1598
1598
  arrowLength: this.arrowLength,
1599
1599
  side: this.cycleSquareSide,
@@ -1602,11 +1602,11 @@ class yt {
1602
1602
  hasSourceArrow: this.hasSourceArrow,
1603
1603
  hasTargetArrow: this.hasTargetArrow
1604
1604
  }));
1605
- o(this, "createDetourPath", (e, t, s, i, n) => new ct({
1605
+ i(this, "createDetourPath", (e, t, s, o, n) => new lt({
1606
1606
  to: s,
1607
1607
  sourceDirection: e,
1608
1608
  targetDirection: t,
1609
- flipX: i,
1609
+ flipX: o,
1610
1610
  flipY: n,
1611
1611
  arrowLength: this.arrowLength,
1612
1612
  arrowOffset: this.arrowOffset,
@@ -1615,27 +1615,27 @@ class yt {
1615
1615
  hasSourceArrow: this.hasSourceArrow,
1616
1616
  hasTargetArrow: this.hasTargetArrow
1617
1617
  }));
1618
- o(this, "createLinePath", (e, t, s, i) => new ot({
1618
+ i(this, "createLinePath", (e, t, s, o) => new it({
1619
1619
  to: s,
1620
1620
  sourceDirection: e,
1621
1621
  targetDirection: t,
1622
- flipX: i,
1622
+ flipX: o,
1623
1623
  arrowLength: this.arrowLength,
1624
1624
  arrowOffset: this.arrowOffset,
1625
1625
  roundness: this.roundness,
1626
1626
  hasSourceArrow: this.hasSourceArrow,
1627
1627
  hasTargetArrow: this.hasTargetArrow
1628
1628
  }));
1629
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1630
- const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1629
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
1630
+ const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
1631
1631
  this.roundness = Math.min(
1632
1632
  t,
1633
1633
  this.arrowOffset,
1634
1634
  this.cycleSquareSide / 2
1635
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1636
- color: (e == null ? void 0 : e.color) ?? f.color,
1637
- width: (e == null ? void 0 : e.width) ?? f.width,
1638
- arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1635
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
1636
+ color: (e == null ? void 0 : e.color) ?? y.color,
1637
+ width: (e == null ? void 0 : e.width) ?? y.width,
1638
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1639
1639
  arrowLength: this.arrowLength,
1640
1640
  hasSourceArrow: this.hasSourceArrow,
1641
1641
  hasTargetArrow: this.hasTargetArrow,
@@ -1648,24 +1648,24 @@ class yt {
1648
1648
  this.pathShape.render(e);
1649
1649
  }
1650
1650
  }
1651
- class ft {
1651
+ class mt {
1652
1652
  constructor(e) {
1653
- o(this, "svg");
1654
- o(this, "group");
1655
- o(this, "line");
1656
- o(this, "sourceArrow");
1657
- o(this, "targetArrow");
1658
- o(this, "onAfterRender");
1659
- o(this, "arrowLength");
1660
- o(this, "arrowOffset");
1661
- o(this, "roundness");
1662
- o(this, "cycleSquareSide");
1663
- o(this, "detourDirection");
1664
- o(this, "detourDistance");
1665
- o(this, "hasSourceArrow");
1666
- o(this, "hasTargetArrow");
1667
- o(this, "pathShape");
1668
- o(this, "createCyclePath", (e) => new J({
1653
+ i(this, "svg");
1654
+ i(this, "group");
1655
+ i(this, "line");
1656
+ i(this, "sourceArrow");
1657
+ i(this, "targetArrow");
1658
+ i(this, "onAfterRender");
1659
+ i(this, "arrowLength");
1660
+ i(this, "arrowOffset");
1661
+ i(this, "roundness");
1662
+ i(this, "cycleSquareSide");
1663
+ i(this, "detourDirection");
1664
+ i(this, "detourDistance");
1665
+ i(this, "hasSourceArrow");
1666
+ i(this, "hasTargetArrow");
1667
+ i(this, "pathShape");
1668
+ i(this, "createCyclePath", (e) => new _({
1669
1669
  sourceDirection: e,
1670
1670
  arrowLength: this.arrowLength,
1671
1671
  side: this.cycleSquareSide,
@@ -1674,11 +1674,11 @@ class ft {
1674
1674
  hasSourceArrow: this.hasSourceArrow,
1675
1675
  hasTargetArrow: this.hasTargetArrow
1676
1676
  }));
1677
- o(this, "createDetourPath", (e, t, s, i, n) => new it({
1677
+ i(this, "createDetourPath", (e, t, s, o, n) => new nt({
1678
1678
  to: s,
1679
1679
  sourceDirection: e,
1680
1680
  targetDirection: t,
1681
- flipX: i,
1681
+ flipX: o,
1682
1682
  flipY: n,
1683
1683
  arrowLength: this.arrowLength,
1684
1684
  arrowOffset: this.arrowOffset,
@@ -1688,7 +1688,7 @@ class ft {
1688
1688
  hasSourceArrow: this.hasSourceArrow,
1689
1689
  hasTargetArrow: this.hasTargetArrow
1690
1690
  }));
1691
- o(this, "createLinePath", (e, t, s) => new nt({
1691
+ i(this, "createLinePath", (e, t, s) => new at({
1692
1692
  to: s,
1693
1693
  sourceDirection: e,
1694
1694
  targetDirection: t,
@@ -1698,16 +1698,16 @@ class ft {
1698
1698
  hasSourceArrow: this.hasSourceArrow,
1699
1699
  hasTargetArrow: this.hasTargetArrow
1700
1700
  }));
1701
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1702
- const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1701
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
1702
+ const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
1703
1703
  this.roundness = Math.min(
1704
1704
  t,
1705
1705
  this.arrowOffset,
1706
1706
  this.cycleSquareSide / 2
1707
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1708
- color: (e == null ? void 0 : e.color) ?? f.color,
1709
- width: (e == null ? void 0 : e.width) ?? f.width,
1710
- arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1707
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
1708
+ color: (e == null ? void 0 : e.color) ?? y.color,
1709
+ width: (e == null ? void 0 : e.width) ?? y.width,
1710
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1711
1711
  arrowLength: this.arrowLength,
1712
1712
  hasSourceArrow: this.hasSourceArrow,
1713
1713
  hasTargetArrow: this.hasTargetArrow,
@@ -1720,23 +1720,23 @@ class ft {
1720
1720
  this.pathShape.render(e);
1721
1721
  }
1722
1722
  }
1723
- class mt {
1723
+ class vt {
1724
1724
  constructor(e) {
1725
- o(this, "svg");
1726
- o(this, "group");
1727
- o(this, "line");
1728
- o(this, "sourceArrow");
1729
- o(this, "targetArrow");
1730
- o(this, "onAfterRender");
1731
- o(this, "arrowLength");
1732
- o(this, "arrowOffset");
1733
- o(this, "roundness");
1734
- o(this, "cycleSquareSide");
1735
- o(this, "detourDistance");
1736
- o(this, "hasSourceArrow");
1737
- o(this, "hasTargetArrow");
1738
- o(this, "pathShape");
1739
- o(this, "createCyclePath", (e) => new J({
1725
+ i(this, "svg");
1726
+ i(this, "group");
1727
+ i(this, "line");
1728
+ i(this, "sourceArrow");
1729
+ i(this, "targetArrow");
1730
+ i(this, "onAfterRender");
1731
+ i(this, "arrowLength");
1732
+ i(this, "arrowOffset");
1733
+ i(this, "roundness");
1734
+ i(this, "cycleSquareSide");
1735
+ i(this, "detourDistance");
1736
+ i(this, "hasSourceArrow");
1737
+ i(this, "hasTargetArrow");
1738
+ i(this, "pathShape");
1739
+ i(this, "createCyclePath", (e) => new _({
1740
1740
  sourceDirection: e,
1741
1741
  arrowLength: this.arrowLength,
1742
1742
  side: this.cycleSquareSide,
@@ -1745,11 +1745,11 @@ class mt {
1745
1745
  hasSourceArrow: this.hasSourceArrow,
1746
1746
  hasTargetArrow: this.hasTargetArrow
1747
1747
  }));
1748
- o(this, "createDetourPath", (e, t, s, i, n) => new lt({
1748
+ i(this, "createDetourPath", (e, t, s, o, n) => new gt({
1749
1749
  to: s,
1750
1750
  sourceDirection: e,
1751
1751
  targetDirection: t,
1752
- flipX: i,
1752
+ flipX: o,
1753
1753
  flipY: n,
1754
1754
  arrowLength: this.arrowLength,
1755
1755
  arrowOffset: this.arrowOffset,
@@ -1758,7 +1758,7 @@ class mt {
1758
1758
  hasSourceArrow: this.hasSourceArrow,
1759
1759
  hasTargetArrow: this.hasTargetArrow
1760
1760
  }));
1761
- o(this, "createLinePath", (e, t, s, i, n) => new at({
1761
+ i(this, "createLinePath", (e, t, s, o, n) => new ht({
1762
1762
  to: s,
1763
1763
  sourceDirection: e,
1764
1764
  targetDirection: t,
@@ -1769,16 +1769,16 @@ class mt {
1769
1769
  hasSourceArrow: this.hasSourceArrow,
1770
1770
  hasTargetArrow: this.hasTargetArrow
1771
1771
  }));
1772
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1773
- const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1772
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
1773
+ const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
1774
1774
  this.roundness = Math.min(
1775
1775
  t,
1776
1776
  this.arrowOffset,
1777
1777
  this.cycleSquareSide / 2
1778
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new z({
1779
- color: (e == null ? void 0 : e.color) ?? f.color,
1780
- width: (e == null ? void 0 : e.width) ?? f.width,
1781
- arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1778
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
1779
+ color: (e == null ? void 0 : e.color) ?? y.color,
1780
+ width: (e == null ? void 0 : e.width) ?? y.width,
1781
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1782
1782
  arrowLength: this.arrowLength,
1783
1783
  hasSourceArrow: this.hasSourceArrow,
1784
1784
  hasTargetArrow: this.hasTargetArrow,
@@ -1793,28 +1793,28 @@ class mt {
1793
1793
  }
1794
1794
  class Le {
1795
1795
  constructor(e) {
1796
- o(this, "svg");
1797
- o(this, "group", De());
1798
- o(this, "line");
1799
- o(this, "sourceArrow", null);
1800
- o(this, "targetArrow", null);
1801
- o(this, "color");
1802
- o(this, "width");
1803
- o(this, "arrowLength");
1804
- o(this, "sourceOffset");
1805
- o(this, "targetOffset");
1806
- o(this, "onAfterRender");
1807
- o(this, "afterRenderEmitter");
1808
- o(this, "arrowRenderer");
1809
- [this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = F((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Te(this.color), this.svg.appendChild(this.group), this.line = Ce(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = U(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = U(), this.group.appendChild(this.targetArrow));
1796
+ i(this, "svg");
1797
+ i(this, "group", De());
1798
+ i(this, "line");
1799
+ i(this, "sourceArrow", null);
1800
+ i(this, "targetArrow", null);
1801
+ i(this, "color");
1802
+ i(this, "width");
1803
+ i(this, "arrowLength");
1804
+ i(this, "sourceOffset");
1805
+ i(this, "targetOffset");
1806
+ i(this, "onAfterRender");
1807
+ i(this, "afterRenderEmitter");
1808
+ i(this, "arrowRenderer");
1809
+ [this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? y.color, this.width = (e == null ? void 0 : e.width) ?? y.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? y.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? y.preOffset, this.svg = Ce(this.color), this.svg.appendChild(this.group), this.line = Me(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
1810
1810
  }
1811
1811
  render(e) {
1812
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
1812
+ const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
1813
1813
  e.from,
1814
1814
  e.to
1815
1815
  );
1816
- Me(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1817
- const d = { x: i, y: n }, c = new dt({
1816
+ Re(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1817
+ const d = { x: o, y: n }, c = new ct({
1818
1818
  to: d,
1819
1819
  sourceOffset: this.sourceOffset,
1820
1820
  targetOffset: this.targetOffset,
@@ -1833,26 +1833,26 @@ class Le {
1833
1833
  y: d.y / u
1834
1834
  };
1835
1835
  if (this.sourceArrow) {
1836
- const y = {
1836
+ const f = {
1837
1837
  x: w.x * this.sourceOffset,
1838
1838
  y: w.y * this.sourceOffset
1839
1839
  };
1840
1840
  g = this.arrowRenderer({
1841
1841
  direction: w,
1842
- shift: y,
1842
+ shift: f,
1843
1843
  arrowLength: this.arrowLength
1844
1844
  }), this.sourceArrow.setAttribute("d", g);
1845
1845
  }
1846
1846
  if (this.targetArrow) {
1847
- const y = {
1847
+ const f = {
1848
1848
  x: w.x * this.targetOffset,
1849
1849
  y: w.y * this.targetOffset
1850
1850
  };
1851
1851
  l = this.arrowRenderer({
1852
1852
  direction: { x: -w.x, y: -w.y },
1853
1853
  shift: {
1854
- x: d.x - y.x,
1855
- y: d.y - y.y
1854
+ x: d.x - f.x,
1855
+ y: d.y - f.y
1856
1856
  },
1857
1857
  arrowLength: this.arrowLength
1858
1858
  }), this.targetArrow.setAttribute("d", l);
@@ -1865,13 +1865,13 @@ class Le {
1865
1865
  });
1866
1866
  }
1867
1867
  }
1868
- const vt = () => {
1868
+ const At = () => {
1869
1869
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1870
1870
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1871
- }, At = (r) => {
1871
+ }, xt = (r) => {
1872
1872
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1873
1873
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1874
- }, we = (r) => {
1874
+ }, fe = (r) => {
1875
1875
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1876
1876
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1877
1877
  };
@@ -1880,42 +1880,42 @@ class Et extends Error {
1880
1880
  super(e), this.name = "InteractiveEdgeError";
1881
1881
  }
1882
1882
  }
1883
- class Re {
1883
+ class Ve {
1884
1884
  constructor(e, t) {
1885
- o(this, "svg");
1886
- o(this, "group");
1887
- o(this, "line");
1888
- o(this, "sourceArrow");
1889
- o(this, "targetArrow");
1890
- o(this, "handle", vt());
1891
- o(this, "onAfterRender");
1892
- o(this, "interactiveLine");
1893
- o(this, "interactiveSourceArrow", null);
1894
- o(this, "interactiveTargetArrow", null);
1895
- if (this.baseEdge = e, e instanceof Re)
1885
+ i(this, "svg");
1886
+ i(this, "group");
1887
+ i(this, "line");
1888
+ i(this, "sourceArrow");
1889
+ i(this, "targetArrow");
1890
+ i(this, "handle", At());
1891
+ i(this, "onAfterRender");
1892
+ i(this, "interactiveLine");
1893
+ i(this, "interactiveSourceArrow", null);
1894
+ i(this, "interactiveTargetArrow", null);
1895
+ if (this.baseEdge = e, e instanceof Ve)
1896
1896
  throw new Et(
1897
1897
  "interactive edge can be configured only once"
1898
1898
  );
1899
1899
  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;
1900
- const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1901
- this.interactiveLine = At(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = we(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = we(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1902
- this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1900
+ const s = (t == null ? void 0 : t.distance) ?? y.interactiveWidth;
1901
+ this.interactiveLine = xt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = fe(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = fe(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
1902
+ this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
1903
1903
  });
1904
1904
  }
1905
1905
  render(e) {
1906
1906
  this.baseEdge.render(e);
1907
1907
  }
1908
1908
  }
1909
- class dr {
1909
+ class yr {
1910
1910
  constructor(e, t) {
1911
- o(this, "group");
1912
- o(this, "line");
1913
- o(this, "sourceArrow");
1914
- o(this, "targetArrow");
1915
- o(this, "onAfterRender");
1916
- o(this, "svg");
1911
+ i(this, "group");
1912
+ i(this, "line");
1913
+ i(this, "sourceArrow");
1914
+ i(this, "targetArrow");
1915
+ i(this, "onAfterRender");
1916
+ i(this, "svg");
1917
1917
  this.baseShape = e, this.midpointElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
1918
- const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1918
+ const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
1919
1919
  this.midpointElement.style.setProperty("transform", n);
1920
1920
  });
1921
1921
  }
@@ -1923,21 +1923,21 @@ class dr {
1923
1923
  this.baseShape.render(e);
1924
1924
  }
1925
1925
  }
1926
- class Ve {
1926
+ class Fe {
1927
1927
  constructor(e) {
1928
- o(this, "onAfterNodeAdded");
1929
- o(this, "onAfterNodeUpdated");
1930
- o(this, "onAfterNodePriorityUpdated");
1931
- o(this, "onBeforeNodeRemoved");
1932
- o(this, "onAfterPortMarked");
1933
- o(this, "onAfterPortUpdated");
1934
- o(this, "onBeforePortUnmarked");
1935
- o(this, "onAfterEdgeAdded");
1936
- o(this, "onAfterEdgeShapeUpdated");
1937
- o(this, "onAfterEdgeUpdated");
1938
- o(this, "onAfterEdgePriorityUpdated");
1939
- o(this, "onBeforeEdgeRemoved");
1940
- o(this, "onBeforeClear");
1928
+ i(this, "onAfterNodeAdded");
1929
+ i(this, "onAfterNodeUpdated");
1930
+ i(this, "onAfterNodePriorityUpdated");
1931
+ i(this, "onBeforeNodeRemoved");
1932
+ i(this, "onAfterPortMarked");
1933
+ i(this, "onAfterPortUpdated");
1934
+ i(this, "onBeforePortUnmarked");
1935
+ i(this, "onAfterEdgeAdded");
1936
+ i(this, "onAfterEdgeShapeUpdated");
1937
+ i(this, "onAfterEdgeUpdated");
1938
+ i(this, "onAfterEdgePriorityUpdated");
1939
+ i(this, "onBeforeEdgeRemoved");
1940
+ i(this, "onBeforeClear");
1941
1941
  this.graphStore = e, this.onAfterNodeAdded = this.graphStore.onAfterNodeAdded, this.onAfterNodeUpdated = this.graphStore.onAfterNodeUpdated, this.onAfterNodePriorityUpdated = this.graphStore.onAfterNodePriorityUpdated, this.onBeforeNodeRemoved = this.graphStore.onBeforeNodeRemoved, this.onAfterPortMarked = this.graphStore.onAfterPortAdded, this.onAfterPortUpdated = this.graphStore.onAfterPortUpdated, this.onBeforePortUnmarked = this.graphStore.onBeforePortRemoved, this.onAfterEdgeAdded = this.graphStore.onAfterEdgeAdded, this.onAfterEdgeShapeUpdated = this.graphStore.onAfterEdgeShapeUpdated, this.onAfterEdgeUpdated = this.graphStore.onAfterEdgeUpdated, this.onAfterEdgePriorityUpdated = this.graphStore.onAfterEdgePriorityUpdated, this.onBeforeEdgeRemoved = this.graphStore.onBeforeEdgeRemoved, this.onBeforeClear = this.graphStore.onBeforeClear;
1942
1942
  }
1943
1943
  hasNode(e) {
@@ -2019,11 +2019,11 @@ class Ve {
2019
2019
  return this.graphStore.getNodeAdjacentEdgeIds(e);
2020
2020
  }
2021
2021
  }
2022
- class Fe {
2022
+ class Ie {
2023
2023
  constructor(e) {
2024
- o(this, "onBeforeUpdated");
2025
- o(this, "onAfterUpdated");
2026
- o(this, "onAfterResize");
2024
+ i(this, "onBeforeUpdated");
2025
+ i(this, "onAfterUpdated");
2026
+ i(this, "onAfterResize");
2027
2027
  this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated, this.onAfterResize = this.viewportStore.onAfterResize;
2028
2028
  }
2029
2029
  getViewportMatrix() {
@@ -2042,10 +2042,10 @@ class Fe {
2042
2042
  return this.viewportStore.createViewportCoords(e);
2043
2043
  }
2044
2044
  }
2045
- const Ie = (r, e) => {
2046
- const t = new xe(), s = new Ve(t), i = new Fe(e), n = new Ae(t, e, r), a = {
2045
+ const Be = (r, e) => {
2046
+ const t = new Se(), s = new Fe(t), o = new Ie(e), n = new xe(t, e, r), a = {
2047
2047
  nodes: {
2048
- centerFn: Pe,
2048
+ centerFn: Ne,
2049
2049
  priorityFn: () => 0
2050
2050
  },
2051
2051
  edges: {
@@ -2058,29 +2058,29 @@ const Ie = (r, e) => {
2058
2058
  };
2059
2059
  return new Ee(
2060
2060
  s,
2061
- i,
2061
+ o,
2062
2062
  t,
2063
2063
  e,
2064
2064
  n,
2065
2065
  a
2066
2066
  );
2067
2067
  };
2068
- class k {
2069
- constructor(e, t, s, i) {
2070
- o(this, "onAfterPortMarked", (e) => {
2068
+ class Y {
2069
+ constructor(e, t, s, o) {
2070
+ i(this, "onAfterPortMarked", (e) => {
2071
2071
  const t = this.canvas.graph.getPort(e);
2072
2072
  this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.hookPortEvents(t.element);
2073
2073
  });
2074
- o(this, "onBeforePortUnmarked", (e) => {
2074
+ i(this, "onBeforePortUnmarked", (e) => {
2075
2075
  const t = this.canvas.graph.getPort(e);
2076
2076
  this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.unhookPortEvents(t.element);
2077
2077
  });
2078
- o(this, "onPortMouseDown", (e) => {
2078
+ i(this, "onPortMouseDown", (e) => {
2079
2079
  const t = e;
2080
2080
  if (!this.params.mouseDownEventVerifier(t))
2081
2081
  return;
2082
- const s = e.currentTarget, i = this.canvas.graph.findPortIdsByElement(s)[0];
2083
- this.params.onPortPointerDown(i, {
2082
+ const s = e.currentTarget, o = this.canvas.graph.findPortIdsByElement(s)[0];
2083
+ this.params.onPortPointerDown(o, {
2084
2084
  x: t.clientX,
2085
2085
  y: t.clientY
2086
2086
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
@@ -2089,8 +2089,8 @@ class k {
2089
2089
  passive: !0
2090
2090
  }));
2091
2091
  });
2092
- o(this, "onWindowMouseMove", (e) => {
2093
- if (!L(
2092
+ i(this, "onWindowMouseMove", (e) => {
2093
+ if (!R(
2094
2094
  this.window,
2095
2095
  this.element,
2096
2096
  e.clientX,
@@ -2101,14 +2101,14 @@ class k {
2101
2101
  }
2102
2102
  this.params.onPointerMove({ x: e.clientX, y: e.clientY });
2103
2103
  });
2104
- o(this, "onWindowMouseUp", (e) => {
2104
+ i(this, "onWindowMouseUp", (e) => {
2105
2105
  this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
2106
2106
  });
2107
- o(this, "onPortTouchStart", (e) => {
2107
+ i(this, "onPortTouchStart", (e) => {
2108
2108
  const t = e;
2109
2109
  if (t.touches.length !== 1)
2110
2110
  return;
2111
- const s = t.touches[0], i = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(i)[0];
2111
+ const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(o)[0];
2112
2112
  this.params.onPortPointerDown(n, {
2113
2113
  x: s.clientX,
2114
2114
  y: s.clientY
@@ -2120,9 +2120,9 @@ class k {
2120
2120
  passive: !0
2121
2121
  }));
2122
2122
  });
2123
- o(this, "onWindowTouchMove", (e) => {
2123
+ i(this, "onWindowTouchMove", (e) => {
2124
2124
  const t = e.touches[0];
2125
- if (!L(
2125
+ if (!R(
2126
2126
  this.window,
2127
2127
  this.element,
2128
2128
  t.clientX,
@@ -2133,23 +2133,23 @@ class k {
2133
2133
  }
2134
2134
  this.params.onPointerMove({ x: t.clientX, y: t.clientY });
2135
2135
  });
2136
- o(this, "onWindowTouchFinish", (e) => {
2136
+ i(this, "onWindowTouchFinish", (e) => {
2137
2137
  const t = e.changedTouches[0];
2138
2138
  this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
2139
2139
  });
2140
- o(this, "onBeforeClear", () => {
2140
+ i(this, "onBeforeClear", () => {
2141
2141
  this.canvas.graph.getAllPortIds().forEach((e) => {
2142
2142
  const t = this.canvas.graph.getPort(e);
2143
2143
  this.unhookPortEvents(t.element);
2144
2144
  });
2145
2145
  });
2146
- o(this, "onBeforeDestroy", () => {
2146
+ i(this, "onBeforeDestroy", () => {
2147
2147
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2148
2148
  });
2149
- this.canvas = e, this.element = t, this.window = s, this.params = i, 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);
2149
+ this.canvas = e, this.element = t, this.window = s, this.params = o, 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);
2150
2150
  }
2151
- static configure(e, t, s, i) {
2152
- new k(e, t, s, i);
2151
+ static configure(e, t, s, o) {
2152
+ new Y(e, t, s, o);
2153
2153
  }
2154
2154
  hookPortEvents(e) {
2155
2155
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2174,7 +2174,7 @@ class k {
2174
2174
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2175
2175
  }
2176
2176
  }
2177
- class xt {
2177
+ class St {
2178
2178
  constructor(e, t, s) {
2179
2179
  this.canvas = e, this.layoutAlgorithm = t, this.params = s;
2180
2180
  }
@@ -2188,7 +2188,7 @@ class xt {
2188
2188
  }), this.params.onAfterApplied();
2189
2189
  }
2190
2190
  }
2191
- class St {
2191
+ class bt {
2192
2192
  constructor(e, t, s) {
2193
2193
  this.canvas = e, this.layoutAlgorithm = t, this.params = s;
2194
2194
  }
@@ -2198,17 +2198,17 @@ class St {
2198
2198
  viewport: this.canvas.viewport,
2199
2199
  dt: e
2200
2200
  });
2201
- this.params.onBeforeApplied(), t.forEach((s, i) => {
2202
- this.params.staticNodeResolver(i) || this.canvas.updateNode(i, s);
2201
+ this.params.onBeforeApplied(), t.forEach((s, o) => {
2202
+ this.params.staticNodeResolver(o) || this.canvas.updateNode(o, s);
2203
2203
  }), this.params.onAfterApplied();
2204
2204
  }
2205
2205
  }
2206
- class _ {
2207
- constructor(e, t, s, i) {
2208
- o(this, "grabbedNode", null);
2209
- o(this, "maxNodePriority", 0);
2210
- o(this, "graph");
2211
- o(this, "onAfterNodeAdded", (e) => {
2206
+ class ee {
2207
+ constructor(e, t, s, o) {
2208
+ i(this, "grabbedNode", null);
2209
+ i(this, "maxNodePriority", 0);
2210
+ i(this, "graph");
2211
+ i(this, "onAfterNodeAdded", (e) => {
2212
2212
  this.updateMaxNodePriority(e);
2213
2213
  const { element: t } = this.graph.getNode(e);
2214
2214
  t.addEventListener("mousedown", this.onMouseDown, {
@@ -2217,50 +2217,50 @@ class _ {
2217
2217
  passive: !0
2218
2218
  });
2219
2219
  });
2220
- o(this, "onAfterNodeUpdated", (e) => {
2220
+ i(this, "onAfterNodeUpdated", (e) => {
2221
2221
  this.updateMaxNodePriority(e);
2222
2222
  });
2223
- o(this, "onBeforeNodeRemoved", (e) => {
2223
+ i(this, "onBeforeNodeRemoved", (e) => {
2224
2224
  const { element: t } = this.graph.getNode(e);
2225
2225
  t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2226
2226
  });
2227
- o(this, "onBeforeDestroy", () => {
2227
+ i(this, "onBeforeDestroy", () => {
2228
2228
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2229
2229
  });
2230
- o(this, "onBeforeClear", () => {
2230
+ i(this, "onBeforeClear", () => {
2231
2231
  this.canvas.graph.getAllNodeIds().forEach((e) => {
2232
2232
  const { element: t } = this.canvas.graph.getNode(e);
2233
2233
  t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2234
2234
  }), this.maxNodePriority = 0;
2235
2235
  });
2236
- o(this, "onMouseDown", (e) => {
2236
+ i(this, "onMouseDown", (e) => {
2237
2237
  const t = e;
2238
2238
  if (!this.params.mouseDownEventVerifier(t))
2239
2239
  return;
2240
- const s = e.currentTarget, i = this.graph.findNodeIdByElement(s), n = this.graph.getNode(i);
2241
- if (!this.params.nodeDragVerifier(i))
2240
+ const s = e.currentTarget, o = this.graph.findNodeIdByElement(s), n = this.graph.getNode(o);
2241
+ if (!this.params.nodeDragVerifier(o))
2242
2242
  return;
2243
- this.params.onNodeDragStarted(i), e.stopPropagation();
2243
+ this.params.onNodeDragStarted(o), e.stopPropagation();
2244
2244
  const h = this.calculateContentPoint({
2245
2245
  x: t.clientX,
2246
2246
  y: t.clientY
2247
2247
  });
2248
2248
  this.grabbedNode = {
2249
- nodeId: i,
2249
+ nodeId: o,
2250
2250
  dx: h.x - n.x,
2251
2251
  dy: h.y - n.y
2252
- }, B(this.element, this.params.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2252
+ }, U(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2253
2253
  passive: !0
2254
2254
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2255
2255
  passive: !0
2256
2256
  });
2257
2257
  });
2258
- o(this, "onTouchStart", (e) => {
2258
+ i(this, "onTouchStart", (e) => {
2259
2259
  const t = e;
2260
2260
  if (t.touches.length !== 1)
2261
2261
  return;
2262
2262
  e.stopPropagation();
2263
- const s = t.touches[0], i = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(i), a = this.graph.getNode(n);
2263
+ const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(o), a = this.graph.getNode(n);
2264
2264
  if (!this.params.nodeDragVerifier({
2265
2265
  nodeId: n,
2266
2266
  element: a.element,
@@ -2284,8 +2284,8 @@ class _ {
2284
2284
  passive: !0
2285
2285
  });
2286
2286
  });
2287
- o(this, "onWindowMouseMove", (e) => {
2288
- if (!L(
2287
+ i(this, "onWindowMouseMove", (e) => {
2288
+ if (!R(
2289
2289
  this.window,
2290
2290
  this.element,
2291
2291
  e.clientX,
@@ -2299,14 +2299,14 @@ class _ {
2299
2299
  y: e.clientY
2300
2300
  });
2301
2301
  });
2302
- o(this, "onWindowMouseUp", (e) => {
2302
+ i(this, "onWindowMouseUp", (e) => {
2303
2303
  this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2304
2304
  });
2305
- o(this, "onWindowTouchMove", (e) => {
2305
+ i(this, "onWindowTouchMove", (e) => {
2306
2306
  if (e.touches.length !== 1)
2307
2307
  return;
2308
2308
  const t = e.touches[0];
2309
- if (!L(
2309
+ if (!R(
2310
2310
  this.window,
2311
2311
  this.element,
2312
2312
  t.clientX,
@@ -2320,21 +2320,21 @@ class _ {
2320
2320
  y: t.clientY
2321
2321
  });
2322
2322
  });
2323
- o(this, "onWindowTouchFinish", () => {
2323
+ i(this, "onWindowTouchFinish", () => {
2324
2324
  this.cancelTouchDrag();
2325
2325
  });
2326
- this.canvas = e, this.element = t, this.window = s, this.params = 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);
2326
+ this.canvas = e, this.element = t, this.window = s, this.params = o, 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);
2327
2327
  }
2328
- static configure(e, t, s, i) {
2329
- new _(e, t, s, i);
2328
+ static configure(e, t, s, o) {
2329
+ new ee(e, t, s, o);
2330
2330
  }
2331
2331
  moveNode(e, t) {
2332
2332
  if (!this.graph.hasNode(e.nodeId))
2333
2333
  return;
2334
- const s = this.calculateContentPoint(t), i = {
2334
+ const s = this.calculateContentPoint(t), o = {
2335
2335
  x: s.x - e.dx,
2336
2336
  y: s.y - e.dy
2337
- }, n = this.adjustNodeCoords(i);
2337
+ }, n = this.adjustNodeCoords(o);
2338
2338
  this.canvas.updateNode(e.nodeId, {
2339
2339
  x: n.x,
2340
2340
  y: n.y
@@ -2344,15 +2344,15 @@ class _ {
2344
2344
  if (this.params.moveOnTop) {
2345
2345
  if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
2346
2346
  const t = this.maxNodePriority;
2347
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
2348
- this.canvas.updateEdge(i, { priority: t });
2347
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
2348
+ this.canvas.updateEdge(o, { priority: t });
2349
2349
  });
2350
2350
  }
2351
2351
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
2352
2352
  }
2353
2353
  }
2354
2354
  cancelMouseDrag() {
2355
- this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, B(this.element, null), this.removeMouseDragListeners();
2355
+ this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
2356
2356
  }
2357
2357
  removeMouseDragListeners() {
2358
2358
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -2395,51 +2395,51 @@ class _ {
2395
2395
  return e;
2396
2396
  }
2397
2397
  }
2398
- const bt = (r, e, t) => ({
2398
+ const Pt = (r, e, t) => ({
2399
2399
  scale: r.scale,
2400
2400
  x: r.x + r.scale * e,
2401
2401
  y: r.y + r.scale * t
2402
- }), Pt = (r, e, t, s) => ({
2402
+ }), Nt = (r, e, t, s) => ({
2403
2403
  scale: r.scale * e,
2404
2404
  x: r.scale * (1 - e) * t + r.x,
2405
2405
  y: r.scale * (1 - e) * s + r.y
2406
- }), I = (r) => {
2406
+ }), B = (r) => {
2407
2407
  const e = [], t = r.touches.length;
2408
2408
  for (let h = 0; h < t; h++)
2409
2409
  e.push([r.touches[h].clientX, r.touches[h].clientY]);
2410
2410
  const s = e.reduce(
2411
2411
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2412
2412
  [0, 0]
2413
- ), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2413
+ ), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
2414
2414
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2415
2415
  0
2416
2416
  );
2417
2417
  return {
2418
- x: i[0],
2419
- y: i[1],
2418
+ x: o[0],
2419
+ y: o[1],
2420
2420
  scale: a / t,
2421
2421
  touchesCnt: t,
2422
2422
  touches: e
2423
2423
  };
2424
2424
  };
2425
- class H {
2426
- constructor(e, t, s, i) {
2427
- o(this, "viewport");
2428
- o(this, "prevTouches", null);
2429
- o(this, "wheelFinishTimer", null);
2430
- o(this, "transformInProgress", !1);
2431
- o(this, "onBeforeDestroy", () => {
2425
+ class X {
2426
+ constructor(e, t, s, o) {
2427
+ i(this, "viewport");
2428
+ i(this, "prevTouches", null);
2429
+ i(this, "wheelFinishTimer", null);
2430
+ i(this, "transformInProgress", !1);
2431
+ i(this, "onBeforeDestroy", () => {
2432
2432
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2433
2433
  });
2434
- o(this, "onMouseDown", (e) => {
2435
- this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2434
+ i(this, "onMouseDown", (e) => {
2435
+ this.params.mouseDownEventVerifier(e) && (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2436
2436
  passive: !0
2437
2437
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2438
2438
  passive: !0
2439
2439
  }), this.startRegisteredTransform());
2440
2440
  });
2441
- o(this, "onWindowMouseMove", (e) => {
2442
- const t = L(
2441
+ i(this, "onWindowMouseMove", (e) => {
2442
+ const t = R(
2443
2443
  this.window,
2444
2444
  this.element,
2445
2445
  e.clientX,
@@ -2449,26 +2449,26 @@ class H {
2449
2449
  this.stopMouseDrag();
2450
2450
  return;
2451
2451
  }
2452
- const s = -e.movementX, i = -e.movementY;
2453
- this.moveViewport(s, i);
2452
+ const s = -e.movementX, o = -e.movementY;
2453
+ this.moveViewport(s, o);
2454
2454
  });
2455
- o(this, "onWindowMouseUp", (e) => {
2455
+ i(this, "onWindowMouseUp", (e) => {
2456
2456
  this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
2457
2457
  });
2458
- o(this, "onWheelScroll", (e) => {
2458
+ i(this, "onWheelScroll", (e) => {
2459
2459
  if (!this.params.mouseWheelEventVerifier(e))
2460
2460
  return;
2461
- const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2462
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2461
+ const { left: t, top: s } = this.element.getBoundingClientRect(), o = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2462
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2463
2463
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2464
2464
  }, this.params.scaleWheelFinishTimeout);
2465
2465
  });
2466
- o(this, "onTouchStart", (e) => {
2466
+ i(this, "onTouchStart", (e) => {
2467
2467
  if (this.prevTouches !== null) {
2468
- this.prevTouches = I(e);
2468
+ this.prevTouches = B(e);
2469
2469
  return;
2470
2470
  }
2471
- this.prevTouches = I(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2471
+ this.prevTouches = B(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2472
2472
  passive: !0
2473
2473
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2474
2474
  passive: !0
@@ -2476,10 +2476,10 @@ class H {
2476
2476
  passive: !0
2477
2477
  }), this.startRegisteredTransform();
2478
2478
  });
2479
- o(this, "onWindowTouchMove", (e) => {
2480
- const t = I(e);
2479
+ i(this, "onWindowTouchMove", (e) => {
2480
+ const t = B(e);
2481
2481
  if (!t.touches.every(
2482
- (i) => L(this.window, this.element, i[0], i[1])
2482
+ (o) => R(this.window, this.element, o[0], o[1])
2483
2483
  )) {
2484
2484
  this.stopTouchDrag();
2485
2485
  return;
@@ -2488,18 +2488,18 @@ class H {
2488
2488
  -(t.x - this.prevTouches.x),
2489
2489
  -(t.y - this.prevTouches.y)
2490
2490
  ), t.touchesCnt === 2) {
2491
- const { left: i, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - i, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2491
+ const { left: o, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - o, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2492
2492
  this.scaleViewport(c, a, h);
2493
2493
  }
2494
2494
  this.prevTouches = t;
2495
2495
  });
2496
- o(this, "onWindowTouchFinish", (e) => {
2497
- e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
2496
+ i(this, "onWindowTouchFinish", (e) => {
2497
+ e.touches.length > 0 ? this.prevTouches = B(e) : this.stopTouchDrag();
2498
2498
  });
2499
- o(this, "preventWheelScaleListener", (e) => {
2499
+ i(this, "preventWheelScaleListener", (e) => {
2500
2500
  e.preventDefault();
2501
2501
  });
2502
- this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2502
+ this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2503
2503
  passive: !1
2504
2504
  }), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
2505
2505
  this.handleResize();
@@ -2511,21 +2511,21 @@ class H {
2511
2511
  passive: !0
2512
2512
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2513
2513
  }
2514
- static configure(e, t, s, i) {
2515
- new H(e, t, s, i);
2514
+ static configure(e, t, s, o) {
2515
+ new X(e, t, s, o);
2516
2516
  }
2517
2517
  moveViewport(e, t) {
2518
- const s = this.viewport.getViewportMatrix(), i = bt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2518
+ const s = this.viewport.getViewportMatrix(), o = Pt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2519
2519
  prevTransform: s,
2520
- nextTransform: i,
2520
+ nextTransform: o,
2521
2521
  canvasWidth: n,
2522
2522
  canvasHeight: a
2523
2523
  });
2524
2524
  this.performTransform(h);
2525
2525
  }
2526
2526
  scaleViewport(e, t, s) {
2527
- const i = this.canvas.viewport.getViewportMatrix(), n = Pt(i, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2528
- prevTransform: i,
2527
+ const o = this.canvas.viewport.getViewportMatrix(), n = Nt(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2528
+ prevTransform: o,
2529
2529
  nextTransform: n,
2530
2530
  canvasWidth: a,
2531
2531
  canvasHeight: h
@@ -2533,7 +2533,7 @@ class H {
2533
2533
  this.performTransform(d);
2534
2534
  }
2535
2535
  stopMouseDrag() {
2536
- B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2536
+ U(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2537
2537
  }
2538
2538
  removeMouseDragListeners() {
2539
2539
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2554,28 +2554,28 @@ class H {
2554
2554
  this.transformInProgress = !1, this.params.onTransformFinished();
2555
2555
  }
2556
2556
  handleResize() {
2557
- const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), i = this.params.transformPreprocessor({
2557
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2558
2558
  prevTransform: e,
2559
2559
  nextTransform: e,
2560
2560
  canvasWidth: t,
2561
2561
  canvasHeight: s
2562
2562
  });
2563
- this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2563
+ this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
2564
2564
  }
2565
2565
  }
2566
- class ee {
2567
- constructor(e, t, s, i, n, a) {
2568
- o(this, "nodeHorizontal");
2569
- o(this, "nodeVertical");
2570
- o(this, "viewport");
2571
- o(this, "currentScale");
2572
- o(this, "loadedArea", {
2566
+ class te {
2567
+ constructor(e, t, s, o, n, a) {
2568
+ i(this, "nodeHorizontal");
2569
+ i(this, "nodeVertical");
2570
+ i(this, "viewport");
2571
+ i(this, "currentScale");
2572
+ i(this, "loadedArea", {
2573
2573
  xFrom: 1 / 0,
2574
2574
  xTo: 1 / 0,
2575
2575
  yFrom: 1 / 0,
2576
2576
  yTo: 1 / 0
2577
2577
  });
2578
- o(this, "updateLoadedArea", (e) => {
2578
+ i(this, "updateLoadedArea", (e) => {
2579
2579
  this.loadedArea = {
2580
2580
  xFrom: e.x,
2581
2581
  xTo: e.x + e.width,
@@ -2583,46 +2583,46 @@ class ee {
2583
2583
  yTo: e.y + e.height
2584
2584
  };
2585
2585
  });
2586
- o(this, "onAfterViewportUpdated", () => {
2586
+ i(this, "onAfterViewportUpdated", () => {
2587
2587
  this.userTransformInProgress || this.loadAreaAroundViewport();
2588
2588
  });
2589
- o(this, "userTransformInProgress", !1);
2589
+ i(this, "userTransformInProgress", !1);
2590
2590
  this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2591
2591
  this.scheduleLoadAreaAroundViewport();
2592
2592
  });
2593
2593
  const h = {
2594
- ...i,
2594
+ ...o,
2595
2595
  onResizeTransformStarted: () => {
2596
- this.userTransformInProgress = !0, i.onResizeTransformStarted();
2596
+ this.userTransformInProgress = !0, o.onResizeTransformStarted();
2597
2597
  },
2598
2598
  onResizeTransformFinished: () => {
2599
- this.userTransformInProgress = !1, i.onResizeTransformFinished();
2599
+ this.userTransformInProgress = !1, o.onResizeTransformFinished();
2600
2600
  },
2601
2601
  onBeforeTransformChange: () => {
2602
- this.userTransformInProgress = !0, i.onBeforeTransformChange();
2602
+ this.userTransformInProgress = !0, o.onBeforeTransformChange();
2603
2603
  },
2604
2604
  onTransformChange: () => {
2605
2605
  this.userTransformInProgress = !1;
2606
2606
  const d = this.currentScale;
2607
- this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), i.onTransformChange();
2607
+ this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
2608
2608
  },
2609
2609
  onTransformFinished: () => {
2610
- this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
2610
+ this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
2611
2611
  }
2612
2612
  };
2613
- H.configure(
2613
+ X.configure(
2614
2614
  e,
2615
2615
  this.element,
2616
2616
  this.window,
2617
2617
  h
2618
2618
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2619
2619
  }
2620
- static configure(e, t, s, i, n, a) {
2621
- new ee(
2620
+ static configure(e, t, s, o, n, a) {
2621
+ new te(
2622
2622
  e,
2623
2623
  t,
2624
2624
  s,
2625
- i,
2625
+ o,
2626
2626
  n,
2627
2627
  a
2628
2628
  );
@@ -2634,12 +2634,12 @@ class ee {
2634
2634
  }
2635
2635
  scheduleEnsureViewportAreaLoaded() {
2636
2636
  setTimeout(() => {
2637
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: i, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = i - this.nodeHorizontal, c = n - this.nodeVertical, g = i + a + this.nodeHorizontal, l = n + h + this.nodeVertical;
2637
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: o, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = o - this.nodeHorizontal, c = n - this.nodeVertical, g = o + a + this.nodeHorizontal, l = n + h + this.nodeVertical;
2638
2638
  this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
2639
2639
  });
2640
2640
  }
2641
2641
  loadAreaAroundViewport() {
2642
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: i, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = i - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, l = 3 * h + 2 * this.nodeVertical;
2642
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: o, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = o - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, l = 3 * h + 2 * this.nodeVertical;
2643
2643
  this.trigger.emit({
2644
2644
  x: d,
2645
2645
  y: c,
@@ -2648,69 +2648,69 @@ class ee {
2648
2648
  });
2649
2649
  }
2650
2650
  }
2651
- const Nt = () => {
2651
+ const Tt = () => {
2652
2652
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2653
2653
  return r.style.position = "absolute", r.style.inset = "0", r;
2654
- }, Tt = () => {
2654
+ }, Ct = () => {
2655
2655
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2656
2656
  return r.setAttribute("fill", "url(#pattern)"), r;
2657
- }, Ct = () => {
2657
+ }, Mt = () => {
2658
2658
  const r = document.createElementNS(
2659
2659
  "http://www.w3.org/2000/svg",
2660
2660
  "pattern"
2661
2661
  );
2662
2662
  return r.setAttribute("id", "pattern"), r;
2663
2663
  };
2664
- class te {
2664
+ class re {
2665
2665
  constructor(e, t, s) {
2666
- o(this, "svg", Nt());
2667
- o(this, "patternRenderingRectangle", Tt());
2668
- o(this, "pattern", Ct());
2669
- o(this, "patternContent");
2670
- o(this, "tileWidth");
2671
- o(this, "tileHeight");
2672
- o(this, "halfTileWidth");
2673
- o(this, "halfTileHeight");
2674
- o(this, "maxViewportScale");
2675
- o(this, "visible", !1);
2676
- o(this, "onAfterTransformUpdated", () => {
2677
- const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, i = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
2678
- this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2666
+ i(this, "svg", Tt());
2667
+ i(this, "patternRenderingRectangle", Ct());
2668
+ i(this, "pattern", Mt());
2669
+ i(this, "patternContent");
2670
+ i(this, "tileWidth");
2671
+ i(this, "tileHeight");
2672
+ i(this, "halfTileWidth");
2673
+ i(this, "halfTileHeight");
2674
+ i(this, "maxViewportScale");
2675
+ i(this, "visible", !1);
2676
+ i(this, "onAfterTransformUpdated", () => {
2677
+ const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, o = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
2678
+ this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
2679
2679
  });
2680
2680
  this.canvas = e, this.backgroundHost = 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;
2681
- const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2682
- this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2681
+ const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2682
+ this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
2683
2683
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2684
2684
  n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2685
2685
  this.updateDimensions();
2686
2686
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2687
2687
  }
2688
2688
  static configure(e, t, s) {
2689
- new te(e, t, s);
2689
+ new re(e, t, s);
2690
2690
  }
2691
2691
  updateVisibility() {
2692
- const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
2692
+ const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
2693
2693
  t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
2694
2694
  }
2695
2695
  updateDimensions() {
2696
2696
  const { width: e, height: t } = this.canvas.viewport.getDimensions();
2697
2697
  this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`);
2698
- const s = this.tileWidth / e, i = this.tileHeight / t;
2699
- this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${i}`);
2698
+ const s = this.tileWidth / e, o = this.tileHeight / t;
2699
+ this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
2700
2700
  }
2701
2701
  }
2702
- class re {
2703
- constructor(e, t, s, i, n) {
2704
- o(this, "overlayCanvas");
2705
- o(this, "staticPortId", null);
2706
- o(this, "isTargetDragging", !0);
2707
- o(this, "onEdgeCreated", (e) => {
2702
+ class se {
2703
+ constructor(e, t, s, o, n) {
2704
+ i(this, "overlayCanvas");
2705
+ i(this, "staticPortId", null);
2706
+ i(this, "isTargetDragging", !0);
2707
+ i(this, "onEdgeCreated", (e) => {
2708
2708
  this.params.onAfterEdgeCreated(e);
2709
2709
  });
2710
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
2710
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Be(
2711
2711
  this.overlayLayer,
2712
2712
  this.viewportStore
2713
- ), k.configure(
2713
+ ), Y.configure(
2714
2714
  this.canvas,
2715
2715
  this.overlayLayer,
2716
2716
  this.window,
@@ -2733,19 +2733,19 @@ class re {
2733
2733
  }
2734
2734
  );
2735
2735
  }
2736
- static configure(e, t, s, i, n) {
2737
- new re(
2736
+ static configure(e, t, s, o, n) {
2737
+ new se(
2738
2738
  e,
2739
2739
  t,
2740
2740
  s,
2741
- i,
2741
+ o,
2742
2742
  n
2743
2743
  );
2744
2744
  }
2745
2745
  grabPort(e, t, s) {
2746
- const i = this.canvas.graph.getPort(e);
2746
+ const o = this.canvas.graph.getPort(e);
2747
2747
  this.staticPortId = e;
2748
- const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
2748
+ const n = o.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
2749
2749
  x: a - d.x,
2750
2750
  y: h - d.y
2751
2751
  }), g = this.canvas.viewport.createContentCoords({
@@ -2754,17 +2754,17 @@ class re {
2754
2754
  }), l = {
2755
2755
  overlayNodeId: N.StaticNodeId,
2756
2756
  portCoords: c,
2757
- portDirection: i.direction
2757
+ portDirection: o.direction
2758
2758
  }, u = {
2759
2759
  overlayNodeId: N.DraggingNodeId,
2760
2760
  portCoords: g,
2761
2761
  portDirection: this.params.dragPortDirection
2762
2762
  };
2763
2763
  this.isTargetDragging = s === "direct";
2764
- const [w, y] = this.isTargetDragging ? [l, u] : [u, l];
2765
- this.overlayCanvas.addNode($(w)), this.overlayCanvas.addNode($(y)), this.overlayCanvas.addEdge({
2764
+ const [w, f] = this.isTargetDragging ? [l, u] : [u, l];
2765
+ this.overlayCanvas.addNode(O(w)), this.overlayCanvas.addNode(O(f)), this.overlayCanvas.addEdge({
2766
2766
  from: w.overlayNodeId,
2767
- to: y.overlayNodeId,
2767
+ to: f.overlayNodeId,
2768
2768
  shape: this.params.edgeShapeFactory(N.EdgeId)
2769
2769
  });
2770
2770
  }
@@ -2772,7 +2772,7 @@ class re {
2772
2772
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2773
2773
  }
2774
2774
  tryCreateConnection(e) {
2775
- const t = be(this.canvas.graph, e), s = this.staticPortId;
2775
+ const t = Pe(this.canvas.graph, e), s = this.staticPortId;
2776
2776
  if (t === null) {
2777
2777
  this.params.onEdgeCreationInterrupted({
2778
2778
  staticPortId: s,
@@ -2780,7 +2780,7 @@ class re {
2780
2780
  });
2781
2781
  return;
2782
2782
  }
2783
- const i = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2783
+ const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
2784
2784
  h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2785
2785
  }
2786
2786
  moveDraggingPort(e) {
@@ -2794,19 +2794,19 @@ class re {
2794
2794
  });
2795
2795
  }
2796
2796
  }
2797
- class se {
2798
- constructor(e, t, s, i, n) {
2799
- o(this, "overlayCanvas");
2800
- o(this, "staticPortId", null);
2801
- o(this, "isTargetDragging", !0);
2802
- o(this, "draggingEdgePayload", null);
2803
- o(this, "onEdgeReattached", (e) => {
2797
+ class oe {
2798
+ constructor(e, t, s, o, n) {
2799
+ i(this, "overlayCanvas");
2800
+ i(this, "staticPortId", null);
2801
+ i(this, "isTargetDragging", !0);
2802
+ i(this, "draggingEdgePayload", null);
2803
+ i(this, "onEdgeReattached", (e) => {
2804
2804
  this.params.onAfterEdgeReattached(e);
2805
2805
  });
2806
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
2806
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Be(
2807
2807
  this.overlayLayer,
2808
2808
  this.viewportStore
2809
- ), k.configure(
2809
+ ), Y.configure(
2810
2810
  this.canvas,
2811
2811
  this.overlayLayer,
2812
2812
  this.window,
@@ -2826,12 +2826,12 @@ class se {
2826
2826
  }
2827
2827
  );
2828
2828
  }
2829
- static configure(e, t, s, i, n) {
2830
- new se(
2829
+ static configure(e, t, s, o, n) {
2830
+ new oe(
2831
2831
  e,
2832
2832
  t,
2833
2833
  s,
2834
- i,
2834
+ o,
2835
2835
  n
2836
2836
  );
2837
2837
  }
@@ -2839,7 +2839,7 @@ class se {
2839
2839
  const s = this.params.draggingEdgeResolver(e);
2840
2840
  if (s === null || !this.canvas.graph.hasEdge(s))
2841
2841
  return !1;
2842
- const i = this.canvas.graph.getEdge(s), n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2842
+ const o = this.canvas.graph.getEdge(s), n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
2843
2843
  this.staticPortId = h, this.isTargetDragging = a;
2844
2844
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2845
2845
  x: g.x + g.width / 2,
@@ -2847,28 +2847,28 @@ class se {
2847
2847
  }, u = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
2848
2848
  x: l.x - u.x,
2849
2849
  y: l.y - u.y
2850
- }), y = this.canvas.viewport.createContentCoords({
2850
+ }), f = this.canvas.viewport.createContentCoords({
2851
2851
  x: t.x - u.x,
2852
2852
  y: t.y - u.y
2853
2853
  });
2854
2854
  this.draggingEdgePayload = {
2855
2855
  id: s,
2856
- from: i.from,
2857
- to: i.to,
2858
- shape: i.shape,
2859
- priority: i.priority
2856
+ from: o.from,
2857
+ to: o.to,
2858
+ shape: o.shape,
2859
+ priority: o.priority
2860
2860
  }, this.canvas.removeEdge(s);
2861
- const E = {
2861
+ const v = {
2862
2862
  overlayNodeId: N.StaticNodeId,
2863
2863
  portCoords: w,
2864
2864
  portDirection: c.direction
2865
2865
  }, S = {
2866
2866
  overlayNodeId: N.DraggingNodeId,
2867
- portCoords: y,
2867
+ portCoords: f,
2868
2868
  portDirection: d.direction
2869
- }, [b, T] = this.isTargetDragging ? [E, S] : [S, E];
2870
- this.overlayCanvas.addNode($(b)), this.overlayCanvas.addNode($(T));
2871
- const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : i.shape;
2869
+ }, [b, T] = this.isTargetDragging ? [v, S] : [S, v];
2870
+ this.overlayCanvas.addNode(O(b)), this.overlayCanvas.addNode(O(T));
2871
+ const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : o.shape;
2872
2872
  return this.overlayCanvas.addEdge({
2873
2873
  id: N.EdgeId,
2874
2874
  from: b.overlayNodeId,
@@ -2883,14 +2883,14 @@ class se {
2883
2883
  const t = this.overlayLayer.getBoundingClientRect(), s = {
2884
2884
  x: e.x - t.x,
2885
2885
  y: e.y - t.y
2886
- }, i = this.canvas.viewport.createContentCoords(s);
2886
+ }, o = this.canvas.viewport.createContentCoords(s);
2887
2887
  this.overlayCanvas.updateNode(N.DraggingNodeId, {
2888
- x: i.x,
2889
- y: i.y
2888
+ x: o.x,
2889
+ y: o.y
2890
2890
  });
2891
2891
  }
2892
2892
  tryCreateConnection(e) {
2893
- const t = be(this.canvas.graph, e);
2893
+ const t = Pe(this.canvas.graph, e);
2894
2894
  if (this.overlayCanvas.removeEdge(N.EdgeId), t === null) {
2895
2895
  const d = this.draggingEdgePayload;
2896
2896
  this.params.onEdgeReattachInterrupted({
@@ -2902,10 +2902,10 @@ class se {
2902
2902
  });
2903
2903
  return;
2904
2904
  }
2905
- const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2905
+ const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2906
2906
  id: n.id,
2907
2907
  from: s,
2908
- to: i,
2908
+ to: o,
2909
2909
  shape: n.shape,
2910
2910
  priority: n.priority
2911
2911
  }, h = this.params.connectionPreprocessor(a);
@@ -2923,20 +2923,20 @@ class se {
2923
2923
  }
2924
2924
  }
2925
2925
  }
2926
- class oe {
2926
+ class ie {
2927
2927
  constructor(e, t) {
2928
2928
  this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
2929
2929
  this.applier.apply();
2930
2930
  });
2931
2931
  }
2932
2932
  static configure(e, t) {
2933
- new oe(e, t);
2933
+ new ie(e, t);
2934
2934
  }
2935
2935
  }
2936
- class O {
2936
+ class z {
2937
2937
  constructor(e, t, s) {
2938
- o(this, "applyScheduled", !1);
2939
- o(this, "apply", () => {
2938
+ i(this, "applyScheduled", !1);
2939
+ i(this, "apply", () => {
2940
2940
  this.applyScheduled = !1, this.applier.apply();
2941
2941
  });
2942
2942
  this.graph = e, this.applier = t, this.defererFn = s, this.graph.onAfterNodeAdded.subscribe(() => {
@@ -2950,7 +2950,7 @@ class O {
2950
2950
  });
2951
2951
  }
2952
2952
  static configure(e, t, s) {
2953
- new O(
2953
+ new z(
2954
2954
  e,
2955
2955
  t,
2956
2956
  s
@@ -2962,23 +2962,23 @@ class O {
2962
2962
  }
2963
2963
  class Dt {
2964
2964
  static configure(e, t) {
2965
- const s = t.applyOn, i = new xt(e, t.algorithm, {
2965
+ const s = t.applyOn, o = new St(e, t.algorithm, {
2966
2966
  staticNodeResolver: t.staticNodeResolver,
2967
2967
  onBeforeApplied: t.onBeforeApplied,
2968
2968
  onAfterApplied: t.onAfterApplied
2969
2969
  });
2970
2970
  switch (s.type) {
2971
2971
  case "manual": {
2972
- oe.configure(
2973
- i,
2972
+ ie.configure(
2973
+ o,
2974
2974
  s.trigger
2975
2975
  );
2976
2976
  break;
2977
2977
  }
2978
2978
  case "topologyChangeMacrotask": {
2979
- O.configure(
2979
+ z.configure(
2980
2980
  e.graph,
2981
- i,
2981
+ o,
2982
2982
  (n) => {
2983
2983
  setTimeout(() => {
2984
2984
  n();
@@ -2988,9 +2988,9 @@ class Dt {
2988
2988
  break;
2989
2989
  }
2990
2990
  case "topologyChangeMicrotask": {
2991
- O.configure(
2991
+ z.configure(
2992
2992
  e.graph,
2993
- i,
2993
+ o,
2994
2994
  (n) => {
2995
2995
  queueMicrotask(() => {
2996
2996
  n();
@@ -3002,10 +3002,10 @@ class Dt {
3002
3002
  }
3003
3003
  }
3004
3004
  }
3005
- class Mt {
3005
+ class Rt {
3006
3006
  constructor(e, t) {
3007
- o(this, "previousTimeStamp");
3008
- o(this, "step", (e) => {
3007
+ i(this, "previousTimeStamp");
3008
+ i(this, "step", (e) => {
3009
3009
  if (this.previousTimeStamp === void 0)
3010
3010
  this.previousTimeStamp = e;
3011
3011
  else {
@@ -3017,61 +3017,61 @@ class Mt {
3017
3017
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3018
3018
  }
3019
3019
  }
3020
- class ie {
3020
+ class ne {
3021
3021
  constructor(e, t, s) {
3022
- o(this, "applier");
3023
- o(this, "step", (e) => {
3022
+ i(this, "applier");
3023
+ i(this, "step", (e) => {
3024
3024
  this.applier.apply(e);
3025
3025
  });
3026
- this.win = s, this.applier = new St(e, t.algorithm, {
3026
+ this.win = s, this.applier = new bt(e, t.algorithm, {
3027
3027
  staticNodeResolver: t.staticNodeResolver,
3028
3028
  onBeforeApplied: t.onBeforeApplied,
3029
3029
  onAfterApplied: t.onAfterApplied
3030
- }), new Mt(this.win, this.step);
3030
+ }), new Rt(this.win, this.step);
3031
3031
  }
3032
3032
  static configure(e, t, s) {
3033
- new ie(e, t, s);
3033
+ new ne(e, t, s);
3034
3034
  }
3035
3035
  }
3036
3036
  const Lt = () => {
3037
3037
  const r = document.createElement("div");
3038
3038
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3039
- }, j = () => {
3039
+ }, q = () => {
3040
3040
  const r = document.createElement("div");
3041
3041
  return r.style.position = "absolute", r.style.inset = "0", r;
3042
3042
  }, ye = () => {
3043
- const r = j();
3043
+ const r = q();
3044
3044
  return r.style.pointerEvents = "none", r;
3045
3045
  };
3046
- class Rt {
3046
+ class Vt {
3047
3047
  constructor(e) {
3048
- o(this, "background", j());
3049
- o(this, "main", j());
3050
- o(this, "overlayConnectablePorts", ye());
3051
- o(this, "overlayDraggableEdges", ye());
3052
- o(this, "host", Lt());
3048
+ i(this, "background", q());
3049
+ i(this, "main", q());
3050
+ i(this, "overlayConnectablePorts", ye());
3051
+ i(this, "overlayDraggableEdges", ye());
3052
+ i(this, "host", Lt());
3053
3053
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3054
3054
  }
3055
3055
  destroy() {
3056
3056
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
3057
3057
  }
3058
3058
  }
3059
- const K = (r) => () => r, fe = K(0), Vt = () => {
3059
+ const K = (r) => () => r, me = K(0), Ft = () => {
3060
3060
  let r = 0;
3061
3061
  return () => r++;
3062
- }, Ft = (r, e) => {
3063
- let t = fe, s = fe;
3064
- const i = Vt();
3065
- return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = K(r)), typeof e == "number" && (s = K(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
3062
+ }, It = (r, e) => {
3063
+ let t = me, s = me;
3064
+ const o = Ft();
3065
+ return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = K(r)), typeof e == "number" && (s = K(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
3066
3066
  nodesPriorityFn: t,
3067
3067
  edgesPriorityFn: s
3068
3068
  };
3069
- }, ne = (r) => {
3069
+ }, ae = (r) => {
3070
3070
  if (typeof r == "function")
3071
3071
  return r;
3072
3072
  switch (r.type) {
3073
3073
  case "straight":
3074
- return () => new ft({
3074
+ return () => new mt({
3075
3075
  color: r.color,
3076
3076
  width: r.width,
3077
3077
  arrowLength: r.arrowLength,
@@ -3098,7 +3098,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3098
3098
  detourDistance: r.detourDistance
3099
3099
  });
3100
3100
  case "vertical":
3101
- return () => new mt({
3101
+ return () => new vt({
3102
3102
  color: r.color,
3103
3103
  width: r.width,
3104
3104
  arrowLength: r.arrowLength,
@@ -3122,7 +3122,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3122
3122
  targetOffset: r.targetOffset
3123
3123
  });
3124
3124
  default:
3125
- return () => new wt({
3125
+ return () => new ft({
3126
3126
  color: r.color,
3127
3127
  width: r.width,
3128
3128
  arrowLength: r.arrowLength,
@@ -3136,30 +3136,30 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3136
3136
  detourDirection: r.detourDirection
3137
3137
  });
3138
3138
  }
3139
- }, It = (r) => {
3140
- var t, s, i, n, a;
3141
- const e = Ft(
3139
+ }, Bt = (r) => {
3140
+ var t, s, o, n, a;
3141
+ const e = It(
3142
3142
  (t = r.nodes) == null ? void 0 : t.priority,
3143
3143
  (s = r.edges) == null ? void 0 : s.priority
3144
3144
  );
3145
3145
  return {
3146
3146
  nodes: {
3147
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Pe,
3147
+ centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Ne,
3148
3148
  priorityFn: e.nodesPriorityFn
3149
3149
  },
3150
3150
  ports: {
3151
3151
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
3152
3152
  },
3153
3153
  edges: {
3154
- shapeFactory: ne(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3154
+ shapeFactory: ae(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3155
3155
  priorityFn: e.edgesPriorityFn
3156
3156
  }
3157
3157
  };
3158
- }, Bt = (r) => {
3159
- var w, y, E, S, b, T;
3158
+ }, $t = (r) => {
3159
+ var w, f, v, S, b, T;
3160
3160
  const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3161
- }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3162
- }), s = r.nodeDragVerifier ?? (() => !0), i = ((E = r.events) == null ? void 0 : E.onNodeDragFinished) ?? (() => {
3161
+ }), t = ((f = r.events) == null ? void 0 : f.onNodeDrag) ?? (() => {
3162
+ }), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
3163
3163
  }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (T = r.mouse) == null ? void 0 : T.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
3164
3164
  return {
3165
3165
  moveOnTop: n,
@@ -3171,25 +3171,25 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3171
3171
  onNodeDragStarted: e,
3172
3172
  onNodeDrag: t,
3173
3173
  nodeDragVerifier: s,
3174
- onNodeDragFinished: i
3174
+ onNodeDragFinished: o
3175
3175
  };
3176
- }, $t = (r) => {
3177
- 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;
3176
+ }, Ut = (r) => {
3177
+ 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, o = r.maxY !== null ? r.maxY : 1 / 0;
3178
3178
  return (n) => {
3179
3179
  let a = n.nextTransform.x, h = n.nextTransform.y;
3180
3180
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3181
3181
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3182
3182
  a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < s && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, s));
3183
- const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
3183
+ const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
3184
3184
  return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3185
3185
  };
3186
- }, Ut = (r) => {
3187
- const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3186
+ }, Ot = (r) => {
3187
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
3188
3188
  return (n) => {
3189
3189
  const a = n.prevTransform, h = n.nextTransform;
3190
3190
  let d = h.scale, c = h.x, g = h.y;
3191
- if (h.scale > i && h.scale > a.scale) {
3192
- d = Math.max(a.scale, i), c = a.x, g = a.y;
3191
+ if (h.scale > o && h.scale > a.scale) {
3192
+ d = Math.max(a.scale, o), c = a.x, g = a.y;
3193
3193
  const l = (d - a.scale) / (h.scale - a.scale);
3194
3194
  c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3195
3195
  }
@@ -3204,7 +3204,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3204
3204
  y: g
3205
3205
  };
3206
3206
  };
3207
- }, Ot = (r) => (e) => r.reduce(
3207
+ }, Wt = (r) => (e) => r.reduce(
3208
3208
  (t, s) => s({
3209
3209
  prevTransform: e.prevTransform,
3210
3210
  nextTransform: t,
@@ -3212,91 +3212,91 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3212
3212
  canvasHeight: e.canvasHeight
3213
3213
  }),
3214
3214
  e.nextTransform
3215
- ), me = (r) => {
3215
+ ), ve = (r) => {
3216
3216
  if (typeof r == "function")
3217
3217
  return r;
3218
3218
  switch (r.type) {
3219
3219
  case "scale-limit":
3220
- return Ut({
3220
+ return Ot({
3221
3221
  minContentScale: r.minContentScale ?? 0,
3222
3222
  maxContentScale: r.maxContentScale ?? 1 / 0
3223
3223
  });
3224
3224
  case "shift-limit":
3225
- return $t({
3225
+ return Ut({
3226
3226
  minX: r.minX ?? -1 / 0,
3227
3227
  maxX: r.maxX ?? 1 / 0,
3228
3228
  minY: r.minY ?? -1 / 0,
3229
3229
  maxY: r.maxY ?? 1 / 0
3230
3230
  });
3231
3231
  }
3232
- }, ve = (r) => {
3233
- var y, E, S, b, T, P, R, V, ae, he, de, ce;
3234
- const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
3235
- let i;
3236
- s !== void 0 ? Array.isArray(s) ? i = Ot(
3232
+ }, Ae = (r) => {
3233
+ var f, v, S, b, T, P, L, V, he, de, ce, le;
3234
+ 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;
3235
+ let o;
3236
+ s !== void 0 ? Array.isArray(s) ? o = Wt(
3237
3237
  s.map(
3238
- (C) => me(C)
3238
+ (C) => ve(C)
3239
3239
  )
3240
- ) : i = me(s) : i = (C) => C.nextTransform;
3241
- const n = ((E = r == null ? void 0 : r.shift) == null ? void 0 : E.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
3240
+ ) : o = ve(s) : o = (C) => C.nextTransform;
3241
+ const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
3242
3242
  }), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
3243
- }), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (C) => C.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (C) => C.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3243
+ }), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (C) => C.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (C) => C.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3244
3244
  return {
3245
3245
  wheelSensitivity: t,
3246
3246
  onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
3247
3247
  }),
3248
- onTransformFinished: ((ae = r == null ? void 0 : r.events) == null ? void 0 : ae.onTransformFinished) ?? (() => {
3248
+ onTransformFinished: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onTransformFinished) ?? (() => {
3249
3249
  }),
3250
3250
  onBeforeTransformChange: a,
3251
3251
  onTransformChange: h,
3252
- transformPreprocessor: i,
3252
+ transformPreprocessor: o,
3253
3253
  shiftCursor: n,
3254
3254
  mouseDownEventVerifier: c,
3255
3255
  mouseUpEventVerifier: l,
3256
3256
  mouseWheelEventVerifier: w,
3257
- scaleWheelFinishTimeout: ((he = r == null ? void 0 : r.scale) == null ? void 0 : he.wheelFinishTimeout) ?? 500,
3258
- onResizeTransformStarted: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformStarted) ?? (() => {
3257
+ scaleWheelFinishTimeout: ((de = r == null ? void 0 : r.scale) == null ? void 0 : de.wheelFinishTimeout) ?? 500,
3258
+ onResizeTransformStarted: ((ce = r == null ? void 0 : r.events) == null ? void 0 : ce.onResizeTransformStarted) ?? (() => {
3259
3259
  }),
3260
- onResizeTransformFinished: ((ce = r == null ? void 0 : r.events) == null ? void 0 : ce.onResizeTransformFinished) ?? (() => {
3260
+ onResizeTransformFinished: ((le = r == null ? void 0 : r.events) == null ? void 0 : le.onResizeTransformFinished) ?? (() => {
3261
3261
  })
3262
3262
  };
3263
- }, Wt = (r, e) => {
3263
+ }, zt = (r, e) => {
3264
3264
  const t = document.createElementNS(
3265
3265
  "http://www.w3.org/2000/svg",
3266
3266
  "circle"
3267
3267
  );
3268
3268
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3269
- }, zt = (r) => r instanceof SVGElement ? r : Wt(
3269
+ }, kt = (r) => r instanceof SVGElement ? r : zt(
3270
3270
  (r == null ? void 0 : r.radius) ?? 1.5,
3271
3271
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3272
- ), kt = (r) => {
3273
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = zt(r.renderer ?? {});
3272
+ ), Ht = (r) => {
3273
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = kt(r.renderer ?? {});
3274
3274
  return {
3275
3275
  tileWidth: t,
3276
3276
  tileHeight: s,
3277
- renderer: i,
3277
+ renderer: o,
3278
3278
  maxViewportScale: r.maxViewportScale ?? 10
3279
3279
  };
3280
- }, Ht = (r, e, t) => {
3280
+ }, Yt = (r, e, t) => {
3281
3281
  var c, g, l;
3282
- const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
3282
+ const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
3283
3283
  }, h = () => {
3284
3284
  }, d = () => {
3285
3285
  };
3286
3286
  return {
3287
3287
  connectionTypeResolver: r.connectionTypeResolver ?? s,
3288
- connectionPreprocessor: r.connectionPreprocessor ?? i,
3288
+ connectionPreprocessor: r.connectionPreprocessor ?? o,
3289
3289
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3290
3290
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3291
3291
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3292
3292
  onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3293
3293
  onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
3294
3294
  dragPortDirection: r.dragPortDirection ?? t,
3295
- edgeShapeFactory: r.edgeShape !== void 0 ? ne(r.edgeShape) : e
3295
+ edgeShapeFactory: r.edgeShape !== void 0 ? ae(r.edgeShape) : e
3296
3296
  };
3297
3297
  }, Xt = (r, e) => {
3298
3298
  var c, g, l;
3299
- const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
3299
+ const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
3300
3300
  const w = e.getPortAdjacentEdgeIds(u);
3301
3301
  return w.length > 0 ? w[w.length - 1] : null;
3302
3302
  }, a = () => {
@@ -3306,17 +3306,17 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3306
3306
  return {
3307
3307
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3308
3308
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3309
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3309
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
3310
3310
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3311
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ne(r.draggingEdgeShape) : null,
3311
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ae(r.draggingEdgeShape) : null,
3312
3312
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3313
3313
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3314
3314
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3315
3315
  };
3316
- }, Yt = (r) => ({
3316
+ }, Gt = (r) => ({
3317
3317
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3318
3318
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3319
- }), Gt = (r) => {
3319
+ }), jt = (r) => {
3320
3320
  var e, t;
3321
3321
  return {
3322
3322
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3325,43 +3325,28 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
3325
3325
  })
3326
3326
  };
3327
3327
  };
3328
- class jt extends Error {
3328
+ class qt extends Error {
3329
3329
  constructor() {
3330
3330
  super(...arguments);
3331
- o(this, "name", "CanvasBuilderError");
3331
+ i(this, "name", "CanvasBuilderError");
3332
3332
  }
3333
3333
  }
3334
- const v = Object.freeze({
3335
- seed: "HTMLGraph is awesome",
3336
- maxTimeDeltaSec: 0.01,
3337
- nodeCharge: 1e5,
3338
- nodeMass: 1,
3339
- edgeEquilibriumLength: 300,
3340
- edgeStiffness: 1e3,
3341
- dtSec: 0.01,
3342
- maxIterations: 1e3,
3343
- convergenceVelocity: 10,
3344
- maxForce: 1e7,
3345
- nodeForceCoefficient: 1,
3346
- barnesHutAreaRadiusThreshold: 0.01,
3347
- barnesHutTheta: 1
3348
- });
3349
- class Be {
3334
+ class $e {
3350
3335
  constructor(e, t, s) {
3351
- o(this, "dt");
3352
- o(this, "nodeMass");
3353
- o(this, "edgeEquilibriumLength");
3354
- o(this, "edgeStiffness");
3355
- o(this, "nodeForcesApplicationStrategy");
3356
- o(this, "distanceVectorGenerator");
3336
+ i(this, "dt");
3337
+ i(this, "nodeMass");
3338
+ i(this, "edgeEquilibriumLength");
3339
+ i(this, "edgeStiffness");
3340
+ i(this, "nodeForcesApplicationStrategy");
3341
+ i(this, "distanceVectorGenerator");
3357
3342
  this.graph = e, this.currentCoords = t, this.dt = s.dtSec, this.nodeMass = s.nodeMass, this.edgeEquilibriumLength = s.edgeEquilibriumLength, this.edgeStiffness = s.edgeStiffness, this.distanceVectorGenerator = s.distanceVectorGenerator, this.nodeForcesApplicationStrategy = s.nodeForcesApplicationStrategy;
3358
3343
  }
3359
3344
  apply() {
3360
3345
  let e = 0;
3361
3346
  const t = /* @__PURE__ */ new Map();
3362
- return this.graph.getAllNodeIds().forEach((i) => {
3363
- t.set(i, { x: 0, y: 0 });
3364
- }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((i, n) => {
3347
+ return this.graph.getAllNodeIds().forEach((o) => {
3348
+ t.set(o, { x: 0, y: 0 });
3349
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
3365
3350
  const a = t.get(n), h = {
3366
3351
  x: a.x / this.nodeMass * this.dt,
3367
3352
  y: a.y / this.nodeMass * this.dt
@@ -3371,26 +3356,26 @@ class Be {
3371
3356
  Math.sqrt(h.x * h.x + h.y * h.y)
3372
3357
  );
3373
3358
  const d = h.x * this.dt, c = h.y * this.dt;
3374
- i.x += d, i.y += c;
3359
+ o.x += d, o.y += c;
3375
3360
  }), e;
3376
3361
  }
3377
3362
  applyEdgeForces(e) {
3378
3363
  this.graph.getAllEdgeIds().forEach((t) => {
3379
- const s = this.graph.getEdge(t), i = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(i.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3364
+ const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3380
3365
  a,
3381
3366
  h
3382
- ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(i.nodeId), y = e.get(n.nodeId);
3383
- w.x += l, w.y += u, y.x -= l, y.y -= u;
3367
+ ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), f = e.get(n.nodeId);
3368
+ w.x += l, w.y += u, f.x -= l, f.y -= u;
3384
3369
  });
3385
3370
  }
3386
3371
  }
3387
- class $e {
3372
+ class Ue {
3388
3373
  constructor(e) {
3389
- o(this, "PI2", 2 * Math.PI);
3374
+ i(this, "PI2", 2 * Math.PI);
3390
3375
  this.rand = e;
3391
3376
  }
3392
3377
  create(e, t) {
3393
- const s = t.x - e.x, i = t.y - e.y, n = s * s + i * i;
3378
+ const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
3394
3379
  if (n === 0) {
3395
3380
  const c = this.PI2 * this.rand();
3396
3381
  return {
@@ -3399,11 +3384,11 @@ class $e {
3399
3384
  d: 0
3400
3385
  };
3401
3386
  }
3402
- const a = Math.sqrt(n), h = s / a, d = i / a;
3387
+ const a = Math.sqrt(n), h = s / a, d = o / a;
3403
3388
  return { ex: h, ey: d, d: a };
3404
3389
  }
3405
3390
  }
3406
- const Ue = (r) => {
3391
+ const Oe = (r) => {
3407
3392
  if (r.distance === 0)
3408
3393
  return r.maxForce;
3409
3394
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
@@ -3411,27 +3396,27 @@ const Ue = (r) => {
3411
3396
  };
3412
3397
  class Kt {
3413
3398
  constructor(e) {
3414
- o(this, "nodeCharge");
3415
- o(this, "distanceVectorGenerator");
3416
- o(this, "maxForce");
3399
+ i(this, "nodeCharge");
3400
+ i(this, "distanceVectorGenerator");
3401
+ i(this, "maxForce");
3417
3402
  this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
3418
3403
  }
3419
3404
  apply(e, t) {
3420
- const s = Array.from(t.keys()), i = s.length;
3421
- for (let n = 0; n < i; n++) {
3405
+ const s = Array.from(t.keys()), o = s.length;
3406
+ for (let n = 0; n < o; n++) {
3422
3407
  const a = s[n];
3423
- for (let h = n + 1; h < i; h++) {
3408
+ for (let h = n + 1; h < o; h++) {
3424
3409
  const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
3425
3410
  c,
3426
3411
  g
3427
- ), u = Ue({
3412
+ ), u = Oe({
3428
3413
  coefficient: 1,
3429
3414
  sourceCharge: this.nodeCharge,
3430
3415
  targetCharge: this.nodeCharge,
3431
3416
  distance: l.d,
3432
3417
  maxForce: this.maxForce
3433
- }), w = u * l.ex, y = u * l.ey, E = t.get(a), S = t.get(d);
3434
- E.x -= w, E.y -= y, S.x += w, S.y += y;
3418
+ }), w = u * l.ex, f = u * l.ey, v = t.get(a), S = t.get(d);
3419
+ v.x -= w, v.y -= f, S.x += w, S.y += f;
3435
3420
  }
3436
3421
  }
3437
3422
  }
@@ -3443,26 +3428,26 @@ const Qt = (r) => {
3443
3428
  centerY: 0,
3444
3429
  radius: 0
3445
3430
  };
3446
- let e = 1 / 0, t = -1 / 0, s = 1 / 0, i = -1 / 0;
3431
+ let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
3447
3432
  r.forEach((d) => {
3448
- e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), i = Math.max(i, d.y);
3433
+ e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
3449
3434
  });
3450
- const n = t - e, a = i - s, h = Math.max(n, a);
3435
+ const n = t - e, a = o - s, h = Math.max(n, a);
3451
3436
  return {
3452
3437
  centerX: (e + t) / 2,
3453
- centerY: (s + i) / 2,
3438
+ centerY: (s + o) / 2,
3454
3439
  radius: h / 2
3455
3440
  };
3456
3441
  };
3457
3442
  class Zt {
3458
3443
  constructor(e) {
3459
- o(this, "root");
3460
- o(this, "leaves", /* @__PURE__ */ new Map());
3461
- o(this, "coords");
3462
- o(this, "areaRadiusThreshold");
3463
- o(this, "nodeMass");
3464
- o(this, "nodeCharge");
3465
- o(this, "sortedParentNodes", []);
3444
+ i(this, "root");
3445
+ i(this, "leaves", /* @__PURE__ */ new Map());
3446
+ i(this, "coords");
3447
+ i(this, "areaRadiusThreshold");
3448
+ i(this, "nodeMass");
3449
+ i(this, "nodeCharge");
3450
+ i(this, "sortedParentNodes", []);
3466
3451
  this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
3467
3452
  nodeIds: new Set(e.coords.keys()),
3468
3453
  box: e.box,
@@ -3482,16 +3467,16 @@ class Zt {
3482
3467
  for (; t.length > 0; ) {
3483
3468
  const s = [];
3484
3469
  for (; t.length > 0; ) {
3485
- const i = t.pop();
3486
- this.processNode(i).forEach((a) => {
3470
+ const o = t.pop();
3471
+ this.processNode(o).forEach((a) => {
3487
3472
  s.push(a);
3488
3473
  });
3489
3474
  }
3490
3475
  t = s;
3491
3476
  }
3492
3477
  this.sortedParentNodes.reverse().forEach((s) => {
3493
- let i = 0, n = 0, a = 0, h = 0;
3494
- s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge, i += s.lb.chargeCenter.x * s.lb.totalCharge, n += s.lb.chargeCenter.y * s.lb.totalCharge), s.lt !== null && (a += s.lt.totalMass, h += s.lt.totalCharge, i += s.lt.chargeCenter.x * s.lt.totalCharge, n += s.lt.chargeCenter.y * s.lt.totalCharge), s.rb !== null && (a += s.rb.totalMass, h += s.rb.totalCharge, i += s.rb.chargeCenter.x * s.rb.totalCharge, n += s.rb.chargeCenter.y * s.rb.totalCharge), s.rt !== null && (a += s.rt.totalMass, h += s.rt.totalCharge, i += s.rt.chargeCenter.x * s.rt.totalCharge, n += s.rt.chargeCenter.y * s.rt.totalCharge), s.totalMass = a, s.totalCharge = h, s.chargeCenter.x = i / h, s.chargeCenter.y = n / h;
3478
+ let o = 0, n = 0, a = 0, h = 0;
3479
+ s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge, o += s.lb.chargeCenter.x * s.lb.totalCharge, n += s.lb.chargeCenter.y * s.lb.totalCharge), s.lt !== null && (a += s.lt.totalMass, h += s.lt.totalCharge, o += s.lt.chargeCenter.x * s.lt.totalCharge, n += s.lt.chargeCenter.y * s.lt.totalCharge), s.rb !== null && (a += s.rb.totalMass, h += s.rb.totalCharge, o += s.rb.chargeCenter.x * s.rb.totalCharge, n += s.rb.chargeCenter.y * s.rb.totalCharge), s.rt !== null && (a += s.rt.totalMass, h += s.rt.totalCharge, o += s.rt.chargeCenter.x * s.rt.totalCharge, n += s.rt.chargeCenter.y * s.rt.totalCharge), s.totalMass = a, s.totalCharge = h, s.chargeCenter.x = o / h, s.chargeCenter.y = n / h;
3495
3480
  });
3496
3481
  }
3497
3482
  getRoot() {
@@ -3503,14 +3488,14 @@ class Zt {
3503
3488
  processNode(e) {
3504
3489
  if (e.nodeIds.size < 2)
3505
3490
  return this.setLeaf(e), [];
3506
- const { centerX: t, centerY: s, radius: i } = e.box;
3507
- if (i < this.areaRadiusThreshold)
3491
+ const { centerX: t, centerY: s, radius: o } = e.box;
3492
+ if (o < this.areaRadiusThreshold)
3508
3493
  return this.setLeaf(e), [];
3509
3494
  this.sortedParentNodes.push(e);
3510
- const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = i / 2;
3495
+ const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
3511
3496
  e.nodeIds.forEach((u) => {
3512
- const { x: w, y } = this.coords.get(u);
3513
- w < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3497
+ const { x: w, y: f } = this.coords.get(u);
3498
+ w < t ? f < s ? d.add(u) : h.add(u) : f < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3514
3499
  });
3515
3500
  const g = {
3516
3501
  parent: e,
@@ -3605,25 +3590,25 @@ class Zt {
3605
3590
  y: 0
3606
3591
  };
3607
3592
  let t = 0, s = 0;
3608
- return e.forEach((i) => {
3609
- const n = this.coords.get(i);
3593
+ return e.forEach((o) => {
3594
+ const n = this.coords.get(o);
3610
3595
  t += n.x, s += n.y;
3611
3596
  }), { x: t / e.size, y: s / e.size };
3612
3597
  }
3613
3598
  }
3614
- class qt {
3599
+ class Jt {
3615
3600
  constructor(e) {
3616
- o(this, "areaRadiusThreshold");
3617
- o(this, "nodeMass");
3618
- o(this, "nodeCharge");
3619
- o(this, "theta");
3620
- o(this, "distanceVectorGenerator");
3621
- o(this, "nodeForceCoefficient");
3622
- o(this, "maxForce");
3601
+ i(this, "areaRadiusThreshold");
3602
+ i(this, "nodeMass");
3603
+ i(this, "nodeCharge");
3604
+ i(this, "theta");
3605
+ i(this, "distanceVectorGenerator");
3606
+ i(this, "nodeForceCoefficient");
3607
+ i(this, "maxForce");
3623
3608
  this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
3624
3609
  }
3625
3610
  apply(e, t) {
3626
- const s = Qt(e), i = new Zt({
3611
+ const s = Qt(e), o = new Zt({
3627
3612
  box: s,
3628
3613
  coords: e,
3629
3614
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -3632,7 +3617,7 @@ class qt {
3632
3617
  });
3633
3618
  e.forEach((n, a) => {
3634
3619
  const h = this.calculateForceForNode(
3635
- i.getLeaf(a),
3620
+ o.getLeaf(a),
3636
3621
  a,
3637
3622
  e
3638
3623
  ), d = t.get(a);
@@ -3640,14 +3625,14 @@ class qt {
3640
3625
  });
3641
3626
  }
3642
3627
  calculateForceForNode(e, t, s) {
3643
- const i = s.get(t), n = { x: 0, y: 0 };
3628
+ const o = s.get(t), n = { x: 0, y: 0 };
3644
3629
  e.nodeIds.forEach((h) => {
3645
3630
  if (h !== t) {
3646
3631
  const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3647
3632
  sourceCharge: this.nodeCharge,
3648
3633
  targetCharge: this.nodeCharge,
3649
3634
  sourceCoords: d,
3650
- targetCoords: i
3635
+ targetCoords: o
3651
3636
  });
3652
3637
  this.applyForce(n, c);
3653
3638
  }
@@ -3658,49 +3643,49 @@ class qt {
3658
3643
  if (h !== null) {
3659
3644
  const d = this.distanceVectorGenerator.create(
3660
3645
  h.chargeCenter,
3661
- i
3646
+ o
3662
3647
  );
3663
3648
  h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3664
3649
  totalForce: n,
3665
- targetCoords: i,
3650
+ targetCoords: o,
3666
3651
  target: h.lb,
3667
3652
  current: a
3668
3653
  }), this.tryApplyFarForce({
3669
3654
  totalForce: n,
3670
- targetCoords: i,
3655
+ targetCoords: o,
3671
3656
  target: h.rb,
3672
3657
  current: a
3673
3658
  }), this.tryApplyFarForce({
3674
3659
  totalForce: n,
3675
- targetCoords: i,
3660
+ targetCoords: o,
3676
3661
  target: h.rt,
3677
3662
  current: a
3678
3663
  }), this.tryApplyFarForce({
3679
3664
  totalForce: n,
3680
- targetCoords: i,
3665
+ targetCoords: o,
3681
3666
  target: h.lt,
3682
3667
  current: a
3683
3668
  })) : (this.tryApplyNearForce({
3684
3669
  totalForce: n,
3685
- targetCoords: i,
3670
+ targetCoords: o,
3686
3671
  target: h.lb,
3687
3672
  current: a,
3688
3673
  nodesCoords: s
3689
3674
  }), this.tryApplyNearForce({
3690
3675
  totalForce: n,
3691
- targetCoords: i,
3676
+ targetCoords: o,
3692
3677
  target: h.rb,
3693
3678
  current: a,
3694
3679
  nodesCoords: s
3695
3680
  }), this.tryApplyNearForce({
3696
3681
  totalForce: n,
3697
- targetCoords: i,
3682
+ targetCoords: o,
3698
3683
  target: h.rt,
3699
3684
  current: a,
3700
3685
  nodesCoords: s
3701
3686
  }), this.tryApplyNearForce({
3702
3687
  totalForce: n,
3703
- targetCoords: i,
3688
+ targetCoords: o,
3704
3689
  target: h.lt,
3705
3690
  current: a,
3706
3691
  nodesCoords: s
@@ -3711,7 +3696,7 @@ class qt {
3711
3696
  return n;
3712
3697
  }
3713
3698
  calculateExactForce(e, t, s) {
3714
- const i = { x: 0, y: 0 }, n = [e];
3699
+ const o = { x: 0, y: 0 }, n = [e];
3715
3700
  for (; n.length > 0; ) {
3716
3701
  const a = n.pop();
3717
3702
  a.nodeIds.forEach((h) => {
@@ -3721,10 +3706,10 @@ class qt {
3721
3706
  sourceCoords: d,
3722
3707
  targetCoords: t
3723
3708
  });
3724
- this.applyForce(i, c);
3709
+ this.applyForce(o, c);
3725
3710
  }), a.lb !== null && n.push(a.lb), a.rb !== null && n.push(a.rb), a.lt !== null && n.push(a.lt), a.rt !== null && n.push(a.rt);
3726
3711
  }
3727
- return i;
3712
+ return o;
3728
3713
  }
3729
3714
  calculateApproximateForce(e, t) {
3730
3715
  return this.calculateNodeRepulsiveForce({
@@ -3738,7 +3723,7 @@ class qt {
3738
3723
  const t = this.distanceVectorGenerator.create(
3739
3724
  e.sourceCoords,
3740
3725
  e.targetCoords
3741
- ), s = Ue({
3726
+ ), s = Oe({
3742
3727
  coefficient: this.nodeForceCoefficient,
3743
3728
  sourceCharge: e.sourceCharge,
3744
3729
  targetCharge: e.targetCharge,
@@ -3773,7 +3758,7 @@ class qt {
3773
3758
  }
3774
3759
  }
3775
3760
  }
3776
- const Oe = (r) => r.theta !== 0 ? new qt({
3761
+ const We = (r) => r.theta !== 0 ? new Jt({
3777
3762
  nodeCharge: r.nodeCharge,
3778
3763
  nodeForceCoefficient: r.nodeForceCoefficient,
3779
3764
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -3787,38 +3772,41 @@ const Oe = (r) => r.theta !== 0 ? new qt({
3787
3772
  distanceVectorGenerator: r.distanceVectorGenerator,
3788
3773
  maxForce: r.maxForce
3789
3774
  });
3790
- class We {
3775
+ class ze {
3791
3776
  constructor(e) {
3792
- o(this, "rand");
3793
- o(this, "sparsity");
3777
+ i(this, "rand");
3778
+ i(this, "sparsity");
3794
3779
  this.rand = e.rand, this.sparsity = e.sparsity;
3795
3780
  }
3796
3781
  calculateCoordinates(e) {
3797
- const { graph: t, viewport: s } = e, i = /* @__PURE__ */ new Map(), n = t.getAllNodeIds(), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
3782
+ const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((f) => {
3783
+ const v = t.getNode(f);
3784
+ return v.x === null || v.y === null;
3785
+ }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
3798
3786
  x: g.x - l,
3799
3787
  y: g.y - l
3800
3788
  };
3801
- return n.forEach((w) => {
3802
- const y = t.getNode(w);
3803
- i.set(w, {
3804
- x: y.x ?? u.x + a * this.rand(),
3805
- y: y.y ?? u.y + a * this.rand()
3789
+ return t.getAllNodeIds().forEach((f) => {
3790
+ const v = t.getNode(f);
3791
+ o.set(f, {
3792
+ x: v.x ?? u.x + a * this.rand(),
3793
+ y: v.y ?? u.y + a * this.rand()
3806
3794
  });
3807
- }), i;
3795
+ }), o;
3808
3796
  }
3809
3797
  }
3810
- class Jt {
3798
+ class _t {
3811
3799
  constructor(e) {
3812
- o(this, "distanceVectorGenerator");
3813
- o(this, "nodeForcesApplicationStrategy");
3814
- o(this, "fillerLayoutAlgorithm");
3815
- o(this, "maxIterations");
3816
- o(this, "dtSec");
3817
- o(this, "nodeMass");
3818
- o(this, "edgeEquilibriumLength");
3819
- o(this, "edgeStiffness");
3820
- o(this, "convergenceVelocity");
3821
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Oe({
3800
+ i(this, "distanceVectorGenerator");
3801
+ i(this, "nodeForcesApplicationStrategy");
3802
+ i(this, "fillerLayoutAlgorithm");
3803
+ i(this, "maxIterations");
3804
+ i(this, "dtSec");
3805
+ i(this, "nodeMass");
3806
+ i(this, "edgeEquilibriumLength");
3807
+ i(this, "edgeStiffness");
3808
+ i(this, "convergenceVelocity");
3809
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Ue(e.rand), this.nodeForcesApplicationStrategy = We({
3822
3810
  distanceVectorGenerator: this.distanceVectorGenerator,
3823
3811
  nodeCharge: e.nodeCharge,
3824
3812
  maxForce: e.maxForce,
@@ -3826,19 +3814,19 @@ class Jt {
3826
3814
  theta: e.barnesHutTheta,
3827
3815
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
3828
3816
  nodeMass: e.nodeMass
3829
- }), this.fillerLayoutAlgorithm = new We({
3817
+ }), this.fillerLayoutAlgorithm = new ze({
3830
3818
  rand: e.rand,
3831
3819
  sparsity: e.edgeEquilibriumLength
3832
3820
  });
3833
3821
  }
3834
3822
  calculateCoordinates(e) {
3835
- const { graph: t, viewport: s } = e, i = this.fillerLayoutAlgorithm.calculateCoordinates({
3823
+ const { graph: t, viewport: s } = e, o = this.fillerLayoutAlgorithm.calculateCoordinates({
3836
3824
  graph: t,
3837
3825
  viewport: s
3838
3826
  });
3839
- for (let n = 0; n < this.maxIterations && !(new Be(
3827
+ for (let n = 0; n < this.maxIterations && !(new $e(
3840
3828
  t,
3841
- i,
3829
+ o,
3842
3830
  {
3843
3831
  distanceVectorGenerator: this.distanceVectorGenerator,
3844
3832
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -3849,20 +3837,148 @@ class Jt {
3849
3837
  }
3850
3838
  ).apply() < this.convergenceVelocity); n++)
3851
3839
  ;
3852
- return i;
3840
+ return o;
3853
3841
  }
3854
3842
  }
3855
- class _t {
3843
+ class er {
3856
3844
  constructor(e) {
3857
- o(this, "distanceVectorGenerator");
3858
- o(this, "nodeForcesApplicationStrategy");
3859
- o(this, "convergenceVelocity");
3860
- o(this, "maxTimeDeltaSec");
3861
- o(this, "nodeMass");
3862
- o(this, "edgeEquilibriumLength");
3863
- o(this, "edgeStiffness");
3864
- o(this, "fillerLayoutAlgorithm");
3865
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Oe({
3845
+ i(this, "forest", /* @__PURE__ */ new Set());
3846
+ i(this, "remainingNodeIds");
3847
+ for (this.graph = e, this.remainingNodeIds = new Set(this.graph.getAllNodeIds()); this.remainingNodeIds.size > 0; ) {
3848
+ const [t] = this.remainingNodeIds;
3849
+ this.traverse(t);
3850
+ }
3851
+ }
3852
+ generate() {
3853
+ return this.forest;
3854
+ }
3855
+ traverse(e) {
3856
+ const t = {
3857
+ nodeId: e,
3858
+ children: /* @__PURE__ */ new Set()
3859
+ }, s = [];
3860
+ this.forest.add({ root: t, sequence: s });
3861
+ let o = [t];
3862
+ for (; o.length > 0; ) {
3863
+ const n = [];
3864
+ o.forEach((a) => {
3865
+ s.push(a), this.remainingNodeIds.delete(a.nodeId);
3866
+ const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
3867
+ const l = this.graph.getEdge(g);
3868
+ return this.graph.getPort(l.to).nodeId;
3869
+ }), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((g) => {
3870
+ const l = this.graph.getEdge(g);
3871
+ return this.graph.getPort(l.from).nodeId;
3872
+ });
3873
+ [...h, ...d].forEach((g) => {
3874
+ if (!this.remainingNodeIds.has(g))
3875
+ return;
3876
+ const l = {
3877
+ nodeId: g,
3878
+ children: /* @__PURE__ */ new Set()
3879
+ };
3880
+ a.children.add(l), n.push(l);
3881
+ });
3882
+ }), o = n;
3883
+ }
3884
+ }
3885
+ }
3886
+ class tr {
3887
+ constructor(e) {
3888
+ i(this, "baseRadius");
3889
+ this.baseRadius = e.radius;
3890
+ }
3891
+ resolve(e) {
3892
+ let t = 0, s = -1 / 0;
3893
+ const o = [];
3894
+ e.forEach((h) => {
3895
+ h === null ? (t += this.baseRadius, o.push(t), t += this.baseRadius) : t + this.baseRadius - h < s ? (s += h, o.push(s), t = s + this.baseRadius, s += h) : (t += this.baseRadius, o.push(t), s = t + h, t += this.baseRadius);
3896
+ });
3897
+ const n = t / 2;
3898
+ let a = 0;
3899
+ if (e.length > 0) {
3900
+ const h = e[e.length - 1] ?? 0, d = o[o.length - 1];
3901
+ a = Math.max(
3902
+ a,
3903
+ d + h - t
3904
+ );
3905
+ const c = e[0] ?? 0, g = o[0];
3906
+ a = Math.max(a, c - g);
3907
+ }
3908
+ return {
3909
+ offsets: o.map((h) => h - n),
3910
+ radius: n + a
3911
+ };
3912
+ }
3913
+ }
3914
+ class rr {
3915
+ constructor(e, t) {
3916
+ i(this, "offsets", /* @__PURE__ */ new Map());
3917
+ i(this, "childrenRadii", /* @__PURE__ */ new Map());
3918
+ i(this, "layerNodePlacementResolver");
3919
+ this.tree = e, this.layerNodePlacementResolver = new tr({
3920
+ radius: t.spaceAroundRadius
3921
+ }), [...this.tree.sequence].reverse().forEach((s) => {
3922
+ if (s.children.size === 0)
3923
+ this.childrenRadii.set(s.nodeId, null);
3924
+ else {
3925
+ const o = Array.from(s.children).map(
3926
+ (h) => this.childrenRadii.get(h.nodeId)
3927
+ ), n = this.layerNodePlacementResolver.resolve(o);
3928
+ this.childrenRadii.set(s.nodeId, n.radius);
3929
+ let a = 0;
3930
+ s.children.forEach((h) => {
3931
+ this.offsets.set(h.nodeId, n.offsets[a]), a++;
3932
+ });
3933
+ }
3934
+ }), this.offsets.set(this.tree.root.nodeId, 0);
3935
+ }
3936
+ generate() {
3937
+ return this.offsets;
3938
+ }
3939
+ }
3940
+ class sr {
3941
+ constructor(e) {
3942
+ this.params = e;
3943
+ }
3944
+ calculateCoordinates(e) {
3945
+ const t = /* @__PURE__ */ new Map(), o = new er(e.graph).generate();
3946
+ let n = 0;
3947
+ return o.forEach((a) => {
3948
+ t.set(a.root.nodeId, { x: n, y: 0 });
3949
+ const d = new rr(a, {
3950
+ spaceAroundRadius: this.params.layerSpace / 2
3951
+ }).generate();
3952
+ let c = [a.root];
3953
+ for (; c.length > 0; ) {
3954
+ const g = [];
3955
+ n += this.params.layerWidth, c.forEach((l) => {
3956
+ l.children.forEach((u) => {
3957
+ const w = t.get(l.nodeId).y;
3958
+ t.set(u.nodeId, {
3959
+ y: w + d.get(u.nodeId),
3960
+ x: n
3961
+ }), g.push(u);
3962
+ });
3963
+ }), c = g;
3964
+ }
3965
+ }), t.forEach((a) => {
3966
+ const h = this.params.transform(a);
3967
+ a.x = h.x, a.y = h.y;
3968
+ }), t;
3969
+ }
3970
+ }
3971
+ class or {
3972
+ constructor(e) {
3973
+ i(this, "distanceVectorGenerator");
3974
+ i(this, "nodeForcesApplicationStrategy");
3975
+ i(this, "convergenceVelocity");
3976
+ i(this, "maxTimeDeltaSec");
3977
+ i(this, "nodeMass");
3978
+ i(this, "edgeEquilibriumLength");
3979
+ i(this, "edgeStiffness");
3980
+ i(this, "fillerLayoutAlgorithm");
3981
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ue(e.rand), this.nodeForcesApplicationStrategy = We({
3866
3982
  distanceVectorGenerator: this.distanceVectorGenerator,
3867
3983
  nodeCharge: e.nodeCharge,
3868
3984
  maxForce: e.maxForce,
@@ -3870,23 +3986,23 @@ class _t {
3870
3986
  theta: e.barnesHutTheta,
3871
3987
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
3872
3988
  nodeMass: e.nodeMass
3873
- }), this.fillerLayoutAlgorithm = new We({
3989
+ }), this.fillerLayoutAlgorithm = new ze({
3874
3990
  rand: e.rand,
3875
3991
  sparsity: e.edgeEquilibriumLength
3876
3992
  });
3877
3993
  }
3878
3994
  calculateNextCoordinates(e) {
3879
- const { graph: t, viewport: s, dt: i } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
3995
+ const { graph: t, viewport: s, dt: o } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
3880
3996
  graph: t,
3881
3997
  viewport: s
3882
3998
  });
3883
- return new Be(
3999
+ return new $e(
3884
4000
  t,
3885
4001
  n,
3886
4002
  {
3887
4003
  distanceVectorGenerator: this.distanceVectorGenerator,
3888
4004
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
3889
- dtSec: Math.min(i, this.maxTimeDeltaSec),
4005
+ dtSec: Math.min(o, this.maxTimeDeltaSec),
3890
4006
  nodeMass: this.nodeMass,
3891
4007
  edgeEquilibriumLength: this.edgeEquilibriumLength,
3892
4008
  edgeStiffness: this.edgeStiffness
@@ -3897,97 +4013,253 @@ class _t {
3897
4013
  }) ? /* @__PURE__ */ new Map() : n;
3898
4014
  }
3899
4015
  }
3900
- const ze = (r) => {
3901
- let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
4016
+ const ke = (r) => {
4017
+ let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
3902
4018
  for (let n = 0, a; n < r.length; n++)
3903
- a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = i ^ Math.imul(s ^ a, 951274213), i = e ^ Math.imul(i ^ a, 2716044179);
3904
- return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(i ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), i = Math.imul(t ^ i >>> 19, 2716044179), e ^= t ^ s ^ i, t ^= e, s ^= e, i ^= e, [e >>> 0, t >>> 0, s >>> 0, i >>> 0];
3905
- }, ke = (r, e, t, s) => function() {
4019
+ a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = o ^ Math.imul(s ^ a, 951274213), o = e ^ Math.imul(o ^ a, 2716044179);
4020
+ return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(o ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), o = Math.imul(t ^ o >>> 19, 2716044179), e ^= t ^ s ^ o, t ^= e, s ^= e, o ^= e, [e >>> 0, t >>> 0, s >>> 0, o >>> 0];
4021
+ }, He = (r, e, t, s) => function() {
3906
4022
  r |= 0, e |= 0, t |= 0, s |= 0;
3907
- const i = (r + e | 0) + s | 0;
3908
- return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + i | 0, (i >>> 0) / 4294967296;
3909
- }, er = (r) => {
4023
+ const o = (r + e | 0) + s | 0;
4024
+ return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + o | 0, (o >>> 0) / 4294967296;
4025
+ }, A = Object.freeze({
4026
+ seed: "HTMLGraph is awesome",
4027
+ maxTimeDeltaSec: 0.01,
4028
+ nodeCharge: 1e5,
4029
+ nodeMass: 1,
4030
+ edgeEquilibriumLength: 300,
4031
+ edgeStiffness: 1e3,
4032
+ dtSec: 0.01,
4033
+ maxIterations: 1e3,
4034
+ convergenceVelocity: 10,
4035
+ maxForce: 1e7,
4036
+ nodeForceCoefficient: 1,
4037
+ barnesHutAreaRadiusThreshold: 0.01,
4038
+ barnesHutTheta: 1
4039
+ }), ir = (r) => {
3910
4040
  var e, t;
3911
4041
  switch (r == null ? void 0 : r.type) {
3912
4042
  case "custom":
3913
4043
  return r.instance;
3914
4044
  default: {
3915
- const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
3916
- return new _t({
3917
- rand: i,
3918
- maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3919
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3920
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3921
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3922
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? v.edgeStiffness,
3923
- convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? v.convergenceVelocity,
3924
- maxForce: (r == null ? void 0 : r.maxForce) ?? v.maxForce,
3925
- nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3926
- barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? v.barnesHutTheta,
3927
- barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
4045
+ const s = ke((r == null ? void 0 : r.seed) ?? A.seed), o = He(s[0], s[1], s[2], s[3]);
4046
+ return new or({
4047
+ rand: o,
4048
+ maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
4049
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
4050
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
4051
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
4052
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
4053
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
4054
+ maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
4055
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
4056
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
4057
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
3928
4058
  });
3929
4059
  }
3930
4060
  }
3931
- }, Y = {
4061
+ }, j = {
3932
4062
  staticNodeResolver: () => !1,
3933
4063
  onBeforeApplied: () => {
3934
4064
  },
3935
4065
  onAfterApplied: () => {
3936
4066
  }
3937
- }, tr = (r) => {
4067
+ }, nr = (r) => {
3938
4068
  var t, s;
3939
4069
  return {
3940
- algorithm: er((r == null ? void 0 : r.algorithm) ?? {}),
3941
- staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Y.staticNodeResolver,
3942
- onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? Y.onBeforeApplied,
3943
- onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? Y.onAfterApplied
4070
+ algorithm: ir((r == null ? void 0 : r.algorithm) ?? {}),
4071
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? j.staticNodeResolver,
4072
+ onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? j.onBeforeApplied,
4073
+ onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? j.onAfterApplied
3944
4074
  };
3945
- }, rr = (r) => r instanceof Q ? {
4075
+ }, ar = (r) => r instanceof Q ? {
3946
4076
  type: "manual",
3947
4077
  trigger: r
3948
4078
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
3949
4079
  type: "topologyChangeMacrotask"
3950
4080
  } : {
3951
4081
  type: "topologyChangeMicrotask"
3952
- }, sr = (r) => {
4082
+ }, F = Object.freeze({
4083
+ staticNodeResolver: () => !1,
4084
+ onBeforeApplied: () => {
4085
+ },
4086
+ onAfterApplied: () => {
4087
+ },
4088
+ hierarchicalLayout: {
4089
+ layerWidth: 300,
4090
+ layerSpace: 300
4091
+ }
4092
+ }), $ = (r, e) => ({
4093
+ a: r.a * e.a + r.b * e.d,
4094
+ b: r.a * e.b + r.b * e.e,
4095
+ c: r.a * e.c + r.b * e.f + r.c,
4096
+ d: r.d * e.a + r.e * e.d,
4097
+ e: r.d * e.b + r.e * e.e,
4098
+ f: r.d * e.c + r.e * e.f + r.f
4099
+ }), hr = (r) => {
4100
+ const { a: e, b: t, c: s, d: o, e: n, f: a } = r, h = e * n - t * o;
4101
+ return {
4102
+ a: n / h,
4103
+ b: -t / h,
4104
+ c: (t * a - s * n) / h,
4105
+ d: -o / h,
4106
+ e: e / h,
4107
+ f: (s * o - e * a) / h
4108
+ };
4109
+ };
4110
+ class dr {
4111
+ resolve(e) {
4112
+ if ("shift" in e)
4113
+ return this.createShiftBaseMatrix(e.shift);
4114
+ if ("scale" in e) {
4115
+ const t = e.origin ?? { x: 0, y: 0 };
4116
+ return this.createScaleRelativeMatrix(e.scale, t);
4117
+ }
4118
+ if ("rotate" in e) {
4119
+ const t = e.origin ?? { x: 0, y: 0 };
4120
+ return this.createRotateRelativeMatrix(e.rotate, t);
4121
+ }
4122
+ if ("mirror" in e) {
4123
+ const t = e.origin ?? { x: 0, y: 0 };
4124
+ return this.createMirrorRelativeMatrix(e.mirror, t);
4125
+ }
4126
+ return {
4127
+ a: e.a ?? 1,
4128
+ b: e.b ?? 0,
4129
+ c: e.c ?? 0,
4130
+ d: e.d ?? 0,
4131
+ e: e.e ?? 1,
4132
+ f: e.f ?? 0
4133
+ };
4134
+ }
4135
+ createScaleRelativeMatrix(e, t) {
4136
+ const s = this.createScaleBaseMatrix(e), o = this.createShiftBaseMatrix(t);
4137
+ return this.createRelativeTransform(s, o);
4138
+ }
4139
+ createRotateRelativeMatrix(e, t) {
4140
+ const s = this.createRotateBaseMatrix(e), o = this.createShiftBaseMatrix(t);
4141
+ return this.createRelativeTransform(s, o);
4142
+ }
4143
+ createMirrorRelativeMatrix(e, t) {
4144
+ const s = this.createMirrorYBaseMatrix(), o = $(
4145
+ this.createShiftBaseMatrix(t),
4146
+ this.createRotateBaseMatrix(e)
4147
+ );
4148
+ return this.createRelativeTransform(s, o);
4149
+ }
4150
+ createRelativeTransform(e, t) {
4151
+ const s = $(
4152
+ t,
4153
+ e
4154
+ ), o = hr(t);
4155
+ return $(s, o);
4156
+ }
4157
+ createShiftBaseMatrix(e) {
4158
+ return {
4159
+ a: 1,
4160
+ b: 0,
4161
+ c: e.x,
4162
+ d: 0,
4163
+ e: 1,
4164
+ f: e.y
4165
+ };
4166
+ }
4167
+ createScaleBaseMatrix(e) {
4168
+ return {
4169
+ a: e,
4170
+ b: 0,
4171
+ c: 0,
4172
+ d: 0,
4173
+ e,
4174
+ f: 0
4175
+ };
4176
+ }
4177
+ createRotateBaseMatrix(e) {
4178
+ const t = Math.sin(e), s = Math.cos(e);
4179
+ return {
4180
+ a: s,
4181
+ b: -t,
4182
+ c: 0,
4183
+ d: t,
4184
+ e: s,
4185
+ f: 0
4186
+ };
4187
+ }
4188
+ createMirrorYBaseMatrix() {
4189
+ return {
4190
+ a: 1,
4191
+ b: 0,
4192
+ c: 0,
4193
+ d: 0,
4194
+ e: -1,
4195
+ f: 0
4196
+ };
4197
+ }
4198
+ }
4199
+ const cr = (r) => {
4200
+ if (r === void 0)
4201
+ return (o) => o;
4202
+ if (typeof r == "function")
4203
+ return r;
4204
+ const e = Array.isArray(r) ? r : [r];
4205
+ let t = {
4206
+ a: 1,
4207
+ b: 0,
4208
+ c: 0,
4209
+ d: 0,
4210
+ e: 1,
4211
+ f: 0
4212
+ };
4213
+ const s = new dr();
4214
+ return e.forEach((o) => {
4215
+ const n = s.resolve(o);
4216
+ t = $(t, n);
4217
+ }), (o) => {
4218
+ const { x: n, y: a } = o;
4219
+ return {
4220
+ x: t.a * n + t.b * a + t.c,
4221
+ y: t.d * n + t.e * a + t.f
4222
+ };
4223
+ };
4224
+ }, lr = (r) => {
3953
4225
  var e, t;
3954
4226
  switch (r == null ? void 0 : r.type) {
3955
4227
  case "custom":
3956
4228
  return r.instance;
4229
+ case "hierarchical":
4230
+ return new sr({
4231
+ layerWidth: r.layerWidth ?? F.hierarchicalLayout.layerWidth,
4232
+ layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace,
4233
+ transform: cr(r.transform)
4234
+ });
3957
4235
  default: {
3958
- const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
3959
- return new Jt({
3960
- dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
3961
- maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
3962
- rand: i,
3963
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3964
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3965
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3966
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? v.edgeStiffness,
3967
- convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? v.convergenceVelocity,
3968
- maxForce: (r == null ? void 0 : r.maxForce) ?? v.maxForce,
3969
- nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3970
- barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? v.barnesHutTheta,
3971
- barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
4236
+ const s = ke((r == null ? void 0 : r.seed) ?? A.seed), o = He(s[0], s[1], s[2], s[3]);
4237
+ return new _t({
4238
+ dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
4239
+ maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
4240
+ rand: o,
4241
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
4242
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
4243
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
4244
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
4245
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
4246
+ maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
4247
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
4248
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
4249
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
3972
4250
  });
3973
4251
  }
3974
4252
  }
3975
- }, G = {
3976
- staticNodeResolver: () => !1,
3977
- onBeforeApplied: () => {
3978
- },
3979
- onAfterApplied: () => {
3980
- }
3981
- }, or = (r) => {
4253
+ }, gr = (r) => {
3982
4254
  var e, t;
3983
4255
  return {
3984
- algorithm: sr(r == null ? void 0 : r.algorithm),
3985
- applyOn: rr(r == null ? void 0 : r.applyOn),
3986
- staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
3987
- onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ?? G.onBeforeApplied,
3988
- onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ?? G.onAfterApplied
4256
+ algorithm: lr(r == null ? void 0 : r.algorithm),
4257
+ applyOn: ar(r == null ? void 0 : r.applyOn),
4258
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? F.staticNodeResolver,
4259
+ onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ?? F.onBeforeApplied,
4260
+ onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ?? F.onAfterApplied
3989
4261
  };
3990
- }, ir = (r, e) => ({
4262
+ }, ur = (r, e) => ({
3991
4263
  ...r,
3992
4264
  onNodeDragStarted: (t) => {
3993
4265
  e.add(t), r.onNodeDragStarted(t);
@@ -3995,44 +4267,44 @@ const ze = (r) => {
3995
4267
  onNodeDragFinished: (t) => {
3996
4268
  e.delete(t), r.onNodeDragFinished(t);
3997
4269
  }
3998
- }), nr = (r, e) => {
4270
+ }), pr = (r, e) => {
3999
4271
  r.onBeforeNodeRemoved.subscribe((t) => {
4000
4272
  e.delete(t);
4001
4273
  }), r.onBeforeClear.subscribe(() => {
4002
4274
  e.clear();
4003
4275
  });
4004
- }, ar = (r, e) => ({
4276
+ }, wr = (r, e) => ({
4005
4277
  ...r,
4006
4278
  staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
4007
4279
  });
4008
- class cr {
4280
+ class mr {
4009
4281
  constructor(e) {
4010
- o(this, "used", !1);
4011
- o(this, "canvasDefaults", {});
4012
- o(this, "dragConfig", {});
4013
- o(this, "transformConfig", {});
4014
- o(this, "backgroundConfig", {});
4015
- o(this, "connectablePortsConfig", {});
4016
- o(this, "draggableEdgesConfig", {});
4017
- o(this, "virtualScrollConfig");
4018
- o(this, "layoutConfig", {});
4019
- o(this, "animatedLayoutConfig", {});
4020
- o(this, "hasDraggableNodes", !1);
4021
- o(this, "hasTransformableViewport", !1);
4022
- o(this, "hasNodeResizeReactiveEdges", !1);
4023
- o(this, "hasBackground", !1);
4024
- o(this, "hasUserConnectablePorts", !1);
4025
- o(this, "hasUserDraggableEdges", !1);
4026
- o(this, "hasAnimatedLayout", !1);
4027
- o(this, "hasLayout", !1);
4028
- o(this, "boxRenderingTrigger", new Q());
4029
- o(this, "graphStore");
4030
- o(this, "viewportStore");
4031
- o(this, "graph");
4032
- o(this, "viewport");
4033
- o(this, "window", window);
4034
- o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
4035
- this.element = e, this.viewportStore = new Je(this.element), this.viewport = new Fe(this.viewportStore), this.graphStore = new xe(), this.graph = new Ve(this.graphStore);
4282
+ i(this, "used", !1);
4283
+ i(this, "canvasDefaults", {});
4284
+ i(this, "dragConfig", {});
4285
+ i(this, "transformConfig", {});
4286
+ i(this, "backgroundConfig", {});
4287
+ i(this, "connectablePortsConfig", {});
4288
+ i(this, "draggableEdgesConfig", {});
4289
+ i(this, "virtualScrollConfig");
4290
+ i(this, "layoutConfig", {});
4291
+ i(this, "animatedLayoutConfig", {});
4292
+ i(this, "hasDraggableNodes", !1);
4293
+ i(this, "hasTransformableViewport", !1);
4294
+ i(this, "hasNodeResizeReactiveEdges", !1);
4295
+ i(this, "hasBackground", !1);
4296
+ i(this, "hasUserConnectablePorts", !1);
4297
+ i(this, "hasUserDraggableEdges", !1);
4298
+ i(this, "hasAnimatedLayout", !1);
4299
+ i(this, "hasLayout", !1);
4300
+ i(this, "boxRenderingTrigger", new Q());
4301
+ i(this, "graphStore");
4302
+ i(this, "viewportStore");
4303
+ i(this, "graph");
4304
+ i(this, "viewport");
4305
+ i(this, "window", window);
4306
+ i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
4307
+ this.element = e, this.viewportStore = new _e(this.element), this.viewport = new Ie(this.viewportStore), this.graphStore = new Se(), this.graph = new Fe(this.graphStore);
4036
4308
  }
4037
4309
  /**
4038
4310
  * specifies default values for graph entities
@@ -4100,9 +4372,9 @@ class cr {
4100
4372
  */
4101
4373
  build() {
4102
4374
  if (this.used)
4103
- throw new jt("CanvasBuilder is a single use object");
4375
+ throw new qt("CanvasBuilder is a single use object");
4104
4376
  this.used = !0;
4105
- const e = new Rt(this.element), t = this.createHtmlView(e.main), s = It(this.canvasDefaults), i = new Ee(
4377
+ const e = new Vt(this.element), t = this.createHtmlView(e.main), s = Bt(this.canvasDefaults), o = new Ee(
4106
4378
  this.graph,
4107
4379
  this.viewport,
4108
4380
  this.graphStore,
@@ -4110,30 +4382,30 @@ class cr {
4110
4382
  t,
4111
4383
  s
4112
4384
  );
4113
- if (this.hasBackground && te.configure(
4114
- i,
4115
- kt(this.backgroundConfig),
4385
+ if (this.hasBackground && re.configure(
4386
+ o,
4387
+ Ht(this.backgroundConfig),
4116
4388
  e.background
4117
- ), this.hasNodeResizeReactiveEdges && Z.configure(i), this.hasDraggableNodes) {
4118
- let a = Bt(this.dragConfig);
4119
- this.hasAnimatedLayout && (a = ir(
4389
+ ), this.hasNodeResizeReactiveEdges && Z.configure(o), this.hasDraggableNodes) {
4390
+ let a = $t(this.dragConfig);
4391
+ this.hasAnimatedLayout && (a = ur(
4120
4392
  a,
4121
4393
  this.animationStaticNodes
4122
- )), _.configure(
4123
- i,
4394
+ )), ee.configure(
4395
+ o,
4124
4396
  e.main,
4125
4397
  this.window,
4126
4398
  a
4127
4399
  );
4128
4400
  }
4129
4401
  if (this.hasUserConnectablePorts) {
4130
- const a = Ht(
4402
+ const a = Yt(
4131
4403
  this.connectablePortsConfig,
4132
4404
  s.edges.shapeFactory,
4133
4405
  s.ports.direction
4134
4406
  );
4135
- re.configure(
4136
- i,
4407
+ se.configure(
4408
+ o,
4137
4409
  e.overlayConnectablePorts,
4138
4410
  this.viewportStore,
4139
4411
  this.window,
@@ -4143,50 +4415,50 @@ class cr {
4143
4415
  if (this.hasUserDraggableEdges) {
4144
4416
  const a = Xt(
4145
4417
  this.draggableEdgesConfig,
4146
- i.graph
4418
+ o.graph
4147
4419
  );
4148
- se.configure(
4149
- i,
4420
+ oe.configure(
4421
+ o,
4150
4422
  e.overlayDraggableEdges,
4151
4423
  this.viewportStore,
4152
4424
  this.window,
4153
4425
  a
4154
4426
  );
4155
4427
  }
4156
- if (this.virtualScrollConfig !== void 0 ? ee.configure(
4157
- i,
4428
+ if (this.virtualScrollConfig !== void 0 ? te.configure(
4429
+ o,
4158
4430
  e.main,
4159
4431
  this.window,
4160
- ve(this.transformConfig),
4432
+ Ae(this.transformConfig),
4161
4433
  this.boxRenderingTrigger,
4162
- Yt(this.virtualScrollConfig)
4163
- ) : this.hasTransformableViewport && H.configure(
4164
- i,
4434
+ Gt(this.virtualScrollConfig)
4435
+ ) : this.hasTransformableViewport && X.configure(
4436
+ o,
4165
4437
  e.main,
4166
4438
  this.window,
4167
- ve(this.transformConfig)
4439
+ Ae(this.transformConfig)
4168
4440
  ), this.hasLayout && Dt.configure(
4169
- i,
4170
- or(this.layoutConfig)
4441
+ o,
4442
+ gr(this.layoutConfig)
4171
4443
  ), this.hasAnimatedLayout) {
4172
- let a = tr(
4444
+ let a = nr(
4173
4445
  this.animatedLayoutConfig
4174
4446
  );
4175
- this.hasDraggableNodes && (nr(
4176
- i.graph,
4447
+ this.hasDraggableNodes && (pr(
4448
+ o.graph,
4177
4449
  this.animationStaticNodes
4178
- ), a = ar(
4450
+ ), a = wr(
4179
4451
  a,
4180
4452
  this.animationStaticNodes
4181
- )), ie.configure(i, a, this.window);
4453
+ )), ne.configure(o, a, this.window);
4182
4454
  }
4183
4455
  const n = () => {
4184
- e.destroy(), i.onBeforeDestroy.unsubscribe(n);
4456
+ e.destroy(), o.onBeforeDestroy.unsubscribe(n);
4185
4457
  };
4186
- return i.onBeforeDestroy.subscribe(n), i;
4458
+ return o.onBeforeDestroy.subscribe(n), o;
4187
4459
  }
4188
4460
  createHtmlView(e) {
4189
- let t = new Ae(
4461
+ let t = new xe(
4190
4462
  this.graphStore,
4191
4463
  this.viewportStore,
4192
4464
  e
@@ -4195,22 +4467,22 @@ class cr {
4195
4467
  t,
4196
4468
  this.graphStore,
4197
4469
  this.boxRenderingTrigger,
4198
- Gt(this.virtualScrollConfig)
4470
+ jt(this.virtualScrollConfig)
4199
4471
  )), new Ze(t, this.graphStore);
4200
4472
  }
4201
4473
  }
4202
4474
  export {
4203
- wt as BezierEdgeShape,
4204
- cr as CanvasBuilder,
4205
- jt as CanvasBuilderError,
4206
- A as CanvasError,
4207
- M as ConnectionCategory,
4475
+ ft as BezierEdgeShape,
4476
+ mr as CanvasBuilder,
4477
+ qt as CanvasBuilderError,
4478
+ x as CanvasError,
4479
+ D as ConnectionCategory,
4208
4480
  Le as DirectEdgeShape,
4209
4481
  Q as EventSubject,
4210
4482
  yt as HorizontalEdgeShape,
4211
4483
  Et as InteractiveEdgeError,
4212
- Re as InteractiveEdgeShape,
4213
- dr as MidpointEdgeShape,
4214
- ft as StraightEdgeShape,
4215
- mt as VerticalEdgeShape
4484
+ Ve as InteractiveEdgeShape,
4485
+ yr as MidpointEdgeShape,
4486
+ mt as StraightEdgeShape,
4487
+ vt as VerticalEdgeShape
4216
4488
  };