dishui 0.0.47 → 0.0.49

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 (82) hide show
  1. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +1 -2
  2. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
  3. package/dist/components/pro/CodeEditor/themes.js +0 -25
  4. package/dist/components/pro/CodeEditor/themes.js.map +1 -1
  5. package/dist/components/pro/CodeEditor/types.d.ts +1 -1
  6. package/dist/components/pro/Flow/Flow.js +500 -483
  7. package/dist/components/pro/Flow/Flow.js.map +1 -1
  8. package/dist/components/pro/Flow/FlowCanvas.js +526 -524
  9. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  10. package/dist/components/pro/Flow/canvas/GridRenderer.d.ts +3 -0
  11. package/dist/components/pro/Flow/canvas/GridRenderer.js +28 -23
  12. package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
  13. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +18 -17
  14. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
  15. package/dist/components/pro/Flow/canvas/PixiApp.d.ts +2 -0
  16. package/dist/components/pro/Flow/canvas/PixiApp.js +14 -11
  17. package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
  18. package/dist/components/pro/Flow/constants.js +7 -7
  19. package/dist/components/pro/Flow/constants.js.map +1 -1
  20. package/dist/components/pro/Flow/context/FlowAIContext.d.ts +15 -0
  21. package/dist/components/pro/Flow/context/FlowAIContext.js +32 -0
  22. package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -0
  23. package/dist/components/pro/Flow/context/FlowUIContext.d.ts +4 -1
  24. package/dist/components/pro/Flow/context/FlowUIContext.js +58 -55
  25. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  26. package/dist/components/pro/Flow/edges/EdgeRenderer.js +22 -21
  27. package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
  28. package/dist/components/pro/Flow/hooks/useFlowImportExport.js +32 -32
  29. package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
  30. package/dist/components/pro/Flow/hooks/usePixiApp.d.ts +6 -1
  31. package/dist/components/pro/Flow/hooks/usePixiApp.js +49 -30
  32. package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
  33. package/dist/components/pro/Flow/index.d.ts +2 -0
  34. package/dist/components/pro/Flow/lines/FreehandTool.js +21 -20
  35. package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
  36. package/dist/components/pro/Flow/lines/GeometricLineTool.js +22 -18
  37. package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
  38. package/dist/components/pro/Flow/lines/LineRenderer.js +19 -18
  39. package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
  40. package/dist/components/pro/Flow/nodes/MediaContent.js +143 -124
  41. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  42. package/dist/components/pro/Flow/nodes/MediaOverlay.js +22 -17
  43. package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
  44. package/dist/components/pro/Flow/nodes/NodeRenderer.js +77 -76
  45. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  46. package/dist/components/pro/Flow/nodes/aiClient.d.ts +22 -0
  47. package/dist/components/pro/Flow/nodes/aiClient.js +107 -54
  48. package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
  49. package/dist/components/pro/Flow/nodes/svgIcons.js +6 -6
  50. package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
  51. package/dist/components/pro/Flow/panels/AIPanel.d.ts +2 -0
  52. package/dist/components/pro/Flow/panels/AIPanel.js +498 -0
  53. package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -0
  54. package/dist/components/pro/Flow/panels/FlowPanelGroup.js +51 -39
  55. package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
  56. package/dist/components/pro/Flow/panels/FlowToolbar.js +91 -85
  57. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  58. package/dist/components/pro/Flow/panels/InspectorPanel.js +372 -332
  59. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  60. package/dist/components/pro/Flow/panels/OutlinePanel.js +28 -27
  61. package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
  62. package/dist/components/pro/Flow/panels/ShapePalette.js +107 -104
  63. package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
  64. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +1 -0
  65. package/dist/components/pro/Flow/panels/toolbarIcons.js +25 -20
  66. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  67. package/dist/components/pro/Flow/types.d.ts +13 -0
  68. package/dist/components/pro/Flow/types.js.map +1 -1
  69. package/dist/components/pro/Flow/utils/themeColor.d.ts +87 -0
  70. package/dist/components/pro/Flow/utils/themeColor.js +212 -0
  71. package/dist/components/pro/Flow/utils/themeColor.js.map +1 -0
  72. package/dist/contexts/AppContext.d.ts +1 -1
  73. package/dist/contexts/AppContext.js +28 -29
  74. package/dist/contexts/AppContext.js.map +1 -1
  75. package/dist/dishui.css +1 -1
  76. package/dist/favicon.svg +10 -0
  77. package/dist/flow.js +56 -51
  78. package/dist/styles/themeStyles.js +6 -11
  79. package/dist/styles/themeStyles.js.map +1 -1
  80. package/dist/utils/themes.js +3 -23
  81. package/dist/utils/themes.js.map +1 -1
  82. package/package.json +17 -18
