react-panel-layout 0.3.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +291 -0
  2. package/dist/FloatingPanelFrame-SOrLGjZd.js +67 -0
  3. package/dist/FloatingPanelFrame-SOrLGjZd.js.map +1 -0
  4. package/dist/FloatingPanelFrame-XtBcHANI.cjs +2 -0
  5. package/dist/FloatingPanelFrame-XtBcHANI.cjs.map +1 -0
  6. package/dist/GridLayout-CLvW8jID.js +1352 -0
  7. package/dist/GridLayout-CLvW8jID.js.map +1 -0
  8. package/dist/GridLayout-qufTyOQM.cjs +2 -0
  9. package/dist/GridLayout-qufTyOQM.cjs.map +1 -0
  10. package/dist/components/pivot/PivotLayer.d.ts +14 -0
  11. package/dist/config/PanelContentDeclaration.d.ts +20 -0
  12. package/dist/config/panelRouter.d.ts +3 -1
  13. package/dist/config.cjs +1 -1
  14. package/dist/config.cjs.map +1 -1
  15. package/dist/config.js +125 -76
  16. package/dist/config.js.map +1 -1
  17. package/dist/constants/styles.d.ts +13 -0
  18. package/dist/floating.cjs +1 -1
  19. package/dist/floating.js +1 -1
  20. package/dist/hooks/useTransitionState.d.ts +21 -0
  21. package/dist/index.cjs +2 -2
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +573 -498
  25. package/dist/index.js.map +1 -1
  26. package/dist/modules/panels/rendering/ContentRegistry.d.ts +50 -0
  27. package/dist/modules/panels/rendering/RenderContext.d.ts +1 -0
  28. package/dist/modules/panels/state/types.d.ts +2 -2
  29. package/dist/modules/pivot/PivotContent.d.ts +29 -0
  30. package/dist/modules/pivot/index.d.ts +5 -0
  31. package/dist/modules/pivot/types.d.ts +62 -0
  32. package/dist/modules/pivot/usePivot.d.ts +28 -0
  33. package/dist/modules/window/useDrawerState.d.ts +3 -2
  34. package/dist/pivot/index.d.ts +8 -0
  35. package/dist/pivot.cjs +2 -0
  36. package/dist/pivot.cjs.map +1 -0
  37. package/dist/pivot.js +5 -0
  38. package/dist/pivot.js.map +1 -0
  39. package/dist/styles-DcG3aIFx.cjs +2 -0
  40. package/dist/styles-DcG3aIFx.cjs.map +1 -0
  41. package/dist/styles-w0ZixggV.js +51 -0
  42. package/dist/styles-w0ZixggV.js.map +1 -0
  43. package/dist/types.d.ts +37 -0
  44. package/dist/usePivot-C8q0pMgW.cjs +2 -0
  45. package/dist/usePivot-C8q0pMgW.cjs.map +1 -0
  46. package/dist/usePivot-z9gumDf-.js +97 -0
  47. package/dist/usePivot-z9gumDf-.js.map +1 -0
  48. package/package.json +7 -1
  49. package/dist/FloatingPanelFrame-0MnRbFkV.cjs +0 -2
  50. package/dist/FloatingPanelFrame-0MnRbFkV.cjs.map +0 -1
  51. package/dist/FloatingPanelFrame-BkjBp0S5.js +0 -96
  52. package/dist/FloatingPanelFrame-BkjBp0S5.js.map +0 -1
  53. package/dist/GridLayout-B0W3Tdan.cjs +0 -2
  54. package/dist/GridLayout-B0W3Tdan.cjs.map +0 -1
  55. package/dist/GridLayout-C0uqEj9E.js +0 -1296
  56. package/dist/GridLayout-C0uqEj9E.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,22 +1,24 @@
1
- import { u as Rt, a as Pt, b as Ct, c as J, d as Dt, e as _, f as At, t as kt, R as nt, G as ot } from "./GridLayout-C0uqEj9E.js";
2
- import { D as vr, g as Ir } from "./GridLayout-C0uqEj9E.js";
1
+ import { u as Dt, a as At, b as kt, c as J, d as Mt, e as M, t as _t, R as ot, G as st } from "./GridLayout-CLvW8jID.js";
2
+ import { D as Rr, f as Pr, r as Dr, g as Ar } from "./GridLayout-CLvW8jID.js";
3
3
  import { jsx as m, jsxs as H, Fragment as et } from "react/jsx-runtime";
4
4
  import * as l from "react";
