dishui 0.0.45 → 0.0.46

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.
Files changed (60) hide show
  1. package/dist/chart.js +46 -0
  2. package/dist/components/Chart/Chart.d.ts +17 -0
  3. package/dist/components/Chart/Chart.js +29 -0
  4. package/dist/components/Chart/Chart.js.map +1 -0
  5. package/dist/components/Chart/index.d.ts +15 -0
  6. package/dist/components/Input/index.js +2 -2
  7. package/dist/components/Input/index.js.map +1 -1
  8. package/dist/components/Select/index.js +1 -1
  9. package/dist/components/Select/index.js.map +1 -1
  10. package/dist/components/pro/Flow/Flow.js +492 -392
  11. package/dist/components/pro/Flow/Flow.js.map +1 -1
  12. package/dist/components/pro/Flow/FlowCanvas.js +895 -864
  13. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  14. package/dist/components/pro/Flow/context/FlowUIContext.d.ts +2 -0
  15. package/dist/components/pro/Flow/context/FlowUIContext.js +68 -65
  16. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  17. package/dist/components/pro/Flow/edges/edgePaths.js +234 -216
  18. package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
  19. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +21 -10
  20. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
  21. package/dist/components/pro/Flow/hooks/useMindMap.js +138 -134
  22. package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
  23. package/dist/components/pro/Flow/index.d.ts +1 -1
  24. package/dist/components/pro/Flow/nodes/MediaContent.js +47 -25
  25. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  26. package/dist/components/pro/Flow/nodes/Model3DView.d.ts +7 -0
  27. package/dist/components/pro/Flow/nodes/Model3DView.js +118 -0
  28. package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -0
  29. package/dist/components/pro/Flow/nodes/NodeHandles.d.ts +2 -1
  30. package/dist/components/pro/Flow/nodes/NodeHandles.js +4 -2
  31. package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
  32. package/dist/components/pro/Flow/nodes/NodeRenderer.d.ts +2 -0
  33. package/dist/components/pro/Flow/nodes/NodeRenderer.js +115 -113
  34. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  35. package/dist/components/pro/Flow/nodes/NodeText.d.ts +3 -0
  36. package/dist/components/pro/Flow/nodes/NodeText.js +26 -17
  37. package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
  38. package/dist/components/pro/Flow/panels/FlowToolbar.js +85 -79
  39. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  40. package/dist/components/pro/Flow/panels/InspectorPanel.js +618 -488
  41. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  42. package/dist/components/pro/Flow/panels/OutlinePanel.js +15 -15
  43. package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
  44. package/dist/components/pro/Flow/panels/ShapePalette.js +71 -55
  45. package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
  46. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +1 -0
  47. package/dist/components/pro/Flow/panels/toolbarIcons.js +59 -41
  48. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  49. package/dist/components/pro/Flow/types.d.ts +13 -4
  50. package/dist/components/pro/Flow/types.js.map +1 -1
  51. package/dist/dishui.css +1 -1
  52. package/dist/index-nostyled.d.ts +3 -1
  53. package/dist/index.d.ts +3 -1
  54. package/dist/index.js +145 -143
  55. package/dist/utils/i18n.d.ts +1 -0
  56. package/dist/utils/i18n.js +200 -6
  57. package/dist/utils/i18n.js.map +1 -1
  58. package/dist/utils/menu.js +26 -10
  59. package/dist/utils/menu.js.map +1 -1
  60. package/package.json +14 -3
