@html-graph/html-graph 8.0.0 → 8.2.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,6 +1,6 @@
1
- var ke = Object.defineProperty;
2
- var ze = (r, e, t) => e in r ? ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => ze(r, typeof e != "symbol" ? e + "" : e, t);
1
+ var ze = Object.defineProperty;
2
+ var ke = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => ke(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  var M = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(M || {});
5
5
  const He = () => {
6
6
  const r = document.createElement("div");
@@ -13,11 +13,11 @@ const He = () => {
13
13
  };
14
14
  class me {
15
15
  constructor(e, t, s) {
16
- i(this, "host", He());
17
- i(this, "container", Xe());
18
- i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
19
- i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
20
- i(this, "applyTransform", () => {
16
+ o(this, "host", He());
17
+ o(this, "container", Xe());
18
+ o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
19
+ o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
20
+ o(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
  });
@@ -50,7 +50,7 @@ class me {
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: 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;
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;
54
54
  t.element.style.transform = `translate(${d}px, ${c}px)`;
55
55
  }
56
56
  updateNodePriority(e) {
@@ -60,24 +60,24 @@ class me {
60
60
  updateEdgeShape(e) {
61
61
  const t = this.edgeIdToElementMap.get(e);
62
62
  this.container.removeChild(t);
63
- const o = this.graphStore.getEdge(e).payload.shape.svg;
64
- this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
63
+ const i = this.graphStore.getEdge(e).payload.shape.svg;
64
+ this.edgeIdToElementMap.set(e, i), this.container.appendChild(i);
65
65
  }
66
66
  renderEdge(e) {
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(
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(
68
68
  s,
69
69
  n,
70
70
  h,
71
71
  d
72
- ), g = this.createEdgeRenderPort(o, a, h, d);
72
+ ), g = this.createEdgeRenderPort(i, a, h, d);
73
73
  let l = M.Line;
74
- s.element === o.element ? l = M.PortCycle : s.nodeId === o.nodeId && (l = M.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
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 });
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, o) {
80
+ createEdgeRenderPort(e, t, s, i) {
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 me {
85
85
  return {
86
86
  x: n.x,
87
87
  y: n.y,
88
- width: t.width * o,
89
- height: t.height * o,
88
+ width: t.width * i,
89
+ height: t.height * i,
90
90
  direction: e.payload.direction
91
91
  };
92
92
  }
93
93
  }
94
94
  class Ge {
95
95
  constructor(e) {
96
- i(this, "xFrom", 1 / 0);
97
- i(this, "yFrom", 1 / 0);
98
- i(this, "xTo", 1 / 0);
99
- i(this, "yTo", 1 / 0);
96
+ o(this, "xFrom", 1 / 0);
97
+ o(this, "yFrom", 1 / 0);
98
+ o(this, "xTo", 1 / 0);
99
+ o(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: o } = t;
107
- return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
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;
108
108
  }
109
109
  hasEdge(e) {
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);
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);
111
111
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
112
112
  }
113
113
  }
114
114
  class je {
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) => {
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) => {
120
120
  this.renderingBox.setRenderingBox(e);
121
- const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
121
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__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 ? o.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 ? i.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
- }), o.forEach((a) => {
134
+ }), i.forEach((a) => {
135
135
  this.handleAttachEdge(a);
136
136
  });
137
137
  });
138
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ge(this.graphStore), this.trigger.subscribe(this.updateViewport);
138
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Ge(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 je {
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, 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);
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);
178
178
  }
179
179
  handleAttachNode(e) {
180
180
  this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -189,10 +189,10 @@ class je {
189
189
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
190
190
  }
191
191
  }
192
- class qe {
192
+ class Ke {
193
193
  constructor(e, t) {
194
- i(this, "deferredNodes", /* @__PURE__ */ new Set());
195
- i(this, "deferredEdges", /* @__PURE__ */ new Set());
194
+ o(this, "deferredNodes", /* @__PURE__ */ new Set());
195
+ o(this, "deferredEdges", /* @__PURE__ */ new Set());
196
196
  this.htmlView = e, this.graphStore = t;
197
197
  }
198
198
  attachNode(e) {
@@ -236,8 +236,8 @@ class qe {
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), o = this.graphStore.getPort(t.to);
240
- return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
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));
241
241
  }
242
242
  tryAttachEdge(e) {
243
243
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
@@ -245,7 +245,7 @@ class qe {
245
245
  }
246
246
  class j {
247
247
  constructor() {
248
- i(this, "callbacks", /* @__PURE__ */ new Set());
248
+ o(this, "callbacks", /* @__PURE__ */ new Set());
249
249
  }
250
250
  subscribe(e) {
251
251
  this.callbacks.add(e);
@@ -265,7 +265,7 @@ const x = () => {
265
265
  };
266
266
  class X {
267
267
  constructor(e) {
268
- i(this, "counter", 0);
268
+ o(this, "counter", 0);
269
269
  this.checkExists = e;
270
270
  }
271
271
  create(e) {
@@ -279,74 +279,68 @@ class X {
279
279
  this.counter = 0;
280
280
  }
281
281
  }
282
- class A extends Error {
283
- constructor() {
284
- super(...arguments);
285
- i(this, "name", "CanvasError");
286
- }
287
- }
288
282
  class ve {
289
- constructor(e, t, s, o, n, a) {
290
- i(this, "nodeIdGenerator", new X(
283
+ constructor(e, t, s, i, n, a) {
284
+ o(this, "nodeIdGenerator", new X(
291
285
  (e) => this.graphStore.hasNode(e)
292
286
  ));
293
- i(this, "portIdGenerator", new X(
287
+ o(this, "portIdGenerator", new X(
294
288
  (e) => this.graphStore.hasPort(e)
295
289
  ));
296
- i(this, "edgeIdGenerator", new X(
290
+ o(this, "edgeIdGenerator", new X(
297
291
  (e) => this.graphStore.hasEdge(e)
298
292
  ));
299
- i(this, "onAfterNodeAdded", (e) => {
293
+ o(this, "onAfterNodeAdded", (e) => {
300
294
  this.htmlView.attachNode(e);
301
295
  });
302
- i(this, "onAfterNodeUpdated", (e) => {
296
+ o(this, "onAfterNodeUpdated", (e) => {
303
297
  this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
304
298
  this.htmlView.renderEdge(t);
305
299
  });
306
300
  });
307
- i(this, "onAfterNodePriorityUpdated", (e) => {
301
+ o(this, "onAfterNodePriorityUpdated", (e) => {
308
302
  this.htmlView.updateNodePriority(e);
309
303
  });
310
- i(this, "onBeforeNodeRemoved", (e) => {
304
+ o(this, "onBeforeNodeRemoved", (e) => {
311
305
  this.graphStore.getNodePortIds(e).forEach((t) => {
312
306
  this.unmarkPort(t);
313
307
  }), this.htmlView.detachNode(e);
314
308
  });
315
- i(this, "onAfterPortUpdated", (e) => {
309
+ o(this, "onAfterPortUpdated", (e) => {
316
310
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
317
311
  this.htmlView.renderEdge(t);
318
312
  });
319
313
  });
320
- i(this, "onBeforePortUnmarked", (e) => {
314
+ o(this, "onBeforePortUnmarked", (e) => {
321
315
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
322
316
  this.removeEdge(t);
323
317
  });
324
318
  });
325
- i(this, "onAfterEdgeAdded", (e) => {
319
+ o(this, "onAfterEdgeAdded", (e) => {
326
320
  this.htmlView.attachEdge(e);
327
321
  });
328
- i(this, "onAfterEdgeShapeUpdated", (e) => {
322
+ o(this, "onAfterEdgeShapeUpdated", (e) => {
329
323
  this.htmlView.updateEdgeShape(e);
330
324
  });
331
- i(this, "onAfterEdgeUpdated", (e) => {
325
+ o(this, "onAfterEdgeUpdated", (e) => {
332
326
  this.htmlView.renderEdge(e);
333
327
  });
334
- i(this, "onAfterEdgePriorityUpdated", (e) => {
328
+ o(this, "onAfterEdgePriorityUpdated", (e) => {
335
329
  this.htmlView.updateEdgePriority(e);
336
330
  });
337
- i(this, "onBeforeEdgeRemoved", (e) => {
331
+ o(this, "onBeforeEdgeRemoved", (e) => {
338
332
  this.htmlView.detachEdge(e);
339
333
  });
340
- i(this, "onBeforeClear", () => {
334
+ o(this, "onBeforeClear", () => {
341
335
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
342
336
  });
343
- i(this, "onBeforeDestroyEmitter");
344
- i(this, "destroyed", !1);
337
+ o(this, "onBeforeDestroyEmitter");
338
+ o(this, "destroyed", !1);
345
339
  /**
346
340
  * emits event just before destruction of canvas
347
341
  */
348
- i(this, "onBeforeDestroy");
349
- 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(
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(
350
344
  this.onAfterNodePriorityUpdated
351
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(
352
346
  this.onAfterEdgeShapeUpdated
@@ -359,12 +353,6 @@ class ve {
359
353
  */
360
354
  addNode(e) {
361
355
  const t = this.nodeIdGenerator.create(e.id);
362
- if (this.graphStore.hasNode(t))
363
- throw new A("failed to add node with existing id");
364
- if (this.graphStore.findNodeIdByElement(e.element) !== void 0)
365
- throw new A(
366
- "failed to add node with html element already in use by another node"
367
- );
368
356
  if (this.graphStore.addNode({
369
357
  id: t,
370
358
  element: e.element,
@@ -386,8 +374,6 @@ class ve {
386
374
  * updates node parameters
387
375
  */
388
376
  updateNode(e, t) {
389
- if (!this.graphStore.hasNode(e))
390
- throw new A("failed to update nonexistent node");
391
377
  return this.graphStore.updateNode(e, t ?? {}), this;
392
378
  }
393
379
  /**
@@ -396,8 +382,6 @@ class ve {
396
382
  * all the edges adjacent to node get removed
397
383
  */
398
384
  removeNode(e) {
399
- if (!this.graphStore.hasNode(e))
400
- throw new A("failed to remove nonexistent node");
401
385
  return this.graphStore.removeNode(e), this;
402
386
  }
403
387
  /**
@@ -405,10 +389,6 @@ class ve {
405
389
  */
406
390
  markPort(e) {
407
391
  const t = this.portIdGenerator.create(e.id);
408
- if (this.graphStore.hasPort(t))
409
- throw new A("failed to add port with existing id");
410
- if (!this.graphStore.hasNode(e.nodeId))
411
- throw new A("failed to mark port for nonexistent node");
412
392
  return this.graphStore.addPort({
413
393
  id: t,
414
394
  element: e.element,
@@ -420,8 +400,6 @@ class ve {
420
400
  * updates port and edges attached to it
421
401
  */
422
402
  updatePort(e, t) {
423
- if (!this.graphStore.hasPort(e))
424
- throw new A("failed to update nonexistent port");
425
403
  return this.graphStore.updatePort(e, t ?? {}), this;
426
404
  }
427
405
  /**
@@ -429,8 +407,6 @@ class ve {
429
407
  * all the edges adjacent to the port get removed
430
408
  */
431
409
  unmarkPort(e) {
432
- if (!this.graphStore.hasPort(e))
433
- throw new A("failed to unmark nonexistent port");
434
410
  return this.graphStore.removePort(e), this;
435
411
  }
436
412
  /**
@@ -438,12 +414,6 @@ class ve {
438
414
  */
439
415
  addEdge(e) {
440
416
  const t = this.edgeIdGenerator.create(e.id);
441
- if (this.graphStore.hasEdge(t))
442
- throw new A("failed to add edge with existing id");
443
- if (!this.graphStore.hasPort(e.from))
444
- throw new A("failed to add edge from nonexistent port");
445
- if (!this.graphStore.hasPort(e.to))
446
- throw new A("failed to add edge to nonexistent port");
447
417
  return this.graphStore.addEdge({
448
418
  id: t,
449
419
  from: e.from,
@@ -456,16 +426,12 @@ class ve {
456
426
  * updates specified edge
457
427
  */
458
428
  updateEdge(e, t) {
459
- if (!this.graphStore.hasEdge(e))
460
- throw new A("failed to update nonexistent edge");
461
429
  return this.graphStore.updateEdge(e, t ?? {}), this;
462
430
  }
463
431
  /**
464
432
  * removes specified edge
465
433
  */
466
434
  removeEdge(e) {
467
- if (!this.graphStore.hasEdge(e))
468
- throw new A("failed to remove nonexistent edge");
469
435
  return this.graphStore.removeEdge(e), this;
470
436
  }
471
437
  /**
@@ -501,10 +467,10 @@ class ve {
501
467
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
502
468
  }
503
469
  }
504
- class Ke {
470
+ class Qe {
505
471
  constructor() {
506
- i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
507
- i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
472
+ o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
473
+ o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
508
474
  }
509
475
  addRecord(e, t) {
510
476
  const s = this.singleToMultiMap.get(e);
@@ -541,42 +507,48 @@ class Ke {
541
507
  return this.multiToSingleMap.get(e) !== void 0;
542
508
  }
543
509
  }
510
+ class A extends Error {
511
+ constructor() {
512
+ super(...arguments);
513
+ o(this, "name", "CanvasError");
514
+ }
515
+ }
544
516
  class Ae {
545
517
  constructor() {
546
- i(this, "nodes", /* @__PURE__ */ new Map());
547
- i(this, "ports", /* @__PURE__ */ new Map());
548
- i(this, "edges", /* @__PURE__ */ new Map());
549
- i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
550
- i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
551
- i(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
552
- i(this, "portCycleEdges", /* @__PURE__ */ new Map());
553
- i(this, "elementPorts", new Ke());
554
- i(this, "afterNodeAddedEmitter");
555
- i(this, "onAfterNodeAdded");
556
- i(this, "afterNodeUpdatedEmitter");
557
- i(this, "onAfterNodeUpdated");
558
- i(this, "afterNodePriorityUpdatedEmitter");
559
- i(this, "onAfterNodePriorityUpdated");
560
- i(this, "beforeNodeRemovedEmitter");
561
- i(this, "onBeforeNodeRemoved");
562
- i(this, "afterPortAddedEmitter");
563
- i(this, "onAfterPortAdded");
564
- i(this, "afterPortUpdatedEmitter");
565
- i(this, "onAfterPortUpdated");
566
- i(this, "beforePortRemovedEmitter");
567
- i(this, "onBeforePortRemoved");
568
- i(this, "afterEdgeAddedEmitter");
569
- i(this, "onAfterEdgeAdded");
570
- i(this, "afterEdgeShapeUpdatedEmitter");
571
- i(this, "onAfterEdgeShapeUpdated");
572
- i(this, "afterEdgeUpdatedEmitter");
573
- i(this, "onAfterEdgeUpdated");
574
- i(this, "afterEdgePriorityUpdatedEmitter");
575
- i(this, "onAfterEdgePriorityUpdated");
576
- i(this, "beforeEdgeRemovedEmitter");
577
- i(this, "onBeforeEdgeRemoved");
578
- i(this, "beforeClearEmitter");
579
- i(this, "onBeforeClear");
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");
580
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();
581
553
  }
582
554
  hasNode(e) {
@@ -589,6 +561,12 @@ class Ae {
589
561
  return t;
590
562
  }
591
563
  addNode(e) {
564
+ if (this.hasNode(e.id))
565
+ throw new A("failed to add node with existing id");
566
+ if (this.findNodeIdByElement(e.element) !== void 0)
567
+ throw new A(
568
+ "failed to add node with html element already in use by another node"
569
+ );
592
570
  const t = /* @__PURE__ */ new Map(), s = {
593
571
  element: e.element,
594
572
  payload: {
@@ -608,10 +586,14 @@ class Ae {
608
586
  return this.nodesElementsMap.get(e);
609
587
  }
610
588
  updateNode(e, t) {
589
+ if (!this.hasNode(e))
590
+ throw new A("failed to update nonexistent node");
611
591
  const { payload: s } = this.nodes.get(e);
612
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);
613
593
  }
614
594
  removeNode(e) {
595
+ if (!this.hasNode(e))
596
+ throw new A("failed to remove nonexistent node");
615
597
  this.beforeNodeRemovedEmitter.emit(e);
616
598
  const t = this.nodes.get(e);
617
599
  this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
@@ -626,6 +608,10 @@ class Ae {
626
608
  return t;
627
609
  }
628
610
  addPort(e) {
611
+ if (this.hasPort(e.id))
612
+ throw new A("failed to add port with existing id");
613
+ if (!this.hasNode(e.nodeId))
614
+ throw new A("failed to add port to nonexistent node");
629
615
  this.ports.set(e.id, {
630
616
  element: e.element,
631
617
  payload: {
@@ -635,6 +621,8 @@ class Ae {
635
621
  }), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutcomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
636
622
  }
637
623
  updatePort(e, t) {
624
+ if (!this.hasPort(e))
625
+ throw new A("failed to update nonexistent port");
638
626
  const s = this.ports.get(e).payload;
639
627
  s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
640
628
  }
@@ -651,6 +639,8 @@ class Ae {
651
639
  return Array.from(t.ports.keys());
652
640
  }
653
641
  removePort(e) {
642
+ if (!this.hasPort(e))
643
+ throw new A("failed to remove nonexistent port");
654
644
  const t = this.ports.get(e).nodeId;
655
645
  this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
656
646
  }
@@ -664,15 +654,23 @@ class Ae {
664
654
  return t;
665
655
  }
666
656
  addEdge(e) {
657
+ if (this.hasEdge(e.id))
658
+ throw new A("failed to add edge with existing id");
659
+ if (!this.hasPort(e.from))
660
+ throw new A("failed to add edge from nonexistent port");
661
+ if (!this.hasPort(e.to))
662
+ throw new A("failed to add edge to nonexistent port");
667
663
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
668
664
  }
669
665
  updateEdge(e, t) {
666
+ if (!this.hasEdge(e))
667
+ throw new A("failed to update nonexistent edge");
670
668
  if (t.from !== void 0 || t.to !== void 0) {
671
- const o = this.edges.get(e), n = o.payload;
669
+ const i = this.edges.get(e), n = i.payload;
672
670
  this.removeEdgeInternal(e), this.addEdgeInternal({
673
671
  id: e,
674
- from: t.from ?? o.from,
675
- to: t.to ?? o.to,
672
+ from: t.from ?? i.from,
673
+ to: t.to ?? i.to,
676
674
  shape: n.shape,
677
675
  priority: n.priority
678
676
  });
@@ -684,6 +682,8 @@ class Ae {
684
682
  return Array.from(this.edges.keys());
685
683
  }
686
684
  removeEdge(e) {
685
+ if (!this.hasEdge(e))
686
+ throw new A("failed to remove nonexistent edge");
687
687
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
688
688
  }
689
689
  clear() {
@@ -716,8 +716,8 @@ class Ae {
716
716
  }
717
717
  getNodeIncomingEdgeIds(e) {
718
718
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
719
- return t.forEach((o) => {
720
- this.getPortIncomingEdgeIds(o).filter((n) => {
719
+ return t.forEach((i) => {
720
+ this.getPortIncomingEdgeIds(i).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 Ae {
727
727
  }
728
728
  getNodeOutgoingEdgeIds(e) {
729
729
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
730
- return t.forEach((o) => {
731
- this.getPortOutgoingEdgeIds(o).filter((n) => {
730
+ return t.forEach((i) => {
731
+ this.getPortOutgoingEdgeIds(i).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 Ae {
738
738
  }
739
739
  getNodeCycleEdgeIds(e) {
740
740
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
741
- return t.forEach((o) => {
742
- this.getPortCycleEdgeIds(o).forEach((n) => {
741
+ return t.forEach((i) => {
742
+ this.getPortCycleEdgeIds(i).forEach((n) => {
743
743
  s.push(n);
744
- }), this.getPortIncomingEdgeIds(o).filter((n) => {
744
+ }), this.getPortIncomingEdgeIds(i).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 Ae {
751
751
  }
752
752
  getNodeAdjacentEdgeIds(e) {
753
753
  const t = Array.from(this.getNode(e).ports.keys()), s = [];
754
- return t.forEach((o) => {
755
- this.getPortIncomingEdgeIds(o).forEach((n) => {
754
+ return t.forEach((i) => {
755
+ this.getPortIncomingEdgeIds(i).forEach((n) => {
756
756
  s.push(n);
757
- }), this.getPortOutgoingEdgeIds(o).forEach((n) => {
757
+ }), this.getPortOutgoingEdgeIds(i).forEach((n) => {
758
758
  s.push(n);
759
- }), this.getPortCycleEdgeIds(o).forEach((n) => {
759
+ }), this.getPortCycleEdgeIds(i).forEach((n) => {
760
760
  s.push(n);
761
761
  });
762
762
  }), s;
@@ -772,8 +772,8 @@ class Ae {
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, 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);
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);
777
777
  }
778
778
  }
779
779
  const de = (r) => ({
@@ -788,17 +788,17 @@ const de = (r) => ({
788
788
  x: r.scale * e.x + r.x,
789
789
  y: r.scale * e.y + r.y
790
790
  });
791
- class Qe {
791
+ class Ze {
792
792
  constructor(e) {
793
- i(this, "viewportMatrix", ce);
794
- i(this, "contentMatrix", ce);
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(() => {
793
+ o(this, "viewportMatrix", ce);
794
+ o(this, "contentMatrix", ce);
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(() => {
802
802
  this.afterResizeEmitter.emit();
803
803
  }));
804
804
  this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = x(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = x(), [this.afterResizeEmitter, this.onAfterResize] = x(), this.observer.observe(this.host);
@@ -837,40 +837,40 @@ class Qe {
837
837
  this.observer.disconnect();
838
838
  }
839
839
  }
840
- class q {
840
+ class K {
841
841
  constructor(e) {
842
- i(this, "elementToNodeId", /* @__PURE__ */ new Map());
843
- i(this, "nodesResizeObserver");
844
- i(this, "onAfterNodeAdded", (e) => {
842
+ o(this, "elementToNodeId", /* @__PURE__ */ new Map());
843
+ o(this, "nodesResizeObserver");
844
+ o(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
- i(this, "onBeforeNodeRemoved", (e) => {
848
+ o(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
- i(this, "onBeforeClear", () => {
852
+ o(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 o = s.target;
858
- this.handleNodeResize(o);
857
+ const i = s.target;
858
+ this.handleNodeResize(i);
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
  }
862
862
  static configure(e) {
863
- new q(e);
863
+ new K(e);
864
864
  }
865
865
  handleNodeResize(e) {
866
866
  const t = this.elementToNodeId.get(e);
867
867
  this.canvas.updateNode(t);
868
868
  }
869
869
  }
870
- const Ze = (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
- }, Je = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => Ze(e, t, s) && Je(r, t, s), $ = (r, e) => {
870
+ const qe = (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
+ }, Je = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => qe(e, t, s) && Je(r, t, s), $ = (r, e) => {
874
874
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
875
875
  }, U = (r) => {
876
876
  const e = document.createElement("div");
@@ -910,8 +910,8 @@ function* Ee(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 o = Ee(s.shadowRoot, e);
914
- for (const n of o)
913
+ const i = Ee(s.shadowRoot, e);
914
+ for (const n of i)
915
915
  yield n;
916
916
  }
917
917
  yield s;
@@ -920,15 +920,15 @@ function* Ee(r, e) {
920
920
  const xe = (r, e) => {
921
921
  const t = Ee(document, e);
922
922
  for (const s of t) {
923
- const o = _e(r, s);
924
- if (o.status === "portFound")
925
- return o.portId;
926
- if (o.status === "nodeEncountered")
923
+ const i = _e(r, s);
924
+ if (i.status === "portFound")
925
+ return i.portId;
926
+ if (i.status === "nodeEncountered")
927
927
  return null;
928
928
  }
929
929
  return null;
930
930
  };
931
- var T = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(T || {});
931
+ var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(N || {});
932
932
  const Se = (r, e) => ({
933
933
  x: r / 2,
934
934
  y: e / 2
@@ -945,9 +945,9 @@ const Se = (r, e) => ({
945
945
  }, s = {
946
946
  x: e.x + e.width / 2,
947
947
  y: e.y + e.height / 2
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;
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;
949
949
  return {
950
- x: o,
950
+ x: i,
951
951
  y: n,
952
952
  width: a,
953
953
  height: h,
@@ -960,8 +960,8 @@ const Se = (r, e) => ({
960
960
  });
961
961
  class et {
962
962
  constructor(e) {
963
- i(this, "path");
964
- i(this, "midpoint");
963
+ o(this, "path");
964
+ o(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 et {
969
969
  { x: this.params.arrowLength, y: p.y },
970
970
  this.params.sourceDirection,
971
971
  p
972
- ), o = m(
972
+ ), i = 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 et {
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: 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}`;
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}`;
983
983
  this.path = `${d}${h}${c}`;
984
984
  }
985
985
  }
986
986
  class tt {
987
987
  constructor(e) {
988
- i(this, "path");
989
- i(this, "midpoint");
988
+ o(this, "path");
989
+ o(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 tt {
999
999
  },
1000
1000
  this.params.targetDirection,
1001
1001
  this.params.to
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 },
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 },
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 - o, y: this.params.to.y },
1010
+ { x: this.params.to.x - i, y: this.params.to.y },
1011
1011
  this.params.targetDirection,
1012
1012
  this.params.to
1013
1013
  ), u = {
@@ -1016,7 +1016,7 @@ class tt {
1016
1016
  }, w = {
1017
1017
  x: (g.x + u.x) / 2,
1018
1018
  y: (g.y + u.y) / 2
1019
- }, f = {
1019
+ }, y = {
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
1022
  }, E = {
@@ -1032,42 +1032,42 @@ class tt {
1032
1032
  this.path = [
1033
1033
  `M ${t.x} ${t.y}`,
1034
1034
  `L ${c.x} ${c.y}`,
1035
- `C ${f.x} ${f.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
1035
+ `C ${y.x} ${y.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
1036
1036
  `C ${b.x} ${b.y} ${E.x} ${E.y} ${l.x} ${l.y}`,
1037
1037
  `L ${s.x} ${s.y}`
1038
1038
  ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
1039
1039
  }
1040
1040
  }
1041
- const K = Object.freeze({
1041
+ const Q = Object.freeze({
1042
1042
  edgeColor: "--edge-color"
1043
1043
  }), Pe = (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(K.edgeColor, r), e;
1046
- }, Te = (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(Q.edgeColor, r), e;
1046
+ }, Ne = (r) => {
1047
1047
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1048
- return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1048
+ return e.setAttribute("stroke", `var(${Q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1049
1049
  }, B = () => {
1050
1050
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
1051
- return r.setAttribute("fill", `var(${K.edgeColor})`), r;
1052
- }, Ce = () => {
1051
+ return r.setAttribute("fill", `var(${Q.edgeColor})`), r;
1052
+ }, Te = () => {
1053
1053
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1054
1054
  return r.style.transformOrigin = "50% 50%", r;
1055
- }, Ne = (r, e) => {
1055
+ }, Ce = (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
1057
  }, D = (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 o = 0, n = 0, a = 0;
1061
+ let i = 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, f = u && w;
1065
- if (u && (c = -o, g = -n, l = a), w) {
1064
+ const u = d > 0, w = d < s, y = u && w;
1065
+ if (u && (c = -i, g = -n, l = a), w) {
1066
1066
  const V = r[d + 1];
1067
- o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
1067
+ i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
1068
1068
  }
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, R = f ? { x: h.x + c * P, y: h.y + g * P } : h;
1070
- d > 0 && t.push(`L ${R.x} ${R.y}`), f && t.push(
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(
1071
1071
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
1072
1072
  );
1073
1073
  });
@@ -1076,8 +1076,8 @@ const K = Object.freeze({
1076
1076
  };
1077
1077
  class rt {
1078
1078
  constructor(e) {
1079
- i(this, "path");
1080
- i(this, "midpoint");
1079
+ o(this, "path");
1080
+ o(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 rt {
1085
1085
  { x: this.params.arrowLength, y: p.y },
1086
1086
  this.params.sourceDirection,
1087
1087
  p
1088
- ) : p, o = this.params.hasTargetArrow ? m(
1088
+ ) : p, i = 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 rt {
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
- }, f = { x: w.x, y: g };
1109
+ }, y = { x: w.x, y: g };
1110
1110
  this.path = D(
1111
- [s, h, l, u, f, w, d, o],
1111
+ [s, h, l, u, y, w, d, i],
1112
1112
  this.params.roundness
1113
1113
  );
1114
1114
  }
1115
1115
  }
1116
1116
  class st {
1117
1117
  constructor(e) {
1118
- i(this, "path");
1119
- i(this, "midpoint");
1118
+ o(this, "path");
1119
+ o(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,12 +1129,12 @@ class st {
1129
1129
  },
1130
1130
  this.params.targetDirection,
1131
1131
  this.params.to
1132
- ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1133
- { x: o, y: p.y },
1132
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1133
+ { x: i, 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 - o, y: this.params.to.y },
1137
+ { x: this.params.to.x - i, 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 };
@@ -1146,8 +1146,8 @@ class st {
1146
1146
  }
1147
1147
  class ot {
1148
1148
  constructor(e) {
1149
- i(this, "path");
1150
- i(this, "midpoint");
1149
+ o(this, "path");
1150
+ o(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 ot {
1155
1155
  { x: this.params.arrowLength, y: p.y },
1156
1156
  this.params.sourceDirection,
1157
1157
  p
1158
- ) : p, o = this.params.hasTargetArrow ? m(
1158
+ ) : p, i = 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 ot {
1171
1171
  this.params.targetDirection,
1172
1172
  this.params.to
1173
1173
  );
1174
- this.path = D([s, a, h, o], this.params.roundness);
1174
+ this.path = D([s, a, h, i], this.params.roundness);
1175
1175
  }
1176
1176
  }
1177
1177
  class it {
1178
1178
  constructor(e) {
1179
- i(this, "path");
1180
- i(this, "midpoint");
1179
+ o(this, "path");
1180
+ o(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 it {
1185
1185
  { x: this.params.arrowLength, y: p.y },
1186
1186
  this.params.sourceDirection,
1187
1187
  p
1188
- ) : p, o = this.params.hasTargetArrow ? m(
1188
+ ) : p, i = this.params.hasTargetArrow ? m(
1189
1189
  {
1190
1190
  x: this.params.to.x - this.params.arrowLength,
1191
1191
  y: this.params.to.y
@@ -1206,26 +1206,26 @@ class it {
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
- }, f = { x: g, y: w.y };
1209
+ }, y = { x: g, y: w.y };
1210
1210
  this.path = D(
1211
- [s, h, l, u, f, w, d, o],
1211
+ [s, h, l, u, y, w, d, i],
1212
1212
  this.params.roundness
1213
1213
  );
1214
1214
  }
1215
1215
  }
1216
- class Q {
1216
+ class Z {
1217
1217
  constructor(e) {
1218
- i(this, "path");
1219
- i(this, "midpoint");
1218
+ o(this, "path");
1219
+ o(this, "midpoint");
1220
1220
  this.params = e;
1221
- const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
1221
+ const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
1222
1222
  { x: this.params.arrowLength, y: p.y },
1223
- { x: o, y: p.y },
1224
- { x: o, y: this.params.side },
1223
+ { x: i, y: p.y },
1224
+ { x: i, y: this.params.side },
1225
1225
  { x: n, y: this.params.side },
1226
1226
  { x: n, y: -this.params.side },
1227
- { x: o, y: -this.params.side },
1228
- { x: o, y: p.y },
1227
+ { x: i, y: -this.params.side },
1228
+ { x: i, y: p.y },
1229
1229
  { x: this.params.arrowLength, y: p.y }
1230
1230
  ].map(
1231
1231
  (c) => m(c, this.params.sourceDirection, p)
@@ -1235,16 +1235,16 @@ class Q {
1235
1235
  }
1236
1236
  class nt {
1237
1237
  constructor(e) {
1238
- i(this, "path");
1239
- i(this, "midpoint");
1238
+ o(this, "path");
1239
+ o(this, "midpoint");
1240
1240
  this.params = e;
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 = [
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 = [
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
- (f) => m(f, this.params.sourceDirection, p)
1247
+ (y) => m(y, 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}`,
@@ -1256,9 +1256,9 @@ class nt {
1256
1256
  }
1257
1257
  class at {
1258
1258
  constructor(e) {
1259
- i(this, "path");
1260
- i(this, "midpoint");
1261
- i(this, "diagonalDistance");
1259
+ o(this, "path");
1260
+ o(this, "midpoint");
1261
+ o(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 at {
1269
1269
  this.path = "";
1270
1270
  return;
1271
1271
  }
1272
- const o = this.createDirectLinePoint({
1272
+ const i = this.createDirectLinePoint({
1273
1273
  offset: this.params.sourceOffset,
1274
1274
  hasArrow: this.params.hasSourceArrow,
1275
1275
  flip: 1,
@@ -1280,20 +1280,20 @@ class at {
1280
1280
  flip: -1,
1281
1281
  shift: this.params.to
1282
1282
  });
1283
- this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
1283
+ this.path = `M ${i.x} ${i.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, o = e.flip * s / this.diagonalDistance;
1286
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
1287
1287
  return {
1288
- x: this.params.to.x * o + e.shift.x,
1289
- y: this.params.to.y * o + e.shift.y
1288
+ x: this.params.to.x * i + e.shift.x,
1289
+ y: this.params.to.y * i + e.shift.y
1290
1290
  };
1291
1291
  }
1292
1292
  }
1293
1293
  class ht {
1294
1294
  constructor(e) {
1295
- i(this, "path");
1296
- i(this, "midpoint");
1295
+ o(this, "path");
1296
+ o(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,12 +1306,12 @@ class ht {
1306
1306
  },
1307
1307
  this.params.targetDirection,
1308
1308
  this.params.to
1309
- ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1310
- { x: o, y: p.y },
1309
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1310
+ { x: i, y: p.y },
1311
1311
  this.params.sourceDirection,
1312
1312
  p
1313
1313
  ), a = m(
1314
- { x: this.params.to.x - o, y: this.params.to.y },
1314
+ { x: this.params.to.x - i, 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 = {
@@ -1333,8 +1333,8 @@ class ht {
1333
1333
  }
1334
1334
  class dt {
1335
1335
  constructor(e) {
1336
- i(this, "path");
1337
- i(this, "midpoint");
1336
+ o(this, "path");
1337
+ o(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,12 +1347,12 @@ class dt {
1347
1347
  },
1348
1348
  this.params.targetDirection,
1349
1349
  this.params.to
1350
- ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1351
- { x: o, y: p.y },
1350
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1351
+ { x: i, y: p.y },
1352
1352
  this.params.sourceDirection,
1353
1353
  p
1354
1354
  ), a = m(
1355
- { x: this.params.to.x - o, y: this.params.to.y },
1355
+ { x: this.params.to.x - i, 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 = {
@@ -1372,7 +1372,7 @@ class dt {
1372
1372
  );
1373
1373
  }
1374
1374
  }
1375
- const y = Object.freeze({
1375
+ const f = Object.freeze({
1376
1376
  color: "#777777",
1377
1377
  width: 1,
1378
1378
  arrowLength: 20,
@@ -1395,24 +1395,24 @@ const y = Object.freeze({
1395
1395
  interactiveWidth: 10,
1396
1396
  preOffset: 0
1397
1397
  }), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1398
- class k {
1398
+ class z {
1399
1399
  constructor(e) {
1400
- i(this, "svg");
1401
- i(this, "group", Ce());
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] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = Te(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1400
+ o(this, "svg");
1401
+ o(this, "group", Te());
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 = Pe(e.color), this.svg.appendChild(this.group), this.line = Ne(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1409
1409
  }
1410
1410
  render(e) {
1411
- const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1411
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = be(
1412
1412
  e.from,
1413
1413
  e.to
1414
1414
  );
1415
- Ne(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1415
+ Ce(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1416
1416
  const d = ge(
1417
1417
  e.from.direction,
1418
1418
  a,
@@ -1422,7 +1422,7 @@ class k {
1422
1422
  a,
1423
1423
  h
1424
1424
  ), g = {
1425
- x: o,
1425
+ x: i,
1426
1426
  y: n
1427
1427
  };
1428
1428
  let l = { x: -c.x, y: -c.y }, u;
@@ -1435,12 +1435,12 @@ class k {
1435
1435
  h
1436
1436
  );
1437
1437
  this.line.setAttribute("d", w.path);
1438
- let f = null;
1439
- this.sourceArrow && (f = this.arrowRenderer({
1438
+ let y = null;
1439
+ this.sourceArrow && (y = this.arrowRenderer({
1440
1440
  direction: d,
1441
1441
  shift: p,
1442
1442
  arrowLength: this.params.arrowLength
1443
- }), this.sourceArrow.setAttribute("d", f));
1443
+ }), this.sourceArrow.setAttribute("d", y));
1444
1444
  let E = null;
1445
1445
  this.targetArrow && (E = this.arrowRenderer({
1446
1446
  direction: l,
@@ -1448,7 +1448,7 @@ class k {
1448
1448
  arrowLength: this.params.arrowLength
1449
1449
  }), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
1450
1450
  edgePath: w,
1451
- sourceArrowPath: f,
1451
+ sourceArrowPath: y,
1452
1452
  targetArrowPath: E
1453
1453
  });
1454
1454
  }
@@ -1463,18 +1463,18 @@ const ct = (r) => (e) => {
1463
1463
  ).map((h) => ({
1464
1464
  x: h.x + e.shift.x,
1465
1465
  y: h.y + e.shift.y
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`;
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
1468
  }, lt = (r) => (e) => {
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}`;
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
1475
  return `${g} ${l} ${u} ${w}`;
1476
1476
  }, gt = (r) => (e) => {
1477
- const t = r.smallRadius, s = r.radius, o = m(
1477
+ const t = r.smallRadius, s = r.radius, i = m(
1478
1478
  {
1479
1479
  x: e.arrowLength,
1480
1480
  y: 0
@@ -1487,7 +1487,7 @@ const ct = (r) => (e) => {
1487
1487
  x: e.arrowLength + r.smallRadius,
1488
1488
  y: 0
1489
1489
  }
1490
- ), a = [p, { x: o.x, y: -o.y }, o].map(
1490
+ ), a = [p, { x: i.x, y: -i.y }, i].map(
1491
1491
  (l) => m(l, e.direction, p)
1492
1492
  ).map((l) => ({
1493
1493
  x: l.x + e.shift.x,
@@ -1500,38 +1500,38 @@ const ct = (r) => (e) => {
1500
1500
  switch (r.type) {
1501
1501
  case "triangle":
1502
1502
  return ct({
1503
- radius: r.radius ?? y.polygonArrowRadius
1503
+ radius: r.radius ?? f.polygonArrowRadius
1504
1504
  });
1505
1505
  case "arc":
1506
1506
  return lt({
1507
- radius: r.radius ?? y.circleArrowRadius
1507
+ radius: r.radius ?? f.circleArrowRadius
1508
1508
  });
1509
1509
  default:
1510
1510
  return gt({
1511
- smallRadius: r.smallRadius ?? y.wedgeArrowSmallRadius,
1512
- angle: r.angle ?? y.wedgeArrowAngle,
1513
- radius: r.radius ?? y.wedgeArrowRadius
1511
+ smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
1512
+ angle: r.angle ?? f.wedgeArrowAngle,
1513
+ radius: r.radius ?? f.wedgeArrowRadius
1514
1514
  });
1515
1515
  }
1516
1516
  };
1517
1517
  class ut {
1518
1518
  constructor(e) {
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 nt({
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 nt({
1535
1535
  sourceDirection: e,
1536
1536
  radius: this.portCycleRadius,
1537
1537
  smallRadius: this.portCycleSmallRadius,
@@ -1539,11 +1539,11 @@ class ut {
1539
1539
  hasSourceArrow: this.hasSourceArrow,
1540
1540
  hasTargetArrow: this.hasTargetArrow
1541
1541
  }));
1542
- i(this, "createDetourPath", (e, t, s, o, n) => new tt({
1542
+ o(this, "createDetourPath", (e, t, s, i, n) => new tt({
1543
1543
  to: s,
1544
1544
  sourceDirection: e,
1545
1545
  targetDirection: t,
1546
- flipX: o,
1546
+ flipX: i,
1547
1547
  flipY: n,
1548
1548
  arrowLength: this.arrowLength,
1549
1549
  detourDirection: this.detourDirection,
@@ -1552,7 +1552,7 @@ class ut {
1552
1552
  hasSourceArrow: this.hasSourceArrow,
1553
1553
  hasTargetArrow: this.hasTargetArrow
1554
1554
  }));
1555
- i(this, "createLinePath", (e, t, s) => new et({
1555
+ o(this, "createLinePath", (e, t, s) => new et({
1556
1556
  to: s,
1557
1557
  sourceDirection: e,
1558
1558
  targetDirection: t,
@@ -1561,9 +1561,9 @@ class ut {
1561
1561
  hasSourceArrow: this.hasSourceArrow,
1562
1562
  hasTargetArrow: this.hasTargetArrow
1563
1563
  }));
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 k({
1565
- color: (e == null ? void 0 : e.color) ?? y.color,
1566
- width: (e == null ? void 0 : e.width) ?? y.width,
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
1567
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1568
1568
  arrowLength: this.arrowLength,
1569
1569
  hasSourceArrow: this.hasSourceArrow,
@@ -1579,21 +1579,21 @@ class ut {
1579
1579
  }
1580
1580
  class pt {
1581
1581
  constructor(e) {
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 Q({
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 Z({
1597
1597
  sourceDirection: e,
1598
1598
  arrowLength: this.arrowLength,
1599
1599
  side: this.cycleSquareSide,
@@ -1602,11 +1602,11 @@ class pt {
1602
1602
  hasSourceArrow: this.hasSourceArrow,
1603
1603
  hasTargetArrow: this.hasTargetArrow
1604
1604
  }));
1605
- i(this, "createDetourPath", (e, t, s, o, n) => new ht({
1605
+ o(this, "createDetourPath", (e, t, s, i, n) => new ht({
1606
1606
  to: s,
1607
1607
  sourceDirection: e,
1608
1608
  targetDirection: t,
1609
- flipX: o,
1609
+ flipX: i,
1610
1610
  flipY: n,
1611
1611
  arrowLength: this.arrowLength,
1612
1612
  arrowOffset: this.arrowOffset,
@@ -1615,26 +1615,26 @@ class pt {
1615
1615
  hasSourceArrow: this.hasSourceArrow,
1616
1616
  hasTargetArrow: this.hasTargetArrow
1617
1617
  }));
1618
- i(this, "createLinePath", (e, t, s, o) => new rt({
1618
+ o(this, "createLinePath", (e, t, s, i) => new rt({
1619
1619
  to: s,
1620
1620
  sourceDirection: e,
1621
1621
  targetDirection: t,
1622
- flipX: o,
1622
+ flipX: i,
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) ?? 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;
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;
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) ?? 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 k({
1636
- color: (e == null ? void 0 : e.color) ?? y.color,
1637
- width: (e == null ? void 0 : e.width) ?? y.width,
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
1638
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1639
1639
  arrowLength: this.arrowLength,
1640
1640
  hasSourceArrow: this.hasSourceArrow,
@@ -1650,22 +1650,22 @@ class pt {
1650
1650
  }
1651
1651
  class wt {
1652
1652
  constructor(e) {
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 Q({
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 Z({
1669
1669
  sourceDirection: e,
1670
1670
  arrowLength: this.arrowLength,
1671
1671
  side: this.cycleSquareSide,
@@ -1674,11 +1674,11 @@ class wt {
1674
1674
  hasSourceArrow: this.hasSourceArrow,
1675
1675
  hasTargetArrow: this.hasTargetArrow
1676
1676
  }));
1677
- i(this, "createDetourPath", (e, t, s, o, n) => new st({
1677
+ o(this, "createDetourPath", (e, t, s, i, n) => new st({
1678
1678
  to: s,
1679
1679
  sourceDirection: e,
1680
1680
  targetDirection: t,
1681
- flipX: o,
1681
+ flipX: i,
1682
1682
  flipY: n,
1683
1683
  arrowLength: this.arrowLength,
1684
1684
  arrowOffset: this.arrowOffset,
@@ -1688,7 +1688,7 @@ class wt {
1688
1688
  hasSourceArrow: this.hasSourceArrow,
1689
1689
  hasTargetArrow: this.hasTargetArrow
1690
1690
  }));
1691
- i(this, "createLinePath", (e, t, s) => new ot({
1691
+ o(this, "createLinePath", (e, t, s) => new ot({
1692
1692
  to: s,
1693
1693
  sourceDirection: e,
1694
1694
  targetDirection: t,
@@ -1698,15 +1698,15 @@ class wt {
1698
1698
  hasSourceArrow: this.hasSourceArrow,
1699
1699
  hasTargetArrow: this.hasTargetArrow
1700
1700
  }));
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;
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;
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) ?? 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 k({
1708
- color: (e == null ? void 0 : e.color) ?? y.color,
1709
- width: (e == null ? void 0 : e.width) ?? y.width,
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
1710
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1711
1711
  arrowLength: this.arrowLength,
1712
1712
  hasSourceArrow: this.hasSourceArrow,
@@ -1720,23 +1720,23 @@ class wt {
1720
1720
  this.pathShape.render(e);
1721
1721
  }
1722
1722
  }
1723
- class ft {
1723
+ class yt {
1724
1724
  constructor(e) {
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 Q({
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 Z({
1740
1740
  sourceDirection: e,
1741
1741
  arrowLength: this.arrowLength,
1742
1742
  side: this.cycleSquareSide,
@@ -1745,11 +1745,11 @@ class ft {
1745
1745
  hasSourceArrow: this.hasSourceArrow,
1746
1746
  hasTargetArrow: this.hasTargetArrow
1747
1747
  }));
1748
- i(this, "createDetourPath", (e, t, s, o, n) => new dt({
1748
+ o(this, "createDetourPath", (e, t, s, i, n) => new dt({
1749
1749
  to: s,
1750
1750
  sourceDirection: e,
1751
1751
  targetDirection: t,
1752
- flipX: o,
1752
+ flipX: i,
1753
1753
  flipY: n,
1754
1754
  arrowLength: this.arrowLength,
1755
1755
  arrowOffset: this.arrowOffset,
@@ -1758,7 +1758,7 @@ class ft {
1758
1758
  hasSourceArrow: this.hasSourceArrow,
1759
1759
  hasTargetArrow: this.hasTargetArrow
1760
1760
  }));
1761
- i(this, "createLinePath", (e, t, s, o, n) => new it({
1761
+ o(this, "createLinePath", (e, t, s, i, n) => new it({
1762
1762
  to: s,
1763
1763
  sourceDirection: e,
1764
1764
  targetDirection: t,
@@ -1769,15 +1769,15 @@ class ft {
1769
1769
  hasSourceArrow: this.hasSourceArrow,
1770
1770
  hasTargetArrow: this.hasTargetArrow
1771
1771
  }));
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;
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;
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) ?? 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 k({
1779
- color: (e == null ? void 0 : e.color) ?? y.color,
1780
- width: (e == null ? void 0 : e.width) ?? y.width,
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
1781
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
1782
1782
  arrowLength: this.arrowLength,
1783
1783
  hasSourceArrow: this.hasSourceArrow,
@@ -1793,28 +1793,28 @@ class ft {
1793
1793
  }
1794
1794
  class De {
1795
1795
  constructor(e) {
1796
- i(this, "svg");
1797
- i(this, "group", Ce());
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] = x(), 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 = F((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 = Pe(this.color), this.svg.appendChild(this.group), this.line = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1796
+ o(this, "svg");
1797
+ o(this, "group", Te());
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 = Pe(this.color), this.svg.appendChild(this.group), this.line = Ne(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1810
1810
  }
1811
1811
  render(e) {
1812
- const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1812
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = be(
1813
1813
  e.from,
1814
1814
  e.to
1815
1815
  );
1816
- Ne(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 at({
1816
+ Ce(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 at({
1818
1818
  to: d,
1819
1819
  sourceOffset: this.sourceOffset,
1820
1820
  targetOffset: this.targetOffset,
@@ -1833,26 +1833,26 @@ class De {
1833
1833
  y: d.y / u
1834
1834
  };
1835
1835
  if (this.sourceArrow) {
1836
- const f = {
1836
+ const y = {
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: f,
1842
+ shift: y,
1843
1843
  arrowLength: this.arrowLength
1844
1844
  }), this.sourceArrow.setAttribute("d", g);
1845
1845
  }
1846
1846
  if (this.targetArrow) {
1847
- const f = {
1847
+ const y = {
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 - f.x,
1855
- y: d.y - f.y
1854
+ x: d.x - y.x,
1855
+ y: d.y - y.y
1856
1856
  },
1857
1857
  arrowLength: this.arrowLength
1858
1858
  }), this.targetArrow.setAttribute("d", l);
@@ -1865,7 +1865,7 @@ class De {
1865
1865
  });
1866
1866
  }
1867
1867
  }
1868
- const yt = () => {
1868
+ const ft = () => {
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
1871
  }, mt = (r) => {
@@ -1882,40 +1882,40 @@ class vt extends Error {
1882
1882
  }
1883
1883
  class Me {
1884
1884
  constructor(e, t) {
1885
- i(this, "svg");
1886
- i(this, "group");
1887
- i(this, "line");
1888
- i(this, "sourceArrow");
1889
- i(this, "targetArrow");
1890
- i(this, "handle", yt());
1891
- i(this, "onAfterRender");
1892
- i(this, "interactiveLine");
1893
- i(this, "interactiveSourceArrow", null);
1894
- i(this, "interactiveTargetArrow", null);
1885
+ o(this, "svg");
1886
+ o(this, "group");
1887
+ o(this, "line");
1888
+ o(this, "sourceArrow");
1889
+ o(this, "targetArrow");
1890
+ o(this, "handle", ft());
1891
+ o(this, "onAfterRender");
1892
+ o(this, "interactiveLine");
1893
+ o(this, "interactiveSourceArrow", null);
1894
+ o(this, "interactiveTargetArrow", null);
1895
1895
  if (this.baseEdge = e, e instanceof Me)
1896
1896
  throw new vt(
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) ?? y.interactiveWidth;
1901
- this.interactiveLine = mt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(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);
1900
+ const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1901
+ this.interactiveLine = mt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(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);
1903
1903
  });
1904
1904
  }
1905
1905
  render(e) {
1906
1906
  this.baseEdge.render(e);
1907
1907
  }
1908
1908
  }
1909
- class sr {
1909
+ class dr {
1910
1910
  constructor(e, t) {
1911
- i(this, "group");
1912
- i(this, "line");
1913
- i(this, "sourceArrow");
1914
- i(this, "targetArrow");
1915
- i(this, "onAfterRender");
1916
- i(this, "svg");
1911
+ o(this, "group");
1912
+ o(this, "line");
1913
+ o(this, "sourceArrow");
1914
+ o(this, "targetArrow");
1915
+ o(this, "onAfterRender");
1916
+ o(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 o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
1918
+ const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1919
1919
  this.midpointElement.style.setProperty("transform", n);
1920
1920
  });
1921
1921
  }
@@ -1925,19 +1925,19 @@ class sr {
1925
1925
  }
1926
1926
  class Le {
1927
1927
  constructor(e) {
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");
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");
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) {
@@ -2021,9 +2021,9 @@ class Le {
2021
2021
  }
2022
2022
  class Re {
2023
2023
  constructor(e) {
2024
- i(this, "onBeforeUpdated");
2025
- i(this, "onAfterUpdated");
2026
- i(this, "onAfterResize");
2024
+ o(this, "onBeforeUpdated");
2025
+ o(this, "onAfterUpdated");
2026
+ o(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() {
@@ -2043,7 +2043,7 @@ class Re {
2043
2043
  }
2044
2044
  }
2045
2045
  const Ve = (r, e) => {
2046
- const t = new Ae(), s = new Le(t), o = new Re(e), n = new me(t, e, r), a = {
2046
+ const t = new Ae(), s = new Le(t), i = new Re(e), n = new me(t, e, r), a = {
2047
2047
  nodes: {
2048
2048
  centerFn: Se,
2049
2049
  priorityFn: () => 0
@@ -2058,37 +2058,38 @@ const Ve = (r, e) => {
2058
2058
  };
2059
2059
  return new ve(
2060
2060
  s,
2061
- o,
2061
+ i,
2062
2062
  t,
2063
2063
  e,
2064
2064
  n,
2065
2065
  a
2066
2066
  );
2067
2067
  };
2068
- class z {
2069
- constructor(e, t, s, o) {
2070
- i(this, "onAfterPortMarked", (e) => {
2068
+ class k {
2069
+ constructor(e, t, s, i) {
2070
+ o(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
- i(this, "onBeforePortUnmarked", (e) => {
2074
+ o(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
- i(this, "onPortMouseDown", (e) => {
2079
- if (!this.params.mouseDownEventVerifier(e))
2078
+ o(this, "onPortMouseDown", (e) => {
2079
+ const t = e;
2080
+ if (!this.params.mouseDownEventVerifier(t))
2080
2081
  return;
2081
- const t = e.currentTarget, s = this.canvas.graph.findPortIdsByElement(t)[0];
2082
- this.params.onPortPointerDown(s, {
2083
- x: e.clientX,
2084
- y: e.clientY
2082
+ const s = e.currentTarget, i = this.canvas.graph.findPortIdsByElement(s)[0];
2083
+ this.params.onPortPointerDown(i, {
2084
+ x: t.clientX,
2085
+ y: t.clientY
2085
2086
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2086
2087
  passive: !0
2087
2088
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2088
2089
  passive: !0
2089
2090
  }));
2090
2091
  });
2091
- i(this, "onWindowMouseMove", (e) => {
2092
+ o(this, "onWindowMouseMove", (e) => {
2092
2093
  if (!L(
2093
2094
  this.window,
2094
2095
  this.element,
@@ -2100,16 +2101,17 @@ class z {
2100
2101
  }
2101
2102
  this.params.onPointerMove({ x: e.clientX, y: e.clientY });
2102
2103
  });
2103
- i(this, "onWindowMouseUp", (e) => {
2104
+ o(this, "onWindowMouseUp", (e) => {
2104
2105
  this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
2105
2106
  });
2106
- i(this, "onPortTouchStart", (e) => {
2107
- if (e.touches.length !== 1)
2107
+ o(this, "onPortTouchStart", (e) => {
2108
+ const t = e;
2109
+ if (t.touches.length !== 1)
2108
2110
  return;
2109
- const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.findPortIdsByElement(s)[0];
2110
- this.params.onPortPointerDown(o, {
2111
- x: t.clientX,
2112
- y: t.clientY
2111
+ const s = t.touches[0], i = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(i)[0];
2112
+ this.params.onPortPointerDown(n, {
2113
+ x: s.clientX,
2114
+ y: s.clientY
2113
2115
  }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2114
2116
  passive: !0
2115
2117
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
@@ -2118,7 +2120,7 @@ class z {
2118
2120
  passive: !0
2119
2121
  }));
2120
2122
  });
2121
- i(this, "onWindowTouchMove", (e) => {
2123
+ o(this, "onWindowTouchMove", (e) => {
2122
2124
  const t = e.touches[0];
2123
2125
  if (!L(
2124
2126
  this.window,
@@ -2131,23 +2133,23 @@ class z {
2131
2133
  }
2132
2134
  this.params.onPointerMove({ x: t.clientX, y: t.clientY });
2133
2135
  });
2134
- i(this, "onWindowTouchFinish", (e) => {
2136
+ o(this, "onWindowTouchFinish", (e) => {
2135
2137
  const t = e.changedTouches[0];
2136
2138
  this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
2137
2139
  });
2138
- i(this, "onBeforeClear", () => {
2140
+ o(this, "onBeforeClear", () => {
2139
2141
  this.canvas.graph.getAllPortIds().forEach((e) => {
2140
2142
  const t = this.canvas.graph.getPort(e);
2141
2143
  this.unhookPortEvents(t.element);
2142
2144
  });
2143
2145
  });
2144
- i(this, "onBeforeDestroy", () => {
2146
+ o(this, "onBeforeDestroy", () => {
2145
2147
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2146
2148
  });
2147
- 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);
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);
2148
2150
  }
2149
- static configure(e, t, s, o) {
2150
- new z(e, t, s, o);
2151
+ static configure(e, t, s, i) {
2152
+ new k(e, t, s, i);
2151
2153
  }
2152
2154
  hookPortEvents(e) {
2153
2155
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2172,78 +2174,107 @@ class z {
2172
2174
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2173
2175
  }
2174
2176
  }
2175
- class Z {
2176
- constructor(e, t, s, o) {
2177
- i(this, "grabbedNode", null);
2178
- i(this, "maxNodePriority", 0);
2179
- i(this, "graph");
2180
- i(this, "onAfterNodeAdded", (e) => {
2177
+ class At {
2178
+ constructor(e, t, s) {
2179
+ this.canvas = e, this.layoutAlgorithm = t, this.params = s;
2180
+ }
2181
+ apply() {
2182
+ this.layoutAlgorithm.calculateCoordinates({
2183
+ graph: this.canvas.graph,
2184
+ viewport: this.canvas.viewport
2185
+ }).forEach((t, s) => {
2186
+ this.params.staticNodeResolver(s) || this.canvas.updateNode(s, t);
2187
+ });
2188
+ }
2189
+ }
2190
+ class Et {
2191
+ constructor(e, t, s) {
2192
+ this.canvas = e, this.layoutAlgorithm = t, this.params = s;
2193
+ }
2194
+ apply(e) {
2195
+ this.layoutAlgorithm.calculateNextCoordinates({
2196
+ graph: this.canvas.graph,
2197
+ viewport: this.canvas.viewport,
2198
+ dt: e
2199
+ }).forEach((s, i) => {
2200
+ this.params.staticNodeResolver(i) || this.canvas.updateNode(i, s);
2201
+ });
2202
+ }
2203
+ }
2204
+ class q {
2205
+ constructor(e, t, s, i) {
2206
+ o(this, "grabbedNode", null);
2207
+ o(this, "maxNodePriority", 0);
2208
+ o(this, "graph");
2209
+ o(this, "onAfterNodeAdded", (e) => {
2181
2210
  this.updateMaxNodePriority(e);
2182
- const t = this.graph.getNode(e);
2183
- t.element.addEventListener("mousedown", this.onMouseDown, {
2211
+ const { element: t } = this.graph.getNode(e);
2212
+ t.addEventListener("mousedown", this.onMouseDown, {
2184
2213
  passive: !0
2185
- }), t.element.addEventListener("touchstart", this.onTouchStart, {
2214
+ }), t.addEventListener("touchstart", this.onTouchStart, {
2186
2215
  passive: !0
2187
2216
  });
2188
2217
  });
2189
- i(this, "onAfterNodeUpdated", (e) => {
2218
+ o(this, "onAfterNodeUpdated", (e) => {
2190
2219
  this.updateMaxNodePriority(e);
2191
2220
  });
2192
- i(this, "onBeforeNodeRemoved", (e) => {
2193
- const t = this.graph.getNode(e);
2194
- t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2221
+ o(this, "onBeforeNodeRemoved", (e) => {
2222
+ const { element: t } = this.graph.getNode(e);
2223
+ t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2195
2224
  });
2196
- i(this, "onBeforeDestroy", () => {
2225
+ o(this, "onBeforeDestroy", () => {
2197
2226
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2198
2227
  });
2199
- i(this, "onBeforeClear", () => {
2228
+ o(this, "onBeforeClear", () => {
2200
2229
  this.canvas.graph.getAllNodeIds().forEach((e) => {
2201
- const t = this.canvas.graph.getNode(e);
2202
- t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2230
+ const { element: t } = this.canvas.graph.getNode(e);
2231
+ t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2203
2232
  }), this.maxNodePriority = 0;
2204
2233
  });
2205
- i(this, "onMouseDown", (e) => {
2206
- if (!this.params.mouseDownEventVerifier(e))
2234
+ o(this, "onMouseDown", (e) => {
2235
+ const t = e;
2236
+ if (!this.params.mouseDownEventVerifier(t))
2207
2237
  return;
2208
- const t = e.currentTarget, s = this.graph.findNodeIdByElement(t), o = this.graph.getNode(s);
2209
- if (!this.params.nodeDragVerifier(s))
2238
+ const s = e.currentTarget, i = this.graph.findNodeIdByElement(s), n = this.graph.getNode(i);
2239
+ if (!this.params.nodeDragVerifier(i))
2210
2240
  return;
2211
- this.params.onNodeDragStarted(s), e.stopPropagation();
2212
- const a = this.calculateContentPoint({
2213
- x: e.clientX,
2214
- y: e.clientY
2241
+ this.params.onNodeDragStarted(i), e.stopPropagation();
2242
+ const h = this.calculateContentPoint({
2243
+ x: t.clientX,
2244
+ y: t.clientY
2215
2245
  });
2216
2246
  this.grabbedNode = {
2217
- nodeId: s,
2218
- dx: a.x - o.x,
2219
- dy: a.y - o.y
2220
- }, $(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2247
+ nodeId: i,
2248
+ dx: h.x - n.x,
2249
+ dy: h.y - n.y
2250
+ }, $(this.element, this.params.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2221
2251
  passive: !0
2222
2252
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2223
2253
  passive: !0
2224
2254
  });
2225
2255
  });
2226
- i(this, "onTouchStart", (e) => {
2227
- if (e.touches.length !== 1)
2256
+ o(this, "onTouchStart", (e) => {
2257
+ const t = e;
2258
+ if (t.touches.length !== 1)
2228
2259
  return;
2229
2260
  e.stopPropagation();
2230
- const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.findNodeIdByElement(s), n = this.graph.getNode(o);
2261
+ const s = t.touches[0], i = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(i), a = this.graph.getNode(n);
2231
2262
  if (!this.params.nodeDragVerifier({
2232
- nodeId: o,
2233
- element: n.element,
2234
- x: n.x,
2235
- y: n.y
2263
+ nodeId: n,
2264
+ element: a.element,
2265
+ x: a.x,
2266
+ y: a.y
2236
2267
  }))
2237
2268
  return;
2238
- const h = this.calculateContentPoint({
2239
- x: t.clientX,
2240
- y: t.clientY
2269
+ const d = this.calculateContentPoint({
2270
+ x: s.clientX,
2271
+ y: s.clientY
2241
2272
  });
2242
2273
  this.grabbedNode = {
2243
- nodeId: o,
2244
- dx: h.x - n.x,
2245
- dy: h.y - n.y
2246
- }, this.moveNodeOnTop(o), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2274
+ nodeId: n,
2275
+ dx: d.x - a.x,
2276
+ dy: d.y - a.y
2277
+ }, this.moveNodeOnTop(n), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2247
2278
  passive: !0
2248
2279
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2249
2280
  passive: !0
@@ -2251,7 +2282,7 @@ class Z {
2251
2282
  passive: !0
2252
2283
  });
2253
2284
  });
2254
- i(this, "onWindowMouseMove", (e) => {
2285
+ o(this, "onWindowMouseMove", (e) => {
2255
2286
  if (!L(
2256
2287
  this.window,
2257
2288
  this.element,
@@ -2266,10 +2297,10 @@ class Z {
2266
2297
  y: e.clientY
2267
2298
  });
2268
2299
  });
2269
- i(this, "onWindowMouseUp", (e) => {
2300
+ o(this, "onWindowMouseUp", (e) => {
2270
2301
  this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2271
2302
  });
2272
- i(this, "onWindowTouchMove", (e) => {
2303
+ o(this, "onWindowTouchMove", (e) => {
2273
2304
  if (e.touches.length !== 1)
2274
2305
  return;
2275
2306
  const t = e.touches[0];
@@ -2287,21 +2318,21 @@ class Z {
2287
2318
  y: t.clientY
2288
2319
  });
2289
2320
  });
2290
- i(this, "onWindowTouchFinish", () => {
2321
+ o(this, "onWindowTouchFinish", () => {
2291
2322
  this.cancelTouchDrag();
2292
2323
  });
2293
- 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);
2324
+ 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);
2294
2325
  }
2295
- static configure(e, t, s, o) {
2296
- new Z(e, t, s, o);
2326
+ static configure(e, t, s, i) {
2327
+ new q(e, t, s, i);
2297
2328
  }
2298
2329
  moveNode(e, t) {
2299
2330
  if (!this.graph.hasNode(e.nodeId))
2300
2331
  return;
2301
- const s = this.calculateContentPoint(t), o = {
2332
+ const s = this.calculateContentPoint(t), i = {
2302
2333
  x: s.x - e.dx,
2303
2334
  y: s.y - e.dy
2304
- }, n = this.adjustNodeCoords(o);
2335
+ }, n = this.adjustNodeCoords(i);
2305
2336
  this.canvas.updateNode(e.nodeId, {
2306
2337
  x: n.x,
2307
2338
  y: n.y
@@ -2311,8 +2342,8 @@ class Z {
2311
2342
  if (this.params.moveOnTop) {
2312
2343
  if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
2313
2344
  const t = this.maxNodePriority;
2314
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
2315
- this.canvas.updateEdge(o, { priority: t });
2345
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
2346
+ this.canvas.updateEdge(i, { priority: t });
2316
2347
  });
2317
2348
  }
2318
2349
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
@@ -2362,11 +2393,11 @@ class Z {
2362
2393
  return e;
2363
2394
  }
2364
2395
  }
2365
- const At = (r, e, t) => ({
2396
+ const xt = (r, e, t) => ({
2366
2397
  scale: r.scale,
2367
2398
  x: r.x + r.scale * e,
2368
2399
  y: r.y + r.scale * t
2369
- }), Et = (r, e, t, s) => ({
2400
+ }), St = (r, e, t, s) => ({
2370
2401
  scale: r.scale * e,
2371
2402
  x: r.scale * (1 - e) * t + r.x,
2372
2403
  y: r.scale * (1 - e) * s + r.y
@@ -2377,35 +2408,35 @@ const At = (r, e, t) => ({
2377
2408
  const s = e.reduce(
2378
2409
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2379
2410
  [0, 0]
2380
- ), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
2411
+ ), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2381
2412
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2382
2413
  0
2383
2414
  );
2384
2415
  return {
2385
- x: o[0],
2386
- y: o[1],
2416
+ x: i[0],
2417
+ y: i[1],
2387
2418
  scale: a / t,
2388
2419
  touchesCnt: t,
2389
2420
  touches: e
2390
2421
  };
2391
2422
  };
2392
2423
  class H {
2393
- constructor(e, t, s, o) {
2394
- i(this, "viewport");
2395
- i(this, "prevTouches", null);
2396
- i(this, "wheelFinishTimer", null);
2397
- i(this, "transformInProgress", !1);
2398
- i(this, "onBeforeDestroy", () => {
2424
+ constructor(e, t, s, i) {
2425
+ o(this, "viewport");
2426
+ o(this, "prevTouches", null);
2427
+ o(this, "wheelFinishTimer", null);
2428
+ o(this, "transformInProgress", !1);
2429
+ o(this, "onBeforeDestroy", () => {
2399
2430
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2400
2431
  });
2401
- i(this, "onMouseDown", (e) => {
2432
+ o(this, "onMouseDown", (e) => {
2402
2433
  this.element === null || !this.params.mouseDownEventVerifier(e) || ($(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2403
2434
  passive: !0
2404
2435
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2405
2436
  passive: !0
2406
2437
  }), this.startRegisteredTransform());
2407
2438
  });
2408
- i(this, "onWindowMouseMove", (e) => {
2439
+ o(this, "onWindowMouseMove", (e) => {
2409
2440
  const t = L(
2410
2441
  this.window,
2411
2442
  this.element,
@@ -2416,21 +2447,21 @@ class H {
2416
2447
  this.stopMouseDrag();
2417
2448
  return;
2418
2449
  }
2419
- const s = -e.movementX, o = -e.movementY;
2420
- this.moveViewport(s, o);
2450
+ const s = -e.movementX, i = -e.movementY;
2451
+ this.moveViewport(s, i);
2421
2452
  });
2422
- i(this, "onWindowMouseUp", (e) => {
2453
+ o(this, "onWindowMouseUp", (e) => {
2423
2454
  this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
2424
2455
  });
2425
- i(this, "onWheelScroll", (e) => {
2456
+ o(this, "onWheelScroll", (e) => {
2426
2457
  if (!this.params.mouseWheelEventVerifier(e))
2427
2458
  return;
2428
- 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);
2429
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2459
+ 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);
2460
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2430
2461
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2431
2462
  }, this.params.scaleWheelFinishTimeout);
2432
2463
  });
2433
- i(this, "onTouchStart", (e) => {
2464
+ o(this, "onTouchStart", (e) => {
2434
2465
  if (this.prevTouches !== null) {
2435
2466
  this.prevTouches = I(e);
2436
2467
  return;
@@ -2443,10 +2474,10 @@ class H {
2443
2474
  passive: !0
2444
2475
  }), this.startRegisteredTransform();
2445
2476
  });
2446
- i(this, "onWindowTouchMove", (e) => {
2477
+ o(this, "onWindowTouchMove", (e) => {
2447
2478
  const t = I(e);
2448
2479
  if (!t.touches.every(
2449
- (o) => L(this.window, this.element, o[0], o[1])
2480
+ (i) => L(this.window, this.element, i[0], i[1])
2450
2481
  )) {
2451
2482
  this.stopTouchDrag();
2452
2483
  return;
@@ -2455,18 +2486,18 @@ class H {
2455
2486
  -(t.x - this.prevTouches.x),
2456
2487
  -(t.y - this.prevTouches.y)
2457
2488
  ), t.touchesCnt === 2) {
2458
- 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);
2489
+ 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);
2459
2490
  this.scaleViewport(c, a, h);
2460
2491
  }
2461
2492
  this.prevTouches = t;
2462
2493
  });
2463
- i(this, "onWindowTouchFinish", (e) => {
2494
+ o(this, "onWindowTouchFinish", (e) => {
2464
2495
  e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
2465
2496
  });
2466
- i(this, "preventWheelScaleListener", (e) => {
2497
+ o(this, "preventWheelScaleListener", (e) => {
2467
2498
  e.preventDefault();
2468
2499
  });
2469
- this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2500
+ this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2470
2501
  passive: !1
2471
2502
  }), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
2472
2503
  this.handleResize();
@@ -2478,21 +2509,21 @@ class H {
2478
2509
  passive: !0
2479
2510
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2480
2511
  }
2481
- static configure(e, t, s, o) {
2482
- new H(e, t, s, o);
2512
+ static configure(e, t, s, i) {
2513
+ new H(e, t, s, i);
2483
2514
  }
2484
2515
  moveViewport(e, t) {
2485
- const s = this.viewport.getViewportMatrix(), o = At(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2516
+ const s = this.viewport.getViewportMatrix(), i = xt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2486
2517
  prevTransform: s,
2487
- nextTransform: o,
2518
+ nextTransform: i,
2488
2519
  canvasWidth: n,
2489
2520
  canvasHeight: a
2490
2521
  });
2491
2522
  this.performTransform(h);
2492
2523
  }
2493
2524
  scaleViewport(e, t, s) {
2494
- const o = this.canvas.viewport.getViewportMatrix(), n = Et(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2495
- prevTransform: o,
2525
+ const i = this.canvas.viewport.getViewportMatrix(), n = St(i, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2526
+ prevTransform: i,
2496
2527
  nextTransform: n,
2497
2528
  canvasWidth: a,
2498
2529
  canvasHeight: h
@@ -2521,28 +2552,28 @@ class H {
2521
2552
  this.transformInProgress = !1, this.params.onTransformFinished();
2522
2553
  }
2523
2554
  handleResize() {
2524
- const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2555
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), i = this.params.transformPreprocessor({
2525
2556
  prevTransform: e,
2526
2557
  nextTransform: e,
2527
2558
  canvasWidth: t,
2528
2559
  canvasHeight: s
2529
2560
  });
2530
- this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
2561
+ this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2531
2562
  }
2532
2563
  }
2533
2564
  class J {
2534
- constructor(e, t, s, o, n, a) {
2535
- i(this, "nodeHorizontal");
2536
- i(this, "nodeVertical");
2537
- i(this, "viewport");
2538
- i(this, "currentScale");
2539
- i(this, "loadedArea", {
2565
+ constructor(e, t, s, i, n, a) {
2566
+ o(this, "nodeHorizontal");
2567
+ o(this, "nodeVertical");
2568
+ o(this, "viewport");
2569
+ o(this, "currentScale");
2570
+ o(this, "loadedArea", {
2540
2571
  xFrom: 1 / 0,
2541
2572
  xTo: 1 / 0,
2542
2573
  yFrom: 1 / 0,
2543
2574
  yTo: 1 / 0
2544
2575
  });
2545
- i(this, "updateLoadedArea", (e) => {
2576
+ o(this, "updateLoadedArea", (e) => {
2546
2577
  this.loadedArea = {
2547
2578
  xFrom: e.x,
2548
2579
  xTo: e.x + e.width,
@@ -2550,31 +2581,31 @@ class J {
2550
2581
  yTo: e.y + e.height
2551
2582
  };
2552
2583
  });
2553
- i(this, "onAfterViewportUpdated", () => {
2584
+ o(this, "onAfterViewportUpdated", () => {
2554
2585
  this.userTransformInProgress || this.loadAreaAroundViewport();
2555
2586
  });
2556
- i(this, "userTransformInProgress", !1);
2587
+ o(this, "userTransformInProgress", !1);
2557
2588
  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(() => {
2558
2589
  this.scheduleLoadAreaAroundViewport();
2559
2590
  });
2560
2591
  const h = {
2561
- ...o,
2592
+ ...i,
2562
2593
  onResizeTransformStarted: () => {
2563
- this.userTransformInProgress = !0, o.onResizeTransformStarted();
2594
+ this.userTransformInProgress = !0, i.onResizeTransformStarted();
2564
2595
  },
2565
2596
  onResizeTransformFinished: () => {
2566
- this.userTransformInProgress = !1, o.onResizeTransformFinished();
2597
+ this.userTransformInProgress = !1, i.onResizeTransformFinished();
2567
2598
  },
2568
2599
  onBeforeTransformChange: () => {
2569
- this.userTransformInProgress = !0, o.onBeforeTransformChange();
2600
+ this.userTransformInProgress = !0, i.onBeforeTransformChange();
2570
2601
  },
2571
2602
  onTransformChange: () => {
2572
2603
  this.userTransformInProgress = !1;
2573
2604
  const d = this.currentScale;
2574
- this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
2605
+ this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), i.onTransformChange();
2575
2606
  },
2576
2607
  onTransformFinished: () => {
2577
- this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
2608
+ this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
2578
2609
  }
2579
2610
  };
2580
2611
  H.configure(
@@ -2584,12 +2615,12 @@ class J {
2584
2615
  h
2585
2616
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2586
2617
  }
2587
- static configure(e, t, s, o, n, a) {
2618
+ static configure(e, t, s, i, n, a) {
2588
2619
  new J(
2589
2620
  e,
2590
2621
  t,
2591
2622
  s,
2592
- o,
2623
+ i,
2593
2624
  n,
2594
2625
  a
2595
2626
  );
@@ -2601,12 +2632,12 @@ class J {
2601
2632
  }
2602
2633
  scheduleEnsureViewportAreaLoaded() {
2603
2634
  setTimeout(() => {
2604
- 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;
2635
+ 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;
2605
2636
  this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
2606
2637
  });
2607
2638
  }
2608
2639
  loadAreaAroundViewport() {
2609
- 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;
2640
+ 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;
2610
2641
  this.trigger.emit({
2611
2642
  x: d,
2612
2643
  y: c,
@@ -2615,13 +2646,13 @@ class J {
2615
2646
  });
2616
2647
  }
2617
2648
  }
2618
- const xt = () => {
2649
+ const bt = () => {
2619
2650
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2620
2651
  return r.style.position = "absolute", r.style.inset = "0", r;
2621
- }, St = () => {
2652
+ }, Pt = () => {
2622
2653
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2623
2654
  return r.setAttribute("fill", "url(#pattern)"), r;
2624
- }, bt = () => {
2655
+ }, Nt = () => {
2625
2656
  const r = document.createElementNS(
2626
2657
  "http://www.w3.org/2000/svg",
2627
2658
  "pattern"
@@ -2630,23 +2661,23 @@ const xt = () => {
2630
2661
  };
2631
2662
  class _ {
2632
2663
  constructor(e, t, s) {
2633
- i(this, "svg", xt());
2634
- i(this, "patternRenderingRectangle", St());
2635
- i(this, "pattern", bt());
2636
- i(this, "patternContent");
2637
- i(this, "tileWidth");
2638
- i(this, "tileHeight");
2639
- i(this, "halfTileWidth");
2640
- i(this, "halfTileHeight");
2641
- i(this, "maxViewportScale");
2642
- i(this, "visible", !1);
2643
- i(this, "onAfterTransformUpdated", () => {
2644
- 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})`;
2645
- this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
2664
+ o(this, "svg", bt());
2665
+ o(this, "patternRenderingRectangle", Pt());
2666
+ o(this, "pattern", Nt());
2667
+ o(this, "patternContent");
2668
+ o(this, "tileWidth");
2669
+ o(this, "tileHeight");
2670
+ o(this, "halfTileWidth");
2671
+ o(this, "halfTileHeight");
2672
+ o(this, "maxViewportScale");
2673
+ o(this, "visible", !1);
2674
+ o(this, "onAfterTransformUpdated", () => {
2675
+ 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})`;
2676
+ this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2646
2677
  });
2647
2678
  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;
2648
- const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2649
- this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
2679
+ const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2680
+ this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2650
2681
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2651
2682
  n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2652
2683
  this.updateDimensions();
@@ -2662,22 +2693,22 @@ class _ {
2662
2693
  updateDimensions() {
2663
2694
  const { width: e, height: t } = this.canvas.viewport.getDimensions();
2664
2695
  this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`);
2665
- const s = this.tileWidth / e, o = this.tileHeight / t;
2666
- this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
2696
+ const s = this.tileWidth / e, i = this.tileHeight / t;
2697
+ this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${i}`);
2667
2698
  }
2668
2699
  }
2669
2700
  class ee {
2670
- constructor(e, t, s, o, n) {
2671
- i(this, "overlayCanvas");
2672
- i(this, "staticPortId", null);
2673
- i(this, "isTargetDragging", !0);
2674
- i(this, "onEdgeCreated", (e) => {
2701
+ constructor(e, t, s, i, n) {
2702
+ o(this, "overlayCanvas");
2703
+ o(this, "staticPortId", null);
2704
+ o(this, "isTargetDragging", !0);
2705
+ o(this, "onEdgeCreated", (e) => {
2675
2706
  this.params.onAfterEdgeCreated(e);
2676
2707
  });
2677
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Ve(
2708
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ve(
2678
2709
  this.overlayLayer,
2679
2710
  this.viewportStore
2680
- ), z.configure(
2711
+ ), k.configure(
2681
2712
  this.canvas,
2682
2713
  this.overlayLayer,
2683
2714
  this.window,
@@ -2700,39 +2731,39 @@ class ee {
2700
2731
  }
2701
2732
  );
2702
2733
  }
2703
- static configure(e, t, s, o, n) {
2734
+ static configure(e, t, s, i, n) {
2704
2735
  new ee(
2705
2736
  e,
2706
2737
  t,
2707
2738
  s,
2708
- o,
2739
+ i,
2709
2740
  n
2710
2741
  );
2711
2742
  }
2712
2743
  grabPort(e, t, s) {
2713
- const o = this.canvas.graph.getPort(e);
2744
+ const i = this.canvas.graph.getPort(e);
2714
2745
  this.staticPortId = e;
2715
- 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({
2746
+ 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({
2716
2747
  x: a - d.x,
2717
2748
  y: h - d.y
2718
2749
  }), g = this.canvas.viewport.createContentCoords({
2719
2750
  x: t.x - d.x,
2720
2751
  y: t.y - d.y
2721
2752
  }), l = {
2722
- overlayNodeId: T.StaticNodeId,
2753
+ overlayNodeId: N.StaticNodeId,
2723
2754
  portCoords: c,
2724
- portDirection: o.direction
2755
+ portDirection: i.direction
2725
2756
  }, u = {
2726
- overlayNodeId: T.DraggingNodeId,
2757
+ overlayNodeId: N.DraggingNodeId,
2727
2758
  portCoords: g,
2728
2759
  portDirection: this.params.dragPortDirection
2729
2760
  };
2730
2761
  this.isTargetDragging = s === "direct";
2731
- const [w, f] = this.isTargetDragging ? [l, u] : [u, l];
2732
- this.overlayCanvas.addNode(U(w)), this.overlayCanvas.addNode(U(f)), this.overlayCanvas.addEdge({
2762
+ const [w, y] = this.isTargetDragging ? [l, u] : [u, l];
2763
+ this.overlayCanvas.addNode(U(w)), this.overlayCanvas.addNode(U(y)), this.overlayCanvas.addEdge({
2733
2764
  from: w.overlayNodeId,
2734
- to: f.overlayNodeId,
2735
- shape: this.params.edgeShapeFactory(T.EdgeId)
2765
+ to: y.overlayNodeId,
2766
+ shape: this.params.edgeShapeFactory(N.EdgeId)
2736
2767
  });
2737
2768
  }
2738
2769
  resetDragState() {
@@ -2747,7 +2778,7 @@ class ee {
2747
2778
  });
2748
2779
  return;
2749
2780
  }
2750
- const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
2781
+ const i = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2751
2782
  h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2752
2783
  }
2753
2784
  moveDraggingPort(e) {
@@ -2755,25 +2786,25 @@ class ee {
2755
2786
  x: e.x - t.x,
2756
2787
  y: e.y - t.y
2757
2788
  });
2758
- this.overlayCanvas.updateNode(T.DraggingNodeId, {
2789
+ this.overlayCanvas.updateNode(N.DraggingNodeId, {
2759
2790
  x: s.x,
2760
2791
  y: s.y
2761
2792
  });
2762
2793
  }
2763
2794
  }
2764
2795
  class te {
2765
- constructor(e, t, s, o, n) {
2766
- i(this, "overlayCanvas");
2767
- i(this, "staticPortId", null);
2768
- i(this, "isTargetDragging", !0);
2769
- i(this, "draggingEdgePayload", null);
2770
- i(this, "onEdgeReattached", (e) => {
2796
+ constructor(e, t, s, i, n) {
2797
+ o(this, "overlayCanvas");
2798
+ o(this, "staticPortId", null);
2799
+ o(this, "isTargetDragging", !0);
2800
+ o(this, "draggingEdgePayload", null);
2801
+ o(this, "onEdgeReattached", (e) => {
2771
2802
  this.params.onAfterEdgeReattached(e);
2772
2803
  });
2773
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Ve(
2804
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ve(
2774
2805
  this.overlayLayer,
2775
2806
  this.viewportStore
2776
- ), z.configure(
2807
+ ), k.configure(
2777
2808
  this.canvas,
2778
2809
  this.overlayLayer,
2779
2810
  this.window,
@@ -2793,12 +2824,12 @@ class te {
2793
2824
  }
2794
2825
  );
2795
2826
  }
2796
- static configure(e, t, s, o, n) {
2827
+ static configure(e, t, s, i, n) {
2797
2828
  new te(
2798
2829
  e,
2799
2830
  t,
2800
2831
  s,
2801
- o,
2832
+ i,
2802
2833
  n
2803
2834
  );
2804
2835
  }
@@ -2806,7 +2837,7 @@ class te {
2806
2837
  const s = this.params.draggingEdgeResolver(e);
2807
2838
  if (s === null || !this.canvas.graph.hasEdge(s))
2808
2839
  return !1;
2809
- const o = this.canvas.graph.getEdge(s), n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
2840
+ const i = this.canvas.graph.getEdge(s), n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2810
2841
  this.staticPortId = h, this.isTargetDragging = a;
2811
2842
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2812
2843
  x: g.x + g.width / 2,
@@ -2814,32 +2845,32 @@ class te {
2814
2845
  }, u = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
2815
2846
  x: l.x - u.x,
2816
2847
  y: l.y - u.y
2817
- }), f = this.canvas.viewport.createContentCoords({
2848
+ }), y = this.canvas.viewport.createContentCoords({
2818
2849
  x: t.x - u.x,
2819
2850
  y: t.y - u.y
2820
2851
  });
2821
2852
  this.draggingEdgePayload = {
2822
2853
  id: s,
2823
- from: o.from,
2824
- to: o.to,
2825
- shape: o.shape,
2826
- priority: o.priority
2854
+ from: i.from,
2855
+ to: i.to,
2856
+ shape: i.shape,
2857
+ priority: i.priority
2827
2858
  }, this.canvas.removeEdge(s);
2828
2859
  const E = {
2829
- overlayNodeId: T.StaticNodeId,
2860
+ overlayNodeId: N.StaticNodeId,
2830
2861
  portCoords: w,
2831
2862
  portDirection: c.direction
2832
2863
  }, S = {
2833
- overlayNodeId: T.DraggingNodeId,
2834
- portCoords: f,
2864
+ overlayNodeId: N.DraggingNodeId,
2865
+ portCoords: y,
2835
2866
  portDirection: d.direction
2836
- }, [b, C] = this.isTargetDragging ? [E, S] : [S, E];
2837
- this.overlayCanvas.addNode(U(b)), this.overlayCanvas.addNode(U(C));
2838
- const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.EdgeId) : o.shape;
2867
+ }, [b, T] = this.isTargetDragging ? [E, S] : [S, E];
2868
+ this.overlayCanvas.addNode(U(b)), this.overlayCanvas.addNode(U(T));
2869
+ const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : i.shape;
2839
2870
  return this.overlayCanvas.addEdge({
2840
- id: T.EdgeId,
2871
+ id: N.EdgeId,
2841
2872
  from: b.overlayNodeId,
2842
- to: C.overlayNodeId,
2873
+ to: T.overlayNodeId,
2843
2874
  shape: P
2844
2875
  }), !0;
2845
2876
  }
@@ -2850,15 +2881,15 @@ class te {
2850
2881
  const t = this.overlayLayer.getBoundingClientRect(), s = {
2851
2882
  x: e.x - t.x,
2852
2883
  y: e.y - t.y
2853
- }, o = this.canvas.viewport.createContentCoords(s);
2854
- this.overlayCanvas.updateNode(T.DraggingNodeId, {
2855
- x: o.x,
2856
- y: o.y
2884
+ }, i = this.canvas.viewport.createContentCoords(s);
2885
+ this.overlayCanvas.updateNode(N.DraggingNodeId, {
2886
+ x: i.x,
2887
+ y: i.y
2857
2888
  });
2858
2889
  }
2859
2890
  tryCreateConnection(e) {
2860
2891
  const t = xe(this.canvas.graph, e);
2861
- if (this.overlayCanvas.removeEdge(T.EdgeId), t === null) {
2892
+ if (this.overlayCanvas.removeEdge(N.EdgeId), t === null) {
2862
2893
  const d = this.draggingEdgePayload;
2863
2894
  this.params.onEdgeReattachInterrupted({
2864
2895
  id: d.id,
@@ -2869,10 +2900,10 @@ class te {
2869
2900
  });
2870
2901
  return;
2871
2902
  }
2872
- const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2903
+ const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2873
2904
  id: n.id,
2874
2905
  from: s,
2875
- to: o,
2906
+ to: i,
2876
2907
  shape: n.shape,
2877
2908
  priority: n.priority
2878
2909
  }, h = this.params.connectionPreprocessor(a);
@@ -2891,45 +2922,28 @@ class te {
2891
2922
  }
2892
2923
  }
2893
2924
  class re {
2894
- constructor(e, t, s) {
2895
- this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
2896
- this.applyLayout();
2925
+ constructor(e, t) {
2926
+ this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
2927
+ this.applier.apply();
2897
2928
  });
2898
2929
  }
2899
- static configure(e, t, s) {
2900
- new re(
2901
- e,
2902
- t,
2903
- s
2904
- );
2905
- }
2906
- applyLayout() {
2907
- this.layoutAlgorithm.calculateCoordinates({
2908
- graph: this.canvas.graph,
2909
- viewport: this.canvas.viewport
2910
- }).forEach((t, s) => {
2911
- this.canvas.updateNode(s, t);
2912
- });
2930
+ static configure(e, t) {
2931
+ new re(e, t);
2913
2932
  }
2914
2933
  }
2915
2934
  class O {
2916
2935
  constructor(e, t, s) {
2917
- i(this, "applyScheduled", !1);
2918
- i(this, "apply", () => {
2919
- this.applyScheduled = !1, this.layoutAlgorithm.calculateCoordinates({
2920
- graph: this.canvas.graph,
2921
- viewport: this.canvas.viewport
2922
- }).forEach((t, s) => {
2923
- this.canvas.updateNode(s, t);
2924
- });
2936
+ o(this, "applyScheduled", !1);
2937
+ o(this, "apply", () => {
2938
+ this.applyScheduled = !1, this.applier.apply();
2925
2939
  });
2926
- this.canvas = e, this.layoutAlgorithm = t, this.defererFn = s, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2940
+ this.graph = e, this.applier = t, this.defererFn = s, this.graph.onAfterNodeAdded.subscribe(() => {
2927
2941
  this.scheduleApply();
2928
- }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
2942
+ }), this.graph.onBeforeNodeRemoved.subscribe(() => {
2929
2943
  this.scheduleApply();
2930
- }), this.canvas.graph.onAfterEdgeAdded.subscribe(() => {
2944
+ }), this.graph.onAfterEdgeAdded.subscribe(() => {
2931
2945
  this.scheduleApply();
2932
- }), this.canvas.graph.onBeforeEdgeRemoved.subscribe(() => {
2946
+ }), this.graph.onBeforeEdgeRemoved.subscribe(() => {
2933
2947
  this.scheduleApply();
2934
2948
  });
2935
2949
  }
@@ -2944,25 +2958,26 @@ class O {
2944
2958
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
2945
2959
  }
2946
2960
  }
2947
- class Pt {
2961
+ class Tt {
2948
2962
  static configure(e, t) {
2949
- const s = t.applyOn;
2963
+ const s = t.applyOn, i = new At(e, t.algorithm, {
2964
+ staticNodeResolver: t.staticNodeResolver
2965
+ });
2950
2966
  switch (s.type) {
2951
2967
  case "manual": {
2952
2968
  re.configure(
2953
- e,
2954
- t.algorithm,
2969
+ i,
2955
2970
  s.trigger
2956
2971
  );
2957
2972
  break;
2958
2973
  }
2959
2974
  case "topologyChangeMacrotask": {
2960
2975
  O.configure(
2961
- e,
2962
- t.algorithm,
2963
- (o) => {
2976
+ e.graph,
2977
+ i,
2978
+ (n) => {
2964
2979
  setTimeout(() => {
2965
- o();
2980
+ n();
2966
2981
  });
2967
2982
  }
2968
2983
  );
@@ -2970,11 +2985,11 @@ class Pt {
2970
2985
  }
2971
2986
  case "topologyChangeMicrotask": {
2972
2987
  O.configure(
2973
- e,
2974
- t.algorithm,
2975
- (o) => {
2988
+ e.graph,
2989
+ i,
2990
+ (n) => {
2976
2991
  queueMicrotask(() => {
2977
- o();
2992
+ n();
2978
2993
  });
2979
2994
  }
2980
2995
  );
@@ -2983,10 +2998,10 @@ class Pt {
2983
2998
  }
2984
2999
  }
2985
3000
  }
2986
- class Tt {
3001
+ class Ct {
2987
3002
  constructor(e, t) {
2988
- i(this, "previousTimeStamp");
2989
- i(this, "step", (e) => {
3003
+ o(this, "previousTimeStamp");
3004
+ o(this, "step", (e) => {
2990
3005
  if (this.previousTimeStamp === void 0)
2991
3006
  this.previousTimeStamp = e;
2992
3007
  else {
@@ -2999,23 +3014,20 @@ class Tt {
2999
3014
  }
3000
3015
  }
3001
3016
  class se {
3002
- constructor(e, t, s, o) {
3003
- i(this, "step", (e) => {
3004
- this.algorithm.calculateNextCoordinates({
3005
- graph: this.canvas.graph,
3006
- dt: e,
3007
- viewport: this.canvas.viewport
3008
- }).forEach((s, o) => {
3009
- this.staticNodes.has(o) || this.canvas.updateNode(o, { x: s.x, y: s.y });
3010
- });
3017
+ constructor(e, t, s) {
3018
+ o(this, "applier");
3019
+ o(this, "step", (e) => {
3020
+ this.applier.apply(e);
3011
3021
  });
3012
- this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = o, new Tt(this.win, this.step);
3022
+ this.win = s, this.applier = new Et(e, t.algorithm, {
3023
+ staticNodeResolver: t.staticNodeResolver
3024
+ }), new Ct(this.win, this.step);
3013
3025
  }
3014
- static configure(e, t, s, o) {
3015
- new se(e, t, s, o);
3026
+ static configure(e, t, s) {
3027
+ new se(e, t, s);
3016
3028
  }
3017
3029
  }
3018
- const Ct = () => {
3030
+ const Dt = () => {
3019
3031
  const r = document.createElement("div");
3020
3032
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
3021
3033
  }, Y = () => {
@@ -3025,26 +3037,26 @@ const Ct = () => {
3025
3037
  const r = Y();
3026
3038
  return r.style.pointerEvents = "none", r;
3027
3039
  };
3028
- class Nt {
3040
+ class Mt {
3029
3041
  constructor(e) {
3030
- i(this, "background", Y());
3031
- i(this, "main", Y());
3032
- i(this, "overlayConnectablePorts", pe());
3033
- i(this, "overlayDraggableEdges", pe());
3034
- i(this, "host", Ct());
3042
+ o(this, "background", Y());
3043
+ o(this, "main", Y());
3044
+ o(this, "overlayConnectablePorts", pe());
3045
+ o(this, "overlayDraggableEdges", pe());
3046
+ o(this, "host", Dt());
3035
3047
  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);
3036
3048
  }
3037
3049
  destroy() {
3038
3050
  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);
3039
3051
  }
3040
3052
  }
3041
- const G = (r) => () => r, we = G(0), Dt = () => {
3053
+ const G = (r) => () => r, we = G(0), Lt = () => {
3042
3054
  let r = 0;
3043
3055
  return () => r++;
3044
- }, Mt = (r, e) => {
3056
+ }, Rt = (r, e) => {
3045
3057
  let t = we, s = we;
3046
- const o = Dt();
3047
- return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = G(r)), typeof e == "number" && (s = G(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
3058
+ const i = Lt();
3059
+ return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = G(r)), typeof e == "number" && (s = G(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
3048
3060
  nodesPriorityFn: t,
3049
3061
  edgesPriorityFn: s
3050
3062
  };
@@ -3080,7 +3092,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3080
3092
  detourDistance: r.detourDistance
3081
3093
  });
3082
3094
  case "vertical":
3083
- return () => new ft({
3095
+ return () => new yt({
3084
3096
  color: r.color,
3085
3097
  width: r.width,
3086
3098
  arrowLength: r.arrowLength,
@@ -3118,15 +3130,15 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3118
3130
  detourDirection: r.detourDirection
3119
3131
  });
3120
3132
  }
3121
- }, Lt = (r) => {
3122
- var t, s, o, n, a;
3123
- const e = Mt(
3133
+ }, Vt = (r) => {
3134
+ var t, s, i, n, a;
3135
+ const e = Rt(
3124
3136
  (t = r.nodes) == null ? void 0 : t.priority,
3125
3137
  (s = r.edges) == null ? void 0 : s.priority
3126
3138
  );
3127
3139
  return {
3128
3140
  nodes: {
3129
- centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Se,
3141
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Se,
3130
3142
  priorityFn: e.nodesPriorityFn
3131
3143
  },
3132
3144
  ports: {
@@ -3137,12 +3149,12 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3137
3149
  priorityFn: e.edgesPriorityFn
3138
3150
  }
3139
3151
  };
3140
- }, Rt = (r) => {
3141
- var w, f, E, S, b, C;
3152
+ }, Ft = (r) => {
3153
+ var w, y, E, S, b, T;
3142
3154
  const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3143
- }), t = ((f = r.events) == null ? void 0 : f.onNodeDrag) ?? (() => {
3144
- }), s = r.nodeDragVerifier ?? (() => !0), o = ((E = r.events) == null ? void 0 : E.onNodeDragFinished) ?? (() => {
3145
- }), 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 = (C = r.mouse) == null ? void 0 : C.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
3155
+ }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3156
+ }), s = r.nodeDragVerifier ?? (() => !0), i = ((E = r.events) == null ? void 0 : E.onNodeDragFinished) ?? (() => {
3157
+ }), 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;
3146
3158
  return {
3147
3159
  moveOnTop: n,
3148
3160
  moveEdgesOnTop: a,
@@ -3153,25 +3165,25 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3153
3165
  onNodeDragStarted: e,
3154
3166
  onNodeDrag: t,
3155
3167
  nodeDragVerifier: s,
3156
- onNodeDragFinished: o
3168
+ onNodeDragFinished: i
3157
3169
  };
3158
- }, Vt = (r) => {
3159
- 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;
3170
+ }, It = (r) => {
3171
+ 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;
3160
3172
  return (n) => {
3161
3173
  let a = n.nextTransform.x, h = n.nextTransform.y;
3162
3174
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3163
3175
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3164
3176
  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));
3165
- const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
3177
+ const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
3166
3178
  return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3167
3179
  };
3168
- }, Ft = (r) => {
3169
- const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
3180
+ }, $t = (r) => {
3181
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3170
3182
  return (n) => {
3171
3183
  const a = n.prevTransform, h = n.nextTransform;
3172
3184
  let d = h.scale, c = h.x, g = h.y;
3173
- if (h.scale > o && h.scale > a.scale) {
3174
- d = Math.max(a.scale, o), c = a.x, g = a.y;
3185
+ if (h.scale > i && h.scale > a.scale) {
3186
+ d = Math.max(a.scale, i), c = a.x, g = a.y;
3175
3187
  const l = (d - a.scale) / (h.scale - a.scale);
3176
3188
  c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3177
3189
  }
@@ -3186,7 +3198,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3186
3198
  y: g
3187
3199
  };
3188
3200
  };
3189
- }, It = (r) => (e) => r.reduce(
3201
+ }, Ut = (r) => (e) => r.reduce(
3190
3202
  (t, s) => s({
3191
3203
  prevTransform: e.prevTransform,
3192
3204
  nextTransform: t,
@@ -3194,35 +3206,35 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3194
3206
  canvasHeight: e.canvasHeight
3195
3207
  }),
3196
3208
  e.nextTransform
3197
- ), fe = (r) => {
3209
+ ), ye = (r) => {
3198
3210
  if (typeof r == "function")
3199
3211
  return r;
3200
3212
  switch (r.type) {
3201
3213
  case "scale-limit":
3202
- return Ft({
3214
+ return $t({
3203
3215
  minContentScale: r.minContentScale ?? 0,
3204
3216
  maxContentScale: r.maxContentScale ?? 1 / 0
3205
3217
  });
3206
3218
  case "shift-limit":
3207
- return Vt({
3219
+ return It({
3208
3220
  minX: r.minX ?? -1 / 0,
3209
3221
  maxX: r.maxX ?? 1 / 0,
3210
3222
  minY: r.minY ?? -1 / 0,
3211
3223
  maxY: r.maxY ?? 1 / 0
3212
3224
  });
3213
3225
  }
3214
- }, ye = (r) => {
3215
- var f, E, S, b, C, P, R, V, ie, ne, ae, he;
3216
- 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;
3217
- let o;
3218
- s !== void 0 ? Array.isArray(s) ? o = It(
3226
+ }, fe = (r) => {
3227
+ var y, E, S, b, T, P, R, V, ie, ne, ae, he;
3228
+ 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;
3229
+ let i;
3230
+ s !== void 0 ? Array.isArray(s) ? i = Ut(
3219
3231
  s.map(
3220
- (N) => fe(N)
3232
+ (C) => ye(C)
3221
3233
  )
3222
- ) : o = fe(s) : o = (N) => N.nextTransform;
3234
+ ) : i = ye(s) : i = (C) => C.nextTransform;
3223
3235
  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) ?? (() => {
3224
3236
  }), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
3225
- }), d = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseDownEventVerifier, c = d !== void 0 ? d : (N) => N.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (N) => N.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3237
+ }), 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;
3226
3238
  return {
3227
3239
  wheelSensitivity: t,
3228
3240
  onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
@@ -3231,7 +3243,7 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3231
3243
  }),
3232
3244
  onBeforeTransformChange: a,
3233
3245
  onTransformChange: h,
3234
- transformPreprocessor: o,
3246
+ transformPreprocessor: i,
3235
3247
  shiftCursor: n,
3236
3248
  mouseDownEventVerifier: c,
3237
3249
  mouseUpEventVerifier: l,
@@ -3242,32 +3254,32 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3242
3254
  onResizeTransformFinished: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onResizeTransformFinished) ?? (() => {
3243
3255
  })
3244
3256
  };
3245
- }, $t = (r, e) => {
3257
+ }, Bt = (r, e) => {
3246
3258
  const t = document.createElementNS(
3247
3259
  "http://www.w3.org/2000/svg",
3248
3260
  "circle"
3249
3261
  );
3250
3262
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3251
- }, Ut = (r) => r instanceof SVGElement ? r : $t(
3263
+ }, Ot = (r) => r instanceof SVGElement ? r : Bt(
3252
3264
  (r == null ? void 0 : r.radius) ?? 1.5,
3253
3265
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3254
- ), Bt = (r) => {
3255
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Ut(r.renderer ?? {});
3266
+ ), Wt = (r) => {
3267
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Ot(r.renderer ?? {});
3256
3268
  return {
3257
3269
  tileWidth: t,
3258
3270
  tileHeight: s,
3259
- renderer: o,
3271
+ renderer: i,
3260
3272
  maxViewportScale: r.maxViewportScale ?? 10
3261
3273
  };
3262
- }, Ot = (r, e, t) => {
3274
+ }, zt = (r, e, t) => {
3263
3275
  var c, g, l;
3264
- const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
3276
+ const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
3265
3277
  }, h = () => {
3266
3278
  }, d = () => {
3267
3279
  };
3268
3280
  return {
3269
3281
  connectionTypeResolver: r.connectionTypeResolver ?? s,
3270
- connectionPreprocessor: r.connectionPreprocessor ?? o,
3282
+ connectionPreprocessor: r.connectionPreprocessor ?? i,
3271
3283
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3272
3284
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3273
3285
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
@@ -3276,9 +3288,9 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3276
3288
  dragPortDirection: r.dragPortDirection ?? t,
3277
3289
  edgeShapeFactory: r.edgeShape !== void 0 ? oe(r.edgeShape) : e
3278
3290
  };
3279
- }, Wt = (r, e) => {
3291
+ }, kt = (r, e) => {
3280
3292
  var c, g, l;
3281
- const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
3293
+ const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
3282
3294
  const w = e.getPortAdjacentEdgeIds(u);
3283
3295
  return w.length > 0 ? w[w.length - 1] : null;
3284
3296
  }, a = () => {
@@ -3288,17 +3300,17 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3288
3300
  return {
3289
3301
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3290
3302
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3291
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
3303
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3292
3304
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3293
3305
  draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? oe(r.draggingEdgeShape) : null,
3294
3306
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3295
3307
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3296
3308
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3297
3309
  };
3298
- }, kt = (r) => ({
3310
+ }, Ht = (r) => ({
3299
3311
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3300
3312
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3301
- }), zt = (r) => {
3313
+ }), Xt = (r) => {
3302
3314
  var e, t;
3303
3315
  return {
3304
3316
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3307,28 +3319,43 @@ const G = (r) => () => r, we = G(0), Dt = () => {
3307
3319
  })
3308
3320
  };
3309
3321
  };
3310
- class Ht extends Error {
3322
+ class Yt extends Error {
3311
3323
  constructor() {
3312
3324
  super(...arguments);
3313
- i(this, "name", "CanvasBuilderError");
3325
+ o(this, "name", "CanvasBuilderError");
3314
3326
  }
3315
3327
  }
3328
+ const v = Object.freeze({
3329
+ seed: "HTMLGraph is awesome",
3330
+ maxTimeDeltaSec: 0.01,
3331
+ nodeCharge: 1e5,
3332
+ nodeMass: 1,
3333
+ edgeEquilibriumLength: 300,
3334
+ edgeStiffness: 1e3,
3335
+ dtSec: 0.01,
3336
+ maxIterations: 1e3,
3337
+ convergenceVelocity: 10,
3338
+ maxForce: 1e7,
3339
+ nodeForceCoefficient: 1,
3340
+ barnesHutAreaRadiusThreshold: 0.01,
3341
+ barnesHutTheta: 1
3342
+ });
3316
3343
  class Fe {
3317
3344
  constructor(e, t, s) {
3318
- i(this, "dt");
3319
- i(this, "nodeMass");
3320
- i(this, "edgeEquilibriumLength");
3321
- i(this, "edgeStiffness");
3322
- i(this, "nodeForcesApplicationStrategy");
3323
- i(this, "distanceVectorGenerator");
3345
+ o(this, "dt");
3346
+ o(this, "nodeMass");
3347
+ o(this, "edgeEquilibriumLength");
3348
+ o(this, "edgeStiffness");
3349
+ o(this, "nodeForcesApplicationStrategy");
3350
+ o(this, "distanceVectorGenerator");
3324
3351
  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;
3325
3352
  }
3326
3353
  apply() {
3327
3354
  let e = 0;
3328
3355
  const t = /* @__PURE__ */ new Map();
3329
- return this.graph.getAllNodeIds().forEach((o) => {
3330
- t.set(o, { x: 0, y: 0 });
3331
- }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
3356
+ return this.graph.getAllNodeIds().forEach((i) => {
3357
+ t.set(i, { x: 0, y: 0 });
3358
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((i, n) => {
3332
3359
  const a = t.get(n), h = {
3333
3360
  x: a.x / this.nodeMass * this.dt,
3334
3361
  y: a.y / this.nodeMass * this.dt
@@ -3338,26 +3365,26 @@ class Fe {
3338
3365
  Math.sqrt(h.x * h.x + h.y * h.y)
3339
3366
  );
3340
3367
  const d = h.x * this.dt, c = h.y * this.dt;
3341
- o.x += d, o.y += c;
3368
+ i.x += d, i.y += c;
3342
3369
  }), e;
3343
3370
  }
3344
3371
  applyEdgeForces(e) {
3345
3372
  this.graph.getAllEdgeIds().forEach((t) => {
3346
- 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(
3373
+ 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(
3347
3374
  a,
3348
3375
  h
3349
- ), 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);
3350
- w.x += l, w.y += u, f.x -= l, f.y -= u;
3376
+ ), 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);
3377
+ w.x += l, w.y += u, y.x -= l, y.y -= u;
3351
3378
  });
3352
3379
  }
3353
3380
  }
3354
3381
  class Ie {
3355
3382
  constructor(e) {
3356
- i(this, "PI2", 2 * Math.PI);
3383
+ o(this, "PI2", 2 * Math.PI);
3357
3384
  this.rand = e;
3358
3385
  }
3359
3386
  create(e, t) {
3360
- const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
3387
+ const s = t.x - e.x, i = t.y - e.y, n = s * s + i * i;
3361
3388
  if (n === 0) {
3362
3389
  const c = this.PI2 * this.rand();
3363
3390
  return {
@@ -3366,7 +3393,7 @@ class Ie {
3366
3393
  d: 0
3367
3394
  };
3368
3395
  }
3369
- const a = Math.sqrt(n), h = s / a, d = o / a;
3396
+ const a = Math.sqrt(n), h = s / a, d = i / a;
3370
3397
  return { ex: h, ey: d, d: a };
3371
3398
  }
3372
3399
  }
@@ -3376,18 +3403,18 @@ const $e = (r) => {
3376
3403
  const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
3377
3404
  return Math.min(e, r.maxForce);
3378
3405
  };
3379
- class Xt {
3406
+ class Gt {
3380
3407
  constructor(e) {
3381
- i(this, "nodeCharge");
3382
- i(this, "distanceVectorGenerator");
3383
- i(this, "maxForce");
3408
+ o(this, "nodeCharge");
3409
+ o(this, "distanceVectorGenerator");
3410
+ o(this, "maxForce");
3384
3411
  this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
3385
3412
  }
3386
3413
  apply(e, t) {
3387
- const s = Array.from(t.keys()), o = s.length;
3388
- for (let n = 0; n < o; n++) {
3414
+ const s = Array.from(t.keys()), i = s.length;
3415
+ for (let n = 0; n < i; n++) {
3389
3416
  const a = s[n];
3390
- for (let h = n + 1; h < o; h++) {
3417
+ for (let h = n + 1; h < i; h++) {
3391
3418
  const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
3392
3419
  c,
3393
3420
  g
@@ -3397,39 +3424,39 @@ class Xt {
3397
3424
  targetCharge: this.nodeCharge,
3398
3425
  distance: l.d,
3399
3426
  maxForce: this.maxForce
3400
- }), w = u * l.ex, f = u * l.ey, E = t.get(a), S = t.get(d);
3401
- E.x -= w, E.y -= f, S.x += w, S.y += f;
3427
+ }), w = u * l.ex, y = u * l.ey, E = t.get(a), S = t.get(d);
3428
+ E.x -= w, E.y -= y, S.x += w, S.y += y;
3402
3429
  }
3403
3430
  }
3404
3431
  }
3405
3432
  }
3406
- const Yt = (r) => {
3433
+ const jt = (r) => {
3407
3434
  if (r.size === 0)
3408
3435
  return {
3409
3436
  centerX: 0,
3410
3437
  centerY: 0,
3411
3438
  radius: 0
3412
3439
  };
3413
- let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
3440
+ let e = 1 / 0, t = -1 / 0, s = 1 / 0, i = -1 / 0;
3414
3441
  r.forEach((d) => {
3415
- e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
3442
+ e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), i = Math.max(i, d.y);
3416
3443
  });
3417
- const n = t - e, a = o - s, h = Math.max(n, a);
3444
+ const n = t - e, a = i - s, h = Math.max(n, a);
3418
3445
  return {
3419
3446
  centerX: (e + t) / 2,
3420
- centerY: (s + o) / 2,
3447
+ centerY: (s + i) / 2,
3421
3448
  radius: h / 2
3422
3449
  };
3423
3450
  };
3424
- class Gt {
3451
+ class Kt {
3425
3452
  constructor(e) {
3426
- i(this, "root");
3427
- i(this, "leaves", /* @__PURE__ */ new Map());
3428
- i(this, "coords");
3429
- i(this, "areaRadiusThreshold");
3430
- i(this, "nodeMass");
3431
- i(this, "nodeCharge");
3432
- i(this, "sortedParentNodes", []);
3453
+ o(this, "root");
3454
+ o(this, "leaves", /* @__PURE__ */ new Map());
3455
+ o(this, "coords");
3456
+ o(this, "areaRadiusThreshold");
3457
+ o(this, "nodeMass");
3458
+ o(this, "nodeCharge");
3459
+ o(this, "sortedParentNodes", []);
3433
3460
  this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
3434
3461
  nodeIds: new Set(e.coords.keys()),
3435
3462
  box: e.box,
@@ -3449,16 +3476,16 @@ class Gt {
3449
3476
  for (; t.length > 0; ) {
3450
3477
  const s = [];
3451
3478
  for (; t.length > 0; ) {
3452
- const o = t.pop();
3453
- this.processNode(o).forEach((a) => {
3479
+ const i = t.pop();
3480
+ this.processNode(i).forEach((a) => {
3454
3481
  s.push(a);
3455
3482
  });
3456
3483
  }
3457
3484
  t = s;
3458
3485
  }
3459
3486
  this.sortedParentNodes.reverse().forEach((s) => {
3460
- let o = 0, n = 0, a = 0, h = 0;
3461
- 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;
3487
+ let i = 0, n = 0, a = 0, h = 0;
3488
+ 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;
3462
3489
  });
3463
3490
  }
3464
3491
  getRoot() {
@@ -3470,14 +3497,14 @@ class Gt {
3470
3497
  processNode(e) {
3471
3498
  if (e.nodeIds.size < 2)
3472
3499
  return this.setLeaf(e), [];
3473
- const { centerX: t, centerY: s, radius: o } = e.box;
3474
- if (o < this.areaRadiusThreshold)
3500
+ const { centerX: t, centerY: s, radius: i } = e.box;
3501
+ if (i < this.areaRadiusThreshold)
3475
3502
  return this.setLeaf(e), [];
3476
3503
  this.sortedParentNodes.push(e);
3477
- const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
3504
+ const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = i / 2;
3478
3505
  e.nodeIds.forEach((u) => {
3479
- const { x: w, y: f } = this.coords.get(u);
3480
- w < t ? f < s ? d.add(u) : h.add(u) : f < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3506
+ const { x: w, y } = this.coords.get(u);
3507
+ w < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3481
3508
  });
3482
3509
  const g = {
3483
3510
  parent: e,
@@ -3572,25 +3599,25 @@ class Gt {
3572
3599
  y: 0
3573
3600
  };
3574
3601
  let t = 0, s = 0;
3575
- return e.forEach((o) => {
3576
- const n = this.coords.get(o);
3602
+ return e.forEach((i) => {
3603
+ const n = this.coords.get(i);
3577
3604
  t += n.x, s += n.y;
3578
3605
  }), { x: t / e.size, y: s / e.size };
3579
3606
  }
3580
3607
  }
3581
- class jt {
3608
+ class Qt {
3582
3609
  constructor(e) {
3583
- i(this, "areaRadiusThreshold");
3584
- i(this, "nodeMass");
3585
- i(this, "nodeCharge");
3586
- i(this, "theta");
3587
- i(this, "distanceVectorGenerator");
3588
- i(this, "nodeForceCoefficient");
3589
- i(this, "maxForce");
3610
+ o(this, "areaRadiusThreshold");
3611
+ o(this, "nodeMass");
3612
+ o(this, "nodeCharge");
3613
+ o(this, "theta");
3614
+ o(this, "distanceVectorGenerator");
3615
+ o(this, "nodeForceCoefficient");
3616
+ o(this, "maxForce");
3590
3617
  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;
3591
3618
  }
3592
3619
  apply(e, t) {
3593
- const s = Yt(e), o = new Gt({
3620
+ const s = jt(e), i = new Kt({
3594
3621
  box: s,
3595
3622
  coords: e,
3596
3623
  areaRadiusThreshold: this.areaRadiusThreshold,
@@ -3599,7 +3626,7 @@ class jt {
3599
3626
  });
3600
3627
  e.forEach((n, a) => {
3601
3628
  const h = this.calculateForceForNode(
3602
- o.getLeaf(a),
3629
+ i.getLeaf(a),
3603
3630
  a,
3604
3631
  e
3605
3632
  ), d = t.get(a);
@@ -3607,14 +3634,14 @@ class jt {
3607
3634
  });
3608
3635
  }
3609
3636
  calculateForceForNode(e, t, s) {
3610
- const o = s.get(t), n = { x: 0, y: 0 };
3637
+ const i = s.get(t), n = { x: 0, y: 0 };
3611
3638
  e.nodeIds.forEach((h) => {
3612
3639
  if (h !== t) {
3613
3640
  const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3614
3641
  sourceCharge: this.nodeCharge,
3615
3642
  targetCharge: this.nodeCharge,
3616
3643
  sourceCoords: d,
3617
- targetCoords: o
3644
+ targetCoords: i
3618
3645
  });
3619
3646
  this.applyForce(n, c);
3620
3647
  }
@@ -3625,49 +3652,49 @@ class jt {
3625
3652
  if (h !== null) {
3626
3653
  const d = this.distanceVectorGenerator.create(
3627
3654
  h.chargeCenter,
3628
- o
3655
+ i
3629
3656
  );
3630
3657
  h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3631
3658
  totalForce: n,
3632
- targetCoords: o,
3659
+ targetCoords: i,
3633
3660
  target: h.lb,
3634
3661
  current: a
3635
3662
  }), this.tryApplyFarForce({
3636
3663
  totalForce: n,
3637
- targetCoords: o,
3664
+ targetCoords: i,
3638
3665
  target: h.rb,
3639
3666
  current: a
3640
3667
  }), this.tryApplyFarForce({
3641
3668
  totalForce: n,
3642
- targetCoords: o,
3669
+ targetCoords: i,
3643
3670
  target: h.rt,
3644
3671
  current: a
3645
3672
  }), this.tryApplyFarForce({
3646
3673
  totalForce: n,
3647
- targetCoords: o,
3674
+ targetCoords: i,
3648
3675
  target: h.lt,
3649
3676
  current: a
3650
3677
  })) : (this.tryApplyNearForce({
3651
3678
  totalForce: n,
3652
- targetCoords: o,
3679
+ targetCoords: i,
3653
3680
  target: h.lb,
3654
3681
  current: a,
3655
3682
  nodesCoords: s
3656
3683
  }), this.tryApplyNearForce({
3657
3684
  totalForce: n,
3658
- targetCoords: o,
3685
+ targetCoords: i,
3659
3686
  target: h.rb,
3660
3687
  current: a,
3661
3688
  nodesCoords: s
3662
3689
  }), this.tryApplyNearForce({
3663
3690
  totalForce: n,
3664
- targetCoords: o,
3691
+ targetCoords: i,
3665
3692
  target: h.rt,
3666
3693
  current: a,
3667
3694
  nodesCoords: s
3668
3695
  }), this.tryApplyNearForce({
3669
3696
  totalForce: n,
3670
- targetCoords: o,
3697
+ targetCoords: i,
3671
3698
  target: h.lt,
3672
3699
  current: a,
3673
3700
  nodesCoords: s
@@ -3678,7 +3705,7 @@ class jt {
3678
3705
  return n;
3679
3706
  }
3680
3707
  calculateExactForce(e, t, s) {
3681
- const o = { x: 0, y: 0 }, n = [e];
3708
+ const i = { x: 0, y: 0 }, n = [e];
3682
3709
  for (; n.length > 0; ) {
3683
3710
  const a = n.pop();
3684
3711
  a.nodeIds.forEach((h) => {
@@ -3688,10 +3715,10 @@ class jt {
3688
3715
  sourceCoords: d,
3689
3716
  targetCoords: t
3690
3717
  });
3691
- this.applyForce(o, c);
3718
+ this.applyForce(i, c);
3692
3719
  }), 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);
3693
3720
  }
3694
- return o;
3721
+ return i;
3695
3722
  }
3696
3723
  calculateApproximateForce(e, t) {
3697
3724
  return this.calculateNodeRepulsiveForce({
@@ -3740,7 +3767,7 @@ class jt {
3740
3767
  }
3741
3768
  }
3742
3769
  }
3743
- const Ue = (r) => r.theta !== 0 ? new jt({
3770
+ const Ue = (r) => r.theta !== 0 ? new Qt({
3744
3771
  nodeCharge: r.nodeCharge,
3745
3772
  nodeForceCoefficient: r.nodeForceCoefficient,
3746
3773
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -3748,7 +3775,7 @@ const Ue = (r) => r.theta !== 0 ? new jt({
3748
3775
  theta: r.theta,
3749
3776
  nodeMass: r.nodeMass,
3750
3777
  areaRadiusThreshold: r.areaRadiusThreshold
3751
- }) : new Xt({
3778
+ }) : new Gt({
3752
3779
  nodeCharge: r.nodeCharge,
3753
3780
  nodeForceCoefficient: r.nodeForceCoefficient,
3754
3781
  distanceVectorGenerator: r.distanceVectorGenerator,
@@ -3756,35 +3783,35 @@ const Ue = (r) => r.theta !== 0 ? new jt({
3756
3783
  });
3757
3784
  class Be {
3758
3785
  constructor(e) {
3759
- i(this, "rand");
3760
- i(this, "sparsity");
3786
+ o(this, "rand");
3787
+ o(this, "sparsity");
3761
3788
  this.rand = e.rand, this.sparsity = e.sparsity;
3762
3789
  }
3763
3790
  calculateCoordinates(e) {
3764
- const { graph: t, viewport: s } = e, o = /* @__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 = {
3791
+ 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 = {
3765
3792
  x: g.x - l,
3766
3793
  y: g.y - l
3767
3794
  };
3768
3795
  return n.forEach((w) => {
3769
- const f = t.getNode(w);
3770
- o.set(w, {
3771
- x: f.x ?? u.x + a * this.rand(),
3772
- y: f.y ?? u.y + a * this.rand()
3796
+ const y = t.getNode(w);
3797
+ i.set(w, {
3798
+ x: y.x ?? u.x + a * this.rand(),
3799
+ y: y.y ?? u.y + a * this.rand()
3773
3800
  });
3774
- }), o;
3801
+ }), i;
3775
3802
  }
3776
3803
  }
3777
- class qt {
3804
+ class Zt {
3778
3805
  constructor(e) {
3779
- i(this, "distanceVectorGenerator");
3780
- i(this, "nodeForcesApplicationStrategy");
3781
- i(this, "fillerLayoutAlgorithm");
3782
- i(this, "maxIterations");
3783
- i(this, "dtSec");
3784
- i(this, "nodeMass");
3785
- i(this, "edgeEquilibriumLength");
3786
- i(this, "edgeStiffness");
3787
- i(this, "convergenceVelocity");
3806
+ o(this, "distanceVectorGenerator");
3807
+ o(this, "nodeForcesApplicationStrategy");
3808
+ o(this, "fillerLayoutAlgorithm");
3809
+ o(this, "maxIterations");
3810
+ o(this, "dtSec");
3811
+ o(this, "nodeMass");
3812
+ o(this, "edgeEquilibriumLength");
3813
+ o(this, "edgeStiffness");
3814
+ o(this, "convergenceVelocity");
3788
3815
  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 Ie(e.rand), this.nodeForcesApplicationStrategy = Ue({
3789
3816
  distanceVectorGenerator: this.distanceVectorGenerator,
3790
3817
  nodeCharge: e.nodeCharge,
@@ -3799,13 +3826,13 @@ class qt {
3799
3826
  });
3800
3827
  }
3801
3828
  calculateCoordinates(e) {
3802
- const { graph: t, viewport: s } = e, o = this.fillerLayoutAlgorithm.calculateCoordinates({
3829
+ const { graph: t, viewport: s } = e, i = this.fillerLayoutAlgorithm.calculateCoordinates({
3803
3830
  graph: t,
3804
3831
  viewport: s
3805
3832
  });
3806
3833
  for (let n = 0; n < this.maxIterations && !(new Fe(
3807
3834
  t,
3808
- o,
3835
+ i,
3809
3836
  {
3810
3837
  distanceVectorGenerator: this.distanceVectorGenerator,
3811
3838
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -3816,19 +3843,19 @@ class qt {
3816
3843
  }
3817
3844
  ).apply() < this.convergenceVelocity); n++)
3818
3845
  ;
3819
- return o;
3846
+ return i;
3820
3847
  }
3821
3848
  }
3822
- class Kt {
3849
+ class qt {
3823
3850
  constructor(e) {
3824
- i(this, "distanceVectorGenerator");
3825
- i(this, "nodeForcesApplicationStrategy");
3826
- i(this, "convergenceVelocity");
3827
- i(this, "maxTimeDeltaSec");
3828
- i(this, "nodeMass");
3829
- i(this, "edgeEquilibriumLength");
3830
- i(this, "edgeStiffness");
3831
- i(this, "fillerLayoutAlgorithm");
3851
+ o(this, "distanceVectorGenerator");
3852
+ o(this, "nodeForcesApplicationStrategy");
3853
+ o(this, "convergenceVelocity");
3854
+ o(this, "maxTimeDeltaSec");
3855
+ o(this, "nodeMass");
3856
+ o(this, "edgeEquilibriumLength");
3857
+ o(this, "edgeStiffness");
3858
+ o(this, "fillerLayoutAlgorithm");
3832
3859
  this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ie(e.rand), this.nodeForcesApplicationStrategy = Ue({
3833
3860
  distanceVectorGenerator: this.distanceVectorGenerator,
3834
3861
  nodeCharge: e.nodeCharge,
@@ -3843,7 +3870,7 @@ class Kt {
3843
3870
  });
3844
3871
  }
3845
3872
  calculateNextCoordinates(e) {
3846
- const { graph: t, viewport: s, dt: o } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
3873
+ const { graph: t, viewport: s, dt: i } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
3847
3874
  graph: t,
3848
3875
  viewport: s
3849
3876
  });
@@ -3853,7 +3880,7 @@ class Kt {
3853
3880
  {
3854
3881
  distanceVectorGenerator: this.distanceVectorGenerator,
3855
3882
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
3856
- dtSec: Math.min(o, this.maxTimeDeltaSec),
3883
+ dtSec: Math.min(i, this.maxTimeDeltaSec),
3857
3884
  nodeMass: this.nodeMass,
3858
3885
  edgeEquilibriumLength: this.edgeEquilibriumLength,
3859
3886
  edgeStiffness: this.edgeStiffness
@@ -3865,68 +3892,59 @@ class Kt {
3865
3892
  }
3866
3893
  }
3867
3894
  const Oe = (r) => {
3868
- let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
3895
+ let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
3869
3896
  for (let n = 0, a; n < r.length; n++)
3870
- 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);
3871
- 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];
3897
+ 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);
3898
+ 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];
3872
3899
  }, We = (r, e, t, s) => function() {
3873
3900
  r |= 0, e |= 0, t |= 0, s |= 0;
3874
- const o = (r + e | 0) + s | 0;
3875
- 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;
3876
- }, v = Object.freeze({
3877
- seed: "HTMLGraph is awesome",
3878
- maxTimeDeltaSec: 0.01,
3879
- nodeCharge: 1e5,
3880
- nodeMass: 1,
3881
- edgeEquilibriumLength: 300,
3882
- edgeStiffness: 1e3,
3883
- dtSec: 0.01,
3884
- maxIterations: 1e3,
3885
- convergenceVelocity: 10,
3886
- maxForce: 1e7,
3887
- nodeForceCoefficient: 1,
3888
- barnesHutAreaRadiusThreshold: 0.01,
3889
- barnesHutTheta: 1
3890
- }), Qt = (r) => {
3891
- var e, t, s;
3892
- switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
3901
+ const i = (r + e | 0) + s | 0;
3902
+ 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;
3903
+ }, Jt = (r) => {
3904
+ var e, t;
3905
+ switch (r == null ? void 0 : r.type) {
3893
3906
  case "custom":
3894
- return r.algorithm.instance;
3907
+ return r.instance;
3895
3908
  default: {
3896
- const o = r == null ? void 0 : r.algorithm, n = Oe((o == null ? void 0 : o.seed) ?? v.seed), a = We(n[0], n[1], n[2], n[3]);
3897
- return new Kt({
3898
- rand: a,
3899
- maxTimeDeltaSec: (o == null ? void 0 : o.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3900
- nodeCharge: (o == null ? void 0 : o.nodeCharge) ?? v.nodeCharge,
3901
- nodeMass: (o == null ? void 0 : o.nodeMass) ?? v.nodeMass,
3902
- edgeEquilibriumLength: (o == null ? void 0 : o.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3903
- edgeStiffness: (o == null ? void 0 : o.edgeStiffness) ?? v.edgeStiffness,
3904
- convergenceVelocity: (o == null ? void 0 : o.convergenceVelocity) ?? v.convergenceVelocity,
3905
- maxForce: (o == null ? void 0 : o.maxForce) ?? v.maxForce,
3906
- nodeForceCoefficient: (o == null ? void 0 : o.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3907
- barnesHutTheta: ((t = o == null ? void 0 : o.barnesHut) == null ? void 0 : t.theta) ?? v.barnesHutTheta,
3908
- barnesHutAreaRadiusThreshold: ((s = o == null ? void 0 : o.barnesHut) == null ? void 0 : s.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3909
+ const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), i = We(s[0], s[1], s[2], s[3]);
3910
+ return new qt({
3911
+ rand: i,
3912
+ maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3913
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3914
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3915
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3916
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? v.edgeStiffness,
3917
+ convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? v.convergenceVelocity,
3918
+ maxForce: (r == null ? void 0 : r.maxForce) ?? v.maxForce,
3919
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3920
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? v.barnesHutTheta,
3921
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3909
3922
  });
3910
3923
  }
3911
3924
  }
3912
- }, Zt = (r) => r instanceof j ? {
3925
+ }, _t = {
3926
+ staticNodeResolver: () => !1
3927
+ }, er = (r) => ({
3928
+ algorithm: Jt((r == null ? void 0 : r.algorithm) ?? {}),
3929
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? _t.staticNodeResolver
3930
+ }), tr = (r) => r instanceof j ? {
3913
3931
  type: "manual",
3914
3932
  trigger: r
3915
3933
  } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
3916
3934
  type: "topologyChangeMacrotask"
3917
3935
  } : {
3918
3936
  type: "topologyChangeMicrotask"
3919
- }, Jt = (r) => {
3937
+ }, rr = (r) => {
3920
3938
  var e, t;
3921
3939
  switch (r == null ? void 0 : r.type) {
3922
3940
  case "custom":
3923
3941
  return r.instance;
3924
3942
  default: {
3925
- const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), o = We(s[0], s[1], s[2], s[3]);
3926
- return new qt({
3943
+ const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), i = We(s[0], s[1], s[2], s[3]);
3944
+ return new Zt({
3927
3945
  dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
3928
3946
  maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
3929
- rand: o,
3947
+ rand: i,
3930
3948
  nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3931
3949
  nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3932
3950
  edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
@@ -3939,10 +3957,13 @@ const Oe = (r) => {
3939
3957
  });
3940
3958
  }
3941
3959
  }
3942
- }, _t = (r) => ({
3943
- algorithm: Jt(r == null ? void 0 : r.algorithm),
3944
- applyOn: Zt(r == null ? void 0 : r.applyOn)
3945
- }), er = (r, e) => ({
3960
+ }, sr = {
3961
+ staticNodeResolver: () => !1
3962
+ }, or = (r) => ({
3963
+ algorithm: rr(r == null ? void 0 : r.algorithm),
3964
+ applyOn: tr(r == null ? void 0 : r.applyOn),
3965
+ staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? sr.staticNodeResolver
3966
+ }), ir = (r, e) => ({
3946
3967
  ...r,
3947
3968
  onNodeDragStarted: (t) => {
3948
3969
  e.add(t), r.onNodeDragStarted(t);
@@ -3950,41 +3971,44 @@ const Oe = (r) => {
3950
3971
  onNodeDragFinished: (t) => {
3951
3972
  e.delete(t), r.onNodeDragFinished(t);
3952
3973
  }
3953
- }), tr = (r, e) => {
3974
+ }), nr = (r, e) => {
3954
3975
  r.onBeforeNodeRemoved.subscribe((t) => {
3955
3976
  e.delete(t);
3956
3977
  }), r.onBeforeClear.subscribe(() => {
3957
3978
  e.clear();
3958
3979
  });
3959
- };
3960
- class or {
3980
+ }, ar = (r, e) => ({
3981
+ ...r,
3982
+ staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
3983
+ });
3984
+ class cr {
3961
3985
  constructor(e) {
3962
- i(this, "used", !1);
3963
- i(this, "canvasDefaults", {});
3964
- i(this, "dragConfig", {});
3965
- i(this, "transformConfig", {});
3966
- i(this, "backgroundConfig", {});
3967
- i(this, "connectablePortsConfig", {});
3968
- i(this, "draggableEdgesConfig", {});
3969
- i(this, "virtualScrollConfig");
3970
- i(this, "layoutConfig", {});
3971
- i(this, "animatedLayoutConfig", {});
3972
- i(this, "hasDraggableNodes", !1);
3973
- i(this, "hasTransformableViewport", !1);
3974
- i(this, "hasNodeResizeReactiveEdges", !1);
3975
- i(this, "hasBackground", !1);
3976
- i(this, "hasUserConnectablePorts", !1);
3977
- i(this, "hasUserDraggableEdges", !1);
3978
- i(this, "hasAnimatedLayout", !1);
3979
- i(this, "hasLayout", !1);
3980
- i(this, "boxRenderingTrigger", new j());
3981
- i(this, "graphStore");
3982
- i(this, "viewportStore");
3983
- i(this, "graph");
3984
- i(this, "viewport");
3985
- i(this, "window", window);
3986
- i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3987
- this.element = e, this.viewportStore = new Qe(this.element), this.viewport = new Re(this.viewportStore), this.graphStore = new Ae(), this.graph = new Le(this.graphStore);
3986
+ o(this, "used", !1);
3987
+ o(this, "canvasDefaults", {});
3988
+ o(this, "dragConfig", {});
3989
+ o(this, "transformConfig", {});
3990
+ o(this, "backgroundConfig", {});
3991
+ o(this, "connectablePortsConfig", {});
3992
+ o(this, "draggableEdgesConfig", {});
3993
+ o(this, "virtualScrollConfig");
3994
+ o(this, "layoutConfig", {});
3995
+ o(this, "animatedLayoutConfig", {});
3996
+ o(this, "hasDraggableNodes", !1);
3997
+ o(this, "hasTransformableViewport", !1);
3998
+ o(this, "hasNodeResizeReactiveEdges", !1);
3999
+ o(this, "hasBackground", !1);
4000
+ o(this, "hasUserConnectablePorts", !1);
4001
+ o(this, "hasUserDraggableEdges", !1);
4002
+ o(this, "hasAnimatedLayout", !1);
4003
+ o(this, "hasLayout", !1);
4004
+ o(this, "boxRenderingTrigger", new j());
4005
+ o(this, "graphStore");
4006
+ o(this, "viewportStore");
4007
+ o(this, "graph");
4008
+ o(this, "viewport");
4009
+ o(this, "window", window);
4010
+ o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
4011
+ this.element = e, this.viewportStore = new Ze(this.element), this.viewport = new Re(this.viewportStore), this.graphStore = new Ae(), this.graph = new Le(this.graphStore);
3988
4012
  }
3989
4013
  /**
3990
4014
  * specifies default values for graph entities
@@ -4052,9 +4076,9 @@ class or {
4052
4076
  */
4053
4077
  build() {
4054
4078
  if (this.used)
4055
- throw new Ht("CanvasBuilder is a single use object");
4079
+ throw new Yt("CanvasBuilder is a single use object");
4056
4080
  this.used = !0;
4057
- const e = new Nt(this.element), t = this.createHtmlView(e.main), s = Lt(this.canvasDefaults), o = new ve(
4081
+ const e = new Mt(this.element), t = this.createHtmlView(e.main), s = Vt(this.canvasDefaults), i = new ve(
4058
4082
  this.graph,
4059
4083
  this.viewport,
4060
4084
  this.graphStore,
@@ -4063,29 +4087,29 @@ class or {
4063
4087
  s
4064
4088
  );
4065
4089
  if (this.hasBackground && _.configure(
4066
- o,
4067
- Bt(this.backgroundConfig),
4090
+ i,
4091
+ Wt(this.backgroundConfig),
4068
4092
  e.background
4069
- ), this.hasNodeResizeReactiveEdges && q.configure(o), this.hasDraggableNodes) {
4070
- let a = Rt(this.dragConfig);
4071
- this.hasAnimatedLayout && (a = er(
4093
+ ), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
4094
+ let a = Ft(this.dragConfig);
4095
+ this.hasAnimatedLayout && (a = ir(
4072
4096
  a,
4073
4097
  this.animationStaticNodes
4074
- )), Z.configure(
4075
- o,
4098
+ )), q.configure(
4099
+ i,
4076
4100
  e.main,
4077
4101
  this.window,
4078
4102
  a
4079
4103
  );
4080
4104
  }
4081
4105
  if (this.hasUserConnectablePorts) {
4082
- const a = Ot(
4106
+ const a = zt(
4083
4107
  this.connectablePortsConfig,
4084
4108
  s.edges.shapeFactory,
4085
4109
  s.ports.direction
4086
4110
  );
4087
4111
  ee.configure(
4088
- o,
4112
+ i,
4089
4113
  e.overlayConnectablePorts,
4090
4114
  this.viewportStore,
4091
4115
  this.window,
@@ -4093,46 +4117,49 @@ class or {
4093
4117
  );
4094
4118
  }
4095
4119
  if (this.hasUserDraggableEdges) {
4096
- const a = Wt(
4120
+ const a = kt(
4097
4121
  this.draggableEdgesConfig,
4098
- o.graph
4122
+ i.graph
4099
4123
  );
4100
4124
  te.configure(
4101
- o,
4125
+ i,
4102
4126
  e.overlayDraggableEdges,
4103
4127
  this.viewportStore,
4104
4128
  this.window,
4105
4129
  a
4106
4130
  );
4107
4131
  }
4108
- this.virtualScrollConfig !== void 0 ? J.configure(
4109
- o,
4132
+ if (this.virtualScrollConfig !== void 0 ? J.configure(
4133
+ i,
4110
4134
  e.main,
4111
4135
  this.window,
4112
- ye(this.transformConfig),
4136
+ fe(this.transformConfig),
4113
4137
  this.boxRenderingTrigger,
4114
- kt(this.virtualScrollConfig)
4138
+ Ht(this.virtualScrollConfig)
4115
4139
  ) : this.hasTransformableViewport && H.configure(
4116
- o,
4140
+ i,
4117
4141
  e.main,
4118
4142
  this.window,
4119
- ye(this.transformConfig)
4120
- ), this.hasLayout && Pt.configure(
4121
- o,
4122
- _t(this.layoutConfig)
4123
- ), this.hasAnimatedLayout && (tr(
4124
- o.graph,
4125
- this.animationStaticNodes
4126
- ), se.configure(
4127
- o,
4128
- Qt(this.animatedLayoutConfig),
4129
- this.animationStaticNodes,
4130
- this.window
4131
- ));
4143
+ fe(this.transformConfig)
4144
+ ), this.hasLayout && Tt.configure(
4145
+ i,
4146
+ or(this.layoutConfig)
4147
+ ), this.hasAnimatedLayout) {
4148
+ let a = er(
4149
+ this.animatedLayoutConfig
4150
+ );
4151
+ this.hasDraggableNodes && (nr(
4152
+ i.graph,
4153
+ this.animationStaticNodes
4154
+ ), a = ar(
4155
+ a,
4156
+ this.animationStaticNodes
4157
+ )), se.configure(i, a, this.window);
4158
+ }
4132
4159
  const n = () => {
4133
- e.destroy(), o.onBeforeDestroy.unsubscribe(n);
4160
+ e.destroy(), i.onBeforeDestroy.unsubscribe(n);
4134
4161
  };
4135
- return o.onBeforeDestroy.subscribe(n), o;
4162
+ return i.onBeforeDestroy.subscribe(n), i;
4136
4163
  }
4137
4164
  createHtmlView(e) {
4138
4165
  let t = new me(
@@ -4144,14 +4171,14 @@ class or {
4144
4171
  t,
4145
4172
  this.graphStore,
4146
4173
  this.boxRenderingTrigger,
4147
- zt(this.virtualScrollConfig)
4148
- )), new qe(t, this.graphStore);
4174
+ Xt(this.virtualScrollConfig)
4175
+ )), new Ke(t, this.graphStore);
4149
4176
  }
4150
4177
  }
4151
4178
  export {
4152
4179
  ut as BezierEdgeShape,
4153
- or as CanvasBuilder,
4154
- Ht as CanvasBuilderError,
4180
+ cr as CanvasBuilder,
4181
+ Yt as CanvasBuilderError,
4155
4182
  A as CanvasError,
4156
4183
  M as ConnectionCategory,
4157
4184
  De as DirectEdgeShape,
@@ -4159,7 +4186,7 @@ export {
4159
4186
  pt as HorizontalEdgeShape,
4160
4187
  vt as InteractiveEdgeError,
4161
4188
  Me as InteractiveEdgeShape,
4162
- sr as MidpointEdgeShape,
4189
+ dr as MidpointEdgeShape,
4163
4190
  wt as StraightEdgeShape,
4164
- ft as VerticalEdgeShape
4191
+ yt as VerticalEdgeShape
4165
4192
  };