@html-graph/html-graph 3.9.0 → 3.11.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,48 +1,48 @@
1
- var ve = Object.defineProperty;
2
- var ye = (t, e, o) => e in t ? ve(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var r = (t, e, o) => ye(t, typeof e != "symbol" ? e + "" : e, o);
4
- const Ae = () => {
5
- const t = document.createElement("div");
6
- return t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.width = "0", t.style.height = "0", t;
7
- }, Ee = () => {
8
- const t = document.createElement("div");
9
- return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t.style.overflow = "hidden", t;
10
- }, pe = (t) => {
11
- t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.visibility = "hidden";
12
- }, N = (t, e) => ({
13
- x: t.scale * e.x + t.x,
14
- y: t.scale * e.y + t.y
1
+ var fe = Object.defineProperty;
2
+ var ve = (r, e, t) => e in r ? fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => ve(r, typeof e != "symbol" ? e + "" : e, t);
4
+ const ye = () => {
5
+ const r = document.createElement("div");
6
+ return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
7
+ }, me = () => {
8
+ const r = document.createElement("div");
9
+ return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
10
+ }, Ae = (r) => {
11
+ r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
12
+ }, D = (r, e) => ({
13
+ x: r.scale * e.x + r.x,
14
+ y: r.scale * e.y + r.y
15
15
  });
16
16
  class ne {
17
- constructor(e, o, i) {
18
- r(this, "host", Ee());
19
- r(this, "container", Ae());
20
- r(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
- r(this, "applyTransform", () => {
17
+ constructor(e, t, s) {
18
+ o(this, "host", me());
19
+ o(this, "container", ye());
20
+ o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
21
+ o(this, "applyTransform", () => {
22
22
  const e = this.viewportStore.getContentMatrix();
23
23
  this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
24
24
  });
25
- this.graphStore = e, this.viewportStore = o, this.element = i, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
25
+ 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);
26
26
  }
27
27
  attachNode(e) {
28
- const o = this.graphStore.getNode(e);
29
- pe(o.element), this.container.appendChild(o.element), this.updateNodePosition(e), this.updateNodePriority(e), o.element.style.visibility = "visible";
28
+ const t = this.graphStore.getNode(e);
29
+ Ae(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
30
30
  }
31
31
  detachNode(e) {
32
- const o = this.graphStore.getNode(e);
33
- this.container.removeChild(o.element);
32
+ const t = this.graphStore.getNode(e);
33
+ this.container.removeChild(t.element);
34
34
  }
35
35
  attachEdge(e) {
36
- const o = this.graphStore.getEdge(e).shape.svg;
37
- this.edgeIdToElementMap.set(e, o), this.container.appendChild(o), this.renderEdge(e), this.updateEdgePriority(e);
36
+ const t = this.graphStore.getEdge(e).shape.svg;
37
+ this.edgeIdToElementMap.set(e, t), this.container.appendChild(t), this.renderEdge(e), this.updateEdgePriority(e);
38
38
  }
39
39
  detachEdge(e) {
40
- const o = this.edgeIdToElementMap.get(e);
41
- this.container.removeChild(o), this.edgeIdToElementMap.delete(e);
40
+ const t = this.edgeIdToElementMap.get(e);
41
+ this.container.removeChild(t), this.edgeIdToElementMap.delete(e);
42
42
  }
43
43
  clear() {
44
- this.edgeIdToElementMap.forEach((e, o) => {
45
- this.detachEdge(o);
44
+ this.edgeIdToElementMap.forEach((e, t) => {
45
+ this.detachEdge(t);
46
46
  }), this.graphStore.getAllNodeIds().forEach((e) => {
47
47
  this.detachNode(e);
48
48
  });
@@ -51,100 +51,100 @@ class ne {
51
51
  this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.clear(), this.element.removeChild(this.host), this.host.removeChild(this.container);
52
52
  }
53
53
  updateNodePosition(e) {
54
- const o = this.graphStore.getNode(e), { width: i, height: s } = o.element.getBoundingClientRect(), h = this.viewportStore.getViewportMatrix().scale, n = o.centerFn(i, s), d = o.x - h * n.x, c = o.y - h * n.y;
55
- o.element.style.transform = `translate(${d}px, ${c}px)`;
54
+ const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, h = t.centerFn(s, i), a = t.x - n * h.x, d = t.y - n * h.y;
55
+ t.element.style.transform = `translate(${a}px, ${d}px)`;
56
56
  }
57
57
  updateNodePriority(e) {
58
- const o = this.graphStore.getNode(e);
59
- o.element.style.zIndex = `${o.priority}`;
58
+ const t = this.graphStore.getNode(e);
59
+ t.element.style.zIndex = `${t.priority}`;
60
60
  }
61
61
  updateEdgeShape(e) {
62
- const o = this.edgeIdToElementMap.get(e);
63
- this.container.removeChild(o);
64
- const i = this.graphStore.getEdge(e);
65
- this.edgeIdToElementMap.set(e, i.shape.svg), this.container.appendChild(i.shape.svg);
62
+ const t = this.edgeIdToElementMap.get(e);
63
+ this.container.removeChild(t);
64
+ const s = this.graphStore.getEdge(e);
65
+ this.edgeIdToElementMap.set(e, s.shape.svg), this.container.appendChild(s.shape.svg);
66
66
  }
67
67
  renderEdge(e) {
68
- const o = this.graphStore.getEdge(e), i = this.graphStore.getPort(o.from), s = this.graphStore.getPort(o.to), h = i.element.getBoundingClientRect(), n = s.element.getBoundingClientRect(), d = this.host.getBoundingClientRect(), c = this.viewportStore.getViewportMatrix(), a = this.createEdgeRenderPort(
69
- o.from,
70
- i,
71
- h,
72
- d,
73
- c
74
- ), l = this.createEdgeRenderPort(
75
- o.to,
68
+ const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), h = i.element.getBoundingClientRect(), a = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
69
+ t.from,
76
70
  s,
77
71
  n,
78
- d,
79
- c
72
+ a,
73
+ d
74
+ ), g = this.createEdgeRenderPort(
75
+ t.to,
76
+ i,
77
+ h,
78
+ a,
79
+ d
80
80
  );
81
- o.shape.render({ from: a, to: l });
81
+ t.shape.render({ from: c, to: g });
82
82
  }
83
83
  updateEdgePriority(e) {
84
- const o = this.graphStore.getEdge(e);
85
- o.shape.svg.style.zIndex = `${o.priority}`;
86
- }
87
- createEdgeRenderPort(e, o, i, s, h) {
88
- const n = {
89
- x: i.left - s.left,
90
- y: i.top - s.top
91
- }, d = N(h, n);
84
+ const t = this.graphStore.getEdge(e);
85
+ t.shape.svg.style.zIndex = `${t.priority}`;
86
+ }
87
+ createEdgeRenderPort(e, t, s, i, n) {
88
+ const h = {
89
+ x: s.left - i.left,
90
+ y: s.top - i.top
91
+ }, a = D(n, h);
92
92
  return {
93
- x: d.x,
94
- y: d.y,
95
- width: i.width * h.scale,
96
- height: i.height * h.scale,
97
- direction: o.direction,
93
+ x: a.x,
94
+ y: a.y,
95
+ width: s.width * n.scale,
96
+ height: s.height * n.scale,
97
+ direction: t.direction,
98
98
  portId: e,
99
- nodeId: o.nodeId
99
+ nodeId: t.nodeId
100
100
  };
101
101
  }
102
102
  }
103
- class xe {
103
+ class Ee {
104
104
  constructor(e) {
105
- r(this, "xFrom", 1 / 0);
106
- r(this, "yFrom", 1 / 0);
107
- r(this, "xTo", 1 / 0);
108
- r(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 o = this.graphStore.getNode(e);
116
- return o.x >= this.xFrom && o.x <= this.xTo && o.y >= this.yFrom && o.y <= this.yTo;
115
+ const t = this.graphStore.getNode(e);
116
+ return t.x >= this.xFrom && t.x <= this.xTo && t.y >= this.yFrom && t.y <= this.yTo;
117
117
  }
118
118
  hasEdge(e) {
119
- const o = this.graphStore.getEdge(e), i = this.graphStore.getPort(o.from).nodeId, s = this.graphStore.getPort(o.to).nodeId, h = this.graphStore.getNode(i), n = this.graphStore.getNode(s), d = Math.min(h.x, n.x), c = Math.max(h.x, n.x), a = Math.min(h.y, n.y), l = Math.max(h.y, n.y);
120
- return d <= this.xTo && c >= this.xFrom && a <= 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), h = this.graphStore.getNode(i), a = Math.min(n.x, h.x), d = Math.max(n.x, h.x), c = Math.min(n.y, h.y), g = Math.max(n.y, h.y);
120
+ return a <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
121
121
  }
122
122
  }
123
- class Se {
124
- constructor(e, o, i) {
125
- r(this, "attachedNodes", /* @__PURE__ */ new Set());
126
- r(this, "attachedEdges", /* @__PURE__ */ new Set());
127
- r(this, "renderingBox");
128
- r(this, "updateViewport", (e) => {
123
+ class xe {
124
+ constructor(e, t, s) {
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 o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
131
- this.graphStore.getAllNodeIds().forEach((n) => {
132
- const d = this.renderingBox.hasNode(n), c = this.attachedNodes.has(n);
133
- d && !c ? o.add(n) : !d && c && i.add(n);
134
- }), this.graphStore.getAllEdgeIds().forEach((n) => {
135
- const d = this.renderingBox.hasEdge(n), c = this.attachedEdges.has(n), a = this.graphStore.getEdge(n), l = this.graphStore.getPort(a.from).nodeId, w = this.graphStore.getPort(a.to).nodeId;
136
- d && (this.renderingBox.hasNode(l) || (o.add(l), i.delete(l)), this.renderingBox.hasNode(w) || (o.add(w), i.delete(w))), d && !c ? s.add(n) : !d && c && h.add(n);
137
- }), h.forEach((n) => {
138
- this.handleDetachEdge(n);
139
- }), i.forEach((n) => {
140
- this.handleDetachNode(n);
141
- }), o.forEach((n) => {
142
- this.attachedNodes.has(n) || this.handleAttachNode(n);
143
- }), s.forEach((n) => {
144
- this.handleAttachEdge(n);
130
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
131
+ this.graphStore.getAllNodeIds().forEach((h) => {
132
+ const a = this.renderingBox.hasNode(h), d = this.attachedNodes.has(h);
133
+ a && !d ? t.add(h) : !a && d && s.add(h);
134
+ }), this.graphStore.getAllEdgeIds().forEach((h) => {
135
+ const a = this.renderingBox.hasEdge(h), d = this.attachedEdges.has(h), c = this.graphStore.getEdge(h), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
136
+ a && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), a && !d ? i.add(h) : !a && d && n.add(h);
137
+ }), n.forEach((h) => {
138
+ this.handleDetachEdge(h);
139
+ }), s.forEach((h) => {
140
+ this.handleDetachNode(h);
141
+ }), t.forEach((h) => {
142
+ this.attachedNodes.has(h) || this.handleAttachNode(h);
143
+ }), i.forEach((h) => {
144
+ this.handleAttachEdge(h);
145
145
  });
146
146
  });
147
- this.htmlView = e, this.graphStore = o, this.trigger = i, this.renderingBox = new xe(this.graphStore), this.trigger.subscribe(this.updateViewport);
147
+ this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new Ee(this.graphStore), this.trigger.subscribe(this.updateViewport);
148
148
  }
149
149
  attachNode(e) {
150
150
  this.renderingBox.hasNode(e) && this.handleAttachNode(e);
@@ -159,8 +159,8 @@ class Se {
159
159
  this.attachedEdges.has(e) && this.handleDetachEdge(e);
160
160
  }
161
161
  updateNodePosition(e) {
162
- this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((o) => {
163
- this.attachEdgeEntities(o);
162
+ this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
163
+ this.attachEdgeEntities(t);
164
164
  }));
165
165
  }
166
166
  updateNodePriority(e) {
@@ -182,8 +182,8 @@ class Se {
182
182
  this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
183
183
  }
184
184
  attachEdgeEntities(e) {
185
- const o = this.graphStore.getEdge(e), i = this.graphStore.getPort(o.from).nodeId, s = this.graphStore.getPort(o.to).nodeId;
186
- this.attachedNodes.has(i) || this.handleAttachNode(i), this.attachedNodes.has(s) || this.handleAttachNode(s), 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.attachedNodes.add(e), this.htmlView.attachNode(e);
@@ -200,7 +200,7 @@ class Se {
200
200
  }
201
201
  class he {
202
202
  constructor() {
203
- r(this, "callbacks", /* @__PURE__ */ new Set());
203
+ o(this, "callbacks", /* @__PURE__ */ new Set());
204
204
  }
205
205
  subscribe(e) {
206
206
  this.callbacks.add(e);
@@ -209,19 +209,19 @@ class he {
209
209
  this.callbacks.delete(e);
210
210
  }
211
211
  emit(e) {
212
- this.callbacks.forEach((o) => {
213
- o(e);
212
+ this.callbacks.forEach((t) => {
213
+ t(e);
214
214
  });
215
215
  }
216
216
  }
217
- const x = () => {
218
- const t = new he();
219
- return [t, t];
217
+ const E = () => {
218
+ const r = new he();
219
+ return [r, r];
220
220
  };
221
- class be {
221
+ class Se {
222
222
  constructor(e) {
223
- r(this, "onBeforeUpdated");
224
- r(this, "onAfterUpdated");
223
+ o(this, "onBeforeUpdated");
224
+ o(this, "onAfterUpdated");
225
225
  this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
226
226
  }
227
227
  getViewportMatrix() {
@@ -231,31 +231,31 @@ class be {
231
231
  return { ...this.viewportStore.getContentMatrix() };
232
232
  }
233
233
  }
234
- class Te {
234
+ class be {
235
235
  constructor(e) {
236
- r(this, "onAfterNodeAdded");
237
- r(this, "onAfterNodeUpdated");
238
- r(this, "onAfterNodePriorityUpdated");
239
- r(this, "onBeforeNodeRemoved");
240
- r(this, "onAfterPortMarked");
241
- r(this, "onAfterPortUpdated");
242
- r(this, "onBeforePortUnmarked");
243
- r(this, "onAfterEdgeAdded");
244
- r(this, "onAfterEdgeShapeUpdated");
245
- r(this, "onAfterEdgeUpdated");
246
- r(this, "onAfterEdgePriorityUpdated");
247
- r(this, "onBeforeEdgeRemoved");
248
- r(this, "onBeforeClear");
236
+ o(this, "onAfterNodeAdded");
237
+ o(this, "onAfterNodeUpdated");
238
+ o(this, "onAfterNodePriorityUpdated");
239
+ o(this, "onBeforeNodeRemoved");
240
+ o(this, "onAfterPortMarked");
241
+ o(this, "onAfterPortUpdated");
242
+ o(this, "onBeforePortUnmarked");
243
+ o(this, "onAfterEdgeAdded");
244
+ o(this, "onAfterEdgeShapeUpdated");
245
+ o(this, "onAfterEdgeUpdated");
246
+ o(this, "onAfterEdgePriorityUpdated");
247
+ o(this, "onBeforeEdgeRemoved");
248
+ o(this, "onBeforeClear");
249
249
  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;
250
250
  }
251
251
  getNode(e) {
252
- const o = this.graphStore.getNode(e);
253
- return o === void 0 ? null : {
254
- element: o.element,
255
- x: o.x,
256
- y: o.y,
257
- centerFn: o.centerFn,
258
- priority: o.priority
252
+ const t = this.graphStore.getNode(e);
253
+ return t === void 0 ? null : {
254
+ element: t.element,
255
+ x: t.x,
256
+ y: t.y,
257
+ centerFn: t.centerFn,
258
+ priority: t.priority
259
259
  };
260
260
  }
261
261
  getElementNodeId(e) {
@@ -266,11 +266,11 @@ class Te {
266
266
  return this.graphStore.getAllNodeIds();
267
267
  }
268
268
  getPort(e) {
269
- const o = this.graphStore.getPort(e);
270
- return o === void 0 ? null : {
271
- element: o.element,
272
- direction: o.direction,
273
- nodeId: o.nodeId
269
+ const t = this.graphStore.getPort(e);
270
+ return t === void 0 ? null : {
271
+ element: t.element,
272
+ direction: t.direction,
273
+ nodeId: t.nodeId
274
274
  };
275
275
  }
276
276
  // TODO: use Set in v4
@@ -290,8 +290,8 @@ class Te {
290
290
  return this.graphStore.getAllEdgeIds();
291
291
  }
292
292
  getEdge(e) {
293
- const o = this.graphStore.getEdge(e);
294
- return o === void 0 ? null : { from: o.from, to: o.to, priority: o.priority };
293
+ const t = this.graphStore.getEdge(e);
294
+ return t === void 0 ? null : { from: t.from, to: t.to, priority: t.priority };
295
295
  }
296
296
  // TODO: use Set in v4
297
297
  getPortIncomingEdgeIds(e) {
@@ -326,9 +326,9 @@ class Te {
326
326
  return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
327
327
  }
328
328
  }
329
- class W {
329
+ class $ {
330
330
  constructor(e) {
331
- r(this, "counter", 0);
331
+ o(this, "counter", 0);
332
332
  this.checkExists = e;
333
333
  }
334
334
  create(e) {
@@ -342,123 +342,123 @@ class W {
342
342
  this.counter = 0;
343
343
  }
344
344
  }
345
- class S extends Error {
345
+ class x extends Error {
346
346
  constructor() {
347
347
  super(...arguments);
348
- r(this, "name", "HtmlGraphError");
348
+ o(this, "name", "HtmlGraphError");
349
349
  }
350
350
  }
351
- class de {
352
- constructor(e, o, i, s, h) {
351
+ class ae {
352
+ constructor(e, t, s, i, n) {
353
353
  /**
354
354
  * provides api for accessing model of rendered graph
355
355
  */
356
- r(this, "graph");
356
+ o(this, "graph");
357
357
  /**
358
358
  * provides api for accessing viewport state
359
359
  */
360
- r(this, "viewport");
361
- r(this, "nodeIdGenerator", new W(
360
+ o(this, "viewport");
361
+ o(this, "nodeIdGenerator", new $(
362
362
  (e) => this.graph.getNode(e) !== null
363
363
  ));
364
- r(this, "portIdGenerator", new W(
364
+ o(this, "portIdGenerator", new $(
365
365
  (e) => this.graph.getPort(e) !== null
366
366
  ));
367
- r(this, "edgeIdGenerator", new W(
367
+ o(this, "edgeIdGenerator", new $(
368
368
  (e) => this.graph.getEdge(e) !== null
369
369
  ));
370
- r(this, "onAfterNodeAdded", (e) => {
370
+ o(this, "onAfterNodeAdded", (e) => {
371
371
  this.htmlView.attachNode(e);
372
372
  });
373
- r(this, "onAfterNodeUpdated", (e) => {
374
- this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((i) => {
375
- this.htmlView.renderEdge(i);
373
+ o(this, "onAfterNodeUpdated", (e) => {
374
+ this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
375
+ this.htmlView.renderEdge(s);
376
376
  });
377
377
  });
378
- r(this, "onAfterNodePriorityUpdated", (e) => {
378
+ o(this, "onAfterNodePriorityUpdated", (e) => {
379
379
  this.htmlView.updateNodePriority(e);
380
380
  });
381
- r(this, "onBeforeNodeRemoved", (e) => {
382
- this.graphStore.getNodePortIds(e).forEach((o) => {
383
- this.unmarkPort(o);
381
+ o(this, "onBeforeNodeRemoved", (e) => {
382
+ this.graphStore.getNodePortIds(e).forEach((t) => {
383
+ this.unmarkPort(t);
384
384
  }), this.htmlView.detachNode(e);
385
385
  });
386
- r(this, "onAfterPortUpdated", (e) => {
387
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((i) => {
388
- this.htmlView.renderEdge(i);
386
+ o(this, "onAfterPortUpdated", (e) => {
387
+ this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
388
+ this.htmlView.renderEdge(s);
389
389
  });
390
390
  });
391
- r(this, "onBeforePortUnmarked", (e) => {
392
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((o) => {
393
- this.removeEdge(o);
391
+ o(this, "onBeforePortUnmarked", (e) => {
392
+ this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
393
+ this.removeEdge(t);
394
394
  });
395
395
  });
396
- r(this, "onAfterEdgeAdded", (e) => {
396
+ o(this, "onAfterEdgeAdded", (e) => {
397
397
  this.htmlView.attachEdge(e);
398
398
  });
399
- r(this, "onAfterEdgeShapeUpdated", (e) => {
399
+ o(this, "onAfterEdgeShapeUpdated", (e) => {
400
400
  this.htmlView.updateEdgeShape(e);
401
401
  });
402
- r(this, "onAfterEdgeUpdated", (e) => {
402
+ o(this, "onAfterEdgeUpdated", (e) => {
403
403
  this.htmlView.renderEdge(e);
404
404
  });
405
- r(this, "onAfterEdgePriorityUpdated", (e) => {
405
+ o(this, "onAfterEdgePriorityUpdated", (e) => {
406
406
  this.htmlView.updateEdgePriority(e);
407
407
  });
408
- r(this, "onBeforeEdgeRemoved", (e) => {
408
+ o(this, "onBeforeEdgeRemoved", (e) => {
409
409
  this.htmlView.detachEdge(e);
410
410
  });
411
- r(this, "onBeforeClear", () => {
411
+ o(this, "onBeforeClear", () => {
412
412
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
413
413
  });
414
- r(this, "onBeforeDestroyEmitter");
414
+ o(this, "onBeforeDestroyEmitter");
415
415
  /**
416
416
  * emits event just before destruction of canvas
417
417
  */
418
- r(this, "onBeforeDestroy");
419
- this.element = e, this.graphStore = o, this.viewportStore = i, this.htmlView = s, this.defaults = h, this.graph = new Te(this.graphStore), this.viewport = new be(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
418
+ o(this, "onBeforeDestroy");
419
+ this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.defaults = n, this.graph = new be(this.graphStore), this.viewport = new Se(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
420
420
  this.onAfterNodePriorityUpdated
421
421
  ), 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(
422
422
  this.onAfterEdgeShapeUpdated
423
423
  ), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
424
424
  this.onAfterEdgePriorityUpdated
425
- ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = x();
425
+ ), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
426
426
  }
427
427
  /**
428
428
  * adds new node
429
429
  */
430
430
  addNode(e) {
431
- const o = this.nodeIdGenerator.create(e.id);
432
- if (this.graph.getNode(o) !== null)
433
- throw new S("failed to add node with existing id");
431
+ const t = this.nodeIdGenerator.create(e.id);
432
+ if (this.graph.getNode(t) !== null)
433
+ throw new x("failed to add node with existing id");
434
434
  if (this.graphStore.getElementNodeId(e.element) !== void 0)
435
- throw new S(
435
+ throw new x(
436
436
  "failed to add node with html element already in use by another node"
437
437
  );
438
438
  if (this.graphStore.addNode({
439
- id: o,
439
+ id: t,
440
440
  element: e.element,
441
441
  x: e.x,
442
442
  y: e.y,
443
443
  centerFn: e.centerFn ?? this.defaults.nodes.centerFn,
444
444
  priority: e.priority ?? this.defaults.nodes.priorityFn()
445
445
  }), e.ports !== void 0)
446
- for (const i of e.ports)
446
+ for (const s of e.ports)
447
447
  this.markPort({
448
- id: i.id,
449
- element: i.element,
450
- nodeId: o,
451
- direction: i.direction
448
+ id: s.id,
449
+ element: s.element,
450
+ nodeId: t,
451
+ direction: s.direction
452
452
  });
453
453
  return this;
454
454
  }
455
455
  /**
456
456
  * updates node parameters
457
457
  */
458
- updateNode(e, o) {
458
+ updateNode(e, t) {
459
459
  if (this.graph.getNode(e) === null)
460
- throw new S("failed to update non existing node");
461
- return this.graphStore.updateNode(e, o ?? {}), this;
460
+ throw new x("failed to update non existing node");
461
+ return this.graphStore.updateNode(e, t ?? {}), this;
462
462
  }
463
463
  /**
464
464
  * removes specified node
@@ -467,20 +467,20 @@ class de {
467
467
  */
468
468
  removeNode(e) {
469
469
  if (this.graph.getNode(e) === null)
470
- throw new S("failed to remove non existing node");
470
+ throw new x("failed to remove non existing node");
471
471
  return this.graphStore.removeNode(e), this;
472
472
  }
473
473
  /**
474
474
  * marks specified element as a port for specified node
475
475
  */
476
476
  markPort(e) {
477
- const o = this.portIdGenerator.create(e.id);
478
- if (this.graph.getPort(o) !== null)
479
- throw new S("failed to add port with existing id");
477
+ const t = this.portIdGenerator.create(e.id);
478
+ if (this.graph.getPort(t) !== null)
479
+ throw new x("failed to add port with existing id");
480
480
  if (this.graph.getNode(e.nodeId) === null)
481
- throw new S("failed to mark port for nonexistent node");
481
+ throw new x("failed to mark port for nonexistent node");
482
482
  return this.graphStore.addPort({
483
- id: o,
483
+ id: t,
484
484
  element: e.element,
485
485
  nodeId: e.nodeId,
486
486
  direction: e.direction ?? this.defaults.ports.direction
@@ -489,10 +489,10 @@ class de {
489
489
  /**
490
490
  * updates port and edges attached to it
491
491
  */
492
- updatePort(e, o) {
492
+ updatePort(e, t) {
493
493
  if (this.graph.getPort(e) === null)
494
- throw new S("failed to update nonexistent port");
495
- return this.graphStore.updatePort(e, o ?? {}), this;
494
+ throw new x("failed to update nonexistent port");
495
+ return this.graphStore.updatePort(e, t ?? {}), this;
496
496
  }
497
497
  /**
498
498
  * unmarks specified port
@@ -500,42 +500,42 @@ class de {
500
500
  */
501
501
  unmarkPort(e) {
502
502
  if (this.graph.getPort(e) === null)
503
- throw new S("failed to unmark non existing port");
503
+ throw new x("failed to unmark non existing port");
504
504
  return this.graphStore.removePort(e), this;
505
505
  }
506
506
  /**
507
507
  * adds new edge
508
508
  */
509
509
  addEdge(e) {
510
- const o = this.edgeIdGenerator.create(e.id);
511
- if (this.graph.getEdge(o) !== null)
512
- throw new S("failed to add edge with existing id");
510
+ const t = this.edgeIdGenerator.create(e.id);
511
+ if (this.graph.getEdge(t) !== null)
512
+ throw new x("failed to add edge with existing id");
513
513
  if (this.graph.getPort(e.from) === null)
514
- throw new S("failed to add edge from nonexistent port");
514
+ throw new x("failed to add edge from nonexistent port");
515
515
  if (this.graph.getPort(e.to) === null)
516
- throw new S("failed to add edge to nonexistent port");
516
+ throw new x("failed to add edge to nonexistent port");
517
517
  return this.graphStore.addEdge({
518
- id: o,
518
+ id: t,
519
519
  from: e.from,
520
520
  to: e.to,
521
- shape: e.shape ?? this.defaults.edges.shapeFactory(o),
521
+ shape: e.shape ?? this.defaults.edges.shapeFactory(t),
522
522
  priority: e.priority ?? this.defaults.edges.priorityFn()
523
523
  }), this;
524
524
  }
525
525
  /**
526
526
  * updates specified edge
527
527
  */
528
- updateEdge(e, o) {
528
+ updateEdge(e, t) {
529
529
  if (this.graph.getEdge(e) === null)
530
- throw new S("failed to update nonexistent edge");
531
- return this.graphStore.updateEdge(e, o ?? {}), this;
530
+ throw new x("failed to update nonexistent edge");
531
+ return this.graphStore.updateEdge(e, t ?? {}), this;
532
532
  }
533
533
  /**
534
534
  * removes specified edge
535
535
  */
536
536
  removeEdge(e) {
537
537
  if (this.graph.getEdge(e) === null)
538
- throw new S("failed to remove nonexistent edge");
538
+ throw new x("failed to remove nonexistent edge");
539
539
  return this.graphStore.removeEdge(e), this;
540
540
  }
541
541
  /**
@@ -571,37 +571,37 @@ class de {
571
571
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
572
572
  }
573
573
  }
574
- class Pe {
574
+ class Te {
575
575
  constructor() {
576
- r(this, "singleToMultiMap", /* @__PURE__ */ new Map());
577
- r(this, "multiToSingleMap", /* @__PURE__ */ new Map());
576
+ o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
577
+ o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
578
578
  }
579
- addRecord(e, o) {
580
- const i = this.singleToMultiMap.get(e);
581
- i === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([o])) : i.add(o), this.multiToSingleMap.set(o, e);
579
+ addRecord(e, t) {
580
+ const s = this.singleToMultiMap.get(e);
581
+ s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
582
582
  }
583
583
  getMultiBySingle(e) {
584
- const o = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
585
- return Array.from(o.values());
584
+ const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
585
+ return Array.from(t.values());
586
586
  }
587
587
  removeByMulti(e) {
588
- const o = this.multiToSingleMap.get(e), i = this.singleToMultiMap.get(o);
589
- i.delete(e), i.size === 0 && this.singleToMultiMap.delete(o), this.multiToSingleMap.delete(e);
588
+ const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
589
+ s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
590
590
  }
591
591
  getByMulti(e) {
592
592
  return this.multiToSingleMap.get(e);
593
593
  }
594
594
  removeBySingle(e) {
595
- this.singleToMultiMap.get(e).forEach((i) => {
596
- this.multiToSingleMap.delete(i);
595
+ this.singleToMultiMap.get(e).forEach((s) => {
596
+ this.multiToSingleMap.delete(s);
597
597
  }), this.singleToMultiMap.delete(e);
598
598
  }
599
599
  clear() {
600
600
  this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
601
601
  }
602
602
  forEachSingle(e) {
603
- this.singleToMultiMap.forEach((o, i) => {
604
- e(i);
603
+ this.singleToMultiMap.forEach((t, s) => {
604
+ e(s);
605
605
  });
606
606
  }
607
607
  hasSingle(e) {
@@ -611,54 +611,54 @@ class Pe {
611
611
  return this.multiToSingleMap.get(e) !== void 0;
612
612
  }
613
613
  }
614
- class ce {
614
+ class de {
615
615
  constructor() {
616
- r(this, "nodes", /* @__PURE__ */ new Map());
617
- r(this, "ports", /* @__PURE__ */ new Map());
618
- r(this, "edges", /* @__PURE__ */ new Map());
619
- r(this, "nodesElementsMap", /* @__PURE__ */ new Map());
620
- r(this, "incomingEdges", /* @__PURE__ */ new Map());
621
- r(this, "outcomingEdges", /* @__PURE__ */ new Map());
622
- r(this, "cycleEdges", /* @__PURE__ */ new Map());
623
- r(this, "elementPorts", new Pe());
624
- r(this, "afterNodeAddedEmitter");
625
- r(this, "onAfterNodeAdded");
626
- r(this, "afterNodeUpdatedEmitter");
627
- r(this, "onAfterNodeUpdated");
628
- r(this, "afterNodePriorityUpdatedEmitter");
629
- r(this, "onAfterNodePriorityUpdated");
630
- r(this, "beforeNodeRemovedEmitter");
631
- r(this, "onBeforeNodeRemoved");
632
- r(this, "afterPortAddedEmitter");
633
- r(this, "onAfterPortAdded");
634
- r(this, "afterPortUpdatedEmitter");
635
- r(this, "onAfterPortUpdated");
636
- r(this, "beforePortRemovedEmitter");
637
- r(this, "onBeforePortRemoved");
638
- r(this, "afterEdgeAddedEmitter");
639
- r(this, "onAfterEdgeAdded");
640
- r(this, "afterEdgeShapeUpdatedEmitter");
641
- r(this, "onAfterEdgeShapeUpdated");
642
- r(this, "afterEdgeUpdatedEmitter");
643
- r(this, "onAfterEdgeUpdated");
644
- r(this, "afterEdgePriorityUpdatedEmitter");
645
- r(this, "onAfterEdgePriorityUpdated");
646
- r(this, "beforeEdgeRemovedEmitter");
647
- r(this, "onBeforeEdgeRemoved");
648
- r(this, "beforeClearEmitter");
649
- r(this, "onBeforeClear");
650
- [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = x(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = x(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = x(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = x(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = x(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = x(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = x(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = x(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = x(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = x(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = x(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = x(), [this.beforeClearEmitter, this.onBeforeClear] = x();
616
+ o(this, "nodes", /* @__PURE__ */ new Map());
617
+ o(this, "ports", /* @__PURE__ */ new Map());
618
+ o(this, "edges", /* @__PURE__ */ new Map());
619
+ o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
620
+ o(this, "incomingEdges", /* @__PURE__ */ new Map());
621
+ o(this, "outcomingEdges", /* @__PURE__ */ new Map());
622
+ o(this, "cycleEdges", /* @__PURE__ */ new Map());
623
+ o(this, "elementPorts", new Te());
624
+ o(this, "afterNodeAddedEmitter");
625
+ o(this, "onAfterNodeAdded");
626
+ o(this, "afterNodeUpdatedEmitter");
627
+ o(this, "onAfterNodeUpdated");
628
+ o(this, "afterNodePriorityUpdatedEmitter");
629
+ o(this, "onAfterNodePriorityUpdated");
630
+ o(this, "beforeNodeRemovedEmitter");
631
+ o(this, "onBeforeNodeRemoved");
632
+ o(this, "afterPortAddedEmitter");
633
+ o(this, "onAfterPortAdded");
634
+ o(this, "afterPortUpdatedEmitter");
635
+ o(this, "onAfterPortUpdated");
636
+ o(this, "beforePortRemovedEmitter");
637
+ o(this, "onBeforePortRemoved");
638
+ o(this, "afterEdgeAddedEmitter");
639
+ o(this, "onAfterEdgeAdded");
640
+ o(this, "afterEdgeShapeUpdatedEmitter");
641
+ o(this, "onAfterEdgeShapeUpdated");
642
+ o(this, "afterEdgeUpdatedEmitter");
643
+ o(this, "onAfterEdgeUpdated");
644
+ o(this, "afterEdgePriorityUpdatedEmitter");
645
+ o(this, "onAfterEdgePriorityUpdated");
646
+ o(this, "beforeEdgeRemovedEmitter");
647
+ o(this, "onBeforeEdgeRemoved");
648
+ o(this, "beforeClearEmitter");
649
+ o(this, "onBeforeClear");
650
+ [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();
651
651
  }
652
652
  addNode(e) {
653
- const o = /* @__PURE__ */ new Map(), i = {
653
+ const t = /* @__PURE__ */ new Map(), s = {
654
654
  element: e.element,
655
655
  x: e.x,
656
656
  y: e.y,
657
657
  centerFn: e.centerFn,
658
658
  priority: e.priority,
659
- ports: o
659
+ ports: t
660
660
  };
661
- this.nodes.set(e.id, i), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
661
+ this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
662
662
  }
663
663
  getAllNodeIds() {
664
664
  return Array.from(this.nodes.keys());
@@ -669,14 +669,14 @@ class ce {
669
669
  getElementNodeId(e) {
670
670
  return this.nodesElementsMap.get(e);
671
671
  }
672
- updateNode(e, o) {
673
- const i = this.nodes.get(e);
674
- i.x = o.x ?? i.x, i.y = o.y ?? i.y, i.centerFn = o.centerFn ?? i.centerFn, o.priority !== void 0 && (i.priority = o.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
672
+ updateNode(e, t) {
673
+ const s = this.nodes.get(e);
674
+ 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);
675
675
  }
676
676
  removeNode(e) {
677
677
  this.beforeNodeRemovedEmitter.emit(e);
678
- const o = this.nodes.get(e);
679
- this.nodesElementsMap.delete(o.element), this.nodes.delete(e);
678
+ const t = this.nodes.get(e);
679
+ this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
680
680
  }
681
681
  addPort(e) {
682
682
  this.ports.set(e.id, {
@@ -688,9 +688,9 @@ class ce {
688
688
  getPort(e) {
689
689
  return this.ports.get(e);
690
690
  }
691
- updatePort(e, o) {
692
- const i = this.ports.get(e);
693
- i.direction = o.direction ?? i.direction, this.afterPortUpdatedEmitter.emit(e);
691
+ updatePort(e, t) {
692
+ const s = this.ports.get(e);
693
+ s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
694
694
  }
695
695
  getAllPortIds() {
696
696
  return Array.from(this.ports.keys());
@@ -699,30 +699,30 @@ class ce {
699
699
  return this.elementPorts.getMultiBySingle(e);
700
700
  }
701
701
  getNodePortIds(e) {
702
- const o = this.nodes.get(e);
703
- if (o !== void 0)
704
- return Array.from(o.ports.keys());
702
+ const t = this.nodes.get(e);
703
+ if (t !== void 0)
704
+ return Array.from(t.ports.keys());
705
705
  }
706
706
  removePort(e) {
707
- const o = this.ports.get(e).nodeId;
708
- this.beforePortRemovedEmitter.emit(e), this.nodes.get(o).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
707
+ const t = this.ports.get(e).nodeId;
708
+ this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
709
709
  }
710
710
  addEdge(e) {
711
711
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
712
712
  }
713
- updateEdge(e, o) {
714
- if (o.from !== void 0 || o.to !== void 0) {
715
- const s = this.edges.get(e);
713
+ updateEdge(e, t) {
714
+ if (t.from !== void 0 || t.to !== void 0) {
715
+ const i = this.edges.get(e);
716
716
  this.removeEdgeInternal(e), this.addEdgeInternal({
717
717
  id: e,
718
- from: o.from ?? s.from,
719
- to: o.to ?? s.to,
720
- shape: s.shape,
721
- priority: s.priority
718
+ from: t.from ?? i.from,
719
+ to: t.to ?? i.to,
720
+ shape: i.shape,
721
+ priority: i.priority
722
722
  });
723
723
  }
724
- const i = this.edges.get(e);
725
- o.shape !== void 0 && (i.shape = o.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), o.priority !== void 0 && (i.priority = o.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
724
+ const s = this.edges.get(e);
725
+ t.shape !== void 0 && (s.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (s.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
726
726
  }
727
727
  getAllEdgeIds() {
728
728
  return Array.from(this.edges.keys());
@@ -753,25 +753,25 @@ class ce {
753
753
  ];
754
754
  }
755
755
  getNodeIncomingEdgeIds(e) {
756
- const o = Array.from(this.nodes.get(e).ports.keys());
757
- let i = [];
758
- return o.forEach((s) => {
759
- i = [...i, ...this.getPortIncomingEdgeIds(s)];
760
- }), i;
756
+ const t = Array.from(this.nodes.get(e).ports.keys());
757
+ let s = [];
758
+ return t.forEach((i) => {
759
+ s = [...s, ...this.getPortIncomingEdgeIds(i)];
760
+ }), s;
761
761
  }
762
762
  getNodeOutcomingEdgeIds(e) {
763
- const o = Array.from(this.nodes.get(e).ports.keys());
764
- let i = [];
765
- return o.forEach((s) => {
766
- i = [...i, ...this.getPortOutcomingEdgeIds(s)];
767
- }), i;
763
+ const t = Array.from(this.nodes.get(e).ports.keys());
764
+ let s = [];
765
+ return t.forEach((i) => {
766
+ s = [...s, ...this.getPortOutcomingEdgeIds(i)];
767
+ }), s;
768
768
  }
769
769
  getNodeCycleEdgeIds(e) {
770
- const o = Array.from(this.nodes.get(e).ports.keys());
771
- let i = [];
772
- return o.forEach((s) => {
773
- i = [...i, ...this.getPortCycleEdgeIds(s)];
774
- }), i;
770
+ const t = Array.from(this.nodes.get(e).ports.keys());
771
+ let s = [];
772
+ return t.forEach((i) => {
773
+ s = [...s, ...this.getPortCycleEdgeIds(i)];
774
+ }), s;
775
775
  }
776
776
  getNodeAdjacentEdgeIds(e) {
777
777
  return [
@@ -789,28 +789,28 @@ class ce {
789
789
  }), 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);
790
790
  }
791
791
  removeEdgeInternal(e) {
792
- const o = this.edges.get(e), i = o.from, s = o.to;
793
- this.cycleEdges.get(i).delete(e), this.cycleEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.edges.delete(e);
792
+ const t = this.edges.get(e), s = t.from, i = t.to;
793
+ this.cycleEdges.get(s).delete(e), this.cycleEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.edges.delete(e);
794
794
  }
795
795
  }
796
- const _ = (t) => ({
797
- scale: 1 / t.scale,
798
- x: -t.x / t.scale,
799
- y: -t.y / t.scale
800
- }), q = {
796
+ const q = (r) => ({
797
+ scale: 1 / r.scale,
798
+ x: -r.x / r.scale,
799
+ y: -r.y / r.scale
800
+ }), ee = {
801
801
  scale: 1,
802
802
  x: 0,
803
803
  y: 0
804
804
  };
805
- class me {
805
+ class Pe {
806
806
  constructor() {
807
- r(this, "viewportMatrix", q);
808
- r(this, "contentMatrix", q);
809
- r(this, "afterUpdateEmitter");
810
- r(this, "onAfterUpdated");
811
- r(this, "beforeUpdateEmitter");
812
- r(this, "onBeforeUpdated");
813
- [this.afterUpdateEmitter, this.onAfterUpdated] = x(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = x();
807
+ o(this, "viewportMatrix", ee);
808
+ o(this, "contentMatrix", ee);
809
+ o(this, "afterUpdateEmitter");
810
+ o(this, "onAfterUpdated");
811
+ o(this, "beforeUpdateEmitter");
812
+ o(this, "onBeforeUpdated");
813
+ [this.afterUpdateEmitter, this.onAfterUpdated] = E(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = E();
814
814
  }
815
815
  getViewportMatrix() {
816
816
  return this.viewportMatrix;
@@ -823,38 +823,38 @@ class me {
823
823
  scale: e.scale ?? this.viewportMatrix.scale,
824
824
  x: e.x ?? this.viewportMatrix.x,
825
825
  y: e.y ?? this.viewportMatrix.y
826
- }, this.contentMatrix = _(this.viewportMatrix), this.afterUpdateEmitter.emit();
826
+ }, this.contentMatrix = q(this.viewportMatrix), this.afterUpdateEmitter.emit();
827
827
  }
828
828
  patchContentMatrix(e) {
829
829
  this.beforeUpdateEmitter.emit(), this.contentMatrix = {
830
830
  scale: e.scale ?? this.contentMatrix.scale,
831
831
  x: e.x ?? this.contentMatrix.x,
832
832
  y: e.y ?? this.contentMatrix.y
833
- }, this.viewportMatrix = _(this.contentMatrix), this.afterUpdateEmitter.emit();
833
+ }, this.viewportMatrix = q(this.contentMatrix), this.afterUpdateEmitter.emit();
834
834
  }
835
835
  }
836
836
  class k {
837
837
  constructor(e) {
838
- r(this, "elementToNodeId", /* @__PURE__ */ new Map());
839
- r(this, "nodesResizeObserver");
840
- r(this, "onAfterNodeAdded", (e) => {
841
- const o = this.canvas.graph.getNode(e);
842
- this.elementToNodeId.set(o.element, e), this.nodesResizeObserver.observe(o.element);
838
+ o(this, "elementToNodeId", /* @__PURE__ */ new Map());
839
+ o(this, "nodesResizeObserver");
840
+ o(this, "onAfterNodeAdded", (e) => {
841
+ const t = this.canvas.graph.getNode(e);
842
+ this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
843
843
  });
844
- r(this, "onBeforeNodeRemoved", (e) => {
845
- const o = this.canvas.graph.getNode(e);
846
- this.elementToNodeId.delete(o.element), this.nodesResizeObserver.unobserve(o.element);
844
+ o(this, "onBeforeNodeRemoved", (e) => {
845
+ const t = this.canvas.graph.getNode(e);
846
+ this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
847
847
  });
848
- r(this, "onBeforeClear", () => {
848
+ o(this, "onBeforeClear", () => {
849
849
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
850
850
  });
851
- r(this, "onBeforeDestroy", () => {
851
+ o(this, "onBeforeDestroy", () => {
852
852
  this.canvas.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
853
853
  });
854
- this.canvas = e, this.nodesResizeObserver = new ResizeObserver((o) => {
855
- o.forEach((i) => {
856
- const s = i.target;
857
- this.handleNodeResize(s);
854
+ this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
855
+ t.forEach((s) => {
856
+ const i = s.target;
857
+ this.handleNodeResize(i);
858
858
  });
859
859
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
860
860
  }
@@ -862,91 +862,91 @@ class k {
862
862
  new k(e);
863
863
  }
864
864
  handleNodeResize(e) {
865
- const o = this.elementToNodeId.get(e);
866
- this.canvas.updateNode(o);
865
+ const t = this.elementToNodeId.get(e);
866
+ this.canvas.updateNode(t);
867
867
  }
868
868
  }
869
- const Ne = (t) => {
870
- var v, A, y, E, p, b;
871
- const e = ((v = t == null ? void 0 : t.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
872
- }), o = ((A = t == null ? void 0 : t.events) == null ? void 0 : A.onBeforeNodeDrag) ?? (() => !0), i = ((y = t == null ? void 0 : t.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
873
- }), s = (t == null ? void 0 : t.moveOnTop) !== !1, h = (t == null ? void 0 : t.moveEdgesOnTop) !== !1 && s, n = (E = t == null ? void 0 : t.mouse) == null ? void 0 : E.dragCursor, d = n !== void 0 ? n : "grab", c = (p = t == null ? void 0 : t.mouse) == null ? void 0 : p.mouseDownEventVerifier, a = c !== void 0 ? c : (T) => T.button === 0, l = (b = t == null ? void 0 : t.mouse) == null ? void 0 : b.mouseUpEventVerifier;
869
+ const De = (r) => {
870
+ var v, p, f, A, m, S;
871
+ const e = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
872
+ }), t = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onBeforeNodeDrag) ?? (() => !0), s = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
873
+ }), i = (r == null ? void 0 : r.moveOnTop) !== !1, n = (r == null ? void 0 : r.moveEdgesOnTop) !== !1 && i, h = (A = r == null ? void 0 : r.mouse) == null ? void 0 : A.dragCursor, a = h !== void 0 ? h : "grab", d = (m = r == null ? void 0 : r.mouse) == null ? void 0 : m.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, g = (S = r == null ? void 0 : r.mouse) == null ? void 0 : S.mouseUpEventVerifier;
874
874
  return {
875
- moveOnTop: s,
876
- moveEdgesOnTop: h,
877
- dragCursor: d,
878
- mouseDownEventVerifier: a,
879
- mouseUpEventVerifier: l !== void 0 ? l : (T) => T.button === 0,
875
+ moveOnTop: i,
876
+ moveEdgesOnTop: n,
877
+ dragCursor: a,
878
+ mouseDownEventVerifier: c,
879
+ mouseUpEventVerifier: g !== void 0 ? g : (b) => b.button === 0,
880
880
  onNodeDrag: e,
881
- onBeforeNodeDrag: o,
882
- onNodeDragFinished: i
881
+ onBeforeNodeDrag: t,
882
+ onNodeDragFinished: s
883
883
  };
884
- }, De = (t, e, o) => {
885
- const { x: i, y: s, width: h, height: n } = t.getBoundingClientRect();
886
- return e >= i && e <= i + h && o >= s && o <= s + n;
887
- }, Me = (t, e, o) => e >= 0 && e <= t.innerWidth && o >= 0 && o <= t.innerHeight, D = (t, e, o, i) => De(e, o, i) && Me(t, o, i), I = (t, e) => {
888
- e !== null ? t.style.cursor = e : t.style.removeProperty("cursor");
884
+ }, Ne = (r, e, t) => {
885
+ const { x: s, y: i, width: n, height: h } = r.getBoundingClientRect();
886
+ return e >= s && e <= s + n && t >= i && t <= i + h;
887
+ }, Me = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, N = (r, e, t, s) => Ne(e, t, s) && Me(r, t, s), B = (r, e) => {
888
+ e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
889
889
  };
890
890
  class z {
891
- constructor(e, o, i, s) {
892
- r(this, "grabbedNodeId", null);
893
- r(this, "maxNodePriority", 0);
894
- r(this, "previousTouchCoordinates", null);
895
- r(this, "graph");
896
- r(this, "onAfterNodeAdded", (e) => {
891
+ constructor(e, t, s, i) {
892
+ o(this, "grabbedNodeId", null);
893
+ o(this, "maxNodePriority", 0);
894
+ o(this, "previousTouchCoordinates", null);
895
+ o(this, "graph");
896
+ o(this, "onAfterNodeAdded", (e) => {
897
897
  this.updateMaxNodePriority(e);
898
- const o = this.graph.getNode(e);
899
- o.element.addEventListener("mousedown", this.onMouseDown, {
898
+ const t = this.graph.getNode(e);
899
+ t.element.addEventListener("mousedown", this.onMouseDown, {
900
900
  passive: !0
901
- }), o.element.addEventListener("touchstart", this.onTouchStart, {
901
+ }), t.element.addEventListener("touchstart", this.onTouchStart, {
902
902
  passive: !0
903
903
  });
904
904
  });
905
- r(this, "onAfterNodeUpdated", (e) => {
905
+ o(this, "onAfterNodeUpdated", (e) => {
906
906
  this.updateMaxNodePriority(e);
907
907
  });
908
- r(this, "onBeforeNodeRemoved", (e) => {
909
- const o = this.graph.getNode(e);
910
- o.element.removeEventListener("mousedown", this.onMouseDown), o.element.removeEventListener("touchstart", this.onTouchStart);
908
+ o(this, "onBeforeNodeRemoved", (e) => {
909
+ const t = this.graph.getNode(e);
910
+ t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
911
911
  });
912
- r(this, "onBeforeDestroy", () => {
912
+ o(this, "onBeforeDestroy", () => {
913
913
  this.graph.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy), this.removeMouseDragListeners(), this.removeTouchDragListeners();
914
914
  });
915
- r(this, "onBeforeClear", () => {
915
+ o(this, "onBeforeClear", () => {
916
916
  this.canvas.graph.getAllNodeIds().forEach((e) => {
917
- const o = this.canvas.graph.getNode(e);
918
- o.element.removeEventListener("mousedown", this.onMouseDown), o.element.removeEventListener("touchstart", this.onTouchStart);
917
+ const t = this.canvas.graph.getNode(e);
918
+ t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
919
919
  }), this.maxNodePriority = 0;
920
920
  });
921
- r(this, "onMouseDown", (e) => {
921
+ o(this, "onMouseDown", (e) => {
922
922
  if (!this.config.mouseDownEventVerifier(e))
923
923
  return;
924
- const o = e.currentTarget, i = this.graph.getElementNodeId(o), s = this.graph.getNode(i);
924
+ const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
925
925
  this.config.onBeforeNodeDrag({
926
- nodeId: i,
927
- element: s.element,
928
- x: s.x,
929
- y: s.y
930
- }) && (e.stopImmediatePropagation(), this.grabbedNodeId = i, I(this.element, this.config.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
926
+ nodeId: s,
927
+ element: i.element,
928
+ x: i.x,
929
+ y: i.y
930
+ }) && (e.stopImmediatePropagation(), this.grabbedNodeId = s, B(this.element, this.config.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
931
931
  passive: !0
932
932
  }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
933
933
  passive: !0
934
934
  }));
935
935
  });
936
- r(this, "onTouchStart", (e) => {
936
+ o(this, "onTouchStart", (e) => {
937
937
  if (e.touches.length !== 1)
938
938
  return;
939
939
  e.stopImmediatePropagation(), this.previousTouchCoordinates = {
940
940
  x: e.touches[0].clientX,
941
941
  y: e.touches[0].clientY
942
942
  };
943
- const o = e.currentTarget, i = this.canvas.graph.getElementNodeId(o), s = this.graph.getNode(i);
943
+ const t = e.currentTarget, s = this.canvas.graph.getElementNodeId(t), i = this.graph.getNode(s);
944
944
  this.config.onBeforeNodeDrag({
945
- nodeId: i,
946
- element: s.element,
947
- x: s.x,
948
- y: s.y
949
- }) && (this.grabbedNodeId = i, this.moveNodeOnTop(i), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
945
+ nodeId: s,
946
+ element: i.element,
947
+ x: i.x,
948
+ y: i.y
949
+ }) && (this.grabbedNodeId = s, this.moveNodeOnTop(s), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
950
950
  passive: !0
951
951
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
952
952
  passive: !0
@@ -954,8 +954,8 @@ class z {
954
954
  passive: !0
955
955
  }));
956
956
  });
957
- r(this, "onWindowMouseMove", (e) => {
958
- if (!D(
957
+ o(this, "onWindowMouseMove", (e) => {
958
+ if (!N(
959
959
  this.window,
960
960
  this.element,
961
961
  e.clientX,
@@ -966,63 +966,63 @@ class z {
966
966
  }
967
967
  this.grabbedNodeId !== null && this.dragNode(this.grabbedNodeId, e.movementX, e.movementY);
968
968
  });
969
- r(this, "onWindowMouseUp", (e) => {
969
+ o(this, "onWindowMouseUp", (e) => {
970
970
  this.config.mouseUpEventVerifier(e) && this.cancelMouseDrag();
971
971
  });
972
- r(this, "onWindowTouchMove", (e) => {
972
+ o(this, "onWindowTouchMove", (e) => {
973
973
  if (e.touches.length !== 1)
974
974
  return;
975
- const o = e.touches[0];
976
- if (!D(
975
+ const t = e.touches[0];
976
+ if (!N(
977
977
  this.window,
978
978
  this.element,
979
- o.clientX,
980
- o.clientY
979
+ t.clientX,
980
+ t.clientY
981
981
  )) {
982
982
  this.cancelTouchDrag();
983
983
  return;
984
984
  }
985
985
  if (this.grabbedNodeId !== null && this.previousTouchCoordinates !== null) {
986
- const s = o.clientX - this.previousTouchCoordinates.x, h = o.clientY - this.previousTouchCoordinates.y;
987
- this.dragNode(this.grabbedNodeId, s, h), this.previousTouchCoordinates = {
986
+ const i = t.clientX - this.previousTouchCoordinates.x, n = t.clientY - this.previousTouchCoordinates.y;
987
+ this.dragNode(this.grabbedNodeId, i, n), this.previousTouchCoordinates = {
988
988
  x: e.touches[0].clientX,
989
989
  y: e.touches[0].clientY
990
990
  };
991
991
  }
992
992
  });
993
- r(this, "onWindowTouchFinish", () => {
993
+ o(this, "onWindowTouchFinish", () => {
994
994
  this.previousTouchCoordinates = null, this.cancelTouchDrag();
995
995
  });
996
- r(this, "config");
997
- this.canvas = e, this.element = o, this.window = i, this.config = Ne(s), 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);
996
+ o(this, "config");
997
+ this.canvas = e, this.element = t, this.window = s, this.config = De(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);
998
998
  }
999
- static configure(e, o, i, s) {
1000
- new z(e, o, i, s);
999
+ static configure(e, t, s, i) {
1000
+ new z(e, t, s, i);
1001
1001
  }
1002
- dragNode(e, o, i) {
1003
- const s = this.graph.getNode(e);
1004
- if (s === null)
1002
+ dragNode(e, t, s) {
1003
+ const i = this.graph.getNode(e);
1004
+ if (i === null)
1005
1005
  return;
1006
- const h = this.canvas.viewport.getContentMatrix(), n = N(h, {
1007
- x: s.x,
1008
- y: s.y
1009
- }), d = N(
1010
- { scale: 1, x: o, y: i },
1011
- n
1012
- ), c = this.canvas.viewport.getViewportMatrix(), a = N(c, d);
1013
- this.canvas.updateNode(e, { x: a.x, y: a.y }), this.config.onNodeDrag({
1006
+ const n = this.canvas.viewport.getContentMatrix(), h = D(n, {
1007
+ x: i.x,
1008
+ y: i.y
1009
+ }), a = D(
1010
+ { scale: 1, x: t, y: s },
1011
+ h
1012
+ ), d = this.canvas.viewport.getViewportMatrix(), c = D(d, a);
1013
+ this.canvas.updateNode(e, { x: c.x, y: c.y }), this.config.onNodeDrag({
1014
1014
  nodeId: e,
1015
- element: s.element,
1016
- x: a.x,
1017
- y: a.y
1015
+ element: i.element,
1016
+ x: c.x,
1017
+ y: c.y
1018
1018
  });
1019
1019
  }
1020
1020
  moveNodeOnTop(e) {
1021
1021
  if (this.config.moveOnTop) {
1022
1022
  if (this.maxNodePriority++, this.config.moveEdgesOnTop) {
1023
- const o = this.maxNodePriority;
1024
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((s) => {
1025
- this.canvas.updateEdge(s, { priority: o });
1023
+ const t = this.maxNodePriority;
1024
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
1025
+ this.canvas.updateEdge(i, { priority: t });
1026
1026
  });
1027
1027
  }
1028
1028
  this.canvas.updateNode(e, { priority: this.maxNodePriority });
@@ -1035,7 +1035,7 @@ class z {
1035
1035
  element: e.element,
1036
1036
  x: e.x,
1037
1037
  y: e.y
1038
- }), this.grabbedNodeId = null, I(this.element, null), this.removeMouseDragListeners();
1038
+ }), this.grabbedNodeId = null, B(this.element, null), this.removeMouseDragListeners();
1039
1039
  }
1040
1040
  removeMouseDragListeners() {
1041
1041
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -1054,171 +1054,171 @@ class z {
1054
1054
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
1055
1055
  }
1056
1056
  updateMaxNodePriority(e) {
1057
- const o = this.graph.getNode(e).priority;
1058
- this.maxNodePriority = Math.max(this.maxNodePriority, o);
1057
+ const t = this.graph.getNode(e).priority;
1058
+ this.maxNodePriority = Math.max(this.maxNodePriority, t);
1059
1059
  }
1060
1060
  }
1061
- const Le = (t) => {
1062
- const e = t.minX !== null ? t.minX : -1 / 0, o = t.maxX !== null ? t.maxX : 1 / 0, i = t.minY !== null ? t.minY : -1 / 0, s = t.maxY !== null ? t.maxY : 1 / 0;
1063
- return (h) => {
1064
- let n = h.nextTransform.x, d = h.nextTransform.y;
1065
- n < e && n < h.prevTransform.x && (n = Math.min(h.prevTransform.x, e));
1066
- const c = h.canvasWidth * h.prevTransform.scale, a = o - c;
1067
- n > a && n > h.prevTransform.x && (n = Math.max(h.prevTransform.x, a)), d < i && d < h.prevTransform.y && (d = Math.min(h.prevTransform.y, i));
1068
- const l = h.canvasHeight * h.prevTransform.scale, w = s - l;
1069
- return d > w && d > h.prevTransform.y && (d = Math.max(h.prevTransform.y, w)), { scale: h.nextTransform.scale, x: n, y: d };
1061
+ const Le = (r) => {
1062
+ 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;
1063
+ return (n) => {
1064
+ let h = n.nextTransform.x, a = n.nextTransform.y;
1065
+ h < e && h < n.prevTransform.x && (h = Math.min(n.prevTransform.x, e));
1066
+ const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
1067
+ h > c && h > n.prevTransform.x && (h = Math.max(n.prevTransform.x, c)), a < s && a < n.prevTransform.y && (a = Math.min(n.prevTransform.y, s));
1068
+ const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
1069
+ return a > l && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: h, y: a };
1070
1070
  };
1071
- }, Ve = (t) => {
1072
- const e = t.maxContentScale, o = t.minContentScale, i = e !== null ? 1 / e : 0, s = o !== null ? 1 / o : 1 / 0;
1073
- return (h) => {
1074
- const n = h.prevTransform, d = h.nextTransform;
1075
- let c = d.scale, a = d.x, l = d.y;
1076
- if (d.scale > s && d.scale > n.scale) {
1077
- c = Math.max(n.scale, s), a = n.x, l = n.y;
1078
- const w = (c - n.scale) / (d.scale - n.scale);
1079
- a = n.x + (d.x - n.x) * w, l = n.y + (d.y - n.y) * w;
1071
+ }, Re = (r) => {
1072
+ const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
1073
+ return (n) => {
1074
+ const h = n.prevTransform, a = n.nextTransform;
1075
+ let d = a.scale, c = a.x, g = a.y;
1076
+ if (a.scale > i && a.scale > h.scale) {
1077
+ d = Math.max(h.scale, i), c = h.x, g = h.y;
1078
+ const l = (d - h.scale) / (a.scale - h.scale);
1079
+ c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
1080
1080
  }
1081
- if (d.scale < i && d.scale < n.scale) {
1082
- c = Math.min(n.scale, i), a = n.x, l = n.y;
1083
- const w = (c - n.scale) / (d.scale - n.scale);
1084
- a = n.x + (d.x - n.x) * w, l = n.y + (d.y - n.y) * w;
1081
+ if (a.scale < s && a.scale < h.scale) {
1082
+ d = Math.min(h.scale, s), c = h.x, g = h.y;
1083
+ const l = (d - h.scale) / (a.scale - h.scale);
1084
+ c = h.x + (a.x - h.x) * l, g = h.y + (a.y - h.y) * l;
1085
1085
  }
1086
1086
  return {
1087
- scale: c,
1088
- x: a,
1089
- y: l
1087
+ scale: d,
1088
+ x: c,
1089
+ y: g
1090
1090
  };
1091
1091
  };
1092
- }, Re = (t) => (e) => t.reduce(
1093
- (o, i) => i({
1092
+ }, Ie = (r) => (e) => r.reduce(
1093
+ (t, s) => s({
1094
1094
  prevTransform: e.prevTransform,
1095
- nextTransform: o,
1095
+ nextTransform: t,
1096
1096
  canvasWidth: e.canvasWidth,
1097
1097
  canvasHeight: e.canvasHeight
1098
1098
  }),
1099
1099
  e.nextTransform
1100
- ), ee = (t) => {
1101
- if (typeof t == "function")
1102
- return t;
1103
- switch (t.type) {
1100
+ ), te = (r) => {
1101
+ if (typeof r == "function")
1102
+ return r;
1103
+ switch (r.type) {
1104
1104
  case "scale-limit":
1105
- return Ve({
1106
- minContentScale: t.minContentScale ?? 0,
1107
- maxContentScale: t.maxContentScale ?? 1 / 0
1105
+ return Re({
1106
+ minContentScale: r.minContentScale ?? 0,
1107
+ maxContentScale: r.maxContentScale ?? 1 / 0
1108
1108
  });
1109
1109
  case "shift-limit":
1110
1110
  return Le({
1111
- minX: t.minX ?? -1 / 0,
1112
- maxX: t.maxX ?? 1 / 0,
1113
- minY: t.minY ?? -1 / 0,
1114
- maxY: t.maxY ?? 1 / 0
1111
+ minX: r.minX ?? -1 / 0,
1112
+ maxX: r.maxX ?? 1 / 0,
1113
+ minY: r.minY ?? -1 / 0,
1114
+ maxY: r.maxY ?? 1 / 0
1115
1115
  });
1116
1116
  }
1117
- }, Ie = (t) => {
1118
- var y, E, p, b, T, P, M, L, Z, J, K, Q;
1119
- const e = (y = t == null ? void 0 : t.scale) == null ? void 0 : y.mouseWheelSensitivity, o = e !== void 0 ? e : 1.2, i = t == null ? void 0 : t.transformPreprocessor;
1120
- let s;
1121
- i !== void 0 ? Array.isArray(i) ? s = Re(
1122
- i.map(
1123
- (m) => ee(m)
1117
+ }, Be = (r) => {
1118
+ var f, A, m, S, b, T, M, L, J, K, Q, _;
1119
+ const e = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
1120
+ let i;
1121
+ s !== void 0 ? Array.isArray(s) ? i = Ie(
1122
+ s.map(
1123
+ (P) => te(P)
1124
1124
  )
1125
- ) : s = ee(i) : s = (m) => m.nextTransform;
1126
- const h = ((E = t == null ? void 0 : t.shift) == null ? void 0 : E.cursor) !== void 0 ? t.shift.cursor : "grab", n = ((p = t == null ? void 0 : t.events) == null ? void 0 : p.onBeforeTransformChange) ?? (() => {
1127
- }), d = ((b = t == null ? void 0 : t.events) == null ? void 0 : b.onTransformChange) ?? (() => {
1128
- }), c = (T = t == null ? void 0 : t.shift) == null ? void 0 : T.mouseDownEventVerifier, a = c !== void 0 ? c : (m) => m.button === 0, l = (P = t == null ? void 0 : t.shift) == null ? void 0 : P.mouseUpEventVerifier, w = l !== void 0 ? l : (m) => m.button === 0, v = (M = t == null ? void 0 : t.scale) == null ? void 0 : M.mouseWheelEventVerifier, A = v !== void 0 ? v : () => !0;
1125
+ ) : i = te(s) : i = (P) => P.nextTransform;
1126
+ const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
1127
+ }), a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onTransformChange) ?? (() => {
1128
+ }), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0, v = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, p = v !== void 0 ? v : () => !0;
1129
1129
  return {
1130
- wheelSensitivity: o,
1131
- onTransformStarted: ((L = t == null ? void 0 : t.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
1130
+ wheelSensitivity: t,
1131
+ onTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
1132
1132
  }),
1133
- onTransformFinished: ((Z = t == null ? void 0 : t.events) == null ? void 0 : Z.onTransformFinished) ?? (() => {
1133
+ onTransformFinished: ((J = r == null ? void 0 : r.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
1134
1134
  }),
1135
- onBeforeTransformChange: n,
1136
- onTransformChange: d,
1137
- transformPreprocessor: s,
1138
- shiftCursor: h,
1139
- mouseDownEventVerifier: a,
1140
- mouseUpEventVerifier: w,
1141
- mouseWheelEventVerifier: A,
1142
- scaleWheelFinishTimeout: ((J = t == null ? void 0 : t.scale) == null ? void 0 : J.wheelFinishTimeout) ?? 500,
1143
- onResizeTransformStarted: ((K = t == null ? void 0 : t.events) == null ? void 0 : K.onResizeTransformStarted) ?? (() => {
1135
+ onBeforeTransformChange: h,
1136
+ onTransformChange: a,
1137
+ transformPreprocessor: i,
1138
+ shiftCursor: n,
1139
+ mouseDownEventVerifier: c,
1140
+ mouseUpEventVerifier: l,
1141
+ mouseWheelEventVerifier: p,
1142
+ scaleWheelFinishTimeout: ((K = r == null ? void 0 : r.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
1143
+ onResizeTransformStarted: ((Q = r == null ? void 0 : r.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
1144
1144
  }),
1145
- onResizeTransformFinished: ((Q = t == null ? void 0 : t.events) == null ? void 0 : Q.onResizeTransformFinished) ?? (() => {
1145
+ onResizeTransformFinished: ((_ = r == null ? void 0 : r.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
1146
1146
  })
1147
1147
  };
1148
- }, Be = (t, e, o) => ({
1149
- scale: t.scale,
1150
- x: t.x + t.scale * e,
1151
- y: t.y + t.scale * o
1152
- }), Ue = (t, e, o, i) => ({
1153
- scale: t.scale * e,
1154
- x: t.scale * (1 - e) * o + t.x,
1155
- y: t.scale * (1 - e) * i + t.y
1156
- }), R = (t) => {
1157
- const e = [], o = t.touches.length;
1158
- for (let d = 0; d < o; d++)
1159
- e.push([t.touches[d].clientX, t.touches[d].clientY]);
1160
- const i = e.reduce(
1161
- (d, c) => [d[0] + c[0], d[1] + c[1]],
1148
+ }, Ve = (r, e, t) => ({
1149
+ scale: r.scale,
1150
+ x: r.x + r.scale * e,
1151
+ y: r.y + r.scale * t
1152
+ }), Ue = (r, e, t, s) => ({
1153
+ scale: r.scale * e,
1154
+ x: r.scale * (1 - e) * t + r.x,
1155
+ y: r.scale * (1 - e) * s + r.y
1156
+ }), I = (r) => {
1157
+ const e = [], t = r.touches.length;
1158
+ for (let a = 0; a < t; a++)
1159
+ e.push([r.touches[a].clientX, r.touches[a].clientY]);
1160
+ const s = e.reduce(
1161
+ (a, d) => [a[0] + d[0], a[1] + d[1]],
1162
1162
  [0, 0]
1163
- ), s = [i[0] / o, i[1] / o], n = e.map((d) => [d[0] - s[0], d[1] - s[1]]).reduce(
1164
- (d, c) => d + Math.sqrt(c[0] * c[0] + c[1] * c[1]),
1163
+ ), i = [s[0] / t, s[1] / t], h = e.map((a) => [a[0] - i[0], a[1] - i[1]]).reduce(
1164
+ (a, d) => a + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
1165
1165
  0
1166
1166
  );
1167
1167
  return {
1168
- x: s[0],
1169
- y: s[1],
1170
- scale: n / o,
1171
- touchesCnt: o,
1168
+ x: i[0],
1169
+ y: i[1],
1170
+ scale: h / t,
1171
+ touchesCnt: t,
1172
1172
  touches: e
1173
1173
  };
1174
1174
  };
1175
1175
  class U {
1176
- constructor(e, o, i, s) {
1177
- r(this, "viewport");
1178
- r(this, "prevTouches", null);
1179
- r(this, "wheelFinishTimer", null);
1180
- r(this, "transformInProgress", !1);
1181
- r(this, "onBeforeDestroy", () => {
1176
+ constructor(e, t, s, i) {
1177
+ o(this, "viewport");
1178
+ o(this, "prevTouches", null);
1179
+ o(this, "wheelFinishTimer", null);
1180
+ o(this, "transformInProgress", !1);
1181
+ o(this, "onBeforeDestroy", () => {
1182
1182
  this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.observer.unobserve(this.element), this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("wheel", this.onWheelScroll), this.element.removeEventListener("touchstart", this.onTouchStart), this.element.removeEventListener("wheel", this.preventWheelScaleListener), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1183
1183
  });
1184
- r(this, "onMouseDown", (e) => {
1185
- this.element === null || !this.config.mouseDownEventVerifier(e) || (I(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1184
+ o(this, "onMouseDown", (e) => {
1185
+ this.element === null || !this.config.mouseDownEventVerifier(e) || (B(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1186
1186
  passive: !0
1187
1187
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1188
1188
  passive: !0
1189
1189
  }), this.startRegisteredTransform());
1190
1190
  });
1191
- r(this, "onWindowMouseMove", (e) => {
1192
- const o = D(
1191
+ o(this, "onWindowMouseMove", (e) => {
1192
+ const t = N(
1193
1193
  this.window,
1194
1194
  this.element,
1195
1195
  e.clientX,
1196
1196
  e.clientY
1197
1197
  );
1198
- if (this.element === null || !o) {
1198
+ if (this.element === null || !t) {
1199
1199
  this.stopMouseDrag();
1200
1200
  return;
1201
1201
  }
1202
- const i = -e.movementX, s = -e.movementY;
1203
- this.moveViewport(i, s);
1202
+ const s = -e.movementX, i = -e.movementY;
1203
+ this.moveViewport(s, i);
1204
1204
  });
1205
- r(this, "onWindowMouseUp", (e) => {
1205
+ o(this, "onWindowMouseUp", (e) => {
1206
1206
  this.element === null || !this.config.mouseUpEventVerifier(e) || this.stopMouseDrag();
1207
1207
  });
1208
- r(this, "onWheelScroll", (e) => {
1208
+ o(this, "onWheelScroll", (e) => {
1209
1209
  if (!this.config.mouseWheelEventVerifier(e))
1210
1210
  return;
1211
- const { left: o, top: i } = this.element.getBoundingClientRect(), s = e.clientX - o, h = e.clientY - i, d = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
1212
- this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(d, s, h), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
1211
+ const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, a = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
1212
+ this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(a, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
1213
1213
  this.transformInProgress || this.config.onTransformFinished(), this.wheelFinishTimer = null;
1214
1214
  }, this.config.scaleWheelFinishTimeout);
1215
1215
  });
1216
- r(this, "onTouchStart", (e) => {
1216
+ o(this, "onTouchStart", (e) => {
1217
1217
  if (this.prevTouches !== null) {
1218
- this.prevTouches = R(e);
1218
+ this.prevTouches = I(e);
1219
1219
  return;
1220
1220
  }
1221
- this.prevTouches = R(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1221
+ this.prevTouches = I(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1222
1222
  passive: !0
1223
1223
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
1224
1224
  passive: !0
@@ -1226,42 +1226,42 @@ class U {
1226
1226
  passive: !0
1227
1227
  }), this.startRegisteredTransform();
1228
1228
  });
1229
- r(this, "onWindowTouchMove", (e) => {
1230
- const o = R(e);
1231
- if (!o.touches.every(
1232
- (s) => D(this.window, this.element, s[0], s[1])
1229
+ o(this, "onWindowTouchMove", (e) => {
1230
+ const t = I(e);
1231
+ if (!t.touches.every(
1232
+ (i) => N(this.window, this.element, i[0], i[1])
1233
1233
  )) {
1234
1234
  this.stopTouchDrag();
1235
1235
  return;
1236
1236
  }
1237
- if ((o.touchesCnt === 1 || o.touchesCnt === 2) && this.moveViewport(
1238
- -(o.x - this.prevTouches.x),
1239
- -(o.y - this.prevTouches.y)
1240
- ), o.touchesCnt === 2) {
1241
- const { left: s, top: h } = this.element.getBoundingClientRect(), n = this.prevTouches.x - s, d = this.prevTouches.y - h, a = 1 / (o.scale / this.prevTouches.scale);
1242
- this.scaleViewport(a, n, d);
1237
+ if ((t.touchesCnt === 1 || t.touchesCnt === 2) && this.moveViewport(
1238
+ -(t.x - this.prevTouches.x),
1239
+ -(t.y - this.prevTouches.y)
1240
+ ), t.touchesCnt === 2) {
1241
+ const { left: i, top: n } = this.element.getBoundingClientRect(), h = this.prevTouches.x - i, a = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
1242
+ this.scaleViewport(c, h, a);
1243
1243
  }
1244
- this.prevTouches = o;
1244
+ this.prevTouches = t;
1245
1245
  });
1246
- r(this, "onWindowTouchFinish", (e) => {
1247
- e.touches.length > 0 ? this.prevTouches = R(e) : this.stopTouchDrag();
1246
+ o(this, "onWindowTouchFinish", (e) => {
1247
+ e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
1248
1248
  });
1249
- r(this, "observer", new ResizeObserver(() => {
1250
- const e = this.viewport.getViewportMatrix(), { width: o, height: i } = this.element.getBoundingClientRect(), s = this.config.transformPreprocessor({
1249
+ o(this, "observer", new ResizeObserver(() => {
1250
+ const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.config.transformPreprocessor({
1251
1251
  prevTransform: e,
1252
1252
  nextTransform: e,
1253
- canvasWidth: o,
1254
- canvasHeight: i
1253
+ canvasWidth: t,
1254
+ canvasHeight: s
1255
1255
  });
1256
- this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.config.onResizeTransformFinished();
1256
+ this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.config.onResizeTransformFinished();
1257
1257
  }));
1258
- r(this, "config");
1259
- r(this, "preventWheelScaleListener", (e) => {
1258
+ o(this, "config");
1259
+ o(this, "preventWheelScaleListener", (e) => {
1260
1260
  e.preventDefault();
1261
1261
  });
1262
- this.canvas = e, this.element = o, this.window = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
1262
+ this.canvas = e, this.element = t, this.window = s, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
1263
1263
  passive: !1
1264
- }), this.config = Ie(s), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
1264
+ }), this.config = Be(i), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
1265
1265
  passive: !0
1266
1266
  }), this.element.addEventListener("wheel", this.onWheelScroll, {
1267
1267
  passive: !0
@@ -1269,34 +1269,34 @@ class U {
1269
1269
  passive: !0
1270
1270
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1271
1271
  }
1272
- static configure(e, o, i, s) {
1272
+ static configure(e, t, s, i) {
1273
1273
  new U(
1274
1274
  e,
1275
- o,
1276
- i,
1277
- s
1275
+ t,
1276
+ s,
1277
+ i
1278
1278
  );
1279
1279
  }
1280
- moveViewport(e, o) {
1281
- const i = this.viewport.getViewportMatrix(), s = Be(i, e, o), { width: h, height: n } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
1280
+ moveViewport(e, t) {
1281
+ const s = this.viewport.getViewportMatrix(), i = Ve(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.config.transformPreprocessor({
1282
+ prevTransform: s,
1283
+ nextTransform: i,
1284
+ canvasWidth: n,
1285
+ canvasHeight: h
1286
+ });
1287
+ this.performTransform(a);
1288
+ }
1289
+ scaleViewport(e, t, s) {
1290
+ const i = this.canvas.viewport.getViewportMatrix(), n = Ue(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
1282
1291
  prevTransform: i,
1283
- nextTransform: s,
1292
+ nextTransform: n,
1284
1293
  canvasWidth: h,
1285
- canvasHeight: n
1294
+ canvasHeight: a
1286
1295
  });
1287
1296
  this.performTransform(d);
1288
1297
  }
1289
- scaleViewport(e, o, i) {
1290
- const s = this.canvas.viewport.getViewportMatrix(), h = Ue(s, e, o, i), { width: n, height: d } = this.element.getBoundingClientRect(), c = this.config.transformPreprocessor({
1291
- prevTransform: s,
1292
- nextTransform: h,
1293
- canvasWidth: n,
1294
- canvasHeight: d
1295
- });
1296
- this.performTransform(c);
1297
- }
1298
1298
  stopMouseDrag() {
1299
- I(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
1299
+ B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
1300
1300
  }
1301
1301
  removeMouseDragListeners() {
1302
1302
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -1318,21 +1318,21 @@ class U {
1318
1318
  }
1319
1319
  }
1320
1320
  class X {
1321
- constructor(e, o, i, s, h, n) {
1322
- r(this, "canvasResizeObserver");
1323
- r(this, "nodeHorizontal");
1324
- r(this, "nodeVertical");
1325
- r(this, "viewport");
1326
- r(this, "viewportWidth", 0);
1327
- r(this, "viewportHeight", 0);
1328
- r(this, "viewportMatrix");
1329
- r(this, "loadedArea", {
1321
+ constructor(e, t, s, i, n, h) {
1322
+ o(this, "canvasResizeObserver");
1323
+ o(this, "nodeHorizontal");
1324
+ o(this, "nodeVertical");
1325
+ o(this, "viewport");
1326
+ o(this, "viewportWidth", 0);
1327
+ o(this, "viewportHeight", 0);
1328
+ o(this, "viewportMatrix");
1329
+ o(this, "loadedArea", {
1330
1330
  xFrom: 1 / 0,
1331
1331
  xTo: 1 / 0,
1332
1332
  yFrom: 1 / 0,
1333
1333
  yTo: 1 / 0
1334
1334
  });
1335
- r(this, "updateLoadedArea", (e) => {
1335
+ o(this, "updateLoadedArea", (e) => {
1336
1336
  this.loadedArea = {
1337
1337
  xFrom: e.x,
1338
1338
  xTo: e.x + e.width,
@@ -1340,45 +1340,45 @@ class X {
1340
1340
  yTo: e.y + e.height
1341
1341
  };
1342
1342
  });
1343
- r(this, "onBeforeDestroy", () => {
1343
+ o(this, "onBeforeDestroy", () => {
1344
1344
  this.trigger.unsubscribe(this.updateLoadedArea), this.canvasResizeObserver.unobserve(this.element), this.canvas.viewport.onAfterUpdated.unsubscribe(
1345
1345
  this.onAfterViewportUpdated
1346
1346
  ), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1347
1347
  });
1348
- r(this, "onAfterViewportUpdated", () => {
1348
+ o(this, "onAfterViewportUpdated", () => {
1349
1349
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
1350
1350
  });
1351
- r(this, "userTransformInProgress", !1);
1352
- var A, y, E, p, b;
1353
- this.canvas = e, this.element = o, this.window = i, this.trigger = h, this.virtualScrollOptions = n, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((T) => {
1354
- const P = T[0];
1355
- this.viewportWidth = P.contentRect.width, this.viewportHeight = P.contentRect.height, this.scheduleLoadAreaAroundViewport();
1351
+ o(this, "userTransformInProgress", !1);
1352
+ var p, f, A, m, S;
1353
+ this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.virtualScrollOptions = h, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((b) => {
1354
+ const T = b[0];
1355
+ this.viewportWidth = T.contentRect.width, this.viewportHeight = T.contentRect.height, this.scheduleLoadAreaAroundViewport();
1356
1356
  }), this.viewport = e.viewport;
1357
- const d = ((A = s == null ? void 0 : s.events) == null ? void 0 : A.onResizeTransformStarted) ?? (() => {
1358
- }), c = ((y = s == null ? void 0 : s.events) == null ? void 0 : y.onResizeTransformFinished) ?? (() => {
1359
- }), a = ((E = s == null ? void 0 : s.events) == null ? void 0 : E.onTransformChange) ?? (() => {
1360
- }), l = ((p = s == null ? void 0 : s.events) == null ? void 0 : p.onBeforeTransformChange) ?? (() => {
1361
- }), w = ((b = s == null ? void 0 : s.events) == null ? void 0 : b.onTransformFinished) ?? (() => {
1357
+ const a = ((p = i == null ? void 0 : i.events) == null ? void 0 : p.onResizeTransformStarted) ?? (() => {
1358
+ }), d = ((f = i == null ? void 0 : i.events) == null ? void 0 : f.onResizeTransformFinished) ?? (() => {
1359
+ }), c = ((A = i == null ? void 0 : i.events) == null ? void 0 : A.onTransformChange) ?? (() => {
1360
+ }), g = ((m = i == null ? void 0 : i.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
1361
+ }), l = ((S = i == null ? void 0 : i.events) == null ? void 0 : S.onTransformFinished) ?? (() => {
1362
1362
  }), v = {
1363
- ...s,
1363
+ ...i,
1364
1364
  events: {
1365
- ...s == null ? void 0 : s.events,
1365
+ ...i == null ? void 0 : i.events,
1366
1366
  onResizeTransformStarted: () => {
1367
- this.userTransformInProgress = !0, d();
1367
+ this.userTransformInProgress = !0, a();
1368
1368
  },
1369
1369
  onResizeTransformFinished: () => {
1370
- this.userTransformInProgress = !1, c();
1370
+ this.userTransformInProgress = !1, d();
1371
1371
  },
1372
1372
  onBeforeTransformChange: () => {
1373
- this.userTransformInProgress = !0, l();
1373
+ this.userTransformInProgress = !0, g();
1374
1374
  },
1375
1375
  onTransformChange: () => {
1376
1376
  this.userTransformInProgress = !1;
1377
- const T = this.viewportMatrix;
1378
- this.viewportMatrix = this.viewport.getViewportMatrix(), T.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), a();
1377
+ const b = this.viewportMatrix;
1378
+ this.viewportMatrix = this.viewport.getViewportMatrix(), b.scale !== this.viewportMatrix.scale && this.scheduleEnsureViewportAreaLoaded(), c();
1379
1379
  },
1380
1380
  onTransformFinished: () => {
1381
- this.scheduleLoadAreaAroundViewport(), w();
1381
+ this.scheduleLoadAreaAroundViewport(), l();
1382
1382
  }
1383
1383
  }
1384
1384
  };
@@ -1389,14 +1389,14 @@ class X {
1389
1389
  v
1390
1390
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1391
1391
  }
1392
- static configure(e, o, i, s, h, n) {
1392
+ static configure(e, t, s, i, n, h) {
1393
1393
  new X(
1394
1394
  e,
1395
- o,
1396
- i,
1395
+ t,
1397
1396
  s,
1398
- h,
1399
- n
1397
+ i,
1398
+ n,
1399
+ h
1400
1400
  );
1401
1401
  }
1402
1402
  scheduleLoadAreaAroundViewport() {
@@ -1405,130 +1405,130 @@ class X {
1405
1405
  });
1406
1406
  }
1407
1407
  scheduleEnsureViewportAreaLoaded() {
1408
- const e = this.viewportWidth * this.viewportMatrix.scale, o = this.viewportHeight * this.viewportMatrix.scale, i = this.viewportMatrix.x - this.nodeHorizontal, s = this.viewportMatrix.y - this.nodeVertical, h = this.viewportMatrix.x + e + this.nodeHorizontal, n = this.viewportMatrix.y + o + this.nodeVertical;
1409
- this.loadedArea.xFrom < i && this.loadedArea.xTo > h && this.loadedArea.yFrom < s && this.loadedArea.yTo > n || this.scheduleLoadAreaAroundViewport();
1408
+ 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, h = this.viewportMatrix.y + t + this.nodeVertical;
1409
+ this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > h || this.scheduleLoadAreaAroundViewport();
1410
1410
  }
1411
1411
  loadAreaAroundViewport() {
1412
- const e = this.viewportWidth * this.viewportMatrix.scale, o = this.viewportHeight * this.viewportMatrix.scale, i = this.viewportMatrix.x - e - this.nodeHorizontal, s = this.viewportMatrix.y - o - this.nodeVertical, h = 3 * e + 2 * this.nodeHorizontal, n = 3 * o + 2 * this.nodeVertical;
1413
- this.trigger.emit({ x: i, y: s, width: h, height: n });
1412
+ 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, h = 3 * t + 2 * this.nodeVertical;
1413
+ this.trigger.emit({ x: s, y: i, width: n, height: h });
1414
1414
  }
1415
1415
  }
1416
1416
  const Ce = () => {
1417
- const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1418
- return t.style.position = "absolute", t.style.inset = "0", t;
1419
- }, We = () => {
1420
- const t = document.createElementNS("http://www.w3.org/2000/svg", "rect");
1421
- return t.setAttribute("fill", "url(#pattern)"), t;
1417
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1418
+ return r.style.position = "absolute", r.style.inset = "0", r;
1422
1419
  }, $e = () => {
1423
- const t = document.createElementNS(
1420
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
1421
+ return r.setAttribute("fill", "url(#pattern)"), r;
1422
+ }, We = () => {
1423
+ const r = document.createElementNS(
1424
1424
  "http://www.w3.org/2000/svg",
1425
1425
  "pattern"
1426
1426
  );
1427
- return t.setAttribute("id", "pattern"), t;
1428
- }, Fe = (t, e) => {
1429
- const o = document.createElementNS(
1427
+ return r.setAttribute("id", "pattern"), r;
1428
+ }, Fe = (r, e) => {
1429
+ const t = document.createElementNS(
1430
1430
  "http://www.w3.org/2000/svg",
1431
1431
  "circle"
1432
1432
  );
1433
- return o.setAttribute("cx", "0"), o.setAttribute("cy", "0"), o.setAttribute("r", `${t}`), o.setAttribute("fill", `${e}`), o;
1434
- }, Oe = (t) => t instanceof SVGElement ? t : Fe(
1435
- (t == null ? void 0 : t.radius) ?? 1.5,
1436
- (t == null ? void 0 : t.color) ?? "#d8d8d8"
1437
- ), ke = (t) => {
1438
- const e = t.tileDimensions, o = (e == null ? void 0 : e.width) ?? 25, i = (e == null ? void 0 : e.height) ?? 25, s = Oe(t.renderer ?? {});
1433
+ return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
1434
+ }, Oe = (r) => r instanceof SVGElement ? r : Fe(
1435
+ (r == null ? void 0 : r.radius) ?? 1.5,
1436
+ (r == null ? void 0 : r.color) ?? "#d8d8d8"
1437
+ ), ke = (r) => {
1438
+ const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Oe(r.renderer ?? {});
1439
1439
  return {
1440
- tileWidth: o,
1441
- tileHeight: i,
1442
- renderer: s,
1443
- maxViewportScale: t.maxViewportScale ?? 10
1440
+ tileWidth: t,
1441
+ tileHeight: s,
1442
+ renderer: i,
1443
+ maxViewportScale: r.maxViewportScale ?? 10
1444
1444
  };
1445
1445
  };
1446
1446
  class Y {
1447
- constructor(e, o, i) {
1448
- r(this, "svg", Ce());
1449
- r(this, "patternRenderingRectangle", We());
1450
- r(this, "pattern", $e());
1451
- r(this, "patternContent");
1452
- r(this, "tileWidth");
1453
- r(this, "tileHeight");
1454
- r(this, "halfTileWidth");
1455
- r(this, "halfTileHeight");
1456
- r(this, "maxViewportScale");
1457
- r(this, "visible", !1);
1458
- r(this, "resizeObserver", new ResizeObserver((e) => {
1459
- const o = e[0], { width: i, height: s } = o.contentRect;
1460
- this.svg.setAttribute("width", `${i}`), this.svg.setAttribute("height", `${s}`), this.patternRenderingRectangle.setAttribute("width", `${i}`), this.patternRenderingRectangle.setAttribute("height", `${s}`);
1461
- const h = this.tileWidth / i, n = this.tileHeight / s;
1462
- this.pattern.setAttribute("width", `${h}`), this.pattern.setAttribute("height", `${n}`);
1447
+ constructor(e, t, s) {
1448
+ o(this, "svg", Ce());
1449
+ o(this, "patternRenderingRectangle", $e());
1450
+ o(this, "pattern", We());
1451
+ o(this, "patternContent");
1452
+ o(this, "tileWidth");
1453
+ o(this, "tileHeight");
1454
+ o(this, "halfTileWidth");
1455
+ o(this, "halfTileHeight");
1456
+ o(this, "maxViewportScale");
1457
+ o(this, "visible", !1);
1458
+ o(this, "resizeObserver", new ResizeObserver((e) => {
1459
+ const t = e[0], { width: s, height: i } = t.contentRect;
1460
+ this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
1461
+ const n = this.tileWidth / s, h = this.tileHeight / i;
1462
+ this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${h}`);
1463
1463
  }));
1464
- r(this, "onAfterTransformUpdated", () => {
1465
- const e = this.canvas.viewport.getContentMatrix(), o = e.x - this.halfTileWidth * e.scale, i = e.y - this.halfTileHeight * e.scale, s = `matrix(${e.scale}, 0, 0, ${e.scale}, ${o}, ${i})`;
1466
- this.pattern.setAttribute("patternTransform", s), this.updateVisibility();
1464
+ o(this, "onAfterTransformUpdated", () => {
1465
+ 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})`;
1466
+ this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
1467
1467
  });
1468
- r(this, "onBeforeDestroy", () => {
1468
+ o(this, "onBeforeDestroy", () => {
1469
1469
  this.resizeObserver.unobserve(this.host), this.host.removeChild(this.svg), this.canvas.viewport.onAfterUpdated.unsubscribe(
1470
1470
  this.onAfterTransformUpdated
1471
1471
  ), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1472
1472
  });
1473
- this.canvas = e, this.host = i;
1474
- const s = ke(o);
1475
- this.tileWidth = s.tileWidth, this.tileHeight = s.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = s.renderer, this.maxViewportScale = s.maxViewportScale;
1476
- const h = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
1477
- this.patternContent.setAttribute("transform", h), this.pattern.appendChild(this.patternContent);
1478
- const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
1479
- n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1473
+ this.canvas = e, this.host = s;
1474
+ const i = ke(t);
1475
+ this.tileWidth = i.tileWidth, this.tileHeight = i.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = i.renderer, this.maxViewportScale = i.maxViewportScale;
1476
+ const n = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
1477
+ this.patternContent.setAttribute("transform", n), this.pattern.appendChild(this.patternContent);
1478
+ const h = document.createElementNS("http://www.w3.org/2000/svg", "defs");
1479
+ h.appendChild(this.pattern), this.svg.appendChild(h), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1480
1480
  }
1481
- static configure(e, o, i) {
1482
- new Y(e, o, i);
1481
+ static configure(e, t, s) {
1482
+ new Y(e, t, s);
1483
1483
  }
1484
1484
  updateVisibility() {
1485
- const o = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
1486
- o && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !o && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
1485
+ const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
1486
+ t && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
1487
1487
  }
1488
1488
  }
1489
- const ze = (t) => {
1490
- var d, c, a;
1491
- const e = () => "direct", o = (l) => l, i = (l) => l.button === 0, s = () => {
1492
- }, h = () => {
1489
+ const ze = (r) => {
1490
+ var a, d, c;
1491
+ const e = () => "direct", t = (g) => g, s = (g) => g.button === 0, i = () => {
1493
1492
  }, n = () => {
1493
+ }, h = () => {
1494
1494
  };
1495
1495
  return {
1496
- connectionTypeResolver: t.connectionTypeResolver ?? e,
1497
- connectionPreprocessor: t.connectionPreprocessor ?? o,
1498
- mouseDownEventVerifier: t.mouseDownEventVerifier ?? i,
1499
- mouseUpEventVerifier: t.mouseUpEventVerifier ?? i,
1500
- onAfterEdgeCreated: ((d = t.events) == null ? void 0 : d.onAfterEdgeCreated) ?? s,
1501
- onEdgeCreationInterrupted: ((c = t.events) == null ? void 0 : c.onEdgeCreationInterrupted) ?? n,
1502
- onEdgeCreationPrevented: ((a = t.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? h,
1503
- dragPortDirection: t.dragPortDirection ?? void 0
1496
+ connectionTypeResolver: r.connectionTypeResolver ?? e,
1497
+ connectionPreprocessor: r.connectionPreprocessor ?? t,
1498
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
1499
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
1500
+ onAfterEdgeCreated: ((a = r.events) == null ? void 0 : a.onAfterEdgeCreated) ?? i,
1501
+ onEdgeCreationInterrupted: ((d = r.events) == null ? void 0 : d.onEdgeCreationInterrupted) ?? h,
1502
+ onEdgeCreationPrevented: ((c = r.events) == null ? void 0 : c.onEdgeCreationPrevented) ?? n,
1503
+ dragPortDirection: r.dragPortDirection ?? void 0
1504
1504
  };
1505
1505
  };
1506
1506
  class H {
1507
- constructor(e, o, i, s, h, n) {
1508
- r(this, "config");
1509
- r(this, "overlayCanvas");
1510
- r(this, "staticOverlayPortId", "static");
1511
- r(this, "draggingOverlayPortId", "dragging");
1512
- r(this, "staticPortId", null);
1513
- r(this, "isDirect", !0);
1514
- r(this, "onAfterPortMarked", (e) => {
1515
- const o = this.canvas.graph.getPort(e);
1516
- this.canvas.graph.getElementPortsIds(o.element).length === 1 && this.hookPortEvents(o.element);
1517
- });
1518
- r(this, "onBeforePortUnmarked", (e) => {
1519
- const o = this.canvas.graph.getPort(e);
1520
- this.canvas.graph.getElementPortsIds(o.element).length === 1 && this.unhookPortEvents(o.element);
1521
- });
1522
- r(this, "onPortMouseDown", (e) => {
1523
- const o = e.currentTarget;
1524
- this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(o) && (e.stopPropagation(), this.grabPort(o, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1507
+ constructor(e, t, s, i, n, h) {
1508
+ o(this, "config");
1509
+ o(this, "overlayCanvas");
1510
+ o(this, "staticOverlayPortId", "static");
1511
+ o(this, "draggingOverlayPortId", "dragging");
1512
+ o(this, "staticPortId", null);
1513
+ o(this, "isDirect", !0);
1514
+ o(this, "onAfterPortMarked", (e) => {
1515
+ const t = this.canvas.graph.getPort(e);
1516
+ this.canvas.graph.getElementPortsIds(t.element).length === 1 && this.hookPortEvents(t.element);
1517
+ });
1518
+ o(this, "onBeforePortUnmarked", (e) => {
1519
+ const t = this.canvas.graph.getPort(e);
1520
+ this.canvas.graph.getElementPortsIds(t.element).length === 1 && this.unhookPortEvents(t.element);
1521
+ });
1522
+ o(this, "onPortMouseDown", (e) => {
1523
+ const t = e.currentTarget;
1524
+ this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(t) && (e.stopPropagation(), this.grabPort(t, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1525
1525
  passive: !0
1526
1526
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1527
1527
  passive: !0
1528
1528
  }));
1529
1529
  });
1530
- r(this, "onWindowMouseMove", (e) => {
1531
- if (!D(
1530
+ o(this, "onWindowMouseMove", (e) => {
1531
+ if (!N(
1532
1532
  this.window,
1533
1533
  this.overlayLayer,
1534
1534
  e.clientX,
@@ -1539,16 +1539,16 @@ class H {
1539
1539
  }
1540
1540
  this.moveDraggingNode({ x: e.clientX, y: e.clientY });
1541
1541
  });
1542
- r(this, "onWindowMouseUp", (e) => {
1542
+ o(this, "onWindowMouseUp", (e) => {
1543
1543
  this.config.mouseUpEventVerifier(e) && (this.tryCreateConnection({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
1544
1544
  });
1545
- r(this, "onPortTouchStart", (e) => {
1546
- const o = e.currentTarget;
1547
- if (!(e.touches.length === 1 && this.isPortConnectionAllowed(o)))
1545
+ o(this, "onPortTouchStart", (e) => {
1546
+ const t = e.currentTarget;
1547
+ if (!(e.touches.length === 1 && this.isPortConnectionAllowed(t)))
1548
1548
  return;
1549
1549
  e.stopPropagation();
1550
- const s = e.touches[0];
1551
- this.grabPort(o, { x: s.clientX, y: s.clientY }), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1550
+ const i = e.touches[0];
1551
+ this.grabPort(t, { x: i.clientX, y: i.clientY }), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1552
1552
  passive: !0
1553
1553
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
1554
1554
  passive: !0
@@ -1556,82 +1556,82 @@ class H {
1556
1556
  passive: !0
1557
1557
  });
1558
1558
  });
1559
- r(this, "onWindowTouchMove", (e) => {
1560
- const o = e.touches[0];
1561
- if (!D(
1559
+ o(this, "onWindowTouchMove", (e) => {
1560
+ const t = e.touches[0];
1561
+ if (!N(
1562
1562
  this.window,
1563
1563
  this.overlayLayer,
1564
- o.clientX,
1565
- o.clientY
1564
+ t.clientX,
1565
+ t.clientY
1566
1566
  )) {
1567
1567
  this.stopTouchDrag();
1568
1568
  return;
1569
1569
  }
1570
- this.moveDraggingNode({ x: o.clientX, y: o.clientY });
1570
+ this.moveDraggingNode({ x: t.clientX, y: t.clientY });
1571
1571
  });
1572
- r(this, "onWindowTouchFinish", (e) => {
1573
- const o = e.changedTouches[0];
1574
- this.tryCreateConnection({ x: o.clientX, y: o.clientY }), this.stopTouchDrag();
1572
+ o(this, "onWindowTouchFinish", (e) => {
1573
+ const t = e.changedTouches[0];
1574
+ this.tryCreateConnection({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
1575
1575
  });
1576
- r(this, "onBeforeClear", () => {
1576
+ o(this, "onBeforeClear", () => {
1577
1577
  this.canvas.graph.getAllPortIds().forEach((e) => {
1578
- const o = this.canvas.graph.getPort(e);
1579
- this.unhookPortEvents(o.element);
1578
+ const t = this.canvas.graph.getPort(e);
1579
+ this.unhookPortEvents(t.element);
1580
1580
  });
1581
1581
  });
1582
- r(this, "onBeforeDestroy", () => {
1582
+ o(this, "onBeforeDestroy", () => {
1583
1583
  this.stopMouseDrag(), this.stopTouchDrag(), this.canvas.graph.onAfterPortMarked.unsubscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.unsubscribe(
1584
1584
  this.onBeforePortUnmarked
1585
1585
  ), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
1586
1586
  });
1587
- r(this, "onEdgeCreated", (e) => {
1587
+ o(this, "onEdgeCreated", (e) => {
1588
1588
  this.config.onAfterEdgeCreated(e);
1589
1589
  });
1590
- this.canvas = e, this.overlayLayer = o, this.viewportStore = i, this.window = s, this.config = ze(n);
1591
- const d = new ce(), c = new ne(
1592
- d,
1590
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config = ze(h);
1591
+ const a = new de(), d = new ne(
1592
+ a,
1593
1593
  this.viewportStore,
1594
1594
  this.overlayLayer
1595
1595
  );
1596
- this.overlayCanvas = new de(
1596
+ this.overlayCanvas = new ae(
1597
1597
  this.overlayLayer,
1598
- d,
1598
+ a,
1599
1599
  this.viewportStore,
1600
- c,
1601
- h
1600
+ d,
1601
+ n
1602
1602
  ), 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);
1603
1603
  }
1604
- static configure(e, o, i, s, h, n) {
1604
+ static configure(e, t, s, i, n, h) {
1605
1605
  new H(
1606
1606
  e,
1607
- o,
1608
- i,
1607
+ t,
1609
1608
  s,
1610
- h,
1611
- n
1609
+ i,
1610
+ n,
1611
+ h
1612
1612
  );
1613
1613
  }
1614
- grabPort(e, o) {
1615
- const i = this.canvas.graph.getElementPortsIds(e)[0], s = this.canvas.graph.getPort(i);
1616
- this.staticPortId = i;
1617
- const h = this.config.connectionTypeResolver(this.staticPortId), n = e.getBoundingClientRect(), d = n.x + n.width / 2, c = n.y + n.height / 2, a = this.overlayLayer.getBoundingClientRect(), l = this.canvas.viewport.getViewportMatrix(), w = N(l, {
1618
- x: d - a.x,
1619
- y: c - a.y
1620
- }), v = N(l, {
1621
- x: o.x - a.x,
1622
- y: o.y - a.y
1623
- }), A = {
1614
+ grabPort(e, t) {
1615
+ const s = this.canvas.graph.getElementPortsIds(e)[0], i = this.canvas.graph.getPort(s);
1616
+ this.staticPortId = s;
1617
+ const n = this.config.connectionTypeResolver(this.staticPortId), h = e.getBoundingClientRect(), a = h.x + h.width / 2, d = h.y + h.height / 2, c = this.overlayLayer.getBoundingClientRect(), g = this.canvas.viewport.getViewportMatrix(), l = D(g, {
1618
+ x: a - c.x,
1619
+ y: d - c.y
1620
+ }), v = D(g, {
1621
+ x: t.x - c.x,
1622
+ y: t.y - c.y
1623
+ }), p = {
1624
1624
  overlayId: this.staticOverlayPortId,
1625
- portCoords: w,
1626
- portDirection: s.direction
1627
- }, y = {
1625
+ portCoords: l,
1626
+ portDirection: i.direction
1627
+ }, f = {
1628
1628
  overlayId: this.draggingOverlayPortId,
1629
1629
  portCoords: v,
1630
1630
  portDirection: this.config.dragPortDirection
1631
1631
  };
1632
- this.isDirect = h === "direct";
1633
- const E = this.isDirect ? A : y, p = this.isDirect ? y : A;
1634
- this.createOverlayGraph(E, p);
1632
+ this.isDirect = n === "direct";
1633
+ const A = this.isDirect ? p : f, m = this.isDirect ? f : p;
1634
+ this.createOverlayGraph(A, m);
1635
1635
  }
1636
1636
  hookPortEvents(e) {
1637
1637
  e.addEventListener("mousedown", this.onPortMouseDown, {
@@ -1652,314 +1652,463 @@ class H {
1652
1652
  resetDragState() {
1653
1653
  this.staticPortId = null, this.isDirect = !0, this.overlayCanvas.clear();
1654
1654
  }
1655
- createOverlayGraph(e, o) {
1656
- const i = this.createAddNodeRequest(e);
1657
- this.overlayCanvas.addNode(i);
1658
- const s = this.createAddNodeRequest(o);
1659
- this.overlayCanvas.addNode(s), this.overlayCanvas.addEdge({
1655
+ createOverlayGraph(e, t) {
1656
+ const s = this.createAddNodeRequest(e);
1657
+ this.overlayCanvas.addNode(s);
1658
+ const i = this.createAddNodeRequest(t);
1659
+ this.overlayCanvas.addNode(i), this.overlayCanvas.addEdge({
1660
1660
  from: e.overlayId,
1661
- to: o.overlayId
1661
+ to: t.overlayId
1662
1662
  });
1663
1663
  }
1664
1664
  createAddNodeRequest(e) {
1665
- const o = document.createElement("div");
1665
+ const t = document.createElement("div");
1666
1666
  return {
1667
1667
  id: e.overlayId,
1668
- element: o,
1668
+ element: t,
1669
1669
  x: e.portCoords.x,
1670
1670
  y: e.portCoords.y,
1671
1671
  ports: [
1672
1672
  {
1673
1673
  id: e.overlayId,
1674
- element: o,
1674
+ element: t,
1675
1675
  direction: e.portDirection
1676
1676
  }
1677
1677
  ]
1678
1678
  };
1679
1679
  }
1680
1680
  tryCreateConnection(e) {
1681
- const o = this.findPortAtPoint(e);
1682
- if (o === null) {
1681
+ const t = this.findPortAtPoint(e);
1682
+ if (t === null) {
1683
1683
  this.config.onEdgeCreationInterrupted(this.staticPortId, this.isDirect);
1684
1684
  return;
1685
1685
  }
1686
- const i = this.isDirect ? this.staticPortId : o, s = this.isDirect ? o : this.staticPortId, h = { from: i, to: s }, n = this.config.connectionPreprocessor(h);
1687
- n !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(n), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.config.onEdgeCreationPrevented(h);
1686
+ const s = this.isDirect ? this.staticPortId : t, i = this.isDirect ? t : this.staticPortId, n = { from: s, to: i }, h = this.config.connectionPreprocessor(n);
1687
+ h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.config.onEdgeCreationPrevented(n);
1688
1688
  }
1689
1689
  moveDraggingNode(e) {
1690
- const o = this.overlayLayer.getBoundingClientRect(), i = {
1691
- x: e.x - o.x,
1692
- y: e.y - o.y
1693
- }, s = this.canvas.viewport.getViewportMatrix(), h = N(s, i);
1690
+ const t = this.overlayLayer.getBoundingClientRect(), s = {
1691
+ x: e.x - t.x,
1692
+ y: e.y - t.y
1693
+ }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
1694
1694
  this.overlayCanvas.updateNode(this.draggingOverlayPortId, {
1695
- x: h.x,
1696
- y: h.y
1695
+ x: n.x,
1696
+ y: n.y
1697
1697
  });
1698
1698
  }
1699
1699
  findPortAtPoint(e) {
1700
- const o = document.elementsFromPoint(e.x, e.y);
1701
- for (const i of o) {
1702
- const s = this.findPortAtElement(i);
1703
- if (s !== null)
1704
- return s;
1700
+ const t = document.elementsFromPoint(e.x, e.y);
1701
+ for (const s of t) {
1702
+ const i = this.findPortAtElement(s);
1703
+ if (i !== null)
1704
+ return i;
1705
1705
  }
1706
1706
  return null;
1707
1707
  }
1708
1708
  findPortAtElement(e) {
1709
- let o = e, i = null;
1710
- for (; o !== null && (i = this.canvas.graph.getElementPortsIds(o)[0] ?? null, i === null); )
1711
- o = o.parentElement;
1712
- return i;
1709
+ let t = e, s = null;
1710
+ for (; t !== null && (s = this.canvas.graph.getElementPortsIds(t)[0] ?? null, s === null); )
1711
+ t = t.parentElement;
1712
+ return s;
1713
1713
  }
1714
1714
  isPortConnectionAllowed(e) {
1715
- const o = this.canvas.graph.getElementPortsIds(e)[0];
1716
- return this.config.connectionTypeResolver(o) !== null;
1715
+ const t = this.canvas.graph.getElementPortsIds(e)[0];
1716
+ return this.config.connectionTypeResolver(t) !== null;
1717
1717
  }
1718
1718
  }
1719
1719
  const Xe = () => {
1720
- const t = document.createElement("div");
1721
- return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t;
1722
- }, $ = () => {
1723
- const t = document.createElement("div");
1724
- return t.style.position = "absolute", t.style.inset = "0", t;
1720
+ const r = document.createElement("div");
1721
+ return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
1722
+ }, W = () => {
1723
+ const r = document.createElement("div");
1724
+ return r.style.position = "absolute", r.style.inset = "0", r;
1725
1725
  };
1726
1726
  class Ye {
1727
1727
  constructor(e) {
1728
- r(this, "background", $());
1729
- r(this, "main", $());
1730
- r(this, "overlay", $());
1731
- r(this, "host", Xe());
1728
+ o(this, "background", W());
1729
+ o(this, "main", W());
1730
+ o(this, "overlay", W());
1731
+ o(this, "host", Xe());
1732
1732
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.overlay.style.pointerEvents = "none", this.host.appendChild(this.overlay);
1733
1733
  }
1734
1734
  destroy() {
1735
1735
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
1736
1736
  }
1737
1737
  }
1738
- const He = (t, e) => ({
1739
- x: t / 2,
1738
+ const He = (r, e) => ({
1739
+ x: r / 2,
1740
1740
  y: e / 2
1741
- }), F = (t) => () => t, te = F(0), je = () => {
1742
- let t = 0;
1743
- return () => t++;
1744
- }, Ge = (t, e) => {
1745
- let o = te, i = te;
1746
- const s = je();
1747
- return t === "incremental" && (o = s), e === "incremental" && (i = s), typeof t == "number" && (o = F(t)), typeof e == "number" && (i = F(e)), typeof t == "function" && (o = t), typeof e == "function" && (i = e), {
1748
- nodesPriorityFn: o,
1749
- edgesPriorityFn: i
1741
+ }), F = (r) => () => r, re = F(0), je = () => {
1742
+ let r = 0;
1743
+ return () => r++;
1744
+ }, Ge = (r, e) => {
1745
+ let t = re, s = re;
1746
+ const i = je();
1747
+ return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = F(r)), typeof e == "number" && (s = F(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
1748
+ nodesPriorityFn: t,
1749
+ edgesPriorityFn: s
1750
1750
  };
1751
- }, f = (t, e, o) => ({
1752
- x: e.x * t.x - e.y * t.y + ((1 - e.x) * o.x + e.y * o.y),
1753
- y: e.y * t.x + e.x * t.y + ((1 - e.x) * o.y - e.y * o.x)
1754
- }), g = {
1751
+ }, y = (r, e, t) => ({
1752
+ x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
1753
+ y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
1754
+ }), w = {
1755
1755
  x: 0,
1756
1756
  y: 0
1757
- }, Ze = (t) => {
1758
- const e = f(
1759
- { x: t.arrowLength, y: g.y },
1760
- t.fromVector,
1761
- g
1762
- ), o = f(
1763
- { x: t.to.x - t.arrowLength, y: t.to.y },
1764
- t.toVector,
1765
- t.to
1766
- ), i = {
1767
- x: e.x + t.fromVector.x * t.curvature,
1768
- y: e.y + t.fromVector.y * t.curvature
1769
- }, s = {
1770
- x: o.x - t.toVector.x * t.curvature,
1771
- y: o.y - t.toVector.y * t.curvature
1772
- }, h = `M ${e.x} ${e.y} C ${i.x} ${i.y}, ${s.x} ${s.y}, ${o.x} ${o.y}`, n = t.hasSourceArrow ? "" : `M ${g.x} ${g.y} L ${e.x} ${e.y} `, d = t.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${t.to.x} ${t.to.y}`;
1773
- return `${n}${h}${d}`;
1774
- }, Je = (t) => {
1775
- const e = t.hasSourceArrow ? f(
1776
- { x: t.arrowLength, y: g.y },
1777
- t.fromVector,
1778
- g
1779
- ) : g, o = t.hasTargetArrow ? f(
1780
- { x: t.to.x - t.arrowLength, y: t.to.y },
1781
- t.toVector,
1782
- t.to
1783
- ) : t.to, i = t.arrowLength, s = Math.cos(t.detourDirection) * t.detourDistance, h = Math.sin(t.detourDirection) * t.detourDistance, n = s * t.flipX, d = h * t.flipY, c = f(
1784
- { x: i, y: g.y },
1785
- t.fromVector,
1786
- g
1787
- ), a = {
1788
- x: c.x + n,
1789
- y: c.y + d
1790
- }, l = f(
1791
- { x: t.to.x - i, y: t.to.y },
1792
- t.toVector,
1793
- t.to
1794
- ), w = {
1795
- x: l.x + n,
1796
- y: l.y + d
1797
- }, v = { x: (a.x + w.x) / 2, y: (a.y + w.y) / 2 }, A = {
1798
- x: c.x + t.curvature * t.fromVector.x,
1799
- y: c.y + t.curvature * t.fromVector.y
1800
- }, y = {
1801
- x: l.x - t.curvature * t.toVector.x,
1802
- y: l.y - t.curvature * t.toVector.y
1803
- }, E = {
1804
- x: c.x + n,
1805
- y: c.y + d
1806
- }, p = {
1807
- x: l.x + n,
1808
- y: l.y + d
1809
- };
1810
- return [
1811
- `M ${e.x} ${e.y}`,
1812
- `L ${c.x} ${c.y}`,
1813
- `C ${A.x} ${A.y} ${E.x} ${E.y} ${v.x} ${v.y}`,
1814
- `C ${p.x} ${p.y} ${y.x} ${y.y} ${l.x} ${l.y}`,
1815
- `L ${o.x} ${o.y}`
1816
- ].join(" ");
1817
- }, V = (t, e) => {
1818
- const o = [];
1819
- if (t.length > 0 && o.push(`M ${t[0].x} ${t[0].y}`), t.length === 2 && o.push(`L ${t[1].x} ${t[1].y}`), t.length > 2) {
1820
- const i = t.length - 1;
1821
- let s = 0, h = 0, n = 0;
1822
- t.forEach((d, c) => {
1823
- let a = 0, l = 0, w = 0;
1824
- const v = c > 0, A = c < i, y = v && A;
1825
- if (v && (a = -s, l = -h, w = n), A) {
1826
- const L = t[c + 1];
1827
- s = L.x - d.x, h = L.y - d.y, n = Math.sqrt(s * s + h * h);
1757
+ };
1758
+ class Ze {
1759
+ constructor(e) {
1760
+ o(this, "path");
1761
+ o(this, "median");
1762
+ this.params = e;
1763
+ const t = this.params.to;
1764
+ this.median = { x: t.x / 2, y: t.y / 2 };
1765
+ const s = y(
1766
+ { x: this.params.arrowLength, y: w.y },
1767
+ this.params.sourceDirection,
1768
+ w
1769
+ ), i = y(
1770
+ { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
1771
+ this.params.targetDirection,
1772
+ this.params.to
1773
+ ), n = {
1774
+ x: s.x + this.params.sourceDirection.x * this.params.curvature,
1775
+ y: s.y + this.params.sourceDirection.y * this.params.curvature
1776
+ }, h = {
1777
+ x: i.x - this.params.targetDirection.x * this.params.curvature,
1778
+ y: i.y - this.params.targetDirection.y * this.params.curvature
1779
+ }, a = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${h.x} ${h.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${w.x} ${w.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
1780
+ this.path = `${d}${a}${c}`;
1781
+ }
1782
+ }
1783
+ class Je {
1784
+ constructor(e) {
1785
+ o(this, "path");
1786
+ o(this, "median");
1787
+ this.params = e;
1788
+ const t = this.params.hasSourceArrow ? y(
1789
+ { x: this.params.arrowLength, y: w.y },
1790
+ this.params.sourceDirection,
1791
+ w
1792
+ ) : w, s = this.params.hasTargetArrow ? y(
1793
+ {
1794
+ x: this.params.to.x - this.params.arrowLength,
1795
+ y: this.params.to.y
1796
+ },
1797
+ this.params.targetDirection,
1798
+ this.params.to
1799
+ ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, a = n * this.params.flipX, d = h * this.params.flipY, c = y(
1800
+ { x: i, y: w.y },
1801
+ this.params.sourceDirection,
1802
+ w
1803
+ ), g = {
1804
+ x: c.x + a,
1805
+ y: c.y + d
1806
+ }, l = y(
1807
+ { x: this.params.to.x - i, y: this.params.to.y },
1808
+ this.params.targetDirection,
1809
+ this.params.to
1810
+ ), v = {
1811
+ x: l.x + a,
1812
+ y: l.y + d
1813
+ };
1814
+ this.median = { x: (g.x + v.x) / 2, y: (g.y + v.y) / 2 };
1815
+ const p = {
1816
+ x: c.x + this.params.curvature * this.params.sourceDirection.x,
1817
+ y: c.y + this.params.curvature * this.params.sourceDirection.y
1818
+ }, f = {
1819
+ x: l.x - this.params.curvature * this.params.targetDirection.x,
1820
+ y: l.y - this.params.curvature * this.params.targetDirection.y
1821
+ }, A = {
1822
+ x: c.x + a,
1823
+ y: c.y + d
1824
+ }, m = {
1825
+ x: l.x + a,
1826
+ y: l.y + d
1827
+ };
1828
+ this.path = [
1829
+ `M ${t.x} ${t.y}`,
1830
+ `L ${c.x} ${c.y}`,
1831
+ `C ${p.x} ${p.y} ${A.x} ${A.y} ${this.median.x} ${this.median.y}`,
1832
+ `C ${m.x} ${m.y} ${f.x} ${f.y} ${l.x} ${l.y}`,
1833
+ `L ${s.x} ${s.y}`
1834
+ ].join(" ");
1835
+ }
1836
+ }
1837
+ const R = (r, e) => {
1838
+ const t = [];
1839
+ 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) {
1840
+ const s = r.length - 1;
1841
+ let i = 0, n = 0, h = 0;
1842
+ r.forEach((a, d) => {
1843
+ let c = 0, g = 0, l = 0;
1844
+ const v = d > 0, p = d < s, f = v && p;
1845
+ if (v && (c = -i, g = -n, l = h), p) {
1846
+ const L = r[d + 1];
1847
+ i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
1828
1848
  }
1829
- const p = n !== 0 ? Math.min((y ? e : 0) / n, c < i - 1 ? 0.5 : 1) : 0, b = y ? { x: d.x + s * p, y: d.y + h * p } : d, P = w !== 0 ? Math.min((y ? e : 0) / w, c > 1 ? 0.5 : 1) : 0, M = y ? { x: d.x + a * P, y: d.y + l * P } : d;
1830
- c > 0 && o.push(`L ${M.x} ${M.y}`), y && o.push(
1831
- `C ${d.x} ${d.y} ${d.x} ${d.y} ${b.x} ${b.y}`
1849
+ const m = h !== 0 ? Math.min((f ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, S = f ? { x: a.x + i * m, y: a.y + n * m } : a, T = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = f ? { x: a.x + c * T, y: a.y + g * T } : a;
1850
+ d > 0 && t.push(`L ${M.x} ${M.y}`), f && t.push(
1851
+ `C ${a.x} ${a.y} ${a.x} ${a.y} ${S.x} ${S.y}`
1832
1852
  );
1833
1853
  });
1834
1854
  }
1835
- return o.join(" ");
1836
- }, Ke = (t) => {
1837
- const e = t.hasSourceArrow ? f(
1838
- { x: t.arrowLength, y: g.y },
1839
- t.fromVector,
1840
- g
1841
- ) : g, o = t.hasTargetArrow ? f(
1842
- { x: t.to.x - t.arrowLength, y: t.to.y },
1843
- t.toVector,
1844
- t.to
1845
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = i - t.roundness, h = f(
1846
- { x: s, y: g.y },
1847
- t.fromVector,
1848
- g
1849
- ), n = f(
1850
- { x: t.to.x - s, y: t.to.y },
1851
- t.toVector,
1852
- t.to
1853
- ), d = Math.max((h.x + n.x) / 2, i), c = t.to.y / 2, a = {
1854
- x: t.flipX > 0 ? d : -i,
1855
- y: h.y
1856
- }, l = { x: a.x, y: c }, w = {
1857
- x: t.flipX > 0 ? t.to.x - d : t.to.x + i,
1858
- y: n.y
1859
- }, v = { x: w.x, y: c };
1860
- return V(
1861
- [e, h, a, l, v, w, n, o],
1862
- t.roundness
1863
- );
1864
- }, j = (t) => {
1865
- const e = t.hasSourceArrow ? f(
1866
- { x: t.arrowLength, y: g.y },
1867
- t.fromVector,
1868
- g
1869
- ) : g, o = t.hasTargetArrow ? f(
1870
- { x: t.to.x - t.arrowLength, y: t.to.y },
1871
- t.toVector,
1872
- t.to
1873
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = f(
1874
- { x: i, y: g.y },
1875
- t.fromVector,
1876
- g
1877
- ), h = Math.cos(t.detourDirection) * t.detourDistance, n = Math.sin(t.detourDirection) * t.detourDistance, d = h * t.flipX, c = n * t.flipY, a = { x: s.x + d, y: s.y + c }, l = f(
1878
- { x: t.to.x - i, y: t.to.y },
1879
- t.toVector,
1880
- t.to
1881
- ), w = { x: l.x + d, y: l.y + c };
1882
- return V(
1883
- [e, s, a, w, l, o],
1884
- t.roundness
1885
- );
1886
- }, Qe = (t) => {
1887
- const e = t.hasSourceArrow ? f(
1888
- { x: t.arrowLength, y: g.y },
1889
- t.fromVector,
1890
- g
1891
- ) : g, o = t.hasTargetArrow ? f(
1892
- { x: t.to.x - t.arrowLength, y: t.to.y },
1893
- t.toVector,
1894
- t.to
1895
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = f(
1896
- { x: i, y: g.y },
1897
- t.fromVector,
1898
- g
1899
- ), h = f(
1900
- { x: t.to.x - i, y: t.to.y },
1901
- t.toVector,
1902
- t.to
1903
- );
1904
- return V([e, s, h, o], t.roundness);
1905
- }, _e = (t) => {
1906
- const e = t.hasSourceArrow ? f(
1907
- { x: t.arrowLength, y: g.y },
1908
- t.fromVector,
1909
- g
1910
- ) : g, o = t.hasTargetArrow ? f(
1911
- { x: t.to.x - t.arrowLength, y: t.to.y },
1912
- t.toVector,
1913
- t.to
1914
- ) : t.to, i = t.arrowLength + t.arrowOffset, s = i - t.roundness, h = f(
1915
- { x: s, y: g.y },
1916
- t.fromVector,
1917
- g
1918
- ), n = f(
1919
- { x: t.to.x - s, y: t.to.y },
1920
- t.toVector,
1921
- t.to
1922
- ), d = Math.max((h.y + n.y) / 2, i), c = t.to.x / 2, a = {
1923
- x: h.x,
1924
- y: t.flipY > 0 ? d : -i
1925
- }, l = { x: c, y: a.y }, w = {
1926
- x: n.x,
1927
- y: t.flipY > 0 ? t.to.y - d : t.to.y + i
1928
- }, v = { x: c, y: w.y };
1929
- return V(
1930
- [e, h, a, l, v, w, n, o],
1931
- t.roundness
1932
- );
1933
- }, G = (t) => {
1934
- const e = t.arrowOffset, o = t.side, i = t.arrowLength + e, s = i + 2 * o, n = [
1935
- { x: t.arrowLength, y: g.y },
1936
- { x: i, y: g.y },
1937
- { x: i, y: t.side },
1938
- { x: s, y: t.side },
1939
- { x: s, y: -t.side },
1940
- { x: i, y: -t.side },
1941
- { x: i, y: g.y },
1942
- { x: t.arrowLength, y: g.y }
1943
- ].map(
1944
- (c) => f(c, t.fromVector, g)
1945
- ), d = `M ${g.x} ${g.y} L ${n[0].x} ${n[0].y} `;
1946
- return `${t.hasSourceArrow || t.hasTargetArrow ? "" : d}${V(n, t.roundness)}`;
1947
- }, qe = (t) => {
1948
- const e = t.smallRadius, o = t.radius, i = Math.sqrt(e * e + o * o), s = e + o, h = t.arrowLength + i * (1 - o / s), n = e * o / s, c = [
1949
- { x: t.arrowLength, y: g.y },
1950
- { x: h, y: n },
1951
- { x: h, y: -n }
1952
- ].map(
1953
- (w) => f(w, t.fromVector, g)
1954
- ), a = [
1955
- `M ${c[0].x} ${c[0].y}`,
1956
- `A ${e} ${e} 0 0 1 ${c[1].x} ${c[1].y}`,
1957
- `A ${o} ${o} 0 1 0 ${c[2].x} ${c[2].y}`,
1958
- `A ${e} ${e} 0 0 1 ${c[0].x} ${c[0].y}`
1959
- ].join(" "), l = `M 0 0 L ${c[0].x} ${c[0].y} `;
1960
- return `${t.hasSourceArrow || t.hasTargetArrow ? "" : l}${a}`;
1961
- }, ae = (t, e) => {
1962
- t.style.transform = `translate(${e.x}px, ${e.y}px)`, t.style.width = `${Math.max(e.width, 1)}px`, t.style.height = `${Math.max(e.height, 1)}px`;
1855
+ return t.join(" ");
1856
+ };
1857
+ class Ke {
1858
+ constructor(e) {
1859
+ o(this, "path");
1860
+ o(this, "median");
1861
+ this.params = e;
1862
+ const t = this.params.to;
1863
+ this.median = { x: t.x / 2, y: t.y / 2 };
1864
+ const s = this.params.hasSourceArrow ? y(
1865
+ { x: this.params.arrowLength, y: w.y },
1866
+ this.params.sourceDirection,
1867
+ w
1868
+ ) : w, i = this.params.hasTargetArrow ? y(
1869
+ {
1870
+ x: this.params.to.x - this.params.arrowLength,
1871
+ y: this.params.to.y
1872
+ },
1873
+ this.params.targetDirection,
1874
+ this.params.to
1875
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
1876
+ { x: h, y: w.y },
1877
+ this.params.sourceDirection,
1878
+ w
1879
+ ), d = y(
1880
+ { x: this.params.to.x - h, y: this.params.to.y },
1881
+ this.params.targetDirection,
1882
+ this.params.to
1883
+ ), c = Math.max((a.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
1884
+ x: this.params.flipX > 0 ? c : -n,
1885
+ y: a.y
1886
+ }, v = { x: l.x, y: g }, p = {
1887
+ x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1888
+ y: d.y
1889
+ }, f = { x: p.x, y: g };
1890
+ this.path = R(
1891
+ [s, a, l, v, f, p, d, i],
1892
+ this.params.roundness
1893
+ );
1894
+ }
1895
+ }
1896
+ class j {
1897
+ constructor(e) {
1898
+ o(this, "path");
1899
+ o(this, "median");
1900
+ this.params = e;
1901
+ const t = this.params.hasSourceArrow ? y(
1902
+ { x: this.params.arrowLength, y: w.y },
1903
+ this.params.sourceDirection,
1904
+ w
1905
+ ) : w, s = this.params.hasTargetArrow ? y(
1906
+ {
1907
+ x: this.params.to.x - this.params.arrowLength,
1908
+ y: this.params.to.y
1909
+ },
1910
+ this.params.targetDirection,
1911
+ this.params.to
1912
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1913
+ { x: i, y: w.y },
1914
+ this.params.sourceDirection,
1915
+ w
1916
+ ), h = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = h * this.params.flipX, c = a * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = y(
1917
+ { x: this.params.to.x - i, y: this.params.to.y },
1918
+ this.params.targetDirection,
1919
+ this.params.to
1920
+ ), v = { x: l.x + d, y: l.y + c };
1921
+ this.median = { x: (g.x + v.x) / 2, y: (g.y + v.y) / 2 }, this.path = R(
1922
+ [t, n, g, v, l, s],
1923
+ this.params.roundness
1924
+ );
1925
+ }
1926
+ }
1927
+ class Qe {
1928
+ constructor(e) {
1929
+ o(this, "path");
1930
+ o(this, "median");
1931
+ this.params = e;
1932
+ const t = this.params.to;
1933
+ this.median = { x: t.x / 2, y: t.y / 2 };
1934
+ const s = this.params.hasSourceArrow ? y(
1935
+ { x: this.params.arrowLength, y: w.y },
1936
+ this.params.sourceDirection,
1937
+ w
1938
+ ) : w, i = this.params.hasTargetArrow ? y(
1939
+ {
1940
+ x: this.params.to.x - this.params.arrowLength,
1941
+ y: this.params.to.y
1942
+ },
1943
+ this.params.targetDirection,
1944
+ this.params.to
1945
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = y(
1946
+ { x: n, y: w.y },
1947
+ this.params.sourceDirection,
1948
+ w
1949
+ ), a = y(
1950
+ { x: this.params.to.x - n, y: this.params.to.y },
1951
+ this.params.targetDirection,
1952
+ this.params.to
1953
+ );
1954
+ this.path = R([s, h, a, i], this.params.roundness);
1955
+ }
1956
+ }
1957
+ class _e {
1958
+ constructor(e) {
1959
+ o(this, "path");
1960
+ o(this, "median");
1961
+ this.params = e;
1962
+ const t = this.params.to;
1963
+ this.median = { x: t.x / 2, y: t.y / 2 };
1964
+ const s = this.params.hasSourceArrow ? y(
1965
+ { x: this.params.arrowLength, y: w.y },
1966
+ this.params.sourceDirection,
1967
+ w
1968
+ ) : w, i = this.params.hasTargetArrow ? y(
1969
+ {
1970
+ x: this.params.to.x - this.params.arrowLength,
1971
+ y: this.params.to.y
1972
+ },
1973
+ this.params.targetDirection,
1974
+ this.params.to
1975
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, h = n - this.params.roundness, a = y(
1976
+ { x: h, y: w.y },
1977
+ this.params.sourceDirection,
1978
+ w
1979
+ ), d = y(
1980
+ { x: this.params.to.x - h, y: this.params.to.y },
1981
+ this.params.targetDirection,
1982
+ this.params.to
1983
+ ), c = Math.max((a.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
1984
+ x: a.x,
1985
+ y: this.params.flipY > 0 ? c : -n
1986
+ }, v = { x: g, y: l.y }, p = {
1987
+ x: d.x,
1988
+ y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1989
+ }, f = { x: g, y: p.y };
1990
+ this.path = R(
1991
+ [s, a, l, v, f, p, d, i],
1992
+ this.params.roundness
1993
+ );
1994
+ }
1995
+ }
1996
+ class G {
1997
+ constructor(e) {
1998
+ o(this, "path");
1999
+ o(this, "median");
2000
+ this.params = e;
2001
+ const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, a = [
2002
+ { x: this.params.arrowLength, y: w.y },
2003
+ { x: i, y: w.y },
2004
+ { x: i, y: this.params.side },
2005
+ { x: n, y: this.params.side },
2006
+ { x: n, y: -this.params.side },
2007
+ { x: i, y: -this.params.side },
2008
+ { x: i, y: w.y },
2009
+ { x: this.params.arrowLength, y: w.y }
2010
+ ].map(
2011
+ (c) => y(c, this.params.sourceDirection, w)
2012
+ ), d = `M ${w.x} ${w.y} L ${a[0].x} ${a[0].y} `;
2013
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(a, this.params.roundness)}`, this.median = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
2014
+ }
2015
+ }
2016
+ class qe {
2017
+ constructor(e) {
2018
+ o(this, "path");
2019
+ o(this, "median");
2020
+ this.params = e;
2021
+ const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, h = Math.sqrt(i * i - t * t), a = h * t / i, d = h + s + this.params.arrowLength, c = this.params.arrowLength + a, l = [
2022
+ { x: this.params.arrowLength, y: w.y },
2023
+ { x: c, y: n },
2024
+ { x: c, y: -n },
2025
+ { x: d, y: 0 }
2026
+ ].map(
2027
+ (f) => y(f, this.params.sourceDirection, w)
2028
+ ), v = [
2029
+ `M ${l[0].x} ${l[0].y}`,
2030
+ `A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
2031
+ `A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
2032
+ `A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
2033
+ ].join(" "), p = `M 0 0 L ${l[0].x} ${l[0].y} `;
2034
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${v}`, this.median = l[3];
2035
+ }
2036
+ }
2037
+ class et {
2038
+ constructor(e) {
2039
+ o(this, "path");
2040
+ o(this, "median");
2041
+ o(this, "diagonalDistance");
2042
+ this.params = e;
2043
+ const t = this.params.to;
2044
+ if (this.median = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
2045
+ this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
2046
+ ), Math.sqrt(
2047
+ this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
2048
+ ) === 0) {
2049
+ this.path = "";
2050
+ return;
2051
+ }
2052
+ const i = this.createDirectLinePoint({
2053
+ offset: this.params.sourceOffset,
2054
+ hasArrow: this.params.hasSourceArrow,
2055
+ flip: 1,
2056
+ shift: w
2057
+ }), n = this.createDirectLinePoint({
2058
+ offset: this.params.targetOffset,
2059
+ hasArrow: this.params.hasTargetArrow,
2060
+ flip: -1,
2061
+ shift: this.params.to
2062
+ });
2063
+ this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
2064
+ }
2065
+ createDirectLinePoint(e) {
2066
+ const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
2067
+ return {
2068
+ x: this.params.to.x * i + e.shift.x,
2069
+ y: this.params.to.y * i + e.shift.y
2070
+ };
2071
+ }
2072
+ }
2073
+ const ce = (r, e) => {
2074
+ 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`;
2075
+ }, Z = Object.freeze({
2076
+ edgeColor: "--edge-color"
2077
+ }), le = (r) => {
2078
+ const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2079
+ 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;
2080
+ }, V = () => {
2081
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
2082
+ return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
2083
+ }, ge = () => {
2084
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2085
+ return r.style.transformOrigin = "50% 50%", r;
2086
+ }, ue = (r) => {
2087
+ const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2088
+ return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
2089
+ }, we = (r, e) => {
2090
+ const t = {
2091
+ x: r.x + r.width / 2,
2092
+ y: r.y + r.height / 2
2093
+ }, s = {
2094
+ x: e.x + e.width / 2,
2095
+ y: e.y + e.height / 2
2096
+ }, i = Math.min(t.x, s.x), n = Math.min(t.y, s.y), h = Math.abs(s.x - t.x), a = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
2097
+ return {
2098
+ x: i,
2099
+ y: n,
2100
+ width: h,
2101
+ height: a,
2102
+ flipX: d,
2103
+ flipY: c
2104
+ };
2105
+ }, O = (r, e, t, s) => {
2106
+ const n = [
2107
+ w,
2108
+ { x: t, y: s },
2109
+ { x: t, y: -s }
2110
+ ].map((c) => y(c, r, w)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), h = `M ${n[0].x} ${n[0].y}`, a = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
2111
+ return `${h} ${a} ${d} Z`;
1963
2112
  }, u = Object.freeze({
1964
2113
  color: "#777777",
1965
2114
  width: 1,
@@ -1978,129 +2127,98 @@ const He = (t, e) => ({
1978
2127
  curvature: 90,
1979
2128
  interactiveWidth: 10,
1980
2129
  preOffset: 0
1981
- }), O = (t, e, o, i) => {
1982
- const h = [
1983
- g,
1984
- { x: o, y: i },
1985
- { x: o, y: -i }
1986
- ].map((a) => f(a, t, g)).map((a) => ({ x: a.x + e.x, y: a.y + e.y })), n = `M ${h[0].x} ${h[0].y}`, d = `L ${h[1].x} ${h[1].y}`, c = `L ${h[2].x} ${h[2].y}`;
1987
- return `${n} ${d} ${c} Z`;
1988
- }, B = (t) => {
1989
- const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1990
- return e.setAttribute("fill", t), e;
1991
- }, le = () => {
1992
- const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
1993
- return t.style.transformOrigin = "50% 50%", t;
1994
- }, ue = (t, e) => {
1995
- const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1996
- return o.setAttribute("stroke", t), o.setAttribute("stroke-width", `${e}`), o.setAttribute("fill", "none"), o;
1997
- }, ge = (t, e) => {
1998
- const o = {
1999
- x: t.x + t.width / 2,
2000
- y: t.y + t.height / 2
2001
- }, i = {
2002
- x: e.x + e.width / 2,
2003
- y: e.y + e.height / 2
2004
- }, s = Math.min(o.x, i.x), h = Math.min(o.y, i.y), n = Math.abs(i.x - o.x), d = Math.abs(i.y - o.y), c = o.x <= i.x ? 1 : -1, a = o.y <= i.y ? 1 : -1;
2005
- return {
2006
- x: s,
2007
- y: h,
2008
- width: n,
2009
- height: d,
2010
- flipX: c,
2011
- flipY: a
2012
- };
2013
- }, we = () => {
2014
- const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2015
- return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t;
2016
- }, oe = (t, e, o) => ({ x: e * Math.cos(t), y: o * Math.sin(t) });
2130
+ }), oe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
2017
2131
  class C {
2018
2132
  constructor(e) {
2019
- r(this, "svg", we());
2020
- r(this, "group", le());
2021
- r(this, "line");
2022
- r(this, "sourceArrow", null);
2023
- r(this, "targetArrow", null);
2024
- this.params = e, this.svg.appendChild(this.group), this.line = ue(e.color, e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(e.color), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(e.color), this.group.appendChild(this.targetArrow));
2133
+ o(this, "svg");
2134
+ o(this, "group", ge());
2135
+ o(this, "line");
2136
+ o(this, "sourceArrow", null);
2137
+ o(this, "targetArrow", null);
2138
+ o(this, "onAfterRender");
2139
+ o(this, "afterRenderEmitter");
2140
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg = le(e.color), this.svg.appendChild(this.group), this.line = ue(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2025
2141
  }
2026
2142
  render(e) {
2027
- const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } = ge(
2143
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = we(
2028
2144
  e.from,
2029
2145
  e.to
2030
2146
  );
2031
- ae(this.svg, { x: o, y: i, width: s, height: h }), this.group.style.transform = `scale(${n}, ${d})`;
2032
- const c = oe(
2147
+ ce(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2148
+ const d = oe(
2033
2149
  e.from.direction,
2034
- n,
2035
- d
2036
- ), a = oe(
2150
+ h,
2151
+ a
2152
+ ), c = oe(
2037
2153
  e.to.direction,
2038
- n,
2039
- d
2040
- ), l = {
2041
- x: s,
2042
- y: h
2154
+ h,
2155
+ a
2156
+ ), g = {
2157
+ x: i,
2158
+ y: n
2043
2159
  };
2044
- let w = a, v = -this.params.arrowLength, A;
2045
- e.from.portId === e.to.portId ? (A = this.params.createCyclePath, w = c, v = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? A = this.params.createDetourPath : A = this.params.createLinePath;
2046
- const y = A(
2160
+ let l = c, v = -this.params.arrowLength, p;
2161
+ e.from.portId === e.to.portId ? (p = this.params.createCyclePath, l = d, v = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? p = this.params.createDetourPath : p = this.params.createLinePath;
2162
+ const f = p(
2163
+ d,
2047
2164
  c,
2048
- a,
2049
- l,
2050
- n,
2051
- d
2165
+ g,
2166
+ h,
2167
+ a
2052
2168
  );
2053
- if (this.line.setAttribute("d", y), this.sourceArrow) {
2054
- const E = O(
2055
- c,
2056
- g,
2057
- this.params.arrowLength,
2058
- this.params.arrowWidth
2059
- );
2060
- this.sourceArrow.setAttribute("d", E);
2061
- }
2062
- if (this.targetArrow) {
2063
- const E = O(
2064
- w,
2065
- l,
2066
- v,
2067
- this.params.arrowWidth
2068
- );
2069
- this.targetArrow.setAttribute("d", E);
2070
- }
2169
+ this.line.setAttribute("d", f.path);
2170
+ let A = null;
2171
+ this.sourceArrow && (A = O(
2172
+ d,
2173
+ w,
2174
+ this.params.arrowLength,
2175
+ this.params.arrowWidth
2176
+ ), this.sourceArrow.setAttribute("d", A));
2177
+ let m = null;
2178
+ this.targetArrow && (m = O(
2179
+ l,
2180
+ g,
2181
+ v,
2182
+ this.params.arrowWidth
2183
+ ), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
2184
+ edgePath: f,
2185
+ sourceArrowPath: A,
2186
+ targetArrowPath: m
2187
+ });
2071
2188
  }
2072
2189
  }
2073
- class et {
2190
+ class tt {
2074
2191
  constructor(e) {
2075
- r(this, "svg");
2076
- r(this, "group");
2077
- r(this, "line");
2078
- r(this, "sourceArrow");
2079
- r(this, "targetArrow");
2080
- r(this, "arrowLength");
2081
- r(this, "arrowWidth");
2082
- r(this, "curvature");
2083
- r(this, "portCycleRadius");
2084
- r(this, "portCycleSmallRadius");
2085
- r(this, "detourDirection");
2086
- r(this, "detourDistance");
2087
- r(this, "hasSourceArrow");
2088
- r(this, "hasTargetArrow");
2089
- r(this, "lineShape");
2090
- r(this, "createCyclePath", (e) => qe({
2091
- fromVector: e,
2192
+ o(this, "svg");
2193
+ o(this, "group");
2194
+ o(this, "line");
2195
+ o(this, "sourceArrow");
2196
+ o(this, "targetArrow");
2197
+ o(this, "onAfterRender");
2198
+ o(this, "arrowLength");
2199
+ o(this, "arrowWidth");
2200
+ o(this, "curvature");
2201
+ o(this, "portCycleRadius");
2202
+ o(this, "portCycleSmallRadius");
2203
+ o(this, "detourDirection");
2204
+ o(this, "detourDistance");
2205
+ o(this, "hasSourceArrow");
2206
+ o(this, "hasTargetArrow");
2207
+ o(this, "pathShape");
2208
+ o(this, "createCyclePath", (e) => new qe({
2209
+ sourceDirection: e,
2092
2210
  radius: this.portCycleRadius,
2093
2211
  smallRadius: this.portCycleSmallRadius,
2094
2212
  arrowLength: this.arrowLength,
2095
2213
  hasSourceArrow: this.hasSourceArrow,
2096
2214
  hasTargetArrow: this.hasTargetArrow
2097
2215
  }));
2098
- r(this, "createDetourPath", (e, o, i, s, h) => Je({
2099
- to: i,
2100
- fromVector: e,
2101
- toVector: o,
2102
- flipX: s,
2103
- flipY: h,
2216
+ o(this, "createDetourPath", (e, t, s, i, n) => new Je({
2217
+ to: s,
2218
+ sourceDirection: e,
2219
+ targetDirection: t,
2220
+ flipX: i,
2221
+ flipY: n,
2104
2222
  arrowLength: this.arrowLength,
2105
2223
  detourDirection: this.detourDirection,
2106
2224
  detourDistance: this.detourDistance,
@@ -2108,16 +2226,16 @@ class et {
2108
2226
  hasSourceArrow: this.hasSourceArrow,
2109
2227
  hasTargetArrow: this.hasTargetArrow
2110
2228
  }));
2111
- r(this, "createLinePath", (e, o, i) => Ze({
2112
- to: i,
2113
- fromVector: e,
2114
- toVector: o,
2229
+ o(this, "createLinePath", (e, t, s) => new Ze({
2230
+ to: s,
2231
+ sourceDirection: e,
2232
+ targetDirection: t,
2115
2233
  arrowLength: this.arrowLength,
2116
2234
  curvature: this.curvature,
2117
2235
  hasSourceArrow: this.hasSourceArrow,
2118
2236
  hasTargetArrow: this.hasTargetArrow
2119
2237
  }));
2120
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2238
+ this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2121
2239
  color: (e == null ? void 0 : e.color) ?? u.color,
2122
2240
  width: (e == null ? void 0 : e.width) ?? u.width,
2123
2241
  arrowLength: this.arrowLength,
@@ -2127,31 +2245,32 @@ class et {
2127
2245
  createCyclePath: this.createCyclePath,
2128
2246
  createDetourPath: this.createDetourPath,
2129
2247
  createLinePath: this.createLinePath
2130
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2248
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2131
2249
  }
2132
2250
  render(e) {
2133
- this.lineShape.render(e);
2251
+ this.pathShape.render(e);
2134
2252
  }
2135
2253
  }
2136
- class tt {
2254
+ class rt {
2137
2255
  constructor(e) {
2138
- r(this, "svg");
2139
- r(this, "group");
2140
- r(this, "line");
2141
- r(this, "sourceArrow");
2142
- r(this, "targetArrow");
2143
- r(this, "arrowLength");
2144
- r(this, "arrowWidth");
2145
- r(this, "arrowOffset");
2146
- r(this, "roundness");
2147
- r(this, "cycleSquareSide");
2148
- r(this, "detourDirection");
2149
- r(this, "detourDistance");
2150
- r(this, "hasSourceArrow");
2151
- r(this, "hasTargetArrow");
2152
- r(this, "lineShape");
2153
- r(this, "createCyclePath", (e) => G({
2154
- fromVector: e,
2256
+ o(this, "svg");
2257
+ o(this, "group");
2258
+ o(this, "line");
2259
+ o(this, "sourceArrow");
2260
+ o(this, "targetArrow");
2261
+ o(this, "onAfterRender");
2262
+ o(this, "arrowLength");
2263
+ o(this, "arrowWidth");
2264
+ o(this, "arrowOffset");
2265
+ o(this, "roundness");
2266
+ o(this, "cycleSquareSide");
2267
+ o(this, "detourDirection");
2268
+ o(this, "detourDistance");
2269
+ o(this, "hasSourceArrow");
2270
+ o(this, "hasTargetArrow");
2271
+ o(this, "pathShape");
2272
+ o(this, "createCyclePath", (e) => new G({
2273
+ sourceDirection: e,
2155
2274
  arrowLength: this.arrowLength,
2156
2275
  side: this.cycleSquareSide,
2157
2276
  arrowOffset: this.arrowOffset,
@@ -2159,12 +2278,12 @@ class tt {
2159
2278
  hasSourceArrow: this.hasSourceArrow,
2160
2279
  hasTargetArrow: this.hasTargetArrow
2161
2280
  }));
2162
- r(this, "createDetourPath", (e, o, i, s, h) => j({
2163
- to: i,
2164
- fromVector: e,
2165
- toVector: o,
2166
- flipX: s,
2167
- flipY: h,
2281
+ o(this, "createDetourPath", (e, t, s, i, n) => new j({
2282
+ to: s,
2283
+ sourceDirection: e,
2284
+ targetDirection: t,
2285
+ flipX: i,
2286
+ flipY: n,
2168
2287
  arrowLength: this.arrowLength,
2169
2288
  arrowOffset: this.arrowOffset,
2170
2289
  roundness: this.roundness,
@@ -2173,11 +2292,11 @@ class tt {
2173
2292
  hasSourceArrow: this.hasSourceArrow,
2174
2293
  hasTargetArrow: this.hasTargetArrow
2175
2294
  }));
2176
- r(this, "createLinePath", (e, o, i, s) => Ke({
2177
- to: i,
2178
- fromVector: e,
2179
- toVector: o,
2180
- flipX: s,
2295
+ o(this, "createLinePath", (e, t, s, i) => new Ke({
2296
+ to: s,
2297
+ sourceDirection: e,
2298
+ targetDirection: t,
2299
+ flipX: i,
2181
2300
  arrowLength: this.arrowLength,
2182
2301
  arrowOffset: this.arrowOffset,
2183
2302
  roundness: this.roundness,
@@ -2185,12 +2304,12 @@ class tt {
2185
2304
  hasTargetArrow: this.hasTargetArrow
2186
2305
  }));
2187
2306
  this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
2188
- const o = (e == null ? void 0 : e.roundness) ?? u.roundness;
2307
+ const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
2189
2308
  this.roundness = Math.min(
2190
- o,
2309
+ t,
2191
2310
  this.arrowOffset,
2192
2311
  this.cycleSquareSide / 2
2193
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2312
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2194
2313
  color: (e == null ? void 0 : e.color) ?? u.color,
2195
2314
  width: (e == null ? void 0 : e.width) ?? u.width,
2196
2315
  arrowLength: this.arrowLength,
@@ -2200,31 +2319,32 @@ class tt {
2200
2319
  createCyclePath: this.createCyclePath,
2201
2320
  createDetourPath: this.createDetourPath,
2202
2321
  createLinePath: this.createLinePath
2203
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2322
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2204
2323
  }
2205
2324
  render(e) {
2206
- this.lineShape.render(e);
2325
+ this.pathShape.render(e);
2207
2326
  }
2208
2327
  }
2209
2328
  class ot {
2210
2329
  constructor(e) {
2211
- r(this, "svg");
2212
- r(this, "group");
2213
- r(this, "line");
2214
- r(this, "sourceArrow");
2215
- r(this, "targetArrow");
2216
- r(this, "arrowLength");
2217
- r(this, "arrowWidth");
2218
- r(this, "arrowOffset");
2219
- r(this, "roundness");
2220
- r(this, "cycleSquareSide");
2221
- r(this, "detourDirection");
2222
- r(this, "detourDistance");
2223
- r(this, "hasSourceArrow");
2224
- r(this, "hasTargetArrow");
2225
- r(this, "lineShape");
2226
- r(this, "createCyclePath", (e) => G({
2227
- fromVector: e,
2330
+ o(this, "svg");
2331
+ o(this, "group");
2332
+ o(this, "line");
2333
+ o(this, "sourceArrow");
2334
+ o(this, "targetArrow");
2335
+ o(this, "onAfterRender");
2336
+ o(this, "arrowLength");
2337
+ o(this, "arrowWidth");
2338
+ o(this, "arrowOffset");
2339
+ o(this, "roundness");
2340
+ o(this, "cycleSquareSide");
2341
+ o(this, "detourDirection");
2342
+ o(this, "detourDistance");
2343
+ o(this, "hasSourceArrow");
2344
+ o(this, "hasTargetArrow");
2345
+ o(this, "pathShape");
2346
+ o(this, "createCyclePath", (e) => new G({
2347
+ sourceDirection: e,
2228
2348
  arrowLength: this.arrowLength,
2229
2349
  side: this.cycleSquareSide,
2230
2350
  arrowOffset: this.arrowOffset,
@@ -2232,12 +2352,12 @@ class ot {
2232
2352
  hasSourceArrow: this.hasSourceArrow,
2233
2353
  hasTargetArrow: this.hasTargetArrow
2234
2354
  }));
2235
- r(this, "createDetourPath", (e, o, i, s, h) => j({
2236
- to: i,
2237
- fromVector: e,
2238
- toVector: o,
2239
- flipX: s,
2240
- flipY: h,
2355
+ o(this, "createDetourPath", (e, t, s, i, n) => new j({
2356
+ to: s,
2357
+ sourceDirection: e,
2358
+ targetDirection: t,
2359
+ flipX: i,
2360
+ flipY: n,
2241
2361
  arrowLength: this.arrowLength,
2242
2362
  arrowOffset: this.arrowOffset,
2243
2363
  roundness: this.roundness,
@@ -2246,10 +2366,10 @@ class ot {
2246
2366
  hasSourceArrow: this.hasSourceArrow,
2247
2367
  hasTargetArrow: this.hasTargetArrow
2248
2368
  }));
2249
- r(this, "createLinePath", (e, o, i) => Qe({
2250
- to: i,
2251
- fromVector: e,
2252
- toVector: o,
2369
+ o(this, "createLinePath", (e, t, s) => new Qe({
2370
+ to: s,
2371
+ sourceDirection: e,
2372
+ targetDirection: t,
2253
2373
  arrowLength: this.arrowLength,
2254
2374
  arrowOffset: this.arrowOffset,
2255
2375
  roundness: this.roundness,
@@ -2257,12 +2377,12 @@ class ot {
2257
2377
  hasTargetArrow: this.hasTargetArrow
2258
2378
  }));
2259
2379
  this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
2260
- const o = (e == null ? void 0 : e.roundness) ?? u.roundness;
2380
+ const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
2261
2381
  this.roundness = Math.min(
2262
- o,
2382
+ t,
2263
2383
  this.arrowOffset,
2264
2384
  this.cycleSquareSide / 2
2265
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2385
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2266
2386
  color: (e == null ? void 0 : e.color) ?? u.color,
2267
2387
  width: (e == null ? void 0 : e.width) ?? u.width,
2268
2388
  arrowLength: this.arrowLength,
@@ -2272,31 +2392,32 @@ class ot {
2272
2392
  createCyclePath: this.createCyclePath,
2273
2393
  createDetourPath: this.createDetourPath,
2274
2394
  createLinePath: this.createLinePath
2275
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2395
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2276
2396
  }
2277
2397
  render(e) {
2278
- this.lineShape.render(e);
2398
+ this.pathShape.render(e);
2279
2399
  }
2280
2400
  }
2281
- class rt {
2401
+ class st {
2282
2402
  constructor(e) {
2283
- r(this, "svg");
2284
- r(this, "group");
2285
- r(this, "line");
2286
- r(this, "sourceArrow");
2287
- r(this, "targetArrow");
2288
- r(this, "arrowLength");
2289
- r(this, "arrowWidth");
2290
- r(this, "arrowOffset");
2291
- r(this, "roundness");
2292
- r(this, "cycleSquareSide");
2293
- r(this, "detourDirection");
2294
- r(this, "detourDistance");
2295
- r(this, "hasSourceArrow");
2296
- r(this, "hasTargetArrow");
2297
- r(this, "lineShape");
2298
- r(this, "createCyclePath", (e) => G({
2299
- fromVector: e,
2403
+ o(this, "svg");
2404
+ o(this, "group");
2405
+ o(this, "line");
2406
+ o(this, "sourceArrow");
2407
+ o(this, "targetArrow");
2408
+ o(this, "onAfterRender");
2409
+ o(this, "arrowLength");
2410
+ o(this, "arrowWidth");
2411
+ o(this, "arrowOffset");
2412
+ o(this, "roundness");
2413
+ o(this, "cycleSquareSide");
2414
+ o(this, "detourDirection");
2415
+ o(this, "detourDistance");
2416
+ o(this, "hasSourceArrow");
2417
+ o(this, "hasTargetArrow");
2418
+ o(this, "pathShape");
2419
+ o(this, "createCyclePath", (e) => new G({
2420
+ sourceDirection: e,
2300
2421
  arrowLength: this.arrowLength,
2301
2422
  side: this.cycleSquareSide,
2302
2423
  arrowOffset: this.arrowOffset,
@@ -2304,12 +2425,12 @@ class rt {
2304
2425
  hasSourceArrow: this.hasSourceArrow,
2305
2426
  hasTargetArrow: this.hasTargetArrow
2306
2427
  }));
2307
- r(this, "createDetourPath", (e, o, i, s, h) => j({
2308
- to: i,
2309
- fromVector: e,
2310
- toVector: o,
2311
- flipX: s,
2312
- flipY: h,
2428
+ o(this, "createDetourPath", (e, t, s, i, n) => new j({
2429
+ to: s,
2430
+ sourceDirection: e,
2431
+ targetDirection: t,
2432
+ flipX: i,
2433
+ flipY: n,
2313
2434
  arrowLength: this.arrowLength,
2314
2435
  arrowOffset: this.arrowOffset,
2315
2436
  roundness: this.roundness,
@@ -2318,11 +2439,11 @@ class rt {
2318
2439
  hasSourceArrow: this.hasSourceArrow,
2319
2440
  hasTargetArrow: this.hasTargetArrow
2320
2441
  }));
2321
- r(this, "createLinePath", (e, o, i, s, h) => _e({
2322
- to: i,
2323
- fromVector: e,
2324
- toVector: o,
2325
- flipY: h,
2442
+ o(this, "createLinePath", (e, t, s, i, n) => new _e({
2443
+ to: s,
2444
+ sourceDirection: e,
2445
+ targetDirection: t,
2446
+ flipY: n,
2326
2447
  arrowLength: this.arrowLength,
2327
2448
  arrowOffset: this.arrowOffset,
2328
2449
  roundness: this.roundness,
@@ -2330,12 +2451,12 @@ class rt {
2330
2451
  hasTargetArrow: this.hasTargetArrow
2331
2452
  }));
2332
2453
  this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? u.cycleSquareSide;
2333
- const o = (e == null ? void 0 : e.roundness) ?? u.roundness;
2454
+ const t = (e == null ? void 0 : e.roundness) ?? u.roundness;
2334
2455
  this.roundness = Math.min(
2335
- o,
2456
+ t,
2336
2457
  this.arrowOffset,
2337
2458
  this.cycleSquareSide / 2
2338
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.lineShape = new C({
2459
+ ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
2339
2460
  color: (e == null ? void 0 : e.color) ?? u.color,
2340
2461
  width: (e == null ? void 0 : e.width) ?? u.width,
2341
2462
  arrowLength: this.arrowLength,
@@ -2345,270 +2466,253 @@ class rt {
2345
2466
  createCyclePath: this.createCyclePath,
2346
2467
  createDetourPath: this.createDetourPath,
2347
2468
  createLinePath: this.createLinePath
2348
- }), this.svg = this.lineShape.svg, this.group = this.lineShape.group, this.line = this.lineShape.line, this.sourceArrow = this.lineShape.sourceArrow, this.targetArrow = this.lineShape.targetArrow;
2469
+ }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
2349
2470
  }
2350
2471
  render(e) {
2351
- this.lineShape.render(e);
2472
+ this.pathShape.render(e);
2352
2473
  }
2353
2474
  }
2354
- const re = (t) => {
2355
- if (t.diagonalDistance === 0)
2475
+ const se = (r) => {
2476
+ if (r.diagonalDistance === 0)
2356
2477
  return "";
2357
- const e = t.offset / t.diagonalDistance, o = t.flip * t.to.x, i = t.flip * t.to.y, s = {
2358
- x: o * e + t.shift.x,
2359
- y: i * e + t.shift.y
2360
- }, h = {
2361
- x: o / t.diagonalDistance,
2362
- y: i / t.diagonalDistance
2478
+ const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
2479
+ x: t * e + r.shift.x,
2480
+ y: s * e + r.shift.y
2481
+ }, n = {
2482
+ x: t / r.diagonalDistance,
2483
+ y: s / r.diagonalDistance
2363
2484
  };
2364
2485
  return O(
2365
- h,
2366
- s,
2367
- t.arrowLength,
2368
- t.arrowWidth
2486
+ n,
2487
+ i,
2488
+ r.arrowLength,
2489
+ r.arrowWidth
2369
2490
  );
2370
- }, ie = (t) => {
2371
- const e = t.hasArrow ? t.arrowLength : 0, o = t.offset + e, i = t.flip * o / t.diagonalDistance;
2372
- return {
2373
- x: t.to.x * i + t.shift.x,
2374
- y: t.to.y * i + t.shift.y
2375
- };
2376
- }, it = (t) => {
2377
- const e = ie({
2378
- diagonalDistance: t.diagonalDistance,
2379
- to: t.to,
2380
- offset: t.sourceOffset,
2381
- hasArrow: t.hasSourceArrow,
2382
- flip: 1,
2383
- shift: g,
2384
- arrowLength: t.arrowLength
2385
- }), o = ie({
2386
- diagonalDistance: t.diagonalDistance,
2387
- to: t.to,
2388
- offset: t.targetOffset,
2389
- hasArrow: t.hasTargetArrow,
2390
- flip: -1,
2391
- shift: t.to,
2392
- arrowLength: t.arrowLength
2393
- });
2394
- return `M ${e.x} ${e.y} L ${o.x} ${o.y}`;
2395
2491
  };
2396
- class st {
2492
+ class it {
2397
2493
  constructor(e) {
2398
- r(this, "svg", we());
2399
- r(this, "group", le());
2400
- r(this, "line");
2401
- r(this, "sourceArrow", null);
2402
- r(this, "targetArrow", null);
2403
- r(this, "color");
2404
- r(this, "width");
2405
- r(this, "arrowLength");
2406
- r(this, "arrowWidth");
2407
- r(this, "sourceOffset");
2408
- r(this, "targetOffset");
2409
- this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg.appendChild(this.group), this.line = ue(this.color, this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(this.color), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(this.color), this.group.appendChild(this.targetArrow));
2494
+ o(this, "svg");
2495
+ o(this, "group", ge());
2496
+ o(this, "line");
2497
+ o(this, "sourceArrow", null);
2498
+ o(this, "targetArrow", null);
2499
+ o(this, "color");
2500
+ o(this, "width");
2501
+ o(this, "arrowLength");
2502
+ o(this, "arrowWidth");
2503
+ o(this, "sourceOffset");
2504
+ o(this, "targetOffset");
2505
+ o(this, "onAfterRender");
2506
+ o(this, "afterRenderEmitter");
2507
+ [this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = le(this.color), this.svg.appendChild(this.group), this.line = ue(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
2410
2508
  }
2411
2509
  render(e) {
2412
- const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } = ge(
2510
+ const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = we(
2413
2511
  e.from,
2414
2512
  e.to
2415
2513
  );
2416
- ae(this.svg, { x: o, y: i, width: s, height: h }), this.group.style.transform = `scale(${n}, ${d})`;
2417
- const c = Math.sqrt(s * s + h * h), a = { x: s, y: h };
2418
- if (c > 0) {
2419
- const l = it({
2420
- diagonalDistance: c,
2421
- to: a,
2422
- sourceOffset: this.sourceOffset,
2423
- targetOffset: this.targetOffset,
2424
- hasSourceArrow: this.sourceArrow !== null,
2425
- hasTargetArrow: this.targetArrow !== null,
2426
- arrowLength: this.arrowLength
2427
- });
2428
- this.line.setAttribute("d", l);
2429
- } else
2430
- this.line.setAttribute("d", "");
2431
- if (this.sourceArrow) {
2432
- const l = re({
2433
- diagonalDistance: c,
2434
- to: a,
2435
- offset: this.sourceOffset,
2436
- flip: 1,
2437
- shift: g,
2438
- arrowWidth: this.arrowWidth,
2439
- arrowLength: this.arrowLength
2440
- });
2441
- this.sourceArrow.setAttribute("d", l);
2442
- }
2443
- if (this.targetArrow) {
2444
- const l = re({
2445
- diagonalDistance: c,
2446
- to: a,
2447
- offset: this.targetOffset,
2448
- flip: -1,
2449
- shift: a,
2450
- arrowWidth: this.arrowWidth,
2451
- arrowLength: this.arrowLength
2452
- });
2453
- this.targetArrow.setAttribute("d", l);
2454
- }
2514
+ ce(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
2515
+ const d = { x: i, y: n }, c = new et({
2516
+ to: d,
2517
+ sourceOffset: this.sourceOffset,
2518
+ targetOffset: this.targetOffset,
2519
+ hasSourceArrow: this.sourceArrow !== null,
2520
+ hasTargetArrow: this.targetArrow !== null,
2521
+ arrowLength: this.arrowLength
2522
+ });
2523
+ this.line.setAttribute("d", c.path);
2524
+ let g = null;
2525
+ this.sourceArrow && (g = se({
2526
+ diagonalDistance: c.diagonalDistance,
2527
+ to: d,
2528
+ offset: this.sourceOffset,
2529
+ flip: 1,
2530
+ shift: w,
2531
+ arrowWidth: this.arrowWidth,
2532
+ arrowLength: this.arrowLength
2533
+ }), this.sourceArrow.setAttribute("d", g));
2534
+ let l = null;
2535
+ this.targetArrow && (l = se({
2536
+ diagonalDistance: c.diagonalDistance,
2537
+ to: d,
2538
+ offset: this.targetOffset,
2539
+ flip: -1,
2540
+ shift: d,
2541
+ arrowWidth: this.arrowWidth,
2542
+ arrowLength: this.arrowLength
2543
+ }), this.targetArrow.setAttribute("d", l)), this.afterRenderEmitter.emit({
2544
+ edgePath: c,
2545
+ sourceArrowPath: g,
2546
+ targetArrowPath: l
2547
+ });
2455
2548
  }
2456
2549
  }
2457
2550
  const nt = () => {
2458
- const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
2459
- return t.style.pointerEvents = "auto", t.style.cursor = "pointer", t;
2460
- }, ht = (t) => {
2551
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
2552
+ return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
2553
+ }, ht = (r) => {
2461
2554
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2462
- return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
2463
- }, se = (t) => {
2555
+ return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
2556
+ }, ie = (r) => {
2464
2557
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
2465
- return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
2558
+ return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
2466
2559
  };
2467
- class dt extends Error {
2560
+ class at extends Error {
2468
2561
  constructor(e) {
2469
2562
  super(e), this.name = "InteractiveEdgeError";
2470
2563
  }
2471
2564
  }
2472
- class fe {
2473
- constructor(e, o) {
2474
- r(this, "svg");
2475
- r(this, "group");
2476
- r(this, "line");
2477
- r(this, "sourceArrow");
2478
- r(this, "targetArrow");
2479
- r(this, "handle", nt());
2480
- r(this, "interactiveLine");
2481
- r(this, "interactiveSourceArrow", null);
2482
- r(this, "interactiveTargetArrow", null);
2483
- if (this.structuredEdge = e, e instanceof fe)
2484
- throw new dt(
2565
+ class pe {
2566
+ constructor(e, t) {
2567
+ o(this, "svg");
2568
+ o(this, "group");
2569
+ o(this, "line");
2570
+ o(this, "sourceArrow");
2571
+ o(this, "targetArrow");
2572
+ o(this, "handle", nt());
2573
+ o(this, "onAfterRender");
2574
+ o(this, "interactiveLine");
2575
+ o(this, "interactiveSourceArrow", null);
2576
+ o(this, "interactiveTargetArrow", null);
2577
+ if (this.baseEdge = e, e instanceof pe)
2578
+ throw new at(
2485
2579
  "interactive edge can be configured only once"
2486
2580
  );
2487
- this.svg = this.structuredEdge.svg, this.group = this.structuredEdge.group, this.line = this.structuredEdge.line, this.sourceArrow = this.structuredEdge.sourceArrow, this.targetArrow = this.structuredEdge.targetArrow;
2488
- const i = (o == null ? void 0 : o.width) ?? u.interactiveWidth;
2489
- this.interactiveLine = ht(i), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = se(i), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = se(i), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle);
2581
+ 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;
2582
+ const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
2583
+ this.interactiveLine = ht(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ie(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ie(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
2584
+ this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
2585
+ });
2490
2586
  }
2491
2587
  render(e) {
2492
- this.structuredEdge.render(e);
2493
- const o = this.line.getAttribute("d");
2494
- if (this.interactiveLine.setAttribute("d", o), this.sourceArrow) {
2495
- const i = this.sourceArrow.getAttribute("d");
2496
- this.interactiveSourceArrow.setAttribute("d", i);
2497
- }
2498
- if (this.targetArrow) {
2499
- const i = this.targetArrow.getAttribute("d");
2500
- this.interactiveTargetArrow.setAttribute("d", i);
2501
- }
2588
+ this.baseEdge.render(e);
2589
+ }
2590
+ }
2591
+ class gt {
2592
+ constructor(e, t) {
2593
+ o(this, "group");
2594
+ o(this, "line");
2595
+ o(this, "sourceArrow");
2596
+ o(this, "targetArrow");
2597
+ o(this, "onAfterRender");
2598
+ o(this, "svg");
2599
+ this.baseShape = e, this.medianElement = 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.medianElement), this.baseShape.onAfterRender.subscribe((s) => {
2600
+ const i = s.edgePath.median, n = `translate(${i.x}px, ${i.y}px)`;
2601
+ this.medianElement.style.setProperty("transform", n);
2602
+ });
2603
+ }
2604
+ render(e) {
2605
+ this.baseShape.render(e);
2502
2606
  }
2503
2607
  }
2504
- const ct = (t) => {
2505
- if (typeof t == "function")
2506
- return t;
2507
- switch (t == null ? void 0 : t.type) {
2608
+ const dt = (r) => {
2609
+ if (typeof r == "function")
2610
+ return r;
2611
+ switch (r == null ? void 0 : r.type) {
2508
2612
  case "straight":
2509
2613
  return () => new ot({
2510
- color: t.color,
2511
- width: t.width,
2512
- arrowLength: t.arrowLength,
2513
- arrowWidth: t.arrowWidth,
2514
- arrowOffset: t.arrowOffset,
2515
- hasSourceArrow: t.hasSourceArrow,
2516
- hasTargetArrow: t.hasTargetArrow,
2517
- cycleSquareSide: t.cycleSquareSide,
2518
- roundness: t.roundness,
2519
- detourDistance: t.detourDistance,
2520
- detourDirection: t.detourDirection
2614
+ color: r.color,
2615
+ width: r.width,
2616
+ arrowLength: r.arrowLength,
2617
+ arrowWidth: r.arrowWidth,
2618
+ arrowOffset: r.arrowOffset,
2619
+ hasSourceArrow: r.hasSourceArrow,
2620
+ hasTargetArrow: r.hasTargetArrow,
2621
+ cycleSquareSide: r.cycleSquareSide,
2622
+ roundness: r.roundness,
2623
+ detourDistance: r.detourDistance,
2624
+ detourDirection: r.detourDirection
2521
2625
  });
2522
2626
  case "horizontal":
2523
- return () => new tt({
2524
- color: t.color,
2525
- width: t.width,
2526
- arrowLength: t.arrowLength,
2527
- arrowWidth: t.arrowWidth,
2528
- arrowOffset: t.arrowOffset,
2529
- hasSourceArrow: t.hasSourceArrow,
2530
- hasTargetArrow: t.hasTargetArrow,
2531
- cycleSquareSide: t.cycleSquareSide,
2532
- roundness: t.roundness,
2533
- detourDistance: t.detourDistance,
2534
- detourDirection: t.detourDirection
2627
+ return () => new rt({
2628
+ color: r.color,
2629
+ width: r.width,
2630
+ arrowLength: r.arrowLength,
2631
+ arrowWidth: r.arrowWidth,
2632
+ arrowOffset: r.arrowOffset,
2633
+ hasSourceArrow: r.hasSourceArrow,
2634
+ hasTargetArrow: r.hasTargetArrow,
2635
+ cycleSquareSide: r.cycleSquareSide,
2636
+ roundness: r.roundness,
2637
+ detourDistance: r.detourDistance,
2638
+ detourDirection: r.detourDirection
2535
2639
  });
2536
2640
  case "vertical":
2537
- return () => new rt({
2538
- color: t.color,
2539
- width: t.width,
2540
- arrowLength: t.arrowLength,
2541
- arrowWidth: t.arrowWidth,
2542
- arrowOffset: t.arrowOffset,
2543
- hasSourceArrow: t.hasSourceArrow,
2544
- hasTargetArrow: t.hasTargetArrow,
2545
- cycleSquareSide: t.cycleSquareSide,
2546
- roundness: t.roundness,
2547
- detourDistance: t.detourDistance,
2548
- detourDirection: t.detourDirection
2641
+ return () => new st({
2642
+ color: r.color,
2643
+ width: r.width,
2644
+ arrowLength: r.arrowLength,
2645
+ arrowWidth: r.arrowWidth,
2646
+ arrowOffset: r.arrowOffset,
2647
+ hasSourceArrow: r.hasSourceArrow,
2648
+ hasTargetArrow: r.hasTargetArrow,
2649
+ cycleSquareSide: r.cycleSquareSide,
2650
+ roundness: r.roundness,
2651
+ detourDistance: r.detourDistance,
2652
+ detourDirection: r.detourDirection
2549
2653
  });
2550
2654
  case "direct":
2551
- return () => new st({
2552
- color: t.color,
2553
- width: t.width,
2554
- arrowLength: t.arrowLength,
2555
- arrowWidth: t.arrowWidth,
2556
- hasSourceArrow: t.hasSourceArrow,
2557
- hasTargetArrow: t.hasTargetArrow,
2558
- sourceOffset: t.sourceOffset,
2559
- targetOffset: t.targetOffset
2655
+ return () => new it({
2656
+ color: r.color,
2657
+ width: r.width,
2658
+ arrowLength: r.arrowLength,
2659
+ arrowWidth: r.arrowWidth,
2660
+ hasSourceArrow: r.hasSourceArrow,
2661
+ hasTargetArrow: r.hasTargetArrow,
2662
+ sourceOffset: r.sourceOffset,
2663
+ targetOffset: r.targetOffset
2560
2664
  });
2561
2665
  default:
2562
- return () => new et({
2563
- color: t.color,
2564
- width: t.width,
2565
- arrowLength: t.arrowLength,
2566
- arrowWidth: t.arrowWidth,
2567
- hasSourceArrow: t.hasSourceArrow,
2568
- hasTargetArrow: t.hasTargetArrow,
2569
- cycleRadius: t.cycleRadius,
2570
- smallCycleRadius: t.smallCycleRadius,
2571
- curvature: t.curvature,
2572
- detourDistance: t.detourDistance,
2573
- detourDirection: t.detourDirection
2666
+ return () => new tt({
2667
+ color: r.color,
2668
+ width: r.width,
2669
+ arrowLength: r.arrowLength,
2670
+ arrowWidth: r.arrowWidth,
2671
+ hasSourceArrow: r.hasSourceArrow,
2672
+ hasTargetArrow: r.hasTargetArrow,
2673
+ cycleRadius: r.cycleRadius,
2674
+ smallCycleRadius: r.smallCycleRadius,
2675
+ curvature: r.curvature,
2676
+ detourDistance: r.detourDistance,
2677
+ detourDirection: r.detourDirection
2574
2678
  });
2575
2679
  }
2576
- }, at = (t) => {
2577
- var o, i, s, h, n;
2680
+ }, ct = (r) => {
2681
+ var t, s, i, n, h;
2578
2682
  const e = Ge(
2579
- (o = t.nodes) == null ? void 0 : o.priority,
2580
- (i = t.edges) == null ? void 0 : i.priority
2683
+ (t = r.nodes) == null ? void 0 : t.priority,
2684
+ (s = r.edges) == null ? void 0 : s.priority
2581
2685
  );
2582
2686
  return {
2583
2687
  nodes: {
2584
- centerFn: ((s = t.nodes) == null ? void 0 : s.centerFn) ?? He,
2688
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? He,
2585
2689
  priorityFn: e.nodesPriorityFn
2586
2690
  },
2587
2691
  ports: {
2588
- direction: ((h = t.ports) == null ? void 0 : h.direction) ?? 0
2692
+ direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
2589
2693
  },
2590
2694
  edges: {
2591
- shapeFactory: ct(((n = t.edges) == null ? void 0 : n.shape) ?? {}),
2695
+ shapeFactory: dt(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
2592
2696
  priorityFn: e.edgesPriorityFn
2593
2697
  }
2594
2698
  };
2595
2699
  };
2596
2700
  class ut {
2597
2701
  constructor(e) {
2598
- r(this, "element", null);
2599
- r(this, "canvasDefaults", {});
2600
- r(this, "dragConfig", {});
2601
- r(this, "transformConfig", {});
2602
- r(this, "backgroundConfig", {});
2603
- r(this, "connectablePortsConfig", {});
2604
- r(this, "virtualScrollConfig");
2605
- r(this, "hasDraggableNode", !1);
2606
- r(this, "hasTransformableViewport", !1);
2607
- r(this, "hasResizeReactiveNodes", !1);
2608
- r(this, "hasBackground", !1);
2609
- r(this, "hasUserConnectablePorts", !1);
2610
- r(this, "boxRenderingTrigger");
2611
- r(this, "window", window);
2702
+ o(this, "element", null);
2703
+ o(this, "canvasDefaults", {});
2704
+ o(this, "dragConfig", {});
2705
+ o(this, "transformConfig", {});
2706
+ o(this, "backgroundConfig", {});
2707
+ o(this, "connectablePortsConfig", {});
2708
+ o(this, "virtualScrollConfig");
2709
+ o(this, "hasDraggableNode", !1);
2710
+ o(this, "hasTransformableViewport", !1);
2711
+ o(this, "hasResizeReactiveNodes", !1);
2712
+ o(this, "hasBackground", !1);
2713
+ o(this, "hasUserConnectablePorts", !1);
2714
+ o(this, "boxRenderingTrigger");
2715
+ o(this, "window", window);
2612
2716
  e !== void 0 && (this.element = e);
2613
2717
  }
2614
2718
  /**
@@ -2672,56 +2776,56 @@ class ut {
2672
2776
  */
2673
2777
  build() {
2674
2778
  if (this.element === null)
2675
- throw new S(
2779
+ throw new x(
2676
2780
  "unable to build canvas when no attach element specified"
2677
2781
  );
2678
2782
  let e = this.boxRenderingTrigger;
2679
2783
  this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
2680
- const o = new ce(), i = new me(), s = new Ye(this.element);
2681
- let h = new ne(
2682
- o,
2683
- i,
2684
- s.main
2784
+ const t = new de(), s = new Pe(), i = new Ye(this.element);
2785
+ let n = new ne(
2786
+ t,
2787
+ s,
2788
+ i.main
2685
2789
  );
2686
- e !== void 0 && (h = new Se(h, o, e));
2687
- const n = at(this.canvasDefaults), d = new de(
2790
+ e !== void 0 && (n = new xe(n, t, e));
2791
+ const h = ct(this.canvasDefaults), a = new ae(
2688
2792
  this.element,
2689
- o,
2690
- i,
2691
- h,
2692
- n
2693
- ), c = () => {
2694
- s.destroy(), d.onBeforeDestroy.unsubscribe(c);
2793
+ t,
2794
+ s,
2795
+ n,
2796
+ h
2797
+ ), d = () => {
2798
+ i.destroy(), a.onBeforeDestroy.unsubscribe(d);
2695
2799
  };
2696
- return d.onBeforeDestroy.subscribe(c), this.hasBackground && Y.configure(
2697
- d,
2800
+ return a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
2801
+ a,
2698
2802
  this.backgroundConfig,
2699
- s.background
2700
- ), this.hasResizeReactiveNodes && k.configure(d), this.hasDraggableNode && z.configure(
2701
- d,
2702
- s.main,
2803
+ i.background
2804
+ ), this.hasResizeReactiveNodes && k.configure(a), this.hasDraggableNode && z.configure(
2805
+ a,
2806
+ i.main,
2703
2807
  this.window,
2704
2808
  this.dragConfig
2705
2809
  ), this.hasUserConnectablePorts && H.configure(
2706
- d,
2707
- s.overlay,
2708
- i,
2810
+ a,
2811
+ i.overlay,
2812
+ s,
2709
2813
  this.window,
2710
- n,
2814
+ h,
2711
2815
  this.connectablePortsConfig
2712
2816
  ), this.virtualScrollConfig !== void 0 ? X.configure(
2713
- d,
2714
- s.main,
2817
+ a,
2818
+ i.main,
2715
2819
  this.window,
2716
2820
  this.transformConfig,
2717
2821
  e,
2718
2822
  this.virtualScrollConfig
2719
2823
  ) : this.hasTransformableViewport && U.configure(
2720
- d,
2721
- s.main,
2824
+ a,
2825
+ i.main,
2722
2826
  this.window,
2723
2827
  this.transformConfig
2724
- ), this.reset(), d;
2828
+ ), this.reset(), a;
2725
2829
  }
2726
2830
  /**
2727
2831
  * @deprecated
@@ -2732,15 +2836,16 @@ class ut {
2732
2836
  }
2733
2837
  }
2734
2838
  export {
2735
- et as BezierEdgeShape,
2839
+ tt as BezierEdgeShape,
2736
2840
  ut as CanvasBuilder,
2737
- st as DirectEdgeShape,
2841
+ it as DirectEdgeShape,
2738
2842
  he as EventSubject,
2739
- tt as HorizontalEdgeShape,
2740
- S as HtmlGraphError,
2741
- dt as InteractiveEdgeError,
2742
- fe as InteractiveEdgeShape,
2843
+ rt as HorizontalEdgeShape,
2844
+ x as HtmlGraphError,
2845
+ at as InteractiveEdgeError,
2846
+ pe as InteractiveEdgeShape,
2743
2847
  C as LineEdgeShape,
2848
+ gt as MedianEdgeShape,
2744
2849
  ot as StraightEdgeShape,
2745
- rt as VerticalEdgeShape
2850
+ st as VerticalEdgeShape
2746
2851
  };