@html-graph/html-graph 0.1.2 → 0.1.3

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.
package/dist/main.js CHANGED
@@ -1,36 +1,36 @@
1
1
  var O = Object.defineProperty;
2
2
  var K = (e, t, o) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var s = (e, t, o) => K(e, typeof t != "symbol" ? t + "" : t, o);
3
+ var n = (e, t, o) => K(e, typeof t != "symbol" ? t + "" : t, o);
4
4
  const _ = (e, t) => ({
5
5
  x: e / 2,
6
6
  y: t / 2
7
7
  }), f = (e, t, o) => ({
8
8
  x: t.x * e.x - t.y * e.y + ((1 - t.x) * o.x + t.y * o.y),
9
9
  y: t.y * e.x + t.x * e.y + ((1 - t.x) * o.y - t.y * o.x)
10
- }), A = (e, t, o) => ({ x: t * Math.cos(e), y: o * Math.sin(e) }), u = {
10
+ }), A = (e, t, o) => ({ x: t * Math.cos(e), y: o * Math.sin(e) }), w = {
11
11
  x: 0,
12
12
  y: 0
13
13
  }, E = (e, t, o, r) => {
14
- const i = [
15
- u,
14
+ const s = [
15
+ w,
16
16
  { x: o, y: r },
17
17
  { x: o, y: -r }
18
- ].map((l) => f(l, e, u)).map((l) => ({ x: l.x + t.x, y: l.y + t.y })), c = `M ${i[0].x} ${i[0].y}`, d = `L ${i[1].x} ${i[1].y}`, h = `L ${i[2].x} ${i[2].y}`;
19
- return `${c} ${d} ${h}`;
18
+ ].map((l) => f(l, e, w)).map((l) => ({ x: l.x + t.x, y: l.y + t.y })), h = `M ${s[0].x} ${s[0].y}`, d = `L ${s[1].x} ${s[1].y}`, c = `L ${s[2].x} ${s[2].y}`;
19
+ return `${h} ${d} ${c}`;
20
20
  }, C = (e, t) => {
21
21
  const o = [];
22
22
  if (e.length > 0 && o.push(`M ${e[0].x} ${e[0].y}`), e.length === 2 && o.push(`L ${e[1].x} ${e[1].y}`), e.length > 2) {
23
23
  const r = e.length - 1;
24
- let n = 0, i = 0, c = 0;
25
- e.forEach((d, h) => {
26
- let l = 0, a = 0, w = 0;
27
- const y = h > 0, x = h < r, v = y && x;
28
- if (y && (l = -n, a = -i, w = c), x) {
29
- const z = e[h + 1];
30
- n = z.x - d.x, i = z.y - d.y, c = Math.sqrt(n * n + i * i);
24
+ let i = 0, s = 0, h = 0;
25
+ e.forEach((d, c) => {
26
+ let l = 0, a = 0, g = 0;
27
+ const y = c > 0, x = c < r, v = y && x;
28
+ if (y && (l = -i, a = -s, g = h), x) {
29
+ const z = e[c + 1];
30
+ i = z.x - d.x, s = z.y - d.y, h = Math.sqrt(i * i + s * s);
31
31
  }
32
- const M = c !== 0 ? Math.min((v ? t : 0) / c, h < r - 1 ? 0.5 : 1) : 0, X = v ? { x: d.x + n * M, y: d.y + i * M } : d, k = w !== 0 ? Math.min((v ? t : 0) / w, h > 1 ? 0.5 : 1) : 0, B = v ? { x: d.x + l * k, y: d.y + a * k } : d;
33
- h > 0 && o.push(`L ${B.x} ${B.y}`), v && o.push(
32
+ const M = h !== 0 ? Math.min((v ? t : 0) / h, c < r - 1 ? 0.5 : 1) : 0, X = v ? { x: d.x + i * M, y: d.y + s * M } : d, k = g !== 0 ? Math.min((v ? t : 0) / g, c > 1 ? 0.5 : 1) : 0, B = v ? { x: d.x + l * k, y: d.y + a * k } : d;
33
+ c > 0 && o.push(`L ${B.x} ${B.y}`), v && o.push(
34
34
  `C ${d.x} ${d.y} ${d.x} ${d.y} ${X.x} ${X.y}`
35
35
  );
36
36
  });
@@ -55,20 +55,20 @@ const _ = (e, t) => ({
55
55
  }, r = {
56
56
  x: t.x + t.width / 2,
57
57
  y: t.y + t.height / 2
58
- }, n = Math.min(o.x, r.x), i = Math.min(o.y, r.y), c = Math.abs(r.x - o.x), d = Math.abs(r.y - o.y), h = o.x <= r.x ? 1 : -1, l = o.y <= r.y ? 1 : -1;
58
+ }, i = Math.min(o.x, r.x), s = Math.min(o.y, r.y), h = Math.abs(r.x - o.x), d = Math.abs(r.y - o.y), c = o.x <= r.x ? 1 : -1, l = o.y <= r.y ? 1 : -1;
59
59
  return {
60
- x: n,
61
- y: i,
62
- width: c,
60
+ x: i,
61
+ y: s,
62
+ width: h,
63
63
  height: d,
64
- flipX: h,
64
+ flipX: c,
65
65
  flipY: l
66
66
  };
67
67
  }, J = (e) => {
68
68
  const t = f(
69
- { x: e.arrowLength, y: u.y },
69
+ { x: e.arrowLength, y: w.y },
70
70
  e.fromVect,
71
- u
71
+ w
72
72
  ), o = f(
73
73
  { x: e.to.x - e.arrowLength, y: e.to.y },
74
74
  e.toVect,
@@ -76,160 +76,160 @@ const _ = (e, t) => ({
76
76
  ), r = {
77
77
  x: t.x + e.fromVect.x * e.curvature,
78
78
  y: t.y + e.fromVect.y * e.curvature
79
- }, n = {
79
+ }, i = {
80
80
  x: o.x - e.toVect.x * e.curvature,
81
81
  y: o.y - e.toVect.y * e.curvature
82
- }, i = `M ${t.x} ${t.y} C ${r.x} ${r.y}, ${n.x} ${n.y}, ${o.x} ${o.y}`, c = e.hasSourceArrow ? "" : `M ${u.x} ${u.y} L ${t.x} ${t.y} `, d = e.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${e.to.x} ${e.to.y}`;
83
- return `${c}${i}${d}`;
82
+ }, s = `M ${t.x} ${t.y} C ${r.x} ${r.y}, ${i.x} ${i.y}, ${o.x} ${o.y}`, h = e.hasSourceArrow ? "" : `M ${w.x} ${w.y} L ${t.x} ${t.y} `, d = e.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${e.to.x} ${e.to.y}`;
83
+ return `${h}${s}${d}`;
84
84
  }, Q = (e) => {
85
85
  const t = e.hasSourceArrow ? f(
86
- { x: e.arrowLength, y: u.y },
86
+ { x: e.arrowLength, y: w.y },
87
87
  e.fromVect,
88
- u
89
- ) : u, o = e.hasTargetArrow ? f(
88
+ w
89
+ ) : w, o = e.hasTargetArrow ? f(
90
90
  { x: e.to.x - e.arrowLength, y: e.to.y },
91
91
  e.toVect,
92
92
  e.to
93
- ) : e.to, r = e.arrowLength, n = Math.cos(e.detourDirection) * e.detourDistance, i = Math.sin(e.detourDirection) * e.detourDistance, c = n * e.flipX, d = i * e.flipY, h = f(
94
- { x: r, y: u.y },
93
+ ) : e.to, r = e.arrowLength, i = Math.cos(e.detourDirection) * e.detourDistance, s = Math.sin(e.detourDirection) * e.detourDistance, h = i * e.flipX, d = s * e.flipY, c = f(
94
+ { x: r, y: w.y },
95
95
  e.fromVect,
96
- u
96
+ w
97
97
  ), l = {
98
- x: h.x + c,
99
- y: h.y + d
98
+ x: c.x + h,
99
+ y: c.y + d
100
100
  }, a = f(
101
101
  { x: e.to.x - r, y: e.to.y },
102
102
  e.toVect,
103
103
  e.to
104
- ), w = {
105
- x: a.x + c,
104
+ ), g = {
105
+ x: a.x + h,
106
106
  y: a.y + d
107
- }, y = { x: (l.x + w.x) / 2, y: (l.y + w.y) / 2 }, x = {
108
- x: h.x + e.curvature * e.fromVect.x,
109
- y: h.y + e.curvature * e.fromVect.y
107
+ }, y = { x: (l.x + g.x) / 2, y: (l.y + g.y) / 2 }, x = {
108
+ x: c.x + e.curvature * e.fromVect.x,
109
+ y: c.y + e.curvature * e.fromVect.y
110
110
  }, v = {
111
111
  x: a.x - e.curvature * e.toVect.x,
112
112
  y: a.y - e.curvature * e.toVect.y
113
113
  }, p = {
114
- x: h.x + c,
115
- y: h.y + d
114
+ x: c.x + h,
115
+ y: c.y + d
116
116
  }, M = {
117
- x: a.x + c,
117
+ x: a.x + h,
118
118
  y: a.y + d
119
119
  };
120
120
  return [
121
121
  `M ${t.x} ${t.y}`,
122
- `L ${h.x} ${h.y}`,
122
+ `L ${c.x} ${c.y}`,
123
123
  `C ${x.x} ${x.y} ${p.x} ${p.y} ${y.x} ${y.y}`,
124
124
  `C ${M.x} ${M.y} ${v.x} ${v.y} ${a.x} ${a.y}`,
125
125
  `L ${o.x} ${o.y}`
126
126
  ].join(" ");
127
127
  }, Z = (e) => {
128
128
  const t = e.hasSourceArrow ? f(
129
- { x: e.arrowLength, y: u.y },
129
+ { x: e.arrowLength, y: w.y },
130
130
  e.fromVect,
131
- u
132
- ) : u, o = e.hasTargetArrow ? f(
131
+ w
132
+ ) : w, o = e.hasTargetArrow ? f(
133
133
  { x: e.to.x - e.arrowLength, y: e.to.y },
134
134
  e.toVect,
135
135
  e.to
136
- ) : e.to, r = e.arrowLength + e.arrowOffset, n = r - e.roundness, i = f({ x: n, y: u.y }, e.fromVect, u), c = f(
137
- { x: e.to.x - n, y: e.to.y },
136
+ ) : e.to, r = e.arrowLength + e.arrowOffset, i = r - e.roundness, s = f({ x: i, y: w.y }, e.fromVect, w), h = f(
137
+ { x: e.to.x - i, y: e.to.y },
138
138
  e.toVect,
139
139
  e.to
140
- ), d = Math.max((i.x + c.x) / 2, r), h = e.to.y / 2, l = { x: e.flipX > 0 ? d : -r, y: i.y }, a = { x: l.x, y: h }, w = {
140
+ ), d = Math.max((s.x + h.x) / 2, r), c = e.to.y / 2, l = { x: e.flipX > 0 ? d : -r, y: s.y }, a = { x: l.x, y: c }, g = {
141
141
  x: e.flipX > 0 ? e.to.x - d : e.to.x + r,
142
- y: c.y
143
- }, y = { x: w.x, y: h };
142
+ y: h.y
143
+ }, y = { x: g.x, y: c };
144
144
  return C(
145
- [t, i, l, a, y, w, c, o],
145
+ [t, s, l, a, y, g, h, o],
146
146
  e.roundness
147
147
  );
148
148
  }, R = (e) => {
149
149
  const t = e.hasSourceArrow ? f(
150
- { x: e.arrowLength, y: u.y },
150
+ { x: e.arrowLength, y: w.y },
151
151
  e.fromVect,
152
- u
153
- ) : u, o = e.hasTargetArrow ? f(
152
+ w
153
+ ) : w, o = e.hasTargetArrow ? f(
154
154
  { x: e.to.x - e.arrowLength, y: e.to.y },
155
155
  e.toVect,
156
156
  e.to
157
- ) : e.to, r = e.arrowLength + e.arrowOffset, n = f(
158
- { x: r, y: u.y },
157
+ ) : e.to, r = e.arrowLength + e.arrowOffset, i = f(
158
+ { x: r, y: w.y },
159
159
  e.fromVect,
160
- u
161
- ), i = Math.cos(e.detourDirection) * e.detourDistance, c = Math.sin(e.detourDirection) * e.detourDistance, d = i * e.flipX, h = c * e.flipY, l = { x: n.x + d, y: n.y + h }, a = f(
160
+ w
161
+ ), s = Math.cos(e.detourDirection) * e.detourDistance, h = Math.sin(e.detourDirection) * e.detourDistance, d = s * e.flipX, c = h * e.flipY, l = { x: i.x + d, y: i.y + c }, a = f(
162
162
  { x: e.to.x - r, y: e.to.y },
163
163
  e.toVect,
164
164
  e.to
165
- ), w = { x: a.x + d, y: a.y + h };
165
+ ), g = { x: a.x + d, y: a.y + c };
166
166
  return C(
167
- [t, n, l, w, a, o],
167
+ [t, i, l, g, a, o],
168
168
  e.roundness
169
169
  );
170
170
  }, q = (e) => {
171
171
  const t = e.hasSourceArrow ? f(
172
- { x: e.arrowLength, y: u.y },
172
+ { x: e.arrowLength, y: w.y },
173
173
  e.fromVect,
174
- u
175
- ) : u, o = e.hasTargetArrow ? f(
174
+ w
175
+ ) : w, o = e.hasTargetArrow ? f(
176
176
  { x: e.to.x - e.arrowLength, y: e.to.y },
177
177
  e.toVect,
178
178
  e.to
179
- ) : e.to, r = e.arrowLength + e.arrowOffset, n = f({ x: r, y: u.y }, e.fromVect, u), i = f(
179
+ ) : e.to, r = e.arrowLength + e.arrowOffset, i = f({ x: r, y: w.y }, e.fromVect, w), s = f(
180
180
  { x: e.to.x - r, y: e.to.y },
181
181
  e.toVect,
182
182
  e.to
183
183
  );
184
- return C([t, n, i, o], e.roundness);
184
+ return C([t, i, s, o], e.roundness);
185
185
  }, tt = (e) => {
186
186
  const t = e.hasSourceArrow ? f(
187
- { x: e.arrowLength, y: u.y },
187
+ { x: e.arrowLength, y: w.y },
188
188
  e.fromVect,
189
- u
190
- ) : u, o = e.hasTargetArrow ? f(
189
+ w
190
+ ) : w, o = e.hasTargetArrow ? f(
191
191
  { x: e.to.x - e.arrowLength, y: e.to.y },
192
192
  e.toVect,
193
193
  e.to
194
- ) : e.to, r = e.arrowLength + e.arrowOffset, n = r - e.roundness, i = f({ x: n, y: u.y }, e.fromVect, u), c = f(
195
- { x: e.to.x - n, y: e.to.y },
194
+ ) : e.to, r = e.arrowLength + e.arrowOffset, i = r - e.roundness, s = f({ x: i, y: w.y }, e.fromVect, w), h = f(
195
+ { x: e.to.x - i, y: e.to.y },
196
196
  e.toVect,
197
197
  e.to
198
- ), d = Math.max((i.y + c.y) / 2, r), h = e.to.x / 2, l = { x: i.x, y: e.flipY > 0 ? d : -r }, a = { x: h, y: l.y }, w = {
199
- x: c.x,
198
+ ), d = Math.max((s.y + h.y) / 2, r), c = e.to.x / 2, l = { x: s.x, y: e.flipY > 0 ? d : -r }, a = { x: c, y: l.y }, g = {
199
+ x: h.x,
200
200
  y: e.flipY > 0 ? e.to.y - d : e.to.y + r
201
- }, y = { x: h, y: w.y };
201
+ }, y = { x: c, y: g.y };
202
202
  return C(
203
- [t, i, l, a, y, w, c, o],
203
+ [t, s, l, a, y, g, h, o],
204
204
  e.roundness
205
205
  );
206
206
  }, Y = (e) => {
207
- const t = e.arrowOffset, o = e.side, r = e.arrowLength + t, n = r + 2 * o, c = [
208
- { x: e.arrowLength, y: u.y },
209
- { x: r, y: u.y },
207
+ const t = e.arrowOffset, o = e.side, r = e.arrowLength + t, i = r + 2 * o, h = [
208
+ { x: e.arrowLength, y: w.y },
209
+ { x: r, y: w.y },
210
210
  { x: r, y: e.side },
211
- { x: n, y: e.side },
212
- { x: n, y: -e.side },
211
+ { x: i, y: e.side },
212
+ { x: i, y: -e.side },
213
213
  { x: r, y: -e.side },
214
- { x: r, y: u.y },
215
- { x: e.arrowLength, y: u.y }
214
+ { x: r, y: w.y },
215
+ { x: e.arrowLength, y: w.y }
216
216
  ].map(
217
- (h) => f(h, e.fromVect, u)
218
- ), d = `M ${u.x} ${u.y} L ${c[0].x} ${c[0].y} `;
219
- return `${e.hasSourceArrow || e.hasTargetArrow ? "" : d}${C(c, e.roundness)}`;
217
+ (c) => f(c, e.fromVect, w)
218
+ ), d = `M ${w.x} ${w.y} L ${h[0].x} ${h[0].y} `;
219
+ return `${e.hasSourceArrow || e.hasTargetArrow ? "" : d}${C(h, e.roundness)}`;
220
220
  }, et = (e) => {
221
- const t = e.smallRadius, o = e.radius, r = Math.sqrt(t * t + o * o), n = t + o, i = e.arrowLength + r * (1 - o / n), c = t * o / n, h = [
222
- { x: e.arrowLength, y: u.y },
223
- { x: i, y: c },
224
- { x: i, y: -c }
225
- ].map((w) => f(w, e.fromVect, u)), l = [
226
- `M ${h[0].x} ${h[0].y}`,
227
- `A ${t} ${t} 0 0 1 ${h[1].x} ${h[1].y}`,
228
- `A ${o} ${o} 0 1 0 ${h[2].x} ${h[2].y}`,
229
- `A ${t} ${t} 0 0 1 ${h[0].x} ${h[0].y}`
230
- ].join(" "), a = `M 0 0 L ${h[0].x} ${h[0].y} `;
221
+ const t = e.smallRadius, o = e.radius, r = Math.sqrt(t * t + o * o), i = t + o, s = e.arrowLength + r * (1 - o / i), h = t * o / i, c = [
222
+ { x: e.arrowLength, y: w.y },
223
+ { x: s, y: h },
224
+ { x: s, y: -h }
225
+ ].map((g) => f(g, e.fromVect, w)), l = [
226
+ `M ${c[0].x} ${c[0].y}`,
227
+ `A ${t} ${t} 0 0 1 ${c[1].x} ${c[1].y}`,
228
+ `A ${o} ${o} 0 1 0 ${c[2].x} ${c[2].y}`,
229
+ `A ${t} ${t} 0 0 1 ${c[0].x} ${c[0].y}`
230
+ ].join(" "), a = `M 0 0 L ${c[0].x} ${c[0].y} `;
231
231
  return `${e.hasSourceArrow || e.hasTargetArrow ? "" : a}${l}`;
232
- }, g = Object.freeze({
232
+ }, u = Object.freeze({
233
233
  color: "#5c5c5c",
234
234
  width: 1,
235
235
  arrowLength: 15,
@@ -248,55 +248,55 @@ const _ = (e, t) => ({
248
248
  });
249
249
  class ot {
250
250
  constructor(t) {
251
- s(this, "svg", I());
252
- s(this, "group", $());
253
- s(this, "line");
254
- s(this, "sourceArrow", null);
255
- s(this, "targetArrow", null);
256
- s(this, "arrowLength");
257
- s(this, "arrowWidth");
258
- s(this, "curvature");
259
- s(this, "portCycleRadius");
260
- s(this, "portCycleSmallRadius");
261
- s(this, "detourDirection");
262
- s(this, "detourDistance");
263
- s(this, "hasSourceArrow");
264
- s(this, "hasTargetArrow");
265
- this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? g.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? g.arrowWidth, this.curvature = (t == null ? void 0 : t.curvature) ?? g.curvature, this.portCycleRadius = (t == null ? void 0 : t.cycleRadius) ?? g.cycleRadius, this.portCycleSmallRadius = (t == null ? void 0 : t.smallCycleRadius) ?? g.smallCycleRadius, this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? g.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? g.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? g.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? g.hasTargetArrow;
266
- const o = (t == null ? void 0 : t.color) ?? g.color, r = (t == null ? void 0 : t.width) ?? g.width;
251
+ n(this, "svg", I());
252
+ n(this, "group", $());
253
+ n(this, "line");
254
+ n(this, "sourceArrow", null);
255
+ n(this, "targetArrow", null);
256
+ n(this, "arrowLength");
257
+ n(this, "arrowWidth");
258
+ n(this, "curvature");
259
+ n(this, "portCycleRadius");
260
+ n(this, "portCycleSmallRadius");
261
+ n(this, "detourDirection");
262
+ n(this, "detourDistance");
263
+ n(this, "hasSourceArrow");
264
+ n(this, "hasTargetArrow");
265
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? u.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? u.arrowWidth, this.curvature = (t == null ? void 0 : t.curvature) ?? u.curvature, this.portCycleRadius = (t == null ? void 0 : t.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (t == null ? void 0 : t.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
266
+ const o = (t == null ? void 0 : t.color) ?? u.color, r = (t == null ? void 0 : t.width) ?? u.width;
267
267
  this.svg.appendChild(this.group), this.line = m(o, r), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(o), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(o), this.group.appendChild(this.targetArrow));
268
268
  }
269
269
  render(t) {
270
- const { x: o, y: r, width: n, height: i, flipX: c, flipY: d } = b(
270
+ const { x: o, y: r, width: i, height: s, flipX: h, flipY: d } = b(
271
271
  t.source,
272
272
  t.target
273
273
  );
274
- this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${n}px`, this.svg.style.height = `${i}px`, this.group.style.transform = `scale(${c}, ${d})`;
275
- const h = A(
274
+ this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${i}px`, this.svg.style.height = `${s}px`, this.group.style.transform = `scale(${h}, ${d})`;
275
+ const c = A(
276
276
  t.source.direction,
277
- c,
277
+ h,
278
278
  d
279
279
  ), l = A(
280
280
  t.target.direction,
281
- c,
281
+ h,
282
282
  d
283
283
  ), a = {
284
- x: n,
285
- y: i
284
+ x: i,
285
+ y: s
286
286
  };
287
- let w, y = l, x = -this.arrowLength;
288
- if (t.source.portId === t.target.portId ? (w = et({
289
- fromVect: h,
287
+ let g, y = l, x = -this.arrowLength;
288
+ if (t.source.portId === t.target.portId ? (g = et({
289
+ fromVect: c,
290
290
  radius: this.portCycleRadius,
291
291
  smallRadius: this.portCycleSmallRadius,
292
292
  arrowLength: this.arrowLength,
293
293
  hasSourceArrow: this.hasSourceArrow,
294
294
  hasTargetArrow: this.hasTargetArrow
295
- }), y = h, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? w = Q({
295
+ }), y = c, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? g = Q({
296
296
  to: a,
297
- fromVect: h,
297
+ fromVect: c,
298
298
  toVect: l,
299
- flipX: c,
299
+ flipX: h,
300
300
  flipY: d,
301
301
  arrowLength: this.arrowLength,
302
302
  detourDirection: this.detourDirection,
@@ -304,18 +304,18 @@ class ot {
304
304
  curvature: this.curvature,
305
305
  hasSourceArrow: this.hasSourceArrow,
306
306
  hasTargetArrow: this.hasTargetArrow
307
- }) : w = J({
307
+ }) : g = J({
308
308
  to: a,
309
- fromVect: h,
309
+ fromVect: c,
310
310
  toVect: l,
311
311
  arrowLength: this.arrowLength,
312
312
  curvature: this.curvature,
313
313
  hasSourceArrow: this.hasSourceArrow,
314
314
  hasTargetArrow: this.hasTargetArrow
315
- }), this.line.setAttribute("d", w), this.sourceArrow) {
315
+ }), this.line.setAttribute("d", g), this.sourceArrow) {
316
316
  const v = E(
317
- h,
318
- u,
317
+ c,
318
+ w,
319
319
  this.arrowLength,
320
320
  this.arrowWidth
321
321
  );
@@ -334,62 +334,62 @@ class ot {
334
334
  }
335
335
  class rt {
336
336
  constructor(t) {
337
- s(this, "svg", I());
338
- s(this, "group", $());
339
- s(this, "line");
340
- s(this, "sourceArrow", null);
341
- s(this, "targetArrow", null);
342
- s(this, "arrowLength");
343
- s(this, "arrowWidth");
344
- s(this, "arrowOffset");
345
- s(this, "roundness");
346
- s(this, "cycleSquareSide");
347
- s(this, "detourDirection");
348
- s(this, "detourDistance");
349
- s(this, "hasSourceArrow");
350
- s(this, "hasTargetArrow");
351
- this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? g.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? g.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? g.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? g.cycleSquareSide;
352
- const o = (t == null ? void 0 : t.roundness) ?? g.roundness;
337
+ n(this, "svg", I());
338
+ n(this, "group", $());
339
+ n(this, "line");
340
+ n(this, "sourceArrow", null);
341
+ n(this, "targetArrow", null);
342
+ n(this, "arrowLength");
343
+ n(this, "arrowWidth");
344
+ n(this, "arrowOffset");
345
+ n(this, "roundness");
346
+ n(this, "cycleSquareSide");
347
+ n(this, "detourDirection");
348
+ n(this, "detourDistance");
349
+ n(this, "hasSourceArrow");
350
+ n(this, "hasTargetArrow");
351
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? u.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? u.cycleSquareSide;
352
+ const o = (t == null ? void 0 : t.roundness) ?? u.roundness;
353
353
  this.roundness = Math.min(
354
354
  o,
355
355
  this.arrowOffset,
356
356
  this.cycleSquareSide / 2
357
- ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? g.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? g.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? g.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? g.hasTargetArrow;
358
- const r = (t == null ? void 0 : t.color) ?? g.color, n = (t == null ? void 0 : t.width) ?? g.width;
359
- this.svg.appendChild(this.group), this.line = m(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(r), this.group.appendChild(this.targetArrow));
357
+ ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
358
+ const r = (t == null ? void 0 : t.color) ?? u.color, i = (t == null ? void 0 : t.width) ?? u.width;
359
+ this.svg.appendChild(this.group), this.line = m(r, i), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(r), this.group.appendChild(this.targetArrow));
360
360
  }
361
361
  render(t) {
362
- const { x: o, y: r, width: n, height: i, flipX: c, flipY: d } = b(
362
+ const { x: o, y: r, width: i, height: s, flipX: h, flipY: d } = b(
363
363
  t.source,
364
364
  t.target
365
365
  );
366
- this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${n}px`, this.svg.style.height = `${i}px`, this.group.style.transform = `scale(${c}, ${d})`;
367
- const h = A(
366
+ this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${i}px`, this.svg.style.height = `${s}px`, this.group.style.transform = `scale(${h}, ${d})`;
367
+ const c = A(
368
368
  t.source.direction,
369
- c,
369
+ h,
370
370
  d
371
371
  ), l = A(
372
372
  t.target.direction,
373
- c,
373
+ h,
374
374
  d
375
375
  ), a = {
376
- x: n,
377
- y: i
376
+ x: i,
377
+ y: s
378
378
  };
379
- let w, y = l, x = -this.arrowLength;
380
- if (t.source.portId === t.target.portId ? (w = Y({
381
- fromVect: h,
379
+ let g, y = l, x = -this.arrowLength;
380
+ if (t.source.portId === t.target.portId ? (g = Y({
381
+ fromVect: c,
382
382
  arrowLength: this.arrowLength,
383
383
  side: this.cycleSquareSide,
384
384
  arrowOffset: this.arrowOffset,
385
385
  roundness: this.roundness,
386
386
  hasSourceArrow: this.hasSourceArrow,
387
387
  hasTargetArrow: this.hasTargetArrow
388
- }), y = h, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? w = R({
388
+ }), y = c, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? g = R({
389
389
  to: a,
390
- fromVect: h,
390
+ fromVect: c,
391
391
  toVect: l,
392
- flipX: c,
392
+ flipX: h,
393
393
  flipY: d,
394
394
  arrowLength: this.arrowLength,
395
395
  arrowOffset: this.arrowOffset,
@@ -398,20 +398,20 @@ class rt {
398
398
  detourDistance: this.detourDistance,
399
399
  hasSourceArrow: this.hasSourceArrow,
400
400
  hasTargetArrow: this.hasTargetArrow
401
- }) : w = Z({
401
+ }) : g = Z({
402
402
  to: a,
403
- fromVect: h,
403
+ fromVect: c,
404
404
  toVect: l,
405
- flipX: c,
405
+ flipX: h,
406
406
  arrowLength: this.arrowLength,
407
407
  arrowOffset: this.arrowOffset,
408
408
  roundness: this.roundness,
409
409
  hasSourceArrow: this.hasSourceArrow,
410
410
  hasTargetArrow: this.hasTargetArrow
411
- }), this.line.setAttribute("d", w), this.sourceArrow) {
411
+ }), this.line.setAttribute("d", g), this.sourceArrow) {
412
412
  const v = E(
413
- h,
414
- u,
413
+ c,
414
+ w,
415
415
  this.arrowLength,
416
416
  this.arrowWidth
417
417
  );
@@ -430,62 +430,62 @@ class rt {
430
430
  }
431
431
  class it {
432
432
  constructor(t) {
433
- s(this, "svg", I());
434
- s(this, "group", $());
435
- s(this, "line");
436
- s(this, "sourceArrow", null);
437
- s(this, "targetArrow", null);
438
- s(this, "arrowLength");
439
- s(this, "arrowWidth");
440
- s(this, "arrowOffset");
441
- s(this, "roundness");
442
- s(this, "cycleSquareSide");
443
- s(this, "detourDirection");
444
- s(this, "detourDistance");
445
- s(this, "hasSourceArrow");
446
- s(this, "hasTargetArrow");
447
- this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? g.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? g.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? g.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? g.cycleSquareSide;
448
- const o = (t == null ? void 0 : t.roundness) ?? g.roundness;
433
+ n(this, "svg", I());
434
+ n(this, "group", $());
435
+ n(this, "line");
436
+ n(this, "sourceArrow", null);
437
+ n(this, "targetArrow", null);
438
+ n(this, "arrowLength");
439
+ n(this, "arrowWidth");
440
+ n(this, "arrowOffset");
441
+ n(this, "roundness");
442
+ n(this, "cycleSquareSide");
443
+ n(this, "detourDirection");
444
+ n(this, "detourDistance");
445
+ n(this, "hasSourceArrow");
446
+ n(this, "hasTargetArrow");
447
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? u.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? u.cycleSquareSide;
448
+ const o = (t == null ? void 0 : t.roundness) ?? u.roundness;
449
449
  this.roundness = Math.min(
450
450
  o,
451
451
  this.arrowOffset,
452
452
  this.cycleSquareSide / 2
453
- ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? g.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? g.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? g.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? g.hasTargetArrow;
454
- const r = (t == null ? void 0 : t.color) ?? g.color, n = (t == null ? void 0 : t.width) ?? g.width;
455
- this.svg.appendChild(this.group), this.line = m(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(r), this.group.appendChild(this.targetArrow));
453
+ ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
454
+ const r = (t == null ? void 0 : t.color) ?? u.color, i = (t == null ? void 0 : t.width) ?? u.width;
455
+ this.svg.appendChild(this.group), this.line = m(r, i), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(r), this.group.appendChild(this.targetArrow));
456
456
  }
457
457
  render(t) {
458
- const { x: o, y: r, width: n, height: i, flipX: c, flipY: d } = b(
458
+ const { x: o, y: r, width: i, height: s, flipX: h, flipY: d } = b(
459
459
  t.source,
460
460
  t.target
461
461
  );
462
- this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${n}px`, this.svg.style.height = `${i}px`, this.group.style.transform = `scale(${c}, ${d})`;
463
- const h = A(
462
+ this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${i}px`, this.svg.style.height = `${s}px`, this.group.style.transform = `scale(${h}, ${d})`;
463
+ const c = A(
464
464
  t.source.direction,
465
- c,
465
+ h,
466
466
  d
467
467
  ), l = A(
468
468
  t.target.direction,
469
- c,
469
+ h,
470
470
  d
471
471
  ), a = {
472
- x: n,
473
- y: i
472
+ x: i,
473
+ y: s
474
474
  };
475
- let w, y = l, x = -this.arrowLength;
476
- if (t.source.portId === t.target.portId ? (w = Y({
477
- fromVect: h,
475
+ let g, y = l, x = -this.arrowLength;
476
+ if (t.source.portId === t.target.portId ? (g = Y({
477
+ fromVect: c,
478
478
  arrowLength: this.arrowLength,
479
479
  side: this.cycleSquareSide,
480
480
  arrowOffset: this.arrowOffset,
481
481
  roundness: this.roundness,
482
482
  hasSourceArrow: this.hasSourceArrow,
483
483
  hasTargetArrow: this.hasTargetArrow
484
- }), y = h, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? w = R({
484
+ }), y = c, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? g = R({
485
485
  to: a,
486
- fromVect: h,
486
+ fromVect: c,
487
487
  toVect: l,
488
- flipX: c,
488
+ flipX: h,
489
489
  flipY: d,
490
490
  arrowLength: this.arrowLength,
491
491
  arrowOffset: this.arrowOffset,
@@ -494,19 +494,19 @@ class it {
494
494
  detourDistance: this.detourDistance,
495
495
  hasSourceArrow: this.hasSourceArrow,
496
496
  hasTargetArrow: this.hasTargetArrow
497
- }) : w = q({
497
+ }) : g = q({
498
498
  to: a,
499
- fromVect: h,
499
+ fromVect: c,
500
500
  toVect: l,
501
501
  arrowLength: this.arrowLength,
502
502
  arrowOffset: this.arrowOffset,
503
503
  roundness: this.roundness,
504
504
  hasSourceArrow: this.hasSourceArrow,
505
505
  hasTargetArrow: this.hasTargetArrow
506
- }), this.line.setAttribute("d", w), this.sourceArrow) {
506
+ }), this.line.setAttribute("d", g), this.sourceArrow) {
507
507
  const v = E(
508
- h,
509
- u,
508
+ c,
509
+ w,
510
510
  this.arrowLength,
511
511
  this.arrowWidth
512
512
  );
@@ -525,62 +525,62 @@ class it {
525
525
  }
526
526
  class nt {
527
527
  constructor(t) {
528
- s(this, "svg", I());
529
- s(this, "group", $());
530
- s(this, "line");
531
- s(this, "sourceArrow", null);
532
- s(this, "targetArrow", null);
533
- s(this, "arrowLength");
534
- s(this, "arrowWidth");
535
- s(this, "arrowOffset");
536
- s(this, "roundness");
537
- s(this, "cycleSquareSide");
538
- s(this, "detourDirection");
539
- s(this, "detourDistance");
540
- s(this, "hasSourceArrow");
541
- s(this, "hasTargetArrow");
542
- this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? g.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? g.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? g.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? g.cycleSquareSide;
543
- const o = (t == null ? void 0 : t.roundness) ?? g.roundness;
528
+ n(this, "svg", I());
529
+ n(this, "group", $());
530
+ n(this, "line");
531
+ n(this, "sourceArrow", null);
532
+ n(this, "targetArrow", null);
533
+ n(this, "arrowLength");
534
+ n(this, "arrowWidth");
535
+ n(this, "arrowOffset");
536
+ n(this, "roundness");
537
+ n(this, "cycleSquareSide");
538
+ n(this, "detourDirection");
539
+ n(this, "detourDistance");
540
+ n(this, "hasSourceArrow");
541
+ n(this, "hasTargetArrow");
542
+ this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? u.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? u.arrowWidth, this.arrowOffset = (t == null ? void 0 : t.arrowOffset) ?? u.arrowOffset, this.cycleSquareSide = (t == null ? void 0 : t.cycleSquareSide) ?? u.cycleSquareSide;
543
+ const o = (t == null ? void 0 : t.roundness) ?? u.roundness;
544
544
  this.roundness = Math.min(
545
545
  o,
546
546
  this.arrowOffset,
547
547
  this.cycleSquareSide / 2
548
- ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? g.detourDirectionVertical, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? g.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? g.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? g.hasTargetArrow;
549
- const r = (t == null ? void 0 : t.color) ?? g.color, n = (t == null ? void 0 : t.width) ?? g.width;
550
- this.svg.appendChild(this.group), this.line = m(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(r), this.group.appendChild(this.targetArrow));
548
+ ), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
549
+ const r = (t == null ? void 0 : t.color) ?? u.color, i = (t == null ? void 0 : t.width) ?? u.width;
550
+ this.svg.appendChild(this.group), this.line = m(r, i), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = T(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = T(r), this.group.appendChild(this.targetArrow));
551
551
  }
552
552
  render(t) {
553
- const { x: o, y: r, width: n, height: i, flipX: c, flipY: d } = b(
553
+ const { x: o, y: r, width: i, height: s, flipX: h, flipY: d } = b(
554
554
  t.source,
555
555
  t.target
556
556
  );
557
- this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${n}px`, this.svg.style.height = `${i}px`, this.group.style.transform = `scale(${c}, ${d})`;
558
- const h = A(
557
+ this.svg.style.transform = `translate(${o}px, ${r}px)`, this.svg.style.width = `${i}px`, this.svg.style.height = `${s}px`, this.group.style.transform = `scale(${h}, ${d})`;
558
+ const c = A(
559
559
  t.source.direction,
560
- c,
560
+ h,
561
561
  d
562
562
  ), l = A(
563
563
  t.target.direction,
564
- c,
564
+ h,
565
565
  d
566
566
  ), a = {
567
- x: n,
568
- y: i
567
+ x: i,
568
+ y: s
569
569
  };
570
- let w, y = l, x = -this.arrowLength;
571
- if (t.source.portId === t.target.portId ? (w = Y({
572
- fromVect: h,
570
+ let g, y = l, x = -this.arrowLength;
571
+ if (t.source.portId === t.target.portId ? (g = Y({
572
+ fromVect: c,
573
573
  arrowLength: this.arrowLength,
574
574
  side: this.cycleSquareSide,
575
575
  arrowOffset: this.arrowOffset,
576
576
  roundness: this.roundness,
577
577
  hasSourceArrow: this.hasSourceArrow,
578
578
  hasTargetArrow: this.hasTargetArrow
579
- }), y = h, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? w = R({
579
+ }), y = c, x = this.arrowLength) : t.source.nodeId === t.target.nodeId ? g = R({
580
580
  to: a,
581
- fromVect: h,
581
+ fromVect: c,
582
582
  toVect: l,
583
- flipX: c,
583
+ flipX: h,
584
584
  flipY: d,
585
585
  arrowLength: this.arrowLength,
586
586
  arrowOffset: this.arrowOffset,
@@ -589,9 +589,9 @@ class nt {
589
589
  detourDistance: this.detourDistance,
590
590
  hasSourceArrow: this.hasSourceArrow,
591
591
  hasTargetArrow: this.hasTargetArrow
592
- }) : w = tt({
592
+ }) : g = tt({
593
593
  to: a,
594
- fromVect: h,
594
+ fromVect: c,
595
595
  toVect: l,
596
596
  flipY: d,
597
597
  arrowLength: this.arrowLength,
@@ -599,10 +599,10 @@ class nt {
599
599
  roundness: this.roundness,
600
600
  hasSourceArrow: this.hasSourceArrow,
601
601
  hasTargetArrow: this.hasTargetArrow
602
- }), this.line.setAttribute("d", w), this.sourceArrow) {
602
+ }), this.line.setAttribute("d", g), this.sourceArrow) {
603
603
  const v = E(
604
- h,
605
- u,
604
+ c,
605
+ w,
606
606
  this.arrowLength,
607
607
  this.arrowWidth
608
608
  );
@@ -686,41 +686,41 @@ const st = (e) => {
686
686
  }, ht = (e, t) => {
687
687
  let o = G, r = G;
688
688
  e === "incremental" && (o = V()), t === "incremental" && (r = V());
689
- const n = V();
690
- return e === "shared-incremental" && (o = n), t === "shared-incremental" && (r = n), typeof e == "number" && (o = F(e)), typeof t == "number" && (r = F(t)), typeof e == "function" && (o = e), typeof t == "function" && (r = t), {
689
+ const i = V();
690
+ return e === "shared-incremental" && (o = i), t === "shared-incremental" && (r = i), typeof e == "number" && (o = F(e)), typeof t == "number" && (r = F(t)), typeof e == "function" && (o = e), typeof t == "function" && (r = t), {
691
691
  nodesPriorityFn: o,
692
692
  edgesPriorityFn: r
693
693
  };
694
694
  }, dt = (e) => {
695
- var o, r, n, i, c;
695
+ var o, r, i, s, h;
696
696
  const t = ht(
697
697
  (o = e == null ? void 0 : e.nodes) == null ? void 0 : o.priority,
698
698
  (r = e == null ? void 0 : e.edges) == null ? void 0 : r.priority
699
699
  );
700
700
  return {
701
701
  nodes: {
702
- centerFn: ((n = e == null ? void 0 : e.nodes) == null ? void 0 : n.centerFn) ?? _,
702
+ centerFn: ((i = e == null ? void 0 : e.nodes) == null ? void 0 : i.centerFn) ?? _,
703
703
  priorityFn: t.nodesPriorityFn
704
704
  },
705
705
  ports: {
706
- direction: ((i = e == null ? void 0 : e.ports) == null ? void 0 : i.direction) ?? 0
706
+ direction: ((s = e == null ? void 0 : e.ports) == null ? void 0 : s.direction) ?? 0
707
707
  },
708
708
  edges: {
709
- shapeFactory: st(((c = e == null ? void 0 : e.edges) == null ? void 0 : c.shape) ?? {}),
709
+ shapeFactory: st(((h = e == null ? void 0 : e.edges) == null ? void 0 : h.shape) ?? {}),
710
710
  priorityFn: t.edgesPriorityFn
711
711
  }
712
712
  };
713
713
  };
714
714
  class ct {
715
715
  constructor() {
716
- s(this, "nodes", /* @__PURE__ */ new Map());
717
- s(this, "ports", /* @__PURE__ */ new Map());
718
- s(this, "nodePorts", /* @__PURE__ */ new Map());
719
- s(this, "portNodeId", /* @__PURE__ */ new Map());
720
- s(this, "edges", /* @__PURE__ */ new Map());
721
- s(this, "incommingEdges", /* @__PURE__ */ new Map());
722
- s(this, "outcommingEdges", /* @__PURE__ */ new Map());
723
- s(this, "cycleEdges", /* @__PURE__ */ new Map());
716
+ n(this, "nodes", /* @__PURE__ */ new Map());
717
+ n(this, "ports", /* @__PURE__ */ new Map());
718
+ n(this, "nodePorts", /* @__PURE__ */ new Map());
719
+ n(this, "portNodeId", /* @__PURE__ */ new Map());
720
+ n(this, "edges", /* @__PURE__ */ new Map());
721
+ n(this, "incommingEdges", /* @__PURE__ */ new Map());
722
+ n(this, "outcommingEdges", /* @__PURE__ */ new Map());
723
+ n(this, "cycleEdges", /* @__PURE__ */ new Map());
724
724
  }
725
725
  addNode(t) {
726
726
  this.nodes.set(t.nodeId, {
@@ -799,8 +799,8 @@ class ct {
799
799
  return this.edges.get(t);
800
800
  }
801
801
  removeEdge(t) {
802
- const o = this.edges.get(t), r = o.from, n = o.to;
803
- this.cycleEdges.get(r).delete(t), this.cycleEdges.get(n).delete(t), this.incommingEdges.get(r).delete(t), this.incommingEdges.get(n).delete(t), this.outcommingEdges.get(r).delete(t), this.outcommingEdges.get(n).delete(t), this.edges.delete(t);
802
+ const o = this.edges.get(t), r = o.from, i = o.to;
803
+ this.cycleEdges.get(r).delete(t), this.cycleEdges.get(i).delete(t), this.incommingEdges.get(r).delete(t), this.incommingEdges.get(i).delete(t), this.outcommingEdges.get(r).delete(t), this.outcommingEdges.get(i).delete(t), this.edges.delete(t);
804
804
  }
805
805
  clear() {
806
806
  this.nodes.clear(), this.ports.clear(), this.nodePorts.clear(), this.portNodeId.clear(), this.edges.clear(), this.incommingEdges.clear(), this.outcommingEdges.clear(), this.cycleEdges.clear();
@@ -824,22 +824,22 @@ class ct {
824
824
  getNodeIncomingEdgeIds(t) {
825
825
  const o = Array.from(this.nodePorts.get(t).keys());
826
826
  let r = [];
827
- return o.forEach((n) => {
828
- r = [...r, ...this.getPortIncomingEdgeIds(n)];
827
+ return o.forEach((i) => {
828
+ r = [...r, ...this.getPortIncomingEdgeIds(i)];
829
829
  }), r;
830
830
  }
831
831
  getNodeOutcomingEdgeIds(t) {
832
832
  const o = Array.from(this.nodePorts.get(t).keys());
833
833
  let r = [];
834
- return o.forEach((n) => {
835
- r = [...r, ...this.getPortOutcomingEdgeIds(n)];
834
+ return o.forEach((i) => {
835
+ r = [...r, ...this.getPortOutcomingEdgeIds(i)];
836
836
  }), r;
837
837
  }
838
838
  getNodeCycleEdgeIds(t) {
839
839
  const o = Array.from(this.nodePorts.get(t).keys());
840
840
  let r = [];
841
- return o.forEach((n) => {
842
- r = [...r, ...this.getPortCycleEdgeIds(n)];
841
+ return o.forEach((i) => {
842
+ r = [...r, ...this.getPortCycleEdgeIds(i)];
843
843
  }), r;
844
844
  }
845
845
  getNodeAdjacentEdgeIds(t) {
@@ -926,8 +926,8 @@ const j = (e) => ({
926
926
  };
927
927
  class at {
928
928
  constructor() {
929
- s(this, "viewportMatrix", H);
930
- s(this, "contentMatrix", H);
929
+ n(this, "viewportMatrix", H);
930
+ n(this, "contentMatrix", H);
931
931
  }
932
932
  getViewportMatrix() {
933
933
  return this.viewportMatrix;
@@ -973,11 +973,11 @@ const ut = () => {
973
973
  };
974
974
  class ft {
975
975
  constructor(t, o) {
976
- s(this, "canvasWrapper", null);
977
- s(this, "host", ut());
978
- s(this, "container", wt());
979
- s(this, "nodeIdToWrapperElementMap", /* @__PURE__ */ new Map());
980
- s(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
976
+ n(this, "canvasWrapper", null);
977
+ n(this, "host", ut());
978
+ n(this, "container", wt());
979
+ n(this, "nodeIdToWrapperElementMap", /* @__PURE__ */ new Map());
980
+ n(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
981
981
  this.graphStore = t, this.viewportTransformer = o, this.host.appendChild(this.container);
982
982
  }
983
983
  attach(t) {
@@ -1017,8 +1017,8 @@ class ft {
1017
1017
  this.clear(), this.detach(), this.host.removeChild(this.container);
1018
1018
  }
1019
1019
  updateNodeCoordinates(t) {
1020
- const o = this.nodeIdToWrapperElementMap.get(t), r = this.graphStore.getNode(t), { width: n, height: i } = r.element.getBoundingClientRect(), c = this.viewportTransformer.getViewportMatrix().scale, d = r.centerFn(n, i), h = r.x - c * d.x, l = r.y - c * d.y;
1021
- o.style.transform = `translate(${h}px, ${l}px)`;
1020
+ const o = this.nodeIdToWrapperElementMap.get(t), r = this.graphStore.getNode(t), { width: i, height: s } = r.element.getBoundingClientRect(), h = this.viewportTransformer.getViewportMatrix().scale, d = r.centerFn(i, s), c = r.x - h * d.x, l = r.y - h * d.y;
1021
+ o.style.transform = `translate(${c}px, ${l}px)`;
1022
1022
  }
1023
1023
  updateNodePriority(t) {
1024
1024
  const o = this.graphStore.getNode(t), r = this.nodeIdToWrapperElementMap.get(t);
@@ -1031,31 +1031,31 @@ class ft {
1031
1031
  this.edgeIdToElementMap.set(t, r.shape.svg), this.container.appendChild(r.shape.svg);
1032
1032
  }
1033
1033
  renderEdge(t) {
1034
- const o = this.graphStore.getEdge(t), r = this.graphStore.getPort(o.from), n = this.graphStore.getPort(o.to), i = r.element.getBoundingClientRect(), c = n.element.getBoundingClientRect(), d = this.host.getBoundingClientRect(), h = this.viewportTransformer.getViewportMatrix(), l = {
1035
- x: h.scale * (i.left - d.left) + h.dx,
1036
- y: h.scale * (i.top - d.top) + h.dy
1034
+ const o = this.graphStore.getEdge(t), r = this.graphStore.getPort(o.from), i = this.graphStore.getPort(o.to), s = r.element.getBoundingClientRect(), h = i.element.getBoundingClientRect(), d = this.host.getBoundingClientRect(), c = this.viewportTransformer.getViewportMatrix(), l = {
1035
+ x: c.scale * (s.left - d.left) + c.dx,
1036
+ y: c.scale * (s.top - d.top) + c.dy
1037
1037
  }, a = {
1038
- x: h.scale * (c.left - d.left) + h.dx,
1039
- y: h.scale * (c.top - d.top) + h.dy
1040
- }, w = {
1038
+ x: c.scale * (h.left - d.left) + c.dx,
1039
+ y: c.scale * (h.top - d.top) + c.dy
1040
+ }, g = {
1041
1041
  x: l.x,
1042
1042
  y: l.y,
1043
- width: i.width * h.scale,
1044
- height: i.height * h.scale,
1043
+ width: s.width * c.scale,
1044
+ height: s.height * c.scale,
1045
1045
  direction: r.direction,
1046
1046
  portId: o.from,
1047
1047
  nodeId: this.graphStore.getPortNodeId(o.from)
1048
1048
  }, y = {
1049
1049
  x: a.x,
1050
1050
  y: a.y,
1051
- width: c.width * h.scale,
1052
- height: c.height * h.scale,
1053
- direction: n.direction,
1051
+ width: h.width * c.scale,
1052
+ height: h.height * c.scale,
1053
+ direction: i.direction,
1054
1054
  portId: o.to,
1055
1055
  nodeId: this.graphStore.getPortNodeId(o.to)
1056
1056
  };
1057
1057
  o.shape.render({
1058
- source: w,
1058
+ source: g,
1059
1059
  target: y
1060
1060
  });
1061
1061
  }
@@ -1066,7 +1066,7 @@ class ft {
1066
1066
  }
1067
1067
  class N {
1068
1068
  constructor(t) {
1069
- s(this, "counter", 0);
1069
+ n(this, "counter", 0);
1070
1070
  this.checkExists = t;
1071
1071
  }
1072
1072
  create(t) {
@@ -1083,21 +1083,21 @@ class N {
1083
1083
  class S extends Error {
1084
1084
  constructor() {
1085
1085
  super(...arguments);
1086
- s(this, "name", "HtmlGraphError");
1086
+ n(this, "name", "HtmlGraphError");
1087
1087
  }
1088
1088
  }
1089
1089
  class vt {
1090
- constructor(t, o, r, n, i, c, d) {
1091
- s(this, "nodeIdGenerator", new N(
1090
+ constructor(t, o, r, i, s, h, d) {
1091
+ n(this, "nodeIdGenerator", new N(
1092
1092
  (t) => this.graphStore.getNode(t) !== void 0
1093
1093
  ));
1094
- s(this, "portIdGenerator", new N(
1094
+ n(this, "portIdGenerator", new N(
1095
1095
  (t) => this.graphStore.getPort(t) !== void 0
1096
1096
  ));
1097
- s(this, "edgeIdGenerator", new N(
1097
+ n(this, "edgeIdGenerator", new N(
1098
1098
  (t) => this.graphStore.getEdge(t) !== void 0
1099
1099
  ));
1100
- this.graphStore = t, this.htmlController = o, this.viewportTransformer = r, this.defaultNodesCenterFn = n, this.defaultPortsDirection = i, this.defaultNodesPriorityFn = c, this.defaultEdgesPriorityFn = d;
1100
+ this.graphStore = t, this.htmlController = o, this.viewportTransformer = r, this.defaultNodesCenterFn = i, this.defaultPortsDirection = s, this.defaultNodesPriorityFn = h, this.defaultEdgesPriorityFn = d;
1101
1101
  }
1102
1102
  attach(t) {
1103
1103
  this.htmlController.attach(t);
@@ -1164,16 +1164,16 @@ class vt {
1164
1164
  const r = this.graphStore.getPort(t);
1165
1165
  if (r === void 0)
1166
1166
  throw new S("failed to unset nonexisting port");
1167
- r.direction = o.direction ?? r.direction, this.graphStore.getPortAdjacentEdgeIds(t).forEach((i) => {
1168
- this.htmlController.renderEdge(i);
1167
+ r.direction = o.direction ?? r.direction, this.graphStore.getPortAdjacentEdgeIds(t).forEach((s) => {
1168
+ this.htmlController.renderEdge(s);
1169
1169
  });
1170
1170
  }
1171
1171
  updateNode(t, o) {
1172
1172
  const r = this.graphStore.getNode(t);
1173
1173
  if (r === void 0)
1174
1174
  throw new S("failed to update nonexisting node");
1175
- r.x = (o == null ? void 0 : o.x) ?? r.x, r.y = (o == null ? void 0 : o.y) ?? r.y, r.centerFn = (o == null ? void 0 : o.centerFn) ?? r.centerFn, r.priority = (o == null ? void 0 : o.priority) ?? r.priority, this.htmlController.updateNodeCoordinates(t), this.htmlController.updateNodePriority(t), this.graphStore.getNodeAdjacentEdgeIds(t).forEach((i) => {
1176
- this.htmlController.renderEdge(i);
1175
+ r.x = (o == null ? void 0 : o.x) ?? r.x, r.y = (o == null ? void 0 : o.y) ?? r.y, r.centerFn = (o == null ? void 0 : o.centerFn) ?? r.centerFn, r.priority = (o == null ? void 0 : o.priority) ?? r.priority, this.htmlController.updateNodeCoordinates(t), this.htmlController.updateNodePriority(t), this.graphStore.getNodeAdjacentEdgeIds(t).forEach((s) => {
1176
+ this.htmlController.renderEdge(s);
1177
1177
  });
1178
1178
  }
1179
1179
  removeEdge(t) {
@@ -1210,17 +1210,17 @@ class vt {
1210
1210
  }
1211
1211
  class xt {
1212
1212
  constructor(t) {
1213
- s(this, "transformation");
1214
- s(this, "model");
1215
- s(this, "canvasController");
1216
- s(this, "edgeShapeFactory");
1213
+ n(this, "transformation");
1214
+ n(this, "model");
1215
+ n(this, "canvasController");
1216
+ n(this, "edgeShapeFactory");
1217
1217
  this.apiOptions = t;
1218
- const o = dt(this.apiOptions), r = new at(), n = new ct();
1219
- this.model = new lt(n), this.transformation = new gt(r);
1220
- const i = new ft(n, r);
1218
+ const o = dt(this.apiOptions), r = new at(), i = new ct();
1219
+ this.model = new lt(i), this.transformation = new gt(r);
1220
+ const s = new ft(i, r);
1221
1221
  this.canvasController = new vt(
1222
- n,
1223
1222
  i,
1223
+ s,
1224
1224
  r,
1225
1225
  o.nodes.centerFn,
1226
1226
  o.ports.direction,
@@ -1307,36 +1307,36 @@ class xt {
1307
1307
  }
1308
1308
  }
1309
1309
  const P = (e, t, o) => {
1310
- const { x: r, y: n, width: i, height: c } = e.getBoundingClientRect();
1311
- return t >= r && t <= r + i && o >= n && o <= n + c;
1310
+ const { x: r, y: i, width: s, height: h } = e.getBoundingClientRect();
1311
+ return t >= r && t <= r + s && o >= i && o <= i + h;
1312
1312
  }, L = (e, t, o) => t >= 0 && t <= e.innerWidth && o >= 0 && o <= e.innerHeight, D = (e, t) => {
1313
1313
  t !== null ? e.style.cursor = t : e.style.removeProperty("cursor");
1314
1314
  };
1315
1315
  class St {
1316
1316
  constructor(t, o) {
1317
- s(this, "model");
1318
- s(this, "transformation");
1319
- s(this, "maxNodePriority", 0);
1320
- s(this, "nodes", /* @__PURE__ */ new Map());
1321
- s(this, "grabbedNodeId", null);
1322
- s(this, "onNodeDrag");
1323
- s(this, "onBeforeNodeDrag");
1324
- s(this, "onNodeDragFinished");
1325
- s(this, "nodeIdGenerator", new N(
1317
+ n(this, "model");
1318
+ n(this, "transformation");
1319
+ n(this, "maxNodePriority", 0);
1320
+ n(this, "nodes", /* @__PURE__ */ new Map());
1321
+ n(this, "grabbedNodeId", null);
1322
+ n(this, "onNodeDrag");
1323
+ n(this, "onBeforeNodeDrag");
1324
+ n(this, "onNodeDragFinished");
1325
+ n(this, "nodeIdGenerator", new N(
1326
1326
  (t) => this.nodes.has(t)
1327
1327
  ));
1328
- s(this, "element", null);
1329
- s(this, "onWindowMouseMove", (t) => {
1328
+ n(this, "element", null);
1329
+ n(this, "onWindowMouseMove", (t) => {
1330
1330
  if (this.element !== null && (!P(this.element, t.clientX, t.clientY) || !L(this.window, t.clientX, t.clientY))) {
1331
1331
  this.cancelMouseDrag();
1332
1332
  return;
1333
1333
  }
1334
1334
  this.grabbedNodeId !== null && this.dragNode(this.grabbedNodeId, t.movementX, t.movementY);
1335
1335
  });
1336
- s(this, "onWindowMouseUp", (t) => {
1336
+ n(this, "onWindowMouseUp", (t) => {
1337
1337
  t.button === 0 && this.cancelMouseDrag();
1338
1338
  });
1339
- s(this, "onWindowTouchMove", (t) => {
1339
+ n(this, "onWindowTouchMove", (t) => {
1340
1340
  if (t.touches.length !== 1)
1341
1341
  return;
1342
1342
  const o = t.touches[0];
@@ -1345,26 +1345,26 @@ class St {
1345
1345
  return;
1346
1346
  }
1347
1347
  if (this.grabbedNodeId !== null && this.previousTouchCoords !== null) {
1348
- const r = o.clientX - this.previousTouchCoords.x, n = o.clientY - this.previousTouchCoords.y;
1349
- this.dragNode(this.grabbedNodeId, r, n), this.previousTouchCoords = {
1348
+ const r = o.clientX - this.previousTouchCoords.x, i = o.clientY - this.previousTouchCoords.y;
1349
+ this.dragNode(this.grabbedNodeId, r, i), this.previousTouchCoords = {
1350
1350
  x: t.touches[0].clientX,
1351
1351
  y: t.touches[0].clientY
1352
1352
  };
1353
1353
  }
1354
1354
  });
1355
- s(this, "onWindowTouchFinish", (t) => {
1355
+ n(this, "onWindowTouchFinish", (t) => {
1356
1356
  t.touches.length > 0 ? this.previousTouchCoords = {
1357
1357
  x: t.touches[0].clientX,
1358
1358
  y: t.touches[0].clientY
1359
1359
  } : this.cancelTouchDrag();
1360
1360
  });
1361
- s(this, "previousTouchCoords", null);
1362
- s(this, "freezePriority");
1363
- s(this, "window", window);
1364
- s(this, "dragCursor");
1365
- var r, n, i;
1361
+ n(this, "previousTouchCoords", null);
1362
+ n(this, "freezePriority");
1363
+ n(this, "window", window);
1364
+ n(this, "dragCursor");
1365
+ var r, i, s;
1366
1366
  this.canvas = t, this.transformation = this.canvas.transformation, this.model = this.canvas.model, this.onNodeDrag = ((r = o == null ? void 0 : o.events) == null ? void 0 : r.onNodeDrag) ?? (() => {
1367
- }), this.onBeforeNodeDrag = ((n = o == null ? void 0 : o.events) == null ? void 0 : n.onBeforeNodeDrag) ?? (() => !0), this.onNodeDragFinished = ((i = o == null ? void 0 : o.events) == null ? void 0 : i.onNodeDragFinished) ?? (() => {
1367
+ }), this.onBeforeNodeDrag = ((i = o == null ? void 0 : o.events) == null ? void 0 : i.onBeforeNodeDrag) ?? (() => !0), this.onNodeDragFinished = ((s = o == null ? void 0 : o.events) == null ? void 0 : s.onNodeDragFinished) ?? (() => {
1368
1368
  }), this.freezePriority = (o == null ? void 0 : o.moveOnTop) === !1, this.dragCursor = (o == null ? void 0 : o.dragCursor) !== void 0 ? o.dragCursor : "grab";
1369
1369
  }
1370
1370
  attach(t) {
@@ -1376,34 +1376,34 @@ class St {
1376
1376
  addNode(t) {
1377
1377
  const o = this.nodeIdGenerator.create(t.id);
1378
1378
  this.canvas.addNode({ ...t, id: o }), this.updateMaxNodePriority(o);
1379
- const r = (i) => {
1380
- if (this.element === null || i.button !== 0)
1379
+ const r = (s) => {
1380
+ if (this.element === null || s.button !== 0)
1381
1381
  return;
1382
- const c = this.model.getNode(o);
1382
+ const h = this.model.getNode(o);
1383
1383
  this.onBeforeNodeDrag({
1384
1384
  nodeId: o,
1385
1385
  element: t.element,
1386
- x: c.x,
1387
- y: c.y
1388
- }) && (i.stopImmediatePropagation(), this.grabbedNodeId = o, D(this.element, this.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mouseup", this.onWindowMouseUp), this.window.addEventListener("mousemove", this.onWindowMouseMove));
1389
- }, n = (i) => {
1390
- i.stopImmediatePropagation(), this.previousTouchCoords = {
1391
- x: i.touches[0].clientX,
1392
- y: i.touches[0].clientY
1386
+ x: h.x,
1387
+ y: h.y
1388
+ }) && (s.stopImmediatePropagation(), this.grabbedNodeId = o, D(this.element, this.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mouseup", this.onWindowMouseUp), this.window.addEventListener("mousemove", this.onWindowMouseMove));
1389
+ }, i = (s) => {
1390
+ s.stopImmediatePropagation(), this.previousTouchCoords = {
1391
+ x: s.touches[0].clientX,
1392
+ y: s.touches[0].clientY
1393
1393
  };
1394
- const c = this.model.getNode(o);
1394
+ const h = this.model.getNode(o);
1395
1395
  this.onBeforeNodeDrag({
1396
1396
  nodeId: o,
1397
1397
  element: t.element,
1398
- x: c.x,
1399
- y: c.y
1400
- }) && i.touches.length === 1 && (this.grabbedNodeId = o, this.moveNodeOnTop(o), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish));
1398
+ x: h.x,
1399
+ y: h.y
1400
+ }) && s.touches.length === 1 && (this.grabbedNodeId = o, this.moveNodeOnTop(o), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish));
1401
1401
  };
1402
1402
  return this.nodes.set(o, {
1403
1403
  element: t.element,
1404
1404
  onMouseDown: r,
1405
- onTouchStart: n
1406
- }), t.element.addEventListener("mousedown", r), t.element.addEventListener("touchstart", n), this;
1405
+ onTouchStart: i
1406
+ }), t.element.addEventListener("mousedown", r), t.element.addEventListener("touchstart", i), this;
1407
1407
  }
1408
1408
  updateNode(t, o) {
1409
1409
  return this.canvas.updateNode(t, o), this.updateMaxNodePriority(t), this;
@@ -1445,15 +1445,15 @@ class St {
1445
1445
  this.detach(), this.clear(), this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.canvas.destroy();
1446
1446
  }
1447
1447
  dragNode(t, o, r) {
1448
- const n = this.model.getNode(t);
1449
- if (n === null)
1448
+ const i = this.model.getNode(t);
1449
+ if (i === null)
1450
1450
  return;
1451
- const i = this.canvas.transformation.getContentMatrix(), c = i.scale * n.x + i.dx, d = i.scale * n.y + i.dy, h = c + o, l = d + r, a = this.canvas.transformation.getViewportMatrix(), w = a.scale * h + a.dx, y = a.scale * l + a.dy;
1452
- this.canvas.updateNode(t, { x: w, y }), this.onNodeDrag({
1451
+ const s = this.canvas.transformation.getContentMatrix(), h = s.scale * i.x + s.dx, d = s.scale * i.y + s.dy, c = h + o, l = d + r, a = this.canvas.transformation.getViewportMatrix(), g = a.scale * c + a.dx, y = a.scale * l + a.dy;
1452
+ this.canvas.updateNode(t, { x: g, y }), this.onNodeDrag({
1453
1453
  nodeId: t,
1454
- element: n.element,
1455
- x: n.x,
1456
- y: n.y
1454
+ element: i.element,
1455
+ x: i.x,
1456
+ y: i.y
1457
1457
  });
1458
1458
  }
1459
1459
  updateMaxNodePriority(t) {
@@ -1465,8 +1465,8 @@ class St {
1465
1465
  return;
1466
1466
  this.maxNodePriority += 2, this.updateNode(t, { priority: this.maxNodePriority });
1467
1467
  const o = this.maxNodePriority - 1;
1468
- this.model.getNodeAdjacentEdgeIds(t).forEach((n) => {
1469
- this.updateEdge(n, { priority: o });
1468
+ this.model.getNodeAdjacentEdgeIds(t).forEach((i) => {
1469
+ this.updateEdge(i, { priority: o });
1470
1470
  });
1471
1471
  }
1472
1472
  cancelMouseDrag() {
@@ -1496,23 +1496,34 @@ class St {
1496
1496
  }
1497
1497
  }
1498
1498
  const At = (e) => {
1499
- const t = e.minX !== null ? e.minX : -1 / 0, o = e.maxX !== null ? e.maxX : 1 / 0, r = e.minY !== null ? e.minY : -1 / 0, n = e.maxY !== null ? e.maxY : 1 / 0;
1500
- return (i) => {
1501
- let c = i.nextTransform.dx, d = i.nextTransform.dy;
1502
- c < t && c < i.prevTransform.dx && (c = Math.min(i.prevTransform.dx, t));
1503
- const h = i.canvasWidth * i.prevTransform.scale;
1504
- c > o - h && c > i.prevTransform.dx && (c = Math.max(i.prevTransform.dx, o - h)), d < r && d < i.prevTransform.dy && (d = Math.min(i.prevTransform.dy, r));
1505
- const l = i.canvasHeight * i.prevTransform.scale;
1506
- return d > n - l && d > i.prevTransform.dy && (d = Math.max(i.prevTransform.dy, n - l)), { scale: i.nextTransform.scale, dx: c, dy: d };
1499
+ const t = e.minX !== null ? e.minX : -1 / 0, o = e.maxX !== null ? e.maxX : 1 / 0, r = e.minY !== null ? e.minY : -1 / 0, i = e.maxY !== null ? e.maxY : 1 / 0;
1500
+ return (s) => {
1501
+ let h = s.nextTransform.dx, d = s.nextTransform.dy;
1502
+ h < t && h < s.prevTransform.dx && (h = Math.min(s.prevTransform.dx, t));
1503
+ const c = s.canvasWidth * s.prevTransform.scale;
1504
+ h > o - c && h > s.prevTransform.dx && (h = Math.max(s.prevTransform.dx, o - c)), d < r && d < s.prevTransform.dy && (d = Math.min(s.prevTransform.dy, r));
1505
+ const l = s.canvasHeight * s.prevTransform.scale;
1506
+ return d > i - l && d > s.prevTransform.dy && (d = Math.max(s.prevTransform.dy, i - l)), { scale: s.nextTransform.scale, dx: h, dy: d };
1507
1507
  };
1508
1508
  }, Et = (e) => {
1509
- const t = e.maxContentScale, o = e.minContentScale, r = t !== null ? 1 / t : 0, n = o !== null ? 1 / o : 1 / 0;
1510
- return (i) => {
1511
- let c = i.nextTransform.scale, d = i.nextTransform.dx, h = i.nextTransform.dy;
1512
- return i.nextTransform.scale > n && i.nextTransform.scale > i.prevTransform.scale && (c = Math.max(i.prevTransform.scale, n), d = i.prevTransform.dx, h = i.prevTransform.dy), i.nextTransform.scale < r && i.nextTransform.scale < i.prevTransform.scale && (c = Math.min(i.prevTransform.scale, r), d = i.prevTransform.dx, h = i.prevTransform.dy), {
1509
+ const t = e.maxContentScale, o = e.minContentScale, r = t !== null ? 1 / t : 0, i = o !== null ? 1 / o : 1 / 0;
1510
+ return (s) => {
1511
+ const h = s.prevTransform, d = s.nextTransform;
1512
+ let c = d.scale, l = d.dx, a = d.dy;
1513
+ if (d.scale > i && d.scale > h.scale) {
1514
+ c = Math.max(h.scale, i), l = h.dx, a = h.dy;
1515
+ const g = (c - h.scale) / (d.scale - h.scale);
1516
+ l = h.dx + (d.dx - h.dx) * g, a = h.dy + (d.dy - h.dy) * g;
1517
+ }
1518
+ if (d.scale < r && d.scale < h.scale) {
1519
+ c = Math.min(h.scale, r), l = h.dx, a = h.dy;
1520
+ const g = (c - h.scale) / (d.scale - h.scale);
1521
+ l = h.dx + (d.dx - h.dx) * g, a = h.dy + (d.dy - h.dy) * g;
1522
+ }
1523
+ return {
1513
1524
  scale: c,
1514
- dx: d,
1515
- dy: h
1525
+ dx: l,
1526
+ dy: a
1516
1527
  };
1517
1528
  };
1518
1529
  }, Tt = (e) => (t) => e.reduce(
@@ -1541,39 +1552,39 @@ const At = (e) => {
1541
1552
  });
1542
1553
  }
1543
1554
  }, Mt = (e) => {
1544
- var h, l, a, w;
1545
- const t = (h = e == null ? void 0 : e.scale) == null ? void 0 : h.mouseWheelSensitivity, o = t !== void 0 ? t : 1.2, r = e == null ? void 0 : e.transformPreprocessor;
1546
- let n;
1547
- r !== void 0 ? Array.isArray(r) ? n = Tt(
1555
+ var c, l, a, g;
1556
+ const t = (c = e == null ? void 0 : e.scale) == null ? void 0 : c.mouseWheelSensitivity, o = t !== void 0 ? t : 1.2, r = e == null ? void 0 : e.transformPreprocessor;
1557
+ let i;
1558
+ r !== void 0 ? Array.isArray(r) ? i = Tt(
1548
1559
  r.map(
1549
1560
  (y) => U(y)
1550
1561
  )
1551
- ) : n = U(r) : n = (y) => y.nextTransform;
1552
- const i = ((l = e == null ? void 0 : e.shift) == null ? void 0 : l.cursor) !== void 0 ? e.shift.cursor : "grab", c = ((a = e == null ? void 0 : e.events) == null ? void 0 : a.onBeforeTransformStarted) ?? (() => {
1553
- }), d = ((w = e == null ? void 0 : e.events) == null ? void 0 : w.onTransformFinished) ?? (() => {
1562
+ ) : i = U(r) : i = (y) => y.nextTransform;
1563
+ const s = ((l = e == null ? void 0 : e.shift) == null ? void 0 : l.cursor) !== void 0 ? e.shift.cursor : "grab", h = ((a = e == null ? void 0 : e.events) == null ? void 0 : a.onBeforeTransformStarted) ?? (() => {
1564
+ }), d = ((g = e == null ? void 0 : e.events) == null ? void 0 : g.onTransformFinished) ?? (() => {
1554
1565
  });
1555
1566
  return {
1556
1567
  wheelSensitivity: o,
1557
- onBeforeTransformStarted: c,
1568
+ onBeforeTransformStarted: h,
1558
1569
  onTransformFinished: d,
1559
- transformPreprocessor: n,
1560
- shiftCursor: i
1570
+ transformPreprocessor: i,
1571
+ shiftCursor: s
1561
1572
  };
1562
1573
  }, W = (e) => {
1563
1574
  const t = [], o = e.touches.length;
1564
1575
  for (let d = 0; d < o; d++)
1565
1576
  t.push([e.touches[d].clientX, e.touches[d].clientY]);
1566
1577
  const r = t.reduce(
1567
- (d, h) => [d[0] + h[0], d[1] + h[1]],
1578
+ (d, c) => [d[0] + c[0], d[1] + c[1]],
1568
1579
  [0, 0]
1569
- ), n = [r[0] / o, r[1] / o], c = t.map((d) => [d[0] - n[0], d[1] - n[1]]).reduce(
1570
- (d, h) => d + Math.sqrt(h[0] * h[0] + h[1] * h[1]),
1580
+ ), i = [r[0] / o, r[1] / o], h = t.map((d) => [d[0] - i[0], d[1] - i[1]]).reduce(
1581
+ (d, c) => d + Math.sqrt(c[0] * c[0] + c[1] * c[1]),
1571
1582
  0
1572
1583
  );
1573
1584
  return {
1574
- x: n[0],
1575
- y: n[1],
1576
- scale: c / o,
1585
+ x: i[0],
1586
+ y: i[1],
1587
+ scale: h / o,
1577
1588
  touchesCnt: o,
1578
1589
  touches: t
1579
1590
  };
@@ -1588,15 +1599,15 @@ const At = (e) => {
1588
1599
  });
1589
1600
  class Pt {
1590
1601
  constructor(t, o) {
1591
- s(this, "model");
1592
- s(this, "transformation");
1593
- s(this, "element", null);
1594
- s(this, "prevTouches", null);
1595
- s(this, "window", window);
1596
- s(this, "onMouseDown", (t) => {
1602
+ n(this, "model");
1603
+ n(this, "transformation");
1604
+ n(this, "element", null);
1605
+ n(this, "prevTouches", null);
1606
+ n(this, "window", window);
1607
+ n(this, "onMouseDown", (t) => {
1597
1608
  this.element === null || t.button !== 0 || (D(this.element, this.options.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove), this.window.addEventListener("mouseup", this.onWindowMouseUp));
1598
1609
  });
1599
- s(this, "onWindowMouseMove", (t) => {
1610
+ n(this, "onWindowMouseMove", (t) => {
1600
1611
  if (this.element === null || !P(this.element, t.clientX, t.clientY) || !L(this.window, t.clientX, t.clientY)) {
1601
1612
  this.stopMouseDrag();
1602
1613
  return;
@@ -1604,24 +1615,24 @@ class Pt {
1604
1615
  const o = -t.movementX, r = -t.movementY;
1605
1616
  this.moveViewport(this.element, o, r);
1606
1617
  });
1607
- s(this, "onWindowMouseUp", (t) => {
1618
+ n(this, "onWindowMouseUp", (t) => {
1608
1619
  this.element === null || t.button !== 0 || this.stopMouseDrag();
1609
1620
  });
1610
- s(this, "onWheelScroll", (t) => {
1621
+ n(this, "onWheelScroll", (t) => {
1611
1622
  t.preventDefault();
1612
- const { left: o, top: r } = this.element.getBoundingClientRect(), n = t.clientX - o, i = t.clientY - r, d = 1 / (t.deltaY < 0 ? this.options.wheelSensitivity : 1 / this.options.wheelSensitivity);
1613
- this.scaleViewport(this.element, d, n, i);
1623
+ const { left: o, top: r } = this.element.getBoundingClientRect(), i = t.clientX - o, s = t.clientY - r, d = 1 / (t.deltaY < 0 ? this.options.wheelSensitivity : 1 / this.options.wheelSensitivity);
1624
+ this.scaleViewport(this.element, d, i, s);
1614
1625
  });
1615
- s(this, "onTouchStart", (t) => {
1626
+ n(this, "onTouchStart", (t) => {
1616
1627
  this.prevTouches = W(t), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish);
1617
1628
  });
1618
- s(this, "onWindowTouchMove", (t) => {
1629
+ n(this, "onWindowTouchMove", (t) => {
1619
1630
  const o = this.element;
1620
1631
  if (o === null)
1621
1632
  return;
1622
1633
  const r = W(t);
1623
1634
  if (!r.touches.every(
1624
- (i) => P(o, i[0], i[1]) && L(this.window, i[0], i[1])
1635
+ (s) => P(o, s[0], s[1]) && L(this.window, s[0], s[1])
1625
1636
  )) {
1626
1637
  this.stopTouchDrag();
1627
1638
  return;
@@ -1631,24 +1642,24 @@ class Pt {
1631
1642
  -(r.x - this.prevTouches.x),
1632
1643
  -(r.y - this.prevTouches.y)
1633
1644
  ), r.touchesCnt === 2) {
1634
- const { left: i, top: c } = o.getBoundingClientRect(), d = this.prevTouches.x - i, h = this.prevTouches.y - c, a = 1 / (r.scale / this.prevTouches.scale);
1635
- this.scaleViewport(o, a, d, h);
1645
+ const { left: s, top: h } = o.getBoundingClientRect(), d = this.prevTouches.x - s, c = this.prevTouches.y - h, a = 1 / (r.scale / this.prevTouches.scale);
1646
+ this.scaleViewport(o, a, d, c);
1636
1647
  }
1637
1648
  this.prevTouches = r;
1638
1649
  });
1639
- s(this, "onWindowTouchFinish", (t) => {
1650
+ n(this, "onWindowTouchFinish", (t) => {
1640
1651
  t.touches.length > 0 ? this.prevTouches = W(t) : this.stopTouchDrag();
1641
1652
  });
1642
- s(this, "observer", new ResizeObserver(() => {
1643
- const t = this.canvas.transformation.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), n = this.options.transformPreprocessor({
1653
+ n(this, "observer", new ResizeObserver(() => {
1654
+ const t = this.canvas.transformation.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), i = this.options.transformPreprocessor({
1644
1655
  prevTransform: t,
1645
1656
  nextTransform: t,
1646
1657
  canvasWidth: o,
1647
1658
  canvasHeight: r
1648
1659
  });
1649
- this.canvas.patchViewportMatrix(n), this.options.onTransformFinished();
1660
+ this.canvas.patchViewportMatrix(i), this.options.onTransformFinished();
1650
1661
  }));
1651
- s(this, "options");
1662
+ n(this, "options");
1652
1663
  this.canvas = t, this.options = Mt(o), this.transformation = this.canvas.transformation, this.model = this.canvas.model;
1653
1664
  }
1654
1665
  attach(t) {
@@ -1698,21 +1709,21 @@ class Pt {
1698
1709
  }
1699
1710
  moveViewport(t, o, r) {
1700
1711
  this.options.onBeforeTransformStarted();
1701
- const n = this.transformation.getViewportMatrix(), i = Nt(n, o, r), { width: c, height: d } = t.getBoundingClientRect(), h = this.options.transformPreprocessor({
1702
- prevTransform: n,
1703
- nextTransform: i,
1704
- canvasWidth: c,
1712
+ const i = this.transformation.getViewportMatrix(), s = Nt(i, o, r), { width: h, height: d } = t.getBoundingClientRect(), c = this.options.transformPreprocessor({
1713
+ prevTransform: i,
1714
+ nextTransform: s,
1715
+ canvasWidth: h,
1705
1716
  canvasHeight: d
1706
1717
  });
1707
- this.canvas.patchViewportMatrix(h), this.options.onTransformFinished();
1718
+ this.canvas.patchViewportMatrix(c), this.options.onTransformFinished();
1708
1719
  }
1709
- scaleViewport(t, o, r, n) {
1720
+ scaleViewport(t, o, r, i) {
1710
1721
  this.options.onBeforeTransformStarted();
1711
- const i = this.canvas.transformation.getViewportMatrix(), c = Ct(i, o, r, n), { width: d, height: h } = t.getBoundingClientRect(), l = this.options.transformPreprocessor({
1712
- prevTransform: i,
1713
- nextTransform: c,
1722
+ const s = this.canvas.transformation.getViewportMatrix(), h = Ct(s, o, r, i), { width: d, height: c } = t.getBoundingClientRect(), l = this.options.transformPreprocessor({
1723
+ prevTransform: s,
1724
+ nextTransform: h,
1714
1725
  canvasWidth: d,
1715
- canvasHeight: h
1726
+ canvasHeight: c
1716
1727
  });
1717
1728
  this.canvas.patchViewportMatrix(l), this.options.onTransformFinished();
1718
1729
  }
@@ -1731,8 +1742,8 @@ class Pt {
1731
1742
  }
1732
1743
  class Lt {
1733
1744
  constructor() {
1734
- s(this, "keyMap", /* @__PURE__ */ new Map());
1735
- s(this, "valueMap", /* @__PURE__ */ new Map());
1745
+ n(this, "keyMap", /* @__PURE__ */ new Map());
1746
+ n(this, "valueMap", /* @__PURE__ */ new Map());
1736
1747
  }
1737
1748
  set(t, o) {
1738
1749
  this.keyMap.set(t, o), this.valueMap.set(o, t);
@@ -1768,17 +1779,17 @@ class Lt {
1768
1779
  }
1769
1780
  class Dt {
1770
1781
  constructor(t) {
1771
- s(this, "transformation");
1772
- s(this, "model");
1773
- s(this, "nodes", new Lt());
1774
- s(this, "nodeIdGenerator", new N(
1782
+ n(this, "transformation");
1783
+ n(this, "model");
1784
+ n(this, "nodes", new Lt());
1785
+ n(this, "nodeIdGenerator", new N(
1775
1786
  (t) => this.nodes.hasKey(t)
1776
1787
  ));
1777
- s(this, "nodesResizeObserver");
1788
+ n(this, "nodesResizeObserver");
1778
1789
  this.canvas = t, this.nodesResizeObserver = new window.ResizeObserver((o) => {
1779
1790
  o.forEach((r) => {
1780
- const n = r.target;
1781
- this.reactNodeChange(n);
1791
+ const i = r.target;
1792
+ this.reactNodeChange(i);
1782
1793
  });
1783
1794
  }), this.transformation = this.canvas.transformation, this.model = this.canvas.model;
1784
1795
  }
@@ -1835,19 +1846,19 @@ class Dt {
1835
1846
  }
1836
1847
  reactNodeChange(t) {
1837
1848
  const o = this.nodes.getByValue(t);
1838
- this.canvas.updateNode(o), this.model.getNodeAdjacentEdgeIds(o).forEach((n) => {
1839
- this.canvas.updateEdge(n);
1849
+ this.canvas.updateNode(o), this.model.getNodeAdjacentEdgeIds(o).forEach((i) => {
1850
+ this.canvas.updateEdge(i);
1840
1851
  });
1841
1852
  }
1842
1853
  }
1843
1854
  class mt {
1844
1855
  constructor() {
1845
- s(this, "coreOptions");
1846
- s(this, "dragOptions");
1847
- s(this, "transformOptions");
1848
- s(this, "isDraggable", !1);
1849
- s(this, "isTransformable", !1);
1850
- s(this, "hasResizeReactiveNodes", !1);
1856
+ n(this, "coreOptions");
1857
+ n(this, "dragOptions");
1858
+ n(this, "transformOptions");
1859
+ n(this, "isDraggable", !1);
1860
+ n(this, "isTransformable", !1);
1861
+ n(this, "hasResizeReactiveNodes", !1);
1851
1862
  }
1852
1863
  setOptions(t) {
1853
1864
  return this.coreOptions = t, this;