@infinit-canvas/react 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { jsx as S, jsxs as $t, Fragment as Ne } from "react/jsx-runtime";
1
+ import { jsx as S, jsxs as $t, Fragment as Le } from "react/jsx-runtime";
2
2
  import { useRef as tt, useState as Gt, useMemo as St, useEffect as ft, useCallback as F, useContext as qe, createContext as Fn, memo as Zt, useLayoutEffect as kr } from "react";
3
3
  import { createPortal as Yn } from "react-dom";
4
4
  const Un = 160, qn = 60;
@@ -63,8 +63,8 @@ function jn(t) {
63
63
  function xo(t, e, n = { x: 0, y: 0, zoom: 1 }, r = !1) {
64
64
  const s = e.x, o = e.y, i = e.x + e.width, c = e.y + e.height;
65
65
  return t.filter((u) => {
66
- const { width: l, height: y } = jn(u), m = u.position.x, C = u.position.y, z = m + l, M = C + y;
67
- return r ? m < i && z > s && C < c && M > o : m >= s && z <= i && C >= o && M <= c;
66
+ const { width: l, height: g } = jn(u), v = u.position.x, N = u.position.y, z = v + l, R = N + g;
67
+ return r ? v < i && z > s && N < c && R > o : v >= s && z <= i && N >= o && R <= c;
68
68
  });
69
69
  }
70
70
  function mo(t) {
@@ -949,8 +949,8 @@ function Cr(t, e) {
949
949
  const s = { worker: r };
950
950
  return mn.set(t, s), s;
951
951
  }
952
- const Vt = 160, jt = 60, Lr = 10;
953
- function Nr({
952
+ const Vt = 160, jt = 60, Nr = 10;
953
+ function Lr({
954
954
  cards: t = [],
955
955
  nodes: e = [],
956
956
  edges: n = [],
@@ -961,27 +961,27 @@ function Nr({
961
961
  onConnect: c,
962
962
  onNodeClick: u,
963
963
  onNodeDragStart: l,
964
- onNodeDrag: y,
965
- onNodeDragStop: m,
966
- onEdgeClick: C,
964
+ onNodeDrag: g,
965
+ onNodeDragStop: v,
966
+ onEdgeClick: N,
967
967
  onEdgeDoubleClick: z,
968
- onEdgeMouseEnter: M,
968
+ onEdgeMouseEnter: R,
969
969
  onEdgeMouseMove: $,
970
- onEdgeMouseLeave: R,
970
+ onEdgeMouseLeave: k,
971
971
  onEdgeContextMenu: E,
972
972
  onNodeDoubleClick: _,
973
- onNodeMouseEnter: D,
974
- onNodeMouseMove: g,
973
+ onNodeMouseEnter: B,
974
+ onNodeMouseMove: D,
975
975
  onNodeMouseLeave: f,
976
- onNodeContextMenu: p,
977
- onPaneClick: v,
978
- onPaneContextMenu: L,
976
+ onNodeContextMenu: h,
977
+ onPaneClick: p,
978
+ onPaneContextMenu: M,
979
979
  onPaneMouseEnter: w,
980
- onPaneMouseMove: P,
981
- onPaneMouseLeave: k,
982
- onSelectionChange: B,
980
+ onPaneMouseMove: C,
981
+ onPaneMouseLeave: x,
982
+ onSelectionChange: T,
983
983
  onConnectStart: j,
984
- onConnectEnd: X,
984
+ onConnectEnd: W,
985
985
  onInit: xt,
986
986
  onMoveStart: K,
987
987
  onMove: rt,
@@ -994,12 +994,12 @@ function Nr({
994
994
  gridSize: It = 40,
995
995
  zoomMin: it = 0.1,
996
996
  zoomMax: mt = 4,
997
- initialCamera: Lt = { x: 0, y: 0, zoom: 1 },
997
+ initialCamera: Nt = { x: 0, y: 0, zoom: 1 },
998
998
  fitView: zt = !1,
999
999
  fitViewOptions: dt,
1000
1000
  nodesDraggable: ht = !0,
1001
1001
  nodesConnectable: Rt = !0,
1002
- elementsSelectable: Nt = !0,
1002
+ elementsSelectable: Lt = !0,
1003
1003
  multiSelectionKeyCode: gt = "Shift",
1004
1004
  selectionOnDrag: ne = !1,
1005
1005
  selectionMode: Ie = "partial",
@@ -1023,11 +1023,11 @@ function Nr({
1023
1023
  autoPanOnNodeDrag: dn = !0,
1024
1024
  autoPanOnConnect: fn = !0,
1025
1025
  autoPanSpeed: Qt = 5,
1026
- edgesReconnectable: Ln = !1,
1026
+ edgesReconnectable: Nn = !1,
1027
1027
  elevateNodesOnSelect: hn = !1,
1028
1028
  edgeRouting: fe = !0
1029
1029
  } = {}) {
1030
- const vt = tt(null), Te = tt(null), Et = tt(null), pt = tt({ ...Lt }), se = tt([...t]), Z = tt([...e]), Pt = tt([...n]), yn = tt(/* @__PURE__ */ new Map()), Se = tt(!1), te = tt(null), [gn, pn] = Gt(!1), _t = tt(null), Wt = tt(null), Me = tt(null), ie = tt(null), Ut = tt(!1), Re = tt(null), [Be, Je] = Gt({ x: Lt.x, y: Lt.y, zoom: Lt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = tt(!1), O = tt({});
1030
+ const vt = tt(null), Te = tt(null), Et = tt(null), pt = tt({ ...Nt }), se = tt([...t]), Z = tt([...e]), Pt = tt([...n]), yn = tt(/* @__PURE__ */ new Map()), Se = tt(!1), te = tt(null), [gn, pn] = Gt(!1), _t = tt(null), Wt = tt(null), Me = tt(null), ie = tt(null), Ut = tt(!1), Re = tt(null), [Be, Je] = Gt({ x: Nt.x, y: Nt.y, zoom: Nt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = tt(!1), O = tt({});
1031
1031
  O.current = {
1032
1032
  onHudUpdate: r,
1033
1033
  onNodesProcessed: s,
@@ -1036,27 +1036,27 @@ function Nr({
1036
1036
  onConnect: c,
1037
1037
  onNodeClick: u,
1038
1038
  onNodeDragStart: l,
1039
- onNodeDrag: y,
1040
- onNodeDragStop: m,
1041
- onEdgeClick: C,
1039
+ onNodeDrag: g,
1040
+ onNodeDragStop: v,
1041
+ onEdgeClick: N,
1042
1042
  onEdgeDoubleClick: z,
1043
- onEdgeMouseEnter: M,
1043
+ onEdgeMouseEnter: R,
1044
1044
  onEdgeMouseMove: $,
1045
- onEdgeMouseLeave: R,
1045
+ onEdgeMouseLeave: k,
1046
1046
  onEdgeContextMenu: E,
1047
1047
  onNodeDoubleClick: _,
1048
- onNodeMouseEnter: D,
1049
- onNodeMouseMove: g,
1048
+ onNodeMouseEnter: B,
1049
+ onNodeMouseMove: D,
1050
1050
  onNodeMouseLeave: f,
1051
- onNodeContextMenu: p,
1052
- onPaneClick: v,
1053
- onPaneContextMenu: L,
1051
+ onNodeContextMenu: h,
1052
+ onPaneClick: p,
1053
+ onPaneContextMenu: M,
1054
1054
  onPaneMouseEnter: w,
1055
- onPaneMouseMove: P,
1056
- onPaneMouseLeave: k,
1057
- onSelectionChange: B,
1055
+ onPaneMouseMove: C,
1056
+ onPaneMouseLeave: x,
1057
+ onSelectionChange: T,
1058
1058
  onConnectStart: j,
1059
- onConnectEnd: X,
1059
+ onConnectEnd: W,
1060
1060
  onInit: xt,
1061
1061
  onMoveStart: K,
1062
1062
  onMove: rt,
@@ -1094,88 +1094,88 @@ function Nr({
1094
1094
  ft(() => {
1095
1095
  const a = (d) => {
1096
1096
  d.key === gt && (Ut.current = !0), d.key === we && (ke.current = !0);
1097
- }, x = (d) => {
1097
+ }, m = (d) => {
1098
1098
  d.key === gt && (Ut.current = !1), d.key === we && (ke.current = !1);
1099
1099
  };
1100
- return window.addEventListener("keydown", a), window.addEventListener("keyup", x), () => {
1101
- window.removeEventListener("keydown", a), window.removeEventListener("keyup", x);
1100
+ return window.addEventListener("keydown", a), window.addEventListener("keyup", m), () => {
1101
+ window.removeEventListener("keydown", a), window.removeEventListener("keyup", m);
1102
1102
  };
1103
1103
  }, [gt, we]);
1104
1104
  const Jt = F(() => {
1105
1105
  var b;
1106
- const a = Z.current.filter((N) => N.selected), x = Pt.current.filter((N) => N.selected), d = { nodes: a, edges: x };
1106
+ const a = Z.current.filter((L) => L.selected), m = Pt.current.filter((L) => L.selected), d = { nodes: a, edges: m };
1107
1107
  (b = ye.current) == null || b.call(ye, d);
1108
- for (const N of he) N(d);
1108
+ for (const L of he) L(d);
1109
1109
  }, [he]);
1110
1110
  ft(() => {
1111
1111
  var a;
1112
1112
  se.current = [...t], (a = Et.current) == null || a.postMessage({ type: "cards", data: { cards: [...t] } });
1113
1113
  }, [t]);
1114
1114
  const ze = F((a) => {
1115
- const x = {};
1116
- for (const d of a) x[d.id] = d;
1115
+ const m = {};
1116
+ for (const d of a) m[d.id] = d;
1117
1117
  return a.map((d) => {
1118
1118
  if (!d.parentId) return d;
1119
- const b = x[d.parentId];
1119
+ const b = m[d.parentId];
1120
1120
  if (!b) return d;
1121
- let N = d.position.x, I = d.position.y, h = b;
1122
- for (; h; )
1123
- N += h.position.x, I += h.position.y, h = h.parentId ? x[h.parentId] : null;
1124
- return { ...d, _absolutePosition: { x: N, y: I } };
1121
+ let L = d.position.x, I = d.position.y, y = b;
1122
+ for (; y; )
1123
+ L += y.position.x, I += y.position.y, y = y.parentId ? m[y.parentId] : null;
1124
+ return { ...d, _absolutePosition: { x: L, y: I } };
1125
1125
  });
1126
1126
  }, []), ee = tt([]), Q = F((a) => {
1127
- const x = yn.current;
1128
- if (!x || x.size === 0) return a;
1127
+ const m = yn.current;
1128
+ if (!m || m.size === 0) return a;
1129
1129
  const d = {};
1130
- for (const [, b] of x)
1130
+ for (const [, b] of m)
1131
1131
  d[b.nodeId] || (d[b.nodeId] = []), d[b.nodeId].push({ id: b.id, type: b.type, position: b.position, x: b.x, y: b.y });
1132
1132
  return a.map((b) => {
1133
- const N = d[b.id];
1134
- return N && N.length > 0 ? { ...b, handles: N } : b;
1133
+ const L = d[b.id];
1134
+ return L && L.length > 0 ? { ...b, handles: L } : b;
1135
1135
  });
1136
1136
  }, []), Ft = F(() => {
1137
- var x;
1137
+ var m;
1138
1138
  if (_t.current) return;
1139
1139
  const a = Q(ee.current);
1140
- (x = Et.current) == null || x.postMessage({ type: "nodes", data: { nodes: a } });
1140
+ (m = Et.current) == null || m.postMessage({ type: "nodes", data: { nodes: a } });
1141
1141
  }, [Q]);
1142
1142
  ft(() => {
1143
1143
  var d;
1144
1144
  if (_t.current) {
1145
- const b = _t.current.id, N = /* @__PURE__ */ new Set([b, ..._t.current.selectedStarts.map((h) => h.id)]), I = {};
1146
- for (const h of Z.current)
1147
- N.has(h.id) && (I[h.id] = { ...h.position });
1145
+ const b = _t.current.id, L = /* @__PURE__ */ new Set([b, ..._t.current.selectedStarts.map((y) => y.id)]), I = {};
1146
+ for (const y of Z.current)
1147
+ L.has(y.id) && (I[y.id] = { ...y.position });
1148
1148
  Z.current = [...e];
1149
- for (const h of Z.current)
1150
- I[h.id] && (h.position = I[h.id]);
1149
+ for (const y of Z.current)
1150
+ I[y.id] && (y.position = I[y.id]);
1151
1151
  ee.current = ze(Z.current);
1152
1152
  return;
1153
1153
  }
1154
1154
  Z.current = [...e];
1155
1155
  const a = ze(e);
1156
1156
  ee.current = a;
1157
- const x = Q(a);
1158
- (d = Et.current) == null || d.postMessage({ type: "nodes", data: { nodes: x } });
1157
+ const m = Q(a);
1158
+ (d = Et.current) == null || d.postMessage({ type: "nodes", data: { nodes: m } });
1159
1159
  }, [e, ze, Q]), ft(() => {
1160
1160
  var a;
1161
1161
  Pt.current = [...n], (a = Et.current) == null || a.postMessage({ type: "edges", data: { edges: [...n] } });
1162
1162
  }, [n]);
1163
- const at = F((a, x) => {
1163
+ const at = F((a, m) => {
1164
1164
  const d = vt.current;
1165
1165
  if (!d) return { x: 0, y: 0 };
1166
- const b = d.getBoundingClientRect(), N = pt.current;
1166
+ const b = d.getBoundingClientRect(), L = pt.current;
1167
1167
  return {
1168
- x: (a - b.left - N.x) / N.zoom,
1169
- y: (x - b.top - N.y) / N.zoom
1168
+ x: (a - b.left - L.x) / L.zoom,
1169
+ y: (m - b.top - L.y) / L.zoom
1170
1170
  };
1171
- }, []), Tt = F((a, x) => {
1171
+ }, []), Tt = F((a, m) => {
1172
1172
  const d = ee.current.length > 0 ? ee.current : Z.current;
1173
1173
  let b = null;
1174
- for (let N = d.length - 1; N >= 0; N--) {
1175
- const I = d[N];
1174
+ for (let L = d.length - 1; L >= 0; L--) {
1175
+ const I = d[L];
1176
1176
  if (I.hidden) continue;
1177
- const h = I._absolutePosition || I.position, A = I.width || Vt, T = I.height || jt;
1178
- if (a >= h.x && a <= h.x + A && x >= h.y && x <= h.y + T) {
1177
+ const y = I._absolutePosition || I.position, A = I.width || Vt, P = I.height || jt;
1178
+ if (a >= y.x && a <= y.x + A && m >= y.y && m <= y.y + P) {
1179
1179
  if (I.type === "group") {
1180
1180
  b || (b = I);
1181
1181
  continue;
@@ -1184,58 +1184,58 @@ function Nr({
1184
1184
  }
1185
1185
  }
1186
1186
  return b;
1187
- }, []), xe = F((a, x) => {
1188
- const d = x.width || Vt, b = x.height || jt;
1187
+ }, []), xe = F((a, m) => {
1188
+ const d = m.width || Vt, b = m.height || jt;
1189
1189
  if (a.x !== void 0 && a.y !== void 0)
1190
- return { x: x.position.x + a.x, y: x.position.y + a.y };
1190
+ return { x: m.position.x + a.x, y: m.position.y + a.y };
1191
1191
  switch (a.position || (a.type === "source" ? "right" : "left")) {
1192
1192
  case "top":
1193
- return { x: x.position.x + d / 2, y: x.position.y };
1193
+ return { x: m.position.x + d / 2, y: m.position.y };
1194
1194
  case "bottom":
1195
- return { x: x.position.x + d / 2, y: x.position.y + b };
1195
+ return { x: m.position.x + d / 2, y: m.position.y + b };
1196
1196
  case "left":
1197
- return { x: x.position.x, y: x.position.y + b / 2 };
1197
+ return { x: m.position.x, y: m.position.y + b / 2 };
1198
1198
  case "right":
1199
- return { x: x.position.x + d, y: x.position.y + b / 2 };
1199
+ return { x: m.position.x + d, y: m.position.y + b / 2 };
1200
1200
  default:
1201
- return { x: x.position.x + d, y: x.position.y + b / 2 };
1201
+ return { x: m.position.x + d, y: m.position.y + b / 2 };
1202
1202
  }
1203
1203
  }, []), Ee = F((a) => {
1204
- const x = a.width || Vt, d = a.height || jt;
1204
+ const m = a.width || Vt, d = a.height || jt;
1205
1205
  return a.handles && a.handles.length > 0 ? a.handles.map((b) => {
1206
- const N = xe(b, a);
1207
- return { id: b.id || null, type: b.type, x: N.x, y: N.y };
1206
+ const L = xe(b, a);
1207
+ return { id: b.id || null, type: b.type, x: L.x, y: L.y };
1208
1208
  }) : [
1209
1209
  { id: null, type: "target", x: a.position.x, y: a.position.y + d / 2 },
1210
- { id: null, type: "source", x: a.position.x + x, y: a.position.y + d / 2 }
1210
+ { id: null, type: "source", x: a.position.x + m, y: a.position.y + d / 2 }
1211
1211
  ];
1212
- }, [xe]), tn = F((a, x) => {
1213
- const d = Z.current, b = pt.current, N = Math.max(Lr, Ot) / b.zoom;
1212
+ }, [xe]), tn = F((a, m) => {
1213
+ const d = Z.current, b = pt.current, L = Math.max(Nr, Ot) / b.zoom;
1214
1214
  for (let I = d.length - 1; I >= 0; I--) {
1215
- const h = d[I];
1216
- if (h.hidden) continue;
1217
- const A = Ee(h);
1218
- for (const T of A)
1219
- if (Math.abs(a - T.x) < N && Math.abs(x - T.y) < N)
1220
- return { nodeId: h.id, handleId: T.id, type: T.type, x: T.x, y: T.y };
1215
+ const y = d[I];
1216
+ if (y.hidden) continue;
1217
+ const A = Ee(y);
1218
+ for (const P of A)
1219
+ if (Math.abs(a - P.x) < L && Math.abs(m - P.y) < L)
1220
+ return { nodeId: y.id, handleId: P.id, type: P.type, x: P.x, y: P.y };
1221
1221
  }
1222
1222
  return null;
1223
- }, [Ee]), ue = F((a, x) => {
1223
+ }, [Ee]), ue = F((a, m) => {
1224
1224
  const b = 8 / pt.current.zoom;
1225
- for (let N = Pt.current.length - 1; N >= 0; N--) {
1226
- const I = Pt.current[N], h = Z.current.find((Mt) => Mt.id === I.source), A = Z.current.find((Mt) => Mt.id === I.target);
1227
- if (!h || !A) continue;
1228
- const T = h.width || Vt, Y = h.height || jt, H = A.height || jt, J = h.position.x + T, ct = h.position.y + Y / 2, U = A.position.x, nt = A.position.y + H / 2;
1229
- if (Ir(a, x, J, ct, U, nt) < b) return I;
1225
+ for (let L = Pt.current.length - 1; L >= 0; L--) {
1226
+ const I = Pt.current[L], y = Z.current.find((Mt) => Mt.id === I.source), A = Z.current.find((Mt) => Mt.id === I.target);
1227
+ if (!y || !A) continue;
1228
+ const P = y.width || Vt, Y = y.height || jt, H = A.height || jt, J = y.position.x + P, ct = y.position.y + Y / 2, U = A.position.x, nt = A.position.y + H / 2;
1229
+ if (Ir(a, m, J, ct, U, nt) < b) return I;
1230
1230
  }
1231
1231
  return null;
1232
1232
  }, []);
1233
1233
  ft(() => {
1234
- const a = Te.current, x = vt.current;
1235
- if (!a || !x) return;
1236
- const d = x.getBoundingClientRect(), b = st !== void 0 ? st : matchMedia("(prefers-color-scheme: dark)").matches, N = ze(Z.current);
1237
- ee.current = N;
1238
- const I = Q(N), { worker: h } = Cr(a, {
1234
+ const a = Te.current, m = vt.current;
1235
+ if (!a || !m) return;
1236
+ const d = m.getBoundingClientRect(), b = st !== void 0 ? st : matchMedia("(prefers-color-scheme: dark)").matches, L = ze(Z.current);
1237
+ ee.current = L;
1238
+ const I = Q(L), { worker: y } = Cr(a, {
1239
1239
  width: d.width,
1240
1240
  height: d.height,
1241
1241
  camera: pt.current,
@@ -1246,18 +1246,18 @@ function Nr({
1246
1246
  gridSize: It,
1247
1247
  edgeRouting: fe
1248
1248
  });
1249
- h.onmessage = (H) => {
1249
+ y.onmessage = (H) => {
1250
1250
  var J, ct;
1251
1251
  H.data.type === "hud" && ((J = ge.current) == null || J.call(ge, H.data.data)), H.data.type === "ready" && pn(!0), H.data.type === "nodesProcessed" && ((ct = pe.current) == null || ct.call(pe, H.data.data));
1252
- }, Et.current = h;
1252
+ }, Et.current = y;
1253
1253
  const A = new ResizeObserver((H) => {
1254
1254
  const { width: J, height: ct } = H[0].contentRect;
1255
- h.postMessage({ type: "resize", data: { width: J, height: ct } });
1255
+ y.postMessage({ type: "resize", data: { width: J, height: ct } });
1256
1256
  });
1257
- A.observe(x);
1258
- let T, Y;
1259
- return st === void 0 && (T = matchMedia("(prefers-color-scheme: dark)"), Y = (H) => h.postMessage({ type: "theme", data: { dark: H.matches } }), T.addEventListener("change", Y)), () => {
1260
- A.disconnect(), T && Y && T.removeEventListener("change", Y), Et.current = null;
1257
+ A.observe(m);
1258
+ let P, Y;
1259
+ return st === void 0 && (P = matchMedia("(prefers-color-scheme: dark)"), Y = (H) => y.postMessage({ type: "theme", data: { dark: H.matches } }), P.addEventListener("change", Y)), () => {
1260
+ A.disconnect(), P && Y && P.removeEventListener("change", Y), Et.current = null;
1261
1261
  };
1262
1262
  }, []), ft(() => {
1263
1263
  var a;
@@ -1266,69 +1266,69 @@ function Nr({
1266
1266
  var a;
1267
1267
  (a = Et.current) == null || a.postMessage({ type: "edgeRouting", data: { enabled: fe } });
1268
1268
  }, [fe]);
1269
- const Nn = tt(0), Ct = F((a = null) => {
1270
- var b, N, I;
1271
- const x = pt.current;
1269
+ const Ln = tt(0), Ct = F((a = null) => {
1270
+ var b, L, I;
1271
+ const m = pt.current;
1272
1272
  if (re) {
1273
- const h = vt.current;
1274
- if (h) {
1275
- const A = h.getBoundingClientRect(), T = -re[1][0] * x.zoom + A.width, Y = -re[1][1] * x.zoom + A.height, H = -re[0][0] * x.zoom, J = -re[0][1] * x.zoom;
1276
- x.x = Math.min(H, Math.max(T, x.x)), x.y = Math.min(J, Math.max(Y, x.y));
1273
+ const y = vt.current;
1274
+ if (y) {
1275
+ const A = y.getBoundingClientRect(), P = -re[1][0] * m.zoom + A.width, Y = -re[1][1] * m.zoom + A.height, H = -re[0][0] * m.zoom, J = -re[0][1] * m.zoom;
1276
+ m.x = Math.min(H, Math.max(P, m.x)), m.y = Math.min(J, Math.max(Y, m.y));
1277
1277
  }
1278
1278
  }
1279
- (b = Et.current) == null || b.postMessage({ type: "camera", data: { camera: { ...x } } });
1280
- const d = { x: x.x, y: x.y, zoom: x.zoom };
1281
- (I = (N = O.current).onMove) == null || I.call(N, a, d);
1282
- for (const h of Kt) h(d);
1283
- cancelAnimationFrame(Nn.current), Nn.current = requestAnimationFrame(() => {
1284
- Je({ x: x.x, y: x.y, zoom: x.zoom });
1279
+ (b = Et.current) == null || b.postMessage({ type: "camera", data: { camera: { ...m } } });
1280
+ const d = { x: m.x, y: m.y, zoom: m.zoom };
1281
+ (I = (L = O.current).onMove) == null || I.call(L, a, d);
1282
+ for (const y of Kt) y(d);
1283
+ cancelAnimationFrame(Ln.current), Ln.current = requestAnimationFrame(() => {
1284
+ Je({ x: m.x, y: m.y, zoom: m.zoom });
1285
1285
  });
1286
1286
  }, [Kt, re]), Ce = F(() => {
1287
1287
  var d, b;
1288
- const a = Wt.current, x = Me.current;
1289
- a && x ? ((d = Et.current) == null || d.postMessage({ type: "connecting", data: { from: a.startPos, to: x, _routedPoints: null } }), ae({ source: a.sourceId, sourceHandle: a.sourceHandle, target: null, targetHandle: null })) : ((b = Et.current) == null || b.postMessage({ type: "connecting", data: null }), ae(null));
1290
- }, []), Le = F(() => {
1291
- var x, d;
1288
+ const a = Wt.current, m = Me.current;
1289
+ a && m ? ((d = Et.current) == null || d.postMessage({ type: "connecting", data: { from: a.startPos, to: m, _routedPoints: null } }), ae({ source: a.sourceId, sourceHandle: a.sourceHandle, target: null, targetHandle: null })) : ((b = Et.current) == null || b.postMessage({ type: "connecting", data: null }), ae(null));
1290
+ }, []), Ne = F(() => {
1291
+ var m, d;
1292
1292
  const a = ie.current;
1293
- a ? (x = Et.current) == null || x.postMessage({ type: "selectionBox", data: a }) : (d = Et.current) == null || d.postMessage({ type: "selectionBox", data: null });
1293
+ a ? (m = Et.current) == null || m.postMessage({ type: "selectionBox", data: a }) : (d = Et.current) == null || d.postMessage({ type: "selectionBox", data: null });
1294
1294
  }, []), dr = F((a) => {
1295
- var N, I, h, A, T, Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht;
1296
- const x = Z.current.length > 0, d = at(a.clientX, a.clientY), b = Ut.current;
1297
- if (x && Rt) {
1298
- const W = tn(d.x, d.y);
1299
- if (Yt && Re.current && W) {
1295
+ var L, I, y, A, P, Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht;
1296
+ const m = Z.current.length > 0, d = at(a.clientX, a.clientY), b = Ut.current;
1297
+ if (m && Rt) {
1298
+ const X = tn(d.x, d.y);
1299
+ if (Yt && Re.current && X) {
1300
1300
  const V = Re.current;
1301
- if (W.nodeId !== V.nodeId) {
1302
- const qt = V.handleType === "target" ? { source: W.nodeId, target: V.nodeId, sourceHandle: W.handleId || null, targetHandle: V.handleId } : { source: V.nodeId, target: W.nodeId, sourceHandle: V.handleId, targetHandle: W.handleId || null };
1303
- (O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((N = ce.current) == null || N.call(ce, { ...qt, ...be }));
1301
+ if (X.nodeId !== V.nodeId) {
1302
+ const qt = V.handleType === "target" ? { source: X.nodeId, target: V.nodeId, sourceHandle: X.handleId || null, targetHandle: V.handleId } : { source: V.nodeId, target: X.nodeId, sourceHandle: V.handleId, targetHandle: X.handleId || null };
1303
+ (O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((L = ce.current) == null || L.call(ce, { ...qt, ...be }));
1304
1304
  }
1305
1305
  Re.current = null;
1306
1306
  return;
1307
1307
  }
1308
- if (Bt === "strict" ? W && W.type === "source" : W != null) {
1308
+ if (Bt === "strict" ? X && X.type === "source" : X != null) {
1309
1309
  if (Yt) {
1310
- Re.current = { nodeId: W.nodeId, handleId: W.handleId || null, handleType: W.type }, (h = (I = O.current).onConnectStart) == null || h.call(I, a, { nodeId: W.nodeId, handleId: W.handleId, handleType: W.type });
1310
+ Re.current = { nodeId: X.nodeId, handleId: X.handleId || null, handleType: X.type }, (y = (I = O.current).onConnectStart) == null || y.call(I, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type });
1311
1311
  return;
1312
1312
  }
1313
1313
  Wt.current = {
1314
- sourceId: W.nodeId,
1315
- sourceHandle: W.handleId || null,
1316
- sourceType: W.type,
1317
- startPos: { x: W.x, y: W.y }
1318
- }, Me.current = { x: d.x, y: d.y }, (A = vt.current) == null || A.setPointerCapture(a.pointerId), (Y = (T = O.current).onConnectStart) == null || Y.call(T, a, { nodeId: W.nodeId, handleId: W.handleId, handleType: W.type }), Ce();
1314
+ sourceId: X.nodeId,
1315
+ sourceHandle: X.handleId || null,
1316
+ sourceType: X.type,
1317
+ startPos: { x: X.x, y: X.y }
1318
+ }, Me.current = { x: d.x, y: d.y }, (A = vt.current) == null || A.setPointerCapture(a.pointerId), (Y = (P = O.current).onConnectStart) == null || Y.call(P, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type }), Ce();
1319
1319
  return;
1320
1320
  }
1321
1321
  }
1322
- if (x) {
1323
- const W = Tt(d.x, d.y);
1324
- if (W) {
1325
- if (bt.current && Nt) {
1322
+ if (m) {
1323
+ const X = Tt(d.x, d.y);
1324
+ if (X) {
1325
+ if (bt.current && Lt) {
1326
1326
  const kt = [];
1327
1327
  if (b)
1328
- kt.push({ id: W.id, type: "select", selected: !W.selected });
1329
- else if (!W.selected) {
1328
+ kt.push({ id: X.id, type: "select", selected: !X.selected });
1329
+ else if (!X.selected) {
1330
1330
  for (const V of Z.current)
1331
- V.id === W.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1331
+ V.id === X.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1332
1332
  if (Dt.current) {
1333
1333
  const V = Pt.current.filter((et) => et.selected).map((et) => ({ id: et.id, type: "select", selected: !1 }));
1334
1334
  V.length && Dt.current(V);
@@ -1336,32 +1336,32 @@ function Nr({
1336
1336
  }
1337
1337
  if (kt.length) {
1338
1338
  if (bt.current(kt), hn && !b) {
1339
- const V = Z.current.findIndex((et) => et.id === W.id);
1339
+ const V = Z.current.findIndex((et) => et.id === X.id);
1340
1340
  V >= 0 && V < Z.current.length - 1 && bt.current([
1341
- { id: W.id, type: "remove" },
1341
+ { id: X.id, type: "remove" },
1342
1342
  { type: "add", item: { ...Z.current[V], selected: !0 } }
1343
1343
  ]);
1344
1344
  }
1345
1345
  Jt();
1346
1346
  }
1347
1347
  }
1348
- if ((H = De.current) == null || H.call(De, a, W), ht) {
1349
- const kt = b && W.selected;
1348
+ if ((H = De.current) == null || H.call(De, a, X), ht) {
1349
+ const kt = b && X.selected;
1350
1350
  let V = null;
1351
- if (W.parentId && W.extent === "parent") {
1352
- const et = Z.current.find((qt) => qt.id === W.parentId);
1351
+ if (X.parentId && X.extent === "parent") {
1352
+ const et = Z.current.find((qt) => qt.id === X.parentId);
1353
1353
  if (et) {
1354
- const qt = et.width || Vt, Xe = et.height || jt, en = W.width || ((J = W.measured) == null ? void 0 : J.width) || Vt, Fe = W.height || ((ct = W.measured) == null ? void 0 : ct.height) || jt;
1354
+ const qt = et.width || Vt, Xe = et.height || jt, en = X.width || ((J = X.measured) == null ? void 0 : J.width) || Vt, Fe = X.height || ((ct = X.measured) == null ? void 0 : ct.height) || jt;
1355
1355
  V = { minX: 0, minY: 0, maxX: qt - en, maxY: Xe - Fe };
1356
1356
  }
1357
1357
  }
1358
1358
  if (_t.current = {
1359
- id: W.id,
1360
- startPos: { ...W.position },
1359
+ id: X.id,
1360
+ startPos: { ...X.position },
1361
1361
  startMouse: { x: d.x, y: d.y },
1362
1362
  parentClamp: V,
1363
- parentId: W.parentId || null,
1364
- selectedStarts: kt ? Z.current.filter((et) => et.selected && et.id !== W.id).map((et) => {
1363
+ parentId: X.parentId || null,
1364
+ selectedStarts: kt ? Z.current.filter((et) => et.selected && et.id !== X.id).map((et) => {
1365
1365
  var Xe, en;
1366
1366
  let qt = null;
1367
1367
  if (et.parentId && et.extent === "parent") {
@@ -1373,8 +1373,8 @@ function Nr({
1373
1373
  }
1374
1374
  return { id: et.id, startPos: { ...et.position }, parentClamp: qt, parentId: et.parentId || null };
1375
1375
  }) : []
1376
- }, (U = vt.current) == null || U.setPointerCapture(a.pointerId), (nt = Ae.current) == null || nt.call(Ae, a, W), bt.current) {
1377
- const et = [{ id: W.id, type: "position", dragging: !0 }];
1376
+ }, (U = vt.current) == null || U.setPointerCapture(a.pointerId), (nt = Ae.current) == null || nt.call(Ae, a, X), bt.current) {
1377
+ const et = [{ id: X.id, type: "position", dragging: !0 }];
1378
1378
  for (const qt of _t.current.selectedStarts)
1379
1379
  et.push({ id: qt.id, type: "position", dragging: !0 });
1380
1380
  bt.current(et);
@@ -1383,16 +1383,16 @@ function Nr({
1383
1383
  return;
1384
1384
  }
1385
1385
  }
1386
- if (Pt.current.length > 0 && Nt) {
1387
- const W = ue(d.x, d.y);
1388
- if (W) {
1386
+ if (Pt.current.length > 0 && Lt) {
1387
+ const X = ue(d.x, d.y);
1388
+ if (X) {
1389
1389
  if (Dt.current) {
1390
1390
  const kt = [];
1391
1391
  if (b)
1392
- kt.push({ id: W.id, type: "select", selected: !W.selected });
1392
+ kt.push({ id: X.id, type: "select", selected: !X.selected });
1393
1393
  else {
1394
1394
  for (const V of Pt.current)
1395
- V.id === W.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1395
+ V.id === X.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1396
1396
  if (bt.current) {
1397
1397
  const V = Z.current.filter((et) => et.selected).map((et) => ({ id: et.id, type: "select", selected: !1 }));
1398
1398
  V.length && bt.current(V);
@@ -1400,40 +1400,40 @@ function Nr({
1400
1400
  }
1401
1401
  kt.length && (Dt.current(kt), Jt());
1402
1402
  }
1403
- (wt = le.current) == null || wt.call(le, a, W);
1403
+ (wt = le.current) == null || wt.call(le, a, X);
1404
1404
  return;
1405
1405
  }
1406
1406
  }
1407
1407
  if (!b) {
1408
- const W = Z.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 })), kt = Pt.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 }));
1409
- W.length && bt.current && bt.current(W), kt.length && Dt.current && Dt.current(kt), (W.length || kt.length) && Jt();
1408
+ const X = Z.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 })), kt = Pt.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 }));
1409
+ X.length && bt.current && bt.current(X), kt.length && Dt.current && Dt.current(kt), (X.length || kt.length) && Jt();
1410
1410
  }
1411
1411
  if ((Mt = We.current) == null || Mt.call(We, a), ne || b) {
1412
- ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At = vt.current) == null || At.setPointerCapture(a.pointerId), Le();
1412
+ ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At = vt.current) == null || At.setPointerCapture(a.pointerId), Ne();
1413
1413
  return;
1414
1414
  }
1415
1415
  Se.current = !0, te.current = { x: a.clientX, y: a.clientY }, (Xt = vt.current) == null || Xt.classList.add("dragging"), (Ht = vt.current) == null || Ht.setPointerCapture(a.pointerId);
1416
- }, [at, Tt, tn, ue, ht, Rt, Nt, ne, Ce, Le, Jt]), fr = F((a) => {
1416
+ }, [at, Tt, tn, ue, ht, Rt, Lt, ne, Ce, Ne, Jt]), fr = F((a) => {
1417
1417
  var d, b;
1418
1418
  if (Wt.current) {
1419
1419
  if (Me.current = at(a.clientX, a.clientY), Ce(), fn) {
1420
- const N = vt.current;
1421
- if (N) {
1422
- const I = N.getBoundingClientRect(), h = 40, A = a.clientX - I.left, T = a.clientY - I.top;
1420
+ const L = vt.current;
1421
+ if (L) {
1422
+ const I = L.getBoundingClientRect(), y = 40, A = a.clientX - I.left, P = a.clientY - I.top;
1423
1423
  let Y = 0, H = 0;
1424
- A < h ? Y = Qt : A > I.width - h && (Y = -Qt), T < h ? H = Qt : T > I.height - h && (H = -Qt), (Y || H) && (pt.current.x += Y, pt.current.y += H, Ct(a));
1424
+ A < y ? Y = Qt : A > I.width - y && (Y = -Qt), P < y ? H = Qt : P > I.height - y && (H = -Qt), (Y || H) && (pt.current.x += Y, pt.current.y += H, Ct(a));
1425
1425
  }
1426
1426
  }
1427
1427
  return;
1428
1428
  }
1429
1429
  if (ie.current) {
1430
- ie.current.endWorld = at(a.clientX, a.clientY), Le();
1431
- const N = ie.current, I = Math.min(N.startWorld.x, N.endWorld.x), h = Math.min(N.startWorld.y, N.endWorld.y), A = Math.max(N.startWorld.x, N.endWorld.x), T = Math.max(N.startWorld.y, N.endWorld.y);
1430
+ ie.current.endWorld = at(a.clientX, a.clientY), Ne();
1431
+ const L = ie.current, I = Math.min(L.startWorld.x, L.endWorld.x), y = Math.min(L.startWorld.y, L.endWorld.y), A = Math.max(L.startWorld.x, L.endWorld.x), P = Math.max(L.startWorld.y, L.endWorld.y);
1432
1432
  if (bt.current) {
1433
1433
  const Y = [];
1434
1434
  for (const H of Z.current) {
1435
1435
  if (H.hidden) continue;
1436
- const J = H.width || Vt, ct = H.height || jt, U = Ie === "full" ? H.position.x >= I && H.position.x + J <= A && H.position.y >= h && H.position.y + ct <= T : H.position.x + J > I && H.position.x < A && H.position.y + ct > h && H.position.y < T;
1436
+ const J = H.width || Vt, ct = H.height || jt, U = Ie === "full" ? H.position.x >= I && H.position.x + J <= A && H.position.y >= y && H.position.y + ct <= P : H.position.x + J > I && H.position.x < A && H.position.y + ct > y && H.position.y < P;
1437
1437
  U !== !!H.selected && Y.push({ id: H.id, type: "select", selected: U });
1438
1438
  }
1439
1439
  Y.length && bt.current(Y);
@@ -1441,15 +1441,15 @@ function Nr({
1441
1441
  return;
1442
1442
  }
1443
1443
  if (_t.current) {
1444
- const N = at(a.clientX, a.clientY), I = _t.current, h = N.x - I.startMouse.x, A = N.y - I.startMouse.y;
1445
- let T = { x: I.startPos.x + h, y: I.startPos.y + A };
1446
- if (me && (T = Pn(T, de)), oe && (T = Tn(T, oe)), I.parentClamp) {
1444
+ const L = at(a.clientX, a.clientY), I = _t.current, y = L.x - I.startMouse.x, A = L.y - I.startMouse.y;
1445
+ let P = { x: I.startPos.x + y, y: I.startPos.y + A };
1446
+ if (me && (P = Pn(P, de)), oe && (P = Tn(P, oe)), I.parentClamp) {
1447
1447
  const U = I.parentClamp;
1448
- T = { x: Math.max(U.minX, Math.min(T.x, U.maxX)), y: Math.max(U.minY, Math.min(T.y, U.maxY)) };
1448
+ P = { x: Math.max(U.minX, Math.min(P.x, U.maxX)), y: Math.max(U.minY, Math.min(P.y, U.maxY)) };
1449
1449
  }
1450
- const Y = [{ id: I.id, position: T }];
1450
+ const Y = [{ id: I.id, position: P }];
1451
1451
  for (const U of I.selectedStarts) {
1452
- let nt = { x: U.startPos.x + h, y: U.startPos.y + A };
1452
+ let nt = { x: U.startPos.x + y, y: U.startPos.y + A };
1453
1453
  if (me && (nt = Pn(nt, de)), oe && (nt = Tn(nt, oe)), U.parentClamp) {
1454
1454
  const wt = U.parentClamp;
1455
1455
  nt = { x: Math.max(wt.minX, Math.min(nt.x, wt.maxX)), y: Math.max(wt.minY, Math.min(nt.y, wt.maxY)) };
@@ -1508,12 +1508,12 @@ function Nr({
1508
1508
  return;
1509
1509
  }
1510
1510
  if (!Se.current) return;
1511
- const x = pt.current;
1512
- x.x += a.clientX - te.current.x, x.y += a.clientY - te.current.y, te.current = { x: a.clientX, y: a.clientY }, Ct();
1513
- }, [Ct, at, Ce, Le]), hr = F((a) => {
1514
- var x, d, b, N, I;
1511
+ const m = pt.current;
1512
+ m.x += a.clientX - te.current.x, m.y += a.clientY - te.current.y, te.current = { x: a.clientX, y: a.clientY }, Ct();
1513
+ }, [Ct, at, Ce, Ne]), hr = F((a) => {
1514
+ var m, d, b, L, I;
1515
1515
  if (Wt.current) {
1516
- const h = at(a.clientX, a.clientY), A = tn(h.x, h.y);
1516
+ const y = at(a.clientX, a.clientY), A = tn(y.x, y.y);
1517
1517
  if (A && A.nodeId !== Wt.current.sourceId && (Bt === "loose" || A.type === "target")) {
1518
1518
  const H = Wt.current.sourceType === "target" ? {
1519
1519
  source: A.nodeId,
@@ -1526,25 +1526,25 @@ function Nr({
1526
1526
  sourceHandle: Wt.current.sourceHandle,
1527
1527
  targetHandle: A.handleId || null
1528
1528
  };
1529
- (O.current.isValidConnection ? O.current.isValidConnection(H) : !0) && ((x = ce.current) == null || x.call(ce, { ...H, ...be }));
1529
+ (O.current.isValidConnection ? O.current.isValidConnection(H) : !0) && ((m = ce.current) == null || m.call(ce, { ...H, ...be }));
1530
1530
  }
1531
1531
  (b = (d = O.current).onConnectEnd) == null || b.call(d, a.nativeEvent || a), Wt.current = null, Me.current = null, Ce();
1532
1532
  return;
1533
1533
  }
1534
1534
  if (ie.current) {
1535
- ie.current = null, Le(), Jt();
1535
+ ie.current = null, Ne(), Jt();
1536
1536
  return;
1537
1537
  }
1538
1538
  if (_t.current) {
1539
- const h = _t.current;
1539
+ const y = _t.current;
1540
1540
  if (bt.current) {
1541
- const T = Z.current.find((H) => H.id === h.id), Y = [{
1542
- id: h.id,
1541
+ const P = Z.current.find((H) => H.id === y.id), Y = [{
1542
+ id: y.id,
1543
1543
  type: "position",
1544
- position: T ? { ...T.position } : void 0,
1544
+ position: P ? { ...P.position } : void 0,
1545
1545
  dragging: !1
1546
1546
  }];
1547
- for (const H of h.selectedStarts) {
1547
+ for (const H of y.selectedStarts) {
1548
1548
  const J = Z.current.find((ct) => ct.id === H.id);
1549
1549
  Y.push({
1550
1550
  id: H.id,
@@ -1558,198 +1558,198 @@ function Nr({
1558
1558
  requestAnimationFrame(() => {
1559
1559
  _t.current = null;
1560
1560
  });
1561
- const A = Z.current.find((T) => T.id === h.id);
1562
- A && ((N = _e.current) == null || N.call(_e, a, A));
1561
+ const A = Z.current.find((P) => P.id === y.id);
1562
+ A && ((L = _e.current) == null || L.call(_e, a, A));
1563
1563
  return;
1564
1564
  }
1565
1565
  Se.current = !1, (I = vt.current) == null || I.classList.remove("dragging");
1566
- }, [at, tn, Ce, Le, Jt]);
1566
+ }, [at, tn, Ce, Ne, Jt]);
1567
1567
  ft(() => {
1568
1568
  const a = vt.current;
1569
1569
  if (!a) return;
1570
- const x = (d) => {
1570
+ const m = (d) => {
1571
1571
  Pe && d.preventDefault();
1572
1572
  const b = pt.current;
1573
1573
  if (Ge || ke.current) {
1574
- const T = Ze;
1575
- $e === "horizontal" ? b.x -= d.deltaY * T : ($e === "vertical" || (b.x -= d.deltaX * T), b.y -= d.deltaY * T), Ct(d);
1574
+ const P = Ze;
1575
+ $e === "horizontal" ? b.x -= d.deltaY * P : ($e === "vertical" || (b.x -= d.deltaX * P), b.y -= d.deltaY * P), Ct(d);
1576
1576
  return;
1577
1577
  }
1578
1578
  if (!Oe) return;
1579
- const N = d.deltaY > 0 ? 0.92 : 1.08, I = a.getBoundingClientRect(), h = d.clientX - I.left, A = d.clientY - I.top;
1580
- b.x = h - (h - b.x) * N, b.y = A - (A - b.y) * N, b.zoom = Math.min(mt, Math.max(it, b.zoom * N)), Ct(d);
1579
+ const L = d.deltaY > 0 ? 0.92 : 1.08, I = a.getBoundingClientRect(), y = d.clientX - I.left, A = d.clientY - I.top;
1580
+ b.x = y - (y - b.x) * L, b.y = A - (A - b.y) * L, b.zoom = Math.min(mt, Math.max(it, b.zoom * L)), Ct(d);
1581
1581
  };
1582
- return a.addEventListener("wheel", x, { passive: !Pe }), () => a.removeEventListener("wheel", x);
1582
+ return a.addEventListener("wheel", m, { passive: !Pe }), () => a.removeEventListener("wheel", m);
1583
1583
  }, [Ct, it, mt, Ge, $e, Ze, Oe, Pe]), ft(() => {
1584
1584
  if (!Ke) return;
1585
1585
  const a = vt.current;
1586
1586
  if (!a) return;
1587
- let x = 0, d = null;
1588
- const b = (h) => {
1589
- if (h.touches.length === 2) {
1590
- const A = h.touches[0].clientX - h.touches[1].clientX, T = h.touches[0].clientY - h.touches[1].clientY;
1591
- x = Math.hypot(A, T);
1587
+ let m = 0, d = null;
1588
+ const b = (y) => {
1589
+ if (y.touches.length === 2) {
1590
+ const A = y.touches[0].clientX - y.touches[1].clientX, P = y.touches[0].clientY - y.touches[1].clientY;
1591
+ m = Math.hypot(A, P);
1592
1592
  const Y = a.getBoundingClientRect();
1593
1593
  d = {
1594
- x: (h.touches[0].clientX + h.touches[1].clientX) / 2 - Y.left,
1595
- y: (h.touches[0].clientY + h.touches[1].clientY) / 2 - Y.top
1596
- }, h.preventDefault();
1594
+ x: (y.touches[0].clientX + y.touches[1].clientX) / 2 - Y.left,
1595
+ y: (y.touches[0].clientY + y.touches[1].clientY) / 2 - Y.top
1596
+ }, y.preventDefault();
1597
1597
  }
1598
- }, N = (h) => {
1599
- if (h.touches.length === 2 && x > 0) {
1600
- h.preventDefault();
1601
- const A = h.touches[0].clientX - h.touches[1].clientX, T = h.touches[0].clientY - h.touches[1].clientY, Y = Math.hypot(A, T), H = Y / x;
1602
- x = Y;
1598
+ }, L = (y) => {
1599
+ if (y.touches.length === 2 && m > 0) {
1600
+ y.preventDefault();
1601
+ const A = y.touches[0].clientX - y.touches[1].clientX, P = y.touches[0].clientY - y.touches[1].clientY, Y = Math.hypot(A, P), H = Y / m;
1602
+ m = Y;
1603
1603
  const J = pt.current, ct = d.x, U = d.y;
1604
- J.x = ct - (ct - J.x) * H, J.y = U - (U - J.y) * H, J.zoom = Math.min(mt, Math.max(it, J.zoom * H)), Ct(h);
1604
+ J.x = ct - (ct - J.x) * H, J.y = U - (U - J.y) * H, J.zoom = Math.min(mt, Math.max(it, J.zoom * H)), Ct(y);
1605
1605
  }
1606
1606
  }, I = () => {
1607
- x = 0, d = null;
1607
+ m = 0, d = null;
1608
1608
  };
1609
- return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove", N, { passive: !1 }), a.addEventListener("touchend", I), () => {
1610
- a.removeEventListener("touchstart", b), a.removeEventListener("touchmove", N), a.removeEventListener("touchend", I);
1609
+ return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove", L, { passive: !1 }), a.addEventListener("touchend", I), () => {
1610
+ a.removeEventListener("touchstart", b), a.removeEventListener("touchmove", L), a.removeEventListener("touchend", I);
1611
1611
  };
1612
1612
  }, [Ke, Ct, it, mt]), ft(() => {
1613
1613
  if (!Qe) return;
1614
1614
  const a = vt.current;
1615
1615
  if (!a) return;
1616
- const x = (d) => {
1616
+ const m = (d) => {
1617
1617
  var H, J, ct, U;
1618
1618
  const b = at(d.clientX, d.clientY);
1619
1619
  if (Tt(b.x, b.y)) {
1620
1620
  (J = (H = O.current).onNodeDoubleClick) == null || J.call(H, d, Tt(b.x, b.y));
1621
1621
  return;
1622
1622
  }
1623
- const N = ue(b.x, b.y);
1624
- if (N) {
1625
- (U = (ct = O.current).onEdgeDoubleClick) == null || U.call(ct, d, N);
1623
+ const L = ue(b.x, b.y);
1624
+ if (L) {
1625
+ (U = (ct = O.current).onEdgeDoubleClick) == null || U.call(ct, d, L);
1626
1626
  return;
1627
1627
  }
1628
- const I = 1.5, h = a.getBoundingClientRect(), A = d.clientX - h.left, T = d.clientY - h.top, Y = pt.current;
1629
- Y.x = A - (A - Y.x) * I, Y.y = T - (T - Y.y) * I, Y.zoom = Math.min(mt, Math.max(it, Y.zoom * I)), Ct(d);
1628
+ const I = 1.5, y = a.getBoundingClientRect(), A = d.clientX - y.left, P = d.clientY - y.top, Y = pt.current;
1629
+ Y.x = A - (A - Y.x) * I, Y.y = P - (P - Y.y) * I, Y.zoom = Math.min(mt, Math.max(it, Y.zoom * I)), Ct(d);
1630
1630
  };
1631
- return a.addEventListener("dblclick", x), () => a.removeEventListener("dblclick", x);
1631
+ return a.addEventListener("dblclick", m), () => a.removeEventListener("dblclick", m);
1632
1632
  }, [Qe, Ct, it, mt, at, Tt, ue]), ft(() => {
1633
1633
  const a = vt.current;
1634
1634
  if (!a) return;
1635
- const x = (d) => {
1636
- var h, A, T, Y, H, J;
1637
- const b = at(d.clientX, d.clientY), N = Tt(b.x, b.y);
1638
- if (N) {
1639
- (A = (h = O.current).onNodeContextMenu) == null || A.call(h, d, N);
1635
+ const m = (d) => {
1636
+ var y, A, P, Y, H, J;
1637
+ const b = at(d.clientX, d.clientY), L = Tt(b.x, b.y);
1638
+ if (L) {
1639
+ (A = (y = O.current).onNodeContextMenu) == null || A.call(y, d, L);
1640
1640
  return;
1641
1641
  }
1642
1642
  const I = ue(b.x, b.y);
1643
1643
  if (I) {
1644
- (Y = (T = O.current).onEdgeContextMenu) == null || Y.call(T, d, I);
1644
+ (Y = (P = O.current).onEdgeContextMenu) == null || Y.call(P, d, I);
1645
1645
  return;
1646
1646
  }
1647
1647
  (J = (H = O.current).onPaneContextMenu) == null || J.call(H, d);
1648
1648
  };
1649
- return a.addEventListener("contextmenu", x), () => a.removeEventListener("contextmenu", x);
1649
+ return a.addEventListener("contextmenu", m), () => a.removeEventListener("contextmenu", m);
1650
1650
  }, [at, Tt, ue]), ft(() => {
1651
1651
  const a = vt.current;
1652
1652
  if (!a) return;
1653
- let x = null, d = null;
1654
- const b = (h) => {
1655
- var Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht, W, kt, V;
1656
- (H = (Y = O.current).onPaneMouseMove) == null || H.call(Y, h);
1657
- const A = at(h.clientX, h.clientY), T = Tt(A.x, A.y);
1658
- if (T !== x && (x && ((ct = (J = O.current).onNodeMouseLeave) == null || ct.call(J, h, x)), T && ((nt = (U = O.current).onNodeMouseEnter) == null || nt.call(U, h, T)), x = T), T && ((Mt = (wt = O.current).onNodeMouseMove) == null || Mt.call(wt, h, T)), !T) {
1653
+ let m = null, d = null;
1654
+ const b = (y) => {
1655
+ var Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht, X, kt, V;
1656
+ (H = (Y = O.current).onPaneMouseMove) == null || H.call(Y, y);
1657
+ const A = at(y.clientX, y.clientY), P = Tt(A.x, A.y);
1658
+ if (P !== m && (m && ((ct = (J = O.current).onNodeMouseLeave) == null || ct.call(J, y, m)), P && ((nt = (U = O.current).onNodeMouseEnter) == null || nt.call(U, y, P)), m = P), P && ((Mt = (wt = O.current).onNodeMouseMove) == null || Mt.call(wt, y, P)), !P) {
1659
1659
  const et = ue(A.x, A.y);
1660
- et !== d && (d && ((Xt = (At = O.current).onEdgeMouseLeave) == null || Xt.call(At, h, d)), et && ((W = (Ht = O.current).onEdgeMouseEnter) == null || W.call(Ht, h, et)), d = et), et && ((V = (kt = O.current).onEdgeMouseMove) == null || V.call(kt, h, et));
1660
+ et !== d && (d && ((Xt = (At = O.current).onEdgeMouseLeave) == null || Xt.call(At, y, d)), et && ((X = (Ht = O.current).onEdgeMouseEnter) == null || X.call(Ht, y, et)), d = et), et && ((V = (kt = O.current).onEdgeMouseMove) == null || V.call(kt, y, et));
1661
1661
  }
1662
- }, N = (h) => {
1663
- var A, T;
1664
- return (T = (A = O.current).onPaneMouseEnter) == null ? void 0 : T.call(A, h);
1665
- }, I = (h) => {
1666
- var A, T, Y, H, J, ct;
1667
- (T = (A = O.current).onPaneMouseLeave) == null || T.call(A, h), x && ((H = (Y = O.current).onNodeMouseLeave) == null || H.call(Y, h, x), x = null), d && ((ct = (J = O.current).onEdgeMouseLeave) == null || ct.call(J, h, d), d = null);
1662
+ }, L = (y) => {
1663
+ var A, P;
1664
+ return (P = (A = O.current).onPaneMouseEnter) == null ? void 0 : P.call(A, y);
1665
+ }, I = (y) => {
1666
+ var A, P, Y, H, J, ct;
1667
+ (P = (A = O.current).onPaneMouseLeave) == null || P.call(A, y), m && ((H = (Y = O.current).onNodeMouseLeave) == null || H.call(Y, y, m), m = null), d && ((ct = (J = O.current).onEdgeMouseLeave) == null || ct.call(J, y, d), d = null);
1668
1668
  };
1669
- return a.addEventListener("mousemove", b), a.addEventListener("mouseenter", N), a.addEventListener("mouseleave", I), () => {
1670
- a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter", N), a.removeEventListener("mouseleave", I);
1669
+ return a.addEventListener("mousemove", b), a.addEventListener("mouseenter", L), a.addEventListener("mouseleave", I), () => {
1670
+ a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter", L), a.removeEventListener("mouseleave", I);
1671
1671
  };
1672
1672
  }, [at, Tt, ue]), ft(() => {
1673
- const a = Array.isArray(ve) ? ve : [ve], x = async (d) => {
1674
- var b, N;
1673
+ const a = Array.isArray(ve) ? ve : [ve], m = async (d) => {
1674
+ var b, L;
1675
1675
  if (a.includes(d.key)) {
1676
1676
  if (d.target.tagName === "INPUT" || d.target.tagName === "TEXTAREA" || d.target.isContentEditable) return;
1677
- const I = Z.current.filter((T) => T.selected), h = Pt.current.filter((T) => T.selected);
1678
- if (!I.length && !h.length || O.current.onBeforeDelete && !await O.current.onBeforeDelete({ nodes: I, edges: h }))
1677
+ const I = Z.current.filter((P) => P.selected), y = Pt.current.filter((P) => P.selected);
1678
+ if (!I.length && !y.length || O.current.onBeforeDelete && !await O.current.onBeforeDelete({ nodes: I, edges: y }))
1679
1679
  return;
1680
- const A = new Set(I.map((T) => T.id));
1681
- if (I.length && bt.current && (bt.current(I.map((T) => ({ id: T.id, type: "remove" }))), Dt.current)) {
1682
- const T = Pt.current.filter((Y) => A.has(Y.source) || A.has(Y.target));
1683
- T.length && Dt.current(T.map((Y) => ({ id: Y.id, type: "remove" })));
1680
+ const A = new Set(I.map((P) => P.id));
1681
+ if (I.length && bt.current && (bt.current(I.map((P) => ({ id: P.id, type: "remove" }))), Dt.current)) {
1682
+ const P = Pt.current.filter((Y) => A.has(Y.source) || A.has(Y.target));
1683
+ P.length && Dt.current(P.map((Y) => ({ id: Y.id, type: "remove" })));
1684
1684
  }
1685
- h.length && Dt.current && Dt.current(h.map((T) => ({ id: T.id, type: "remove" }))), (N = (b = O.current).onDelete) == null || N.call(b, { nodes: I, edges: h });
1685
+ y.length && Dt.current && Dt.current(y.map((P) => ({ id: P.id, type: "remove" }))), (L = (b = O.current).onDelete) == null || L.call(b, { nodes: I, edges: y });
1686
1686
  }
1687
1687
  if ((d.ctrlKey || d.metaKey) && d.key === "a") {
1688
1688
  if (d.target.tagName === "INPUT" || d.target.tagName === "TEXTAREA") return;
1689
1689
  if (d.preventDefault(), bt.current) {
1690
- const I = Z.current.filter((h) => !h.selected).map((h) => ({ id: h.id, type: "select", selected: !0 }));
1690
+ const I = Z.current.filter((y) => !y.selected).map((y) => ({ id: y.id, type: "select", selected: !0 }));
1691
1691
  I.length && bt.current(I);
1692
1692
  }
1693
1693
  if (Dt.current) {
1694
- const I = Pt.current.filter((h) => !h.selected).map((h) => ({ id: h.id, type: "select", selected: !0 }));
1694
+ const I = Pt.current.filter((y) => !y.selected).map((y) => ({ id: y.id, type: "select", selected: !0 }));
1695
1695
  I.length && Dt.current(I);
1696
1696
  }
1697
1697
  }
1698
1698
  };
1699
- return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
1699
+ return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
1700
1700
  }, [ve]);
1701
1701
  const In = tt(!1);
1702
1702
  ft(() => {
1703
- var a, x;
1703
+ var a, m;
1704
1704
  if (!In.current && Et.current) {
1705
1705
  if (In.current = !0, zt && Z.current.length > 0) {
1706
1706
  const d = vt.current;
1707
1707
  if (d) {
1708
- const b = d.getBoundingClientRect(), N = (dt == null ? void 0 : dt.padding) ?? 0.1, I = Mn(Z.current), h = Rn(I, b.width, b.height, N);
1709
- dt != null && dt.maxZoom && (h.zoom = Math.min(h.zoom, dt.maxZoom)), dt != null && dt.minZoom && (h.zoom = Math.max(h.zoom, dt.minZoom)), pt.current = h, Ct();
1708
+ const b = d.getBoundingClientRect(), L = (dt == null ? void 0 : dt.padding) ?? 0.1, I = Mn(Z.current), y = Rn(I, b.width, b.height, L);
1709
+ dt != null && dt.maxZoom && (y.zoom = Math.min(y.zoom, dt.maxZoom)), dt != null && dt.minZoom && (y.zoom = Math.max(y.zoom, dt.minZoom)), pt.current = y, Ct();
1710
1710
  }
1711
1711
  }
1712
- (x = (a = O.current).onInit) == null || x.call(a, {
1712
+ (m = (a = O.current).onInit) == null || m.call(a, {
1713
1713
  getNodes: () => [...Z.current],
1714
1714
  getEdges: () => [...Pt.current],
1715
1715
  getViewport: () => ({ ...pt.current }),
1716
1716
  fitView: (d = {}) => {
1717
1717
  const b = vt.current;
1718
1718
  if (!b || !Z.current.length) return;
1719
- const N = b.getBoundingClientRect(), I = Mn(Z.current), h = Rn(I, N.width, N.height, d.padding ?? 0.1);
1720
- pt.current = h, Ct();
1719
+ const L = b.getBoundingClientRect(), I = Mn(Z.current), y = Rn(I, L.width, L.height, d.padding ?? 0.1);
1720
+ pt.current = y, Ct();
1721
1721
  }
1722
1722
  });
1723
1723
  }
1724
1724
  });
1725
1725
  const yr = F(() => {
1726
- pt.current = { ...Lt }, Ct();
1727
- }, [Ct, Lt]), gr = F((a) => {
1728
- var x;
1726
+ pt.current = { ...Nt }, Ct();
1727
+ }, [Ct, Nt]), gr = F((a) => {
1728
+ var m;
1729
1729
  if (a)
1730
1730
  se.current.push(a);
1731
1731
  else {
1732
1732
  const d = pt.current, b = vt.current;
1733
1733
  if (!b) return;
1734
- const N = b.getBoundingClientRect(), I = Math.round(-d.x / d.zoom + N.width / 2 / d.zoom), h = Math.round(-d.y / d.zoom + N.height / 2 / d.zoom);
1734
+ const L = b.getBoundingClientRect(), I = Math.round(-d.x / d.zoom + L.width / 2 / d.zoom), y = Math.round(-d.y / d.zoom + L.height / 2 / d.zoom);
1735
1735
  se.current.push({
1736
1736
  x: I - 80,
1737
- y: h - 45,
1737
+ y: y - 45,
1738
1738
  w: 160,
1739
1739
  h: 90,
1740
1740
  title: "Note " + (se.current.length + 1),
1741
1741
  body: "Added at viewport center"
1742
1742
  });
1743
1743
  }
1744
- (x = Et.current) == null || x.postMessage({ type: "cards", data: { cards: [...se.current] } });
1744
+ (m = Et.current) == null || m.postMessage({ type: "cards", data: { cards: [...se.current] } });
1745
1745
  }, []), pr = F((a) => {
1746
1746
  if (a.id || (a.id = "node-" + Date.now()), !a.position) {
1747
- const x = pt.current, d = vt.current;
1747
+ const m = pt.current, d = vt.current;
1748
1748
  if (!d) return;
1749
1749
  const b = d.getBoundingClientRect();
1750
1750
  a.position = {
1751
- x: Math.round(-x.x / x.zoom + b.width / 2 / x.zoom) - Vt / 2,
1752
- y: Math.round(-x.y / x.zoom + b.height / 2 / x.zoom) - jt / 2
1751
+ x: Math.round(-m.x / m.zoom + b.width / 2 / m.zoom) - Vt / 2,
1752
+ y: Math.round(-m.y / m.zoom + b.height / 2 / m.zoom) - jt / 2
1753
1753
  };
1754
1754
  }
1755
1755
  a.data || (a.data = { label: a.id }), bt.current && bt.current([{ type: "add", item: a }]);
@@ -1828,36 +1828,36 @@ function Ro() {
1828
1828
  return qe(je);
1829
1829
  }
1830
1830
  function $r({ node: t, nodeType: e }) {
1831
- var m, C, z;
1831
+ var v, N, z;
1832
1832
  const n = yt(), r = tt(null), s = t._absolutePosition || t.position, o = tt(null);
1833
1833
  ft(() => {
1834
- const M = r.current;
1835
- if (!M) return;
1836
- const $ = new ResizeObserver((R) => {
1837
- var D, g, f, p;
1838
- const { width: E, height: _ } = R[0].contentRect;
1834
+ const R = r.current;
1835
+ if (!R) return;
1836
+ const $ = new ResizeObserver((k) => {
1837
+ var B, D, f, h;
1838
+ const { width: E, height: _ } = k[0].contentRect;
1839
1839
  if (E > 0 && _ > 0) {
1840
- const v = n.nodesRef.current.find((P) => P.id === t.id), L = (v == null ? void 0 : v.width) || ((D = v == null ? void 0 : v.measured) == null ? void 0 : D.width), w = (v == null ? void 0 : v.height) || ((g = v == null ? void 0 : v.measured) == null ? void 0 : g.height);
1841
- (Math.abs((L || 0) - E) > 1 || Math.abs((w || 0) - _) > 1) && ((p = (f = n.onNodesChangeRef).current) == null || p.call(f, [
1840
+ const p = n.nodesRef.current.find((C) => C.id === t.id), M = (p == null ? void 0 : p.width) || ((B = p == null ? void 0 : p.measured) == null ? void 0 : B.width), w = (p == null ? void 0 : p.height) || ((D = p == null ? void 0 : p.measured) == null ? void 0 : D.height);
1841
+ (Math.abs((M || 0) - E) > 1 || Math.abs((w || 0) - _) > 1) && ((h = (f = n.onNodesChangeRef).current) == null || h.call(f, [
1842
1842
  { id: t.id, type: "dimensions", dimensions: { width: E, height: _ }, setAttributes: !0 }
1843
1843
  ]));
1844
1844
  }
1845
1845
  });
1846
- return $.observe(M), () => $.disconnect();
1846
+ return $.observe(R), () => $.disconnect();
1847
1847
  }, [t.id, n]);
1848
- const i = F((M) => {
1849
- var B, j, X, xt;
1850
- M.stopPropagation();
1851
- const $ = M.target.tagName;
1852
- if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || $ === "LABEL" || M.target.isContentEditable) return;
1853
- let R = M.target;
1854
- for (; R && R !== r.current; ) {
1855
- if ((B = R.classList) != null && B.contains("nodrag") || (j = R.classList) != null && j.contains("nopan")) return;
1856
- R = R.parentElement;
1848
+ const i = F((R) => {
1849
+ var T, j, W, xt;
1850
+ R.stopPropagation();
1851
+ const $ = R.target.tagName;
1852
+ if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || $ === "LABEL" || R.target.isContentEditable) return;
1853
+ let k = R.target;
1854
+ for (; k && k !== r.current; ) {
1855
+ if ((T = k.classList) != null && T.contains("nodrag") || (j = k.classList) != null && j.contains("nopan")) return;
1856
+ k = k.parentElement;
1857
1857
  }
1858
1858
  if (n.onNodesChangeRef.current) {
1859
1859
  const K = [];
1860
- if (M.shiftKey)
1860
+ if (R.shiftKey)
1861
1861
  K.push({ id: t.id, type: "select", selected: !t.selected });
1862
1862
  else
1863
1863
  for (const q of n.nodesRef.current)
@@ -1866,20 +1866,20 @@ function $r({ node: t, nodeType: e }) {
1866
1866
  }
1867
1867
  const E = n.cameraRef.current, _ = n.wrapRef.current;
1868
1868
  if (!_) return;
1869
- const D = _.getBoundingClientRect(), g = (M.clientX - D.left - E.x) / E.zoom, f = (M.clientY - D.top - E.y) / E.zoom, v = M.shiftKey && t.selected ? n.nodesRef.current.filter((K) => K.selected && K.id !== t.id).map((K) => ({ id: K.id, startPos: { ...K.position } })) : [];
1869
+ const B = _.getBoundingClientRect(), D = (R.clientX - B.left - E.x) / E.zoom, f = (R.clientY - B.top - E.y) / E.zoom, p = R.shiftKey && t.selected ? n.nodesRef.current.filter((K) => K.selected && K.id !== t.id).map((K) => ({ id: K.id, startPos: { ...K.position } })) : [];
1870
1870
  o.current = {
1871
1871
  startPos: { ...t.position },
1872
- startMouse: { x: g, y: f },
1873
- selectedStarts: v
1872
+ startMouse: { x: D, y: f },
1873
+ selectedStarts: p
1874
1874
  };
1875
- const L = [{ id: t.id, type: "position", dragging: !0 }];
1876
- for (const K of v)
1877
- L.push({ id: K.id, type: "position", dragging: !0 });
1878
- (xt = (X = n.onNodesChangeRef).current) == null || xt.call(X, L);
1875
+ const M = [{ id: t.id, type: "position", dragging: !0 }];
1876
+ for (const K of p)
1877
+ M.push({ id: K.id, type: "position", dragging: !0 });
1878
+ (xt = (W = n.onNodesChangeRef).current) == null || xt.call(W, M);
1879
1879
  const w = r.current;
1880
- w && w.setPointerCapture(M.pointerId);
1881
- const P = (K) => {
1882
- var it, mt, Lt, zt;
1880
+ w && w.setPointerCapture(R.pointerId);
1881
+ const C = (K) => {
1882
+ var it, mt, Nt, zt;
1883
1883
  if (!o.current) return;
1884
1884
  const rt = n.cameraRef.current, q = _.getBoundingClientRect(), G = (K.clientX - q.left - rt.x) / rt.zoom, ot = (K.clientY - q.top - rt.y) / rt.zoom, lt = G - o.current.startMouse.x, ut = ot - o.current.startMouse.y;
1885
1885
  let st = { x: o.current.startPos.x + lt, y: o.current.startPos.y + ut };
@@ -1889,9 +1889,9 @@ function $r({ node: t, nodeType: e }) {
1889
1889
  }), t.parentId && t.extent === "parent") {
1890
1890
  const dt = n.nodesRef.current.find((ht) => ht.id === t.parentId);
1891
1891
  if (dt) {
1892
- const ht = dt.width || 160, Rt = dt.height || 60, Nt = t.width || ((it = t.measured) == null ? void 0 : it.width) || 160, gt = t.height || ((mt = t.measured) == null ? void 0 : mt.height) || 60;
1892
+ const ht = dt.width || 160, Rt = dt.height || 60, Lt = t.width || ((it = t.measured) == null ? void 0 : it.width) || 160, gt = t.height || ((mt = t.measured) == null ? void 0 : mt.height) || 60;
1893
1893
  st = {
1894
- x: Math.max(0, Math.min(st.x, ht - Nt)),
1894
+ x: Math.max(0, Math.min(st.x, ht - Lt)),
1895
1895
  y: Math.max(0, Math.min(st.y, Rt - gt))
1896
1896
  };
1897
1897
  }
@@ -1904,22 +1904,22 @@ function $r({ node: t, nodeType: e }) {
1904
1904
  y: n.snapGrid[1] * Math.round(ht.y / n.snapGrid[1])
1905
1905
  }), It.push({ id: dt.id, type: "position", position: ht, dragging: !0 });
1906
1906
  }
1907
- (zt = (Lt = n.onNodesChangeRef).current) == null || zt.call(Lt, It);
1908
- }, k = (K) => {
1907
+ (zt = (Nt = n.onNodesChangeRef).current) == null || zt.call(Nt, It);
1908
+ }, x = (K) => {
1909
1909
  var q, G;
1910
1910
  if (!o.current) return;
1911
1911
  const rt = [{ id: t.id, type: "position", dragging: !1 }];
1912
1912
  for (const ot of o.current.selectedStarts)
1913
1913
  rt.push({ id: ot.id, type: "position", dragging: !1 });
1914
- (G = (q = n.onNodesChangeRef).current) == null || G.call(q, rt), o.current = null, w && w.releasePointerCapture(K.pointerId), w == null || w.removeEventListener("pointermove", P), w == null || w.removeEventListener("pointerup", k);
1914
+ (G = (q = n.onNodesChangeRef).current) == null || G.call(q, rt), o.current = null, w && w.releasePointerCapture(K.pointerId), w == null || w.removeEventListener("pointermove", C), w == null || w.removeEventListener("pointerup", x);
1915
1915
  };
1916
- w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup", k);
1917
- }, [t, n]), c = F((M) => {
1918
- var g, f, p, v, L, w;
1916
+ w == null || w.addEventListener("pointermove", C), w == null || w.addEventListener("pointerup", x);
1917
+ }, [t, n]), c = F((R) => {
1918
+ var D, f, h, p, M, w;
1919
1919
  if (!t.selected) return;
1920
- const $ = M.shiftKey ? 10 : 1;
1921
- let R = 0, E = 0;
1922
- switch (M.key) {
1920
+ const $ = R.shiftKey ? 10 : 1;
1921
+ let k = 0, E = 0;
1922
+ switch (R.key) {
1923
1923
  case "ArrowUp":
1924
1924
  E = -$;
1925
1925
  break;
@@ -1927,27 +1927,27 @@ function $r({ node: t, nodeType: e }) {
1927
1927
  E = $;
1928
1928
  break;
1929
1929
  case "ArrowLeft":
1930
- R = -$;
1930
+ k = -$;
1931
1931
  break;
1932
1932
  case "ArrowRight":
1933
- R = $;
1933
+ k = $;
1934
1934
  break;
1935
1935
  case "Escape":
1936
- (f = (g = n.onNodesChangeRef).current) == null || f.call(g, [{ id: t.id, type: "select", selected: !1 }]);
1936
+ (f = (D = n.onNodesChangeRef).current) == null || f.call(D, [{ id: t.id, type: "select", selected: !1 }]);
1937
1937
  return;
1938
1938
  case "Delete":
1939
1939
  case "Backspace":
1940
- t.deletable !== !1 && ((v = (p = n.onNodesChangeRef).current) == null || v.call(p, [{ id: t.id, type: "remove" }]));
1940
+ t.deletable !== !1 && ((p = (h = n.onNodesChangeRef).current) == null || p.call(h, [{ id: t.id, type: "remove" }]));
1941
1941
  return;
1942
1942
  default:
1943
1943
  return;
1944
1944
  }
1945
- M.preventDefault();
1946
- const _ = { x: t.position.x + R, y: t.position.y + E }, D = [{ id: t.id, type: "position", position: _ }];
1947
- for (const P of n.nodesRef.current)
1948
- P.selected && P.id !== t.id && D.push({ id: P.id, type: "position", position: { x: P.position.x + R, y: P.position.y + E } });
1949
- (w = (L = n.onNodesChangeRef).current) == null || w.call(L, D);
1950
- }, [t, n]), u = t.width || ((m = t.measured) == null ? void 0 : m.width), l = t.height || ((C = t.measured) == null ? void 0 : C.height), y = !!(u && l);
1945
+ R.preventDefault();
1946
+ const _ = { x: t.position.x + k, y: t.position.y + E }, B = [{ id: t.id, type: "position", position: _ }];
1947
+ for (const C of n.nodesRef.current)
1948
+ C.selected && C.id !== t.id && B.push({ id: C.id, type: "position", position: { x: C.position.x + k, y: C.position.y + E } });
1949
+ (w = (M = n.onNodesChangeRef).current) == null || w.call(M, B);
1950
+ }, [t, n]), u = t.width || ((v = t.measured) == null ? void 0 : v.width), l = t.height || ((N = t.measured) == null ? void 0 : N.height), g = !!(u && l);
1951
1951
  return /* @__PURE__ */ S(je.Provider, { value: t.id, children: /* @__PURE__ */ S(
1952
1952
  "div",
1953
1953
  {
@@ -1959,9 +1959,7 @@ function $r({ node: t, nodeType: e }) {
1959
1959
  top: s.y,
1960
1960
  zIndex: t.type === "group" ? 0 : t.zIndex || 1,
1961
1961
  pointerEvents: t.type === "group" ? "none" : "all",
1962
- cursor: t.dragging ? "grabbing" : "grab",
1963
- visibility: y ? "visible" : "hidden",
1964
- userSelect: "none",
1962
+ visibility: g ? "visible" : "hidden",
1965
1963
  outline: "none"
1966
1964
  },
1967
1965
  "data-nodeid": t.id,
@@ -2002,32 +2000,32 @@ function Bn(t, e, n, r) {
2002
2000
  var c, u;
2003
2001
  const s = t.width || ((c = t.measured) == null ? void 0 : c.width) || On, o = t.height || ((u = t.measured) == null ? void 0 : u.height) || Qn, i = t._absolutePosition || t.position;
2004
2002
  if (t.handleBounds) {
2005
- const l = t.handleBounds[e] || [], y = n ? l.find((m) => m.id === n) : l[0];
2006
- if (y && y.x !== void 0 && y.y !== void 0) {
2007
- const m = y.position || (e === "source" ? "right" : "left");
2008
- return { x: i.x + y.x, y: i.y + y.y, position: m };
2003
+ const l = t.handleBounds[e] || [], g = n ? l.find((v) => v.id === n) : l[0];
2004
+ if (g && g.x !== void 0 && g.y !== void 0) {
2005
+ const v = g.position || (e === "source" ? "right" : "left");
2006
+ return { x: i.x + g.x, y: i.y + g.y, position: v };
2009
2007
  }
2010
2008
  }
2011
2009
  if (r) {
2012
- const l = `${t.id}__${n || e}`, y = r.get(l);
2013
- if (y && y.x !== void 0 && y.y !== void 0)
2014
- return { x: i.x + y.x, y: i.y + y.y, position: y.position || (e === "source" ? "right" : "left") };
2010
+ const l = `${t.id}__${n || e}`, g = r.get(l);
2011
+ if (g && g.x !== void 0 && g.y !== void 0)
2012
+ return { x: i.x + g.x, y: i.y + g.y, position: g.position || (e === "source" ? "right" : "left") };
2015
2013
  }
2016
2014
  if (t.handles && t.handles.length) {
2017
2015
  for (const l of t.handles)
2018
2016
  if (l.type === e && (!n || l.id === n)) {
2019
2017
  if (l.x !== void 0 && l.y !== void 0)
2020
2018
  return { x: i.x + l.x, y: i.y + l.y, position: l.position || (e === "source" ? "right" : "left") };
2021
- const y = l.position || (e === "source" ? "right" : "left");
2022
- switch (y) {
2019
+ const g = l.position || (e === "source" ? "right" : "left");
2020
+ switch (g) {
2023
2021
  case "top":
2024
- return { x: i.x + s / 2, y: i.y, position: y };
2022
+ return { x: i.x + s / 2, y: i.y, position: g };
2025
2023
  case "bottom":
2026
- return { x: i.x + s / 2, y: i.y + o, position: y };
2024
+ return { x: i.x + s / 2, y: i.y + o, position: g };
2027
2025
  case "left":
2028
- return { x: i.x, y: i.y + o / 2, position: y };
2026
+ return { x: i.x, y: i.y + o / 2, position: g };
2029
2027
  default:
2030
- return { x: i.x + s, y: i.y + o / 2, position: y };
2028
+ return { x: i.x + s, y: i.y + o / 2, position: g };
2031
2029
  }
2032
2030
  }
2033
2031
  }
@@ -2055,32 +2053,32 @@ function Dn({ x: t, y: e, position: n, type: r, onPointerDown: s }) {
2055
2053
  );
2056
2054
  }
2057
2055
  function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2058
- var g, f, p;
2059
- const s = yt(), [o, i] = Gt(null), c = F((v, L, w, P) => {
2056
+ var D, f, h;
2057
+ const s = yt(), [o, i] = Gt(null), c = F((p, M, w, C) => {
2060
2058
  var rt;
2061
- L.stopPropagation(), L.preventDefault();
2062
- const k = s.wrapRef.current;
2063
- if (!k) return;
2064
- const B = v === "source" ? P : w, j = v === "source" ? t.target : t.source;
2059
+ M.stopPropagation(), M.preventDefault();
2060
+ const x = s.wrapRef.current;
2061
+ if (!x) return;
2062
+ const T = p === "source" ? C : w, j = p === "source" ? t.target : t.source;
2065
2063
  (rt = s.workerRef.current) == null || rt.postMessage({
2066
2064
  type: "connecting",
2067
- data: { from: { x: B.x, y: B.y }, to: { x: B.x, y: B.y } }
2065
+ data: { from: { x: T.x, y: T.y }, to: { x: T.x, y: T.y } }
2068
2066
  });
2069
- const X = k.getBoundingClientRect(), xt = (q) => {
2067
+ const W = x.getBoundingClientRect(), xt = (q) => {
2070
2068
  var ut;
2071
- const G = s.cameraRef.current, ot = (q.clientX - X.left - G.x) / G.zoom, lt = (q.clientY - X.top - G.y) / G.zoom;
2069
+ const G = s.cameraRef.current, ot = (q.clientX - W.left - G.x) / G.zoom, lt = (q.clientY - W.top - G.y) / G.zoom;
2072
2070
  (ut = s.workerRef.current) == null || ut.postMessage({
2073
2071
  type: "connecting",
2074
- data: { from: { x: B.x, y: B.y }, to: { x: ot, y: lt } }
2072
+ data: { from: { x: T.x, y: T.y }, to: { x: ot, y: lt } }
2075
2073
  });
2076
2074
  }, K = (q) => {
2077
- var mt, Lt, zt, dt;
2078
- const G = s.cameraRef.current, ot = (q.clientX - X.left - G.x) / G.zoom, lt = (q.clientY - X.top - G.y) / G.zoom, ut = 20 / G.zoom;
2075
+ var mt, Nt, zt, dt;
2076
+ const G = s.cameraRef.current, ot = (q.clientX - W.left - G.x) / G.zoom, lt = (q.clientY - W.top - G.y) / G.zoom, ut = 20 / G.zoom;
2079
2077
  let st = null, It = null;
2080
2078
  const it = (mt = s.handleRegistryRef) == null ? void 0 : mt.current;
2081
2079
  for (const ht of s.nodesRef.current) {
2082
2080
  if (ht.hidden) continue;
2083
- const Rt = ht.width || On, Nt = ht.height || Qn, gt = ht._absolutePosition || ht.position, ne = [];
2081
+ const Rt = ht.width || On, Lt = ht.height || Qn, gt = ht._absolutePosition || ht.position, ne = [];
2084
2082
  if (it)
2085
2083
  for (const [, Bt] of it)
2086
2084
  Bt.nodeId === ht.id && ne.push(Bt);
@@ -2098,13 +2096,13 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2098
2096
  Ot = gt.x + Rt / 2, Yt = gt.y;
2099
2097
  break;
2100
2098
  case "bottom":
2101
- Ot = gt.x + Rt / 2, Yt = gt.y + Nt;
2099
+ Ot = gt.x + Rt / 2, Yt = gt.y + Lt;
2102
2100
  break;
2103
2101
  case "left":
2104
- Ot = gt.x, Yt = gt.y + Nt / 2;
2102
+ Ot = gt.x, Yt = gt.y + Lt / 2;
2105
2103
  break;
2106
2104
  default:
2107
- Ot = gt.x + Rt, Yt = gt.y + Nt / 2;
2105
+ Ot = gt.x + Rt, Yt = gt.y + Lt / 2;
2108
2106
  break;
2109
2107
  }
2110
2108
  if (Math.abs(ot - Ot) < ut && Math.abs(lt - Yt) < ut) {
@@ -2115,17 +2113,17 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2115
2113
  if (st) break;
2116
2114
  }
2117
2115
  if (st) {
2118
- const ht = v === "source" ? { source: st.id, target: j, sourceHandle: It, targetHandle: t.targetHandle } : { source: j, target: st.id, sourceHandle: t.sourceHandle, targetHandle: It };
2119
- (zt = (Lt = s.onEdgesChangeRef).current) == null || zt.call(Lt, [
2116
+ const ht = p === "source" ? { source: st.id, target: j, sourceHandle: It, targetHandle: t.targetHandle } : { source: j, target: st.id, sourceHandle: t.sourceHandle, targetHandle: It };
2117
+ (zt = (Nt = s.onEdgesChangeRef).current) == null || zt.call(Nt, [
2120
2118
  { id: t.id, type: "remove" },
2121
2119
  { type: "add", item: { id: t.id, ...ht } }
2122
2120
  ]);
2123
2121
  }
2124
- (dt = s.workerRef.current) == null || dt.postMessage({ type: "connecting", data: null }), k.removeEventListener("pointermove", xt), k.removeEventListener("pointerup", K);
2122
+ (dt = s.workerRef.current) == null || dt.postMessage({ type: "connecting", data: null }), x.removeEventListener("pointermove", xt), x.removeEventListener("pointerup", K);
2125
2123
  };
2126
- k.addEventListener("pointermove", xt), k.addEventListener("pointerup", K);
2127
- }, [t, s]), u = n.find((v) => v.id === t.source), l = n.find((v) => v.id === t.target), y = u && !!(u.width || (g = u.measured) != null && g.width), m = l && !!(l.width || (f = l.measured) != null && f.width), C = (p = s.handleRegistryRef) == null ? void 0 : p.current, z = y ? Bn(u, "source", t.sourceHandle, C) : null, M = m ? Bn(l, "target", t.targetHandle, C) : null, $ = t.type === "bezier" || t.type === "simplebezier" || t.type === "default", R = s.routedEdges || s.edges, E = R == null ? void 0 : R.find((v) => v.id === t.id), _ = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, D = r !== !1 && t.reconnectable !== !1;
2128
- return !z || !M ? null : /* @__PURE__ */ $t(
2124
+ x.addEventListener("pointermove", xt), x.addEventListener("pointerup", K);
2125
+ }, [t, s]), u = n.find((p) => p.id === t.source), l = n.find((p) => p.id === t.target), g = u && !!(u.width || (D = u.measured) != null && D.width), v = l && !!(l.width || (f = l.measured) != null && f.width), N = (h = s.handleRegistryRef) == null ? void 0 : h.current, z = g ? Bn(u, "source", t.sourceHandle, N) : null, R = v ? Bn(l, "target", t.targetHandle, N) : null, $ = t.type === "bezier" || t.type === "simplebezier" || t.type === "default", k = s.routedEdges || s.edges, E = k == null ? void 0 : k.find((p) => p.id === t.id), _ = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, B = r !== !1 && t.reconnectable !== !1;
2126
+ return !z || !R ? null : /* @__PURE__ */ $t(
2129
2127
  "g",
2130
2128
  {
2131
2129
  className: `ric-edge-wrapper ${t.selected ? "selected" : ""}`,
@@ -2141,10 +2139,10 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2141
2139
  target: t.target,
2142
2140
  sourceX: z.x,
2143
2141
  sourceY: z.y,
2144
- targetX: M.x,
2145
- targetY: M.y,
2142
+ targetX: R.x,
2143
+ targetY: R.y,
2146
2144
  sourcePosition: z.position,
2147
- targetPosition: M.position,
2145
+ targetPosition: R.position,
2148
2146
  sourceHandleId: t.sourceHandle,
2149
2147
  targetHandleId: t.targetHandle,
2150
2148
  data: t.data,
@@ -2158,7 +2156,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2158
2156
  routedPoints: _
2159
2157
  }
2160
2158
  ),
2161
- D && (o || t.selected) && /* @__PURE__ */ $t(Ne, { children: [
2159
+ B && (o || t.selected) && /* @__PURE__ */ $t(Le, { children: [
2162
2160
  /* @__PURE__ */ S(
2163
2161
  Dn,
2164
2162
  {
@@ -2166,17 +2164,17 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2166
2164
  y: z.y,
2167
2165
  position: z.position,
2168
2166
  type: "source",
2169
- onPointerDown: (v) => c("source", v, z, M)
2167
+ onPointerDown: (p) => c("source", p, z, R)
2170
2168
  }
2171
2169
  ),
2172
2170
  /* @__PURE__ */ S(
2173
2171
  Dn,
2174
2172
  {
2175
- x: M.x,
2176
- y: M.y,
2177
- position: M.position,
2173
+ x: R.x,
2174
+ y: R.y,
2175
+ position: R.position,
2178
2176
  type: "target",
2179
- onPointerDown: (v) => c("target", v, z, M)
2177
+ onPointerDown: (p) => c("target", p, z, R)
2180
2178
  }
2181
2179
  )
2182
2180
  ] })
@@ -2189,46 +2187,46 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2189
2187
  var $;
2190
2188
  const n = yt(), [r, s] = Gt(null), o = tt(null);
2191
2189
  if (ft(() => {
2192
- const R = n.wrapRef.current;
2193
- if (!R) return;
2194
- let E = !1, _ = null, D = !1;
2195
- const g = (w) => {
2196
- w.key === t && (D = !0);
2190
+ const k = n.wrapRef.current;
2191
+ if (!k) return;
2192
+ let E = !1, _ = null, B = !1;
2193
+ const D = (w) => {
2194
+ w.key === t && (B = !0);
2197
2195
  }, f = (w) => {
2198
- w.key === t && (D = !1);
2199
- }, p = (w) => {
2200
- if (!D) return;
2201
- const P = w.target;
2202
- if (P.closest(".ric-node-wrapper") || P.closest(".ric-handle")) return;
2196
+ w.key === t && (B = !1);
2197
+ }, h = (w) => {
2198
+ if (!B) return;
2199
+ const C = w.target;
2200
+ if (C.closest(".ric-node-wrapper") || C.closest(".ric-handle")) return;
2203
2201
  E = !0;
2204
- const k = n.cameraRef.current, B = R.getBoundingClientRect(), j = (w.clientX - B.left - k.x) / k.zoom, X = (w.clientY - B.top - k.y) / k.zoom;
2205
- _ = { x: j, y: X }, s({ startX: j, startY: X, endX: j, endY: X }), w.stopPropagation();
2206
- }, v = (w) => {
2202
+ const x = n.cameraRef.current, T = k.getBoundingClientRect(), j = (w.clientX - T.left - x.x) / x.zoom, W = (w.clientY - T.top - x.y) / x.zoom;
2203
+ _ = { x: j, y: W }, s({ startX: j, startY: W, endX: j, endY: W }), w.stopPropagation();
2204
+ }, p = (w) => {
2207
2205
  if (!E || !_) return;
2208
- const P = n.cameraRef.current, k = R.getBoundingClientRect(), B = (w.clientX - k.left - P.x) / P.zoom, j = (w.clientY - k.top - P.y) / P.zoom;
2209
- s({ startX: _.x, startY: _.y, endX: B, endY: j });
2210
- }, L = (w) => {
2206
+ const C = n.cameraRef.current, x = k.getBoundingClientRect(), T = (w.clientX - x.left - C.x) / C.zoom, j = (w.clientY - x.top - C.y) / C.zoom;
2207
+ s({ startX: _.x, startY: _.y, endX: T, endY: j });
2208
+ }, M = (w) => {
2211
2209
  var K, rt;
2212
2210
  if (!E || !_) return;
2213
2211
  E = !1;
2214
- const P = n.cameraRef.current, k = R.getBoundingClientRect(), B = (w.clientX - k.left - P.x) / P.zoom, j = (w.clientY - k.top - P.y) / P.zoom, X = {
2215
- x: Math.min(_.x, B),
2212
+ const C = n.cameraRef.current, x = k.getBoundingClientRect(), T = (w.clientX - x.left - C.x) / C.zoom, j = (w.clientY - x.top - C.y) / C.zoom, W = {
2213
+ x: Math.min(_.x, T),
2216
2214
  y: Math.min(_.y, j),
2217
- width: Math.abs(B - _.x),
2215
+ width: Math.abs(T - _.x),
2218
2216
  height: Math.abs(j - _.y)
2219
2217
  }, xt = [];
2220
2218
  for (const q of n.nodesRef.current) {
2221
2219
  const G = q._absolutePosition || q.position, ot = q.width || 160, lt = q.height || 60;
2222
2220
  let ut;
2223
- e === "full" ? ut = G.x >= X.x && G.y >= X.y && G.x + ot <= X.x + X.width && G.y + lt <= X.y + X.height : ut = G.x + ot > X.x && G.x < X.x + X.width && G.y + lt > X.y && G.y < X.y + X.height, xt.push({ id: q.id, type: "select", selected: ut });
2221
+ e === "full" ? ut = G.x >= W.x && G.y >= W.y && G.x + ot <= W.x + W.width && G.y + lt <= W.y + W.height : ut = G.x + ot > W.x && G.x < W.x + W.width && G.y + lt > W.y && G.y < W.y + W.height, xt.push({ id: q.id, type: "select", selected: ut });
2224
2222
  }
2225
2223
  xt.length && ((rt = (K = n.onNodesChangeRef).current) == null || rt.call(K, xt)), _ = null, s(null);
2226
2224
  };
2227
- return R.addEventListener("pointerdown", p, !0), R.addEventListener("pointermove", v), R.addEventListener("pointerup", L), window.addEventListener("keydown", g), window.addEventListener("keyup", f), () => {
2228
- R.removeEventListener("pointerdown", p, !0), R.removeEventListener("pointermove", v), R.removeEventListener("pointerup", L), window.removeEventListener("keydown", g), window.removeEventListener("keyup", f);
2225
+ return k.addEventListener("pointerdown", h, !0), k.addEventListener("pointermove", p), k.addEventListener("pointerup", M), window.addEventListener("keydown", D), window.addEventListener("keyup", f), () => {
2226
+ k.removeEventListener("pointerdown", h, !0), k.removeEventListener("pointermove", p), k.removeEventListener("pointerup", M), window.removeEventListener("keydown", D), window.removeEventListener("keyup", f);
2229
2227
  };
2230
2228
  }, [n, t, e]), !r) return null;
2231
- const i = (($ = n.cameraRef) == null ? void 0 : $.current) || { x: 0, y: 0, zoom: 1 }, c = Math.min(r.startX, r.endX), u = Math.min(r.startY, r.endY), l = Math.abs(r.endX - r.startX), y = Math.abs(r.endY - r.startY), m = c * i.zoom + i.x, C = u * i.zoom + i.y, z = l * i.zoom, M = y * i.zoom;
2229
+ const i = (($ = n.cameraRef) == null ? void 0 : $.current) || { x: 0, y: 0, zoom: 1 }, c = Math.min(r.startX, r.endX), u = Math.min(r.startY, r.endY), l = Math.abs(r.endX - r.startX), g = Math.abs(r.endY - r.startY), v = c * i.zoom + i.x, N = u * i.zoom + i.y, z = l * i.zoom, R = g * i.zoom;
2232
2230
  return /* @__PURE__ */ S(
2233
2231
  "div",
2234
2232
  {
@@ -2236,10 +2234,10 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2236
2234
  className: "ric-selection-box",
2237
2235
  style: {
2238
2236
  position: "absolute",
2239
- left: m,
2240
- top: C,
2237
+ left: v,
2238
+ top: N,
2241
2239
  width: z,
2242
- height: M,
2240
+ height: R,
2243
2241
  border: "1px dashed #3b82f6",
2244
2242
  background: "rgba(59, 130, 246, 0.08)",
2245
2243
  pointerEvents: "none",
@@ -2290,84 +2288,84 @@ function on({
2290
2288
  className: c = "",
2291
2289
  style: u = {},
2292
2290
  onConnect: l,
2293
- ...y
2291
+ ...g
2294
2292
  }) {
2295
- const m = qe(je), C = yt(), z = tt(null), M = tt(C);
2296
- M.current = C;
2293
+ const v = qe(je), N = yt(), z = tt(null), R = tt(N);
2294
+ R.current = N;
2297
2295
  const $ = F(() => {
2298
- var w, P, k;
2299
- const D = z.current;
2300
- if (!D || !m) return;
2301
- const g = M.current, f = (w = g.handleRegistryRef) == null ? void 0 : w.current;
2296
+ var w, C, x;
2297
+ const B = z.current;
2298
+ if (!B || !v) return;
2299
+ const D = R.current, f = (w = D.handleRegistryRef) == null ? void 0 : w.current;
2302
2300
  if (!f) return;
2303
- const p = `${m}__${n || t}`, v = (k = (P = g.cameraRef) == null ? void 0 : P.current) == null ? void 0 : k.zoom, L = Hr(D, v);
2304
- if (L) {
2305
- const B = { nodeId: m, id: n || null, type: t, position: e, x: L.x, y: L.y };
2306
- f.set(p, B);
2301
+ const h = `${v}__${n || t}`, p = (x = (C = D.cameraRef) == null ? void 0 : C.current) == null ? void 0 : x.zoom, M = Hr(B, p);
2302
+ if (M) {
2303
+ const T = { nodeId: v, id: n || null, type: t, position: e, x: M.x, y: M.y };
2304
+ f.set(h, T);
2307
2305
  }
2308
- }, [m, n, t, e]);
2306
+ }, [v, n, t, e]);
2309
2307
  kr(() => {
2310
2308
  $();
2311
2309
  }, [$]), ft(() => {
2312
- if (!m) return;
2313
- const D = M.current;
2314
- An(D, m);
2315
- const g = z.current, f = g == null ? void 0 : g.closest(".ric-node-wrapper"), p = new ResizeObserver(() => {
2316
- $(), An(M.current, m);
2310
+ if (!v) return;
2311
+ const B = R.current;
2312
+ An(B, v);
2313
+ const D = z.current, f = D == null ? void 0 : D.closest(".ric-node-wrapper"), h = new ResizeObserver(() => {
2314
+ $(), An(R.current, v);
2317
2315
  });
2318
- return f && p.observe(f), () => {
2319
- var P;
2320
- p.disconnect();
2321
- const v = M.current, L = (P = v.handleRegistryRef) == null ? void 0 : P.current, w = `${m}__${n || t}`;
2322
- L == null || L.delete(w), Jn(v, m);
2316
+ return f && h.observe(f), () => {
2317
+ var C;
2318
+ h.disconnect();
2319
+ const p = R.current, M = (C = p.handleRegistryRef) == null ? void 0 : C.current, w = `${v}__${n || t}`;
2320
+ M == null || M.delete(w), Jn(p, v);
2323
2321
  };
2324
- }, [m, n, t, e, $]);
2325
- const R = F(() => {
2326
- var k;
2327
- const D = M.current, g = D.nodesRef.current.find((B) => B.id === m);
2328
- if (!g) return null;
2329
- const f = g._absolutePosition || g.position, p = (k = D.handleRegistryRef) == null ? void 0 : k.current, v = `${m}__${n || t}`, L = p == null ? void 0 : p.get(v);
2330
- if (L && L.x !== void 0 && L.y !== void 0)
2331
- return { x: f.x + L.x, y: f.y + L.y };
2332
- const w = g.width || 160, P = g.height || 60;
2322
+ }, [v, n, t, e, $]);
2323
+ const k = F(() => {
2324
+ var x;
2325
+ const B = R.current, D = B.nodesRef.current.find((T) => T.id === v);
2326
+ if (!D) return null;
2327
+ const f = D._absolutePosition || D.position, h = (x = B.handleRegistryRef) == null ? void 0 : x.current, p = `${v}__${n || t}`, M = h == null ? void 0 : h.get(p);
2328
+ if (M && M.x !== void 0 && M.y !== void 0)
2329
+ return { x: f.x + M.x, y: f.y + M.y };
2330
+ const w = D.width || 160, C = D.height || 60;
2333
2331
  switch (e) {
2334
2332
  case "top":
2335
2333
  return { x: f.x + w / 2, y: f.y };
2336
2334
  case "bottom":
2337
- return { x: f.x + w / 2, y: f.y + P };
2335
+ return { x: f.x + w / 2, y: f.y + C };
2338
2336
  case "left":
2339
- return { x: f.x, y: f.y + P / 2 };
2337
+ return { x: f.x, y: f.y + C / 2 };
2340
2338
  default:
2341
- return { x: f.x + w, y: f.y + P / 2 };
2339
+ return { x: f.x + w, y: f.y + C / 2 };
2342
2340
  }
2343
- }, [m, n, t, e]), E = F((D) => {
2341
+ }, [v, n, t, e]), E = F((B) => {
2344
2342
  var j;
2345
2343
  if (!r || !s) return;
2346
- D.stopPropagation(), D.preventDefault();
2347
- const g = M.current, f = g.cameraRef.current, p = g.wrapRef.current;
2348
- if (!p) return;
2349
- const v = p.getBoundingClientRect(), L = R();
2350
- if (!L) return;
2351
- const w = L.x, P = L.y;
2352
- (j = g.workerRef.current) == null || j.postMessage({
2344
+ B.stopPropagation(), B.preventDefault();
2345
+ const D = R.current, f = D.cameraRef.current, h = D.wrapRef.current;
2346
+ if (!h) return;
2347
+ const p = h.getBoundingClientRect(), M = k();
2348
+ if (!M) return;
2349
+ const w = M.x, C = M.y;
2350
+ (j = D.workerRef.current) == null || j.postMessage({
2353
2351
  type: "connecting",
2354
- data: { from: { x: w, y: P }, to: { x: w, y: P } }
2355
- }), p.setPointerCapture(D.pointerId);
2356
- const k = (X) => {
2352
+ data: { from: { x: w, y: C }, to: { x: w, y: C } }
2353
+ }), h.setPointerCapture(B.pointerId);
2354
+ const x = (W) => {
2357
2355
  var rt;
2358
- const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom;
2359
- (rt = g.workerRef.current) == null || rt.postMessage({
2356
+ const xt = (W.clientX - p.left - f.x) / f.zoom, K = (W.clientY - p.top - f.y) / f.zoom;
2357
+ (rt = D.workerRef.current) == null || rt.postMessage({
2360
2358
  type: "connecting",
2361
- data: { from: { x: w, y: P }, to: { x: xt, y: K } }
2359
+ data: { from: { x: w, y: C }, to: { x: xt, y: K } }
2362
2360
  });
2363
- }, B = (X) => {
2361
+ }, T = (W) => {
2364
2362
  var lt, ut, st, It;
2365
- const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom, rt = 20 / f.zoom;
2363
+ const xt = (W.clientX - p.left - f.x) / f.zoom, K = (W.clientY - p.top - f.y) / f.zoom, rt = 20 / f.zoom;
2366
2364
  let q = null, G = null;
2367
- const ot = (lt = g.handleRegistryRef) == null ? void 0 : lt.current;
2368
- for (const it of g.nodesRef.current) {
2369
- if (it.id === m || it.hidden) continue;
2370
- const mt = it.width || 160, Lt = it.height || 60, zt = it._absolutePosition || it.position, dt = [];
2365
+ const ot = (lt = D.handleRegistryRef) == null ? void 0 : lt.current;
2366
+ for (const it of D.nodesRef.current) {
2367
+ if (it.id === v || it.hidden) continue;
2368
+ const mt = it.width || 160, Nt = it.height || 60, zt = it._absolutePosition || it.position, dt = [];
2371
2369
  if (ot)
2372
2370
  for (const [, Rt] of ot)
2373
2371
  Rt.nodeId === it.id && dt.push(Rt);
@@ -2376,25 +2374,25 @@ function on({
2376
2374
  { type: "source", position: "right" }
2377
2375
  ];
2378
2376
  for (const Rt of ht) {
2379
- let Nt, gt;
2377
+ let Lt, gt;
2380
2378
  if (Rt.x !== void 0 && Rt.y !== void 0)
2381
- Nt = zt.x + Rt.x, gt = zt.y + Rt.y;
2379
+ Lt = zt.x + Rt.x, gt = zt.y + Rt.y;
2382
2380
  else
2383
2381
  switch (Rt.position || (Rt.type === "source" ? "right" : "left")) {
2384
2382
  case "top":
2385
- Nt = zt.x + mt / 2, gt = zt.y;
2383
+ Lt = zt.x + mt / 2, gt = zt.y;
2386
2384
  break;
2387
2385
  case "bottom":
2388
- Nt = zt.x + mt / 2, gt = zt.y + Lt;
2386
+ Lt = zt.x + mt / 2, gt = zt.y + Nt;
2389
2387
  break;
2390
2388
  case "left":
2391
- Nt = zt.x, gt = zt.y + Lt / 2;
2389
+ Lt = zt.x, gt = zt.y + Nt / 2;
2392
2390
  break;
2393
2391
  default:
2394
- Nt = zt.x + mt, gt = zt.y + Lt / 2;
2392
+ Lt = zt.x + mt, gt = zt.y + Nt / 2;
2395
2393
  break;
2396
2394
  }
2397
- if (Math.abs(xt - Nt) < rt && Math.abs(K - gt) < rt) {
2395
+ if (Math.abs(xt - Lt) < rt && Math.abs(K - gt) < rt) {
2398
2396
  q = it, G = Rt.id || null;
2399
2397
  break;
2400
2398
  }
@@ -2403,17 +2401,17 @@ function on({
2403
2401
  }
2404
2402
  if (q) {
2405
2403
  const it = {
2406
- source: t === "source" ? m : q.id,
2407
- target: t === "source" ? q.id : m,
2404
+ source: t === "source" ? v : q.id,
2405
+ target: t === "source" ? q.id : v,
2408
2406
  sourceHandle: t === "source" ? n || null : G,
2409
2407
  targetHandle: t === "source" ? G : n || null
2410
2408
  };
2411
- (st = (ut = g.onEdgesChangeRef) == null ? void 0 : ut.current) == null || st.call(ut, [{ type: "add", item: { id: `e-${it.source}-${it.target}`, ...it } }]);
2409
+ (st = (ut = D.onEdgesChangeRef) == null ? void 0 : ut.current) == null || st.call(ut, [{ type: "add", item: { id: `e-${it.source}-${it.target}`, ...it } }]);
2412
2410
  }
2413
- (It = g.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), p.removeEventListener("pointermove", k), p.removeEventListener("pointerup", B);
2411
+ (It = D.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), h.removeEventListener("pointermove", x), h.removeEventListener("pointerup", T);
2414
2412
  };
2415
- p.addEventListener("pointermove", k), p.addEventListener("pointerup", B);
2416
- }, [m, n, t, e, r, s, R]), _ = {
2413
+ h.addEventListener("pointermove", x), h.addEventListener("pointerup", T);
2414
+ }, [v, n, t, e, r, s, k]), _ = {
2417
2415
  top: { top: 0, left: "50%", transform: "translate(-50%, -50%)" },
2418
2416
  bottom: { bottom: 0, left: "50%", transform: "translate(-50%, 50%)" },
2419
2417
  left: { top: "50%", left: 0, transform: "translate(-50%, -50%)" },
@@ -2425,7 +2423,7 @@ function on({
2425
2423
  ref: z,
2426
2424
  className: `ric-handle ric-handle-${e} ric-handle-${t} ${c}`,
2427
2425
  "data-handleid": n || null,
2428
- "data-nodeid": m,
2426
+ "data-nodeid": v,
2429
2427
  "data-handlepos": e,
2430
2428
  "data-handletype": t,
2431
2429
  onPointerDown: E,
@@ -2442,7 +2440,7 @@ function on({
2442
2440
  ..._,
2443
2441
  ...u
2444
2442
  },
2445
- ...y,
2443
+ ...g,
2446
2444
  children: i
2447
2445
  }
2448
2446
  );
@@ -2576,34 +2574,34 @@ function Vn({
2576
2574
  labelBgBorderRadius: c = 2,
2577
2575
  children: u,
2578
2576
  className: l = "",
2579
- ...y
2577
+ ...g
2580
2578
  }) {
2581
- const [m, C] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
2579
+ const [v, N] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
2582
2580
  return ft(() => {
2583
2581
  if (z.current) {
2584
- const M = z.current.getBBox();
2585
- C({
2586
- x: M.x,
2587
- y: M.y,
2588
- width: M.width,
2589
- height: M.height
2582
+ const R = z.current.getBBox();
2583
+ N({
2584
+ x: R.x,
2585
+ y: R.y,
2586
+ width: R.width,
2587
+ height: R.height
2590
2588
  });
2591
2589
  }
2592
2590
  }, [n]), n ? /* @__PURE__ */ $t(
2593
2591
  "g",
2594
2592
  {
2595
- transform: `translate(${t - m.width / 2} ${e - m.height / 2})`,
2593
+ transform: `translate(${t - v.width / 2} ${e - v.height / 2})`,
2596
2594
  className: `ric-edge-textwrapper ${l}`,
2597
- visibility: m.width ? "visible" : "hidden",
2598
- ...y,
2595
+ visibility: v.width ? "visible" : "hidden",
2596
+ ...g,
2599
2597
  children: [
2600
2598
  s && /* @__PURE__ */ S(
2601
2599
  "rect",
2602
2600
  {
2603
- width: m.width + 2 * i[0],
2601
+ width: v.width + 2 * i[0],
2604
2602
  x: -i[0],
2605
2603
  y: -i[1],
2606
- height: m.height + 2 * i[1],
2604
+ height: v.height + 2 * i[1],
2607
2605
  className: "ric-edge-textbg",
2608
2606
  style: o,
2609
2607
  rx: c,
@@ -2614,7 +2612,7 @@ function Vn({
2614
2612
  "text",
2615
2613
  {
2616
2614
  className: "ric-edge-text",
2617
- y: m.height / 2,
2615
+ y: v.height / 2,
2618
2616
  dy: "0.3em",
2619
2617
  ref: z,
2620
2618
  style: r,
@@ -2642,14 +2640,14 @@ function un({
2642
2640
  labelBgStyle: c,
2643
2641
  labelBgPadding: u,
2644
2642
  labelBgBorderRadius: l,
2645
- interactionWidth: y = 20,
2646
- style: m,
2647
- markerEnd: C,
2643
+ interactionWidth: g = 20,
2644
+ style: v,
2645
+ markerEnd: N,
2648
2646
  markerStart: z,
2649
- className: M = "",
2647
+ className: R = "",
2650
2648
  ...$
2651
2649
  }) {
2652
- return /* @__PURE__ */ $t(Ne, { children: [
2650
+ return /* @__PURE__ */ $t(Le, { children: [
2653
2651
  /* @__PURE__ */ S(
2654
2652
  "path",
2655
2653
  {
@@ -2658,20 +2656,20 @@ function un({
2658
2656
  fill: "none",
2659
2657
  stroke: "#b1b1b7",
2660
2658
  strokeWidth: 1.5,
2661
- className: `ric-edge-path ${M}`,
2662
- style: m,
2663
- markerEnd: C,
2659
+ className: `ric-edge-path ${R}`,
2660
+ style: v,
2661
+ markerEnd: N,
2664
2662
  markerStart: z,
2665
2663
  ...$
2666
2664
  }
2667
2665
  ),
2668
- y ? /* @__PURE__ */ S(
2666
+ g ? /* @__PURE__ */ S(
2669
2667
  "path",
2670
2668
  {
2671
2669
  d: e,
2672
2670
  fill: "none",
2673
2671
  strokeOpacity: 0,
2674
- strokeWidth: y,
2672
+ strokeWidth: g,
2675
2673
  className: "ric-edge-interaction",
2676
2674
  style: { pointerEvents: "stroke" }
2677
2675
  }
@@ -2716,64 +2714,64 @@ const tr = Zt(function({
2716
2714
  targetPosition: c = "top",
2717
2715
  label: u,
2718
2716
  labelStyle: l,
2719
- labelShowBg: y,
2720
- labelBgStyle: m,
2721
- labelBgPadding: C,
2717
+ labelShowBg: g,
2718
+ labelBgStyle: v,
2719
+ labelBgPadding: N,
2722
2720
  labelBgBorderRadius: z,
2723
- style: M,
2721
+ style: R,
2724
2722
  markerEnd: $,
2725
- markerStart: R,
2723
+ markerStart: k,
2726
2724
  interactionWidth: E
2727
2725
  }) {
2728
- let _, D, g;
2729
- const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x), L = Math.max(50, v * 0.5);
2730
- let w, P, k, B;
2726
+ let _, B, D;
2727
+ const f = _n(n, r, i), h = _n(s, o, c), p = Math.abs(h.x - f.x), M = Math.max(50, p * 0.5);
2728
+ let w, C, x, T;
2731
2729
  switch (i) {
2732
2730
  case "left":
2733
- w = f.x - L, P = f.y;
2731
+ w = f.x - M, C = f.y;
2734
2732
  break;
2735
2733
  case "top":
2736
- w = f.x, P = f.y - L;
2734
+ w = f.x, C = f.y - M;
2737
2735
  break;
2738
2736
  case "bottom":
2739
- w = f.x, P = f.y + L;
2737
+ w = f.x, C = f.y + M;
2740
2738
  break;
2741
2739
  default:
2742
- w = f.x + L, P = f.y;
2740
+ w = f.x + M, C = f.y;
2743
2741
  break;
2744
2742
  }
2745
2743
  switch (c) {
2746
2744
  case "right":
2747
- k = p.x + L, B = p.y;
2745
+ x = h.x + M, T = h.y;
2748
2746
  break;
2749
2747
  case "top":
2750
- k = p.x, B = p.y - L;
2748
+ x = h.x, T = h.y - M;
2751
2749
  break;
2752
2750
  case "bottom":
2753
- k = p.x, B = p.y + L;
2751
+ x = h.x, T = h.y + M;
2754
2752
  break;
2755
2753
  default:
2756
- k = p.x - L, B = p.y;
2754
+ x = h.x - M, T = h.y;
2757
2755
  break;
2758
2756
  }
2759
- _ = `M ${n},${r} L ${f.x},${f.y} C ${w},${P} ${k},${B} ${p.x},${p.y} L ${s},${o}`;
2760
- const j = 0.5, X = 0.5;
2761
- return D = X * X * X * f.x + 3 * X * X * j * w + 3 * X * j * j * k + j * j * j * p.x, g = X * X * X * f.y + 3 * X * X * j * P + 3 * X * j * j * B + j * j * j * p.y, /* @__PURE__ */ S(
2757
+ _ = `M ${n},${r} L ${f.x},${f.y} C ${w},${C} ${x},${T} ${h.x},${h.y} L ${s},${o}`;
2758
+ const j = 0.5, W = 0.5;
2759
+ return B = W * W * W * f.x + 3 * W * W * j * w + 3 * W * j * j * x + j * j * j * h.x, D = W * W * W * f.y + 3 * W * W * j * C + 3 * W * j * j * T + j * j * j * h.y, /* @__PURE__ */ S(
2762
2760
  un,
2763
2761
  {
2764
2762
  id: e,
2765
2763
  path: _,
2766
- labelX: D,
2767
- labelY: g,
2764
+ labelX: B,
2765
+ labelY: D,
2768
2766
  label: u,
2769
2767
  labelStyle: l,
2770
- labelShowBg: y,
2771
- labelBgStyle: m,
2772
- labelBgPadding: C,
2768
+ labelShowBg: g,
2769
+ labelBgStyle: v,
2770
+ labelBgPadding: N,
2773
2771
  labelBgBorderRadius: z,
2774
- style: M,
2772
+ style: R,
2775
2773
  markerEnd: $,
2776
- markerStart: R,
2774
+ markerStart: k,
2777
2775
  interactionWidth: E
2778
2776
  }
2779
2777
  );
@@ -2792,42 +2790,42 @@ function nr({
2792
2790
  targetPosition: o = "left",
2793
2791
  curvature: i = 0.25
2794
2792
  }) {
2795
- const c = Math.abs(n - t), u = Math.abs(r - e), l = Math.sqrt(c * c + u * u), y = Math.max(l * i, 50);
2796
- let m, C, z, M;
2793
+ const c = Math.abs(n - t), u = Math.abs(r - e), l = Math.sqrt(c * c + u * u), g = Math.max(l * i, 50);
2794
+ let v, N, z, R;
2797
2795
  switch (s) {
2798
2796
  case "top":
2799
- m = t, C = e - y;
2797
+ v = t, N = e - g;
2800
2798
  break;
2801
2799
  case "bottom":
2802
- m = t, C = e + y;
2800
+ v = t, N = e + g;
2803
2801
  break;
2804
2802
  case "left":
2805
- m = t - y, C = e;
2803
+ v = t - g, N = e;
2806
2804
  break;
2807
2805
  default:
2808
- m = t + y, C = e;
2806
+ v = t + g, N = e;
2809
2807
  break;
2810
2808
  }
2811
2809
  switch (o) {
2812
2810
  case "top":
2813
- z = n, M = r - y;
2811
+ z = n, R = r - g;
2814
2812
  break;
2815
2813
  case "bottom":
2816
- z = n, M = r + y;
2814
+ z = n, R = r + g;
2817
2815
  break;
2818
2816
  case "right":
2819
- z = n + y, M = r;
2817
+ z = n + g, R = r;
2820
2818
  break;
2821
2819
  default:
2822
- z = n - y, M = r;
2820
+ z = n - g, R = r;
2823
2821
  break;
2824
2822
  }
2825
- const $ = `M ${t},${e} C ${m},${C} ${z},${M} ${n},${r}`, R = 0.5, E = 1 - R, _ = E * E * E * t + 3 * E * E * R * m + 3 * E * R * R * z + R * R * R * n, D = E * E * E * e + 3 * E * E * R * C + 3 * E * R * R * M + R * R * R * r;
2826
- return [$, _, D, 0, 0];
2823
+ const $ = `M ${t},${e} C ${v},${N} ${z},${R} ${n},${r}`, k = 0.5, E = 1 - k, _ = E * E * E * t + 3 * E * E * k * v + 3 * E * k * k * z + k * k * k * n, B = E * E * E * e + 3 * E * E * k * N + 3 * E * k * k * R + k * k * k * r;
2824
+ return [$, _, B, 0, 0];
2827
2825
  }
2828
2826
  function rr({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
2829
- const s = Math.abs(n - t), o = Math.max(s * 0.5, 50), i = t + o, c = n - o, u = `M ${t},${e} C ${i},${e} ${c},${r} ${n},${r}`, l = 0.5, y = 0.5, m = y * y * y * t + 3 * y * y * l * i + 3 * y * l * l * c + l * l * l * n, C = y * y * y * e + 3 * y * y * l * e + 3 * y * l * l * r + l * l * l * r;
2830
- return [u, m, C, 0, 0];
2827
+ const s = Math.abs(n - t), o = Math.max(s * 0.5, 50), i = t + o, c = n - o, u = `M ${t},${e} C ${i},${e} ${c},${r} ${n},${r}`, l = 0.5, g = 0.5, v = g * g * g * t + 3 * g * g * l * i + 3 * g * l * l * c + l * l * l * n, N = g * g * g * e + 3 * g * g * l * e + 3 * g * l * l * r + l * l * l * r;
2828
+ return [u, v, N, 0, 0];
2831
2829
  }
2832
2830
  function kn({
2833
2831
  sourceX: t,
@@ -2843,11 +2841,11 @@ function kn({
2843
2841
  if (u) {
2844
2842
  if (Math.abs(r - e) < 1)
2845
2843
  return [`M ${t},${e} L ${n},${r}`, (t + n) / 2, e, 0, 0];
2846
- const z = (t + n) / 2, M = r > e ? 1 : -1;
2847
- return [`M ${t},${e} L ${z - l},${e} Q ${z},${e} ${z},${e + M * l} L ${z},${r - M * l} Q ${z},${r} ${z + (n > z ? l : -l)},${r} L ${n},${r}`, z, (e + r) / 2, 0, 0];
2844
+ const z = (t + n) / 2, R = r > e ? 1 : -1;
2845
+ return [`M ${t},${e} L ${z - l},${e} Q ${z},${e} ${z},${e + R * l} L ${z},${r - R * l} Q ${z},${r} ${z + (n > z ? l : -l)},${r} L ${n},${r}`, z, (e + r) / 2, 0, 0];
2848
2846
  }
2849
- const y = (e + r) / 2, m = n > t ? 1 : -1;
2850
- return [`M ${t},${e} L ${t},${y - l} Q ${t},${y} ${t + m * l},${y} L ${n - m * l},${y} Q ${n},${y} ${n},${y + (r > y ? l : -l)} L ${n},${r}`, (t + n) / 2, y, 0, 0];
2847
+ const g = (e + r) / 2, v = n > t ? 1 : -1;
2848
+ return [`M ${t},${e} L ${t},${g - l} Q ${t},${g} ${t + v * l},${g} L ${n - v * l},${g} Q ${n},${g} ${n},${g + (r > g ? l : -l)} L ${n},${r}`, (t + n) / 2, g, 0, 0];
2851
2849
  }
2852
2850
  function zo({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
2853
2851
  const [, s, o] = nr({ sourceX: t, sourceY: e, targetX: n, targetY: r });
@@ -2905,20 +2903,20 @@ function ln(t, e) {
2905
2903
  }
2906
2904
  }
2907
2905
  function Yr(t, e, n, r, s, o, i, c) {
2908
- const u = Math.min(t, n), l = Math.max(t, n), y = Math.min(e, r), m = Math.max(e, r);
2909
- if (l <= s || u >= s + i || m <= o || y >= o + c) return !1;
2910
- const C = 0.5;
2911
- if (t > s + C && t < s + i - C && e > o + C && e < o + c - C || n > s + C && n < s + i - C && r > o + C && r < o + c - C) return !0;
2912
- const z = (t + n) / 2, M = (e + r) / 2;
2913
- if (z > s + C && z < s + i - C && M > o + C && M < o + c - C) return !0;
2906
+ const u = Math.min(t, n), l = Math.max(t, n), g = Math.min(e, r), v = Math.max(e, r);
2907
+ if (l <= s || u >= s + i || v <= o || g >= o + c) return !1;
2908
+ const N = 0.5;
2909
+ if (t > s + N && t < s + i - N && e > o + N && e < o + c - N || n > s + N && n < s + i - N && r > o + N && r < o + c - N) return !0;
2910
+ const z = (t + n) / 2, R = (e + r) / 2;
2911
+ if (z > s + N && z < s + i - N && R > o + N && R < o + c - N) return !0;
2914
2912
  const $ = [[s, o], [s + i, o], [s + i, o + c], [s, o + c]];
2915
- for (let R = 0; R < 4; R++)
2916
- if (Ur(t, e, n, r, $[R][0], $[R][1], $[(R + 1) % 4][0], $[(R + 1) % 4][1])) return !0;
2913
+ for (let k = 0; k < 4; k++)
2914
+ if (Ur(t, e, n, r, $[k][0], $[k][1], $[(k + 1) % 4][0], $[(k + 1) % 4][1])) return !0;
2917
2915
  return !1;
2918
2916
  }
2919
2917
  function Ur(t, e, n, r, s, o, i, c) {
2920
- const u = (i - s) * (e - o) - (c - o) * (t - s), l = (i - s) * (r - o) - (c - o) * (n - s), y = (n - t) * (o - e) - (r - e) * (s - t), m = (n - t) * (c - e) - (r - e) * (i - t);
2921
- return (u > 0 && l < 0 || u < 0 && l > 0) && (y > 0 && m < 0 || y < 0 && m > 0);
2918
+ const u = (i - s) * (e - o) - (c - o) * (t - s), l = (i - s) * (r - o) - (c - o) * (n - s), g = (n - t) * (o - e) - (r - e) * (s - t), v = (n - t) * (c - e) - (r - e) * (i - t);
2919
+ return (u > 0 && l < 0 || u < 0 && l > 0) && (g > 0 && v < 0 || g < 0 && v > 0);
2922
2920
  }
2923
2921
  function zn(t, e, n, r, s) {
2924
2922
  for (let o = 0; o < s.length; o++) {
@@ -2958,44 +2956,44 @@ function sr(t, e, n) {
2958
2956
  r.add(t.x), r.add(e.x), s.add(t.y), s.add(e.y);
2959
2957
  const o = Ue + 5;
2960
2958
  t.dir === "right" ? r.add(t.x + o) : t.dir === "left" ? r.add(t.x - o) : t.dir === "top" ? s.add(t.y - o) : t.dir === "bottom" && s.add(t.y + o), e.dir === "right" ? r.add(e.x + o) : e.dir === "left" ? r.add(e.x - o) : e.dir === "top" ? s.add(e.y - o) : e.dir === "bottom" && s.add(e.y + o);
2961
- for (let k = 0; k < n.length; k++) {
2962
- const B = n[k];
2963
- r.add(B.x), r.add(B.x + B.w), s.add(B.y), s.add(B.y + B.h);
2959
+ for (let x = 0; x < n.length; x++) {
2960
+ const T = n[x];
2961
+ r.add(T.x), r.add(T.x + T.w), s.add(T.y), s.add(T.y + T.h);
2964
2962
  }
2965
- const i = [...r].sort((k, B) => k - B), c = [...s].sort((k, B) => k - B), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2966
- for (let k = 0; k < i.length; k++) u.set(i[k], k);
2967
- for (let k = 0; k < c.length; k++) l.set(c[k], k);
2968
- const y = i.length, m = c.length, C = (k, B) => B * y + k, z = u.get(t.x), M = l.get(t.y), $ = u.get(e.x), R = l.get(e.y);
2969
- if (z === void 0 || M === void 0 || $ === void 0 || R === void 0) return null;
2970
- const E = C(z, M), _ = C($, R), D = new Float64Array(y * m).fill(1 / 0), g = new Float64Array(y * m).fill(1 / 0), f = new Int32Array(y * m).fill(-1), p = new Int8Array(y * m).fill(-1), v = new Uint8Array(y * m);
2971
- D[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[R] - t.y);
2972
- const L = [E], w = 15, P = [[1, 0], [-1, 0], [0, 1], [0, -1]];
2973
- for (; L.length > 0; ) {
2974
- let k = 0;
2975
- for (let q = 1; q < L.length; q++)
2976
- g[L[q]] < g[L[k]] && (k = q);
2977
- const B = L[k];
2978
- if (L[k] = L[L.length - 1], L.pop(), B === _) {
2963
+ const i = [...r].sort((x, T) => x - T), c = [...s].sort((x, T) => x - T), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2964
+ for (let x = 0; x < i.length; x++) u.set(i[x], x);
2965
+ for (let x = 0; x < c.length; x++) l.set(c[x], x);
2966
+ const g = i.length, v = c.length, N = (x, T) => T * g + x, z = u.get(t.x), R = l.get(t.y), $ = u.get(e.x), k = l.get(e.y);
2967
+ if (z === void 0 || R === void 0 || $ === void 0 || k === void 0) return null;
2968
+ const E = N(z, R), _ = N($, k), B = new Float64Array(g * v).fill(1 / 0), D = new Float64Array(g * v).fill(1 / 0), f = new Int32Array(g * v).fill(-1), h = new Int8Array(g * v).fill(-1), p = new Uint8Array(g * v);
2969
+ B[E] = 0, D[E] = Math.abs(i[$] - t.x) + Math.abs(c[k] - t.y);
2970
+ const M = [E], w = 15, C = [[1, 0], [-1, 0], [0, 1], [0, -1]];
2971
+ for (; M.length > 0; ) {
2972
+ let x = 0;
2973
+ for (let q = 1; q < M.length; q++)
2974
+ D[M[q]] < D[M[x]] && (x = q);
2975
+ const T = M[x];
2976
+ if (M[x] = M[M.length - 1], M.pop(), T === _) {
2979
2977
  const q = [];
2980
2978
  let G = _;
2981
2979
  for (; G !== -1 && G !== E; ) {
2982
- const ot = G / y | 0, lt = G % y;
2980
+ const ot = G / g | 0, lt = G % g;
2983
2981
  q.unshift({ x: i[lt], y: c[ot] }), G = f[G];
2984
2982
  }
2985
2983
  return q.unshift({ x: t.x, y: t.y }), jr(q, n);
2986
2984
  }
2987
- if (v[B]) continue;
2988
- v[B] = 1;
2989
- const j = B / y | 0, X = B % y, xt = i[X], K = c[j], rt = p[B];
2985
+ if (p[T]) continue;
2986
+ p[T] = 1;
2987
+ const j = T / g | 0, W = T % g, xt = i[W], K = c[j], rt = h[T];
2990
2988
  for (let q = 0; q < 4; q++) {
2991
- const G = X + P[q][0], ot = j + P[q][1];
2992
- if (G < 0 || G >= y || ot < 0 || ot >= m) continue;
2993
- const lt = C(G, ot);
2994
- if (v[lt]) continue;
2989
+ const G = W + C[q][0], ot = j + C[q][1];
2990
+ if (G < 0 || G >= g || ot < 0 || ot >= v) continue;
2991
+ const lt = N(G, ot);
2992
+ if (p[lt]) continue;
2995
2993
  const ut = i[G], st = c[ot];
2996
2994
  if (qr(ut, st, n) || !zn(xt, K, ut, st, n)) continue;
2997
- const It = Math.abs(ut - xt) + Math.abs(st - K), it = rt >= 0 && rt !== q ? w : 0, mt = D[B] + It + it;
2998
- mt < D[lt] && (f[lt] = B, p[lt] = q, D[lt] = mt, g[lt] = mt + Math.abs(i[$] - ut) + Math.abs(c[R] - st), L.push(lt));
2995
+ const It = Math.abs(ut - xt) + Math.abs(st - K), it = rt >= 0 && rt !== q ? w : 0, mt = B[T] + It + it;
2996
+ mt < B[lt] && (f[lt] = T, h[lt] = q, B[lt] = mt, D[lt] = mt + Math.abs(i[$] - ut) + Math.abs(c[k] - st), M.push(lt));
2999
2997
  }
3000
2998
  }
3001
2999
  return null;
@@ -3035,8 +3033,8 @@ function Gr(t) {
3035
3033
  if (i.length < 2) continue;
3036
3034
  const c = (i.length - 1) * nn / 2;
3037
3035
  for (let u = 0; u < i.length; u++) {
3038
- const l = i[u], y = -c + u * nn, m = r.get(l.edgeId);
3039
- m && (m[l.segIdx].y += y, m[l.segIdx + 1].y += y);
3036
+ const l = i[u], g = -c + u * nn, v = r.get(l.edgeId);
3037
+ v && (v[l.segIdx].y += g, v[l.segIdx + 1].y += g);
3040
3038
  }
3041
3039
  }
3042
3040
  }
@@ -3047,8 +3045,8 @@ function Gr(t) {
3047
3045
  if (i.length < 2) continue;
3048
3046
  const c = (i.length - 1) * nn / 2;
3049
3047
  for (let u = 0; u < i.length; u++) {
3050
- const l = i[u], y = -c + u * nn, m = r.get(l.edgeId);
3051
- m && (m[l.segIdx].x += y, m[l.segIdx + 1].x += y);
3048
+ const l = i[u], g = -c + u * nn, v = r.get(l.edgeId);
3049
+ v && (v[l.segIdx].x += g, v[l.segIdx + 1].x += g);
3052
3050
  }
3053
3051
  }
3054
3052
  }
@@ -3073,10 +3071,10 @@ function En(t, e = 6, n = !1) {
3073
3071
  const r = e;
3074
3072
  let s = `M ${t[0].x},${t[0].y}`;
3075
3073
  for (let o = 1; o < t.length - 1; o++) {
3076
- const i = t[o - 1], c = t[o], u = t[o + 1], l = Math.abs(c.x - i.x) + Math.abs(c.y - i.y), y = Math.abs(u.x - c.x) + Math.abs(u.y - c.y), m = Math.min(r, l / 2, y / 2);
3077
- if (m > 0.5) {
3078
- const C = c.x - i.x, z = c.y - i.y, M = u.x - c.x, $ = u.y - c.y, R = Math.sqrt(C * C + z * z) || 1, E = Math.sqrt(M * M + $ * $) || 1;
3079
- s += ` L ${c.x - C / R * m},${c.y - z / R * m}`, s += ` Q ${c.x},${c.y} ${c.x + M / E * m},${c.y + $ / E * m}`;
3074
+ const i = t[o - 1], c = t[o], u = t[o + 1], l = Math.abs(c.x - i.x) + Math.abs(c.y - i.y), g = Math.abs(u.x - c.x) + Math.abs(u.y - c.y), v = Math.min(r, l / 2, g / 2);
3075
+ if (v > 0.5) {
3076
+ const N = c.x - i.x, z = c.y - i.y, R = u.x - c.x, $ = u.y - c.y, k = Math.sqrt(N * N + z * z) || 1, E = Math.sqrt(R * R + $ * $) || 1;
3077
+ s += ` L ${c.x - N / k * v},${c.y - z / k * v}`, s += ` Q ${c.x},${c.y} ${c.x + R / E * v},${c.y + $ / E * v}`;
3080
3078
  } else
3081
3079
  s += ` L ${c.x},${c.y}`;
3082
3080
  }
@@ -3090,8 +3088,8 @@ function Zr(t) {
3090
3088
  const e = 0.3;
3091
3089
  let n = `M ${t[0].x},${t[0].y}`;
3092
3090
  for (let r = 0; r < t.length - 1; r++) {
3093
- const s = t[r === 0 ? 0 : r - 1], o = t[r], i = t[r + 1], c = t[r + 2 < t.length ? r + 2 : t.length - 1], u = o.x + (i.x - s.x) * e, l = o.y + (i.y - s.y) * e, y = i.x - (c.x - o.x) * e, m = i.y - (c.y - o.y) * e;
3094
- n += ` C ${u},${l} ${y},${m} ${i.x},${i.y}`;
3091
+ const s = t[r === 0 ? 0 : r - 1], o = t[r], i = t[r + 1], c = t[r + 2 < t.length ? r + 2 : t.length - 1], u = o.x + (i.x - s.x) * e, l = o.y + (i.y - s.y) * e, g = i.x - (c.x - o.x) * e, v = i.y - (c.y - o.y) * e;
3092
+ n += ` C ${u},${l} ${g},${v} ${i.x},${i.y}`;
3095
3093
  }
3096
3094
  return n;
3097
3095
  }
@@ -3114,30 +3112,30 @@ function Cn(t) {
3114
3112
  }
3115
3113
  return { x: t[0].x, y: t[0].y };
3116
3114
  }
3117
- function Lo(t, e) {
3115
+ function No(t, e) {
3118
3116
  if (!t || !e || t.length === 0 || e.length === 0) return e;
3119
3117
  const n = {};
3120
3118
  for (const o of t) n[o.id] = o;
3121
3119
  const r = or(t, null), s = e.map((o) => {
3122
- var p, v, L, w;
3120
+ var h, p, M, w;
3123
3121
  const i = o.type || "default";
3124
3122
  if (i === "bezier" || i === "simplebezier" || i === "default") return o;
3125
3123
  const c = n[o.source], u = n[o.target];
3126
3124
  if (!c || !u || c.hidden || u.hidden) return o;
3127
- const l = Wn(c, "source", o.sourceHandle), y = Wn(u, "target", o.targetHandle), m = ln(l, cn), C = ln(y, cn), z = 5, M = r.filter((P) => P.id !== o.source && P.id !== o.target), $ = c._absolutePosition || c.position, R = c.width || ((p = c.measured) == null ? void 0 : p.width) || sn, E = c.height || ((v = c.measured) == null ? void 0 : v.height) || an;
3128
- M.push({ id: o.source, x: $.x - z, y: $.y - z, w: R + 2 * z, h: E + 2 * z });
3129
- const _ = u._absolutePosition || u.position, D = u.width || ((L = u.measured) == null ? void 0 : L.width) || sn, g = u.height || ((w = u.measured) == null ? void 0 : w.height) || an;
3130
- if (M.push({ id: o.target, x: _.x - z, y: _.y - z, w: D + 2 * z, h: g + 2 * z }), M.length === 0) return o;
3131
- const f = sr(m, C, M);
3132
- return f && f.length >= 2 ? (f.unshift({ x: l.x, y: l.y }), f.push({ x: y.x, y: y.y }), { ...o, _routedPoints: f }) : o;
3125
+ const l = Wn(c, "source", o.sourceHandle), g = Wn(u, "target", o.targetHandle), v = ln(l, cn), N = ln(g, cn), z = 5, R = r.filter((C) => C.id !== o.source && C.id !== o.target), $ = c._absolutePosition || c.position, k = c.width || ((h = c.measured) == null ? void 0 : h.width) || sn, E = c.height || ((p = c.measured) == null ? void 0 : p.height) || an;
3126
+ R.push({ id: o.source, x: $.x - z, y: $.y - z, w: k + 2 * z, h: E + 2 * z });
3127
+ const _ = u._absolutePosition || u.position, B = u.width || ((M = u.measured) == null ? void 0 : M.width) || sn, D = u.height || ((w = u.measured) == null ? void 0 : w.height) || an;
3128
+ if (R.push({ id: o.target, x: _.x - z, y: _.y - z, w: B + 2 * z, h: D + 2 * z }), R.length === 0) return o;
3129
+ const f = sr(v, N, R);
3130
+ return f && f.length >= 2 ? (f.unshift({ x: l.x, y: l.y }), f.push({ x: g.x, y: g.y }), { ...o, _routedPoints: f }) : o;
3133
3131
  });
3134
3132
  return Gr(s);
3135
3133
  }
3136
- function No(t, e, n, r, s, o, i, c) {
3134
+ function Lo(t, e, n, r, s, o, i, c) {
3137
3135
  const u = or(i, c ? new Set(c) : null);
3138
3136
  if (u.length === 0) return null;
3139
- const l = { x: t, y: e, dir: s || "right" }, y = { x: n, y: r, dir: o || "left" }, m = ln(l, cn), C = ln(y, cn), z = sr(m, C, u);
3140
- return z && z.length >= 2 ? (z.unshift({ x: l.x, y: l.y }), z.push({ x: y.x, y: y.y }), z) : null;
3137
+ const l = { x: t, y: e, dir: s || "right" }, g = { x: n, y: r, dir: o || "left" }, v = ln(l, cn), N = ln(g, cn), z = sr(v, N, u);
3138
+ return z && z.length >= 2 ? (z.unshift({ x: l.x, y: l.y }), z.push({ x: g.x, y: g.y }), z) : null;
3141
3139
  }
3142
3140
  const ir = Zt(function({
3143
3141
  id: e,
@@ -3149,37 +3147,37 @@ const ir = Zt(function({
3149
3147
  labelStyle: c,
3150
3148
  labelShowBg: u,
3151
3149
  labelBgStyle: l,
3152
- labelBgPadding: y,
3153
- labelBgBorderRadius: m,
3154
- style: C,
3150
+ labelBgPadding: g,
3151
+ labelBgBorderRadius: v,
3152
+ style: N,
3155
3153
  markerEnd: z,
3156
- markerStart: M,
3154
+ markerStart: R,
3157
3155
  interactionWidth: $,
3158
- routedPoints: R
3156
+ routedPoints: k
3159
3157
  }) {
3160
- let E, _, D;
3161
- if (R && R.length >= 2) {
3162
- E = En(R);
3163
- const g = Cn(R);
3164
- _ = g.x, D = g.y;
3158
+ let E, _, B;
3159
+ if (k && k.length >= 2) {
3160
+ E = En(k);
3161
+ const D = Cn(k);
3162
+ _ = D.x, B = D.y;
3165
3163
  } else
3166
- [E, _, D] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
3164
+ [E, _, B] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
3167
3165
  return /* @__PURE__ */ S(
3168
3166
  un,
3169
3167
  {
3170
3168
  id: e,
3171
3169
  path: E,
3172
3170
  labelX: _,
3173
- labelY: D,
3171
+ labelY: B,
3174
3172
  label: i,
3175
3173
  labelStyle: c,
3176
3174
  labelShowBg: u,
3177
3175
  labelBgStyle: l,
3178
- labelBgPadding: y,
3179
- labelBgBorderRadius: m,
3180
- style: C,
3176
+ labelBgPadding: g,
3177
+ labelBgBorderRadius: v,
3178
+ style: N,
3181
3179
  markerEnd: z,
3182
- markerStart: M,
3180
+ markerStart: R,
3183
3181
  interactionWidth: $
3184
3182
  }
3185
3183
  );
@@ -3195,24 +3193,24 @@ const ar = Zt(function({
3195
3193
  targetPosition: c = "top",
3196
3194
  label: u,
3197
3195
  labelStyle: l,
3198
- labelShowBg: y,
3199
- labelBgStyle: m,
3200
- labelBgPadding: C,
3196
+ labelShowBg: g,
3197
+ labelBgStyle: v,
3198
+ labelBgPadding: N,
3201
3199
  labelBgBorderRadius: z,
3202
- style: M,
3200
+ style: R,
3203
3201
  markerEnd: $,
3204
- markerStart: R,
3202
+ markerStart: k,
3205
3203
  pathOptions: E,
3206
3204
  interactionWidth: _,
3207
- routedPoints: D
3205
+ routedPoints: B
3208
3206
  }) {
3209
- let g, f, p;
3210
- if (D && D.length >= 2) {
3211
- g = En(D);
3212
- const v = Cn(D);
3213
- f = v.x, p = v.y;
3207
+ let D, f, h;
3208
+ if (B && B.length >= 2) {
3209
+ D = En(B);
3210
+ const p = Cn(B);
3211
+ f = p.x, h = p.y;
3214
3212
  } else
3215
- [g, f, p] = kn({
3213
+ [D, f, h] = kn({
3216
3214
  sourceX: n,
3217
3215
  sourceY: r,
3218
3216
  sourcePosition: i,
@@ -3226,18 +3224,18 @@ const ar = Zt(function({
3226
3224
  un,
3227
3225
  {
3228
3226
  id: e,
3229
- path: g,
3227
+ path: D,
3230
3228
  labelX: f,
3231
- labelY: p,
3229
+ labelY: h,
3232
3230
  label: u,
3233
3231
  labelStyle: l,
3234
- labelShowBg: y,
3235
- labelBgStyle: m,
3236
- labelBgPadding: C,
3232
+ labelShowBg: g,
3233
+ labelBgStyle: v,
3234
+ labelBgPadding: N,
3237
3235
  labelBgBorderRadius: z,
3238
- style: M,
3236
+ style: R,
3239
3237
  markerEnd: $,
3240
- markerStart: R,
3238
+ markerStart: k,
3241
3239
  interactionWidth: _
3242
3240
  }
3243
3241
  );
@@ -3265,23 +3263,23 @@ const cr = Zt(function({
3265
3263
  targetPosition: c,
3266
3264
  label: u,
3267
3265
  labelStyle: l,
3268
- labelShowBg: y,
3269
- labelBgStyle: m,
3270
- labelBgPadding: C,
3266
+ labelShowBg: g,
3267
+ labelBgStyle: v,
3268
+ labelBgPadding: N,
3271
3269
  labelBgBorderRadius: z,
3272
- style: M,
3270
+ style: R,
3273
3271
  markerEnd: $,
3274
- markerStart: R,
3272
+ markerStart: k,
3275
3273
  interactionWidth: E,
3276
3274
  routedPoints: _
3277
3275
  }) {
3278
- let D, g, f;
3276
+ let B, D, f;
3279
3277
  if (_ && _.length >= 2) {
3280
- D = En(_);
3281
- const p = Cn(_);
3282
- g = p.x, f = p.y;
3278
+ B = En(_);
3279
+ const h = Cn(_);
3280
+ D = h.x, f = h.y;
3283
3281
  } else
3284
- [D, g, f] = rr({
3282
+ [B, D, f] = rr({
3285
3283
  sourceX: n,
3286
3284
  sourceY: r,
3287
3285
  targetX: s,
@@ -3291,18 +3289,18 @@ const cr = Zt(function({
3291
3289
  un,
3292
3290
  {
3293
3291
  id: e,
3294
- path: D,
3295
- labelX: g,
3292
+ path: B,
3293
+ labelX: D,
3296
3294
  labelY: f,
3297
3295
  label: u,
3298
3296
  labelStyle: l,
3299
- labelShowBg: y,
3300
- labelBgStyle: m,
3301
- labelBgPadding: C,
3297
+ labelShowBg: g,
3298
+ labelBgStyle: v,
3299
+ labelBgPadding: N,
3302
3300
  labelBgBorderRadius: z,
3303
- style: M,
3301
+ style: R,
3304
3302
  markerEnd: $,
3305
- markerStart: R,
3303
+ markerStart: k,
3306
3304
  interactionWidth: E
3307
3305
  }
3308
3306
  );
@@ -3332,29 +3330,29 @@ function Io({
3332
3330
  width: c = "100%",
3333
3331
  height: u = "420px",
3334
3332
  className: l = "",
3335
- style: y = {},
3333
+ style: g = {},
3336
3334
  // Zoom/Camera
3337
- zoomMin: m,
3338
- zoomMax: C,
3335
+ zoomMin: v,
3336
+ zoomMax: N,
3339
3337
  initialCamera: z,
3340
- fitView: M,
3338
+ fitView: R,
3341
3339
  fitViewOptions: $,
3342
3340
  // Node/Edge callbacks
3343
- onNodesChange: R,
3341
+ onNodesChange: k,
3344
3342
  onEdgesChange: E,
3345
3343
  onConnect: _,
3346
- onConnectStart: D,
3347
- onConnectEnd: g,
3344
+ onConnectStart: B,
3345
+ onConnectEnd: D,
3348
3346
  onNodeClick: f,
3349
- onNodeDoubleClick: p,
3350
- onNodeMouseEnter: v,
3351
- onNodeMouseMove: L,
3347
+ onNodeDoubleClick: h,
3348
+ onNodeMouseEnter: p,
3349
+ onNodeMouseMove: M,
3352
3350
  onNodeMouseLeave: w,
3353
- onNodeContextMenu: P,
3354
- onNodeDragStart: k,
3355
- onNodeDrag: B,
3351
+ onNodeContextMenu: C,
3352
+ onNodeDragStart: x,
3353
+ onNodeDrag: T,
3356
3354
  onNodeDragStop: j,
3357
- onEdgeClick: X,
3355
+ onEdgeClick: W,
3358
3356
  onEdgeDoubleClick: xt,
3359
3357
  onEdgeMouseEnter: K,
3360
3358
  onEdgeMouseMove: rt,
@@ -3367,12 +3365,12 @@ function Io({
3367
3365
  onPaneMouseLeave: It,
3368
3366
  onSelectionChange: it,
3369
3367
  onInit: mt,
3370
- onMoveStart: Lt,
3368
+ onMoveStart: Nt,
3371
3369
  onMove: zt,
3372
3370
  onMoveEnd: dt,
3373
3371
  onDelete: ht,
3374
3372
  onBeforeDelete: Rt,
3375
- onError: Nt,
3373
+ onError: Lt,
3376
3374
  // Drag and drop
3377
3375
  onDragOver: gt,
3378
3376
  onDrop: ne,
@@ -3398,7 +3396,7 @@ function Io({
3398
3396
  panOnScrollMode: dn,
3399
3397
  panOnScrollSpeed: fn,
3400
3398
  zoomOnScroll: Qt,
3401
- zoomOnDoubleClick: Ln,
3399
+ zoomOnDoubleClick: Nn,
3402
3400
  zoomOnPinch: hn,
3403
3401
  preventScrolling: fe,
3404
3402
  translateExtent: vt,
@@ -3439,34 +3437,34 @@ function Io({
3439
3437
  onPointerMove: He,
3440
3438
  onPointerUp: _e,
3441
3439
  store: le
3442
- } = Nr({
3440
+ } = Lr({
3443
3441
  cards: t,
3444
3442
  nodes: O,
3445
3443
  edges: bt,
3446
3444
  dark: o,
3447
3445
  gridSize: i,
3448
- zoomMin: m,
3449
- zoomMax: C,
3446
+ zoomMin: v,
3447
+ zoomMax: N,
3450
3448
  initialCamera: z,
3451
- fitView: M,
3449
+ fitView: R,
3452
3450
  fitViewOptions: $,
3453
3451
  onHudUpdate: Ve,
3454
3452
  onNodesProcessed: gn,
3455
- onNodesChange: R,
3453
+ onNodesChange: k,
3456
3454
  onEdgesChange: E,
3457
3455
  onConnect: _,
3458
- onConnectStart: D,
3459
- onConnectEnd: g,
3456
+ onConnectStart: B,
3457
+ onConnectEnd: D,
3460
3458
  onNodeClick: f,
3461
- onNodeDoubleClick: p,
3462
- onNodeMouseEnter: v,
3463
- onNodeMouseMove: L,
3459
+ onNodeDoubleClick: h,
3460
+ onNodeMouseEnter: p,
3461
+ onNodeMouseMove: M,
3464
3462
  onNodeMouseLeave: w,
3465
- onNodeContextMenu: P,
3466
- onNodeDragStart: k,
3467
- onNodeDrag: B,
3463
+ onNodeContextMenu: C,
3464
+ onNodeDragStart: x,
3465
+ onNodeDrag: T,
3468
3466
  onNodeDragStop: j,
3469
- onEdgeClick: X,
3467
+ onEdgeClick: W,
3470
3468
  onEdgeDoubleClick: xt,
3471
3469
  onEdgeMouseEnter: K,
3472
3470
  onEdgeMouseMove: rt,
@@ -3479,12 +3477,12 @@ function Io({
3479
3477
  onPaneMouseLeave: It,
3480
3478
  onSelectionChange: it,
3481
3479
  onInit: mt,
3482
- onMoveStart: Lt,
3480
+ onMoveStart: Nt,
3483
3481
  onMove: zt,
3484
3482
  onMoveEnd: dt,
3485
3483
  onDelete: ht,
3486
3484
  onBeforeDelete: Rt,
3487
- onError: Nt,
3485
+ onError: Lt,
3488
3486
  nodesDraggable: Ot,
3489
3487
  nodesConnectable: Yt,
3490
3488
  elementsSelectable: me,
@@ -3504,7 +3502,7 @@ function Io({
3504
3502
  panOnScrollMode: dn,
3505
3503
  panOnScrollSpeed: fn,
3506
3504
  zoomOnScroll: Qt,
3507
- zoomOnDoubleClick: Ln,
3505
+ zoomOnDoubleClick: Nn,
3508
3506
  zoomOnPinch: hn,
3509
3507
  preventScrolling: fe,
3510
3508
  translateExtent: vt,
@@ -3541,7 +3539,7 @@ function Io({
3541
3539
  {
3542
3540
  ref: Dt,
3543
3541
  className: `ric-wrap ${l}`,
3544
- style: { width: c, height: u, ...y },
3542
+ style: { width: c, height: u, ...g },
3545
3543
  onPointerDown: Ae,
3546
3544
  onPointerMove: He,
3547
3545
  onPointerUp: _e,
@@ -3650,11 +3648,11 @@ function Io({
3650
3648
  ")   zoom: ",
3651
3649
  Ut.zoom,
3652
3650
  "x",
3653
- Ut.nodeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
3651
+ Ut.nodeCount > 0 && /* @__PURE__ */ $t(Le, { children: [
3654
3652
  "   nodes: ",
3655
3653
  Ut.nodeCount
3656
3654
  ] }),
3657
- Ut.edgeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
3655
+ Ut.edgeCount > 0 && /* @__PURE__ */ $t(Le, { children: [
3658
3656
  "   edges: ",
3659
3657
  Ut.edgeCount
3660
3658
  ] })
@@ -3747,97 +3745,103 @@ function So(t) {
3747
3745
  return [e, n, r];
3748
3746
  }
3749
3747
  function eo() {
3750
- const t = yt(), e = F(() => [...t.nodesRef.current], [t]), n = F(() => [...t.edgesRef.current], [t]), r = F((g) => t.nodesRef.current.find((f) => f.id === g), [t]), s = F((g) => t.edgesRef.current.find((f) => f.id === g), [t]), o = F((g) => {
3751
- var f, p, v, L;
3752
- if (typeof g == "function") {
3753
- const w = g(t.nodesRef.current);
3754
- (p = (f = t.onNodesChangeRef).current) == null || p.call(f, [
3755
- ...t.nodesRef.current.map((P) => ({ id: P.id, type: "remove" })),
3756
- ...w.map((P) => ({ type: "add", item: P }))
3748
+ const t = yt(), e = F(() => [...t.nodesRef.current], [t]), n = F(() => [...t.edgesRef.current], [t]), r = F((f) => t.nodesRef.current.find((h) => h.id === f), [t]), s = F((f) => t.edgesRef.current.find((h) => h.id === f), [t]), o = F((f) => {
3749
+ var h, p, M, w;
3750
+ if (typeof f == "function") {
3751
+ const C = f(t.nodesRef.current);
3752
+ (p = (h = t.onNodesChangeRef).current) == null || p.call(h, [
3753
+ ...t.nodesRef.current.map((x) => ({ id: x.id, type: "remove" })),
3754
+ ...C.map((x) => ({ type: "add", item: x }))
3757
3755
  ]);
3758
3756
  } else
3759
- (L = (v = t.onNodesChangeRef).current) == null || L.call(v, [
3760
- ...t.nodesRef.current.map((w) => ({ id: w.id, type: "remove" })),
3761
- ...g.map((w) => ({ type: "add", item: w }))
3757
+ (w = (M = t.onNodesChangeRef).current) == null || w.call(M, [
3758
+ ...t.nodesRef.current.map((C) => ({ id: C.id, type: "remove" })),
3759
+ ...f.map((C) => ({ type: "add", item: C }))
3762
3760
  ]);
3763
- }, [t]), i = F((g) => {
3764
- var f, p, v, L;
3765
- if (typeof g == "function") {
3766
- const w = g(t.edgesRef.current);
3767
- (p = (f = t.onEdgesChangeRef).current) == null || p.call(f, [
3768
- ...t.edgesRef.current.map((P) => ({ id: P.id, type: "remove" })),
3769
- ...w.map((P) => ({ type: "add", item: P }))
3761
+ }, [t]), i = F((f) => {
3762
+ var h, p, M, w;
3763
+ if (typeof f == "function") {
3764
+ const C = f(t.edgesRef.current);
3765
+ (p = (h = t.onEdgesChangeRef).current) == null || p.call(h, [
3766
+ ...t.edgesRef.current.map((x) => ({ id: x.id, type: "remove" })),
3767
+ ...C.map((x) => ({ type: "add", item: x }))
3770
3768
  ]);
3771
3769
  } else
3772
- (L = (v = t.onEdgesChangeRef).current) == null || L.call(v, [
3773
- ...t.edgesRef.current.map((w) => ({ id: w.id, type: "remove" })),
3774
- ...g.map((w) => ({ type: "add", item: w }))
3770
+ (w = (M = t.onEdgesChangeRef).current) == null || w.call(M, [
3771
+ ...t.edgesRef.current.map((C) => ({ id: C.id, type: "remove" })),
3772
+ ...f.map((C) => ({ type: "add", item: C }))
3775
3773
  ]);
3776
- }, [t]), c = F((g) => {
3777
- var p, v;
3778
- const f = Array.isArray(g) ? g : [g];
3779
- (v = (p = t.onNodesChangeRef).current) == null || v.call(p, f.map((L) => ({ type: "add", item: L })));
3780
- }, [t]), u = F((g) => {
3781
- var p, v;
3782
- const f = Array.isArray(g) ? g : [g];
3783
- (v = (p = t.onEdgesChangeRef).current) == null || v.call(p, f.map((L) => ({ type: "add", item: L })));
3784
- }, [t]), l = F(({ nodes: g = [], edges: f = [] }) => {
3785
- if (g.length && t.onNodesChangeRef.current) {
3786
- t.onNodesChangeRef.current(g.map((v) => ({ id: v.id, type: "remove" })));
3787
- const p = zr(g, t.edgesRef.current);
3788
- p.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(p.map((v) => ({ id: v.id, type: "remove" })));
3774
+ }, [t]), c = F((f) => {
3775
+ var p, M;
3776
+ const h = Array.isArray(f) ? f : [f];
3777
+ (M = (p = t.onNodesChangeRef).current) == null || M.call(p, h.map((w) => ({ type: "add", item: w })));
3778
+ }, [t]), u = F((f) => {
3779
+ var p, M;
3780
+ const h = Array.isArray(f) ? f : [f];
3781
+ (M = (p = t.onEdgesChangeRef).current) == null || M.call(p, h.map((w) => ({ type: "add", item: w })));
3782
+ }, [t]), l = F(({ nodes: f = [], edges: h = [] }) => {
3783
+ if (f.length && t.onNodesChangeRef.current) {
3784
+ t.onNodesChangeRef.current(f.map((M) => ({ id: M.id, type: "remove" })));
3785
+ const p = zr(f, t.edgesRef.current);
3786
+ p.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(p.map((M) => ({ id: M.id, type: "remove" })));
3789
3787
  }
3790
- f.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(f.map((p) => ({ id: p.id, type: "remove" })));
3791
- }, [t]), y = F(() => {
3792
- const g = t.cameraRef.current;
3793
- return { x: g.x, y: g.y, zoom: g.zoom };
3794
- }, [t]), m = F((g, f) => {
3788
+ h.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(h.map((p) => ({ id: p.id, type: "remove" })));
3789
+ }, [t]), g = F(() => {
3790
+ const f = t.cameraRef.current;
3791
+ return { x: f.x, y: f.y, zoom: f.zoom };
3792
+ }, [t]), v = F((f, h) => {
3795
3793
  t.cameraRef.current = {
3796
- x: g.x ?? t.cameraRef.current.x,
3797
- y: g.y ?? t.cameraRef.current.y,
3798
- zoom: g.zoom ?? t.cameraRef.current.zoom
3794
+ x: f.x ?? t.cameraRef.current.x,
3795
+ y: f.y ?? t.cameraRef.current.y,
3796
+ zoom: f.zoom ?? t.cameraRef.current.zoom
3799
3797
  }, t.sendCamera();
3800
- }, [t]), C = F(() => t.cameraRef.current.zoom, [t]), z = F((g) => {
3801
- const f = t.cameraRef.current, p = t.wrapRef.current;
3798
+ }, [t]), N = F(() => t.cameraRef.current.zoom, [t]), z = F((f) => {
3799
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3802
3800
  if (!p) return;
3803
- const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = 1.2;
3804
- f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, f.zoom * P), t.sendCamera();
3805
- }, [t]), M = F((g) => {
3806
- const f = t.cameraRef.current, p = t.wrapRef.current;
3801
+ const M = p.getBoundingClientRect(), w = M.width / 2, C = M.height / 2, x = 1.2;
3802
+ h.x = w - (w - h.x) * x, h.y = C - (C - h.y) * x, h.zoom = Math.min(t.zoomMax, h.zoom * x), t.sendCamera();
3803
+ }, [t]), R = F((f) => {
3804
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3807
3805
  if (!p) return;
3808
- const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = 1 / 1.2;
3809
- f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.max(t.zoomMin, f.zoom * P), t.sendCamera();
3810
- }, [t]), $ = F((g) => {
3811
- const f = t.cameraRef.current, p = t.wrapRef.current;
3806
+ const M = p.getBoundingClientRect(), w = M.width / 2, C = M.height / 2, x = 1 / 1.2;
3807
+ h.x = w - (w - h.x) * x, h.y = C - (C - h.y) * x, h.zoom = Math.max(t.zoomMin, h.zoom * x), t.sendCamera();
3808
+ }, [t]), $ = F((f) => {
3809
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3812
3810
  if (!p) return;
3813
- const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = g / f.zoom;
3814
- f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, g)), t.sendCamera();
3815
- }, [t]), R = F((g = {}) => {
3816
- const f = t.nodesRef.current;
3817
- if (!f.length) return;
3811
+ const M = p.getBoundingClientRect(), w = M.width / 2, C = M.height / 2, x = f / h.zoom;
3812
+ h.x = w - (w - h.x) * x, h.y = C - (C - h.y) * x, h.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, f)), t.sendCamera();
3813
+ }, [t]), k = F((f = {}) => {
3814
+ const h = t.nodesRef.current;
3815
+ if (!h.length) return;
3818
3816
  const p = t.wrapRef.current;
3819
3817
  if (!p) return;
3820
- const v = p.getBoundingClientRect(), L = g.padding ?? 0.1, w = g.nodes ? f.filter((B) => g.nodes.some((j) => j.id === B.id)) : f;
3821
- if (!w.length) return;
3822
- const P = Mn(w), k = Rn(P, v.width, v.height, L);
3823
- g.maxZoom && (k.zoom = Math.min(k.zoom, g.maxZoom)), g.minZoom && (k.zoom = Math.max(k.zoom, g.minZoom)), t.cameraRef.current = k, t.sendCamera();
3824
- }, [t]), E = F((g, f, p = {}) => {
3825
- const v = t.wrapRef.current;
3826
- if (!v) return;
3827
- const L = v.getBoundingClientRect(), w = p.zoom ?? t.cameraRef.current.zoom;
3818
+ const M = p.getBoundingClientRect(), w = f.padding ?? 0.1, C = f.nodes ? h.filter((j) => f.nodes.some((W) => W.id === j.id)) : h;
3819
+ if (!C.length) return;
3820
+ const x = Mn(C), T = Rn(x, M.width, M.height, w);
3821
+ f.maxZoom && (T.zoom = Math.min(T.zoom, f.maxZoom)), f.minZoom && (T.zoom = Math.max(T.zoom, f.minZoom)), t.cameraRef.current = T, t.sendCamera();
3822
+ }, [t]), E = F((f, h, p = {}) => {
3823
+ const M = t.wrapRef.current;
3824
+ if (!M) return;
3825
+ const w = M.getBoundingClientRect(), C = p.zoom ?? t.cameraRef.current.zoom;
3828
3826
  t.cameraRef.current = {
3829
- x: L.width / 2 - g * w,
3830
- y: L.height / 2 - f * w,
3831
- zoom: w
3827
+ x: w.width / 2 - f * C,
3828
+ y: w.height / 2 - h * C,
3829
+ zoom: C
3832
3830
  }, t.sendCamera();
3833
- }, [t]), _ = F((g) => t.screenToWorld(g.x, g.y), [t]), D = F((g) => {
3834
- const f = t.cameraRef.current, p = t.wrapRef.current;
3831
+ }, [t]), _ = F((f) => t.screenToWorld(f.x, f.y), [t]), B = F((f) => {
3832
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3835
3833
  if (!p) return { x: 0, y: 0 };
3836
- const v = p.getBoundingClientRect();
3834
+ const M = p.getBoundingClientRect();
3837
3835
  return {
3838
- x: g.x * f.zoom + f.x + v.left,
3839
- y: g.y * f.zoom + f.y + v.top
3836
+ x: f.x * h.zoom + h.x + M.left,
3837
+ y: f.y * h.zoom + h.y + M.top
3840
3838
  };
3839
+ }, [t]), D = F((f, h) => {
3840
+ var w, C;
3841
+ const p = t.nodesRef.current.find((x) => x.id === f);
3842
+ if (!p) return;
3843
+ const M = typeof h == "function" ? h(p.data) : { ...p.data, ...h };
3844
+ (C = (w = t.onNodesChangeRef).current) == null || C.call(w, [{ id: f, type: "replace", item: { ...p, data: M } }]);
3841
3845
  }, [t]);
3842
3846
  return {
3843
3847
  getNodes: e,
@@ -3849,16 +3853,17 @@ function eo() {
3849
3853
  addNodes: c,
3850
3854
  addEdges: u,
3851
3855
  deleteElements: l,
3852
- getViewport: y,
3853
- setViewport: m,
3854
- getZoom: C,
3856
+ getViewport: g,
3857
+ setViewport: v,
3858
+ getZoom: N,
3855
3859
  zoomIn: z,
3856
- zoomOut: M,
3860
+ zoomOut: R,
3857
3861
  zoomTo: $,
3858
- fitView: R,
3862
+ fitView: k,
3859
3863
  setCenter: E,
3860
3864
  screenToFlowPosition: _,
3861
- flowToScreenPosition: D
3865
+ flowToScreenPosition: B,
3866
+ updateNodeData: D
3862
3867
  };
3863
3868
  }
3864
3869
  function Bo() {
@@ -3969,52 +3974,52 @@ function Qo({
3969
3974
  style: o = {},
3970
3975
  className: i = ""
3971
3976
  }) {
3972
- const c = yt(), u = tt(null), l = tt(null), y = F(() => {
3973
- const m = u.current;
3974
- if (!m) return;
3975
- const C = m.getContext("2d"), z = window.devicePixelRatio || 1;
3976
- m.width = t * z, m.height = e * z, C.scale(z, z), C.clearRect(0, 0, t, e);
3977
- const M = c.nodesRef.current;
3978
- if (!M.length) return;
3979
- let $ = 1 / 0, R = 1 / 0, E = -1 / 0, _ = -1 / 0;
3980
- for (const k of M) {
3981
- const B = k.width || wn, j = k.height || bn;
3982
- k.position.x < $ && ($ = k.position.x), k.position.y < R && (R = k.position.y), k.position.x + B > E && (E = k.position.x + B), k.position.y + j > _ && (_ = k.position.y + j);
3977
+ const c = yt(), u = tt(null), l = tt(null), g = F(() => {
3978
+ const v = u.current;
3979
+ if (!v) return;
3980
+ const N = v.getContext("2d"), z = window.devicePixelRatio || 1;
3981
+ v.width = t * z, v.height = e * z, N.scale(z, z), N.clearRect(0, 0, t, e);
3982
+ const R = c.nodesRef.current;
3983
+ if (!R.length) return;
3984
+ let $ = 1 / 0, k = 1 / 0, E = -1 / 0, _ = -1 / 0;
3985
+ for (const x of R) {
3986
+ const T = x.width || wn, j = x.height || bn;
3987
+ x.position.x < $ && ($ = x.position.x), x.position.y < k && (k = x.position.y), x.position.x + T > E && (E = x.position.x + T), x.position.y + j > _ && (_ = x.position.y + j);
3983
3988
  }
3984
- const D = 40;
3985
- $ -= D, R -= D, E += D, _ += D;
3986
- const g = E - $, f = _ - R, p = Math.min(t / g, e / f), v = (t - g * p) / 2, L = (e - f * p) / 2;
3987
- for (const k of M) {
3988
- if (k.hidden) continue;
3989
- const B = k.width || wn, j = k.height || bn, X = (k.position.x - $) * p + v, xt = (k.position.y - R) * p + L, K = B * p, rt = j * p;
3990
- C.fillStyle = k.selected ? "#f59e0b" : typeof n == "function" ? n(k) : n, C.fillRect(X, xt, Math.max(K, 2), Math.max(rt, 2));
3989
+ const B = 40;
3990
+ $ -= B, k -= B, E += B, _ += B;
3991
+ const D = E - $, f = _ - k, h = Math.min(t / D, e / f), p = (t - D * h) / 2, M = (e - f * h) / 2;
3992
+ for (const x of R) {
3993
+ if (x.hidden) continue;
3994
+ const T = x.width || wn, j = x.height || bn, W = (x.position.x - $) * h + p, xt = (x.position.y - k) * h + M, K = T * h, rt = j * h;
3995
+ N.fillStyle = x.selected ? "#f59e0b" : typeof n == "function" ? n(x) : n, N.fillRect(W, xt, Math.max(K, 2), Math.max(rt, 2));
3991
3996
  }
3992
- const w = c.cameraRef.current, P = c.wrapRef.current;
3993
- if (P) {
3994
- const k = P.getBoundingClientRect(), B = -w.x / w.zoom, j = -w.y / w.zoom, X = k.width / w.zoom, xt = k.height / w.zoom;
3995
- C.fillStyle = s, C.fillRect(0, 0, t, e);
3996
- const K = (B - $) * p + v, rt = (j - R) * p + L, q = X * p, G = xt * p;
3997
- C.clearRect(K, rt, q, G);
3998
- for (const ot of M) {
3997
+ const w = c.cameraRef.current, C = c.wrapRef.current;
3998
+ if (C) {
3999
+ const x = C.getBoundingClientRect(), T = -w.x / w.zoom, j = -w.y / w.zoom, W = x.width / w.zoom, xt = x.height / w.zoom;
4000
+ N.fillStyle = s, N.fillRect(0, 0, t, e);
4001
+ const K = (T - $) * h + p, rt = (j - k) * h + M, q = W * h, G = xt * h;
4002
+ N.clearRect(K, rt, q, G);
4003
+ for (const ot of R) {
3999
4004
  if (ot.hidden) continue;
4000
- const lt = ot.width || wn, ut = ot.height || bn, st = (ot.position.x - $) * p + v, It = (ot.position.y - R) * p + L;
4001
- C.fillStyle = ot.selected ? "#f59e0b" : typeof n == "function" ? n(ot) : n, C.fillRect(st, It, Math.max(lt * p, 2), Math.max(ut * p, 2));
4005
+ const lt = ot.width || wn, ut = ot.height || bn, st = (ot.position.x - $) * h + p, It = (ot.position.y - k) * h + M;
4006
+ N.fillStyle = ot.selected ? "#f59e0b" : typeof n == "function" ? n(ot) : n, N.fillRect(st, It, Math.max(lt * h, 2), Math.max(ut * h, 2));
4002
4007
  }
4003
- C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(K, rt, q, G);
4008
+ N.strokeStyle = "#3b82f6", N.lineWidth = 1.5, N.strokeRect(K, rt, q, G);
4004
4009
  }
4005
4010
  }, [c, t, e, n, r, s]);
4006
4011
  return ft(() => {
4007
- let m = !0;
4008
- function C() {
4009
- m && (y(), l.current = requestAnimationFrame(C));
4012
+ let v = !0;
4013
+ function N() {
4014
+ v && (g(), l.current = requestAnimationFrame(N));
4010
4015
  }
4011
4016
  const z = setInterval(() => {
4012
- cancelAnimationFrame(l.current), l.current = requestAnimationFrame(C);
4017
+ cancelAnimationFrame(l.current), l.current = requestAnimationFrame(N);
4013
4018
  }, 66);
4014
- return y(), () => {
4015
- m = !1, clearInterval(z), cancelAnimationFrame(l.current);
4019
+ return g(), () => {
4020
+ v = !1, clearInterval(z), cancelAnimationFrame(l.current);
4016
4021
  };
4017
- }, [y]), /* @__PURE__ */ S(
4022
+ }, [g]), /* @__PURE__ */ S(
4018
4023
  "canvas",
4019
4024
  {
4020
4025
  ref: u,
@@ -4080,21 +4085,21 @@ function ao({
4080
4085
  onInteractiveChange: c,
4081
4086
  position: u = "bottom-left",
4082
4087
  orientation: l = "vertical",
4083
- style: y = {},
4084
- className: m = "",
4085
- "aria-label": C = "Canvas controls",
4088
+ style: g = {},
4089
+ className: v = "",
4090
+ "aria-label": N = "Canvas controls",
4086
4091
  children: z
4087
4092
  }) {
4088
- const M = yt(), { zoomIn: $, zoomOut: R, fitView: E, getZoom: _ } = eo(), [D, g] = Gt(!0), f = _() <= M.zoomMin, p = _() >= M.zoomMax, v = F(() => {
4093
+ const R = yt(), { zoomIn: $, zoomOut: k, fitView: E, getZoom: _ } = eo(), [B, D] = Gt(!0), f = _() <= R.zoomMin, h = _() >= R.zoomMax, p = F(() => {
4089
4094
  $(), s == null || s();
4090
- }, [$, s]), L = F(() => {
4091
- R(), o == null || o();
4092
- }, [R, o]), w = F(() => {
4095
+ }, [$, s]), M = F(() => {
4096
+ k(), o == null || o();
4097
+ }, [k, o]), w = F(() => {
4093
4098
  E(r || { padding: 0.1 }), i == null || i();
4094
- }, [E, r, i]), P = F(() => {
4095
- const B = !D;
4096
- g(B), c == null || c(B);
4097
- }, [D, c]), k = {
4099
+ }, [E, r, i]), C = F(() => {
4100
+ const T = !B;
4101
+ D(T), c == null || c(T);
4102
+ }, [B, c]), x = {
4098
4103
  "top-left": { top: 10, left: 10 },
4099
4104
  "top-right": { top: 10, right: 10 },
4100
4105
  "top-center": { top: 10, left: "50%", transform: "translateX(-50%)" },
@@ -4105,25 +4110,25 @@ function ao({
4105
4110
  return /* @__PURE__ */ $t(
4106
4111
  "div",
4107
4112
  {
4108
- className: `ric-controls ${m}`,
4113
+ className: `ric-controls ${v}`,
4109
4114
  style: {
4110
4115
  position: "absolute",
4111
4116
  display: "flex",
4112
4117
  flexDirection: l === "horizontal" ? "row" : "column",
4113
4118
  gap: 2,
4114
4119
  zIndex: 5,
4115
- ...k,
4116
- ...y
4120
+ ...x,
4121
+ ...g
4117
4122
  },
4118
4123
  role: "toolbar",
4119
- "aria-label": C,
4124
+ "aria-label": N,
4120
4125
  children: [
4121
- t && /* @__PURE__ */ $t(Ne, { children: [
4126
+ t && /* @__PURE__ */ $t(Le, { children: [
4122
4127
  /* @__PURE__ */ S(
4123
4128
  rn,
4124
4129
  {
4125
- onClick: v,
4126
- disabled: p,
4130
+ onClick: p,
4131
+ disabled: h,
4127
4132
  title: "Zoom in",
4128
4133
  "aria-label": "Zoom in",
4129
4134
  className: "ric-controls-zoomin",
@@ -4133,7 +4138,7 @@ function ao({
4133
4138
  /* @__PURE__ */ S(
4134
4139
  rn,
4135
4140
  {
4136
- onClick: L,
4141
+ onClick: M,
4137
4142
  disabled: f,
4138
4143
  title: "Zoom out",
4139
4144
  "aria-label": "Zoom out",
@@ -4155,11 +4160,11 @@ function ao({
4155
4160
  n && /* @__PURE__ */ S(
4156
4161
  rn,
4157
4162
  {
4158
- onClick: P,
4159
- title: D ? "Lock interactivity" : "Unlock interactivity",
4160
- "aria-label": D ? "Lock interactivity" : "Unlock interactivity",
4163
+ onClick: C,
4164
+ title: B ? "Lock interactivity" : "Unlock interactivity",
4165
+ "aria-label": B ? "Lock interactivity" : "Unlock interactivity",
4161
4166
  className: "ric-controls-interactive",
4162
- children: D ? /* @__PURE__ */ S(io, {}) : /* @__PURE__ */ S(so, {})
4167
+ children: B ? /* @__PURE__ */ S(io, {}) : /* @__PURE__ */ S(so, {})
4163
4168
  }
4164
4169
  ),
4165
4170
  z
@@ -4237,34 +4242,34 @@ function ts({
4237
4242
  color: c = "#3b82f6",
4238
4243
  onResizeStart: u,
4239
4244
  onResize: l,
4240
- onResizeEnd: y
4245
+ onResizeEnd: g
4241
4246
  }) {
4242
- const m = qe(je), C = yt(), z = tt(null), M = F((E, _) => {
4247
+ const v = qe(je), N = yt(), z = tt(null), R = F((E, _) => {
4243
4248
  E.stopPropagation(), E.preventDefault();
4244
- const D = C.nodesRef.current.find((p) => p.id === m);
4245
- if (!D) return;
4249
+ const B = N.nodesRef.current.find((h) => h.id === v);
4250
+ if (!B) return;
4246
4251
  z.current = {
4247
4252
  direction: _,
4248
4253
  startX: E.clientX,
4249
4254
  startY: E.clientY,
4250
- width: D.width || 160,
4251
- height: D.height || 60
4255
+ width: B.width || 160,
4256
+ height: B.height || 60
4252
4257
  }, u == null || u(E, { width: z.current.width, height: z.current.height });
4253
- const g = (p) => {
4254
- var j, X;
4258
+ const D = (h) => {
4259
+ var j, W;
4255
4260
  if (!z.current) return;
4256
- const v = z.current, L = C.cameraRef.current, w = (p.clientX - v.startX) / L.zoom, P = (p.clientY - v.startY) / L.zoom;
4257
- let k = v.width, B = v.height;
4258
- v.direction.includes("e") && (k = Math.min(n, Math.max(t, v.width + w))), v.direction.includes("w") && (k = Math.min(n, Math.max(t, v.width - w))), v.direction.includes("s") && (B = Math.min(r, Math.max(e, v.height + P))), v.direction.includes("n") && (B = Math.min(r, Math.max(e, v.height - P))), (X = (j = C.onNodesChangeRef).current) == null || X.call(j, [
4259
- { id: m, type: "dimensions", dimensions: { width: k, height: B }, setAttributes: !0 }
4260
- ]), l == null || l(p, { width: k, height: B });
4261
- }, f = (p) => {
4262
- z.current = null, y == null || y(p, {}), window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", f);
4261
+ const p = z.current, M = N.cameraRef.current, w = (h.clientX - p.startX) / M.zoom, C = (h.clientY - p.startY) / M.zoom;
4262
+ let x = p.width, T = p.height;
4263
+ p.direction.includes("e") && (x = Math.min(n, Math.max(t, p.width + w))), p.direction.includes("w") && (x = Math.min(n, Math.max(t, p.width - w))), p.direction.includes("s") && (T = Math.min(r, Math.max(e, p.height + C))), p.direction.includes("n") && (T = Math.min(r, Math.max(e, p.height - C))), (W = (j = N.onNodesChangeRef).current) == null || W.call(j, [
4264
+ { id: v, type: "dimensions", dimensions: { width: x, height: T }, setAttributes: !0 }
4265
+ ]), l == null || l(h, { width: x, height: T });
4266
+ }, f = (h) => {
4267
+ z.current = null, g == null || g(h, {}), window.removeEventListener("pointermove", D), window.removeEventListener("pointerup", f);
4263
4268
  };
4264
- window.addEventListener("pointermove", g), window.addEventListener("pointerup", f);
4265
- }, [m, C, t, e, n, r, u, l, y]);
4269
+ window.addEventListener("pointermove", D), window.addEventListener("pointerup", f);
4270
+ }, [v, N, t, e, n, r, u, l, g]);
4266
4271
  if (!s) return null;
4267
- const $ = 8, R = {
4272
+ const $ = 8, k = {
4268
4273
  position: "absolute",
4269
4274
  width: $,
4270
4275
  height: $,
@@ -4274,61 +4279,61 @@ function ts({
4274
4279
  zIndex: 20,
4275
4280
  ...o
4276
4281
  };
4277
- return /* @__PURE__ */ $t(Ne, { children: [
4282
+ return /* @__PURE__ */ $t(Le, { children: [
4278
4283
  /* @__PURE__ */ S(
4279
4284
  "div",
4280
4285
  {
4281
- style: { ...R, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
4282
- onPointerDown: (E) => M(E, "se")
4286
+ style: { ...k, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
4287
+ onPointerDown: (E) => R(E, "se")
4283
4288
  }
4284
4289
  ),
4285
4290
  /* @__PURE__ */ S(
4286
4291
  "div",
4287
4292
  {
4288
- style: { ...R, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
4289
- onPointerDown: (E) => M(E, "sw")
4293
+ style: { ...k, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
4294
+ onPointerDown: (E) => R(E, "sw")
4290
4295
  }
4291
4296
  ),
4292
4297
  /* @__PURE__ */ S(
4293
4298
  "div",
4294
4299
  {
4295
- style: { ...R, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
4296
- onPointerDown: (E) => M(E, "ne")
4300
+ style: { ...k, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
4301
+ onPointerDown: (E) => R(E, "ne")
4297
4302
  }
4298
4303
  ),
4299
4304
  /* @__PURE__ */ S(
4300
4305
  "div",
4301
4306
  {
4302
- style: { ...R, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
4303
- onPointerDown: (E) => M(E, "nw")
4307
+ style: { ...k, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
4308
+ onPointerDown: (E) => R(E, "nw")
4304
4309
  }
4305
4310
  ),
4306
4311
  /* @__PURE__ */ S(
4307
4312
  "div",
4308
4313
  {
4309
- style: { ...R, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4310
- onPointerDown: (E) => M(E, "e")
4314
+ style: { ...k, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4315
+ onPointerDown: (E) => R(E, "e")
4311
4316
  }
4312
4317
  ),
4313
4318
  /* @__PURE__ */ S(
4314
4319
  "div",
4315
4320
  {
4316
- style: { ...R, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4317
- onPointerDown: (E) => M(E, "w")
4321
+ style: { ...k, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4322
+ onPointerDown: (E) => R(E, "w")
4318
4323
  }
4319
4324
  ),
4320
4325
  /* @__PURE__ */ S(
4321
4326
  "div",
4322
4327
  {
4323
- style: { ...R, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4324
- onPointerDown: (E) => M(E, "n")
4328
+ style: { ...k, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4329
+ onPointerDown: (E) => R(E, "n")
4325
4330
  }
4326
4331
  ),
4327
4332
  /* @__PURE__ */ S(
4328
4333
  "div",
4329
4334
  {
4330
- style: { ...R, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4331
- onPointerDown: (E) => M(E, "s")
4335
+ style: { ...k, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4336
+ onPointerDown: (E) => R(E, "s")
4332
4337
  }
4333
4338
  )
4334
4339
  ] });
@@ -4342,9 +4347,9 @@ function es({
4342
4347
  style: o = {},
4343
4348
  className: i = ""
4344
4349
  }) {
4345
- const c = qe(je), l = yt().nodes.find((C) => C.id === c);
4350
+ const c = qe(je), l = yt().nodes.find((N) => N.id === c);
4346
4351
  if (!(t !== void 0 ? t : l == null ? void 0 : l.selected)) return null;
4347
- const m = {
4352
+ const v = {
4348
4353
  top: { bottom: "100%", left: r === "start" ? 0 : r === "end" ? void 0 : "50%", right: r === "end" ? 0 : void 0, transform: r === "center" ? "translateX(-50%)" : void 0, marginBottom: n },
4349
4354
  bottom: { top: "100%", left: r === "start" ? 0 : r === "end" ? void 0 : "50%", right: r === "end" ? 0 : void 0, transform: r === "center" ? "translateX(-50%)" : void 0, marginTop: n },
4350
4355
  left: { right: "100%", top: r === "start" ? 0 : r === "end" ? void 0 : "50%", bottom: r === "end" ? 0 : void 0, transform: r === "center" ? "translateY(-50%)" : void 0, marginRight: n },
@@ -4358,10 +4363,10 @@ function es({
4358
4363
  position: "absolute",
4359
4364
  zIndex: 1e3,
4360
4365
  pointerEvents: "all",
4361
- ...m,
4366
+ ...v,
4362
4367
  ...o
4363
4368
  },
4364
- onPointerDown: (C) => C.stopPropagation(),
4369
+ onPointerDown: (N) => N.stopPropagation(),
4365
4370
  children: s
4366
4371
  }
4367
4372
  );
@@ -4529,7 +4534,7 @@ export {
4529
4534
  vo as boxToRect,
4530
4535
  or as buildObstacles,
4531
4536
  Tn as clampPosition,
4532
- Lo as computeRoutedEdges,
4537
+ No as computeRoutedEdges,
4533
4538
  zo as getBezierEdgeCenter,
4534
4539
  nr as getBezierPath,
4535
4540
  wo as getBoundsOfBoxes,
@@ -4552,14 +4557,14 @@ export {
4552
4557
  Mo as nodeToRect,
4553
4558
  Co as reconnectEdge,
4554
4559
  mo as rectToBox,
4555
- No as routeSinglePath,
4560
+ Lo as routeSinglePath,
4556
4561
  En as routedPointsToPath,
4557
4562
  Pn as snapPosition,
4558
4563
  Ho as useConnection,
4559
4564
  Do as useEdges,
4560
4565
  So as useEdgesState,
4561
4566
  Xo as useHandleConnections,
4562
- Nr as useInfiniteCanvas,
4567
+ Lr as useInfiniteCanvas,
4563
4568
  Go as useInternalNode,
4564
4569
  Uo as useKeyPress,
4565
4570
  Wo as useNodeConnections,