@html-graph/html-graph 5.1.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 Me = Object.defineProperty;
2
- var Re = (r, e, t) => e in r ? Me(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var s = (r, e, t) => Re(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 L = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(L || {});
9
- const Le = () => {
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
- }, Ce = () => {
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
- }, Ve = (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
- class ue {
19
- constructor(e, t, o) {
20
- s(this, "host", Le());
21
- s(this, "container", Ce());
22
- s(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
- s(this, "attachedNodeIds", /* @__PURE__ */ new Set());
24
- s(this, "applyTransform", () => {
18
+ class ye {
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
- Ve(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 ue {
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 ue {
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 = L.Line;
83
- o.element === i.element ? g = L.PortCycle : o.nodeId === i.nodeId && (g = L.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 ue {
100
100
  };
101
101
  }
102
102
  }
103
- class $e {
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 Ue {
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 Ue {
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 $e(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 Ue {
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 Ue {
198
198
  this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
199
199
  }
200
200
  }
201
- class Ie {
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 Ie {
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 pe {
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 pe {
268
268
  });
269
269
  }
270
270
  }
271
- const E = () => {
272
- const r = new pe();
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 we {
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 Be {
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 Be {
550
550
  return this.multiToSingleMap.get(e) !== void 0;
551
551
  }
552
552
  }
553
- class fe {
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, "incomingEdges", /* @__PURE__ */ new Map());
560
- s(this, "outcomingEdges", /* @__PURE__ */ new Map());
561
- s(this, "cycleEdges", /* @__PURE__ */ new Map());
562
- s(this, "elementPorts", new Be());
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 fe {
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 fe {
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);
@@ -626,14 +626,14 @@ class fe {
626
626
  direction: e.direction
627
627
  },
628
628
  nodeId: e.nodeId
629
- }), this.elementPorts.addRecord(e.element, e.id), this.cycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.incomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.outcomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
629
+ }), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutcomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
630
630
  }
631
631
  getPort(e) {
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 fe {
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());
@@ -677,16 +677,16 @@ class fe {
677
677
  this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
678
678
  }
679
679
  clear() {
680
- this.beforeClearEmitter.emit(), this.incomingEdges.clear(), this.outcomingEdges.clear(), this.cycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
680
+ this.beforeClearEmitter.emit(), this.portIncomingEdges.clear(), this.portOutcomingEdges.clear(), this.portCycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
681
681
  }
682
682
  getPortIncomingEdgeIds(e) {
683
- return Array.from(this.incomingEdges.get(e));
683
+ return Array.from(this.portIncomingEdges.get(e));
684
684
  }
685
685
  getPortOutgoingEdgeIds(e) {
686
- return Array.from(this.outcomingEdges.get(e));
686
+ return Array.from(this.portOutcomingEdges.get(e));
687
687
  }
688
688
  getPortCycleEdgeIds(e) {
689
- return Array.from(this.cycleEdges.get(e));
689
+ return Array.from(this.portCycleEdges.get(e));
690
690
  }
691
691
  getPortAdjacentEdgeIds(e) {
692
692
  return [
@@ -696,32 +696,51 @@ class fe {
696
696
  ];
697
697
  }
698
698
  getNodeIncomingEdgeIds(e) {
699
- const t = Array.from(this.nodes.get(e).ports.keys());
700
- let o = [];
699
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
701
700
  return t.forEach((i) => {
702
- o = [...o, ...this.getPortIncomingEdgeIds(i)];
703
- }), o;
701
+ this.getPortIncomingEdgeIds(i).filter((n) => {
702
+ const a = this.getEdge(n);
703
+ return this.getPort(a.from).nodeId !== e;
704
+ }).forEach((n) => {
705
+ s.push(n);
706
+ });
707
+ }), s;
704
708
  }
705
709
  getNodeOutgoingEdgeIds(e) {
706
- const t = Array.from(this.nodes.get(e).ports.keys());
707
- let o = [];
710
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
708
711
  return t.forEach((i) => {
709
- o = [...o, ...this.getPortOutgoingEdgeIds(i)];
710
- }), o;
712
+ this.getPortOutgoingEdgeIds(i).filter((n) => {
713
+ const a = this.getEdge(n);
714
+ return this.getPort(a.to).nodeId !== e;
715
+ }).forEach((n) => {
716
+ s.push(n);
717
+ });
718
+ }), s;
711
719
  }
712
720
  getNodeCycleEdgeIds(e) {
713
- const t = Array.from(this.nodes.get(e).ports.keys());
714
- let o = [];
721
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
715
722
  return t.forEach((i) => {
716
- o = [...o, ...this.getPortCycleEdgeIds(i)];
717
- }), o;
723
+ this.getPortCycleEdgeIds(i).forEach((n) => {
724
+ s.push(n);
725
+ }), this.getPortIncomingEdgeIds(i).filter((n) => {
726
+ const a = this.getEdge(n);
727
+ return this.getPort(a.to).nodeId === e;
728
+ }).forEach((n) => {
729
+ s.push(n);
730
+ });
731
+ }), s;
718
732
  }
719
733
  getNodeAdjacentEdgeIds(e) {
720
- return [
721
- ...this.getNodeIncomingEdgeIds(e),
722
- ...this.getNodeOutgoingEdgeIds(e),
723
- ...this.getNodeCycleEdgeIds(e)
724
- ];
734
+ const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
735
+ return t.forEach((i) => {
736
+ this.getPortIncomingEdgeIds(i).forEach((n) => {
737
+ s.push(n);
738
+ }), this.getPortOutgoingEdgeIds(i).forEach((n) => {
739
+ s.push(n);
740
+ }), this.getPortCycleEdgeIds(i).forEach((n) => {
741
+ s.push(n);
742
+ });
743
+ }), s;
725
744
  }
726
745
  addEdgeInternal(e) {
727
746
  this.edges.set(e.id, {
@@ -731,29 +750,29 @@ class fe {
731
750
  shape: e.shape,
732
751
  priority: e.priority
733
752
  }
734
- }), e.from !== e.to ? (this.outcomingEdges.get(e.from).add(e.id), this.incomingEdges.get(e.to).add(e.id)) : this.cycleEdges.get(e.from).add(e.id);
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);
735
754
  }
736
755
  removeEdgeInternal(e) {
737
- const t = this.edges.get(e), o = t.from, i = t.to;
738
- this.cycleEdges.get(o).delete(e), this.cycleEdges.get(i).delete(e), this.incomingEdges.get(o).delete(e), this.incomingEdges.get(i).delete(e), this.outcomingEdges.get(o).delete(e), this.outcomingEdges.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);
739
758
  }
740
759
  }
741
- const ie = (r) => ({
760
+ const ce = (r) => ({
742
761
  scale: 1 / r.scale,
743
762
  x: -r.x / r.scale,
744
763
  y: -r.y / r.scale
745
- }), ne = {
764
+ }), le = {
746
765
  scale: 1,
747
766
  x: 0,
748
767
  y: 0
749
768
  };
750
- class Fe {
769
+ class je {
751
770
  constructor() {
752
- s(this, "viewportMatrix", ne);
753
- s(this, "contentMatrix", ne);
754
- s(this, "afterUpdateEmitter");
755
- s(this, "onAfterUpdated");
756
- [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();
757
776
  }
758
777
  getViewportMatrix() {
759
778
  return this.viewportMatrix;
@@ -766,52 +785,52 @@ class Fe {
766
785
  scale: e.scale ?? this.viewportMatrix.scale,
767
786
  x: e.x ?? this.viewportMatrix.x,
768
787
  y: e.y ?? this.viewportMatrix.y
769
- }, this.contentMatrix = ie(this.viewportMatrix), this.afterUpdateEmitter.emit();
788
+ }, this.contentMatrix = ce(this.viewportMatrix), this.afterUpdateEmitter.emit();
770
789
  }
771
790
  patchContentMatrix(e) {
772
791
  this.contentMatrix = {
773
792
  scale: e.scale ?? this.contentMatrix.scale,
774
793
  x: e.x ?? this.contentMatrix.x,
775
794
  y: e.y ?? this.contentMatrix.y
776
- }, this.viewportMatrix = ie(this.contentMatrix), this.afterUpdateEmitter.emit();
795
+ }, this.viewportMatrix = ce(this.contentMatrix), this.afterUpdateEmitter.emit();
777
796
  }
778
797
  }
779
- class j {
798
+ class K {
780
799
  constructor(e) {
781
- s(this, "elementToNodeId", /* @__PURE__ */ new Map());
782
- s(this, "nodesResizeObserver");
783
- s(this, "onAfterNodeAdded", (e) => {
800
+ o(this, "elementToNodeId", /* @__PURE__ */ new Map());
801
+ o(this, "nodesResizeObserver");
802
+ o(this, "onAfterNodeAdded", (e) => {
784
803
  const t = this.canvas.graph.getNode(e);
785
804
  this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
786
805
  });
787
- s(this, "onBeforeNodeRemoved", (e) => {
806
+ o(this, "onBeforeNodeRemoved", (e) => {
788
807
  const t = this.canvas.graph.getNode(e);
789
808
  this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
790
809
  });
791
- s(this, "onBeforeClear", () => {
810
+ o(this, "onBeforeClear", () => {
792
811
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
793
812
  });
794
813
  this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
795
- t.forEach((o) => {
796
- const i = o.target;
814
+ t.forEach((s) => {
815
+ const i = s.target;
797
816
  this.handleNodeResize(i);
798
817
  });
799
818
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
800
819
  }
801
820
  static configure(e) {
802
- new j(e);
821
+ new K(e);
803
822
  }
804
823
  handleNodeResize(e) {
805
824
  const t = this.elementToNodeId.get(e);
806
825
  this.canvas.updateNode(t);
807
826
  }
808
827
  }
809
- const Oe = (r, e, t) => {
810
- const { x: o, y: i, width: n, height: a } = r.getBoundingClientRect();
811
- return e >= o && e <= o + n && t >= i && t <= i + a;
812
- }, We = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, C = (r, e, t, o) => Oe(e, t, o) && We(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) => {
813
832
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
814
- }, B = (r) => {
833
+ }, F = (r) => {
815
834
  const e = document.createElement("div");
816
835
  return {
817
836
  id: r.overlayId,
@@ -826,38 +845,38 @@ const Oe = (r, e, t) => {
826
845
  }
827
846
  ]
828
847
  };
829
- }, ke = (r, e) => {
830
- let t = e, o = null;
831
- 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); )
832
851
  t = t.parentElement;
833
- return o;
834
- }, ye = (r, e) => {
852
+ return s;
853
+ }, Ae = (r, e) => {
835
854
  const t = document.elementsFromPoint(e.x, e.y);
836
- for (const o of t) {
837
- const i = ke(r, o);
855
+ for (const s of t) {
856
+ const i = Ze(r, s);
838
857
  if (i !== null)
839
858
  return i;
840
859
  }
841
860
  return null;
842
861
  };
843
- var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(P || {});
844
- const me = (r, e) => ({
862
+ var b = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(b || {});
863
+ const xe = (r, e) => ({
845
864
  x: r / 2,
846
865
  y: e / 2
847
- }), u = {
866
+ }), p = {
848
867
  x: 0,
849
868
  y: 0
850
- }, m = (r, e, t) => ({
869
+ }, y = (r, e, t) => ({
851
870
  x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
852
871
  y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
853
- }), ve = (r, e) => {
872
+ }), Se = (r, e) => {
854
873
  const t = {
855
874
  x: r.x + r.width / 2,
856
875
  y: r.y + r.height / 2
857
- }, o = {
876
+ }, s = {
858
877
  x: e.x + e.width / 2,
859
878
  y: e.y + e.height / 2
860
- }, 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;
861
880
  return {
862
881
  x: i,
863
882
  y: n,
@@ -866,311 +885,311 @@ const me = (r, e) => ({
866
885
  flipX: d,
867
886
  flipY: c
868
887
  };
869
- }, O = (r, e, t, o) => ({
870
- x: e * r.x + (1 - e) / 2 * o.x,
871
- 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
872
891
  });
873
- class ze {
892
+ class Je {
874
893
  constructor(e) {
875
- s(this, "path");
876
- s(this, "midpoint");
894
+ o(this, "path");
895
+ o(this, "midpoint");
877
896
  this.params = e;
878
897
  const t = this.params.to;
879
898
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
880
- const o = m(
881
- { x: this.params.arrowLength, y: u.y },
899
+ const s = y(
900
+ { x: this.params.arrowLength, y: p.y },
882
901
  this.params.sourceDirection,
883
- u
884
- ), i = m(
902
+ p
903
+ ), i = y(
885
904
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
886
905
  this.params.targetDirection,
887
906
  this.params.to
888
907
  ), n = {
889
- x: o.x + this.params.sourceDirection.x * this.params.curvature,
890
- 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
891
910
  }, a = {
892
911
  x: i.x - this.params.targetDirection.x * this.params.curvature,
893
912
  y: i.y - this.params.targetDirection.y * this.params.curvature
894
- }, 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}`;
895
914
  this.path = `${d}${h}${c}`;
896
915
  }
897
916
  }
898
- class Xe {
917
+ class Qe {
899
918
  constructor(e) {
900
- s(this, "path");
901
- s(this, "midpoint");
919
+ o(this, "path");
920
+ o(this, "midpoint");
902
921
  this.params = e;
903
- const t = this.params.hasSourceArrow ? m(
904
- { x: this.params.arrowLength, y: u.y },
922
+ const t = this.params.hasSourceArrow ? y(
923
+ { x: this.params.arrowLength, y: p.y },
905
924
  this.params.sourceDirection,
906
- u
907
- ) : u, o = this.params.hasTargetArrow ? m(
925
+ p
926
+ ) : p, s = this.params.hasTargetArrow ? y(
908
927
  {
909
928
  x: this.params.to.x - this.params.arrowLength,
910
929
  y: this.params.to.y
911
930
  },
912
931
  this.params.targetDirection,
913
932
  this.params.to
914
- ) : 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(
915
- { 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 },
916
935
  this.params.sourceDirection,
917
- u
918
- ), l = {
936
+ p
937
+ ), g = {
919
938
  x: c.x + h,
920
939
  y: c.y + d
921
- }, g = m(
940
+ }, l = y(
922
941
  { x: this.params.to.x - i, y: this.params.to.y },
923
942
  this.params.targetDirection,
924
943
  this.params.to
925
- ), p = {
926
- x: g.x + h,
927
- y: g.y + d
928
- }, f = {
929
- x: (l.x + p.x) / 2,
930
- y: (l.y + p.y) / 2
931
- }, 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 = {
932
951
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
933
952
  y: c.y + this.params.curvature * this.params.sourceDirection.y
934
953
  }, v = {
935
- x: g.x - this.params.curvature * this.params.targetDirection.x,
936
- y: g.y - this.params.curvature * this.params.targetDirection.y
937
- }, 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 = {
938
957
  x: c.x + h,
939
958
  y: c.y + d
940
959
  }, A = {
941
- x: g.x + h,
942
- y: g.y + d
960
+ x: l.x + h,
961
+ y: l.y + d
943
962
  };
944
963
  this.path = [
945
964
  `M ${t.x} ${t.y}`,
946
965
  `L ${c.x} ${c.y}`,
947
- `C ${y.x} ${y.y} ${x.x} ${x.y} ${f.x} ${f.y}`,
948
- `C ${A.x} ${A.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
949
- `L ${o.x} ${o.y}`
950
- ].join(" "), this.midpoint = O(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);
951
970
  }
952
971
  }
953
- const G = Object.freeze({
972
+ const Z = Object.freeze({
954
973
  edgeColor: "--edge-color"
955
- }), Ee = (r) => {
974
+ }), Pe = (r) => {
956
975
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
957
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(G.edgeColor, r), e;
958
- }, Ae = (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) => {
959
978
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
960
- return e.setAttribute("stroke", `var(${G.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
961
- }, F = () => {
979
+ return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
980
+ }, O = () => {
962
981
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
963
- return r.setAttribute("fill", `var(${G.edgeColor})`), r;
964
- }, xe = () => {
982
+ return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
983
+ }, Te = () => {
965
984
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
966
985
  return r.style.transformOrigin = "50% 50%", r;
967
- }, Se = (r, e) => {
986
+ }, De = (r, e) => {
968
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`;
969
- }, M = (r, e) => {
988
+ }, L = (r, e) => {
970
989
  const t = [];
971
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) {
972
- const o = r.length - 1;
991
+ const s = r.length - 1;
973
992
  let i = 0, n = 0, a = 0;
974
993
  r.forEach((h, d) => {
975
- let c = 0, l = 0, g = 0;
976
- const p = d > 0, f = d < o, y = p && f;
977
- if (p && (c = -i, l = -n, g = a), f) {
978
- const V = r[d + 1];
979
- 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);
980
999
  }
981
- 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, D = y ? { x: h.x + c * b, y: h.y + l * b } : h;
982
- d > 0 && t.push(`L ${D.x} ${D.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(
983
1002
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
984
1003
  );
985
1004
  });
986
1005
  }
987
1006
  return t.join(" ");
988
1007
  };
989
- class Ye {
1008
+ class qe {
990
1009
  constructor(e) {
991
- s(this, "path");
992
- s(this, "midpoint");
1010
+ o(this, "path");
1011
+ o(this, "midpoint");
993
1012
  this.params = e;
994
1013
  const t = this.params.to;
995
1014
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
996
- const o = this.params.hasSourceArrow ? m(
997
- { x: this.params.arrowLength, y: u.y },
1015
+ const s = this.params.hasSourceArrow ? y(
1016
+ { x: this.params.arrowLength, y: p.y },
998
1017
  this.params.sourceDirection,
999
- u
1000
- ) : u, i = this.params.hasTargetArrow ? m(
1018
+ p
1019
+ ) : p, i = this.params.hasTargetArrow ? y(
1001
1020
  {
1002
1021
  x: this.params.to.x - this.params.arrowLength,
1003
1022
  y: this.params.to.y
1004
1023
  },
1005
1024
  this.params.targetDirection,
1006
1025
  this.params.to
1007
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1008
- { 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 },
1009
1028
  this.params.sourceDirection,
1010
- u
1011
- ), d = m(
1029
+ p
1030
+ ), d = y(
1012
1031
  { x: this.params.to.x - a, y: this.params.to.y },
1013
1032
  this.params.targetDirection,
1014
1033
  this.params.to
1015
- ), 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 = {
1016
1035
  x: this.params.flipX > 0 ? c : -n,
1017
1036
  y: h.y
1018
- }, p = { x: g.x, y: l }, f = {
1037
+ }, u = { x: l.x, y: g }, w = {
1019
1038
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1020
1039
  y: d.y
1021
- }, y = { x: f.x, y: l };
1022
- this.path = M(
1023
- [o, h, g, p, y, f, d, i],
1040
+ }, m = { x: w.x, y: g };
1041
+ this.path = L(
1042
+ [s, h, l, u, m, w, d, i],
1024
1043
  this.params.roundness
1025
1044
  );
1026
1045
  }
1027
1046
  }
1028
- class He {
1047
+ class _e {
1029
1048
  constructor(e) {
1030
- s(this, "path");
1031
- s(this, "midpoint");
1049
+ o(this, "path");
1050
+ o(this, "midpoint");
1032
1051
  this.params = e;
1033
- const t = this.params.hasSourceArrow ? m(
1034
- { x: this.params.arrowLength, y: u.y },
1052
+ const t = this.params.hasSourceArrow ? y(
1053
+ { x: this.params.arrowLength, y: p.y },
1035
1054
  this.params.sourceDirection,
1036
- u
1037
- ) : u, o = this.params.hasTargetArrow ? m(
1055
+ p
1056
+ ) : p, s = this.params.hasTargetArrow ? y(
1038
1057
  {
1039
1058
  x: this.params.to.x - this.params.arrowLength,
1040
1059
  y: this.params.to.y
1041
1060
  },
1042
1061
  this.params.targetDirection,
1043
1062
  this.params.to
1044
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1045
- { x: i, y: u.y },
1063
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1064
+ { x: i, y: p.y },
1046
1065
  this.params.sourceDirection,
1047
- u
1048
- ), 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(
1049
1068
  { x: this.params.to.x - i, y: this.params.to.y },
1050
1069
  this.params.targetDirection,
1051
1070
  this.params.to
1052
- ), p = { x: g.x + d, y: g.y + c }, f = { x: (l.x + p.x) / 2, y: (l.y + p.y) / 2 };
1053
- this.midpoint = O(f, e.flipX, e.flipY, e.to), this.path = M(
1054
- [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],
1055
1074
  this.params.roundness
1056
1075
  );
1057
1076
  }
1058
1077
  }
1059
- class je {
1078
+ class et {
1060
1079
  constructor(e) {
1061
- s(this, "path");
1062
- s(this, "midpoint");
1080
+ o(this, "path");
1081
+ o(this, "midpoint");
1063
1082
  this.params = e;
1064
1083
  const t = this.params.to;
1065
1084
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1066
- const o = this.params.hasSourceArrow ? m(
1067
- { x: this.params.arrowLength, y: u.y },
1085
+ const s = this.params.hasSourceArrow ? y(
1086
+ { x: this.params.arrowLength, y: p.y },
1068
1087
  this.params.sourceDirection,
1069
- u
1070
- ) : u, i = this.params.hasTargetArrow ? m(
1088
+ p
1089
+ ) : p, i = this.params.hasTargetArrow ? y(
1071
1090
  {
1072
1091
  x: this.params.to.x - this.params.arrowLength,
1073
1092
  y: this.params.to.y
1074
1093
  },
1075
1094
  this.params.targetDirection,
1076
1095
  this.params.to
1077
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
1078
- { x: n, y: u.y },
1096
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
1097
+ { x: n, y: p.y },
1079
1098
  this.params.sourceDirection,
1080
- u
1081
- ), h = m(
1099
+ p
1100
+ ), h = y(
1082
1101
  { x: this.params.to.x - n, y: this.params.to.y },
1083
1102
  this.params.targetDirection,
1084
1103
  this.params.to
1085
1104
  );
1086
- this.path = M([o, a, h, i], this.params.roundness);
1105
+ this.path = L([s, a, h, i], this.params.roundness);
1087
1106
  }
1088
1107
  }
1089
- class Ge {
1108
+ class tt {
1090
1109
  constructor(e) {
1091
- s(this, "path");
1092
- s(this, "midpoint");
1110
+ o(this, "path");
1111
+ o(this, "midpoint");
1093
1112
  this.params = e;
1094
1113
  const t = this.params.to;
1095
1114
  this.midpoint = { x: t.x / 2, y: t.y / 2 };
1096
- const o = this.params.hasSourceArrow ? m(
1097
- { x: this.params.arrowLength, y: u.y },
1115
+ const s = this.params.hasSourceArrow ? y(
1116
+ { x: this.params.arrowLength, y: p.y },
1098
1117
  this.params.sourceDirection,
1099
- u
1100
- ) : u, i = this.params.hasTargetArrow ? m(
1118
+ p
1119
+ ) : p, i = this.params.hasTargetArrow ? y(
1101
1120
  {
1102
1121
  x: this.params.to.x - this.params.arrowLength,
1103
1122
  y: this.params.to.y
1104
1123
  },
1105
1124
  this.params.targetDirection,
1106
1125
  this.params.to
1107
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1108
- { 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 },
1109
1128
  this.params.sourceDirection,
1110
- u
1111
- ), d = m(
1129
+ p
1130
+ ), d = y(
1112
1131
  { x: this.params.to.x - a, y: this.params.to.y },
1113
1132
  this.params.targetDirection,
1114
1133
  this.params.to
1115
- ), 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 = {
1116
1135
  x: h.x,
1117
1136
  y: this.params.flipY > 0 ? c : -n
1118
- }, p = { x: l, y: g.y }, f = {
1137
+ }, u = { x: g, y: l.y }, w = {
1119
1138
  x: d.x,
1120
1139
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1121
- }, y = { x: l, y: f.y };
1122
- this.path = M(
1123
- [o, h, g, p, y, f, d, i],
1140
+ }, m = { x: g, y: w.y };
1141
+ this.path = L(
1142
+ [s, h, l, u, m, w, d, i],
1124
1143
  this.params.roundness
1125
1144
  );
1126
1145
  }
1127
1146
  }
1128
- class K {
1147
+ class J {
1129
1148
  constructor(e) {
1130
- s(this, "path");
1131
- s(this, "midpoint");
1149
+ o(this, "path");
1150
+ o(this, "midpoint");
1132
1151
  this.params = e;
1133
- const t = this.params.arrowOffset, o = this.params.side, i = this.params.arrowLength + t, n = i + 2 * o, h = [
1134
- { x: this.params.arrowLength, y: u.y },
1135
- { 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 },
1136
1155
  { x: i, y: this.params.side },
1137
1156
  { x: n, y: this.params.side },
1138
1157
  { x: n, y: -this.params.side },
1139
1158
  { x: i, y: -this.params.side },
1140
- { x: i, y: u.y },
1141
- { x: this.params.arrowLength, y: u.y }
1159
+ { x: i, y: p.y },
1160
+ { x: this.params.arrowLength, y: p.y }
1142
1161
  ].map(
1143
- (c) => m(c, this.params.sourceDirection, u)
1144
- ), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
1145
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1162
+ (c) => y(c, this.params.sourceDirection, p)
1163
+ ), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
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 };
1146
1165
  }
1147
1166
  }
1148
- class Ke {
1167
+ class rt {
1149
1168
  constructor(e) {
1150
- s(this, "path");
1151
- s(this, "midpoint");
1169
+ o(this, "path");
1170
+ o(this, "midpoint");
1152
1171
  this.params = e;
1153
- 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 = [
1154
- { 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 },
1155
1174
  { x: c, y: n },
1156
1175
  { x: c, y: -n },
1157
1176
  { x: d, y: 0 }
1158
1177
  ].map(
1159
- (y) => m(y, this.params.sourceDirection, u)
1160
- ), p = [
1161
- `M ${g[0].x} ${g[0].y}`,
1162
- `A ${t} ${t} 0 0 1 ${g[1].x} ${g[1].y}`,
1163
- `A ${o} ${o} 0 1 0 ${g[2].x} ${g[2].y}`,
1164
- `A ${t} ${t} 0 0 1 ${g[0].x} ${g[0].y}`
1165
- ].join(" "), f = `M 0 0 L ${g[0].x} ${g[0].y} `;
1166
- 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];
1167
1186
  }
1168
1187
  }
1169
- class Ze {
1188
+ class st {
1170
1189
  constructor(e) {
1171
- s(this, "path");
1172
- s(this, "midpoint");
1173
- s(this, "diagonalDistance");
1190
+ o(this, "path");
1191
+ o(this, "midpoint");
1192
+ o(this, "diagonalDistance");
1174
1193
  this.params = e;
1175
1194
  const t = this.params.to;
1176
1195
  if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
@@ -1185,7 +1204,7 @@ class Ze {
1185
1204
  offset: this.params.sourceOffset,
1186
1205
  hasArrow: this.params.hasSourceArrow,
1187
1206
  flip: 1,
1188
- shift: u
1207
+ shift: p
1189
1208
  }), n = this.createDirectLinePoint({
1190
1209
  offset: this.params.targetOffset,
1191
1210
  hasArrow: this.params.hasTargetArrow,
@@ -1195,96 +1214,96 @@ class Ze {
1195
1214
  this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
1196
1215
  }
1197
1216
  createDirectLinePoint(e) {
1198
- 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;
1199
1218
  return {
1200
1219
  x: this.params.to.x * i + e.shift.x,
1201
1220
  y: this.params.to.y * i + e.shift.y
1202
1221
  };
1203
1222
  }
1204
1223
  }
1205
- class Je {
1224
+ class ot {
1206
1225
  constructor(e) {
1207
- s(this, "path");
1208
- s(this, "midpoint");
1226
+ o(this, "path");
1227
+ o(this, "midpoint");
1209
1228
  this.params = e;
1210
- const t = this.params.hasSourceArrow ? m(
1211
- { x: this.params.arrowLength, y: u.y },
1229
+ const t = this.params.hasSourceArrow ? y(
1230
+ { x: this.params.arrowLength, y: p.y },
1212
1231
  this.params.sourceDirection,
1213
- u
1214
- ) : u, o = this.params.hasTargetArrow ? m(
1232
+ p
1233
+ ) : p, s = this.params.hasTargetArrow ? y(
1215
1234
  {
1216
1235
  x: this.params.to.x - this.params.arrowLength,
1217
1236
  y: this.params.to.y
1218
1237
  },
1219
1238
  this.params.targetDirection,
1220
1239
  this.params.to
1221
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1222
- { x: i, y: u.y },
1240
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1241
+ { x: i, y: p.y },
1223
1242
  this.params.sourceDirection,
1224
- u
1225
- ), a = m(
1243
+ p
1244
+ ), a = y(
1226
1245
  { x: this.params.to.x - i, y: this.params.to.y },
1227
1246
  this.params.targetDirection,
1228
1247
  this.params.to
1229
- ), 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 = {
1230
1249
  x: (n.x + a.x) / 2,
1231
- y: l
1250
+ y: g
1232
1251
  };
1233
- this.midpoint = O(g, e.flipX, e.flipY, e.to), this.path = M(
1252
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
1234
1253
  [
1235
1254
  t,
1236
1255
  n,
1237
- { x: n.x, y: l },
1238
- { x: a.x, y: l },
1256
+ { x: n.x, y: g },
1257
+ { x: a.x, y: g },
1239
1258
  a,
1240
- o
1259
+ s
1241
1260
  ],
1242
1261
  this.params.roundness
1243
1262
  );
1244
1263
  }
1245
1264
  }
1246
- class Qe {
1265
+ class it {
1247
1266
  constructor(e) {
1248
- s(this, "path");
1249
- s(this, "midpoint");
1267
+ o(this, "path");
1268
+ o(this, "midpoint");
1250
1269
  this.params = e;
1251
- const t = this.params.hasSourceArrow ? m(
1252
- { x: this.params.arrowLength, y: u.y },
1270
+ const t = this.params.hasSourceArrow ? y(
1271
+ { x: this.params.arrowLength, y: p.y },
1253
1272
  this.params.sourceDirection,
1254
- u
1255
- ) : u, o = this.params.hasTargetArrow ? m(
1273
+ p
1274
+ ) : p, s = this.params.hasTargetArrow ? y(
1256
1275
  {
1257
1276
  x: this.params.to.x - this.params.arrowLength,
1258
1277
  y: this.params.to.y
1259
1278
  },
1260
1279
  this.params.targetDirection,
1261
1280
  this.params.to
1262
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1263
- { x: i, y: u.y },
1281
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1282
+ { x: i, y: p.y },
1264
1283
  this.params.sourceDirection,
1265
- u
1266
- ), a = m(
1284
+ p
1285
+ ), a = y(
1267
1286
  { x: this.params.to.x - i, y: this.params.to.y },
1268
1287
  this.params.targetDirection,
1269
1288
  this.params.to
1270
- ), 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 = {
1271
- 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,
1272
1291
  y: (n.y + a.y) / 2
1273
1292
  };
1274
- this.midpoint = O(g, e.flipX, e.flipY, e.to), this.path = M(
1293
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
1275
1294
  [
1276
1295
  t,
1277
1296
  n,
1278
- { x: l, y: n.y },
1279
- { x: l, y: a.y },
1297
+ { x: g, y: n.y },
1298
+ { x: g, y: a.y },
1280
1299
  a,
1281
- o
1300
+ s
1282
1301
  ],
1283
1302
  this.params.roundness
1284
1303
  );
1285
1304
  }
1286
1305
  }
1287
- const w = Object.freeze({
1306
+ const f = Object.freeze({
1288
1307
  color: "#777777",
1289
1308
  width: 1,
1290
1309
  arrowLength: 20,
@@ -1306,87 +1325,87 @@ const w = Object.freeze({
1306
1325
  curvature: 90,
1307
1326
  interactiveWidth: 10,
1308
1327
  preOffset: 0
1309
- }), ae = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1310
- class W {
1328
+ }), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1329
+ class k {
1311
1330
  constructor(e) {
1312
- s(this, "svg");
1313
- s(this, "group", xe());
1314
- s(this, "line");
1315
- s(this, "sourceArrow", null);
1316
- s(this, "targetArrow", null);
1317
- s(this, "onAfterRender");
1318
- s(this, "afterRenderEmitter");
1319
- s(this, "arrowRenderer");
1320
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Ee(e.color), this.svg.appendChild(this.group), this.line = Ae(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = F(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = F(), 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));
1321
1340
  }
1322
1341
  render(e) {
1323
- const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } = ve(
1342
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
1324
1343
  e.from,
1325
1344
  e.to
1326
1345
  );
1327
- Se(this.svg, { x: t, y: o, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1328
- const d = ae(
1346
+ De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1347
+ const d = ge(
1329
1348
  e.from.direction,
1330
1349
  a,
1331
1350
  h
1332
- ), c = ae(
1351
+ ), c = ge(
1333
1352
  e.to.direction,
1334
1353
  a,
1335
1354
  h
1336
- ), l = {
1355
+ ), g = {
1337
1356
  x: i,
1338
1357
  y: n
1339
1358
  };
1340
- let g = { x: -c.x, y: -c.y }, p;
1341
- e.category === L.PortCycle ? (p = this.params.createCyclePath, g = d) : e.category === L.NodeCycle ? p = this.params.createDetourPath : p = this.params.createLinePath;
1342
- 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(
1343
1362
  d,
1344
1363
  c,
1345
- l,
1364
+ g,
1346
1365
  a,
1347
1366
  h
1348
1367
  );
1349
- this.line.setAttribute("d", f.path);
1350
- let y = null;
1351
- this.sourceArrow && (y = this.arrowRenderer({
1368
+ this.line.setAttribute("d", w.path);
1369
+ let m = null;
1370
+ this.sourceArrow && (m = this.arrowRenderer({
1352
1371
  direction: d,
1353
- shift: u,
1372
+ shift: p,
1354
1373
  arrowLength: this.params.arrowLength
1355
- }), this.sourceArrow.setAttribute("d", y));
1374
+ }), this.sourceArrow.setAttribute("d", m));
1356
1375
  let v = null;
1357
1376
  this.targetArrow && (v = this.arrowRenderer({
1358
- direction: g,
1359
- shift: l,
1377
+ direction: l,
1378
+ shift: g,
1360
1379
  arrowLength: this.params.arrowLength
1361
1380
  }), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
1362
- edgePath: f,
1363
- sourceArrowPath: y,
1381
+ edgePath: w,
1382
+ sourceArrowPath: m,
1364
1383
  targetArrowPath: v
1365
1384
  });
1366
1385
  }
1367
1386
  }
1368
- const _e = (r) => (e) => {
1369
- const o = [
1370
- u,
1387
+ const nt = (r) => (e) => {
1388
+ const s = [
1389
+ p,
1371
1390
  { x: e.arrowLength, y: r.radius },
1372
1391
  { x: e.arrowLength, y: -r.radius }
1373
1392
  ].map(
1374
- (h) => m(h, e.direction, u)
1393
+ (h) => y(h, e.direction, p)
1375
1394
  ).map((h) => ({
1376
1395
  x: h.x + e.shift.x,
1377
1396
  y: h.y + e.shift.y
1378
- })), 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}`;
1379
1398
  return `${i} ${n} ${a} Z`;
1380
- }, qe = (r) => (e) => {
1381
- 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(
1382
- (y) => m(y, e.direction, u)
1383
- ).map((y) => ({
1384
- x: y.x + e.shift.x,
1385
- y: y.y + e.shift.y
1386
- })), 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}`;
1387
- return `${l} ${g} ${p} ${f}`;
1388
- }, et = (r) => (e) => {
1389
- 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(
1390
1409
  {
1391
1410
  x: e.arrowLength,
1392
1411
  y: 0
@@ -1399,51 +1418,51 @@ const _e = (r) => (e) => {
1399
1418
  x: e.arrowLength + r.smallRadius,
1400
1419
  y: 0
1401
1420
  }
1402
- ), a = [u, { x: i.x, y: -i.y }, i].map(
1403
- (g) => m(g, e.direction, u)
1404
- ).map((g) => ({
1405
- x: g.x + e.shift.x,
1406
- y: g.y + e.shift.y
1407
- })), 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}`;
1408
- return `${h} ${d} ${c} ${l}`;
1409
- }, $ = (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) => {
1410
1429
  if (typeof r == "function")
1411
1430
  return r;
1412
1431
  switch (r.type) {
1413
1432
  case "triangle":
1414
- return _e({
1415
- radius: r.radius ?? w.polygonArrowRadius
1433
+ return nt({
1434
+ radius: r.radius ?? f.polygonArrowRadius
1416
1435
  });
1417
1436
  case "arc":
1418
- return qe({
1419
- radius: r.radius ?? w.circleArrowRadius
1437
+ return at({
1438
+ radius: r.radius ?? f.circleArrowRadius
1420
1439
  });
1421
1440
  default:
1422
- return et({
1423
- smallRadius: r.smallRadius ?? w.wedgeArrowSmallRadius,
1424
- angle: r.angle ?? w.wedgeArrowAngle,
1425
- 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
1426
1445
  });
1427
1446
  }
1428
1447
  };
1429
- class tt {
1448
+ class dt {
1430
1449
  constructor(e) {
1431
- s(this, "svg");
1432
- s(this, "group");
1433
- s(this, "line");
1434
- s(this, "sourceArrow");
1435
- s(this, "targetArrow");
1436
- s(this, "onAfterRender");
1437
- s(this, "arrowLength");
1438
- s(this, "curvature");
1439
- s(this, "portCycleRadius");
1440
- s(this, "portCycleSmallRadius");
1441
- s(this, "detourDirection");
1442
- s(this, "detourDistance");
1443
- s(this, "hasSourceArrow");
1444
- s(this, "hasTargetArrow");
1445
- s(this, "pathShape");
1446
- s(this, "createCyclePath", (e) => new Ke({
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({
1447
1466
  sourceDirection: e,
1448
1467
  radius: this.portCycleRadius,
1449
1468
  smallRadius: this.portCycleSmallRadius,
@@ -1451,8 +1470,8 @@ class tt {
1451
1470
  hasSourceArrow: this.hasSourceArrow,
1452
1471
  hasTargetArrow: this.hasTargetArrow
1453
1472
  }));
1454
- s(this, "createDetourPath", (e, t, o, i, n) => new Xe({
1455
- to: o,
1473
+ o(this, "createDetourPath", (e, t, s, i, n) => new Qe({
1474
+ to: s,
1456
1475
  sourceDirection: e,
1457
1476
  targetDirection: t,
1458
1477
  flipX: i,
@@ -1464,8 +1483,8 @@ class tt {
1464
1483
  hasSourceArrow: this.hasSourceArrow,
1465
1484
  hasTargetArrow: this.hasTargetArrow
1466
1485
  }));
1467
- s(this, "createLinePath", (e, t, o) => new ze({
1468
- to: o,
1486
+ o(this, "createLinePath", (e, t, s) => new Je({
1487
+ to: s,
1469
1488
  sourceDirection: e,
1470
1489
  targetDirection: t,
1471
1490
  arrowLength: this.arrowLength,
@@ -1473,10 +1492,10 @@ class tt {
1473
1492
  hasSourceArrow: this.hasSourceArrow,
1474
1493
  hasTargetArrow: this.hasTargetArrow
1475
1494
  }));
1476
- 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({
1477
- color: (e == null ? void 0 : e.color) ?? w.color,
1478
- width: (e == null ? void 0 : e.width) ?? w.width,
1479
- 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) ?? {}),
1480
1499
  arrowLength: this.arrowLength,
1481
1500
  hasSourceArrow: this.hasSourceArrow,
1482
1501
  hasTargetArrow: this.hasTargetArrow,
@@ -1489,23 +1508,23 @@ class tt {
1489
1508
  this.pathShape.render(e);
1490
1509
  }
1491
1510
  }
1492
- class rt {
1511
+ class ct {
1493
1512
  constructor(e) {
1494
- s(this, "svg");
1495
- s(this, "group");
1496
- s(this, "line");
1497
- s(this, "sourceArrow");
1498
- s(this, "targetArrow");
1499
- s(this, "onAfterRender");
1500
- s(this, "arrowLength");
1501
- s(this, "arrowOffset");
1502
- s(this, "roundness");
1503
- s(this, "cycleSquareSide");
1504
- s(this, "detourDistance");
1505
- s(this, "hasSourceArrow");
1506
- s(this, "hasTargetArrow");
1507
- s(this, "pathShape");
1508
- s(this, "createCyclePath", (e) => new K({
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({
1509
1528
  sourceDirection: e,
1510
1529
  arrowLength: this.arrowLength,
1511
1530
  side: this.cycleSquareSide,
@@ -1514,8 +1533,8 @@ class rt {
1514
1533
  hasSourceArrow: this.hasSourceArrow,
1515
1534
  hasTargetArrow: this.hasTargetArrow
1516
1535
  }));
1517
- s(this, "createDetourPath", (e, t, o, i, n) => new Je({
1518
- to: o,
1536
+ o(this, "createDetourPath", (e, t, s, i, n) => new ot({
1537
+ to: s,
1519
1538
  sourceDirection: e,
1520
1539
  targetDirection: t,
1521
1540
  flipX: i,
@@ -1527,8 +1546,8 @@ class rt {
1527
1546
  hasSourceArrow: this.hasSourceArrow,
1528
1547
  hasTargetArrow: this.hasTargetArrow
1529
1548
  }));
1530
- s(this, "createLinePath", (e, t, o, i) => new Ye({
1531
- to: o,
1549
+ o(this, "createLinePath", (e, t, s, i) => new qe({
1550
+ to: s,
1532
1551
  sourceDirection: e,
1533
1552
  targetDirection: t,
1534
1553
  flipX: i,
@@ -1538,16 +1557,16 @@ class rt {
1538
1557
  hasSourceArrow: this.hasSourceArrow,
1539
1558
  hasTargetArrow: this.hasTargetArrow
1540
1559
  }));
1541
- 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;
1542
- 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;
1543
1562
  this.roundness = Math.min(
1544
1563
  t,
1545
1564
  this.arrowOffset,
1546
1565
  this.cycleSquareSide / 2
1547
- ), 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({
1548
- color: (e == null ? void 0 : e.color) ?? w.color,
1549
- width: (e == null ? void 0 : e.width) ?? w.width,
1550
- 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) ?? {}),
1551
1570
  arrowLength: this.arrowLength,
1552
1571
  hasSourceArrow: this.hasSourceArrow,
1553
1572
  hasTargetArrow: this.hasTargetArrow,
@@ -1560,24 +1579,24 @@ class rt {
1560
1579
  this.pathShape.render(e);
1561
1580
  }
1562
1581
  }
1563
- class ot {
1582
+ class lt {
1564
1583
  constructor(e) {
1565
- s(this, "svg");
1566
- s(this, "group");
1567
- s(this, "line");
1568
- s(this, "sourceArrow");
1569
- s(this, "targetArrow");
1570
- s(this, "onAfterRender");
1571
- s(this, "arrowLength");
1572
- s(this, "arrowOffset");
1573
- s(this, "roundness");
1574
- s(this, "cycleSquareSide");
1575
- s(this, "detourDirection");
1576
- s(this, "detourDistance");
1577
- s(this, "hasSourceArrow");
1578
- s(this, "hasTargetArrow");
1579
- s(this, "pathShape");
1580
- s(this, "createCyclePath", (e) => new K({
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({
1581
1600
  sourceDirection: e,
1582
1601
  arrowLength: this.arrowLength,
1583
1602
  side: this.cycleSquareSide,
@@ -1586,8 +1605,8 @@ class ot {
1586
1605
  hasSourceArrow: this.hasSourceArrow,
1587
1606
  hasTargetArrow: this.hasTargetArrow
1588
1607
  }));
1589
- s(this, "createDetourPath", (e, t, o, i, n) => new He({
1590
- to: o,
1608
+ o(this, "createDetourPath", (e, t, s, i, n) => new _e({
1609
+ to: s,
1591
1610
  sourceDirection: e,
1592
1611
  targetDirection: t,
1593
1612
  flipX: i,
@@ -1600,8 +1619,8 @@ class ot {
1600
1619
  hasSourceArrow: this.hasSourceArrow,
1601
1620
  hasTargetArrow: this.hasTargetArrow
1602
1621
  }));
1603
- s(this, "createLinePath", (e, t, o) => new je({
1604
- to: o,
1622
+ o(this, "createLinePath", (e, t, s) => new et({
1623
+ to: s,
1605
1624
  sourceDirection: e,
1606
1625
  targetDirection: t,
1607
1626
  arrowLength: this.arrowLength,
@@ -1610,16 +1629,16 @@ class ot {
1610
1629
  hasSourceArrow: this.hasSourceArrow,
1611
1630
  hasTargetArrow: this.hasTargetArrow
1612
1631
  }));
1613
- 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;
1614
- 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;
1615
1634
  this.roundness = Math.min(
1616
1635
  t,
1617
1636
  this.arrowOffset,
1618
1637
  this.cycleSquareSide / 2
1619
- ), 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({
1620
- color: (e == null ? void 0 : e.color) ?? w.color,
1621
- width: (e == null ? void 0 : e.width) ?? w.width,
1622
- 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) ?? {}),
1623
1642
  arrowLength: this.arrowLength,
1624
1643
  hasSourceArrow: this.hasSourceArrow,
1625
1644
  hasTargetArrow: this.hasTargetArrow,
@@ -1632,23 +1651,23 @@ class ot {
1632
1651
  this.pathShape.render(e);
1633
1652
  }
1634
1653
  }
1635
- class st {
1654
+ class gt {
1636
1655
  constructor(e) {
1637
- s(this, "svg");
1638
- s(this, "group");
1639
- s(this, "line");
1640
- s(this, "sourceArrow");
1641
- s(this, "targetArrow");
1642
- s(this, "onAfterRender");
1643
- s(this, "arrowLength");
1644
- s(this, "arrowOffset");
1645
- s(this, "roundness");
1646
- s(this, "cycleSquareSide");
1647
- s(this, "detourDistance");
1648
- s(this, "hasSourceArrow");
1649
- s(this, "hasTargetArrow");
1650
- s(this, "pathShape");
1651
- s(this, "createCyclePath", (e) => new K({
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({
1652
1671
  sourceDirection: e,
1653
1672
  arrowLength: this.arrowLength,
1654
1673
  side: this.cycleSquareSide,
@@ -1657,8 +1676,8 @@ class st {
1657
1676
  hasSourceArrow: this.hasSourceArrow,
1658
1677
  hasTargetArrow: this.hasTargetArrow
1659
1678
  }));
1660
- s(this, "createDetourPath", (e, t, o, i, n) => new Qe({
1661
- to: o,
1679
+ o(this, "createDetourPath", (e, t, s, i, n) => new it({
1680
+ to: s,
1662
1681
  sourceDirection: e,
1663
1682
  targetDirection: t,
1664
1683
  flipX: i,
@@ -1670,8 +1689,8 @@ class st {
1670
1689
  hasSourceArrow: this.hasSourceArrow,
1671
1690
  hasTargetArrow: this.hasTargetArrow
1672
1691
  }));
1673
- s(this, "createLinePath", (e, t, o, i, n) => new Ge({
1674
- to: o,
1692
+ o(this, "createLinePath", (e, t, s, i, n) => new tt({
1693
+ to: s,
1675
1694
  sourceDirection: e,
1676
1695
  targetDirection: t,
1677
1696
  flipY: n,
@@ -1681,16 +1700,16 @@ class st {
1681
1700
  hasSourceArrow: this.hasSourceArrow,
1682
1701
  hasTargetArrow: this.hasTargetArrow
1683
1702
  }));
1684
- 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;
1685
- 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;
1686
1705
  this.roundness = Math.min(
1687
1706
  t,
1688
1707
  this.arrowOffset,
1689
1708
  this.cycleSquareSide / 2
1690
- ), 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({
1691
- color: (e == null ? void 0 : e.color) ?? w.color,
1692
- width: (e == null ? void 0 : e.width) ?? w.width,
1693
- 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) ?? {}),
1694
1713
  arrowLength: this.arrowLength,
1695
1714
  hasSourceArrow: this.hasSourceArrow,
1696
1715
  hasTargetArrow: this.hasTargetArrow,
@@ -1703,30 +1722,30 @@ class st {
1703
1722
  this.pathShape.render(e);
1704
1723
  }
1705
1724
  }
1706
- class Pe {
1725
+ class Ne {
1707
1726
  constructor(e) {
1708
- s(this, "svg");
1709
- s(this, "group", xe());
1710
- s(this, "line");
1711
- s(this, "sourceArrow", null);
1712
- s(this, "targetArrow", null);
1713
- s(this, "color");
1714
- s(this, "width");
1715
- s(this, "arrowLength");
1716
- s(this, "sourceOffset");
1717
- s(this, "targetOffset");
1718
- s(this, "onAfterRender");
1719
- s(this, "afterRenderEmitter");
1720
- s(this, "arrowRenderer");
1721
- [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 = Ee(this.color), this.svg.appendChild(this.group), this.line = Ae(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = F(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = F(), 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));
1722
1741
  }
1723
1742
  render(e) {
1724
- const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } = ve(
1743
+ const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
1725
1744
  e.from,
1726
1745
  e.to
1727
1746
  );
1728
- Se(this.svg, { x: t, y: o, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1729
- const d = { x: i, y: n }, c = new Ze({
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({
1730
1749
  to: d,
1731
1750
  sourceOffset: this.sourceOffset,
1732
1751
  targetOffset: this.targetOffset,
@@ -1735,82 +1754,82 @@ class Pe {
1735
1754
  arrowLength: this.arrowLength
1736
1755
  });
1737
1756
  this.line.setAttribute("d", c.path);
1738
- let l = null, g = null;
1739
- const p = c.diagonalDistance;
1740
- if (p === 0)
1741
- 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));
1742
1761
  else {
1743
- const f = {
1744
- x: d.x / p,
1745
- y: d.y / p
1762
+ const w = {
1763
+ x: d.x / u,
1764
+ y: d.y / u
1746
1765
  };
1747
1766
  if (this.sourceArrow) {
1748
- const y = {
1749
- x: f.x * this.sourceOffset,
1750
- y: f.y * this.sourceOffset
1767
+ const m = {
1768
+ x: w.x * this.sourceOffset,
1769
+ y: w.y * this.sourceOffset
1751
1770
  };
1752
- l = this.arrowRenderer({
1753
- direction: f,
1754
- shift: y,
1771
+ g = this.arrowRenderer({
1772
+ direction: w,
1773
+ shift: m,
1755
1774
  arrowLength: this.arrowLength
1756
- }), this.sourceArrow.setAttribute("d", l);
1775
+ }), this.sourceArrow.setAttribute("d", g);
1757
1776
  }
1758
1777
  if (this.targetArrow) {
1759
- const y = {
1760
- x: f.x * this.targetOffset,
1761
- y: f.y * this.targetOffset
1778
+ const m = {
1779
+ x: w.x * this.targetOffset,
1780
+ y: w.y * this.targetOffset
1762
1781
  };
1763
- g = this.arrowRenderer({
1764
- direction: { x: -f.x, y: -f.y },
1782
+ l = this.arrowRenderer({
1783
+ direction: { x: -w.x, y: -w.y },
1765
1784
  shift: {
1766
- x: d.x - y.x,
1767
- y: d.y - y.y
1785
+ x: d.x - m.x,
1786
+ y: d.y - m.y
1768
1787
  },
1769
1788
  arrowLength: this.arrowLength
1770
- }), this.targetArrow.setAttribute("d", g);
1789
+ }), this.targetArrow.setAttribute("d", l);
1771
1790
  }
1772
1791
  }
1773
1792
  this.afterRenderEmitter.emit({
1774
1793
  edgePath: c,
1775
- sourceArrowPath: l,
1776
- targetArrowPath: g
1794
+ sourceArrowPath: g,
1795
+ targetArrowPath: l
1777
1796
  });
1778
1797
  }
1779
1798
  }
1780
- const it = () => {
1799
+ const ut = () => {
1781
1800
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1782
1801
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1783
- }, nt = (r) => {
1802
+ }, pt = (r) => {
1784
1803
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1785
1804
  return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1786
- }, he = (r) => {
1805
+ }, ue = (r) => {
1787
1806
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1788
1807
  return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1789
1808
  };
1790
- class at extends Error {
1809
+ class wt extends Error {
1791
1810
  constructor(e) {
1792
1811
  super(e), this.name = "InteractiveEdgeError";
1793
1812
  }
1794
1813
  }
1795
- class be {
1814
+ class Me {
1796
1815
  constructor(e, t) {
1797
- s(this, "svg");
1798
- s(this, "group");
1799
- s(this, "line");
1800
- s(this, "sourceArrow");
1801
- s(this, "targetArrow");
1802
- s(this, "handle", it());
1803
- s(this, "onAfterRender");
1804
- s(this, "interactiveLine");
1805
- s(this, "interactiveSourceArrow", null);
1806
- s(this, "interactiveTargetArrow", null);
1807
- if (this.baseEdge = e, e instanceof be)
1808
- throw new at(
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(
1809
1828
  "interactive edge can be configured only once"
1810
1829
  );
1811
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;
1812
- const o = (t == null ? void 0 : t.distance) ?? w.interactiveWidth;
1813
- this.interactiveLine = nt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = he(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = he(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) => {
1814
1833
  this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1815
1834
  });
1816
1835
  }
@@ -1818,16 +1837,16 @@ class be {
1818
1837
  this.baseEdge.render(e);
1819
1838
  }
1820
1839
  }
1821
- class Lt {
1840
+ class Jt {
1822
1841
  constructor(e, t) {
1823
- s(this, "group");
1824
- s(this, "line");
1825
- s(this, "sourceArrow");
1826
- s(this, "targetArrow");
1827
- s(this, "onAfterRender");
1828
- s(this, "svg");
1829
- 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) => {
1830
- 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)`;
1831
1850
  this.midpointElement.style.setProperty("transform", n);
1832
1851
  });
1833
1852
  }
@@ -1835,34 +1854,34 @@ class Lt {
1835
1854
  this.baseShape.render(e);
1836
1855
  }
1837
1856
  }
1838
- class Te {
1857
+ class Le {
1839
1858
  constructor(e) {
1840
- s(this, "onAfterNodeAdded");
1841
- s(this, "onAfterNodeUpdated");
1842
- s(this, "onAfterNodePriorityUpdated");
1843
- s(this, "onBeforeNodeRemoved");
1844
- s(this, "onAfterPortMarked");
1845
- s(this, "onAfterPortUpdated");
1846
- s(this, "onBeforePortUnmarked");
1847
- s(this, "onAfterEdgeAdded");
1848
- s(this, "onAfterEdgeShapeUpdated");
1849
- s(this, "onAfterEdgeUpdated");
1850
- s(this, "onAfterEdgePriorityUpdated");
1851
- s(this, "onBeforeEdgeRemoved");
1852
- 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");
1853
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;
1854
1873
  }
1855
1874
  getNode(e) {
1856
1875
  const t = this.graphStore.getNode(e);
1857
1876
  if (t === void 0)
1858
1877
  return null;
1859
- const o = t.payload;
1878
+ const s = t.payload;
1860
1879
  return {
1861
1880
  element: t.element,
1862
- x: o.x,
1863
- y: o.y,
1864
- centerFn: o.centerFn,
1865
- priority: o.priority
1881
+ x: s.x,
1882
+ y: s.y,
1883
+ centerFn: s.centerFn,
1884
+ priority: s.priority
1866
1885
  };
1867
1886
  }
1868
1887
  getElementNodeId(e) {
@@ -1895,12 +1914,12 @@ class Te {
1895
1914
  const t = this.graphStore.getEdge(e);
1896
1915
  if (t === void 0)
1897
1916
  return null;
1898
- const o = t.payload;
1917
+ const s = t.payload;
1899
1918
  return {
1900
1919
  from: t.from,
1901
1920
  to: t.to,
1902
- priority: o.priority,
1903
- shape: o.shape
1921
+ priority: s.priority,
1922
+ shape: s.shape
1904
1923
  };
1905
1924
  }
1906
1925
  getPortIncomingEdgeIds(e) {
@@ -1928,9 +1947,9 @@ class Te {
1928
1947
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
1929
1948
  }
1930
1949
  }
1931
- class De {
1950
+ class Re {
1932
1951
  constructor(e) {
1933
- s(this, "onAfterUpdated");
1952
+ o(this, "onAfterUpdated");
1934
1953
  this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
1935
1954
  }
1936
1955
  getViewportMatrix() {
@@ -1940,22 +1959,22 @@ class De {
1940
1959
  return { ...this.viewportStore.getContentMatrix() };
1941
1960
  }
1942
1961
  }
1943
- const Ne = (r, e) => {
1944
- const t = new fe(), o = new Te(t), i = new De(e), n = new ue(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 = {
1945
1964
  nodes: {
1946
- centerFn: me,
1965
+ centerFn: xe,
1947
1966
  priorityFn: () => 0
1948
1967
  },
1949
1968
  edges: {
1950
- shapeFactory: () => new Pe(),
1969
+ shapeFactory: () => new Ne(),
1951
1970
  priorityFn: () => 0
1952
1971
  },
1953
1972
  ports: {
1954
1973
  direction: 0
1955
1974
  }
1956
1975
  };
1957
- return new we(
1958
- o,
1976
+ return new ve(
1977
+ s,
1959
1978
  i,
1960
1979
  t,
1961
1980
  e,
@@ -1963,21 +1982,21 @@ const Ne = (r, e) => {
1963
1982
  a
1964
1983
  );
1965
1984
  };
1966
- class k {
1967
- constructor(e, t, o, i) {
1968
- s(this, "onAfterPortMarked", (e) => {
1985
+ class z {
1986
+ constructor(e, t, s, i) {
1987
+ o(this, "onAfterPortMarked", (e) => {
1969
1988
  const t = this.canvas.graph.getPort(e);
1970
1989
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
1971
1990
  });
1972
- s(this, "onBeforePortUnmarked", (e) => {
1991
+ o(this, "onBeforePortUnmarked", (e) => {
1973
1992
  const t = this.canvas.graph.getPort(e);
1974
1993
  this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
1975
1994
  });
1976
- s(this, "onPortMouseDown", (e) => {
1995
+ o(this, "onPortMouseDown", (e) => {
1977
1996
  if (!this.params.mouseDownEventVerifier(e))
1978
1997
  return;
1979
- const t = e.currentTarget, o = this.canvas.graph.getElementPortIds(t)[0];
1980
- this.params.onPortPointerDown(o, {
1998
+ const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
1999
+ this.params.onPortPointerDown(s, {
1981
2000
  x: e.clientX,
1982
2001
  y: e.clientY
1983
2002
  }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
@@ -1986,8 +2005,8 @@ class k {
1986
2005
  passive: !0
1987
2006
  }));
1988
2007
  });
1989
- s(this, "onWindowMouseMove", (e) => {
1990
- if (!C(
2008
+ o(this, "onWindowMouseMove", (e) => {
2009
+ if (!V(
1991
2010
  this.window,
1992
2011
  this.element,
1993
2012
  e.clientX,
@@ -1998,13 +2017,13 @@ class k {
1998
2017
  }
1999
2018
  this.params.onPointerMove({ x: e.clientX, y: e.clientY });
2000
2019
  });
2001
- s(this, "onWindowMouseUp", (e) => {
2020
+ o(this, "onWindowMouseUp", (e) => {
2002
2021
  this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
2003
2022
  });
2004
- s(this, "onPortTouchStart", (e) => {
2023
+ o(this, "onPortTouchStart", (e) => {
2005
2024
  if (e.touches.length !== 1)
2006
2025
  return;
2007
- 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];
2008
2027
  this.params.onPortPointerDown(i, {
2009
2028
  x: t.clientX,
2010
2029
  y: t.clientY
@@ -2016,9 +2035,9 @@ class k {
2016
2035
  passive: !0
2017
2036
  }));
2018
2037
  });
2019
- s(this, "onWindowTouchMove", (e) => {
2038
+ o(this, "onWindowTouchMove", (e) => {
2020
2039
  const t = e.touches[0];
2021
- if (!C(
2040
+ if (!V(
2022
2041
  this.window,
2023
2042
  this.element,
2024
2043
  t.clientX,
@@ -2029,23 +2048,23 @@ class k {
2029
2048
  }
2030
2049
  this.params.onPointerMove({ x: t.clientX, y: t.clientY });
2031
2050
  });
2032
- s(this, "onWindowTouchFinish", (e) => {
2051
+ o(this, "onWindowTouchFinish", (e) => {
2033
2052
  const t = e.changedTouches[0];
2034
2053
  this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
2035
2054
  });
2036
- s(this, "onBeforeClear", () => {
2055
+ o(this, "onBeforeClear", () => {
2037
2056
  this.canvas.graph.getAllPortIds().forEach((e) => {
2038
2057
  const t = this.canvas.graph.getPort(e);
2039
2058
  this.unhookPortEvents(t.element);
2040
2059
  });
2041
2060
  });
2042
- s(this, "onBeforeDestroy", () => {
2061
+ o(this, "onBeforeDestroy", () => {
2043
2062
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
2044
2063
  });
2045
- 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);
2046
2065
  }
2047
- static configure(e, t, o, i) {
2048
- new k(e, t, o, i);
2066
+ static configure(e, t, s, i) {
2067
+ new z(e, t, s, i);
2049
2068
  }
2050
2069
  hookPortEvents(e) {
2051
2070
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -2070,12 +2089,12 @@ class k {
2070
2089
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2071
2090
  }
2072
2091
  }
2073
- class Z {
2074
- constructor(e, t, o, i) {
2075
- s(this, "grabbedNode", null);
2076
- s(this, "maxNodePriority", 0);
2077
- s(this, "graph");
2078
- 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) => {
2079
2098
  this.updateMaxNodePriority(e);
2080
2099
  const t = this.graph.getNode(e);
2081
2100
  t.element.addEventListener("mousedown", this.onMouseDown, {
@@ -2084,27 +2103,27 @@ class Z {
2084
2103
  passive: !0
2085
2104
  });
2086
2105
  });
2087
- s(this, "onAfterNodeUpdated", (e) => {
2106
+ o(this, "onAfterNodeUpdated", (e) => {
2088
2107
  this.updateMaxNodePriority(e);
2089
2108
  });
2090
- s(this, "onBeforeNodeRemoved", (e) => {
2109
+ o(this, "onBeforeNodeRemoved", (e) => {
2091
2110
  const t = this.graph.getNode(e);
2092
2111
  t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2093
2112
  });
2094
- s(this, "onBeforeDestroy", () => {
2113
+ o(this, "onBeforeDestroy", () => {
2095
2114
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2096
2115
  });
2097
- s(this, "onBeforeClear", () => {
2116
+ o(this, "onBeforeClear", () => {
2098
2117
  this.canvas.graph.getAllNodeIds().forEach((e) => {
2099
2118
  const t = this.canvas.graph.getNode(e);
2100
2119
  t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
2101
2120
  }), this.maxNodePriority = 0;
2102
2121
  });
2103
- s(this, "onMouseDown", (e) => {
2122
+ o(this, "onMouseDown", (e) => {
2104
2123
  if (!this.params.mouseDownEventVerifier(e))
2105
2124
  return;
2106
- const t = e.currentTarget, o = this.graph.getElementNodeId(t), i = this.graph.getNode(o);
2107
- 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))
2108
2127
  return;
2109
2128
  e.stopPropagation();
2110
2129
  const a = this.calculateContentPoint({
@@ -2112,20 +2131,20 @@ class Z {
2112
2131
  y: e.clientY
2113
2132
  });
2114
2133
  this.grabbedNode = {
2115
- nodeId: o,
2134
+ nodeId: s,
2116
2135
  dx: a.x - i.x,
2117
2136
  dy: a.y - i.y
2118
- }, 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, {
2119
2138
  passive: !0
2120
2139
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2121
2140
  passive: !0
2122
2141
  });
2123
2142
  });
2124
- s(this, "onTouchStart", (e) => {
2143
+ o(this, "onTouchStart", (e) => {
2125
2144
  if (e.touches.length !== 1)
2126
2145
  return;
2127
2146
  e.stopPropagation();
2128
- 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);
2129
2148
  if (!this.params.nodeDragVerifier({
2130
2149
  nodeId: i,
2131
2150
  element: n.element,
@@ -2149,8 +2168,8 @@ class Z {
2149
2168
  passive: !0
2150
2169
  });
2151
2170
  });
2152
- s(this, "onWindowMouseMove", (e) => {
2153
- if (!C(
2171
+ o(this, "onWindowMouseMove", (e) => {
2172
+ if (!V(
2154
2173
  this.window,
2155
2174
  this.element,
2156
2175
  e.clientX,
@@ -2164,14 +2183,14 @@ class Z {
2164
2183
  y: e.clientY
2165
2184
  });
2166
2185
  });
2167
- s(this, "onWindowMouseUp", (e) => {
2186
+ o(this, "onWindowMouseUp", (e) => {
2168
2187
  this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2169
2188
  });
2170
- s(this, "onWindowTouchMove", (e) => {
2189
+ o(this, "onWindowTouchMove", (e) => {
2171
2190
  if (e.touches.length !== 1)
2172
2191
  return;
2173
2192
  const t = e.touches[0];
2174
- if (!C(
2193
+ if (!V(
2175
2194
  this.window,
2176
2195
  this.element,
2177
2196
  t.clientX,
@@ -2185,13 +2204,13 @@ class Z {
2185
2204
  y: t.clientY
2186
2205
  });
2187
2206
  });
2188
- s(this, "onWindowTouchFinish", () => {
2207
+ o(this, "onWindowTouchFinish", () => {
2189
2208
  this.cancelTouchDrag();
2190
2209
  });
2191
- 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);
2192
2211
  }
2193
- static configure(e, t, o, i) {
2194
- new Z(e, t, o, i);
2212
+ static configure(e, t, s, i) {
2213
+ new Q(e, t, s, i);
2195
2214
  }
2196
2215
  moveNode(e, t) {
2197
2216
  if (this.graph.getNode(e.nodeId) === null)
@@ -2217,7 +2236,7 @@ class Z {
2217
2236
  }
2218
2237
  }
2219
2238
  cancelMouseDrag() {
2220
- 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();
2221
2240
  }
2222
2241
  removeMouseDragListeners() {
2223
2242
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -2242,40 +2261,40 @@ class Z {
2242
2261
  this.maxNodePriority = Math.max(this.maxNodePriority, t);
2243
2262
  }
2244
2263
  calculateContentPoint(e) {
2245
- const t = this.element.getBoundingClientRect(), o = {
2264
+ const t = this.element.getBoundingClientRect(), s = {
2246
2265
  x: e.x - t.x,
2247
2266
  y: e.y - t.y
2248
2267
  }, i = this.canvas.viewport.getViewportMatrix();
2249
- return T(i, o);
2268
+ return D(i, s);
2250
2269
  }
2251
2270
  adjustNodeCoords(e) {
2252
2271
  const t = this.params.gridSize;
2253
2272
  if (t !== null) {
2254
- const o = t / 2;
2273
+ const s = t / 2;
2255
2274
  return {
2256
- x: Math.floor((e.x + o) / t) * t,
2257
- 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
2258
2277
  };
2259
2278
  }
2260
2279
  return e;
2261
2280
  }
2262
2281
  }
2263
- const ht = (r, e, t) => ({
2282
+ const ft = (r, e, t) => ({
2264
2283
  scale: r.scale,
2265
2284
  x: r.x + r.scale * e,
2266
2285
  y: r.y + r.scale * t
2267
- }), dt = (r, e, t, o) => ({
2286
+ }), mt = (r, e, t, s) => ({
2268
2287
  scale: r.scale * e,
2269
2288
  x: r.scale * (1 - e) * t + r.x,
2270
- y: r.scale * (1 - e) * o + r.y
2289
+ y: r.scale * (1 - e) * s + r.y
2271
2290
  }), U = (r) => {
2272
2291
  const e = [], t = r.touches.length;
2273
2292
  for (let h = 0; h < t; h++)
2274
2293
  e.push([r.touches[h].clientX, r.touches[h].clientY]);
2275
- const o = e.reduce(
2294
+ const s = e.reduce(
2276
2295
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2277
2296
  [0, 0]
2278
- ), 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(
2279
2298
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2280
2299
  0
2281
2300
  );
@@ -2287,24 +2306,24 @@ const ht = (r, e, t) => ({
2287
2306
  touches: e
2288
2307
  };
2289
2308
  };
2290
- class z {
2291
- constructor(e, t, o, i) {
2292
- s(this, "viewport");
2293
- s(this, "prevTouches", null);
2294
- s(this, "wheelFinishTimer", null);
2295
- s(this, "transformInProgress", !1);
2296
- 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", () => {
2297
2316
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2298
2317
  });
2299
- s(this, "onMouseDown", (e) => {
2300
- 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, {
2301
2320
  passive: !0
2302
2321
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2303
2322
  passive: !0
2304
2323
  }), this.startRegisteredTransform());
2305
2324
  });
2306
- s(this, "onWindowMouseMove", (e) => {
2307
- const t = C(
2325
+ o(this, "onWindowMouseMove", (e) => {
2326
+ const t = V(
2308
2327
  this.window,
2309
2328
  this.element,
2310
2329
  e.clientX,
@@ -2314,21 +2333,21 @@ class z {
2314
2333
  this.stopMouseDrag();
2315
2334
  return;
2316
2335
  }
2317
- const o = -e.movementX, i = -e.movementY;
2318
- this.moveViewport(o, i);
2336
+ const s = -e.movementX, i = -e.movementY;
2337
+ this.moveViewport(s, i);
2319
2338
  });
2320
- s(this, "onWindowMouseUp", (e) => {
2339
+ o(this, "onWindowMouseUp", (e) => {
2321
2340
  this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
2322
2341
  });
2323
- s(this, "onWheelScroll", (e) => {
2342
+ o(this, "onWheelScroll", (e) => {
2324
2343
  if (!this.params.mouseWheelEventVerifier(e))
2325
2344
  return;
2326
- 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);
2327
2346
  this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2328
2347
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2329
2348
  }, this.params.scaleWheelFinishTimeout);
2330
2349
  });
2331
- s(this, "onTouchStart", (e) => {
2350
+ o(this, "onTouchStart", (e) => {
2332
2351
  if (this.prevTouches !== null) {
2333
2352
  this.prevTouches = U(e);
2334
2353
  return;
@@ -2341,10 +2360,10 @@ class z {
2341
2360
  passive: !0
2342
2361
  }), this.startRegisteredTransform();
2343
2362
  });
2344
- s(this, "onWindowTouchMove", (e) => {
2363
+ o(this, "onWindowTouchMove", (e) => {
2345
2364
  const t = U(e);
2346
2365
  if (!t.touches.every(
2347
- (i) => C(this.window, this.element, i[0], i[1])
2366
+ (i) => V(this.window, this.element, i[0], i[1])
2348
2367
  )) {
2349
2368
  this.stopTouchDrag();
2350
2369
  return;
@@ -2358,22 +2377,22 @@ class z {
2358
2377
  }
2359
2378
  this.prevTouches = t;
2360
2379
  });
2361
- s(this, "onWindowTouchFinish", (e) => {
2380
+ o(this, "onWindowTouchFinish", (e) => {
2362
2381
  e.touches.length > 0 ? this.prevTouches = U(e) : this.stopTouchDrag();
2363
2382
  });
2364
- s(this, "observer", new ResizeObserver(() => {
2365
- 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({
2366
2385
  prevTransform: e,
2367
2386
  nextTransform: e,
2368
2387
  canvasWidth: t,
2369
- canvasHeight: o
2388
+ canvasHeight: s
2370
2389
  });
2371
2390
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2372
2391
  }));
2373
- s(this, "preventWheelScaleListener", (e) => {
2392
+ o(this, "preventWheelScaleListener", (e) => {
2374
2393
  e.preventDefault();
2375
2394
  });
2376
- 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, {
2377
2396
  passive: !1
2378
2397
  }), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
2379
2398
  passive: !0
@@ -2383,20 +2402,20 @@ class z {
2383
2402
  passive: !0
2384
2403
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2385
2404
  }
2386
- static configure(e, t, o, i) {
2387
- new z(e, t, o, i);
2405
+ static configure(e, t, s, i) {
2406
+ new X(e, t, s, i);
2388
2407
  }
2389
2408
  moveViewport(e, t) {
2390
- const o = this.viewport.getViewportMatrix(), i = ht(o, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2391
- 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,
2392
2411
  nextTransform: i,
2393
2412
  canvasWidth: n,
2394
2413
  canvasHeight: a
2395
2414
  });
2396
2415
  this.performTransform(h);
2397
2416
  }
2398
- scaleViewport(e, t, o) {
2399
- const i = this.canvas.viewport.getViewportMatrix(), n = dt(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({
2400
2419
  prevTransform: i,
2401
2420
  nextTransform: n,
2402
2421
  canvasWidth: a,
@@ -2405,7 +2424,7 @@ class z {
2405
2424
  this.performTransform(d);
2406
2425
  }
2407
2426
  stopMouseDrag() {
2408
- I(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2427
+ B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2409
2428
  }
2410
2429
  removeMouseDragListeners() {
2411
2430
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2426,22 +2445,22 @@ class z {
2426
2445
  this.transformInProgress = !1, this.params.onTransformFinished();
2427
2446
  }
2428
2447
  }
2429
- class J {
2430
- constructor(e, t, o, i, n, a) {
2431
- s(this, "canvasResizeObserver");
2432
- s(this, "nodeHorizontal");
2433
- s(this, "nodeVertical");
2434
- s(this, "viewport");
2435
- s(this, "viewportWidth", 0);
2436
- s(this, "viewportHeight", 0);
2437
- s(this, "viewportMatrix");
2438
- 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", {
2439
2458
  xFrom: 1 / 0,
2440
2459
  xTo: 1 / 0,
2441
2460
  yFrom: 1 / 0,
2442
2461
  yTo: 1 / 0
2443
2462
  });
2444
- s(this, "updateLoadedArea", (e) => {
2463
+ o(this, "updateLoadedArea", (e) => {
2445
2464
  this.loadedArea = {
2446
2465
  xFrom: e.x,
2447
2466
  xTo: e.x + e.width,
@@ -2449,11 +2468,11 @@ class J {
2449
2468
  yTo: e.y + e.height
2450
2469
  };
2451
2470
  });
2452
- s(this, "onAfterViewportUpdated", () => {
2471
+ o(this, "onAfterViewportUpdated", () => {
2453
2472
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
2454
2473
  });
2455
- s(this, "userTransformInProgress", !1);
2456
- 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) => {
2457
2476
  const c = d[0];
2458
2477
  this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
2459
2478
  }), this.viewport = e.viewport;
@@ -2477,18 +2496,18 @@ class J {
2477
2496
  this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
2478
2497
  }
2479
2498
  };
2480
- z.configure(
2499
+ X.configure(
2481
2500
  e,
2482
2501
  this.element,
2483
2502
  this.window,
2484
2503
  h
2485
2504
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2486
2505
  }
2487
- static configure(e, t, o, i, n, a) {
2488
- new J(
2506
+ static configure(e, t, s, i, n, a) {
2507
+ new q(
2489
2508
  e,
2490
2509
  t,
2491
- o,
2510
+ s,
2492
2511
  i,
2493
2512
  n,
2494
2513
  a
@@ -2500,75 +2519,75 @@ class J {
2500
2519
  });
2501
2520
  }
2502
2521
  scheduleEnsureViewportAreaLoaded() {
2503
- 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;
2504
- 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();
2505
2524
  }
2506
2525
  loadAreaAroundViewport() {
2507
- 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;
2508
- 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 });
2509
2528
  }
2510
2529
  }
2511
- const ct = () => {
2530
+ const yt = () => {
2512
2531
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2513
2532
  return r.style.position = "absolute", r.style.inset = "0", r;
2514
- }, gt = () => {
2533
+ }, vt = () => {
2515
2534
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2516
2535
  return r.setAttribute("fill", "url(#pattern)"), r;
2517
- }, lt = () => {
2536
+ }, Et = () => {
2518
2537
  const r = document.createElementNS(
2519
2538
  "http://www.w3.org/2000/svg",
2520
2539
  "pattern"
2521
2540
  );
2522
2541
  return r.setAttribute("id", "pattern"), r;
2523
2542
  };
2524
- class Q {
2525
- constructor(e, t, o) {
2526
- s(this, "svg", ct());
2527
- s(this, "patternRenderingRectangle", gt());
2528
- s(this, "pattern", lt());
2529
- s(this, "patternContent");
2530
- s(this, "tileWidth");
2531
- s(this, "tileHeight");
2532
- s(this, "halfTileWidth");
2533
- s(this, "halfTileHeight");
2534
- s(this, "maxViewportScale");
2535
- s(this, "visible", !1);
2536
- s(this, "resizeObserver", new ResizeObserver((e) => {
2537
- const t = e[0], { width: o, height: i } = t.contentRect;
2538
- this.svg.setAttribute("width", `${o}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${o}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
2539
- const n = this.tileWidth / o, a = this.tileHeight / i;
2543
+ class _ {
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;
2540
2559
  this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
2541
2560
  }));
2542
- s(this, "onAfterTransformUpdated", () => {
2543
- 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})`;
2544
2563
  this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2545
2564
  });
2546
- 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;
2547
2566
  const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2548
2567
  this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2549
2568
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2550
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();
2551
2570
  }
2552
- static configure(e, t, o) {
2553
- new Q(e, t, o);
2571
+ static configure(e, t, s) {
2572
+ new _(e, t, s);
2554
2573
  }
2555
2574
  updateVisibility() {
2556
2575
  const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
2557
2576
  t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
2558
2577
  }
2559
2578
  }
2560
- class _ {
2561
- constructor(e, t, o, i, n) {
2562
- s(this, "overlayCanvas");
2563
- s(this, "staticPortId", null);
2564
- s(this, "isTargetDragging", !0);
2565
- 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) => {
2566
2585
  this.params.onAfterEdgeCreated(e);
2567
2586
  });
2568
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas = Ne(
2587
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
2569
2588
  this.overlayLayer,
2570
2589
  this.viewportStore
2571
- ), k.configure(
2590
+ ), z.configure(
2572
2591
  this.canvas,
2573
2592
  this.overlayLayer,
2574
2593
  this.window,
@@ -2591,80 +2610,80 @@ class _ {
2591
2610
  }
2592
2611
  );
2593
2612
  }
2594
- static configure(e, t, o, i, n) {
2595
- new _(
2613
+ static configure(e, t, s, i, n) {
2614
+ new ee(
2596
2615
  e,
2597
2616
  t,
2598
- o,
2617
+ s,
2599
2618
  i,
2600
2619
  n
2601
2620
  );
2602
2621
  }
2603
- grabPort(e, t, o) {
2622
+ grabPort(e, t, s) {
2604
2623
  const i = this.canvas.graph.getPort(e);
2605
2624
  this.staticPortId = e;
2606
- 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, {
2607
2626
  x: a - d.x,
2608
2627
  y: h - d.y
2609
- }), g = T(c, {
2628
+ }), l = D(c, {
2610
2629
  x: t.x - d.x,
2611
2630
  y: t.y - d.y
2612
- }), p = {
2613
- overlayId: P.Static,
2614
- portCoords: l,
2615
- portDirection: i.direction
2616
- }, f = {
2617
- overlayId: P.Dragging,
2631
+ }), u = {
2632
+ overlayId: b.Static,
2618
2633
  portCoords: g,
2634
+ portDirection: i.direction
2635
+ }, w = {
2636
+ overlayId: b.Dragging,
2637
+ portCoords: l,
2619
2638
  portDirection: this.params.dragPortDirection
2620
2639
  };
2621
- this.isTargetDragging = o === "direct";
2622
- const [y, v] = this.isTargetDragging ? [p, f] : [f, p];
2623
- this.overlayCanvas.addNode(B(y)), this.overlayCanvas.addNode(B(v)), this.overlayCanvas.addEdge({
2624
- 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,
2625
2644
  to: v.overlayId,
2626
- shape: this.params.edgeShapeFactory(P.Edge)
2645
+ shape: this.params.edgeShapeFactory(b.Edge)
2627
2646
  });
2628
2647
  }
2629
2648
  resetDragState() {
2630
2649
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2631
2650
  }
2632
2651
  tryCreateConnection(e) {
2633
- const t = ye(this.canvas.graph, e), o = this.staticPortId;
2652
+ const t = Ae(this.canvas.graph, e), s = this.staticPortId;
2634
2653
  if (t === null) {
2635
2654
  this.params.onEdgeCreationInterrupted({
2636
- staticPortId: o,
2655
+ staticPortId: s,
2637
2656
  isDirect: this.isTargetDragging
2638
2657
  });
2639
2658
  return;
2640
2659
  }
2641
- 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);
2642
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);
2643
2662
  }
2644
2663
  moveDraggingPort(e) {
2645
- const t = this.overlayLayer.getBoundingClientRect(), o = {
2664
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
2646
2665
  x: e.x - t.x,
2647
2666
  y: e.y - t.y
2648
- }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, o);
2649
- this.overlayCanvas.updateNode(P.Dragging, {
2667
+ }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
2668
+ this.overlayCanvas.updateNode(b.Dragging, {
2650
2669
  x: n.x,
2651
2670
  y: n.y
2652
2671
  });
2653
2672
  }
2654
2673
  }
2655
- class q {
2656
- constructor(e, t, o, i, n) {
2657
- s(this, "overlayCanvas");
2658
- s(this, "staticPortId", null);
2659
- s(this, "isTargetDragging", !0);
2660
- s(this, "draggingEdgePayload", null);
2661
- 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) => {
2662
2681
  this.params.onAfterEdgeReattached(e);
2663
2682
  });
2664
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas = Ne(
2683
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
2665
2684
  this.overlayLayer,
2666
2685
  this.viewportStore
2667
- ), k.configure(
2686
+ ), z.configure(
2668
2687
  this.canvas,
2669
2688
  this.overlayLayer,
2670
2689
  this.window,
@@ -2684,75 +2703,75 @@ class q {
2684
2703
  }
2685
2704
  );
2686
2705
  }
2687
- static configure(e, t, o, i, n) {
2688
- new q(
2706
+ static configure(e, t, s, i, n) {
2707
+ new te(
2689
2708
  e,
2690
2709
  t,
2691
- o,
2710
+ s,
2692
2711
  i,
2693
2712
  n
2694
2713
  );
2695
2714
  }
2696
2715
  tryStartEdgeDragging(e, t) {
2697
- const o = this.params.draggingEdgeResolver(e);
2698
- if (o === null)
2716
+ const s = this.params.draggingEdgeResolver(e);
2717
+ if (s === null)
2699
2718
  return !1;
2700
- const i = this.canvas.graph.getEdge(o);
2719
+ const i = this.canvas.graph.getEdge(s);
2701
2720
  if (i === null)
2702
2721
  return !1;
2703
2722
  const n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2704
2723
  this.staticPortId = h, this.isTargetDragging = a;
2705
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), g = {
2706
- x: l.x + l.width / 2,
2707
- y: l.y + l.height / 2
2708
- }, p = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), y = T(p, {
2709
- x: g.x - f.x,
2710
- y: g.y - f.y
2711
- }), v = T(p, {
2712
- x: t.x - f.x,
2713
- 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
2714
2733
  });
2715
2734
  this.draggingEdgePayload = {
2716
- id: o,
2735
+ id: s,
2717
2736
  from: i.from,
2718
2737
  to: i.to,
2719
2738
  shape: i.shape,
2720
2739
  priority: i.priority
2721
- }, this.canvas.removeEdge(o);
2722
- const x = {
2723
- overlayId: P.Static,
2724
- portCoords: y,
2740
+ }, this.canvas.removeEdge(s);
2741
+ const E = {
2742
+ overlayId: b.Static,
2743
+ portCoords: m,
2725
2744
  portDirection: c.direction
2726
2745
  }, A = {
2727
- overlayId: P.Dragging,
2746
+ overlayId: b.Dragging,
2728
2747
  portCoords: v,
2729
2748
  portDirection: d.direction
2730
- }, [R, b] = this.isTargetDragging ? [x, A] : [A, x];
2731
- this.overlayCanvas.addNode(B(R)), this.overlayCanvas.addNode(B(b));
2732
- const D = 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;
2733
2752
  return this.overlayCanvas.addEdge({
2734
- id: P.Edge,
2753
+ id: b.Edge,
2735
2754
  from: R.overlayId,
2736
- to: b.overlayId,
2737
- shape: D
2755
+ to: T.overlayId,
2756
+ shape: N
2738
2757
  }), !0;
2739
2758
  }
2740
2759
  resetDragState() {
2741
2760
  this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2742
2761
  }
2743
2762
  moveDraggingPort(e) {
2744
- const t = this.overlayLayer.getBoundingClientRect(), o = {
2763
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
2745
2764
  x: e.x - t.x,
2746
2765
  y: e.y - t.y
2747
- }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, o);
2748
- this.overlayCanvas.updateNode(P.Dragging, {
2766
+ }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
2767
+ this.overlayCanvas.updateNode(b.Dragging, {
2749
2768
  x: n.x,
2750
2769
  y: n.y
2751
2770
  });
2752
2771
  }
2753
2772
  tryCreateConnection(e) {
2754
- const t = ye(this.canvas.graph, e);
2755
- 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) {
2756
2775
  const d = this.draggingEdgePayload;
2757
2776
  this.params.onEdgeReattachInterrupted({
2758
2777
  id: d.id,
@@ -2763,9 +2782,9 @@ class q {
2763
2782
  });
2764
2783
  return;
2765
2784
  }
2766
- 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 = {
2767
2786
  id: n.id,
2768
- from: o,
2787
+ from: s,
2769
2788
  to: i,
2770
2789
  shape: n.shape,
2771
2790
  priority: n.priority
@@ -2784,45 +2803,147 @@ class q {
2784
2803
  }
2785
2804
  }
2786
2805
  }
2787
- const ut = () => {
2806
+ class re {
2807
+ constructor(e, t, s) {
2808
+ this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
2809
+ this.applyLayout();
2810
+ });
2811
+ }
2812
+ static configure(e, t, s) {
2813
+ new re(
2814
+ e,
2815
+ t,
2816
+ s
2817
+ );
2818
+ }
2819
+ applyLayout() {
2820
+ this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
2821
+ this.canvas.updateNode(s, t);
2822
+ });
2823
+ }
2824
+ }
2825
+ class se {
2826
+ constructor(e, t) {
2827
+ o(this, "applyScheduled", !1);
2828
+ this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2829
+ this.scheduleApply();
2830
+ }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
2831
+ this.scheduleApply();
2832
+ }), this.canvas.graph.onAfterEdgeAdded.subscribe(() => {
2833
+ this.scheduleApply();
2834
+ }), this.canvas.graph.onBeforeEdgeRemoved.subscribe(() => {
2835
+ this.scheduleApply();
2836
+ });
2837
+ }
2838
+ static configure(e, t) {
2839
+ new se(
2840
+ e,
2841
+ t
2842
+ );
2843
+ }
2844
+ scheduleApply() {
2845
+ this.applyScheduled || (this.applyScheduled = !0, setTimeout(() => {
2846
+ this.applyScheduled = !1, this.applyLayout();
2847
+ }));
2848
+ }
2849
+ applyLayout() {
2850
+ this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
2851
+ this.canvas.updateNode(s, t);
2852
+ });
2853
+ }
2854
+ }
2855
+ class At {
2856
+ static configure(e, t) {
2857
+ const s = t.applyOn;
2858
+ switch (s.type) {
2859
+ case "manual": {
2860
+ re.configure(
2861
+ e,
2862
+ t.algorithm,
2863
+ s.trigger
2864
+ );
2865
+ break;
2866
+ }
2867
+ case "topologyChangeTimeout": {
2868
+ se.configure(
2869
+ e,
2870
+ t.algorithm
2871
+ );
2872
+ break;
2873
+ }
2874
+ }
2875
+ }
2876
+ }
2877
+ class xt {
2878
+ constructor(e, t) {
2879
+ o(this, "previousTimeStamp");
2880
+ o(this, "step", (e) => {
2881
+ if (this.previousTimeStamp === void 0)
2882
+ this.previousTimeStamp = e;
2883
+ else {
2884
+ const t = (e - this.previousTimeStamp) / 1e3;
2885
+ this.previousTimeStamp = e, this.callback(t);
2886
+ }
2887
+ this.win.requestAnimationFrame(this.step);
2888
+ });
2889
+ this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
2890
+ }
2891
+ }
2892
+ class oe {
2893
+ constructor(e, t, s, i) {
2894
+ o(this, "step", (e) => {
2895
+ this.algorithm.calculateNextCoordinates(
2896
+ this.canvas.graph,
2897
+ e
2898
+ ).forEach((s, i) => {
2899
+ this.staticNodes.has(i) || this.canvas.updateNode(i, { x: s.x, y: s.y });
2900
+ });
2901
+ });
2902
+ this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new xt(this.win, this.step);
2903
+ }
2904
+ static configure(e, t, s, i) {
2905
+ new oe(e, t, s, i);
2906
+ }
2907
+ }
2908
+ const St = () => {
2788
2909
  const r = document.createElement("div");
2789
2910
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
2790
- }, Y = () => {
2911
+ }, H = () => {
2791
2912
  const r = document.createElement("div");
2792
2913
  return r.style.position = "absolute", r.style.inset = "0", r;
2793
- }, de = () => {
2794
- const r = Y();
2914
+ }, pe = () => {
2915
+ const r = H();
2795
2916
  return r.style.pointerEvents = "none", r;
2796
2917
  };
2797
- class pt {
2918
+ class Pt {
2798
2919
  constructor(e) {
2799
- s(this, "background", Y());
2800
- s(this, "main", Y());
2801
- s(this, "overlayConnectablePorts", de());
2802
- s(this, "overlayDraggableEdges", de());
2803
- s(this, "host", ut());
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());
2804
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);
2805
2926
  }
2806
2927
  destroy() {
2807
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);
2808
2929
  }
2809
2930
  }
2810
- const H = (r) => () => r, ce = H(0), wt = () => {
2931
+ const j = (r) => () => r, we = j(0), bt = () => {
2811
2932
  let r = 0;
2812
2933
  return () => r++;
2813
- }, ft = (r, e) => {
2814
- let t = ce, o = ce;
2815
- const i = wt();
2816
- 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), {
2817
2938
  nodesPriorityFn: t,
2818
- edgesPriorityFn: o
2939
+ edgesPriorityFn: s
2819
2940
  };
2820
- }, ee = (r) => {
2941
+ }, ie = (r) => {
2821
2942
  if (typeof r == "function")
2822
2943
  return r;
2823
2944
  switch (r.type) {
2824
2945
  case "straight":
2825
- return () => new ot({
2946
+ return () => new lt({
2826
2947
  color: r.color,
2827
2948
  width: r.width,
2828
2949
  arrowLength: r.arrowLength,
@@ -2836,7 +2957,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
2836
2957
  detourDirection: r.detourDirection
2837
2958
  });
2838
2959
  case "horizontal":
2839
- return () => new rt({
2960
+ return () => new ct({
2840
2961
  color: r.color,
2841
2962
  width: r.width,
2842
2963
  arrowLength: r.arrowLength,
@@ -2849,7 +2970,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
2849
2970
  detourDistance: r.detourDistance
2850
2971
  });
2851
2972
  case "vertical":
2852
- return () => new st({
2973
+ return () => new gt({
2853
2974
  color: r.color,
2854
2975
  width: r.width,
2855
2976
  arrowLength: r.arrowLength,
@@ -2862,7 +2983,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
2862
2983
  detourDistance: r.detourDistance
2863
2984
  });
2864
2985
  case "direct":
2865
- return () => new Pe({
2986
+ return () => new Ne({
2866
2987
  color: r.color,
2867
2988
  width: r.width,
2868
2989
  arrowLength: r.arrowLength,
@@ -2873,7 +2994,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
2873
2994
  targetOffset: r.targetOffset
2874
2995
  });
2875
2996
  default:
2876
- return () => new tt({
2997
+ return () => new dt({
2877
2998
  color: r.color,
2878
2999
  width: r.width,
2879
3000
  arrowLength: r.arrowLength,
@@ -2887,185 +3008,185 @@ const H = (r) => () => r, ce = H(0), wt = () => {
2887
3008
  detourDirection: r.detourDirection
2888
3009
  });
2889
3010
  }
2890
- }, yt = (r) => {
2891
- var t, o, i, n, a;
2892
- const e = ft(
3011
+ }, Dt = (r) => {
3012
+ var t, s, i, n, a;
3013
+ const e = Tt(
2893
3014
  (t = r.nodes) == null ? void 0 : t.priority,
2894
- (o = r.edges) == null ? void 0 : o.priority
3015
+ (s = r.edges) == null ? void 0 : s.priority
2895
3016
  );
2896
3017
  return {
2897
3018
  nodes: {
2898
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? me,
3019
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? xe,
2899
3020
  priorityFn: e.nodesPriorityFn
2900
3021
  },
2901
3022
  ports: {
2902
3023
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
2903
3024
  },
2904
3025
  edges: {
2905
- shapeFactory: ee(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
3026
+ shapeFactory: ie(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
2906
3027
  priorityFn: e.edgesPriorityFn
2907
3028
  }
2908
3029
  };
2909
- }, mt = (r) => {
2910
- var p, f, y, v, x;
2911
- const e = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
2912
- }), t = r.nodeDragVerifier ?? (() => !0), o = ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
2913
- }), 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;
2914
3035
  return {
2915
3036
  moveOnTop: i,
2916
3037
  moveEdgesOnTop: n,
2917
3038
  dragCursor: h,
2918
3039
  gridSize: r.gridSize ?? null,
2919
3040
  mouseDownEventVerifier: c,
2920
- mouseUpEventVerifier: g,
3041
+ mouseUpEventVerifier: l,
2921
3042
  onNodeDrag: e,
2922
3043
  nodeDragVerifier: t,
2923
- onNodeDragFinished: o
3044
+ onNodeDragFinished: s
2924
3045
  };
2925
- }, vt = (r) => {
2926
- 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;
2927
3048
  return (n) => {
2928
3049
  let a = n.nextTransform.x, h = n.nextTransform.y;
2929
3050
  a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
2930
3051
  const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
2931
- 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));
2932
- const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
2933
- 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 };
2934
3055
  };
2935
- }, Et = (r) => {
2936
- 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;
2937
3058
  return (n) => {
2938
3059
  const a = n.prevTransform, h = n.nextTransform;
2939
- let d = h.scale, c = h.x, l = h.y;
3060
+ let d = h.scale, c = h.x, g = h.y;
2940
3061
  if (h.scale > i && h.scale > a.scale) {
2941
- d = Math.max(a.scale, i), c = a.x, l = a.y;
2942
- const g = (d - a.scale) / (h.scale - a.scale);
2943
- 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;
2944
3065
  }
2945
- if (h.scale < o && h.scale < a.scale) {
2946
- d = Math.min(a.scale, o), c = a.x, l = a.y;
2947
- const g = (d - a.scale) / (h.scale - a.scale);
2948
- 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;
2949
3070
  }
2950
3071
  return {
2951
3072
  scale: d,
2952
3073
  x: c,
2953
- y: l
3074
+ y: g
2954
3075
  };
2955
3076
  };
2956
- }, At = (r) => (e) => r.reduce(
2957
- (t, o) => o({
3077
+ }, Rt = (r) => (e) => r.reduce(
3078
+ (t, s) => s({
2958
3079
  prevTransform: e.prevTransform,
2959
3080
  nextTransform: t,
2960
3081
  canvasWidth: e.canvasWidth,
2961
3082
  canvasHeight: e.canvasHeight
2962
3083
  }),
2963
3084
  e.nextTransform
2964
- ), ge = (r) => {
3085
+ ), fe = (r) => {
2965
3086
  if (typeof r == "function")
2966
3087
  return r;
2967
3088
  switch (r.type) {
2968
3089
  case "scale-limit":
2969
- return Et({
3090
+ return Lt({
2970
3091
  minContentScale: r.minContentScale ?? 0,
2971
3092
  maxContentScale: r.maxContentScale ?? 1 / 0
2972
3093
  });
2973
3094
  case "shift-limit":
2974
- return vt({
3095
+ return Mt({
2975
3096
  minX: r.minX ?? -1 / 0,
2976
3097
  maxX: r.maxX ?? 1 / 0,
2977
3098
  minY: r.minY ?? -1 / 0,
2978
3099
  maxY: r.maxY ?? 1 / 0
2979
3100
  });
2980
3101
  }
2981
- }, le = (r) => {
2982
- var y, v, x, A, R, b, D, V, te, re, oe, se;
2983
- 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;
2984
3105
  let i;
2985
- o !== void 0 ? Array.isArray(o) ? i = At(
2986
- o.map(
2987
- (N) => ge(N)
3106
+ s !== void 0 ? Array.isArray(s) ? i = Rt(
3107
+ s.map(
3108
+ (M) => fe(M)
2988
3109
  )
2989
- ) : i = ge(o) : i = (N) => N.nextTransform;
2990
- 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) ?? (() => {
2991
3112
  }), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
2992
- }), d = (R = r == null ? void 0 : r.shift) == null ? void 0 : R.mouseDownEventVerifier, c = d !== void 0 ? d : (N) => N.button === 0, l = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = l !== void 0 ? l : (N) => N.button === 0, p = (D = r == null ? void 0 : r.scale) == null ? void 0 : D.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;
2993
3114
  return {
2994
3115
  wheelSensitivity: t,
2995
- 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) ?? (() => {
2996
3117
  }),
2997
- onTransformFinished: ((te = r == null ? void 0 : r.events) == null ? void 0 : te.onTransformFinished) ?? (() => {
3118
+ onTransformFinished: ((ne = r == null ? void 0 : r.events) == null ? void 0 : ne.onTransformFinished) ?? (() => {
2998
3119
  }),
2999
3120
  onBeforeTransformChange: a,
3000
3121
  onTransformChange: h,
3001
3122
  transformPreprocessor: i,
3002
3123
  shiftCursor: n,
3003
3124
  mouseDownEventVerifier: c,
3004
- mouseUpEventVerifier: g,
3005
- mouseWheelEventVerifier: f,
3006
- scaleWheelFinishTimeout: ((re = r == null ? void 0 : r.scale) == null ? void 0 : re.wheelFinishTimeout) ?? 500,
3007
- onResizeTransformStarted: ((oe = r == null ? void 0 : r.events) == null ? void 0 : oe.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) ?? (() => {
3008
3129
  }),
3009
- onResizeTransformFinished: ((se = r == null ? void 0 : r.events) == null ? void 0 : se.onResizeTransformFinished) ?? (() => {
3130
+ onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
3010
3131
  })
3011
3132
  };
3012
- }, xt = (r, e) => {
3133
+ }, Ct = (r, e) => {
3013
3134
  const t = document.createElementNS(
3014
3135
  "http://www.w3.org/2000/svg",
3015
3136
  "circle"
3016
3137
  );
3017
3138
  return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
3018
- }, St = (r) => r instanceof SVGElement ? r : xt(
3139
+ }, Vt = (r) => r instanceof SVGElement ? r : Ct(
3019
3140
  (r == null ? void 0 : r.radius) ?? 1.5,
3020
3141
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
3021
- ), Pt = (r) => {
3022
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, i = St(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 ?? {});
3023
3144
  return {
3024
3145
  tileWidth: t,
3025
- tileHeight: o,
3146
+ tileHeight: s,
3026
3147
  renderer: i,
3027
3148
  maxViewportScale: r.maxViewportScale ?? 10
3028
3149
  };
3029
- }, bt = (r, e, t) => {
3030
- var c, l, g;
3031
- 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 = () => {
3032
3153
  }, h = () => {
3033
3154
  }, d = () => {
3034
3155
  };
3035
3156
  return {
3036
- connectionTypeResolver: r.connectionTypeResolver ?? o,
3157
+ connectionTypeResolver: r.connectionTypeResolver ?? s,
3037
3158
  connectionPreprocessor: r.connectionPreprocessor ?? i,
3038
3159
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3039
3160
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3040
3161
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3041
- onEdgeCreationInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeCreationInterrupted) ?? d,
3042
- 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,
3043
3164
  dragPortDirection: r.dragPortDirection ?? t,
3044
- edgeShapeFactory: r.edgeShape !== void 0 ? ee(r.edgeShape) : e
3165
+ edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
3045
3166
  };
3046
- }, Tt = (r, e) => {
3047
- var c, l, g;
3048
- const t = (p) => p, o = (p) => p.button === 0 && p.ctrlKey, i = (p) => p.button === 0, n = (p) => {
3049
- const f = e.getPortAdjacentEdgeIds(p);
3050
- 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;
3051
3172
  }, a = () => {
3052
3173
  }, h = () => {
3053
3174
  }, d = () => {
3054
3175
  };
3055
3176
  return {
3056
3177
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3057
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
3178
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3058
3179
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3059
3180
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3060
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ee(r.draggingEdgeShape) : null,
3181
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ie(r.draggingEdgeShape) : null,
3061
3182
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3062
- onEdgeReattachInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeReattachInterrupted) ?? d,
3063
- 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
3064
3185
  };
3065
- }, Dt = (r) => ({
3186
+ }, Bt = (r) => ({
3066
3187
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3067
3188
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3068
- }), Nt = (r) => {
3189
+ }), Ft = (r) => {
3069
3190
  var e, t;
3070
3191
  return {
3071
3192
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3074,34 +3195,232 @@ const H = (r) => () => r, ce = H(0), wt = () => {
3074
3195
  })
3075
3196
  };
3076
3197
  };
3077
- class Mt extends Error {
3198
+ class Ot extends Error {
3078
3199
  constructor() {
3079
3200
  super(...arguments);
3080
- 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;
3081
3291
  }
3082
3292
  }
3083
- class Ct {
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 ? {
3357
+ type: "manual",
3358
+ trigger: r
3359
+ } : {
3360
+ type: "topologyChangeTimeout"
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) => ({
3385
+ ...r,
3386
+ nodeDragVerifier: (t) => (e.add(t), r.nodeDragVerifier(t)),
3387
+ onNodeDragFinished: (t) => {
3388
+ e.delete(t), r.onNodeDragFinished(t);
3389
+ }
3390
+ }), Kt = (r, e) => {
3391
+ r.onBeforeNodeRemoved.subscribe((t) => {
3392
+ e.delete(t);
3393
+ }), r.onBeforeClear.subscribe(() => {
3394
+ e.clear();
3395
+ });
3396
+ };
3397
+ class Qt {
3084
3398
  constructor(e) {
3085
- s(this, "used", !1);
3086
- s(this, "canvasDefaults", {});
3087
- s(this, "dragConfig", {});
3088
- s(this, "transformConfig", {});
3089
- s(this, "backgroundConfig", {});
3090
- s(this, "connectablePortsConfig", {});
3091
- s(this, "draggableEdgesConfig", {});
3092
- s(this, "virtualScrollConfig");
3093
- s(this, "hasDraggableNode", !1);
3094
- s(this, "hasTransformableViewport", !1);
3095
- s(this, "hasNodeResizeReactiveEdges", !1);
3096
- s(this, "hasBackground", !1);
3097
- s(this, "hasUserConnectablePorts", !1);
3098
- s(this, "hasUserDraggableEdges", !1);
3099
- s(this, "boxRenderingTrigger", new pe());
3100
- s(this, "graphStore", new fe());
3101
- s(this, "viewportStore", new Fe());
3102
- s(this, "graph", new Te(this.graphStore));
3103
- s(this, "viewport", new De(this.viewportStore));
3104
- s(this, "window", window);
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());
3105
3424
  this.element = e;
3106
3425
  }
3107
3426
  /**
@@ -3114,7 +3433,7 @@ class Ct {
3114
3433
  * enables nodes draggable by user
3115
3434
  */
3116
3435
  enableUserDraggableNodes(e) {
3117
- return this.hasDraggableNode = !0, this.dragConfig = e ?? {}, this;
3436
+ return this.hasDraggableNodes = !0, this.dragConfig = e ?? {}, this;
3118
3437
  }
3119
3438
  /**
3120
3439
  * enables viewport transformable by user
@@ -3147,52 +3466,74 @@ class Ct {
3147
3466
  enableUserConnectablePorts(e) {
3148
3467
  return this.hasUserConnectablePorts = !0, this.connectablePortsConfig = e ?? {}, this;
3149
3468
  }
3469
+ /**
3470
+ * enables edges dragging by dragging one of the adjacent ports
3471
+ */
3150
3472
  enableUserDraggableEdges(e) {
3151
3473
  return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
3152
3474
  }
3475
+ /**
3476
+ * enables nodes positioning with specified layout
3477
+ */
3478
+ enableLayout(e) {
3479
+ return this.layoutConfig = e, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
3480
+ }
3481
+ /**
3482
+ * enables animated nodes positioning with specified layout
3483
+ */
3484
+ enableAnimatedLayout(e) {
3485
+ return this.animatedLayoutConfig = e, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
3486
+ }
3153
3487
  /**
3154
3488
  * builds final canvas
3155
3489
  */
3156
3490
  build() {
3157
3491
  if (this.used)
3158
- throw new Mt("CanvasBuilder is a single use object");
3492
+ throw new Ot("CanvasBuilder is a single use object");
3159
3493
  this.used = !0;
3160
- const e = new pt(this.element);
3161
- let t = new ue(
3494
+ const e = new Pt(this.element);
3495
+ let t = new ye(
3162
3496
  this.graphStore,
3163
3497
  this.viewportStore,
3164
3498
  e.main
3165
3499
  );
3166
- this.virtualScrollConfig !== void 0 && (t = new Ue(
3500
+ this.virtualScrollConfig !== void 0 && (t = new Xe(
3167
3501
  t,
3168
3502
  this.graphStore,
3169
3503
  this.boxRenderingTrigger,
3170
- Nt(this.virtualScrollConfig)
3171
- )), t = new Ie(t, this.graphStore);
3172
- const o = yt(this.canvasDefaults), i = new we(
3504
+ Ft(this.virtualScrollConfig)
3505
+ )), t = new Ye(t, this.graphStore);
3506
+ const s = Dt(this.canvasDefaults), i = new ve(
3173
3507
  this.graph,
3174
3508
  this.viewport,
3175
3509
  this.graphStore,
3176
3510
  this.viewportStore,
3177
3511
  t,
3178
- o
3512
+ s
3179
3513
  );
3180
- if (this.hasBackground && Q.configure(
3514
+ if (this.hasBackground && _.configure(
3181
3515
  i,
3182
- Pt(this.backgroundConfig),
3516
+ $t(this.backgroundConfig),
3183
3517
  e.background
3184
- ), this.hasNodeResizeReactiveEdges && j.configure(i), this.hasDraggableNode && Z.configure(
3185
- i,
3186
- e.main,
3187
- this.window,
3188
- mt(this.dragConfig)
3189
- ), this.hasUserConnectablePorts) {
3190
- const a = bt(
3518
+ ), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
3519
+ let a = Nt(this.dragConfig);
3520
+ this.hasAnimatedLayout && (a = Gt(
3521
+ a,
3522
+ this.animationStaticNodes
3523
+ )), Q.configure(
3524
+ i,
3525
+ e.main,
3526
+ this.window,
3527
+ a
3528
+ );
3529
+ }
3530
+ if (this.hasUserConnectablePorts) {
3531
+ const a = It(
3191
3532
  this.connectablePortsConfig,
3192
- o.edges.shapeFactory,
3193
- o.ports.direction
3533
+ s.edges.shapeFactory,
3534
+ s.ports.direction
3194
3535
  );
3195
- _.configure(
3536
+ ee.configure(
3196
3537
  i,
3197
3538
  e.overlayConnectablePorts,
3198
3539
  this.viewportStore,
@@ -3201,11 +3542,11 @@ class Ct {
3201
3542
  );
3202
3543
  }
3203
3544
  if (this.hasUserDraggableEdges) {
3204
- const a = Tt(
3545
+ const a = Ut(
3205
3546
  this.draggableEdgesConfig,
3206
3547
  i.graph
3207
3548
  );
3208
- q.configure(
3549
+ te.configure(
3209
3550
  i,
3210
3551
  e.overlayDraggableEdges,
3211
3552
  this.viewportStore,
@@ -3213,19 +3554,30 @@ class Ct {
3213
3554
  a
3214
3555
  );
3215
3556
  }
3216
- this.virtualScrollConfig !== void 0 ? J.configure(
3557
+ this.virtualScrollConfig !== void 0 ? q.configure(
3217
3558
  i,
3218
3559
  e.main,
3219
3560
  this.window,
3220
- le(this.transformConfig),
3561
+ me(this.transformConfig),
3221
3562
  this.boxRenderingTrigger,
3222
- Dt(this.virtualScrollConfig)
3223
- ) : this.hasTransformableViewport && z.configure(
3563
+ Bt(this.virtualScrollConfig)
3564
+ ) : this.hasTransformableViewport && X.configure(
3224
3565
  i,
3225
3566
  e.main,
3226
3567
  this.window,
3227
- le(this.transformConfig)
3228
- );
3568
+ me(this.transformConfig)
3569
+ ), this.hasLayout && At.configure(
3570
+ i,
3571
+ jt(this.layoutConfig)
3572
+ ), this.hasAnimatedLayout && (Kt(
3573
+ i.graph,
3574
+ this.animationStaticNodes
3575
+ ), oe.configure(
3576
+ i,
3577
+ Xt(this.animatedLayoutConfig),
3578
+ this.animationStaticNodes,
3579
+ this.window
3580
+ ));
3229
3581
  const n = () => {
3230
3582
  e.destroy(), i.onBeforeDestroy.unsubscribe(n);
3231
3583
  };
@@ -3233,15 +3585,16 @@ class Ct {
3233
3585
  }
3234
3586
  }
3235
3587
  export {
3236
- tt as BezierEdgeShape,
3237
- Ct as CanvasBuilder,
3238
- Mt as CanvasBuilderError,
3239
- S as CanvasError,
3240
- Pe as DirectEdgeShape,
3241
- rt as HorizontalEdgeShape,
3242
- at as InteractiveEdgeError,
3243
- be as InteractiveEdgeShape,
3244
- Lt as MidpointEdgeShape,
3245
- ot as StraightEdgeShape,
3246
- st as VerticalEdgeShape
3588
+ dt as BezierEdgeShape,
3589
+ Qt as CanvasBuilder,
3590
+ Ot as CanvasBuilderError,
3591
+ P as CanvasError,
3592
+ Ne as DirectEdgeShape,
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
3247
3600
  };