5
- import { k as _t, l as Mt, m as Ot, H as Bt, p as Lt, q as $t, r as Ht, s as Nt, t as zt, u as Xt, T as Yt, v as Ft, w as jt, x as Vt, y as Kt, z as Ut, A as qt, S as Wt } from "./FloatingPanelFrame-BkjBp0S5.js";
6
- import { B as yr } from "./FloatingPanelFrame-BkjBp0S5.js";
7
- const Zt = (t) => ({
8
- width: Bt,
5
+ import { t as Ot, u as Bt, v as Lt, H as Ht, y as Nt, z as $t, A as zt, B as Xt, E as Yt, I as Ft, T as jt, J as Kt, K as Vt, L as Ut, M as Wt, N as qt, O as Zt, S as Jt } from "./styles-w0ZixggV.js";
6
+ import { Q as Mr } from "./styles-w0ZixggV.js";
7
+ import { a as rt } from "./usePivot-z9gumDf-.js";
8
+ import { createPortal as Qt } from "react-dom";
9
+ const te = (t) => ({
10
+ width: Ht,
9
11
  cursor: "col-resize",
10
12
  position: "relative",
11
13
  userSelect: "none",
12
- backgroundColor: t === "drag" ? _t : t === "hover" ? Mt : Ot
13
- }), pr = ({ onResize: t, component: e, element: r }) => {
14
- const { ref: n, isDragging: o, onPointerDown: s } = Rt({
14
+ backgroundColor: t === "drag" ? Ot : t === "hover" ? Bt : Lt
15
+ }), Tr = ({ onResize: t, component: e, element: r }) => {
16
+ const { ref: n, isDragging: o, onPointerDown: s } = Dt({
15
17
  axis: "x",
16
18
  onResize: t
17
19
  }), [a, i] = l.useState(!1), c = {
18
20
  ref: n,
19
- style: Zt(o ? "drag" : a ? "hover" : "idle"),
21
+ style: te(o ? "drag" : a ? "hover" : "idle"),
20
22
  role: "separator",
21
23
  "aria-orientation": "vertical",
22
24
  "data-dragging": o ? "true" : void 0,
@@ -25,20 +27,20 @@ const Zt = (t) => ({
25
27
  onPointerLeave: () => i(!1)
26
28
  };
27
29
  return r ? l.cloneElement(r, c) : e ? /* @__PURE__ */ m(e, { ...c }) : /* @__PURE__ */ m("div", { ...c });
28
- }, fr = () => {
29
- const { layerId: t } = Pt(), { getLayerHandleProps: e } = Ct();
30
+ }, xr = () => {
31
+ const { layerId: t } = At(), { getLayerHandleProps: e } = kt();
30
32
  return l.useMemo(() => e(t), [e, t]);
31
- }, lt = l.createContext(null), Jt = () => {
32
- const t = l.useContext(lt);
33
+ }, dt = l.createContext(null), ee = () => {
34
+ const t = l.useContext(dt);
33
35
  if (!t)
34
36
  throw new Error("useKeybindings must be used within KeybindingsProvider");
35
37
  return t;
36
- }, Qt = (t) => {
38
+ }, re = (t) => {
37
39
  const e = [];
38
40
  t.metaKey && e.push("Mod"), t.ctrlKey && e.push("Ctrl"), t.altKey && e.push("Alt"), t.shiftKey && e.push("Shift");
39
41
  const r = t.key.length === 1 ? t.key.toUpperCase() : t.key;
40
42
  return e.push(r), e.join("-");
41
- }, te = ({ children: t, configure: e }) => {
43
+ }, ne = ({ children: t, configure: e }) => {
42
44
  const r = l.useRef({}), n = l.useCallback((a, i) => {
43
45
  r.current = { ...r.current, [a]: i };
44
46
  }, []), o = l.useCallback((a) => {
@@ -47,7 +49,7 @@ const Zt = (t) => ({
47
49
  }, []);
48
50
  l.useEffect(() => {
49
51
  const a = (i) => {
50
- const c = Qt(i), u = r.current[c];
52
+ const c = re(i), u = r.current[c];
51
53
  u && u(i);
52
54
  };
53
55
  return window.addEventListener("keydown", a), () => {
@@ -57,8 +59,8 @@ const Zt = (t) => ({
57
59
  const s = l.useMemo(() => ({ register: n, unregister: o }), [n, o]);
58
60
  return l.useEffect(() => {
59
61
  e && e(s);
60
- }, [s, e]), /* @__PURE__ */ m(lt.Provider, { value: s, children: t });
61
- }, ee = (t, e) => {
62
+ }, [s, e]), /* @__PURE__ */ m(dt.Provider, { value: s, children: t });
63
+ }, oe = (t, e) => {
62
64
  t.register("Mod-\\", (r) => {
63
65
  r.preventDefault(), e.splitFocused("vertical");
64
66
  }), t.register("Mod-Shift-\\", (r) => {
@@ -73,9 +75,9 @@ const Zt = (t) => ({
73
75
  }), t.register("Alt-ArrowLeft", (r) => {
74
76
  r.preventDefault(), e.focusPrevGroup();
75
77
  });
76
- }, re = (t) => t.type === "group", dt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
78
+ }, se = (t) => t.type === "group", pt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
77
79
  const r = /* @__PURE__ */ new Map(), n = (o, s) => {
78
- if (re(o)) {
80
+ if (se(o)) {
79
81
  r.set(o.groupId, s);
80
82
  return;
81
83
  }
@@ -88,8 +90,8 @@ const Zt = (t) => ({
88
90
  n(o.a, { x: s.x, y: s.y, w: s.w, h: a }), n(o.b, { x: s.x, y: s.y + a, w: s.w, h: i });
89
91
  };
90
92
  return n(t, e), r;
91
- }, ne = (t, e) => {
92
- const r = dt(t.tree), n = {
93
+ }, ie = (t, e) => {
94
+ const r = pt(t.tree), n = {
93
95
  areas: [["root"]],
94
96
  rows: [{ size: "1fr" }],
95
97
  columns: [{ size: "1fr" }],
@@ -114,41 +116,41 @@ const Zt = (t) => ({
114
116
  };
115
117
  });
116
118
  return { config: n, layers: o };
117
- }, oe = (t, e, r) => {
118
- const n = dt(t.tree), o = Array.from(new Set(Array.from(n.values()).flatMap((h) => [h.x, h.x + h.w]))).sort((h, w) => h - w), s = Array.from(new Set(Array.from(n.values()).flatMap((h) => [h.y, h.y + h.h]))).sort((h, w) => h - w), a = o.slice(1).map((h, w) => `${h - o[w]}fr`), i = s.slice(1).map((h, w) => `${h - s[w]}fr`), c = a.map((h) => ({ size: h, resizable: r })), u = i.map((h) => ({ size: h, resizable: r })), d = (h, w, b, y) => {
119
- for (const [f, I] of n.entries())
120
- if (h >= I.x && w <= I.x + I.w && b >= I.y && y <= I.y + I.h)
121
- return f;
119
+ }, ae = (t, e, r) => {
120
+ const n = pt(t.tree), o = Array.from(new Set(Array.from(n.values()).flatMap((h) => [h.x, h.x + h.w]))).sort((h, w) => h - w), s = Array.from(new Set(Array.from(n.values()).flatMap((h) => [h.y, h.y + h.h]))).sort((h, w) => h - w), a = o.slice(1).map((h, w) => `${h - o[w]}fr`), i = s.slice(1).map((h, w) => `${h - s[w]}fr`), c = a.map((h) => ({ size: h, resizable: r })), u = i.map((h) => ({ size: h, resizable: r })), d = (h, w, I, T) => {
121
+ for (const [b, v] of n.entries())
122
+ if (h >= v.x && w <= v.x + v.w && I >= v.y && T <= v.y + v.h)
123
+ return b;
122
124
  return ".";
123
- }, g = [];
125
+ }, f = [];
124
126
  for (let h = 0; h < s.length - 1; h += 1) {
125
127
  const w = [];
126
- for (let b = 0; b < o.length - 1; b += 1)
127
- w.push(d(o[b], o[b + 1], s[h], s[h + 1]));
128
- g.push(w);
128
+ for (let I = 0; I < o.length - 1; I += 1)
129
+ w.push(d(o[I], o[I + 1], s[h], s[h + 1]));
130
+ f.push(w);
129
131
  }
130
- const v = {
131
- areas: g,
132
+ const g = {
133
+ areas: f,
132
134
  rows: u,
133
135
  columns: c,
134
136
  gap: "0px"
135
- }, T = Array.from(n.keys()).map((h) => ({
137
+ }, y = Array.from(n.keys()).map((h) => ({
136
138
  id: h,
137
139
  gridArea: h,
138
140
  component: e(h)
139
141
  }));
140
- return { config: v, layers: T };
141
- }, pt = l.createContext(null), se = () => {
142
- const t = l.useContext(pt);
142
+ return { config: g, layers: y };
143
+ }, ft = l.createContext(null), ce = () => {
144
+ const t = l.useContext(ft);
143
145
  if (!t)
144
146
  throw new Error("usePanelRenderContext must be used within PanelRenderProvider");
145
147
  return t;
146
- }, ie = ({ value: t, children: e }) => /* @__PURE__ */ m(pt.Provider, { value: t, children: e }), ft = l.createContext(null), bt = () => {
147
- const t = l.useContext(ft);
148
+ }, ue = ({ value: t, children: e }) => /* @__PURE__ */ m(ft.Provider, { value: t, children: e }), bt = l.createContext(null), gt = () => {
149
+ const t = l.useContext(bt);
148
150
  if (!t)
149
151
  throw new Error("useDomRegistry must be used within DomRegistryProvider");
150
152
  return t;
151
- }, ae = ({ children: t }) => {
153
+ }, le = ({ children: t }) => {
152
154
  const e = l.useRef(/* @__PURE__ */ new Map()), r = l.useCallback((c) => {
153
155
  const u = e.current.get(c);
154
156
  if (u)
@@ -159,8 +161,8 @@ const Zt = (t) => ({
159
161
  (c, u) => {
160
162
  const d = r(c);
161
163
  if (d.group = u, u === null) {
162
- const g = e.current.get(c);
163
- (g ? g.tabbar === null && g.content === null : !1) && e.current.delete(c);
164
+ const f = e.current.get(c);
165
+ (f ? f.tabbar === null && f.content === null : !1) && e.current.delete(c);
164
166
  }
165
167
  },
166
168
  [r]
@@ -168,8 +170,8 @@ const Zt = (t) => ({
168
170
  (c, u) => {
169
171
  const d = r(c);
170
172
  if (d.tabbar = u, u === null) {
171
- const g = e.current.get(c);
172
- (g ? g.group === null && g.content === null : !1) && e.current.delete(c);
173
+ const f = e.current.get(c);
174
+ (f ? f.group === null && f.content === null : !1) && e.current.delete(c);
173
175
  }
174
176
  },
175
177
  [r]
@@ -177,32 +179,32 @@ const Zt = (t) => ({
177
179
  (c, u) => {
178
180
  const d = r(c);
179
181
  if (d.content = u, u === null) {
180
- const g = e.current.get(c);
181
- (g ? g.group === null && g.tabbar === null : !1) && e.current.delete(c);
182
+ const f = e.current.get(c);
183
+ (f ? f.group === null && f.tabbar === null : !1) && e.current.delete(c);
182
184
  }
183
185
  },
184
186
  [r]
185
187
  ), a = l.useCallback(() => e.current, []), i = l.useMemo(() => ({ setGroupEl: n, setTabbarEl: o, setContentEl: s, getAll: a }), [n, o, s, a]);
186
- return /* @__PURE__ */ m(ft.Provider, { value: i, children: t });
187
- }, ce = {
188
+ return /* @__PURE__ */ m(bt.Provider, { value: i, children: t });
189
+ }, de = {
188
190
  display: "flex",
189
191
  flexDirection: "column",
190
192
  width: "100%",
191
193
  height: "100%"
192
- }, ue = {
194
+ }, pe = {
193
195
  flex: "1 1 auto",
194
196
  minWidth: 0,
195
197
  minHeight: 0,
196
198
  position: "relative",
197
199
  overflow: "hidden"
198
200
  };
199
- function le(t, e, r, n) {
201
+ function fe(t, e, r, n) {
200
202
  return t ? l.cloneElement(t, r, n) : e ? /* @__PURE__ */ m(e, { ...r, children: n }) : /* @__PURE__ */ m("div", { ...r, children: n });
201
203
  }
202
- function de(t, e, r, n) {
204
+ function be(t, e, r, n) {
203
205
  return t ? l.cloneElement(t, r, n) : e ? /* @__PURE__ */ m(e, { ...r, children: n }) : /* @__PURE__ */ m("div", { ...r, children: n });
204
206
  }
205
- const pe = ({
207
+ const ge = ({
206
208
  group: t,
207
209
  tabbar: e,
208
210
  content: r,
@@ -216,21 +218,21 @@ const pe = ({
216
218
  }) => {
217
219
  const d = {
218
220
  ref: o,
219
- style: ce,
221
+ style: de,
220
222
  "data-group-id": t.id
221
- }, v = le(u, c, {
223
+ }, g = fe(u, c, {
222
224
  ref: s,
223
- style: ue,
225
+ style: pe,
224
226
  "data-dnd-zone": "content",
225
227
  onPointerDown: n
226
228
  }, r);
227
- return de(i, a, d, /* @__PURE__ */ H(et, { children: [
229
+ return be(i, a, d, /* @__PURE__ */ H(et, { children: [
228
230
  e,
229
- v
231
+ g
230
232
  ] }));
231
- }, gt = l.memo(pe, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
232
- gt.displayName = "PanelGroupView";
233
- const V = (t, e, r) => {
233
+ }, ht = l.memo(ge, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
234
+ ht.displayName = "PanelGroupView";
235
+ const K = (t, e, r) => {
234
236
  const n = t.left, o = t.top, s = t.width, a = t.height, i = e - n, c = r - o, u = s / 3, d = a / 3;
235
237
  return i > u && i < s - u && c > d && c < a - d ? "center" : i < c && i < s - i && c < a - c ? "left" : s - i < c && s - i < i && c < a - c ? "right" : c < i && c < a - c && i < s - i ? "top" : "bottom";
236
238
  };
@@ -253,7 +255,7 @@ function A(t, e) {
253
255
  enumerable: !0
254
256
  }), r;
255
257
  }
256
- const fe = (t, e) => {
258
+ const he = (t, e) => {
257
259
  const r = {};
258
260
  return Object.keys(t).forEach((n) => {
259
261
  const o = t[n];
@@ -262,7 +264,7 @@ const fe = (t, e) => {
262
264
  return e(a), a;
263
265
  });
264
266
  }), r;
265
- }, ht = (t, e) => {
267
+ }, mt = (t, e) => {
266
268
  const r = {};
267
269
  return Object.keys(e).forEach((n) => {
268
270
  const o = e[n];
@@ -273,7 +275,7 @@ const fe = (t, e) => {
273
275
  throw new Error(`Missing action creator for key "${String(n)}"`);
274
276
  r[s.type] = o;
275
277
  }), r;
276
- }, mt = { phase: { kind: "idle" }, suggest: null, pointer: null, tabbarHover: null, draggingTabElement: null }, D = {
278
+ }, vt = { phase: { kind: "idle" }, suggest: null, pointer: null, tabbarHover: null, draggingTabElement: null }, D = {
277
279
  startContent: A(
278
280
  "START_CONTENT",
279
281
  (t) => t
@@ -289,7 +291,7 @@ const fe = (t, e) => {
289
291
  (t) => t
290
292
  ),
291
293
  reset: A("RESET")
292
- }, be = ht(D, {
294
+ }, me = mt(D, {
293
295
  startContent: (t, e) => ({
294
296
  phase: {
295
297
  kind: "content",
@@ -321,16 +323,16 @@ const fe = (t, e) => {
321
323
  setSuggest: (t, e) => ({ ...t, suggest: e.payload }),
322
324
  setPointer: (t, e) => ({ ...t, pointer: e.payload }),
323
325
  setTabbarHover: (t, e) => ({ ...t, tabbarHover: e.payload }),
324
- reset: () => mt
325
- }), ge = (t, e) => {
326
- const r = be[e.type];
326
+ reset: () => vt
327
+ }), ve = (t, e) => {
328
+ const r = me[e.type];
327
329
  return r ? r(t, e, void 0) : t;
328
- }, vt = l.createContext(null), q = () => {
329
- const t = l.useContext(vt);
330
+ }, It = l.createContext(null), W = () => {
331
+ const t = l.useContext(It);
330
332
  if (!t)
331
333
  throw new Error("usePanelInteractions must be used within InteractionsProvider");
332
334
  return t;
333
- }, he = ({
335
+ }, Ie = ({
334
336
  containerRef: t,
335
337
  dragThresholdPx: e,
336
338
  onCommitContentDrop: r,
@@ -338,122 +340,122 @@ const fe = (t, e) => {
338
340
  isContentZoneAllowed: o,
339
341
  children: s
340
342
  }) => {
341
- const [a, i] = l.useReducer(ge, mt), c = bt(), u = l.useCallback(() => {
342
- const b = Array.from(c.getAll().entries()), y = b.map(([p, G]) => ({ gid: p, el: G.content ?? G.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), f = b.map(([p, G]) => ({ gid: p, el: G.tabbar })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), I = b.map(([p, G]) => ({ gid: p, el: G.content ?? G.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() }));
343
- return { groups: y, tabbars: f, contents: I };
344
- }, [c]), d = J((b) => {
343
+ const [a, i] = l.useReducer(ve, vt), c = gt(), u = l.useCallback(() => {
344
+ const I = Array.from(c.getAll().entries()), T = I.map(([p, x]) => ({ gid: p, el: x.content ?? x.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), b = I.map(([p, x]) => ({ gid: p, el: x.tabbar })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), v = I.map(([p, x]) => ({ gid: p, el: x.content ?? x.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() }));
345
+ return { groups: T, tabbars: b, contents: v };
346
+ }, [c]), d = J((I) => {
345
347
  if (!t.current)
346
348
  return;
347
- const f = b.clientX, I = b.clientY, p = a.phase;
349
+ const b = I.clientX, v = I.clientY, p = a.phase;
348
350
  if (p.kind === "idle")
349
351
  return;
350
- const G = Math.abs(f - p.startX), E = Math.abs(I - p.startY);
351
- if (G < e && E < e) {
352
+ const x = Math.abs(b - p.startX), E = Math.abs(v - p.startY);
353
+ if (x < e && E < e) {
352
354
  a.phase.kind === "content" && i(D.setSuggest(null)), i(D.setPointer(null)), i(D.setTabbarHover(null));
353
355
  return;
354
356
  }
355
- if (i(D.setPointer({ x: f, y: I })), p.kind === "content") {
356
- const S = p.cache.groups.find(({ rect: x }) => f >= x.left && f <= x.right && I >= x.top && I <= x.bottom);
357
+ if (i(D.setPointer({ x: b, y: v })), p.kind === "content") {
358
+ const S = p.cache.groups.find(({ rect: G }) => b >= G.left && b <= G.right && v >= G.top && v <= G.bottom);
357
359
  if (!S) {
358
360
  i(D.setSuggest(null));
359
361
  return;
360
362
  }
361
- const P = V(S.rect, f, I);
362
- if (o && !o({ targetGroupId: S.gid, zone: P })) {
363
+ const R = K(S.rect, b, v);
364
+ if (o && !o({ targetGroupId: S.gid, zone: R })) {
363
365
  i(D.setSuggest(null));
364
366
  return;
365
367
  }
366
- i(D.setSuggest({ rect: S.rect, zone: P }));
368
+ i(D.setSuggest({ rect: S.rect, zone: R }));
367
369
  return;
368
370
  }
369
371
  if (p.kind === "tab") {
370
- const S = p.cache.tabbars.find(({ rect: R }) => f >= R.left && f <= R.right && I >= R.top && I <= R.bottom);
372
+ const S = p.cache.tabbars.find(({ rect: C }) => b >= C.left && b <= C.right && v >= C.top && v <= C.bottom);
371
373
  if (S) {
372
- const k = Array.from(S.el.querySelectorAll("[role='tab']")).map((N) => N.getBoundingClientRect()), C = k.map((N) => N.left + N.width / 2), O = C.findIndex((N) => f < N), B = O === -1 ? C.length : O, Et = k.length === 0 ? S.rect.left + 8 : B === 0 ? k[0].left : B === k.length ? k[k.length - 1].right : (k[B - 1].right + k[B].left) / 2;
373
- i(D.setTabbarHover({ groupId: S.gid, index: B, rect: S.rect, insertX: Et }));
374
+ const k = Array.from(S.el.querySelectorAll("[role='tab']")).map(($) => $.getBoundingClientRect()), P = k.map(($) => $.left + $.width / 2), O = P.findIndex(($) => b < $), B = O === -1 ? P.length : O, Pt = k.length === 0 ? S.rect.left + 8 : B === 0 ? k[0].left : B === k.length ? k[k.length - 1].right : (k[B - 1].right + k[B].left) / 2;
375
+ i(D.setTabbarHover({ groupId: S.gid, index: B, rect: S.rect, insertX: Pt }));
374
376
  } else
375
377
  i(D.setTabbarHover(null));
376
- const P = p.cache.contents.find(({ rect: R }) => f >= R.left && f <= R.right && I >= R.top && I <= R.bottom);
377
- if (!P) {
378
+ const R = p.cache.contents.find(({ rect: C }) => b >= C.left && b <= C.right && v >= C.top && v <= C.bottom);
379
+ if (!R) {
378
380
  i(D.setSuggest(null));
379
381
  return;
380
382
  }
381
- const x = V(P.rect, f, I);
382
- if (o && !o({ targetGroupId: P.gid, zone: x })) {
383
+ const G = K(R.rect, b, v);
384
+ if (o && !o({ targetGroupId: R.gid, zone: G })) {
383
385
  i(D.setSuggest(null));
384
386
  return;
385
387
  }
386
- i(D.setSuggest({ rect: P.rect, zone: x }));
388
+ i(D.setSuggest({ rect: R.rect, zone: G }));
387
389
  }
388
- }), g = J((b) => {
389
- const y = t.current, f = a;
390
- if (i(D.reset()), !y)
390
+ }), f = J((I) => {
391
+ const T = t.current, b = a;
392
+ if (i(D.reset()), !T)
391
393
  return;
392
- const I = b.clientX, p = b.clientY;
393
- if (f.phase.kind === "idle")
394
+ const v = I.clientX, p = I.clientY;
395
+ if (b.phase.kind === "idle")
394
396
  return;
395
- const G = Math.abs(I - f.phase.startX), E = Math.abs(p - f.phase.startY);
396
- if (!(G < e && E < e)) {
397
- if (f.phase.kind === "content") {
398
- const S = f.phase.cache.groups.find(({ rect: R }) => I >= R.left && I <= R.right && p >= R.top && p <= R.bottom);
397
+ const x = Math.abs(v - b.phase.startX), E = Math.abs(p - b.phase.startY);
398
+ if (!(x < e && E < e)) {
399
+ if (b.phase.kind === "content") {
400
+ const S = b.phase.cache.groups.find(({ rect: C }) => v >= C.left && v <= C.right && p >= C.top && p <= C.bottom);
399
401
  if (!S)
400
402
  return;
401
- const P = S.gid ?? null;
402
- if (!P)
403
+ const R = S.gid ?? null;
404
+ if (!R)
403
405
  return;
404
- const x = V(S.rect, I, p);
405
- if (o && !o({ targetGroupId: P, zone: x }))
406
+ const G = K(S.rect, v, p);
407
+ if (o && !o({ targetGroupId: R, zone: G }))
406
408
  return;
407
- r({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: P, zone: x });
409
+ r({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: R, zone: G });
408
410
  return;
409
411
  }
410
- if (f.phase.kind === "tab") {
411
- const S = f.phase.cache.tabbars.find(({ rect: x }) => I >= x.left && I <= x.right && p >= x.top && p <= x.bottom);
412
+ if (b.phase.kind === "tab") {
413
+ const S = b.phase.cache.tabbars.find(({ rect: G }) => v >= G.left && v <= G.right && p >= G.top && p <= G.bottom);
412
414
  if (S) {
413
- const x = S.gid;
414
- if (!x)
415
+ const G = S.gid;
416
+ if (!G)
415
417
  return;
416
418
  const k = Array.from(S.el.querySelectorAll("[role='tab']")).map((B) => {
417
419
  const Z = B.getBoundingClientRect();
418
420
  return Z.left + Z.width / 2;
419
- }), C = k.findIndex((B) => I < B), O = C === -1 ? k.length : C;
420
- n({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: x, targetIndex: O });
421
+ }), P = k.findIndex((B) => v < B), O = P === -1 ? k.length : P;
422
+ n({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: G, targetIndex: O });
421
423
  return;
422
424
  }
423
- const P = f.phase.cache.contents.find(({ rect: x }) => I >= x.left && I <= x.right && p >= x.top && p <= x.bottom);
424
- if (P) {
425
- const x = P.gid ?? null;
426
- if (!x)
425
+ const R = b.phase.cache.contents.find(({ rect: G }) => v >= G.left && v <= G.right && p >= G.top && p <= G.bottom);
426
+ if (R) {
427
+ const G = R.gid ?? null;
428
+ if (!G)
427
429
  return;
428
- const R = V(P.rect, I, p);
429
- if (o && !o({ targetGroupId: x, zone: R }))
430
+ const C = K(R.rect, v, p);
431
+ if (o && !o({ targetGroupId: G, zone: C }))
430
432
  return;
431
- r({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: x, zone: R });
433
+ r({ fromGroupId: b.phase.fromGroupId, tabId: b.phase.tabId, targetGroupId: G, zone: C });
432
434
  }
433
435
  }
434
436
  }
435
- }), v = J(() => {
437
+ }), g = J(() => {
436
438
  i(D.reset());
437
439
  });
438
440
  l.useEffect(() => {
439
441
  if (a.phase.kind !== "idle")
440
- return window.addEventListener("pointermove", d), window.addEventListener("pointerup", g, { once: !0 }), window.addEventListener("pointercancel", v, { once: !0 }), () => {
441
- window.removeEventListener("pointermove", d), window.removeEventListener("pointerup", g), window.removeEventListener("pointercancel", v);
442
+ return window.addEventListener("pointermove", d), window.addEventListener("pointerup", f, { once: !0 }), window.addEventListener("pointercancel", g, { once: !0 }), () => {
443
+ window.removeEventListener("pointermove", d), window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", g);
442
444
  };
443
445
  }, [a.phase.kind]);
444
- const T = l.useCallback((b, y, f) => {
445
- if (f.button !== 0)
446
+ const y = l.useCallback((I, T, b) => {
447
+ if (b.button !== 0)
446
448
  return;
447
- f.currentTarget.setPointerCapture(f.pointerId);
448
- const I = u();
449
- i(D.startContent({ x: f.clientX, y: f.clientY, groupId: b, tabId: y, cache: I }));
450
- }, [u]), h = l.useCallback((b, y, f) => {
451
- if (f.button !== 0)
449
+ b.currentTarget.setPointerCapture(b.pointerId);
450
+ const v = u();
451
+ i(D.startContent({ x: b.clientX, y: b.clientY, groupId: I, tabId: T, cache: v }));
452
+ }, [u]), h = l.useCallback((I, T, b) => {
453
+ if (b.button !== 0)
452
454
  return;
453
- const I = f.currentTarget;
454
- I && I.setPointerCapture(f.pointerId);
455
+ const v = b.currentTarget;
456
+ v && v.setPointerCapture(b.pointerId);
455
457
  const p = u();
456
- i(D.startTab({ x: f.clientX, y: f.clientY, groupId: y, tabId: b, cache: p, element: I }));
458
+ i(D.startTab({ x: b.clientX, y: b.clientY, groupId: T, tabId: I, cache: p, element: v }));
457
459
  }, [u]), w = l.useMemo(() => ({
458
460
  suggest: a.suggest,
459
461
  isTabDragging: a.phase.kind === "tab",
@@ -461,15 +463,15 @@ const fe = (t, e) => {
461
463
  dragPointer: a.pointer,
462
464
  tabbarHover: a.tabbarHover,
463
465
  draggingTabElement: a.draggingTabElement,
464
- onStartContentDrag: T,
466
+ onStartContentDrag: y,
465
467
  onStartTabDrag: h
466
- }), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, T, h]);
467
- return /* @__PURE__ */ m(vt.Provider, { value: w, children: s });
468
- }, st = {
468
+ }), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, y, h]);
469
+ return /* @__PURE__ */ m(It.Provider, { value: w, children: s });
470
+ }, it = {
469
471
  display: "inline-flex",
470
472
  alignItems: "center",
471
473
  userSelect: "none"
472
- }, me = ({
474
+ }, we = ({
473
475
  groupId: t,
474
476
  tab: e,
475
477
  active: r,
@@ -483,17 +485,17 @@ const fe = (t, e) => {
483
485
  }) => {
484
486
  const d = l.useEffectEvent(() => {
485
487
  o(e.id);
486
- }), g = l.useEffectEvent((w) => {
488
+ }), f = l.useEffectEvent((w) => {
487
489
  s && w.button === 0 && s(e.id, t, w);
488
- }), v = () => {
490
+ }), g = () => {
489
491
  const w = !!a;
490
492
  return /* @__PURE__ */ m(l.Activity, { mode: w ? "visible" : "hidden", children: /* @__PURE__ */ m(
491
493
  "button",
492
494
  {
493
495
  type: "button",
494
496
  "aria-label": `Close tab ${e.title}`,
495
- onClick: (b) => {
496
- a && (b.stopPropagation(), a(t, e.id));
497
+ onClick: (I) => {
498
+ a && (I.stopPropagation(), a(t, e.id));
497
499
  },
498
500
  style: { marginLeft: 6 },
499
501
  tabIndex: w ? void 0 : -1,
@@ -502,27 +504,27 @@ const fe = (t, e) => {
502
504
  children: "×"
503
505
  }
504
506
  ) });
505
- }, T = {
507
+ }, y = {
506
508
  role: "tab",
507
509
  "aria-selected": r,
508
510
  tabIndex: r ? 0 : -1,
509
- style: st,
511
+ style: it,
510
512
  onClick: d,
511
- onPointerDown: g,
513
+ onPointerDown: f,
512
514
  onDoubleClick: u,
513
515
  "data-tab-id": e.id,
514
516
  "data-active": r ? "true" : "false",
515
517
  "data-dragging": n ? "true" : "false",
516
518
  children: /* @__PURE__ */ H(et, { children: [
517
519
  /* @__PURE__ */ m("span", { children: e.title }),
518
- v()
520
+ g()
519
521
  ] })
520
522
  }, h = {
521
523
  type: "button",
522
524
  role: "tab",
523
525
  "aria-selected": r,
524
526
  tabIndex: r ? 0 : -1,
525
- style: st,
527
+ style: it,
526
528
  onClick: () => {
527
529
  o(e.id);
528
530
  },
@@ -532,14 +534,14 @@ const fe = (t, e) => {
532
534
  onDoubleClick: u,
533
535
  children: /* @__PURE__ */ m("span", { children: e.title })
534
536
  };
535
- return c ? c(h) : i ? /* @__PURE__ */ m(i, { ...h }) : /* @__PURE__ */ m("div", { ...T });
536
- }, ve = {
537
+ return c ? c(h) : i ? /* @__PURE__ */ m(i, { ...h }) : /* @__PURE__ */ m("div", { ...y });
538
+ }, ye = {
537
539
  display: "flex",
538
540
  alignItems: "center"
539
- }, Ie = {
541
+ }, Te = {
540
542
  flex: "1 1 auto",
541
543
  alignSelf: "stretch"
542
- }, we = ({
544
+ }, xe = ({
543
545
  group: t,
544
546
  onClickTab: e,
545
547
  onStartDrag: r,
@@ -552,9 +554,9 @@ const fe = (t, e) => {
552
554
  onCloseTab: u,
553
555
  doubleClickToAdd: d
554
556
  }) => {
555
- const { isTabDragging: g, draggingTabId: v } = q(), T = l.useRef(null), h = l.useCallback(
557
+ const { isTabDragging: f, draggingTabId: g } = W(), y = l.useRef(null), h = l.useCallback(
556
558
  (p) => {
557
- if (T.current = p, !!n) {
559
+ if (y.current = p, !!n) {
558
560
  if (typeof n == "function") {
559
561
  n(p);
560
562
  return;
@@ -567,26 +569,26 @@ const fe = (t, e) => {
567
569
  },
568
570
  [n]
569
571
  ), w = l.useEffectEvent((p) => {
570
- const G = T.current ?? p.currentTarget;
571
- if (!G)
572
+ const x = y.current ?? p.currentTarget;
573
+ if (!x)
572
574
  return;
573
- const E = Array.from(G.querySelectorAll('[role="tab"]'));
575
+ const E = Array.from(x.querySelectorAll('[role="tab"]'));
574
576
  if (E.length === 0)
575
577
  return;
576
- const S = (C) => {
577
- const O = Math.max(0, Math.min(C, E.length - 1)), B = E[O];
578
+ const S = (P) => {
579
+ const O = Math.max(0, Math.min(P, E.length - 1)), B = E[O];
578
580
  B && B.focus();
579
- }, P = document.activeElement, x = P ? E.indexOf(P) : E.findIndex((C) => C.getAttribute("data-tab-id") === t.activeTabId);
581
+ }, R = document.activeElement, G = R ? E.indexOf(R) : E.findIndex((P) => P.getAttribute("data-tab-id") === t.activeTabId);
580
582
  if (p.key === "ArrowRight") {
581
583
  p.preventDefault();
582
- const C = x >= 0 ? x + 1 : 0;
583
- S(C >= E.length ? 0 : C);
584
+ const P = G >= 0 ? G + 1 : 0;
585
+ S(P >= E.length ? 0 : P);
584
586
  return;
585
587
  }
586
588
  if (p.key === "ArrowLeft") {
587
589
  p.preventDefault();
588
- const C = x >= 0 ? x - 1 : E.length - 1;
589
- S(C < 0 ? E.length - 1 : C);
590
+ const P = G >= 0 ? G - 1 : E.length - 1;
591
+ S(P < 0 ? E.length - 1 : P);
590
592
  return;
591
593
  }
592
594
  if (p.key === "Home") {
@@ -599,44 +601,44 @@ const fe = (t, e) => {
599
601
  }
600
602
  if (p.key === "Enter" || p.key === " ") {
601
603
  p.preventDefault();
602
- const O = (x >= 0 ? E[x] : null)?.getAttribute("data-tab-id") ?? null;
604
+ const O = (G >= 0 ? E[G] : null)?.getAttribute("data-tab-id") ?? null;
603
605
  O && e(O);
604
606
  return;
605
607
  }
606
608
  if (p.key === "Delete" || p.key === "Backspace") {
607
609
  if (u) {
608
610
  p.preventDefault();
609
- const O = (x >= 0 ? E[x] : null)?.getAttribute("data-tab-id") ?? null;
611
+ const O = (G >= 0 ? E[G] : null)?.getAttribute("data-tab-id") ?? null;
610
612
  O && u(t.id, O);
611
613
  }
612
614
  return;
613
615
  }
614
- const R = (p.ctrlKey ? 1 : 0) + (p.metaKey ? 1 : 0) > 0, k = typeof p.key == "string" ? p.key.toLowerCase() : "";
615
- if (R && k === "t") {
616
+ const C = (p.ctrlKey ? 1 : 0) + (p.metaKey ? 1 : 0) > 0, k = typeof p.key == "string" ? p.key.toLowerCase() : "";
617
+ if (C && k === "t") {
616
618
  c && (p.preventDefault(), c(t.id));
617
619
  return;
618
620
  }
619
621
  });
620
622
  l.useEffect(() => {
621
- const p = T.current;
623
+ const p = y.current;
622
624
  if (!p)
623
625
  return;
624
- const G = p.querySelector(`[role="tab"][data-tab-id="${t.activeTabId}"]`);
625
- if (G === document.activeElement)
626
+ const x = p.querySelector(`[role="tab"][data-tab-id="${t.activeTabId}"]`);
627
+ if (x === document.activeElement)
626
628
  return;
627
- !p.contains(document.activeElement) && G && G.focus();
629
+ !p.contains(document.activeElement) && x && x.focus();
628
630
  }, [t.activeTabId]);
629
- const b = {
630
- style: ve,
631
+ const I = {
632
+ style: ye,
631
633
  role: "tablist",
632
634
  "data-tabbar": "true",
633
635
  "data-group-id": t.id,
634
- "data-dragging": g ? "true" : "false",
636
+ "data-dragging": f ? "true" : "false",
635
637
  onKeyDown: w
636
- }, y = Dt({
638
+ }, T = Mt({
637
639
  element: s,
638
640
  component: o
639
- }), f = () => c ? /* @__PURE__ */ m(
641
+ }), b = () => c ? /* @__PURE__ */ m(
640
642
  "button",
641
643
  {
642
644
  type: "button",
@@ -646,17 +648,17 @@ const fe = (t, e) => {
646
648
  },
647
649
  children: "+"
648
650
  }
649
- ) : null, I = l.useCallback(() => {
651
+ ) : null, v = l.useCallback(() => {
650
652
  d && c && c(t.id);
651
653
  }, [d, c, t.id]);
652
- return /* @__PURE__ */ H(y, { ...b, ref: h, onDoubleClick: I, children: [
653
- t.tabs.map((p, G) => /* @__PURE__ */ m(
654
- me,
654
+ return /* @__PURE__ */ H(T, { ...I, ref: h, onDoubleClick: v, children: [
655
+ t.tabs.map((p, x) => /* @__PURE__ */ m(
656
+ we,
655
657
  {
656
658
  groupId: t.id,
657
659
  tab: p,
658
660
  active: t.activeTabId === p.id,
659
- dragging: v === p.id,
661
+ dragging: g === p.id,
660
662
  onClickTab: e,
661
663
  onStartDrag: r,
662
664
  onCloseTab: u,
@@ -664,65 +666,64 @@ const fe = (t, e) => {
664
666
  tabElement: i,
665
667
  onDoubleClick: (E) => E.stopPropagation()
666
668
  },
667
- `${t.id}:${p.id}:${G}`
669
+ `${t.id}:${p.id}:${x}`
668
670
  )),
669
- /* @__PURE__ */ m("span", { style: Ie }),
670
- f()
671
+ /* @__PURE__ */ m("span", { style: Te }),
672
+ b()
671
673
  ] });
672
- }, ye = ({ id: t, TabBarComponent: e, PanelGroupComponent: r }) => {
673
- const { getGroup: n, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartContentDrag: c, onStartTabDrag: u, doubleClickToAdd: d } = se(), { setGroupEl: g, setTabbarEl: v, setContentEl: T } = bt(), h = l.useCallback(
674
- (G) => {
675
- g(t, G);
674
+ }, Ge = ({ id: t, TabBarComponent: e, PanelGroupComponent: r }) => {
675
+ const { getGroup: n, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: u, registerContentContainer: d } = ce(), { setGroupEl: f, setTabbarEl: g, setContentEl: y } = gt(), h = l.useCallback(
676
+ (x) => {
677
+ f(t, x);
676
678
  },
677
- [t, g]
679
+ [t, f]
678
680
  ), w = l.useCallback(
679
- (G) => {
680
- T(t, G);
681
+ (x) => {
682
+ y(t, x), d(t, x);
681
683
  },
682
- [t, T]
683
- ), b = l.useCallback(
684
- (G) => {
685
- v(t, G);
684
+ [t, y, d]
685
+ ), I = l.useCallback(
686
+ (x) => {
687
+ g(t, x);
686
688
  },
687
- [t, v]
688
- ), y = n(t);
689
- if (!y)
689
+ [t, g]
690
+ ), T = n(t);
691
+ if (!T)
690
692
  return null;
691
- const f = o(t);
693
+ const b = o(t);
692
694
  return /* @__PURE__ */ m(
693
- r ?? ((G) => /* @__PURE__ */ m(gt, { ...G })),
695
+ r ?? ((x) => /* @__PURE__ */ m(ht, { ...x })),
694
696
  {
695
- group: y,
697
+ group: T,
696
698
  tabbar: /* @__PURE__ */ m(
697
- e ?? we,
699
+ e ?? xe,
698
700
  {
699
- rootRef: b,
700
- group: y,
701
- onClickTab: (G) => s(t, G),
701
+ rootRef: I,
702
+ group: T,
703
+ onClickTab: (x) => s(t, x),
702
704
  onAddTab: a,
703
705
  onCloseTab: i,
704
- onStartDrag: (G, E, S) => u(G, E, S),
705
- doubleClickToAdd: d
706
+ onStartDrag: (x, E, S) => c(x, E, S),
707
+ doubleClickToAdd: u
706
708
  }
707
709
  ),
708
- content: f,
710
+ content: b,
709
711
  groupRef: h,
710
- contentRef: w,
711
- onContentPointerDown: (G) => c(t, G)
712
+ contentRef: w
712
713
  }
713
714
  );
714
- }, Te = (t, e) => {
715
+ }, Se = (t, e) => {
715
716
  const r = new Array(16);
716
717
  for (let n = 0; n < 4; n++)
717
718
  for (let o = 0; o < 4; o++)
718
719
  r[n * 4 + o] = t[0 + o] * e[n * 4 + 0] + t[4 + o] * e[n * 4 + 1] + t[8 + o] * e[n * 4 + 2] + t[12 + o] * e[n * 4 + 3];
719
720
  return r;
720
- }, K = (t) => {
721
+ }, V = (t) => {
721
722
  if (t.length !== 16)
722
723
  throw new Error("Matrix must have exactly 16 values");
723
724
  const e = Object.freeze([...t]), r = (n) => {
724
- const o = Te(e, n);
725
- return K(o);
725
+ const o = Se(e, n);
726
+ return V(o);
726
727
  };
727
728
  return Object.freeze({
728
729
  translate: (n = 0, o = 0, s = 0) => r([
@@ -971,7 +972,7 @@ const fe = (t, e) => {
971
972
  rotate: (n, o, s, a) => {
972
973
  const i = Math.sqrt(o * o + s * s + a * a);
973
974
  if (i === 0)
974
- return K(e);
975
+ return V(e);
975
976
  o /= i, s /= i, a /= i;
976
977
  const c = Math.cos(n), u = Math.sin(n), d = 1 - c;
977
978
  return r([
@@ -996,7 +997,7 @@ const fe = (t, e) => {
996
997
  rotate3d: (n, o, s, a) => {
997
998
  const i = Math.sqrt(n * n + o * o + s * s);
998
999
  if (i === 0)
999
- return K(e);
1000
+ return V(e);
1000
1001
  n /= i, o /= i, s /= i;
1001
1002
  const c = Math.cos(a), u = Math.sin(a), d = 1 - c;
1002
1003
  return r([
@@ -1113,7 +1114,7 @@ const fe = (t, e) => {
1113
1114
  ].join(`
1114
1115
  `)
1115
1116
  });
1116
- }, Ge = () => K([
1117
+ }, Ee = () => V([
1117
1118
  1,
1118
1119
  0,
1119
1120
  0,
@@ -1130,95 +1131,95 @@ const fe = (t, e) => {
1130
1131
  0,
1131
1132
  0,
1132
1133
  1
1133
- ]), xe = {
1134
+ ]), Ce = {
1134
1135
  position: "fixed",
1135
1136
  inset: 0,
1136
1137
  pointerEvents: "none",
1137
- zIndex: Lt
1138
- }, Se = {
1138
+ zIndex: Nt
1139
+ }, Re = {
1139
1140
  position: "absolute",
1140
- border: `${Nt} dashed ${zt}`,
1141
- background: Ht,
1141
+ border: `${Xt} dashed ${Yt}`,
1142
+ background: zt,
1142
1143
  borderRadius: $t,
1143
1144
  transformOrigin: "top left"
1144
- }, L = (t, e) => e <= 0 ? 0 : _(t / e, 0), Ee = (t, e, r) => {
1145
+ }, L = (t, e) => e <= 0 ? 0 : M(t / e, 0), Pe = (t, e, r) => {
1145
1146
  const { width: n, height: o } = t, s = r / 2, a = n > 0 ? n : 1, i = o > 0 ? o : 1, c = {
1146
1147
  translateX: r,
1147
1148
  translateY: r,
1148
- scaleX: L(_(n - r * 2, 0), a),
1149
- scaleY: L(_(o - r * 2, 0), i)
1149
+ scaleX: L(M(n - r * 2, 0), a),
1150
+ scaleY: L(M(o - r * 2, 0), i)
1150
1151
  }, u = {
1151
1152
  translateX: r,
1152
1153
  translateY: r,
1153
- scaleX: L(_(n / 2 - r * 1.5, 0), a),
1154
- scaleY: L(_(o - r * 2, 0), i)
1154
+ scaleX: L(M(n / 2 - r * 1.5, 0), a),
1155
+ scaleY: L(M(o - r * 2, 0), i)
1155
1156
  }, d = {
1156
1157
  translateX: n / 2 + s,
1157
1158
  translateY: r,
1158
- scaleX: L(_(n / 2 - r * 1.5, 0), a),
1159
- scaleY: L(_(o - r * 2, 0), i)
1160
- }, g = {
1159
+ scaleX: L(M(n / 2 - r * 1.5, 0), a),
1160
+ scaleY: L(M(o - r * 2, 0), i)
1161
+ }, f = {
1161
1162
  translateX: r,
1162
1163
  translateY: r,
1163
- scaleX: L(_(n - r * 2, 0), a),
1164
- scaleY: L(_(o / 2 - r * 1.5, 0), i)
1165
- }, v = {
1164
+ scaleX: L(M(n - r * 2, 0), a),
1165
+ scaleY: L(M(o / 2 - r * 1.5, 0), i)
1166
+ }, g = {
1166
1167
  translateX: r,
1167
1168
  translateY: o / 2 + s,
1168
- scaleX: L(_(n - r * 2, 0), a),
1169
- scaleY: L(_(o / 2 - r * 1.5, 0), i)
1170
- }, T = {
1169
+ scaleX: L(M(n - r * 2, 0), a),
1170
+ scaleY: L(M(o / 2 - r * 1.5, 0), i)
1171
+ }, y = {
1171
1172
  center: c,
1172
1173
  left: u,
1173
1174
  right: d,
1174
- top: g,
1175
- bottom: v
1176
- }, { translateX: h, translateY: w, scaleX: b, scaleY: y } = T[e];
1177
- return Ge().translate(h, w, 0).scale(b, y, 1).toCSS();
1178
- }, Re = (t, e) => {
1179
- const r = Xt;
1175
+ top: f,
1176
+ bottom: g
1177
+ }, { translateX: h, translateY: w, scaleX: I, scaleY: T } = y[e];
1178
+ return Ee().translate(h, w, 0).scale(I, T, 1).toCSS();
1179
+ }, De = (t, e) => {
1180
+ const r = Ft;
1180
1181
  return {
1181
- ...Se,
1182
+ ...Re,
1182
1183
  left: t.left,
1183
1184
  top: t.top,
1184
1185
  width: t.width,
1185
1186
  height: t.height,
1186
- transform: Ee(t, e, r)
1187
+ transform: Pe(t, e, r)
1187
1188
  };
1188
- }, Pe = ({ suggest: t }) => {
1189
+ }, Ae = ({ suggest: t }) => {
1189
1190
  if (!t)
1190
1191
  return null;
1191
- const { rect: e, zone: r } = t, n = Re(e, r);
1192
- return /* @__PURE__ */ m("div", { style: xe, children: /* @__PURE__ */ m("div", { style: n }) });
1193
- }, Ce = typeof window < "u" && typeof document < "u", De = (t) => {
1192
+ const { rect: e, zone: r } = t, n = De(e, r);
1193
+ return /* @__PURE__ */ m("div", { style: Ce, children: /* @__PURE__ */ m("div", { style: n }) });
1194
+ }, ke = typeof window < "u" && typeof document < "u", Me = (t) => {
1194
1195
  const [e, r] = l.useState(null), [n, o] = l.useState(null);
1195
- return At(() => {
1196
- if (!Ce || !t) {
1196
+ return rt(() => {
1197
+ if (!ke || !t) {
1197
1198
  r(null), o(null);
1198
1199
  return;
1199
1200
  }
1200
1201
  const s = t.getBoundingClientRect();
1201
1202
  r({ width: s.width, height: s.height }), o(t.outerHTML);
1202
1203
  }, [t]), { html: n, size: e };
1203
- }, Ae = {
1204
+ }, _e = {
1204
1205
  position: "fixed",
1205
1206
  inset: 0,
1206
1207
  pointerEvents: "none",
1207
- zIndex: qt
1208
- }, ke = {
1208
+ zIndex: Zt
1209
+ }, Oe = {
1209
1210
  position: "absolute",
1210
- width: Ut,
1211
- borderRadius: Kt,
1212
- background: Vt,
1213
- boxShadow: jt
1214
- }, _e = () => {
1215
- const { isTabDragging: t, draggingTabId: e, dragPointer: r, tabbarHover: n, draggingTabElement: o } = q(), { html: s, size: a } = De(o), i = r !== null && e !== null, c = l.useMemo(() => {
1211
+ width: qt,
1212
+ borderRadius: Wt,
1213
+ background: Ut,
1214
+ boxShadow: Vt
1215
+ }, Be = () => {
1216
+ const { isTabDragging: t, draggingTabId: e, dragPointer: r, tabbarHover: n, draggingTabElement: o } = W(), { html: s, size: a } = Me(o), i = r !== null && e !== null, c = l.useMemo(() => {
1216
1217
  if (!(!i || !r))
1217
1218
  return {
1218
1219
  position: "absolute",
1219
1220
  left: r.x,
1220
1221
  top: r.y,
1221
- transform: `translate(${Yt}, ${Ft})`,
1222
+ transform: `translate(${jt}, ${Kt})`,
1222
1223
  pointerEvents: "none"
1223
1224
  };
1224
1225
  }, [i, r]), u = l.useMemo(() => {
@@ -1227,13 +1228,13 @@ const fe = (t, e) => {
1227
1228
  }, [c, o, a]), d = l.useMemo(() => {
1228
1229
  if (n)
1229
1230
  return {
1230
- ...ke,
1231
+ ...Oe,
1231
1232
  left: n.insertX,
1232
1233
  top: n.rect.top + 4,
1233
1234
  height: Math.max(0, n.rect.height - 8)
1234
1235
  };
1235
1236
  }, [n]);
1236
- return t ? /* @__PURE__ */ H("div", { style: Ae, children: [
1237
+ return t ? /* @__PURE__ */ H("div", { style: _e, children: [
1237
1238
  /* @__PURE__ */ m(l.Activity, { mode: u ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: u, children: /* @__PURE__ */ m(
1238
1239
  "div",
1239
1240
  {
@@ -1243,26 +1244,26 @@ const fe = (t, e) => {
1243
1244
  ) }) }),
1244
1245
  /* @__PURE__ */ m(l.Activity, { mode: d ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: d }) })
1245
1246
  ] }) : null;
1246
- }, M = (t) => t.type === "group", Y = (t, e = []) => {
1247
- if (M(t))
1247
+ }, _ = (t) => t.type === "group", F = (t, e = []) => {
1248
+ if (_(t))
1248
1249
  return [...e, t.groupId];
1249
- const r = Y(t.a, e);
1250
- return Y(t.b, r);
1251
- }, W = (t, e) => e.reduce((r, n) => M(r) ? r : r[n], t), F = (t, e, r) => {
1250
+ const r = F(t.a, e);
1251
+ return F(t.b, r);
1252
+ }, q = (t, e) => e.reduce((r, n) => _(r) ? r : r[n], t), j = (t, e, r) => {
1252
1253
  if (e.length === 0)
1253
1254
  return r;
1254
1255
  const [n, ...o] = e;
1255
- return M(t) ? t : n === "a" ? { ...t, a: F(t.a, o, r) } : { ...t, b: F(t.b, o, r) };
1256
+ return _(t) ? t : n === "a" ? { ...t, a: j(t.a, o, r) } : { ...t, b: j(t.b, o, r) };
1256
1257
  }, U = (t, e, r = []) => {
1257
- if (M(t))
1258
+ if (_(t))
1258
1259
  return t.groupId === e ? { splitPath: null, side: null } : null;
1259
- if (M(t.a) && t.a.groupId === e)
1260
+ if (_(t.a) && t.a.groupId === e)
1260
1261
  return { splitPath: r, side: "a" };
1261
- if (M(t.b) && t.b.groupId === e)
1262
+ if (_(t.b) && t.b.groupId === e)
1262
1263
  return { splitPath: r, side: "b" };
1263
1264
  const n = U(t.a, e, [...r, "a"]);
1264
1265
  return n || U(t.b, e, [...r, "b"]);
1265
- }, It = (t, e, r, n) => {
1266
+ }, wt = (t, e, r, n) => {
1266
1267
  const o = n(), s = U(t, e), a = {
1267
1268
  type: "split",
1268
1269
  direction: r,
@@ -1272,26 +1273,26 @@ const fe = (t, e) => {
1272
1273
  };
1273
1274
  if (!s || s.splitPath === null)
1274
1275
  return { tree: a, newGroupId: o };
1275
- const i = s.splitPath, c = W(t, i);
1276
- if (M(c))
1276
+ const i = s.splitPath, c = q(t, i);
1277
+ if (_(c))
1277
1278
  return { tree: a, newGroupId: o };
1278
1279
  const u = s.side === "a" ? { ...c, a } : { ...c, b: a };
1279
- return { tree: F(t, i, u), newGroupId: o };
1280
- }, Me = (t, e) => {
1280
+ return { tree: j(t, i, u), newGroupId: o };
1281
+ }, Le = (t, e) => {
1281
1282
  const r = U(t, e);
1282
1283
  if (!r || r.splitPath === null)
1283
1284
  return { tree: t, survivorGroupId: e };
1284
- const n = r.splitPath, o = W(t, n);
1285
- if (M(o))
1285
+ const n = r.splitPath, o = q(t, n);
1286
+ if (_(o))
1286
1287
  return { tree: t, survivorGroupId: e };
1287
- const s = r.side === "a" ? o.b : o.a, a = F(t, n, s), i = M(s) ? s.groupId : Y(s)[0] ?? null;
1288
+ const s = r.side === "a" ? o.b : o.a, a = j(t, n, s), i = _(s) ? s.groupId : F(s)[0] ?? null;
1288
1289
  return { tree: a, survivorGroupId: i };
1289
- }, Oe = (t, e, r) => {
1290
- const n = W(t, e);
1291
- if (M(n))
1290
+ }, He = (t, e, r) => {
1291
+ const n = q(t, e);
1292
+ if (_(n))
1292
1293
  return t;
1293
- const o = { ...n, ratio: _(r, 0.05, 0.95) };
1294
- return F(t, e, o);
1294
+ const o = { ...n, ratio: M(r, 0.05, 0.95) };
1295
+ return j(t, e, o);
1295
1296
  }, Q = (t) => {
1296
1297
  if (Object.keys(t.groups).filter((o) => t.groups[o].tabIds.length === 0).length === 0)
1297
1298
  return t;
@@ -1299,29 +1300,29 @@ const fe = (t, e) => {
1299
1300
  const a = o.groups[s];
1300
1301
  if (!a || a.tabs.length > 0 || Object.keys(o.groups).length <= 1)
1301
1302
  return o;
1302
- const { tree: c, survivorGroupId: u } = Me(o.tree, s), { [s]: d, ...g } = o.groups, v = Y(c), T = o.focusedGroupId === s ? u ?? v[0] ?? null : o.focusedGroupId;
1303
- return { ...o, tree: c, groups: g, groupOrder: v, focusedGroupId: T };
1303
+ const { tree: c, survivorGroupId: u } = Le(o.tree, s), { [s]: d, ...f } = o.groups, g = F(c), y = o.focusedGroupId === s ? u ?? g[0] ?? null : o.focusedGroupId;
1304
+ return { ...o, tree: c, groups: f, groupOrder: g, focusedGroupId: y };
1304
1305
  };
1305
1306
  return t.groupOrder.reduce((o, s) => n(o, s), t);
1306
- }, Be = (t) => ({ id: t, tabIds: [], tabs: [], activeTabId: null }), it = (t, e, r, n) => {
1307
+ }, Ne = (t) => ({ id: t, tabIds: [], tabs: [], activeTabId: null }), at = (t, e, r, n) => {
1307
1308
  const o = { ...t.groups }, s = o[e];
1308
1309
  if (!s)
1309
1310
  throw new Error(`Group ${e} does not exist.`);
1310
- const a = { ...t.panels, [r.id]: r }, i = [...s.tabIds, r.id], c = n ? r.id : s.activeTabId ?? r.id, u = i.map((g) => a[g]), d = { ...s, tabIds: i, tabs: u, activeTabId: c };
1311
+ const a = { ...t.panels, [r.id]: r }, i = [...s.tabIds, r.id], c = n ? r.id : s.activeTabId ?? r.id, u = i.map((f) => a[f]), d = { ...s, tabIds: i, tabs: u, activeTabId: c };
1311
1312
  return o[e] = d, { ...t, panels: a, groups: o };
1312
- }, Le = (t, e, r) => {
1313
+ }, $e = (t, e, r) => {
1313
1314
  const n = { ...t.groups }, o = n[e];
1314
1315
  if (!o)
1315
1316
  throw new Error(`Group ${e} does not exist.`);
1316
1317
  const s = o.tabIds.filter((c) => c !== r), a = s.map((c) => t.panels[c]), i = o.activeTabId === r ? s[0] ?? null : o.activeTabId;
1317
1318
  return n[e] = { ...o, tabIds: s, tabs: a, activeTabId: i }, { ...t, groups: n };
1318
- }, at = (t, e, r, n, o) => {
1319
+ }, ct = (t, e, r, n, o) => {
1319
1320
  const s = t.groups[e], a = t.groups[r];
1320
1321
  if (!s || !a)
1321
1322
  throw new Error("moveTab: source or target group is missing.");
1322
- const i = { ...t.groups }, c = s.tabIds.filter((g) => g !== n), u = [...a.tabIds.filter((g) => g !== n), n], d = s.activeTabId === n ? c[0] ?? null : s.activeTabId;
1323
- return i[e] = { ...s, tabIds: c, tabs: c.map((g) => t.panels[g]), activeTabId: d }, i[r] = { ...a, tabIds: u, tabs: u.map((g) => t.panels[g]), activeTabId: n }, { ...t, groups: i };
1324
- }, wt = (t, e, r) => {
1323
+ const i = { ...t.groups }, c = s.tabIds.filter((f) => f !== n), u = [...a.tabIds.filter((f) => f !== n), n], d = s.activeTabId === n ? c[0] ?? null : s.activeTabId;
1324
+ return i[e] = { ...s, tabIds: c, tabs: c.map((f) => t.panels[f]), activeTabId: d }, i[r] = { ...a, tabIds: u, tabs: u.map((f) => t.panels[f]), activeTabId: n }, { ...t, groups: i };
1325
+ }, yt = (t, e, r) => {
1325
1326
  const n = t.groups[e];
1326
1327
  if (!n)
1327
1328
  throw new Error(`setActiveTab: group ${e} not found.`);
@@ -1329,85 +1330,85 @@ const fe = (t, e) => {
1329
1330
  throw new Error(`setActiveTab: tab ${r} not found in group ${e}.`);
1330
1331
  const o = { ...t.groups, [e]: { ...n, activeTabId: r } };
1331
1332
  return { ...t, groups: o, focusedGroupId: e };
1332
- }, ct = (t, e, r, n, o) => {
1333
+ }, ut = (t, e, r, n, o) => {
1333
1334
  const s = t.groups[e];
1334
1335
  if (!s)
1335
1336
  throw new Error(`addTabToGroupAtIndex: group ${e} not found.`);
1336
1337
  const a = { ...t.panels, [r.id]: r }, i = s.tabIds.slice(), c = Math.max(0, Math.min(n, i.length));
1337
1338
  i.splice(c, 0, r.id);
1338
- const u = i.map((v) => a[v]), d = o ? r.id : s.activeTabId ?? r.id, g = { ...t.groups, [e]: { ...s, tabIds: i, tabs: u, activeTabId: d } };
1339
- return { ...t, panels: a, groups: g };
1340
- }, $ = (t, e) => {
1339
+ const u = i.map((g) => a[g]), d = o ? r.id : s.activeTabId ?? r.id, f = { ...t.groups, [e]: { ...s, tabIds: i, tabs: u, activeTabId: d } };
1340
+ return { ...t, panels: a, groups: f };
1341
+ }, N = (t, e) => {
1341
1342
  if (!t.groups[e])
1342
1343
  throw new Error(`setFocusedGroup: group ${e} not found.`);
1343
1344
  return { ...t, focusedGroupId: e };
1344
- }, $e = (t, e) => {
1345
+ }, ze = (t, e) => {
1345
1346
  const r = e - 1, n = t.groupOrder[r];
1346
- return n ? $(t, n) : t;
1347
- }, He = (t) => {
1347
+ return n ? N(t, n) : t;
1348
+ }, Xe = (t) => {
1348
1349
  const e = t.groupOrder, r = t.focusedGroupId;
1349
1350
  if (!r) {
1350
1351
  const s = e[0];
1351
- return s ? $(t, s) : t;
1352
+ return s ? N(t, s) : t;
1352
1353
  }
1353
1354
  const n = e.indexOf(r), o = e[(n + 1) % e.length];
1354
- return $(t, o);
1355
- }, Ne = (t) => {
1355
+ return N(t, o);
1356
+ }, Ye = (t) => {
1356
1357
  const e = t.groupOrder, r = t.focusedGroupId;
1357
1358
  if (!r) {
1358
1359
  const s = e[e.length - 1];
1359
- return s ? $(t, s) : t;
1360
+ return s ? N(t, s) : t;
1360
1361
  }
1361
1362
  const n = e.indexOf(r), o = e[(n - 1 + e.length) % e.length];
1362
- return $(t, o);
1363
- }, yt = (t, e, r, n) => {
1364
- const { tree: o, newGroupId: s } = It(t.tree, e, r, n), a = { ...t.groups, [s]: Be(s) }, i = Y(o);
1363
+ return N(t, o);
1364
+ }, Tt = (t, e, r, n) => {
1365
+ const { tree: o, newGroupId: s } = wt(t.tree, e, r, n), a = { ...t.groups, [s]: Ne(s) }, i = F(o);
1365
1366
  return { ...t, tree: o, groups: a, groupOrder: i, focusedGroupId: s };
1366
- }, br = (t) => {
1367
+ }, Gr = (t) => {
1367
1368
  const r = { type: "group", groupId: "g_1" }, n = Object.fromEntries(t.map((i) => [i.id, i])), s = { g_1: { id: "g_1", tabIds: t.map((i) => i.id), tabs: t, activeTabId: t[0]?.id ?? null } };
1368
1369
  return { tree: r, panels: n, groups: s, groupOrder: ["g_1"], focusedGroupId: "g_1" };
1369
- }, ze = l.createContext(null), Xe = ({ value: t, children: e }) => /* @__PURE__ */ m(ze.Provider, { value: t, children: e }), Tt = l.createContext(null), Ye = () => {
1370
- const t = l.useContext(Tt);
1370
+ }, Fe = l.createContext(null), je = ({ value: t, children: e }) => /* @__PURE__ */ m(Fe.Provider, { value: t, children: e }), xt = l.createContext(null), Ke = () => {
1371
+ const t = l.useContext(xt);
1371
1372
  if (!t)
1372
1373
  throw new Error("useTree must be used within TreeProvider");
1373
1374
  return t;
1374
- }, Fe = ({ value: t, children: e }) => /* @__PURE__ */ m(Tt.Provider, { value: t, children: e }), je = l.createContext(null), Ve = ({ value: t, children: e }) => /* @__PURE__ */ m(je.Provider, { value: t, children: e }), z = (t) => {
1375
- const e = kt(t, Number.POSITIVE_INFINITY);
1376
- return _(e, 1);
1377
- }, Ke = (t) => typeof t == "object" && t !== null, Ue = (t) => Ke(t) ? "rows" in t ? !0 : "cols" in t : !1, Gt = (t) => {
1375
+ }, Ve = ({ value: t, children: e }) => /* @__PURE__ */ m(xt.Provider, { value: t, children: e }), Ue = l.createContext(null), We = ({ value: t, children: e }) => /* @__PURE__ */ m(Ue.Provider, { value: t, children: e }), X = (t) => {
1376
+ const e = _t(t, Number.POSITIVE_INFINITY);
1377
+ return M(e, 1);
1378
+ }, qe = (t) => typeof t == "object" && t !== null, Ze = (t) => qe(t) ? "rows" in t ? !0 : "cols" in t : !1, Gt = (t) => {
1378
1379
  if (!t)
1379
1380
  return {
1380
1381
  rows: Number.POSITIVE_INFINITY,
1381
1382
  cols: Number.POSITIVE_INFINITY
1382
1383
  };
1383
1384
  if (typeof t == "number") {
1384
- const r = z(t);
1385
+ const r = X(t);
1385
1386
  return { rows: r, cols: r };
1386
1387
  }
1387
- if (Ue(t))
1388
+ if (Ze(t))
1388
1389
  return {
1389
- rows: z(t.rows),
1390
- cols: z(t.cols)
1390
+ rows: X(t.rows),
1391
+ cols: X(t.cols)
1391
1392
  };
1392
1393
  const e = t;
1393
1394
  return {
1394
- rows: z(e.maxHorizontal),
1395
- cols: z(e.maxVertical)
1395
+ rows: X(e.maxHorizontal),
1396
+ cols: X(e.maxVertical)
1396
1397
  };
1397
1398
  }, tt = (t) => {
1398
- if (M(t))
1399
+ if (_(t))
1399
1400
  return { horizontal: 1, vertical: 1 };
1400
1401
  const e = tt(t.a), r = tt(t.b);
1401
1402
  return t.direction === "horizontal" ? { horizontal: e.horizontal + r.horizontal, vertical: Math.max(e.vertical, r.vertical) } : { horizontal: Math.max(e.horizontal, r.horizontal), vertical: e.vertical + r.vertical };
1402
- }, qe = (t, e, r) => {
1403
- const { tree: n } = It(t, e, r, () => "__preview__");
1403
+ }, Je = (t, e, r) => {
1404
+ const { tree: n } = wt(t, e, r, () => "__preview__");
1404
1405
  return n;
1405
- }, rt = (t, e, r, n) => {
1406
+ }, nt = (t, e, r, n) => {
1406
1407
  if (!Number.isFinite(n.rows) && !Number.isFinite(n.cols))
1407
1408
  return !0;
1408
- const o = qe(t, e, r), s = tt(o);
1409
+ const o = Je(t, e, r), s = tt(o);
1409
1410
  return !(s.horizontal > n.rows || s.vertical > n.cols);
1410
- }, xt = {
1411
+ }, St = {
1411
1412
  splitFocused: A("panelState/splitFocused", (t) => ({ direction: t })),
1412
1413
  focusGroupIndex: A("panelState/focusGroupIndex", (t) => ({ index1Based: t })),
1413
1414
  focusNextGroup: A("panelState/focusNextGroup"),
@@ -1431,79 +1432,79 @@ const fe = (t, e) => {
1431
1432
  (t) => t
1432
1433
  ),
1433
1434
  adjustSplitRatio: A("panelState/adjustSplitRatio", (t) => t)
1434
- }, We = (t, e, r) => {
1435
+ }, Qe = (t, e, r) => {
1435
1436
  const n = t.groups[e.fromGroupId], o = t.groups[e.targetGroupId];
1436
- if (!n || !o || !n.tabs.find((g) => g.id === e.tabId))
1437
+ if (!n || !o || !n.tabs.find((f) => f.id === e.tabId))
1437
1438
  return t;
1438
1439
  if (e.zone === "center" && e.fromGroupId === e.targetGroupId)
1439
- return wt(t, e.fromGroupId, e.tabId);
1440
+ return yt(t, e.fromGroupId, e.tabId);
1440
1441
  if (e.zone === "center") {
1441
- const g = at(t, e.fromGroupId, e.targetGroupId, e.tabId);
1442
- return $(g, e.targetGroupId);
1442
+ const f = ct(t, e.fromGroupId, e.targetGroupId, e.tabId);
1443
+ return N(f, e.targetGroupId);
1443
1444
  }
1444
1445
  const a = e.zone === "left" || e.zone === "right" ? "vertical" : "horizontal";
1445
- if (!rt(t.tree, e.targetGroupId, a, r.splitLimits))
1446
+ if (!nt(t.tree, e.targetGroupId, a, r.splitLimits))
1446
1447
  return t;
1447
- const i = r.createGroupId(), c = yt(t, e.targetGroupId, a, () => i), u = e.zone === "left" || e.zone === "top" ? e.targetGroupId : i, d = at(c, e.fromGroupId, u, e.tabId);
1448
- return $(d, u);
1449
- }, Ze = (t, e) => {
1448
+ const i = r.createGroupId(), c = Tt(t, e.targetGroupId, a, () => i), u = e.zone === "left" || e.zone === "top" ? e.targetGroupId : i, d = ct(c, e.fromGroupId, u, e.tabId);
1449
+ return N(d, u);
1450
+ }, tr = (t, e) => {
1450
1451
  const r = t.groups[e.fromGroupId], n = t.groups[e.targetGroupId];
1451
1452
  if (!r || !n || !t.panels[e.tabId])
1452
1453
  return t;
1453
1454
  if (e.fromGroupId === e.targetGroupId) {
1454
- const v = r.tabIds.filter((y) => y !== e.tabId), T = Math.max(0, Math.min(e.targetIndex, v.length)), h = v.slice(0, T).concat([e.tabId], v.slice(T)), w = h.map((y) => t.panels[y]).filter(Boolean), b = { ...t.groups, [e.fromGroupId]: { ...r, tabIds: h, tabs: w } };
1455
- return { ...t, groups: b };
1455
+ const g = r.tabIds.filter((T) => T !== e.tabId), y = Math.max(0, Math.min(e.targetIndex, g.length)), h = g.slice(0, y).concat([e.tabId], g.slice(y)), w = h.map((T) => t.panels[T]).filter(Boolean), I = { ...t.groups, [e.fromGroupId]: { ...r, tabIds: h, tabs: w } };
1456
+ return { ...t, groups: I };
1456
1457
  }
1457
- const s = { ...t.groups }, a = r.tabIds.filter((v) => v !== e.tabId), i = a.map((v) => t.panels[v]);
1458
+ const s = { ...t.groups }, a = r.tabIds.filter((g) => g !== e.tabId), i = a.map((g) => t.panels[g]);
1458
1459
  s[e.fromGroupId] = {
1459
1460
  ...r,
1460
1461
  tabIds: a,
1461
1462
  tabs: i,
1462
1463
  activeTabId: r.activeTabId === e.tabId ? i[0]?.id ?? null : r.activeTabId
1463
1464
  };
1464
- const c = n.tabIds.filter((v) => v !== e.tabId), u = Math.max(0, Math.min(e.targetIndex, c.length)), d = c.slice(0, u).concat([e.tabId], c.slice(u)), g = d.map((v) => t.panels[v]).filter(Boolean);
1465
- return s[e.targetGroupId] = { ...n, tabIds: d, tabs: g, activeTabId: e.tabId }, { ...t, groups: s, focusedGroupId: e.targetGroupId };
1466
- }, Je = ht(xt, {
1465
+ const c = n.tabIds.filter((g) => g !== e.tabId), u = Math.max(0, Math.min(e.targetIndex, c.length)), d = c.slice(0, u).concat([e.tabId], c.slice(u)), f = d.map((g) => t.panels[g]).filter(Boolean);
1466
+ return s[e.targetGroupId] = { ...n, tabIds: d, tabs: f, activeTabId: e.tabId }, { ...t, groups: s, focusedGroupId: e.targetGroupId };
1467
+ }, er = mt(St, {
1467
1468
  splitFocused: (t, e, r) => {
1468
1469
  const n = t.focusedGroupId ?? t.groupOrder[0] ?? null;
1469
- return !n || !rt(t.tree, n, e.payload.direction, r.splitLimits) ? t : yt(t, n, e.payload.direction, r.createGroupId);
1470
+ return !n || !nt(t.tree, n, e.payload.direction, r.splitLimits) ? t : Tt(t, n, e.payload.direction, r.createGroupId);
1470
1471
  },
1471
- focusGroupIndex: (t, e) => $e(t, e.payload.index1Based),
1472
- focusNextGroup: (t) => He(t),
1473
- focusPrevGroup: (t) => Ne(t),
1474
- setActiveTab: (t, e) => wt(t, e.payload.groupId, e.payload.tabId),
1472
+ focusGroupIndex: (t, e) => ze(t, e.payload.index1Based),
1473
+ focusNextGroup: (t) => Xe(t),
1474
+ focusPrevGroup: (t) => Ye(t),
1475
+ setActiveTab: (t, e) => yt(t, e.payload.groupId, e.payload.tabId),
1475
1476
  addTab: (t, e) => {
1476
1477
  const { groupId: r, tab: n, index: o, makeActive: s } = e.payload;
1477
- return typeof o == "number" ? ct(t, r, n, o, s ?? !0) : it(t, r, n, s ?? !0);
1478
+ return typeof o == "number" ? ut(t, r, n, o, s ?? !0) : at(t, r, n, s ?? !0);
1478
1479
  },
1479
1480
  addNewTab: (t, e, r) => {
1480
1481
  if (!r.createPanelId)
1481
1482
  throw new Error("addNewTab requires PanelSystemProvider.createPanelId");
1482
1483
  const o = { id: r.createPanelId(), title: e.payload.title, render: () => e.payload.title }, { groupId: s, index: a, makeActive: i } = e.payload;
1483
- return typeof a == "number" ? ct(t, s, o, a, i ?? !0) : it(t, s, o, i ?? !0);
1484
+ return typeof a == "number" ? ut(t, s, o, a, i ?? !0) : at(t, s, o, i ?? !0);
1484
1485
  },
1485
- removeTab: (t, e) => Le(t, e.payload.groupId, e.payload.tabId),
1486
- contentDrop: (t, e, r) => We(t, e.payload, r),
1487
- tabDrop: (t, e) => Ze(t, e.payload),
1486
+ removeTab: (t, e) => $e(t, e.payload.groupId, e.payload.tabId),
1487
+ contentDrop: (t, e, r) => Qe(t, e.payload, r),
1488
+ tabDrop: (t, e) => tr(t, e.payload),
1488
1489
  adjustSplitRatio: (t, e) => {
1489
- const r = W(t.tree, e.payload.path);
1490
- if (M(r))
1490
+ const r = q(t.tree, e.payload.path);
1491
+ if (_(r))
1491
1492
  return t;
1492
- const n = Oe(t.tree, e.payload.path, r.ratio + e.payload.deltaRatio);
1493
+ const n = He(t.tree, e.payload.path, r.ratio + e.payload.deltaRatio);
1493
1494
  return { ...t, tree: n };
1494
1495
  }
1495
- }), ut = (t, e, r) => {
1496
- const n = Je[e.type];
1496
+ }), lt = (t, e, r) => {
1497
+ const n = er[e.type];
1497
1498
  if (!n)
1498
1499
  return t;
1499
1500
  const o = n(t, e, r);
1500
1501
  return Q(o);
1501
- }, St = l.createContext(null), j = () => {
1502
- const t = l.useContext(St);
1502
+ }, Et = l.createContext(null), z = () => {
1503
+ const t = l.useContext(Et);
1503
1504
  if (!t)
1504
1505
  throw new Error("usePanelSystem must be used within PanelSystemProvider");
1505
1506
  return t;
1506
- }, Qe = ({
1507
+ }, rr = ({
1507
1508
  initialState: t,
1508
1509
  createGroupId: e,
1509
1510
  createPanelId: r,
@@ -1514,53 +1515,53 @@ const fe = (t, e) => {
1514
1515
  }) => {
1515
1516
  const i = l.useMemo(() => Q(t), [t]), c = l.useMemo(() => Gt(s), [s]), u = l.useRef({ createGroupId: e, splitLimits: c, createPanelId: r });
1516
1517
  u.current.createGroupId = e, u.current.splitLimits = c, u.current.createPanelId = r;
1517
- const [d, g] = l.useReducer(
1518
- (G, E) => ut(G, E, u.current),
1518
+ const [d, f] = l.useReducer(
1519
+ (x, E) => lt(x, E, u.current),
1519
1520
  i
1520
- ), v = l.useMemo(
1521
+ ), g = l.useMemo(
1521
1522
  () => n ? Q(n) : d,
1522
1523
  [n, d]
1523
- ), T = l.useRef(v);
1524
- T.current = v;
1524
+ ), y = l.useRef(g);
1525
+ y.current = g;
1525
1526
  const h = n !== void 0, w = l.useCallback(
1526
- (G) => {
1527
+ (x) => {
1527
1528
  if (h) {
1528
- const E = ut(T.current, G, u.current);
1529
+ const E = lt(y.current, x, u.current);
1529
1530
  o?.(E);
1530
1531
  return;
1531
1532
  }
1532
- g(G);
1533
+ f(x);
1533
1534
  },
1534
- [h, o, g]
1535
- ), b = l.useMemo(() => fe(xt, w), [w]), y = l.useMemo(
1535
+ [h, o, f]
1536
+ ), I = l.useMemo(() => he(St, w), [w]), T = l.useMemo(
1536
1537
  () => ({
1537
- setActiveTab: b.setActiveTab,
1538
- tabDrop: b.tabDrop
1538
+ setActiveTab: I.setActiveTab,
1539
+ tabDrop: I.tabDrop
1539
1540
  }),
1540
- [b]
1541
- ), f = l.useMemo(
1541
+ [I]
1542
+ ), b = l.useMemo(
1542
1543
  () => ({
1543
- adjustSplitRatio: b.adjustSplitRatio
1544
+ adjustSplitRatio: I.adjustSplitRatio
1544
1545
  }),
1545
- [b]
1546
- ), I = l.useMemo(
1546
+ [I]
1547
+ ), v = l.useMemo(
1547
1548
  () => ({
1548
- focusGroupIndex: b.focusGroupIndex,
1549
- focusNextGroup: b.focusNextGroup,
1550
- focusPrevGroup: b.focusPrevGroup
1549
+ focusGroupIndex: I.focusGroupIndex,
1550
+ focusNextGroup: I.focusNextGroup,
1551
+ focusPrevGroup: I.focusPrevGroup
1551
1552
  }),
1552
- [b]
1553
+ [I]
1553
1554
  ), p = l.useMemo(
1554
1555
  () => ({
1555
- state: v,
1556
+ state: g,
1556
1557
  dispatch: w,
1557
- actions: b
1558
+ actions: I
1558
1559
  }),
1559
- [v, w, b]
1560
+ [g, w, I]
1560
1561
  );
1561
- return /* @__PURE__ */ m(St.Provider, { value: p, children: /* @__PURE__ */ m(Xe, { value: y, children: /* @__PURE__ */ m(Fe, { value: f, children: /* @__PURE__ */ m(Ve, { value: I, children: a }) }) }) });
1562
- }, tr = () => {
1563
- const { actions: t } = j();
1562
+ return /* @__PURE__ */ m(Et.Provider, { value: p, children: /* @__PURE__ */ m(je, { value: T, children: /* @__PURE__ */ m(Ve, { value: b, children: /* @__PURE__ */ m(We, { value: v, children: a }) }) }) });
1563
+ }, nr = () => {
1564
+ const { actions: t } = z();
1564
1565
  return l.useMemo(
1565
1566
  () => ({
1566
1567
  splitFocused: (e) => {
@@ -1580,8 +1581,8 @@ const fe = (t, e) => {
1580
1581
  }),
1581
1582
  [t]
1582
1583
  );
1583
- }, er = () => {
1584
- const { actions: t } = j(), e = l.useCallback(
1584
+ }, or = () => {
1585
+ const { actions: t } = z(), e = l.useCallback(
1585
1586
  ({ fromGroupId: n, tabId: o, targetGroupId: s, zone: a }) => {
1586
1587
  t.contentDrop({ fromGroupId: n, tabId: o, targetGroupId: s, zone: a });
1587
1588
  },
@@ -1593,87 +1594,159 @@ const fe = (t, e) => {
1593
1594
  [t]
1594
1595
  );
1595
1596
  return { onCommitContentDrop: e, onCommitTabDrop: r };
1596
- }, rr = () => {
1597
- const t = Jt(), e = tr();
1597
+ }, sr = () => {
1598
+ const t = ee(), e = nr();
1598
1599
  return l.useEffect(() => {
1599
- ee(t, e);
1600
+ oe(t, e);
1600
1601
  }, [t, e]), null;
1601
- }, nr = ({
1602
+ }, Ct = l.createContext(null), ir = () => {
1603
+ const t = l.useContext(Ct);
1604
+ if (!t)
1605
+ throw new Error("useContentRegistry must be used within ContentRegistryProvider");
1606
+ return t;
1607
+ }, ar = (t) => {
1608
+ const e = document.createElement("div");
1609
+ return e.setAttribute("data-panel-wrapper", t), e.style.display = "contents", e;
1610
+ }, cr = (t, e, r) => {
1611
+ const [n] = l.useState(() => ar(t));
1612
+ return rt(() => (n.style.display = r ? "contents" : "none", e && n.parentElement !== e && e.appendChild(n), () => {
1613
+ n.parentElement?.removeChild(n);
1614
+ }), [n, e, r]), n;
1615
+ }, Rt = l.memo(
1616
+ ({ panelId: t, content: e, placement: r, containerElement: n }) => {
1617
+ const o = r?.isActive ?? !1, s = cr(t, n, o);
1618
+ return Qt(
1619
+ /* @__PURE__ */ m(l.Activity, { mode: o ? "visible" : "hidden", children: e }),
1620
+ s
1621
+ );
1622
+ }
1623
+ );
1624
+ Rt.displayName = "PanelContentHost";
1625
+ const ur = ({
1626
+ children: t,
1627
+ panels: e,
1628
+ placements: r
1629
+ }) => {
1630
+ const [n, o] = l.useState(/* @__PURE__ */ new Map()), s = l.useRef(/* @__PURE__ */ new Map()), a = l.useCallback((d, f) => {
1631
+ o((g) => {
1632
+ const y = new Map(g);
1633
+ return f ? y.set(d, f) : y.delete(d), y;
1634
+ });
1635
+ }, []), i = l.useMemo(
1636
+ () => ({ registerContentContainer: a }),
1637
+ [a]
1638
+ ), c = l.useCallback((d, f) => {
1639
+ const g = s.current.get(d);
1640
+ if (g)
1641
+ return g;
1642
+ const y = f.render(f.id);
1643
+ return s.current.set(d, y), y;
1644
+ }, []), u = Object.keys(e);
1645
+ return /* @__PURE__ */ H(Ct.Provider, { value: i, children: [
1646
+ t,
1647
+ u.map((d) => {
1648
+ const f = e[d];
1649
+ if (!f)
1650
+ return null;
1651
+ const g = r[d] ?? null, y = g ? n.get(g.groupId) ?? null : null, h = c(d, f);
1652
+ return /* @__PURE__ */ m(
1653
+ Rt,
1654
+ {
1655
+ panelId: d,
1656
+ content: h,
1657
+ placement: g,
1658
+ containerElement: y
1659
+ },
1660
+ d
1661
+ );
1662
+ })
1663
+ ] });
1664
+ }, lr = ({
1602
1665
  children: t,
1603
1666
  emptyContentComponent: e,
1604
1667
  doubleClickToAdd: r
1605
1668
  }) => {
1606
- const n = q(), { state: o, actions: s } = j(), a = l.useCallback(() => l.createElement("div", { style: { color: "#888", fontSize: 12, padding: 12 } }, "No tabs"), []), i = e ?? a, c = l.useCallback(
1607
- (b) => {
1608
- const y = o.groups[b];
1609
- if (!y)
1669
+ const n = W(), { state: o, actions: s } = z(), { registerContentContainer: a } = ir(), i = l.useCallback(() => l.createElement("div", { style: { color: "#888", fontSize: 12, padding: 12 } }, "No tabs"), []), c = e ?? i, u = l.useCallback(
1670
+ (T) => {
1671
+ const b = o.groups[T];
1672
+ if (!b)
1610
1673
  return null;
1611
- const f = y.tabIds.map((I) => o.panels[I]).filter(Boolean);
1612
- return { ...y, tabs: f };
1674
+ const v = b.tabIds.map((p) => o.panels[p]).filter(Boolean);
1675
+ return { ...b, tabs: v };
1613
1676
  },
1614
1677
  [o.groups, o.panels]
1615
- ), u = l.useCallback(
1616
- (b) => {
1617
- const y = o.groups[b];
1618
- if (!y)
1619
- return /* @__PURE__ */ m(i, {});
1620
- const f = y.activeTabId;
1621
- if (!f)
1622
- return /* @__PURE__ */ m(i, {});
1623
- const I = o.panels[f];
1624
- return I ? I.render() : /* @__PURE__ */ m(i, {});
1678
+ ), d = l.useCallback(
1679
+ (T) => {
1680
+ const b = o.groups[T];
1681
+ return !b || b.tabIds.length === 0 ? /* @__PURE__ */ m(c, {}) : null;
1625
1682
  },
1626
- [o.groups, o.panels, i]
1627
- ), d = l.useCallback((b, y) => {
1628
- s.setActiveTab(b, y);
1629
- }, [s]), g = l.useCallback((b) => {
1630
- s.addNewTab({ groupId: b, title: "New Tab", makeActive: !0 });
1631
- }, [s]), v = l.useCallback((b, y) => {
1632
- s.removeTab(b, y);
1633
- }, [s]), T = l.useCallback((b, y, f) => {
1634
- s.setActiveTab(y, b), n.onStartTabDrag(b, y, f);
1635
- }, [s, n]), h = l.useCallback((b, y) => {
1636
- const f = o.groups[b];
1637
- !f || !f.activeTabId || n.onStartContentDrag(b, f.activeTabId, y);
1638
- }, [o.groups, n]), w = l.useMemo(
1639
- () => ({ getGroup: c, getGroupContent: u, onClickTab: d, onAddTab: g, onCloseTab: v, onStartTabDrag: T, onStartContentDrag: h, doubleClickToAdd: r }),
1640
- [c, u, d, g, v, T, h, r]
1683
+ [o.groups, c]
1684
+ ), f = l.useCallback((T, b) => {
1685
+ s.setActiveTab(T, b);
1686
+ }, [s]), g = l.useCallback((T) => {
1687
+ s.addNewTab({ groupId: T, title: "New Tab", makeActive: !0 });
1688
+ }, [s]), y = l.useCallback((T, b) => {
1689
+ s.removeTab(T, b);
1690
+ }, [s]), h = l.useCallback((T, b, v) => {
1691
+ s.setActiveTab(b, T), n.onStartTabDrag(T, b, v);
1692
+ }, [s, n]), w = l.useCallback((T, b) => {
1693
+ const v = o.groups[T];
1694
+ !v || !v.activeTabId || n.onStartContentDrag(T, v.activeTabId, b);
1695
+ }, [o.groups, n]), I = l.useMemo(
1696
+ () => ({ getGroup: u, getGroupContent: d, onClickTab: f, onAddTab: g, onCloseTab: y, onStartTabDrag: h, onStartContentDrag: w, doubleClickToAdd: r, registerContentContainer: a }),
1697
+ [u, d, f, g, y, h, w, r, a]
1641
1698
  );
1642
- return /* @__PURE__ */ m(ie, { value: w, children: t });
1643
- }, X = (t, e, r, n) => {
1644
- if (M(t))
1699
+ return /* @__PURE__ */ m(ue, { value: I, children: t });
1700
+ }, dr = ({
1701
+ children: t,
1702
+ emptyContentComponent: e,
1703
+ doubleClickToAdd: r
1704
+ }) => {
1705
+ const { state: n } = z(), o = l.useMemo(() => {
1706
+ const s = {};
1707
+ for (const [a, i] of Object.entries(n.groups))
1708
+ for (const c of i.tabIds)
1709
+ s[c] = {
1710
+ groupId: a,
1711
+ isActive: c === i.activeTabId
1712
+ };
1713
+ return s;
1714
+ }, [n.groups]);
1715
+ return /* @__PURE__ */ m(ur, { panels: n.panels, placements: o, children: /* @__PURE__ */ m(lr, { emptyContentComponent: e, doubleClickToAdd: r, children: t }) });
1716
+ }, Y = (t, e, r, n) => {
1717
+ if (_(t))
1645
1718
  return n;
1646
1719
  const o = t.direction, s = o === "vertical" ? r.x + r.w * t.ratio : r.y + r.h * t.ratio;
1647
1720
  if (n.push({ path: e, direction: o, parentRect: r, linePos: s }), o === "vertical") {
1648
1721
  const c = r.w * t.ratio, u = r.w - c;
1649
- return X(t.a, [...e, "a"], { x: r.x, y: r.y, w: c, h: r.h }, n), X(t.b, [...e, "b"], { x: r.x + c, y: r.y, w: u, h: r.h }, n), n;
1722
+ return Y(t.a, [...e, "a"], { x: r.x, y: r.y, w: c, h: r.h }, n), Y(t.b, [...e, "b"], { x: r.x + c, y: r.y, w: u, h: r.h }, n), n;
1650
1723
  }
1651
1724
  const a = r.h * t.ratio, i = r.h - a;
1652
- return X(t.a, [...e, "a"], { x: r.x, y: r.y, w: r.w, h: a }, n), X(t.b, [...e, "b"], { x: r.x, y: r.y + a, w: r.w, h: i }, n), n;
1653
- }, or = ({ containerRef: t }) => {
1654
- const { state: e } = j(), { adjustSplitRatio: r } = Ye(), n = l.useMemo(() => X(e.tree, [], { x: 0, y: 0, w: 100, h: 100 }, []), [e.tree]), [o, s] = l.useState(null);
1655
- if (l.useLayoutEffect(() => {
1725
+ return Y(t.a, [...e, "a"], { x: r.x, y: r.y, w: r.w, h: a }, n), Y(t.b, [...e, "b"], { x: r.x, y: r.y + a, w: r.w, h: i }, n), n;
1726
+ }, pr = ({ containerRef: t }) => {
1727
+ const { state: e } = z(), { adjustSplitRatio: r } = Ke(), n = l.useMemo(() => Y(e.tree, [], { x: 0, y: 0, w: 100, h: 100 }, []), [e.tree]), [o, s] = l.useState(null);
1728
+ if (rt(() => {
1656
1729
  const i = t.current;
1657
1730
  if (!i)
1658
1731
  return;
1659
1732
  const c = () => {
1660
- const T = i.getBoundingClientRect();
1661
- s({ left: T.left, top: T.top, width: T.width, height: T.height });
1733
+ const y = i.getBoundingClientRect();
1734
+ s({ left: y.left, top: y.top, width: y.width, height: y.height });
1662
1735
  };
1663
1736
  c();
1664
1737
  function u() {
1665
1738
  try {
1666
- const T = window.ResizeObserver;
1667
- return typeof T == "function" ? T : null;
1739
+ const y = window.ResizeObserver;
1740
+ return typeof y == "function" ? y : null;
1668
1741
  } catch {
1669
1742
  return null;
1670
1743
  }
1671
1744
  }
1672
- const d = u(), g = d ? new d(() => c()) : null;
1673
- g && g.observe(i);
1674
- const v = () => c();
1675
- return window.addEventListener("scroll", v, !0), () => {
1676
- window.removeEventListener("scroll", v, !0), g && g.disconnect();
1745
+ const d = u(), f = d ? new d(() => c()) : null;
1746
+ f && f.observe(i);
1747
+ const g = () => c();
1748
+ return window.addEventListener("scroll", g, !0), () => {
1749
+ window.removeEventListener("scroll", g, !0), f && f.disconnect();
1677
1750
  };
1678
1751
  }, [t, e.tree]), !o)
1679
1752
  return null;
@@ -1683,7 +1756,7 @@ const fe = (t, e) => {
1683
1756
  top: o.top + o.height * i.parentRect.y / 100,
1684
1757
  width: o.width * i.parentRect.w / 100,
1685
1758
  height: o.height * i.parentRect.h / 100
1686
- }, d = Wt;
1759
+ }, d = Jt;
1687
1760
  if (i.direction === "vertical") {
1688
1761
  const h = u.left + u.width * (i.linePos - i.parentRect.x) / i.parentRect.w, w = {
1689
1762
  position: "fixed",
@@ -1694,32 +1767,32 @@ const fe = (t, e) => {
1694
1767
  cursor: "col-resize",
1695
1768
  pointerEvents: "auto"
1696
1769
  };
1697
- return /* @__PURE__ */ m("div", { style: w, children: /* @__PURE__ */ m(nt, { direction: "vertical", onResize: (y) => {
1698
- const f = o.width * i.parentRect.w / 100, I = f === 0 ? 0 : y / f;
1699
- r({ path: i.path, deltaRatio: I });
1770
+ return /* @__PURE__ */ m("div", { style: w, children: /* @__PURE__ */ m(ot, { direction: "vertical", onResize: (T) => {
1771
+ const b = o.width * i.parentRect.w / 100, v = b === 0 ? 0 : T / b;
1772
+ r({ path: i.path, deltaRatio: v });
1700
1773
  } }) }, `split-${c}`);
1701
1774
  }
1702
- const g = u.top + u.height * (i.linePos - i.parentRect.y) / i.parentRect.h, v = {
1775
+ const f = u.top + u.height * (i.linePos - i.parentRect.y) / i.parentRect.h, g = {
1703
1776
  position: "fixed",
1704
1777
  left: Math.round(u.left),
1705
- top: `calc(${Math.round(g)}px - ${d} / 2)`,
1778
+ top: `calc(${Math.round(f)}px - ${d} / 2)`,
1706
1779
  width: Math.round(u.width),
1707
1780
  height: d,
1708
1781
  cursor: "row-resize",
1709
1782
  pointerEvents: "auto"
1710
1783
  };
1711
- return /* @__PURE__ */ m("div", { style: v, children: /* @__PURE__ */ m(nt, { direction: "horizontal", onResize: (h) => {
1712
- const w = o.height * i.parentRect.h / 100, b = w === 0 ? 0 : h / w;
1713
- r({ path: i.path, deltaRatio: b });
1784
+ return /* @__PURE__ */ m("div", { style: g, children: /* @__PURE__ */ m(ot, { direction: "horizontal", onResize: (h) => {
1785
+ const w = o.height * i.parentRect.h / 100, I = w === 0 ? 0 : h / w;
1786
+ r({ path: i.path, deltaRatio: I });
1714
1787
  } }) }, `split-${c}`);
1715
1788
  };
1716
1789
  return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children: n.map((i, c) => a(i, c)) });
1717
- }, sr = {
1790
+ }, fr = {
1718
1791
  position: "relative",
1719
1792
  display: "flex",
1720
1793
  width: "100%",
1721
1794
  height: "100%"
1722
- }, ir = ({
1795
+ }, br = ({
1723
1796
  state: t,
1724
1797
  layoutMode: e,
1725
1798
  gridTracksInteractive: r,
@@ -1727,14 +1800,14 @@ const fe = (t, e) => {
1727
1800
  tabBarComponent: o,
1728
1801
  panelGroupComponent: s
1729
1802
  }) => {
1730
- const a = (c) => n ? /* @__PURE__ */ m(n, { groupId: c }) : /* @__PURE__ */ m(ye, { id: c, TabBarComponent: o, PanelGroupComponent: s });
1803
+ const a = (c) => n ? /* @__PURE__ */ m(n, { groupId: c }) : /* @__PURE__ */ m(Ge, { id: c, TabBarComponent: o, PanelGroupComponent: s });
1731
1804
  if (e === "grid") {
1732
- const c = oe(t, a, !!r);
1733
- return /* @__PURE__ */ m(ot, { config: c.config, layers: c.layers });
1805
+ const c = ae(t, a, !!r);
1806
+ return /* @__PURE__ */ m(st, { config: c.config, layers: c.layers });
1734
1807
  }
1735
- const i = ne(t, a);
1736
- return /* @__PURE__ */ m(ot, { config: i.config, layers: i.layers });
1737
- }, ar = ({
1808
+ const i = ie(t, a);
1809
+ return /* @__PURE__ */ m(st, { config: i.config, layers: i.layers });
1810
+ }, gr = ({
1738
1811
  containerRef: t,
1739
1812
  layoutMode: e,
1740
1813
  gridTracksInteractive: r,
@@ -1746,30 +1819,30 @@ const fe = (t, e) => {
1746
1819
  panelGroupComponent: c,
1747
1820
  splitLimits: u,
1748
1821
  emptyContentComponent: d,
1749
- doubleClickToAdd: g
1822
+ doubleClickToAdd: f
1750
1823
  }) => {
1751
- const { state: v } = j(), { onCommitContentDrop: T, onCommitTabDrop: h } = er(), w = l.useMemo(() => ({ ...sr, ...s }), [s]), b = l.useCallback(
1752
- ({ targetGroupId: y, zone: f }) => {
1753
- if (f === "center")
1824
+ const { state: g } = z(), { onCommitContentDrop: y, onCommitTabDrop: h } = or(), w = l.useMemo(() => ({ ...fr, ...s }), [s]), I = l.useCallback(
1825
+ ({ targetGroupId: T, zone: b }) => {
1826
+ if (b === "center")
1754
1827
  return !0;
1755
- const I = f === "left" || f === "right" ? "vertical" : "horizontal";
1756
- return rt(v.tree, y, I, u);
1828
+ const v = b === "left" || b === "right" ? "vertical" : "horizontal";
1829
+ return nt(g.tree, T, v, u);
1757
1830
  },
1758
- [v.tree, u]
1831
+ [g.tree, u]
1759
1832
  );
1760
- return /* @__PURE__ */ m(ae, { children: /* @__PURE__ */ H(
1761
- he,
1833
+ return /* @__PURE__ */ m(le, { children: /* @__PURE__ */ H(
1834
+ Ie,
1762
1835
  {
1763
1836
  containerRef: t,
1764
1837
  dragThresholdPx: n,
1765
- onCommitContentDrop: T,
1838
+ onCommitContentDrop: y,
1766
1839
  onCommitTabDrop: h,
1767
- isContentZoneAllowed: b,
1840
+ isContentZoneAllowed: I,
1768
1841
  children: [
1769
- /* @__PURE__ */ m(nr, { emptyContentComponent: d, doubleClickToAdd: g, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: w, children: /* @__PURE__ */ m(
1770
- ir,
1842
+ /* @__PURE__ */ m(dr, { emptyContentComponent: d, doubleClickToAdd: f, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: w, children: /* @__PURE__ */ m(
1843
+ br,
1771
1844
  {
1772
- state: v,
1845
+ state: g,
1773
1846
  layoutMode: e,
1774
1847
  gridTracksInteractive: r,
1775
1848
  view: o,
@@ -1777,18 +1850,18 @@ const fe = (t, e) => {
1777
1850
  panelGroupComponent: c
1778
1851
  }
1779
1852
  ) }) }),
1780
- /* @__PURE__ */ m(or, { containerRef: t }),
1781
- /* @__PURE__ */ m(cr, {})
1853
+ /* @__PURE__ */ m(pr, { containerRef: t }),
1854
+ /* @__PURE__ */ m(hr, {})
1782
1855
  ]
1783
1856
  }
1784
1857
  ) });
1785
- }, cr = () => {
1786
- const t = q();
1858
+ }, hr = () => {
1859
+ const t = W();
1787
1860
  return /* @__PURE__ */ H(et, { children: [
1788
- /* @__PURE__ */ m(Pe, { suggest: t.suggest }),
1789
- /* @__PURE__ */ m(_e, {})
1861
+ /* @__PURE__ */ m(Ae, { suggest: t.suggest }),
1862
+ /* @__PURE__ */ m(Be, {})
1790
1863
  ] });
1791
- }, gr = ({
1864
+ }, Sr = ({
1792
1865
  initialState: t,
1793
1866
  createGroupId: e,
1794
1867
  createPanelId: r,
@@ -1800,9 +1873,9 @@ const fe = (t, e) => {
1800
1873
  state: c,
1801
1874
  onStateChange: u,
1802
1875
  className: d,
1803
- style: g,
1804
- tabBarComponent: v,
1805
- panelGroupComponent: T,
1876
+ style: f,
1877
+ tabBarComponent: g,
1878
+ panelGroupComponent: y,
1806
1879
  splitLimits: h,
1807
1880
  doubleClickToAdd: w
1808
1881
  }) => {
@@ -1816,9 +1889,9 @@ const fe = (t, e) => {
1816
1889
  throw new Error("PanelSystem(layoutMode='grid') requires explicit 'gridTracksInteractive' flag.");
1817
1890
  if (s === void 0)
1818
1891
  throw new Error("PanelSystem requires explicit 'dragThresholdPx' value.");
1819
- const b = l.useRef(null), y = l.useMemo(() => Gt(h), [h]);
1892
+ const I = l.useRef(null), T = l.useMemo(() => Gt(h), [h]);
1820
1893
  return /* @__PURE__ */ m(
1821
- Qe,
1894
+ rr,
1822
1895
  {
1823
1896
  initialState: t,
1824
1897
  createGroupId: e,
@@ -1826,21 +1899,21 @@ const fe = (t, e) => {
1826
1899
  state: c,
1827
1900
  onStateChange: u,
1828
1901
  splitLimits: h,
1829
- children: /* @__PURE__ */ H(te, { children: [
1830
- /* @__PURE__ */ m(rr, {}),
1902
+ children: /* @__PURE__ */ H(ne, { children: [
1903
+ /* @__PURE__ */ m(sr, {}),
1831
1904
  /* @__PURE__ */ m(
1832
- ar,
1905
+ gr,
1833
1906
  {
1834
- containerRef: b,
1907
+ containerRef: I,
1835
1908
  layoutMode: n,
1836
1909
  gridTracksInteractive: o,
1837
1910
  dragThresholdPx: s,
1838
1911
  view: a,
1839
- style: g,
1912
+ style: f,
1840
1913
  className: d,
1841
- tabBarComponent: v,
1842
- panelGroupComponent: T,
1843
- splitLimits: y,
1914
+ tabBarComponent: g,
1915
+ panelGroupComponent: y,
1916
+ splitLimits: T,
1844
1917
  emptyContentComponent: i,
1845
1918
  doubleClickToAdd: w
1846
1919
  }
@@ -1850,14 +1923,16 @@ const fe = (t, e) => {
1850
1923
  );
1851
1924
  };
1852
1925
  export {
1853
- yr as CSS_VAR_PREFIX,
1854
- vr as Drawer,
1855
- Ir as DrawerLayers,
1856
- ot as GridLayout,
1857
- pr as HorizontalDivider,
1858
- gr as PanelSystem,
1859
- nt as ResizeHandle,
1860
- br as buildInitialState,
1861
- fr as useLayerDragHandle
1926
+ Mr as CSS_VAR_PREFIX,
1927
+ Rr as Drawer,
1928
+ Pr as DrawerLayers,
1929
+ st as GridLayout,
1930
+ Tr as HorizontalDivider,
1931
+ Sr as PanelSystem,
1932
+ ot as ResizeHandle,
1933
+ Gr as buildInitialState,
1934
+ Dr as runTransition,
1935
+ xr as useLayerDragHandle,
1936
+ Ar as useTransitionState
1862
1937
  };
1863
1938
  //# sourceMappingURL=index.js.map