@html-graph/html-graph 0.1.2 → 0.1.4

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}`;
20
- }, C = (e, t) => {
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
+ }, N = (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 };
144
- return C(
145
- [t, i, l, a, y, w, c, o],
142
+ y: h.y
143
+ }, y = { x: g.x, y: c };
144
+ return N(
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 };
166
- return C(
167
- [t, n, l, w, a, o],
165
+ ), g = { x: a.x + d, y: a.y + c };
166
+ return N(
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 N([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 };
202
- return C(
203
- [t, i, l, a, y, w, c, o],
201
+ }, y = { x: c, y: g.y };
202
+ return N(
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}${N(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
  }
@@ -1064,9 +1064,9 @@ class ft {
1064
1064
  o.shape.svg.style.zIndex = `${o.priority}`;
1065
1065
  }
1066
1066
  }
1067
- class N {
1067
+ class C {
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 C(
1092
1092
  (t) => this.graphStore.getNode(t) !== void 0
1093
1093
  ));
1094
- s(this, "portIdGenerator", new N(
1094
+ n(this, "portIdGenerator", new C(
1095
1095
  (t) => this.graphStore.getPort(t) !== void 0
1096
1096
  ));
1097
- s(this, "edgeIdGenerator", new N(
1097
+ n(this, "edgeIdGenerator", new C(
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 C(
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,23 @@ 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) => {
1356
- t.touches.length > 0 ? this.previousTouchCoords = {
1357
- x: t.touches[0].clientX,
1358
- y: t.touches[0].clientY
1359
- } : this.cancelTouchDrag();
1355
+ n(this, "onWindowTouchFinish", () => {
1356
+ this.previousTouchCoords = null, this.cancelTouchDrag();
1360
1357
  });
1361
- s(this, "previousTouchCoords", null);
1362
- s(this, "freezePriority");
1363
- s(this, "window", window);
1364
- s(this, "dragCursor");
1365
- var r, n, i;
1358
+ n(this, "previousTouchCoords", null);
1359
+ n(this, "freezePriority");
1360
+ n(this, "window", window);
1361
+ n(this, "dragCursor");
1362
+ var r, i, s;
1366
1363
  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) ?? (() => {
1364
+ }), 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
1365
  }), this.freezePriority = (o == null ? void 0 : o.moveOnTop) === !1, this.dragCursor = (o == null ? void 0 : o.dragCursor) !== void 0 ? o.dragCursor : "grab";
1369
1366
  }
1370
1367
  attach(t) {
@@ -1376,34 +1373,36 @@ class St {
1376
1373
  addNode(t) {
1377
1374
  const o = this.nodeIdGenerator.create(t.id);
1378
1375
  this.canvas.addNode({ ...t, id: o }), this.updateMaxNodePriority(o);
1379
- const r = (i) => {
1380
- if (this.element === null || i.button !== 0)
1376
+ const r = (s) => {
1377
+ if (this.element === null || s.button !== 0)
1381
1378
  return;
1382
- const c = this.model.getNode(o);
1379
+ const h = this.model.getNode(o);
1383
1380
  this.onBeforeNodeDrag({
1384
1381
  nodeId: o,
1385
1382
  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
1383
+ x: h.x,
1384
+ y: h.y
1385
+ }) && (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));
1386
+ }, i = (s) => {
1387
+ if (s.touches.length !== 1)
1388
+ return;
1389
+ s.stopImmediatePropagation(), this.previousTouchCoords = {
1390
+ x: s.touches[0].clientX,
1391
+ y: s.touches[0].clientY
1393
1392
  };
1394
- const c = this.model.getNode(o);
1393
+ const h = this.model.getNode(o);
1395
1394
  this.onBeforeNodeDrag({
1396
1395
  nodeId: o,
1397
1396
  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));
1397
+ x: h.x,
1398
+ y: h.y
1399
+ }) && (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
1400
  };
1402
1401
  return this.nodes.set(o, {
1403
1402
  element: t.element,
1404
1403
  onMouseDown: r,
1405
- onTouchStart: n
1406
- }), t.element.addEventListener("mousedown", r), t.element.addEventListener("touchstart", n), this;
1404
+ onTouchStart: i
1405
+ }), t.element.addEventListener("mousedown", r), t.element.addEventListener("touchstart", i), this;
1407
1406
  }
1408
1407
  updateNode(t, o) {
1409
1408
  return this.canvas.updateNode(t, o), this.updateMaxNodePriority(t), this;
@@ -1445,15 +1444,15 @@ class St {
1445
1444
  this.detach(), this.clear(), this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.canvas.destroy();
1446
1445
  }
1447
1446
  dragNode(t, o, r) {
1448
- const n = this.model.getNode(t);
1449
- if (n === null)
1447
+ const i = this.model.getNode(t);
1448
+ if (i === null)
1450
1449
  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({
1450
+ 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;
1451
+ this.canvas.updateNode(t, { x: g, y }), this.onNodeDrag({
1453
1452
  nodeId: t,
1454
- element: n.element,
1455
- x: n.x,
1456
- y: n.y
1453
+ element: i.element,
1454
+ x: i.x,
1455
+ y: i.y
1457
1456
  });
1458
1457
  }
1459
1458
  updateMaxNodePriority(t) {
@@ -1465,8 +1464,8 @@ class St {
1465
1464
  return;
1466
1465
  this.maxNodePriority += 2, this.updateNode(t, { priority: this.maxNodePriority });
1467
1466
  const o = this.maxNodePriority - 1;
1468
- this.model.getNodeAdjacentEdgeIds(t).forEach((n) => {
1469
- this.updateEdge(n, { priority: o });
1467
+ this.model.getNodeAdjacentEdgeIds(t).forEach((i) => {
1468
+ this.updateEdge(i, { priority: o });
1470
1469
  });
1471
1470
  }
1472
1471
  cancelMouseDrag() {
@@ -1496,23 +1495,34 @@ class St {
1496
1495
  }
1497
1496
  }
1498
1497
  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 };
1498
+ 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;
1499
+ return (s) => {
1500
+ let h = s.nextTransform.dx, d = s.nextTransform.dy;
1501
+ h < t && h < s.prevTransform.dx && (h = Math.min(s.prevTransform.dx, t));
1502
+ const c = s.canvasWidth * s.prevTransform.scale;
1503
+ 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));
1504
+ const l = s.canvasHeight * s.prevTransform.scale;
1505
+ 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
1506
  };
1508
1507
  }, 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), {
1508
+ const t = e.maxContentScale, o = e.minContentScale, r = t !== null ? 1 / t : 0, i = o !== null ? 1 / o : 1 / 0;
1509
+ return (s) => {
1510
+ const h = s.prevTransform, d = s.nextTransform;
1511
+ let c = d.scale, l = d.dx, a = d.dy;
1512
+ if (d.scale > i && d.scale > h.scale) {
1513
+ c = Math.max(h.scale, i), l = h.dx, a = h.dy;
1514
+ const g = (c - h.scale) / (d.scale - h.scale);
1515
+ l = h.dx + (d.dx - h.dx) * g, a = h.dy + (d.dy - h.dy) * g;
1516
+ }
1517
+ if (d.scale < r && d.scale < h.scale) {
1518
+ c = Math.min(h.scale, r), l = h.dx, a = h.dy;
1519
+ const g = (c - h.scale) / (d.scale - h.scale);
1520
+ l = h.dx + (d.dx - h.dx) * g, a = h.dy + (d.dy - h.dy) * g;
1521
+ }
1522
+ return {
1513
1523
  scale: c,
1514
- dx: d,
1515
- dy: h
1524
+ dx: l,
1525
+ dy: a
1516
1526
  };
1517
1527
  };
1518
1528
  }, Tt = (e) => (t) => e.reduce(
@@ -1541,62 +1551,62 @@ const At = (e) => {
1541
1551
  });
1542
1552
  }
1543
1553
  }, 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(
1554
+ var c, l, a, g;
1555
+ 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;
1556
+ let i;
1557
+ r !== void 0 ? Array.isArray(r) ? i = Tt(
1548
1558
  r.map(
1549
1559
  (y) => U(y)
1550
1560
  )
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) ?? (() => {
1561
+ ) : i = U(r) : i = (y) => y.nextTransform;
1562
+ 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.onBeforeTransformChange) ?? (() => {
1563
+ }), d = ((g = e == null ? void 0 : e.events) == null ? void 0 : g.onTransformChange) ?? (() => {
1554
1564
  });
1555
1565
  return {
1556
1566
  wheelSensitivity: o,
1557
- onBeforeTransformStarted: c,
1567
+ onBeforeTransformStarted: h,
1558
1568
  onTransformFinished: d,
1559
- transformPreprocessor: n,
1560
- shiftCursor: i
1569
+ transformPreprocessor: i,
1570
+ shiftCursor: s
1561
1571
  };
1562
1572
  }, W = (e) => {
1563
1573
  const t = [], o = e.touches.length;
1564
1574
  for (let d = 0; d < o; d++)
1565
1575
  t.push([e.touches[d].clientX, e.touches[d].clientY]);
1566
1576
  const r = t.reduce(
1567
- (d, h) => [d[0] + h[0], d[1] + h[1]],
1577
+ (d, c) => [d[0] + c[0], d[1] + c[1]],
1568
1578
  [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]),
1579
+ ), i = [r[0] / o, r[1] / o], h = t.map((d) => [d[0] - i[0], d[1] - i[1]]).reduce(
1580
+ (d, c) => d + Math.sqrt(c[0] * c[0] + c[1] * c[1]),
1571
1581
  0
1572
1582
  );
1573
1583
  return {
1574
- x: n[0],
1575
- y: n[1],
1576
- scale: c / o,
1584
+ x: i[0],
1585
+ y: i[1],
1586
+ scale: h / o,
1577
1587
  touchesCnt: o,
1578
1588
  touches: t
1579
1589
  };
1580
- }, Nt = (e, t, o) => ({
1590
+ }, Ct = (e, t, o) => ({
1581
1591
  scale: e.scale,
1582
1592
  dx: e.dx + e.scale * t,
1583
1593
  dy: e.dy + e.scale * o
1584
- }), Ct = (e, t, o, r) => ({
1594
+ }), Nt = (e, t, o, r) => ({
1585
1595
  scale: e.scale * t,
1586
1596
  dx: e.scale * (1 - t) * o + e.dx,
1587
1597
  dy: e.scale * (1 - t) * r + e.dy
1588
1598
  });
1589
1599
  class Pt {
1590
1600
  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) => {
1601
+ n(this, "model");
1602
+ n(this, "transformation");
1603
+ n(this, "element", null);
1604
+ n(this, "prevTouches", null);
1605
+ n(this, "window", window);
1606
+ n(this, "onMouseDown", (t) => {
1597
1607
  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
1608
  });
1599
- s(this, "onWindowMouseMove", (t) => {
1609
+ n(this, "onWindowMouseMove", (t) => {
1600
1610
  if (this.element === null || !P(this.element, t.clientX, t.clientY) || !L(this.window, t.clientX, t.clientY)) {
1601
1611
  this.stopMouseDrag();
1602
1612
  return;
@@ -1604,24 +1614,24 @@ class Pt {
1604
1614
  const o = -t.movementX, r = -t.movementY;
1605
1615
  this.moveViewport(this.element, o, r);
1606
1616
  });
1607
- s(this, "onWindowMouseUp", (t) => {
1617
+ n(this, "onWindowMouseUp", (t) => {
1608
1618
  this.element === null || t.button !== 0 || this.stopMouseDrag();
1609
1619
  });
1610
- s(this, "onWheelScroll", (t) => {
1620
+ n(this, "onWheelScroll", (t) => {
1611
1621
  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);
1622
+ 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);
1623
+ this.scaleViewport(this.element, d, i, s);
1614
1624
  });
1615
- s(this, "onTouchStart", (t) => {
1625
+ n(this, "onTouchStart", (t) => {
1616
1626
  this.prevTouches = W(t), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish);
1617
1627
  });
1618
- s(this, "onWindowTouchMove", (t) => {
1628
+ n(this, "onWindowTouchMove", (t) => {
1619
1629
  const o = this.element;
1620
1630
  if (o === null)
1621
1631
  return;
1622
1632
  const r = W(t);
1623
1633
  if (!r.touches.every(
1624
- (i) => P(o, i[0], i[1]) && L(this.window, i[0], i[1])
1634
+ (s) => P(o, s[0], s[1]) && L(this.window, s[0], s[1])
1625
1635
  )) {
1626
1636
  this.stopTouchDrag();
1627
1637
  return;
@@ -1631,24 +1641,24 @@ class Pt {
1631
1641
  -(r.x - this.prevTouches.x),
1632
1642
  -(r.y - this.prevTouches.y)
1633
1643
  ), 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);
1644
+ const { left: s, top: h } = o.getBoundingClientRect(), d = this.prevTouches.x - s, c = this.prevTouches.y - h, a = 1 / (r.scale / this.prevTouches.scale);
1645
+ this.scaleViewport(o, a, d, c);
1636
1646
  }
1637
1647
  this.prevTouches = r;
1638
1648
  });
1639
- s(this, "onWindowTouchFinish", (t) => {
1649
+ n(this, "onWindowTouchFinish", (t) => {
1640
1650
  t.touches.length > 0 ? this.prevTouches = W(t) : this.stopTouchDrag();
1641
1651
  });
1642
- s(this, "observer", new ResizeObserver(() => {
1643
- const t = this.canvas.transformation.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), n = this.options.transformPreprocessor({
1652
+ n(this, "observer", new ResizeObserver(() => {
1653
+ const t = this.canvas.transformation.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), i = this.options.transformPreprocessor({
1644
1654
  prevTransform: t,
1645
1655
  nextTransform: t,
1646
1656
  canvasWidth: o,
1647
1657
  canvasHeight: r
1648
1658
  });
1649
- this.canvas.patchViewportMatrix(n), this.options.onTransformFinished();
1659
+ this.canvas.patchViewportMatrix(i), this.options.onTransformFinished();
1650
1660
  }));
1651
- s(this, "options");
1661
+ n(this, "options");
1652
1662
  this.canvas = t, this.options = Mt(o), this.transformation = this.canvas.transformation, this.model = this.canvas.model;
1653
1663
  }
1654
1664
  attach(t) {
@@ -1698,21 +1708,21 @@ class Pt {
1698
1708
  }
1699
1709
  moveViewport(t, o, r) {
1700
1710
  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,
1711
+ const i = this.transformation.getViewportMatrix(), s = Ct(i, o, r), { width: h, height: d } = t.getBoundingClientRect(), c = this.options.transformPreprocessor({
1712
+ prevTransform: i,
1713
+ nextTransform: s,
1714
+ canvasWidth: h,
1705
1715
  canvasHeight: d
1706
1716
  });
1707
- this.canvas.patchViewportMatrix(h), this.options.onTransformFinished();
1717
+ this.canvas.patchViewportMatrix(c), this.options.onTransformFinished();
1708
1718
  }
1709
- scaleViewport(t, o, r, n) {
1719
+ scaleViewport(t, o, r, i) {
1710
1720
  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,
1721
+ const s = this.canvas.transformation.getViewportMatrix(), h = Nt(s, o, r, i), { width: d, height: c } = t.getBoundingClientRect(), l = this.options.transformPreprocessor({
1722
+ prevTransform: s,
1723
+ nextTransform: h,
1714
1724
  canvasWidth: d,
1715
- canvasHeight: h
1725
+ canvasHeight: c
1716
1726
  });
1717
1727
  this.canvas.patchViewportMatrix(l), this.options.onTransformFinished();
1718
1728
  }
@@ -1731,8 +1741,8 @@ class Pt {
1731
1741
  }
1732
1742
  class Lt {
1733
1743
  constructor() {
1734
- s(this, "keyMap", /* @__PURE__ */ new Map());
1735
- s(this, "valueMap", /* @__PURE__ */ new Map());
1744
+ n(this, "keyMap", /* @__PURE__ */ new Map());
1745
+ n(this, "valueMap", /* @__PURE__ */ new Map());
1736
1746
  }
1737
1747
  set(t, o) {
1738
1748
  this.keyMap.set(t, o), this.valueMap.set(o, t);
@@ -1768,17 +1778,17 @@ class Lt {
1768
1778
  }
1769
1779
  class Dt {
1770
1780
  constructor(t) {
1771
- s(this, "transformation");
1772
- s(this, "model");
1773
- s(this, "nodes", new Lt());
1774
- s(this, "nodeIdGenerator", new N(
1781
+ n(this, "transformation");
1782
+ n(this, "model");
1783
+ n(this, "nodes", new Lt());
1784
+ n(this, "nodeIdGenerator", new C(
1775
1785
  (t) => this.nodes.hasKey(t)
1776
1786
  ));
1777
- s(this, "nodesResizeObserver");
1787
+ n(this, "nodesResizeObserver");
1778
1788
  this.canvas = t, this.nodesResizeObserver = new window.ResizeObserver((o) => {
1779
1789
  o.forEach((r) => {
1780
- const n = r.target;
1781
- this.reactNodeChange(n);
1790
+ const i = r.target;
1791
+ this.reactNodeChange(i);
1782
1792
  });
1783
1793
  }), this.transformation = this.canvas.transformation, this.model = this.canvas.model;
1784
1794
  }
@@ -1835,19 +1845,19 @@ class Dt {
1835
1845
  }
1836
1846
  reactNodeChange(t) {
1837
1847
  const o = this.nodes.getByValue(t);
1838
- this.canvas.updateNode(o), this.model.getNodeAdjacentEdgeIds(o).forEach((n) => {
1839
- this.canvas.updateEdge(n);
1848
+ this.canvas.updateNode(o), this.model.getNodeAdjacentEdgeIds(o).forEach((i) => {
1849
+ this.canvas.updateEdge(i);
1840
1850
  });
1841
1851
  }
1842
1852
  }
1843
1853
  class mt {
1844
1854
  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);
1855
+ n(this, "coreOptions");
1856
+ n(this, "dragOptions");
1857
+ n(this, "transformOptions");
1858
+ n(this, "isDraggable", !1);
1859
+ n(this, "isTransformable", !1);
1860
+ n(this, "hasResizeReactiveNodes", !1);
1851
1861
  }
1852
1862
  setOptions(t) {
1853
1863
  return this.coreOptions = t, this;