@html-graph/html-graph 3.21.0 → 4.1.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,182 +1,178 @@
1
- var Ne = Object.defineProperty;
2
- var Me = (r, e, t) => e in r ? Ne(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => Me(r, typeof e != "symbol" ? e + "" : e, t);
4
- const D = (r, e) => ({
5
- x: r.scale * e.x + r.x,
6
- y: r.scale * e.y + r.y
1
+ var Nt = Object.defineProperty;
2
+ var Mt = (r, t, e) => t in r ? Nt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var o = (r, t, e) => Mt(r, typeof t != "symbol" ? t + "" : t, e);
4
+ const T = (r, t) => ({
5
+ x: r.scale * t.x + r.x,
6
+ y: r.scale * t.y + r.y
7
7
  });
8
- var R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
9
- const Le = () => {
8
+ var C = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(C || {});
9
+ const Lt = () => {
10
10
  const r = document.createElement("div");
11
11
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
12
- }, Re = () => {
12
+ }, Ct = () => {
13
13
  const r = document.createElement("div");
14
14
  return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
15
- }, Ce = (r) => {
15
+ }, Rt = (r) => {
16
16
  r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
17
17
  };
18
- class pe {
19
- constructor(e, t, s) {
20
- o(this, "host", Le());
21
- o(this, "container", Re());
18
+ class pt {
19
+ constructor(t, e, s) {
20
+ o(this, "host", Lt());
21
+ o(this, "container", Ct());
22
22
  o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
23
23
  o(this, "applyTransform", () => {
24
- const e = this.viewportStore.getContentMatrix();
25
- this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
24
+ const t = this.viewportStore.getContentMatrix();
25
+ this.container.style.transform = `matrix(${t.scale}, 0, 0, ${t.scale}, ${t.x}, ${t.y})`;
26
26
  });
27
- 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);
27
+ this.graphStore = t, this.viewportStore = e, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
28
28
  }
29
- attachNode(e) {
30
- const t = this.graphStore.getNode(e);
31
- Ce(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
29
+ attachNode(t) {
30
+ const e = this.graphStore.getNode(t);
31
+ Rt(e.element), this.container.appendChild(e.element), this.updateNodePosition(t), this.updateNodePriority(t), e.element.style.visibility = "visible";
32
32
  }
33
- detachNode(e) {
34
- const t = this.graphStore.getNode(e);
35
- this.container.removeChild(t.element);
33
+ detachNode(t) {
34
+ const e = this.graphStore.getNode(t);
35
+ this.container.removeChild(e.element);
36
36
  }
37
- attachEdge(e) {
38
- const t = this.graphStore.getEdge(e).shape.svg;
39
- this.edgeIdToElementMap.set(e, t), this.container.appendChild(t), this.renderEdge(e), this.updateEdgePriority(e);
37
+ attachEdge(t) {
38
+ const e = this.graphStore.getEdge(t).payload.shape.svg;
39
+ this.edgeIdToElementMap.set(t, e), this.container.appendChild(e), this.renderEdge(t), this.updateEdgePriority(t);
40
40
  }
41
- detachEdge(e) {
42
- const t = this.edgeIdToElementMap.get(e);
43
- this.container.removeChild(t), this.edgeIdToElementMap.delete(e);
41
+ detachEdge(t) {
42
+ const e = this.edgeIdToElementMap.get(t);
43
+ this.container.removeChild(e), this.edgeIdToElementMap.delete(t);
44
44
  }
45
45
  clear() {
46
- this.edgeIdToElementMap.forEach((e, t) => {
47
- this.detachEdge(t);
48
- }), this.graphStore.getAllNodeIds().forEach((e) => {
49
- this.detachNode(e);
46
+ this.edgeIdToElementMap.forEach((t, e) => {
47
+ this.detachEdge(e);
48
+ }), this.graphStore.getAllNodeIds().forEach((t) => {
49
+ this.detachNode(t);
50
50
  });
51
51
  }
52
52
  destroy() {
53
53
  this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.clear(), this.element.removeChild(this.host), this.host.removeChild(this.container);
54
54
  }
55
- updateNodePosition(e) {
56
- const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, a = t.centerFn(s, i), h = t.x - n * a.x, d = t.y - n * a.y;
57
- t.element.style.transform = `translate(${h}px, ${d}px)`;
55
+ updateNodePosition(t) {
56
+ const e = this.graphStore.getNode(t), { width: s, height: i } = e.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, a = e.payload.centerFn(s, i), h = e.payload.x - n * a.x, d = e.payload.y - n * a.y;
57
+ e.element.style.transform = `translate(${h}px, ${d}px)`;
58
58
  }
59
- updateNodePriority(e) {
60
- const t = this.graphStore.getNode(e);
61
- t.element.style.zIndex = `${t.priority}`;
59
+ updateNodePriority(t) {
60
+ const e = this.graphStore.getNode(t);
61
+ e.element.style.zIndex = `${e.payload.priority}`;
62
62
  }
63
- updateEdgeShape(e) {
64
- const t = this.edgeIdToElementMap.get(e);
65
- this.container.removeChild(t);
66
- const s = this.graphStore.getEdge(e);
67
- this.edgeIdToElementMap.set(e, s.shape.svg), this.container.appendChild(s.shape.svg);
63
+ updateEdgeShape(t) {
64
+ const e = this.edgeIdToElementMap.get(t);
65
+ this.container.removeChild(e);
66
+ const i = this.graphStore.getEdge(t).payload.shape.svg;
67
+ this.edgeIdToElementMap.set(t, i), this.container.appendChild(i);
68
68
  }
69
- renderEdge(e) {
70
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
71
- t.from,
69
+ renderEdge(t) {
70
+ const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from), i = this.graphStore.getPort(e.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
72
71
  s,
73
72
  n,
74
73
  h,
75
74
  d
76
75
  ), l = this.createEdgeRenderPort(
77
- t.to,
78
76
  i,
79
77
  a,
80
78
  h,
81
79
  d
82
80
  );
83
- let g = R.Line;
84
- s.element === i.element ? g = R.PortCycle : s.nodeId === i.nodeId && (g = R.NodeCycle), t.shape.render({ from: c, to: l, category: g });
85
- }
86
- updateEdgePriority(e) {
87
- const t = this.graphStore.getEdge(e);
88
- t.shape.svg.style.zIndex = `${t.priority}`;
89
- }
90
- createEdgeRenderPort(e, t, s, i, n) {
91
- const a = {
92
- x: s.left - i.left,
93
- y: s.top - i.top
94
- }, h = D(n, a);
81
+ let g = C.Line;
82
+ s.element === i.element ? g = C.PortCycle : s.nodeId === i.nodeId && (g = C.NodeCycle), e.payload.shape.render({ from: c, to: l, category: g });
83
+ }
84
+ updateEdgePriority(t) {
85
+ const e = this.graphStore.getEdge(t);
86
+ e.payload.shape.svg.style.zIndex = `${e.payload.priority}`;
87
+ }
88
+ createEdgeRenderPort(t, e, s, i) {
89
+ const n = {
90
+ x: e.left - s.left,
91
+ y: e.top - s.top
92
+ }, a = T(i, n);
95
93
  return {
96
- x: h.x,
97
- y: h.y,
98
- width: s.width * n.scale,
99
- height: s.height * n.scale,
100
- direction: t.direction,
101
- portId: e,
102
- nodeId: t.nodeId
94
+ x: a.x,
95
+ y: a.y,
96
+ width: e.width * i.scale,
97
+ height: e.height * i.scale,
98
+ direction: t.payload.direction
103
99
  };
104
100
  }
105
101
  }
106
- class Ve {
107
- constructor(e) {
102
+ class Vt {
103
+ constructor(t) {
108
104
  o(this, "xFrom", 1 / 0);
109
105
  o(this, "yFrom", 1 / 0);
110
106
  o(this, "xTo", 1 / 0);
111
107
  o(this, "yTo", 1 / 0);
112
- this.graphStore = e;
108
+ this.graphStore = t;
113
109
  }
114
- setRenderingBox(e) {
115
- this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
110
+ setRenderingBox(t) {
111
+ this.xFrom = t.x, this.xTo = t.x + t.width, this.yFrom = t.y, this.yTo = t.y + t.height;
116
112
  }
117
- hasNode(e) {
118
- const t = this.graphStore.getNode(e);
119
- return t.x >= this.xFrom && t.x <= this.xTo && t.y >= this.yFrom && t.y <= this.yTo;
113
+ hasNode(t) {
114
+ const e = this.graphStore.getNode(t).payload;
115
+ return e.x >= this.xFrom && e.x <= this.xTo && e.y >= this.yFrom && e.y <= this.yTo;
120
116
  }
121
- hasEdge(e) {
122
- 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), a = this.graphStore.getNode(i), h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
117
+ hasEdge(t) {
118
+ const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from).nodeId, i = this.graphStore.getPort(e.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(i).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
123
119
  return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
124
120
  }
125
121
  }
126
- class Ie {
127
- constructor(e, t, s, i) {
122
+ class It {
123
+ constructor(t, e, s, i) {
128
124
  o(this, "attachedNodes", /* @__PURE__ */ new Set());
129
125
  o(this, "attachedEdges", /* @__PURE__ */ new Set());
130
126
  o(this, "renderingBox");
131
- o(this, "updateViewport", (e) => {
132
- this.renderingBox.setRenderingBox(e);
133
- const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
127
+ o(this, "updateViewport", (t) => {
128
+ this.renderingBox.setRenderingBox(t);
129
+ const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
134
130
  this.graphStore.getAllNodeIds().forEach((a) => {
135
131
  const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
136
- h && !d ? t.add(a) : !h && d && s.add(a);
132
+ h && !d ? e.add(a) : !h && d && s.add(a);
137
133
  }), this.graphStore.getAllEdgeIds().forEach((a) => {
138
134
  const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), l = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
139
- h && (this.renderingBox.hasNode(l) || (t.add(l), s.delete(l)), this.renderingBox.hasNode(g) || (t.add(g), s.delete(g))), h && !d ? i.add(a) : !h && d && n.add(a);
135
+ h && (this.renderingBox.hasNode(l) || (e.add(l), s.delete(l)), this.renderingBox.hasNode(g) || (e.add(g), s.delete(g))), h && !d ? i.add(a) : !h && d && n.add(a);
140
136
  }), n.forEach((a) => {
141
137
  this.handleDetachEdge(a);
142
138
  }), s.forEach((a) => {
143
139
  this.handleDetachNode(a);
144
- }), t.forEach((a) => {
140
+ }), e.forEach((a) => {
145
141
  this.attachedNodes.has(a) || this.handleAttachNode(a);
146
142
  }), i.forEach((a) => {
147
143
  this.handleAttachEdge(a);
148
144
  });
149
145
  });
150
- this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Ve(this.graphStore), this.trigger.subscribe(this.updateViewport);
146
+ this.htmlView = t, this.graphStore = e, this.trigger = s, this.params = i, this.renderingBox = new Vt(this.graphStore), this.trigger.subscribe(this.updateViewport);
151
147
  }
152
- attachNode(e) {
153
- this.renderingBox.hasNode(e) && this.handleAttachNode(e);
148
+ attachNode(t) {
149
+ this.renderingBox.hasNode(t) && this.handleAttachNode(t);
154
150
  }
155
- detachNode(e) {
156
- this.attachedNodes.has(e) && this.handleDetachNode(e);
151
+ detachNode(t) {
152
+ this.attachedNodes.has(t) && this.handleDetachNode(t);
157
153
  }
158
- attachEdge(e) {
159
- this.renderingBox.hasEdge(e) && this.attachEdgeEntities(e);
154
+ attachEdge(t) {
155
+ this.renderingBox.hasEdge(t) && this.attachEdgeEntities(t);
160
156
  }
161
- detachEdge(e) {
162
- this.attachedEdges.has(e) && this.handleDetachEdge(e);
157
+ detachEdge(t) {
158
+ this.attachedEdges.has(t) && this.handleDetachEdge(t);
163
159
  }
164
- updateNodePosition(e) {
165
- this.attachedNodes.has(e) ? this.htmlView.updateNodePosition(e) : this.renderingBox.hasNode(e) && (this.handleAttachNode(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
166
- this.attachEdgeEntities(t);
160
+ updateNodePosition(t) {
161
+ this.attachedNodes.has(t) ? this.htmlView.updateNodePosition(t) : this.renderingBox.hasNode(t) && (this.handleAttachNode(t), this.graphStore.getNodeAdjacentEdgeIds(t).forEach((e) => {
162
+ this.attachEdgeEntities(e);
167
163
  }));
168
164
  }
169
- updateNodePriority(e) {
170
- this.attachedNodes.has(e) && this.htmlView.updateNodePriority(e);
165
+ updateNodePriority(t) {
166
+ this.attachedNodes.has(t) && this.htmlView.updateNodePriority(t);
171
167
  }
172
- updateEdgeShape(e) {
173
- this.attachedEdges.has(e) && this.htmlView.updateEdgeShape(e);
168
+ updateEdgeShape(t) {
169
+ this.attachedEdges.has(t) && this.htmlView.updateEdgeShape(t);
174
170
  }
175
- renderEdge(e) {
176
- this.attachedEdges.has(e) && this.htmlView.renderEdge(e);
171
+ renderEdge(t) {
172
+ this.attachedEdges.has(t) && this.htmlView.renderEdge(t);
177
173
  }
178
- updateEdgePriority(e) {
179
- this.attachedEdges.has(e) && this.htmlView.updateEdgePriority(e);
174
+ updateEdgePriority(t) {
175
+ this.attachedEdges.has(t) && this.htmlView.updateEdgePriority(t);
180
176
  }
181
177
  clear() {
182
178
  this.htmlView.clear(), this.attachedNodes.clear(), this.attachedEdges.clear();
@@ -184,52 +180,47 @@ class Ie {
184
180
  destroy() {
185
181
  this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
186
182
  }
187
- attachEdgeEntities(e) {
188
- const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
189
- this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
183
+ attachEdgeEntities(t) {
184
+ const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from).nodeId, i = this.graphStore.getPort(e.to).nodeId;
185
+ this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(t);
190
186
  }
191
- handleAttachNode(e) {
192
- this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
187
+ handleAttachNode(t) {
188
+ this.params.onBeforeNodeAttached(t), this.attachedNodes.add(t), this.htmlView.attachNode(t);
193
189
  }
194
- handleDetachNode(e) {
195
- this.htmlView.detachNode(e), this.attachedNodes.delete(e), this.params.onAfterNodeDetached(e);
190
+ handleDetachNode(t) {
191
+ this.htmlView.detachNode(t), this.attachedNodes.delete(t), this.params.onAfterNodeDetached(t);
196
192
  }
197
- handleAttachEdge(e) {
198
- this.attachedEdges.add(e), this.htmlView.attachEdge(e);
193
+ handleAttachEdge(t) {
194
+ this.attachedEdges.add(t), this.htmlView.attachEdge(t);
199
195
  }
200
- handleDetachEdge(e) {
201
- this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
196
+ handleDetachEdge(t) {
197
+ this.htmlView.detachEdge(t), this.attachedEdges.delete(t);
202
198
  }
203
199
  }
204
- class we {
200
+ class wt {
205
201
  constructor() {
206
202
  o(this, "callbacks", /* @__PURE__ */ new Set());
207
203
  }
208
- subscribe(e) {
209
- this.callbacks.add(e);
204
+ subscribe(t) {
205
+ this.callbacks.add(t);
210
206
  }
211
- unsubscribe(e) {
212
- this.callbacks.delete(e);
207
+ unsubscribe(t) {
208
+ this.callbacks.delete(t);
213
209
  }
214
- emit(e) {
215
- this.callbacks.forEach((t) => {
216
- t(e);
210
+ emit(t) {
211
+ this.callbacks.forEach((e) => {
212
+ e(t);
217
213
  });
218
214
  }
219
215
  }
220
216
  const A = () => {
221
- const r = new we();
217
+ const r = new wt();
222
218
  return [r, r];
223
219
  };
224
- class Ue {
225
- constructor(e) {
226
- /**
227
- * @deprecated
228
- * do not use
229
- */
230
- o(this, "onBeforeUpdated");
220
+ class Ut {
221
+ constructor(t) {
231
222
  o(this, "onAfterUpdated");
232
- this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
223
+ this.viewportStore = t, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
233
224
  }
234
225
  getViewportMatrix() {
235
226
  return { ...this.viewportStore.getViewportMatrix() };
@@ -238,8 +229,8 @@ class Ue {
238
229
  return { ...this.viewportStore.getContentMatrix() };
239
230
  }
240
231
  }
241
- class We {
242
- constructor(e) {
232
+ class Wt {
233
+ constructor(t) {
243
234
  o(this, "onAfterNodeAdded");
244
235
  o(this, "onAfterNodeUpdated");
245
236
  o(this, "onAfterNodePriorityUpdated");
@@ -253,107 +244,92 @@ class We {
253
244
  o(this, "onAfterEdgePriorityUpdated");
254
245
  o(this, "onBeforeEdgeRemoved");
255
246
  o(this, "onBeforeClear");
256
- 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;
247
+ this.graphStore = t, 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;
257
248
  }
258
- getNode(e) {
259
- const t = this.graphStore.getNode(e);
260
- return t === void 0 ? null : {
261
- element: t.element,
262
- x: t.x,
263
- y: t.y,
264
- centerFn: t.centerFn,
265
- priority: t.priority
249
+ getNode(t) {
250
+ const e = this.graphStore.getNode(t);
251
+ if (e === void 0)
252
+ return null;
253
+ const s = e.payload;
254
+ return {
255
+ element: e.element,
256
+ x: s.x,
257
+ y: s.y,
258
+ centerFn: s.centerFn,
259
+ priority: s.priority
266
260
  };
267
261
  }
268
- getElementNodeId(e) {
269
- return this.graphStore.getElementNodeId(e) ?? null;
262
+ getElementNodeId(t) {
263
+ return this.graphStore.getElementNodeId(t) ?? null;
270
264
  }
271
265
  getAllNodeIds() {
272
266
  return this.graphStore.getAllNodeIds();
273
267
  }
274
- getPort(e) {
275
- const t = this.graphStore.getPort(e);
276
- return t === void 0 ? null : {
277
- element: t.element,
278
- direction: t.direction,
279
- nodeId: t.nodeId
268
+ getPort(t) {
269
+ const e = this.graphStore.getPort(t);
270
+ return e === void 0 ? null : {
271
+ element: e.element,
272
+ direction: e.payload.direction,
273
+ nodeId: e.nodeId
280
274
  };
281
275
  }
282
276
  getAllPortIds() {
283
277
  return this.graphStore.getAllPortIds();
284
278
  }
285
- getNodePortIds(e) {
286
- return this.graphStore.getNodePortIds(e) ?? null;
279
+ getNodePortIds(t) {
280
+ return this.graphStore.getNodePortIds(t) ?? null;
287
281
  }
288
- getElementPortIds(e) {
289
- return [...this.graphStore.getElementPortIds(e)];
290
- }
291
- /**
292
- * @deprecated
293
- * use getElementPortIds instead
294
- */
295
- getElementPortsIds(e) {
296
- return this.getElementPortIds(e);
282
+ getElementPortIds(t) {
283
+ return [...this.graphStore.getElementPortIds(t)];
297
284
  }
298
285
  getAllEdgeIds() {
299
286
  return this.graphStore.getAllEdgeIds();
300
287
  }
301
- getEdge(e) {
302
- const t = this.graphStore.getEdge(e);
303
- return t === void 0 ? null : {
304
- from: t.from,
305
- to: t.to,
306
- priority: t.priority,
307
- shape: t.shape
288
+ getEdge(t) {
289
+ const e = this.graphStore.getEdge(t);
290
+ if (e === void 0)
291
+ return null;
292
+ const s = e.payload;
293
+ return {
294
+ from: e.from,
295
+ to: e.to,
296
+ priority: s.priority,
297
+ shape: s.shape
308
298
  };
309
299
  }
310
- getPortIncomingEdgeIds(e) {
311
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortIncomingEdgeIds(e);
300
+ getPortIncomingEdgeIds(t) {
301
+ return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortIncomingEdgeIds(t);
312
302
  }
313
- getPortOutgoingEdgeIds(e) {
314
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortOutgoingEdgeIds(e);
303
+ getPortOutgoingEdgeIds(t) {
304
+ return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortOutgoingEdgeIds(t);
315
305
  }
316
- /**
317
- * @deprecated
318
- * use getPortOutgoingEdgeIds instead
319
- */
320
- getPortOutcomingEdgeIds(e) {
321
- return this.getPortOutgoingEdgeIds(e);
322
- }
323
- getPortCycleEdgeIds(e) {
324
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortCycleEdgeIds(e);
306
+ getPortCycleEdgeIds(t) {
307
+ return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortCycleEdgeIds(t);
325
308
  }
326
- getPortAdjacentEdgeIds(e) {
327
- return this.graphStore.getPort(e) === void 0 ? null : this.graphStore.getPortAdjacentEdgeIds(e);
309
+ getPortAdjacentEdgeIds(t) {
310
+ return this.graphStore.getPort(t) === void 0 ? null : this.graphStore.getPortAdjacentEdgeIds(t);
328
311
  }
329
- getNodeIncomingEdgeIds(e) {
330
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeIncomingEdgeIds(e);
312
+ getNodeIncomingEdgeIds(t) {
313
+ return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeIncomingEdgeIds(t);
331
314
  }
332
- getNodeOutgoingEdgeIds(e) {
333
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeOutgoingEdgeIds(e);
334
- }
335
- /**
336
- * @deprecated
337
- * use getNodeOutgoingEdgeIds instead
338
- */
339
- getNodeOutcomingEdgeIds(e) {
340
- return this.getNodeOutgoingEdgeIds(e);
315
+ getNodeOutgoingEdgeIds(t) {
316
+ return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeOutgoingEdgeIds(t);
341
317
  }
342
- getNodeCycleEdgeIds(e) {
343
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeCycleEdgeIds(e);
318
+ getNodeCycleEdgeIds(t) {
319
+ return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeCycleEdgeIds(t);
344
320
  }
345
- getNodeAdjacentEdgeIds(e) {
346
- return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
321
+ getNodeAdjacentEdgeIds(t) {
322
+ return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(t);
347
323
  }
348
324
  }
349
325
  class z {
350
- constructor(e) {
326
+ constructor(t) {
351
327
  o(this, "counter", 0);
352
- this.checkExists = e;
328
+ this.checkExists = t;
353
329
  }
354
- create(e) {
355
- if (e !== void 0)
356
- return e;
330
+ create(t) {
331
+ if (t !== void 0)
332
+ return t;
357
333
  for (; this.checkExists(this.counter); )
358
334
  this.counter++;
359
335
  return this.counter;
@@ -365,11 +341,11 @@ class z {
365
341
  class S extends Error {
366
342
  constructor() {
367
343
  super(...arguments);
368
- o(this, "name", "HtmlGraphError");
344
+ o(this, "name", "CanvasError");
369
345
  }
370
346
  }
371
- class fe {
372
- constructor(e, t, s, i, n) {
347
+ class ft {
348
+ constructor(t, e, s, i) {
373
349
  /**
374
350
  * provides api for accessing model of rendered graph
375
351
  */
@@ -379,54 +355,54 @@ class fe {
379
355
  */
380
356
  o(this, "viewport");
381
357
  o(this, "nodeIdGenerator", new z(
382
- (e) => this.graph.getNode(e) !== null
358
+ (t) => this.graph.getNode(t) !== null
383
359
  ));
384
360
  o(this, "portIdGenerator", new z(
385
- (e) => this.graph.getPort(e) !== null
361
+ (t) => this.graph.getPort(t) !== null
386
362
  ));
387
363
  o(this, "edgeIdGenerator", new z(
388
- (e) => this.graph.getEdge(e) !== null
364
+ (t) => this.graph.getEdge(t) !== null
389
365
  ));
390
- o(this, "onAfterNodeAdded", (e) => {
391
- this.htmlView.attachNode(e);
366
+ o(this, "onAfterNodeAdded", (t) => {
367
+ this.htmlView.attachNode(t);
392
368
  });
393
- o(this, "onAfterNodeUpdated", (e) => {
394
- this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
369
+ o(this, "onAfterNodeUpdated", (t) => {
370
+ this.htmlView.updateNodePosition(t), this.graphStore.getNodeAdjacentEdgeIds(t).forEach((s) => {
395
371
  this.htmlView.renderEdge(s);
396
372
  });
397
373
  });
398
- o(this, "onAfterNodePriorityUpdated", (e) => {
399
- this.htmlView.updateNodePriority(e);
374
+ o(this, "onAfterNodePriorityUpdated", (t) => {
375
+ this.htmlView.updateNodePriority(t);
400
376
  });
401
- o(this, "onBeforeNodeRemoved", (e) => {
402
- this.graphStore.getNodePortIds(e).forEach((t) => {
403
- this.unmarkPort(t);
404
- }), this.htmlView.detachNode(e);
377
+ o(this, "onBeforeNodeRemoved", (t) => {
378
+ this.graphStore.getNodePortIds(t).forEach((e) => {
379
+ this.unmarkPort(e);
380
+ }), this.htmlView.detachNode(t);
405
381
  });
406
- o(this, "onAfterPortUpdated", (e) => {
407
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
382
+ o(this, "onAfterPortUpdated", (t) => {
383
+ this.graphStore.getPortAdjacentEdgeIds(t).forEach((s) => {
408
384
  this.htmlView.renderEdge(s);
409
385
  });
410
386
  });
411
- o(this, "onBeforePortUnmarked", (e) => {
412
- this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
413
- this.removeEdge(t);
387
+ o(this, "onBeforePortUnmarked", (t) => {
388
+ this.graphStore.getPortAdjacentEdgeIds(t).forEach((e) => {
389
+ this.removeEdge(e);
414
390
  });
415
391
  });
416
- o(this, "onAfterEdgeAdded", (e) => {
417
- this.htmlView.attachEdge(e);
392
+ o(this, "onAfterEdgeAdded", (t) => {
393
+ this.htmlView.attachEdge(t);
418
394
  });
419
- o(this, "onAfterEdgeShapeUpdated", (e) => {
420
- this.htmlView.updateEdgeShape(e);
395
+ o(this, "onAfterEdgeShapeUpdated", (t) => {
396
+ this.htmlView.updateEdgeShape(t);
421
397
  });
422
- o(this, "onAfterEdgeUpdated", (e) => {
423
- this.htmlView.renderEdge(e);
398
+ o(this, "onAfterEdgeUpdated", (t) => {
399
+ this.htmlView.renderEdge(t);
424
400
  });
425
- o(this, "onAfterEdgePriorityUpdated", (e) => {
426
- this.htmlView.updateEdgePriority(e);
401
+ o(this, "onAfterEdgePriorityUpdated", (t) => {
402
+ this.htmlView.updateEdgePriority(t);
427
403
  });
428
- o(this, "onBeforeEdgeRemoved", (e) => {
429
- this.htmlView.detachEdge(e);
404
+ o(this, "onBeforeEdgeRemoved", (t) => {
405
+ this.htmlView.detachEdge(t);
430
406
  });
431
407
  o(this, "onBeforeClear", () => {
432
408
  this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
@@ -437,7 +413,7 @@ class fe {
437
413
  * emits event just before destruction of canvas
438
414
  */
439
415
  o(this, "onBeforeDestroy");
440
- this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.params = n, this.graph = new We(this.graphStore), this.viewport = new Ue(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
416
+ this.graphStore = t, this.viewportStore = e, this.htmlView = s, this.params = i, this.graph = new Wt(this.graphStore), this.viewport = new Ut(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
441
417
  this.onAfterNodePriorityUpdated
442
418
  ), 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(
443
419
  this.onAfterEdgeShapeUpdated
@@ -448,27 +424,27 @@ class fe {
448
424
  /**
449
425
  * adds new node
450
426
  */
451
- addNode(e) {
452
- const t = this.nodeIdGenerator.create(e.id);
453
- if (this.graph.getNode(t) !== null)
427
+ addNode(t) {
428
+ const e = this.nodeIdGenerator.create(t.id);
429
+ if (this.graphStore.getNode(e) !== void 0)
454
430
  throw new S("failed to add node with existing id");
455
- if (this.graphStore.getElementNodeId(e.element) !== void 0)
431
+ if (this.graphStore.getElementNodeId(t.element) !== void 0)
456
432
  throw new S(
457
433
  "failed to add node with html element already in use by another node"
458
434
  );
459
435
  if (this.graphStore.addNode({
460
- id: t,
461
- element: e.element,
462
- x: e.x,
463
- y: e.y,
464
- centerFn: e.centerFn ?? this.params.nodes.centerFn,
465
- priority: e.priority ?? this.params.nodes.priorityFn()
466
- }), e.ports !== void 0)
467
- for (const s of e.ports)
436
+ id: e,
437
+ element: t.element,
438
+ x: t.x,
439
+ y: t.y,
440
+ centerFn: t.centerFn ?? this.params.nodes.centerFn,
441
+ priority: t.priority ?? this.params.nodes.priorityFn()
442
+ }), t.ports !== void 0)
443
+ for (const s of t.ports)
468
444
  this.markPort({
469
445
  id: s.id,
470
446
  element: s.element,
471
- nodeId: t,
447
+ nodeId: e,
472
448
  direction: s.direction
473
449
  });
474
450
  return this;
@@ -476,100 +452,100 @@ class fe {
476
452
  /**
477
453
  * updates node parameters
478
454
  */
479
- updateNode(e, t) {
480
- if (this.graph.getNode(e) === null)
455
+ updateNode(t, e) {
456
+ if (this.graphStore.getNode(t) === void 0)
481
457
  throw new S("failed to update non existing node");
482
- return this.graphStore.updateNode(e, t ?? {}), this;
458
+ return this.graphStore.updateNode(t, e ?? {}), this;
483
459
  }
484
460
  /**
485
461
  * removes specified node
486
462
  * all the ports of node get unmarked
487
463
  * all the edges adjacent to node get removed
488
464
  */
489
- removeNode(e) {
490
- if (this.graph.getNode(e) === null)
465
+ removeNode(t) {
466
+ if (this.graphStore.getNode(t) === void 0)
491
467
  throw new S("failed to remove non existing node");
492
- return this.graphStore.removeNode(e), this;
468
+ return this.graphStore.removeNode(t), this;
493
469
  }
494
470
  /**
495
471
  * marks specified element as a port for specified node
496
472
  */
497
- markPort(e) {
498
- const t = this.portIdGenerator.create(e.id);
499
- if (this.graph.getPort(t) !== null)
473
+ markPort(t) {
474
+ const e = this.portIdGenerator.create(t.id);
475
+ if (this.graphStore.getPort(e) !== void 0)
500
476
  throw new S("failed to add port with existing id");
501
- if (this.graph.getNode(e.nodeId) === null)
477
+ if (this.graphStore.getNode(t.nodeId) === void 0)
502
478
  throw new S("failed to mark port for nonexistent node");
503
479
  return this.graphStore.addPort({
504
- id: t,
505
- element: e.element,
506
- nodeId: e.nodeId,
507
- direction: e.direction ?? this.params.ports.direction
480
+ id: e,
481
+ element: t.element,
482
+ nodeId: t.nodeId,
483
+ direction: t.direction ?? this.params.ports.direction
508
484
  }), this;
509
485
  }
510
486
  /**
511
487
  * updates port and edges attached to it
512
488
  */
513
- updatePort(e, t) {
514
- if (this.graph.getPort(e) === null)
489
+ updatePort(t, e) {
490
+ if (this.graphStore.getPort(t) === void 0)
515
491
  throw new S("failed to update nonexistent port");
516
- return this.graphStore.updatePort(e, t ?? {}), this;
492
+ return this.graphStore.updatePort(t, e ?? {}), this;
517
493
  }
518
494
  /**
519
495
  * unmarks specified port
520
496
  * all the edges adjacent to the port get removed
521
497
  */
522
- unmarkPort(e) {
523
- if (this.graph.getPort(e) === null)
498
+ unmarkPort(t) {
499
+ if (this.graphStore.getPort(t) === void 0)
524
500
  throw new S("failed to unmark non existing port");
525
- return this.graphStore.removePort(e), this;
501
+ return this.graphStore.removePort(t), this;
526
502
  }
527
503
  /**
528
504
  * adds new edge
529
505
  */
530
- addEdge(e) {
531
- const t = this.edgeIdGenerator.create(e.id);
532
- if (this.graph.getEdge(t) !== null)
506
+ addEdge(t) {
507
+ const e = this.edgeIdGenerator.create(t.id);
508
+ if (this.graphStore.getEdge(e) !== void 0)
533
509
  throw new S("failed to add edge with existing id");
534
- if (this.graph.getPort(e.from) === null)
510
+ if (this.graphStore.getPort(t.from) === void 0)
535
511
  throw new S("failed to add edge from nonexistent port");
536
- if (this.graph.getPort(e.to) === null)
512
+ if (this.graphStore.getPort(t.to) === void 0)
537
513
  throw new S("failed to add edge to nonexistent port");
538
514
  return this.graphStore.addEdge({
539
- id: t,
540
- from: e.from,
541
- to: e.to,
542
- shape: e.shape ?? this.params.edges.shapeFactory(t),
543
- priority: e.priority ?? this.params.edges.priorityFn()
515
+ id: e,
516
+ from: t.from,
517
+ to: t.to,
518
+ shape: t.shape ?? this.params.edges.shapeFactory(e),
519
+ priority: t.priority ?? this.params.edges.priorityFn()
544
520
  }), this;
545
521
  }
546
522
  /**
547
523
  * updates specified edge
548
524
  */
549
- updateEdge(e, t) {
550
- if (this.graph.getEdge(e) === null)
525
+ updateEdge(t, e) {
526
+ if (this.graphStore.getEdge(t) === void 0)
551
527
  throw new S("failed to update nonexistent edge");
552
- return this.graphStore.updateEdge(e, t ?? {}), this;
528
+ return this.graphStore.updateEdge(t, e ?? {}), this;
553
529
  }
554
530
  /**
555
531
  * removes specified edge
556
532
  */
557
- removeEdge(e) {
558
- if (this.graph.getEdge(e) === null)
533
+ removeEdge(t) {
534
+ if (this.graphStore.getEdge(t) === void 0)
559
535
  throw new S("failed to remove nonexistent edge");
560
- return this.graphStore.removeEdge(e), this;
536
+ return this.graphStore.removeEdge(t), this;
561
537
  }
562
538
  /**
563
539
  * applies transformation for viewport matrix
564
540
  */
565
- patchViewportMatrix(e) {
566
- return this.viewportStore.patchViewportMatrix(e), this;
541
+ patchViewportMatrix(t) {
542
+ return this.viewportStore.patchViewportMatrix(t), this;
567
543
  }
568
544
  /**
569
545
  * applies transformation for content matrix
570
546
  */
571
- patchContentMatrix(e) {
572
- return this.viewportStore.patchContentMatrix(e), this;
547
+ patchContentMatrix(t) {
548
+ return this.viewportStore.patchContentMatrix(t), this;
573
549
  }
574
550
  /**
575
551
  * clears canvas from nodes and edges
@@ -592,47 +568,47 @@ class fe {
592
568
  ), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
593
569
  }
594
570
  }
595
- class Be {
571
+ class $t {
596
572
  constructor() {
597
573
  o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
598
574
  o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
599
575
  }
600
- addRecord(e, t) {
601
- const s = this.singleToMultiMap.get(e);
602
- s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
576
+ addRecord(t, e) {
577
+ const s = this.singleToMultiMap.get(t);
578
+ s === void 0 ? this.singleToMultiMap.set(t, /* @__PURE__ */ new Set([e])) : s.add(e), this.multiToSingleMap.set(e, t);
603
579
  }
604
- getMultiBySingle(e) {
605
- const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
606
- return Array.from(t.values());
580
+ getMultiBySingle(t) {
581
+ const e = this.singleToMultiMap.get(t) ?? /* @__PURE__ */ new Set();
582
+ return Array.from(e.values());
607
583
  }
608
- removeByMulti(e) {
609
- const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
610
- s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
584
+ removeByMulti(t) {
585
+ const e = this.multiToSingleMap.get(t), s = this.singleToMultiMap.get(e);
586
+ s.delete(t), s.size === 0 && this.singleToMultiMap.delete(e), this.multiToSingleMap.delete(t);
611
587
  }
612
- getByMulti(e) {
613
- return this.multiToSingleMap.get(e);
588
+ getByMulti(t) {
589
+ return this.multiToSingleMap.get(t);
614
590
  }
615
- removeBySingle(e) {
616
- this.singleToMultiMap.get(e).forEach((s) => {
591
+ removeBySingle(t) {
592
+ this.singleToMultiMap.get(t).forEach((s) => {
617
593
  this.multiToSingleMap.delete(s);
618
- }), this.singleToMultiMap.delete(e);
594
+ }), this.singleToMultiMap.delete(t);
619
595
  }
620
596
  clear() {
621
597
  this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
622
598
  }
623
- forEachSingle(e) {
624
- this.singleToMultiMap.forEach((t, s) => {
625
- e(s);
599
+ forEachSingle(t) {
600
+ this.singleToMultiMap.forEach((e, s) => {
601
+ t(s);
626
602
  });
627
603
  }
628
- hasSingle(e) {
629
- return this.singleToMultiMap.get(e) !== void 0;
604
+ hasSingle(t) {
605
+ return this.singleToMultiMap.get(t) !== void 0;
630
606
  }
631
- hasMulti(e) {
632
- return this.multiToSingleMap.get(e) !== void 0;
607
+ hasMulti(t) {
608
+ return this.multiToSingleMap.get(t) !== void 0;
633
609
  }
634
610
  }
635
- class me {
611
+ class yt {
636
612
  constructor() {
637
613
  o(this, "nodes", /* @__PURE__ */ new Map());
638
614
  o(this, "ports", /* @__PURE__ */ new Map());
@@ -641,7 +617,7 @@ class me {
641
617
  o(this, "incomingEdges", /* @__PURE__ */ new Map());
642
618
  o(this, "outcomingEdges", /* @__PURE__ */ new Map());
643
619
  o(this, "cycleEdges", /* @__PURE__ */ new Map());
644
- o(this, "elementPorts", new Be());
620
+ o(this, "elementPorts", new $t());
645
621
  o(this, "afterNodeAddedEmitter");
646
622
  o(this, "onAfterNodeAdded");
647
623
  o(this, "afterNodeUpdatedEmitter");
@@ -670,172 +646,172 @@ class me {
670
646
  o(this, "onBeforeClear");
671
647
  [this.afterNodeAddedEmitter, this.onAfterNodeAdded] = A(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = A(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = A(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = A(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = A(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = A(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = A(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = A(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = A(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = A(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = A(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = A(), [this.beforeClearEmitter, this.onBeforeClear] = A();
672
648
  }
673
- addNode(e) {
674
- const t = /* @__PURE__ */ new Map(), s = {
675
- element: e.element,
676
- x: e.x,
677
- y: e.y,
678
- centerFn: e.centerFn,
679
- priority: e.priority,
680
- ports: t
649
+ addNode(t) {
650
+ const e = /* @__PURE__ */ new Map(), s = {
651
+ element: t.element,
652
+ payload: {
653
+ x: t.x,
654
+ y: t.y,
655
+ centerFn: t.centerFn,
656
+ priority: t.priority
657
+ },
658
+ ports: e
681
659
  };
682
- this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
660
+ this.nodes.set(t.id, s), this.nodesElementsMap.set(t.element, t.id), this.afterNodeAddedEmitter.emit(t.id);
683
661
  }
684
662
  getAllNodeIds() {
685
663
  return Array.from(this.nodes.keys());
686
664
  }
687
- getNode(e) {
688
- return this.nodes.get(e);
665
+ getNode(t) {
666
+ return this.nodes.get(t);
689
667
  }
690
- getElementNodeId(e) {
691
- return this.nodesElementsMap.get(e);
668
+ getElementNodeId(t) {
669
+ return this.nodesElementsMap.get(t);
692
670
  }
693
- updateNode(e, t) {
694
- const s = this.nodes.get(e);
695
- 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);
671
+ updateNode(t, e) {
672
+ const s = this.nodes.get(t).payload;
673
+ s.x = e.x ?? s.x, s.y = e.y ?? s.y, s.centerFn = e.centerFn ?? s.centerFn, e.priority !== void 0 && (s.priority = e.priority, this.afterNodePriorityUpdatedEmitter.emit(t)), this.afterNodeUpdatedEmitter.emit(t);
696
674
  }
697
- removeNode(e) {
698
- this.beforeNodeRemovedEmitter.emit(e);
699
- const t = this.nodes.get(e);
700
- this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
675
+ removeNode(t) {
676
+ this.beforeNodeRemovedEmitter.emit(t);
677
+ const e = this.nodes.get(t);
678
+ this.nodesElementsMap.delete(e.element), this.nodes.delete(t);
701
679
  }
702
- addPort(e) {
703
- this.ports.set(e.id, {
704
- element: e.element,
705
- direction: e.direction,
706
- nodeId: e.nodeId
707
- }), this.elementPorts.addRecord(e.element, e.id), this.cycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.incomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.outcomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
680
+ addPort(t) {
681
+ this.ports.set(t.id, {
682
+ element: t.element,
683
+ payload: {
684
+ direction: t.direction
685
+ },
686
+ nodeId: t.nodeId
687
+ }), this.elementPorts.addRecord(t.element, t.id), this.cycleEdges.set(t.id, /* @__PURE__ */ new Set()), this.incomingEdges.set(t.id, /* @__PURE__ */ new Set()), this.outcomingEdges.set(t.id, /* @__PURE__ */ new Set()), this.nodes.get(t.nodeId).ports.set(t.id, t.element), this.afterPortAddedEmitter.emit(t.id);
708
688
  }
709
- getPort(e) {
710
- return this.ports.get(e);
689
+ getPort(t) {
690
+ return this.ports.get(t);
711
691
  }
712
- updatePort(e, t) {
713
- const s = this.ports.get(e);
714
- s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
692
+ updatePort(t, e) {
693
+ const s = this.ports.get(t).payload;
694
+ s.direction = e.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(t);
715
695
  }
716
696
  getAllPortIds() {
717
697
  return Array.from(this.ports.keys());
718
698
  }
719
- getElementPortIds(e) {
720
- return this.elementPorts.getMultiBySingle(e);
699
+ getElementPortIds(t) {
700
+ return this.elementPorts.getMultiBySingle(t);
721
701
  }
722
- getNodePortIds(e) {
723
- const t = this.nodes.get(e);
724
- if (t !== void 0)
725
- return Array.from(t.ports.keys());
726
- }
727
- removePort(e) {
728
- const t = this.ports.get(e).nodeId;
729
- this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
730
- }
731
- addEdge(e) {
732
- this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
733
- }
734
- updateEdge(e, t) {
735
- if (t.from !== void 0 || t.to !== void 0) {
736
- const i = this.edges.get(e);
737
- this.removeEdgeInternal(e), this.addEdgeInternal({
738
- id: e,
739
- from: t.from ?? i.from,
740
- to: t.to ?? i.to,
741
- shape: i.shape,
742
- priority: i.priority
702
+ getNodePortIds(t) {
703
+ const e = this.nodes.get(t);
704
+ if (e !== void 0)
705
+ return Array.from(e.ports.keys());
706
+ }
707
+ removePort(t) {
708
+ const e = this.ports.get(t).nodeId;
709
+ this.beforePortRemovedEmitter.emit(t), this.nodes.get(e).ports.delete(t), this.ports.delete(t), this.elementPorts.removeByMulti(t);
710
+ }
711
+ addEdge(t) {
712
+ this.addEdgeInternal(t), this.afterEdgeAddedEmitter.emit(t.id);
713
+ }
714
+ updateEdge(t, e) {
715
+ if (e.from !== void 0 || e.to !== void 0) {
716
+ const i = this.edges.get(t), n = i.payload;
717
+ this.removeEdgeInternal(t), this.addEdgeInternal({
718
+ id: t,
719
+ from: e.from ?? i.from,
720
+ to: e.to ?? i.to,
721
+ shape: n.shape,
722
+ priority: n.priority
743
723
  });
744
724
  }
745
- const s = this.edges.get(e);
746
- 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);
725
+ const s = this.edges.get(t);
726
+ e.shape !== void 0 && (s.payload.shape = e.shape, this.afterEdgeShapeUpdatedEmitter.emit(t)), e.priority !== void 0 && (s.payload.priority = e.priority, this.afterEdgePriorityUpdatedEmitter.emit(t)), this.afterEdgeUpdatedEmitter.emit(t);
747
727
  }
748
728
  getAllEdgeIds() {
749
729
  return Array.from(this.edges.keys());
750
730
  }
751
- getEdge(e) {
752
- return this.edges.get(e);
731
+ getEdge(t) {
732
+ return this.edges.get(t);
753
733
  }
754
- removeEdge(e) {
755
- this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
734
+ removeEdge(t) {
735
+ this.beforeEdgeRemovedEmitter.emit(t), this.removeEdgeInternal(t);
756
736
  }
757
737
  clear() {
758
738
  this.beforeClearEmitter.emit(), this.incomingEdges.clear(), this.outcomingEdges.clear(), this.cycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
759
739
  }
760
- getPortIncomingEdgeIds(e) {
761
- return Array.from(this.incomingEdges.get(e));
740
+ getPortIncomingEdgeIds(t) {
741
+ return Array.from(this.incomingEdges.get(t));
762
742
  }
763
- getPortOutgoingEdgeIds(e) {
764
- return Array.from(this.outcomingEdges.get(e));
743
+ getPortOutgoingEdgeIds(t) {
744
+ return Array.from(this.outcomingEdges.get(t));
765
745
  }
766
- getPortCycleEdgeIds(e) {
767
- return Array.from(this.cycleEdges.get(e));
746
+ getPortCycleEdgeIds(t) {
747
+ return Array.from(this.cycleEdges.get(t));
768
748
  }
769
- getPortAdjacentEdgeIds(e) {
749
+ getPortAdjacentEdgeIds(t) {
770
750
  return [
771
- ...this.getPortIncomingEdgeIds(e),
772
- ...this.getPortOutgoingEdgeIds(e),
773
- ...this.getPortCycleEdgeIds(e)
751
+ ...this.getPortIncomingEdgeIds(t),
752
+ ...this.getPortOutgoingEdgeIds(t),
753
+ ...this.getPortCycleEdgeIds(t)
774
754
  ];
775
755
  }
776
- getNodeIncomingEdgeIds(e) {
777
- const t = Array.from(this.nodes.get(e).ports.keys());
756
+ getNodeIncomingEdgeIds(t) {
757
+ const e = Array.from(this.nodes.get(t).ports.keys());
778
758
  let s = [];
779
- return t.forEach((i) => {
759
+ return e.forEach((i) => {
780
760
  s = [...s, ...this.getPortIncomingEdgeIds(i)];
781
761
  }), s;
782
762
  }
783
- getNodeOutgoingEdgeIds(e) {
784
- const t = Array.from(this.nodes.get(e).ports.keys());
763
+ getNodeOutgoingEdgeIds(t) {
764
+ const e = Array.from(this.nodes.get(t).ports.keys());
785
765
  let s = [];
786
- return t.forEach((i) => {
766
+ return e.forEach((i) => {
787
767
  s = [...s, ...this.getPortOutgoingEdgeIds(i)];
788
768
  }), s;
789
769
  }
790
- getNodeCycleEdgeIds(e) {
791
- const t = Array.from(this.nodes.get(e).ports.keys());
770
+ getNodeCycleEdgeIds(t) {
771
+ const e = Array.from(this.nodes.get(t).ports.keys());
792
772
  let s = [];
793
- return t.forEach((i) => {
773
+ return e.forEach((i) => {
794
774
  s = [...s, ...this.getPortCycleEdgeIds(i)];
795
775
  }), s;
796
776
  }
797
- getNodeAdjacentEdgeIds(e) {
777
+ getNodeAdjacentEdgeIds(t) {
798
778
  return [
799
- ...this.getNodeIncomingEdgeIds(e),
800
- ...this.getNodeOutgoingEdgeIds(e),
801
- ...this.getNodeCycleEdgeIds(e)
779
+ ...this.getNodeIncomingEdgeIds(t),
780
+ ...this.getNodeOutgoingEdgeIds(t),
781
+ ...this.getNodeCycleEdgeIds(t)
802
782
  ];
803
783
  }
804
- addEdgeInternal(e) {
805
- this.edges.set(e.id, {
806
- from: e.from,
807
- to: e.to,
808
- shape: e.shape,
809
- priority: e.priority
810
- }), 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);
784
+ addEdgeInternal(t) {
785
+ this.edges.set(t.id, {
786
+ from: t.from,
787
+ to: t.to,
788
+ payload: {
789
+ shape: t.shape,
790
+ priority: t.priority
791
+ }
792
+ }), t.from !== t.to ? (this.outcomingEdges.get(t.from).add(t.id), this.incomingEdges.get(t.to).add(t.id)) : this.cycleEdges.get(t.from).add(t.id);
811
793
  }
812
- removeEdgeInternal(e) {
813
- const t = this.edges.get(e), s = t.from, i = t.to;
814
- 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
+ removeEdgeInternal(t) {
795
+ const e = this.edges.get(t), s = e.from, i = e.to;
796
+ this.cycleEdges.get(s).delete(t), this.cycleEdges.get(i).delete(t), this.incomingEdges.get(s).delete(t), this.incomingEdges.get(i).delete(t), this.outcomingEdges.get(s).delete(t), this.outcomingEdges.get(i).delete(t), this.edges.delete(t);
815
797
  }
816
798
  }
817
- const ie = (r) => ({
799
+ const it = (r) => ({
818
800
  scale: 1 / r.scale,
819
801
  x: -r.x / r.scale,
820
802
  y: -r.y / r.scale
821
- }), ne = {
803
+ }), nt = {
822
804
  scale: 1,
823
805
  x: 0,
824
806
  y: 0
825
807
  };
826
- class $e {
808
+ class Bt {
827
809
  constructor() {
828
- o(this, "viewportMatrix", ne);
829
- o(this, "contentMatrix", ne);
810
+ o(this, "viewportMatrix", nt);
811
+ o(this, "contentMatrix", nt);
830
812
  o(this, "afterUpdateEmitter");
831
813
  o(this, "onAfterUpdated");
832
- o(this, "beforeUpdateEmitter");
833
- /**
834
- * @deprecated
835
- * do not use
836
- */
837
- o(this, "onBeforeUpdated");
838
- [this.afterUpdateEmitter, this.onAfterUpdated] = A(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = A();
814
+ [this.afterUpdateEmitter, this.onAfterUpdated] = A();
839
815
  }
840
816
  getViewportMatrix() {
841
817
  return this.viewportMatrix;
@@ -843,108 +819,108 @@ class $e {
843
819
  getContentMatrix() {
844
820
  return this.contentMatrix;
845
821
  }
846
- patchViewportMatrix(e) {
847
- this.beforeUpdateEmitter.emit(), this.viewportMatrix = {
848
- scale: e.scale ?? this.viewportMatrix.scale,
849
- x: e.x ?? this.viewportMatrix.x,
850
- y: e.y ?? this.viewportMatrix.y
851
- }, this.contentMatrix = ie(this.viewportMatrix), this.afterUpdateEmitter.emit();
822
+ patchViewportMatrix(t) {
823
+ this.viewportMatrix = {
824
+ scale: t.scale ?? this.viewportMatrix.scale,
825
+ x: t.x ?? this.viewportMatrix.x,
826
+ y: t.y ?? this.viewportMatrix.y
827
+ }, this.contentMatrix = it(this.viewportMatrix), this.afterUpdateEmitter.emit();
852
828
  }
853
- patchContentMatrix(e) {
854
- this.beforeUpdateEmitter.emit(), this.contentMatrix = {
855
- scale: e.scale ?? this.contentMatrix.scale,
856
- x: e.x ?? this.contentMatrix.x,
857
- y: e.y ?? this.contentMatrix.y
858
- }, this.viewportMatrix = ie(this.contentMatrix), this.afterUpdateEmitter.emit();
829
+ patchContentMatrix(t) {
830
+ this.contentMatrix = {
831
+ scale: t.scale ?? this.contentMatrix.scale,
832
+ x: t.x ?? this.contentMatrix.x,
833
+ y: t.y ?? this.contentMatrix.y
834
+ }, this.viewportMatrix = it(this.contentMatrix), this.afterUpdateEmitter.emit();
859
835
  }
860
836
  }
861
837
  class j {
862
- constructor(e) {
838
+ constructor(t) {
863
839
  o(this, "elementToNodeId", /* @__PURE__ */ new Map());
864
840
  o(this, "nodesResizeObserver");
865
- o(this, "onAfterNodeAdded", (e) => {
866
- const t = this.canvas.graph.getNode(e);
867
- this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
841
+ o(this, "onAfterNodeAdded", (t) => {
842
+ const e = this.canvas.graph.getNode(t);
843
+ this.elementToNodeId.set(e.element, t), this.nodesResizeObserver.observe(e.element);
868
844
  });
869
- o(this, "onBeforeNodeRemoved", (e) => {
870
- const t = this.canvas.graph.getNode(e);
871
- this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
845
+ o(this, "onBeforeNodeRemoved", (t) => {
846
+ const e = this.canvas.graph.getNode(t);
847
+ this.elementToNodeId.delete(e.element), this.nodesResizeObserver.unobserve(e.element);
872
848
  });
873
849
  o(this, "onBeforeClear", () => {
874
850
  this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
875
851
  });
876
- this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
877
- t.forEach((s) => {
852
+ this.canvas = t, this.nodesResizeObserver = new ResizeObserver((e) => {
853
+ e.forEach((s) => {
878
854
  const i = s.target;
879
855
  this.handleNodeResize(i);
880
856
  });
881
857
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
882
858
  }
883
- static configure(e) {
884
- new j(e);
859
+ static configure(t) {
860
+ new j(t);
885
861
  }
886
- handleNodeResize(e) {
887
- const t = this.elementToNodeId.get(e);
888
- this.canvas.updateNode(t);
862
+ handleNodeResize(t) {
863
+ const e = this.elementToNodeId.get(t);
864
+ this.canvas.updateNode(e);
889
865
  }
890
866
  }
891
- const Fe = (r, e, t) => {
867
+ const Ft = (r, t, e) => {
892
868
  const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
893
- return e >= s && e <= s + n && t >= i && t <= i + a;
894
- }, Oe = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, C = (r, e, t, s) => Fe(e, t, s) && Oe(r, t, s), U = (r, e) => {
895
- e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
869
+ return t >= s && t <= s + n && e >= i && e <= i + a;
870
+ }, Ot = (r, t, e) => t >= 0 && t <= r.innerWidth && e >= 0 && e <= r.innerHeight, R = (r, t, e, s) => Ft(t, e, s) && Ot(r, e, s), U = (r, t) => {
871
+ t !== null ? r.style.cursor = t : r.style.removeProperty("cursor");
896
872
  }, W = (r) => {
897
- const e = document.createElement("div");
873
+ const t = document.createElement("div");
898
874
  return {
899
875
  id: r.overlayId,
900
- element: e,
876
+ element: t,
901
877
  x: r.portCoords.x,
902
878
  y: r.portCoords.y,
903
879
  ports: [
904
880
  {
905
881
  id: r.overlayId,
906
- element: e,
882
+ element: t,
907
883
  direction: r.portDirection
908
884
  }
909
885
  ]
910
886
  };
911
- }, ke = (r, e) => {
912
- let t = e, s = null;
913
- for (; t !== null && (s = r.getElementPortIds(t)[0] ?? null, s === null); )
914
- t = t.parentElement;
887
+ }, kt = (r, t) => {
888
+ let e = t, s = null;
889
+ for (; e !== null && (s = r.getElementPortIds(e)[0] ?? null, s === null); )
890
+ e = e.parentElement;
915
891
  return s;
916
- }, ye = (r, e) => {
917
- const t = document.elementsFromPoint(e.x, e.y);
918
- for (const s of t) {
919
- const i = ke(r, s);
892
+ }, mt = (r, t) => {
893
+ const e = document.elementsFromPoint(t.x, t.y);
894
+ for (const s of e) {
895
+ const i = kt(r, s);
920
896
  if (i !== null)
921
897
  return i;
922
898
  }
923
899
  return null;
924
900
  };
925
901
  var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(P || {});
926
- const ve = (r, e) => ({
902
+ const vt = (r, t) => ({
927
903
  x: r / 2,
928
- y: e / 2
929
- }), m = (r, e, t) => ({
930
- x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
931
- y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
904
+ y: t / 2
905
+ }), y = (r, t, e) => ({
906
+ x: t.x * r.x - t.y * r.y + ((1 - t.x) * e.x + t.y * e.y),
907
+ y: t.y * r.x + t.x * r.y + ((1 - t.x) * e.y - t.y * e.x)
932
908
  }), u = {
933
909
  x: 0,
934
910
  y: 0
935
911
  };
936
- class ze {
937
- constructor(e) {
912
+ class zt {
913
+ constructor(t) {
938
914
  o(this, "path");
939
915
  o(this, "midpoint");
940
- this.params = e;
941
- const t = this.params.to;
942
- this.midpoint = { x: t.x / 2, y: t.y / 2 };
943
- const s = m(
916
+ this.params = t;
917
+ const e = this.params.to;
918
+ this.midpoint = { x: e.x / 2, y: e.y / 2 };
919
+ const s = y(
944
920
  { x: this.params.arrowLength, y: u.y },
945
921
  this.params.sourceDirection,
946
922
  u
947
- ), i = m(
923
+ ), i = y(
948
924
  { x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
949
925
  this.params.targetDirection,
950
926
  this.params.to
@@ -958,34 +934,34 @@ class ze {
958
934
  this.path = `${d}${h}${c}`;
959
935
  }
960
936
  }
961
- const $ = (r, e, t, s) => ({
962
- x: e * r.x + (1 - e) / 2 * s.x,
963
- y: t * r.y + (1 - t) / 2 * s.y
937
+ const B = (r, t, e, s) => ({
938
+ x: t * r.x + (1 - t) / 2 * s.x,
939
+ y: e * r.y + (1 - e) / 2 * s.y
964
940
  });
965
- class Xe {
966
- constructor(e) {
941
+ class Xt {
942
+ constructor(t) {
967
943
  o(this, "path");
968
944
  o(this, "midpoint");
969
- this.params = e;
970
- const t = this.params.hasSourceArrow ? m(
945
+ this.params = t;
946
+ const e = this.params.hasSourceArrow ? y(
971
947
  { x: this.params.arrowLength, y: u.y },
972
948
  this.params.sourceDirection,
973
949
  u
974
- ) : u, s = this.params.hasTargetArrow ? m(
950
+ ) : u, s = this.params.hasTargetArrow ? y(
975
951
  {
976
952
  x: this.params.to.x - this.params.arrowLength,
977
953
  y: this.params.to.y
978
954
  },
979
955
  this.params.targetDirection,
980
956
  this.params.to
981
- ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
957
+ ) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = y(
982
958
  { x: i, y: u.y },
983
959
  this.params.sourceDirection,
984
960
  u
985
961
  ), l = {
986
962
  x: c.x + h,
987
963
  y: c.y + d
988
- }, g = m(
964
+ }, g = y(
989
965
  { x: this.params.to.x - i, y: this.params.to.y },
990
966
  this.params.targetDirection,
991
967
  this.params.to
@@ -995,7 +971,7 @@ class Xe {
995
971
  }, f = {
996
972
  x: (l.x + w.x) / 2,
997
973
  y: (l.y + w.y) / 2
998
- }, y = {
974
+ }, m = {
999
975
  x: c.x + this.params.curvature * this.params.sourceDirection.x,
1000
976
  y: c.y + this.params.curvature * this.params.sourceDirection.y
1001
977
  }, v = {
@@ -1009,57 +985,57 @@ class Xe {
1009
985
  y: g.y + d
1010
986
  };
1011
987
  this.path = [
1012
- `M ${t.x} ${t.y}`,
988
+ `M ${e.x} ${e.y}`,
1013
989
  `L ${c.x} ${c.y}`,
1014
- `C ${y.x} ${y.y} ${E.x} ${E.y} ${f.x} ${f.y}`,
990
+ `C ${m.x} ${m.y} ${E.x} ${E.y} ${f.x} ${f.y}`,
1015
991
  `C ${x.x} ${x.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
1016
992
  `L ${s.x} ${s.y}`
1017
- ].join(" "), this.midpoint = $(f, e.flipX, e.flipY, e.to);
993
+ ].join(" "), this.midpoint = B(f, t.flipX, t.flipY, t.to);
1018
994
  }
1019
995
  }
1020
- const L = (r, e) => {
1021
- const t = [];
1022
- 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) {
996
+ const M = (r, t) => {
997
+ const e = [];
998
+ if (r.length > 0 && e.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && e.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
1023
999
  const s = r.length - 1;
1024
1000
  let i = 0, n = 0, a = 0;
1025
1001
  r.forEach((h, d) => {
1026
1002
  let c = 0, l = 0, g = 0;
1027
- const w = d > 0, f = d < s, y = w && f;
1003
+ const w = d > 0, f = d < s, m = w && f;
1028
1004
  if (w && (c = -i, l = -n, g = a), f) {
1029
1005
  const V = r[d + 1];
1030
1006
  i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
1031
1007
  }
1032
- const E = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, x = y ? { x: h.x + i * E, y: h.y + n * E } : h, T = g !== 0 ? Math.min((y ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * T, y: h.y + l * T } : h;
1033
- d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
1008
+ const E = a !== 0 ? Math.min((m ? t : 0) / a, d < s - 1 ? 0.5 : 1) : 0, x = m ? { x: h.x + i * E, y: h.y + n * E } : h, b = g !== 0 ? Math.min((m ? t : 0) / g, d > 1 ? 0.5 : 1) : 0, D = m ? { x: h.x + c * b, y: h.y + l * b } : h;
1009
+ d > 0 && e.push(`L ${D.x} ${D.y}`), m && e.push(
1034
1010
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
1035
1011
  );
1036
1012
  });
1037
1013
  }
1038
- return t.join(" ");
1014
+ return e.join(" ");
1039
1015
  };
1040
- class Ye {
1041
- constructor(e) {
1016
+ class Yt {
1017
+ constructor(t) {
1042
1018
  o(this, "path");
1043
1019
  o(this, "midpoint");
1044
- this.params = e;
1045
- const t = this.params.to;
1046
- this.midpoint = { x: t.x / 2, y: t.y / 2 };
1047
- const s = this.params.hasSourceArrow ? m(
1020
+ this.params = t;
1021
+ const e = this.params.to;
1022
+ this.midpoint = { x: e.x / 2, y: e.y / 2 };
1023
+ const s = this.params.hasSourceArrow ? y(
1048
1024
  { x: this.params.arrowLength, y: u.y },
1049
1025
  this.params.sourceDirection,
1050
1026
  u
1051
- ) : u, i = this.params.hasTargetArrow ? m(
1027
+ ) : u, i = this.params.hasTargetArrow ? y(
1052
1028
  {
1053
1029
  x: this.params.to.x - this.params.arrowLength,
1054
1030
  y: this.params.to.y
1055
1031
  },
1056
1032
  this.params.targetDirection,
1057
1033
  this.params.to
1058
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1034
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1059
1035
  { x: a, y: u.y },
1060
1036
  this.params.sourceDirection,
1061
1037
  u
1062
- ), d = m(
1038
+ ), d = y(
1063
1039
  { x: this.params.to.x - a, y: this.params.to.y },
1064
1040
  this.params.targetDirection,
1065
1041
  this.params.to
@@ -1069,97 +1045,97 @@ class Ye {
1069
1045
  }, w = { x: g.x, y: l }, f = {
1070
1046
  x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
1071
1047
  y: d.y
1072
- }, y = { x: f.x, y: l };
1073
- this.path = L(
1074
- [s, h, g, w, y, f, d, i],
1048
+ }, m = { x: f.x, y: l };
1049
+ this.path = M(
1050
+ [s, h, g, w, m, f, d, i],
1075
1051
  this.params.roundness
1076
1052
  );
1077
1053
  }
1078
1054
  }
1079
- class He {
1080
- constructor(e) {
1055
+ class Ht {
1056
+ constructor(t) {
1081
1057
  o(this, "path");
1082
1058
  o(this, "midpoint");
1083
- this.params = e;
1084
- const t = this.params.hasSourceArrow ? m(
1059
+ this.params = t;
1060
+ const e = this.params.hasSourceArrow ? y(
1085
1061
  { x: this.params.arrowLength, y: u.y },
1086
1062
  this.params.sourceDirection,
1087
1063
  u
1088
- ) : u, s = this.params.hasTargetArrow ? m(
1064
+ ) : u, s = this.params.hasTargetArrow ? y(
1089
1065
  {
1090
1066
  x: this.params.to.x - this.params.arrowLength,
1091
1067
  y: this.params.to.y
1092
1068
  },
1093
1069
  this.params.targetDirection,
1094
1070
  this.params.to
1095
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1071
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1096
1072
  { x: i, y: u.y },
1097
1073
  this.params.sourceDirection,
1098
1074
  u
1099
- ), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, l = { x: n.x + d, y: n.y + c }, g = m(
1075
+ ), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, l = { x: n.x + d, y: n.y + c }, g = y(
1100
1076
  { x: this.params.to.x - i, y: this.params.to.y },
1101
1077
  this.params.targetDirection,
1102
1078
  this.params.to
1103
1079
  ), w = { x: g.x + d, y: g.y + c }, f = { x: (l.x + w.x) / 2, y: (l.y + w.y) / 2 };
1104
- this.midpoint = $(f, e.flipX, e.flipY, e.to), this.path = L(
1105
- [t, n, l, w, g, s],
1080
+ this.midpoint = B(f, t.flipX, t.flipY, t.to), this.path = M(
1081
+ [e, n, l, w, g, s],
1106
1082
  this.params.roundness
1107
1083
  );
1108
1084
  }
1109
1085
  }
1110
- class je {
1111
- constructor(e) {
1086
+ class jt {
1087
+ constructor(t) {
1112
1088
  o(this, "path");
1113
1089
  o(this, "midpoint");
1114
- this.params = e;
1115
- const t = this.params.to;
1116
- this.midpoint = { x: t.x / 2, y: t.y / 2 };
1117
- const s = this.params.hasSourceArrow ? m(
1090
+ this.params = t;
1091
+ const e = this.params.to;
1092
+ this.midpoint = { x: e.x / 2, y: e.y / 2 };
1093
+ const s = this.params.hasSourceArrow ? y(
1118
1094
  { x: this.params.arrowLength, y: u.y },
1119
1095
  this.params.sourceDirection,
1120
1096
  u
1121
- ) : u, i = this.params.hasTargetArrow ? m(
1097
+ ) : u, i = this.params.hasTargetArrow ? y(
1122
1098
  {
1123
1099
  x: this.params.to.x - this.params.arrowLength,
1124
1100
  y: this.params.to.y
1125
1101
  },
1126
1102
  this.params.targetDirection,
1127
1103
  this.params.to
1128
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
1104
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
1129
1105
  { x: n, y: u.y },
1130
1106
  this.params.sourceDirection,
1131
1107
  u
1132
- ), h = m(
1108
+ ), h = y(
1133
1109
  { x: this.params.to.x - n, y: this.params.to.y },
1134
1110
  this.params.targetDirection,
1135
1111
  this.params.to
1136
1112
  );
1137
- this.path = L([s, a, h, i], this.params.roundness);
1113
+ this.path = M([s, a, h, i], this.params.roundness);
1138
1114
  }
1139
1115
  }
1140
- class Ge {
1141
- constructor(e) {
1116
+ class Gt {
1117
+ constructor(t) {
1142
1118
  o(this, "path");
1143
1119
  o(this, "midpoint");
1144
- this.params = e;
1145
- const t = this.params.to;
1146
- this.midpoint = { x: t.x / 2, y: t.y / 2 };
1147
- const s = this.params.hasSourceArrow ? m(
1120
+ this.params = t;
1121
+ const e = this.params.to;
1122
+ this.midpoint = { x: e.x / 2, y: e.y / 2 };
1123
+ const s = this.params.hasSourceArrow ? y(
1148
1124
  { x: this.params.arrowLength, y: u.y },
1149
1125
  this.params.sourceDirection,
1150
1126
  u
1151
- ) : u, i = this.params.hasTargetArrow ? m(
1127
+ ) : u, i = this.params.hasTargetArrow ? y(
1152
1128
  {
1153
1129
  x: this.params.to.x - this.params.arrowLength,
1154
1130
  y: this.params.to.y
1155
1131
  },
1156
1132
  this.params.targetDirection,
1157
1133
  this.params.to
1158
- ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
1134
+ ) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
1159
1135
  { x: a, y: u.y },
1160
1136
  this.params.sourceDirection,
1161
1137
  u
1162
- ), d = m(
1138
+ ), d = y(
1163
1139
  { x: this.params.to.x - a, y: this.params.to.y },
1164
1140
  this.params.targetDirection,
1165
1141
  this.params.to
@@ -1169,19 +1145,19 @@ class Ge {
1169
1145
  }, w = { x: l, y: g.y }, f = {
1170
1146
  x: d.x,
1171
1147
  y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
1172
- }, y = { x: l, y: f.y };
1173
- this.path = L(
1174
- [s, h, g, w, y, f, d, i],
1148
+ }, m = { x: l, y: f.y };
1149
+ this.path = M(
1150
+ [s, h, g, w, m, f, d, i],
1175
1151
  this.params.roundness
1176
1152
  );
1177
1153
  }
1178
1154
  }
1179
1155
  class G {
1180
- constructor(e) {
1156
+ constructor(t) {
1181
1157
  o(this, "path");
1182
1158
  o(this, "midpoint");
1183
- this.params = e;
1184
- const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
1159
+ this.params = t;
1160
+ const e = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + e, n = i + 2 * s, h = [
1185
1161
  { x: this.params.arrowLength, y: u.y },
1186
1162
  { x: i, y: u.y },
1187
1163
  { x: i, y: this.params.side },
@@ -1191,40 +1167,40 @@ class G {
1191
1167
  { x: i, y: u.y },
1192
1168
  { x: this.params.arrowLength, y: u.y }
1193
1169
  ].map(
1194
- (c) => m(c, this.params.sourceDirection, u)
1170
+ (c) => y(c, this.params.sourceDirection, u)
1195
1171
  ), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
1196
- this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${L(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1172
+ this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
1197
1173
  }
1198
1174
  }
1199
- class Ke {
1200
- constructor(e) {
1175
+ class Kt {
1176
+ constructor(t) {
1201
1177
  o(this, "path");
1202
1178
  o(this, "midpoint");
1203
- this.params = e;
1204
- const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, g = [
1179
+ this.params = t;
1180
+ const e = this.params.smallRadius, s = this.params.radius, i = e + s, n = e * s / i, a = Math.sqrt(i * i - e * e), h = a * e / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, g = [
1205
1181
  { x: this.params.arrowLength, y: u.y },
1206
1182
  { x: c, y: n },
1207
1183
  { x: c, y: -n },
1208
1184
  { x: d, y: 0 }
1209
1185
  ].map(
1210
- (y) => m(y, this.params.sourceDirection, u)
1186
+ (m) => y(m, this.params.sourceDirection, u)
1211
1187
  ), w = [
1212
1188
  `M ${g[0].x} ${g[0].y}`,
1213
- `A ${t} ${t} 0 0 1 ${g[1].x} ${g[1].y}`,
1189
+ `A ${e} ${e} 0 0 1 ${g[1].x} ${g[1].y}`,
1214
1190
  `A ${s} ${s} 0 1 0 ${g[2].x} ${g[2].y}`,
1215
- `A ${t} ${t} 0 0 1 ${g[0].x} ${g[0].y}`
1191
+ `A ${e} ${e} 0 0 1 ${g[0].x} ${g[0].y}`
1216
1192
  ].join(" "), f = `M 0 0 L ${g[0].x} ${g[0].y} `;
1217
1193
  this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${w}`, this.midpoint = g[3];
1218
1194
  }
1219
1195
  }
1220
- class Ze {
1221
- constructor(e) {
1196
+ class Zt {
1197
+ constructor(t) {
1222
1198
  o(this, "path");
1223
1199
  o(this, "midpoint");
1224
1200
  o(this, "diagonalDistance");
1225
- this.params = e;
1226
- const t = this.params.to;
1227
- if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
1201
+ this.params = t;
1202
+ const e = this.params.to;
1203
+ if (this.midpoint = { x: e.x / 2, y: e.y / 2 }, this.diagonalDistance = Math.sqrt(
1228
1204
  this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
1229
1205
  ), Math.sqrt(
1230
1206
  this.params.to.x * this.params.to.x + this.params.to.y * this.params.to.y
@@ -1245,35 +1221,35 @@ class Ze {
1245
1221
  });
1246
1222
  this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
1247
1223
  }
1248
- createDirectLinePoint(e) {
1249
- const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
1224
+ createDirectLinePoint(t) {
1225
+ const e = t.hasArrow ? this.params.arrowLength : 0, s = t.offset + e, i = t.flip * s / this.diagonalDistance;
1250
1226
  return {
1251
- x: this.params.to.x * i + e.shift.x,
1252
- y: this.params.to.y * i + e.shift.y
1227
+ x: this.params.to.x * i + t.shift.x,
1228
+ y: this.params.to.y * i + t.shift.y
1253
1229
  };
1254
1230
  }
1255
1231
  }
1256
- class Je {
1257
- constructor(e) {
1232
+ class Jt {
1233
+ constructor(t) {
1258
1234
  o(this, "path");
1259
1235
  o(this, "midpoint");
1260
- this.params = e;
1261
- const t = this.params.hasSourceArrow ? m(
1236
+ this.params = t;
1237
+ const e = this.params.hasSourceArrow ? y(
1262
1238
  { x: this.params.arrowLength, y: u.y },
1263
1239
  this.params.sourceDirection,
1264
1240
  u
1265
- ) : u, s = this.params.hasTargetArrow ? m(
1241
+ ) : u, s = this.params.hasTargetArrow ? y(
1266
1242
  {
1267
1243
  x: this.params.to.x - this.params.arrowLength,
1268
1244
  y: this.params.to.y
1269
1245
  },
1270
1246
  this.params.targetDirection,
1271
1247
  this.params.to
1272
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1248
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1273
1249
  { x: i, y: u.y },
1274
1250
  this.params.sourceDirection,
1275
1251
  u
1276
- ), a = m(
1252
+ ), a = y(
1277
1253
  { x: this.params.to.x - i, y: this.params.to.y },
1278
1254
  this.params.targetDirection,
1279
1255
  this.params.to
@@ -1281,9 +1257,9 @@ class Je {
1281
1257
  x: (n.x + a.x) / 2,
1282
1258
  y: l
1283
1259
  };
1284
- this.midpoint = $(g, e.flipX, e.flipY, e.to), this.path = L(
1260
+ this.midpoint = B(g, t.flipX, t.flipY, t.to), this.path = M(
1285
1261
  [
1286
- t,
1262
+ e,
1287
1263
  n,
1288
1264
  { x: n.x, y: l },
1289
1265
  { x: a.x, y: l },
@@ -1294,27 +1270,27 @@ class Je {
1294
1270
  );
1295
1271
  }
1296
1272
  }
1297
- class Qe {
1298
- constructor(e) {
1273
+ class Qt {
1274
+ constructor(t) {
1299
1275
  o(this, "path");
1300
1276
  o(this, "midpoint");
1301
- this.params = e;
1302
- const t = this.params.hasSourceArrow ? m(
1277
+ this.params = t;
1278
+ const e = this.params.hasSourceArrow ? y(
1303
1279
  { x: this.params.arrowLength, y: u.y },
1304
1280
  this.params.sourceDirection,
1305
1281
  u
1306
- ) : u, s = this.params.hasTargetArrow ? m(
1282
+ ) : u, s = this.params.hasTargetArrow ? y(
1307
1283
  {
1308
1284
  x: this.params.to.x - this.params.arrowLength,
1309
1285
  y: this.params.to.y
1310
1286
  },
1311
1287
  this.params.targetDirection,
1312
1288
  this.params.to
1313
- ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
1289
+ ) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
1314
1290
  { x: i, y: u.y },
1315
1291
  this.params.sourceDirection,
1316
1292
  u
1317
- ), a = m(
1293
+ ), a = y(
1318
1294
  { x: this.params.to.x - i, y: this.params.to.y },
1319
1295
  this.params.targetDirection,
1320
1296
  this.params.to
@@ -1322,9 +1298,9 @@ class Qe {
1322
1298
  x: l,
1323
1299
  y: (n.y + a.y) / 2
1324
1300
  };
1325
- this.midpoint = $(g, e.flipX, e.flipY, e.to), this.path = L(
1301
+ this.midpoint = B(g, t.flipX, t.flipY, t.to), this.path = M(
1326
1302
  [
1327
- t,
1303
+ e,
1328
1304
  n,
1329
1305
  { x: l, y: n.y },
1330
1306
  { x: l, y: a.y },
@@ -1335,30 +1311,30 @@ class Qe {
1335
1311
  );
1336
1312
  }
1337
1313
  }
1338
- const Ee = (r, e) => {
1339
- 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`;
1314
+ const Et = (r, t) => {
1315
+ r.style.transform = `translate(${t.x}px, ${t.y}px)`, r.style.width = `${Math.max(t.width, 1)}px`, r.style.height = `${Math.max(t.height, 1)}px`;
1340
1316
  }, K = Object.freeze({
1341
1317
  edgeColor: "--edge-color"
1342
- }), Ae = (r) => {
1343
- const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1344
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(K.edgeColor, r), e;
1345
- }, B = () => {
1318
+ }), At = (r) => {
1319
+ const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1320
+ return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t.style.setProperty(K.edgeColor, r), t;
1321
+ }, $ = () => {
1346
1322
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
1347
1323
  return r.setAttribute("fill", `var(${K.edgeColor})`), r;
1348
- }, xe = () => {
1324
+ }, xt = () => {
1349
1325
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1350
1326
  return r.style.transformOrigin = "50% 50%", r;
1351
- }, Se = (r) => {
1352
- const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1353
- return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1354
- }, Pe = (r, e) => {
1355
- const t = {
1327
+ }, St = (r) => {
1328
+ const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
1329
+ return t.setAttribute("stroke", `var(${K.edgeColor})`), t.setAttribute("stroke-width", `${r}`), t.setAttribute("fill", "none"), t;
1330
+ }, Pt = (r, t) => {
1331
+ const e = {
1356
1332
  x: r.x + r.width / 2,
1357
1333
  y: r.y + r.height / 2
1358
1334
  }, s = {
1359
- x: e.x + e.width / 2,
1360
- y: e.y + e.height / 2
1361
- }, i = Math.min(t.x, s.x), n = Math.min(t.y, s.y), a = Math.abs(s.x - t.x), h = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
1335
+ x: t.x + t.width / 2,
1336
+ y: t.y + t.height / 2
1337
+ }, i = Math.min(e.x, s.x), n = Math.min(e.y, s.y), a = Math.abs(s.x - e.x), h = Math.abs(s.y - e.y), d = e.x <= s.x ? 1 : -1, c = e.y <= s.y ? 1 : -1;
1362
1338
  return {
1363
1339
  x: i,
1364
1340
  y: n,
@@ -1367,12 +1343,12 @@ const Ee = (r, e) => {
1367
1343
  flipX: d,
1368
1344
  flipY: c
1369
1345
  };
1370
- }, X = (r, e, t, s) => {
1346
+ }, X = (r, t, e, s) => {
1371
1347
  const n = [
1372
1348
  u,
1373
- { x: t, y: s },
1374
- { x: t, y: -s }
1375
- ].map((c) => m(c, r, u)).map((c) => ({ x: c.x + e.x, y: c.y + e.y })), a = `M ${n[0].x} ${n[0].y}`, h = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
1349
+ { x: e, y: s },
1350
+ { x: e, y: -s }
1351
+ ].map((c) => y(c, r, u)).map((c) => ({ x: c.x + t.x, y: c.y + t.y })), a = `M ${n[0].x} ${n[0].y}`, h = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
1376
1352
  return `${a} ${h} ${d} Z`;
1377
1353
  }, p = Object.freeze({
1378
1354
  color: "#777777",
@@ -1392,30 +1368,30 @@ const Ee = (r, e) => {
1392
1368
  curvature: 90,
1393
1369
  interactiveWidth: 10,
1394
1370
  preOffset: 0
1395
- }), ae = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1371
+ }), at = (r, t, e) => ({ x: t * Math.cos(r), y: e * Math.sin(r) });
1396
1372
  class F {
1397
- constructor(e) {
1373
+ constructor(t) {
1398
1374
  o(this, "svg");
1399
- o(this, "group", xe());
1375
+ o(this, "group", xt());
1400
1376
  o(this, "line");
1401
1377
  o(this, "sourceArrow", null);
1402
1378
  o(this, "targetArrow", null);
1403
1379
  o(this, "onAfterRender");
1404
1380
  o(this, "afterRenderEmitter");
1405
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = A(), this.svg = Ae(e.color), this.svg.appendChild(this.group), this.line = Se(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1381
+ this.params = t, [this.afterRenderEmitter, this.onAfterRender] = A(), this.svg = At(t.color), this.svg.appendChild(this.group), this.line = St(t.width), this.group.appendChild(this.line), t.hasSourceArrow && (this.sourceArrow = $(), this.group.appendChild(this.sourceArrow)), t.hasTargetArrow && (this.targetArrow = $(), this.group.appendChild(this.targetArrow));
1406
1382
  }
1407
- render(e) {
1408
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Pe(
1409
- e.from,
1410
- e.to
1383
+ render(t) {
1384
+ const { x: e, y: s, width: i, height: n, flipX: a, flipY: h } = Pt(
1385
+ t.from,
1386
+ t.to
1411
1387
  );
1412
- Ee(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1413
- const d = ae(
1414
- e.from.direction,
1388
+ Et(this.svg, { x: e, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1389
+ const d = at(
1390
+ t.from.direction,
1415
1391
  a,
1416
1392
  h
1417
- ), c = ae(
1418
- e.to.direction,
1393
+ ), c = at(
1394
+ t.to.direction,
1419
1395
  a,
1420
1396
  h
1421
1397
  ), l = {
@@ -1423,15 +1399,15 @@ class F {
1423
1399
  y: n
1424
1400
  };
1425
1401
  let g = c, w = -this.params.arrowLength, f;
1426
- e.category === R.PortCycle ? (f = this.params.createCyclePath, g = d, w = this.params.arrowLength) : e.category === R.NodeCycle ? f = this.params.createDetourPath : f = this.params.createLinePath;
1427
- const y = f(
1402
+ t.category === C.PortCycle ? (f = this.params.createCyclePath, g = d, w = this.params.arrowLength) : t.category === C.NodeCycle ? f = this.params.createDetourPath : f = this.params.createLinePath;
1403
+ const m = f(
1428
1404
  d,
1429
1405
  c,
1430
1406
  l,
1431
1407
  a,
1432
1408
  h
1433
1409
  );
1434
- this.line.setAttribute("d", y.path);
1410
+ this.line.setAttribute("d", m.path);
1435
1411
  let v = null;
1436
1412
  this.sourceArrow && (v = X(
1437
1413
  d,
@@ -1446,14 +1422,14 @@ class F {
1446
1422
  w,
1447
1423
  this.params.arrowWidth
1448
1424
  ), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
1449
- edgePath: y,
1425
+ edgePath: m,
1450
1426
  sourceArrowPath: v,
1451
1427
  targetArrowPath: E
1452
1428
  });
1453
1429
  }
1454
1430
  }
1455
- class _e {
1456
- constructor(e) {
1431
+ class _t {
1432
+ constructor(t) {
1457
1433
  o(this, "svg");
1458
1434
  o(this, "group");
1459
1435
  o(this, "line");
@@ -1470,18 +1446,18 @@ class _e {
1470
1446
  o(this, "hasSourceArrow");
1471
1447
  o(this, "hasTargetArrow");
1472
1448
  o(this, "pathShape");
1473
- o(this, "createCyclePath", (e) => new Ke({
1474
- sourceDirection: e,
1449
+ o(this, "createCyclePath", (t) => new Kt({
1450
+ sourceDirection: t,
1475
1451
  radius: this.portCycleRadius,
1476
1452
  smallRadius: this.portCycleSmallRadius,
1477
1453
  arrowLength: this.arrowLength,
1478
1454
  hasSourceArrow: this.hasSourceArrow,
1479
1455
  hasTargetArrow: this.hasTargetArrow
1480
1456
  }));
1481
- o(this, "createDetourPath", (e, t, s, i, n) => new Xe({
1457
+ o(this, "createDetourPath", (t, e, s, i, n) => new Xt({
1482
1458
  to: s,
1483
- sourceDirection: e,
1484
- targetDirection: t,
1459
+ sourceDirection: t,
1460
+ targetDirection: e,
1485
1461
  flipX: i,
1486
1462
  flipY: n,
1487
1463
  arrowLength: this.arrowLength,
@@ -1491,18 +1467,18 @@ class _e {
1491
1467
  hasSourceArrow: this.hasSourceArrow,
1492
1468
  hasTargetArrow: this.hasTargetArrow
1493
1469
  }));
1494
- o(this, "createLinePath", (e, t, s) => new ze({
1470
+ o(this, "createLinePath", (t, e, s) => new zt({
1495
1471
  to: s,
1496
- sourceDirection: e,
1497
- targetDirection: t,
1472
+ sourceDirection: t,
1473
+ targetDirection: e,
1498
1474
  arrowLength: this.arrowLength,
1499
1475
  curvature: this.curvature,
1500
1476
  hasSourceArrow: this.hasSourceArrow,
1501
1477
  hasTargetArrow: this.hasTargetArrow
1502
1478
  }));
1503
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? p.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? p.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? p.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? p.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? p.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? p.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1504
- color: (e == null ? void 0 : e.color) ?? p.color,
1505
- width: (e == null ? void 0 : e.width) ?? p.width,
1479
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.curvature = (t == null ? void 0 : t.curvature) ?? p.curvature, this.portCycleRadius = (t == null ? void 0 : t.cycleRadius) ?? p.cycleRadius, this.portCycleSmallRadius = (t == null ? void 0 : t.smallCycleRadius) ?? p.smallCycleRadius, this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? p.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1480
+ color: (t == null ? void 0 : t.color) ?? p.color,
1481
+ width: (t == null ? void 0 : t.width) ?? p.width,
1506
1482
  arrowLength: this.arrowLength,
1507
1483
  arrowWidth: this.arrowWidth,
1508
1484
  hasSourceArrow: this.hasSourceArrow,
@@ -1512,12 +1488,12 @@ class _e {
1512
1488
  createLinePath: this.createLinePath
1513
1489
  }), 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;
1514
1490
  }
1515
- render(e) {
1516
- this.pathShape.render(e);
1491
+ render(t) {
1492
+ this.pathShape.render(t);
1517
1493
  }
1518
1494
  }
1519
- class qe {
1520
- constructor(e) {
1495
+ class qt {
1496
+ constructor(t) {
1521
1497
  o(this, "svg");
1522
1498
  o(this, "group");
1523
1499
  o(this, "line");
@@ -1533,8 +1509,8 @@ class qe {
1533
1509
  o(this, "hasSourceArrow");
1534
1510
  o(this, "hasTargetArrow");
1535
1511
  o(this, "pathShape");
1536
- o(this, "createCyclePath", (e) => new G({
1537
- sourceDirection: e,
1512
+ o(this, "createCyclePath", (t) => new G({
1513
+ sourceDirection: t,
1538
1514
  arrowLength: this.arrowLength,
1539
1515
  side: this.cycleSquareSide,
1540
1516
  arrowOffset: this.arrowOffset,
@@ -1542,10 +1518,10 @@ class qe {
1542
1518
  hasSourceArrow: this.hasSourceArrow,
1543
1519
  hasTargetArrow: this.hasTargetArrow
1544
1520
  }));
1545
- o(this, "createDetourPath", (e, t, s, i, n) => new Je({
1521
+ o(this, "createDetourPath", (t, e, s, i, n) => new Jt({
1546
1522
  to: s,
1547
- sourceDirection: e,
1548
- targetDirection: t,
1523
+ sourceDirection: t,
1524
+ targetDirection: e,
1549
1525
  flipX: i,
1550
1526
  flipY: n,
1551
1527
  arrowLength: this.arrowLength,
@@ -1555,10 +1531,10 @@ class qe {
1555
1531
  hasSourceArrow: this.hasSourceArrow,
1556
1532
  hasTargetArrow: this.hasTargetArrow
1557
1533
  }));
1558
- o(this, "createLinePath", (e, t, s, i) => new Ye({
1534
+ o(this, "createLinePath", (t, e, s, i) => new Yt({
1559
1535
  to: s,
1560
- sourceDirection: e,
1561
- targetDirection: t,
1536
+ sourceDirection: t,
1537
+ targetDirection: e,
1562
1538
  flipX: i,
1563
1539
  arrowLength: this.arrowLength,
1564
1540
  arrowOffset: this.arrowOffset,
@@ -1566,15 +1542,15 @@ class qe {
1566
1542
  hasSourceArrow: this.hasSourceArrow,
1567
1543
  hasTargetArrow: this.hasTargetArrow
1568
1544
  }));
1569
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? p.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? p.cycleSquareSide;
1570
- const t = (e == null ? void 0 : e.roundness) ?? p.roundness;
1545
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? p.cycleSquareSide;
1546
+ const e = (t == null ? void 0 : t.roundness) ?? p.roundness;
1571
1547
  this.roundness = Math.min(
1572
- t,
1548
+ e,
1573
1549
  this.arrowOffset,
1574
1550
  this.cycleSquareSide / 2
1575
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1576
- color: (e == null ? void 0 : e.color) ?? p.color,
1577
- width: (e == null ? void 0 : e.width) ?? p.width,
1551
+ ), this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1552
+ color: (t == null ? void 0 : t.color) ?? p.color,
1553
+ width: (t == null ? void 0 : t.width) ?? p.width,
1578
1554
  arrowLength: this.arrowLength,
1579
1555
  arrowWidth: this.arrowWidth,
1580
1556
  hasSourceArrow: this.hasSourceArrow,
@@ -1584,12 +1560,12 @@ class qe {
1584
1560
  createLinePath: this.createLinePath
1585
1561
  }), 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;
1586
1562
  }
1587
- render(e) {
1588
- this.pathShape.render(e);
1563
+ render(t) {
1564
+ this.pathShape.render(t);
1589
1565
  }
1590
1566
  }
1591
- class et {
1592
- constructor(e) {
1567
+ class te {
1568
+ constructor(t) {
1593
1569
  o(this, "svg");
1594
1570
  o(this, "group");
1595
1571
  o(this, "line");
@@ -1606,8 +1582,8 @@ class et {
1606
1582
  o(this, "hasSourceArrow");
1607
1583
  o(this, "hasTargetArrow");
1608
1584
  o(this, "pathShape");
1609
- o(this, "createCyclePath", (e) => new G({
1610
- sourceDirection: e,
1585
+ o(this, "createCyclePath", (t) => new G({
1586
+ sourceDirection: t,
1611
1587
  arrowLength: this.arrowLength,
1612
1588
  side: this.cycleSquareSide,
1613
1589
  arrowOffset: this.arrowOffset,
@@ -1615,10 +1591,10 @@ class et {
1615
1591
  hasSourceArrow: this.hasSourceArrow,
1616
1592
  hasTargetArrow: this.hasTargetArrow
1617
1593
  }));
1618
- o(this, "createDetourPath", (e, t, s, i, n) => new He({
1594
+ o(this, "createDetourPath", (t, e, s, i, n) => new Ht({
1619
1595
  to: s,
1620
- sourceDirection: e,
1621
- targetDirection: t,
1596
+ sourceDirection: t,
1597
+ targetDirection: e,
1622
1598
  flipX: i,
1623
1599
  flipY: n,
1624
1600
  arrowLength: this.arrowLength,
@@ -1629,25 +1605,25 @@ class et {
1629
1605
  hasSourceArrow: this.hasSourceArrow,
1630
1606
  hasTargetArrow: this.hasTargetArrow
1631
1607
  }));
1632
- o(this, "createLinePath", (e, t, s) => new je({
1608
+ o(this, "createLinePath", (t, e, s) => new jt({
1633
1609
  to: s,
1634
- sourceDirection: e,
1635
- targetDirection: t,
1610
+ sourceDirection: t,
1611
+ targetDirection: e,
1636
1612
  arrowLength: this.arrowLength,
1637
1613
  arrowOffset: this.arrowOffset,
1638
1614
  roundness: this.roundness,
1639
1615
  hasSourceArrow: this.hasSourceArrow,
1640
1616
  hasTargetArrow: this.hasTargetArrow
1641
1617
  }));
1642
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? p.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? p.cycleSquareSide;
1643
- const t = (e == null ? void 0 : e.roundness) ?? p.roundness;
1618
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? p.cycleSquareSide;
1619
+ const e = (t == null ? void 0 : t.roundness) ?? p.roundness;
1644
1620
  this.roundness = Math.min(
1645
- t,
1621
+ e,
1646
1622
  this.arrowOffset,
1647
1623
  this.cycleSquareSide / 2
1648
- ), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? p.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1649
- color: (e == null ? void 0 : e.color) ?? p.color,
1650
- width: (e == null ? void 0 : e.width) ?? p.width,
1624
+ ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? p.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1625
+ color: (t == null ? void 0 : t.color) ?? p.color,
1626
+ width: (t == null ? void 0 : t.width) ?? p.width,
1651
1627
  arrowLength: this.arrowLength,
1652
1628
  arrowWidth: this.arrowWidth,
1653
1629
  hasSourceArrow: this.hasSourceArrow,
@@ -1657,12 +1633,12 @@ class et {
1657
1633
  createLinePath: this.createLinePath
1658
1634
  }), 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;
1659
1635
  }
1660
- render(e) {
1661
- this.pathShape.render(e);
1636
+ render(t) {
1637
+ this.pathShape.render(t);
1662
1638
  }
1663
1639
  }
1664
- class tt {
1665
- constructor(e) {
1640
+ class ee {
1641
+ constructor(t) {
1666
1642
  o(this, "svg");
1667
1643
  o(this, "group");
1668
1644
  o(this, "line");
@@ -1678,8 +1654,8 @@ class tt {
1678
1654
  o(this, "hasSourceArrow");
1679
1655
  o(this, "hasTargetArrow");
1680
1656
  o(this, "pathShape");
1681
- o(this, "createCyclePath", (e) => new G({
1682
- sourceDirection: e,
1657
+ o(this, "createCyclePath", (t) => new G({
1658
+ sourceDirection: t,
1683
1659
  arrowLength: this.arrowLength,
1684
1660
  side: this.cycleSquareSide,
1685
1661
  arrowOffset: this.arrowOffset,
@@ -1687,10 +1663,10 @@ class tt {
1687
1663
  hasSourceArrow: this.hasSourceArrow,
1688
1664
  hasTargetArrow: this.hasTargetArrow
1689
1665
  }));
1690
- o(this, "createDetourPath", (e, t, s, i, n) => new Qe({
1666
+ o(this, "createDetourPath", (t, e, s, i, n) => new Qt({
1691
1667
  to: s,
1692
- sourceDirection: e,
1693
- targetDirection: t,
1668
+ sourceDirection: t,
1669
+ targetDirection: e,
1694
1670
  flipX: i,
1695
1671
  flipY: n,
1696
1672
  arrowLength: this.arrowLength,
@@ -1700,10 +1676,10 @@ class tt {
1700
1676
  hasSourceArrow: this.hasSourceArrow,
1701
1677
  hasTargetArrow: this.hasTargetArrow
1702
1678
  }));
1703
- o(this, "createLinePath", (e, t, s, i, n) => new Ge({
1679
+ o(this, "createLinePath", (t, e, s, i, n) => new Gt({
1704
1680
  to: s,
1705
- sourceDirection: e,
1706
- targetDirection: t,
1681
+ sourceDirection: t,
1682
+ targetDirection: e,
1707
1683
  flipY: n,
1708
1684
  arrowLength: this.arrowLength,
1709
1685
  arrowOffset: this.arrowOffset,
@@ -1711,15 +1687,15 @@ class tt {
1711
1687
  hasSourceArrow: this.hasSourceArrow,
1712
1688
  hasTargetArrow: this.hasTargetArrow
1713
1689
  }));
1714
- this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? p.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? p.cycleSquareSide;
1715
- const t = (e == null ? void 0 : e.roundness) ?? p.roundness;
1690
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? p.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? p.cycleSquareSide;
1691
+ const e = (t == null ? void 0 : t.roundness) ?? p.roundness;
1716
1692
  this.roundness = Math.min(
1717
- t,
1693
+ e,
1718
1694
  this.arrowOffset,
1719
1695
  this.cycleSquareSide / 2
1720
- ), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1721
- color: (e == null ? void 0 : e.color) ?? p.color,
1722
- width: (e == null ? void 0 : e.width) ?? p.width,
1696
+ ), this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? p.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? p.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? p.hasTargetArrow, this.pathShape = new F({
1697
+ color: (t == null ? void 0 : t.color) ?? p.color,
1698
+ width: (t == null ? void 0 : t.width) ?? p.width,
1723
1699
  arrowLength: this.arrowLength,
1724
1700
  arrowWidth: this.arrowWidth,
1725
1701
  hasSourceArrow: this.hasSourceArrow,
@@ -1729,18 +1705,18 @@ class tt {
1729
1705
  createLinePath: this.createLinePath
1730
1706
  }), 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;
1731
1707
  }
1732
- render(e) {
1733
- this.pathShape.render(e);
1708
+ render(t) {
1709
+ this.pathShape.render(t);
1734
1710
  }
1735
1711
  }
1736
- const he = (r) => {
1712
+ const ht = (r) => {
1737
1713
  if (r.diagonalDistance === 0)
1738
1714
  return "";
1739
- const e = r.offset / r.diagonalDistance, t = r.flip * r.to.x, s = r.flip * r.to.y, i = {
1740
- x: t * e + r.shift.x,
1741
- y: s * e + r.shift.y
1715
+ const t = r.offset / r.diagonalDistance, e = r.flip * r.to.x, s = r.flip * r.to.y, i = {
1716
+ x: e * t + r.shift.x,
1717
+ y: s * t + r.shift.y
1742
1718
  }, n = {
1743
- x: t / r.diagonalDistance,
1719
+ x: e / r.diagonalDistance,
1744
1720
  y: s / r.diagonalDistance
1745
1721
  };
1746
1722
  return X(
@@ -1750,10 +1726,10 @@ const he = (r) => {
1750
1726
  r.arrowWidth
1751
1727
  );
1752
1728
  };
1753
- class be {
1754
- constructor(e) {
1729
+ class bt {
1730
+ constructor(t) {
1755
1731
  o(this, "svg");
1756
- o(this, "group", xe());
1732
+ o(this, "group", xt());
1757
1733
  o(this, "line");
1758
1734
  o(this, "sourceArrow", null);
1759
1735
  o(this, "targetArrow", null);
@@ -1765,15 +1741,15 @@ class be {
1765
1741
  o(this, "targetOffset");
1766
1742
  o(this, "onAfterRender");
1767
1743
  o(this, "afterRenderEmitter");
1768
- [this.afterRenderEmitter, this.onAfterRender] = A(), this.color = (e == null ? void 0 : e.color) ?? p.color, this.width = (e == null ? void 0 : e.width) ?? p.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? p.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? p.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? p.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? p.preOffset, this.svg = Ae(this.color), this.svg.appendChild(this.group), this.line = Se(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1744
+ [this.afterRenderEmitter, this.onAfterRender] = A(), this.color = (t == null ? void 0 : t.color) ?? p.color, this.width = (t == null ? void 0 : t.width) ?? p.width, this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? p.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? p.arrowWidth, this.sourceOffset = (t == null ? void 0 : t.sourceOffset) ?? p.preOffset, this.targetOffset = (t == null ? void 0 : t.targetOffset) ?? p.preOffset, this.svg = At(this.color), this.svg.appendChild(this.group), this.line = St(this.width), this.group.appendChild(this.line), t != null && t.hasSourceArrow && (this.sourceArrow = $(), this.group.appendChild(this.sourceArrow)), t != null && t.hasTargetArrow && (this.targetArrow = $(), this.group.appendChild(this.targetArrow));
1769
1745
  }
1770
- render(e) {
1771
- const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Pe(
1772
- e.from,
1773
- e.to
1746
+ render(t) {
1747
+ const { x: e, y: s, width: i, height: n, flipX: a, flipY: h } = Pt(
1748
+ t.from,
1749
+ t.to
1774
1750
  );
1775
- Ee(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1776
- const d = { x: i, y: n }, c = new Ze({
1751
+ Et(this.svg, { x: e, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
1752
+ const d = { x: i, y: n }, c = new Zt({
1777
1753
  to: d,
1778
1754
  sourceOffset: this.sourceOffset,
1779
1755
  targetOffset: this.targetOffset,
@@ -1783,7 +1759,7 @@ class be {
1783
1759
  });
1784
1760
  this.line.setAttribute("d", c.path);
1785
1761
  let l = null;
1786
- this.sourceArrow && (l = he({
1762
+ this.sourceArrow && (l = ht({
1787
1763
  diagonalDistance: c.diagonalDistance,
1788
1764
  to: d,
1789
1765
  offset: this.sourceOffset,
@@ -1793,7 +1769,7 @@ class be {
1793
1769
  arrowLength: this.arrowLength
1794
1770
  }), this.sourceArrow.setAttribute("d", l));
1795
1771
  let g = null;
1796
- this.targetArrow && (g = he({
1772
+ this.targetArrow && (g = ht({
1797
1773
  diagonalDistance: c.diagonalDistance,
1798
1774
  to: d,
1799
1775
  offset: this.targetOffset,
@@ -1808,137 +1784,126 @@ class be {
1808
1784
  });
1809
1785
  }
1810
1786
  }
1811
- const rt = () => {
1787
+ const re = () => {
1812
1788
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1813
1789
  return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
1814
- }, ot = (r) => {
1815
- const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1816
- return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
1817
- }, de = (r) => {
1818
- const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1819
- return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
1790
+ }, oe = (r) => {
1791
+ const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
1792
+ return t.setAttribute("stroke", "transparent"), t.setAttribute("stroke-width", `${r}`), t.setAttribute("fill", "none"), t.setAttribute("stroke-linecap", "round"), t;
1793
+ }, dt = (r) => {
1794
+ const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
1795
+ return t.setAttribute("stroke-linejoin", "round"), t.setAttribute("stroke-width", `${r}`), t.setAttribute("fill", "transparent"), t.setAttribute("stroke", "transparent"), t;
1820
1796
  };
1821
- class st extends Error {
1822
- constructor(e) {
1823
- super(e), this.name = "InteractiveEdgeError";
1797
+ class se extends Error {
1798
+ constructor(t) {
1799
+ super(t), this.name = "InteractiveEdgeError";
1824
1800
  }
1825
1801
  }
1826
- class Te {
1827
- constructor(e, t) {
1802
+ class Tt {
1803
+ constructor(t, e) {
1828
1804
  o(this, "svg");
1829
1805
  o(this, "group");
1830
1806
  o(this, "line");
1831
1807
  o(this, "sourceArrow");
1832
1808
  o(this, "targetArrow");
1833
- o(this, "handle", rt());
1809
+ o(this, "handle", re());
1834
1810
  o(this, "onAfterRender");
1835
1811
  o(this, "interactiveLine");
1836
1812
  o(this, "interactiveSourceArrow", null);
1837
1813
  o(this, "interactiveTargetArrow", null);
1838
- if (this.baseEdge = e, e instanceof Te)
1839
- throw new st(
1814
+ if (this.baseEdge = t, t instanceof Tt)
1815
+ throw new se(
1840
1816
  "interactive edge can be configured only once"
1841
1817
  );
1842
1818
  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;
1843
- const s = (t == null ? void 0 : t.width) ?? p.interactiveWidth;
1844
- this.interactiveLine = ot(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = de(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = de(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1819
+ const s = (e == null ? void 0 : e.distance) ?? p.interactiveWidth;
1820
+ this.interactiveLine = oe(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = dt(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = dt(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
1845
1821
  this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
1846
1822
  });
1847
1823
  }
1848
- render(e) {
1849
- this.baseEdge.render(e);
1824
+ render(t) {
1825
+ this.baseEdge.render(t);
1850
1826
  }
1851
1827
  }
1852
- class Dt {
1853
- constructor(e, t) {
1828
+ class Ne {
1829
+ constructor(t, e) {
1854
1830
  o(this, "group");
1855
1831
  o(this, "line");
1856
1832
  o(this, "sourceArrow");
1857
1833
  o(this, "targetArrow");
1858
1834
  o(this, "onAfterRender");
1859
1835
  o(this, "svg");
1860
- /**
1861
- * @deprecated
1862
- * use midpointElement instead
1863
- */
1864
- o(this, "medianElement");
1865
- this.baseShape = e, this.midpointElement = t, this.medianElement = this.midpointElement, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
1836
+ this.baseShape = t, this.midpointElement = e, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
1866
1837
  const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
1867
1838
  this.midpointElement.style.setProperty("transform", n);
1868
1839
  });
1869
1840
  }
1870
- render(e) {
1871
- this.baseShape.render(e);
1841
+ render(t) {
1842
+ this.baseShape.render(t);
1872
1843
  }
1873
1844
  }
1874
- const De = (r, e) => {
1875
- const t = new me(), s = new pe(t, e, r), i = {
1845
+ const Dt = (r, t) => {
1846
+ const e = new yt(), s = new pt(e, t, r), i = {
1876
1847
  nodes: {
1877
- centerFn: ve,
1848
+ centerFn: vt,
1878
1849
  priorityFn: () => 0
1879
1850
  },
1880
1851
  edges: {
1881
- shapeFactory: () => new be(),
1852
+ shapeFactory: () => new bt(),
1882
1853
  priorityFn: () => 0
1883
1854
  },
1884
1855
  ports: {
1885
1856
  direction: 0
1886
1857
  }
1887
1858
  };
1888
- return new fe(
1889
- r,
1890
- t,
1891
- e,
1892
- s,
1893
- i
1894
- );
1859
+ return new ft(e, t, s, i);
1895
1860
  };
1896
1861
  class O {
1897
- constructor(e, t, s, i) {
1898
- o(this, "onAfterPortMarked", (e) => {
1899
- const t = this.canvas.graph.getPort(e);
1900
- this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
1862
+ constructor(t, e, s, i) {
1863
+ o(this, "onAfterPortMarked", (t) => {
1864
+ const e = this.canvas.graph.getPort(t);
1865
+ this.canvas.graph.getElementPortIds(e.element).length === 1 && this.hookPortEvents(e.element);
1901
1866
  });
1902
- o(this, "onBeforePortUnmarked", (e) => {
1903
- const t = this.canvas.graph.getPort(e);
1904
- this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
1867
+ o(this, "onBeforePortUnmarked", (t) => {
1868
+ const e = this.canvas.graph.getPort(t);
1869
+ this.canvas.graph.getElementPortIds(e.element).length === 1 && this.unhookPortEvents(e.element);
1905
1870
  });
1906
- o(this, "onPortMouseDown", (e) => {
1907
- if (!this.params.mouseDownEventVerifier(e))
1871
+ o(this, "onPortMouseDown", (t) => {
1872
+ if (!this.params.mouseDownEventVerifier(t))
1908
1873
  return;
1909
- const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
1874
+ const e = t.currentTarget, s = this.canvas.graph.getElementPortIds(e)[0];
1910
1875
  this.params.onPortPointerDown(s, {
1911
- x: e.clientX,
1912
- y: e.clientY
1913
- }) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1876
+ x: t.clientX,
1877
+ y: t.clientY
1878
+ }) && (t.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
1914
1879
  passive: !0
1915
1880
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
1916
1881
  passive: !0
1917
1882
  }));
1918
1883
  });
1919
- o(this, "onWindowMouseMove", (e) => {
1920
- if (!C(
1884
+ o(this, "onWindowMouseMove", (t) => {
1885
+ if (!R(
1921
1886
  this.window,
1922
1887
  this.element,
1923
- e.clientX,
1924
- e.clientY
1888
+ t.clientX,
1889
+ t.clientY
1925
1890
  )) {
1926
1891
  this.stopMouseDrag();
1927
1892
  return;
1928
1893
  }
1929
- this.params.onPointerMove({ x: e.clientX, y: e.clientY });
1894
+ this.params.onPointerMove({ x: t.clientX, y: t.clientY });
1930
1895
  });
1931
- o(this, "onWindowMouseUp", (e) => {
1932
- this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
1896
+ o(this, "onWindowMouseUp", (t) => {
1897
+ this.params.mouseUpEventVerifier(t) && (this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopMouseDrag());
1933
1898
  });
1934
- o(this, "onPortTouchStart", (e) => {
1935
- if (e.touches.length !== 1)
1899
+ o(this, "onPortTouchStart", (t) => {
1900
+ if (t.touches.length !== 1)
1936
1901
  return;
1937
- const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
1902
+ const e = t.touches[0], s = t.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
1938
1903
  this.params.onPortPointerDown(i, {
1939
- x: t.clientX,
1940
- y: t.clientY
1941
- }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1904
+ x: e.clientX,
1905
+ y: e.clientY
1906
+ }) && (t.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
1942
1907
  passive: !0
1943
1908
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
1944
1909
  passive: !0
@@ -1946,46 +1911,46 @@ class O {
1946
1911
  passive: !0
1947
1912
  }));
1948
1913
  });
1949
- o(this, "onWindowTouchMove", (e) => {
1950
- const t = e.touches[0];
1951
- if (!C(
1914
+ o(this, "onWindowTouchMove", (t) => {
1915
+ const e = t.touches[0];
1916
+ if (!R(
1952
1917
  this.window,
1953
1918
  this.element,
1954
- t.clientX,
1955
- t.clientY
1919
+ e.clientX,
1920
+ e.clientY
1956
1921
  )) {
1957
1922
  this.stopTouchDrag();
1958
1923
  return;
1959
1924
  }
1960
- this.params.onPointerMove({ x: t.clientX, y: t.clientY });
1925
+ this.params.onPointerMove({ x: e.clientX, y: e.clientY });
1961
1926
  });
1962
- o(this, "onWindowTouchFinish", (e) => {
1963
- const t = e.changedTouches[0];
1964
- this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
1927
+ o(this, "onWindowTouchFinish", (t) => {
1928
+ const e = t.changedTouches[0];
1929
+ this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopTouchDrag();
1965
1930
  });
1966
1931
  o(this, "onBeforeClear", () => {
1967
- this.canvas.graph.getAllPortIds().forEach((e) => {
1968
- const t = this.canvas.graph.getPort(e);
1969
- this.unhookPortEvents(t.element);
1932
+ this.canvas.graph.getAllPortIds().forEach((t) => {
1933
+ const e = this.canvas.graph.getPort(t);
1934
+ this.unhookPortEvents(e.element);
1970
1935
  });
1971
1936
  });
1972
1937
  o(this, "onBeforeDestroy", () => {
1973
1938
  this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
1974
1939
  });
1975
- this.canvas = e, this.element = t, this.window = s, this.params = i, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1940
+ this.canvas = t, this.element = e, this.window = s, this.params = i, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
1976
1941
  }
1977
- static configure(e, t, s, i) {
1978
- new O(e, t, s, i);
1942
+ static configure(t, e, s, i) {
1943
+ new O(t, e, s, i);
1979
1944
  }
1980
- hookPortEvents(e) {
1981
- e.addEventListener("mousedown", this.onPortMouseDown, {
1945
+ hookPortEvents(t) {
1946
+ t.addEventListener("mousedown", this.onPortMouseDown, {
1982
1947
  passive: !0
1983
- }), e.addEventListener("touchstart", this.onPortTouchStart, {
1948
+ }), t.addEventListener("touchstart", this.onPortTouchStart, {
1984
1949
  passive: !0
1985
1950
  });
1986
1951
  }
1987
- unhookPortEvents(e) {
1988
- e.removeEventListener("mousedown", this.onPortMouseDown), e.removeEventListener("touchstart", this.onPortTouchStart);
1952
+ unhookPortEvents(t) {
1953
+ t.removeEventListener("mousedown", this.onPortMouseDown), t.removeEventListener("touchstart", this.onPortTouchStart);
1989
1954
  }
1990
1955
  stopMouseDrag() {
1991
1956
  this.params.onStopDrag(), this.removeWindowMouseListeners();
@@ -2001,50 +1966,45 @@ class O {
2001
1966
  }
2002
1967
  }
2003
1968
  class Z {
2004
- constructor(e, t, s, i) {
1969
+ constructor(t, e, s, i) {
2005
1970
  o(this, "grabbedNode", null);
2006
1971
  o(this, "maxNodePriority", 0);
2007
1972
  o(this, "graph");
2008
- o(this, "onAfterNodeAdded", (e) => {
2009
- this.updateMaxNodePriority(e);
2010
- const t = this.graph.getNode(e);
2011
- t.element.addEventListener("mousedown", this.onMouseDown, {
1973
+ o(this, "onAfterNodeAdded", (t) => {
1974
+ this.updateMaxNodePriority(t);
1975
+ const e = this.graph.getNode(t);
1976
+ e.element.addEventListener("mousedown", this.onMouseDown, {
2012
1977
  passive: !0
2013
- }), t.element.addEventListener("touchstart", this.onTouchStart, {
1978
+ }), e.element.addEventListener("touchstart", this.onTouchStart, {
2014
1979
  passive: !0
2015
1980
  });
2016
1981
  });
2017
- o(this, "onAfterNodeUpdated", (e) => {
2018
- this.updateMaxNodePriority(e);
1982
+ o(this, "onAfterNodeUpdated", (t) => {
1983
+ this.updateMaxNodePriority(t);
2019
1984
  });
2020
- o(this, "onBeforeNodeRemoved", (e) => {
2021
- const t = this.graph.getNode(e);
2022
- t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
1985
+ o(this, "onBeforeNodeRemoved", (t) => {
1986
+ const e = this.graph.getNode(t);
1987
+ e.element.removeEventListener("mousedown", this.onMouseDown), e.element.removeEventListener("touchstart", this.onTouchStart);
2023
1988
  });
2024
1989
  o(this, "onBeforeDestroy", () => {
2025
1990
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2026
1991
  });
2027
1992
  o(this, "onBeforeClear", () => {
2028
- this.canvas.graph.getAllNodeIds().forEach((e) => {
2029
- const t = this.canvas.graph.getNode(e);
2030
- t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
1993
+ this.canvas.graph.getAllNodeIds().forEach((t) => {
1994
+ const e = this.canvas.graph.getNode(t);
1995
+ e.element.removeEventListener("mousedown", this.onMouseDown), e.element.removeEventListener("touchstart", this.onTouchStart);
2031
1996
  }), this.maxNodePriority = 0;
2032
1997
  });
2033
- o(this, "onMouseDown", (e) => {
2034
- if (!this.params.mouseDownEventVerifier(e))
1998
+ o(this, "onMouseDown", (t) => {
1999
+ if (!this.params.mouseDownEventVerifier(t))
2035
2000
  return;
2036
- const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
2037
- if (!this.params.nodeDragVerifier({
2038
- nodeId: s,
2039
- element: i.element,
2040
- x: i.x,
2041
- y: i.y
2042
- }))
2001
+ const e = t.currentTarget, s = this.graph.getElementNodeId(e), i = this.graph.getNode(s);
2002
+ if (!this.params.nodeDragVerifier(s))
2043
2003
  return;
2044
- e.stopPropagation();
2004
+ t.stopPropagation();
2045
2005
  const a = this.calculateContentPoint({
2046
- x: e.clientX,
2047
- y: e.clientY
2006
+ x: t.clientX,
2007
+ y: t.clientY
2048
2008
  });
2049
2009
  this.grabbedNode = {
2050
2010
  nodeId: s,
@@ -2056,11 +2016,11 @@ class Z {
2056
2016
  passive: !0
2057
2017
  });
2058
2018
  });
2059
- o(this, "onTouchStart", (e) => {
2060
- if (e.touches.length !== 1)
2019
+ o(this, "onTouchStart", (t) => {
2020
+ if (t.touches.length !== 1)
2061
2021
  return;
2062
- e.stopPropagation();
2063
- const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
2022
+ t.stopPropagation();
2023
+ const e = t.touches[0], s = t.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
2064
2024
  if (!this.params.nodeDragVerifier({
2065
2025
  nodeId: i,
2066
2026
  element: n.element,
@@ -2069,8 +2029,8 @@ class Z {
2069
2029
  }))
2070
2030
  return;
2071
2031
  const h = this.calculateContentPoint({
2072
- x: t.clientX,
2073
- y: t.clientY
2032
+ x: e.clientX,
2033
+ y: e.clientY
2074
2034
  });
2075
2035
  this.grabbedNode = {
2076
2036
  nodeId: i,
@@ -2084,102 +2044,87 @@ class Z {
2084
2044
  passive: !0
2085
2045
  });
2086
2046
  });
2087
- o(this, "onWindowMouseMove", (e) => {
2088
- if (!C(
2047
+ o(this, "onWindowMouseMove", (t) => {
2048
+ if (!R(
2089
2049
  this.window,
2090
2050
  this.element,
2091
- e.clientX,
2092
- e.clientY
2051
+ t.clientX,
2052
+ t.clientY
2093
2053
  )) {
2094
2054
  this.cancelMouseDrag();
2095
2055
  return;
2096
2056
  }
2097
2057
  this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
2098
- x: e.clientX,
2099
- y: e.clientY
2058
+ x: t.clientX,
2059
+ y: t.clientY
2100
2060
  });
2101
2061
  });
2102
- o(this, "onWindowMouseUp", (e) => {
2103
- this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
2062
+ o(this, "onWindowMouseUp", (t) => {
2063
+ this.params.mouseUpEventVerifier(t) && this.cancelMouseDrag();
2104
2064
  });
2105
- o(this, "onWindowTouchMove", (e) => {
2106
- if (e.touches.length !== 1)
2065
+ o(this, "onWindowTouchMove", (t) => {
2066
+ if (t.touches.length !== 1)
2107
2067
  return;
2108
- const t = e.touches[0];
2109
- if (!C(
2068
+ const e = t.touches[0];
2069
+ if (!R(
2110
2070
  this.window,
2111
2071
  this.element,
2112
- t.clientX,
2113
- t.clientY
2072
+ e.clientX,
2073
+ e.clientY
2114
2074
  )) {
2115
2075
  this.cancelTouchDrag();
2116
2076
  return;
2117
2077
  }
2118
2078
  this.grabbedNode !== null && this.moveNode(this.grabbedNode, {
2119
- x: t.clientX,
2120
- y: t.clientY
2079
+ x: e.clientX,
2080
+ y: e.clientY
2121
2081
  });
2122
2082
  });
2123
2083
  o(this, "onWindowTouchFinish", () => {
2124
2084
  this.cancelTouchDrag();
2125
2085
  });
2126
- this.canvas = e, this.element = t, this.window = s, this.params = i, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2086
+ this.canvas = t, this.element = e, this.window = s, this.params = i, this.graph = t.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);
2127
2087
  }
2128
- static configure(e, t, s, i) {
2129
- new Z(e, t, s, i);
2088
+ static configure(t, e, s, i) {
2089
+ new Z(t, e, s, i);
2130
2090
  }
2131
- moveNode(e, t) {
2132
- const s = this.graph.getNode(e.nodeId);
2133
- if (s === null)
2091
+ moveNode(t, e) {
2092
+ if (this.graph.getNode(t.nodeId) === null)
2134
2093
  return;
2135
- const i = this.calculateContentPoint(t), n = {
2136
- x: i.x - e.dx,
2137
- y: i.y - e.dy
2094
+ const i = this.calculateContentPoint(e), n = {
2095
+ x: i.x - t.dx,
2096
+ y: i.y - t.dy
2138
2097
  }, a = this.adjustNodeCoords(n);
2139
- this.canvas.updateNode(e.nodeId, {
2098
+ this.canvas.updateNode(t.nodeId, {
2140
2099
  x: a.x,
2141
2100
  y: a.y
2142
- }), this.params.onNodeDrag({
2143
- nodeId: e.nodeId,
2144
- element: s.element,
2145
- x: a.x,
2146
- y: a.y
2147
- });
2101
+ }), this.params.onNodeDrag(t.nodeId);
2148
2102
  }
2149
- moveNodeOnTop(e) {
2103
+ moveNodeOnTop(t) {
2150
2104
  if (this.params.moveOnTop) {
2151
2105
  if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
2152
- const t = this.maxNodePriority;
2153
- this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((i) => {
2154
- this.canvas.updateEdge(i, { priority: t });
2106
+ const e = this.maxNodePriority;
2107
+ this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(t).forEach((i) => {
2108
+ this.canvas.updateEdge(i, { priority: e });
2155
2109
  });
2156
2110
  }
2157
- this.canvas.updateNode(e, { priority: this.maxNodePriority });
2111
+ this.canvas.updateNode(t, { priority: this.maxNodePriority });
2158
2112
  }
2159
2113
  }
2160
2114
  cancelMouseDrag() {
2161
- if (this.grabbedNode !== null) {
2162
- const e = this.graph.getNode(this.grabbedNode.nodeId);
2163
- e !== null && this.params.onNodeDragFinished({
2164
- nodeId: this.grabbedNode.nodeId,
2165
- element: e.element,
2166
- x: e.x,
2167
- y: e.y
2168
- });
2169
- }
2170
- this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
2115
+ this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
2171
2116
  }
2172
2117
  removeMouseDragListeners() {
2173
2118
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
2174
2119
  }
2175
2120
  cancelTouchDrag() {
2176
2121
  if (this.grabbedNode !== null) {
2177
- const e = this.graph.getNode(this.grabbedNode.nodeId);
2178
- e !== null && this.params.onNodeDragFinished({
2122
+ const t = this.graph.getNode(this.grabbedNode.nodeId);
2123
+ t !== null && this.params.onNodeDragFinished({
2179
2124
  nodeId: this.grabbedNode.nodeId,
2180
- element: e.element,
2181
- x: e.x,
2182
- y: e.y
2125
+ element: t.element,
2126
+ x: t.x,
2127
+ y: t.y
2183
2128
  });
2184
2129
  }
2185
2130
  this.grabbedNode = null, this.removeTouchDragListeners();
@@ -2187,58 +2132,58 @@ class Z {
2187
2132
  removeTouchDragListeners() {
2188
2133
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2189
2134
  }
2190
- updateMaxNodePriority(e) {
2191
- const t = this.graph.getNode(e).priority;
2192
- this.maxNodePriority = Math.max(this.maxNodePriority, t);
2135
+ updateMaxNodePriority(t) {
2136
+ const e = this.graph.getNode(t).priority;
2137
+ this.maxNodePriority = Math.max(this.maxNodePriority, e);
2193
2138
  }
2194
- calculateContentPoint(e) {
2195
- const t = this.element.getBoundingClientRect(), s = {
2196
- x: e.x - t.x,
2197
- y: e.y - t.y
2139
+ calculateContentPoint(t) {
2140
+ const e = this.element.getBoundingClientRect(), s = {
2141
+ x: t.x - e.x,
2142
+ y: t.y - e.y
2198
2143
  }, i = this.canvas.viewport.getViewportMatrix();
2199
- return D(i, s);
2144
+ return T(i, s);
2200
2145
  }
2201
- adjustNodeCoords(e) {
2202
- const t = this.params.gridSize;
2203
- if (t !== null) {
2204
- const s = t / 2;
2146
+ adjustNodeCoords(t) {
2147
+ const e = this.params.gridSize;
2148
+ if (e !== null) {
2149
+ const s = e / 2;
2205
2150
  return {
2206
- x: Math.floor((e.x + s) / t) * t,
2207
- y: Math.floor((e.y + s) / t) * t
2151
+ x: Math.floor((t.x + s) / e) * e,
2152
+ y: Math.floor((t.y + s) / e) * e
2208
2153
  };
2209
2154
  }
2210
- return e;
2155
+ return t;
2211
2156
  }
2212
2157
  }
2213
- const it = (r, e, t) => ({
2158
+ const ie = (r, t, e) => ({
2214
2159
  scale: r.scale,
2215
- x: r.x + r.scale * e,
2216
- y: r.y + r.scale * t
2217
- }), nt = (r, e, t, s) => ({
2218
- scale: r.scale * e,
2219
- x: r.scale * (1 - e) * t + r.x,
2220
- y: r.scale * (1 - e) * s + r.y
2160
+ x: r.x + r.scale * t,
2161
+ y: r.y + r.scale * e
2162
+ }), ne = (r, t, e, s) => ({
2163
+ scale: r.scale * t,
2164
+ x: r.scale * (1 - t) * e + r.x,
2165
+ y: r.scale * (1 - t) * s + r.y
2221
2166
  }), I = (r) => {
2222
- const e = [], t = r.touches.length;
2223
- for (let h = 0; h < t; h++)
2224
- e.push([r.touches[h].clientX, r.touches[h].clientY]);
2225
- const s = e.reduce(
2167
+ const t = [], e = r.touches.length;
2168
+ for (let h = 0; h < e; h++)
2169
+ t.push([r.touches[h].clientX, r.touches[h].clientY]);
2170
+ const s = t.reduce(
2226
2171
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2227
2172
  [0, 0]
2228
- ), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2173
+ ), i = [s[0] / e, s[1] / e], a = t.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
2229
2174
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2230
2175
  0
2231
2176
  );
2232
2177
  return {
2233
2178
  x: i[0],
2234
2179
  y: i[1],
2235
- scale: a / t,
2236
- touchesCnt: t,
2237
- touches: e
2180
+ scale: a / e,
2181
+ touchesCnt: e,
2182
+ touches: t
2238
2183
  };
2239
2184
  };
2240
2185
  class k {
2241
- constructor(e, t, s, i) {
2186
+ constructor(t, e, s, i) {
2242
2187
  o(this, "viewport");
2243
2188
  o(this, "prevTouches", null);
2244
2189
  o(this, "wheelFinishTimer", null);
@@ -2246,44 +2191,44 @@ class k {
2246
2191
  o(this, "onBeforeDestroy", () => {
2247
2192
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2248
2193
  });
2249
- o(this, "onMouseDown", (e) => {
2250
- this.element === null || !this.params.mouseDownEventVerifier(e) || (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2194
+ o(this, "onMouseDown", (t) => {
2195
+ this.element === null || !this.params.mouseDownEventVerifier(t) || (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2251
2196
  passive: !0
2252
2197
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
2253
2198
  passive: !0
2254
2199
  }), this.startRegisteredTransform());
2255
2200
  });
2256
- o(this, "onWindowMouseMove", (e) => {
2257
- const t = C(
2201
+ o(this, "onWindowMouseMove", (t) => {
2202
+ const e = R(
2258
2203
  this.window,
2259
2204
  this.element,
2260
- e.clientX,
2261
- e.clientY
2205
+ t.clientX,
2206
+ t.clientY
2262
2207
  );
2263
- if (this.element === null || !t) {
2208
+ if (this.element === null || !e) {
2264
2209
  this.stopMouseDrag();
2265
2210
  return;
2266
2211
  }
2267
- const s = -e.movementX, i = -e.movementY;
2212
+ const s = -t.movementX, i = -t.movementY;
2268
2213
  this.moveViewport(s, i);
2269
2214
  });
2270
- o(this, "onWindowMouseUp", (e) => {
2271
- this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
2215
+ o(this, "onWindowMouseUp", (t) => {
2216
+ this.element === null || !this.params.mouseUpEventVerifier(t) || this.stopMouseDrag();
2272
2217
  });
2273
- o(this, "onWheelScroll", (e) => {
2274
- if (!this.params.mouseWheelEventVerifier(e))
2218
+ o(this, "onWheelScroll", (t) => {
2219
+ if (!this.params.mouseWheelEventVerifier(t))
2275
2220
  return;
2276
- const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2221
+ const { left: e, top: s } = this.element.getBoundingClientRect(), i = t.clientX - e, n = t.clientY - s, h = 1 / (t.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2277
2222
  this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2278
2223
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2279
2224
  }, this.params.scaleWheelFinishTimeout);
2280
2225
  });
2281
- o(this, "onTouchStart", (e) => {
2226
+ o(this, "onTouchStart", (t) => {
2282
2227
  if (this.prevTouches !== null) {
2283
- this.prevTouches = I(e);
2228
+ this.prevTouches = I(t);
2284
2229
  return;
2285
2230
  }
2286
- this.prevTouches = I(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2231
+ this.prevTouches = I(t), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2287
2232
  passive: !0
2288
2233
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2289
2234
  passive: !0
@@ -2291,53 +2236,53 @@ class k {
2291
2236
  passive: !0
2292
2237
  }), this.startRegisteredTransform();
2293
2238
  });
2294
- o(this, "onWindowTouchMove", (e) => {
2295
- const t = I(e);
2296
- if (!t.touches.every(
2297
- (i) => C(this.window, this.element, i[0], i[1])
2239
+ o(this, "onWindowTouchMove", (t) => {
2240
+ const e = I(t);
2241
+ if (!e.touches.every(
2242
+ (i) => R(this.window, this.element, i[0], i[1])
2298
2243
  )) {
2299
2244
  this.stopTouchDrag();
2300
2245
  return;
2301
2246
  }
2302
- if ((t.touchesCnt === 1 || t.touchesCnt === 2) && this.moveViewport(
2303
- -(t.x - this.prevTouches.x),
2304
- -(t.y - this.prevTouches.y)
2305
- ), t.touchesCnt === 2) {
2306
- const { left: i, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - i, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2247
+ if ((e.touchesCnt === 1 || e.touchesCnt === 2) && this.moveViewport(
2248
+ -(e.x - this.prevTouches.x),
2249
+ -(e.y - this.prevTouches.y)
2250
+ ), e.touchesCnt === 2) {
2251
+ const { left: i, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - i, h = this.prevTouches.y - n, c = 1 / (e.scale / this.prevTouches.scale);
2307
2252
  this.scaleViewport(c, a, h);
2308
2253
  }
2309
- this.prevTouches = t;
2254
+ this.prevTouches = e;
2310
2255
  });
2311
- o(this, "onWindowTouchFinish", (e) => {
2312
- e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
2256
+ o(this, "onWindowTouchFinish", (t) => {
2257
+ t.touches.length > 0 ? this.prevTouches = I(t) : this.stopTouchDrag();
2313
2258
  });
2314
2259
  o(this, "observer", new ResizeObserver(() => {
2315
- const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
2316
- prevTransform: e,
2317
- nextTransform: e,
2318
- canvasWidth: t,
2260
+ const t = this.viewport.getViewportMatrix(), { width: e, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
2261
+ prevTransform: t,
2262
+ nextTransform: t,
2263
+ canvasWidth: e,
2319
2264
  canvasHeight: s
2320
2265
  });
2321
2266
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
2322
2267
  }));
2323
- o(this, "preventWheelScaleListener", (e) => {
2324
- e.preventDefault();
2268
+ o(this, "preventWheelScaleListener", (t) => {
2269
+ t.preventDefault();
2325
2270
  });
2326
- this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2271
+ this.canvas = t, this.element = e, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
2327
2272
  passive: !1
2328
- }), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
2273
+ }), this.viewport = t.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
2329
2274
  passive: !0
2330
2275
  }), this.element.addEventListener("wheel", this.onWheelScroll, {
2331
2276
  passive: !0
2332
2277
  }), this.element.addEventListener("touchstart", this.onTouchStart, {
2333
2278
  passive: !0
2334
- }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2279
+ }), t.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2335
2280
  }
2336
- static configure(e, t, s, i) {
2337
- new k(e, t, s, i);
2281
+ static configure(t, e, s, i) {
2282
+ new k(t, e, s, i);
2338
2283
  }
2339
- moveViewport(e, t) {
2340
- const s = this.viewport.getViewportMatrix(), i = it(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2284
+ moveViewport(t, e) {
2285
+ const s = this.viewport.getViewportMatrix(), i = ie(s, t, e), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
2341
2286
  prevTransform: s,
2342
2287
  nextTransform: i,
2343
2288
  canvasWidth: n,
@@ -2345,8 +2290,8 @@ class k {
2345
2290
  });
2346
2291
  this.performTransform(h);
2347
2292
  }
2348
- scaleViewport(e, t, s) {
2349
- const i = this.canvas.viewport.getViewportMatrix(), n = nt(i, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
2293
+ scaleViewport(t, e, s) {
2294
+ const i = this.canvas.viewport.getViewportMatrix(), n = ne(i, t, e, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
2350
2295
  prevTransform: i,
2351
2296
  nextTransform: n,
2352
2297
  canvasWidth: a,
@@ -2366,8 +2311,8 @@ class k {
2366
2311
  removeTouchDragListeners() {
2367
2312
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2368
2313
  }
2369
- performTransform(e) {
2370
- this.params.onBeforeTransformChange(), this.canvas.patchViewportMatrix(e), this.params.onTransformChange();
2314
+ performTransform(t) {
2315
+ this.params.onBeforeTransformChange(), this.canvas.patchViewportMatrix(t), this.params.onTransformChange();
2371
2316
  }
2372
2317
  startRegisteredTransform() {
2373
2318
  this.transformInProgress = !0, this.params.onTransformStarted();
@@ -2377,7 +2322,7 @@ class k {
2377
2322
  }
2378
2323
  }
2379
2324
  class J {
2380
- constructor(e, t, s, i, n, a) {
2325
+ constructor(t, e, s, i, n, a) {
2381
2326
  o(this, "canvasResizeObserver");
2382
2327
  o(this, "nodeHorizontal");
2383
2328
  o(this, "nodeVertical");
@@ -2391,22 +2336,22 @@ class J {
2391
2336
  yFrom: 1 / 0,
2392
2337
  yTo: 1 / 0
2393
2338
  });
2394
- o(this, "updateLoadedArea", (e) => {
2339
+ o(this, "updateLoadedArea", (t) => {
2395
2340
  this.loadedArea = {
2396
- xFrom: e.x,
2397
- xTo: e.x + e.width,
2398
- yFrom: e.y,
2399
- yTo: e.y + e.height
2341
+ xFrom: t.x,
2342
+ xTo: t.x + t.width,
2343
+ yFrom: t.y,
2344
+ yTo: t.y + t.height
2400
2345
  };
2401
2346
  });
2402
2347
  o(this, "onAfterViewportUpdated", () => {
2403
2348
  this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
2404
2349
  });
2405
2350
  o(this, "userTransformInProgress", !1);
2406
- this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.canvasResizeObserver = new ResizeObserver((d) => {
2351
+ this.canvas = t, this.element = e, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.canvasResizeObserver = new ResizeObserver((d) => {
2407
2352
  const c = d[0];
2408
2353
  this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
2409
- }), this.viewport = e.viewport;
2354
+ }), this.viewport = t.viewport;
2410
2355
  const h = {
2411
2356
  ...i,
2412
2357
  onResizeTransformStarted: () => {
@@ -2428,16 +2373,16 @@ class J {
2428
2373
  }
2429
2374
  };
2430
2375
  k.configure(
2431
- e,
2376
+ t,
2432
2377
  this.element,
2433
2378
  this.window,
2434
2379
  h
2435
2380
  ), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2436
2381
  }
2437
- static configure(e, t, s, i, n, a) {
2382
+ static configure(t, e, s, i, n, a) {
2438
2383
  new J(
2439
- e,
2440
2384
  t,
2385
+ e,
2441
2386
  s,
2442
2387
  i,
2443
2388
  n,
@@ -2450,21 +2395,21 @@ class J {
2450
2395
  });
2451
2396
  }
2452
2397
  scheduleEnsureViewportAreaLoaded() {
2453
- const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, a = this.viewportMatrix.y + t + this.nodeVertical;
2398
+ const t = this.viewportWidth * this.viewportMatrix.scale, e = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + t + this.nodeHorizontal, a = this.viewportMatrix.y + e + this.nodeVertical;
2454
2399
  this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
2455
2400
  }
2456
2401
  loadAreaAroundViewport() {
2457
- const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, i = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, a = 3 * t + 2 * this.nodeVertical;
2402
+ const t = this.viewportWidth * this.viewportMatrix.scale, e = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - t - this.nodeHorizontal, i = this.viewportMatrix.y - e - this.nodeVertical, n = 3 * t + 2 * this.nodeHorizontal, a = 3 * e + 2 * this.nodeVertical;
2458
2403
  this.trigger.emit({ x: s, y: i, width: n, height: a });
2459
2404
  }
2460
2405
  }
2461
- const at = () => {
2406
+ const ae = () => {
2462
2407
  const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2463
2408
  return r.style.position = "absolute", r.style.inset = "0", r;
2464
- }, ht = () => {
2409
+ }, he = () => {
2465
2410
  const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2466
2411
  return r.setAttribute("fill", "url(#pattern)"), r;
2467
- }, dt = () => {
2412
+ }, de = () => {
2468
2413
  const r = document.createElementNS(
2469
2414
  "http://www.w3.org/2000/svg",
2470
2415
  "pattern"
@@ -2472,10 +2417,10 @@ const at = () => {
2472
2417
  return r.setAttribute("id", "pattern"), r;
2473
2418
  };
2474
2419
  class Q {
2475
- constructor(e, t, s) {
2476
- o(this, "svg", at());
2477
- o(this, "patternRenderingRectangle", ht());
2478
- o(this, "pattern", dt());
2420
+ constructor(t, e, s) {
2421
+ o(this, "svg", ae());
2422
+ o(this, "patternRenderingRectangle", he());
2423
+ o(this, "pattern", de());
2479
2424
  o(this, "patternContent");
2480
2425
  o(this, "tileWidth");
2481
2426
  o(this, "tileHeight");
@@ -2483,39 +2428,39 @@ class Q {
2483
2428
  o(this, "halfTileHeight");
2484
2429
  o(this, "maxViewportScale");
2485
2430
  o(this, "visible", !1);
2486
- o(this, "resizeObserver", new ResizeObserver((e) => {
2487
- const t = e[0], { width: s, height: i } = t.contentRect;
2431
+ o(this, "resizeObserver", new ResizeObserver((t) => {
2432
+ const e = t[0], { width: s, height: i } = e.contentRect;
2488
2433
  this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
2489
2434
  const n = this.tileWidth / s, a = this.tileHeight / i;
2490
2435
  this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
2491
2436
  }));
2492
2437
  o(this, "onAfterTransformUpdated", () => {
2493
- 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})`;
2438
+ const t = this.canvas.viewport.getContentMatrix(), e = t.x - this.halfTileWidth * t.scale, s = t.y - this.halfTileHeight * t.scale, i = `matrix(${t.scale}, 0, 0, ${t.scale}, ${e}, ${s})`;
2494
2439
  this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
2495
2440
  });
2496
- this.canvas = e, this.backgroundHost = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
2441
+ this.canvas = t, this.backgroundHost = s, this.tileWidth = e.tileWidth, this.tileHeight = e.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = e.renderer, this.maxViewportScale = e.maxViewportScale;
2497
2442
  const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2498
2443
  this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
2499
2444
  const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2500
2445
  n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.backgroundHost), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2501
2446
  }
2502
- static configure(e, t, s) {
2503
- new Q(e, t, s);
2447
+ static configure(t, e, s) {
2448
+ new Q(t, e, s);
2504
2449
  }
2505
2450
  updateVisibility() {
2506
- const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
2507
- t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
2451
+ const e = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
2452
+ e && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !e && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
2508
2453
  }
2509
2454
  }
2510
2455
  class _ {
2511
- constructor(e, t, s, i, n) {
2456
+ constructor(t, e, s, i, n) {
2512
2457
  o(this, "overlayCanvas");
2513
2458
  o(this, "staticPortId", null);
2514
2459
  o(this, "isTargetDragging", !0);
2515
- o(this, "onEdgeCreated", (e) => {
2516
- this.params.onAfterEdgeCreated(e);
2460
+ o(this, "onEdgeCreated", (t) => {
2461
+ this.params.onAfterEdgeCreated(t);
2517
2462
  });
2518
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = De(
2463
+ this.canvas = t, this.overlayLayer = e, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Dt(
2519
2464
  this.overlayLayer,
2520
2465
  this.viewportStore
2521
2466
  ), O.configure(
@@ -2541,24 +2486,24 @@ class _ {
2541
2486
  }
2542
2487
  );
2543
2488
  }
2544
- static configure(e, t, s, i, n) {
2489
+ static configure(t, e, s, i, n) {
2545
2490
  new _(
2546
- e,
2547
2491
  t,
2492
+ e,
2548
2493
  s,
2549
2494
  i,
2550
2495
  n
2551
2496
  );
2552
2497
  }
2553
- grabPort(e, t, s) {
2554
- const i = this.canvas.graph.getPort(e);
2555
- this.staticPortId = e;
2556
- const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), l = D(c, {
2498
+ grabPort(t, e, s) {
2499
+ const i = this.canvas.graph.getPort(t);
2500
+ this.staticPortId = t;
2501
+ const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), l = T(c, {
2557
2502
  x: a - d.x,
2558
2503
  y: h - d.y
2559
- }), g = D(c, {
2560
- x: t.x - d.x,
2561
- y: t.y - d.y
2504
+ }), g = T(c, {
2505
+ x: e.x - d.x,
2506
+ y: e.y - d.y
2562
2507
  }), w = {
2563
2508
  overlayId: P.Static,
2564
2509
  portCoords: l,
@@ -2569,9 +2514,9 @@ class _ {
2569
2514
  portDirection: this.params.dragPortDirection
2570
2515
  };
2571
2516
  this.isTargetDragging = s === "direct";
2572
- const [y, v] = this.isTargetDragging ? [w, f] : [f, w];
2573
- this.overlayCanvas.addNode(W(y)), this.overlayCanvas.addNode(W(v)), this.overlayCanvas.addEdge({
2574
- from: y.overlayId,
2517
+ const [m, v] = this.isTargetDragging ? [w, f] : [f, w];
2518
+ this.overlayCanvas.addNode(W(m)), this.overlayCanvas.addNode(W(v)), this.overlayCanvas.addEdge({
2519
+ from: m.overlayId,
2575
2520
  to: v.overlayId,
2576
2521
  shape: this.params.edgeShapeFactory(P.Edge)
2577
2522
  });
@@ -2579,23 +2524,23 @@ class _ {
2579
2524
  resetDragState() {
2580
2525
  this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2581
2526
  }
2582
- tryCreateConnection(e) {
2583
- const t = ye(this.canvas.graph, e);
2584
- if (t === null) {
2585
- this.params.onEdgeCreationInterrupted(
2586
- this.staticPortId,
2587
- this.isTargetDragging
2588
- );
2527
+ tryCreateConnection(t) {
2528
+ const e = mt(this.canvas.graph, t), s = this.staticPortId;
2529
+ if (e === null) {
2530
+ this.params.onEdgeCreationInterrupted({
2531
+ staticPortId: s,
2532
+ isDirect: this.isTargetDragging
2533
+ });
2589
2534
  return;
2590
2535
  }
2591
- const s = this.isTargetDragging ? this.staticPortId : t, i = this.isTargetDragging ? t : this.staticPortId, n = { from: s, to: i }, a = this.params.connectionPreprocessor(n);
2592
- a !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(a), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(n);
2593
- }
2594
- moveDraggingPort(e) {
2595
- const t = this.overlayLayer.getBoundingClientRect(), s = {
2596
- x: e.x - t.x,
2597
- y: e.y - t.y
2598
- }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
2536
+ const i = this.isTargetDragging ? s : e, n = this.isTargetDragging ? e : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
2537
+ h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
2538
+ }
2539
+ moveDraggingPort(t) {
2540
+ const e = this.overlayLayer.getBoundingClientRect(), s = {
2541
+ x: t.x - e.x,
2542
+ y: t.y - e.y
2543
+ }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, s);
2599
2544
  this.overlayCanvas.updateNode(P.Dragging, {
2600
2545
  x: n.x,
2601
2546
  y: n.y
@@ -2603,15 +2548,15 @@ class _ {
2603
2548
  }
2604
2549
  }
2605
2550
  class q {
2606
- constructor(e, t, s, i, n) {
2551
+ constructor(t, e, s, i, n) {
2607
2552
  o(this, "overlayCanvas");
2608
2553
  o(this, "staticPortId", null);
2609
2554
  o(this, "isTargetDragging", !0);
2610
2555
  o(this, "draggingEdgePayload", null);
2611
- o(this, "onEdgeReattached", (e) => {
2612
- this.params.onAfterEdgeReattached(e);
2556
+ o(this, "onEdgeReattached", (t) => {
2557
+ this.params.onAfterEdgeReattached(t);
2613
2558
  });
2614
- this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = De(
2559
+ this.canvas = t, this.overlayLayer = e, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Dt(
2615
2560
  this.overlayLayer,
2616
2561
  this.viewportStore
2617
2562
  ), O.configure(
@@ -2634,33 +2579,33 @@ class q {
2634
2579
  }
2635
2580
  );
2636
2581
  }
2637
- static configure(e, t, s, i, n) {
2582
+ static configure(t, e, s, i, n) {
2638
2583
  new q(
2639
- e,
2640
2584
  t,
2585
+ e,
2641
2586
  s,
2642
2587
  i,
2643
2588
  n
2644
2589
  );
2645
2590
  }
2646
- tryStartEdgeDragging(e, t) {
2647
- const s = this.params.draggingEdgeResolver(e);
2591
+ tryStartEdgeDragging(t, e) {
2592
+ const s = this.params.draggingEdgeResolver(t);
2648
2593
  if (s === null)
2649
2594
  return !1;
2650
2595
  const i = this.canvas.graph.getEdge(s);
2651
2596
  if (i === null)
2652
2597
  return !1;
2653
- const n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
2598
+ const n = t === i.from, a = t === i.to, h = n ? i.to : i.from;
2654
2599
  this.staticPortId = h, this.isTargetDragging = a;
2655
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), g = {
2600
+ const d = this.canvas.graph.getPort(t), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), g = {
2656
2601
  x: l.x + l.width / 2,
2657
2602
  y: l.y + l.height / 2
2658
- }, w = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), y = D(w, {
2603
+ }, w = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), m = T(w, {
2659
2604
  x: g.x - f.x,
2660
2605
  y: g.y - f.y
2661
- }), v = D(w, {
2662
- x: t.x - f.x,
2663
- y: t.y - f.y
2606
+ }), v = T(w, {
2607
+ x: e.x - f.x,
2608
+ y: e.y - f.y
2664
2609
  });
2665
2610
  this.draggingEdgePayload = {
2666
2611
  id: s,
@@ -2671,38 +2616,38 @@ class q {
2671
2616
  }, this.canvas.removeEdge(s);
2672
2617
  const E = {
2673
2618
  overlayId: P.Static,
2674
- portCoords: y,
2619
+ portCoords: m,
2675
2620
  portDirection: c.direction
2676
2621
  }, x = {
2677
2622
  overlayId: P.Dragging,
2678
2623
  portCoords: v,
2679
2624
  portDirection: d.direction
2680
- }, [b, T] = this.isTargetDragging ? [E, x] : [x, E];
2681
- this.overlayCanvas.addNode(W(b)), this.overlayCanvas.addNode(W(T));
2682
- const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(P.Edge) : i.shape;
2625
+ }, [L, b] = this.isTargetDragging ? [E, x] : [x, E];
2626
+ this.overlayCanvas.addNode(W(L)), this.overlayCanvas.addNode(W(b));
2627
+ const D = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(P.Edge) : i.shape;
2683
2628
  return this.overlayCanvas.addEdge({
2684
2629
  id: P.Edge,
2685
- from: b.overlayId,
2686
- to: T.overlayId,
2687
- shape: N
2630
+ from: L.overlayId,
2631
+ to: b.overlayId,
2632
+ shape: D
2688
2633
  }), !0;
2689
2634
  }
2690
2635
  resetDragState() {
2691
2636
  this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
2692
2637
  }
2693
- moveDraggingPort(e) {
2694
- const t = this.overlayLayer.getBoundingClientRect(), s = {
2695
- x: e.x - t.x,
2696
- y: e.y - t.y
2697
- }, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
2638
+ moveDraggingPort(t) {
2639
+ const e = this.overlayLayer.getBoundingClientRect(), s = {
2640
+ x: t.x - e.x,
2641
+ y: t.y - e.y
2642
+ }, i = this.canvas.viewport.getViewportMatrix(), n = T(i, s);
2698
2643
  this.overlayCanvas.updateNode(P.Dragging, {
2699
2644
  x: n.x,
2700
2645
  y: n.y
2701
2646
  });
2702
2647
  }
2703
- tryCreateConnection(e) {
2704
- const t = ye(this.canvas.graph, e);
2705
- if (this.overlayCanvas.removeEdge(P.Edge), t === null) {
2648
+ tryCreateConnection(t) {
2649
+ const e = mt(this.canvas.graph, t);
2650
+ if (this.overlayCanvas.removeEdge(P.Edge), e === null) {
2706
2651
  const d = this.draggingEdgePayload;
2707
2652
  this.params.onEdgeReattachInterrupted({
2708
2653
  id: d.id,
@@ -2713,7 +2658,7 @@ class q {
2713
2658
  });
2714
2659
  return;
2715
2660
  }
2716
- const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
2661
+ const [s, i] = this.isTargetDragging ? [this.staticPortId, e] : [e, this.staticPortId], n = this.draggingEdgePayload, a = {
2717
2662
  id: n.id,
2718
2663
  from: s,
2719
2664
  to: i,
@@ -2734,45 +2679,45 @@ class q {
2734
2679
  }
2735
2680
  }
2736
2681
  }
2737
- const ct = () => {
2682
+ const ce = () => {
2738
2683
  const r = document.createElement("div");
2739
2684
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
2740
2685
  }, Y = () => {
2741
2686
  const r = document.createElement("div");
2742
2687
  return r.style.position = "absolute", r.style.inset = "0", r;
2743
- }, ce = () => {
2688
+ }, ct = () => {
2744
2689
  const r = Y();
2745
2690
  return r.style.pointerEvents = "none", r;
2746
2691
  };
2747
- class gt {
2748
- constructor(e) {
2692
+ class ge {
2693
+ constructor(t) {
2749
2694
  o(this, "background", Y());
2750
2695
  o(this, "main", Y());
2751
- o(this, "overlayConnectablePorts", ce());
2752
- o(this, "overlayDraggableEdges", ce());
2753
- o(this, "host", ct());
2754
- this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
2696
+ o(this, "overlayConnectablePorts", ct());
2697
+ o(this, "overlayDraggableEdges", ct());
2698
+ o(this, "host", ce());
2699
+ this.element = t, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
2755
2700
  }
2756
2701
  destroy() {
2757
2702
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
2758
2703
  }
2759
2704
  }
2760
- const H = (r) => () => r, ge = H(0), lt = () => {
2705
+ const H = (r) => () => r, gt = H(0), le = () => {
2761
2706
  let r = 0;
2762
2707
  return () => r++;
2763
- }, ut = (r, e) => {
2764
- let t = ge, s = ge;
2765
- const i = lt();
2766
- return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = H(r)), typeof e == "number" && (s = H(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
2767
- nodesPriorityFn: t,
2708
+ }, ue = (r, t) => {
2709
+ let e = gt, s = gt;
2710
+ const i = le();
2711
+ return r === "incremental" && (e = i), t === "incremental" && (s = i), typeof r == "number" && (e = H(r)), typeof t == "number" && (s = H(t)), typeof r == "function" && (e = r), typeof t == "function" && (s = t), {
2712
+ nodesPriorityFn: e,
2768
2713
  edgesPriorityFn: s
2769
2714
  };
2770
- }, ee = (r) => {
2715
+ }, tt = (r) => {
2771
2716
  if (typeof r == "function")
2772
2717
  return r;
2773
2718
  switch (r == null ? void 0 : r.type) {
2774
2719
  case "straight":
2775
- return () => new et({
2720
+ return () => new te({
2776
2721
  color: r.color,
2777
2722
  width: r.width,
2778
2723
  arrowLength: r.arrowLength,
@@ -2786,7 +2731,7 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2786
2731
  detourDirection: r.detourDirection
2787
2732
  });
2788
2733
  case "horizontal":
2789
- return () => new qe({
2734
+ return () => new qt({
2790
2735
  color: r.color,
2791
2736
  width: r.width,
2792
2737
  arrowLength: r.arrowLength,
@@ -2796,11 +2741,10 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2796
2741
  hasTargetArrow: r.hasTargetArrow,
2797
2742
  cycleSquareSide: r.cycleSquareSide,
2798
2743
  roundness: r.roundness,
2799
- detourDistance: r.detourDistance,
2800
- detourDirection: r.detourDirection
2744
+ detourDistance: r.detourDistance
2801
2745
  });
2802
2746
  case "vertical":
2803
- return () => new tt({
2747
+ return () => new ee({
2804
2748
  color: r.color,
2805
2749
  width: r.width,
2806
2750
  arrowLength: r.arrowLength,
@@ -2810,11 +2754,10 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2810
2754
  hasTargetArrow: r.hasTargetArrow,
2811
2755
  cycleSquareSide: r.cycleSquareSide,
2812
2756
  roundness: r.roundness,
2813
- detourDistance: r.detourDistance,
2814
- detourDirection: r.detourDirection
2757
+ detourDistance: r.detourDistance
2815
2758
  });
2816
2759
  case "direct":
2817
- return () => new be({
2760
+ return () => new bt({
2818
2761
  color: r.color,
2819
2762
  width: r.width,
2820
2763
  arrowLength: r.arrowLength,
@@ -2825,7 +2768,7 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2825
2768
  targetOffset: r.targetOffset
2826
2769
  });
2827
2770
  default:
2828
- return () => new _e({
2771
+ return () => new _t({
2829
2772
  color: r.color,
2830
2773
  width: r.width,
2831
2774
  arrowLength: r.arrowLength,
@@ -2839,30 +2782,30 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2839
2782
  detourDirection: r.detourDirection
2840
2783
  });
2841
2784
  }
2842
- }, pt = (r) => {
2843
- var t, s, i, n, a;
2844
- const e = ut(
2845
- (t = r.nodes) == null ? void 0 : t.priority,
2785
+ }, pe = (r) => {
2786
+ var e, s, i, n, a;
2787
+ const t = ue(
2788
+ (e = r.nodes) == null ? void 0 : e.priority,
2846
2789
  (s = r.edges) == null ? void 0 : s.priority
2847
2790
  );
2848
2791
  return {
2849
2792
  nodes: {
2850
- centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? ve,
2851
- priorityFn: e.nodesPriorityFn
2793
+ centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? vt,
2794
+ priorityFn: t.nodesPriorityFn
2852
2795
  },
2853
2796
  ports: {
2854
2797
  direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
2855
2798
  },
2856
2799
  edges: {
2857
- shapeFactory: ee(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
2858
- priorityFn: e.edgesPriorityFn
2800
+ shapeFactory: tt(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
2801
+ priorityFn: t.edgesPriorityFn
2859
2802
  }
2860
2803
  };
2861
- }, wt = (r) => {
2862
- var w, f, y, v, E, x;
2863
- const e = ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? (() => {
2864
- }), t = (((f = r.events) == null ? void 0 : f.onBeforeNodeDrag) || r.nodeDragVerifier) ?? (() => !0), s = ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
2865
- }), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (v = r.mouse) == null ? void 0 : v.dragCursor, h = a !== void 0 ? a : "grab", d = (E = r.mouse) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, l = (x = r.mouse) == null ? void 0 : x.mouseUpEventVerifier, g = l !== void 0 ? l : (b) => b.button === 0;
2804
+ }, we = (r) => {
2805
+ var w, f, m, v, E;
2806
+ const t = ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? (() => {
2807
+ }), e = r.nodeDragVerifier ?? (() => !0), s = ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
2808
+ }), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (m = r.mouse) == null ? void 0 : m.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (x) => x.button === 0, l = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, g = l !== void 0 ? l : (x) => x.button === 0;
2866
2809
  return {
2867
2810
  moveOnTop: i,
2868
2811
  moveEdgesOnTop: n,
@@ -2870,22 +2813,22 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2870
2813
  gridSize: r.gridSize ?? null,
2871
2814
  mouseDownEventVerifier: c,
2872
2815
  mouseUpEventVerifier: g,
2873
- onNodeDrag: e,
2874
- nodeDragVerifier: t,
2816
+ onNodeDrag: t,
2817
+ nodeDragVerifier: e,
2875
2818
  onNodeDragFinished: s
2876
2819
  };
2877
- }, ft = (r) => {
2878
- 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;
2820
+ }, fe = (r) => {
2821
+ const t = r.minX !== null ? r.minX : -1 / 0, e = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
2879
2822
  return (n) => {
2880
2823
  let a = n.nextTransform.x, h = n.nextTransform.y;
2881
- a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
2882
- const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
2824
+ a < t && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, t));
2825
+ const d = n.canvasWidth * n.prevTransform.scale, c = e - d;
2883
2826
  a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < s && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, s));
2884
2827
  const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
2885
2828
  return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
2886
2829
  };
2887
- }, mt = (r) => {
2888
- const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
2830
+ }, ye = (r) => {
2831
+ const t = r.maxContentScale, e = r.minContentScale, s = t !== null ? 1 / t : 0, i = e !== null ? 1 / e : 1 / 0;
2889
2832
  return (n) => {
2890
2833
  const a = n.prevTransform, h = n.nextTransform;
2891
2834
  let d = h.scale, c = h.x, l = h.y;
@@ -2905,48 +2848,48 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2905
2848
  y: l
2906
2849
  };
2907
2850
  };
2908
- }, yt = (r) => (e) => r.reduce(
2909
- (t, s) => s({
2910
- prevTransform: e.prevTransform,
2911
- nextTransform: t,
2912
- canvasWidth: e.canvasWidth,
2913
- canvasHeight: e.canvasHeight
2851
+ }, me = (r) => (t) => r.reduce(
2852
+ (e, s) => s({
2853
+ prevTransform: t.prevTransform,
2854
+ nextTransform: e,
2855
+ canvasWidth: t.canvasWidth,
2856
+ canvasHeight: t.canvasHeight
2914
2857
  }),
2915
- e.nextTransform
2916
- ), le = (r) => {
2858
+ t.nextTransform
2859
+ ), lt = (r) => {
2917
2860
  if (typeof r == "function")
2918
2861
  return r;
2919
2862
  switch (r.type) {
2920
2863
  case "scale-limit":
2921
- return mt({
2864
+ return ye({
2922
2865
  minContentScale: r.minContentScale ?? 0,
2923
2866
  maxContentScale: r.maxContentScale ?? 1 / 0
2924
2867
  });
2925
2868
  case "shift-limit":
2926
- return ft({
2869
+ return fe({
2927
2870
  minX: r.minX ?? -1 / 0,
2928
2871
  maxX: r.maxX ?? 1 / 0,
2929
2872
  minY: r.minY ?? -1 / 0,
2930
2873
  maxY: r.maxY ?? 1 / 0
2931
2874
  });
2932
2875
  }
2933
- }, ue = (r) => {
2934
- var y, v, E, x, b, T, N, V, te, re, oe, se;
2935
- const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
2876
+ }, ut = (r) => {
2877
+ var m, v, E, x, L, b, D, V, et, rt, ot, st;
2878
+ const t = (m = r == null ? void 0 : r.scale) == null ? void 0 : m.mouseWheelSensitivity, e = t !== void 0 ? t : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
2936
2879
  let i;
2937
- s !== void 0 ? Array.isArray(s) ? i = yt(
2880
+ s !== void 0 ? Array.isArray(s) ? i = me(
2938
2881
  s.map(
2939
- (M) => le(M)
2882
+ (N) => lt(N)
2940
2883
  )
2941
- ) : i = le(s) : i = (M) => M.nextTransform;
2884
+ ) : i = lt(s) : i = (N) => N.nextTransform;
2942
2885
  const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
2943
2886
  }), h = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
2944
- }), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, l = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, g = l !== void 0 ? l : (M) => M.button === 0, w = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, f = w !== void 0 ? w : () => !0;
2887
+ }), d = (L = r == null ? void 0 : r.shift) == null ? void 0 : L.mouseDownEventVerifier, c = d !== void 0 ? d : (N) => N.button === 0, l = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = l !== void 0 ? l : (N) => N.button === 0, w = (D = r == null ? void 0 : r.scale) == null ? void 0 : D.mouseWheelEventVerifier, f = w !== void 0 ? w : () => !0;
2945
2888
  return {
2946
- wheelSensitivity: t,
2889
+ wheelSensitivity: e,
2947
2890
  onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
2948
2891
  }),
2949
- onTransformFinished: ((te = r == null ? void 0 : r.events) == null ? void 0 : te.onTransformFinished) ?? (() => {
2892
+ onTransformFinished: ((et = r == null ? void 0 : r.events) == null ? void 0 : et.onTransformFinished) ?? (() => {
2950
2893
  }),
2951
2894
  onBeforeTransformChange: a,
2952
2895
  onTransformChange: h,
@@ -2955,30 +2898,30 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2955
2898
  mouseDownEventVerifier: c,
2956
2899
  mouseUpEventVerifier: g,
2957
2900
  mouseWheelEventVerifier: f,
2958
- scaleWheelFinishTimeout: ((re = r == null ? void 0 : r.scale) == null ? void 0 : re.wheelFinishTimeout) ?? 500,
2959
- onResizeTransformStarted: ((oe = r == null ? void 0 : r.events) == null ? void 0 : oe.onResizeTransformStarted) ?? (() => {
2901
+ scaleWheelFinishTimeout: ((rt = r == null ? void 0 : r.scale) == null ? void 0 : rt.wheelFinishTimeout) ?? 500,
2902
+ onResizeTransformStarted: ((ot = r == null ? void 0 : r.events) == null ? void 0 : ot.onResizeTransformStarted) ?? (() => {
2960
2903
  }),
2961
- onResizeTransformFinished: ((se = r == null ? void 0 : r.events) == null ? void 0 : se.onResizeTransformFinished) ?? (() => {
2904
+ onResizeTransformFinished: ((st = r == null ? void 0 : r.events) == null ? void 0 : st.onResizeTransformFinished) ?? (() => {
2962
2905
  })
2963
2906
  };
2964
- }, vt = (r, e) => {
2965
- const t = document.createElementNS(
2907
+ }, ve = (r, t) => {
2908
+ const e = document.createElementNS(
2966
2909
  "http://www.w3.org/2000/svg",
2967
2910
  "circle"
2968
2911
  );
2969
- return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
2970
- }, Et = (r) => r instanceof SVGElement ? r : vt(
2912
+ return e.setAttribute("cx", "0"), e.setAttribute("cy", "0"), e.setAttribute("r", `${r}`), e.setAttribute("fill", `${t}`), e;
2913
+ }, Ee = (r) => r instanceof SVGElement ? r : ve(
2971
2914
  (r == null ? void 0 : r.radius) ?? 1.5,
2972
2915
  (r == null ? void 0 : r.color) ?? "#d8d8d8"
2973
- ), At = (r) => {
2974
- const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Et(r.renderer ?? {});
2916
+ ), Ae = (r) => {
2917
+ const t = r.tileDimensions, e = (t == null ? void 0 : t.width) ?? 25, s = (t == null ? void 0 : t.height) ?? 25, i = Ee(r.renderer ?? {});
2975
2918
  return {
2976
- tileWidth: t,
2919
+ tileWidth: e,
2977
2920
  tileHeight: s,
2978
2921
  renderer: i,
2979
2922
  maxViewportScale: r.maxViewportScale ?? 10
2980
2923
  };
2981
- }, xt = (r, e, t) => {
2924
+ }, xe = (r, t, e) => {
2982
2925
  var c, l, g;
2983
2926
  const s = () => "direct", i = (w) => w, n = (w) => w.button === 0, a = () => {
2984
2927
  }, h = () => {
@@ -2992,43 +2935,49 @@ const H = (r) => () => r, ge = H(0), lt = () => {
2992
2935
  onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
2993
2936
  onEdgeCreationInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeCreationInterrupted) ?? d,
2994
2937
  onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
2995
- dragPortDirection: r.dragPortDirection ?? t,
2996
- edgeShapeFactory: r.edgeShape !== void 0 ? ee(r.edgeShape) : e
2938
+ dragPortDirection: r.dragPortDirection ?? e,
2939
+ edgeShapeFactory: r.edgeShape !== void 0 ? tt(r.edgeShape) : t
2997
2940
  };
2998
- }, St = (r, e) => {
2941
+ }, Se = (r, t) => {
2999
2942
  var c, l, g;
3000
- const t = (w) => w, s = (w) => w.button === 0 && w.ctrlKey, i = (w) => w.button === 0, n = (w) => {
3001
- const f = e.getPortAdjacentEdgeIds(w);
2943
+ const e = (w) => w, s = (w) => w.button === 0 && w.ctrlKey, i = (w) => w.button === 0, n = (w) => {
2944
+ const f = t.getPortAdjacentEdgeIds(w);
3002
2945
  return f.length > 0 ? f[f.length - 1] : null;
3003
2946
  }, a = () => {
3004
2947
  }, h = () => {
3005
2948
  }, d = () => {
3006
2949
  };
3007
2950
  return {
3008
- connectionPreprocessor: r.connectionPreprocessor ?? t,
2951
+ connectionPreprocessor: r.connectionPreprocessor ?? e,
3009
2952
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
3010
2953
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
3011
2954
  draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3012
- draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ee(r.draggingEdgeShape) : null,
2955
+ draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? tt(r.draggingEdgeShape) : null,
3013
2956
  onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3014
2957
  onEdgeReattachInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeReattachInterrupted) ?? d,
3015
2958
  onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
3016
2959
  };
3017
- }, Pt = (r) => ({
2960
+ }, Pe = (r) => ({
3018
2961
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3019
2962
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3020
- }), bt = (r) => {
3021
- var e, t;
2963
+ }), be = (r) => {
2964
+ var t, e;
3022
2965
  return {
3023
- onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
2966
+ onAfterNodeDetached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterNodeDetached) ?? (() => {
3024
2967
  }),
3025
- onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? (() => {
2968
+ onBeforeNodeAttached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeNodeAttached) ?? (() => {
3026
2969
  })
3027
2970
  };
3028
2971
  };
3029
- class Nt {
3030
- constructor(e) {
3031
- o(this, "element", null);
2972
+ class Te extends Error {
2973
+ constructor() {
2974
+ super(...arguments);
2975
+ o(this, "name", "CanvasBuilderError");
2976
+ }
2977
+ }
2978
+ class Me {
2979
+ constructor(t) {
2980
+ o(this, "used", !1);
3032
2981
  o(this, "canvasDefaults", {});
3033
2982
  o(this, "dragConfig", {});
3034
2983
  o(this, "transformConfig", {});
@@ -3042,41 +2991,29 @@ class Nt {
3042
2991
  o(this, "hasBackground", !1);
3043
2992
  o(this, "hasUserConnectablePorts", !1);
3044
2993
  o(this, "hasUserDraggableEdges", !1);
3045
- o(this, "boxRenderingTrigger");
2994
+ o(this, "boxRenderingTrigger", new wt());
2995
+ o(this, "graphStore", new yt());
2996
+ o(this, "viewportStore", new Bt());
3046
2997
  o(this, "window", window);
3047
- e !== void 0 && (this.element = e);
3048
- }
3049
- /**
3050
- * @deprecated
3051
- * use `new CanvasBuilder(element);` instead
3052
- */
3053
- setElement(e) {
3054
- return this.element = e, this;
2998
+ this.element = t;
3055
2999
  }
3056
3000
  /**
3057
3001
  * specifies default values for graph entities
3058
3002
  */
3059
- setDefaults(e) {
3060
- return this.canvasDefaults = e, this;
3003
+ setDefaults(t) {
3004
+ return this.canvasDefaults = t, this;
3061
3005
  }
3062
3006
  /**
3063
3007
  * enables nodes draggable by user
3064
3008
  */
3065
- enableUserDraggableNodes(e) {
3066
- return this.hasDraggableNode = !0, this.dragConfig = e ?? {}, this;
3009
+ enableUserDraggableNodes(t) {
3010
+ return this.hasDraggableNode = !0, this.dragConfig = t ?? {}, this;
3067
3011
  }
3068
3012
  /**
3069
3013
  * enables viewport transformable by user
3070
3014
  */
3071
- enableUserTransformableViewport(e) {
3072
- return this.hasTransformableViewport = !0, this.transformConfig = e ?? {}, this;
3073
- }
3074
- /**
3075
- * @deprecated
3076
- * use enableNodeResizeReactiveEdges instead
3077
- */
3078
- enableResizeReactiveNodes() {
3079
- return this.hasNodeResizeReactiveEdges = !0, this;
3015
+ enableUserTransformableViewport(t) {
3016
+ return this.hasTransformableViewport = !0, this.transformConfig = t ?? {}, this;
3080
3017
  }
3081
3018
  /**
3082
3019
  * enables automatic edges update on node resize
@@ -3084,139 +3021,118 @@ class Nt {
3084
3021
  enableNodeResizeReactiveEdges() {
3085
3022
  return this.hasNodeResizeReactiveEdges = !0, this;
3086
3023
  }
3087
- /**
3088
- * @deprecated
3089
- * do not use
3090
- * sets emitter for rendering graph inside bounded area
3091
- */
3092
- enableBoxAreaRendering(e) {
3093
- return this.boxRenderingTrigger = e, this;
3094
- }
3095
3024
  /**
3096
3025
  * enables built-in virtual scroll behavior, when only nodes and edges close
3097
3026
  * to viewport are rendered
3098
3027
  */
3099
- enableVirtualScroll(e) {
3100
- return this.virtualScrollConfig = e, this;
3028
+ enableVirtualScroll(t) {
3029
+ return this.virtualScrollConfig = t, this;
3101
3030
  }
3102
3031
  /**
3103
3032
  * enables built-in background rendering
3104
3033
  */
3105
- enableBackground(e) {
3106
- return this.hasBackground = !0, this.backgroundConfig = e ?? {}, this;
3034
+ enableBackground(t) {
3035
+ return this.hasBackground = !0, this.backgroundConfig = t ?? {}, this;
3107
3036
  }
3108
3037
  /**
3109
3038
  * enables edge creation by dragging one port to another
3110
3039
  */
3111
- enableUserConnectablePorts(e) {
3112
- return this.connectablePortsConfig = e ?? {}, this.hasUserConnectablePorts = !0, this;
3040
+ enableUserConnectablePorts(t) {
3041
+ return this.hasUserConnectablePorts = !0, this.connectablePortsConfig = t ?? {}, this;
3113
3042
  }
3114
- enableUserDraggableEdges(e) {
3115
- return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
3043
+ enableUserDraggableEdges(t) {
3044
+ return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = t ?? {}, this;
3116
3045
  }
3117
3046
  /**
3118
3047
  * builds final canvas
3119
3048
  */
3120
3049
  build() {
3121
- if (this.element === null)
3122
- throw new S(
3123
- "unable to build canvas when no attach element specified"
3124
- );
3125
- let e = this.boxRenderingTrigger;
3126
- this.virtualScrollConfig !== void 0 && e === void 0 && (e = new we());
3127
- const t = new me(), s = new $e(), i = new gt(this.element);
3128
- let n = new pe(
3129
- t,
3130
- s,
3131
- i.main
3050
+ if (this.used)
3051
+ throw new Te("CanvasBuilder is a single use object");
3052
+ this.used = !0;
3053
+ const t = new ge(this.element);
3054
+ let e = new pt(
3055
+ this.graphStore,
3056
+ this.viewportStore,
3057
+ t.main
3132
3058
  );
3133
- e !== void 0 && (n = new Ie(
3134
- n,
3135
- t,
3059
+ this.virtualScrollConfig !== void 0 && (e = new It(
3136
3060
  e,
3137
- bt(this.virtualScrollConfig)
3061
+ this.graphStore,
3062
+ this.boxRenderingTrigger,
3063
+ be(this.virtualScrollConfig)
3138
3064
  ));
3139
- const a = pt(this.canvasDefaults), h = new fe(
3140
- this.element,
3141
- t,
3142
- s,
3143
- n,
3144
- a
3065
+ const s = pe(this.canvasDefaults), i = new ft(
3066
+ this.graphStore,
3067
+ this.viewportStore,
3068
+ e,
3069
+ s
3145
3070
  );
3146
3071
  if (this.hasBackground && Q.configure(
3147
- h,
3148
- At(this.backgroundConfig),
3149
- i.background
3150
- ), this.hasNodeResizeReactiveEdges && j.configure(h), this.hasDraggableNode && Z.configure(
3151
- h,
3152
- i.main,
3072
+ i,
3073
+ Ae(this.backgroundConfig),
3074
+ t.background
3075
+ ), this.hasNodeResizeReactiveEdges && j.configure(i), this.hasDraggableNode && Z.configure(
3076
+ i,
3077
+ t.main,
3153
3078
  this.window,
3154
- wt(this.dragConfig)
3079
+ we(this.dragConfig)
3155
3080
  ), this.hasUserConnectablePorts) {
3156
- const c = xt(
3081
+ const a = xe(
3157
3082
  this.connectablePortsConfig,
3158
- a.edges.shapeFactory,
3159
- a.ports.direction
3083
+ s.edges.shapeFactory,
3084
+ s.ports.direction
3160
3085
  );
3161
3086
  _.configure(
3162
- h,
3163
- i.overlayConnectablePorts,
3164
- s,
3087
+ i,
3088
+ t.overlayConnectablePorts,
3089
+ this.viewportStore,
3165
3090
  this.window,
3166
- c
3091
+ a
3167
3092
  );
3168
3093
  }
3169
3094
  if (this.hasUserDraggableEdges) {
3170
- const c = St(
3095
+ const a = Se(
3171
3096
  this.draggableEdgesConfig,
3172
- h.graph
3097
+ i.graph
3173
3098
  );
3174
3099
  q.configure(
3175
- h,
3176
- i.overlayDraggableEdges,
3177
- s,
3100
+ i,
3101
+ t.overlayDraggableEdges,
3102
+ this.viewportStore,
3178
3103
  this.window,
3179
- c
3104
+ a
3180
3105
  );
3181
3106
  }
3182
3107
  this.virtualScrollConfig !== void 0 ? J.configure(
3183
- h,
3184
- i.main,
3108
+ i,
3109
+ t.main,
3185
3110
  this.window,
3186
- ue(this.transformConfig),
3187
- e,
3188
- Pt(this.virtualScrollConfig)
3111
+ ut(this.transformConfig),
3112
+ this.boxRenderingTrigger,
3113
+ Pe(this.virtualScrollConfig)
3189
3114
  ) : this.hasTransformableViewport && k.configure(
3190
- h,
3191
- i.main,
3115
+ i,
3116
+ t.main,
3192
3117
  this.window,
3193
- ue(this.transformConfig)
3194
- ), this.reset();
3195
- const d = () => {
3196
- i.destroy(), h.onBeforeDestroy.unsubscribe(d);
3118
+ ut(this.transformConfig)
3119
+ );
3120
+ const n = () => {
3121
+ t.destroy(), i.onBeforeDestroy.unsubscribe(n);
3197
3122
  };
3198
- return h.onBeforeDestroy.subscribe(d), h;
3199
- }
3200
- /**
3201
- * @deprecated
3202
- * CanvasBuilder should be single use object
3203
- */
3204
- reset() {
3205
- this.element = null, this.canvasDefaults = {}, this.dragConfig = {}, this.transformConfig = {}, this.backgroundConfig = {}, this.virtualScrollConfig = void 0, this.hasDraggableNode = !1, this.hasTransformableViewport = !1, this.hasNodeResizeReactiveEdges = !1, this.hasBackground = !1, this.boxRenderingTrigger = void 0, this.hasUserConnectablePorts = !1;
3123
+ return i.onBeforeDestroy.subscribe(n), i;
3206
3124
  }
3207
3125
  }
3208
3126
  export {
3209
- _e as BezierEdgeShape,
3210
- Nt as CanvasBuilder,
3211
- be as DirectEdgeShape,
3212
- we as EventSubject,
3213
- qe as HorizontalEdgeShape,
3214
- S as HtmlGraphError,
3215
- st as InteractiveEdgeError,
3216
- Te as InteractiveEdgeShape,
3217
- F as LineEdgeShape,
3218
- Dt as MedianEdgeShape,
3219
- Dt as MidpointEdgeShape,
3220
- et as StraightEdgeShape,
3221
- tt as VerticalEdgeShape
3127
+ _t as BezierEdgeShape,
3128
+ Me as CanvasBuilder,
3129
+ Te as CanvasBuilderError,
3130
+ S as CanvasError,
3131
+ bt as DirectEdgeShape,
3132
+ qt as HorizontalEdgeShape,
3133
+ se as InteractiveEdgeError,
3134
+ Tt as InteractiveEdgeShape,
3135
+ Ne as MidpointEdgeShape,
3136
+ te as StraightEdgeShape,
3137
+ ee as VerticalEdgeShape
3222
3138
  };