@html-graph/html-graph 4.0.0 → 5.0.0

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