@@ -1,4 +1,4 @@
1
- import { getHandlePositions as g } from "../nodes/NodeHandles.js";
1
+ import { getHandlePositions as M } from "../nodes/NodeHandles.js";
2
2
  var p = {
3
3
  top: {
4
4
  dx: 0,
@@ -16,338 +16,356 @@ var p = {
16
16
  dx: 1,
17
17
  dy: 0
18
18
  }
19
- }, E = 20, H = 30, _ = 0.3;
20
- function I(n, c, t, o) {
21
- const x = {
22
- x: c.sx,
23
- y: c.sy
24
- }, s = {
25
- x: c.tx,
26
- y: c.ty
27
- }, y = t ?? [];
28
- switch (n) {
19
+ }, w = 20, _ = 30, E = 0.3;
20
+ function D(o, x, t, s) {
21
+ const y = {
22
+ x: x.sx,
23
+ y: x.sy
24
+ }, c = {
25
+ x: x.tx,
26
+ y: x.ty
27
+ }, n = t ?? [];
28
+ switch (o) {
29
29
  case "straight":
30
- return b([
31
- x,
32
- ...y,
33
- s
30
+ return m([
31
+ y,
32
+ ...n,
33
+ c
34
34
  ]);
35
35
  case "step":
36
36
  case "smoothstep":
37
- return P(x, s, y, c, n === "smoothstep" ? 8 : 0);
37
+ return P(y, c, n, x, o === "smoothstep" ? 8 : 0);
38
38
  case "simplebezier":
39
- return D([
40
- x,
41
- ...y,
42
- s
43
- ], o, c);
39
+ return O([
40
+ y,
41
+ ...n,
42
+ c
43
+ ], s, x);
44
44
  default:
45
- return b([
46
- x,
47
- ...y,
48
- s
45
+ return m([
46
+ y,
47
+ ...n,
48
+ c
49
49
  ]);
50
50
  }
51
51
  }
52
- function b(n) {
53
- const c = [{
52
+ function m(o) {
53
+ const x = [{
54
54
  type: "M",
55
- x: n[0].x,
56
- y: n[0].y
55
+ x: o[0].x,
56
+ y: o[0].y
57
57
  }];
58
- for (let t = 1; t < n.length; t++) c.push({
58
+ for (let t = 1; t < o.length; t++) x.push({
59
59
  type: "L",
60
- x: n[t].x,
61
- y: n[t].y
60
+ x: o[t].x,
61
+ y: o[t].y
62
62
  });
63
- return c;
63
+ return x;
64
64
  }
65
- function P(n, c, t, o, x) {
66
- const s = Math.hypot(c.x - n.x, c.y - n.y), y = Math.min(E, s / 4), i = {
67
- x: n.x + o.snx * y,
68
- y: n.y + o.sny * y
69
- }, a = {
70
- x: c.x + o.tnx * y,
71
- y: c.y + o.tny * y
72
- }, u = Math.abs(o.sny) > Math.abs(o.snx), e = Math.abs(o.tny) > Math.abs(o.tnx), h = [{
73
- x: n.x,
74
- y: n.y
75
- }, i], d = [
76
- i,
65
+ function P(o, x, t, s, y) {
66
+ const c = Math.hypot(x.x - o.x, x.y - o.y), n = Math.min(w, c / 4), e = {
67
+ x: o.x + s.snx * n,
68
+ y: o.y + s.sny * n
69
+ }, i = {
70
+ x: x.x + s.tnx * n,
71
+ y: x.y + s.tny * n
72
+ }, h = Math.abs(s.sny) > Math.abs(s.snx), a = Math.abs(s.tny) > Math.abs(s.tnx), r = [{
73
+ x: o.x,
74
+ y: o.y
75
+ }, e], f = [
76
+ e,
77
77
  ...t,
78
- a
78
+ i
79
79
  ];
80
- for (let r = 0; r < d.length - 1; r++) {
81
- const l = d[r], f = d[r + 1];
82
- if (r === 0 ? u : r === d.length - 2 ? e : u) {
83
- const M = (l.y + f.y) / 2;
84
- h.push({
85
- x: l.x,
86
- y: M
80
+ for (let l = 0; l < f.length - 1; l++) {
81
+ const u = f[l], d = f[l + 1];
82
+ if (l === 0 ? h : l === f.length - 2 ? a : h) {
83
+ const g = (u.y + d.y) / 2;
84
+ r.push({
85
+ x: u.x,
86
+ y: g
87
87
  }, {
88
- x: f.x,
89
- y: M
88
+ x: d.x,
89
+ y: g
90
90
  });
91
91
  } else {
92
- const M = (l.x + f.x) / 2;
93
- h.push({
94
- x: M,
95
- y: l.y
92
+ const g = (u.x + d.x) / 2;
93
+ r.push({
94
+ x: g,
95
+ y: u.y
96
96
  }, {
97
- x: M,
98
- y: f.y
97
+ x: g,
98
+ y: d.y
99
99
  });
100
100
  }
101
- h.push({
102
- x: f.x,
103
- y: f.y
101
+ r.push({
102
+ x: d.x,
103
+ y: d.y
104
104
  });
105
105
  }
106
- return h.push({
107
- x: c.x,
108
- y: c.y
109
- }), C(k(h), x);
106
+ return r.push({
107
+ x: x.x,
108
+ y: x.y
109
+ }), k(S(r), y);
110
110
  }
111
- function k(n) {
112
- const c = [];
113
- for (const o of n) {
114
- const x = c[c.length - 1];
115
- x && Math.abs(x.x - o.x) < 0.01 && Math.abs(x.y - o.y) < 0.01 || c.push({
116
- x: o.x,
117
- y: o.y
111
+ function S(o) {
112
+ const x = [];
113
+ for (const s of o) {
114
+ const y = x[x.length - 1];
115
+ y && Math.abs(y.x - s.x) < 0.01 && Math.abs(y.y - s.y) < 0.01 || x.push({
116
+ x: s.x,
117
+ y: s.y
118
118
  });
119
119
  }
120
120
  const t = [];
121
- for (let o = 0; o < c.length; o++) {
122
- const x = t[t.length - 1], s = c[o], y = c[o + 1];
123
- if (x && y) {
124
- const i = Math.abs(x.x - s.x) < 0.01 && Math.abs(s.x - y.x) < 0.01, a = Math.abs(x.y - s.y) < 0.01 && Math.abs(s.y - y.y) < 0.01;
125
- if (i || a) continue;
121
+ for (let s = 0; s < x.length; s++) {
122
+ const y = t[t.length - 1], c = x[s], n = x[s + 1];
123
+ if (y && n) {
124
+ const e = Math.abs(y.x - c.x) < 0.01 && Math.abs(c.x - n.x) < 0.01, i = Math.abs(y.y - c.y) < 0.01 && Math.abs(c.y - n.y) < 0.01;
125
+ if (e || i) continue;
126
126
  }
127
- t.push(s);
127
+ t.push(c);
128
128
  }
129
129
  return t;
130
130
  }
131
- function C(n, c) {
132
- if (n.length === 0) return [];
131
+ function k(o, x) {
132
+ if (o.length === 0) return [];
133
133
  const t = [{
134
134
  type: "M",
135
- x: n[0].x,
136
- y: n[0].y
135
+ x: o[0].x,
136
+ y: o[0].y
137
137
  }];
138
- if (n.length === 1) return t;
139
- if (c <= 0.5) {
140
- for (let x = 1; x < n.length; x++) t.push({
138
+ if (o.length === 1) return t;
139
+ if (x <= 0.5) {
140
+ for (let y = 1; y < o.length; y++) t.push({
141
141
  type: "L",
142
- x: n[x].x,
143
- y: n[x].y
142
+ x: o[y].x,
143
+ y: o[y].y
144
144
  });
145
145
  return t;
146
146
  }
147
- for (let x = 1; x < n.length - 1; x++) {
148
- const s = n[x - 1], y = n[x], i = n[x + 1], a = Math.hypot(y.x - s.x, y.y - s.y), u = Math.hypot(i.x - y.x, i.y - y.y), e = Math.min(c, a / 2, u / 2);
149
- if (e < 0.5) {
147
+ for (let y = 1; y < o.length - 1; y++) {
148
+ const c = o[y - 1], n = o[y], e = o[y + 1], i = Math.hypot(n.x - c.x, n.y - c.y), h = Math.hypot(e.x - n.x, e.y - n.y), a = Math.min(x, i / 2, h / 2);
149
+ if (a < 0.5) {
150
150
  t.push({
151
151
  type: "L",
152
- x: y.x,
153
- y: y.y
152
+ x: n.x,
153
+ y: n.y
154
154
  });
155
155
  continue;
156
156
  }
157
- const h = Math.sign(y.x - s.x), d = Math.sign(y.y - s.y), r = Math.sign(i.x - y.x), l = Math.sign(i.y - y.y);
157
+ const r = Math.sign(n.x - c.x), f = Math.sign(n.y - c.y), l = Math.sign(e.x - n.x), u = Math.sign(e.y - n.y);
158
158
  t.push({
159
159
  type: "L",
160
- x: y.x - h * e,
161
- y: y.y - d * e
160
+ x: n.x - r * a,
161
+ y: n.y - f * a
162
162
  }), t.push({
163
163
  type: "Q",
164
- x: y.x + r * e,
165
- y: y.y + l * e,
166
- cp1x: y.x,
167
- cp1y: y.y
164
+ x: n.x + l * a,
165
+ y: n.y + u * a,
166
+ cp1x: n.x,
167
+ cp1y: n.y
168
168
  });
169
169
  }
170
- const o = n[n.length - 1];
170
+ const s = o[o.length - 1];
171
171
  return t.push({
172
172
  type: "L",
173
- x: o.x,
174
- y: o.y
173
+ x: s.x,
174
+ y: s.y
175
175
  }), t;
176
176
  }
177
- function D(n, c, t) {
178
- const o = [{
177
+ function O(o, x, t) {
178
+ const s = [{
179
179
  type: "M",
180
- x: n[0].x,
181
- y: n[0].y
182
- }], x = n.length - 2;
183
- for (let s = 0; s <= x; s++) {
184
- const y = n[s], i = n[s + 1], a = c?.[s];
185
- if (a) o.push({
180
+ x: o[0].x,
181
+ y: o[0].y
182
+ }], y = o.length - 2;
183
+ for (let c = 0; c <= y; c++) {
184
+ const n = o[c], e = o[c + 1], i = x?.[c];
185
+ if (i) s.push({
186
186
  type: "C",
187
- x: i.x,
188
- y: i.y,
189
- cp1x: a.c1x,
190
- cp1y: a.c1y,
191
- cp2x: a.c2x,
192
- cp2y: a.c2y
187
+ x: e.x,
188
+ y: e.y,
189
+ cp1x: i.c1x,
190
+ cp1y: i.c1y,
191
+ cp2x: i.c2x,
192
+ cp2y: i.c2y
193
193
  });
194
194
  else {
195
- const u = Math.hypot(i.x - y.x, i.y - y.y), e = Math.max(H, u * _);
196
- let h, d;
197
- s === 0 && t ? (h = y.x + t.snx * e, d = y.y + t.sny * e) : (h = y.x + (i.x - y.x) * 0.4, d = y.y);
198
- let r, l;
199
- s === x && t ? (r = i.x + t.tnx * e, l = i.y + t.tny * e) : (r = i.x - (i.x - y.x) * 0.4, l = i.y), o.push({
195
+ const h = Math.hypot(e.x - n.x, e.y - n.y), a = Math.max(_, h * E);
196
+ let r, f;
197
+ c === 0 && t ? (r = n.x + t.snx * a, f = n.y + t.sny * a) : (r = n.x + (e.x - n.x) * 0.4, f = n.y);
198
+ let l, u;
199
+ c === y && t ? (l = e.x + t.tnx * a, u = e.y + t.tny * a) : (l = e.x - (e.x - n.x) * 0.4, u = e.y), s.push({
200
200
  type: "C",
201
- x: i.x,
202
- y: i.y,
203
- cp1x: h,
204
- cp1y: d,
205
- cp2x: r,
206
- cp2y: l
201
+ x: e.x,
202
+ y: e.y,
203
+ cp1x: r,
204
+ cp1y: f,
205
+ cp2x: l,
206
+ cp2y: u
207
207
  });
208
208
  }
209
209
  }
210
- return o;
210
+ return s;
211
211
  }
212
- function N(n) {
213
- if (n.length < 2) return {
214
- x: n[0]?.x ?? 0,
215
- y: n[0]?.y ?? 0
212
+ function z(o) {
213
+ if (o.length < 2) return {
214
+ x: o[0]?.x ?? 0,
215
+ y: o[0]?.y ?? 0
216
216
  };
217
- const c = Math.floor(n.length / 2), t = n[c - 1], o = n[c];
217
+ const x = Math.floor(o.length / 2), t = o[x - 1], s = o[x];
218
218
  return {
219
- x: (t.x + o.x) / 2,
220
- y: (t.y + o.y) / 2
219
+ x: (t.x + s.x) / 2,
220
+ y: (t.y + s.y) / 2
221
221
  };
222
222
  }
223
- function m(n, c, t) {
224
- const o = t.data.rotation ?? 0;
225
- if (o === 0) return {
226
- x: t.position.x + n,
227
- y: t.position.y + c
223
+ function b(o, x, t) {
224
+ const s = t.data.rotation ?? 0;
225
+ if (s === 0) return {
226
+ x: t.position.x + o,
227
+ y: t.position.y + x
228
228
  };
229
- const x = o * Math.PI / 180, s = t.width / 2, y = t.height / 2, i = n - s, a = c - y, u = Math.cos(x), e = Math.sin(x);
229
+ const y = s * Math.PI / 180, c = t.width / 2, n = t.height / 2, e = o - c, i = x - n, h = Math.cos(y), a = Math.sin(y);
230
230
  return {
231
- x: t.position.x + s + i * u - a * e,
232
- y: t.position.y + y + i * e + a * u
231
+ x: t.position.x + c + e * h - i * a,
232
+ y: t.position.y + n + e * a + i * h
233
233
  };
234
234
  }
235
- function L(n, c) {
236
- const t = p[n?.side ?? "right"] ?? p.right, o = c.data.rotation ?? 0;
237
- if (o === 0) return {
235
+ function H(o, x) {
236
+ const t = p[o?.side ?? "right"] ?? p.right, s = x.data.rotation ?? 0;
237
+ if (s === 0) return {
238
238
  nx: t.dx,
239
239
  ny: t.dy
240
240
  };
241
- const x = o * Math.PI / 180, s = Math.cos(x), y = Math.sin(x);
241
+ const y = s * Math.PI / 180, c = Math.cos(y), n = Math.sin(y);
242
242
  return {
243
- nx: t.dx * s - t.dy * y,
244
- ny: t.dx * y + t.dy * s
243
+ nx: t.dx * c - t.dy * n,
244
+ ny: t.dx * n + t.dy * c
245
245
  };
246
246
  }
247
- function O(n, c) {
248
- const t = c.get(n.source), o = c.get(n.target);
249
- if (!t || !o) return null;
250
- const x = g(t.width, t.height), s = g(o.width, o.height);
251
- let y, i, a;
252
- if (n.sourceHandle) {
253
- a = x.find((f) => f.id === n.sourceHandle) ?? null;
254
- const l = m(a ? a.x : t.width / 2, a ? a.y : t.height / 2, t);
255
- y = l.x, i = l.y;
247
+ function A(o, x) {
248
+ const t = x.get(o.source), s = x.get(o.target);
249
+ if (!t || !s) return null;
250
+ const y = M(t.width, t.height), c = M(s.width, s.height);
251
+ let n, e, i;
252
+ if (o.sourceHandle) {
253
+ i = y.find((d) => d.id === o.sourceHandle) ?? null;
254
+ const u = b(i ? i.x : t.width / 2, i ? i.y : t.height / 2, t);
255
+ n = u.x, e = u.y;
256
256
  } else {
257
- const l = w(t, o);
258
- y = l.x, i = l.y, a = l.handleLike;
257
+ const u = L(t, s);
258
+ n = u.x, e = u.y, i = u.handleLike;
259
259
  }
260
- let u, e, h;
261
- if (n.targetHandle) {
262
- h = s.find((f) => f.id === n.targetHandle) ?? null;
263
- const l = m(h ? h.x : o.width / 2, h ? h.y : o.height / 2, o);
264
- u = l.x, e = l.y;
260
+ let h, a, r;
261
+ if (o.targetHandle) {
262
+ r = c.find((d) => d.id === o.targetHandle) ?? null;
263
+ const u = b(r ? r.x : s.width / 2, r ? r.y : s.height / 2, s);
264
+ h = u.x, a = u.y;
265
265
  } else {
266
- const l = w(o, t);
267
- u = l.x, e = l.y, h = l.handleLike;
266
+ const u = L(s, t);
267
+ h = u.x, a = u.y, r = u.handleLike;
268
268
  }
269
- const d = L(a, t), r = L(h, o);
269
+ const f = H(i, t), l = H(r, s);
270
270
  return {
271
- sx: y,
272
- sy: i,
273
- tx: u,
274
- ty: e,
275
- snx: d.nx,
276
- sny: d.ny,
277
- tnx: r.nx,
278
- tny: r.ny
271
+ sx: n,
272
+ sy: e,
273
+ tx: h,
274
+ ty: a,
275
+ snx: f.nx,
276
+ sny: f.ny,
277
+ tnx: l.nx,
278
+ tny: l.ny
279
279
  };
280
280
  }
281
- function w(n, c) {
282
- const t = n.position.x, o = n.position.y, x = n.width, s = n.height, y = t + x / 2, i = o + s / 2, a = c.position.x + c.width / 2, u = c.position.y + c.height / 2, e = a - y, h = u - i, d = Math.min(12, x / 2 - 1, s / 2 - 1);
283
- let r, l, f;
284
- return Math.abs(e) >= Math.abs(h) ? (r = e >= 0 ? "right" : "left", l = r === "right" ? t + x : t, f = Math.max(o + d, Math.min(o + s - d, u))) : (r = h >= 0 ? "bottom" : "top", f = r === "bottom" ? o + s : o, l = Math.max(t + d, Math.min(t + x - d, a))), (n.data.rotation ?? 0) !== 0 ? {
285
- x: r === "right" ? t + x : r === "left" ? t : y,
286
- y: r === "bottom" ? o + s : r === "top" ? o : i,
281
+ function L(o, x) {
282
+ const t = o.position.x, s = o.position.y, y = o.width, c = o.height, n = t + y / 2, e = s + c / 2, i = x.position.x + x.width / 2, h = x.position.y + x.height / 2, a = i - n, r = h - e, f = Math.min(12, y / 2 - 1, c / 2 - 1);
283
+ let l, u, d;
284
+ return Math.abs(a) >= Math.abs(r) ? (l = a >= 0 ? "right" : "left", u = l === "right" ? t + y : t, d = Math.max(s + f, Math.min(s + c - f, h))) : (l = r >= 0 ? "bottom" : "top", d = l === "bottom" ? s + c : s, u = Math.max(t + f, Math.min(t + y - f, i))), (o.data.rotation ?? 0) !== 0 ? {
285
+ x: l === "right" ? t + y : l === "left" ? t : n,
286
+ y: l === "bottom" ? s + c : l === "top" ? s : e,
287
287
  handleLike: {
288
- id: `float_${r}`,
288
+ id: `float_${l}`,
289
289
  x: 0,
290
290
  y: 0,
291
- side: r
291
+ side: l
292
292
  }
293
293
  } : {
294
- x: l,
295
- y: f,
294
+ x: u,
295
+ y: d,
296
296
  handleLike: {
297
- id: `float_${r}`,
297
+ id: `float_${l}`,
298
298
  x: 0,
299
299
  y: 0,
300
- side: r
300
+ side: l
301
301
  }
302
302
  };
303
303
  }
304
- function S(n, c) {
305
- return n;
304
+ function I(o, x) {
305
+ const t = /* @__PURE__ */ new Map([
306
+ ["0.25", String(0.3333333333333333)],
307
+ ["0.5", String(0.5)],
308
+ ["0.75", String(0.6666666666666666)]
309
+ ]);
310
+ let s = !1;
311
+ const y = (n) => {
312
+ if (!n) return n;
313
+ const [e, i] = n.split("_"), h = t.get(i);
314
+ return !h || !e ? n : (s = !0, `${e}_${h}`);
315
+ }, c = o.map((n) => {
316
+ const e = y(n.sourceHandle), i = y(n.targetHandle);
317
+ return e === n.sourceHandle && i === n.targetHandle ? n : {
318
+ ...n,
319
+ sourceHandle: e,
320
+ targetHandle: i
321
+ };
322
+ });
323
+ return s ? c : o;
306
324
  }
307
- function v(n, c = 8) {
325
+ function N(o, x = 8) {
308
326
  const t = [];
309
- let o = 0, x = 0;
310
- for (const s of n) switch (s.type) {
327
+ let s = 0, y = 0;
328
+ for (const c of o) switch (c.type) {
311
329
  case "M":
312
330
  case "L":
313
- o = s.x, x = s.y, t.push({
314
- x: o,
315
- y: x
331
+ s = c.x, y = c.y, t.push({
332
+ x: s,
333
+ y
316
334
  });
317
335
  break;
318
336
  case "Q": {
319
- const y = s.cp1x, i = s.cp1y;
320
- for (let a = 1; a <= c; a++) {
321
- const u = a / c, e = 1 - u;
337
+ const n = c.cp1x, e = c.cp1y;
338
+ for (let i = 1; i <= x; i++) {
339
+ const h = i / x, a = 1 - h;
322
340
  t.push({
323
- x: e * e * o + 2 * e * u * y + u * u * s.x,
324
- y: e * e * x + 2 * e * u * i + u * u * s.y
341
+ x: a * a * s + 2 * a * h * n + h * h * c.x,
342
+ y: a * a * y + 2 * a * h * e + h * h * c.y
325
343
  });
326
344
  }
327
- o = s.x, x = s.y;
345
+ s = c.x, y = c.y;
328
346
  break;
329
347
  }
330
348
  case "C": {
331
- const y = s.cp1x, i = s.cp1y, a = s.cp2x, u = s.cp2y;
332
- for (let e = 1; e <= c; e++) {
333
- const h = e / c, d = 1 - h;
349
+ const n = c.cp1x, e = c.cp1y, i = c.cp2x, h = c.cp2y;
350
+ for (let a = 1; a <= x; a++) {
351
+ const r = a / x, f = 1 - r;
334
352
  t.push({
335
- x: d ** 3 * o + 3 * d ** 2 * h * y + 3 * d * h ** 2 * a + h ** 3 * s.x,
336
- y: d ** 3 * x + 3 * d ** 2 * h * i + 3 * d * h ** 2 * u + h ** 3 * s.y
353
+ x: f ** 3 * s + 3 * f ** 2 * r * n + 3 * f * r ** 2 * i + r ** 3 * c.x,
354
+ y: f ** 3 * y + 3 * f ** 2 * r * e + 3 * f * r ** 2 * h + r ** 3 * c.y
337
355
  });
338
356
  }
339
- o = s.x, x = s.y;
357
+ s = c.x, y = c.y;
340
358
  break;
341
359
  }
342
360
  }
343
361
  return t;
344
362
  }
345
363
  export {
346
- I as buildEdgePath,
347
- N as getPathCenter,
348
- v as linearizeSegments,
349
- S as normalizeEdgeHandles,
350
- O as resolveEdgeEndpoints
364
+ D as buildEdgePath,
365
+ z as getPathCenter,
366
+ N as linearizeSegments,
367
+ I as normalizeEdgeHandles,
368
+ A as resolveEdgeEndpoints
351
369
  };
352
370
 
353
371
  //# sourceMappingURL=edgePaths.js.map