@@ -1,405 +1,407 @@
1
- import { useFlowContext as Ve } from "./context/FlowContext.js";
2
- import { useFlowUI as Be } from "./context/FlowUIContext.js";
3
- import { usePixiApp as Ke } from "./hooks/usePixiApp.js";
4
- import { useViewport as je } from "./hooks/useViewport.js";
5
- import { GridRenderer as Ue } from "./canvas/GridRenderer.js";
6
- import { SelectionOverlay as $e } from "./canvas/SelectionOverlay.js";
7
- import { shapeDrawers as Pe } from "./nodes/shapes.js";
8
- import { findClosestHandleWorld as Dt, getHandlePositions as gt, handleWorldPos as Ot } from "./nodes/NodeHandles.js";
9
- import { distToSegment as me, generateId as Je, isPointInNode as Ht, rectsOverlap as Qe } from "./nodes/nodeUtils.js";
10
- import { NodeRenderer as tn } from "./nodes/NodeRenderer.js";
11
- import { buildEdgePath as _e, linearizeSegments as Ze, resolveEdgeEndpoints as Mt } from "./edges/edgePaths.js";
12
- import { EdgeRenderer as en } from "./edges/EdgeRenderer.js";
13
- import { LineRenderer as nn } from "./lines/LineRenderer.js";
14
- import { FreehandTool as rn } from "./lines/FreehandTool.js";
15
- import { GeometricLineTool as on } from "./lines/GeometricLineTool.js";
16
- import { computeAlignmentSnap as ee } from "./hooks/useAlignmentGuides.js";
17
- import { AlignmentGuidesRenderer as sn } from "./canvas/AlignmentGuides.js";
18
- import { getDocumentSlides as cn, nextAnimIndex as dn } from "./nodes/animAnchors.js";
19
- import { useCallback as ne, useEffect as wt, useRef as b, useState as Ge } from "react";
20
- import { jsx as We, jsxs as an } from "react/jsx-runtime";
21
- import { Graphics as Vt } from "pixi.js";
22
- var ln = {
1
+ import { useFlowContext as Be } from "./context/FlowContext.js";
2
+ import { useFlowUI as Ke } from "./context/FlowUIContext.js";
3
+ import { usePixiApp as je } from "./hooks/usePixiApp.js";
4
+ import { useViewport as Ue } from "./hooks/useViewport.js";
5
+ import { GridRenderer as $e } from "./canvas/GridRenderer.js";
6
+ import { SelectionOverlay as Je } from "./canvas/SelectionOverlay.js";
7
+ import { shapeDrawers as Ge } from "./nodes/shapes.js";
8
+ import { findClosestHandleWorld as Et, getHandlePositions as gt, handleWorldPos as Zt } from "./nodes/NodeHandles.js";
9
+ import { distToSegment as me, generateId as Qe, isPointInNode as Dt, rectsOverlap as tn } from "./nodes/nodeUtils.js";
10
+ import { NodeRenderer as en } from "./nodes/NodeRenderer.js";
11
+ import { buildEdgePath as Ze, linearizeSegments as qe, resolveEdgeEndpoints as Mt } from "./edges/edgePaths.js";
12
+ import { EdgeRenderer as nn } from "./edges/EdgeRenderer.js";
13
+ import { LineRenderer as rn } from "./lines/LineRenderer.js";
14
+ import { FreehandTool as on } from "./lines/FreehandTool.js";
15
+ import { GeometricLineTool as sn } from "./lines/GeometricLineTool.js";
16
+ import { computeAlignmentSnap as ne } from "./hooks/useAlignmentGuides.js";
17
+ import { AlignmentGuidesRenderer as cn } from "./canvas/AlignmentGuides.js";
18
+ import { getDocumentSlides as dn, nextAnimIndex as an } from "./nodes/animAnchors.js";
19
+ import { useCallback as qt, useEffect as wt, useRef as b, useState as We } from "react";
20
+ import { jsx as Le, jsxs as ln } from "react/jsx-runtime";
21
+ import { Graphics as Ot } from "pixi.js";
22
+ var un = {
23
23
  nw: "nwse-resize",
24
24
  ne: "nesw-resize",
25
25
  se: "nwse-resize",
26
26
  sw: "nesw-resize"
27
27
  };
28
- function Le(_, E, X) {
29
- const { x: O, y: D } = E.position, T = E.width, k = E.height, N = [
28
+ function Ae(F, E, G) {
29
+ const { x: Z, y: D } = E.position, W = E.width, k = E.height, z = [
30
30
  [
31
31
  "nw",
32
- O,
32
+ Z,
33
33
  D
34
34
  ],
35
35
  [
36
36
  "ne",
37
- O + T,
37
+ Z + W,
38
38
  D
39
39
  ],
40
40
  [
41
41
  "se",
42
- O + T,
42
+ Z + W,
43
43
  D + k
44
44
  ],
45
45
  [
46
46
  "sw",
47
- O,
47
+ Z,
48
48
  D + k
49
49
  ]
50
50
  ];
51
- let M = null, F = X;
52
- for (const [j, tt, ct] of N) {
53
- const U = Math.hypot(_.x - tt, _.y - ct);
54
- U < F && (F = U, M = j);
51
+ let M = null, _ = G;
52
+ for (const [U, it, tt] of z) {
53
+ const K = Math.hypot(F.x - it, F.y - tt);
54
+ K < _ && (_ = K, M = U);
55
55
  }
56
56
  return M;
57
57
  }
58
- function Ae(_, E, X, O, D) {
59
- let T = null, k = D;
60
- for (const N of X) {
61
- const M = Mt(N, O);
58
+ function Ye(F, E, G, Z, D) {
59
+ let W = null, k = D;
60
+ for (const z of G) {
61
+ const M = Mt(z, Z);
62
62
  if (!M) continue;
63
- const F = Math.hypot(_ - M.sx, E - M.sy);
64
- F < k && (k = F, T = {
65
- edgeId: N.id,
63
+ const _ = Math.hypot(F - M.sx, E - M.sy);
64
+ _ < k && (k = _, W = {
65
+ edgeId: z.id,
66
66
  end: "source",
67
67
  worldX: M.sx,
68
68
  worldY: M.sy
69
69
  });
70
- const j = Math.hypot(_ - M.tx, E - M.ty);
71
- j < k && (k = j, T = {
72
- edgeId: N.id,
70
+ const U = Math.hypot(F - M.tx, E - M.ty);
71
+ U < k && (k = U, W = {
72
+ edgeId: z.id,
73
73
  end: "target",
74
74
  worldX: M.tx,
75
75
  worldY: M.ty
76
76
  });
77
77
  }
78
- return T;
78
+ return W;
79
79
  }
80
- function Ye(_, E, X, O) {
81
- let D = null, T = O;
82
- for (const k of X) {
83
- const N = k.data.waypoints;
84
- if (N)
85
- for (let M = 0; M < N.length; M++) {
86
- const F = Math.hypot(_ - N[M].x, E - N[M].y);
87
- F < T && (T = F, D = {
80
+ function Xe(F, E, G, Z) {
81
+ let D = null, W = Z;
82
+ for (const k of G) {
83
+ const z = k.data.waypoints;
84
+ if (z)
85
+ for (let M = 0; M < z.length; M++) {
86
+ const _ = Math.hypot(F - z[M].x, E - z[M].y);
87
+ _ < W && (W = _, D = {
88
88
  edgeId: k.id,
89
89
  waypointIndex: M,
90
- wx: N[M].x,
91
- wy: N[M].y
90
+ wx: z[M].x,
91
+ wy: z[M].y
92
92
  });
93
93
  }
94
94
  }
95
95
  return D;
96
96
  }
97
- function Xe(_, E, X, O, D) {
98
- let T = null, k = D;
99
- for (const N of X) {
100
- if (N.type !== "simplebezier") continue;
101
- const M = Mt(N, O);
97
+ function Fe(F, E, G, Z, D) {
98
+ let W = null, k = D;
99
+ for (const z of G) {
100
+ if (z.type !== "simplebezier") continue;
101
+ const M = Mt(z, Z);
102
102
  if (!M) continue;
103
- const F = N.data.waypoints ?? [], j = [
103
+ const _ = z.data.waypoints ?? [], U = [
104
104
  {
105
105
  x: M.sx,
106
106
  y: M.sy
107
107
  },
108
- ...F,
108
+ ..._,
109
109
  {
110
110
  x: M.tx,
111
111
  y: M.ty
112
112
  }
113
- ], tt = N.data.bezierControls, ct = j.length - 2;
114
- for (let U = 0; U <= ct; U++) {
115
- const et = j[U], nt = j[U + 1], Tt = tt?.[U], re = Math.hypot(nt.x - et.x, nt.y - et.y), mt = Math.max(30, re * 0.3), Pt = Tt?.c1x ?? (U === 0 ? et.x + M.snx * mt : et.x + (nt.x - et.x) * 0.4), Rt = Tt?.c1y ?? (U === 0 ? et.y + M.sny * mt : et.y), It = Tt?.c2x ?? (U === ct ? nt.x + M.tnx * mt : nt.x - (nt.x - et.x) * 0.4), yt = Tt?.c2y ?? (U === ct ? nt.y + M.tny * mt : nt.y), St = Math.hypot(_ - Pt, E - Rt);
116
- St < k && (k = St, T = {
117
- edgeId: N.id,
118
- segmentIndex: U,
113
+ ], it = z.data.bezierControls, tt = U.length - 2;
114
+ for (let K = 0; K <= tt; K++) {
115
+ const et = U[K], nt = U[K + 1], mt = it?.[K], Vt = Math.hypot(nt.x - et.x, nt.y - et.y), kt = Math.max(30, Vt * 0.3), Bt = mt?.c1x ?? (K === 0 ? et.x + M.snx * kt : et.x + (nt.x - et.x) * 0.4), Ht = mt?.c1y ?? (K === 0 ? et.y + M.sny * kt : et.y), Tt = mt?.c2x ?? (K === tt ? nt.x + M.tnx * kt : nt.x - (nt.x - et.x) * 0.4), Rt = mt?.c2y ?? (K === tt ? nt.y + M.tny * kt : nt.y), It = Math.hypot(F - Bt, E - Ht);
116
+ It < k && (k = It, W = {
117
+ edgeId: z.id,
118
+ segmentIndex: K,
119
119
  controlEnd: "c1",
120
- wx: Pt,
121
- wy: Rt
120
+ wx: Bt,
121
+ wy: Ht
122
122
  });
123
- const Gt = Math.hypot(_ - It, E - yt);
124
- Gt < k && (k = Gt, T = {
125
- edgeId: N.id,
126
- segmentIndex: U,
123
+ const yt = Math.hypot(F - Tt, E - Rt);
124
+ yt < k && (k = yt, W = {
125
+ edgeId: z.id,
126
+ segmentIndex: K,
127
127
  controlEnd: "c2",
128
- wx: It,
129
- wy: yt
128
+ wx: Tt,
129
+ wy: Rt
130
130
  });
131
131
  }
132
132
  }
133
- return T;
133
+ return W;
134
134
  }
135
- function un(_, E, X, O) {
136
- const D = Mt(X, O);
135
+ function fn(F, E, G, Z) {
136
+ const D = Mt(G, Z);
137
137
  if (!D) return 0;
138
- const T = X.data.waypoints ?? [], k = [
138
+ const W = G.data.waypoints ?? [], k = [
139
139
  {
140
140
  x: D.sx,
141
141
  y: D.sy
142
142
  },
143
- ...T,
143
+ ...W,
144
144
  {
145
145
  x: D.tx,
146
146
  y: D.ty
147
147
  }
148
148
  ];
149
- let N = 1 / 0, M = 0;
150
- for (let F = 0; F < k.length - 1; F++) {
151
- const j = me(_, E, k[F].x, k[F].y, k[F + 1].x, k[F + 1].y);
152
- j < N && (N = j, M = F);
149
+ let z = 1 / 0, M = 0;
150
+ for (let _ = 0; _ < k.length - 1; _++) {
151
+ const U = me(F, E, k[_].x, k[_].y, k[_ + 1].x, k[_ + 1].y);
152
+ U < z && (z = U, M = _);
153
153
  }
154
154
  return M;
155
155
  }
156
- function fn(_, E, X, O, D = 24) {
157
- let { x: T, y: k, w: N, h: M } = { ..._ };
158
- const F = E === "nw" || E === "sw", j = E === "ne" || E === "se", tt = E === "nw" || E === "ne", ct = E === "sw" || E === "se";
159
- return F && (T += X, N -= X), j && (N += X), tt && (k += O, M -= O), ct && (M += O), N < D && (F && (T = _.x + _.w - D), N = D), M < D && (tt && (k = _.y + _.h - D), M = D), {
160
- x: T,
156
+ function hn(F, E, G, Z, D = 24) {
157
+ let { x: W, y: k, w: z, h: M } = { ...F };
158
+ const _ = E === "nw" || E === "sw", U = E === "ne" || E === "se", it = E === "nw" || E === "ne", tt = E === "sw" || E === "se";
159
+ return _ && (W += G, z -= G), U && (z += G), it && (k += Z, M -= Z), tt && (M += Z), z < D && (_ && (W = F.x + F.w - D), z = D), M < D && (it && (k = F.y + F.h - D), M = D), {
160
+ x: W,
161
161
  y: k,
162
- w: N,
162
+ w: z,
163
163
  h: M
164
164
  };
165
165
  }
166
- function we(_, E, X, O, D) {
167
- const T = Mt(X, O);
168
- if (!T) return !1;
169
- const k = Ze(_e(X.type, T, X.data.waypoints, X.data.bezierControls));
170
- for (let N = 0; N < k.length - 1; N++) if (me(_, E, k[N].x, k[N].y, k[N + 1].x, k[N + 1].y) < D) return !0;
166
+ function we(F, E, G, Z, D) {
167
+ const W = Mt(G, Z);
168
+ if (!W) return !1;
169
+ const k = qe(Ze(G.type, W, G.data.waypoints, G.data.bezierControls));
170
+ for (let z = 0; z < k.length - 1; z++) if (me(F, E, k[z].x, k[z].y, k[z + 1].x, k[z + 1].y) < D) return !0;
171
171
  return !1;
172
172
  }
173
- function Fe(_, E, X, O) {
174
- const D = X.points;
175
- for (let T = 0; T < D.length - 1; T++) if (me(_, E, D[T].x, D[T].y, D[T + 1].x, D[T + 1].y) < O) return !0;
173
+ function _e(F, E, G, Z) {
174
+ const D = G.points;
175
+ for (let W = 0; W < D.length - 1; W++) if (me(F, E, D[W].x, D[W].y, D[W + 1].x, D[W + 1].y) < Z) return !0;
176
176
  return !1;
177
177
  }
178
- function Gn({ onPixiReady: _ }) {
179
- const E = b(null), { pixiRef: X, readyRef: O } = Ke(E), { setViewportInternal: D, viewportReqRef: T, viewport: k, autoFocus: N, showGrid: M, showAnchors: F, gridSize: j, toolMode: tt, edgeType: ct, focusOnRect: U, setFocusOnRect: et, pendingPlacement: nt, setPendingPlacement: Tt, setContextMenu: re, beginNodeDrag: mt, endNodeDrag: Pt, presentation: Rt, editingNodeId: It, setEditingNodeId: yt } = Be(), { currentCanvas: St, selection: Gt, setSelection: lt, setDoc: J, currentCanvasId: oe, pushCanvas: qe, doc: Ie } = Ve(), zt = b(null), Nt = b(null), Bt = b(null), Kt = b(null), jt = b(null), se = b(null), ie = b(null), Ut = b(null), Wt = b(null), Lt = b(null), $t = b(null), Ct = b([]), ce = b(null), de = b(null), ut = b(null), At = b(null), ve = b({
178
+ function Wn({ onPixiReady: F }) {
179
+ const E = b(null), G = b(null), Z = b(13751771), { pixiRef: D, readyRef: W } = je(E, qt((l) => {
180
+ Z.current = l.gridDot, G.current && (G.current.dotColor = l.gridDot);
181
+ }, [])), { setViewportInternal: k, viewportReqRef: z, viewport: M, autoFocus: _, showGrid: U, showAnchors: it, gridSize: tt, toolMode: K, edgeType: et, focusOnRect: nt, setFocusOnRect: mt, pendingPlacement: Vt, setPendingPlacement: kt, setContextMenu: Bt, beginNodeDrag: Ht, endNodeDrag: Tt, presentation: Rt, editingNodeId: It, setEditingNodeId: yt } = Ke(), { currentCanvas: re, selection: Ie, setSelection: lt, setDoc: J, currentCanvasId: oe, pushCanvas: Oe, doc: ve } = Be(), St = b(null), Kt = b(null), jt = b(null), Ut = b(null), se = b(null), ce = b(null), $t = b(null), Pt = b(null), Gt = b(null), Jt = b(null), zt = b([]), ie = b(null), de = b(null), ut = b(null), Wt = b(null), be = b({
180
182
  time: 0,
181
183
  wx: 0,
182
184
  wy: 0
183
- }), Yt = b({
185
+ }), Lt = b({
184
186
  time: 0,
185
187
  wx: 0,
186
188
  wy: 0
187
- }), Xt = b(null), be = b({
189
+ }), At = b(null), Me = b({
188
190
  x: 0,
189
191
  y: 0
190
- }), Me = F || Rt ? St : {
191
- ...St,
192
- nodes: St.nodes.filter((u) => u.type !== "animAnchor")
193
- }, L = b(Me);
194
- L.current = Me;
192
+ }), Re = it || Rt ? re : {
193
+ ...re,
194
+ nodes: re.nodes.filter((l) => l.type !== "animAnchor")
195
+ }, A = b(Re);
196
+ A.current = Re;
195
197
  const V = b(oe);
196
198
  V.current = oe;
197
- const Ft = b(Gt);
198
- Ft.current = Gt;
199
- const Re = b(Ie);
200
- Re.current = Ie;
201
- const _t = b(tt);
202
- _t.current = tt;
203
- const Zt = b(N);
204
- Zt.current = N;
205
- const qt = b(U);
206
- qt.current = U;
207
- const Se = b(ct);
208
- Se.current = ct;
209
- const ze = b(F);
210
- ze.current = F;
211
- const Et = b(Rt);
212
- Et.current = Rt;
213
- const ae = b(nt);
214
- ae.current = nt;
215
- const Ne = b(mt);
216
- Ne.current = mt;
217
- const le = b(Pt);
218
- le.current = Pt;
219
- const ft = b(null), rt = b(null), ot = b(null), dt = b(null), xt = b(null), pt = b(null), vt = b(null), ue = b(k), fe = b(0), { vmRef: $, screenToWorld: Ce } = je(X, ne((u) => {
220
- ue.current = u, fe.current || (fe.current = requestAnimationFrame(() => {
221
- fe.current = 0, D(ue.current);
199
+ const Yt = b(Ie);
200
+ Yt.current = Ie;
201
+ const Se = b(ve);
202
+ Se.current = ve;
203
+ const Xt = b(K);
204
+ Xt.current = K;
205
+ const Ft = b(_);
206
+ Ft.current = _;
207
+ const _t = b(nt);
208
+ _t.current = nt;
209
+ const ze = b(et);
210
+ ze.current = et;
211
+ const Ce = b(it);
212
+ Ce.current = it;
213
+ const Ct = b(Rt);
214
+ Ct.current = Rt;
215
+ const ae = b(Vt);
216
+ ae.current = Vt;
217
+ const Ne = b(Ht);
218
+ Ne.current = Ht;
219
+ const le = b(Tt);
220
+ le.current = Tt;
221
+ const ft = b(null), rt = b(null), ot = b(null), dt = b(null), xt = b(null), pt = b(null), vt = b(null), ue = b(M), fe = b(0), { vmRef: $, screenToWorld: Ee } = Ue(D, qt((l) => {
222
+ ue.current = l, fe.current || (fe.current = requestAnimationFrame(() => {
223
+ fe.current = 0, k(ue.current);
222
224
  }));
223
- }, [D])), st = b(Ce);
224
- st.current = Ce;
225
- const [at, he] = Ge(null), [ye, xe] = Ge(null), pe = b(at);
225
+ }, [k])), st = b(Ee);
226
+ st.current = Ee;
227
+ const [at, he] = We(null), [ye, xe] = We(null), pe = b(at);
226
228
  pe.current = at;
227
- const Jt = b(() => {
229
+ const Qt = b(() => {
228
230
  });
229
- Jt.current = (u, P, A) => {
230
- yt(u === "node" ? P : null), he({
231
- kind: u,
232
- id: P,
233
- value: A
231
+ Qt.current = (l, T, Y) => {
232
+ yt(l === "node" ? T : null), he({
233
+ kind: l,
234
+ id: T,
235
+ value: Y
234
236
  });
235
237
  };
236
- const Ee = ne((u) => {
237
- const P = pe.current;
238
- P && (J((A) => {
239
- const W = V.current, Z = A.canvases[W];
240
- if (!Z) return A;
241
- let Y = Z;
242
- if (P.kind === "node") Y = {
243
- ...Z,
244
- nodes: Z.nodes.map((B) => B.id === P.id ? {
238
+ const De = qt((l) => {
239
+ const T = pe.current;
240
+ T && (J((Y) => {
241
+ const L = V.current, q = Y.canvases[L];
242
+ if (!q) return Y;
243
+ let X = q;
244
+ if (T.kind === "node") X = {
245
+ ...q,
246
+ nodes: q.nodes.map((B) => B.id === T.id ? {
245
247
  ...B,
246
248
  data: {
247
249
  ...B.data,
248
- label: u
250
+ label: l
249
251
  }
250
252
  } : B)
251
253
  };
252
- else if (P.kind === "edge") Y = {
253
- ...Z,
254
- edges: Z.edges.map((B) => B.id === P.id ? {
254
+ else if (T.kind === "edge") X = {
255
+ ...q,
256
+ edges: q.edges.map((B) => B.id === T.id ? {
255
257
  ...B,
256
258
  data: {
257
259
  ...B.data,
258
- labelText: u
260
+ labelText: l
259
261
  }
260
262
  } : B)
261
263
  };
262
- else return A;
264
+ else return Y;
263
265
  return {
264
- ...A,
266
+ ...Y,
265
267
  canvases: {
266
- ...A.canvases,
267
- [W]: Y
268
+ ...Y.canvases,
269
+ [L]: X
268
270
  }
269
271
  };
270
272
  }), he(null), yt(null), xe(null));
271
- }, [J, yt]), Oe = ne(() => {
273
+ }, [J, yt]), Ve = qt(() => {
272
274
  he(null), yt(null), xe(null);
273
275
  }, [yt]);
274
276
  wt(() => {
275
277
  if (!It || pe.current?.id === It) return;
276
- const u = L.current.nodes.find((P) => P.id === It);
277
- u && Jt.current("node", u.id, u.data.label);
278
+ const l = A.current.nodes.find((T) => T.id === It);
279
+ l && Qt.current("node", l.id, l.data.label);
278
280
  }, [It]), wt(() => {
279
281
  if (!at) return;
280
- const u = $.current;
281
- if (!u) return;
282
- const P = L.current;
283
- let A = null;
282
+ const l = $.current;
283
+ if (!l) return;
284
+ const T = A.current;
285
+ let Y = null;
284
286
  if (at.kind === "node") {
285
- const W = P.nodes.find((Z) => Z.id === at.id);
286
- W && (A = {
287
- x: W.position.x + W.width / 2,
288
- y: W.position.y + W.height / 2
287
+ const L = T.nodes.find((q) => q.id === at.id);
288
+ L && (Y = {
289
+ x: L.position.x + L.width / 2,
290
+ y: L.position.y + L.height / 2
289
291
  });
290
292
  } else if (at.kind === "edge") {
291
- const W = P.edges.find((Y) => Y.id === at.id), Z = /* @__PURE__ */ new Map();
292
- for (const Y of P.nodes) Z.set(Y.id, Y);
293
- if (W) {
294
- const Y = Mt(W, Z);
295
- if (Y) {
296
- const B = Ze(_e(W.type, Y, W.data.waypoints, W.data.bezierControls)), Q = B[Math.floor(B.length / 2)] ?? {
297
- x: (Y.sx + Y.tx) / 2,
298
- y: (Y.sy + Y.ty) / 2
293
+ const L = T.edges.find((X) => X.id === at.id), q = /* @__PURE__ */ new Map();
294
+ for (const X of T.nodes) q.set(X.id, X);
295
+ if (L) {
296
+ const X = Mt(L, q);
297
+ if (X) {
298
+ const B = qe(Ze(L.type, X, L.data.waypoints, L.data.bezierControls)), Q = B[Math.floor(B.length / 2)] ?? {
299
+ x: (X.sx + X.tx) / 2,
300
+ y: (X.sy + X.ty) / 2
299
301
  };
300
- A = {
302
+ Y = {
301
303
  x: Q.x,
302
304
  y: Q.y
303
305
  };
304
306
  }
305
307
  }
306
308
  }
307
- if (A) {
308
- const W = u.worldToScreen(A.x, A.y);
309
+ if (Y) {
310
+ const L = l.worldToScreen(Y.x, Y.y);
309
311
  xe({
310
- x: W.x,
311
- y: W.y
312
+ x: L.x,
313
+ y: L.y
312
314
  });
313
315
  }
314
316
  }, [at, $]);
315
317
  const ke = b(0);
316
318
  wt(() => {
317
- T.current !== ke.current && (ke.current = T.current, ue.current = k, $.current?.setState(k));
319
+ z.current !== ke.current && (ke.current = z.current, ue.current = M, $.current?.setState(M));
318
320
  }, [
319
- k,
321
+ M,
320
322
  $,
321
- T
323
+ z
322
324
  ]), wt(() => {
323
- et((u, P, A, W, Z) => {
324
- const Y = $.current, B = E.current;
325
- if (!Y || !B) return;
326
- const Q = B.clientWidth || 800, it = B.clientHeight || 600, bt = Math.max(0, Z?.padding ?? 60), Qt = Math.max(1, Q - bt * 2), m = Math.max(1, it - bt * 2), s = Z?.preserveZoom ? Y.state.zoom : Math.min(Qt / Math.max(A, 1), m / Math.max(W, 1), Z?.maxZoom ?? 2), l = u + A / 2, v = P + W / 2, G = Q / 2 - l * s, C = it / 2 - v * s;
327
- Y.animateTo({
328
- x: G,
329
- y: C,
325
+ mt((l, T, Y, L, q) => {
326
+ const X = $.current, B = E.current;
327
+ if (!X || !B) return;
328
+ const Q = B.clientWidth || 800, ct = B.clientHeight || 600, bt = Math.max(0, q?.padding ?? 60), te = Math.max(1, Q - bt * 2), m = Math.max(1, ct - bt * 2), s = q?.preserveZoom ? X.state.zoom : Math.min(te / Math.max(Y, 1), m / Math.max(L, 1), q?.maxZoom ?? 2), u = l + Y / 2, v = T + L / 2, P = Q / 2 - u * s, N = ct / 2 - v * s;
329
+ X.animateTo({
330
+ x: P,
331
+ y: N,
330
332
  zoom: s
331
- }, Z?.duration ?? 350);
333
+ }, q?.duration ?? 350);
332
334
  });
333
- }, [et, $]);
334
- const De = ne((u) => {
335
- J((P) => {
336
- const A = P.canvases[V.current];
337
- return A ? {
338
- ...P,
335
+ }, [mt, $]);
336
+ const He = qt((l) => {
337
+ J((T) => {
338
+ const Y = T.canvases[V.current];
339
+ return Y ? {
340
+ ...T,
339
341
  canvases: {
340
- ...P.canvases,
342
+ ...T.canvases,
341
343
  [V.current]: {
342
- ...A,
343
- lines: [...A.lines, u]
344
+ ...Y,
345
+ lines: [...Y.lines, l]
344
346
  }
345
347
  }
346
- } : P;
348
+ } : T;
347
349
  });
348
- }, [J, oe]), ge = b(De);
349
- return ge.current = De, wt(() => {
350
- const u = X.current;
351
- if (!u || u.destroyed) return;
352
- let P = !1;
353
- const A = () => {
354
- if (P) return;
355
- if (!O.current) {
356
- setTimeout(A, 30);
350
+ }, [J, oe]), ge = b(He);
351
+ return ge.current = He, wt(() => {
352
+ const l = D.current;
353
+ if (!l || l.destroyed) return;
354
+ let T = !1;
355
+ const Y = () => {
356
+ if (T) return;
357
+ if (!W.current) {
358
+ setTimeout(Y, 30);
357
359
  return;
358
360
  }
359
- zt.current = new Ue(u.app.stage, j, M), Nt.current = new $e(u.app.stage), Bt.current = new tn(u.world), Kt.current = new en(u.world), jt.current = new nn(u.world);
360
- const W = new Vt();
361
- W.label = "connect-line", W.visible = !1, u.world.addChild(W), xt.current = W;
362
- const Z = new Vt();
363
- Z.label = "transform-handles", u.app.stage.addChild(Z), Wt.current = Z;
364
- const Y = new Vt();
365
- Y.label = "handle-hover", u.world.addChild(Y), Lt.current = Y;
366
- const B = new Vt();
367
- B.label = "edge-edit-handles", u.world.addChild(B), At.current = B;
368
- const Q = new Vt();
369
- Q.label = "ghost-placement", Q.alpha = 0.5, u.world.addChild(Q), Xt.current = Q, $t.current = new sn(u.world), se.current = new rn(u.app.stage, u.world, {
361
+ G.current = new $e(l.app.stage, tt, U), G.current.dotColor = Z.current, St.current = new Je(l.app.stage), Kt.current = new en(l.world), jt.current = new nn(l.world), Ut.current = new rn(l.world);
362
+ const L = new Ot();
363
+ L.label = "connect-line", L.visible = !1, l.world.addChild(L), xt.current = L;
364
+ const q = new Ot();
365
+ q.label = "transform-handles", l.app.stage.addChild(q), Pt.current = q;
366
+ const X = new Ot();
367
+ X.label = "handle-hover", l.world.addChild(X), Gt.current = X;
368
+ const B = new Ot();
369
+ B.label = "edge-edit-handles", l.world.addChild(B), Wt.current = B;
370
+ const Q = new Ot();
371
+ Q.label = "ghost-placement", Q.alpha = 0.5, l.world.addChild(Q), At.current = Q, Jt.current = new cn(l.world), se.current = new on(l.app.stage, l.world, {
370
372
  onLineComplete: (m) => ge.current(m),
371
373
  screenToWorld: (m, s) => st.current(m, s)
372
- }), ie.current = new on(u.app.stage, u.world, {
374
+ }), ce.current = new sn(l.app.stage, l.world, {
373
375
  onLineComplete: (m) => ge.current(m),
374
376
  screenToWorld: (m, s) => st.current(m, s)
375
- }), _?.(u);
376
- const it = u.app.stage;
377
- it.on("pointerdown", (m) => {
377
+ }), F?.(l);
378
+ const ct = l.app.stage;
379
+ ct.on("pointerdown", (m) => {
378
380
  if (E.current?.focus({ preventScroll: !0 }), $.current?.isPanning || $.current?.isSpaceHeld || m.button !== 0) return;
379
- const s = _t.current;
381
+ const s = Xt.current;
380
382
  if (s === "pan") {
381
383
  $.current?.startPan(m.global.x, m.global.y);
382
384
  return;
383
385
  }
384
386
  if (s === "freehand" || s === "line" || s === "polyline" || s === "arrow") return;
385
- const l = st.current(m.global.x, m.global.y), v = L.current.nodes, G = L.current.edges, C = L.current.lines, I = Ft.current, S = m.metaKey || m.ctrlKey || m.shiftKey, q = $.current?.state.zoom ?? 1, e = ae.current;
387
+ const u = st.current(m.global.x, m.global.y), v = A.current.nodes, P = A.current.edges, N = A.current.lines, I = Yt.current, S = m.metaKey || m.ctrlKey || m.shiftKey, O = $.current?.state.zoom ?? 1, e = ae.current;
386
388
  if (e) {
387
- const t = Je("node"), c = l.x - e.width / 2, n = l.y - e.height / 2, o = ee([{
389
+ const t = Qe("node"), i = u.x - e.width / 2, n = u.y - e.height / 2, o = ne([{
388
390
  id: "__ghost__",
389
391
  type: e.type,
390
392
  position: {
391
- x: c,
393
+ x: i,
392
394
  y: n
393
395
  },
394
396
  width: e.width,
395
397
  height: e.height,
396
398
  data: {}
397
- }], v), r = c + o.dx, d = n + o.dy;
399
+ }], v), r = i + o.dx, d = n + o.dy;
398
400
  J((w) => {
399
401
  const g = w.canvases[V.current];
400
402
  if (!g) return w;
401
- const z = {};
402
- e.type === "animAnchor" && (z.animIndex = dn(w));
403
+ const C = {};
404
+ e.type === "animAnchor" && (C.animIndex = an(w));
403
405
  const H = Math.max(0, ...g.nodes.map((h) => h.zIndex ?? 0), ...g.lines.map((h) => h.zIndex ?? 0));
404
406
  return {
405
407
  ...w,
@@ -419,7 +421,7 @@ function Gn({ onPixiReady: _ }) {
419
421
  zIndex: H + 1,
420
422
  data: {
421
423
  ...e.data,
422
- ...z
424
+ ...C
423
425
  }
424
426
  }]
425
427
  }
@@ -429,8 +431,8 @@ function Gn({ onPixiReady: _ }) {
429
431
  nodeIds: /* @__PURE__ */ new Set([t]),
430
432
  edgeIds: /* @__PURE__ */ new Set(),
431
433
  lineIds: /* @__PURE__ */ new Set()
432
- }), Zt.current && window.setTimeout(() => {
433
- qt.current(r, d, e.width, e.height, {
434
+ }), Ft.current && window.setTimeout(() => {
435
+ _t.current(r, d, e.width, e.height, {
434
436
  padding: 80,
435
437
  preserveZoom: !0,
436
438
  duration: 280
@@ -438,36 +440,36 @@ function Gn({ onPixiReady: _ }) {
438
440
  }, 0);
439
441
  return;
440
442
  }
441
- const i = Date.now(), y = ve.current, f = i - y.time < 350 && Math.hypot(l.x - y.wx, l.y - y.wy) < 8 / q;
442
- if (ve.current = {
443
- time: i,
444
- wx: l.x,
445
- wy: l.y
443
+ const c = Date.now(), y = be.current, f = c - y.time < 350 && Math.hypot(u.x - y.wx, u.y - y.wy) < 8 / O;
444
+ if (be.current = {
445
+ time: c,
446
+ wx: u.x,
447
+ wy: u.y
446
448
  }, I.nodeIds.size === 1 && !S && s === "select") {
447
- const t = v.find((c) => c.id === [...I.nodeIds][0]);
449
+ const t = v.find((i) => i.id === [...I.nodeIds][0]);
448
450
  if (t) {
449
- const c = Le(l, t, Math.min(10 / q, 16));
450
- if (c) {
451
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), r = t.type === "geometryGroup", d = r || t.type === "flowGroup" || t.data.isGroup, w = t.position.x, g = t.position.y, z = t.width, H = t.height;
451
+ const i = Ae(u, t, Math.min(10 / O, 16));
452
+ if (i) {
453
+ const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), r = t.type === "geometryGroup", d = r || t.type === "flowGroup" || t.data.isGroup, w = t.position.x, g = t.position.y, C = t.width, H = t.height;
452
454
  for (const h of v)
453
455
  h.id !== t.id && (h.parentId === t.id ? n.set(h.id, {
454
456
  x: h.position.x,
455
457
  y: h.position.y,
456
458
  w: h.width,
457
459
  h: h.height
458
- }) : r && h.position.x >= w && h.position.y >= g && h.position.x + h.width <= w + z && h.position.y + h.height <= g + H && n.set(h.id, {
460
+ }) : r && h.position.x >= w && h.position.y >= g && h.position.x + h.width <= w + C && h.position.y + h.height <= g + H && n.set(h.id, {
459
461
  x: h.position.x,
460
462
  y: h.position.y,
461
463
  w: h.width,
462
464
  h: h.height
463
465
  }));
464
466
  if (d)
465
- for (const h of L.current.lines) h.parentId === t.id ? o.set(h.id, h.points.map((R) => ({ ...R }))) : r && h.points.length > 0 && h.points.every((R) => R.x >= w && R.x <= w + z && R.y >= g && R.y <= g + H) && o.set(h.id, h.points.map((R) => ({ ...R })));
467
+ for (const h of A.current.lines) h.parentId === t.id ? o.set(h.id, h.points.map((R) => ({ ...R }))) : r && h.points.length > 0 && h.points.every((R) => R.x >= w && R.x <= w + C && R.y >= g && R.y <= g + H) && o.set(h.id, h.points.map((R) => ({ ...R })));
466
468
  pt.current = {
467
469
  active: !0,
468
470
  nodeId: t.id,
469
- handle: c,
470
- startWorld: l,
471
+ handle: i,
472
+ startWorld: u,
471
473
  startBounds: {
472
474
  x: t.position.x,
473
475
  y: t.position.y,
@@ -482,16 +484,16 @@ function Gn({ onPixiReady: _ }) {
482
484
  }
483
485
  }
484
486
  let x = null;
485
- for (let t = v.length - 1; t >= 0; t--) if (Ht(l.x, l.y, v[t])) {
487
+ for (let t = v.length - 1; t >= 0; t--) if (Dt(u.x, u.y, v[t])) {
486
488
  x = v[t];
487
489
  break;
488
490
  }
489
491
  if (x?.parentId) {
490
- const t = v.find((c) => c.id === x.parentId);
492
+ const t = v.find((i) => i.id === x.parentId);
491
493
  t && (x = t);
492
494
  }
493
495
  if (x && (s === "select" || s === "connect")) {
494
- const t = Dt(gt(x.width, x.height), x, l.x, l.y, Math.min(14 / q, 20));
496
+ const t = Et(gt(x.width, x.height), x, u.x, u.y, Math.min(14 / O, 20));
495
497
  if (t) {
496
498
  ot.current = {
497
499
  active: !0,
@@ -504,9 +506,9 @@ function Gn({ onPixiReady: _ }) {
504
506
  if ((s === "select" || s === "connect") && !S && I.edgeIds.size > 0) {
505
507
  const t = /* @__PURE__ */ new Map();
506
508
  for (const o of v) t.set(o.id, o);
507
- const c = G.filter((o) => I.edgeIds.has(o.id)), n = Ae(l.x, l.y, c, t, Math.min(14 / q, 20));
509
+ const i = P.filter((o) => I.edgeIds.has(o.id)), n = Ye(u.x, u.y, i, t, Math.min(14 / O, 20));
508
510
  if (n) {
509
- const o = G.find((r) => r.id === n.edgeId);
511
+ const o = P.find((r) => r.id === n.edgeId);
510
512
  if (o) {
511
513
  const r = n.end === "source" ? "target" : "source";
512
514
  dt.current = {
@@ -523,7 +525,7 @@ function Gn({ onPixiReady: _ }) {
523
525
  if (s === "select" && I.edgeIds.size > 0 && !x) {
524
526
  const t = /* @__PURE__ */ new Map();
525
527
  for (const d of v) t.set(d.id, d);
526
- const c = G.filter((d) => I.edgeIds.has(d.id)), n = Math.min(10 / q, 14), o = Xe(l.x, l.y, c, t, n);
528
+ const i = P.filter((d) => I.edgeIds.has(d.id)), n = Math.min(10 / O, 14), o = Fe(u.x, u.y, i, t, n);
527
529
  if (o) {
528
530
  ut.current = {
529
531
  active: !0,
@@ -533,7 +535,7 @@ function Gn({ onPixiReady: _ }) {
533
535
  };
534
536
  return;
535
537
  }
536
- const r = Ye(l.x, l.y, c, n);
538
+ const r = Xe(u.x, u.y, i, n);
537
539
  if (r) {
538
540
  if (f) {
539
541
  J((d) => {
@@ -546,11 +548,11 @@ function Gn({ onPixiReady: _ }) {
546
548
  ...w,
547
549
  edges: w.edges.map((g) => {
548
550
  if (g.id !== r.edgeId) return g;
549
- const z = [...g.data.waypoints ?? []];
550
- z.splice(r.waypointIndex, 1);
551
+ const C = [...g.data.waypoints ?? []];
552
+ C.splice(r.waypointIndex, 1);
551
553
  const H = {
552
554
  ...g.data,
553
- waypoints: z.length > 0 ? z : void 0
555
+ waypoints: C.length > 0 ? C : void 0
554
556
  };
555
557
  if (g.type === "simplebezier" && g.data.bezierControls) {
556
558
  const h = [...g.data.bezierControls];
@@ -576,40 +578,40 @@ function Gn({ onPixiReady: _ }) {
576
578
  return;
577
579
  }
578
580
  if (f) {
579
- for (const d of c) if (we(l.x, l.y, d, t, Math.min(8 / q, 12))) {
580
- const w = un(l.x, l.y, d, t), g = {
581
- x: l.x,
582
- y: l.y
581
+ for (const d of i) if (we(u.x, u.y, d, t, Math.min(8 / O, 12))) {
582
+ const w = fn(u.x, u.y, d, t), g = {
583
+ x: u.x,
584
+ y: u.y
583
585
  };
584
- J((z) => {
585
- const H = z.canvases[V.current];
586
+ J((C) => {
587
+ const H = C.canvases[V.current];
586
588
  return H ? {
587
- ...z,
589
+ ...C,
588
590
  canvases: {
589
- ...z.canvases,
591
+ ...C.canvases,
590
592
  [V.current]: {
591
593
  ...H,
592
594
  edges: H.edges.map((h) => {
593
595
  if (h.id !== d.id) return h;
594
596
  const R = [...h.data.waypoints ?? []];
595
597
  R.splice(w, 0, g);
596
- const K = {
598
+ const j = {
597
599
  ...h.data,
598
600
  waypoints: R
599
601
  };
600
602
  if (h.type === "simplebezier" && h.data.bezierControls) {
601
603
  const ht = [...h.data.bezierControls];
602
604
  for (; ht.length < (h.data.waypoints ?? []).length + 1; ) ht.push(null);
603
- ht.splice(w, 1, null, null), K.bezierControls = ht;
605
+ ht.splice(w, 1, null, null), j.bezierControls = ht;
604
606
  }
605
607
  return {
606
608
  ...h,
607
- data: K
609
+ data: j
608
610
  };
609
611
  })
610
612
  }
611
613
  }
612
- } : z;
614
+ } : C;
613
615
  }), ut.current = {
614
616
  active: !0,
615
617
  edgeId: d.id,
@@ -632,40 +634,40 @@ function Gn({ onPixiReady: _ }) {
632
634
  edgeIds: /* @__PURE__ */ new Set(),
633
635
  lineIds: /* @__PURE__ */ new Set()
634
636
  };
635
- }), Zt.current && qt.current(x.position.x, x.position.y, x.width, x.height, {
637
+ }), Ft.current && _t.current(x.position.x, x.position.y, x.width, x.height, {
636
638
  padding: 80,
637
639
  preserveZoom: !0,
638
640
  duration: 280
639
641
  });
640
642
  const t = I.nodeIds.has(x.id) ? new Set(I.nodeIds) : /* @__PURE__ */ new Set([x.id]);
641
643
  S && !I.nodeIds.has(x.id) && t.add(x.id);
642
- const c = /* @__PURE__ */ new Set();
644
+ const i = /* @__PURE__ */ new Set();
643
645
  for (const r of [...t]) {
644
646
  const d = v.find((R) => R.id === r);
645
647
  if (!d || d.type !== "flowGroup" && d.type !== "geometryGroup" && !d.data.isGroup) continue;
646
- const w = d.type === "geometryGroup", g = d.position.x, z = d.position.y, H = d.width, h = d.height;
648
+ const w = d.type === "geometryGroup", g = d.position.x, C = d.position.y, H = d.width, h = d.height;
647
649
  for (const R of v)
648
650
  if (!(t.has(R.id) || R.id === r)) {
649
651
  if (R.parentId === r) {
650
652
  t.add(R.id);
651
653
  continue;
652
654
  }
653
- w && R.position.x >= g && R.position.y >= z && R.position.x + R.width <= g + H && R.position.y + R.height <= z + h && t.add(R.id);
655
+ w && R.position.x >= g && R.position.y >= C && R.position.x + R.width <= g + H && R.position.y + R.height <= C + h && t.add(R.id);
654
656
  }
655
- for (const R of L.current.lines) R.parentId === r && c.add(R.id);
656
- if (w) for (const R of L.current.lines)
657
- c.has(R.id) || R.points.length > 0 && R.points.every((K) => K.x >= g && K.x <= g + H && K.y >= z && K.y <= z + h) && c.add(R.id);
657
+ for (const R of A.current.lines) R.parentId === r && i.add(R.id);
658
+ if (w) for (const R of A.current.lines)
659
+ i.has(R.id) || R.points.length > 0 && R.points.every((j) => j.x >= g && j.x <= g + H && j.y >= C && j.y <= C + h) && i.add(R.id);
658
660
  }
659
661
  const n = /* @__PURE__ */ new Map();
660
662
  for (const r of v) t.has(r.id) && n.set(r.id, { ...r.position });
661
663
  const o = /* @__PURE__ */ new Map();
662
- if (c.size > 0)
663
- for (const r of L.current.lines) c.has(r.id) && o.set(r.id, r.points.map((d) => ({ ...d })));
664
+ if (i.size > 0)
665
+ for (const r of A.current.lines) i.has(r.id) && o.set(r.id, r.points.map((d) => ({ ...d })));
664
666
  ft.current = {
665
667
  active: !0,
666
668
  nodeIds: t,
667
- lineIds: c.size > 0 ? c : void 0,
668
- startWorld: l,
669
+ lineIds: i.size > 0 ? i : void 0,
670
+ startWorld: u,
669
671
  nodeStarts: n,
670
672
  linePointStarts: o.size > 0 ? o : void 0
671
673
  }, Ne.current();
@@ -673,23 +675,23 @@ function Gn({ onPixiReady: _ }) {
673
675
  }
674
676
  const p = /* @__PURE__ */ new Map();
675
677
  for (const t of v) p.set(t.id, t);
676
- const a = Math.min(8 / q, 12);
677
- for (const t of G) if (we(l.x, l.y, t, p, a)) {
678
- if (lt(S ? (c) => {
679
- const n = new Set(c.edgeIds);
678
+ const a = Math.min(8 / O, 12);
679
+ for (const t of P) if (we(u.x, u.y, t, p, a)) {
680
+ if (lt(S ? (i) => {
681
+ const n = new Set(i.edgeIds);
680
682
  return n.has(t.id) ? n.delete(t.id) : n.add(t.id), {
681
- ...c,
683
+ ...i,
682
684
  edgeIds: n
683
685
  };
684
686
  } : {
685
687
  nodeIds: /* @__PURE__ */ new Set(),
686
688
  edgeIds: /* @__PURE__ */ new Set([t.id]),
687
689
  lineIds: /* @__PURE__ */ new Set()
688
- }), Zt.current) {
689
- const c = p.get(t.source), n = p.get(t.target);
690
- if (c && n) {
691
- const o = Math.min(c.position.x, n.position.x), r = Math.min(c.position.y, n.position.y), d = Math.max(c.position.x + c.width, n.position.x + n.width), w = Math.max(c.position.y + c.height, n.position.y + n.height);
692
- qt.current(o, r, d - o, w - r, {
690
+ }), Ft.current) {
691
+ const i = p.get(t.source), n = p.get(t.target);
692
+ if (i && n) {
693
+ const o = Math.min(i.position.x, n.position.x), r = Math.min(i.position.y, n.position.y), d = Math.max(i.position.x + i.width, n.position.x + n.width), w = Math.max(i.position.y + i.height, n.position.y + n.height);
694
+ _t.current(o, r, d - o, w - r, {
693
695
  padding: 80,
694
696
  preserveZoom: !0,
695
697
  duration: 280
@@ -698,32 +700,32 @@ function Gn({ onPixiReady: _ }) {
698
700
  }
699
701
  return;
700
702
  }
701
- for (const t of C) if (Fe(l.x, l.y, t, a)) {
702
- const c = I.lineIds.has(t.id);
703
+ for (const t of N) if (_e(u.x, u.y, t, a)) {
704
+ const i = I.lineIds.has(t.id);
703
705
  if (S ? lt((r) => {
704
706
  const d = new Set(r.lineIds);
705
707
  return d.has(t.id) ? d.delete(t.id) : d.add(t.id), {
706
708
  ...r,
707
709
  lineIds: d
708
710
  };
709
- }) : c || lt({
711
+ }) : i || lt({
710
712
  nodeIds: /* @__PURE__ */ new Set(),
711
713
  edgeIds: /* @__PURE__ */ new Set(),
712
714
  lineIds: /* @__PURE__ */ new Set([t.id])
713
- }), Zt.current && t.points.length > 0) {
714
- const r = t.points.map((h) => h.x), d = t.points.map((h) => h.y), w = Math.min(...r), g = Math.min(...d), z = Math.max(...r), H = Math.max(...d);
715
- qt.current(w, g, Math.max(1, z - w), Math.max(1, H - g), {
715
+ }), Ft.current && t.points.length > 0) {
716
+ const r = t.points.map((h) => h.x), d = t.points.map((h) => h.y), w = Math.min(...r), g = Math.min(...d), C = Math.max(...r), H = Math.max(...d);
717
+ _t.current(w, g, Math.max(1, C - w), Math.max(1, H - g), {
716
718
  padding: 80,
717
719
  preserveZoom: !0,
718
720
  duration: 280
719
721
  });
720
722
  }
721
- const n = c ? new Set(I.lineIds) : /* @__PURE__ */ new Set([t.id]), o = /* @__PURE__ */ new Map();
722
- for (const r of C) n.has(r.id) && o.set(r.id, r.points.map((d) => ({ ...d })));
723
+ const n = i ? new Set(I.lineIds) : /* @__PURE__ */ new Set([t.id]), o = /* @__PURE__ */ new Map();
724
+ for (const r of N) n.has(r.id) && o.set(r.id, r.points.map((d) => ({ ...d })));
723
725
  vt.current = {
724
726
  active: !0,
725
727
  lineIds: n,
726
- startWorld: l,
728
+ startWorld: u,
727
729
  pointStarts: o
728
730
  };
729
731
  return;
@@ -739,30 +741,30 @@ function Gn({ onPixiReady: _ }) {
739
741
  y: m.global.y
740
742
  }
741
743
  });
742
- }), it.on("globalpointermove", (m) => {
744
+ }), ct.on("globalpointermove", (m) => {
743
745
  const s = st.current(m.global.x, m.global.y);
744
- be.current = s;
745
- const l = _t.current;
746
- if (l === "freehand" || l === "line" || l === "polyline" || l === "arrow") return;
747
- const v = L.current.nodes, G = L.current.edges, C = $.current?.state.zoom ?? 1, I = !ft.current?.active && !ot.current?.active && !pt.current?.active && !dt.current?.active && !ut.current?.active && !vt.current?.active;
746
+ Me.current = s;
747
+ const u = Xt.current;
748
+ if (u === "freehand" || u === "line" || u === "polyline" || u === "arrow") return;
749
+ const v = A.current.nodes, P = A.current.edges, N = $.current?.state.zoom ?? 1, I = !ft.current?.active && !ot.current?.active && !pt.current?.active && !dt.current?.active && !ut.current?.active && !vt.current?.active;
748
750
  let S = null;
749
- for (let e = v.length - 1; e >= 0; e--) if (Ht(s.x, s.y, v[e])) {
750
- const i = v[e];
751
- S = i.parentId ? v.find((y) => y.id === i.parentId)?.id ?? i.id : i.id;
751
+ for (let e = v.length - 1; e >= 0; e--) if (Dt(s.x, s.y, v[e])) {
752
+ const c = v[e];
753
+ S = c.parentId ? v.find((y) => y.id === c.parentId)?.id ?? c.id : c.id;
752
754
  break;
753
755
  }
754
- if (Ut.current = S, I && (l === "select" || l === "connect")) {
756
+ if ($t.current = S, I && (u === "select" || u === "connect")) {
755
757
  const e = /* @__PURE__ */ new Map();
756
758
  for (const p of v) e.set(p.id, p);
757
- const i = Ft.current, y = i.edgeIds.size > 0 ? G.filter((p) => i.edgeIds.has(p.id)) : [], f = y.length > 0 ? Ae(s.x, s.y, y, e, Math.min(12 / C, 18)) : null;
759
+ const c = Yt.current, y = c.edgeIds.size > 0 ? P.filter((p) => c.edgeIds.has(p.id)) : [], f = y.length > 0 ? Ye(s.x, s.y, y, e, Math.min(12 / N, 18)) : null;
758
760
  de.current = f;
759
761
  let x = null;
760
762
  if (S) {
761
763
  const p = v.find((a) => a.id === S);
762
764
  if (p) {
763
- const a = Dt(gt(p.width, p.height), p, s.x, s.y, Math.min(14 / C, 20));
765
+ const a = Et(gt(p.width, p.height), p, s.x, s.y, Math.min(14 / N, 20));
764
766
  if (a) {
765
- const t = Ot(a, p);
767
+ const t = Zt(a, p);
766
768
  x = {
767
769
  nodeId: p.id,
768
770
  handleId: a.id,
@@ -772,38 +774,38 @@ function Gn({ onPixiReady: _ }) {
772
774
  }
773
775
  }
774
776
  }
775
- ce.current = x;
777
+ ie.current = x;
776
778
  }
777
- const q = E.current;
778
- if (q && I) {
779
- const e = Ft.current;
780
- let i = "";
781
- if (de.current) i = "crosshair";
782
- else if (ce.current) i = "crosshair";
783
- else if (e.edgeIds.size > 0 && l === "select") {
784
- const y = G.filter((p) => e.edgeIds.has(p.id)), f = /* @__PURE__ */ new Map();
779
+ const O = E.current;
780
+ if (O && I) {
781
+ const e = Yt.current;
782
+ let c = "";
783
+ if (de.current) c = "crosshair";
784
+ else if (ie.current) c = "crosshair";
785
+ else if (e.edgeIds.size > 0 && u === "select") {
786
+ const y = P.filter((p) => e.edgeIds.has(p.id)), f = /* @__PURE__ */ new Map();
785
787
  for (const p of v) f.set(p.id, p);
786
- const x = Math.min(10 / C, 14);
787
- (Ye(s.x, s.y, y, x) || Xe(s.x, s.y, y, f, x)) && (i = "grab");
788
+ const x = Math.min(10 / N, 14);
789
+ (Xe(s.x, s.y, y, x) || Fe(s.x, s.y, y, f, x)) && (c = "grab");
788
790
  }
789
- if (!i && e.nodeIds.size === 1 && l === "select") {
791
+ if (!c && e.nodeIds.size === 1 && u === "select") {
790
792
  const y = v.find((f) => f.id === [...e.nodeIds][0]);
791
793
  if (y) {
792
- const f = Le(s, y, Math.min(10 / C, 16));
793
- f && (i = ln[f]);
794
+ const f = Ae(s, y, Math.min(10 / N, 16));
795
+ f && (c = un[f]);
794
796
  }
795
797
  }
796
- if (!i && l === "select") {
797
- const y = L.current.lines, f = Math.min(8 / C, 12);
798
- for (const x of y) if (Fe(s.x, s.y, x, f)) {
799
- i = "move";
798
+ if (!c && u === "select") {
799
+ const y = A.current.lines, f = Math.min(8 / N, 12);
800
+ for (const x of y) if (_e(s.x, s.y, x, f)) {
801
+ c = "move";
800
802
  break;
801
803
  }
802
804
  }
803
- q.style.cursor = i;
805
+ O.style.cursor = c;
804
806
  }
805
807
  if (pt.current?.active) {
806
- const e = pt.current, i = s.x - e.startWorld.x, y = s.y - e.startWorld.y, f = fn(e.startBounds, e.handle, i, y), x = L.current.nodes, p = ee([{
808
+ const e = pt.current, c = s.x - e.startWorld.x, y = s.y - e.startWorld.y, f = hn(e.startBounds, e.handle, c, y), x = A.current.nodes, p = ne([{
807
809
  id: e.nodeId,
808
810
  type: "shapeRect",
809
811
  position: {
@@ -814,8 +816,8 @@ function Gn({ onPixiReady: _ }) {
814
816
  height: f.h,
815
817
  data: {}
816
818
  }], x);
817
- f.x += p.dx, f.y += p.dy, (e.handle === "ne" || e.handle === "se") && (f.w += p.dx), (e.handle === "se" || e.handle === "sw") && (f.h += p.dy), Ct.current = p.guides;
818
- const a = e.startBounds, t = Math.max(f.w, 24), c = Math.max(f.h, 24), n = a.w > 0 ? t / a.w : 1, o = a.h > 0 ? c / a.h : 1;
819
+ f.x += p.dx, f.y += p.dy, (e.handle === "ne" || e.handle === "se") && (f.w += p.dx), (e.handle === "se" || e.handle === "sw") && (f.h += p.dy), zt.current = p.guides;
820
+ const a = e.startBounds, t = Math.max(f.w, 24), i = Math.max(f.h, 24), n = a.w > 0 ? t / a.w : 1, o = a.h > 0 ? i / a.h : 1;
819
821
  J((r) => {
820
822
  const d = r.canvases[V.current];
821
823
  return d ? {
@@ -832,7 +834,7 @@ function Gn({ onPixiReady: _ }) {
832
834
  y: f.y
833
835
  },
834
836
  width: t,
835
- height: c
837
+ height: i
836
838
  };
837
839
  const g = e.childStarts.get(w.id);
838
840
  return g ? {
@@ -849,9 +851,9 @@ function Gn({ onPixiReady: _ }) {
849
851
  const g = e.childLineStarts.get(w.id);
850
852
  return g ? {
851
853
  ...w,
852
- points: g.map((z) => ({
853
- x: f.x + (z.x - a.x) * n,
854
- y: f.y + (z.y - a.y) * o
854
+ points: g.map((C) => ({
855
+ x: f.x + (C.x - a.x) * n,
856
+ y: f.y + (C.y - a.y) * o
855
857
  }))
856
858
  } : w;
857
859
  }) : d.lines
@@ -862,8 +864,8 @@ function Gn({ onPixiReady: _ }) {
862
864
  return;
863
865
  }
864
866
  if (ut.current?.active) {
865
- const e = ut.current, i = L.current.nodes, y = /* @__PURE__ */ new Map();
866
- for (const f of i) y.set(f.id, f);
867
+ const e = ut.current, c = A.current.nodes, y = /* @__PURE__ */ new Map();
868
+ for (const f of c) y.set(f.id, f);
867
869
  J((f) => {
868
870
  const x = f.canvases[V.current];
869
871
  return x ? {
@@ -875,21 +877,21 @@ function Gn({ onPixiReady: _ }) {
875
877
  edges: x.edges.map((p) => {
876
878
  if (p.id !== e.edgeId) return p;
877
879
  if (e.type === "waypoint") {
878
- const kt = [...p.data.waypoints ?? []];
879
- return e.index < kt.length && (kt[e.index] = {
880
+ const Nt = [...p.data.waypoints ?? []];
881
+ return e.index < Nt.length && (Nt[e.index] = {
880
882
  x: s.x,
881
883
  y: s.y
882
884
  }), {
883
885
  ...p,
884
886
  data: {
885
887
  ...p.data,
886
- waypoints: kt
888
+ waypoints: Nt
887
889
  }
888
890
  };
889
891
  }
890
892
  const a = Mt(p, y);
891
893
  if (!a) return p;
892
- const t = p.data.waypoints ?? [], c = [
894
+ const t = p.data.waypoints ?? [], i = [
893
895
  {
894
896
  x: a.sx,
895
897
  y: a.sy
@@ -899,19 +901,19 @@ function Gn({ onPixiReady: _ }) {
899
901
  x: a.tx,
900
902
  y: a.ty
901
903
  }
902
- ], n = c.length - 1, o = [...p.data.bezierControls ?? []];
904
+ ], n = i.length - 1, o = [...p.data.bezierControls ?? []];
903
905
  for (; o.length < n; ) o.push(null);
904
906
  const r = e.index;
905
907
  if (r >= n) return p;
906
- const d = c[r], w = c[r + 1], g = o[r], z = Math.hypot(w.x - d.x, w.y - d.y), H = Math.max(30, z * 0.3), h = n - 1, R = r === 0 ? d.x + a.snx * H : d.x + (w.x - d.x) * 0.4, K = r === 0 ? d.y + a.sny * H : d.y, ht = r === h ? w.x + a.tnx * H : w.x - (w.x - d.x) * 0.4, te = r === h ? w.y + a.tny * H : w.y;
908
+ const d = i[r], w = i[r + 1], g = o[r], C = Math.hypot(w.x - d.x, w.y - d.y), H = Math.max(30, C * 0.3), h = n - 1, R = r === 0 ? d.x + a.snx * H : d.x + (w.x - d.x) * 0.4, j = r === 0 ? d.y + a.sny * H : d.y, ht = r === h ? w.x + a.tnx * H : w.x - (w.x - d.x) * 0.4, ee = r === h ? w.y + a.tny * H : w.y;
907
909
  return e.type === "bezierC1" ? o[r] = {
908
910
  c1x: s.x,
909
911
  c1y: s.y,
910
912
  c2x: g?.c2x ?? ht,
911
- c2y: g?.c2y ?? te
913
+ c2y: g?.c2y ?? ee
912
914
  } : o[r] = {
913
915
  c1x: g?.c1x ?? R,
914
- c1y: g?.c1y ?? K,
916
+ c1y: g?.c1y ?? j,
915
917
  c2x: s.x,
916
918
  c2y: s.y
917
919
  }, {
@@ -929,7 +931,7 @@ function Gn({ onPixiReady: _ }) {
929
931
  return;
930
932
  }
931
933
  if (vt.current?.active) {
932
- const e = vt.current, i = s.x - e.startWorld.x, y = s.y - e.startWorld.y;
934
+ const e = vt.current, c = s.x - e.startWorld.x, y = s.y - e.startWorld.y;
933
935
  J((f) => {
934
936
  const x = f.canvases[V.current];
935
937
  return x ? {
@@ -943,7 +945,7 @@ function Gn({ onPixiReady: _ }) {
943
945
  return a ? {
944
946
  ...p,
945
947
  points: a.map((t) => ({
946
- x: t.x + i,
948
+ x: t.x + c,
947
949
  y: t.y + y
948
950
  }))
949
951
  } : p;
@@ -955,25 +957,25 @@ function Gn({ onPixiReady: _ }) {
955
957
  return;
956
958
  }
957
959
  if (ft.current?.active) {
958
- const e = ft.current, i = s.x - e.startWorld.x, y = s.y - e.startWorld.y, f = L.current.nodes, x = ee(f.filter((t) => e.nodeIds.has(t.id)).map((t) => {
959
- const c = e.nodeStarts.get(t.id);
960
+ const e = ft.current, c = s.x - e.startWorld.x, y = s.y - e.startWorld.y, f = A.current.nodes, x = ne(f.filter((t) => e.nodeIds.has(t.id)).map((t) => {
961
+ const i = e.nodeStarts.get(t.id);
960
962
  return {
961
963
  ...t,
962
964
  position: {
963
- x: c.x + i,
964
- y: c.y + y
965
+ x: i.x + c,
966
+ y: i.y + y
965
967
  }
966
968
  };
967
- }), f), p = i + x.dx, a = y + x.dy;
968
- Ct.current = x.guides, J((t) => {
969
- const c = t.canvases[V.current];
970
- return c ? {
969
+ }), f), p = c + x.dx, a = y + x.dy;
970
+ zt.current = x.guides, J((t) => {
971
+ const i = t.canvases[V.current];
972
+ return i ? {
971
973
  ...t,
972
974
  canvases: {
973
975
  ...t.canvases,
974
976
  [V.current]: {
975
- ...c,
976
- nodes: c.nodes.map((n) => {
977
+ ...i,
978
+ nodes: i.nodes.map((n) => {
977
979
  const o = e.nodeStarts.get(n.id);
978
980
  return o ? {
979
981
  ...n,
@@ -983,7 +985,7 @@ function Gn({ onPixiReady: _ }) {
983
985
  }
984
986
  } : n;
985
987
  }),
986
- lines: e.linePointStarts ? c.lines.map((n) => {
988
+ lines: e.linePointStarts ? i.lines.map((n) => {
987
989
  const o = e.linePointStarts.get(n.id);
988
990
  return o ? {
989
991
  ...n,
@@ -992,59 +994,59 @@ function Gn({ onPixiReady: _ }) {
992
994
  y: r.y + a
993
995
  }))
994
996
  } : n;
995
- }) : c.lines
997
+ }) : i.lines
996
998
  }
997
999
  }
998
1000
  } : t;
999
1001
  });
1000
1002
  return;
1001
1003
  }
1002
- if (rt.current?.active && Nt.current) {
1003
- const e = Math.min(rt.current.startScreen.x, m.global.x), i = Math.min(rt.current.startScreen.y, m.global.y), y = Math.abs(m.global.x - rt.current.startScreen.x), f = Math.abs(m.global.y - rt.current.startScreen.y);
1004
- Nt.current.showMarquee(e, i, y, f);
1004
+ if (rt.current?.active && St.current) {
1005
+ const e = Math.min(rt.current.startScreen.x, m.global.x), c = Math.min(rt.current.startScreen.y, m.global.y), y = Math.abs(m.global.x - rt.current.startScreen.x), f = Math.abs(m.global.y - rt.current.startScreen.y);
1006
+ St.current.showMarquee(e, c, y, f);
1005
1007
  }
1006
1008
  if (ot.current?.active && xt.current) {
1007
- const e = L.current.nodes.find((i) => i.id === ot.current.sourceNodeId);
1009
+ const e = A.current.nodes.find((c) => c.id === ot.current.sourceNodeId);
1008
1010
  if (e) {
1009
- const i = gt(e.width, e.height).find((y) => y.id === ot.current.sourceHandleId);
1010
- if (i) {
1011
- const y = Ot(i, e), f = y.x, x = y.y;
1011
+ const c = gt(e.width, e.height).find((y) => y.id === ot.current.sourceHandleId);
1012
+ if (c) {
1013
+ const y = Zt(c, e), f = y.x, x = y.y;
1012
1014
  let p = s.x, a = s.y;
1013
- const t = Ut.current;
1015
+ const t = $t.current;
1014
1016
  if (t && t !== ot.current.sourceNodeId) {
1015
- const n = L.current.nodes.find((o) => o.id === t);
1017
+ const n = A.current.nodes.find((o) => o.id === t);
1016
1018
  if (n) {
1017
- const o = Dt(gt(n.width, n.height), n, s.x, s.y, 1 / 0);
1019
+ const o = Et(gt(n.width, n.height), n, s.x, s.y, 1 / 0);
1018
1020
  if (o) {
1019
- const r = Ot(o, n);
1021
+ const r = Zt(o, n);
1020
1022
  p = r.x, a = r.y;
1021
1023
  }
1022
1024
  }
1023
1025
  }
1024
- const c = xt.current;
1025
- c.clear(), c.moveTo(f, x).lineTo(p, a).stroke({
1026
+ const i = xt.current;
1027
+ i.clear(), i.moveTo(f, x).lineTo(p, a).stroke({
1026
1028
  color: 3900150,
1027
1029
  width: 2,
1028
1030
  alpha: 0.6
1029
- }), c.visible = !0;
1031
+ }), i.visible = !0;
1030
1032
  }
1031
1033
  }
1032
1034
  }
1033
1035
  if (dt.current?.active && xt.current && !xt.current.destroyed) {
1034
- const e = dt.current, i = L.current.nodes.find((y) => y.id === e.fixedNodeId);
1035
- if (i) {
1036
- const y = gt(i.width, i.height).find((o) => o.id === e.fixedHandleId), f = y ? Ot(y, i) : {
1037
- x: i.position.x + i.width / 2,
1038
- y: i.position.y + i.height / 2
1036
+ const e = dt.current, c = A.current.nodes.find((y) => y.id === e.fixedNodeId);
1037
+ if (c) {
1038
+ const y = gt(c.width, c.height).find((o) => o.id === e.fixedHandleId), f = y ? Zt(y, c) : {
1039
+ x: c.position.x + c.width / 2,
1040
+ y: c.position.y + c.height / 2
1039
1041
  }, x = f.x, p = f.y;
1040
1042
  let a = s.x, t = s.y;
1041
- const c = Ut.current;
1042
- if (c && c !== e.fixedNodeId) {
1043
- const o = L.current.nodes.find((r) => r.id === c);
1043
+ const i = $t.current;
1044
+ if (i && i !== e.fixedNodeId) {
1045
+ const o = A.current.nodes.find((r) => r.id === i);
1044
1046
  if (o) {
1045
- const r = Dt(gt(o.width, o.height), o, s.x, s.y, 1 / 0);
1047
+ const r = Et(gt(o.width, o.height), o, s.x, s.y, 1 / 0);
1046
1048
  if (r) {
1047
- const d = Ot(r, o);
1049
+ const d = Zt(r, o);
1048
1050
  a = d.x, t = d.y;
1049
1051
  }
1050
1052
  }
@@ -1059,9 +1061,9 @@ function Gn({ onPixiReady: _ }) {
1059
1061
  }
1060
1062
  });
1061
1063
  const bt = () => {
1062
- Ct.current = [];
1064
+ zt.current = [];
1063
1065
  try {
1064
- $t.current?.clear();
1066
+ Jt.current?.clear();
1065
1067
  } catch {
1066
1068
  }
1067
1069
  try {
@@ -1071,7 +1073,7 @@ function Gn({ onPixiReady: _ }) {
1071
1073
  }
1072
1074
  E.current && (E.current.style.cursor = "");
1073
1075
  };
1074
- it.on("pointerup", (m) => {
1076
+ ct.on("pointerup", (m) => {
1075
1077
  if (bt(), ut.current?.active) {
1076
1078
  ut.current = null;
1077
1079
  return;
@@ -1085,44 +1087,44 @@ function Gn({ onPixiReady: _ }) {
1085
1087
  return;
1086
1088
  }
1087
1089
  if (ft.current?.active && (ft.current = null, le.current()), rt.current?.active) {
1088
- const s = st.current(rt.current.startScreen.x, rt.current.startScreen.y), l = st.current(m.global.x, m.global.y), v = Math.min(s.x, l.x), G = Math.min(s.y, l.y), C = Math.abs(l.x - s.x), I = Math.abs(l.y - s.y);
1089
- if (C > 4 && I > 4) {
1090
- const S = L.current.nodes.filter((e) => Qe(v, G, C, I, e.position.x, e.position.y, e.width, e.height)), q = L.current.lines.filter((e) => e.points.length === 0 ? !1 : e.points.every((i) => i.x >= v && i.x <= v + C && i.y >= G && i.y <= G + I));
1090
+ const s = st.current(rt.current.startScreen.x, rt.current.startScreen.y), u = st.current(m.global.x, m.global.y), v = Math.min(s.x, u.x), P = Math.min(s.y, u.y), N = Math.abs(u.x - s.x), I = Math.abs(u.y - s.y);
1091
+ if (N > 4 && I > 4) {
1092
+ const S = A.current.nodes.filter((e) => tn(v, P, N, I, e.position.x, e.position.y, e.width, e.height)), O = A.current.lines.filter((e) => e.points.length === 0 ? !1 : e.points.every((c) => c.x >= v && c.x <= v + N && c.y >= P && c.y <= P + I));
1091
1093
  lt({
1092
1094
  nodeIds: new Set(S.map((e) => e.id)),
1093
1095
  edgeIds: /* @__PURE__ */ new Set(),
1094
- lineIds: new Set(q.map((e) => e.id))
1096
+ lineIds: new Set(O.map((e) => e.id))
1095
1097
  });
1096
1098
  }
1097
- rt.current = null, Nt.current?.hideMarquee();
1099
+ rt.current = null, St.current?.hideMarquee();
1098
1100
  }
1099
1101
  if (dt.current?.active) {
1100
- const s = dt.current.edgeId, l = dt.current.movingEnd, v = dt.current.fixedNodeId;
1102
+ const s = dt.current.edgeId, u = dt.current.movingEnd, v = dt.current.fixedNodeId;
1101
1103
  dt.current = null;
1102
- const G = st.current(m.global.x, m.global.y), C = L.current.nodes;
1104
+ const P = st.current(m.global.x, m.global.y), N = A.current.nodes;
1103
1105
  let I = null;
1104
- for (let S = C.length - 1; S >= 0; S--) if (Ht(G.x, G.y, C[S]) && C[S].id !== v) {
1105
- I = C[S];
1106
+ for (let S = N.length - 1; S >= 0; S--) if (Dt(P.x, P.y, N[S]) && N[S].id !== v) {
1107
+ I = N[S];
1106
1108
  break;
1107
1109
  }
1108
1110
  if (I) {
1109
- const S = I.id, q = Dt(gt(I.width, I.height), I, G.x, G.y, 1 / 0)?.id;
1111
+ const S = I.id, O = Et(gt(I.width, I.height), I, P.x, P.y, 1 / 0)?.id;
1110
1112
  J((e) => {
1111
- const i = e.canvases[V.current];
1112
- return i ? {
1113
+ const c = e.canvases[V.current];
1114
+ return c ? {
1113
1115
  ...e,
1114
1116
  canvases: {
1115
1117
  ...e.canvases,
1116
1118
  [V.current]: {
1117
- ...i,
1118
- edges: i.edges.map((y) => y.id !== s ? y : l === "source" ? {
1119
+ ...c,
1120
+ edges: c.edges.map((y) => y.id !== s ? y : u === "source" ? {
1119
1121
  ...y,
1120
1122
  source: S,
1121
- sourceHandle: q
1123
+ sourceHandle: O
1122
1124
  } : {
1123
1125
  ...y,
1124
1126
  target: S,
1125
- targetHandle: q
1127
+ targetHandle: O
1126
1128
  })
1127
1129
  }
1128
1130
  }
@@ -1132,33 +1134,33 @@ function Gn({ onPixiReady: _ }) {
1132
1134
  return;
1133
1135
  }
1134
1136
  if (ot.current?.active) {
1135
- const s = ot.current.sourceNodeId, l = ot.current.sourceHandleId;
1137
+ const s = ot.current.sourceNodeId, u = ot.current.sourceHandleId;
1136
1138
  ot.current = null;
1137
- const v = st.current(m.global.x, m.global.y), G = L.current.nodes;
1138
- let C = null;
1139
- for (let I = G.length - 1; I >= 0; I--) if (Ht(v.x, v.y, G[I]) && G[I].id !== s) {
1140
- C = G[I];
1139
+ const v = st.current(m.global.x, m.global.y), P = A.current.nodes;
1140
+ let N = null;
1141
+ for (let I = P.length - 1; I >= 0; I--) if (Dt(v.x, v.y, P[I]) && P[I].id !== s) {
1142
+ N = P[I];
1141
1143
  break;
1142
1144
  }
1143
- if (C) {
1144
- const I = C.id, S = Dt(gt(C.width, C.height), C, v.x, v.y, 1 / 0)?.id, q = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, e = Se.current;
1145
- J((i) => {
1146
- const y = i.canvases[V.current];
1147
- return !y || y.edges.some((f) => f.source === s && f.target === I && f.sourceHandle === l && f.targetHandle === S) ? i : {
1148
- ...i,
1145
+ if (N) {
1146
+ const I = N.id, S = Et(gt(N.width, N.height), N, v.x, v.y, 1 / 0)?.id, O = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, e = ze.current;
1147
+ J((c) => {
1148
+ const y = c.canvases[V.current];
1149
+ return !y || y.edges.some((f) => f.source === s && f.target === I && f.sourceHandle === u && f.targetHandle === S) ? c : {
1150
+ ...c,
1149
1151
  canvases: {
1150
- ...i.canvases,
1152
+ ...c.canvases,
1151
1153
  [V.current]: {
1152
1154
  ...y,
1153
1155
  edges: [...y.edges, {
1154
- id: q,
1156
+ id: O,
1155
1157
  source: s,
1156
1158
  target: I,
1157
- sourceHandle: l,
1159
+ sourceHandle: u,
1158
1160
  targetHandle: S,
1159
1161
  type: e,
1160
1162
  data: {
1161
- strokeColor: "#374151",
1163
+ strokeColor: "theme:base-content",
1162
1164
  strokeWidth: 2,
1163
1165
  lineStyle: "solid",
1164
1166
  markerEnd: "arrowclosed"
@@ -1170,49 +1172,49 @@ function Gn({ onPixiReady: _ }) {
1170
1172
  });
1171
1173
  }
1172
1174
  }
1173
- }), it.on("pointerupoutside", () => {
1174
- bt(), ft.current?.active && le.current(), ft.current = null, pt.current = null, rt.current = null, dt.current = null, ot.current = null, ut.current = null, vt.current = null, Nt.current?.hideMarquee();
1175
- }), it.on("rightclick", (m) => {
1175
+ }), ct.on("pointerupoutside", () => {
1176
+ bt(), ft.current?.active && le.current(), ft.current = null, pt.current = null, rt.current = null, dt.current = null, ot.current = null, ut.current = null, vt.current = null, St.current?.hideMarquee();
1177
+ }), ct.on("rightclick", (m) => {
1176
1178
  if (m.preventDefault?.(), $.current?.didRightPan) return;
1177
- const s = st.current(m.global.x, m.global.y), l = L.current.nodes;
1179
+ const s = st.current(m.global.x, m.global.y), u = A.current.nodes;
1178
1180
  let v = null;
1179
- for (let S = l.length - 1; S >= 0; S--) if (Ht(s.x, s.y, l[S])) {
1180
- v = l[S].id;
1181
+ for (let S = u.length - 1; S >= 0; S--) if (Dt(s.x, s.y, u[S])) {
1182
+ v = u[S].id;
1181
1183
  break;
1182
1184
  }
1183
- const G = m.nativeEvent, C = G?.clientX ?? m.global.x, I = G?.clientY ?? m.global.y;
1184
- re({
1185
- x: C,
1185
+ const P = m.nativeEvent, N = P?.clientX ?? m.global.x, I = P?.clientY ?? m.global.y;
1186
+ Bt({
1187
+ x: N,
1186
1188
  y: I,
1187
1189
  nodeId: v
1188
1190
  });
1189
- }), it.on("pointertap", (m) => {
1191
+ }), ct.on("pointertap", (m) => {
1190
1192
  if (m.button !== 0) return;
1191
- const s = Date.now(), l = st.current(m.global.x, m.global.y), v = Yt.current, G = l.x - v.wx, C = l.y - v.wy;
1192
- if (s - v.time < 400 && Math.abs(G) < 10 && Math.abs(C) < 10) {
1193
- const I = L.current.nodes;
1194
- for (let i = I.length - 1; i >= 0; i--) if (Ht(l.x, l.y, I[i])) {
1195
- const y = I[i], f = y.data.childCanvasId;
1193
+ const s = Date.now(), u = st.current(m.global.x, m.global.y), v = Lt.current, P = u.x - v.wx, N = u.y - v.wy;
1194
+ if (s - v.time < 400 && Math.abs(P) < 10 && Math.abs(N) < 10) {
1195
+ const I = A.current.nodes;
1196
+ for (let c = I.length - 1; c >= 0; c--) if (Dt(u.x, u.y, I[c])) {
1197
+ const y = I[c], f = y.data.childCanvasId;
1196
1198
  if (f) {
1197
- qe(f), Yt.current = {
1199
+ Oe(f), Lt.current = {
1198
1200
  time: 0,
1199
1201
  wx: 0,
1200
1202
  wy: 0
1201
1203
  };
1202
1204
  return;
1203
1205
  }
1204
- Jt.current("node", y.id, y.data.label ?? ""), Yt.current = {
1206
+ Qt.current("node", y.id, y.data.label ?? ""), Lt.current = {
1205
1207
  time: 0,
1206
1208
  wx: 0,
1207
1209
  wy: 0
1208
1210
  };
1209
1211
  return;
1210
1212
  }
1211
- const S = L.current.edges, q = /* @__PURE__ */ new Map();
1212
- for (const i of I) q.set(i.id, i);
1213
+ const S = A.current.edges, O = /* @__PURE__ */ new Map();
1214
+ for (const c of I) O.set(c.id, c);
1213
1215
  const e = $.current?.state.zoom ?? 1;
1214
- for (let i = S.length - 1; i >= 0; i--) if (we(l.x, l.y, S[i], q, Math.min(8 / e, 12))) {
1215
- Jt.current("edge", S[i].id, S[i].data.labelText ?? ""), Yt.current = {
1216
+ for (let c = S.length - 1; c >= 0; c--) if (we(u.x, u.y, S[c], O, Math.min(8 / e, 12))) {
1217
+ Qt.current("edge", S[c].id, S[c].data.labelText ?? ""), Lt.current = {
1216
1218
  time: 0,
1217
1219
  wx: 0,
1218
1220
  wy: 0
@@ -1220,39 +1222,39 @@ function Gn({ onPixiReady: _ }) {
1220
1222
  return;
1221
1223
  }
1222
1224
  }
1223
- Yt.current = {
1225
+ Lt.current = {
1224
1226
  time: s,
1225
- wx: l.x,
1226
- wy: l.y
1227
+ wx: u.x,
1228
+ wy: u.y
1227
1229
  };
1228
1230
  });
1229
- let Qt = !1;
1230
- u.app.ticker.add((m) => {
1231
- if (u.destroyed) return;
1232
- const s = m.deltaMS, l = u.app.screen, v = $.current?.state ?? {
1231
+ let te = !1;
1232
+ l.app.ticker.add((m) => {
1233
+ if (l.destroyed) return;
1234
+ const s = m.deltaMS, u = l.app.screen, v = $.current?.state ?? {
1233
1235
  x: 0,
1234
1236
  y: 0,
1235
1237
  zoom: 1
1236
1238
  };
1237
- zt.current?.update(v, l.width, l.height);
1238
- const G = $.current?.isPanning ?? !1;
1239
- G !== Qt && (Qt = G, E.current && (E.current.style.cursor = G ? "grabbing" : ""));
1240
- const C = L.current, I = Ft.current, S = cn(Re.current), q = /* @__PURE__ */ new Map();
1241
- S.forEach((a, t) => q.set(a.node.id, t + 1)), Bt.current?.advanceAnimation(s);
1242
- const e = Et.current ? S[Et.current.current] : void 0;
1243
- Bt.current?.sync(C.nodes, I.nodeIds, Ut.current, q, {
1244
- showAnchors: ze.current,
1245
- presentation: Et.current !== null,
1239
+ G.current?.update(v, u.width, u.height);
1240
+ const P = $.current?.isPanning ?? !1;
1241
+ P !== te && (te = P, E.current && (E.current.style.cursor = P ? "grabbing" : ""));
1242
+ const N = A.current, I = Yt.current, S = dn(Se.current), O = /* @__PURE__ */ new Map();
1243
+ S.forEach((a, t) => O.set(a.node.id, t + 1)), Kt.current?.advanceAnimation(s);
1244
+ const e = Ct.current ? S[Ct.current.current] : void 0;
1245
+ Kt.current?.sync(N.nodes, I.nodeIds, $t.current, O, {
1246
+ showAnchors: Ce.current,
1247
+ presentation: Ct.current !== null,
1246
1248
  presentationAnchorId: e?.node.id,
1247
- presentationAnchorVisible: Et.current?.showAnchor ?? !1
1249
+ presentationAnchorVisible: Ct.current?.showAnchor ?? !1
1248
1250
  });
1249
- const i = /* @__PURE__ */ new Map();
1250
- for (const a of C.nodes) i.set(a.id, a);
1251
- Kt.current?.advanceAnimation(s), Kt.current?.sync(C.edges, i, I.edgeIds, null, { presentation: Et.current !== null }), jt.current?.advanceAnimation(s), jt.current?.sync(C.lines, I.lineIds), $t.current?.update(Ct.current, l.width, l.height, v);
1252
- const y = Lt.current;
1251
+ const c = /* @__PURE__ */ new Map();
1252
+ for (const a of N.nodes) c.set(a.id, a);
1253
+ jt.current?.advanceAnimation(s), jt.current?.sync(N.edges, c, I.edgeIds, null, { presentation: Ct.current !== null }), Ut.current?.advanceAnimation(s), Ut.current?.sync(N.lines, I.lineIds), Jt.current?.update(zt.current, u.width, u.height, v);
1254
+ const y = Gt.current;
1253
1255
  if (y) {
1254
1256
  y.clear();
1255
- const a = ce.current;
1257
+ const a = ie.current;
1256
1258
  a && (y.circle(a.wx, a.wy, 10).fill({
1257
1259
  color: 3900150,
1258
1260
  alpha: 0.12
@@ -1277,23 +1279,23 @@ function Gn({ onPixiReady: _ }) {
1277
1279
  alpha: 0.9
1278
1280
  }));
1279
1281
  }
1280
- const f = Xt.current;
1282
+ const f = At.current;
1281
1283
  if (f) {
1282
1284
  f.clear();
1283
1285
  const a = ae.current;
1284
1286
  if (a) {
1285
- const t = be.current, c = t.x - a.width / 2, n = t.y - a.height / 2, o = ee([{
1287
+ const t = Me.current, i = t.x - a.width / 2, n = t.y - a.height / 2, o = ne([{
1286
1288
  id: "__ghost__",
1287
1289
  type: a.type,
1288
1290
  position: {
1289
- x: c,
1291
+ x: i,
1290
1292
  y: n
1291
1293
  },
1292
1294
  width: a.width,
1293
1295
  height: a.height,
1294
1296
  data: {}
1295
- }], C.nodes);
1296
- Ct.current = o.guides, f.position.set(c + o.dx, n + o.dy), (Pe[a.type] ?? Pe.shapeRect)(f, {
1297
+ }], N.nodes);
1298
+ zt.current = o.guides, f.position.set(i + o.dx, n + o.dy), (Ge[a.type] ?? Ge.shapeRect)(f, {
1297
1299
  width: a.width,
1298
1300
  height: a.height,
1299
1301
  fill: "#3b82f6",
@@ -1302,22 +1304,22 @@ function Gn({ onPixiReady: _ }) {
1302
1304
  borderStyle: a.data.borderStyle
1303
1305
  });
1304
1306
  } else
1305
- f.position.set(0, 0), !ft.current?.active && !pt.current?.active && (Ct.current = []);
1307
+ f.position.set(0, 0), !ft.current?.active && !pt.current?.active && (zt.current = []);
1306
1308
  }
1307
- const x = At.current;
1308
- if (x && (x.clear(), I.edgeIds.size > 0 && _t.current === "select")) {
1309
+ const x = Wt.current;
1310
+ if (x && (x.clear(), I.edgeIds.size > 0 && Xt.current === "select")) {
1309
1311
  const a = 1 / v.zoom;
1310
- for (const t of C.edges) {
1312
+ for (const t of N.edges) {
1311
1313
  if (!I.edgeIds.has(t.id)) continue;
1312
- const c = t.data.waypoints;
1313
- if (c) for (const n of c) x.circle(n.x, n.y, 5 * a).fill({ color: 16777215 }).stroke({
1314
+ const i = t.data.waypoints;
1315
+ if (i) for (const n of i) x.circle(n.x, n.y, 5 * a).fill({ color: 16777215 }).stroke({
1314
1316
  color: 3900150,
1315
1317
  width: 1.5 * a
1316
1318
  });
1317
1319
  if (t.type === "simplebezier") {
1318
- const n = Mt(t, i);
1320
+ const n = Mt(t, c);
1319
1321
  if (!n) continue;
1320
- const o = c ?? [], r = [
1322
+ const o = i ?? [], r = [
1321
1323
  {
1322
1324
  x: n.sx,
1323
1325
  y: n.sy
@@ -1329,19 +1331,19 @@ function Gn({ onPixiReady: _ }) {
1329
1331
  }
1330
1332
  ], d = t.data.bezierControls, w = r.length - 2;
1331
1333
  for (let g = 0; g <= w; g++) {
1332
- const z = r[g], H = r[g + 1], h = d?.[g], R = Math.hypot(H.x - z.x, H.y - z.y), K = Math.max(30, R * 0.3), ht = h?.c1x ?? (g === 0 ? z.x + n.snx * K : z.x + (H.x - z.x) * 0.4), te = h?.c1y ?? (g === 0 ? z.y + n.sny * K : z.y), kt = h?.c2x ?? (g === w ? H.x + n.tnx * K : H.x - (H.x - z.x) * 0.4), He = h?.c2y ?? (g === w ? H.y + n.tny * K : H.y);
1333
- x.moveTo(z.x, z.y).lineTo(ht, te).stroke({
1334
+ const C = r[g], H = r[g + 1], h = d?.[g], R = Math.hypot(H.x - C.x, H.y - C.y), j = Math.max(30, R * 0.3), ht = h?.c1x ?? (g === 0 ? C.x + n.snx * j : C.x + (H.x - C.x) * 0.4), ee = h?.c1y ?? (g === 0 ? C.y + n.sny * j : C.y), Nt = h?.c2x ?? (g === w ? H.x + n.tnx * j : H.x - (H.x - C.x) * 0.4), Te = h?.c2y ?? (g === w ? H.y + n.tny * j : H.y);
1335
+ x.moveTo(C.x, C.y).lineTo(ht, ee).stroke({
1334
1336
  color: 10265519,
1335
1337
  width: 1 * a
1336
- }), x.moveTo(H.x, H.y).lineTo(kt, He).stroke({
1338
+ }), x.moveTo(H.x, H.y).lineTo(Nt, Te).stroke({
1337
1339
  color: 10265519,
1338
1340
  width: 1 * a
1339
1341
  });
1340
- const Te = 4 * a;
1341
- x.circle(ht, te, Te).fill({ color: 16777215 }).stroke({
1342
+ const Pe = 4 * a;
1343
+ x.circle(ht, ee, Pe).fill({ color: 16777215 }).stroke({
1342
1344
  color: 3900150,
1343
1345
  width: 1.5 * a
1344
- }), x.circle(kt, He, Te).fill({ color: 16777215 }).stroke({
1346
+ }), x.circle(Nt, Te, Pe).fill({ color: 16777215 }).stroke({
1345
1347
  color: 3900150,
1346
1348
  width: 1.5 * a
1347
1349
  });
@@ -1349,22 +1351,22 @@ function Gn({ onPixiReady: _ }) {
1349
1351
  }
1350
1352
  }
1351
1353
  }
1352
- const p = Wt.current;
1353
- if (p && (p.clear(), I.nodeIds.size === 1 && _t.current === "select")) {
1354
- const a = [...I.nodeIds][0], t = C.nodes.find((c) => c.id === a);
1354
+ const p = Pt.current;
1355
+ if (p && (p.clear(), I.nodeIds.size === 1 && Xt.current === "select")) {
1356
+ const a = [...I.nodeIds][0], t = N.nodes.find((i) => i.id === a);
1355
1357
  if (t) {
1356
- const c = v.zoom, n = t.position.x * c + v.x, o = t.position.y * c + v.y, r = t.width * c, d = t.height * c;
1358
+ const i = v.zoom, n = t.position.x * i + v.x, o = t.position.y * i + v.y, r = t.width * i, d = t.height * i;
1357
1359
  p.rect(n, o, r, d).stroke({
1358
1360
  color: 3900150,
1359
1361
  width: 1.5
1360
1362
  });
1361
- const w = 7, g = w / 2, z = [
1363
+ const w = 7, g = w / 2, C = [
1362
1364
  [n, o],
1363
1365
  [n + r, o],
1364
1366
  [n + r, o + d],
1365
1367
  [n, o + d]
1366
1368
  ];
1367
- for (const [R, K] of z) p.rect(R - g, K - g, w, w).fill({ color: 16777215 }).stroke({
1369
+ for (const [R, j] of C) p.rect(R - g, j - g, w, w).fill({ color: 16777215 }).stroke({
1368
1370
  color: 3900150,
1369
1371
  width: 1.5
1370
1372
  });
@@ -1374,7 +1376,7 @@ function Gn({ onPixiReady: _ }) {
1374
1376
  [n + r / 2, o + d],
1375
1377
  [n, o + d / 2]
1376
1378
  ];
1377
- for (const [R, K] of h) p.circle(R, K, H).fill({
1379
+ for (const [R, j] of h) p.circle(R, j, H).fill({
1378
1380
  color: 3900150,
1379
1381
  alpha: 0.9
1380
1382
  });
@@ -1382,55 +1384,55 @@ function Gn({ onPixiReady: _ }) {
1382
1384
  }
1383
1385
  });
1384
1386
  };
1385
- return A(), () => {
1386
- if (P = !0, u && !u.destroyed) try {
1387
- u.app.stage.removeAllListeners();
1387
+ return Y(), () => {
1388
+ if (T = !0, l && !l.destroyed) try {
1389
+ l.app.stage.removeAllListeners();
1388
1390
  } catch {
1389
1391
  }
1390
- zt.current?.destroy(), Nt.current?.destroy(), Bt.current?.destroy(), Kt.current?.destroy(), jt.current?.destroy(), se.current?.destroy(), ie.current?.destroy(), xt.current?.destroy(), Wt.current && (Wt.current.destroy(), Wt.current = null), Lt.current && (Lt.current.destroy(), Lt.current = null), At.current && (At.current.destroy(), At.current = null), Xt.current && (Xt.current.destroy(), Xt.current = null), $t.current?.destroy();
1392
+ G.current?.destroy(), St.current?.destroy(), Kt.current?.destroy(), jt.current?.destroy(), Ut.current?.destroy(), se.current?.destroy(), ce.current?.destroy(), xt.current?.destroy(), Pt.current && (Pt.current.destroy(), Pt.current = null), Gt.current && (Gt.current.destroy(), Gt.current = null), Wt.current && (Wt.current.destroy(), Wt.current = null), At.current && (At.current.destroy(), At.current = null), Jt.current?.destroy();
1391
1393
  };
1392
- }, [X.current]), wt(() => {
1393
- const u = se.current, P = ie.current;
1394
- if (!(!u || !P))
1395
- switch (u.deactivate(), P.deactivate(), tt) {
1394
+ }, [D.current]), wt(() => {
1395
+ const l = se.current, T = ce.current;
1396
+ if (!(!l || !T))
1397
+ switch (l.deactivate(), T.deactivate(), K) {
1396
1398
  case "freehand":
1397
- u.activate();
1399
+ l.activate();
1398
1400
  break;
1399
1401
  case "line":
1400
- P.activate("straight");
1402
+ T.activate("straight");
1401
1403
  break;
1402
1404
  case "polyline":
1403
- P.activate("polyline");
1405
+ T.activate("polyline");
1404
1406
  break;
1405
1407
  case "arrow":
1406
- P.activate("arrow");
1408
+ T.activate("arrow");
1407
1409
  break;
1408
1410
  }
1409
- }, [tt]), wt(() => {
1410
- zt.current && (zt.current.visible = M, zt.current.gridSize = j);
1411
- }, [M, j]), wt(() => {
1412
- const u = E.current;
1413
- if (!u) return;
1414
- const P = 1e-3, A = (W) => {
1415
- W.preventDefault();
1416
- const Z = $.current;
1417
- if (!Z) return;
1418
- const Y = u.getBoundingClientRect(), B = W.clientX - Y.left, Q = W.clientY - Y.top, it = W.ctrlKey ? 3 : 1, bt = -W.deltaY * P * it;
1419
- Z.zoomAt(B, Q, 1 + bt);
1411
+ }, [K]), wt(() => {
1412
+ G.current && (G.current.visible = U, G.current.gridSize = tt);
1413
+ }, [U, tt]), wt(() => {
1414
+ const l = E.current;
1415
+ if (!l) return;
1416
+ const T = 1e-3, Y = (L) => {
1417
+ L.preventDefault();
1418
+ const q = $.current;
1419
+ if (!q) return;
1420
+ const X = l.getBoundingClientRect(), B = L.clientX - X.left, Q = L.clientY - X.top, ct = L.ctrlKey ? 3 : 1, bt = -L.deltaY * T * ct;
1421
+ q.zoomAt(B, Q, 1 + bt);
1420
1422
  };
1421
- return u.addEventListener("wheel", A, { passive: !1 }), () => u.removeEventListener("wheel", A);
1422
- }, [$]), /* @__PURE__ */ an("div", {
1423
+ return l.addEventListener("wheel", Y, { passive: !1 }), () => l.removeEventListener("wheel", Y);
1424
+ }, [$]), /* @__PURE__ */ ln("div", {
1423
1425
  style: {
1424
1426
  position: "relative",
1425
1427
  width: "100%",
1426
1428
  height: "100%"
1427
1429
  },
1428
- children: [/* @__PURE__ */ We("div", {
1430
+ children: [/* @__PURE__ */ Le("div", {
1429
1431
  ref: E,
1430
1432
  className: "flow-canvas-wrapper",
1431
1433
  tabIndex: -1,
1432
- onContextMenu: (u) => u.preventDefault()
1433
- }), at && ye && /* @__PURE__ */ We("input", {
1434
+ onContextMenu: (l) => l.preventDefault()
1435
+ }), at && ye && /* @__PURE__ */ Le("input", {
1434
1436
  className: "flow-label-editor",
1435
1437
  autoFocus: !0,
1436
1438
  defaultValue: at.value,
@@ -1438,16 +1440,16 @@ function Gn({ onPixiReady: _ }) {
1438
1440
  left: ye.x,
1439
1441
  top: ye.y
1440
1442
  },
1441
- onKeyDown: (u) => {
1442
- u.key === "Enter" ? (u.preventDefault(), Ee(u.target.value)) : u.key === "Escape" && (u.preventDefault(), Oe()), u.stopPropagation();
1443
+ onKeyDown: (l) => {
1444
+ l.key === "Enter" ? (l.preventDefault(), De(l.target.value)) : l.key === "Escape" && (l.preventDefault(), Ve()), l.stopPropagation();
1443
1445
  },
1444
- onBlur: (u) => Ee(u.target.value),
1445
- onPointerDown: (u) => u.stopPropagation()
1446
+ onBlur: (l) => De(l.target.value),
1447
+ onPointerDown: (l) => l.stopPropagation()
1446
1448
  })]
1447
1449
  });
1448
1450
  }
1449
1451
  export {
1450
- Gn as default
1452
+ Wn as default
1451
1453
  };
1452
1454
 
1453
1455
  //# sourceMappingURL=FlowCanvas.js.map