@oscherbakov/react-flow-automated-layout 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import { jsx as d, jsxs as T, Fragment as P } from "react/jsx-runtime";
2
- import { createContext as Ut, useContext as Ft, useState as B, useEffect as V, useRef as ut, useCallback as U } from "react";
3
- import { Position as A, useReactFlow as Vt, useNodes as Yt, useEdges as It, useOnSelectionChange as Pt, ControlButton as D, Controls as jt } from "@xyflow/react";
4
- import dt from "@dagrejs/dagre";
5
- const Lt = Ut(void 0);
6
- function Y() {
7
- const t = Ft(Lt);
1
+ import { jsx as u, jsxs as T, Fragment as P } from "react/jsx-runtime";
2
+ import { createContext as Ft, useContext as Vt, useState as B, useEffect as V, useRef as dt, useCallback as U } from "react";
3
+ import { Position as A, useReactFlow as It, useNodes as Yt, useEdges as Pt, useOnSelectionChange as jt, ControlButton as D, Controls as Xt } from "@xyflow/react";
4
+ import ut from "@dagrejs/dagre";
5
+ const Lt = Ft(void 0);
6
+ function I() {
7
+ const t = Vt(Lt);
8
8
  if (t === void 0)
9
9
  throw new Error("useLayoutContext must be used within a LayoutProvider");
10
10
  return t;
@@ -35,7 +35,7 @@ const ft = (t) => {
35
35
  default:
36
36
  return "DOWN";
37
37
  }
38
- }, Xt = {
38
+ }, Jt = {
39
39
  enabled: !0,
40
40
  padding: {
41
41
  horizontal: 80,
@@ -44,7 +44,7 @@ const ft = (t) => {
44
44
  respectHeaderHeight: !0,
45
45
  minWidth: 200,
46
46
  minHeight: 100
47
- }, Jt = (t) => {
47
+ }, Zt = (t) => {
48
48
  switch (t) {
49
49
  case "DOWN":
50
50
  return A.Bottom;
@@ -57,7 +57,7 @@ const ft = (t) => {
57
57
  default:
58
58
  return A.Bottom;
59
59
  }
60
- }, Zt = (t) => {
60
+ }, qt = (t) => {
61
61
  switch (t) {
62
62
  case "DOWN":
63
63
  return A.Top;
@@ -71,7 +71,7 @@ const ft = (t) => {
71
71
  return A.Top;
72
72
  }
73
73
  };
74
- function qt(t, r, e) {
74
+ function Qt(t, r, e) {
75
75
  if (e)
76
76
  return { nodes: t, edges: r };
77
77
  const o = t.filter((l) => !l.hidden), n = new Set(o.map((l) => l.id)), i = r.filter(
@@ -79,8 +79,8 @@ function qt(t, r, e) {
79
79
  );
80
80
  return { nodes: o, edges: i };
81
81
  }
82
- const Qt = 172, Wt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Qt, c = Wt, h = !1) => {
83
- const a = new dt.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
82
+ const Wt = 172, Kt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Wt, c = Kt, h = !1) => {
83
+ const a = new ut.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
84
84
  a.setGraph({
85
85
  rankdir: e,
86
86
  marginx: o,
@@ -91,55 +91,55 @@ const Qt = 172, Wt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Qt, c =
91
91
  //When we have siblings, we want their top edges to be aligned
92
92
  ranker: "tight-tree"
93
93
  });
94
- const s = h ? t : t.filter((p) => !p.hidden);
94
+ const s = h ? t : t.filter((f) => !f.hidden);
95
95
  if (s.length === 0)
96
96
  return { nodes: [], edges: [], width: 0, height: 0 };
97
- s.forEach((p) => {
98
- var y, x;
99
- const f = Number((y = p.style) == null ? void 0 : y.width) || l, m = Number((x = p.style) == null ? void 0 : x.height) || c;
100
- a.setNode(p.id, { width: f, height: m });
101
- }), r.forEach((p) => {
102
- var E, L;
103
- const f = p.sourceHandle, m = p.targetHandle, y = !!((E = p.data) != null && E.isReciprocal), x = !!((L = p.data) != null && L.isSyntheticBridge);
104
- let w = {};
105
- y ? w = { constraint: !1, minlen: 1, weight: 5 } : x ? w = { constraint: !0, minlen: 1, weight: 4 } : f === "right" && m === "left" ? w = { constraint: !1, minlen: 1 } : f === "bottom" && m === "top" ? w = { constraint: !0, minlen: 1 } : w = { constraint: !0, minlen: 2 }, a.setEdge(p.source, p.target, w);
106
- }), dt.layout(a);
107
- const u = a.graph().width || 0, g = a.graph().height || 0, N = Jt(pt(e)), b = Zt(pt(e));
97
+ s.forEach((f) => {
98
+ var w, y;
99
+ const p = Number((w = f.style) == null ? void 0 : w.width) || l, m = Number((y = f.style) == null ? void 0 : y.height) || c;
100
+ a.setNode(f.id, { width: p, height: m });
101
+ }), r.forEach((f) => {
102
+ var C, b;
103
+ const p = f.sourceHandle, m = f.targetHandle, w = !!((C = f.data) != null && C.isReciprocal), y = !!((b = f.data) != null && b.isSyntheticBridge);
104
+ let g = {};
105
+ w ? g = { constraint: !1, minlen: 1, weight: 5 } : y ? g = { constraint: !0, minlen: 1, weight: 4 } : p === "right" && m === "left" ? g = { constraint: !1, minlen: 1 } : p === "bottom" && m === "top" ? g = { constraint: !0, minlen: 1 } : g = { constraint: !0, minlen: 2 }, a.setEdge(f.source, f.target, g);
106
+ }), ut.layout(a);
107
+ const d = a.graph().width || 0, x = a.graph().height || 0, N = Zt(pt(e)), L = qt(pt(e));
108
108
  return {
109
- nodes: s.map((p) => {
110
- var L;
111
- const f = a.node(p.id), { width: m, height: y } = f, x = {
112
- ...p,
109
+ nodes: s.map((f) => {
110
+ var b;
111
+ const p = a.node(f.id), { width: m, height: w } = p, y = {
112
+ ...f,
113
113
  sourcePosition: N,
114
- targetPosition: b,
114
+ targetPosition: L,
115
115
  selected: !1
116
- }, w = f.x, E = f.y;
117
- switch ((L = p.data) == null ? void 0 : L.positionType) {
116
+ }, g = p.x, C = p.y;
117
+ switch ((b = f.data) == null ? void 0 : b.positionType) {
118
118
  case "center":
119
- x.position = { x: w, y: E };
119
+ y.position = { x: g, y: C };
120
120
  break;
121
121
  case "topRight":
122
- x.position = { x: w + m / 2, y: E - y / 2 };
122
+ y.position = { x: g + m / 2, y: C - w / 2 };
123
123
  break;
124
124
  case "bottomLeft":
125
- x.position = { x: w - m / 2, y: E + y / 2 };
125
+ y.position = { x: g - m / 2, y: C + w / 2 };
126
126
  break;
127
127
  case "bottomRight":
128
- x.position = { x: w + m / 2, y: E + y / 2 };
128
+ y.position = { x: g + m / 2, y: C + w / 2 };
129
129
  break;
130
130
  case "topLeft":
131
131
  default:
132
- x.position = { x: w - m / 2, y: E - y / 2 };
132
+ y.position = { x: g - m / 2, y: C - w / 2 };
133
133
  }
134
- return x;
134
+ return y;
135
135
  }),
136
136
  edges: r,
137
- width: u,
138
- height: g
137
+ width: d,
138
+ height: x
139
139
  };
140
- }, Kt = {
140
+ }, te = {
141
141
  calculate: async (t, r, e) => {
142
- const o = e.nodes || t, n = e.edges || r, l = e.dagreDirection || typeof e.direction == "string" && (e.direction === "RIGHT" || e.direction === "LEFT" ? "LR" : "TB") || "TB", c = e.margin ?? (typeof e.padding == "number" ? e.padding : 0), h = e.nodeSpacing ?? 50, a = e.layerSpacing ?? 50, s = e.nodeWidth ?? 172, u = e.nodeHeight ?? 36, g = e.layoutHidden ?? !1;
142
+ const o = e.nodes || t, n = e.edges || r, l = e.dagreDirection || typeof e.direction == "string" && (e.direction === "RIGHT" || e.direction === "LEFT" ? "LR" : "TB") || "TB", c = e.margin ?? (typeof e.padding == "number" ? e.padding : 0), h = e.nodeSpacing ?? 50, a = e.layerSpacing ?? 50, s = e.nodeWidth ?? 172, d = e.nodeHeight ?? 36, x = e.layoutHidden ?? !1;
143
143
  return X(
144
144
  o,
145
145
  n,
@@ -148,14 +148,14 @@ const Qt = 172, Wt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Qt, c =
148
148
  h,
149
149
  a,
150
150
  s,
151
- u,
152
- g
151
+ d,
152
+ x
153
153
  );
154
154
  }
155
- }, te = {
156
- dagre: Kt
155
+ }, ee = {
156
+ dagre: te
157
157
  };
158
- function ee({
158
+ function re({
159
159
  initialDirection: t = "DOWN",
160
160
  initialAlgorithm: r = "layered",
161
161
  initialAutoLayout: e = !0,
@@ -166,38 +166,38 @@ function ee({
166
166
  includeHidden: c = !1,
167
167
  layoutEngines: h
168
168
  }) {
169
- const [a, s] = B(t), [u, g] = B(r), [N, b] = B(e), [C, p] = B(!1), [f, m] = B(c), [y, x] = B({
170
- ...te,
169
+ const [a, s] = B(t), [d, x] = B(r), [N, L] = B(e), [E, f] = B(!1), [p, m] = B(c), [w, y] = B({
170
+ ...ee,
171
171
  ...h
172
- }), [w, E] = B({}), [L, M] = B(o), [G, O] = B(n.node || 150), [k, v] = B(n.layer || 180), [S, R] = B(i.width || 100), [_, J] = B(i.height || 100), [Z, q] = B({
173
- ...Xt,
172
+ }), [g, C] = B({}), [b, M] = B(o), [G, O] = B(n.node || 150), [k, v] = B(n.layer || 180), [S, R] = B(i.width || 100), [_, J] = B(i.height || 100), [Z, q] = B({
173
+ ...Jt,
174
174
  ...l,
175
175
  enabled: e
176
- }), [I, Q] = B([]);
176
+ }), [Y, Q] = B([]);
177
177
  return {
178
178
  // State
179
179
  direction: a,
180
- algorithm: u,
180
+ algorithm: d,
181
181
  autoLayout: N,
182
- layoutInProgress: C,
183
- layoutHidden: f,
184
- layoutEngines: y,
185
- layoutEngineOptions: w,
186
- padding: L,
182
+ layoutInProgress: E,
183
+ layoutHidden: p,
184
+ layoutEngines: w,
185
+ layoutEngineOptions: g,
186
+ padding: b,
187
187
  nodeSpacing: G,
188
188
  layerSpacing: k,
189
189
  nodeWidth: S,
190
190
  nodeHeight: _,
191
191
  parentResizingOptions: Z,
192
- selectedNodes: I,
192
+ selectedNodes: Y,
193
193
  // Setters
194
194
  setDirection: s,
195
- setAlgorithm: g,
196
- setAutoLayout: b,
197
- setLayoutInProgress: p,
195
+ setAlgorithm: x,
196
+ setAutoLayout: L,
197
+ setLayoutInProgress: f,
198
198
  setLayoutHidden: m,
199
- setLayoutEngines: x,
200
- setLayoutEngineOptions: E,
199
+ setLayoutEngines: y,
200
+ setLayoutEngineOptions: C,
201
201
  setPadding: M,
202
202
  setNodeSpacing: O,
203
203
  setLayerSpacing: v,
@@ -207,49 +207,50 @@ function ee({
207
207
  setSelectedNodes: Q
208
208
  };
209
209
  }
210
- function re({
210
+ function ne({
211
211
  nodes: t,
212
212
  externalNodeIdWithNode: r,
213
213
  externalNodeParentIdMapWithChildIdSet: e,
214
214
  noParentKey: o = "no-parent"
215
215
  }) {
216
- const [n, i] = B(/* @__PURE__ */ new Map()), [l, c] = B(/* @__PURE__ */ new Map()), [h, a] = B({}), [s, u] = B(t.length), [g, N] = B(!1), b = r || n, C = e || l, p = b.size;
216
+ const [n, i] = B(/* @__PURE__ */ new Map()), [l, c] = B(/* @__PURE__ */ new Map()), [h, a] = B({}), [s, d] = B(t.length), [x, N] = B(!1), [L, E] = B(!1), f = r || n, p = e || l, m = f.size;
217
217
  return V(() => {
218
218
  if (!r || !e) {
219
- const f = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
220
- t.forEach((y) => {
221
- var w;
222
- f.set(y.id, y);
223
- const x = y.parentId || o;
224
- m.has(x) || m.set(x, /* @__PURE__ */ new Set()), (w = m.get(x)) == null || w.add(y.id);
225
- }), r || i(f), e || c(m);
219
+ const w = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
220
+ E(!1), t.forEach((g) => {
221
+ var b;
222
+ w.set(g.id, g);
223
+ const C = g.parentId || o;
224
+ y.has(C) || y.set(C, /* @__PURE__ */ new Set()), (b = y.get(C)) == null || b.add(g.id);
225
+ }), r || i(w), e || c(y);
226
226
  }
227
227
  }, [t, r, e, o]), V(() => {
228
- t.length !== s && u(t.length);
228
+ t.length !== s && d(t.length);
229
229
  }, [t]), V(() => {
230
- b.size > 0 && C.size > 0 && !g && N(!0);
231
- }, [b, C, g]), V(() => {
232
- const f = {};
233
- C.forEach((y, x) => {
234
- f[x] = y.size;
230
+ f.size > 0 && p.size > 0 && !x && (N(!0), E(!0));
231
+ }, [f, p, x]), V(() => {
232
+ const w = {};
233
+ p.forEach((g, C) => {
234
+ w[C] = g.size;
235
235
  });
236
- let m = !1;
237
- for (const y in f)
238
- if (!h.hasOwnProperty(y) || f[y] !== h[y]) {
239
- m = !0;
236
+ let y = !1;
237
+ for (const g in w)
238
+ if (!h.hasOwnProperty(g) || w[g] !== h[g]) {
239
+ y = !0;
240
240
  break;
241
241
  }
242
- m && a(f);
243
- }, [C]), {
244
- nodeIdWithNode: b,
245
- nodeParentIdMapWithChildIdSet: C,
246
- numberOfNodes: p,
242
+ y && a(w);
243
+ }, [p]), {
244
+ nodeIdWithNode: f,
245
+ nodeParentIdMapWithChildIdSet: p,
246
+ numberOfNodes: m,
247
247
  nodesLength: s,
248
- childrenInitialized: g,
248
+ nodesInitialized: L,
249
+ childrenInitialized: x,
249
250
  parentChildStructure: h
250
251
  };
251
252
  }
252
- function ne({
253
+ function oe({
253
254
  nodes: t,
254
255
  edges: r,
255
256
  selectedNodes: e,
@@ -262,22 +263,22 @@ function ne({
262
263
  setNodeSpacing: a,
263
264
  setLayerSpacing: s
264
265
  }) {
265
- const u = Vt(), g = ut(null), N = ut(null), b = U(async (p = [], f = []) => {
266
- g.current && g.current.abort();
266
+ const d = It(), x = dt(null), N = dt(null), L = U(async (f = [], p = []) => {
267
+ x.current && x.current.abort();
267
268
  const m = new AbortController();
268
- g.current = m;
269
- const y = p.length > 0 ? p : t, x = f.length > 0 ? f : r;
270
- if (y.length === 0)
271
- return { nodes: y, edges: x };
269
+ x.current = m;
270
+ const w = f.length > 0 ? f : t, y = p.length > 0 ? p : r;
271
+ if (w.length === 0)
272
+ return { nodes: w, edges: y };
272
273
  try {
273
274
  if (h(!0), m.signal.aborted)
274
- return { nodes: y, edges: x };
275
- const { nodes: w, edges: E } = qt(y, x, o), L = await n(w, E, e, m.signal);
276
- return m.signal.aborted ? { nodes: y, edges: x } : (g.current === m && (l ? l(L.nodes) : u != null && u.setNodes && u.setNodes(L.nodes), c ? c(L.edges) : u != null && u.setEdges && u.setEdges(L.edges), N.current && (N.current.node !== void 0 && a(N.current.node), N.current.layer !== void 0 && s(N.current.layer), N.current = null)), L);
277
- } catch (w) {
278
- return m.signal.aborted || console.error("Error applying layout:", w), { nodes: y, edges: x };
275
+ return { nodes: w, edges: y };
276
+ const { nodes: g, edges: C } = Qt(w, y, o), b = await n(g, C, e, m.signal);
277
+ return m.signal.aborted ? { nodes: w, edges: y } : (x.current === m && (l ? l(b.nodes) : d != null && d.setNodes && d.setNodes(b.nodes), c ? c(b.edges) : d != null && d.setEdges && d.setEdges(b.edges), N.current && (N.current.node !== void 0 && a(N.current.node), N.current.layer !== void 0 && s(N.current.layer), N.current = null)), b);
278
+ } catch (g) {
279
+ return m.signal.aborted || console.error("Error applying layout:", g), { nodes: w, edges: y };
279
280
  } finally {
280
- g.current === m && (h(!1), g.current = null);
281
+ x.current === m && (h(!1), x.current = null);
281
282
  }
282
283
  }, [
283
284
  t,
@@ -286,32 +287,32 @@ function ne({
286
287
  n,
287
288
  l,
288
289
  c,
289
- u,
290
+ d,
290
291
  o,
291
292
  h,
292
293
  a,
293
294
  s
294
- ]), C = U(async (p) => {
295
- g.current && g.current.abort();
296
- const f = new AbortController();
297
- if (g.current = f, t.length === 0) return { nodes: t, edges: r };
295
+ ]), E = U(async (f) => {
296
+ x.current && x.current.abort();
297
+ const p = new AbortController();
298
+ if (x.current = p, t.length === 0) return { nodes: t, edges: r };
298
299
  try {
299
- if (h(!0), f.signal.aborted) return { nodes: t, edges: r };
300
- const m = await i(p, t, r, f.signal);
301
- return f.signal.aborted ? { nodes: t, edges: r } : (g.current === f && (l ? l(m.nodes) : u != null && u.setNodes && u.setNodes(m.nodes), c ? c(m.edges) : u != null && u.setEdges && u.setEdges(m.edges)), m);
300
+ if (h(!0), p.signal.aborted) return { nodes: t, edges: r };
301
+ const m = await i(f, t, r, p.signal);
302
+ return p.signal.aborted ? { nodes: t, edges: r } : (x.current === p && (l ? l(m.nodes) : d != null && d.setNodes && d.setNodes(m.nodes), c ? c(m.edges) : d != null && d.setEdges && d.setEdges(m.edges)), m);
302
303
  } catch (m) {
303
- return f.signal.aborted || console.error("Error applying container layout:", m), { nodes: t, edges: r };
304
+ return p.signal.aborted || console.error("Error applying container layout:", m), { nodes: t, edges: r };
304
305
  } finally {
305
- g.current === f && (h(!1), g.current = null);
306
+ x.current === p && (h(!1), x.current = null);
306
307
  }
307
- }, [t, r, i, l, c, u, h]);
308
+ }, [t, r, i, l, c, d, h]);
308
309
  return {
309
- applyLayout: b,
310
- applyContainerLayout: C,
310
+ applyLayout: L,
311
+ applyContainerLayout: E,
311
312
  pendingSpacingUpdateRef: N
312
313
  };
313
314
  }
314
- const oe = (t, r, e = "no-parent") => {
315
+ const ie = (t, r, e = "no-parent") => {
315
316
  const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
316
317
  t.forEach((c, h) => {
317
318
  const a = r.get(h);
@@ -327,11 +328,11 @@ const oe = (t, r, e = "no-parent") => {
327
328
  o.add(c);
328
329
  const s = n.get(c);
329
330
  s.depth = h;
330
- const u = t.get(c) || /* @__PURE__ */ new Set();
331
- for (const g of u)
332
- if (t.has(g) && r.get(g)) {
333
- const b = i(g, h + 1);
334
- b && s.children.push(b);
331
+ const d = t.get(c) || /* @__PURE__ */ new Set();
332
+ for (const x of d)
333
+ if (t.has(x) && r.get(x)) {
334
+ const L = i(x, h + 1);
335
+ L && s.children.push(L);
335
336
  }
336
337
  return s;
337
338
  }, l = [];
@@ -340,8 +341,8 @@ const oe = (t, r, e = "no-parent") => {
340
341
  if (a) {
341
342
  const s = a.parentId;
342
343
  if (!s || s === e) {
343
- const u = i(h, 0);
344
- u && l.push(u);
344
+ const d = i(h, 0);
345
+ d && l.push(d);
345
346
  }
346
347
  }
347
348
  }), l;
@@ -374,23 +375,23 @@ function z(t, r, e, o = "no-parent") {
374
375
  function F(t, r, e, o = "no-parent") {
375
376
  const n = tt(t, e, o), i = tt(r, e, o), l = new Set(i);
376
377
  let c = null, h = -1;
377
- for (let g = 0; g < n.length; g++)
378
- if (l.has(n[g])) {
379
- c = n[g], h = g;
378
+ for (let x = 0; x < n.length; x++)
379
+ if (l.has(n[x])) {
380
+ c = n[x], h = x;
380
381
  break;
381
382
  }
382
383
  if (!c)
383
384
  return { lca: null, sourceChild: null, targetChild: null };
384
- const a = i.indexOf(c), s = h > 0 ? n[h - 1] : t, u = a > 0 ? i[a - 1] : r;
385
- return { lca: c, sourceChild: s, targetChild: u };
385
+ const a = i.indexOf(c), s = h > 0 ? n[h - 1] : t, d = a > 0 ? i[a - 1] : r;
386
+ return { lca: c, sourceChild: s, targetChild: d };
386
387
  }
387
- const ie = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
388
- const i = ie(t);
388
+ const se = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
389
+ const i = se(t);
389
390
  return i.source = r, i.target = e, i.id = o, i.data = {
390
391
  ...i.data,
391
392
  ...n
392
393
  }, i;
393
- }, se = (t) => {
394
+ }, ce = (t) => {
394
395
  for (const r of t.values()) {
395
396
  const e = /* @__PURE__ */ new Map();
396
397
  r.forEach((n) => {
@@ -413,7 +414,7 @@ const ie = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
413
414
  }), o.add(i), o.add(l);
414
415
  });
415
416
  }
416
- }, ce = (t, r, e, o) => {
417
+ }, ae = (t, r, e, o) => {
417
418
  const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
418
419
  t.forEach((c) => {
419
420
  const h = n.get(c.target) || [];
@@ -425,77 +426,77 @@ const ie = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
425
426
  i.forEach((c, h) => {
426
427
  const a = n.get(h) || [];
427
428
  a.length !== 0 && a.forEach((s) => {
428
- c.forEach((u) => {
429
- if (s.source === u.target)
429
+ c.forEach((d) => {
430
+ if (s.source === d.target)
430
431
  return;
431
- const { lca: g, sourceChild: N, targetChild: b } = F(
432
+ const { lca: x, sourceChild: N, targetChild: L } = F(
432
433
  s.source,
433
- u.target,
434
+ d.target,
434
435
  r,
435
436
  o
436
- ), C = F(
437
+ ), E = F(
437
438
  s.source,
438
439
  h,
439
440
  r,
440
441
  o
441
- ).lca, p = F(
442
+ ).lca, f = F(
442
443
  h,
443
- u.target,
444
+ d.target,
444
445
  r,
445
446
  o
446
447
  ).lca;
447
- if (!C || C !== p)
448
+ if (!E || E !== f)
448
449
  return;
449
- const f = z(
450
+ const p = z(
450
451
  s.source,
451
- C,
452
+ E,
452
453
  r,
453
454
  o
454
455
  ), m = z(
455
- u.target,
456
- C,
456
+ d.target,
457
+ E,
457
458
  r,
458
459
  o
459
- ), y = z(
460
+ ), w = z(
460
461
  h,
461
- C,
462
+ E,
462
463
  r,
463
464
  o
464
465
  );
465
- if (!f || !m || !y || f !== m || f === y)
466
+ if (!p || !m || !w || p !== m || p === w)
466
467
  return;
467
- const x = f, w = z(
468
+ const y = p, g = z(
468
469
  s.source,
469
- x,
470
+ y,
470
471
  r,
471
472
  o
472
- ), E = z(
473
- u.target,
474
- x,
473
+ ), C = z(
474
+ d.target,
475
+ y,
475
476
  r,
476
477
  o
477
478
  );
478
- if (!g || !N || !b || !w || !E || w === E)
479
+ if (!x || !N || !L || !g || !C || g === C)
479
480
  return;
480
- const L = `synthetic_bridge_${s.id}_${h}_${u.id}_${x}`;
481
- if (l.has(L))
481
+ const b = `synthetic_bridge_${s.id}_${h}_${d.id}_${y}`;
482
+ if (l.has(b))
482
483
  return;
483
484
  const M = Et(
484
485
  s,
485
- w,
486
- E,
487
- L,
486
+ g,
487
+ C,
488
+ b,
488
489
  {
489
490
  isTemporary: !0,
490
491
  isSyntheticBridge: !0,
491
492
  bridgeNode: h,
492
- bridgeBranch: y,
493
- anchorBranch: f,
493
+ bridgeBranch: w,
494
+ anchorBranch: p,
494
495
  originalSource: s.source,
495
- originalTarget: u.target
496
+ originalTarget: d.target
496
497
  }
497
498
  );
498
- e.has(x) || e.set(x, []), e.get(x).push(M), l.add(L);
499
+ e.has(y) || e.set(y, []), e.get(y).push(M), l.add(b);
499
500
  });
500
501
  });
501
502
  });
@@ -524,7 +525,7 @@ function et(t, r, e = "no-parent") {
524
525
  o.has(i) || o.set(i, []), o.get(i).push(h);
525
526
  }
526
527
  }
527
- return ce(t, r, o, e), se(o), o;
528
+ return ae(t, r, o, e), ce(o), o;
528
529
  }
529
530
  const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
530
531
  var c, h;
@@ -551,13 +552,13 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
551
552
  x: t.position.x + r / 2,
552
553
  y: t.position.y + e / 2
553
554
  };
554
- }, ae = (t, r) => {
555
+ }, le = (t, r) => {
555
556
  if (t.length === 0)
556
557
  return { nodes: t, width: 0, height: 0 };
557
558
  let e = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY, n = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY;
558
559
  t.forEach((s) => {
559
- const { width: u, height: g } = $(s);
560
- e = Math.min(e, s.position.x), o = Math.min(o, s.position.y), n = Math.max(n, s.position.x + u), i = Math.max(i, s.position.y + g);
560
+ const { width: d, height: x } = $(s);
561
+ e = Math.min(e, s.position.x), o = Math.min(o, s.position.y), n = Math.max(n, s.position.x + d), i = Math.max(i, s.position.y + x);
561
562
  });
562
563
  const l = r - e, c = r - o;
563
564
  t.forEach((s) => {
@@ -568,7 +569,7 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
568
569
  });
569
570
  const h = n - e + r * 2, a = i - o + r * 2;
570
571
  return { nodes: t, width: h, height: a };
571
- }, le = (t, r, e, o) => {
572
+ }, he = (t, r, e, o) => {
572
573
  if (!(t.length < 2 || o.size === 0))
573
574
  if (r === "TB" || r === "BT") {
574
575
  const n = [...t].sort((i, l) => i.position.x - l.position.x);
@@ -577,8 +578,8 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
577
578
  return;
578
579
  let c = i.position.x + $(i).width;
579
580
  for (let h = l + 1; h < n.length; h++) {
580
- const a = n[h], { width: s } = $(a), u = c + e;
581
- a.position.x < u && (a.position.x = u), c = a.position.x + s;
581
+ const a = n[h], { width: s } = $(a), d = c + e;
582
+ a.position.x < d && (a.position.x = d), c = a.position.x + s;
582
583
  }
583
584
  });
584
585
  } else {
@@ -588,12 +589,12 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
588
589
  return;
589
590
  let c = i.position.y + $(i).height;
590
591
  for (let h = l + 1; h < n.length; h++) {
591
- const a = n[h], { height: s } = $(a), u = c + e;
592
- a.position.y < u && (a.position.y = u), c = a.position.y + s;
592
+ const a = n[h], { height: s } = $(a), d = c + e;
593
+ a.position.y < d && (a.position.y = d), c = a.position.y + s;
593
594
  }
594
595
  });
595
596
  }
596
- }, he = (t, r, e, o) => {
597
+ }, de = (t, r, e, o) => {
597
598
  const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
598
599
  r.forEach((c) => {
599
600
  const h = n.get(c.target) || [];
@@ -605,88 +606,88 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
605
606
  return i.forEach((c, h) => {
606
607
  const a = n.get(h) || [];
607
608
  a.length !== 0 && a.forEach((s) => {
608
- c.forEach((u) => {
609
- if (s.source === u.target)
609
+ c.forEach((d) => {
610
+ if (s.source === d.target)
610
611
  return;
611
- const g = F(
612
+ const x = F(
612
613
  s.source,
613
614
  h,
614
615
  e,
615
616
  o
616
617
  ).lca, N = F(
617
618
  h,
618
- u.target,
619
+ d.target,
619
620
  e,
620
621
  o
621
622
  ).lca;
622
- if (g !== t || N !== t)
623
+ if (x !== t || N !== t)
623
624
  return;
624
- const b = z(
625
+ const L = z(
625
626
  s.source,
626
627
  t,
627
628
  e,
628
629
  o
629
- ), C = z(
630
- u.target,
630
+ ), E = z(
631
+ d.target,
631
632
  t,
632
633
  e,
633
634
  o
634
- ), p = z(
635
+ ), f = z(
635
636
  h,
636
637
  t,
637
638
  e,
638
639
  o
639
640
  );
640
- if (!b || !C || !p || b !== C || b === p)
641
+ if (!L || !E || !f || L !== E || L === f)
641
642
  return;
642
- const f = z(
643
+ const p = z(
643
644
  s.source,
644
- b,
645
+ L,
645
646
  e,
646
647
  o
647
648
  ), m = z(
648
- u.target,
649
- b,
649
+ d.target,
650
+ L,
650
651
  e,
651
652
  o
652
653
  );
653
- if (!f || !m || f === m)
654
+ if (!p || !m || p === m)
654
655
  return;
655
- const y = `${b}:${p}:${f}:${m}`;
656
- l.set(y, {
657
- anchorContainerId: b,
658
- bridgeContainerId: p,
659
- sourceNodeId: f,
656
+ const w = `${L}:${f}:${p}:${m}`;
657
+ l.set(w, {
658
+ anchorContainerId: L,
659
+ bridgeContainerId: f,
660
+ sourceNodeId: p,
660
661
  targetNodeId: m
661
662
  });
662
663
  });
663
664
  });
664
665
  }), [...l.values()];
665
666
  }, ue = (t, r, e, o, n, i, l) => {
666
- const c = he(r, n, i, l), h = /* @__PURE__ */ new Set();
667
+ const c = de(r, n, i, l), h = /* @__PURE__ */ new Set();
667
668
  return c.forEach((a) => {
668
- const s = gt(t, a.anchorContainerId), u = gt(t, a.bridgeContainerId);
669
- if (!s || !u)
669
+ const s = gt(t, a.anchorContainerId), d = gt(t, a.bridgeContainerId);
670
+ if (!s || !d)
670
671
  return;
671
- const g = yt(a.sourceNodeId, r, i), N = yt(a.targetNodeId, r, i);
672
- if (!g || !N)
672
+ const x = yt(a.sourceNodeId, r, i), N = yt(a.targetNodeId, r, i);
673
+ if (!x || !N)
673
674
  return;
674
- const { width: b, height: C } = $(u), { width: p, height: f } = $(s), m = xt(s), y = xt(u);
675
+ const { width: L, height: E } = $(d), { width: f, height: p } = $(s), m = xt(s), w = xt(d);
675
676
  if (e === "TB" || e === "BT") {
676
- const x = (g.y + N.y) / 2;
677
- u.position.y = x - C / 2;
678
- const w = y.x >= m.x, E = w ? u.position.x - (s.position.x + p) : s.position.x - (u.position.x + b), L = Math.max(o, E);
679
- u.position.x = w ? s.position.x + p + L : s.position.x - b - L;
677
+ const y = (x.y + N.y) / 2;
678
+ d.position.y = y - E / 2;
679
+ const g = w.x >= m.x, C = g ? d.position.x - (s.position.x + f) : s.position.x - (d.position.x + L), b = Math.max(o, C);
680
+ d.position.x = g ? s.position.x + f + b : s.position.x - L - b;
680
681
  } else {
681
- const x = (g.x + N.x) / 2;
682
- u.position.x = x - b / 2;
683
- const w = y.y >= m.y, E = w ? u.position.y - (s.position.y + f) : s.position.y - (u.position.y + C), L = Math.max(o, E);
684
- u.position.y = w ? s.position.y + f + L : s.position.y - C - L;
682
+ const y = (x.x + N.x) / 2;
683
+ d.position.x = y - L / 2;
684
+ const g = w.y >= m.y, C = g ? d.position.y - (s.position.y + p) : s.position.y - (d.position.y + E), b = Math.max(o, C);
685
+ d.position.y = g ? s.position.y + p + b : s.position.y - E - b;
685
686
  }
686
- h.add(u.id);
687
+ h.add(d.id);
687
688
  }), h;
688
- }, Nt = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, u = !1, g = "no-parent") => {
689
- const N = et(n, o, g), { updatedNodes: b } = await j(
689
+ }, Nt = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, d = !1, x = "no-parent") => {
690
+ const N = et(n, o, x), { updatedNodes: L } = await j(
690
691
  t,
691
692
  r,
692
693
  e,
@@ -698,14 +699,14 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
698
699
  h,
699
700
  a,
700
701
  s,
701
- u,
702
+ d,
702
703
  N,
703
- g
704
- ), C = o.get(t);
705
- if (!C)
706
- return { updatedNodes: b, updatedEdges: n };
707
- const { updatedNodes: p } = await Nt(
708
- C.parentId || g,
704
+ x
705
+ ), E = o.get(t);
706
+ if (!E)
707
+ return { updatedNodes: L, updatedEdges: n };
708
+ const { updatedNodes: f } = await Nt(
709
+ E.parentId || x,
709
710
  r,
710
711
  e,
711
712
  o,
@@ -716,83 +717,83 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
716
717
  h,
717
718
  a,
718
719
  s,
719
- u,
720
- g
720
+ d,
721
+ x
721
722
  );
722
723
  return {
723
- updatedNodes: [...p, ...b],
724
+ updatedNodes: [...f, ...L],
724
725
  updatedEdges: n
725
726
  // Always return original edges unchanged
726
727
  };
727
- }, j = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, u = !1, g = /* @__PURE__ */ new Map(), N = "no-parent") => {
728
- const b = e.get(t);
729
- if (!b || b.size === 0)
728
+ }, j = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, d = !1, x = /* @__PURE__ */ new Map(), N = "no-parent") => {
729
+ const L = e.get(t);
730
+ if (!L || L.size === 0)
730
731
  return { updatedNodes: [] };
731
- const C = [];
732
- if (b.forEach((L) => {
733
- const M = o.get(L);
734
- M && C.push(M);
735
- }), C.length === 0)
732
+ const E = [];
733
+ if (L.forEach((b) => {
734
+ const M = o.get(b);
735
+ M && E.push(M);
736
+ }), E.length === 0)
736
737
  return { updatedNodes: [] };
737
- let p = r;
738
- const f = o.get(t);
739
- f && f.data.layoutDirection && (p = f.data.layoutDirection);
740
- const m = g.get(t) || [], { nodes: y, edges: x } = await s(
741
- C,
738
+ let f = r;
739
+ const p = o.get(t);
740
+ p && p.data.layoutDirection && (f = p.data.layoutDirection);
741
+ const m = x.get(t) || [], { nodes: w, edges: y } = await s(
742
+ E,
742
743
  m,
743
744
  // Only use temporary edges for layout
744
- p,
745
+ f,
745
746
  i,
746
747
  l,
747
748
  c,
748
749
  h,
749
750
  a,
750
- u
751
+ d
751
752
  );
752
- y.forEach((L) => {
753
- o.set(L.id, L);
753
+ w.forEach((b) => {
754
+ o.set(b.id, b);
754
755
  });
755
- const w = ue(
756
- y,
756
+ const g = ue(
757
+ w,
757
758
  t,
758
- p,
759
+ f,
759
760
  l,
760
761
  n,
761
762
  o,
762
763
  N
763
764
  );
764
- le(
765
- y,
766
- p,
765
+ he(
766
+ w,
767
+ f,
767
768
  l,
768
- w
769
- ), y.forEach((L) => {
770
- o.set(L.id, L);
769
+ g
770
+ ), w.forEach((b) => {
771
+ o.set(b.id, b);
771
772
  });
772
- const E = ae(y, i);
773
- return E.nodes.forEach((L) => {
774
- o.set(L.id, L);
775
- }), f && E.width && E.height && de(f, E.width, E.height), {
776
- updatedNodes: [...E.nodes],
777
- udpatedParentNode: f || void 0
773
+ const C = le(w, i);
774
+ return C.nodes.forEach((b) => {
775
+ o.set(b.id, b);
776
+ }), p && C.width && C.height && fe(p, C.width, C.height), {
777
+ updatedNodes: [...C.nodes],
778
+ udpatedParentNode: p || void 0
778
779
  };
779
- }, de = (t, r, e) => (t.style || (t.style = {}), t.width = r, t.height = e, t.measured = {
780
+ }, fe = (t, r, e) => (t.style || (t.style = {}), t.width = r, t.height = e, t.measured = {
780
781
  width: r,
781
782
  height: e
782
- }, t.style.width = r, t.style.height = e, t), fe = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, u = !1, g = "no-parent") => {
783
+ }, t.style.width = r, t.style.height = e, t), pe = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, d = !1, x = "no-parent") => {
783
784
  let N = [];
784
- const b = et(n, o, g), C = /* @__PURE__ */ new Map();
785
- let p = 0;
786
- const f = (y, x) => {
787
- x > p && (p = x);
788
- for (const w of y)
789
- C.has(x) || C.set(x, []), C.get(x).push(w.id), w.children.length > 0 && f(w.children, x + 1);
785
+ const L = et(n, o, x), E = /* @__PURE__ */ new Map();
786
+ let f = 0;
787
+ const p = (w, y) => {
788
+ y > f && (f = y);
789
+ for (const g of w)
790
+ E.has(y) || E.set(y, []), E.get(y).push(g.id), g.children.length > 0 && p(g.children, y + 1);
790
791
  };
791
- f(t, 0);
792
- for (let y = p; y >= 0; y--) {
793
- const x = C.get(y) || [], w = await Promise.all(x.map(
794
- (E) => j(
795
- E,
792
+ p(t, 0);
793
+ for (let w = f; w >= 0; w--) {
794
+ const y = E.get(w) || [], g = await Promise.all(y.map(
795
+ (C) => j(
796
+ C,
796
797
  r,
797
798
  e,
798
799
  o,
@@ -804,17 +805,17 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
804
805
  h,
805
806
  a,
806
807
  s,
807
- u,
808
- b,
808
+ d,
809
+ L,
809
810
  // Pass the global temporary edges map
810
- g
811
+ x
811
812
  )
812
813
  ));
813
- for (const { updatedNodes: E } of w)
814
- N = [...E, ...N];
814
+ for (const { updatedNodes: C } of g)
815
+ N = [...C, ...N];
815
816
  }
816
817
  const { updatedNodes: m } = await j(
817
- g,
818
+ x,
818
819
  r,
819
820
  e,
820
821
  o,
@@ -826,17 +827,17 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
826
827
  h,
827
828
  a,
828
829
  s,
829
- u,
830
- b,
830
+ d,
831
+ L,
831
832
  // Process root-level temporary edges
832
- g
833
+ x
833
834
  );
834
835
  return N = [...m, ...N], {
835
836
  updatedNodes: N,
836
837
  updatedEdges: n
837
838
  // Always return original edges unchanged
838
839
  };
839
- }, pe = (t, r, e, o = "no-parent") => {
840
+ }, ge = (t, r, e, o = "no-parent") => {
840
841
  const n = t.map((a) => a.id), i = t.map((a) => {
841
842
  var s;
842
843
  return ((s = e.get(a.id)) == null ? void 0 : s.parentId) || a.parentId;
@@ -847,7 +848,7 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
847
848
  return s ? !s.parentId || !c.includes(s.parentId) : !0;
848
849
  });
849
850
  return h.length === 0 ? [o] : h;
850
- }, ge = async (t, r, e) => {
851
+ }, ye = async (t, r, e) => {
851
852
  const {
852
853
  dagreDirection: o,
853
854
  nodeParentIdMapWithChildIdSet: n,
@@ -857,24 +858,24 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
857
858
  margin: h,
858
859
  nodeSpacing: a,
859
860
  layerSpacing: s,
860
- nodeWidth: u,
861
- nodeHeight: g,
861
+ nodeWidth: d,
862
+ nodeHeight: x,
862
863
  layoutHidden: N = !1,
863
- noParentKey: b = "no-parent"
864
- } = r, C = pe(
864
+ noParentKey: L = "no-parent"
865
+ } = r, E = ge(
865
866
  t,
866
867
  n,
867
868
  i,
868
- b
869
+ L
869
870
  );
870
- if (C.length === 0)
871
+ if (E.length === 0)
871
872
  return { nodes: l, edges: c };
872
- const p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
873
+ const f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
873
874
  if (e != null && e.aborted)
874
875
  return { nodes: l, edges: c };
875
876
  (await Promise.all(
876
- C.map(async (w) => e != null && e.aborted ? { updatedNodes: [], updatedEdges: [] } : Nt(
877
- w,
877
+ E.map(async (g) => e != null && e.aborted ? { updatedNodes: [], updatedEdges: [] } : Nt(
878
+ g,
878
879
  o,
879
880
  n,
880
881
  i,
@@ -882,74 +883,74 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
882
883
  h,
883
884
  a,
884
885
  s,
885
- u,
886
- g,
886
+ d,
887
+ x,
887
888
  void 0,
888
889
  N
889
890
  ))
890
- )).forEach(({ updatedNodes: w, updatedEdges: E }) => {
891
- w.forEach((L) => {
892
- p.set(L.id, L);
893
- }), E.forEach((L) => {
894
- f.set(L.id, L);
891
+ )).forEach(({ updatedNodes: g, updatedEdges: C }) => {
892
+ g.forEach((b) => {
893
+ f.set(b.id, b);
894
+ }), C.forEach((b) => {
895
+ p.set(b.id, b);
895
896
  });
896
897
  });
897
- const y = l.map(
898
- (w) => p.has(w.id) ? p.get(w.id) : w
899
- ), x = c.map(
900
- (w) => f.has(w.id) ? f.get(w.id) : w
898
+ const w = l.map(
899
+ (g) => f.has(g.id) ? f.get(g.id) : g
900
+ ), y = c.map(
901
+ (g) => p.has(g.id) ? p.get(g.id) : g
901
902
  );
902
- return { nodes: y, edges: x };
903
- }, ye = (t, r, e, o, n, i, l, c, h = 172, a = 36, s = !1, u = "no-parent") => {
904
- const g = U(async (b, C, p, f) => {
903
+ return { nodes: w, edges: y };
904
+ }, xe = (t, r, e, o, n, i, l, c, h = 172, a = 36, s = !1, d = "no-parent") => {
905
+ const x = U(async (L, E, f, p) => {
905
906
  if (!(t[e] || t.dagre))
906
- return console.error(`Layout engine "${e}" not found`), { nodes: b, edges: C };
907
- const y = s ? b : b.filter((k) => !k.hidden), x = new Set(y.map((k) => k.id)), w = s ? C : C.filter(
908
- (k) => x.has(k.source) && x.has(k.target)
909
- ), E = ft(r), L = o.padding.horizontal;
907
+ return console.error(`Layout engine "${e}" not found`), { nodes: L, edges: E };
908
+ const w = s ? L : L.filter((k) => !k.hidden), y = new Set(w.map((k) => k.id)), g = s ? E : E.filter(
909
+ (k) => y.has(k.source) && y.has(k.target)
910
+ ), C = ft(r), b = o.padding.horizontal;
910
911
  let M = [], G = [];
911
- if (p && p.length > 0) {
912
- const k = s ? p : p.filter((S) => !S.hidden), v = await ge(
912
+ if (f && f.length > 0) {
913
+ const k = s ? f : f.filter((S) => !S.hidden), v = await ye(
913
914
  k,
914
915
  {
915
- dagreDirection: E,
916
+ dagreDirection: C,
916
917
  nodeParentIdMapWithChildIdSet: n,
917
918
  nodeIdWithNode: i,
918
- nodes: y,
919
- edges: w,
920
- margin: L,
919
+ nodes: w,
920
+ edges: g,
921
+ margin: b,
921
922
  nodeSpacing: l,
922
923
  layerSpacing: c,
923
924
  nodeWidth: h,
924
925
  nodeHeight: a,
925
926
  layoutHidden: s,
926
- noParentKey: u
927
+ noParentKey: d
927
928
  },
928
- f
929
+ p
929
930
  );
930
931
  M = v.nodes, G = v.edges;
931
932
  } else {
932
- if (f != null && f.aborted)
933
- return { nodes: b, edges: C };
934
- const k = oe(n, i, u), v = await fe(
933
+ if (p != null && p.aborted)
934
+ return { nodes: L, edges: E };
935
+ const k = ie(n, i, d), v = await pe(
935
936
  k,
936
- E,
937
+ C,
937
938
  n,
938
939
  i,
939
- w,
940
- L,
940
+ g,
941
+ b,
941
942
  l,
942
943
  c,
943
944
  h,
944
945
  a,
945
946
  void 0,
946
947
  s,
947
- u
948
+ d
948
949
  );
949
950
  M = v.updatedNodes, G = v.updatedEdges;
950
951
  }
951
952
  return {
952
- nodes: b.map((k) => !s && k.hidden ? k : M.find((S) => S.id === k.id) || k),
953
+ nodes: L.map((k) => !s && k.hidden ? k : M.find((S) => S.id === k.id) || k),
953
954
  edges: G
954
955
  };
955
956
  }, [
@@ -964,37 +965,37 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
964
965
  h,
965
966
  a,
966
967
  s,
967
- u
968
- ]), N = U(async (b, C, p, f) => {
969
- if (f != null && f.aborted) return { nodes: C, edges: p };
970
- const m = ft(r), y = o.padding.horizontal, x = s ? C : C.filter((v) => !v.hidden), w = new Set(x.map((v) => v.id)), E = s ? p : p.filter((v) => w.has(v.source) && w.has(v.target)), L = et(E, i, u), M = (v) => {
968
+ d
969
+ ]), N = U(async (L, E, f, p) => {
970
+ if (p != null && p.aborted) return { nodes: E, edges: f };
971
+ const m = ft(r), w = o.padding.horizontal, y = s ? E : E.filter((v) => !v.hidden), g = new Set(y.map((v) => v.id)), C = s ? f : f.filter((v) => g.has(v.source) && g.has(v.target)), b = et(C, i, d), M = (v) => {
971
972
  const S = [], R = n.get(v);
972
973
  if (R)
973
974
  for (const _ of R)
974
975
  n.has(_) && S.push(...M(_));
975
976
  return S.push(v), S;
976
- }, G = M(b), O = /* @__PURE__ */ new Map();
977
+ }, G = M(L), O = /* @__PURE__ */ new Map();
977
978
  for (const v of G) {
978
- if (f != null && f.aborted) return { nodes: C, edges: p };
979
+ if (p != null && p.aborted) return { nodes: E, edges: f };
979
980
  const { updatedNodes: S, udpatedParentNode: R } = await j(
980
981
  v,
981
982
  m,
982
983
  n,
983
984
  i,
984
- E,
985
- y,
985
+ C,
986
+ w,
986
987
  l,
987
988
  c,
988
989
  h,
989
990
  a,
990
991
  void 0,
991
992
  s,
992
- L,
993
- u
993
+ b,
994
+ d
994
995
  );
995
996
  S.forEach((_) => O.set(_.id, _)), R && O.set(R.id, { ...R });
996
997
  }
997
- return { nodes: C.map((v) => O.get(v.id) ?? v), edges: p };
998
+ return { nodes: E.map((v) => O.get(v.id) ?? v), edges: f };
998
999
  }, [
999
1000
  r,
1000
1001
  o.padding.horizontal,
@@ -1005,11 +1006,11 @@ const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
1005
1006
  h,
1006
1007
  a,
1007
1008
  s,
1008
- u
1009
+ d
1009
1010
  ]);
1010
- return { calculateLayout: g, calculateContainerLayout: N };
1011
+ return { calculateLayout: x, calculateContainerLayout: N };
1011
1012
  };
1012
- function Ce({
1013
+ function Le({
1013
1014
  children: t,
1014
1015
  initialDirection: r = "DOWN",
1015
1016
  initialAlgorithm: e = "layered",
@@ -1021,19 +1022,19 @@ function Ce({
1021
1022
  includeHidden: h = !1,
1022
1023
  layoutEngines: a,
1023
1024
  updateNodes: s,
1024
- updateEdges: u,
1025
- nodeParentIdMapWithChildIdSet: g,
1025
+ updateEdges: d,
1026
+ nodeParentIdMapWithChildIdSet: x,
1026
1027
  nodeIdWithNode: N,
1027
- noParentKey: b = "no-parent",
1028
- disableAutoLayoutEffect: C = !1
1028
+ noParentKey: L = "no-parent",
1029
+ disableAutoLayoutEffect: E = !1
1029
1030
  }) {
1030
- const p = Yt(), f = It(), {
1031
+ const f = Yt(), p = Pt(), {
1031
1032
  direction: m,
1032
- algorithm: y,
1033
- autoLayout: x,
1034
- layoutInProgress: w,
1035
- layoutHidden: E,
1036
- layoutEngines: L,
1033
+ algorithm: w,
1034
+ autoLayout: y,
1035
+ layoutInProgress: g,
1036
+ layoutHidden: C,
1037
+ layoutEngines: b,
1037
1038
  layoutEngineOptions: M,
1038
1039
  padding: G,
1039
1040
  nodeSpacing: O,
@@ -1045,7 +1046,7 @@ function Ce({
1045
1046
  setDirection: J,
1046
1047
  setAlgorithm: Z,
1047
1048
  setAutoLayout: q,
1048
- setLayoutInProgress: I,
1049
+ setLayoutInProgress: Y,
1049
1050
  setLayoutHidden: Q,
1050
1051
  setLayoutEngines: nt,
1051
1052
  setLayoutEngineOptions: vt,
@@ -1056,7 +1057,7 @@ function Ce({
1056
1057
  setNodeHeight: Bt,
1057
1058
  setParentResizingOptionsState: st,
1058
1059
  setSelectedNodes: ct
1059
- } = ee({
1060
+ } = re({
1060
1061
  initialDirection: r,
1061
1062
  initialAlgorithm: e,
1062
1063
  initialAutoLayout: o,
@@ -1072,22 +1073,23 @@ function Ce({
1072
1073
  numberOfNodes: Mt,
1073
1074
  nodesLength: St,
1074
1075
  childrenInitialized: lt,
1075
- parentChildStructure: Dt
1076
- } = re({
1077
- nodes: p,
1076
+ nodesInitialized: Dt,
1077
+ parentChildStructure: Rt
1078
+ } = ne({
1079
+ nodes: f,
1078
1080
  externalNodeIdWithNode: N,
1079
- externalNodeParentIdMapWithChildIdSet: g,
1080
- noParentKey: b
1081
- }), Rt = U(({ nodes: H }) => {
1081
+ externalNodeParentIdMapWithChildIdSet: x,
1082
+ noParentKey: L
1083
+ }), Ot = U(({ nodes: H }) => {
1082
1084
  ct(H);
1083
1085
  }, [ct]);
1084
- Pt({
1085
- onChange: Rt
1086
+ jt({
1087
+ onChange: Ot
1086
1088
  });
1087
- const { calculateLayout: Ot, calculateContainerLayout: At } = ye(
1088
- L,
1089
+ const { calculateLayout: At, calculateContainerLayout: zt } = xe(
1090
+ b,
1089
1091
  m,
1090
- y,
1092
+ w,
1091
1093
  R,
1092
1094
  at,
1093
1095
  W,
@@ -1095,71 +1097,72 @@ function Ce({
1095
1097
  k,
1096
1098
  v,
1097
1099
  S,
1098
- E,
1099
- b
1100
- ), { applyLayout: ht, applyContainerLayout: zt } = ne({
1101
- nodes: p,
1102
- edges: f,
1100
+ C,
1101
+ L
1102
+ ), { applyLayout: ht, applyContainerLayout: Gt } = oe({
1103
+ nodes: f,
1104
+ edges: p,
1103
1105
  selectedNodes: _,
1104
- layoutHidden: E,
1105
- calculateLayout: Ot,
1106
- calculateContainerLayout: At,
1106
+ layoutHidden: C,
1107
+ calculateLayout: At,
1108
+ calculateContainerLayout: zt,
1107
1109
  updateNodes: s,
1108
- updateEdges: u,
1109
- setLayoutInProgress: I,
1110
+ updateEdges: d,
1111
+ setLayoutInProgress: Y,
1110
1112
  setNodeSpacing: ot,
1111
1113
  setLayerSpacing: it
1112
- }), Gt = U((H, K) => {
1113
- nt(($t) => ({ ...$t, [H]: K }));
1114
- }, [nt]), _t = U((H) => {
1114
+ }), _t = U((H, K) => {
1115
+ nt((Ut) => ({ ...Ut, [H]: K }));
1116
+ }, [nt]), Ht = U((H) => {
1115
1117
  st((K) => ({
1116
1118
  ...K,
1117
1119
  ...H,
1118
- enabled: x
1120
+ enabled: y
1119
1121
  }));
1120
- }, [x, st]);
1122
+ }, [y, st]);
1121
1123
  V(() => {
1122
1124
  var H;
1123
- C || W.has((H = p[p.length - 1]) == null ? void 0 : H.id) && lt && x && ht();
1124
- }, [lt, x, m, Mt, O, k, Dt, St]);
1125
- const Ht = {
1125
+ E || W.has((H = f[f.length - 1]) == null ? void 0 : H.id) && lt && y && ht();
1126
+ }, [lt, y, m, Mt, O, k, Rt, St]);
1127
+ const $t = {
1126
1128
  direction: m,
1127
- algorithm: y,
1128
- autoLayout: x,
1129
- layoutInProgress: w,
1129
+ algorithm: w,
1130
+ autoLayout: y,
1131
+ layoutInProgress: g,
1132
+ nodesInitialized: Dt,
1130
1133
  padding: G,
1131
1134
  nodeSpacing: O,
1132
1135
  layerSpacing: k,
1133
1136
  nodeWidth: v,
1134
1137
  nodeHeight: S,
1135
- layoutHidden: E,
1138
+ layoutHidden: C,
1136
1139
  parentResizingOptions: R,
1137
- layoutEngines: L,
1140
+ layoutEngines: b,
1138
1141
  layoutEngineOptions: M,
1139
1142
  nodeParentIdMapWithChildIdSet: at,
1140
1143
  nodeIdWithNode: W,
1141
- noParentKey: b,
1144
+ noParentKey: L,
1142
1145
  updateNodes: s,
1143
- updateEdges: u,
1146
+ updateEdges: d,
1144
1147
  setDirection: J,
1145
1148
  setAlgorithm: Z,
1146
1149
  setAutoLayout: q,
1147
- setLayoutInProgress: I,
1150
+ setLayoutInProgress: Y,
1148
1151
  setPadding: Tt,
1149
1152
  setNodeSpacing: ot,
1150
1153
  setLayerSpacing: it,
1151
1154
  setNodeWidth: kt,
1152
1155
  setNodeHeight: Bt,
1153
1156
  setLayoutHidden: Q,
1154
- setParentResizingOptions: _t,
1157
+ setParentResizingOptions: Ht,
1155
1158
  setLayoutEngineOptions: vt,
1156
1159
  applyLayout: ht,
1157
- applyContainerLayout: zt,
1160
+ applyContainerLayout: Gt,
1158
1161
  clearLayoutCache: () => {
1159
1162
  },
1160
- registerLayoutEngine: Gt
1163
+ registerLayoutEngine: _t
1161
1164
  };
1162
- return /* @__PURE__ */ d(Lt.Provider, { value: Ht, children: t });
1165
+ return /* @__PURE__ */ u(Lt.Provider, { value: $t, children: t });
1163
1166
  }
1164
1167
  const wt = ({
1165
1168
  compact: t = !1
@@ -1168,57 +1171,57 @@ const wt = ({
1168
1171
  direction: r,
1169
1172
  setDirection: e,
1170
1173
  clearLayoutCache: o
1171
- } = Y(), n = (i) => {
1174
+ } = I(), n = (i) => {
1172
1175
  e(i), o && o();
1173
1176
  };
1174
- return t ? /* @__PURE__ */ d(
1177
+ return t ? /* @__PURE__ */ u(
1175
1178
  D,
1176
1179
  {
1177
1180
  onClick: () => n(r === "DOWN" ? "RIGHT" : "DOWN"),
1178
1181
  title: `Switch to ${r === "DOWN" ? "horizontal" : "vertical"} layout`,
1179
- children: /* @__PURE__ */ d("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: r === "DOWN" ? (
1182
+ children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: r === "DOWN" ? (
1180
1183
  // Horizontal layout icon
1181
- /* @__PURE__ */ d("path", { d: "M4 12h16M16 6l6 6-6 6" })
1184
+ /* @__PURE__ */ u("path", { d: "M4 12h16M16 6l6 6-6 6" })
1182
1185
  ) : (
1183
1186
  // Vertical layout icon
1184
- /* @__PURE__ */ d("path", { d: "M12 4v16M6 16l6 6 6-6" })
1187
+ /* @__PURE__ */ u("path", { d: "M12 4v16M6 16l6 6 6-6" })
1185
1188
  ) })
1186
1189
  }
1187
1190
  ) : /* @__PURE__ */ T(P, { children: [
1188
- /* @__PURE__ */ d(
1191
+ /* @__PURE__ */ u(
1189
1192
  D,
1190
1193
  {
1191
1194
  onClick: () => n("DOWN"),
1192
1195
  className: r === "DOWN" ? "selected" : "",
1193
1196
  title: "Top to Bottom",
1194
- children: /* @__PURE__ */ d("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ d("path", { d: "M12 4v16M6 16l6 6 6-6" }) })
1197
+ children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M12 4v16M6 16l6 6 6-6" }) })
1195
1198
  }
1196
1199
  ),
1197
- /* @__PURE__ */ d(
1200
+ /* @__PURE__ */ u(
1198
1201
  D,
1199
1202
  {
1200
1203
  onClick: () => n("RIGHT"),
1201
1204
  className: r === "RIGHT" ? "selected" : "",
1202
1205
  title: "Left to Right",
1203
- children: /* @__PURE__ */ d("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ d("path", { d: "M4 12h16M16 6l6 6-6 6" }) })
1206
+ children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M4 12h16M16 6l6 6-6 6" }) })
1204
1207
  }
1205
1208
  ),
1206
- /* @__PURE__ */ d(
1209
+ /* @__PURE__ */ u(
1207
1210
  D,
1208
1211
  {
1209
1212
  onClick: () => n("LEFT"),
1210
1213
  className: r === "LEFT" ? "selected" : "",
1211
1214
  title: "Right to Left",
1212
- children: /* @__PURE__ */ d("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ d("path", { d: "M20 12H4M8 6L2 12l6 6" }) })
1215
+ children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M20 12H4M8 6L2 12l6 6" }) })
1213
1216
  }
1214
1217
  ),
1215
- /* @__PURE__ */ d(
1218
+ /* @__PURE__ */ u(
1216
1219
  D,
1217
1220
  {
1218
1221
  onClick: () => n("UP"),
1219
1222
  className: r === "UP" ? "selected" : "",
1220
1223
  title: "Bottom to Top",
1221
- children: /* @__PURE__ */ d("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ d("path", { d: "M12 20V4M6 8l6-6 6 6" }) })
1224
+ children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M12 20V4M6 8l6-6 6 6" }) })
1222
1225
  }
1223
1226
  )
1224
1227
  ] });
@@ -1231,23 +1234,23 @@ const wt = ({
1231
1234
  setNodeSpacing: o,
1232
1235
  setLayerSpacing: n,
1233
1236
  clearLayoutCache: i
1234
- } = Y(), [l, c] = B(!1), h = (s) => {
1237
+ } = I(), [l, c] = B(!1), h = (s) => {
1235
1238
  o(s), i && i();
1236
1239
  }, a = (s) => {
1237
1240
  n(s), i && i();
1238
1241
  };
1239
1242
  return t ? /* @__PURE__ */ T("div", { style: { position: "relative" }, children: [
1240
- /* @__PURE__ */ d(
1243
+ /* @__PURE__ */ u(
1241
1244
  D,
1242
1245
  {
1243
1246
  onClick: () => c(!l),
1244
1247
  title: "Adjust node and layer spacing",
1245
1248
  children: /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
1246
- /* @__PURE__ */ d("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
1247
- /* @__PURE__ */ d("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
1248
- /* @__PURE__ */ d("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
1249
- /* @__PURE__ */ d("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
1250
- /* @__PURE__ */ d("path", { d: "M7 10v4M17 10v4M10 7h4M10 17h4" })
1249
+ /* @__PURE__ */ u("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
1250
+ /* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
1251
+ /* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
1252
+ /* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
1253
+ /* @__PURE__ */ u("path", { d: "M7 10v4M17 10v4M10 7h4M10 17h4" })
1251
1254
  ] })
1252
1255
  }
1253
1256
  ),
@@ -1275,7 +1278,7 @@ const wt = ({
1275
1278
  r,
1276
1279
  "px"
1277
1280
  ] }),
1278
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px" }, children: [50, 100, 150, 200].map((s) => /* @__PURE__ */ d(
1281
+ /* @__PURE__ */ u("div", { style: { display: "flex", gap: "4px" }, children: [50, 100, 150, 200].map((s) => /* @__PURE__ */ u(
1279
1282
  "button",
1280
1283
  {
1281
1284
  onClick: () => h(s),
@@ -1298,7 +1301,7 @@ const wt = ({
1298
1301
  e,
1299
1302
  "px"
1300
1303
  ] }),
1301
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: "4px" }, children: [50, 100, 150, 200].map((s) => /* @__PURE__ */ d(
1304
+ /* @__PURE__ */ u("div", { style: { display: "flex", gap: "4px" }, children: [50, 100, 150, 200].map((s) => /* @__PURE__ */ u(
1302
1305
  "button",
1303
1306
  {
1304
1307
  onClick: () => a(s),
@@ -1315,7 +1318,7 @@ const wt = ({
1315
1318
  s
1316
1319
  )) })
1317
1320
  ] }),
1318
- /* @__PURE__ */ d("div", { style: { marginTop: "12px", textAlign: "right" }, children: /* @__PURE__ */ d(
1321
+ /* @__PURE__ */ u("div", { style: { marginTop: "12px", textAlign: "right" }, children: /* @__PURE__ */ u(
1319
1322
  "button",
1320
1323
  {
1321
1324
  onClick: () => c(!1),
@@ -1340,16 +1343,16 @@ const wt = ({
1340
1343
  title: "Decrease node spacing",
1341
1344
  children: [
1342
1345
  /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
1343
- /* @__PURE__ */ d("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
1344
- /* @__PURE__ */ d("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
1345
- /* @__PURE__ */ d("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
1346
- /* @__PURE__ */ d("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
1347
- /* @__PURE__ */ d("line", { x1: "7", y1: "10", x2: "7", y2: "14" }),
1348
- /* @__PURE__ */ d("line", { x1: "17", y1: "10", x2: "17", y2: "14" }),
1349
- /* @__PURE__ */ d("line", { x1: "10", y1: "7", x2: "14", y2: "7" }),
1350
- /* @__PURE__ */ d("line", { x1: "10", y1: "17", x2: "14", y2: "17" })
1346
+ /* @__PURE__ */ u("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
1347
+ /* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
1348
+ /* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
1349
+ /* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
1350
+ /* @__PURE__ */ u("line", { x1: "7", y1: "10", x2: "7", y2: "14" }),
1351
+ /* @__PURE__ */ u("line", { x1: "17", y1: "10", x2: "17", y2: "14" }),
1352
+ /* @__PURE__ */ u("line", { x1: "10", y1: "7", x2: "14", y2: "7" }),
1353
+ /* @__PURE__ */ u("line", { x1: "10", y1: "17", x2: "14", y2: "17" })
1351
1354
  ] }),
1352
- /* @__PURE__ */ d("span", { style: { marginLeft: "4px" }, children: "-" })
1355
+ /* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "-" })
1353
1356
  ]
1354
1357
  }
1355
1358
  ),
@@ -1373,20 +1376,20 @@ const wt = ({
1373
1376
  title: "Increase node spacing",
1374
1377
  children: [
1375
1378
  /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
1376
- /* @__PURE__ */ d("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
1377
- /* @__PURE__ */ d("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
1378
- /* @__PURE__ */ d("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
1379
- /* @__PURE__ */ d("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
1380
- /* @__PURE__ */ d("line", { x1: "7", y1: "10", x2: "7", y2: "14" }),
1381
- /* @__PURE__ */ d("line", { x1: "17", y1: "10", x2: "17", y2: "14" }),
1382
- /* @__PURE__ */ d("line", { x1: "10", y1: "7", x2: "14", y2: "7" }),
1383
- /* @__PURE__ */ d("line", { x1: "10", y1: "17", x2: "14", y2: "17" })
1379
+ /* @__PURE__ */ u("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
1380
+ /* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
1381
+ /* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
1382
+ /* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
1383
+ /* @__PURE__ */ u("line", { x1: "7", y1: "10", x2: "7", y2: "14" }),
1384
+ /* @__PURE__ */ u("line", { x1: "17", y1: "10", x2: "17", y2: "14" }),
1385
+ /* @__PURE__ */ u("line", { x1: "10", y1: "7", x2: "14", y2: "7" }),
1386
+ /* @__PURE__ */ u("line", { x1: "10", y1: "17", x2: "14", y2: "17" })
1384
1387
  ] }),
1385
- /* @__PURE__ */ d("span", { style: { marginLeft: "4px" }, children: "+" })
1388
+ /* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "+" })
1386
1389
  ]
1387
1390
  }
1388
1391
  ),
1389
- /* @__PURE__ */ d("div", { style: { display: "inline-block", width: "1px", height: "24px", background: "#ddd", margin: "0 10px" } }),
1392
+ /* @__PURE__ */ u("div", { style: { display: "inline-block", width: "1px", height: "24px", background: "#ddd", margin: "0 10px" } }),
1390
1393
  /* @__PURE__ */ T(
1391
1394
  D,
1392
1395
  {
@@ -1394,11 +1397,11 @@ const wt = ({
1394
1397
  title: "Decrease layer spacing",
1395
1398
  children: [
1396
1399
  /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
1397
- /* @__PURE__ */ d("line", { x1: "4", y1: "6", x2: "20", y2: "6" }),
1398
- /* @__PURE__ */ d("line", { x1: "4", y1: "12", x2: "20", y2: "12" }),
1399
- /* @__PURE__ */ d("line", { x1: "4", y1: "18", x2: "20", y2: "18" })
1400
+ /* @__PURE__ */ u("line", { x1: "4", y1: "6", x2: "20", y2: "6" }),
1401
+ /* @__PURE__ */ u("line", { x1: "4", y1: "12", x2: "20", y2: "12" }),
1402
+ /* @__PURE__ */ u("line", { x1: "4", y1: "18", x2: "20", y2: "18" })
1400
1403
  ] }),
1401
- /* @__PURE__ */ d("span", { style: { marginLeft: "4px" }, children: "-" })
1404
+ /* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "-" })
1402
1405
  ]
1403
1406
  }
1404
1407
  ),
@@ -1422,11 +1425,11 @@ const wt = ({
1422
1425
  title: "Increase layer spacing",
1423
1426
  children: [
1424
1427
  /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
1425
- /* @__PURE__ */ d("line", { x1: "4", y1: "6", x2: "20", y2: "6" }),
1426
- /* @__PURE__ */ d("line", { x1: "4", y1: "12", x2: "20", y2: "12" }),
1427
- /* @__PURE__ */ d("line", { x1: "4", y1: "18", x2: "20", y2: "18" })
1428
+ /* @__PURE__ */ u("line", { x1: "4", y1: "6", x2: "20", y2: "6" }),
1429
+ /* @__PURE__ */ u("line", { x1: "4", y1: "12", x2: "20", y2: "12" }),
1430
+ /* @__PURE__ */ u("line", { x1: "4", y1: "18", x2: "20", y2: "18" })
1428
1431
  ] }),
1429
- /* @__PURE__ */ d("span", { style: { marginLeft: "4px" }, children: "+" })
1432
+ /* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "+" })
1430
1433
  ]
1431
1434
  }
1432
1435
  )
@@ -1437,8 +1440,8 @@ const wt = ({
1437
1440
  const {
1438
1441
  autoLayout: r,
1439
1442
  setAutoLayout: e
1440
- } = Y();
1441
- return /* @__PURE__ */ d(
1443
+ } = I();
1444
+ return /* @__PURE__ */ u(
1442
1445
  D,
1443
1446
  {
1444
1447
  onClick: () => {
@@ -1448,12 +1451,12 @@ const wt = ({
1448
1451
  title: r ? "Disable automatic layout" : "Enable automatic layout",
1449
1452
  style: { color: r ? "green" : "inherit" },
1450
1453
  children: t ? /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "1.5", fill: "none", children: [
1451
- /* @__PURE__ */ d("rect", { x: "4", y: "4", width: "4", height: "4", rx: "1" }),
1452
- /* @__PURE__ */ d("rect", { x: "4", y: "16", width: "4", height: "4", rx: "1" }),
1453
- /* @__PURE__ */ d("rect", { x: "16", y: "10", width: "4", height: "4", rx: "1" }),
1454
+ /* @__PURE__ */ u("rect", { x: "4", y: "4", width: "4", height: "4", rx: "1" }),
1455
+ /* @__PURE__ */ u("rect", { x: "4", y: "16", width: "4", height: "4", rx: "1" }),
1456
+ /* @__PURE__ */ u("rect", { x: "16", y: "10", width: "4", height: "4", rx: "1" }),
1454
1457
  /* @__PURE__ */ T(P, { children: [
1455
- /* @__PURE__ */ d("path", { d: "M8 6c6 0 3 8 8 6" }),
1456
- /* @__PURE__ */ d("path", { d: "M8 18c3-3 2-8 6-6" })
1458
+ /* @__PURE__ */ u("path", { d: "M8 6c6 0 3 8 8 6" }),
1459
+ /* @__PURE__ */ u("path", { d: "M8 18c3-3 2-8 6-6" })
1457
1460
  ] })
1458
1461
  ] }) : /* @__PURE__ */ T(P, { children: [
1459
1462
  "Auto-Layout ",
@@ -1468,7 +1471,7 @@ const wt = ({
1468
1471
  layoutInProgress: r,
1469
1472
  setLayoutInProgress: e,
1470
1473
  applyLayout: o
1471
- } = Y();
1474
+ } = I();
1472
1475
  return /* @__PURE__ */ T(
1473
1476
  D,
1474
1477
  {
@@ -1485,19 +1488,19 @@ const wt = ({
1485
1488
  style: { color: r ? "#999" : "#000" },
1486
1489
  children: [
1487
1490
  /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "1.5", fill: "none", children: [
1488
- /* @__PURE__ */ d("rect", { x: "3", y: "3", width: "5", height: "5", rx: "1" }),
1489
- /* @__PURE__ */ d("rect", { x: "16", y: "3", width: "5", height: "5", rx: "1" }),
1490
- /* @__PURE__ */ d("rect", { x: "3", y: "16", width: "5", height: "5", rx: "1" }),
1491
- /* @__PURE__ */ d("rect", { x: "16", y: "16", width: "5", height: "5", rx: "1" }),
1492
- /* @__PURE__ */ d("path", { d: "M8 5.5h8M5.5 8v8M18.5 8v8M8 18.5h8" }),
1493
- /* @__PURE__ */ d("circle", { cx: "12", cy: "12", r: "3" }),
1494
- /* @__PURE__ */ d("path", { d: "M11 10.5v3l2-1.5z", fill: "currentColor" })
1491
+ /* @__PURE__ */ u("rect", { x: "3", y: "3", width: "5", height: "5", rx: "1" }),
1492
+ /* @__PURE__ */ u("rect", { x: "16", y: "3", width: "5", height: "5", rx: "1" }),
1493
+ /* @__PURE__ */ u("rect", { x: "3", y: "16", width: "5", height: "5", rx: "1" }),
1494
+ /* @__PURE__ */ u("rect", { x: "16", y: "16", width: "5", height: "5", rx: "1" }),
1495
+ /* @__PURE__ */ u("path", { d: "M8 5.5h8M5.5 8v8M18.5 8v8M8 18.5h8" }),
1496
+ /* @__PURE__ */ u("circle", { cx: "12", cy: "12", r: "3" }),
1497
+ /* @__PURE__ */ u("path", { d: "M11 10.5v3l2-1.5z", fill: "currentColor" })
1495
1498
  ] }),
1496
- !t && /* @__PURE__ */ d("span", { style: { marginLeft: "4px" }, children: "Apply Layout" })
1499
+ !t && /* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "Apply Layout" })
1497
1500
  ]
1498
1501
  }
1499
1502
  );
1500
- }, Le = ({
1503
+ }, Ee = ({
1501
1504
  showDirectionControls: t = !0,
1502
1505
  showSpacingControls: r = !0,
1503
1506
  showAutoLayoutToggle: e = !0,
@@ -1506,54 +1509,54 @@ const wt = ({
1506
1509
  standalone: n = !1,
1507
1510
  position: i = "top-right"
1508
1511
  }) => {
1509
- const l = Y(), {
1512
+ const l = I(), {
1510
1513
  autoLayout: c
1511
1514
  } = l;
1512
- return n ? /* @__PURE__ */ T(jt, { position: i, showZoom: !1, showFitView: !1, showInteractive: !1, children: [
1513
- o && !c && /* @__PURE__ */ d(
1515
+ return n ? /* @__PURE__ */ T(Xt, { position: i, showZoom: !1, showFitView: !1, showInteractive: !1, children: [
1516
+ o && !c && /* @__PURE__ */ u(
1514
1517
  Ct,
1515
1518
  {
1516
1519
  compact: !0
1517
1520
  }
1518
1521
  ),
1519
- t && /* @__PURE__ */ d(
1522
+ t && /* @__PURE__ */ u(
1520
1523
  wt,
1521
1524
  {
1522
1525
  compact: !0
1523
1526
  }
1524
1527
  ),
1525
- r && /* @__PURE__ */ d(
1528
+ r && /* @__PURE__ */ u(
1526
1529
  mt,
1527
1530
  {
1528
1531
  compact: !0
1529
1532
  }
1530
1533
  ),
1531
- e && /* @__PURE__ */ d(
1534
+ e && /* @__PURE__ */ u(
1532
1535
  bt,
1533
1536
  {
1534
1537
  compact: !0
1535
1538
  }
1536
1539
  )
1537
1540
  ] }) : /* @__PURE__ */ T(P, { children: [
1538
- o && !c && /* @__PURE__ */ d(
1541
+ o && !c && /* @__PURE__ */ u(
1539
1542
  Ct,
1540
1543
  {
1541
1544
  compact: !0
1542
1545
  }
1543
1546
  ),
1544
- t && /* @__PURE__ */ d(
1547
+ t && /* @__PURE__ */ u(
1545
1548
  wt,
1546
1549
  {
1547
1550
  compact: !0
1548
1551
  }
1549
1552
  ),
1550
- r && /* @__PURE__ */ d(
1553
+ r && /* @__PURE__ */ u(
1551
1554
  mt,
1552
1555
  {
1553
1556
  compact: !0
1554
1557
  }
1555
1558
  ),
1556
- e && /* @__PURE__ */ d(
1559
+ e && /* @__PURE__ */ u(
1557
1560
  bt,
1558
1561
  {
1559
1562
  compact: !0
@@ -1563,11 +1566,11 @@ const wt = ({
1563
1566
  };
1564
1567
  export {
1565
1568
  bt as AutoLayoutToggle,
1566
- Kt as DagreEngine,
1569
+ te as DagreEngine,
1567
1570
  wt as DirectionControls,
1568
- Le as LayoutControls,
1569
- Ce as LayoutProvider,
1571
+ Ee as LayoutControls,
1572
+ Le as LayoutProvider,
1570
1573
  mt as SpacingControls,
1571
- te as engines,
1572
- Y as useLayoutContext
1574
+ ee as engines,
1575
+ I as useLayoutContext
1573
1576
  };