@html-graph/html-graph 7.2.0 → 7.3.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,27 +1,27 @@
1
- var Fe = Object.defineProperty;
2
- var Oe = (r, e, t) => e in r ? Fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => Oe(r, typeof e != "symbol" ? e + "" : e, t);
4
- const N = (r, e) => ({
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);
4
+ const D = (r, e) => ({
5
5
  x: r.scale * e.x + r.x,
6
6
  y: r.scale * e.y + r.y
7
7
  });
8
- var C = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(C || {});
9
- const We = () => {
8
+ var R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
9
+ const He = () => {
10
10
  const r = document.createElement("div");
11
11
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
12
- }, ke = () => {
12
+ }, Xe = () => {
13
13
  const r = document.createElement("div");
14
14
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
15
- }, ze = (r) => {
15
+ }, Ye = (r) => {
16
16
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
17
17
  };
18
- class ye {
18
+ class me {
19
19
  constructor(e, t, s) {
20
- o(this, "host", We());
21
- o(this, "container", ke());
22
- o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
- o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
24
- o(this, "applyTransform", () => {
20
+ i(this, "host", He());
21
+ i(this, "container", Xe());
22
+ i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
+ i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
24
+ i(this, "applyTransform", () => {
25
25
  const e = this.viewportStore.getContentMatrix();
26
26
  this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
27
27
  });
@@ -29,7 +29,7 @@ class ye {
29
29
  }
30
30
  attachNode(e) {
31
31
  const t = this.graphStore.getNode(e);
32
- ze(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
32
+ Ye(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
33
33
  }
34
34
  detachNode(e) {
35
35
  const t = this.graphStore.getNode(e);
@@ -54,7 +54,7 @@ class ye {
54
54
  this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
55
55
  }
56
56
  updateNodePosition(e) {
57
- 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;
57
+ 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;
58
58
  t.element.style.transform = `translate(${d}px, ${c}px)`;
59
59
  }
60
60
  updateNodePriority(e) {
@@ -64,87 +64,87 @@ class ye {
64
64
  updateEdgeShape(e) {
65
65
  const t = this.edgeIdToElementMap.get(e);
66
66
  this.container.removeChild(t);
67
- const i = this.graphStore.getEdge(e).payload.shape.svg;
68
- this.edgeIdToElementMap.set(e, i), this.container.appendChild(i);
67
+ const o = this.graphStore.getEdge(e).payload.shape.svg;
68
+ this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
69
69
  }
70
70
  renderEdge(e) {
71
- 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(), c = this.createEdgeRenderPort(
71
+ 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(), c = this.createEdgeRenderPort(
72
72
  s,
73
73
  n,
74
74
  h,
75
75
  d
76
76
  ), g = this.createEdgeRenderPort(
77
- i,
77
+ o,
78
78
  a,
79
79
  h,
80
80
  d
81
81
  );
82
- let l = C.Line;
83
- s.element === i.element ? l = C.PortCycle : s.nodeId === i.nodeId && (l = C.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
82
+ let l = R.Line;
83
+ s.element === o.element ? l = R.PortCycle : s.nodeId === o.nodeId && (l = R.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
84
84
  }
85
85
  updateEdgePriority(e) {
86
86
  const t = this.graphStore.getEdge(e);
87
87
  t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
88
88
  }
89
- createEdgeRenderPort(e, t, s, i) {
89
+ createEdgeRenderPort(e, t, s, o) {
90
90
  const n = {
91
91
  x: t.left - s.left,
92
92
  y: t.top - s.top
93
- }, a = N(i, n);
93
+ }, a = D(o, n);
94
94
  return {
95
95
  x: a.x,
96
96
  y: a.y,
97
- width: t.width * i.scale,
98
- height: t.height * i.scale,
97
+ width: t.width * o.scale,
98
+ height: t.height * o.scale,
99
99
  direction: e.payload.direction
100
100
  };
101
101
  }
102
102
  }
103
- class Xe {
103
+ class Ge {
104
104
  constructor(e) {
105
- o(this, "xFrom", 1 / 0);
106
- o(this, "yFrom", 1 / 0);
107
- o(this, "xTo", 1 / 0);
108
- o(this, "yTo", 1 / 0);
105
+ i(this, "xFrom", 1 / 0);
106
+ i(this, "yFrom", 1 / 0);
107
+ i(this, "xTo", 1 / 0);
108
+ i(this, "yTo", 1 / 0);
109
109
  this.graphStore = e;
110
110
  }
111
111
  setRenderingBox(e) {
112
112
  this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
113
113
  }
114
114
  hasNode(e) {
115
- const t = this.graphStore.getNode(e).payload, { x: s, y: i } = t;
116
- return s >= this.xFrom && s <= this.xTo && i >= this.yFrom && i <= this.yTo;
115
+ const t = this.graphStore.getNode(e).payload, { x: s, y: o } = t;
116
+ return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
117
117
  }
118
118
  hasEdge(e) {
119
- 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);
119
+ 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);
120
120
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
121
121
  }
122
122
  }
123
- class Ye {
124
- constructor(e, t, s, i) {
125
- o(this, "attachedNodes", /* @__PURE__ */ new Set());
126
- o(this, "attachedEdges", /* @__PURE__ */ new Set());
127
- o(this, "renderingBox");
128
- o(this, "updateViewport", (e) => {
123
+ class je {
124
+ constructor(e, t, s, o) {
125
+ i(this, "attachedNodes", /* @__PURE__ */ new Set());
126
+ i(this, "attachedEdges", /* @__PURE__ */ new Set());
127
+ i(this, "renderingBox");
128
+ i(this, "updateViewport", (e) => {
129
129
  this.renderingBox.setRenderingBox(e);
130
- const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
130
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
131
131
  this.graphStore.getAllNodeIds().forEach((a) => {
132
132
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
133
133
  h && !d ? t.add(a) : !h && d && s.add(a);
134
134
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
135
135
  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;
136
- 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);
136
+ 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);
137
137
  }), n.forEach((a) => {
138
138
  this.handleDetachEdge(a);
139
139
  }), s.forEach((a) => {
140
140
  this.handleDetachNode(a);
141
141
  }), t.forEach((a) => {
142
142
  this.attachedNodes.has(a) || this.handleAttachNode(a);
143
- }), i.forEach((a) => {
143
+ }), o.forEach((a) => {
144
144
  this.handleAttachEdge(a);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Xe(this.graphStore), this.trigger.subscribe(this.updateViewport);
147
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ge(this.graphStore), this.trigger.subscribe(this.updateViewport);
148
148
  }
149
149
  attachNode(e) {
150
150
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -182,8 +182,8 @@ class Ye {
182
182
  this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
183
183
  }
184
184
  attachEdgeEntities(e) {
185
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
186
- this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
185
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId;
186
+ this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(o) || this.handleAttachNode(o), this.handleAttachEdge(e);
187
187
  }
188
188
  handleAttachNode(e) {
189
189
  this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -198,10 +198,10 @@ class Ye {
198
198
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
199
199
  }
200
200
  }
201
- class He {
201
+ class Ke {
202
202
  constructor(e, t) {
203
- o(this, "deferredNodes", /* @__PURE__ */ new Set());
204
- o(this, "deferredEdges", /* @__PURE__ */ new Set());
203
+ i(this, "deferredNodes", /* @__PURE__ */ new Set());
204
+ i(this, "deferredEdges", /* @__PURE__ */ new Set());
205
205
  this.htmlView = e, this.graphStore = t;
206
206
  }
207
207
  attachNode(e) {
@@ -245,16 +245,16 @@ class He {
245
245
  this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
246
246
  }
247
247
  isEdgeValid(e) {
248
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to);
249
- return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(i.nodeId));
248
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to);
249
+ return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
250
250
  }
251
251
  tryAttachEdge(e) {
252
252
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
253
253
  }
254
254
  }
255
- class G {
255
+ class j {
256
256
  constructor() {
257
- o(this, "callbacks", /* @__PURE__ */ new Set());
257
+ i(this, "callbacks", /* @__PURE__ */ new Set());
258
258
  }
259
259
  subscribe(e) {
260
260
  this.callbacks.add(e);
@@ -268,13 +268,13 @@ class G {
268
268
  });
269
269
  }
270
270
  }
271
- const x = () => {
272
- const r = new G();
271
+ const E = () => {
272
+ const r = new j();
273
273
  return [r, r];
274
274
  };
275
- class Y {
275
+ class X {
276
276
  constructor(e) {
277
- o(this, "counter", 0);
277
+ i(this, "counter", 0);
278
278
  this.checkExists = e;
279
279
  }
280
280
  create(e) {
@@ -288,80 +288,80 @@ class Y {
288
288
  this.counter = 0;
289
289
  }
290
290
  }
291
- class P extends Error {
291
+ class b extends Error {
292
292
  constructor() {
293
293
  super(...arguments);
294
- o(this, "name", "CanvasError");
294
+ i(this, "name", "CanvasError");
295
295
  }
296
296
  }
297
297
  class ve {
298
- constructor(e, t, s, i, n, a) {
299
- o(this, "nodeIdGenerator", new Y(
298
+ constructor(e, t, s, o, n, a) {
299
+ i(this, "nodeIdGenerator", new X(
300
300
  (e) => this.graphStore.getNode(e) !== void 0
301
301
  ));
302
- o(this, "portIdGenerator", new Y(
302
+ i(this, "portIdGenerator", new X(
303
303
  (e) => this.graphStore.getPort(e) !== void 0
304
304
  ));
305
- o(this, "edgeIdGenerator", new Y(
305
+ i(this, "edgeIdGenerator", new X(
306
306
  (e) => this.graphStore.getEdge(e) !== void 0
307
307
  ));
308
- o(this, "onAfterNodeAdded", (e) => {
308
+ i(this, "onAfterNodeAdded", (e) => {
309
309
  this.htmlView.attachNode(e);
310
310
  });
311
- o(this, "onAfterNodeUpdated", (e) => {
311
+ i(this, "onAfterNodeUpdated", (e) => {
312
312
  this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
313
313
  this.htmlView.renderEdge(s);
314
314
  });
315
315
  });
316
- o(this, "onAfterNodePriorityUpdated", (e) => {
316
+ i(this, "onAfterNodePriorityUpdated", (e) => {
317
317
  this.htmlView.updateNodePriority(e);
318
318
  });
319
- o(this, "onBeforeNodeRemoved", (e) => {
319
+ i(this, "onBeforeNodeRemoved", (e) => {
320
320
  this.graphStore.getNodePortIds(e).forEach((t) => {
321
321
  this.unmarkPort(t);
322
322
  }), this.htmlView.detachNode(e);
323
323
  });
324
- o(this, "onAfterPortUpdated", (e) => {
324
+ i(this, "onAfterPortUpdated", (e) => {
325
325
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
326
326
  this.htmlView.renderEdge(s);
327
327
  });
328
328
  });
329
- o(this, "onBeforePortUnmarked", (e) => {
329
+ i(this, "onBeforePortUnmarked", (e) => {
330
330
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
331
331
  this.removeEdge(t);
332
332
  });
333
333
  });
334
- o(this, "onAfterEdgeAdded", (e) => {
334
+ i(this, "onAfterEdgeAdded", (e) => {
335
335
  this.htmlView.attachEdge(e);
336
336
  });
337
- o(this, "onAfterEdgeShapeUpdated", (e) => {
337
+ i(this, "onAfterEdgeShapeUpdated", (e) => {
338
338
  this.htmlView.updateEdgeShape(e);
339
339
  });
340
- o(this, "onAfterEdgeUpdated", (e) => {
340
+ i(this, "onAfterEdgeUpdated", (e) => {
341
341
  this.htmlView.renderEdge(e);
342
342
  });
343
- o(this, "onAfterEdgePriorityUpdated", (e) => {
343
+ i(this, "onAfterEdgePriorityUpdated", (e) => {
344
344
  this.htmlView.updateEdgePriority(e);
345
345
  });
346
- o(this, "onBeforeEdgeRemoved", (e) => {
346
+ i(this, "onBeforeEdgeRemoved", (e) => {
347
347
  this.htmlView.detachEdge(e);
348
348
  });
349
- o(this, "onBeforeClear", () => {
349
+ i(this, "onBeforeClear", () => {
350
350
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
351
351
  });
352
- o(this, "onBeforeDestroyEmitter");
353
- o(this, "destroyed", !1);
352
+ i(this, "onBeforeDestroyEmitter");
353
+ i(this, "destroyed", !1);
354
354
  /**
355
355
  * emits event just before destruction of canvas
356
356
  */
357
- o(this, "onBeforeDestroy");
358
- 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(
357
+ i(this, "onBeforeDestroy");
358
+ 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(
359
359
  this.onAfterNodePriorityUpdated
360
360
  ), 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(
361
361
  this.onAfterEdgeShapeUpdated
362
362
  ), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
363
363
  this.onAfterEdgePriorityUpdated
364
- ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = x();
364
+ ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
365
365
  }
366
366
  /**
367
367
  * adds new node
@@ -369,9 +369,9 @@ class ve {
369
369
  addNode(e) {
370
370
  const t = this.nodeIdGenerator.create(e.id);
371
371
  if (this.graphStore.getNode(t) !== void 0)
372
- throw new P("failed to add node with existing id");
372
+ throw new b("failed to add node with existing id");
373
373
  if (this.graphStore.getElementNodeId(e.element) !== void 0)
374
- throw new P(
374
+ throw new b(
375
375
  "failed to add node with html element already in use by another node"
376
376
  );
377
377
  if (this.graphStore.addNode({
@@ -396,7 +396,7 @@ class ve {
396
396
  */
397
397
  updateNode(e, t) {
398
398
  if (this.graphStore.getNode(e) === void 0)
399
- throw new P("failed to update nonexistent node");
399
+ throw new b("failed to update nonexistent node");
400
400
  return this.graphStore.updateNode(e, t ?? {}), this;
401
401
  }
402
402
  /**
@@ -406,7 +406,7 @@ class ve {
406
406
  */
407
407
  removeNode(e) {
408
408
  if (this.graphStore.getNode(e) === void 0)
409
- throw new P("failed to remove nonexistent node");
409
+ throw new b("failed to remove nonexistent node");
410
410
  return this.graphStore.removeNode(e), this;
411
411
  }
412
412
  /**
@@ -415,9 +415,9 @@ class ve {
415
415
  markPort(e) {
416
416
  const t = this.portIdGenerator.create(e.id);
417
417
  if (this.graphStore.getPort(t) !== void 0)
418
- throw new P("failed to add port with existing id");
418
+ throw new b("failed to add port with existing id");
419
419
  if (this.graphStore.getNode(e.nodeId) === void 0)
420
- throw new P("failed to mark port for nonexistent node");
420
+ throw new b("failed to mark port for nonexistent node");
421
421
  return this.graphStore.addPort({
422
422
  id: t,
423
423
  element: e.element,
@@ -430,7 +430,7 @@ class ve {
430
430
  */
431
431
  updatePort(e, t) {
432
432
  if (this.graphStore.getPort(e) === void 0)
433
- throw new P("failed to update nonexistent port");
433
+ throw new b("failed to update nonexistent port");
434
434
  return this.graphStore.updatePort(e, t ?? {}), this;
435
435
  }
436
436
  /**
@@ -439,7 +439,7 @@ class ve {
439
439
  */
440
440
  unmarkPort(e) {
441
441
  if (this.graphStore.getPort(e) === void 0)
442
- throw new P("failed to unmark nonexistent port");
442
+ throw new b("failed to unmark nonexistent port");
443
443
  return this.graphStore.removePort(e), this;
444
444
  }
445
445
  /**
@@ -448,11 +448,11 @@ class ve {
448
448
  addEdge(e) {
449
449
  const t = this.edgeIdGenerator.create(e.id);
450
450
  if (this.graphStore.getEdge(t) !== void 0)
451
- throw new P("failed to add edge with existing id");
451
+ throw new b("failed to add edge with existing id");
452
452
  if (this.graphStore.getPort(e.from) === void 0)
453
- throw new P("failed to add edge from nonexistent port");
453
+ throw new b("failed to add edge from nonexistent port");
454
454
  if (this.graphStore.getPort(e.to) === void 0)
455
- throw new P("failed to add edge to nonexistent port");
455
+ throw new b("failed to add edge to nonexistent port");
456
456
  return this.graphStore.addEdge({
457
457
  id: t,
458
458
  from: e.from,
@@ -466,7 +466,7 @@ class ve {
466
466
  */
467
467
  updateEdge(e, t) {
468
468
  if (this.graphStore.getEdge(e) === void 0)
469
- throw new P("failed to update nonexistent edge");
469
+ throw new b("failed to update nonexistent edge");
470
470
  return this.graphStore.updateEdge(e, t ?? {}), this;
471
471
  }
472
472
  /**
@@ -474,7 +474,7 @@ class ve {
474
474
  */
475
475
  removeEdge(e) {
476
476
  if (this.graphStore.getEdge(e) === void 0)
477
- throw new P("failed to remove nonexistent edge");
477
+ throw new b("failed to remove nonexistent edge");
478
478
  return this.graphStore.removeEdge(e), this;
479
479
  }
480
480
  /**
@@ -510,10 +510,10 @@ class ve {
510
510
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
511
511
  }
512
512
  }
513
- class je {
513
+ class Qe {
514
514
  constructor() {
515
- o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
516
- o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
515
+ i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
516
+ i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
517
517
  }
518
518
  addRecord(e, t) {
519
519
  const s = this.singleToMultiMap.get(e);
@@ -550,43 +550,43 @@ class je {
550
550
  return this.multiToSingleMap.get(e) !== void 0;
551
551
  }
552
552
  }
553
- class Ee {
553
+ class xe {
554
554
  constructor() {
555
- o(this, "nodes", /* @__PURE__ */ new Map());
556
- o(this, "ports", /* @__PURE__ */ new Map());
557
- o(this, "edges", /* @__PURE__ */ new Map());
558
- o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
559
- o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
560
- o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
561
- o(this, "portCycleEdges", /* @__PURE__ */ new Map());
562
- o(this, "elementPorts", new je());
563
- o(this, "afterNodeAddedEmitter");
564
- o(this, "onAfterNodeAdded");
565
- o(this, "afterNodeUpdatedEmitter");
566
- o(this, "onAfterNodeUpdated");
567
- o(this, "afterNodePriorityUpdatedEmitter");
568
- o(this, "onAfterNodePriorityUpdated");
569
- o(this, "beforeNodeRemovedEmitter");
570
- o(this, "onBeforeNodeRemoved");
571
- o(this, "afterPortAddedEmitter");
572
- o(this, "onAfterPortAdded");
573
- o(this, "afterPortUpdatedEmitter");
574
- o(this, "onAfterPortUpdated");
575
- o(this, "beforePortRemovedEmitter");
576
- o(this, "onBeforePortRemoved");
577
- o(this, "afterEdgeAddedEmitter");
578
- o(this, "onAfterEdgeAdded");
579
- o(this, "afterEdgeShapeUpdatedEmitter");
580
- o(this, "onAfterEdgeShapeUpdated");
581
- o(this, "afterEdgeUpdatedEmitter");
582
- o(this, "onAfterEdgeUpdated");
583
- o(this, "afterEdgePriorityUpdatedEmitter");
584
- o(this, "onAfterEdgePriorityUpdated");
585
- o(this, "beforeEdgeRemovedEmitter");
586
- o(this, "onBeforeEdgeRemoved");
587
- o(this, "beforeClearEmitter");
588
- o(this, "onBeforeClear");
589
- [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();
555
+ i(this, "nodes", /* @__PURE__ */ new Map());
556
+ i(this, "ports", /* @__PURE__ */ new Map());
557
+ i(this, "edges", /* @__PURE__ */ new Map());
558
+ i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
559
+ i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
560
+ i(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
561
+ i(this, "portCycleEdges", /* @__PURE__ */ new Map());
562
+ i(this, "elementPorts", new Qe());
563
+ i(this, "afterNodeAddedEmitter");
564
+ i(this, "onAfterNodeAdded");
565
+ i(this, "afterNodeUpdatedEmitter");
566
+ i(this, "onAfterNodeUpdated");
567
+ i(this, "afterNodePriorityUpdatedEmitter");
568
+ i(this, "onAfterNodePriorityUpdated");
569
+ i(this, "beforeNodeRemovedEmitter");
570
+ i(this, "onBeforeNodeRemoved");
571
+ i(this, "afterPortAddedEmitter");
572
+ i(this, "onAfterPortAdded");
573
+ i(this, "afterPortUpdatedEmitter");
574
+ i(this, "onAfterPortUpdated");
575
+ i(this, "beforePortRemovedEmitter");
576
+ i(this, "onBeforePortRemoved");
577
+ i(this, "afterEdgeAddedEmitter");
578
+ i(this, "onAfterEdgeAdded");
579
+ i(this, "afterEdgeShapeUpdatedEmitter");
580
+ i(this, "onAfterEdgeShapeUpdated");
581
+ i(this, "afterEdgeUpdatedEmitter");
582
+ i(this, "onAfterEdgeUpdated");
583
+ i(this, "afterEdgePriorityUpdatedEmitter");
584
+ i(this, "onAfterEdgePriorityUpdated");
585
+ i(this, "beforeEdgeRemovedEmitter");
586
+ i(this, "onBeforeEdgeRemoved");
587
+ i(this, "beforeClearEmitter");
588
+ i(this, "onBeforeClear");
589
+ [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = E(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = E(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = E(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = E(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = E(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = E(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = E(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = E(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = E(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = E(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = E(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = E(), [this.beforeClearEmitter, this.onBeforeClear] = E();
590
590
  }
591
591
  addNode(e) {
592
592
  const t = /* @__PURE__ */ new Map(), s = {
@@ -655,11 +655,11 @@ class Ee {
655
655
  }
656
656
  updateEdge(e, t) {
657
657
  if (t.from !== void 0 || t.to !== void 0) {
658
- const i = this.edges.get(e), n = i.payload;
658
+ const o = this.edges.get(e), n = o.payload;
659
659
  this.removeEdgeInternal(e), this.addEdgeInternal({
660
660
  id: e,
661
- from: t.from ?? i.from,
662
- to: t.to ?? i.to,
661
+ from: t.from ?? o.from,
662
+ to: t.to ?? o.to,
663
663
  shape: n.shape,
664
664
  priority: n.priority
665
665
  });
@@ -697,8 +697,8 @@ class Ee {
697
697
  }
698
698
  getNodeIncomingEdgeIds(e) {
699
699
  const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
700
- return t.forEach((i) => {
701
- this.getPortIncomingEdgeIds(i).filter((n) => {
700
+ return t.forEach((o) => {
701
+ this.getPortIncomingEdgeIds(o).filter((n) => {
702
702
  const a = this.getEdge(n);
703
703
  return this.getPort(a.from).nodeId !== e;
704
704
  }).forEach((n) => {
@@ -708,8 +708,8 @@ class Ee {
708
708
  }
709
709
  getNodeOutgoingEdgeIds(e) {
710
710
  const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
711
- return t.forEach((i) => {
712
- this.getPortOutgoingEdgeIds(i).filter((n) => {
711
+ return t.forEach((o) => {
712
+ this.getPortOutgoingEdgeIds(o).filter((n) => {
713
713
  const a = this.getEdge(n);
714
714
  return this.getPort(a.to).nodeId !== e;
715
715
  }).forEach((n) => {
@@ -719,10 +719,10 @@ class Ee {
719
719
  }
720
720
  getNodeCycleEdgeIds(e) {
721
721
  const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
722
- return t.forEach((i) => {
723
- this.getPortCycleEdgeIds(i).forEach((n) => {
722
+ return t.forEach((o) => {
723
+ this.getPortCycleEdgeIds(o).forEach((n) => {
724
724
  s.push(n);
725
- }), this.getPortIncomingEdgeIds(i).filter((n) => {
725
+ }), this.getPortIncomingEdgeIds(o).filter((n) => {
726
726
  const a = this.getEdge(n);
727
727
  return this.getPort(a.to).nodeId === e;
728
728
  }).forEach((n) => {
@@ -732,12 +732,12 @@ class Ee {
732
732
  }
733
733
  getNodeAdjacentEdgeIds(e) {
734
734
  const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
735
- return t.forEach((i) => {
736
- this.getPortIncomingEdgeIds(i).forEach((n) => {
735
+ return t.forEach((o) => {
736
+ this.getPortIncomingEdgeIds(o).forEach((n) => {
737
737
  s.push(n);
738
- }), this.getPortOutgoingEdgeIds(i).forEach((n) => {
738
+ }), this.getPortOutgoingEdgeIds(o).forEach((n) => {
739
739
  s.push(n);
740
- }), this.getPortCycleEdgeIds(i).forEach((n) => {
740
+ }), this.getPortCycleEdgeIds(o).forEach((n) => {
741
741
  s.push(n);
742
742
  });
743
743
  }), s;
@@ -753,8 +753,8 @@ class Ee {
753
753
  }), 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);
754
754
  }
755
755
  removeEdgeInternal(e) {
756
- const t = this.edges.get(e), s = t.from, i = t.to;
757
- 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);
756
+ const t = this.edges.get(e), s = t.from, o = t.to;
757
+ 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);
758
758
  }
759
759
  }
760
760
  const ce = (r) => ({
@@ -766,13 +766,13 @@ const ce = (r) => ({
766
766
  x: 0,
767
767
  y: 0
768
768
  };
769
- class Ge {
769
+ class Ze {
770
770
  constructor() {
771
- o(this, "viewportMatrix", le);
772
- o(this, "contentMatrix", le);
773
- o(this, "afterUpdateEmitter");
774
- o(this, "onAfterUpdated");
775
- [this.afterUpdateEmitter, this.onAfterUpdated] = x();
771
+ i(this, "viewportMatrix", le);
772
+ i(this, "contentMatrix", le);
773
+ i(this, "afterUpdateEmitter");
774
+ i(this, "onAfterUpdated");
775
+ [this.afterUpdateEmitter, this.onAfterUpdated] = E();
776
776
  }
777
777
  getViewportMatrix() {
778
778
  return this.viewportMatrix;
@@ -797,23 +797,23 @@ class Ge {
797
797
  }
798
798
  class K {
799
799
  constructor(e) {
800
- o(this, "elementToNodeId", /* @__PURE__ */ new Map());
801
- o(this, "nodesResizeObserver");
802
- o(this, "onAfterNodeAdded", (e) => {
800
+ i(this, "elementToNodeId", /* @__PURE__ */ new Map());
801
+ i(this, "nodesResizeObserver");
802
+ i(this, "onAfterNodeAdded", (e) => {
803
803
  const t = this.canvas.graph.getNode(e);
804
804
  this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
805
805
  });
806
- o(this, "onBeforeNodeRemoved", (e) => {
806
+ i(this, "onBeforeNodeRemoved", (e) => {
807
807
  const t = this.canvas.graph.getNode(e);
808
808
  this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
809
809
  });
810
- o(this, "onBeforeClear", () => {
810
+ i(this, "onBeforeClear", () => {
811
811
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
812
812
  });
813
813
  this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
814
814
  t.forEach((s) => {
815
- const i = s.target;
816
- this.handleNodeResize(i);
815
+ const o = s.target;
816
+ this.handleNodeResize(o);
817
817
  });
818
818
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
819
819
  }
@@ -825,12 +825,12 @@ class K {
825
825
  this.canvas.updateNode(t);
826
826
  }
827
827
  }
828
- const Ke = (r, e, t) => {
829
- const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
830
- return e >= s && e <= s + n && t >= i && t <= i + a;
831
- }, Ze = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, V = (r, e, t, s) => Ke(e, t, s) && Ze(r, t, s), B = (r, e) => {
828
+ const Je = (r, e, t) => {
829
+ const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
830
+ return e >= s && e <= s + n && t >= o && t <= o + a;
831
+ }, qe = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, F = (r, e, t, s) => Je(e, t, s) && qe(r, t, s), U = (r, e) => {
832
832
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
833
- }, F = (r) => {
833
+ }, B = (r) => {
834
834
  const e = document.createElement("div");
835
835
  return {
836
836
  id: r.overlayId,
@@ -845,7 +845,7 @@ const Ke = (r, e, t) => {
845
845
  }
846
846
  ]
847
847
  };
848
- }, Je = (r, e) => {
848
+ }, _e = (r, e) => {
849
849
  let t = e;
850
850
  for (; t !== null; ) {
851
851
  const s = r.getElementPortIds(t)[0] ?? null;
@@ -868,20 +868,20 @@ function* Ae(r, e) {
868
868
  const t = r.elementsFromPoint(e.x, e.y);
869
869
  for (const s of t) {
870
870
  if (s.shadowRoot !== null) {
871
- const i = Ae(s.shadowRoot, e);
872
- for (const n of i)
871
+ const o = Ae(s.shadowRoot, e);
872
+ for (const n of o)
873
873
  yield n;
874
874
  }
875
875
  yield s;
876
876
  }
877
877
  }
878
- const xe = (r, e) => {
878
+ const Ee = (r, e) => {
879
879
  const t = Ae(document, e);
880
880
  for (const s of t) {
881
- const i = Je(r, s);
882
- if (i.status === "portFound")
883
- return i.portId;
884
- if (i.status === "nodeEncountered")
881
+ const o = _e(r, s);
882
+ if (o.status === "portFound")
883
+ return o.portId;
884
+ if (o.status === "nodeEncountered")
885
885
  return null;
886
886
  }
887
887
  return null;
@@ -890,22 +890,22 @@ var T = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r
890
890
  const Se = (r, e) => ({
891
891
  x: r / 2,
892
892
  y: e / 2
893
- }), u = {
893
+ }), p = {
894
894
  x: 0,
895
895
  y: 0
896
- }, y = (r, e, t) => ({
896
+ }, m = (r, e, t) => ({
897
897
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
898
898
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
899
- }), Pe = (r, e) => {
899
+ }), be = (r, e) => {
900
900
  const t = {
901
901
  x: r.x + r.width / 2,
902
902
  y: r.y + r.height / 2
903
903
  }, s = {
904
904
  x: e.x + e.width / 2,
905
905
  y: e.y + e.height / 2
906
- }, 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;
906
+ }, 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;
907
907
  return {
908
- x: i,
908
+ x: o,
909
909
  y: n,
910
910
  width: a,
911
911
  height: h,
@@ -916,18 +916,18 @@ const Se = (r, e) => ({
916
916
  x: e * r.x + (1 - e) / 2 * s.x,
917
917
  y: t * r.y + (1 - t) / 2 * s.y
918
918
  });
919
- class Qe {
919
+ class et {
920
920
  constructor(e) {
921
- o(this, "path");
922
- o(this, "midpoint");
921
+ i(this, "path");
922
+ i(this, "midpoint");
923
923
  this.params = e;
924
924
  const t = this.params.to;
925
925
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
926
- const s = y(
927
- { x: this.params.arrowLength, y: u.y },
926
+ const s = m(
927
+ { x: this.params.arrowLength, y: p.y },
928
928
  this.params.sourceDirection,
929
- u
930
- ), i = y(
929
+ p
930
+ ), o = m(
931
931
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
932
932
  this.params.targetDirection,
933
933
  this.params.to
@@ -935,288 +935,288 @@ class Qe {
935
935
  x: s.x + this.params.sourceDirection.x * this.params.curvature,
936
936
  y: s.y + this.params.sourceDirection.y * this.params.curvature
937
937
  }, a = {
938
- x: i.x - this.params.targetDirection.x * this.params.curvature,
939
- y: i.y - this.params.targetDirection.y * this.params.curvature
940
- }, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${u.x} ${u.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
938
+ x: o.x - this.params.targetDirection.x * this.params.curvature,
939
+ y: o.y - this.params.targetDirection.y * this.params.curvature
940
+ }, 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}`;
941
941
  this.path = `${d}${h}${c}`;
942
942
  }
943
943
  }
944
- class qe {
944
+ class tt {
945
945
  constructor(e) {
946
- o(this, "path");
947
- o(this, "midpoint");
946
+ i(this, "path");
947
+ i(this, "midpoint");
948
948
  this.params = e;
949
- const t = this.params.hasSourceArrow ? y(
950
- { x: this.params.arrowLength, y: u.y },
949
+ const t = this.params.hasSourceArrow ? m(
950
+ { x: this.params.arrowLength, y: p.y },
951
951
  this.params.sourceDirection,
952
- u
953
- ) : u, s = this.params.hasTargetArrow ? y(
952
+ p
953
+ ) : p, s = this.params.hasTargetArrow ? m(
954
954
  {
955
955
  x: this.params.to.x - this.params.arrowLength,
956
956
  y: this.params.to.y
957
957
  },
958
958
  this.params.targetDirection,
959
959
  this.params.to
960
- ) : 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 = y(
961
- { x: i, y: u.y },
960
+ ) : 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(
961
+ { x: o, y: p.y },
962
962
  this.params.sourceDirection,
963
- u
963
+ p
964
964
  ), g = {
965
965
  x: c.x + h,
966
966
  y: c.y + d
967
- }, l = y(
968
- { x: this.params.to.x - i, y: this.params.to.y },
967
+ }, l = m(
968
+ { x: this.params.to.x - o, y: this.params.to.y },
969
969
  this.params.targetDirection,
970
970
  this.params.to
971
- ), p = {
971
+ ), u = {
972
972
  x: l.x + h,
973
973
  y: l.y + d
974
974
  }, w = {
975
- x: (g.x + p.x) / 2,
976
- y: (g.y + p.y) / 2
977
- }, m = {
975
+ x: (g.x + u.x) / 2,
976
+ y: (g.y + u.y) / 2
977
+ }, y = {
978
978
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
979
979
  y: c.y + this.params.curvature * this.params.sourceDirection.y
980
- }, v = {
980
+ }, x = {
981
981
  x: l.x - this.params.curvature * this.params.targetDirection.x,
982
982
  y: l.y - this.params.curvature * this.params.targetDirection.y
983
- }, E = {
983
+ }, A = {
984
984
  x: c.x + h,
985
985
  y: c.y + d
986
- }, A = {
986
+ }, S = {
987
987
  x: l.x + h,
988
988
  y: l.y + d
989
989
  };
990
990
  this.path = [
991
991
  `M ${t.x} ${t.y}`,
992
992
  `L ${c.x} ${c.y}`,
993
- `C ${m.x} ${m.y} ${E.x} ${E.y} ${w.x} ${w.y}`,
994
- `C ${A.x} ${A.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
993
+ `C ${y.x} ${y.y} ${A.x} ${A.y} ${w.x} ${w.y}`,
994
+ `C ${S.x} ${S.y} ${x.x} ${x.y} ${l.x} ${l.y}`,
995
995
  `L ${s.x} ${s.y}`
996
996
  ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
997
997
  }
998
998
  }
999
- const Z = Object.freeze({
999
+ const Q = Object.freeze({
1000
1000
  edgeColor: "--edge-color"
1001
- }), be = (r) => {
1001
+ }), Pe = (r) => {
1002
1002
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1003
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
1003
+ 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;
1004
1004
  }, Te = (r) => {
1005
1005
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1006
- return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1006
+ return e.setAttribute("stroke", `var(${Q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1007
1007
  }, O = () => {
1008
1008
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
1009
- return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
1010
- }, De = () => {
1009
+ return r.setAttribute("fill", `var(${Q.edgeColor})`), r;
1010
+ }, Ce = () => {
1011
1011
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1012
1012
  return r.style.transformOrigin = "50% 50%", r;
1013
- }, Ne = (r, e) => {
1013
+ }, De = (r, e) => {
1014
1014
  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`;
1015
- }, R = (r, e) => {
1015
+ }, L = (r, e) => {
1016
1016
  const t = [];
1017
1017
  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) {
1018
1018
  const s = r.length - 1;
1019
- let i = 0, n = 0, a = 0;
1019
+ let o = 0, n = 0, a = 0;
1020
1020
  r.forEach((h, d) => {
1021
1021
  let c = 0, g = 0, l = 0;
1022
- const p = d > 0, w = d < s, m = p && w;
1023
- if (p && (c = -i, g = -n, l = a), w) {
1024
- const $ = r[d + 1];
1025
- i = $.x - h.x, n = $.y - h.y, a = Math.sqrt(i * i + n * n);
1022
+ const u = d > 0, w = d < s, y = u && w;
1023
+ if (u && (c = -o, g = -n, l = a), w) {
1024
+ const V = r[d + 1];
1025
+ o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
1026
1026
  }
1027
- const E = a !== 0 ? Math.min((m ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, A = m ? { x: h.x + i * E, y: h.y + n * E } : h, b = l !== 0 ? Math.min((m ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = m ? { x: h.x + c * b, y: h.y + g * b } : h;
1028
- d > 0 && t.push(`L ${M.x} ${M.y}`), m && t.push(
1029
- `C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
1027
+ const A = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, S = y ? { x: h.x + o * A, y: h.y + n * A } : h, P = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * P, y: h.y + g * P } : h;
1028
+ d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
1029
+ `C ${h.x} ${h.y} ${h.x} ${h.y} ${S.x} ${S.y}`
1030
1030
  );
1031
1031
  });
1032
1032
  }
1033
1033
  return t.join(" ");
1034
1034
  };
1035
- class _e {
1035
+ class rt {
1036
1036
  constructor(e) {
1037
- o(this, "path");
1038
- o(this, "midpoint");
1037
+ i(this, "path");
1038
+ i(this, "midpoint");
1039
1039
  this.params = e;
1040
1040
  const t = this.params.to;
1041
1041
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1042
- const s = this.params.hasSourceArrow ? y(
1043
- { x: this.params.arrowLength, y: u.y },
1042
+ const s = this.params.hasSourceArrow ? m(
1043
+ { x: this.params.arrowLength, y: p.y },
1044
1044
  this.params.sourceDirection,
1045
- u
1046
- ) : u, i = this.params.hasTargetArrow ? y(
1045
+ p
1046
+ ) : p, o = this.params.hasTargetArrow ? m(
1047
1047
  {
1048
1048
  x: this.params.to.x - this.params.arrowLength,
1049
1049
  y: this.params.to.y
1050
1050
  },
1051
1051
  this.params.targetDirection,
1052
1052
  this.params.to
1053
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1054
- { x: a, y: u.y },
1053
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1054
+ { x: a, y: p.y },
1055
1055
  this.params.sourceDirection,
1056
- u
1057
- ), d = y(
1056
+ p
1057
+ ), d = m(
1058
1058
  { x: this.params.to.x - a, y: this.params.to.y },
1059
1059
  this.params.targetDirection,
1060
1060
  this.params.to
1061
1061
  ), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
1062
1062
  x: this.params.flipX > 0 ? c : -n,
1063
1063
  y: h.y
1064
- }, p = { x: l.x, y: g }, w = {
1064
+ }, u = { x: l.x, y: g }, w = {
1065
1065
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1066
1066
  y: d.y
1067
- }, m = { x: w.x, y: g };
1068
- this.path = R(
1069
- [s, h, l, p, m, w, d, i],
1067
+ }, y = { x: w.x, y: g };
1068
+ this.path = L(
1069
+ [s, h, l, u, y, w, d, o],
1070
1070
  this.params.roundness
1071
1071
  );
1072
1072
  }
1073
1073
  }
1074
- class et {
1074
+ class st {
1075
1075
  constructor(e) {
1076
- o(this, "path");
1077
- o(this, "midpoint");
1076
+ i(this, "path");
1077
+ i(this, "midpoint");
1078
1078
  this.params = e;
1079
- const t = this.params.hasSourceArrow ? y(
1080
- { x: this.params.arrowLength, y: u.y },
1079
+ const t = this.params.hasSourceArrow ? m(
1080
+ { x: this.params.arrowLength, y: p.y },
1081
1081
  this.params.sourceDirection,
1082
- u
1083
- ) : u, s = this.params.hasTargetArrow ? y(
1082
+ p
1083
+ ) : p, s = this.params.hasTargetArrow ? m(
1084
1084
  {
1085
1085
  x: this.params.to.x - this.params.arrowLength,
1086
1086
  y: this.params.to.y
1087
1087
  },
1088
1088
  this.params.targetDirection,
1089
1089
  this.params.to
1090
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1091
- { x: i, y: u.y },
1090
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1091
+ { x: o, y: p.y },
1092
1092
  this.params.sourceDirection,
1093
- u
1094
- ), 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 = y(
1095
- { x: this.params.to.x - i, y: this.params.to.y },
1093
+ p
1094
+ ), 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(
1095
+ { x: this.params.to.x - o, y: this.params.to.y },
1096
1096
  this.params.targetDirection,
1097
1097
  this.params.to
1098
- ), p = { x: l.x + d, y: l.y + c }, w = { x: (g.x + p.x) / 2, y: (g.y + p.y) / 2 };
1099
- this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = R(
1100
- [t, n, g, p, l, s],
1098
+ ), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
1099
+ this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = L(
1100
+ [t, n, g, u, l, s],
1101
1101
  this.params.roundness
1102
1102
  );
1103
1103
  }
1104
1104
  }
1105
- class tt {
1105
+ class ot {
1106
1106
  constructor(e) {
1107
- o(this, "path");
1108
- o(this, "midpoint");
1107
+ i(this, "path");
1108
+ i(this, "midpoint");
1109
1109
  this.params = e;
1110
1110
  const t = this.params.to;
1111
1111
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1112
- const s = this.params.hasSourceArrow ? y(
1113
- { x: this.params.arrowLength, y: u.y },
1112
+ const s = this.params.hasSourceArrow ? m(
1113
+ { x: this.params.arrowLength, y: p.y },
1114
1114
  this.params.sourceDirection,
1115
- u
1116
- ) : u, i = this.params.hasTargetArrow ? y(
1115
+ p
1116
+ ) : p, o = this.params.hasTargetArrow ? m(
1117
1117
  {
1118
1118
  x: this.params.to.x - this.params.arrowLength,
1119
1119
  y: this.params.to.y
1120
1120
  },
1121
1121
  this.params.targetDirection,
1122
1122
  this.params.to
1123
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
1124
- { x: n, y: u.y },
1123
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
1124
+ { x: n, y: p.y },
1125
1125
  this.params.sourceDirection,
1126
- u
1127
- ), h = y(
1126
+ p
1127
+ ), h = m(
1128
1128
  { x: this.params.to.x - n, y: this.params.to.y },
1129
1129
  this.params.targetDirection,
1130
1130
  this.params.to
1131
1131
  );
1132
- this.path = R([s, a, h, i], this.params.roundness);
1132
+ this.path = L([s, a, h, o], this.params.roundness);
1133
1133
  }
1134
1134
  }
1135
- class rt {
1135
+ class it {
1136
1136
  constructor(e) {
1137
- o(this, "path");
1138
- o(this, "midpoint");
1137
+ i(this, "path");
1138
+ i(this, "midpoint");
1139
1139
  this.params = e;
1140
1140
  const t = this.params.to;
1141
1141
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1142
- const s = this.params.hasSourceArrow ? y(
1143
- { x: this.params.arrowLength, y: u.y },
1142
+ const s = this.params.hasSourceArrow ? m(
1143
+ { x: this.params.arrowLength, y: p.y },
1144
1144
  this.params.sourceDirection,
1145
- u
1146
- ) : u, i = this.params.hasTargetArrow ? y(
1145
+ p
1146
+ ) : p, o = this.params.hasTargetArrow ? m(
1147
1147
  {
1148
1148
  x: this.params.to.x - this.params.arrowLength,
1149
1149
  y: this.params.to.y
1150
1150
  },
1151
1151
  this.params.targetDirection,
1152
1152
  this.params.to
1153
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1154
- { x: a, y: u.y },
1153
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1154
+ { x: a, y: p.y },
1155
1155
  this.params.sourceDirection,
1156
- u
1157
- ), d = y(
1156
+ p
1157
+ ), d = m(
1158
1158
  { x: this.params.to.x - a, y: this.params.to.y },
1159
1159
  this.params.targetDirection,
1160
1160
  this.params.to
1161
1161
  ), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
1162
1162
  x: h.x,
1163
1163
  y: this.params.flipY > 0 ? c : -n
1164
- }, p = { x: g, y: l.y }, w = {
1164
+ }, u = { x: g, y: l.y }, w = {
1165
1165
  x: d.x,
1166
1166
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1167
- }, m = { x: g, y: w.y };
1168
- this.path = R(
1169
- [s, h, l, p, m, w, d, i],
1167
+ }, y = { x: g, y: w.y };
1168
+ this.path = L(
1169
+ [s, h, l, u, y, w, d, o],
1170
1170
  this.params.roundness
1171
1171
  );
1172
1172
  }
1173
1173
  }
1174
- class J {
1174
+ class Z {
1175
1175
  constructor(e) {
1176
- o(this, "path");
1177
- o(this, "midpoint");
1176
+ i(this, "path");
1177
+ i(this, "midpoint");
1178
1178
  this.params = e;
1179
- const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
1180
- { x: this.params.arrowLength, y: u.y },
1181
- { x: i, y: u.y },
1182
- { x: i, y: this.params.side },
1179
+ const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
1180
+ { x: this.params.arrowLength, y: p.y },
1181
+ { x: o, y: p.y },
1182
+ { x: o, y: this.params.side },
1183
1183
  { x: n, y: this.params.side },
1184
1184
  { x: n, y: -this.params.side },
1185
- { x: i, y: -this.params.side },
1186
- { x: i, y: u.y },
1187
- { x: this.params.arrowLength, y: u.y }
1185
+ { x: o, y: -this.params.side },
1186
+ { x: o, y: p.y },
1187
+ { x: this.params.arrowLength, y: p.y }
1188
1188
  ].map(
1189
- (c) => y(c, this.params.sourceDirection, u)
1190
- ), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
1191
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1189
+ (c) => m(c, this.params.sourceDirection, p)
1190
+ ), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
1191
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${L(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1192
1192
  }
1193
1193
  }
1194
- class st {
1194
+ class nt {
1195
1195
  constructor(e) {
1196
- o(this, "path");
1197
- o(this, "midpoint");
1196
+ i(this, "path");
1197
+ i(this, "midpoint");
1198
1198
  this.params = e;
1199
- 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 = [
1200
- { x: this.params.arrowLength, y: u.y },
1199
+ 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 = [
1200
+ { x: this.params.arrowLength, y: p.y },
1201
1201
  { x: c, y: n },
1202
1202
  { x: c, y: -n },
1203
1203
  { x: d, y: 0 }
1204
1204
  ].map(
1205
- (m) => y(m, this.params.sourceDirection, u)
1206
- ), p = [
1205
+ (y) => m(y, this.params.sourceDirection, p)
1206
+ ), u = [
1207
1207
  `M ${l[0].x} ${l[0].y}`,
1208
1208
  `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
1209
1209
  `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
1210
1210
  `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
1211
1211
  ].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
1212
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${p}`, this.midpoint = l[3];
1212
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
1213
1213
  }
1214
1214
  }
1215
- class ot {
1215
+ class at {
1216
1216
  constructor(e) {
1217
- o(this, "path");
1218
- o(this, "midpoint");
1219
- o(this, "diagonalDistance");
1217
+ i(this, "path");
1218
+ i(this, "midpoint");
1219
+ i(this, "diagonalDistance");
1220
1220
  this.params = e;
1221
1221
  const t = this.params.to;
1222
1222
  if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
@@ -1227,56 +1227,56 @@ class ot {
1227
1227
  this.path = "";
1228
1228
  return;
1229
1229
  }
1230
- const i = this.createDirectLinePoint({
1230
+ const o = this.createDirectLinePoint({
1231
1231
  offset: this.params.sourceOffset,
1232
1232
  hasArrow: this.params.hasSourceArrow,
1233
1233
  flip: 1,
1234
- shift: u
1234
+ shift: p
1235
1235
  }), n = this.createDirectLinePoint({
1236
1236
  offset: this.params.targetOffset,
1237
1237
  hasArrow: this.params.hasTargetArrow,
1238
1238
  flip: -1,
1239
1239
  shift: this.params.to
1240
1240
  });
1241
- this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
1241
+ this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
1242
1242
  }
1243
1243
  createDirectLinePoint(e) {
1244
- const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
1244
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
1245
1245
  return {
1246
- x: this.params.to.x * i + e.shift.x,
1247
- y: this.params.to.y * i + e.shift.y
1246
+ x: this.params.to.x * o + e.shift.x,
1247
+ y: this.params.to.y * o + e.shift.y
1248
1248
  };
1249
1249
  }
1250
1250
  }
1251
- class it {
1251
+ class ht {
1252
1252
  constructor(e) {
1253
- o(this, "path");
1254
- o(this, "midpoint");
1253
+ i(this, "path");
1254
+ i(this, "midpoint");
1255
1255
  this.params = e;
1256
- const t = this.params.hasSourceArrow ? y(
1257
- { x: this.params.arrowLength, y: u.y },
1256
+ const t = this.params.hasSourceArrow ? m(
1257
+ { x: this.params.arrowLength, y: p.y },
1258
1258
  this.params.sourceDirection,
1259
- u
1260
- ) : u, s = this.params.hasTargetArrow ? y(
1259
+ p
1260
+ ) : p, s = this.params.hasTargetArrow ? m(
1261
1261
  {
1262
1262
  x: this.params.to.x - this.params.arrowLength,
1263
1263
  y: this.params.to.y
1264
1264
  },
1265
1265
  this.params.targetDirection,
1266
1266
  this.params.to
1267
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1268
- { x: i, y: u.y },
1267
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1268
+ { x: o, y: p.y },
1269
1269
  this.params.sourceDirection,
1270
- u
1271
- ), a = y(
1272
- { x: this.params.to.x - i, y: this.params.to.y },
1270
+ p
1271
+ ), a = m(
1272
+ { x: this.params.to.x - o, y: this.params.to.y },
1273
1273
  this.params.targetDirection,
1274
1274
  this.params.to
1275
1275
  ), 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 = {
1276
1276
  x: (n.x + a.x) / 2,
1277
1277
  y: g
1278
1278
  };
1279
- this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = R(
1279
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
1280
1280
  [
1281
1281
  t,
1282
1282
  n,
@@ -1289,35 +1289,35 @@ class it {
1289
1289
  );
1290
1290
  }
1291
1291
  }
1292
- class nt {
1292
+ class dt {
1293
1293
  constructor(e) {
1294
- o(this, "path");
1295
- o(this, "midpoint");
1294
+ i(this, "path");
1295
+ i(this, "midpoint");
1296
1296
  this.params = e;
1297
- const t = this.params.hasSourceArrow ? y(
1298
- { x: this.params.arrowLength, y: u.y },
1297
+ const t = this.params.hasSourceArrow ? m(
1298
+ { x: this.params.arrowLength, y: p.y },
1299
1299
  this.params.sourceDirection,
1300
- u
1301
- ) : u, s = this.params.hasTargetArrow ? y(
1300
+ p
1301
+ ) : p, s = this.params.hasTargetArrow ? m(
1302
1302
  {
1303
1303
  x: this.params.to.x - this.params.arrowLength,
1304
1304
  y: this.params.to.y
1305
1305
  },
1306
1306
  this.params.targetDirection,
1307
1307
  this.params.to
1308
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1309
- { x: i, y: u.y },
1308
+ ) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
1309
+ { x: o, y: p.y },
1310
1310
  this.params.sourceDirection,
1311
- u
1312
- ), a = y(
1313
- { x: this.params.to.x - i, y: this.params.to.y },
1311
+ p
1312
+ ), a = m(
1313
+ { x: this.params.to.x - o, y: this.params.to.y },
1314
1314
  this.params.targetDirection,
1315
1315
  this.params.to
1316
1316
  ), 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 = {
1317
1317
  x: g,
1318
1318
  y: (n.y + a.y) / 2
1319
1319
  };
1320
- this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = R(
1320
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
1321
1321
  [
1322
1322
  t,
1323
1323
  n,
@@ -1355,22 +1355,22 @@ const f = Object.freeze({
1355
1355
  }), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1356
1356
  class k {
1357
1357
  constructor(e) {
1358
- o(this, "svg");
1359
- o(this, "group", De());
1360
- o(this, "line");
1361
- o(this, "sourceArrow", null);
1362
- o(this, "targetArrow", null);
1363
- o(this, "onAfterRender");
1364
- o(this, "afterRenderEmitter");
1365
- o(this, "arrowRenderer");
1366
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = be(e.color), this.svg.appendChild(this.group), this.line = Te(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1358
+ i(this, "svg");
1359
+ i(this, "group", Ce());
1360
+ i(this, "line");
1361
+ i(this, "sourceArrow", null);
1362
+ i(this, "targetArrow", null);
1363
+ i(this, "onAfterRender");
1364
+ i(this, "afterRenderEmitter");
1365
+ i(this, "arrowRenderer");
1366
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), 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 = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1367
1367
  }
1368
1368
  render(e) {
1369
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Pe(
1369
+ const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1370
1370
  e.from,
1371
1371
  e.to
1372
1372
  );
1373
- Ne(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1373
+ De(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1374
1374
  const d = ge(
1375
1375
  e.from.direction,
1376
1376
  a,
@@ -1380,12 +1380,12 @@ class k {
1380
1380
  a,
1381
1381
  h
1382
1382
  ), g = {
1383
- x: i,
1383
+ x: o,
1384
1384
  y: n
1385
1385
  };
1386
- let l = { x: -c.x, y: -c.y }, p;
1387
- e.category === C.PortCycle ? (p = this.params.createCyclePath, l = d) : e.category === C.NodeCycle ? p = this.params.createDetourPath : p = this.params.createLinePath;
1388
- const w = p(
1386
+ let l = { x: -c.x, y: -c.y }, u;
1387
+ e.category === R.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === R.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1388
+ const w = u(
1389
1389
  d,
1390
1390
  c,
1391
1391
  g,
@@ -1393,46 +1393,46 @@ class k {
1393
1393
  h
1394
1394
  );
1395
1395
  this.line.setAttribute("d", w.path);
1396
- let m = null;
1397
- this.sourceArrow && (m = this.arrowRenderer({
1396
+ let y = null;
1397
+ this.sourceArrow && (y = this.arrowRenderer({
1398
1398
  direction: d,
1399
- shift: u,
1399
+ shift: p,
1400
1400
  arrowLength: this.params.arrowLength
1401
- }), this.sourceArrow.setAttribute("d", m));
1402
- let v = null;
1403
- this.targetArrow && (v = this.arrowRenderer({
1401
+ }), this.sourceArrow.setAttribute("d", y));
1402
+ let x = null;
1403
+ this.targetArrow && (x = this.arrowRenderer({
1404
1404
  direction: l,
1405
1405
  shift: g,
1406
1406
  arrowLength: this.params.arrowLength
1407
- }), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
1407
+ }), this.targetArrow.setAttribute("d", x)), this.afterRenderEmitter.emit({
1408
1408
  edgePath: w,
1409
- sourceArrowPath: m,
1410
- targetArrowPath: v
1409
+ sourceArrowPath: y,
1410
+ targetArrowPath: x
1411
1411
  });
1412
1412
  }
1413
1413
  }
1414
- const at = (r) => (e) => {
1414
+ const ct = (r) => (e) => {
1415
1415
  const s = [
1416
- u,
1416
+ p,
1417
1417
  { x: e.arrowLength, y: r.radius },
1418
1418
  { x: e.arrowLength, y: -r.radius }
1419
1419
  ].map(
1420
- (h) => y(h, e.direction, u)
1420
+ (h) => m(h, e.direction, p)
1421
1421
  ).map((h) => ({
1422
1422
  x: h.x + e.shift.x,
1423
1423
  y: h.y + e.shift.y
1424
- })), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1425
- return `${i} ${n} ${a} Z`;
1426
- }, ht = (r) => (e) => {
1427
- 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 = [u, { x: a, y: -h }, { x: a, y: h }].map(
1428
- (m) => y(m, e.direction, u)
1429
- ).map((m) => ({
1430
- x: m.x + e.shift.x,
1431
- y: m.y + e.shift.y
1432
- })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, p = `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}`;
1433
- return `${g} ${l} ${p} ${w}`;
1434
- }, dt = (r) => (e) => {
1435
- const t = r.smallRadius, s = r.radius, i = y(
1424
+ })), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1425
+ return `${o} ${n} ${a} Z`;
1426
+ }, lt = (r) => (e) => {
1427
+ 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(
1428
+ (y) => m(y, e.direction, p)
1429
+ ).map((y) => ({
1430
+ x: y.x + e.shift.x,
1431
+ y: y.y + e.shift.y
1432
+ })), 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}`;
1433
+ return `${g} ${l} ${u} ${w}`;
1434
+ }, gt = (r) => (e) => {
1435
+ const t = r.smallRadius, s = r.radius, o = m(
1436
1436
  {
1437
1437
  x: e.arrowLength,
1438
1438
  y: 0
@@ -1445,8 +1445,8 @@ const at = (r) => (e) => {
1445
1445
  x: e.arrowLength + r.smallRadius,
1446
1446
  y: 0
1447
1447
  }
1448
- ), a = [u, { x: i.x, y: -i.y }, i].map(
1449
- (l) => y(l, e.direction, u)
1448
+ ), a = [p, { x: o.x, y: -o.y }, o].map(
1449
+ (l) => m(l, e.direction, p)
1450
1450
  ).map((l) => ({
1451
1451
  x: l.x + e.shift.x,
1452
1452
  y: l.y + e.shift.y
@@ -1457,39 +1457,39 @@ const at = (r) => (e) => {
1457
1457
  return r;
1458
1458
  switch (r.type) {
1459
1459
  case "triangle":
1460
- return at({
1460
+ return ct({
1461
1461
  radius: r.radius ?? f.polygonArrowRadius
1462
1462
  });
1463
1463
  case "arc":
1464
- return ht({
1464
+ return lt({
1465
1465
  radius: r.radius ?? f.circleArrowRadius
1466
1466
  });
1467
1467
  default:
1468
- return dt({
1468
+ return gt({
1469
1469
  smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
1470
1470
  angle: r.angle ?? f.wedgeArrowAngle,
1471
1471
  radius: r.radius ?? f.wedgeArrowRadius
1472
1472
  });
1473
1473
  }
1474
1474
  };
1475
- class ct {
1475
+ class ut {
1476
1476
  constructor(e) {
1477
- o(this, "svg");
1478
- o(this, "group");
1479
- o(this, "line");
1480
- o(this, "sourceArrow");
1481
- o(this, "targetArrow");
1482
- o(this, "onAfterRender");
1483
- o(this, "arrowLength");
1484
- o(this, "curvature");
1485
- o(this, "portCycleRadius");
1486
- o(this, "portCycleSmallRadius");
1487
- o(this, "detourDirection");
1488
- o(this, "detourDistance");
1489
- o(this, "hasSourceArrow");
1490
- o(this, "hasTargetArrow");
1491
- o(this, "pathShape");
1492
- o(this, "createCyclePath", (e) => new st({
1477
+ i(this, "svg");
1478
+ i(this, "group");
1479
+ i(this, "line");
1480
+ i(this, "sourceArrow");
1481
+ i(this, "targetArrow");
1482
+ i(this, "onAfterRender");
1483
+ i(this, "arrowLength");
1484
+ i(this, "curvature");
1485
+ i(this, "portCycleRadius");
1486
+ i(this, "portCycleSmallRadius");
1487
+ i(this, "detourDirection");
1488
+ i(this, "detourDistance");
1489
+ i(this, "hasSourceArrow");
1490
+ i(this, "hasTargetArrow");
1491
+ i(this, "pathShape");
1492
+ i(this, "createCyclePath", (e) => new nt({
1493
1493
  sourceDirection: e,
1494
1494
  radius: this.portCycleRadius,
1495
1495
  smallRadius: this.portCycleSmallRadius,
@@ -1497,11 +1497,11 @@ class ct {
1497
1497
  hasSourceArrow: this.hasSourceArrow,
1498
1498
  hasTargetArrow: this.hasTargetArrow
1499
1499
  }));
1500
- o(this, "createDetourPath", (e, t, s, i, n) => new qe({
1500
+ i(this, "createDetourPath", (e, t, s, o, n) => new tt({
1501
1501
  to: s,
1502
1502
  sourceDirection: e,
1503
1503
  targetDirection: t,
1504
- flipX: i,
1504
+ flipX: o,
1505
1505
  flipY: n,
1506
1506
  arrowLength: this.arrowLength,
1507
1507
  detourDirection: this.detourDirection,
@@ -1510,7 +1510,7 @@ class ct {
1510
1510
  hasSourceArrow: this.hasSourceArrow,
1511
1511
  hasTargetArrow: this.hasTargetArrow
1512
1512
  }));
1513
- o(this, "createLinePath", (e, t, s) => new Qe({
1513
+ i(this, "createLinePath", (e, t, s) => new et({
1514
1514
  to: s,
1515
1515
  sourceDirection: e,
1516
1516
  targetDirection: t,
@@ -1535,23 +1535,23 @@ class ct {
1535
1535
  this.pathShape.render(e);
1536
1536
  }
1537
1537
  }
1538
- class lt {
1538
+ class pt {
1539
1539
  constructor(e) {
1540
- o(this, "svg");
1541
- o(this, "group");
1542
- o(this, "line");
1543
- o(this, "sourceArrow");
1544
- o(this, "targetArrow");
1545
- o(this, "onAfterRender");
1546
- o(this, "arrowLength");
1547
- o(this, "arrowOffset");
1548
- o(this, "roundness");
1549
- o(this, "cycleSquareSide");
1550
- o(this, "detourDistance");
1551
- o(this, "hasSourceArrow");
1552
- o(this, "hasTargetArrow");
1553
- o(this, "pathShape");
1554
- o(this, "createCyclePath", (e) => new J({
1540
+ i(this, "svg");
1541
+ i(this, "group");
1542
+ i(this, "line");
1543
+ i(this, "sourceArrow");
1544
+ i(this, "targetArrow");
1545
+ i(this, "onAfterRender");
1546
+ i(this, "arrowLength");
1547
+ i(this, "arrowOffset");
1548
+ i(this, "roundness");
1549
+ i(this, "cycleSquareSide");
1550
+ i(this, "detourDistance");
1551
+ i(this, "hasSourceArrow");
1552
+ i(this, "hasTargetArrow");
1553
+ i(this, "pathShape");
1554
+ i(this, "createCyclePath", (e) => new Z({
1555
1555
  sourceDirection: e,
1556
1556
  arrowLength: this.arrowLength,
1557
1557
  side: this.cycleSquareSide,
@@ -1560,11 +1560,11 @@ class lt {
1560
1560
  hasSourceArrow: this.hasSourceArrow,
1561
1561
  hasTargetArrow: this.hasTargetArrow
1562
1562
  }));
1563
- o(this, "createDetourPath", (e, t, s, i, n) => new it({
1563
+ i(this, "createDetourPath", (e, t, s, o, n) => new ht({
1564
1564
  to: s,
1565
1565
  sourceDirection: e,
1566
1566
  targetDirection: t,
1567
- flipX: i,
1567
+ flipX: o,
1568
1568
  flipY: n,
1569
1569
  arrowLength: this.arrowLength,
1570
1570
  arrowOffset: this.arrowOffset,
@@ -1573,11 +1573,11 @@ class lt {
1573
1573
  hasSourceArrow: this.hasSourceArrow,
1574
1574
  hasTargetArrow: this.hasTargetArrow
1575
1575
  }));
1576
- o(this, "createLinePath", (e, t, s, i) => new _e({
1576
+ i(this, "createLinePath", (e, t, s, o) => new rt({
1577
1577
  to: s,
1578
1578
  sourceDirection: e,
1579
1579
  targetDirection: t,
1580
- flipX: i,
1580
+ flipX: o,
1581
1581
  arrowLength: this.arrowLength,
1582
1582
  arrowOffset: this.arrowOffset,
1583
1583
  roundness: this.roundness,
@@ -1606,24 +1606,24 @@ class lt {
1606
1606
  this.pathShape.render(e);
1607
1607
  }
1608
1608
  }
1609
- class gt {
1609
+ class wt {
1610
1610
  constructor(e) {
1611
- o(this, "svg");
1612
- o(this, "group");
1613
- o(this, "line");
1614
- o(this, "sourceArrow");
1615
- o(this, "targetArrow");
1616
- o(this, "onAfterRender");
1617
- o(this, "arrowLength");
1618
- o(this, "arrowOffset");
1619
- o(this, "roundness");
1620
- o(this, "cycleSquareSide");
1621
- o(this, "detourDirection");
1622
- o(this, "detourDistance");
1623
- o(this, "hasSourceArrow");
1624
- o(this, "hasTargetArrow");
1625
- o(this, "pathShape");
1626
- o(this, "createCyclePath", (e) => new J({
1611
+ i(this, "svg");
1612
+ i(this, "group");
1613
+ i(this, "line");
1614
+ i(this, "sourceArrow");
1615
+ i(this, "targetArrow");
1616
+ i(this, "onAfterRender");
1617
+ i(this, "arrowLength");
1618
+ i(this, "arrowOffset");
1619
+ i(this, "roundness");
1620
+ i(this, "cycleSquareSide");
1621
+ i(this, "detourDirection");
1622
+ i(this, "detourDistance");
1623
+ i(this, "hasSourceArrow");
1624
+ i(this, "hasTargetArrow");
1625
+ i(this, "pathShape");
1626
+ i(this, "createCyclePath", (e) => new Z({
1627
1627
  sourceDirection: e,
1628
1628
  arrowLength: this.arrowLength,
1629
1629
  side: this.cycleSquareSide,
@@ -1632,11 +1632,11 @@ class gt {
1632
1632
  hasSourceArrow: this.hasSourceArrow,
1633
1633
  hasTargetArrow: this.hasTargetArrow
1634
1634
  }));
1635
- o(this, "createDetourPath", (e, t, s, i, n) => new et({
1635
+ i(this, "createDetourPath", (e, t, s, o, n) => new st({
1636
1636
  to: s,
1637
1637
  sourceDirection: e,
1638
1638
  targetDirection: t,
1639
- flipX: i,
1639
+ flipX: o,
1640
1640
  flipY: n,
1641
1641
  arrowLength: this.arrowLength,
1642
1642
  arrowOffset: this.arrowOffset,
@@ -1646,7 +1646,7 @@ class gt {
1646
1646
  hasSourceArrow: this.hasSourceArrow,
1647
1647
  hasTargetArrow: this.hasTargetArrow
1648
1648
  }));
1649
- o(this, "createLinePath", (e, t, s) => new tt({
1649
+ i(this, "createLinePath", (e, t, s) => new ot({
1650
1650
  to: s,
1651
1651
  sourceDirection: e,
1652
1652
  targetDirection: t,
@@ -1678,23 +1678,23 @@ class gt {
1678
1678
  this.pathShape.render(e);
1679
1679
  }
1680
1680
  }
1681
- class ut {
1681
+ class ft {
1682
1682
  constructor(e) {
1683
- o(this, "svg");
1684
- o(this, "group");
1685
- o(this, "line");
1686
- o(this, "sourceArrow");
1687
- o(this, "targetArrow");
1688
- o(this, "onAfterRender");
1689
- o(this, "arrowLength");
1690
- o(this, "arrowOffset");
1691
- o(this, "roundness");
1692
- o(this, "cycleSquareSide");
1693
- o(this, "detourDistance");
1694
- o(this, "hasSourceArrow");
1695
- o(this, "hasTargetArrow");
1696
- o(this, "pathShape");
1697
- o(this, "createCyclePath", (e) => new J({
1683
+ i(this, "svg");
1684
+ i(this, "group");
1685
+ i(this, "line");
1686
+ i(this, "sourceArrow");
1687
+ i(this, "targetArrow");
1688
+ i(this, "onAfterRender");
1689
+ i(this, "arrowLength");
1690
+ i(this, "arrowOffset");
1691
+ i(this, "roundness");
1692
+ i(this, "cycleSquareSide");
1693
+ i(this, "detourDistance");
1694
+ i(this, "hasSourceArrow");
1695
+ i(this, "hasTargetArrow");
1696
+ i(this, "pathShape");
1697
+ i(this, "createCyclePath", (e) => new Z({
1698
1698
  sourceDirection: e,
1699
1699
  arrowLength: this.arrowLength,
1700
1700
  side: this.cycleSquareSide,
@@ -1703,11 +1703,11 @@ class ut {
1703
1703
  hasSourceArrow: this.hasSourceArrow,
1704
1704
  hasTargetArrow: this.hasTargetArrow
1705
1705
  }));
1706
- o(this, "createDetourPath", (e, t, s, i, n) => new nt({
1706
+ i(this, "createDetourPath", (e, t, s, o, n) => new dt({
1707
1707
  to: s,
1708
1708
  sourceDirection: e,
1709
1709
  targetDirection: t,
1710
- flipX: i,
1710
+ flipX: o,
1711
1711
  flipY: n,
1712
1712
  arrowLength: this.arrowLength,
1713
1713
  arrowOffset: this.arrowOffset,
@@ -1716,7 +1716,7 @@ class ut {
1716
1716
  hasSourceArrow: this.hasSourceArrow,
1717
1717
  hasTargetArrow: this.hasTargetArrow
1718
1718
  }));
1719
- o(this, "createLinePath", (e, t, s, i, n) => new rt({
1719
+ i(this, "createLinePath", (e, t, s, o, n) => new it({
1720
1720
  to: s,
1721
1721
  sourceDirection: e,
1722
1722
  targetDirection: t,
@@ -1749,30 +1749,30 @@ class ut {
1749
1749
  this.pathShape.render(e);
1750
1750
  }
1751
1751
  }
1752
- class Me {
1752
+ class Ne {
1753
1753
  constructor(e) {
1754
- o(this, "svg");
1755
- o(this, "group", De());
1756
- o(this, "line");
1757
- o(this, "sourceArrow", null);
1758
- o(this, "targetArrow", null);
1759
- o(this, "color");
1760
- o(this, "width");
1761
- o(this, "arrowLength");
1762
- o(this, "sourceOffset");
1763
- o(this, "targetOffset");
1764
- o(this, "onAfterRender");
1765
- o(this, "afterRenderEmitter");
1766
- o(this, "arrowRenderer");
1767
- [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 = I((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 = be(this.color), this.svg.appendChild(this.group), this.line = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1754
+ i(this, "svg");
1755
+ i(this, "group", Ce());
1756
+ i(this, "line");
1757
+ i(this, "sourceArrow", null);
1758
+ i(this, "targetArrow", null);
1759
+ i(this, "color");
1760
+ i(this, "width");
1761
+ i(this, "arrowLength");
1762
+ i(this, "sourceOffset");
1763
+ i(this, "targetOffset");
1764
+ i(this, "onAfterRender");
1765
+ i(this, "afterRenderEmitter");
1766
+ i(this, "arrowRenderer");
1767
+ [this.afterRenderEmitter, this.onAfterRender] = E(), 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 = I((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 = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
1768
1768
  }
1769
1769
  render(e) {
1770
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Pe(
1770
+ const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = be(
1771
1771
  e.from,
1772
1772
  e.to
1773
1773
  );
1774
- Ne(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1775
- const d = { x: i, y: n }, c = new ot({
1774
+ De(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1775
+ const d = { x: o, y: n }, c = new at({
1776
1776
  to: d,
1777
1777
  sourceOffset: this.sourceOffset,
1778
1778
  targetOffset: this.targetOffset,
@@ -1782,35 +1782,35 @@ class Me {
1782
1782
  });
1783
1783
  this.line.setAttribute("d", c.path);
1784
1784
  let g = null, l = null;
1785
- const p = c.diagonalDistance;
1786
- if (p === 0)
1785
+ const u = c.diagonalDistance;
1786
+ if (u === 0)
1787
1787
  this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
1788
1788
  else {
1789
1789
  const w = {
1790
- x: d.x / p,
1791
- y: d.y / p
1790
+ x: d.x / u,
1791
+ y: d.y / u
1792
1792
  };
1793
1793
  if (this.sourceArrow) {
1794
- const m = {
1794
+ const y = {
1795
1795
  x: w.x * this.sourceOffset,
1796
1796
  y: w.y * this.sourceOffset
1797
1797
  };
1798
1798
  g = this.arrowRenderer({
1799
1799
  direction: w,
1800
- shift: m,
1800
+ shift: y,
1801
1801
  arrowLength: this.arrowLength
1802
1802
  }), this.sourceArrow.setAttribute("d", g);
1803
1803
  }
1804
1804
  if (this.targetArrow) {
1805
- const m = {
1805
+ const y = {
1806
1806
  x: w.x * this.targetOffset,
1807
1807
  y: w.y * this.targetOffset
1808
1808
  };
1809
1809
  l = this.arrowRenderer({
1810
1810
  direction: { x: -w.x, y: -w.y },
1811
1811
  shift: {
1812
- x: d.x - m.x,
1813
- y: d.y - m.y
1812
+ x: d.x - y.x,
1813
+ y: d.y - y.y
1814
1814
  },
1815
1815
  arrowLength: this.arrowLength
1816
1816
  }), this.targetArrow.setAttribute("d", l);
@@ -1823,57 +1823,57 @@ class Me {
1823
1823
  });
1824
1824
  }
1825
1825
  }
1826
- const pt = () => {
1826
+ const yt = () => {
1827
1827
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1828
1828
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1829
- }, wt = (r) => {
1829
+ }, mt = (r) => {
1830
1830
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1831
1831
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1832
1832
  }, ue = (r) => {
1833
1833
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1834
1834
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1835
1835
  };
1836
- class ft extends Error {
1836
+ class vt extends Error {
1837
1837
  constructor(e) {
1838
1838
  super(e), this.name = "InteractiveEdgeError";
1839
1839
  }
1840
1840
  }
1841
- class Le {
1841
+ class Me {
1842
1842
  constructor(e, t) {
1843
- o(this, "svg");
1844
- o(this, "group");
1845
- o(this, "line");
1846
- o(this, "sourceArrow");
1847
- o(this, "targetArrow");
1848
- o(this, "handle", pt());
1849
- o(this, "onAfterRender");
1850
- o(this, "interactiveLine");
1851
- o(this, "interactiveSourceArrow", null);
1852
- o(this, "interactiveTargetArrow", null);
1853
- if (this.baseEdge = e, e instanceof Le)
1854
- throw new ft(
1843
+ i(this, "svg");
1844
+ i(this, "group");
1845
+ i(this, "line");
1846
+ i(this, "sourceArrow");
1847
+ i(this, "targetArrow");
1848
+ i(this, "handle", yt());
1849
+ i(this, "onAfterRender");
1850
+ i(this, "interactiveLine");
1851
+ i(this, "interactiveSourceArrow", null);
1852
+ i(this, "interactiveTargetArrow", null);
1853
+ if (this.baseEdge = e, e instanceof Me)
1854
+ throw new vt(
1855
1855
  "interactive edge can be configured only once"
1856
1856
  );
1857
1857
  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;
1858
1858
  const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1859
- this.interactiveLine = wt(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) => {
1860
- this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1859
+ 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) => {
1860
+ this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
1861
1861
  });
1862
1862
  }
1863
1863
  render(e) {
1864
1864
  this.baseEdge.render(e);
1865
1865
  }
1866
1866
  }
1867
- class Qt {
1867
+ class sr {
1868
1868
  constructor(e, t) {
1869
- o(this, "group");
1870
- o(this, "line");
1871
- o(this, "sourceArrow");
1872
- o(this, "targetArrow");
1873
- o(this, "onAfterRender");
1874
- o(this, "svg");
1869
+ i(this, "group");
1870
+ i(this, "line");
1871
+ i(this, "sourceArrow");
1872
+ i(this, "targetArrow");
1873
+ i(this, "onAfterRender");
1874
+ i(this, "svg");
1875
1875
  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) => {
1876
- const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1876
+ const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
1877
1877
  this.midpointElement.style.setProperty("transform", n);
1878
1878
  });
1879
1879
  }
@@ -1881,21 +1881,21 @@ class Qt {
1881
1881
  this.baseShape.render(e);
1882
1882
  }
1883
1883
  }
1884
- class Re {
1884
+ class Le {
1885
1885
  constructor(e) {
1886
- o(this, "onAfterNodeAdded");
1887
- o(this, "onAfterNodeUpdated");
1888
- o(this, "onAfterNodePriorityUpdated");
1889
- o(this, "onBeforeNodeRemoved");
1890
- o(this, "onAfterPortMarked");
1891
- o(this, "onAfterPortUpdated");
1892
- o(this, "onBeforePortUnmarked");
1893
- o(this, "onAfterEdgeAdded");
1894
- o(this, "onAfterEdgeShapeUpdated");
1895
- o(this, "onAfterEdgeUpdated");
1896
- o(this, "onAfterEdgePriorityUpdated");
1897
- o(this, "onBeforeEdgeRemoved");
1898
- o(this, "onBeforeClear");
1886
+ i(this, "onAfterNodeAdded");
1887
+ i(this, "onAfterNodeUpdated");
1888
+ i(this, "onAfterNodePriorityUpdated");
1889
+ i(this, "onBeforeNodeRemoved");
1890
+ i(this, "onAfterPortMarked");
1891
+ i(this, "onAfterPortUpdated");
1892
+ i(this, "onBeforePortUnmarked");
1893
+ i(this, "onAfterEdgeAdded");
1894
+ i(this, "onAfterEdgeShapeUpdated");
1895
+ i(this, "onAfterEdgeUpdated");
1896
+ i(this, "onAfterEdgePriorityUpdated");
1897
+ i(this, "onBeforeEdgeRemoved");
1898
+ i(this, "onBeforeClear");
1899
1899
  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;
1900
1900
  }
1901
1901
  getNode(e) {
@@ -1974,9 +1974,9 @@ class Re {
1974
1974
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
1975
1975
  }
1976
1976
  }
1977
- class Ce {
1977
+ class Re {
1978
1978
  constructor(e) {
1979
- o(this, "onAfterUpdated");
1979
+ i(this, "onAfterUpdated");
1980
1980
  this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
1981
1981
  }
1982
1982
  getViewportMatrix() {
@@ -1986,14 +1986,14 @@ class Ce {
1986
1986
  return { ...this.viewportStore.getContentMatrix() };
1987
1987
  }
1988
1988
  }
1989
- const Ve = (r, e) => {
1990
- const t = new Ee(), s = new Re(t), i = new Ce(e), n = new ye(t, e, r), a = {
1989
+ const Fe = (r, e) => {
1990
+ const t = new xe(), s = new Le(t), o = new Re(e), n = new me(t, e, r), a = {
1991
1991
  nodes: {
1992
1992
  centerFn: Se,
1993
1993
  priorityFn: () => 0
1994
1994
  },
1995
1995
  edges: {
1996
- shapeFactory: () => new Me(),
1996
+ shapeFactory: () => new Ne(),
1997
1997
  priorityFn: () => 0
1998
1998
  },
1999
1999
  ports: {
@@ -2002,7 +2002,7 @@ const Ve = (r, e) => {
2002
2002
  };
2003
2003
  return new ve(
2004
2004
  s,
2005
- i,
2005
+ o,
2006
2006
  t,
2007
2007
  e,
2008
2008
  n,
@@ -2010,16 +2010,16 @@ const Ve = (r, e) => {
2010
2010
  );
2011
2011
  };
2012
2012
  class z {
2013
- constructor(e, t, s, i) {
2014
- o(this, "onAfterPortMarked", (e) => {
2013
+ constructor(e, t, s, o) {
2014
+ i(this, "onAfterPortMarked", (e) => {
2015
2015
  const t = this.canvas.graph.getPort(e);
2016
2016
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
2017
2017
  });
2018
- o(this, "onBeforePortUnmarked", (e) => {
2018
+ i(this, "onBeforePortUnmarked", (e) => {
2019
2019
  const t = this.canvas.graph.getPort(e);
2020
2020
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
2021
2021
  });
2022
- o(this, "onPortMouseDown", (e) => {
2022
+ i(this, "onPortMouseDown", (e) => {
2023
2023
  if (!this.params.mouseDownEventVerifier(e))
2024
2024
  return;
2025
2025
  const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
@@ -2032,8 +2032,8 @@ class z {
2032
2032
  passive: !0
2033
2033
  }));
2034
2034
  });
2035
- o(this, "onWindowMouseMove", (e) => {
2036
- if (!V(
2035
+ i(this, "onWindowMouseMove", (e) => {
2036
+ if (!F(
2037
2037
  this.window,
2038
2038
  this.element,
2039
2039
  e.clientX,
@@ -2044,14 +2044,14 @@ class z {
2044
2044
  }
2045
2045
  this.params.onPointerMove({ x: e.clientX, y: e.clientY });
2046
2046
  });
2047
- o(this, "onWindowMouseUp", (e) => {
2047
+ i(this, "onWindowMouseUp", (e) => {
2048
2048
  this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
2049
2049
  });
2050
- o(this, "onPortTouchStart", (e) => {
2050
+ i(this, "onPortTouchStart", (e) => {
2051
2051
  if (e.touches.length !== 1)
2052
2052
  return;
2053
- const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
2054
- this.params.onPortPointerDown(i, {
2053
+ const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.getElementPortIds(s)[0];
2054
+ this.params.onPortPointerDown(o, {
2055
2055
  x: t.clientX,
2056
2056
  y: t.clientY
2057
2057
  }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
@@ -2062,9 +2062,9 @@ class z {
2062
2062
  passive: !0
2063
2063
  }));
2064
2064
  });
2065
- o(this, "onWindowTouchMove", (e) => {
2065
+ i(this, "onWindowTouchMove", (e) => {
2066
2066
  const t = e.touches[0];
2067
- if (!V(
2067
+ if (!F(
2068
2068
  this.window,
2069
2069
  this.element,
2070
2070
  t.clientX,
@@ -2075,23 +2075,23 @@ class z {
2075
2075
  }
2076
2076
  this.params.onPointerMove({ x: t.clientX, y: t.clientY });
2077
2077
  });
2078
- o(this, "onWindowTouchFinish", (e) => {
2078
+ i(this, "onWindowTouchFinish", (e) => {
2079
2079
  const t = e.changedTouches[0];
2080
2080
  this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
2081
2081
  });
2082
- o(this, "onBeforeClear", () => {
2082
+ i(this, "onBeforeClear", () => {
2083
2083
  this.canvas.graph.getAllPortIds().forEach((e) => {
2084
2084
  const t = this.canvas.graph.getPort(e);
2085
2085
  this.unhookPortEvents(t.element);
2086
2086
  });
2087
2087
  });
2088
- o(this, "onBeforeDestroy", () => {
2088
+ i(this, "onBeforeDestroy", () => {
2089
2089
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2090
2090
  });
2091
- 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);
2091
+ 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);
2092
2092
  }
2093
- static configure(e, t, s, i) {
2094
- new z(e, t, s, i);
2093
+ static configure(e, t, s, o) {
2094
+ new z(e, t, s, o);
2095
2095
  }
2096
2096
  hookPortEvents(e) {
2097
2097
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2116,12 +2116,12 @@ class z {
2116
2116
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2117
2117
  }
2118
2118
  }
2119
- class Q {
2120
- constructor(e, t, s, i) {
2121
- o(this, "grabbedNode", null);
2122
- o(this, "maxNodePriority", 0);
2123
- o(this, "graph");
2124
- o(this, "onAfterNodeAdded", (e) => {
2119
+ class J {
2120
+ constructor(e, t, s, o) {
2121
+ i(this, "grabbedNode", null);
2122
+ i(this, "maxNodePriority", 0);
2123
+ i(this, "graph");
2124
+ i(this, "onAfterNodeAdded", (e) => {
2125
2125
  this.updateMaxNodePriority(e);
2126
2126
  const t = this.graph.getNode(e);
2127
2127
  t.element.addEventListener("mousedown", this.onMouseDown, {
@@ -2130,26 +2130,26 @@ class Q {
2130
2130
  passive: !0
2131
2131
  });
2132
2132
  });
2133
- o(this, "onAfterNodeUpdated", (e) => {
2133
+ i(this, "onAfterNodeUpdated", (e) => {
2134
2134
  this.updateMaxNodePriority(e);
2135
2135
  });
2136
- o(this, "onBeforeNodeRemoved", (e) => {
2136
+ i(this, "onBeforeNodeRemoved", (e) => {
2137
2137
  const t = this.graph.getNode(e);
2138
2138
  t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2139
2139
  });
2140
- o(this, "onBeforeDestroy", () => {
2140
+ i(this, "onBeforeDestroy", () => {
2141
2141
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2142
2142
  });
2143
- o(this, "onBeforeClear", () => {
2143
+ i(this, "onBeforeClear", () => {
2144
2144
  this.canvas.graph.getAllNodeIds().forEach((e) => {
2145
2145
  const t = this.canvas.graph.getNode(e);
2146
2146
  t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2147
2147
  }), this.maxNodePriority = 0;
2148
2148
  });
2149
- o(this, "onMouseDown", (e) => {
2149
+ i(this, "onMouseDown", (e) => {
2150
2150
  if (!this.params.mouseDownEventVerifier(e))
2151
2151
  return;
2152
- const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
2152
+ const t = e.currentTarget, s = this.graph.getElementNodeId(t), o = this.graph.getNode(s);
2153
2153
  if (!this.params.nodeDragVerifier(s))
2154
2154
  return;
2155
2155
  this.params.onNodeDragStarted(s), e.stopPropagation();
@@ -2159,21 +2159,21 @@ class Q {
2159
2159
  });
2160
2160
  this.grabbedNode = {
2161
2161
  nodeId: s,
2162
- dx: a.x - i.x,
2163
- dy: a.y - i.y
2164
- }, B(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2162
+ dx: a.x - o.x,
2163
+ dy: a.y - o.y
2164
+ }, U(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2165
2165
  passive: !0
2166
2166
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2167
2167
  passive: !0
2168
2168
  });
2169
2169
  });
2170
- o(this, "onTouchStart", (e) => {
2170
+ i(this, "onTouchStart", (e) => {
2171
2171
  if (e.touches.length !== 1)
2172
2172
  return;
2173
2173
  e.stopPropagation();
2174
- const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
2174
+ const t = e.touches[0], s = e.currentTarget, o = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(o);
2175
2175
  if (!this.params.nodeDragVerifier({
2176
- nodeId: i,
2176
+ nodeId: o,
2177
2177
  element: n.element,
2178
2178
  x: n.x,
2179
2179
  y: n.y
@@ -2184,10 +2184,10 @@ class Q {
2184
2184
  y: t.clientY
2185
2185
  });
2186
2186
  this.grabbedNode = {
2187
- nodeId: i,
2187
+ nodeId: o,
2188
2188
  dx: h.x - n.x,
2189
2189
  dy: h.y - n.y
2190
- }, this.moveNodeOnTop(i), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2190
+ }, this.moveNodeOnTop(o), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2191
2191
  passive: !0
2192
2192
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2193
2193
  passive: !0
@@ -2195,8 +2195,8 @@ class Q {
2195
2195
  passive: !0
2196
2196
  });
2197
2197
  });
2198
- o(this, "onWindowMouseMove", (e) => {
2199
- if (!V(
2198
+ i(this, "onWindowMouseMove", (e) => {
2199
+ if (!F(
2200
2200
  this.window,
2201
2201
  this.element,
2202
2202
  e.clientX,
@@ -2210,14 +2210,14 @@ class Q {
2210
2210
  y: e.clientY
2211
2211
  });
2212
2212
  });
2213
- o(this, "onWindowMouseUp", (e) => {
2213
+ i(this, "onWindowMouseUp", (e) => {
2214
2214
  this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2215
2215
  });
2216
- o(this, "onWindowTouchMove", (e) => {
2216
+ i(this, "onWindowTouchMove", (e) => {
2217
2217
  if (e.touches.length !== 1)
2218
2218
  return;
2219
2219
  const t = e.touches[0];
2220
- if (!V(
2220
+ if (!F(
2221
2221
  this.window,
2222
2222
  this.element,
2223
2223
  t.clientX,
@@ -2231,20 +2231,20 @@ class Q {
2231
2231
  y: t.clientY
2232
2232
  });
2233
2233
  });
2234
- o(this, "onWindowTouchFinish", () => {
2234
+ i(this, "onWindowTouchFinish", () => {
2235
2235
  this.cancelTouchDrag();
2236
2236
  });
2237
- 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);
2237
+ 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);
2238
2238
  }
2239
- static configure(e, t, s, i) {
2240
- new Q(e, t, s, i);
2239
+ static configure(e, t, s, o) {
2240
+ new J(e, t, s, o);
2241
2241
  }
2242
2242
  moveNode(e, t) {
2243
2243
  if (this.graph.getNode(e.nodeId) === null)
2244
2244
  return;
2245
- const i = this.calculateContentPoint(t), n = {
2246
- x: i.x - e.dx,
2247
- y: i.y - e.dy
2245
+ const o = this.calculateContentPoint(t), n = {
2246
+ x: o.x - e.dx,
2247
+ y: o.y - e.dy
2248
2248
  }, a = this.adjustNodeCoords(n);
2249
2249
  this.canvas.updateNode(e.nodeId, {
2250
2250
  x: a.x,
@@ -2255,15 +2255,15 @@ class Q {
2255
2255
  if (this.params.moveOnTop) {
2256
2256
  if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
2257
2257
  const t = this.maxNodePriority;
2258
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
2259
- this.canvas.updateEdge(i, { priority: t });
2258
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
2259
+ this.canvas.updateEdge(o, { priority: t });
2260
2260
  });
2261
2261
  }
2262
2262
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
2263
2263
  }
2264
2264
  }
2265
2265
  cancelMouseDrag() {
2266
- this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, B(this.element, null), this.removeMouseDragListeners();
2266
+ this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
2267
2267
  }
2268
2268
  removeMouseDragListeners() {
2269
2269
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -2291,8 +2291,8 @@ class Q {
2291
2291
  const t = this.element.getBoundingClientRect(), s = {
2292
2292
  x: e.x - t.x,
2293
2293
  y: e.y - t.y
2294
- }, i = this.canvas.viewport.getViewportMatrix();
2295
- return N(i, s);
2294
+ }, o = this.canvas.viewport.getViewportMatrix();
2295
+ return D(o, s);
2296
2296
  }
2297
2297
  adjustNodeCoords(e) {
2298
2298
  const t = this.params.gridSize;
@@ -2306,51 +2306,51 @@ class Q {
2306
2306
  return e;
2307
2307
  }
2308
2308
  }
2309
- const mt = (r, e, t) => ({
2309
+ const xt = (r, e, t) => ({
2310
2310
  scale: r.scale,
2311
2311
  x: r.x + r.scale * e,
2312
2312
  y: r.y + r.scale * t
2313
- }), yt = (r, e, t, s) => ({
2313
+ }), At = (r, e, t, s) => ({
2314
2314
  scale: r.scale * e,
2315
2315
  x: r.scale * (1 - e) * t + r.x,
2316
2316
  y: r.scale * (1 - e) * s + r.y
2317
- }), U = (r) => {
2317
+ }), $ = (r) => {
2318
2318
  const e = [], t = r.touches.length;
2319
2319
  for (let h = 0; h < t; h++)
2320
2320
  e.push([r.touches[h].clientX, r.touches[h].clientY]);
2321
2321
  const s = e.reduce(
2322
2322
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2323
2323
  [0, 0]
2324
- ), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2324
+ ), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
2325
2325
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2326
2326
  0
2327
2327
  );
2328
2328
  return {
2329
- x: i[0],
2330
- y: i[1],
2329
+ x: o[0],
2330
+ y: o[1],
2331
2331
  scale: a / t,
2332
2332
  touchesCnt: t,
2333
2333
  touches: e
2334
2334
  };
2335
2335
  };
2336
- class X {
2337
- constructor(e, t, s, i) {
2338
- o(this, "viewport");
2339
- o(this, "prevTouches", null);
2340
- o(this, "wheelFinishTimer", null);
2341
- o(this, "transformInProgress", !1);
2342
- o(this, "onBeforeDestroy", () => {
2336
+ class H {
2337
+ constructor(e, t, s, o) {
2338
+ i(this, "viewport");
2339
+ i(this, "prevTouches", null);
2340
+ i(this, "wheelFinishTimer", null);
2341
+ i(this, "transformInProgress", !1);
2342
+ i(this, "onBeforeDestroy", () => {
2343
2343
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2344
2344
  });
2345
- o(this, "onMouseDown", (e) => {
2346
- this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2345
+ i(this, "onMouseDown", (e) => {
2346
+ this.element === null || !this.params.mouseDownEventVerifier(e) || (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2347
2347
  passive: !0
2348
2348
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2349
2349
  passive: !0
2350
2350
  }), this.startRegisteredTransform());
2351
2351
  });
2352
- o(this, "onWindowMouseMove", (e) => {
2353
- const t = V(
2352
+ i(this, "onWindowMouseMove", (e) => {
2353
+ const t = F(
2354
2354
  this.window,
2355
2355
  this.element,
2356
2356
  e.clientX,
@@ -2360,26 +2360,26 @@ class X {
2360
2360
  this.stopMouseDrag();
2361
2361
  return;
2362
2362
  }
2363
- const s = -e.movementX, i = -e.movementY;
2364
- this.moveViewport(s, i);
2363
+ const s = -e.movementX, o = -e.movementY;
2364
+ this.moveViewport(s, o);
2365
2365
  });
2366
- o(this, "onWindowMouseUp", (e) => {
2366
+ i(this, "onWindowMouseUp", (e) => {
2367
2367
  this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
2368
2368
  });
2369
- o(this, "onWheelScroll", (e) => {
2369
+ i(this, "onWheelScroll", (e) => {
2370
2370
  if (!this.params.mouseWheelEventVerifier(e))
2371
2371
  return;
2372
- 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);
2373
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2372
+ 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);
2373
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2374
2374
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2375
2375
  }, this.params.scaleWheelFinishTimeout);
2376
2376
  });
2377
- o(this, "onTouchStart", (e) => {
2377
+ i(this, "onTouchStart", (e) => {
2378
2378
  if (this.prevTouches !== null) {
2379
- this.prevTouches = U(e);
2379
+ this.prevTouches = $(e);
2380
2380
  return;
2381
2381
  }
2382
- this.prevTouches = U(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2382
+ this.prevTouches = $(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2383
2383
  passive: !0
2384
2384
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2385
2385
  passive: !0
@@ -2387,10 +2387,10 @@ class X {
2387
2387
  passive: !0
2388
2388
  }), this.startRegisteredTransform();
2389
2389
  });
2390
- o(this, "onWindowTouchMove", (e) => {
2391
- const t = U(e);
2390
+ i(this, "onWindowTouchMove", (e) => {
2391
+ const t = $(e);
2392
2392
  if (!t.touches.every(
2393
- (i) => V(this.window, this.element, i[0], i[1])
2393
+ (o) => F(this.window, this.element, o[0], o[1])
2394
2394
  )) {
2395
2395
  this.stopTouchDrag();
2396
2396
  return;
@@ -2399,27 +2399,27 @@ class X {
2399
2399
  -(t.x - this.prevTouches.x),
2400
2400
  -(t.y - this.prevTouches.y)
2401
2401
  ), t.touchesCnt === 2) {
2402
- 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);
2402
+ 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);
2403
2403
  this.scaleViewport(c, a, h);
2404
2404
  }
2405
2405
  this.prevTouches = t;
2406
2406
  });
2407
- o(this, "onWindowTouchFinish", (e) => {
2408
- e.touches.length > 0 ? this.prevTouches = U(e) : this.stopTouchDrag();
2407
+ i(this, "onWindowTouchFinish", (e) => {
2408
+ e.touches.length > 0 ? this.prevTouches = $(e) : this.stopTouchDrag();
2409
2409
  });
2410
- o(this, "observer", new ResizeObserver(() => {
2411
- const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
2410
+ i(this, "observer", new ResizeObserver(() => {
2411
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), o = this.params.transformPreprocessor({
2412
2412
  prevTransform: e,
2413
2413
  nextTransform: e,
2414
2414
  canvasWidth: t,
2415
2415
  canvasHeight: s
2416
2416
  });
2417
- this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2417
+ this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
2418
2418
  }));
2419
- o(this, "preventWheelScaleListener", (e) => {
2419
+ i(this, "preventWheelScaleListener", (e) => {
2420
2420
  e.preventDefault();
2421
2421
  });
2422
- this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2422
+ this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2423
2423
  passive: !1
2424
2424
  }), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
2425
2425
  passive: !0
@@ -2429,21 +2429,21 @@ class X {
2429
2429
  passive: !0
2430
2430
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2431
2431
  }
2432
- static configure(e, t, s, i) {
2433
- new X(e, t, s, i);
2432
+ static configure(e, t, s, o) {
2433
+ new H(e, t, s, o);
2434
2434
  }
2435
2435
  moveViewport(e, t) {
2436
- const s = this.viewport.getViewportMatrix(), i = mt(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2436
+ const s = this.viewport.getViewportMatrix(), o = xt(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2437
2437
  prevTransform: s,
2438
- nextTransform: i,
2438
+ nextTransform: o,
2439
2439
  canvasWidth: n,
2440
2440
  canvasHeight: a
2441
2441
  });
2442
2442
  this.performTransform(h);
2443
2443
  }
2444
2444
  scaleViewport(e, t, s) {
2445
- const i = this.canvas.viewport.getViewportMatrix(), n = yt(i, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
2446
- prevTransform: i,
2445
+ const o = this.canvas.viewport.getViewportMatrix(), n = At(o, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
2446
+ prevTransform: o,
2447
2447
  nextTransform: n,
2448
2448
  canvasWidth: a,
2449
2449
  canvasHeight: h
@@ -2451,7 +2451,7 @@ class X {
2451
2451
  this.performTransform(d);
2452
2452
  }
2453
2453
  stopMouseDrag() {
2454
- B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2454
+ U(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2455
2455
  }
2456
2456
  removeMouseDragListeners() {
2457
2457
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2473,21 +2473,21 @@ class X {
2473
2473
  }
2474
2474
  }
2475
2475
  class q {
2476
- constructor(e, t, s, i, n, a) {
2477
- o(this, "canvasResizeObserver");
2478
- o(this, "nodeHorizontal");
2479
- o(this, "nodeVertical");
2480
- o(this, "viewport");
2481
- o(this, "viewportWidth", 0);
2482
- o(this, "viewportHeight", 0);
2483
- o(this, "viewportMatrix");
2484
- o(this, "loadedArea", {
2476
+ constructor(e, t, s, o, n, a) {
2477
+ i(this, "canvasResizeObserver");
2478
+ i(this, "nodeHorizontal");
2479
+ i(this, "nodeVertical");
2480
+ i(this, "viewport");
2481
+ i(this, "viewportWidth", 0);
2482
+ i(this, "viewportHeight", 0);
2483
+ i(this, "viewportMatrix");
2484
+ i(this, "loadedArea", {
2485
2485
  xFrom: 1 / 0,
2486
2486
  xTo: 1 / 0,
2487
2487
  yFrom: 1 / 0,
2488
2488
  yTo: 1 / 0
2489
2489
  });
2490
- o(this, "updateLoadedArea", (e) => {
2490
+ i(this, "updateLoadedArea", (e) => {
2491
2491
  this.loadedArea = {
2492
2492
  xFrom: e.x,
2493
2493
  xTo: e.x + e.width,
@@ -2495,47 +2495,47 @@ class q {
2495
2495
  yTo: e.y + e.height
2496
2496
  };
2497
2497
  });
2498
- o(this, "onAfterViewportUpdated", () => {
2498
+ i(this, "onAfterViewportUpdated", () => {
2499
2499
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
2500
2500
  });
2501
- o(this, "userTransformInProgress", !1);
2501
+ i(this, "userTransformInProgress", !1);
2502
2502
  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.canvasResizeObserver = new ResizeObserver((d) => {
2503
2503
  const c = d[0];
2504
2504
  this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
2505
2505
  }), this.viewport = e.viewport;
2506
2506
  const h = {
2507
- ...i,
2507
+ ...o,
2508
2508
  onResizeTransformStarted: () => {
2509
- this.userTransformInProgress = !0, i.onResizeTransformStarted();
2509
+ this.userTransformInProgress = !0, o.onResizeTransformStarted();
2510
2510
  },
2511
2511
  onResizeTransformFinished: () => {
2512
- this.userTransformInProgress = !1, i.onResizeTransformFinished();
2512
+ this.userTransformInProgress = !1, o.onResizeTransformFinished();
2513
2513
  },
2514
2514
  onBeforeTransformChange: () => {
2515
- this.userTransformInProgress = !0, i.onBeforeTransformChange();
2515
+ this.userTransformInProgress = !0, o.onBeforeTransformChange();
2516
2516
  },
2517
2517
  onTransformChange: () => {
2518
2518
  this.userTransformInProgress = !1;
2519
2519
  const d = this.viewportMatrix;
2520
- this.viewportMatrix = this.viewport.getViewportMatrix(), d.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), i.onTransformChange();
2520
+ this.viewportMatrix = this.viewport.getViewportMatrix(), d.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
2521
2521
  },
2522
2522
  onTransformFinished: () => {
2523
- this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
2523
+ this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
2524
2524
  }
2525
2525
  };
2526
- X.configure(
2526
+ H.configure(
2527
2527
  e,
2528
2528
  this.element,
2529
2529
  this.window,
2530
2530
  h
2531
2531
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2532
2532
  }
2533
- static configure(e, t, s, i, n, a) {
2533
+ static configure(e, t, s, o, n, a) {
2534
2534
  new q(
2535
2535
  e,
2536
2536
  t,
2537
2537
  s,
2538
- i,
2538
+ o,
2539
2539
  n,
2540
2540
  a
2541
2541
  );
@@ -2546,21 +2546,21 @@ class q {
2546
2546
  });
2547
2547
  }
2548
2548
  scheduleEnsureViewportAreaLoaded() {
2549
- const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, a = this.viewportMatrix.y + t + this.nodeVertical;
2550
- this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
2549
+ const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, o = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, a = this.viewportMatrix.y + t + this.nodeVertical;
2550
+ this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < o && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
2551
2551
  }
2552
2552
  loadAreaAroundViewport() {
2553
- const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, i = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, a = 3 * t + 2 * this.nodeVertical;
2554
- this.trigger.emit({ x: s, y: i, width: n, height: a });
2553
+ const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, o = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, a = 3 * t + 2 * this.nodeVertical;
2554
+ this.trigger.emit({ x: s, y: o, width: n, height: a });
2555
2555
  }
2556
2556
  }
2557
- const vt = () => {
2557
+ const Et = () => {
2558
2558
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2559
2559
  return r.style.position = "absolute", r.style.inset = "0", r;
2560
- }, Et = () => {
2560
+ }, St = () => {
2561
2561
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2562
2562
  return r.setAttribute("fill", "url(#pattern)"), r;
2563
- }, At = () => {
2563
+ }, bt = () => {
2564
2564
  const r = document.createElementNS(
2565
2565
  "http://www.w3.org/2000/svg",
2566
2566
  "pattern"
@@ -2569,29 +2569,29 @@ const vt = () => {
2569
2569
  };
2570
2570
  class _ {
2571
2571
  constructor(e, t, s) {
2572
- o(this, "svg", vt());
2573
- o(this, "patternRenderingRectangle", Et());
2574
- o(this, "pattern", At());
2575
- o(this, "patternContent");
2576
- o(this, "tileWidth");
2577
- o(this, "tileHeight");
2578
- o(this, "halfTileWidth");
2579
- o(this, "halfTileHeight");
2580
- o(this, "maxViewportScale");
2581
- o(this, "visible", !1);
2582
- o(this, "resizeObserver", new ResizeObserver((e) => {
2583
- const t = e[0], { width: s, height: i } = t.contentRect;
2584
- this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
2585
- const n = this.tileWidth / s, a = this.tileHeight / i;
2572
+ i(this, "svg", Et());
2573
+ i(this, "patternRenderingRectangle", St());
2574
+ i(this, "pattern", bt());
2575
+ i(this, "patternContent");
2576
+ i(this, "tileWidth");
2577
+ i(this, "tileHeight");
2578
+ i(this, "halfTileWidth");
2579
+ i(this, "halfTileHeight");
2580
+ i(this, "maxViewportScale");
2581
+ i(this, "visible", !1);
2582
+ i(this, "resizeObserver", new ResizeObserver((e) => {
2583
+ const t = e[0], { width: s, height: o } = t.contentRect;
2584
+ this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${o}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${o}`);
2585
+ const n = this.tileWidth / s, a = this.tileHeight / o;
2586
2586
  this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
2587
2587
  }));
2588
- o(this, "onAfterTransformUpdated", () => {
2589
- 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})`;
2590
- this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2588
+ i(this, "onAfterTransformUpdated", () => {
2589
+ 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})`;
2590
+ this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
2591
2591
  });
2592
2592
  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;
2593
- const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2594
- this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2593
+ const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2594
+ this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
2595
2595
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2596
2596
  n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.backgroundHost), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2597
2597
  }
@@ -2604,14 +2604,14 @@ class _ {
2604
2604
  }
2605
2605
  }
2606
2606
  class ee {
2607
- constructor(e, t, s, i, n) {
2608
- o(this, "overlayCanvas");
2609
- o(this, "staticPortId", null);
2610
- o(this, "isTargetDragging", !0);
2611
- o(this, "onEdgeCreated", (e) => {
2607
+ constructor(e, t, s, o, n) {
2608
+ i(this, "overlayCanvas");
2609
+ i(this, "staticPortId", null);
2610
+ i(this, "isTargetDragging", !0);
2611
+ i(this, "onEdgeCreated", (e) => {
2612
2612
  this.params.onAfterEdgeCreated(e);
2613
2613
  });
2614
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ve(
2614
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Fe(
2615
2615
  this.overlayLayer,
2616
2616
  this.viewportStore
2617
2617
  ), z.configure(
@@ -2637,38 +2637,38 @@ class ee {
2637
2637
  }
2638
2638
  );
2639
2639
  }
2640
- static configure(e, t, s, i, n) {
2640
+ static configure(e, t, s, o, n) {
2641
2641
  new ee(
2642
2642
  e,
2643
2643
  t,
2644
2644
  s,
2645
- i,
2645
+ o,
2646
2646
  n
2647
2647
  );
2648
2648
  }
2649
2649
  grabPort(e, t, s) {
2650
- const i = this.canvas.graph.getPort(e);
2650
+ const o = this.canvas.graph.getPort(e);
2651
2651
  this.staticPortId = e;
2652
- 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.getViewportMatrix(), g = N(c, {
2652
+ 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.getViewportMatrix(), g = D(c, {
2653
2653
  x: a - d.x,
2654
2654
  y: h - d.y
2655
- }), l = N(c, {
2655
+ }), l = D(c, {
2656
2656
  x: t.x - d.x,
2657
2657
  y: t.y - d.y
2658
- }), p = {
2658
+ }), u = {
2659
2659
  overlayId: T.Static,
2660
2660
  portCoords: g,
2661
- portDirection: i.direction
2661
+ portDirection: o.direction
2662
2662
  }, w = {
2663
2663
  overlayId: T.Dragging,
2664
2664
  portCoords: l,
2665
2665
  portDirection: this.params.dragPortDirection
2666
2666
  };
2667
2667
  this.isTargetDragging = s === "direct";
2668
- const [m, v] = this.isTargetDragging ? [p, w] : [w, p];
2669
- this.overlayCanvas.addNode(F(m)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
2670
- from: m.overlayId,
2671
- to: v.overlayId,
2668
+ const [y, x] = this.isTargetDragging ? [u, w] : [w, u];
2669
+ this.overlayCanvas.addNode(B(y)), this.overlayCanvas.addNode(B(x)), this.overlayCanvas.addEdge({
2670
+ from: y.overlayId,
2671
+ to: x.overlayId,
2672
2672
  shape: this.params.edgeShapeFactory(T.Edge)
2673
2673
  });
2674
2674
  }
@@ -2676,7 +2676,7 @@ class ee {
2676
2676
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2677
2677
  }
2678
2678
  tryCreateConnection(e) {
2679
- const t = xe(this.canvas.graph, e), s = this.staticPortId;
2679
+ const t = Ee(this.canvas.graph, e), s = this.staticPortId;
2680
2680
  if (t === null) {
2681
2681
  this.params.onEdgeCreationInterrupted({
2682
2682
  staticPortId: s,
@@ -2684,14 +2684,14 @@ class ee {
2684
2684
  });
2685
2685
  return;
2686
2686
  }
2687
- const i = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2687
+ const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
2688
2688
  h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2689
2689
  }
2690
2690
  moveDraggingPort(e) {
2691
2691
  const t = this.overlayLayer.getBoundingClientRect(), s = {
2692
2692
  x: e.x - t.x,
2693
2693
  y: e.y - t.y
2694
- }, i = this.canvas.viewport.getViewportMatrix(), n = N(i, s);
2694
+ }, o = this.canvas.viewport.getViewportMatrix(), n = D(o, s);
2695
2695
  this.overlayCanvas.updateNode(T.Dragging, {
2696
2696
  x: n.x,
2697
2697
  y: n.y
@@ -2699,15 +2699,15 @@ class ee {
2699
2699
  }
2700
2700
  }
2701
2701
  class te {
2702
- constructor(e, t, s, i, n) {
2703
- o(this, "overlayCanvas");
2704
- o(this, "staticPortId", null);
2705
- o(this, "isTargetDragging", !0);
2706
- o(this, "draggingEdgePayload", null);
2707
- o(this, "onEdgeReattached", (e) => {
2702
+ constructor(e, t, s, o, n) {
2703
+ i(this, "overlayCanvas");
2704
+ i(this, "staticPortId", null);
2705
+ i(this, "isTargetDragging", !0);
2706
+ i(this, "draggingEdgePayload", null);
2707
+ i(this, "onEdgeReattached", (e) => {
2708
2708
  this.params.onAfterEdgeReattached(e);
2709
2709
  });
2710
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ve(
2710
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Fe(
2711
2711
  this.overlayLayer,
2712
2712
  this.viewportStore
2713
2713
  ), z.configure(
@@ -2730,12 +2730,12 @@ class te {
2730
2730
  }
2731
2731
  );
2732
2732
  }
2733
- static configure(e, t, s, i, n) {
2733
+ static configure(e, t, s, o, n) {
2734
2734
  new te(
2735
2735
  e,
2736
2736
  t,
2737
2737
  s,
2738
- i,
2738
+ o,
2739
2739
  n
2740
2740
  );
2741
2741
  }
@@ -2743,44 +2743,44 @@ class te {
2743
2743
  const s = this.params.draggingEdgeResolver(e);
2744
2744
  if (s === null)
2745
2745
  return !1;
2746
- const i = this.canvas.graph.getEdge(s);
2747
- if (i === null)
2746
+ const o = this.canvas.graph.getEdge(s);
2747
+ if (o === null)
2748
2748
  return !1;
2749
- const n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2749
+ const n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
2750
2750
  this.staticPortId = h, this.isTargetDragging = a;
2751
2751
  const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2752
2752
  x: g.x + g.width / 2,
2753
2753
  y: g.y + g.height / 2
2754
- }, p = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), m = N(p, {
2754
+ }, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), y = D(u, {
2755
2755
  x: l.x - w.x,
2756
2756
  y: l.y - w.y
2757
- }), v = N(p, {
2757
+ }), x = D(u, {
2758
2758
  x: t.x - w.x,
2759
2759
  y: t.y - w.y
2760
2760
  });
2761
2761
  this.draggingEdgePayload = {
2762
2762
  id: s,
2763
- from: i.from,
2764
- to: i.to,
2765
- shape: i.shape,
2766
- priority: i.priority
2763
+ from: o.from,
2764
+ to: o.to,
2765
+ shape: o.shape,
2766
+ priority: o.priority
2767
2767
  }, this.canvas.removeEdge(s);
2768
- const E = {
2768
+ const A = {
2769
2769
  overlayId: T.Static,
2770
- portCoords: m,
2770
+ portCoords: y,
2771
2771
  portDirection: c.direction
2772
- }, A = {
2772
+ }, S = {
2773
2773
  overlayId: T.Dragging,
2774
- portCoords: v,
2774
+ portCoords: x,
2775
2775
  portDirection: d.direction
2776
- }, [D, b] = this.isTargetDragging ? [E, A] : [A, E];
2777
- this.overlayCanvas.addNode(F(D)), this.overlayCanvas.addNode(F(b));
2778
- const M = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.Edge) : i.shape;
2776
+ }, [C, P] = this.isTargetDragging ? [A, S] : [S, A];
2777
+ this.overlayCanvas.addNode(B(C)), this.overlayCanvas.addNode(B(P));
2778
+ const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.Edge) : o.shape;
2779
2779
  return this.overlayCanvas.addEdge({
2780
2780
  id: T.Edge,
2781
- from: D.overlayId,
2782
- to: b.overlayId,
2783
- shape: M
2781
+ from: C.overlayId,
2782
+ to: P.overlayId,
2783
+ shape: N
2784
2784
  }), !0;
2785
2785
  }
2786
2786
  resetDragState() {
@@ -2790,14 +2790,14 @@ class te {
2790
2790
  const t = this.overlayLayer.getBoundingClientRect(), s = {
2791
2791
  x: e.x - t.x,
2792
2792
  y: e.y - t.y
2793
- }, i = this.canvas.viewport.getViewportMatrix(), n = N(i, s);
2793
+ }, o = this.canvas.viewport.getViewportMatrix(), n = D(o, s);
2794
2794
  this.overlayCanvas.updateNode(T.Dragging, {
2795
2795
  x: n.x,
2796
2796
  y: n.y
2797
2797
  });
2798
2798
  }
2799
2799
  tryCreateConnection(e) {
2800
- const t = xe(this.canvas.graph, e);
2800
+ const t = Ee(this.canvas.graph, e);
2801
2801
  if (this.overlayCanvas.removeEdge(T.Edge), t === null) {
2802
2802
  const d = this.draggingEdgePayload;
2803
2803
  this.params.onEdgeReattachInterrupted({
@@ -2809,10 +2809,10 @@ class te {
2809
2809
  });
2810
2810
  return;
2811
2811
  }
2812
- const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2812
+ const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2813
2813
  id: n.id,
2814
2814
  from: s,
2815
- to: i,
2815
+ to: o,
2816
2816
  shape: n.shape,
2817
2817
  priority: n.priority
2818
2818
  }, h = this.params.connectionPreprocessor(a);
@@ -2851,7 +2851,7 @@ class re {
2851
2851
  }
2852
2852
  class se {
2853
2853
  constructor(e, t) {
2854
- o(this, "applyScheduled", !1);
2854
+ i(this, "applyScheduled", !1);
2855
2855
  this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2856
2856
  this.scheduleApply();
2857
2857
  }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
@@ -2879,7 +2879,7 @@ class se {
2879
2879
  });
2880
2880
  }
2881
2881
  }
2882
- class xt {
2882
+ class Pt {
2883
2883
  static configure(e, t) {
2884
2884
  const s = t.applyOn;
2885
2885
  switch (s.type) {
@@ -2901,10 +2901,10 @@ class xt {
2901
2901
  }
2902
2902
  }
2903
2903
  }
2904
- class St {
2904
+ class Tt {
2905
2905
  constructor(e, t) {
2906
- o(this, "previousTimeStamp");
2907
- o(this, "step", (e) => {
2906
+ i(this, "previousTimeStamp");
2907
+ i(this, "step", (e) => {
2908
2908
  if (this.previousTimeStamp === void 0)
2909
2909
  this.previousTimeStamp = e;
2910
2910
  else {
@@ -2917,51 +2917,51 @@ class St {
2917
2917
  }
2918
2918
  }
2919
2919
  class oe {
2920
- constructor(e, t, s, i) {
2921
- o(this, "step", (e) => {
2920
+ constructor(e, t, s, o) {
2921
+ i(this, "step", (e) => {
2922
2922
  this.algorithm.calculateNextCoordinates(
2923
2923
  this.canvas.graph,
2924
2924
  e
2925
- ).forEach((s, i) => {
2926
- this.staticNodes.has(i) || this.canvas.updateNode(i, { x: s.x, y: s.y });
2925
+ ).forEach((s, o) => {
2926
+ this.staticNodes.has(o) || this.canvas.updateNode(o, { x: s.x, y: s.y });
2927
2927
  });
2928
2928
  });
2929
- this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new St(this.win, this.step);
2929
+ this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = o, new Tt(this.win, this.step);
2930
2930
  }
2931
- static configure(e, t, s, i) {
2932
- new oe(e, t, s, i);
2931
+ static configure(e, t, s, o) {
2932
+ new oe(e, t, s, o);
2933
2933
  }
2934
2934
  }
2935
- const Pt = () => {
2935
+ const Ct = () => {
2936
2936
  const r = document.createElement("div");
2937
2937
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
2938
- }, H = () => {
2938
+ }, Y = () => {
2939
2939
  const r = document.createElement("div");
2940
2940
  return r.style.position = "absolute", r.style.inset = "0", r;
2941
2941
  }, pe = () => {
2942
- const r = H();
2942
+ const r = Y();
2943
2943
  return r.style.pointerEvents = "none", r;
2944
2944
  };
2945
- class bt {
2945
+ class Dt {
2946
2946
  constructor(e) {
2947
- o(this, "background", H());
2948
- o(this, "main", H());
2949
- o(this, "overlayConnectablePorts", pe());
2950
- o(this, "overlayDraggableEdges", pe());
2951
- o(this, "host", Pt());
2947
+ i(this, "background", Y());
2948
+ i(this, "main", Y());
2949
+ i(this, "overlayConnectablePorts", pe());
2950
+ i(this, "overlayDraggableEdges", pe());
2951
+ i(this, "host", Ct());
2952
2952
  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);
2953
2953
  }
2954
2954
  destroy() {
2955
2955
  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);
2956
2956
  }
2957
2957
  }
2958
- const j = (r) => () => r, we = j(0), Tt = () => {
2958
+ const G = (r) => () => r, we = G(0), Nt = () => {
2959
2959
  let r = 0;
2960
2960
  return () => r++;
2961
- }, Dt = (r, e) => {
2961
+ }, Mt = (r, e) => {
2962
2962
  let t = we, s = we;
2963
- const i = Tt();
2964
- return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = j(r)), typeof e == "number" && (s = j(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
2963
+ const o = Nt();
2964
+ 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), {
2965
2965
  nodesPriorityFn: t,
2966
2966
  edgesPriorityFn: s
2967
2967
  };
@@ -2970,7 +2970,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
2970
2970
  return r;
2971
2971
  switch (r.type) {
2972
2972
  case "straight":
2973
- return () => new gt({
2973
+ return () => new wt({
2974
2974
  color: r.color,
2975
2975
  width: r.width,
2976
2976
  arrowLength: r.arrowLength,
@@ -2984,7 +2984,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
2984
2984
  detourDirection: r.detourDirection
2985
2985
  });
2986
2986
  case "horizontal":
2987
- return () => new lt({
2987
+ return () => new pt({
2988
2988
  color: r.color,
2989
2989
  width: r.width,
2990
2990
  arrowLength: r.arrowLength,
@@ -2997,7 +2997,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
2997
2997
  detourDistance: r.detourDistance
2998
2998
  });
2999
2999
  case "vertical":
3000
- return () => new ut({
3000
+ return () => new ft({
3001
3001
  color: r.color,
3002
3002
  width: r.width,
3003
3003
  arrowLength: r.arrowLength,
@@ -3010,7 +3010,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3010
3010
  detourDistance: r.detourDistance
3011
3011
  });
3012
3012
  case "direct":
3013
- return () => new Me({
3013
+ return () => new Ne({
3014
3014
  color: r.color,
3015
3015
  width: r.width,
3016
3016
  arrowLength: r.arrowLength,
@@ -3021,7 +3021,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3021
3021
  targetOffset: r.targetOffset
3022
3022
  });
3023
3023
  default:
3024
- return () => new ct({
3024
+ return () => new ut({
3025
3025
  color: r.color,
3026
3026
  width: r.width,
3027
3027
  arrowLength: r.arrowLength,
@@ -3035,15 +3035,15 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3035
3035
  detourDirection: r.detourDirection
3036
3036
  });
3037
3037
  }
3038
- }, Nt = (r) => {
3039
- var t, s, i, n, a;
3040
- const e = Dt(
3038
+ }, Lt = (r) => {
3039
+ var t, s, o, n, a;
3040
+ const e = Mt(
3041
3041
  (t = r.nodes) == null ? void 0 : t.priority,
3042
3042
  (s = r.edges) == null ? void 0 : s.priority
3043
3043
  );
3044
3044
  return {
3045
3045
  nodes: {
3046
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Se,
3046
+ centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Se,
3047
3047
  priorityFn: e.nodesPriorityFn
3048
3048
  },
3049
3049
  ports: {
@@ -3054,41 +3054,41 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3054
3054
  priorityFn: e.edgesPriorityFn
3055
3055
  }
3056
3056
  };
3057
- }, Mt = (r) => {
3058
- var w, m, v, E, A, D;
3057
+ }, Rt = (r) => {
3058
+ var w, y, x, A, S, C;
3059
3059
  const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3060
- }), t = ((m = r.events) == null ? void 0 : m.onNodeDrag) ?? (() => {
3061
- }), s = r.nodeDragVerifier ?? (() => !0), i = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
3062
- }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (E = r.mouse) == null ? void 0 : E.dragCursor, d = h !== void 0 ? h : "grab", c = (A = r.mouse) == null ? void 0 : A.mouseDownEventVerifier, g = c !== void 0 ? c : (b) => b.button === 0, l = (D = r.mouse) == null ? void 0 : D.mouseUpEventVerifier, p = l !== void 0 ? l : (b) => b.button === 0;
3060
+ }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3061
+ }), s = r.nodeDragVerifier ?? (() => !0), o = ((x = r.events) == null ? void 0 : x.onNodeDragFinished) ?? (() => {
3062
+ }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (A = r.mouse) == null ? void 0 : A.dragCursor, d = h !== void 0 ? h : "grab", c = (S = r.mouse) == null ? void 0 : S.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;
3063
3063
  return {
3064
3064
  moveOnTop: n,
3065
3065
  moveEdgesOnTop: a,
3066
3066
  dragCursor: d,
3067
3067
  gridSize: r.gridSize ?? null,
3068
3068
  mouseDownEventVerifier: g,
3069
- mouseUpEventVerifier: p,
3069
+ mouseUpEventVerifier: u,
3070
3070
  onNodeDragStarted: e,
3071
3071
  onNodeDrag: t,
3072
3072
  nodeDragVerifier: s,
3073
- onNodeDragFinished: i
3073
+ onNodeDragFinished: o
3074
3074
  };
3075
- }, Lt = (r) => {
3076
- 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;
3075
+ }, Ft = (r) => {
3076
+ 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;
3077
3077
  return (n) => {
3078
3078
  let a = n.nextTransform.x, h = n.nextTransform.y;
3079
3079
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3080
3080
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3081
3081
  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));
3082
- const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
3082
+ const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
3083
3083
  return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3084
3084
  };
3085
- }, Rt = (r) => {
3086
- const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3085
+ }, Vt = (r) => {
3086
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
3087
3087
  return (n) => {
3088
3088
  const a = n.prevTransform, h = n.nextTransform;
3089
3089
  let d = h.scale, c = h.x, g = h.y;
3090
- if (h.scale > i && h.scale > a.scale) {
3091
- d = Math.max(a.scale, i), c = a.x, g = a.y;
3090
+ if (h.scale > o && h.scale > a.scale) {
3091
+ d = Math.max(a.scale, o), c = a.x, g = a.y;
3092
3092
  const l = (d - a.scale) / (h.scale - a.scale);
3093
3093
  c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3094
3094
  }
@@ -3103,7 +3103,7 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3103
3103
  y: g
3104
3104
  };
3105
3105
  };
3106
- }, Ct = (r) => (e) => r.reduce(
3106
+ }, It = (r) => (e) => r.reduce(
3107
3107
  (t, s) => s({
3108
3108
  prevTransform: e.prevTransform,
3109
3109
  nextTransform: t,
@@ -3116,39 +3116,39 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3116
3116
  return r;
3117
3117
  switch (r.type) {
3118
3118
  case "scale-limit":
3119
- return Rt({
3119
+ return Vt({
3120
3120
  minContentScale: r.minContentScale ?? 0,
3121
3121
  maxContentScale: r.maxContentScale ?? 1 / 0
3122
3122
  });
3123
3123
  case "shift-limit":
3124
- return Lt({
3124
+ return Ft({
3125
3125
  minX: r.minX ?? -1 / 0,
3126
3126
  maxX: r.maxX ?? 1 / 0,
3127
3127
  minY: r.minY ?? -1 / 0,
3128
3128
  maxY: r.maxY ?? 1 / 0
3129
3129
  });
3130
3130
  }
3131
- }, me = (r) => {
3132
- var m, v, E, A, D, b, M, $, ne, ae, he, de;
3133
- const e = (m = r == null ? void 0 : r.scale) == null ? void 0 : m.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
3134
- let i;
3135
- s !== void 0 ? Array.isArray(s) ? i = Ct(
3131
+ }, ye = (r) => {
3132
+ var y, x, A, S, C, P, N, V, ne, ae, he, de;
3133
+ 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;
3134
+ let o;
3135
+ s !== void 0 ? Array.isArray(s) ? o = It(
3136
3136
  s.map(
3137
- (L) => fe(L)
3137
+ (M) => fe(M)
3138
3138
  )
3139
- ) : i = fe(s) : i = (L) => L.nextTransform;
3140
- const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
3141
- }), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
3142
- }), d = (D = r == null ? void 0 : r.shift) == null ? void 0 : D.mouseDownEventVerifier, c = d !== void 0 ? d : (L) => L.button === 0, g = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, l = g !== void 0 ? g : (L) => L.button === 0, p = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, w = p !== void 0 ? p : () => !0;
3139
+ ) : o = fe(s) : o = (M) => M.nextTransform;
3140
+ const n = ((x = r == null ? void 0 : r.shift) == null ? void 0 : x.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onBeforeTransformChange) ?? (() => {
3141
+ }), h = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onTransformChange) ?? (() => {
3142
+ }), d = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (M) => M.button === 0, u = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3143
3143
  return {
3144
3144
  wheelSensitivity: t,
3145
- onTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onTransformStarted) ?? (() => {
3145
+ onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
3146
3146
  }),
3147
3147
  onTransformFinished: ((ne = r == null ? void 0 : r.events) == null ? void 0 : ne.onTransformFinished) ?? (() => {
3148
3148
  }),
3149
3149
  onBeforeTransformChange: a,
3150
3150
  onTransformChange: h,
3151
- transformPreprocessor: i,
3151
+ transformPreprocessor: o,
3152
3152
  shiftCursor: n,
3153
3153
  mouseDownEventVerifier: c,
3154
3154
  mouseUpEventVerifier: l,
@@ -3159,32 +3159,32 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3159
3159
  onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
3160
3160
  })
3161
3161
  };
3162
- }, Vt = (r, e) => {
3162
+ }, $t = (r, e) => {
3163
3163
  const t = document.createElementNS(
3164
3164
  "http://www.w3.org/2000/svg",
3165
3165
  "circle"
3166
3166
  );
3167
3167
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3168
- }, $t = (r) => r instanceof SVGElement ? r : Vt(
3168
+ }, Ut = (r) => r instanceof SVGElement ? r : $t(
3169
3169
  (r == null ? void 0 : r.radius) ?? 1.5,
3170
3170
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3171
- ), It = (r) => {
3172
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = $t(r.renderer ?? {});
3171
+ ), Bt = (r) => {
3172
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Ut(r.renderer ?? {});
3173
3173
  return {
3174
3174
  tileWidth: t,
3175
3175
  tileHeight: s,
3176
- renderer: i,
3176
+ renderer: o,
3177
3177
  maxViewportScale: r.maxViewportScale ?? 10
3178
3178
  };
3179
- }, Ut = (r, e, t) => {
3179
+ }, Ot = (r, e, t) => {
3180
3180
  var c, g, l;
3181
- const s = () => "direct", i = (p) => p, n = (p) => p.button === 0, a = () => {
3181
+ const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
3182
3182
  }, h = () => {
3183
3183
  }, d = () => {
3184
3184
  };
3185
3185
  return {
3186
3186
  connectionTypeResolver: r.connectionTypeResolver ?? s,
3187
- connectionPreprocessor: r.connectionPreprocessor ?? i,
3187
+ connectionPreprocessor: r.connectionPreprocessor ?? o,
3188
3188
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3189
3189
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3190
3190
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
@@ -3193,10 +3193,10 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3193
3193
  dragPortDirection: r.dragPortDirection ?? t,
3194
3194
  edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
3195
3195
  };
3196
- }, Bt = (r, e) => {
3196
+ }, Wt = (r, e) => {
3197
3197
  var c, g, l;
3198
- const t = (p) => p, s = (p) => p.button === 0 && p.ctrlKey, i = (p) => p.button === 0, n = (p) => {
3199
- const w = e.getPortAdjacentEdgeIds(p);
3198
+ const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
3199
+ const w = e.getPortAdjacentEdgeIds(u);
3200
3200
  return w.length > 0 ? w[w.length - 1] : null;
3201
3201
  }, a = () => {
3202
3202
  }, h = () => {
@@ -3205,17 +3205,17 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3205
3205
  return {
3206
3206
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3207
3207
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3208
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3208
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
3209
3209
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3210
3210
  draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ie(r.draggingEdgeShape) : null,
3211
3211
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3212
3212
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3213
3213
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3214
3214
  };
3215
- }, Ft = (r) => ({
3215
+ }, kt = (r) => ({
3216
3216
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3217
3217
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3218
- }), Ot = (r) => {
3218
+ }), zt = (r) => {
3219
3219
  var e, t;
3220
3220
  return {
3221
3221
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3224,71 +3224,48 @@ const j = (r) => () => r, we = j(0), Tt = () => {
3224
3224
  })
3225
3225
  };
3226
3226
  };
3227
- class Wt extends Error {
3227
+ class Ht extends Error {
3228
3228
  constructor() {
3229
3229
  super(...arguments);
3230
- o(this, "name", "CanvasBuilderError");
3231
- }
3232
- }
3233
- class kt {
3234
- constructor(e, t) {
3235
- this.coordinates = e, this.rand = t;
3236
- }
3237
- getVector(e, t) {
3238
- const s = this.coordinates.get(e), i = this.coordinates.get(t), n = i.x - s.x, a = i.y - s.y, h = n * n + a * a;
3239
- if (h === 0) {
3240
- const l = this.rand() * 2 * Math.PI;
3241
- return { ex: Math.cos(l), ey: Math.sin(l), d2: 1, d: 1 };
3242
- }
3243
- const d = Math.sqrt(h), c = n / d, g = a / d;
3244
- return { ex: c, ey: g, d2: h, d };
3230
+ i(this, "name", "CanvasBuilderError");
3245
3231
  }
3246
3232
  }
3247
- class $e {
3233
+ class Ve {
3248
3234
  constructor(e, t, s) {
3249
- o(this, "dtSec");
3250
- o(this, "k");
3251
- o(this, "nodeMass");
3252
- o(this, "edgeEquilibriumLength");
3253
- o(this, "edgeStiffness");
3254
- o(this, "effectiveDistance");
3255
- this.graph = e, this.currentCoords = t, this.params = s, this.dtSec = this.params.dtSec, this.k = this.params.nodeCharge * this.params.nodeCharge, this.nodeMass = this.params.nodeMass, this.edgeEquilibriumLength = this.params.edgeEquilibriumLength, this.edgeStiffness = this.params.edgeStiffness, this.effectiveDistance = this.params.effectiveDistance;
3256
- }
3257
- next() {
3235
+ i(this, "dt");
3236
+ i(this, "nodeMass");
3237
+ i(this, "edgeEquilibriumLength");
3238
+ i(this, "edgeStiffness");
3239
+ i(this, "nodeForcesApplicationStrategy");
3240
+ i(this, "distanceVectorGenerator");
3241
+ 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;
3242
+ }
3243
+ apply() {
3258
3244
  let e = 0;
3259
- const t = /* @__PURE__ */ new Map(), s = this.graph.getAllNodeIds();
3260
- s.forEach((a) => {
3261
- t.set(a, { x: 0, y: 0 });
3262
- });
3263
- const i = new kt(
3264
- this.currentCoords,
3265
- this.params.rand
3266
- ), n = s.length;
3267
- for (let a = 0; a < n; a++) {
3268
- const h = s[a];
3269
- for (let d = a + 1; d < n; d++) {
3270
- const c = s[d], g = i.getVector(h, c);
3271
- if (g.d > this.effectiveDistance)
3272
- continue;
3273
- const l = this.k / g.d2, p = l * g.ex, w = l * g.ey, m = p / 2, v = w / 2, E = t.get(h), A = t.get(c);
3274
- E.x -= m, E.y -= v, A.x += m, A.y += v;
3275
- }
3276
- }
3277
- return this.graph.getAllEdgeIds().forEach((a) => {
3278
- const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId), p = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * p, m = g.ey * p, v = t.get(d.nodeId), E = t.get(c.nodeId);
3279
- v.x += w, v.y += m, E.x -= w, E.y -= m;
3280
- }), this.currentCoords.forEach((a, h) => {
3281
- const d = t.get(h), c = {
3282
- x: d.x / this.nodeMass * this.dtSec,
3283
- y: d.y / this.nodeMass * this.dtSec
3284
- }, g = c.x * this.dtSec, l = c.y * this.dtSec;
3285
- a.x += g, a.y += l, e = Math.max(e, Math.sqrt(g * g + l * l));
3245
+ const t = /* @__PURE__ */ new Map();
3246
+ return this.graph.getAllNodeIds().forEach((o) => {
3247
+ t.set(o, { x: 0, y: 0 });
3248
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
3249
+ const a = t.get(n), h = {
3250
+ x: a.x / this.nodeMass * this.dt,
3251
+ y: a.y / this.nodeMass * this.dt
3252
+ }, d = h.x * this.dt, c = h.y * this.dt;
3253
+ o.x += d, o.y += c, e = Math.max(e, Math.sqrt(d * d + c * c));
3286
3254
  }), e;
3287
3255
  }
3256
+ applyEdgeForces(e) {
3257
+ this.graph.getAllEdgeIds().forEach((t) => {
3258
+ 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(
3259
+ a,
3260
+ h
3261
+ ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), y = e.get(n.nodeId);
3262
+ w.x += l, w.y += u, y.x -= l, y.y -= u;
3263
+ });
3264
+ }
3288
3265
  }
3289
3266
  const Ie = (r, e, t) => {
3290
- const s = /* @__PURE__ */ new Map(), i = r.getAllNodeIds(), n = Math.sqrt(i.length) * t;
3291
- return i.forEach((a) => {
3267
+ const s = /* @__PURE__ */ new Map(), o = r.getAllNodeIds(), n = Math.sqrt(o.length) * t;
3268
+ return o.forEach((a) => {
3292
3269
  const h = r.getNode(a);
3293
3270
  s.set(a, {
3294
3271
  x: h.x ?? n * e(),
@@ -3296,9 +3273,430 @@ const Ie = (r, e, t) => {
3296
3273
  });
3297
3274
  }), s;
3298
3275
  };
3299
- class zt {
3276
+ class $e {
3300
3277
  constructor(e) {
3301
- this.params = e;
3278
+ i(this, "PI2", 2 * Math.PI);
3279
+ this.rand = e;
3280
+ }
3281
+ create(e, t) {
3282
+ const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
3283
+ if (n === 0) {
3284
+ const c = this.PI2 * this.rand();
3285
+ return {
3286
+ ex: Math.cos(c),
3287
+ ey: Math.sin(c),
3288
+ d: 0
3289
+ };
3290
+ }
3291
+ const a = Math.sqrt(n), h = s / a, d = o / a;
3292
+ return { ex: h, ey: d, d: a };
3293
+ }
3294
+ }
3295
+ const Ue = (r) => {
3296
+ if (r.distance === 0)
3297
+ return r.maxForce;
3298
+ const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
3299
+ return Math.min(e, r.maxForce);
3300
+ };
3301
+ class Xt {
3302
+ constructor(e) {
3303
+ i(this, "effectiveDistance");
3304
+ i(this, "nodeCharge");
3305
+ i(this, "distanceVectorGenerator");
3306
+ i(this, "maxForce");
3307
+ this.effectiveDistance = e.effectiveDistance, this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
3308
+ }
3309
+ apply(e, t) {
3310
+ const s = Array.from(t.keys()), o = s.length;
3311
+ for (let n = 0; n < o; n++) {
3312
+ const a = s[n];
3313
+ for (let h = n + 1; h < o; h++) {
3314
+ const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
3315
+ c,
3316
+ g
3317
+ );
3318
+ if (l.d > this.effectiveDistance)
3319
+ continue;
3320
+ const u = Ue({
3321
+ coefficient: 1,
3322
+ sourceCharge: this.nodeCharge,
3323
+ targetCharge: this.nodeCharge,
3324
+ distance: l.d,
3325
+ maxForce: this.maxForce
3326
+ }), w = u * l.ex, y = u * l.ey, x = t.get(a), A = t.get(d);
3327
+ x.x -= w, x.y -= y, A.x += w, A.y += y;
3328
+ }
3329
+ }
3330
+ }
3331
+ }
3332
+ const Yt = (r) => {
3333
+ if (r.size === 0)
3334
+ return {
3335
+ centerX: 0,
3336
+ centerY: 0,
3337
+ radius: 0
3338
+ };
3339
+ let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
3340
+ r.forEach((d) => {
3341
+ e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
3342
+ });
3343
+ const n = t - e, a = o - s, h = Math.max(n, a);
3344
+ return {
3345
+ centerX: (e + t) / 2,
3346
+ centerY: (s + o) / 2,
3347
+ radius: h / 2
3348
+ };
3349
+ };
3350
+ class Gt {
3351
+ constructor(e) {
3352
+ i(this, "root");
3353
+ i(this, "leaves", /* @__PURE__ */ new Map());
3354
+ i(this, "coords");
3355
+ i(this, "areaRadiusThreshold");
3356
+ i(this, "nodeMass");
3357
+ i(this, "nodeCharge");
3358
+ i(this, "sortedParentNodes", []);
3359
+ this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
3360
+ nodeIds: new Set(e.coords.keys()),
3361
+ box: e.box,
3362
+ totalMass: 0,
3363
+ totalCharge: 0,
3364
+ chargeCenter: {
3365
+ x: 0,
3366
+ y: 0
3367
+ },
3368
+ parent: null,
3369
+ lb: null,
3370
+ lt: null,
3371
+ rb: null,
3372
+ rt: null
3373
+ };
3374
+ let t = [this.root];
3375
+ for (; t.length > 0; ) {
3376
+ const s = [];
3377
+ for (; t.length > 0; ) {
3378
+ const o = t.pop();
3379
+ this.processNode(o).forEach((a) => {
3380
+ s.push(a);
3381
+ });
3382
+ }
3383
+ t = s;
3384
+ }
3385
+ this.sortedParentNodes.reverse().forEach((s) => {
3386
+ let o = 0, n = 0, a = 0, h = 0;
3387
+ 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;
3388
+ });
3389
+ }
3390
+ getRoot() {
3391
+ return this.root;
3392
+ }
3393
+ getLeaf(e) {
3394
+ return this.leaves.get(e);
3395
+ }
3396
+ processNode(e) {
3397
+ if (e.nodeIds.size < 2)
3398
+ return this.setLeaf(e), [];
3399
+ const { centerX: t, centerY: s, radius: o } = e.box;
3400
+ if (o < this.areaRadiusThreshold)
3401
+ return this.setLeaf(e), [];
3402
+ this.sortedParentNodes.push(e);
3403
+ const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
3404
+ e.nodeIds.forEach((u) => {
3405
+ const { x: w, y } = this.coords.get(u);
3406
+ w < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
3407
+ });
3408
+ const g = {
3409
+ parent: e,
3410
+ lb: null,
3411
+ lt: null,
3412
+ rb: null,
3413
+ rt: null
3414
+ }, l = [];
3415
+ if (n.size > 0) {
3416
+ const u = {
3417
+ nodeIds: n,
3418
+ totalMass: 0,
3419
+ totalCharge: 0,
3420
+ chargeCenter: {
3421
+ x: 0,
3422
+ y: 0
3423
+ },
3424
+ box: {
3425
+ centerX: t + c,
3426
+ centerY: s + c,
3427
+ radius: c
3428
+ },
3429
+ ...g
3430
+ };
3431
+ e.rt = u, l.push(u);
3432
+ }
3433
+ if (a.size > 0) {
3434
+ const u = {
3435
+ nodeIds: a,
3436
+ totalMass: 0,
3437
+ totalCharge: 0,
3438
+ chargeCenter: {
3439
+ x: 0,
3440
+ y: 0
3441
+ },
3442
+ box: {
3443
+ centerX: t + c,
3444
+ centerY: s - c,
3445
+ radius: c
3446
+ },
3447
+ ...g
3448
+ };
3449
+ e.rb = u, l.push(u);
3450
+ }
3451
+ if (h.size > 0) {
3452
+ const u = {
3453
+ nodeIds: h,
3454
+ totalMass: 0,
3455
+ totalCharge: 0,
3456
+ chargeCenter: {
3457
+ x: 0,
3458
+ y: 0
3459
+ },
3460
+ box: {
3461
+ centerX: t - c,
3462
+ centerY: s + c,
3463
+ radius: c
3464
+ },
3465
+ ...g
3466
+ };
3467
+ e.lt = u, l.push(u);
3468
+ }
3469
+ if (d.size > 0) {
3470
+ const u = {
3471
+ nodeIds: d,
3472
+ totalMass: 0,
3473
+ totalCharge: 0,
3474
+ chargeCenter: {
3475
+ x: 0,
3476
+ y: 0
3477
+ },
3478
+ box: {
3479
+ centerX: t - c,
3480
+ centerY: s - c,
3481
+ radius: c
3482
+ },
3483
+ ...g
3484
+ };
3485
+ e.lb = u, l.push(u);
3486
+ }
3487
+ return l;
3488
+ }
3489
+ setLeaf(e) {
3490
+ e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
3491
+ this.leaves.set(t, e);
3492
+ });
3493
+ }
3494
+ calculateLeafChargeCenter(e) {
3495
+ if (e.size === 0)
3496
+ return {
3497
+ x: 0,
3498
+ y: 0
3499
+ };
3500
+ let t = 0, s = 0;
3501
+ return e.forEach((o) => {
3502
+ const n = this.coords.get(o);
3503
+ t += n.x, s += n.y;
3504
+ }), { x: t / e.size, y: s / e.size };
3505
+ }
3506
+ }
3507
+ class jt {
3508
+ constructor(e) {
3509
+ i(this, "areaRadiusThreshold");
3510
+ i(this, "nodeMass");
3511
+ i(this, "nodeCharge");
3512
+ i(this, "theta");
3513
+ i(this, "distanceVectorGenerator");
3514
+ i(this, "nodeForceCoefficient");
3515
+ i(this, "maxForce");
3516
+ 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;
3517
+ }
3518
+ apply(e, t) {
3519
+ const s = Yt(e), o = new Gt({
3520
+ box: s,
3521
+ coords: e,
3522
+ areaRadiusThreshold: this.areaRadiusThreshold,
3523
+ nodeMass: this.nodeMass,
3524
+ nodeCharge: this.nodeCharge
3525
+ });
3526
+ e.forEach((n, a) => {
3527
+ const h = this.calculateForceForNode(
3528
+ o.getLeaf(a),
3529
+ a,
3530
+ e
3531
+ ), d = t.get(a);
3532
+ this.applyForce(d, h);
3533
+ });
3534
+ }
3535
+ calculateForceForNode(e, t, s) {
3536
+ const o = s.get(t), n = { x: 0, y: 0 };
3537
+ e.nodeIds.forEach((h) => {
3538
+ if (h !== t) {
3539
+ const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3540
+ sourceCharge: this.nodeCharge,
3541
+ targetCharge: this.nodeCharge,
3542
+ sourceCoords: d,
3543
+ targetCoords: o
3544
+ });
3545
+ this.applyForce(n, c);
3546
+ }
3547
+ });
3548
+ let a = e;
3549
+ for (; a !== null; ) {
3550
+ const h = a.parent;
3551
+ if (h !== null) {
3552
+ const d = this.distanceVectorGenerator.create(
3553
+ h.chargeCenter,
3554
+ o
3555
+ );
3556
+ h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3557
+ totalForce: n,
3558
+ targetCoords: o,
3559
+ target: h.lb,
3560
+ current: a
3561
+ }), this.tryApplyFarForce({
3562
+ totalForce: n,
3563
+ targetCoords: o,
3564
+ target: h.rb,
3565
+ current: a
3566
+ }), this.tryApplyFarForce({
3567
+ totalForce: n,
3568
+ targetCoords: o,
3569
+ target: h.rt,
3570
+ current: a
3571
+ }), this.tryApplyFarForce({
3572
+ totalForce: n,
3573
+ targetCoords: o,
3574
+ target: h.lt,
3575
+ current: a
3576
+ })) : (this.tryApplyNearForce({
3577
+ totalForce: n,
3578
+ targetCoords: o,
3579
+ target: h.lb,
3580
+ current: a,
3581
+ nodesCoords: s
3582
+ }), this.tryApplyNearForce({
3583
+ totalForce: n,
3584
+ targetCoords: o,
3585
+ target: h.rb,
3586
+ current: a,
3587
+ nodesCoords: s
3588
+ }), this.tryApplyNearForce({
3589
+ totalForce: n,
3590
+ targetCoords: o,
3591
+ target: h.rt,
3592
+ current: a,
3593
+ nodesCoords: s
3594
+ }), this.tryApplyNearForce({
3595
+ totalForce: n,
3596
+ targetCoords: o,
3597
+ target: h.lt,
3598
+ current: a,
3599
+ nodesCoords: s
3600
+ }));
3601
+ }
3602
+ a = a.parent;
3603
+ }
3604
+ return n;
3605
+ }
3606
+ calculateExactForce(e, t, s) {
3607
+ const o = { x: 0, y: 0 }, n = [e];
3608
+ for (; n.length > 0; ) {
3609
+ const a = n.pop();
3610
+ a.nodeIds.forEach((h) => {
3611
+ const d = s.get(h), c = this.calculateNodeRepulsiveForce({
3612
+ sourceCharge: this.nodeCharge,
3613
+ targetCharge: this.nodeCharge,
3614
+ sourceCoords: d,
3615
+ targetCoords: t
3616
+ });
3617
+ this.applyForce(o, c);
3618
+ }), 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);
3619
+ }
3620
+ return o;
3621
+ }
3622
+ calculateApproximateForce(e, t) {
3623
+ return this.calculateNodeRepulsiveForce({
3624
+ sourceCharge: this.nodeCharge,
3625
+ targetCharge: e.totalCharge,
3626
+ sourceCoords: e.chargeCenter,
3627
+ targetCoords: t
3628
+ });
3629
+ }
3630
+ calculateNodeRepulsiveForce(e) {
3631
+ const t = this.distanceVectorGenerator.create(
3632
+ e.sourceCoords,
3633
+ e.targetCoords
3634
+ ), s = Ue({
3635
+ coefficient: this.nodeForceCoefficient,
3636
+ sourceCharge: e.sourceCharge,
3637
+ targetCharge: e.targetCharge,
3638
+ distance: t.d,
3639
+ maxForce: this.maxForce
3640
+ });
3641
+ return {
3642
+ x: s * t.ex,
3643
+ y: s * t.ey
3644
+ };
3645
+ }
3646
+ applyForce(e, t) {
3647
+ e.x += t.x, e.y += t.y;
3648
+ }
3649
+ tryApplyFarForce(e) {
3650
+ if (e.target !== null && e.target !== e.current) {
3651
+ const t = this.calculateApproximateForce(
3652
+ e.target,
3653
+ e.targetCoords
3654
+ );
3655
+ this.applyForce(e.totalForce, t);
3656
+ }
3657
+ }
3658
+ tryApplyNearForce(e) {
3659
+ if (e.target !== null && e.target !== e.current) {
3660
+ const t = this.calculateExactForce(
3661
+ e.target,
3662
+ e.targetCoords,
3663
+ e.nodesCoords
3664
+ );
3665
+ this.applyForce(e.totalForce, t);
3666
+ }
3667
+ }
3668
+ }
3669
+ const Be = (r) => r.theta !== 0 ? new jt({
3670
+ nodeCharge: r.nodeCharge,
3671
+ nodeForceCoefficient: r.nodeForceCoefficient,
3672
+ distanceVectorGenerator: r.distanceVectorGenerator,
3673
+ maxForce: r.maxForce,
3674
+ theta: r.theta,
3675
+ nodeMass: r.nodeMass,
3676
+ areaRadiusThreshold: r.areaRadiusThreshold
3677
+ }) : new Xt({
3678
+ nodeCharge: r.nodeCharge,
3679
+ nodeForceCoefficient: r.nodeForceCoefficient,
3680
+ distanceVectorGenerator: r.distanceVectorGenerator,
3681
+ effectiveDistance: r.effectiveDistance,
3682
+ maxForce: r.maxForce
3683
+ });
3684
+ class Kt {
3685
+ constructor(e) {
3686
+ i(this, "distanceVectorGenerator");
3687
+ i(this, "nodeForcesApplicationStrategy");
3688
+ this.params = e, this.distanceVectorGenerator = new $e(
3689
+ this.params.rand
3690
+ ), this.nodeForcesApplicationStrategy = Be({
3691
+ distanceVectorGenerator: this.distanceVectorGenerator,
3692
+ nodeCharge: this.params.nodeCharge,
3693
+ effectiveDistance: this.params.effectiveDistance,
3694
+ maxForce: this.params.maxForce,
3695
+ nodeForceCoefficient: this.params.nodeForceCoefficient,
3696
+ theta: this.params.barnesHutTheta,
3697
+ areaRadiusThreshold: this.params.barnesHutAreaRadiusThreshold,
3698
+ nodeMass: this.params.nodeMass
3699
+ });
3302
3700
  }
3303
3701
  calculateCoordinates(e) {
3304
3702
  const t = Ie(
@@ -3306,22 +3704,36 @@ class zt {
3306
3704
  this.params.rand,
3307
3705
  this.params.edgeEquilibriumLength
3308
3706
  );
3309
- for (let s = 0; s < this.params.maxIterations && !(new $e(e, t, {
3310
- rand: this.params.rand,
3311
- dtSec: this.params.dtSec,
3312
- nodeMass: this.params.nodeMass,
3313
- nodeCharge: this.params.nodeCharge,
3314
- edgeEquilibriumLength: this.params.edgeEquilibriumLength,
3315
- effectiveDistance: this.params.effectiveDistance,
3316
- edgeStiffness: this.params.edgeStiffness
3317
- }).next() < this.params.convergenceDelta); s++)
3707
+ for (let s = 0; s < this.params.maxIterations && !(new Ve(
3708
+ e,
3709
+ t,
3710
+ {
3711
+ distanceVectorGenerator: this.distanceVectorGenerator,
3712
+ nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
3713
+ dtSec: this.params.dtSec,
3714
+ nodeMass: this.params.nodeMass,
3715
+ edgeEquilibriumLength: this.params.edgeEquilibriumLength,
3716
+ edgeStiffness: this.params.edgeStiffness
3717
+ }
3718
+ ).apply() < this.params.convergenceDelta); s++)
3318
3719
  ;
3319
3720
  return t;
3320
3721
  }
3321
3722
  }
3322
- class Xt {
3723
+ class Qt {
3323
3724
  constructor(e) {
3324
- this.params = e;
3725
+ i(this, "distanceVectorGenerator");
3726
+ i(this, "nodeForcesApplicationStrategy");
3727
+ this.params = e, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Be({
3728
+ distanceVectorGenerator: this.distanceVectorGenerator,
3729
+ nodeCharge: this.params.nodeCharge,
3730
+ effectiveDistance: this.params.effectiveDistance,
3731
+ maxForce: this.params.maxForce,
3732
+ nodeForceCoefficient: this.params.nodeForceCoefficient,
3733
+ theta: this.params.barnesHutTheta,
3734
+ areaRadiusThreshold: this.params.barnesHutAreaRadiusThreshold,
3735
+ nodeMass: this.params.nodeMass
3736
+ });
3325
3737
  }
3326
3738
  calculateNextCoordinates(e, t) {
3327
3739
  const s = Ie(
@@ -3329,87 +3741,103 @@ class Xt {
3329
3741
  this.params.rand,
3330
3742
  this.params.edgeEquilibriumLength
3331
3743
  );
3332
- return new $e(e, s, {
3333
- rand: this.params.rand,
3334
- dtSec: Math.min(t, this.params.maxTimeDeltaSec),
3335
- nodeMass: this.params.nodeMass,
3336
- nodeCharge: this.params.nodeCharge,
3337
- edgeEquilibriumLength: this.params.edgeEquilibriumLength,
3338
- effectiveDistance: this.params.effectiveDistance,
3339
- edgeStiffness: this.params.edgeStiffness
3340
- }).next() < this.params.convergenceDelta && !e.getAllNodeIds().some((h) => {
3744
+ return new Ve(
3745
+ e,
3746
+ s,
3747
+ {
3748
+ distanceVectorGenerator: this.distanceVectorGenerator,
3749
+ nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
3750
+ dtSec: Math.min(t, this.params.maxTimeDeltaSec),
3751
+ nodeMass: this.params.nodeMass,
3752
+ edgeEquilibriumLength: this.params.edgeEquilibriumLength,
3753
+ edgeStiffness: this.params.edgeStiffness
3754
+ }
3755
+ ).apply() < this.params.convergenceDelta && !e.getAllNodeIds().some((h) => {
3341
3756
  const d = e.getNode(h);
3342
3757
  return d.x === null || d.y === null;
3343
3758
  }) ? /* @__PURE__ */ new Map() : s;
3344
3759
  }
3345
3760
  }
3346
- const Ue = (r) => {
3347
- let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
3761
+ const Oe = (r) => {
3762
+ let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
3348
3763
  for (let n = 0, a; n < r.length; n++)
3349
- 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);
3350
- 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];
3351
- }, Be = (r, e, t, s) => function() {
3764
+ 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);
3765
+ 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];
3766
+ }, We = (r, e, t, s) => function() {
3352
3767
  r |= 0, e |= 0, t |= 0, s |= 0;
3353
- const i = (r + e | 0) + s | 0;
3354
- 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;
3355
- }, S = Object.freeze({
3768
+ const o = (r + e | 0) + s | 0;
3769
+ 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;
3770
+ }, v = Object.freeze({
3356
3771
  seed: "HTMLGraph is awesome",
3357
- maxTimeDeltaSec: 0.1,
3772
+ maxTimeDeltaSec: 0.01,
3358
3773
  nodeCharge: 1e5,
3359
3774
  nodeMass: 1,
3360
3775
  edgeEquilibriumLength: 300,
3361
3776
  edgeStiffness: 1e3,
3362
3777
  effectiveDistance: 1e3,
3363
- dtSec: 0.02,
3364
- maxIterations: 100,
3365
- convergenceDelta: 1e-3
3366
- }), Yt = (r) => {
3367
- var e;
3778
+ dtSec: 0.01,
3779
+ maxIterations: 1e3,
3780
+ convergenceDelta: 1,
3781
+ maxForce: 1e7,
3782
+ nodeForceCoefficient: 1,
3783
+ barnesHutAreaRadiusThreshold: 0.01,
3784
+ barnesHutTheta: 1
3785
+ }), Zt = (r) => {
3786
+ var e, t, s;
3368
3787
  switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
3369
3788
  case "custom":
3370
3789
  return r.algorithm.instance;
3371
3790
  default: {
3372
- const t = r == null ? void 0 : r.algorithm, s = Ue((t == null ? void 0 : t.seed) ?? S.seed), i = Be(s[0], s[1], s[2], s[3]);
3373
- return new Xt({
3374
- rand: i,
3375
- maxTimeDeltaSec: (t == null ? void 0 : t.maxTimeDeltaSec) ?? S.maxTimeDeltaSec,
3376
- nodeCharge: (t == null ? void 0 : t.nodeCharge) ?? S.nodeCharge,
3377
- nodeMass: (t == null ? void 0 : t.nodeMass) ?? S.nodeMass,
3378
- edgeEquilibriumLength: (t == null ? void 0 : t.edgeEquilibriumLength) ?? S.edgeEquilibriumLength,
3379
- effectiveDistance: S.effectiveDistance,
3380
- edgeStiffness: (t == null ? void 0 : t.edgeStiffness) ?? S.edgeStiffness,
3381
- convergenceDelta: (t == null ? void 0 : t.convergenceDelta) ?? S.convergenceDelta
3791
+ 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]);
3792
+ return new Qt({
3793
+ rand: a,
3794
+ maxTimeDeltaSec: (o == null ? void 0 : o.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
3795
+ nodeCharge: (o == null ? void 0 : o.nodeCharge) ?? v.nodeCharge,
3796
+ nodeMass: (o == null ? void 0 : o.nodeMass) ?? v.nodeMass,
3797
+ edgeEquilibriumLength: (o == null ? void 0 : o.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3798
+ effectiveDistance: v.effectiveDistance,
3799
+ edgeStiffness: (o == null ? void 0 : o.edgeStiffness) ?? v.edgeStiffness,
3800
+ convergenceDelta: (o == null ? void 0 : o.convergenceDelta) ?? v.convergenceDelta,
3801
+ maxForce: (o == null ? void 0 : o.maxForce) ?? v.maxForce,
3802
+ nodeForceCoefficient: (o == null ? void 0 : o.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3803
+ barnesHutTheta: ((t = o == null ? void 0 : o.barnesHut) == null ? void 0 : t.theta) ?? v.barnesHutTheta,
3804
+ barnesHutAreaRadiusThreshold: ((s = o == null ? void 0 : o.barnesHut) == null ? void 0 : s.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3382
3805
  });
3383
3806
  }
3384
3807
  }
3385
- }, Ht = (r) => r instanceof G ? {
3808
+ }, Jt = (r) => r instanceof j ? {
3386
3809
  type: "manual",
3387
3810
  trigger: r
3388
3811
  } : {
3389
3812
  type: "topologyChangeTimeout"
3390
- }, jt = (r) => {
3813
+ }, qt = (r) => {
3814
+ var e, t;
3391
3815
  switch (r == null ? void 0 : r.type) {
3392
3816
  case "custom":
3393
3817
  return r.instance;
3394
3818
  default: {
3395
- const e = Ue((r == null ? void 0 : r.seed) ?? S.seed), t = Be(e[0], e[1], e[2], e[3]);
3396
- return new zt({
3397
- dtSec: (r == null ? void 0 : r.dtSec) ?? S.dtSec,
3398
- maxIterations: (r == null ? void 0 : r.maxIterations) ?? S.maxIterations,
3399
- rand: t,
3400
- nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? S.nodeCharge,
3401
- nodeMass: (r == null ? void 0 : r.nodeMass) ?? S.nodeMass,
3402
- edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? S.edgeEquilibriumLength,
3403
- edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? S.edgeStiffness,
3404
- effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ?? S.effectiveDistance,
3405
- convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ?? S.convergenceDelta
3819
+ const s = Oe((r == null ? void 0 : r.seed) ?? v.seed), o = We(s[0], s[1], s[2], s[3]);
3820
+ return new Kt({
3821
+ dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
3822
+ maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
3823
+ rand: o,
3824
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
3825
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? v.nodeMass,
3826
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? v.edgeEquilibriumLength,
3827
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? v.edgeStiffness,
3828
+ effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ?? v.effectiveDistance,
3829
+ convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ?? v.convergenceDelta,
3830
+ maxForce: (r == null ? void 0 : r.maxForce) ?? v.maxForce,
3831
+ nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? v.nodeForceCoefficient,
3832
+ barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? v.barnesHutTheta,
3833
+ barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? v.barnesHutAreaRadiusThreshold
3406
3834
  });
3407
3835
  }
3408
3836
  }
3409
- }, Gt = (r) => ({
3410
- algorithm: jt(r == null ? void 0 : r.algorithm),
3411
- applyOn: Ht(r == null ? void 0 : r.applyOn)
3412
- }), Kt = (r, e) => ({
3837
+ }, _t = (r) => ({
3838
+ algorithm: qt(r == null ? void 0 : r.algorithm),
3839
+ applyOn: Jt(r == null ? void 0 : r.applyOn)
3840
+ }), er = (r, e) => ({
3413
3841
  ...r,
3414
3842
  onNodeDragStarted: (t) => {
3415
3843
  e.add(t), r.onNodeDragStarted(t);
@@ -3417,40 +3845,40 @@ const Ue = (r) => {
3417
3845
  onNodeDragFinished: (t) => {
3418
3846
  e.delete(t), r.onNodeDragFinished(t);
3419
3847
  }
3420
- }), Zt = (r, e) => {
3848
+ }), tr = (r, e) => {
3421
3849
  r.onBeforeNodeRemoved.subscribe((t) => {
3422
3850
  e.delete(t);
3423
3851
  }), r.onBeforeClear.subscribe(() => {
3424
3852
  e.clear();
3425
3853
  });
3426
3854
  };
3427
- class qt {
3855
+ class or {
3428
3856
  constructor(e) {
3429
- o(this, "used", !1);
3430
- o(this, "canvasDefaults", {});
3431
- o(this, "dragConfig", {});
3432
- o(this, "transformConfig", {});
3433
- o(this, "backgroundConfig", {});
3434
- o(this, "connectablePortsConfig", {});
3435
- o(this, "draggableEdgesConfig", {});
3436
- o(this, "virtualScrollConfig");
3437
- o(this, "layoutConfig", {});
3438
- o(this, "animatedLayoutConfig", {});
3439
- o(this, "hasDraggableNodes", !1);
3440
- o(this, "hasTransformableViewport", !1);
3441
- o(this, "hasNodeResizeReactiveEdges", !1);
3442
- o(this, "hasBackground", !1);
3443
- o(this, "hasUserConnectablePorts", !1);
3444
- o(this, "hasUserDraggableEdges", !1);
3445
- o(this, "hasAnimatedLayout", !1);
3446
- o(this, "hasLayout", !1);
3447
- o(this, "boxRenderingTrigger", new G());
3448
- o(this, "graphStore", new Ee());
3449
- o(this, "viewportStore", new Ge());
3450
- o(this, "graph", new Re(this.graphStore));
3451
- o(this, "viewport", new Ce(this.viewportStore));
3452
- o(this, "window", window);
3453
- o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3857
+ i(this, "used", !1);
3858
+ i(this, "canvasDefaults", {});
3859
+ i(this, "dragConfig", {});
3860
+ i(this, "transformConfig", {});
3861
+ i(this, "backgroundConfig", {});
3862
+ i(this, "connectablePortsConfig", {});
3863
+ i(this, "draggableEdgesConfig", {});
3864
+ i(this, "virtualScrollConfig");
3865
+ i(this, "layoutConfig", {});
3866
+ i(this, "animatedLayoutConfig", {});
3867
+ i(this, "hasDraggableNodes", !1);
3868
+ i(this, "hasTransformableViewport", !1);
3869
+ i(this, "hasNodeResizeReactiveEdges", !1);
3870
+ i(this, "hasBackground", !1);
3871
+ i(this, "hasUserConnectablePorts", !1);
3872
+ i(this, "hasUserDraggableEdges", !1);
3873
+ i(this, "hasAnimatedLayout", !1);
3874
+ i(this, "hasLayout", !1);
3875
+ i(this, "boxRenderingTrigger", new j());
3876
+ i(this, "graphStore", new xe());
3877
+ i(this, "viewportStore", new Ze());
3878
+ i(this, "graph", new Le(this.graphStore));
3879
+ i(this, "viewport", new Re(this.viewportStore));
3880
+ i(this, "window", window);
3881
+ i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3454
3882
  this.element = e;
3455
3883
  }
3456
3884
  /**
@@ -3519,21 +3947,21 @@ class qt {
3519
3947
  */
3520
3948
  build() {
3521
3949
  if (this.used)
3522
- throw new Wt("CanvasBuilder is a single use object");
3950
+ throw new Ht("CanvasBuilder is a single use object");
3523
3951
  this.used = !0;
3524
- const e = new bt(this.element);
3525
- let t = new ye(
3952
+ const e = new Dt(this.element);
3953
+ let t = new me(
3526
3954
  this.graphStore,
3527
3955
  this.viewportStore,
3528
3956
  e.main
3529
3957
  );
3530
- this.virtualScrollConfig !== void 0 && (t = new Ye(
3958
+ this.virtualScrollConfig !== void 0 && (t = new je(
3531
3959
  t,
3532
3960
  this.graphStore,
3533
3961
  this.boxRenderingTrigger,
3534
- Ot(this.virtualScrollConfig)
3535
- )), t = new He(t, this.graphStore);
3536
- const s = Nt(this.canvasDefaults), i = new ve(
3962
+ zt(this.virtualScrollConfig)
3963
+ )), t = new Ke(t, this.graphStore);
3964
+ const s = Lt(this.canvasDefaults), o = new ve(
3537
3965
  this.graph,
3538
3966
  this.viewport,
3539
3967
  this.graphStore,
@@ -3542,29 +3970,29 @@ class qt {
3542
3970
  s
3543
3971
  );
3544
3972
  if (this.hasBackground && _.configure(
3545
- i,
3546
- It(this.backgroundConfig),
3973
+ o,
3974
+ Bt(this.backgroundConfig),
3547
3975
  e.background
3548
- ), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
3549
- let a = Mt(this.dragConfig);
3550
- this.hasAnimatedLayout && (a = Kt(
3976
+ ), this.hasNodeResizeReactiveEdges && K.configure(o), this.hasDraggableNodes) {
3977
+ let a = Rt(this.dragConfig);
3978
+ this.hasAnimatedLayout && (a = er(
3551
3979
  a,
3552
3980
  this.animationStaticNodes
3553
- )), Q.configure(
3554
- i,
3981
+ )), J.configure(
3982
+ o,
3555
3983
  e.main,
3556
3984
  this.window,
3557
3985
  a
3558
3986
  );
3559
3987
  }
3560
3988
  if (this.hasUserConnectablePorts) {
3561
- const a = Ut(
3989
+ const a = Ot(
3562
3990
  this.connectablePortsConfig,
3563
3991
  s.edges.shapeFactory,
3564
3992
  s.ports.direction
3565
3993
  );
3566
3994
  ee.configure(
3567
- i,
3995
+ o,
3568
3996
  e.overlayConnectablePorts,
3569
3997
  this.viewportStore,
3570
3998
  this.window,
@@ -3572,12 +4000,12 @@ class qt {
3572
4000
  );
3573
4001
  }
3574
4002
  if (this.hasUserDraggableEdges) {
3575
- const a = Bt(
4003
+ const a = Wt(
3576
4004
  this.draggableEdgesConfig,
3577
- i.graph
4005
+ o.graph
3578
4006
  );
3579
4007
  te.configure(
3580
- i,
4008
+ o,
3581
4009
  e.overlayDraggableEdges,
3582
4010
  this.viewportStore,
3583
4011
  this.window,
@@ -3585,46 +4013,47 @@ class qt {
3585
4013
  );
3586
4014
  }
3587
4015
  this.virtualScrollConfig !== void 0 ? q.configure(
3588
- i,
4016
+ o,
3589
4017
  e.main,
3590
4018
  this.window,
3591
- me(this.transformConfig),
4019
+ ye(this.transformConfig),
3592
4020
  this.boxRenderingTrigger,
3593
- Ft(this.virtualScrollConfig)
3594
- ) : this.hasTransformableViewport && X.configure(
3595
- i,
4021
+ kt(this.virtualScrollConfig)
4022
+ ) : this.hasTransformableViewport && H.configure(
4023
+ o,
3596
4024
  e.main,
3597
4025
  this.window,
3598
- me(this.transformConfig)
3599
- ), this.hasLayout && xt.configure(
3600
- i,
3601
- Gt(this.layoutConfig)
3602
- ), this.hasAnimatedLayout && (Zt(
3603
- i.graph,
4026
+ ye(this.transformConfig)
4027
+ ), this.hasLayout && Pt.configure(
4028
+ o,
4029
+ _t(this.layoutConfig)
4030
+ ), this.hasAnimatedLayout && (tr(
4031
+ o.graph,
3604
4032
  this.animationStaticNodes
3605
4033
  ), oe.configure(
3606
- i,
3607
- Yt(this.animatedLayoutConfig),
4034
+ o,
4035
+ Zt(this.animatedLayoutConfig),
3608
4036
  this.animationStaticNodes,
3609
4037
  this.window
3610
4038
  ));
3611
4039
  const n = () => {
3612
- e.destroy(), i.onBeforeDestroy.unsubscribe(n);
4040
+ e.destroy(), o.onBeforeDestroy.unsubscribe(n);
3613
4041
  };
3614
- return i.onBeforeDestroy.subscribe(n), i;
4042
+ return o.onBeforeDestroy.subscribe(n), o;
3615
4043
  }
3616
4044
  }
3617
4045
  export {
3618
- ct as BezierEdgeShape,
3619
- qt as CanvasBuilder,
3620
- Wt as CanvasBuilderError,
3621
- P as CanvasError,
3622
- Me as DirectEdgeShape,
3623
- G as EventSubject,
3624
- lt as HorizontalEdgeShape,
3625
- ft as InteractiveEdgeError,
3626
- Le as InteractiveEdgeShape,
3627
- Qt as MidpointEdgeShape,
3628
- gt as StraightEdgeShape,
3629
- ut as VerticalEdgeShape
4046
+ ut as BezierEdgeShape,
4047
+ or as CanvasBuilder,
4048
+ Ht as CanvasBuilderError,
4049
+ b as CanvasError,
4050
+ R as ConnectionCategory,
4051
+ Ne as DirectEdgeShape,
4052
+ j as EventSubject,
4053
+ pt as HorizontalEdgeShape,
4054
+ vt as InteractiveEdgeError,
4055
+ Me as InteractiveEdgeShape,
4056
+ sr as MidpointEdgeShape,
4057
+ wt as StraightEdgeShape,
4058
+ ft as VerticalEdgeShape
3630
4059
  };