@html-graph/html-graph 6.0.0 → 7.0.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,35 +1,35 @@
1
- var Ce = Object.defineProperty;
2
- var Ve = (r, e, t) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var s = (r, e, t) => Ve(r, typeof e != "symbol" ? e + "" : e, t);
4
- const T = (r, e) => ({
1
+ var Be = Object.defineProperty;
2
+ var Fe = (r, e, t) => e in r ? Be(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => Fe(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 R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
9
- const $e = () => {
8
+ var C = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(C || {});
9
+ const Oe = () => {
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
- }, Ue = () => {
12
+ }, We = () => {
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
- }, Ie = (r) => {
15
+ }, ke = (r) => {
16
16
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
17
17
  };
18
18
  class ye {
19
- constructor(e, t, o) {
20
- s(this, "host", $e());
21
- s(this, "container", Ue());
22
- s(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
- s(this, "attachedNodeIds", /* @__PURE__ */ new Set());
24
- s(this, "applyTransform", () => {
19
+ constructor(e, t, s) {
20
+ o(this, "host", Oe());
21
+ o(this, "container", We());
22
+ o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
+ o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
24
+ o(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
  });
28
- this.graphStore = e, this.viewportStore = t, this.element = o, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
28
+ this.graphStore = e, this.viewportStore = t, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
29
29
  }
30
30
  attachNode(e) {
31
31
  const t = this.graphStore.getNode(e);
32
- Ie(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
32
+ ke(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: o, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(o, i), d = a.x - n * h.x, c = a.y - n * h.y;
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;
58
58
  t.element.style.transform = `translate(${d}px, ${c}px)`;
59
59
  }
60
60
  updateNodePriority(e) {
@@ -68,29 +68,29 @@ class ye {
68
68
  this.edgeIdToElementMap.set(e, i), this.container.appendChild(i);
69
69
  }
70
70
  renderEdge(e) {
71
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = o.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
72
- o,
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(
72
+ s,
73
73
  n,
74
74
  h,
75
75
  d
76
- ), l = this.createEdgeRenderPort(
76
+ ), g = this.createEdgeRenderPort(
77
77
  i,
78
78
  a,
79
79
  h,
80
80
  d
81
81
  );
82
- let g = R.Line;
83
- o.element === i.element ? g = R.PortCycle : o.nodeId === i.nodeId && (g = R.NodeCycle), t.payload.shape.render({ from: c, to: l, category: g });
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 });
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, o, i) {
89
+ createEdgeRenderPort(e, t, s, i) {
90
90
  const n = {
91
- x: t.left - o.left,
92
- y: t.top - o.top
93
- }, a = T(i, n);
91
+ x: t.left - s.left,
92
+ y: t.top - s.top
93
+ }, a = D(i, n);
94
94
  return {
95
95
  x: a.x,
96
96
  y: a.y,
@@ -100,43 +100,43 @@ class ye {
100
100
  };
101
101
  }
102
102
  }
103
- class Be {
103
+ class ze {
104
104
  constructor(e) {
105
- s(this, "xFrom", 1 / 0);
106
- s(this, "yFrom", 1 / 0);
107
- s(this, "xTo", 1 / 0);
108
- s(this, "yTo", 1 / 0);
105
+ o(this, "xFrom", 1 / 0);
106
+ o(this, "yFrom", 1 / 0);
107
+ o(this, "xTo", 1 / 0);
108
+ o(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: o, y: i } = t;
116
- return o >= this.xFrom && o <= this.xTo && i >= this.yFrom && i <= this.yTo;
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;
117
117
  }
118
118
  hasEdge(e) {
119
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).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), l = Math.max(n.y, a.y);
120
- return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
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);
120
+ return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
121
121
  }
122
122
  }
123
- class Oe {
124
- constructor(e, t, o, i) {
125
- s(this, "attachedNodes", /* @__PURE__ */ new Set());
126
- s(this, "attachedEdges", /* @__PURE__ */ new Set());
127
- s(this, "renderingBox");
128
- s(this, "updateViewport", (e) => {
123
+ class Xe {
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) => {
129
129
  this.renderingBox.setRenderingBox(e);
130
- const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
130
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__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
- h && !d ? t.add(a) : !h && d && o.add(a);
133
+ h && !d ? t.add(a) : !h && d && s.add(a);
134
134
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
135
- const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), l = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
136
- h && (this.renderingBox.hasNode(l) || (t.add(l), o.delete(l)), this.renderingBox.hasNode(g) || (t.add(g), o.delete(g))), h && !d ? i.add(a) : !h && d && n.add(a);
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);
137
137
  }), n.forEach((a) => {
138
138
  this.handleDetachEdge(a);
139
- }), o.forEach((a) => {
139
+ }), s.forEach((a) => {
140
140
  this.handleDetachNode(a);
141
141
  }), t.forEach((a) => {
142
142
  this.attachedNodes.has(a) || this.handleAttachNode(a);
@@ -144,7 +144,7 @@ class Oe {
144
144
  this.handleAttachEdge(a);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = i, this.renderingBox = new Be(this.graphStore), this.trigger.subscribe(this.updateViewport);
147
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new ze(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 Oe {
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), o = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
186
- this.attachedNodes.has(o) || this.handleAttachNode(o), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(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);
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 Oe {
198
198
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
199
199
  }
200
200
  }
201
- class Fe {
201
+ class Ye {
202
202
  constructor(e, t) {
203
- s(this, "deferredNodes", /* @__PURE__ */ new Set());
204
- s(this, "deferredEdges", /* @__PURE__ */ new Set());
203
+ o(this, "deferredNodes", /* @__PURE__ */ new Set());
204
+ o(this, "deferredEdges", /* @__PURE__ */ new Set());
205
205
  this.htmlView = e, this.graphStore = t;
206
206
  }
207
207
  attachNode(e) {
@@ -245,16 +245,16 @@ class Fe {
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), o = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to);
249
- return !(this.deferredNodes.has(o.nodeId) || this.deferredNodes.has(i.nodeId));
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));
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 j {
255
+ class G {
256
256
  constructor() {
257
- s(this, "callbacks", /* @__PURE__ */ new Set());
257
+ o(this, "callbacks", /* @__PURE__ */ new Set());
258
258
  }
259
259
  subscribe(e) {
260
260
  this.callbacks.add(e);
@@ -268,13 +268,13 @@ class j {
268
268
  });
269
269
  }
270
270
  }
271
- const E = () => {
272
- const r = new j();
271
+ const S = () => {
272
+ const r = new G();
273
273
  return [r, r];
274
274
  };
275
- class X {
275
+ class Y {
276
276
  constructor(e) {
277
- s(this, "counter", 0);
277
+ o(this, "counter", 0);
278
278
  this.checkExists = e;
279
279
  }
280
280
  create(e) {
@@ -288,80 +288,80 @@ class X {
288
288
  this.counter = 0;
289
289
  }
290
290
  }
291
- class S extends Error {
291
+ class P extends Error {
292
292
  constructor() {
293
293
  super(...arguments);
294
- s(this, "name", "CanvasError");
294
+ o(this, "name", "CanvasError");
295
295
  }
296
296
  }
297
- class me {
298
- constructor(e, t, o, i, n, a) {
299
- s(this, "nodeIdGenerator", new X(
297
+ class ve {
298
+ constructor(e, t, s, i, n, a) {
299
+ o(this, "nodeIdGenerator", new Y(
300
300
  (e) => this.graphStore.getNode(e) !== void 0
301
301
  ));
302
- s(this, "portIdGenerator", new X(
302
+ o(this, "portIdGenerator", new Y(
303
303
  (e) => this.graphStore.getPort(e) !== void 0
304
304
  ));
305
- s(this, "edgeIdGenerator", new X(
305
+ o(this, "edgeIdGenerator", new Y(
306
306
  (e) => this.graphStore.getEdge(e) !== void 0
307
307
  ));
308
- s(this, "onAfterNodeAdded", (e) => {
308
+ o(this, "onAfterNodeAdded", (e) => {
309
309
  this.htmlView.attachNode(e);
310
310
  });
311
- s(this, "onAfterNodeUpdated", (e) => {
312
- this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((o) => {
313
- this.htmlView.renderEdge(o);
311
+ o(this, "onAfterNodeUpdated", (e) => {
312
+ this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
313
+ this.htmlView.renderEdge(s);
314
314
  });
315
315
  });
316
- s(this, "onAfterNodePriorityUpdated", (e) => {
316
+ o(this, "onAfterNodePriorityUpdated", (e) => {
317
317
  this.htmlView.updateNodePriority(e);
318
318
  });
319
- s(this, "onBeforeNodeRemoved", (e) => {
319
+ o(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
- s(this, "onAfterPortUpdated", (e) => {
325
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((o) => {
326
- this.htmlView.renderEdge(o);
324
+ o(this, "onAfterPortUpdated", (e) => {
325
+ this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
326
+ this.htmlView.renderEdge(s);
327
327
  });
328
328
  });
329
- s(this, "onBeforePortUnmarked", (e) => {
329
+ o(this, "onBeforePortUnmarked", (e) => {
330
330
  this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
331
331
  this.removeEdge(t);
332
332
  });
333
333
  });
334
- s(this, "onAfterEdgeAdded", (e) => {
334
+ o(this, "onAfterEdgeAdded", (e) => {
335
335
  this.htmlView.attachEdge(e);
336
336
  });
337
- s(this, "onAfterEdgeShapeUpdated", (e) => {
337
+ o(this, "onAfterEdgeShapeUpdated", (e) => {
338
338
  this.htmlView.updateEdgeShape(e);
339
339
  });
340
- s(this, "onAfterEdgeUpdated", (e) => {
340
+ o(this, "onAfterEdgeUpdated", (e) => {
341
341
  this.htmlView.renderEdge(e);
342
342
  });
343
- s(this, "onAfterEdgePriorityUpdated", (e) => {
343
+ o(this, "onAfterEdgePriorityUpdated", (e) => {
344
344
  this.htmlView.updateEdgePriority(e);
345
345
  });
346
- s(this, "onBeforeEdgeRemoved", (e) => {
346
+ o(this, "onBeforeEdgeRemoved", (e) => {
347
347
  this.htmlView.detachEdge(e);
348
348
  });
349
- s(this, "onBeforeClear", () => {
349
+ o(this, "onBeforeClear", () => {
350
350
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
351
351
  });
352
- s(this, "onBeforeDestroyEmitter");
353
- s(this, "destroyed", !1);
352
+ o(this, "onBeforeDestroyEmitter");
353
+ o(this, "destroyed", !1);
354
354
  /**
355
355
  * emits event just before destruction of canvas
356
356
  */
357
- s(this, "onBeforeDestroy");
358
- this.graph = e, this.viewport = t, this.graphStore = o, 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
+ 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(
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] = E();
364
+ ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = S();
365
365
  }
366
366
  /**
367
367
  * adds new node
@@ -369,9 +369,9 @@ class me {
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 S("failed to add node with existing id");
372
+ throw new P("failed to add node with existing id");
373
373
  if (this.graphStore.getElementNodeId(e.element) !== void 0)
374
- throw new S(
374
+ throw new P(
375
375
  "failed to add node with html element already in use by another node"
376
376
  );
377
377
  if (this.graphStore.addNode({
@@ -382,12 +382,12 @@ class me {
382
382
  centerFn: e.centerFn ?? this.params.nodes.centerFn,
383
383
  priority: e.priority ?? this.params.nodes.priorityFn()
384
384
  }), e.ports !== void 0)
385
- for (const o of e.ports)
385
+ for (const s of e.ports)
386
386
  this.markPort({
387
- id: o.id,
388
- element: o.element,
387
+ id: s.id,
388
+ element: s.element,
389
389
  nodeId: t,
390
- direction: o.direction
390
+ direction: s.direction
391
391
  });
392
392
  return this;
393
393
  }
@@ -396,7 +396,7 @@ class me {
396
396
  */
397
397
  updateNode(e, t) {
398
398
  if (this.graphStore.getNode(e) === void 0)
399
- throw new S("failed to update nonexistent node");
399
+ throw new P("failed to update nonexistent node");
400
400
  return this.graphStore.updateNode(e, t ?? {}), this;
401
401
  }
402
402
  /**
@@ -406,7 +406,7 @@ class me {
406
406
  */
407
407
  removeNode(e) {
408
408
  if (this.graphStore.getNode(e) === void 0)
409
- throw new S("failed to remove nonexistent node");
409
+ throw new P("failed to remove nonexistent node");
410
410
  return this.graphStore.removeNode(e), this;
411
411
  }
412
412
  /**
@@ -415,9 +415,9 @@ class me {
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 S("failed to add port with existing id");
418
+ throw new P("failed to add port with existing id");
419
419
  if (this.graphStore.getNode(e.nodeId) === void 0)
420
- throw new S("failed to mark port for nonexistent node");
420
+ throw new P("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 me {
430
430
  */
431
431
  updatePort(e, t) {
432
432
  if (this.graphStore.getPort(e) === void 0)
433
- throw new S("failed to update nonexistent port");
433
+ throw new P("failed to update nonexistent port");
434
434
  return this.graphStore.updatePort(e, t ?? {}), this;
435
435
  }
436
436
  /**
@@ -439,7 +439,7 @@ class me {
439
439
  */
440
440
  unmarkPort(e) {
441
441
  if (this.graphStore.getPort(e) === void 0)
442
- throw new S("failed to unmark nonexistent port");
442
+ throw new P("failed to unmark nonexistent port");
443
443
  return this.graphStore.removePort(e), this;
444
444
  }
445
445
  /**
@@ -448,11 +448,11 @@ class me {
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 S("failed to add edge with existing id");
451
+ throw new P("failed to add edge with existing id");
452
452
  if (this.graphStore.getPort(e.from) === void 0)
453
- throw new S("failed to add edge from nonexistent port");
453
+ throw new P("failed to add edge from nonexistent port");
454
454
  if (this.graphStore.getPort(e.to) === void 0)
455
- throw new S("failed to add edge to nonexistent port");
455
+ throw new P("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 me {
466
466
  */
467
467
  updateEdge(e, t) {
468
468
  if (this.graphStore.getEdge(e) === void 0)
469
- throw new S("failed to update nonexistent edge");
469
+ throw new P("failed to update nonexistent edge");
470
470
  return this.graphStore.updateEdge(e, t ?? {}), this;
471
471
  }
472
472
  /**
@@ -474,7 +474,7 @@ class me {
474
474
  */
475
475
  removeEdge(e) {
476
476
  if (this.graphStore.getEdge(e) === void 0)
477
- throw new S("failed to remove nonexistent edge");
477
+ throw new P("failed to remove nonexistent edge");
478
478
  return this.graphStore.removeEdge(e), this;
479
479
  }
480
480
  /**
@@ -510,37 +510,37 @@ class me {
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 We {
513
+ class He {
514
514
  constructor() {
515
- s(this, "singleToMultiMap", /* @__PURE__ */ new Map());
516
- s(this, "multiToSingleMap", /* @__PURE__ */ new Map());
515
+ o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
516
+ o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
517
517
  }
518
518
  addRecord(e, t) {
519
- const o = this.singleToMultiMap.get(e);
520
- o === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : o.add(t), this.multiToSingleMap.set(t, e);
519
+ const s = this.singleToMultiMap.get(e);
520
+ s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
521
521
  }
522
522
  getMultiBySingle(e) {
523
523
  const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
524
524
  return Array.from(t.values());
525
525
  }
526
526
  removeByMulti(e) {
527
- const t = this.multiToSingleMap.get(e), o = this.singleToMultiMap.get(t);
528
- o.delete(e), o.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
527
+ const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
528
+ s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
529
529
  }
530
530
  getByMulti(e) {
531
531
  return this.multiToSingleMap.get(e);
532
532
  }
533
533
  removeBySingle(e) {
534
- this.singleToMultiMap.get(e).forEach((o) => {
535
- this.multiToSingleMap.delete(o);
534
+ this.singleToMultiMap.get(e).forEach((s) => {
535
+ this.multiToSingleMap.delete(s);
536
536
  }), this.singleToMultiMap.delete(e);
537
537
  }
538
538
  clear() {
539
539
  this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
540
540
  }
541
541
  forEachSingle(e) {
542
- this.singleToMultiMap.forEach((t, o) => {
543
- e(o);
542
+ this.singleToMultiMap.forEach((t, s) => {
543
+ e(s);
544
544
  });
545
545
  }
546
546
  hasSingle(e) {
@@ -550,46 +550,46 @@ class We {
550
550
  return this.multiToSingleMap.get(e) !== void 0;
551
551
  }
552
552
  }
553
- class ve {
553
+ class Ee {
554
554
  constructor() {
555
- s(this, "nodes", /* @__PURE__ */ new Map());
556
- s(this, "ports", /* @__PURE__ */ new Map());
557
- s(this, "edges", /* @__PURE__ */ new Map());
558
- s(this, "nodesElementsMap", /* @__PURE__ */ new Map());
559
- s(this, "portIncomingEdges", /* @__PURE__ */ new Map());
560
- s(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
561
- s(this, "portCycleEdges", /* @__PURE__ */ new Map());
562
- s(this, "elementPorts", new We());
563
- s(this, "afterNodeAddedEmitter");
564
- s(this, "onAfterNodeAdded");
565
- s(this, "afterNodeUpdatedEmitter");
566
- s(this, "onAfterNodeUpdated");
567
- s(this, "afterNodePriorityUpdatedEmitter");
568
- s(this, "onAfterNodePriorityUpdated");
569
- s(this, "beforeNodeRemovedEmitter");
570
- s(this, "onBeforeNodeRemoved");
571
- s(this, "afterPortAddedEmitter");
572
- s(this, "onAfterPortAdded");
573
- s(this, "afterPortUpdatedEmitter");
574
- s(this, "onAfterPortUpdated");
575
- s(this, "beforePortRemovedEmitter");
576
- s(this, "onBeforePortRemoved");
577
- s(this, "afterEdgeAddedEmitter");
578
- s(this, "onAfterEdgeAdded");
579
- s(this, "afterEdgeShapeUpdatedEmitter");
580
- s(this, "onAfterEdgeShapeUpdated");
581
- s(this, "afterEdgeUpdatedEmitter");
582
- s(this, "onAfterEdgeUpdated");
583
- s(this, "afterEdgePriorityUpdatedEmitter");
584
- s(this, "onAfterEdgePriorityUpdated");
585
- s(this, "beforeEdgeRemovedEmitter");
586
- s(this, "onBeforeEdgeRemoved");
587
- s(this, "beforeClearEmitter");
588
- s(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();
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 He());
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] = S(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = S(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = S(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = S(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = S(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = S(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = S(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = S(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = S(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = S(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = S(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = S(), [this.beforeClearEmitter, this.onBeforeClear] = S();
590
590
  }
591
591
  addNode(e) {
592
- const t = /* @__PURE__ */ new Map(), o = {
592
+ const t = /* @__PURE__ */ new Map(), s = {
593
593
  element: e.element,
594
594
  payload: {
595
595
  x: e.x,
@@ -599,7 +599,7 @@ class ve {
599
599
  },
600
600
  ports: t
601
601
  };
602
- this.nodes.set(e.id, o), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
602
+ this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
603
603
  }
604
604
  getAllNodeIds() {
605
605
  return Array.from(this.nodes.keys());
@@ -611,8 +611,8 @@ class ve {
611
611
  return this.nodesElementsMap.get(e);
612
612
  }
613
613
  updateNode(e, t) {
614
- const o = this.nodes.get(e).payload;
615
- o.x = t.x ?? o.x, o.y = t.y ?? o.y, o.centerFn = t.centerFn ?? o.centerFn, t.priority !== void 0 && (o.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
614
+ const s = this.nodes.get(e).payload;
615
+ s.x = t.x ?? s.x, s.y = t.y ?? s.y, s.centerFn = t.centerFn ?? s.centerFn, t.priority !== void 0 && (s.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
616
616
  }
617
617
  removeNode(e) {
618
618
  this.beforeNodeRemovedEmitter.emit(e);
@@ -632,8 +632,8 @@ class ve {
632
632
  return this.ports.get(e);
633
633
  }
634
634
  updatePort(e, t) {
635
- const o = this.ports.get(e).payload;
636
- o.direction = t.direction ?? o.direction, this.afterPortUpdatedEmitter.emit(e);
635
+ const s = this.ports.get(e).payload;
636
+ s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
637
637
  }
638
638
  getAllPortIds() {
639
639
  return Array.from(this.ports.keys());
@@ -664,8 +664,8 @@ class ve {
664
664
  priority: n.priority
665
665
  });
666
666
  }
667
- const o = this.edges.get(e);
668
- t.shape !== void 0 && (o.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (o.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
667
+ const s = this.edges.get(e);
668
+ t.shape !== void 0 && (s.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (s.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
669
669
  }
670
670
  getAllEdgeIds() {
671
671
  return Array.from(this.edges.keys());
@@ -696,51 +696,51 @@ class ve {
696
696
  ];
697
697
  }
698
698
  getNodeIncomingEdgeIds(e) {
699
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
699
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
700
700
  return t.forEach((i) => {
701
701
  this.getPortIncomingEdgeIds(i).filter((n) => {
702
702
  const a = this.getEdge(n);
703
703
  return this.getPort(a.from).nodeId !== e;
704
704
  }).forEach((n) => {
705
- o.push(n);
705
+ s.push(n);
706
706
  });
707
- }), o;
707
+ }), s;
708
708
  }
709
709
  getNodeOutgoingEdgeIds(e) {
710
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
710
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
711
711
  return t.forEach((i) => {
712
712
  this.getPortOutgoingEdgeIds(i).filter((n) => {
713
713
  const a = this.getEdge(n);
714
714
  return this.getPort(a.to).nodeId !== e;
715
715
  }).forEach((n) => {
716
- o.push(n);
716
+ s.push(n);
717
717
  });
718
- }), o;
718
+ }), s;
719
719
  }
720
720
  getNodeCycleEdgeIds(e) {
721
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
721
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
722
722
  return t.forEach((i) => {
723
723
  this.getPortCycleEdgeIds(i).forEach((n) => {
724
- o.push(n);
724
+ s.push(n);
725
725
  }), this.getPortIncomingEdgeIds(i).filter((n) => {
726
726
  const a = this.getEdge(n);
727
727
  return this.getPort(a.to).nodeId === e;
728
728
  }).forEach((n) => {
729
- o.push(n);
729
+ s.push(n);
730
730
  });
731
- }), o;
731
+ }), s;
732
732
  }
733
733
  getNodeAdjacentEdgeIds(e) {
734
- const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
734
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
735
735
  return t.forEach((i) => {
736
736
  this.getPortIncomingEdgeIds(i).forEach((n) => {
737
- o.push(n);
737
+ s.push(n);
738
738
  }), this.getPortOutgoingEdgeIds(i).forEach((n) => {
739
- o.push(n);
739
+ s.push(n);
740
740
  }), this.getPortCycleEdgeIds(i).forEach((n) => {
741
- o.push(n);
741
+ s.push(n);
742
742
  });
743
- }), o;
743
+ }), s;
744
744
  }
745
745
  addEdgeInternal(e) {
746
746
  this.edges.set(e.id, {
@@ -753,26 +753,26 @@ class ve {
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), o = t.from, i = t.to;
757
- this.portCycleEdges.get(o).delete(e), this.portCycleEdges.get(i).delete(e), this.portIncomingEdges.get(o).delete(e), this.portIncomingEdges.get(i).delete(e), this.portOutcomingEdges.get(o).delete(e), this.portOutcomingEdges.get(i).delete(e), this.edges.delete(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);
758
758
  }
759
759
  }
760
- const de = (r) => ({
760
+ const ce = (r) => ({
761
761
  scale: 1 / r.scale,
762
762
  x: -r.x / r.scale,
763
763
  y: -r.y / r.scale
764
- }), ce = {
764
+ }), le = {
765
765
  scale: 1,
766
766
  x: 0,
767
767
  y: 0
768
768
  };
769
- class ke {
769
+ class je {
770
770
  constructor() {
771
- s(this, "viewportMatrix", ce);
772
- s(this, "contentMatrix", ce);
773
- s(this, "afterUpdateEmitter");
774
- s(this, "onAfterUpdated");
775
- [this.afterUpdateEmitter, this.onAfterUpdated] = E();
771
+ o(this, "viewportMatrix", le);
772
+ o(this, "contentMatrix", le);
773
+ o(this, "afterUpdateEmitter");
774
+ o(this, "onAfterUpdated");
775
+ [this.afterUpdateEmitter, this.onAfterUpdated] = S();
776
776
  }
777
777
  getViewportMatrix() {
778
778
  return this.viewportMatrix;
@@ -785,52 +785,52 @@ class ke {
785
785
  scale: e.scale ?? this.viewportMatrix.scale,
786
786
  x: e.x ?? this.viewportMatrix.x,
787
787
  y: e.y ?? this.viewportMatrix.y
788
- }, this.contentMatrix = de(this.viewportMatrix), this.afterUpdateEmitter.emit();
788
+ }, this.contentMatrix = ce(this.viewportMatrix), this.afterUpdateEmitter.emit();
789
789
  }
790
790
  patchContentMatrix(e) {
791
791
  this.contentMatrix = {
792
792
  scale: e.scale ?? this.contentMatrix.scale,
793
793
  x: e.x ?? this.contentMatrix.x,
794
794
  y: e.y ?? this.contentMatrix.y
795
- }, this.viewportMatrix = de(this.contentMatrix), this.afterUpdateEmitter.emit();
795
+ }, this.viewportMatrix = ce(this.contentMatrix), this.afterUpdateEmitter.emit();
796
796
  }
797
797
  }
798
- class G {
798
+ class K {
799
799
  constructor(e) {
800
- s(this, "elementToNodeId", /* @__PURE__ */ new Map());
801
- s(this, "nodesResizeObserver");
802
- s(this, "onAfterNodeAdded", (e) => {
800
+ o(this, "elementToNodeId", /* @__PURE__ */ new Map());
801
+ o(this, "nodesResizeObserver");
802
+ o(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
- s(this, "onBeforeNodeRemoved", (e) => {
806
+ o(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
- s(this, "onBeforeClear", () => {
810
+ o(this, "onBeforeClear", () => {
811
811
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
812
812
  });
813
813
  this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
814
- t.forEach((o) => {
815
- const i = o.target;
814
+ t.forEach((s) => {
815
+ const i = s.target;
816
816
  this.handleNodeResize(i);
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
  }
820
820
  static configure(e) {
821
- new G(e);
821
+ new K(e);
822
822
  }
823
823
  handleNodeResize(e) {
824
824
  const t = this.elementToNodeId.get(e);
825
825
  this.canvas.updateNode(t);
826
826
  }
827
827
  }
828
- const ze = (r, e, t) => {
829
- const { x: o, y: i, width: n, height: a } = r.getBoundingClientRect();
830
- return e >= o && e <= o + n && t >= i && t <= i + a;
831
- }, Xe = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, C = (r, e, t, o) => ze(e, t, o) && Xe(r, t, o), I = (r, e) => {
828
+ const Ge = (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
+ }, Ke = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, V = (r, e, t, s) => Ge(e, t, s) && Ke(r, t, s), B = (r, e) => {
832
832
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
833
- }, B = (r) => {
833
+ }, F = (r) => {
834
834
  const e = document.createElement("div");
835
835
  return {
836
836
  id: r.overlayId,
@@ -845,38 +845,38 @@ const ze = (r, e, t) => {
845
845
  }
846
846
  ]
847
847
  };
848
- }, Ye = (r, e) => {
849
- let t = e, o = null;
850
- for (; t !== null && (o = r.getElementPortIds(t)[0] ?? null, o === null); )
848
+ }, Ze = (r, e) => {
849
+ let t = e, s = null;
850
+ for (; t !== null && (s = r.getElementPortIds(t)[0] ?? null, s === null); )
851
851
  t = t.parentElement;
852
- return o;
853
- }, Ee = (r, e) => {
852
+ return s;
853
+ }, Ae = (r, e) => {
854
854
  const t = document.elementsFromPoint(e.x, e.y);
855
- for (const o of t) {
856
- const i = Ye(r, o);
855
+ for (const s of t) {
856
+ const i = Ze(r, s);
857
857
  if (i !== null)
858
858
  return i;
859
859
  }
860
860
  return null;
861
861
  };
862
- var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(P || {});
863
- const Ae = (r, e) => ({
862
+ var b = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(b || {});
863
+ const xe = (r, e) => ({
864
864
  x: r / 2,
865
865
  y: e / 2
866
- }), u = {
866
+ }), p = {
867
867
  x: 0,
868
868
  y: 0
869
- }, m = (r, e, t) => ({
869
+ }, y = (r, e, t) => ({
870
870
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
871
871
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
872
- }), xe = (r, e) => {
872
+ }), Se = (r, e) => {
873
873
  const t = {
874
874
  x: r.x + r.width / 2,
875
875
  y: r.y + r.height / 2
876
- }, o = {
876
+ }, s = {
877
877
  x: e.x + e.width / 2,
878
878
  y: e.y + e.height / 2
879
- }, i = Math.min(t.x, o.x), n = Math.min(t.y, o.y), a = Math.abs(o.x - t.x), h = Math.abs(o.y - t.y), d = t.x <= o.x ? 1 : -1, c = t.y <= o.y ? 1 : -1;
879
+ }, 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;
880
880
  return {
881
881
  x: i,
882
882
  y: n,
@@ -885,311 +885,311 @@ const Ae = (r, e) => ({
885
885
  flipX: d,
886
886
  flipY: c
887
887
  };
888
- }, F = (r, e, t, o) => ({
889
- x: e * r.x + (1 - e) / 2 * o.x,
890
- y: t * r.y + (1 - t) / 2 * o.y
888
+ }, W = (r, e, t, s) => ({
889
+ x: e * r.x + (1 - e) / 2 * s.x,
890
+ y: t * r.y + (1 - t) / 2 * s.y
891
891
  });
892
- class He {
892
+ class Je {
893
893
  constructor(e) {
894
- s(this, "path");
895
- s(this, "midpoint");
894
+ o(this, "path");
895
+ o(this, "midpoint");
896
896
  this.params = e;
897
897
  const t = this.params.to;
898
898
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
899
- const o = m(
900
- { x: this.params.arrowLength, y: u.y },
899
+ const s = y(
900
+ { x: this.params.arrowLength, y: p.y },
901
901
  this.params.sourceDirection,
902
- u
903
- ), i = m(
902
+ p
903
+ ), i = y(
904
904
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
905
905
  this.params.targetDirection,
906
906
  this.params.to
907
907
  ), n = {
908
- x: o.x + this.params.sourceDirection.x * this.params.curvature,
909
- y: o.y + this.params.sourceDirection.y * this.params.curvature
908
+ x: s.x + this.params.sourceDirection.x * this.params.curvature,
909
+ y: s.y + this.params.sourceDirection.y * this.params.curvature
910
910
  }, a = {
911
911
  x: i.x - this.params.targetDirection.x * this.params.curvature,
912
912
  y: i.y - this.params.targetDirection.y * this.params.curvature
913
- }, h = `M ${o.x} ${o.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${u.x} ${u.y} L ${o.x} ${o.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
913
+ }, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
914
914
  this.path = `${d}${h}${c}`;
915
915
  }
916
916
  }
917
- class je {
917
+ class Qe {
918
918
  constructor(e) {
919
- s(this, "path");
920
- s(this, "midpoint");
919
+ o(this, "path");
920
+ o(this, "midpoint");
921
921
  this.params = e;
922
- const t = this.params.hasSourceArrow ? m(
923
- { x: this.params.arrowLength, y: u.y },
922
+ const t = this.params.hasSourceArrow ? y(
923
+ { x: this.params.arrowLength, y: p.y },
924
924
  this.params.sourceDirection,
925
- u
926
- ) : u, o = this.params.hasTargetArrow ? m(
925
+ p
926
+ ) : p, s = this.params.hasTargetArrow ? y(
927
927
  {
928
928
  x: this.params.to.x - this.params.arrowLength,
929
929
  y: this.params.to.y
930
930
  },
931
931
  this.params.targetDirection,
932
932
  this.params.to
933
- ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
934
- { x: i, y: u.y },
933
+ ) : 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(
934
+ { x: i, y: p.y },
935
935
  this.params.sourceDirection,
936
- u
937
- ), l = {
936
+ p
937
+ ), g = {
938
938
  x: c.x + h,
939
939
  y: c.y + d
940
- }, g = m(
940
+ }, l = y(
941
941
  { x: this.params.to.x - i, y: this.params.to.y },
942
942
  this.params.targetDirection,
943
943
  this.params.to
944
- ), p = {
945
- x: g.x + h,
946
- y: g.y + d
947
- }, f = {
948
- x: (l.x + p.x) / 2,
949
- y: (l.y + p.y) / 2
950
- }, y = {
944
+ ), u = {
945
+ x: l.x + h,
946
+ y: l.y + d
947
+ }, w = {
948
+ x: (g.x + u.x) / 2,
949
+ y: (g.y + u.y) / 2
950
+ }, m = {
951
951
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
952
952
  y: c.y + this.params.curvature * this.params.sourceDirection.y
953
953
  }, v = {
954
- x: g.x - this.params.curvature * this.params.targetDirection.x,
955
- y: g.y - this.params.curvature * this.params.targetDirection.y
956
- }, x = {
954
+ x: l.x - this.params.curvature * this.params.targetDirection.x,
955
+ y: l.y - this.params.curvature * this.params.targetDirection.y
956
+ }, E = {
957
957
  x: c.x + h,
958
958
  y: c.y + d
959
959
  }, A = {
960
- x: g.x + h,
961
- y: g.y + d
960
+ x: l.x + h,
961
+ y: l.y + d
962
962
  };
963
963
  this.path = [
964
964
  `M ${t.x} ${t.y}`,
965
965
  `L ${c.x} ${c.y}`,
966
- `C ${y.x} ${y.y} ${x.x} ${x.y} ${f.x} ${f.y}`,
967
- `C ${A.x} ${A.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
968
- `L ${o.x} ${o.y}`
969
- ].join(" "), this.midpoint = F(f, e.flipX, e.flipY, e.to);
966
+ `C ${m.x} ${m.y} ${E.x} ${E.y} ${w.x} ${w.y}`,
967
+ `C ${A.x} ${A.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
968
+ `L ${s.x} ${s.y}`
969
+ ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
970
970
  }
971
971
  }
972
- const K = Object.freeze({
972
+ const Z = Object.freeze({
973
973
  edgeColor: "--edge-color"
974
- }), Se = (r) => {
974
+ }), Pe = (r) => {
975
975
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
976
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(K.edgeColor, r), e;
977
- }, Pe = (r) => {
976
+ 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;
977
+ }, be = (r) => {
978
978
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
979
- return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
979
+ return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
980
980
  }, O = () => {
981
981
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
982
- return r.setAttribute("fill", `var(${K.edgeColor})`), r;
983
- }, be = () => {
982
+ return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
983
+ }, Te = () => {
984
984
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
985
985
  return r.style.transformOrigin = "50% 50%", r;
986
- }, Te = (r, e) => {
986
+ }, De = (r, e) => {
987
987
  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`;
988
988
  }, L = (r, e) => {
989
989
  const t = [];
990
990
  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) {
991
- const o = r.length - 1;
991
+ const s = r.length - 1;
992
992
  let i = 0, n = 0, a = 0;
993
993
  r.forEach((h, d) => {
994
- let c = 0, l = 0, g = 0;
995
- const p = d > 0, f = d < o, y = p && f;
996
- if (p && (c = -i, l = -n, g = a), f) {
997
- const V = r[d + 1];
998
- i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
994
+ let c = 0, g = 0, l = 0;
995
+ const u = d > 0, w = d < s, m = u && w;
996
+ if (u && (c = -i, g = -n, l = a), w) {
997
+ const $ = r[d + 1];
998
+ i = $.x - h.x, n = $.y - h.y, a = Math.sqrt(i * i + n * n);
999
999
  }
1000
- const x = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, A = y ? { x: h.x + i * x, y: h.y + n * x } : h, b = g !== 0 ? Math.min((y ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * b, y: h.y + l * b } : h;
1001
- d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
1000
+ 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, T = l !== 0 ? Math.min((m ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = m ? { x: h.x + c * T, y: h.y + g * T } : h;
1001
+ d > 0 && t.push(`L ${N.x} ${N.y}`), m && t.push(
1002
1002
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
1003
1003
  );
1004
1004
  });
1005
1005
  }
1006
1006
  return t.join(" ");
1007
1007
  };
1008
- class Ge {
1008
+ class qe {
1009
1009
  constructor(e) {
1010
- s(this, "path");
1011
- s(this, "midpoint");
1010
+ o(this, "path");
1011
+ o(this, "midpoint");
1012
1012
  this.params = e;
1013
1013
  const t = this.params.to;
1014
1014
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1015
- const o = this.params.hasSourceArrow ? m(
1016
- { x: this.params.arrowLength, y: u.y },
1015
+ const s = this.params.hasSourceArrow ? y(
1016
+ { x: this.params.arrowLength, y: p.y },
1017
1017
  this.params.sourceDirection,
1018
- u
1019
- ) : u, i = this.params.hasTargetArrow ? m(
1018
+ p
1019
+ ) : p, i = this.params.hasTargetArrow ? y(
1020
1020
  {
1021
1021
  x: this.params.to.x - this.params.arrowLength,
1022
1022
  y: this.params.to.y
1023
1023
  },
1024
1024
  this.params.targetDirection,
1025
1025
  this.params.to
1026
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1027
- { x: a, y: u.y },
1026
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1027
+ { x: a, y: p.y },
1028
1028
  this.params.sourceDirection,
1029
- u
1030
- ), d = m(
1029
+ p
1030
+ ), d = y(
1031
1031
  { x: this.params.to.x - a, y: this.params.to.y },
1032
1032
  this.params.targetDirection,
1033
1033
  this.params.to
1034
- ), c = Math.max((h.x + d.x) / 2, n), l = this.params.to.y / 2, g = {
1034
+ ), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
1035
1035
  x: this.params.flipX > 0 ? c : -n,
1036
1036
  y: h.y
1037
- }, p = { x: g.x, y: l }, f = {
1037
+ }, u = { x: l.x, y: g }, w = {
1038
1038
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1039
1039
  y: d.y
1040
- }, y = { x: f.x, y: l };
1040
+ }, m = { x: w.x, y: g };
1041
1041
  this.path = L(
1042
- [o, h, g, p, y, f, d, i],
1042
+ [s, h, l, u, m, w, d, i],
1043
1043
  this.params.roundness
1044
1044
  );
1045
1045
  }
1046
1046
  }
1047
- class Ke {
1047
+ class _e {
1048
1048
  constructor(e) {
1049
- s(this, "path");
1050
- s(this, "midpoint");
1049
+ o(this, "path");
1050
+ o(this, "midpoint");
1051
1051
  this.params = e;
1052
- const t = this.params.hasSourceArrow ? m(
1053
- { x: this.params.arrowLength, y: u.y },
1052
+ const t = this.params.hasSourceArrow ? y(
1053
+ { x: this.params.arrowLength, y: p.y },
1054
1054
  this.params.sourceDirection,
1055
- u
1056
- ) : u, o = this.params.hasTargetArrow ? m(
1055
+ p
1056
+ ) : p, s = this.params.hasTargetArrow ? y(
1057
1057
  {
1058
1058
  x: this.params.to.x - this.params.arrowLength,
1059
1059
  y: this.params.to.y
1060
1060
  },
1061
1061
  this.params.targetDirection,
1062
1062
  this.params.to
1063
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1064
- { x: i, y: u.y },
1063
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1064
+ { x: i, y: p.y },
1065
1065
  this.params.sourceDirection,
1066
- u
1067
- ), 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, l = { x: n.x + d, y: n.y + c }, g = m(
1066
+ p
1067
+ ), 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(
1068
1068
  { x: this.params.to.x - i, y: this.params.to.y },
1069
1069
  this.params.targetDirection,
1070
1070
  this.params.to
1071
- ), p = { x: g.x + d, y: g.y + c }, f = { x: (l.x + p.x) / 2, y: (l.y + p.y) / 2 };
1072
- this.midpoint = F(f, e.flipX, e.flipY, e.to), this.path = L(
1073
- [t, n, l, p, g, o],
1071
+ ), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
1072
+ this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = L(
1073
+ [t, n, g, u, l, s],
1074
1074
  this.params.roundness
1075
1075
  );
1076
1076
  }
1077
1077
  }
1078
- class Ze {
1078
+ class et {
1079
1079
  constructor(e) {
1080
- s(this, "path");
1081
- s(this, "midpoint");
1080
+ o(this, "path");
1081
+ o(this, "midpoint");
1082
1082
  this.params = e;
1083
1083
  const t = this.params.to;
1084
1084
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1085
- const o = this.params.hasSourceArrow ? m(
1086
- { x: this.params.arrowLength, y: u.y },
1085
+ const s = this.params.hasSourceArrow ? y(
1086
+ { x: this.params.arrowLength, y: p.y },
1087
1087
  this.params.sourceDirection,
1088
- u
1089
- ) : u, i = this.params.hasTargetArrow ? m(
1088
+ p
1089
+ ) : p, i = this.params.hasTargetArrow ? y(
1090
1090
  {
1091
1091
  x: this.params.to.x - this.params.arrowLength,
1092
1092
  y: this.params.to.y
1093
1093
  },
1094
1094
  this.params.targetDirection,
1095
1095
  this.params.to
1096
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
1097
- { x: n, y: u.y },
1096
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
1097
+ { x: n, y: p.y },
1098
1098
  this.params.sourceDirection,
1099
- u
1100
- ), h = m(
1099
+ p
1100
+ ), h = y(
1101
1101
  { x: this.params.to.x - n, y: this.params.to.y },
1102
1102
  this.params.targetDirection,
1103
1103
  this.params.to
1104
1104
  );
1105
- this.path = L([o, a, h, i], this.params.roundness);
1105
+ this.path = L([s, a, h, i], this.params.roundness);
1106
1106
  }
1107
1107
  }
1108
- class Je {
1108
+ class tt {
1109
1109
  constructor(e) {
1110
- s(this, "path");
1111
- s(this, "midpoint");
1110
+ o(this, "path");
1111
+ o(this, "midpoint");
1112
1112
  this.params = e;
1113
1113
  const t = this.params.to;
1114
1114
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1115
- const o = this.params.hasSourceArrow ? m(
1116
- { x: this.params.arrowLength, y: u.y },
1115
+ const s = this.params.hasSourceArrow ? y(
1116
+ { x: this.params.arrowLength, y: p.y },
1117
1117
  this.params.sourceDirection,
1118
- u
1119
- ) : u, i = this.params.hasTargetArrow ? m(
1118
+ p
1119
+ ) : p, i = this.params.hasTargetArrow ? y(
1120
1120
  {
1121
1121
  x: this.params.to.x - this.params.arrowLength,
1122
1122
  y: this.params.to.y
1123
1123
  },
1124
1124
  this.params.targetDirection,
1125
1125
  this.params.to
1126
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1127
- { x: a, y: u.y },
1126
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1127
+ { x: a, y: p.y },
1128
1128
  this.params.sourceDirection,
1129
- u
1130
- ), d = m(
1129
+ p
1130
+ ), d = y(
1131
1131
  { x: this.params.to.x - a, y: this.params.to.y },
1132
1132
  this.params.targetDirection,
1133
1133
  this.params.to
1134
- ), c = Math.max((h.y + d.y) / 2, n), l = this.params.to.x / 2, g = {
1134
+ ), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
1135
1135
  x: h.x,
1136
1136
  y: this.params.flipY > 0 ? c : -n
1137
- }, p = { x: l, y: g.y }, f = {
1137
+ }, u = { x: g, y: l.y }, w = {
1138
1138
  x: d.x,
1139
1139
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1140
- }, y = { x: l, y: f.y };
1140
+ }, m = { x: g, y: w.y };
1141
1141
  this.path = L(
1142
- [o, h, g, p, y, f, d, i],
1142
+ [s, h, l, u, m, w, d, i],
1143
1143
  this.params.roundness
1144
1144
  );
1145
1145
  }
1146
1146
  }
1147
- class Z {
1147
+ class J {
1148
1148
  constructor(e) {
1149
- s(this, "path");
1150
- s(this, "midpoint");
1149
+ o(this, "path");
1150
+ o(this, "midpoint");
1151
1151
  this.params = e;
1152
- const t = this.params.arrowOffset, o = this.params.side, i = this.params.arrowLength + t, n = i + 2 * o, h = [
1153
- { x: this.params.arrowLength, y: u.y },
1154
- { x: i, y: u.y },
1152
+ const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
1153
+ { x: this.params.arrowLength, y: p.y },
1154
+ { x: i, y: p.y },
1155
1155
  { x: i, y: this.params.side },
1156
1156
  { x: n, y: this.params.side },
1157
1157
  { x: n, y: -this.params.side },
1158
1158
  { x: i, y: -this.params.side },
1159
- { x: i, y: u.y },
1160
- { x: this.params.arrowLength, y: u.y }
1159
+ { x: i, y: p.y },
1160
+ { x: this.params.arrowLength, y: p.y }
1161
1161
  ].map(
1162
- (c) => m(c, this.params.sourceDirection, u)
1163
- ), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
1162
+ (c) => y(c, this.params.sourceDirection, p)
1163
+ ), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
1164
1164
  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 };
1165
1165
  }
1166
1166
  }
1167
- class Qe {
1167
+ class rt {
1168
1168
  constructor(e) {
1169
- s(this, "path");
1170
- s(this, "midpoint");
1169
+ o(this, "path");
1170
+ o(this, "midpoint");
1171
1171
  this.params = e;
1172
- const t = this.params.smallRadius, o = this.params.radius, i = t + o, n = t * o / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + o + this.params.arrowLength, c = this.params.arrowLength + h, g = [
1173
- { x: this.params.arrowLength, y: u.y },
1172
+ 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 = [
1173
+ { x: this.params.arrowLength, y: p.y },
1174
1174
  { x: c, y: n },
1175
1175
  { x: c, y: -n },
1176
1176
  { x: d, y: 0 }
1177
1177
  ].map(
1178
- (y) => m(y, this.params.sourceDirection, u)
1179
- ), p = [
1180
- `M ${g[0].x} ${g[0].y}`,
1181
- `A ${t} ${t} 0 0 1 ${g[1].x} ${g[1].y}`,
1182
- `A ${o} ${o} 0 1 0 ${g[2].x} ${g[2].y}`,
1183
- `A ${t} ${t} 0 0 1 ${g[0].x} ${g[0].y}`
1184
- ].join(" "), f = `M 0 0 L ${g[0].x} ${g[0].y} `;
1185
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.midpoint = g[3];
1178
+ (m) => y(m, this.params.sourceDirection, p)
1179
+ ), u = [
1180
+ `M ${l[0].x} ${l[0].y}`,
1181
+ `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
1182
+ `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
1183
+ `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
1184
+ ].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
1185
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
1186
1186
  }
1187
1187
  }
1188
- class _e {
1188
+ class st {
1189
1189
  constructor(e) {
1190
- s(this, "path");
1191
- s(this, "midpoint");
1192
- s(this, "diagonalDistance");
1190
+ o(this, "path");
1191
+ o(this, "midpoint");
1192
+ o(this, "diagonalDistance");
1193
1193
  this.params = e;
1194
1194
  const t = this.params.to;
1195
1195
  if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
@@ -1204,7 +1204,7 @@ class _e {
1204
1204
  offset: this.params.sourceOffset,
1205
1205
  hasArrow: this.params.hasSourceArrow,
1206
1206
  flip: 1,
1207
- shift: u
1207
+ shift: p
1208
1208
  }), n = this.createDirectLinePoint({
1209
1209
  offset: this.params.targetOffset,
1210
1210
  hasArrow: this.params.hasTargetArrow,
@@ -1214,96 +1214,96 @@ class _e {
1214
1214
  this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
1215
1215
  }
1216
1216
  createDirectLinePoint(e) {
1217
- const t = e.hasArrow ? this.params.arrowLength : 0, o = e.offset + t, i = e.flip * o / this.diagonalDistance;
1217
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
1218
1218
  return {
1219
1219
  x: this.params.to.x * i + e.shift.x,
1220
1220
  y: this.params.to.y * i + e.shift.y
1221
1221
  };
1222
1222
  }
1223
1223
  }
1224
- class qe {
1224
+ class ot {
1225
1225
  constructor(e) {
1226
- s(this, "path");
1227
- s(this, "midpoint");
1226
+ o(this, "path");
1227
+ o(this, "midpoint");
1228
1228
  this.params = e;
1229
- const t = this.params.hasSourceArrow ? m(
1230
- { x: this.params.arrowLength, y: u.y },
1229
+ const t = this.params.hasSourceArrow ? y(
1230
+ { x: this.params.arrowLength, y: p.y },
1231
1231
  this.params.sourceDirection,
1232
- u
1233
- ) : u, o = this.params.hasTargetArrow ? m(
1232
+ p
1233
+ ) : p, s = this.params.hasTargetArrow ? y(
1234
1234
  {
1235
1235
  x: this.params.to.x - this.params.arrowLength,
1236
1236
  y: this.params.to.y
1237
1237
  },
1238
1238
  this.params.targetDirection,
1239
1239
  this.params.to
1240
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1241
- { x: i, y: u.y },
1240
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1241
+ { x: i, y: p.y },
1242
1242
  this.params.sourceDirection,
1243
- u
1244
- ), a = m(
1243
+ p
1244
+ ), a = y(
1245
1245
  { x: this.params.to.x - i, y: this.params.to.y },
1246
1246
  this.params.targetDirection,
1247
1247
  this.params.to
1248
- ), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.y / 2, c = d + Math.abs(this.params.detourDistance), l = d + c * this.params.flipY * h, g = {
1248
+ ), 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 = {
1249
1249
  x: (n.x + a.x) / 2,
1250
- y: l
1250
+ y: g
1251
1251
  };
1252
- this.midpoint = F(g, e.flipX, e.flipY, e.to), this.path = L(
1252
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
1253
1253
  [
1254
1254
  t,
1255
1255
  n,
1256
- { x: n.x, y: l },
1257
- { x: a.x, y: l },
1256
+ { x: n.x, y: g },
1257
+ { x: a.x, y: g },
1258
1258
  a,
1259
- o
1259
+ s
1260
1260
  ],
1261
1261
  this.params.roundness
1262
1262
  );
1263
1263
  }
1264
1264
  }
1265
- class et {
1265
+ class it {
1266
1266
  constructor(e) {
1267
- s(this, "path");
1268
- s(this, "midpoint");
1267
+ o(this, "path");
1268
+ o(this, "midpoint");
1269
1269
  this.params = e;
1270
- const t = this.params.hasSourceArrow ? m(
1271
- { x: this.params.arrowLength, y: u.y },
1270
+ const t = this.params.hasSourceArrow ? y(
1271
+ { x: this.params.arrowLength, y: p.y },
1272
1272
  this.params.sourceDirection,
1273
- u
1274
- ) : u, o = this.params.hasTargetArrow ? m(
1273
+ p
1274
+ ) : p, s = this.params.hasTargetArrow ? y(
1275
1275
  {
1276
1276
  x: this.params.to.x - this.params.arrowLength,
1277
1277
  y: this.params.to.y
1278
1278
  },
1279
1279
  this.params.targetDirection,
1280
1280
  this.params.to
1281
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1282
- { x: i, y: u.y },
1281
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1282
+ { x: i, y: p.y },
1283
1283
  this.params.sourceDirection,
1284
- u
1285
- ), a = m(
1284
+ p
1285
+ ), a = y(
1286
1286
  { x: this.params.to.x - i, y: this.params.to.y },
1287
1287
  this.params.targetDirection,
1288
1288
  this.params.to
1289
- ), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance), l = d + c * this.params.flipX * h, g = {
1290
- x: l,
1289
+ ), 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 = {
1290
+ x: g,
1291
1291
  y: (n.y + a.y) / 2
1292
1292
  };
1293
- this.midpoint = F(g, e.flipX, e.flipY, e.to), this.path = L(
1293
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
1294
1294
  [
1295
1295
  t,
1296
1296
  n,
1297
- { x: l, y: n.y },
1298
- { x: l, y: a.y },
1297
+ { x: g, y: n.y },
1298
+ { x: g, y: a.y },
1299
1299
  a,
1300
- o
1300
+ s
1301
1301
  ],
1302
1302
  this.params.roundness
1303
1303
  );
1304
1304
  }
1305
1305
  }
1306
- const w = Object.freeze({
1306
+ const f = Object.freeze({
1307
1307
  color: "#777777",
1308
1308
  width: 1,
1309
1309
  arrowLength: 20,
@@ -1326,24 +1326,24 @@ const w = Object.freeze({
1326
1326
  interactiveWidth: 10,
1327
1327
  preOffset: 0
1328
1328
  }), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1329
- class W {
1329
+ class k {
1330
1330
  constructor(e) {
1331
- s(this, "svg");
1332
- s(this, "group", be());
1333
- s(this, "line");
1334
- s(this, "sourceArrow", null);
1335
- s(this, "targetArrow", null);
1336
- s(this, "onAfterRender");
1337
- s(this, "afterRenderEmitter");
1338
- s(this, "arrowRenderer");
1339
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Se(e.color), this.svg.appendChild(this.group), this.line = Pe(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));
1331
+ o(this, "svg");
1332
+ o(this, "group", Te());
1333
+ o(this, "line");
1334
+ o(this, "sourceArrow", null);
1335
+ o(this, "targetArrow", null);
1336
+ o(this, "onAfterRender");
1337
+ o(this, "afterRenderEmitter");
1338
+ o(this, "arrowRenderer");
1339
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = S(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = be(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));
1340
1340
  }
1341
1341
  render(e) {
1342
- const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } = xe(
1342
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
1343
1343
  e.from,
1344
1344
  e.to
1345
1345
  );
1346
- Te(this.svg, { x: t, y: o, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1346
+ De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1347
1347
  const d = ge(
1348
1348
  e.from.direction,
1349
1349
  a,
@@ -1352,60 +1352,60 @@ class W {
1352
1352
  e.to.direction,
1353
1353
  a,
1354
1354
  h
1355
- ), l = {
1355
+ ), g = {
1356
1356
  x: i,
1357
1357
  y: n
1358
1358
  };
1359
- let g = { x: -c.x, y: -c.y }, p;
1360
- e.category === R.PortCycle ? (p = this.params.createCyclePath, g = d) : e.category === R.NodeCycle ? p = this.params.createDetourPath : p = this.params.createLinePath;
1361
- const f = p(
1359
+ let l = { x: -c.x, y: -c.y }, u;
1360
+ e.category === C.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === C.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1361
+ const w = u(
1362
1362
  d,
1363
1363
  c,
1364
- l,
1364
+ g,
1365
1365
  a,
1366
1366
  h
1367
1367
  );
1368
- this.line.setAttribute("d", f.path);
1369
- let y = null;
1370
- this.sourceArrow && (y = this.arrowRenderer({
1368
+ this.line.setAttribute("d", w.path);
1369
+ let m = null;
1370
+ this.sourceArrow && (m = this.arrowRenderer({
1371
1371
  direction: d,
1372
- shift: u,
1372
+ shift: p,
1373
1373
  arrowLength: this.params.arrowLength
1374
- }), this.sourceArrow.setAttribute("d", y));
1374
+ }), this.sourceArrow.setAttribute("d", m));
1375
1375
  let v = null;
1376
1376
  this.targetArrow && (v = this.arrowRenderer({
1377
- direction: g,
1378
- shift: l,
1377
+ direction: l,
1378
+ shift: g,
1379
1379
  arrowLength: this.params.arrowLength
1380
1380
  }), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
1381
- edgePath: f,
1382
- sourceArrowPath: y,
1381
+ edgePath: w,
1382
+ sourceArrowPath: m,
1383
1383
  targetArrowPath: v
1384
1384
  });
1385
1385
  }
1386
1386
  }
1387
- const tt = (r) => (e) => {
1388
- const o = [
1389
- u,
1387
+ const nt = (r) => (e) => {
1388
+ const s = [
1389
+ p,
1390
1390
  { x: e.arrowLength, y: r.radius },
1391
1391
  { x: e.arrowLength, y: -r.radius }
1392
1392
  ].map(
1393
- (h) => m(h, e.direction, u)
1393
+ (h) => y(h, e.direction, p)
1394
1394
  ).map((h) => ({
1395
1395
  x: h.x + e.shift.x,
1396
1396
  y: h.y + e.shift.y
1397
- })), i = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1397
+ })), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
1398
1398
  return `${i} ${n} ${a} Z`;
1399
- }, rt = (r) => (e) => {
1400
- const t = r.radius, o = e.arrowLength, i = (o * o + 2 * o * t) / (2 * t), n = i + t, a = o + t - t * (o + t) / n, h = t * i / n, c = [u, { x: a, y: -h }, { x: a, y: h }].map(
1401
- (y) => m(y, e.direction, u)
1402
- ).map((y) => ({
1403
- x: y.x + e.shift.x,
1404
- y: y.y + e.shift.y
1405
- })), l = `M ${c[0].x} ${c[0].y}`, g = `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}`, f = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
1406
- return `${l} ${g} ${p} ${f}`;
1407
- }, ot = (r) => (e) => {
1408
- const t = r.smallRadius, o = r.radius, i = m(
1399
+ }, at = (r) => (e) => {
1400
+ const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
1401
+ (m) => y(m, e.direction, p)
1402
+ ).map((m) => ({
1403
+ x: m.x + e.shift.x,
1404
+ y: m.y + e.shift.y
1405
+ })), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
1406
+ return `${g} ${l} ${u} ${w}`;
1407
+ }, ht = (r) => (e) => {
1408
+ const t = r.smallRadius, s = r.radius, i = y(
1409
1409
  {
1410
1410
  x: e.arrowLength,
1411
1411
  y: 0
@@ -1418,51 +1418,51 @@ const tt = (r) => (e) => {
1418
1418
  x: e.arrowLength + r.smallRadius,
1419
1419
  y: 0
1420
1420
  }
1421
- ), a = [u, { x: i.x, y: -i.y }, i].map(
1422
- (g) => m(g, e.direction, u)
1423
- ).map((g) => ({
1424
- x: g.x + e.shift.x,
1425
- y: g.y + e.shift.y
1426
- })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, l = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1427
- return `${h} ${d} ${c} ${l}`;
1428
- }, $ = (r) => {
1421
+ ), a = [p, { x: i.x, y: -i.y }, i].map(
1422
+ (l) => y(l, e.direction, p)
1423
+ ).map((l) => ({
1424
+ x: l.x + e.shift.x,
1425
+ y: l.y + e.shift.y
1426
+ })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${s} ${s} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${s} ${s} 0 0 1 ${a[0].x} ${a[0].y}`;
1427
+ return `${h} ${d} ${c} ${g}`;
1428
+ }, I = (r) => {
1429
1429
  if (typeof r == "function")
1430
1430
  return r;
1431
1431
  switch (r.type) {
1432
1432
  case "triangle":
1433
- return tt({
1434
- radius: r.radius ?? w.polygonArrowRadius
1433
+ return nt({
1434
+ radius: r.radius ?? f.polygonArrowRadius
1435
1435
  });
1436
1436
  case "arc":
1437
- return rt({
1438
- radius: r.radius ?? w.circleArrowRadius
1437
+ return at({
1438
+ radius: r.radius ?? f.circleArrowRadius
1439
1439
  });
1440
1440
  default:
1441
- return ot({
1442
- smallRadius: r.smallRadius ?? w.wedgeArrowSmallRadius,
1443
- angle: r.angle ?? w.wedgeArrowAngle,
1444
- radius: r.radius ?? w.wedgeArrowRadius
1441
+ return ht({
1442
+ smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
1443
+ angle: r.angle ?? f.wedgeArrowAngle,
1444
+ radius: r.radius ?? f.wedgeArrowRadius
1445
1445
  });
1446
1446
  }
1447
1447
  };
1448
- class st {
1448
+ class dt {
1449
1449
  constructor(e) {
1450
- s(this, "svg");
1451
- s(this, "group");
1452
- s(this, "line");
1453
- s(this, "sourceArrow");
1454
- s(this, "targetArrow");
1455
- s(this, "onAfterRender");
1456
- s(this, "arrowLength");
1457
- s(this, "curvature");
1458
- s(this, "portCycleRadius");
1459
- s(this, "portCycleSmallRadius");
1460
- s(this, "detourDirection");
1461
- s(this, "detourDistance");
1462
- s(this, "hasSourceArrow");
1463
- s(this, "hasTargetArrow");
1464
- s(this, "pathShape");
1465
- s(this, "createCyclePath", (e) => new Qe({
1450
+ o(this, "svg");
1451
+ o(this, "group");
1452
+ o(this, "line");
1453
+ o(this, "sourceArrow");
1454
+ o(this, "targetArrow");
1455
+ o(this, "onAfterRender");
1456
+ o(this, "arrowLength");
1457
+ o(this, "curvature");
1458
+ o(this, "portCycleRadius");
1459
+ o(this, "portCycleSmallRadius");
1460
+ o(this, "detourDirection");
1461
+ o(this, "detourDistance");
1462
+ o(this, "hasSourceArrow");
1463
+ o(this, "hasTargetArrow");
1464
+ o(this, "pathShape");
1465
+ o(this, "createCyclePath", (e) => new rt({
1466
1466
  sourceDirection: e,
1467
1467
  radius: this.portCycleRadius,
1468
1468
  smallRadius: this.portCycleSmallRadius,
@@ -1470,8 +1470,8 @@ class st {
1470
1470
  hasSourceArrow: this.hasSourceArrow,
1471
1471
  hasTargetArrow: this.hasTargetArrow
1472
1472
  }));
1473
- s(this, "createDetourPath", (e, t, o, i, n) => new je({
1474
- to: o,
1473
+ o(this, "createDetourPath", (e, t, s, i, n) => new Qe({
1474
+ to: s,
1475
1475
  sourceDirection: e,
1476
1476
  targetDirection: t,
1477
1477
  flipX: i,
@@ -1483,8 +1483,8 @@ class st {
1483
1483
  hasSourceArrow: this.hasSourceArrow,
1484
1484
  hasTargetArrow: this.hasTargetArrow
1485
1485
  }));
1486
- s(this, "createLinePath", (e, t, o) => new He({
1487
- to: o,
1486
+ o(this, "createLinePath", (e, t, s) => new Je({
1487
+ to: s,
1488
1488
  sourceDirection: e,
1489
1489
  targetDirection: t,
1490
1490
  arrowLength: this.arrowLength,
@@ -1492,10 +1492,10 @@ class st {
1492
1492
  hasSourceArrow: this.hasSourceArrow,
1493
1493
  hasTargetArrow: this.hasTargetArrow
1494
1494
  }));
1495
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? w.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? w.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? w.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? w.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? w.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? w.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? w.hasTargetArrow, this.pathShape = new W({
1496
- color: (e == null ? void 0 : e.color) ?? w.color,
1497
- width: (e == null ? void 0 : e.width) ?? w.width,
1498
- arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
1495
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
1496
+ color: (e == null ? void 0 : e.color) ?? f.color,
1497
+ width: (e == null ? void 0 : e.width) ?? f.width,
1498
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1499
1499
  arrowLength: this.arrowLength,
1500
1500
  hasSourceArrow: this.hasSourceArrow,
1501
1501
  hasTargetArrow: this.hasTargetArrow,
@@ -1508,23 +1508,23 @@ class st {
1508
1508
  this.pathShape.render(e);
1509
1509
  }
1510
1510
  }
1511
- class it {
1511
+ class ct {
1512
1512
  constructor(e) {
1513
- s(this, "svg");
1514
- s(this, "group");
1515
- s(this, "line");
1516
- s(this, "sourceArrow");
1517
- s(this, "targetArrow");
1518
- s(this, "onAfterRender");
1519
- s(this, "arrowLength");
1520
- s(this, "arrowOffset");
1521
- s(this, "roundness");
1522
- s(this, "cycleSquareSide");
1523
- s(this, "detourDistance");
1524
- s(this, "hasSourceArrow");
1525
- s(this, "hasTargetArrow");
1526
- s(this, "pathShape");
1527
- s(this, "createCyclePath", (e) => new Z({
1513
+ o(this, "svg");
1514
+ o(this, "group");
1515
+ o(this, "line");
1516
+ o(this, "sourceArrow");
1517
+ o(this, "targetArrow");
1518
+ o(this, "onAfterRender");
1519
+ o(this, "arrowLength");
1520
+ o(this, "arrowOffset");
1521
+ o(this, "roundness");
1522
+ o(this, "cycleSquareSide");
1523
+ o(this, "detourDistance");
1524
+ o(this, "hasSourceArrow");
1525
+ o(this, "hasTargetArrow");
1526
+ o(this, "pathShape");
1527
+ o(this, "createCyclePath", (e) => new J({
1528
1528
  sourceDirection: e,
1529
1529
  arrowLength: this.arrowLength,
1530
1530
  side: this.cycleSquareSide,
@@ -1533,8 +1533,8 @@ class it {
1533
1533
  hasSourceArrow: this.hasSourceArrow,
1534
1534
  hasTargetArrow: this.hasTargetArrow
1535
1535
  }));
1536
- s(this, "createDetourPath", (e, t, o, i, n) => new qe({
1537
- to: o,
1536
+ o(this, "createDetourPath", (e, t, s, i, n) => new ot({
1537
+ to: s,
1538
1538
  sourceDirection: e,
1539
1539
  targetDirection: t,
1540
1540
  flipX: i,
@@ -1546,8 +1546,8 @@ class it {
1546
1546
  hasSourceArrow: this.hasSourceArrow,
1547
1547
  hasTargetArrow: this.hasTargetArrow
1548
1548
  }));
1549
- s(this, "createLinePath", (e, t, o, i) => new Ge({
1550
- to: o,
1549
+ o(this, "createLinePath", (e, t, s, i) => new qe({
1550
+ to: s,
1551
1551
  sourceDirection: e,
1552
1552
  targetDirection: t,
1553
1553
  flipX: i,
@@ -1557,16 +1557,16 @@ class it {
1557
1557
  hasSourceArrow: this.hasSourceArrow,
1558
1558
  hasTargetArrow: this.hasTargetArrow
1559
1559
  }));
1560
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? w.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? w.cycleSquareSide;
1561
- const t = (e == null ? void 0 : e.roundness) ?? w.roundness;
1560
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1561
+ const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1562
1562
  this.roundness = Math.min(
1563
1563
  t,
1564
1564
  this.arrowOffset,
1565
1565
  this.cycleSquareSide / 2
1566
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? w.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? w.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? w.hasTargetArrow, this.pathShape = new W({
1567
- color: (e == null ? void 0 : e.color) ?? w.color,
1568
- width: (e == null ? void 0 : e.width) ?? w.width,
1569
- arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
1566
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
1567
+ color: (e == null ? void 0 : e.color) ?? f.color,
1568
+ width: (e == null ? void 0 : e.width) ?? f.width,
1569
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1570
1570
  arrowLength: this.arrowLength,
1571
1571
  hasSourceArrow: this.hasSourceArrow,
1572
1572
  hasTargetArrow: this.hasTargetArrow,
@@ -1579,24 +1579,24 @@ class it {
1579
1579
  this.pathShape.render(e);
1580
1580
  }
1581
1581
  }
1582
- class nt {
1582
+ class lt {
1583
1583
  constructor(e) {
1584
- s(this, "svg");
1585
- s(this, "group");
1586
- s(this, "line");
1587
- s(this, "sourceArrow");
1588
- s(this, "targetArrow");
1589
- s(this, "onAfterRender");
1590
- s(this, "arrowLength");
1591
- s(this, "arrowOffset");
1592
- s(this, "roundness");
1593
- s(this, "cycleSquareSide");
1594
- s(this, "detourDirection");
1595
- s(this, "detourDistance");
1596
- s(this, "hasSourceArrow");
1597
- s(this, "hasTargetArrow");
1598
- s(this, "pathShape");
1599
- s(this, "createCyclePath", (e) => new Z({
1584
+ o(this, "svg");
1585
+ o(this, "group");
1586
+ o(this, "line");
1587
+ o(this, "sourceArrow");
1588
+ o(this, "targetArrow");
1589
+ o(this, "onAfterRender");
1590
+ o(this, "arrowLength");
1591
+ o(this, "arrowOffset");
1592
+ o(this, "roundness");
1593
+ o(this, "cycleSquareSide");
1594
+ o(this, "detourDirection");
1595
+ o(this, "detourDistance");
1596
+ o(this, "hasSourceArrow");
1597
+ o(this, "hasTargetArrow");
1598
+ o(this, "pathShape");
1599
+ o(this, "createCyclePath", (e) => new J({
1600
1600
  sourceDirection: e,
1601
1601
  arrowLength: this.arrowLength,
1602
1602
  side: this.cycleSquareSide,
@@ -1605,8 +1605,8 @@ class nt {
1605
1605
  hasSourceArrow: this.hasSourceArrow,
1606
1606
  hasTargetArrow: this.hasTargetArrow
1607
1607
  }));
1608
- s(this, "createDetourPath", (e, t, o, i, n) => new Ke({
1609
- to: o,
1608
+ o(this, "createDetourPath", (e, t, s, i, n) => new _e({
1609
+ to: s,
1610
1610
  sourceDirection: e,
1611
1611
  targetDirection: t,
1612
1612
  flipX: i,
@@ -1619,8 +1619,8 @@ class nt {
1619
1619
  hasSourceArrow: this.hasSourceArrow,
1620
1620
  hasTargetArrow: this.hasTargetArrow
1621
1621
  }));
1622
- s(this, "createLinePath", (e, t, o) => new Ze({
1623
- to: o,
1622
+ o(this, "createLinePath", (e, t, s) => new et({
1623
+ to: s,
1624
1624
  sourceDirection: e,
1625
1625
  targetDirection: t,
1626
1626
  arrowLength: this.arrowLength,
@@ -1629,16 +1629,16 @@ class nt {
1629
1629
  hasSourceArrow: this.hasSourceArrow,
1630
1630
  hasTargetArrow: this.hasTargetArrow
1631
1631
  }));
1632
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? w.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? w.cycleSquareSide;
1633
- const t = (e == null ? void 0 : e.roundness) ?? w.roundness;
1632
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1633
+ const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1634
1634
  this.roundness = Math.min(
1635
1635
  t,
1636
1636
  this.arrowOffset,
1637
1637
  this.cycleSquareSide / 2
1638
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? w.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? w.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? w.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? w.hasTargetArrow, this.pathShape = new W({
1639
- color: (e == null ? void 0 : e.color) ?? w.color,
1640
- width: (e == null ? void 0 : e.width) ?? w.width,
1641
- arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
1638
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
1639
+ color: (e == null ? void 0 : e.color) ?? f.color,
1640
+ width: (e == null ? void 0 : e.width) ?? f.width,
1641
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1642
1642
  arrowLength: this.arrowLength,
1643
1643
  hasSourceArrow: this.hasSourceArrow,
1644
1644
  hasTargetArrow: this.hasTargetArrow,
@@ -1651,23 +1651,23 @@ class nt {
1651
1651
  this.pathShape.render(e);
1652
1652
  }
1653
1653
  }
1654
- class at {
1654
+ class gt {
1655
1655
  constructor(e) {
1656
- s(this, "svg");
1657
- s(this, "group");
1658
- s(this, "line");
1659
- s(this, "sourceArrow");
1660
- s(this, "targetArrow");
1661
- s(this, "onAfterRender");
1662
- s(this, "arrowLength");
1663
- s(this, "arrowOffset");
1664
- s(this, "roundness");
1665
- s(this, "cycleSquareSide");
1666
- s(this, "detourDistance");
1667
- s(this, "hasSourceArrow");
1668
- s(this, "hasTargetArrow");
1669
- s(this, "pathShape");
1670
- s(this, "createCyclePath", (e) => new Z({
1656
+ o(this, "svg");
1657
+ o(this, "group");
1658
+ o(this, "line");
1659
+ o(this, "sourceArrow");
1660
+ o(this, "targetArrow");
1661
+ o(this, "onAfterRender");
1662
+ o(this, "arrowLength");
1663
+ o(this, "arrowOffset");
1664
+ o(this, "roundness");
1665
+ o(this, "cycleSquareSide");
1666
+ o(this, "detourDistance");
1667
+ o(this, "hasSourceArrow");
1668
+ o(this, "hasTargetArrow");
1669
+ o(this, "pathShape");
1670
+ o(this, "createCyclePath", (e) => new J({
1671
1671
  sourceDirection: e,
1672
1672
  arrowLength: this.arrowLength,
1673
1673
  side: this.cycleSquareSide,
@@ -1676,8 +1676,8 @@ class at {
1676
1676
  hasSourceArrow: this.hasSourceArrow,
1677
1677
  hasTargetArrow: this.hasTargetArrow
1678
1678
  }));
1679
- s(this, "createDetourPath", (e, t, o, i, n) => new et({
1680
- to: o,
1679
+ o(this, "createDetourPath", (e, t, s, i, n) => new it({
1680
+ to: s,
1681
1681
  sourceDirection: e,
1682
1682
  targetDirection: t,
1683
1683
  flipX: i,
@@ -1689,8 +1689,8 @@ class at {
1689
1689
  hasSourceArrow: this.hasSourceArrow,
1690
1690
  hasTargetArrow: this.hasTargetArrow
1691
1691
  }));
1692
- s(this, "createLinePath", (e, t, o, i, n) => new Je({
1693
- to: o,
1692
+ o(this, "createLinePath", (e, t, s, i, n) => new tt({
1693
+ to: s,
1694
1694
  sourceDirection: e,
1695
1695
  targetDirection: t,
1696
1696
  flipY: n,
@@ -1700,16 +1700,16 @@ class at {
1700
1700
  hasSourceArrow: this.hasSourceArrow,
1701
1701
  hasTargetArrow: this.hasTargetArrow
1702
1702
  }));
1703
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? w.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? w.cycleSquareSide;
1704
- const t = (e == null ? void 0 : e.roundness) ?? w.roundness;
1703
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
1704
+ const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
1705
1705
  this.roundness = Math.min(
1706
1706
  t,
1707
1707
  this.arrowOffset,
1708
1708
  this.cycleSquareSide / 2
1709
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? w.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? w.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? w.hasTargetArrow, this.pathShape = new W({
1710
- color: (e == null ? void 0 : e.color) ?? w.color,
1711
- width: (e == null ? void 0 : e.width) ?? w.width,
1712
- arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
1709
+ ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
1710
+ color: (e == null ? void 0 : e.color) ?? f.color,
1711
+ width: (e == null ? void 0 : e.width) ?? f.width,
1712
+ arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
1713
1713
  arrowLength: this.arrowLength,
1714
1714
  hasSourceArrow: this.hasSourceArrow,
1715
1715
  hasTargetArrow: this.hasTargetArrow,
@@ -1724,28 +1724,28 @@ class at {
1724
1724
  }
1725
1725
  class Ne {
1726
1726
  constructor(e) {
1727
- s(this, "svg");
1728
- s(this, "group", be());
1729
- s(this, "line");
1730
- s(this, "sourceArrow", null);
1731
- s(this, "targetArrow", null);
1732
- s(this, "color");
1733
- s(this, "width");
1734
- s(this, "arrowLength");
1735
- s(this, "sourceOffset");
1736
- s(this, "targetOffset");
1737
- s(this, "onAfterRender");
1738
- s(this, "afterRenderEmitter");
1739
- s(this, "arrowRenderer");
1740
- [this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? w.color, this.width = (e == null ? void 0 : e.width) ?? w.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.arrowRenderer = $((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? w.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? w.preOffset, this.svg = Se(this.color), this.svg.appendChild(this.group), this.line = Pe(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));
1727
+ o(this, "svg");
1728
+ o(this, "group", Te());
1729
+ o(this, "line");
1730
+ o(this, "sourceArrow", null);
1731
+ o(this, "targetArrow", null);
1732
+ o(this, "color");
1733
+ o(this, "width");
1734
+ o(this, "arrowLength");
1735
+ o(this, "sourceOffset");
1736
+ o(this, "targetOffset");
1737
+ o(this, "onAfterRender");
1738
+ o(this, "afterRenderEmitter");
1739
+ o(this, "arrowRenderer");
1740
+ [this.afterRenderEmitter, this.onAfterRender] = S(), 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 = be(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));
1741
1741
  }
1742
1742
  render(e) {
1743
- const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } = xe(
1743
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
1744
1744
  e.from,
1745
1745
  e.to
1746
1746
  );
1747
- Te(this.svg, { x: t, y: o, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1748
- const d = { x: i, y: n }, c = new _e({
1747
+ De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1748
+ const d = { x: i, y: n }, c = new st({
1749
1749
  to: d,
1750
1750
  sourceOffset: this.sourceOffset,
1751
1751
  targetOffset: this.targetOffset,
@@ -1754,82 +1754,82 @@ class Ne {
1754
1754
  arrowLength: this.arrowLength
1755
1755
  });
1756
1756
  this.line.setAttribute("d", c.path);
1757
- let l = null, g = null;
1758
- const p = c.diagonalDistance;
1759
- if (p === 0)
1760
- this.sourceArrow !== null && (l = "", this.sourceArrow.setAttribute("d", l)), this.targetArrow !== null && (g = "", this.targetArrow.setAttribute("d", g));
1757
+ let g = null, l = null;
1758
+ const u = c.diagonalDistance;
1759
+ if (u === 0)
1760
+ this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
1761
1761
  else {
1762
- const f = {
1763
- x: d.x / p,
1764
- y: d.y / p
1762
+ const w = {
1763
+ x: d.x / u,
1764
+ y: d.y / u
1765
1765
  };
1766
1766
  if (this.sourceArrow) {
1767
- const y = {
1768
- x: f.x * this.sourceOffset,
1769
- y: f.y * this.sourceOffset
1767
+ const m = {
1768
+ x: w.x * this.sourceOffset,
1769
+ y: w.y * this.sourceOffset
1770
1770
  };
1771
- l = this.arrowRenderer({
1772
- direction: f,
1773
- shift: y,
1771
+ g = this.arrowRenderer({
1772
+ direction: w,
1773
+ shift: m,
1774
1774
  arrowLength: this.arrowLength
1775
- }), this.sourceArrow.setAttribute("d", l);
1775
+ }), this.sourceArrow.setAttribute("d", g);
1776
1776
  }
1777
1777
  if (this.targetArrow) {
1778
- const y = {
1779
- x: f.x * this.targetOffset,
1780
- y: f.y * this.targetOffset
1778
+ const m = {
1779
+ x: w.x * this.targetOffset,
1780
+ y: w.y * this.targetOffset
1781
1781
  };
1782
- g = this.arrowRenderer({
1783
- direction: { x: -f.x, y: -f.y },
1782
+ l = this.arrowRenderer({
1783
+ direction: { x: -w.x, y: -w.y },
1784
1784
  shift: {
1785
- x: d.x - y.x,
1786
- y: d.y - y.y
1785
+ x: d.x - m.x,
1786
+ y: d.y - m.y
1787
1787
  },
1788
1788
  arrowLength: this.arrowLength
1789
- }), this.targetArrow.setAttribute("d", g);
1789
+ }), this.targetArrow.setAttribute("d", l);
1790
1790
  }
1791
1791
  }
1792
1792
  this.afterRenderEmitter.emit({
1793
1793
  edgePath: c,
1794
- sourceArrowPath: l,
1795
- targetArrowPath: g
1794
+ sourceArrowPath: g,
1795
+ targetArrowPath: l
1796
1796
  });
1797
1797
  }
1798
1798
  }
1799
- const ht = () => {
1799
+ const ut = () => {
1800
1800
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1801
1801
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1802
- }, dt = (r) => {
1802
+ }, pt = (r) => {
1803
1803
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1804
1804
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1805
- }, le = (r) => {
1805
+ }, ue = (r) => {
1806
1806
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1807
1807
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1808
1808
  };
1809
- class ct extends Error {
1809
+ class wt extends Error {
1810
1810
  constructor(e) {
1811
1811
  super(e), this.name = "InteractiveEdgeError";
1812
1812
  }
1813
1813
  }
1814
- class De {
1814
+ class Me {
1815
1815
  constructor(e, t) {
1816
- s(this, "svg");
1817
- s(this, "group");
1818
- s(this, "line");
1819
- s(this, "sourceArrow");
1820
- s(this, "targetArrow");
1821
- s(this, "handle", ht());
1822
- s(this, "onAfterRender");
1823
- s(this, "interactiveLine");
1824
- s(this, "interactiveSourceArrow", null);
1825
- s(this, "interactiveTargetArrow", null);
1826
- if (this.baseEdge = e, e instanceof De)
1827
- throw new ct(
1816
+ o(this, "svg");
1817
+ o(this, "group");
1818
+ o(this, "line");
1819
+ o(this, "sourceArrow");
1820
+ o(this, "targetArrow");
1821
+ o(this, "handle", ut());
1822
+ o(this, "onAfterRender");
1823
+ o(this, "interactiveLine");
1824
+ o(this, "interactiveSourceArrow", null);
1825
+ o(this, "interactiveTargetArrow", null);
1826
+ if (this.baseEdge = e, e instanceof Me)
1827
+ throw new wt(
1828
1828
  "interactive edge can be configured only once"
1829
1829
  );
1830
1830
  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;
1831
- const o = (t == null ? void 0 : t.distance) ?? w.interactiveWidth;
1832
- this.interactiveLine = dt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = le(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = le(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1831
+ const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
1832
+ this.interactiveLine = pt(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) => {
1833
1833
  this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1834
1834
  });
1835
1835
  }
@@ -1837,16 +1837,16 @@ class De {
1837
1837
  this.baseEdge.render(e);
1838
1838
  }
1839
1839
  }
1840
- class kt {
1840
+ class Jt {
1841
1841
  constructor(e, t) {
1842
- s(this, "group");
1843
- s(this, "line");
1844
- s(this, "sourceArrow");
1845
- s(this, "targetArrow");
1846
- s(this, "onAfterRender");
1847
- s(this, "svg");
1848
- 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((o) => {
1849
- const i = o.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1842
+ o(this, "group");
1843
+ o(this, "line");
1844
+ o(this, "sourceArrow");
1845
+ o(this, "targetArrow");
1846
+ o(this, "onAfterRender");
1847
+ o(this, "svg");
1848
+ 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) => {
1849
+ const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1850
1850
  this.midpointElement.style.setProperty("transform", n);
1851
1851
  });
1852
1852
  }
@@ -1856,32 +1856,32 @@ class kt {
1856
1856
  }
1857
1857
  class Le {
1858
1858
  constructor(e) {
1859
- s(this, "onAfterNodeAdded");
1860
- s(this, "onAfterNodeUpdated");
1861
- s(this, "onAfterNodePriorityUpdated");
1862
- s(this, "onBeforeNodeRemoved");
1863
- s(this, "onAfterPortMarked");
1864
- s(this, "onAfterPortUpdated");
1865
- s(this, "onBeforePortUnmarked");
1866
- s(this, "onAfterEdgeAdded");
1867
- s(this, "onAfterEdgeShapeUpdated");
1868
- s(this, "onAfterEdgeUpdated");
1869
- s(this, "onAfterEdgePriorityUpdated");
1870
- s(this, "onBeforeEdgeRemoved");
1871
- s(this, "onBeforeClear");
1859
+ o(this, "onAfterNodeAdded");
1860
+ o(this, "onAfterNodeUpdated");
1861
+ o(this, "onAfterNodePriorityUpdated");
1862
+ o(this, "onBeforeNodeRemoved");
1863
+ o(this, "onAfterPortMarked");
1864
+ o(this, "onAfterPortUpdated");
1865
+ o(this, "onBeforePortUnmarked");
1866
+ o(this, "onAfterEdgeAdded");
1867
+ o(this, "onAfterEdgeShapeUpdated");
1868
+ o(this, "onAfterEdgeUpdated");
1869
+ o(this, "onAfterEdgePriorityUpdated");
1870
+ o(this, "onBeforeEdgeRemoved");
1871
+ o(this, "onBeforeClear");
1872
1872
  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;
1873
1873
  }
1874
1874
  getNode(e) {
1875
1875
  const t = this.graphStore.getNode(e);
1876
1876
  if (t === void 0)
1877
1877
  return null;
1878
- const o = t.payload;
1878
+ const s = t.payload;
1879
1879
  return {
1880
1880
  element: t.element,
1881
- x: o.x,
1882
- y: o.y,
1883
- centerFn: o.centerFn,
1884
- priority: o.priority
1881
+ x: s.x,
1882
+ y: s.y,
1883
+ centerFn: s.centerFn,
1884
+ priority: s.priority
1885
1885
  };
1886
1886
  }
1887
1887
  getElementNodeId(e) {
@@ -1914,12 +1914,12 @@ class Le {
1914
1914
  const t = this.graphStore.getEdge(e);
1915
1915
  if (t === void 0)
1916
1916
  return null;
1917
- const o = t.payload;
1917
+ const s = t.payload;
1918
1918
  return {
1919
1919
  from: t.from,
1920
1920
  to: t.to,
1921
- priority: o.priority,
1922
- shape: o.shape
1921
+ priority: s.priority,
1922
+ shape: s.shape
1923
1923
  };
1924
1924
  }
1925
1925
  getPortIncomingEdgeIds(e) {
@@ -1947,9 +1947,9 @@ class Le {
1947
1947
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
1948
1948
  }
1949
1949
  }
1950
- class Me {
1950
+ class Re {
1951
1951
  constructor(e) {
1952
- s(this, "onAfterUpdated");
1952
+ o(this, "onAfterUpdated");
1953
1953
  this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
1954
1954
  }
1955
1955
  getViewportMatrix() {
@@ -1959,10 +1959,10 @@ class Me {
1959
1959
  return { ...this.viewportStore.getContentMatrix() };
1960
1960
  }
1961
1961
  }
1962
- const Re = (r, e) => {
1963
- const t = new ve(), o = new Le(t), i = new Me(e), n = new ye(t, e, r), a = {
1962
+ const Ce = (r, e) => {
1963
+ const t = new Ee(), s = new Le(t), i = new Re(e), n = new ye(t, e, r), a = {
1964
1964
  nodes: {
1965
- centerFn: Ae,
1965
+ centerFn: xe,
1966
1966
  priorityFn: () => 0
1967
1967
  },
1968
1968
  edges: {
@@ -1973,8 +1973,8 @@ const Re = (r, e) => {
1973
1973
  direction: 0
1974
1974
  }
1975
1975
  };
1976
- return new me(
1977
- o,
1976
+ return new ve(
1977
+ s,
1978
1978
  i,
1979
1979
  t,
1980
1980
  e,
@@ -1982,21 +1982,21 @@ const Re = (r, e) => {
1982
1982
  a
1983
1983
  );
1984
1984
  };
1985
- class k {
1986
- constructor(e, t, o, i) {
1987
- s(this, "onAfterPortMarked", (e) => {
1985
+ class z {
1986
+ constructor(e, t, s, i) {
1987
+ o(this, "onAfterPortMarked", (e) => {
1988
1988
  const t = this.canvas.graph.getPort(e);
1989
1989
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
1990
1990
  });
1991
- s(this, "onBeforePortUnmarked", (e) => {
1991
+ o(this, "onBeforePortUnmarked", (e) => {
1992
1992
  const t = this.canvas.graph.getPort(e);
1993
1993
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
1994
1994
  });
1995
- s(this, "onPortMouseDown", (e) => {
1995
+ o(this, "onPortMouseDown", (e) => {
1996
1996
  if (!this.params.mouseDownEventVerifier(e))
1997
1997
  return;
1998
- const t = e.currentTarget, o = this.canvas.graph.getElementPortIds(t)[0];
1999
- this.params.onPortPointerDown(o, {
1998
+ const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
1999
+ this.params.onPortPointerDown(s, {
2000
2000
  x: e.clientX,
2001
2001
  y: e.clientY
2002
2002
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
@@ -2005,8 +2005,8 @@ class k {
2005
2005
  passive: !0
2006
2006
  }));
2007
2007
  });
2008
- s(this, "onWindowMouseMove", (e) => {
2009
- if (!C(
2008
+ o(this, "onWindowMouseMove", (e) => {
2009
+ if (!V(
2010
2010
  this.window,
2011
2011
  this.element,
2012
2012
  e.clientX,
@@ -2017,13 +2017,13 @@ class k {
2017
2017
  }
2018
2018
  this.params.onPointerMove({ x: e.clientX, y: e.clientY });
2019
2019
  });
2020
- s(this, "onWindowMouseUp", (e) => {
2020
+ o(this, "onWindowMouseUp", (e) => {
2021
2021
  this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
2022
2022
  });
2023
- s(this, "onPortTouchStart", (e) => {
2023
+ o(this, "onPortTouchStart", (e) => {
2024
2024
  if (e.touches.length !== 1)
2025
2025
  return;
2026
- const t = e.touches[0], o = e.currentTarget, i = this.canvas.graph.getElementPortIds(o)[0];
2026
+ const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
2027
2027
  this.params.onPortPointerDown(i, {
2028
2028
  x: t.clientX,
2029
2029
  y: t.clientY
@@ -2035,9 +2035,9 @@ class k {
2035
2035
  passive: !0
2036
2036
  }));
2037
2037
  });
2038
- s(this, "onWindowTouchMove", (e) => {
2038
+ o(this, "onWindowTouchMove", (e) => {
2039
2039
  const t = e.touches[0];
2040
- if (!C(
2040
+ if (!V(
2041
2041
  this.window,
2042
2042
  this.element,
2043
2043
  t.clientX,
@@ -2048,23 +2048,23 @@ class k {
2048
2048
  }
2049
2049
  this.params.onPointerMove({ x: t.clientX, y: t.clientY });
2050
2050
  });
2051
- s(this, "onWindowTouchFinish", (e) => {
2051
+ o(this, "onWindowTouchFinish", (e) => {
2052
2052
  const t = e.changedTouches[0];
2053
2053
  this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
2054
2054
  });
2055
- s(this, "onBeforeClear", () => {
2055
+ o(this, "onBeforeClear", () => {
2056
2056
  this.canvas.graph.getAllPortIds().forEach((e) => {
2057
2057
  const t = this.canvas.graph.getPort(e);
2058
2058
  this.unhookPortEvents(t.element);
2059
2059
  });
2060
2060
  });
2061
- s(this, "onBeforeDestroy", () => {
2061
+ o(this, "onBeforeDestroy", () => {
2062
2062
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2063
2063
  });
2064
- this.canvas = e, this.element = t, this.window = o, 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);
2064
+ 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);
2065
2065
  }
2066
- static configure(e, t, o, i) {
2067
- new k(e, t, o, i);
2066
+ static configure(e, t, s, i) {
2067
+ new z(e, t, s, i);
2068
2068
  }
2069
2069
  hookPortEvents(e) {
2070
2070
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2089,12 +2089,12 @@ class k {
2089
2089
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2090
2090
  }
2091
2091
  }
2092
- class J {
2093
- constructor(e, t, o, i) {
2094
- s(this, "grabbedNode", null);
2095
- s(this, "maxNodePriority", 0);
2096
- s(this, "graph");
2097
- s(this, "onAfterNodeAdded", (e) => {
2092
+ class Q {
2093
+ constructor(e, t, s, i) {
2094
+ o(this, "grabbedNode", null);
2095
+ o(this, "maxNodePriority", 0);
2096
+ o(this, "graph");
2097
+ o(this, "onAfterNodeAdded", (e) => {
2098
2098
  this.updateMaxNodePriority(e);
2099
2099
  const t = this.graph.getNode(e);
2100
2100
  t.element.addEventListener("mousedown", this.onMouseDown, {
@@ -2103,27 +2103,27 @@ class J {
2103
2103
  passive: !0
2104
2104
  });
2105
2105
  });
2106
- s(this, "onAfterNodeUpdated", (e) => {
2106
+ o(this, "onAfterNodeUpdated", (e) => {
2107
2107
  this.updateMaxNodePriority(e);
2108
2108
  });
2109
- s(this, "onBeforeNodeRemoved", (e) => {
2109
+ o(this, "onBeforeNodeRemoved", (e) => {
2110
2110
  const t = this.graph.getNode(e);
2111
2111
  t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2112
2112
  });
2113
- s(this, "onBeforeDestroy", () => {
2113
+ o(this, "onBeforeDestroy", () => {
2114
2114
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2115
2115
  });
2116
- s(this, "onBeforeClear", () => {
2116
+ o(this, "onBeforeClear", () => {
2117
2117
  this.canvas.graph.getAllNodeIds().forEach((e) => {
2118
2118
  const t = this.canvas.graph.getNode(e);
2119
2119
  t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2120
2120
  }), this.maxNodePriority = 0;
2121
2121
  });
2122
- s(this, "onMouseDown", (e) => {
2122
+ o(this, "onMouseDown", (e) => {
2123
2123
  if (!this.params.mouseDownEventVerifier(e))
2124
2124
  return;
2125
- const t = e.currentTarget, o = this.graph.getElementNodeId(t), i = this.graph.getNode(o);
2126
- if (!this.params.nodeDragVerifier(o))
2125
+ const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
2126
+ if (!this.params.nodeDragVerifier(s))
2127
2127
  return;
2128
2128
  e.stopPropagation();
2129
2129
  const a = this.calculateContentPoint({
@@ -2131,20 +2131,20 @@ class J {
2131
2131
  y: e.clientY
2132
2132
  });
2133
2133
  this.grabbedNode = {
2134
- nodeId: o,
2134
+ nodeId: s,
2135
2135
  dx: a.x - i.x,
2136
2136
  dy: a.y - i.y
2137
- }, I(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2137
+ }, B(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2138
2138
  passive: !0
2139
2139
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2140
2140
  passive: !0
2141
2141
  });
2142
2142
  });
2143
- s(this, "onTouchStart", (e) => {
2143
+ o(this, "onTouchStart", (e) => {
2144
2144
  if (e.touches.length !== 1)
2145
2145
  return;
2146
2146
  e.stopPropagation();
2147
- const t = e.touches[0], o = e.currentTarget, i = this.canvas.graph.getElementNodeId(o), n = this.graph.getNode(i);
2147
+ const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
2148
2148
  if (!this.params.nodeDragVerifier({
2149
2149
  nodeId: i,
2150
2150
  element: n.element,
@@ -2168,8 +2168,8 @@ class J {
2168
2168
  passive: !0
2169
2169
  });
2170
2170
  });
2171
- s(this, "onWindowMouseMove", (e) => {
2172
- if (!C(
2171
+ o(this, "onWindowMouseMove", (e) => {
2172
+ if (!V(
2173
2173
  this.window,
2174
2174
  this.element,
2175
2175
  e.clientX,
@@ -2183,14 +2183,14 @@ class J {
2183
2183
  y: e.clientY
2184
2184
  });
2185
2185
  });
2186
- s(this, "onWindowMouseUp", (e) => {
2186
+ o(this, "onWindowMouseUp", (e) => {
2187
2187
  this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2188
2188
  });
2189
- s(this, "onWindowTouchMove", (e) => {
2189
+ o(this, "onWindowTouchMove", (e) => {
2190
2190
  if (e.touches.length !== 1)
2191
2191
  return;
2192
2192
  const t = e.touches[0];
2193
- if (!C(
2193
+ if (!V(
2194
2194
  this.window,
2195
2195
  this.element,
2196
2196
  t.clientX,
@@ -2204,13 +2204,13 @@ class J {
2204
2204
  y: t.clientY
2205
2205
  });
2206
2206
  });
2207
- s(this, "onWindowTouchFinish", () => {
2207
+ o(this, "onWindowTouchFinish", () => {
2208
2208
  this.cancelTouchDrag();
2209
2209
  });
2210
- this.canvas = e, this.element = t, this.window = o, 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);
2210
+ 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);
2211
2211
  }
2212
- static configure(e, t, o, i) {
2213
- new J(e, t, o, i);
2212
+ static configure(e, t, s, i) {
2213
+ new Q(e, t, s, i);
2214
2214
  }
2215
2215
  moveNode(e, t) {
2216
2216
  if (this.graph.getNode(e.nodeId) === null)
@@ -2236,7 +2236,7 @@ class J {
2236
2236
  }
2237
2237
  }
2238
2238
  cancelMouseDrag() {
2239
- this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, I(this.element, null), this.removeMouseDragListeners();
2239
+ 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();
2240
2240
  }
2241
2241
  removeMouseDragListeners() {
2242
2242
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -2261,40 +2261,40 @@ class J {
2261
2261
  this.maxNodePriority = Math.max(this.maxNodePriority, t);
2262
2262
  }
2263
2263
  calculateContentPoint(e) {
2264
- const t = this.element.getBoundingClientRect(), o = {
2264
+ const t = this.element.getBoundingClientRect(), s = {
2265
2265
  x: e.x - t.x,
2266
2266
  y: e.y - t.y
2267
2267
  }, i = this.canvas.viewport.getViewportMatrix();
2268
- return T(i, o);
2268
+ return D(i, s);
2269
2269
  }
2270
2270
  adjustNodeCoords(e) {
2271
2271
  const t = this.params.gridSize;
2272
2272
  if (t !== null) {
2273
- const o = t / 2;
2273
+ const s = t / 2;
2274
2274
  return {
2275
- x: Math.floor((e.x + o) / t) * t,
2276
- y: Math.floor((e.y + o) / t) * t
2275
+ x: Math.floor((e.x + s) / t) * t,
2276
+ y: Math.floor((e.y + s) / t) * t
2277
2277
  };
2278
2278
  }
2279
2279
  return e;
2280
2280
  }
2281
2281
  }
2282
- const gt = (r, e, t) => ({
2282
+ const ft = (r, e, t) => ({
2283
2283
  scale: r.scale,
2284
2284
  x: r.x + r.scale * e,
2285
2285
  y: r.y + r.scale * t
2286
- }), lt = (r, e, t, o) => ({
2286
+ }), mt = (r, e, t, s) => ({
2287
2287
  scale: r.scale * e,
2288
2288
  x: r.scale * (1 - e) * t + r.x,
2289
- y: r.scale * (1 - e) * o + r.y
2289
+ y: r.scale * (1 - e) * s + r.y
2290
2290
  }), U = (r) => {
2291
2291
  const e = [], t = r.touches.length;
2292
2292
  for (let h = 0; h < t; h++)
2293
2293
  e.push([r.touches[h].clientX, r.touches[h].clientY]);
2294
- const o = e.reduce(
2294
+ const s = e.reduce(
2295
2295
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2296
2296
  [0, 0]
2297
- ), i = [o[0] / t, o[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2297
+ ), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2298
2298
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2299
2299
  0
2300
2300
  );
@@ -2306,24 +2306,24 @@ const gt = (r, e, t) => ({
2306
2306
  touches: e
2307
2307
  };
2308
2308
  };
2309
- class z {
2310
- constructor(e, t, o, i) {
2311
- s(this, "viewport");
2312
- s(this, "prevTouches", null);
2313
- s(this, "wheelFinishTimer", null);
2314
- s(this, "transformInProgress", !1);
2315
- s(this, "onBeforeDestroy", () => {
2309
+ class X {
2310
+ constructor(e, t, s, i) {
2311
+ o(this, "viewport");
2312
+ o(this, "prevTouches", null);
2313
+ o(this, "wheelFinishTimer", null);
2314
+ o(this, "transformInProgress", !1);
2315
+ o(this, "onBeforeDestroy", () => {
2316
2316
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2317
2317
  });
2318
- s(this, "onMouseDown", (e) => {
2319
- this.element === null || !this.params.mouseDownEventVerifier(e) || (I(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2318
+ o(this, "onMouseDown", (e) => {
2319
+ this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2320
2320
  passive: !0
2321
2321
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2322
2322
  passive: !0
2323
2323
  }), this.startRegisteredTransform());
2324
2324
  });
2325
- s(this, "onWindowMouseMove", (e) => {
2326
- const t = C(
2325
+ o(this, "onWindowMouseMove", (e) => {
2326
+ const t = V(
2327
2327
  this.window,
2328
2328
  this.element,
2329
2329
  e.clientX,
@@ -2333,21 +2333,21 @@ class z {
2333
2333
  this.stopMouseDrag();
2334
2334
  return;
2335
2335
  }
2336
- const o = -e.movementX, i = -e.movementY;
2337
- this.moveViewport(o, i);
2336
+ const s = -e.movementX, i = -e.movementY;
2337
+ this.moveViewport(s, i);
2338
2338
  });
2339
- s(this, "onWindowMouseUp", (e) => {
2339
+ o(this, "onWindowMouseUp", (e) => {
2340
2340
  this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
2341
2341
  });
2342
- s(this, "onWheelScroll", (e) => {
2342
+ o(this, "onWheelScroll", (e) => {
2343
2343
  if (!this.params.mouseWheelEventVerifier(e))
2344
2344
  return;
2345
- const { left: t, top: o } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2345
+ 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);
2346
2346
  this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2347
2347
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2348
2348
  }, this.params.scaleWheelFinishTimeout);
2349
2349
  });
2350
- s(this, "onTouchStart", (e) => {
2350
+ o(this, "onTouchStart", (e) => {
2351
2351
  if (this.prevTouches !== null) {
2352
2352
  this.prevTouches = U(e);
2353
2353
  return;
@@ -2360,10 +2360,10 @@ class z {
2360
2360
  passive: !0
2361
2361
  }), this.startRegisteredTransform();
2362
2362
  });
2363
- s(this, "onWindowTouchMove", (e) => {
2363
+ o(this, "onWindowTouchMove", (e) => {
2364
2364
  const t = U(e);
2365
2365
  if (!t.touches.every(
2366
- (i) => C(this.window, this.element, i[0], i[1])
2366
+ (i) => V(this.window, this.element, i[0], i[1])
2367
2367
  )) {
2368
2368
  this.stopTouchDrag();
2369
2369
  return;
@@ -2377,22 +2377,22 @@ class z {
2377
2377
  }
2378
2378
  this.prevTouches = t;
2379
2379
  });
2380
- s(this, "onWindowTouchFinish", (e) => {
2380
+ o(this, "onWindowTouchFinish", (e) => {
2381
2381
  e.touches.length > 0 ? this.prevTouches = U(e) : this.stopTouchDrag();
2382
2382
  });
2383
- s(this, "observer", new ResizeObserver(() => {
2384
- const e = this.viewport.getViewportMatrix(), { width: t, height: o } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
2383
+ o(this, "observer", new ResizeObserver(() => {
2384
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
2385
2385
  prevTransform: e,
2386
2386
  nextTransform: e,
2387
2387
  canvasWidth: t,
2388
- canvasHeight: o
2388
+ canvasHeight: s
2389
2389
  });
2390
2390
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2391
2391
  }));
2392
- s(this, "preventWheelScaleListener", (e) => {
2392
+ o(this, "preventWheelScaleListener", (e) => {
2393
2393
  e.preventDefault();
2394
2394
  });
2395
- this.canvas = e, this.element = t, this.window = o, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2395
+ this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2396
2396
  passive: !1
2397
2397
  }), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
2398
2398
  passive: !0
@@ -2402,20 +2402,20 @@ class z {
2402
2402
  passive: !0
2403
2403
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2404
2404
  }
2405
- static configure(e, t, o, i) {
2406
- new z(e, t, o, i);
2405
+ static configure(e, t, s, i) {
2406
+ new X(e, t, s, i);
2407
2407
  }
2408
2408
  moveViewport(e, t) {
2409
- const o = this.viewport.getViewportMatrix(), i = gt(o, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2410
- prevTransform: o,
2409
+ const s = this.viewport.getViewportMatrix(), i = ft(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2410
+ prevTransform: s,
2411
2411
  nextTransform: i,
2412
2412
  canvasWidth: n,
2413
2413
  canvasHeight: a
2414
2414
  });
2415
2415
  this.performTransform(h);
2416
2416
  }
2417
- scaleViewport(e, t, o) {
2418
- const i = this.canvas.viewport.getViewportMatrix(), n = lt(i, e, t, o), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
2417
+ scaleViewport(e, t, s) {
2418
+ const i = this.canvas.viewport.getViewportMatrix(), n = mt(i, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
2419
2419
  prevTransform: i,
2420
2420
  nextTransform: n,
2421
2421
  canvasWidth: a,
@@ -2424,7 +2424,7 @@ class z {
2424
2424
  this.performTransform(d);
2425
2425
  }
2426
2426
  stopMouseDrag() {
2427
- I(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2427
+ B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2428
2428
  }
2429
2429
  removeMouseDragListeners() {
2430
2430
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2445,22 +2445,22 @@ class z {
2445
2445
  this.transformInProgress = !1, this.params.onTransformFinished();
2446
2446
  }
2447
2447
  }
2448
- class Q {
2449
- constructor(e, t, o, i, n, a) {
2450
- s(this, "canvasResizeObserver");
2451
- s(this, "nodeHorizontal");
2452
- s(this, "nodeVertical");
2453
- s(this, "viewport");
2454
- s(this, "viewportWidth", 0);
2455
- s(this, "viewportHeight", 0);
2456
- s(this, "viewportMatrix");
2457
- s(this, "loadedArea", {
2448
+ class q {
2449
+ constructor(e, t, s, i, n, a) {
2450
+ o(this, "canvasResizeObserver");
2451
+ o(this, "nodeHorizontal");
2452
+ o(this, "nodeVertical");
2453
+ o(this, "viewport");
2454
+ o(this, "viewportWidth", 0);
2455
+ o(this, "viewportHeight", 0);
2456
+ o(this, "viewportMatrix");
2457
+ o(this, "loadedArea", {
2458
2458
  xFrom: 1 / 0,
2459
2459
  xTo: 1 / 0,
2460
2460
  yFrom: 1 / 0,
2461
2461
  yTo: 1 / 0
2462
2462
  });
2463
- s(this, "updateLoadedArea", (e) => {
2463
+ o(this, "updateLoadedArea", (e) => {
2464
2464
  this.loadedArea = {
2465
2465
  xFrom: e.x,
2466
2466
  xTo: e.x + e.width,
@@ -2468,11 +2468,11 @@ class Q {
2468
2468
  yTo: e.y + e.height
2469
2469
  };
2470
2470
  });
2471
- s(this, "onAfterViewportUpdated", () => {
2471
+ o(this, "onAfterViewportUpdated", () => {
2472
2472
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
2473
2473
  });
2474
- s(this, "userTransformInProgress", !1);
2475
- this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.canvasResizeObserver = new ResizeObserver((d) => {
2474
+ o(this, "userTransformInProgress", !1);
2475
+ 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) => {
2476
2476
  const c = d[0];
2477
2477
  this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
2478
2478
  }), this.viewport = e.viewport;
@@ -2496,18 +2496,18 @@ class Q {
2496
2496
  this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
2497
2497
  }
2498
2498
  };
2499
- z.configure(
2499
+ X.configure(
2500
2500
  e,
2501
2501
  this.element,
2502
2502
  this.window,
2503
2503
  h
2504
2504
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2505
2505
  }
2506
- static configure(e, t, o, i, n, a) {
2507
- new Q(
2506
+ static configure(e, t, s, i, n, a) {
2507
+ new q(
2508
2508
  e,
2509
2509
  t,
2510
- o,
2510
+ s,
2511
2511
  i,
2512
2512
  n,
2513
2513
  a
@@ -2519,21 +2519,21 @@ class Q {
2519
2519
  });
2520
2520
  }
2521
2521
  scheduleEnsureViewportAreaLoaded() {
2522
- const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, o = 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;
2523
- this.loadedArea.xFrom < o && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
2522
+ 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;
2523
+ this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
2524
2524
  }
2525
2525
  loadAreaAroundViewport() {
2526
- const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, o = 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;
2527
- this.trigger.emit({ x: o, y: i, width: n, height: a });
2526
+ 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;
2527
+ this.trigger.emit({ x: s, y: i, width: n, height: a });
2528
2528
  }
2529
2529
  }
2530
- const ut = () => {
2530
+ const yt = () => {
2531
2531
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2532
2532
  return r.style.position = "absolute", r.style.inset = "0", r;
2533
- }, pt = () => {
2533
+ }, vt = () => {
2534
2534
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2535
2535
  return r.setAttribute("fill", "url(#pattern)"), r;
2536
- }, wt = () => {
2536
+ }, Et = () => {
2537
2537
  const r = document.createElementNS(
2538
2538
  "http://www.w3.org/2000/svg",
2539
2539
  "pattern"
@@ -2541,53 +2541,53 @@ const ut = () => {
2541
2541
  return r.setAttribute("id", "pattern"), r;
2542
2542
  };
2543
2543
  class _ {
2544
- constructor(e, t, o) {
2545
- s(this, "svg", ut());
2546
- s(this, "patternRenderingRectangle", pt());
2547
- s(this, "pattern", wt());
2548
- s(this, "patternContent");
2549
- s(this, "tileWidth");
2550
- s(this, "tileHeight");
2551
- s(this, "halfTileWidth");
2552
- s(this, "halfTileHeight");
2553
- s(this, "maxViewportScale");
2554
- s(this, "visible", !1);
2555
- s(this, "resizeObserver", new ResizeObserver((e) => {
2556
- const t = e[0], { width: o, height: i } = t.contentRect;
2557
- this.svg.setAttribute("width", `${o}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${o}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
2558
- const n = this.tileWidth / o, a = this.tileHeight / i;
2544
+ constructor(e, t, s) {
2545
+ o(this, "svg", yt());
2546
+ o(this, "patternRenderingRectangle", vt());
2547
+ o(this, "pattern", Et());
2548
+ o(this, "patternContent");
2549
+ o(this, "tileWidth");
2550
+ o(this, "tileHeight");
2551
+ o(this, "halfTileWidth");
2552
+ o(this, "halfTileHeight");
2553
+ o(this, "maxViewportScale");
2554
+ o(this, "visible", !1);
2555
+ o(this, "resizeObserver", new ResizeObserver((e) => {
2556
+ const t = e[0], { width: s, height: i } = t.contentRect;
2557
+ this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
2558
+ const n = this.tileWidth / s, a = this.tileHeight / i;
2559
2559
  this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
2560
2560
  }));
2561
- s(this, "onAfterTransformUpdated", () => {
2562
- const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, o = e.y - this.halfTileHeight * e.scale, i = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${o})`;
2561
+ o(this, "onAfterTransformUpdated", () => {
2562
+ 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})`;
2563
2563
  this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2564
2564
  });
2565
- this.canvas = e, this.backgroundHost = o, 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;
2565
+ 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;
2566
2566
  const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2567
2567
  this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2568
2568
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2569
2569
  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();
2570
2570
  }
2571
- static configure(e, t, o) {
2572
- new _(e, t, o);
2571
+ static configure(e, t, s) {
2572
+ new _(e, t, s);
2573
2573
  }
2574
2574
  updateVisibility() {
2575
2575
  const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
2576
2576
  t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
2577
2577
  }
2578
2578
  }
2579
- class q {
2580
- constructor(e, t, o, i, n) {
2581
- s(this, "overlayCanvas");
2582
- s(this, "staticPortId", null);
2583
- s(this, "isTargetDragging", !0);
2584
- s(this, "onEdgeCreated", (e) => {
2579
+ class ee {
2580
+ constructor(e, t, s, i, n) {
2581
+ o(this, "overlayCanvas");
2582
+ o(this, "staticPortId", null);
2583
+ o(this, "isTargetDragging", !0);
2584
+ o(this, "onEdgeCreated", (e) => {
2585
2585
  this.params.onAfterEdgeCreated(e);
2586
2586
  });
2587
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas = Re(
2587
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
2588
2588
  this.overlayLayer,
2589
2589
  this.viewportStore
2590
- ), k.configure(
2590
+ ), z.configure(
2591
2591
  this.canvas,
2592
2592
  this.overlayLayer,
2593
2593
  this.window,
@@ -2610,80 +2610,80 @@ class q {
2610
2610
  }
2611
2611
  );
2612
2612
  }
2613
- static configure(e, t, o, i, n) {
2614
- new q(
2613
+ static configure(e, t, s, i, n) {
2614
+ new ee(
2615
2615
  e,
2616
2616
  t,
2617
- o,
2617
+ s,
2618
2618
  i,
2619
2619
  n
2620
2620
  );
2621
2621
  }
2622
- grabPort(e, t, o) {
2622
+ grabPort(e, t, s) {
2623
2623
  const i = this.canvas.graph.getPort(e);
2624
2624
  this.staticPortId = e;
2625
- 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(), l = T(c, {
2625
+ 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 = D(c, {
2626
2626
  x: a - d.x,
2627
2627
  y: h - d.y
2628
- }), g = T(c, {
2628
+ }), l = D(c, {
2629
2629
  x: t.x - d.x,
2630
2630
  y: t.y - d.y
2631
- }), p = {
2632
- overlayId: P.Static,
2633
- portCoords: l,
2634
- portDirection: i.direction
2635
- }, f = {
2636
- overlayId: P.Dragging,
2631
+ }), u = {
2632
+ overlayId: b.Static,
2637
2633
  portCoords: g,
2634
+ portDirection: i.direction
2635
+ }, w = {
2636
+ overlayId: b.Dragging,
2637
+ portCoords: l,
2638
2638
  portDirection: this.params.dragPortDirection
2639
2639
  };
2640
- this.isTargetDragging = o === "direct";
2641
- const [y, v] = this.isTargetDragging ? [p, f] : [f, p];
2642
- this.overlayCanvas.addNode(B(y)), this.overlayCanvas.addNode(B(v)), this.overlayCanvas.addEdge({
2643
- from: y.overlayId,
2640
+ this.isTargetDragging = s === "direct";
2641
+ const [m, v] = this.isTargetDragging ? [u, w] : [w, u];
2642
+ this.overlayCanvas.addNode(F(m)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
2643
+ from: m.overlayId,
2644
2644
  to: v.overlayId,
2645
- shape: this.params.edgeShapeFactory(P.Edge)
2645
+ shape: this.params.edgeShapeFactory(b.Edge)
2646
2646
  });
2647
2647
  }
2648
2648
  resetDragState() {
2649
2649
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2650
2650
  }
2651
2651
  tryCreateConnection(e) {
2652
- const t = Ee(this.canvas.graph, e), o = this.staticPortId;
2652
+ const t = Ae(this.canvas.graph, e), s = this.staticPortId;
2653
2653
  if (t === null) {
2654
2654
  this.params.onEdgeCreationInterrupted({
2655
- staticPortId: o,
2655
+ staticPortId: s,
2656
2656
  isDirect: this.isTargetDragging
2657
2657
  });
2658
2658
  return;
2659
2659
  }
2660
- const i = this.isTargetDragging ? o : t, n = this.isTargetDragging ? t : o, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2660
+ const i = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2661
2661
  h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2662
2662
  }
2663
2663
  moveDraggingPort(e) {
2664
- const t = this.overlayLayer.getBoundingClientRect(), o = {
2664
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
2665
2665
  x: e.x - t.x,
2666
2666
  y: e.y - t.y
2667
- }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, o);
2668
- this.overlayCanvas.updateNode(P.Dragging, {
2667
+ }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
2668
+ this.overlayCanvas.updateNode(b.Dragging, {
2669
2669
  x: n.x,
2670
2670
  y: n.y
2671
2671
  });
2672
2672
  }
2673
2673
  }
2674
- class ee {
2675
- constructor(e, t, o, i, n) {
2676
- s(this, "overlayCanvas");
2677
- s(this, "staticPortId", null);
2678
- s(this, "isTargetDragging", !0);
2679
- s(this, "draggingEdgePayload", null);
2680
- s(this, "onEdgeReattached", (e) => {
2674
+ class te {
2675
+ constructor(e, t, s, i, n) {
2676
+ o(this, "overlayCanvas");
2677
+ o(this, "staticPortId", null);
2678
+ o(this, "isTargetDragging", !0);
2679
+ o(this, "draggingEdgePayload", null);
2680
+ o(this, "onEdgeReattached", (e) => {
2681
2681
  this.params.onAfterEdgeReattached(e);
2682
2682
  });
2683
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas = Re(
2683
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
2684
2684
  this.overlayLayer,
2685
2685
  this.viewportStore
2686
- ), k.configure(
2686
+ ), z.configure(
2687
2687
  this.canvas,
2688
2688
  this.overlayLayer,
2689
2689
  this.window,
@@ -2703,56 +2703,56 @@ class ee {
2703
2703
  }
2704
2704
  );
2705
2705
  }
2706
- static configure(e, t, o, i, n) {
2707
- new ee(
2706
+ static configure(e, t, s, i, n) {
2707
+ new te(
2708
2708
  e,
2709
2709
  t,
2710
- o,
2710
+ s,
2711
2711
  i,
2712
2712
  n
2713
2713
  );
2714
2714
  }
2715
2715
  tryStartEdgeDragging(e, t) {
2716
- const o = this.params.draggingEdgeResolver(e);
2717
- if (o === null)
2716
+ const s = this.params.draggingEdgeResolver(e);
2717
+ if (s === null)
2718
2718
  return !1;
2719
- const i = this.canvas.graph.getEdge(o);
2719
+ const i = this.canvas.graph.getEdge(s);
2720
2720
  if (i === null)
2721
2721
  return !1;
2722
2722
  const n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2723
2723
  this.staticPortId = h, this.isTargetDragging = a;
2724
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), g = {
2725
- x: l.x + l.width / 2,
2726
- y: l.y + l.height / 2
2727
- }, p = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), y = T(p, {
2728
- x: g.x - f.x,
2729
- y: g.y - f.y
2730
- }), v = T(p, {
2731
- x: t.x - f.x,
2732
- y: t.y - f.y
2724
+ const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
2725
+ x: g.x + g.width / 2,
2726
+ y: g.y + g.height / 2
2727
+ }, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), m = D(u, {
2728
+ x: l.x - w.x,
2729
+ y: l.y - w.y
2730
+ }), v = D(u, {
2731
+ x: t.x - w.x,
2732
+ y: t.y - w.y
2733
2733
  });
2734
2734
  this.draggingEdgePayload = {
2735
- id: o,
2735
+ id: s,
2736
2736
  from: i.from,
2737
2737
  to: i.to,
2738
2738
  shape: i.shape,
2739
2739
  priority: i.priority
2740
- }, this.canvas.removeEdge(o);
2741
- const x = {
2742
- overlayId: P.Static,
2743
- portCoords: y,
2740
+ }, this.canvas.removeEdge(s);
2741
+ const E = {
2742
+ overlayId: b.Static,
2743
+ portCoords: m,
2744
2744
  portDirection: c.direction
2745
2745
  }, A = {
2746
- overlayId: P.Dragging,
2746
+ overlayId: b.Dragging,
2747
2747
  portCoords: v,
2748
2748
  portDirection: d.direction
2749
- }, [M, b] = this.isTargetDragging ? [x, A] : [A, x];
2750
- this.overlayCanvas.addNode(B(M)), this.overlayCanvas.addNode(B(b));
2751
- const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(P.Edge) : i.shape;
2749
+ }, [R, T] = this.isTargetDragging ? [E, A] : [A, E];
2750
+ this.overlayCanvas.addNode(F(R)), this.overlayCanvas.addNode(F(T));
2751
+ const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(b.Edge) : i.shape;
2752
2752
  return this.overlayCanvas.addEdge({
2753
- id: P.Edge,
2754
- from: M.overlayId,
2755
- to: b.overlayId,
2753
+ id: b.Edge,
2754
+ from: R.overlayId,
2755
+ to: T.overlayId,
2756
2756
  shape: N
2757
2757
  }), !0;
2758
2758
  }
@@ -2760,18 +2760,18 @@ class ee {
2760
2760
  this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2761
2761
  }
2762
2762
  moveDraggingPort(e) {
2763
- const t = this.overlayLayer.getBoundingClientRect(), o = {
2763
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
2764
2764
  x: e.x - t.x,
2765
2765
  y: e.y - t.y
2766
- }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, o);
2767
- this.overlayCanvas.updateNode(P.Dragging, {
2766
+ }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
2767
+ this.overlayCanvas.updateNode(b.Dragging, {
2768
2768
  x: n.x,
2769
2769
  y: n.y
2770
2770
  });
2771
2771
  }
2772
2772
  tryCreateConnection(e) {
2773
- const t = Ee(this.canvas.graph, e);
2774
- if (this.overlayCanvas.removeEdge(P.Edge), t === null) {
2773
+ const t = Ae(this.canvas.graph, e);
2774
+ if (this.overlayCanvas.removeEdge(b.Edge), t === null) {
2775
2775
  const d = this.draggingEdgePayload;
2776
2776
  this.params.onEdgeReattachInterrupted({
2777
2777
  id: d.id,
@@ -2782,9 +2782,9 @@ class ee {
2782
2782
  });
2783
2783
  return;
2784
2784
  }
2785
- const [o, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2785
+ const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2786
2786
  id: n.id,
2787
- from: o,
2787
+ from: s,
2788
2788
  to: i,
2789
2789
  shape: n.shape,
2790
2790
  priority: n.priority
@@ -2803,28 +2803,28 @@ class ee {
2803
2803
  }
2804
2804
  }
2805
2805
  }
2806
- class te {
2807
- constructor(e, t, o) {
2808
- this.canvas = e, this.layoutAlgorithm = t, this.trigger = o, this.trigger.subscribe(() => {
2806
+ class re {
2807
+ constructor(e, t, s) {
2808
+ this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
2809
2809
  this.applyLayout();
2810
2810
  });
2811
2811
  }
2812
- static configure(e, t, o) {
2813
- new te(
2812
+ static configure(e, t, s) {
2813
+ new re(
2814
2814
  e,
2815
2815
  t,
2816
- o
2816
+ s
2817
2817
  );
2818
2818
  }
2819
2819
  applyLayout() {
2820
- this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, o) => {
2821
- this.canvas.updateNode(o, t);
2820
+ this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
2821
+ this.canvas.updateNode(s, t);
2822
2822
  });
2823
2823
  }
2824
2824
  }
2825
- class re {
2825
+ class se {
2826
2826
  constructor(e, t) {
2827
- s(this, "applyScheduled", !1);
2827
+ o(this, "applyScheduled", !1);
2828
2828
  this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2829
2829
  this.scheduleApply();
2830
2830
  }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
@@ -2836,7 +2836,7 @@ class re {
2836
2836
  });
2837
2837
  }
2838
2838
  static configure(e, t) {
2839
- new re(
2839
+ new se(
2840
2840
  e,
2841
2841
  t
2842
2842
  );
@@ -2847,25 +2847,25 @@ class re {
2847
2847
  }));
2848
2848
  }
2849
2849
  applyLayout() {
2850
- this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, o) => {
2851
- this.canvas.updateNode(o, t);
2850
+ this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
2851
+ this.canvas.updateNode(s, t);
2852
2852
  });
2853
2853
  }
2854
2854
  }
2855
- class ft {
2855
+ class At {
2856
2856
  static configure(e, t) {
2857
- const o = t.applyOn;
2858
- switch (o.type) {
2857
+ const s = t.applyOn;
2858
+ switch (s.type) {
2859
2859
  case "manual": {
2860
- te.configure(
2860
+ re.configure(
2861
2861
  e,
2862
2862
  t.algorithm,
2863
- o.trigger
2863
+ s.trigger
2864
2864
  );
2865
2865
  break;
2866
2866
  }
2867
2867
  case "topologyChangeTimeout": {
2868
- re.configure(
2868
+ se.configure(
2869
2869
  e,
2870
2870
  t.algorithm
2871
2871
  );
@@ -2874,10 +2874,10 @@ class ft {
2874
2874
  }
2875
2875
  }
2876
2876
  }
2877
- class yt {
2877
+ class xt {
2878
2878
  constructor(e, t) {
2879
- s(this, "previousTimeStamp");
2880
- s(this, "step", (e) => {
2879
+ o(this, "previousTimeStamp");
2880
+ o(this, "step", (e) => {
2881
2881
  if (this.previousTimeStamp === void 0)
2882
2882
  this.previousTimeStamp = e;
2883
2883
  else {
@@ -2890,60 +2890,60 @@ class yt {
2890
2890
  }
2891
2891
  }
2892
2892
  class oe {
2893
- constructor(e, t, o, i) {
2894
- s(this, "step", (e) => {
2895
- this.params.algorithm.calculateNextCoordinates(
2893
+ constructor(e, t, s, i) {
2894
+ o(this, "step", (e) => {
2895
+ this.algorithm.calculateNextCoordinates(
2896
2896
  this.canvas.graph,
2897
2897
  e
2898
- ).forEach((o, i) => {
2899
- this.staticNodes.has(i) || this.canvas.updateNode(i, { x: o.x, y: o.y });
2898
+ ).forEach((s, i) => {
2899
+ this.staticNodes.has(i) || this.canvas.updateNode(i, { x: s.x, y: s.y });
2900
2900
  });
2901
2901
  });
2902
- this.canvas = e, this.params = t, this.staticNodes = o, this.win = i, new yt(this.win, this.step);
2902
+ this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new xt(this.win, this.step);
2903
2903
  }
2904
- static configure(e, t, o, i) {
2905
- new oe(e, t, o, i);
2904
+ static configure(e, t, s, i) {
2905
+ new oe(e, t, s, i);
2906
2906
  }
2907
2907
  }
2908
- const mt = () => {
2908
+ const St = () => {
2909
2909
  const r = document.createElement("div");
2910
2910
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
2911
- }, Y = () => {
2911
+ }, H = () => {
2912
2912
  const r = document.createElement("div");
2913
2913
  return r.style.position = "absolute", r.style.inset = "0", r;
2914
- }, ue = () => {
2915
- const r = Y();
2914
+ }, pe = () => {
2915
+ const r = H();
2916
2916
  return r.style.pointerEvents = "none", r;
2917
2917
  };
2918
- class vt {
2918
+ class Pt {
2919
2919
  constructor(e) {
2920
- s(this, "background", Y());
2921
- s(this, "main", Y());
2922
- s(this, "overlayConnectablePorts", ue());
2923
- s(this, "overlayDraggableEdges", ue());
2924
- s(this, "host", mt());
2920
+ o(this, "background", H());
2921
+ o(this, "main", H());
2922
+ o(this, "overlayConnectablePorts", pe());
2923
+ o(this, "overlayDraggableEdges", pe());
2924
+ o(this, "host", St());
2925
2925
  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);
2926
2926
  }
2927
2927
  destroy() {
2928
2928
  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);
2929
2929
  }
2930
2930
  }
2931
- const H = (r) => () => r, pe = H(0), Et = () => {
2931
+ const j = (r) => () => r, we = j(0), bt = () => {
2932
2932
  let r = 0;
2933
2933
  return () => r++;
2934
- }, At = (r, e) => {
2935
- let t = pe, o = pe;
2936
- const i = Et();
2937
- return r === "incremental" && (t = i), e === "incremental" && (o = i), typeof r == "number" && (t = H(r)), typeof e == "number" && (o = H(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
2934
+ }, Tt = (r, e) => {
2935
+ let t = we, s = we;
2936
+ const i = bt();
2937
+ 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), {
2938
2938
  nodesPriorityFn: t,
2939
- edgesPriorityFn: o
2939
+ edgesPriorityFn: s
2940
2940
  };
2941
- }, se = (r) => {
2941
+ }, ie = (r) => {
2942
2942
  if (typeof r == "function")
2943
2943
  return r;
2944
2944
  switch (r.type) {
2945
2945
  case "straight":
2946
- return () => new nt({
2946
+ return () => new lt({
2947
2947
  color: r.color,
2948
2948
  width: r.width,
2949
2949
  arrowLength: r.arrowLength,
@@ -2957,7 +2957,7 @@ const H = (r) => () => r, pe = H(0), Et = () => {
2957
2957
  detourDirection: r.detourDirection
2958
2958
  });
2959
2959
  case "horizontal":
2960
- return () => new it({
2960
+ return () => new ct({
2961
2961
  color: r.color,
2962
2962
  width: r.width,
2963
2963
  arrowLength: r.arrowLength,
@@ -2970,7 +2970,7 @@ const H = (r) => () => r, pe = H(0), Et = () => {
2970
2970
  detourDistance: r.detourDistance
2971
2971
  });
2972
2972
  case "vertical":
2973
- return () => new at({
2973
+ return () => new gt({
2974
2974
  color: r.color,
2975
2975
  width: r.width,
2976
2976
  arrowLength: r.arrowLength,
@@ -2994,7 +2994,7 @@ const H = (r) => () => r, pe = H(0), Et = () => {
2994
2994
  targetOffset: r.targetOffset
2995
2995
  });
2996
2996
  default:
2997
- return () => new st({
2997
+ return () => new dt({
2998
2998
  color: r.color,
2999
2999
  width: r.width,
3000
3000
  arrowLength: r.arrowLength,
@@ -3008,185 +3008,185 @@ const H = (r) => () => r, pe = H(0), Et = () => {
3008
3008
  detourDirection: r.detourDirection
3009
3009
  });
3010
3010
  }
3011
- }, xt = (r) => {
3012
- var t, o, i, n, a;
3013
- const e = At(
3011
+ }, Dt = (r) => {
3012
+ var t, s, i, n, a;
3013
+ const e = Tt(
3014
3014
  (t = r.nodes) == null ? void 0 : t.priority,
3015
- (o = r.edges) == null ? void 0 : o.priority
3015
+ (s = r.edges) == null ? void 0 : s.priority
3016
3016
  );
3017
3017
  return {
3018
3018
  nodes: {
3019
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Ae,
3019
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? xe,
3020
3020
  priorityFn: e.nodesPriorityFn
3021
3021
  },
3022
3022
  ports: {
3023
3023
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
3024
3024
  },
3025
3025
  edges: {
3026
- shapeFactory: se(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3026
+ shapeFactory: ie(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3027
3027
  priorityFn: e.edgesPriorityFn
3028
3028
  }
3029
3029
  };
3030
- }, St = (r) => {
3031
- var p, f, y, v, x;
3032
- const e = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
3033
- }), t = r.nodeDragVerifier ?? (() => !0), o = ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
3034
- }), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (y = r.mouse) == null ? void 0 : y.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (A) => A.button === 0, l = (x = r.mouse) == null ? void 0 : x.mouseUpEventVerifier, g = l !== void 0 ? l : (A) => A.button === 0;
3030
+ }, Nt = (r) => {
3031
+ var u, w, m, v, E;
3032
+ const e = ((u = r.events) == null ? void 0 : u.onNodeDrag) ?? (() => {
3033
+ }), t = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
3034
+ }), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (m = r.mouse) == null ? void 0 : m.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (A) => A.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (A) => A.button === 0;
3035
3035
  return {
3036
3036
  moveOnTop: i,
3037
3037
  moveEdgesOnTop: n,
3038
3038
  dragCursor: h,
3039
3039
  gridSize: r.gridSize ?? null,
3040
3040
  mouseDownEventVerifier: c,
3041
- mouseUpEventVerifier: g,
3041
+ mouseUpEventVerifier: l,
3042
3042
  onNodeDrag: e,
3043
3043
  nodeDragVerifier: t,
3044
- onNodeDragFinished: o
3044
+ onNodeDragFinished: s
3045
3045
  };
3046
- }, Pt = (r) => {
3047
- const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
3046
+ }, Mt = (r) => {
3047
+ 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;
3048
3048
  return (n) => {
3049
3049
  let a = n.nextTransform.x, h = n.nextTransform.y;
3050
3050
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3051
3051
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3052
- a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < o && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, o));
3053
- const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
3054
- return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
3052
+ 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));
3053
+ const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
3054
+ return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
3055
3055
  };
3056
- }, bt = (r) => {
3057
- const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3056
+ }, Lt = (r) => {
3057
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
3058
3058
  return (n) => {
3059
3059
  const a = n.prevTransform, h = n.nextTransform;
3060
- let d = h.scale, c = h.x, l = h.y;
3060
+ let d = h.scale, c = h.x, g = h.y;
3061
3061
  if (h.scale > i && h.scale > a.scale) {
3062
- d = Math.max(a.scale, i), c = a.x, l = a.y;
3063
- const g = (d - a.scale) / (h.scale - a.scale);
3064
- c = a.x + (h.x - a.x) * g, l = a.y + (h.y - a.y) * g;
3062
+ d = Math.max(a.scale, i), c = a.x, g = a.y;
3063
+ const l = (d - a.scale) / (h.scale - a.scale);
3064
+ c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3065
3065
  }
3066
- if (h.scale < o && h.scale < a.scale) {
3067
- d = Math.min(a.scale, o), c = a.x, l = a.y;
3068
- const g = (d - a.scale) / (h.scale - a.scale);
3069
- c = a.x + (h.x - a.x) * g, l = a.y + (h.y - a.y) * g;
3066
+ if (h.scale < s && h.scale < a.scale) {
3067
+ d = Math.min(a.scale, s), c = a.x, g = a.y;
3068
+ const l = (d - a.scale) / (h.scale - a.scale);
3069
+ c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
3070
3070
  }
3071
3071
  return {
3072
3072
  scale: d,
3073
3073
  x: c,
3074
- y: l
3074
+ y: g
3075
3075
  };
3076
3076
  };
3077
- }, Tt = (r) => (e) => r.reduce(
3078
- (t, o) => o({
3077
+ }, Rt = (r) => (e) => r.reduce(
3078
+ (t, s) => s({
3079
3079
  prevTransform: e.prevTransform,
3080
3080
  nextTransform: t,
3081
3081
  canvasWidth: e.canvasWidth,
3082
3082
  canvasHeight: e.canvasHeight
3083
3083
  }),
3084
3084
  e.nextTransform
3085
- ), we = (r) => {
3085
+ ), fe = (r) => {
3086
3086
  if (typeof r == "function")
3087
3087
  return r;
3088
3088
  switch (r.type) {
3089
3089
  case "scale-limit":
3090
- return bt({
3090
+ return Lt({
3091
3091
  minContentScale: r.minContentScale ?? 0,
3092
3092
  maxContentScale: r.maxContentScale ?? 1 / 0
3093
3093
  });
3094
3094
  case "shift-limit":
3095
- return Pt({
3095
+ return Mt({
3096
3096
  minX: r.minX ?? -1 / 0,
3097
3097
  maxX: r.maxX ?? 1 / 0,
3098
3098
  minY: r.minY ?? -1 / 0,
3099
3099
  maxY: r.maxY ?? 1 / 0
3100
3100
  });
3101
3101
  }
3102
- }, fe = (r) => {
3103
- var y, v, x, A, M, b, N, V, ie, ne, ae, he;
3104
- const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3102
+ }, me = (r) => {
3103
+ var m, v, E, A, R, T, N, $, ne, ae, he, de;
3104
+ 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;
3105
3105
  let i;
3106
- o !== void 0 ? Array.isArray(o) ? i = Tt(
3107
- o.map(
3108
- (D) => we(D)
3106
+ s !== void 0 ? Array.isArray(s) ? i = Rt(
3107
+ s.map(
3108
+ (M) => fe(M)
3109
3109
  )
3110
- ) : i = we(o) : i = (D) => D.nextTransform;
3111
- const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
3110
+ ) : i = fe(s) : i = (M) => M.nextTransform;
3111
+ 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) ?? (() => {
3112
3112
  }), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
3113
- }), d = (M = r == null ? void 0 : r.shift) == null ? void 0 : M.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, l = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = l !== void 0 ? l : (D) => D.button === 0, p = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, f = p !== void 0 ? p : () => !0;
3113
+ }), d = (R = r == null ? void 0 : r.shift) == null ? void 0 : R.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.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;
3114
3114
  return {
3115
3115
  wheelSensitivity: t,
3116
- onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
3116
+ onTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onTransformStarted) ?? (() => {
3117
3117
  }),
3118
- onTransformFinished: ((ie = r == null ? void 0 : r.events) == null ? void 0 : ie.onTransformFinished) ?? (() => {
3118
+ onTransformFinished: ((ne = r == null ? void 0 : r.events) == null ? void 0 : ne.onTransformFinished) ?? (() => {
3119
3119
  }),
3120
3120
  onBeforeTransformChange: a,
3121
3121
  onTransformChange: h,
3122
3122
  transformPreprocessor: i,
3123
3123
  shiftCursor: n,
3124
3124
  mouseDownEventVerifier: c,
3125
- mouseUpEventVerifier: g,
3126
- mouseWheelEventVerifier: f,
3127
- scaleWheelFinishTimeout: ((ne = r == null ? void 0 : r.scale) == null ? void 0 : ne.wheelFinishTimeout) ?? 500,
3128
- onResizeTransformStarted: ((ae = r == null ? void 0 : r.events) == null ? void 0 : ae.onResizeTransformStarted) ?? (() => {
3125
+ mouseUpEventVerifier: l,
3126
+ mouseWheelEventVerifier: w,
3127
+ scaleWheelFinishTimeout: ((ae = r == null ? void 0 : r.scale) == null ? void 0 : ae.wheelFinishTimeout) ?? 500,
3128
+ onResizeTransformStarted: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onResizeTransformStarted) ?? (() => {
3129
3129
  }),
3130
- onResizeTransformFinished: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onResizeTransformFinished) ?? (() => {
3130
+ onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
3131
3131
  })
3132
3132
  };
3133
- }, Nt = (r, e) => {
3133
+ }, Ct = (r, e) => {
3134
3134
  const t = document.createElementNS(
3135
3135
  "http://www.w3.org/2000/svg",
3136
3136
  "circle"
3137
3137
  );
3138
3138
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3139
- }, Dt = (r) => r instanceof SVGElement ? r : Nt(
3139
+ }, Vt = (r) => r instanceof SVGElement ? r : Ct(
3140
3140
  (r == null ? void 0 : r.radius) ?? 1.5,
3141
3141
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3142
- ), Lt = (r) => {
3143
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, i = Dt(r.renderer ?? {});
3142
+ ), $t = (r) => {
3143
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Vt(r.renderer ?? {});
3144
3144
  return {
3145
3145
  tileWidth: t,
3146
- tileHeight: o,
3146
+ tileHeight: s,
3147
3147
  renderer: i,
3148
3148
  maxViewportScale: r.maxViewportScale ?? 10
3149
3149
  };
3150
- }, Mt = (r, e, t) => {
3151
- var c, l, g;
3152
- const o = () => "direct", i = (p) => p, n = (p) => p.button === 0, a = () => {
3150
+ }, It = (r, e, t) => {
3151
+ var c, g, l;
3152
+ const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
3153
3153
  }, h = () => {
3154
3154
  }, d = () => {
3155
3155
  };
3156
3156
  return {
3157
- connectionTypeResolver: r.connectionTypeResolver ?? o,
3157
+ connectionTypeResolver: r.connectionTypeResolver ?? s,
3158
3158
  connectionPreprocessor: r.connectionPreprocessor ?? i,
3159
3159
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3160
3160
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3161
3161
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3162
- onEdgeCreationInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeCreationInterrupted) ?? d,
3163
- onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
3162
+ onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3163
+ onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
3164
3164
  dragPortDirection: r.dragPortDirection ?? t,
3165
- edgeShapeFactory: r.edgeShape !== void 0 ? se(r.edgeShape) : e
3165
+ edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
3166
3166
  };
3167
- }, Rt = (r, e) => {
3168
- var c, l, g;
3169
- const t = (p) => p, o = (p) => p.button === 0 && p.ctrlKey, i = (p) => p.button === 0, n = (p) => {
3170
- const f = e.getPortAdjacentEdgeIds(p);
3171
- return f.length > 0 ? f[f.length - 1] : null;
3167
+ }, Ut = (r, e) => {
3168
+ var c, g, l;
3169
+ const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
3170
+ const w = e.getPortAdjacentEdgeIds(u);
3171
+ return w.length > 0 ? w[w.length - 1] : null;
3172
3172
  }, a = () => {
3173
3173
  }, h = () => {
3174
3174
  }, d = () => {
3175
3175
  };
3176
3176
  return {
3177
3177
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3178
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
3178
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3179
3179
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3180
3180
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3181
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? se(r.draggingEdgeShape) : null,
3181
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ie(r.draggingEdgeShape) : null,
3182
3182
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3183
- onEdgeReattachInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeReattachInterrupted) ?? d,
3184
- onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
3183
+ onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3184
+ onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3185
3185
  };
3186
- }, Ct = (r) => ({
3186
+ }, Bt = (r) => ({
3187
3187
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3188
3188
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3189
- }), Vt = (r) => {
3189
+ }), Ft = (r) => {
3190
3190
  var e, t;
3191
3191
  return {
3192
3192
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3195,60 +3195,232 @@ const H = (r) => () => r, pe = H(0), Et = () => {
3195
3195
  })
3196
3196
  };
3197
3197
  };
3198
- class $t extends Error {
3198
+ class Ot extends Error {
3199
3199
  constructor() {
3200
3200
  super(...arguments);
3201
- s(this, "name", "CanvasBuilderError");
3201
+ o(this, "name", "CanvasBuilderError");
3202
+ }
3203
+ }
3204
+ class Wt {
3205
+ constructor(e, t) {
3206
+ this.coordinates = e, this.rand = t;
3207
+ }
3208
+ getVector(e, t) {
3209
+ 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;
3210
+ if (h === 0) {
3211
+ const l = this.rand() * 2 * Math.PI;
3212
+ return { ex: Math.cos(l), ey: Math.sin(l), d2: 1, d: 1 };
3213
+ }
3214
+ const d = Math.sqrt(h), c = n / d, g = a / d;
3215
+ return { ex: c, ey: g, d2: h, d };
3216
+ }
3217
+ }
3218
+ class Ve {
3219
+ constructor(e, t, s) {
3220
+ o(this, "dtSec");
3221
+ o(this, "k");
3222
+ o(this, "nodeMass");
3223
+ o(this, "edgeEquilibriumLength");
3224
+ o(this, "edgeStiffness");
3225
+ o(this, "effectiveDistance");
3226
+ 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;
3227
+ }
3228
+ next() {
3229
+ let e = 0;
3230
+ const t = /* @__PURE__ */ new Map(), s = this.graph.getAllNodeIds();
3231
+ s.forEach((a) => {
3232
+ t.set(a, { x: 0, y: 0 });
3233
+ });
3234
+ const i = new Wt(
3235
+ this.currentCoords,
3236
+ this.params.rand
3237
+ ), n = s.length;
3238
+ for (let a = 0; a < n; a++) {
3239
+ const h = s[a];
3240
+ for (let d = a + 1; d < n; d++) {
3241
+ const c = s[d], g = i.getVector(h, c);
3242
+ if (g.d > this.effectiveDistance)
3243
+ continue;
3244
+ const l = this.k / g.d2, u = l * g.ex, w = l * g.ey, m = u / 2, v = w / 2, E = t.get(h), A = t.get(c);
3245
+ E.x -= m, E.y -= v, A.x += m, A.y += v;
3246
+ }
3247
+ }
3248
+ return this.graph.getAllEdgeIds().forEach((a) => {
3249
+ 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), u = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * u, m = g.ey * u, v = t.get(d.nodeId), E = t.get(c.nodeId);
3250
+ v.x += w, v.y += m, E.x -= w, E.y -= m;
3251
+ }), this.currentCoords.forEach((a, h) => {
3252
+ const d = t.get(h), c = {
3253
+ x: d.x / this.nodeMass * this.dtSec,
3254
+ y: d.y / this.nodeMass * this.dtSec
3255
+ }, g = c.x * this.dtSec, l = c.y * this.dtSec;
3256
+ a.x += g, a.y += l, e = Math.max(e, Math.sqrt(g * g + l * l));
3257
+ }), e;
3258
+ }
3259
+ }
3260
+ const $e = (r, e, t) => {
3261
+ const s = /* @__PURE__ */ new Map(), i = r.getAllNodeIds(), n = Math.sqrt(i.length) * t;
3262
+ return i.forEach((a) => {
3263
+ const h = r.getNode(a);
3264
+ s.set(a, {
3265
+ x: h.x ?? n * e(),
3266
+ y: h.y ?? n * e()
3267
+ });
3268
+ }), s;
3269
+ };
3270
+ class kt {
3271
+ constructor(e) {
3272
+ this.params = e;
3273
+ }
3274
+ calculateCoordinates(e) {
3275
+ const t = $e(
3276
+ e,
3277
+ this.params.rand,
3278
+ this.params.edgeEquilibriumLength
3279
+ );
3280
+ for (let s = 0; s < this.params.maxIterations && !(new Ve(e, t, {
3281
+ rand: this.params.rand,
3282
+ dtSec: this.params.dtSec,
3283
+ nodeMass: this.params.nodeMass,
3284
+ nodeCharge: this.params.nodeCharge,
3285
+ edgeEquilibriumLength: this.params.edgeEquilibriumLength,
3286
+ effectiveDistance: this.params.effectiveDistance,
3287
+ edgeStiffness: this.params.edgeStiffness
3288
+ }).next() < this.params.convergenceDelta); s++)
3289
+ ;
3290
+ return t;
3202
3291
  }
3203
3292
  }
3204
- const Ut = (r) => ({
3205
- algorithm: r.algorithm
3206
- }), It = (r) => r instanceof j ? {
3293
+ class zt {
3294
+ constructor(e) {
3295
+ this.params = e;
3296
+ }
3297
+ calculateNextCoordinates(e, t) {
3298
+ const s = $e(
3299
+ e,
3300
+ this.params.rand,
3301
+ this.params.edgeEquilibriumLength
3302
+ );
3303
+ return new Ve(e, s, {
3304
+ rand: this.params.rand,
3305
+ dtSec: Math.min(t, this.params.maxTimeDeltaSec),
3306
+ nodeMass: this.params.nodeMass,
3307
+ nodeCharge: this.params.nodeCharge,
3308
+ edgeEquilibriumLength: this.params.edgeEquilibriumLength,
3309
+ effectiveDistance: this.params.effectiveDistance,
3310
+ edgeStiffness: this.params.edgeStiffness
3311
+ }).next() < this.params.convergenceDelta && !e.getAllNodeIds().some((h) => {
3312
+ const d = e.getNode(h);
3313
+ return d.x === null || d.y === null;
3314
+ }) ? /* @__PURE__ */ new Map() : s;
3315
+ }
3316
+ }
3317
+ const Ie = (r) => {
3318
+ let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
3319
+ for (let n = 0, a; n < r.length; n++)
3320
+ 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);
3321
+ 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];
3322
+ }, Ue = (r, e, t, s) => function() {
3323
+ r |= 0, e |= 0, t |= 0, s |= 0;
3324
+ const i = (r + e | 0) + s | 0;
3325
+ 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;
3326
+ }, x = Object.freeze({
3327
+ seed: "HTMLGraph is awesome",
3328
+ maxTimeDeltaSec: 0.1,
3329
+ nodeCharge: 1e5,
3330
+ nodeMass: 1,
3331
+ edgeEquilibriumLength: 300,
3332
+ edgeStiffness: 1e3,
3333
+ effectiveDistance: 1e3,
3334
+ dtSec: 0.02,
3335
+ maxIterations: 100,
3336
+ convergenceDelta: 1e-3
3337
+ }), Xt = (r) => {
3338
+ var e;
3339
+ switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
3340
+ case "custom":
3341
+ return r.algorithm.instance;
3342
+ default: {
3343
+ const t = r == null ? void 0 : r.algorithm, s = Ie((t == null ? void 0 : t.seed) ?? x.seed), i = Ue(s[0], s[1], s[2], s[3]);
3344
+ return new zt({
3345
+ rand: i,
3346
+ maxTimeDeltaSec: (t == null ? void 0 : t.maxTimeDeltaSec) ?? x.maxTimeDeltaSec,
3347
+ nodeCharge: (t == null ? void 0 : t.nodeCharge) ?? x.nodeCharge,
3348
+ nodeMass: (t == null ? void 0 : t.nodeMass) ?? x.nodeMass,
3349
+ edgeEquilibriumLength: (t == null ? void 0 : t.edgeEquilibriumLength) ?? x.edgeEquilibriumLength,
3350
+ effectiveDistance: x.effectiveDistance,
3351
+ edgeStiffness: (t == null ? void 0 : t.edgeStiffness) ?? x.edgeStiffness,
3352
+ convergenceDelta: (t == null ? void 0 : t.convergenceDelta) ?? x.convergenceDelta
3353
+ });
3354
+ }
3355
+ }
3356
+ }, Yt = (r) => r instanceof G ? {
3207
3357
  type: "manual",
3208
3358
  trigger: r
3209
3359
  } : {
3210
3360
  type: "topologyChangeTimeout"
3211
- }, Bt = (r) => ({
3212
- algorithm: r.algorithm,
3213
- applyOn: It(r.applyOn)
3214
- }), Ot = (r, e) => ({
3361
+ }, Ht = (r) => {
3362
+ switch (r == null ? void 0 : r.type) {
3363
+ case "custom":
3364
+ return r.instance;
3365
+ default: {
3366
+ const e = Ie((r == null ? void 0 : r.seed) ?? x.seed), t = Ue(e[0], e[1], e[2], e[3]);
3367
+ return new kt({
3368
+ dtSec: (r == null ? void 0 : r.dtSec) ?? x.dtSec,
3369
+ maxIterations: (r == null ? void 0 : r.maxIterations) ?? x.maxIterations,
3370
+ rand: t,
3371
+ maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? x.maxTimeDeltaSec,
3372
+ nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? x.nodeCharge,
3373
+ nodeMass: (r == null ? void 0 : r.nodeMass) ?? x.nodeMass,
3374
+ edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? x.edgeEquilibriumLength,
3375
+ edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? x.edgeStiffness,
3376
+ effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ?? x.effectiveDistance,
3377
+ convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ?? x.convergenceDelta
3378
+ });
3379
+ }
3380
+ }
3381
+ }, jt = (r) => ({
3382
+ algorithm: Ht(r == null ? void 0 : r.algorithm),
3383
+ applyOn: Yt(r == null ? void 0 : r.applyOn)
3384
+ }), Gt = (r, e) => ({
3215
3385
  ...r,
3216
3386
  nodeDragVerifier: (t) => (e.add(t), r.nodeDragVerifier(t)),
3217
3387
  onNodeDragFinished: (t) => {
3218
3388
  e.delete(t), r.onNodeDragFinished(t);
3219
3389
  }
3220
- }), Ft = (r, e) => {
3390
+ }), Kt = (r, e) => {
3221
3391
  r.onBeforeNodeRemoved.subscribe((t) => {
3222
3392
  e.delete(t);
3223
3393
  }), r.onBeforeClear.subscribe(() => {
3224
3394
  e.clear();
3225
3395
  });
3226
3396
  };
3227
- class zt {
3397
+ class Qt {
3228
3398
  constructor(e) {
3229
- s(this, "used", !1);
3230
- s(this, "canvasDefaults", {});
3231
- s(this, "dragConfig", {});
3232
- s(this, "transformConfig", {});
3233
- s(this, "backgroundConfig", {});
3234
- s(this, "connectablePortsConfig", {});
3235
- s(this, "draggableEdgesConfig", {});
3236
- s(this, "virtualScrollConfig");
3237
- s(this, "layoutConfig");
3238
- s(this, "animatedLayoutConfig");
3239
- s(this, "hasDraggableNodes", !1);
3240
- s(this, "hasTransformableViewport", !1);
3241
- s(this, "hasNodeResizeReactiveEdges", !1);
3242
- s(this, "hasBackground", !1);
3243
- s(this, "hasUserConnectablePorts", !1);
3244
- s(this, "hasUserDraggableEdges", !1);
3245
- s(this, "boxRenderingTrigger", new j());
3246
- s(this, "graphStore", new ve());
3247
- s(this, "viewportStore", new ke());
3248
- s(this, "graph", new Le(this.graphStore));
3249
- s(this, "viewport", new Me(this.viewportStore));
3250
- s(this, "window", window);
3251
- s(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3399
+ o(this, "used", !1);
3400
+ o(this, "canvasDefaults", {});
3401
+ o(this, "dragConfig", {});
3402
+ o(this, "transformConfig", {});
3403
+ o(this, "backgroundConfig", {});
3404
+ o(this, "connectablePortsConfig", {});
3405
+ o(this, "draggableEdgesConfig", {});
3406
+ o(this, "virtualScrollConfig");
3407
+ o(this, "layoutConfig");
3408
+ o(this, "animatedLayoutConfig");
3409
+ o(this, "hasDraggableNodes", !1);
3410
+ o(this, "hasTransformableViewport", !1);
3411
+ o(this, "hasNodeResizeReactiveEdges", !1);
3412
+ o(this, "hasBackground", !1);
3413
+ o(this, "hasUserConnectablePorts", !1);
3414
+ o(this, "hasUserDraggableEdges", !1);
3415
+ o(this, "hasAnimatedLayout", !1);
3416
+ o(this, "hasLayout", !1);
3417
+ o(this, "boxRenderingTrigger", new G());
3418
+ o(this, "graphStore", new Ee());
3419
+ o(this, "viewportStore", new je());
3420
+ o(this, "graph", new Le(this.graphStore));
3421
+ o(this, "viewport", new Re(this.viewportStore));
3422
+ o(this, "window", window);
3423
+ o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
3252
3424
  this.element = e;
3253
3425
  }
3254
3426
  /**
@@ -3304,51 +3476,51 @@ class zt {
3304
3476
  * enables nodes positioning with specified layout
3305
3477
  */
3306
3478
  enableLayout(e) {
3307
- return this.layoutConfig = e, this.animatedLayoutConfig = void 0, this;
3479
+ return this.layoutConfig = e, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
3308
3480
  }
3309
3481
  /**
3310
3482
  * enables animated nodes positioning with specified layout
3311
3483
  */
3312
3484
  enableAnimatedLayout(e) {
3313
- return this.animatedLayoutConfig = e, this.layoutConfig = void 0, this;
3485
+ return this.animatedLayoutConfig = e, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
3314
3486
  }
3315
3487
  /**
3316
3488
  * builds final canvas
3317
3489
  */
3318
3490
  build() {
3319
3491
  if (this.used)
3320
- throw new $t("CanvasBuilder is a single use object");
3492
+ throw new Ot("CanvasBuilder is a single use object");
3321
3493
  this.used = !0;
3322
- const e = new vt(this.element);
3494
+ const e = new Pt(this.element);
3323
3495
  let t = new ye(
3324
3496
  this.graphStore,
3325
3497
  this.viewportStore,
3326
3498
  e.main
3327
3499
  );
3328
- this.virtualScrollConfig !== void 0 && (t = new Oe(
3500
+ this.virtualScrollConfig !== void 0 && (t = new Xe(
3329
3501
  t,
3330
3502
  this.graphStore,
3331
3503
  this.boxRenderingTrigger,
3332
- Vt(this.virtualScrollConfig)
3333
- )), t = new Fe(t, this.graphStore);
3334
- const o = xt(this.canvasDefaults), i = new me(
3504
+ Ft(this.virtualScrollConfig)
3505
+ )), t = new Ye(t, this.graphStore);
3506
+ const s = Dt(this.canvasDefaults), i = new ve(
3335
3507
  this.graph,
3336
3508
  this.viewport,
3337
3509
  this.graphStore,
3338
3510
  this.viewportStore,
3339
3511
  t,
3340
- o
3512
+ s
3341
3513
  );
3342
3514
  if (this.hasBackground && _.configure(
3343
3515
  i,
3344
- Lt(this.backgroundConfig),
3516
+ $t(this.backgroundConfig),
3345
3517
  e.background
3346
- ), this.hasNodeResizeReactiveEdges && G.configure(i), this.hasDraggableNodes) {
3347
- let a = St(this.dragConfig);
3348
- this.animatedLayoutConfig !== void 0 && (a = Ot(
3518
+ ), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
3519
+ let a = Nt(this.dragConfig);
3520
+ this.hasAnimatedLayout && (a = Gt(
3349
3521
  a,
3350
3522
  this.animationStaticNodes
3351
- )), J.configure(
3523
+ )), Q.configure(
3352
3524
  i,
3353
3525
  e.main,
3354
3526
  this.window,
@@ -3356,12 +3528,12 @@ class zt {
3356
3528
  );
3357
3529
  }
3358
3530
  if (this.hasUserConnectablePorts) {
3359
- const a = Mt(
3531
+ const a = It(
3360
3532
  this.connectablePortsConfig,
3361
- o.edges.shapeFactory,
3362
- o.ports.direction
3533
+ s.edges.shapeFactory,
3534
+ s.ports.direction
3363
3535
  );
3364
- q.configure(
3536
+ ee.configure(
3365
3537
  i,
3366
3538
  e.overlayConnectablePorts,
3367
3539
  this.viewportStore,
@@ -3370,11 +3542,11 @@ class zt {
3370
3542
  );
3371
3543
  }
3372
3544
  if (this.hasUserDraggableEdges) {
3373
- const a = Rt(
3545
+ const a = Ut(
3374
3546
  this.draggableEdgesConfig,
3375
3547
  i.graph
3376
3548
  );
3377
- ee.configure(
3549
+ te.configure(
3378
3550
  i,
3379
3551
  e.overlayDraggableEdges,
3380
3552
  this.viewportStore,
@@ -3382,27 +3554,27 @@ class zt {
3382
3554
  a
3383
3555
  );
3384
3556
  }
3385
- this.virtualScrollConfig !== void 0 ? Q.configure(
3557
+ this.virtualScrollConfig !== void 0 ? q.configure(
3386
3558
  i,
3387
3559
  e.main,
3388
3560
  this.window,
3389
- fe(this.transformConfig),
3561
+ me(this.transformConfig),
3390
3562
  this.boxRenderingTrigger,
3391
- Ct(this.virtualScrollConfig)
3392
- ) : this.hasTransformableViewport && z.configure(
3563
+ Bt(this.virtualScrollConfig)
3564
+ ) : this.hasTransformableViewport && X.configure(
3393
3565
  i,
3394
3566
  e.main,
3395
3567
  this.window,
3396
- fe(this.transformConfig)
3397
- ), this.layoutConfig !== void 0 && ft.configure(
3568
+ me(this.transformConfig)
3569
+ ), this.hasLayout && At.configure(
3398
3570
  i,
3399
- Bt(this.layoutConfig)
3400
- ), this.animatedLayoutConfig !== void 0 && (Ft(
3571
+ jt(this.layoutConfig)
3572
+ ), this.hasAnimatedLayout && (Kt(
3401
3573
  i.graph,
3402
3574
  this.animationStaticNodes
3403
3575
  ), oe.configure(
3404
3576
  i,
3405
- Ut(this.animatedLayoutConfig),
3577
+ Xt(this.animatedLayoutConfig),
3406
3578
  this.animationStaticNodes,
3407
3579
  this.window
3408
3580
  ));
@@ -3413,16 +3585,16 @@ class zt {
3413
3585
  }
3414
3586
  }
3415
3587
  export {
3416
- st as BezierEdgeShape,
3417
- zt as CanvasBuilder,
3418
- $t as CanvasBuilderError,
3419
- S as CanvasError,
3588
+ dt as BezierEdgeShape,
3589
+ Qt as CanvasBuilder,
3590
+ Ot as CanvasBuilderError,
3591
+ P as CanvasError,
3420
3592
  Ne as DirectEdgeShape,
3421
- j as EventSubject,
3422
- it as HorizontalEdgeShape,
3423
- ct as InteractiveEdgeError,
3424
- De as InteractiveEdgeShape,
3425
- kt as MidpointEdgeShape,
3426
- nt as StraightEdgeShape,
3427
- at as VerticalEdgeShape
3593
+ G as EventSubject,
3594
+ ct as HorizontalEdgeShape,
3595
+ wt as InteractiveEdgeError,
3596
+ Me as InteractiveEdgeShape,
3597
+ Jt as MidpointEdgeShape,
3598
+ lt as StraightEdgeShape,
3599
+ gt as VerticalEdgeShape
3428
3600
  };