@pasquelin/panels 0.3.0 → 0.3.1

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.
package/dist/index.js CHANGED
@@ -1,50 +1,50 @@
1
- import { jsx as u, jsxs as g, Fragment as A } from "react/jsx-runtime";
2
- import F, { useEffect as nn, useLayoutEffect as kn, useState as W, useMemo as w, useContext as tn, createContext as en, useRef as H, useCallback as _, memo as Sn, Fragment as Dn, Children as jn, isValidElement as Hn } from "react";
1
+ import { jsx as u, jsxs as m, Fragment as j } from "react/jsx-runtime";
2
+ import H, { useEffect as tn, useLayoutEffect as Bn, useState as J, useMemo as w, useContext as en, createContext as on, useRef as Z, useCallback as N, memo as Sn, Fragment as kn, Children as Dn, isValidElement as Hn } from "react";
3
3
  import { c as b } from "./cx-CcykAxZN.js";
4
- const an = (n) => {
4
+ const un = (n) => {
5
5
  let t;
6
6
  const e = /* @__PURE__ */ new Set(), o = (a, d) => {
7
7
  const f = typeof a == "function" ? a(t) : a;
8
8
  if (!Object.is(f, t)) {
9
- const h = t;
10
- t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((m) => m(t, h));
9
+ const p = t;
10
+ t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((g) => g(t, p));
11
11
  }
12
- }, c = () => t, i = { setState: o, getState: c, getInitialState: () => l, subscribe: (a) => (e.add(a), () => e.delete(a)) }, l = t = n(o, c, i);
13
- return i;
14
- }, Un = ((n) => n ? an(n) : an), Vn = (n) => n;
15
- function Yn(n, t = Vn) {
16
- const e = F.useSyncExternalStore(
12
+ }, l = () => t, r = { setState: o, getState: l, getInitialState: () => c, subscribe: (a) => (e.add(a), () => e.delete(a)) }, c = t = n(o, l, r);
13
+ return r;
14
+ }, jn = ((n) => n ? un(n) : un), Un = (n) => n;
15
+ function Vn(n, t = Un) {
16
+ const e = H.useSyncExternalStore(
17
17
  n.subscribe,
18
- F.useCallback(() => t(n.getState()), [n, t]),
19
- F.useCallback(() => t(n.getInitialState()), [n, t])
18
+ H.useCallback(() => t(n.getState()), [n, t]),
19
+ H.useCallback(() => t(n.getInitialState()), [n, t])
20
20
  );
21
- return F.useDebugValue(e), e;
21
+ return H.useDebugValue(e), e;
22
22
  }
23
- const U = ["left", "right", "top", "bottomLeft", "bottomRight"], Nn = ["primary", "secondary"], on = "default", $n = ["bottomLeft", "bottomRight"];
24
- function rn(n) {
23
+ const B = ["left", "right", "top", "bottomLeft", "bottomRight"], Pn = ["primary", "secondary"], rn = "default", Wn = ["bottomLeft", "bottomRight"];
24
+ function sn(n) {
25
25
  return n === "bottomLeft" || n === "bottomRight";
26
26
  }
27
- function M(n) {
28
- return n === "top" || rn(n);
27
+ function T(n) {
28
+ return n === "top" || sn(n);
29
29
  }
30
- const G = {
30
+ const X = {
31
31
  left: { column: ["left", "top"], band: "bottomLeft" },
32
32
  right: { column: ["right"], band: "bottomRight" }
33
33
  };
34
- function un(n) {
34
+ function dn(n) {
35
35
  return n === "left" || n === "top";
36
36
  }
37
- const B = 140, Pn = 240, Z = 100, Wn = {
37
+ const U = 140, Nn = 240, z = 100, Yn = {
38
38
  left: 320,
39
39
  right: 260,
40
40
  top: 180,
41
41
  bottomLeft: 240,
42
42
  bottomRight: 240
43
43
  }, _n = "bottomRight";
44
- function k(n) {
45
- return rn(n) ? _n : n;
44
+ function V(n) {
45
+ return sn(n) ? _n : n;
46
46
  }
47
- const x = {
47
+ const C = {
48
48
  left: "right",
49
49
  right: "left",
50
50
  // The band as a whole faces the top strip: either half of it takes the same height off.
@@ -55,113 +55,118 @@ const x = {
55
55
  function In(n, t, e) {
56
56
  return Math.min(Math.max(n, t), e);
57
57
  }
58
- function xn(n, t, e) {
59
- const o = Math.max(B, Math.round(t - e - Pn));
60
- return In(Math.round(n), B, o);
58
+ function En(n, t, e) {
59
+ const o = Math.max(U, Math.round(t - e - Nn));
60
+ return In(Math.round(n), U, o);
61
61
  }
62
- function D(n, t) {
63
- const e = Math.max(Z, Math.round(t - Z));
64
- return In(Math.round(n), Z, e);
62
+ function W(n, t) {
63
+ const e = Math.max(z, Math.round(t - z));
64
+ return In(Math.round(n), z, e);
65
65
  }
66
- function Cn(n, t, e, o) {
67
- return e(t) ? n.sizes[k(t)] ?? o(t) : 0;
66
+ function xn(n, t, e, o) {
67
+ return e(t) ? n.sizes[V(t)] ?? o(t) : 0;
68
68
  }
69
- function Gn(n, t, e, o, c) {
70
- const s = { ...n.sizes }, r = { ...n.splits };
71
- for (const l of U) {
72
- const a = s[l];
69
+ function $n(n, t, e, o, l) {
70
+ const s = { ...n.sizes }, i = { ...n.splits };
71
+ for (const c of B) {
72
+ const a = s[c];
73
73
  if (a !== void 0) {
74
- const f = M(l) ? e : t, h = Cn(n, x[l], o, c);
75
- s[l] = xn(a, f, h);
74
+ const f = T(c) ? e : t, p = xn(n, C[c], o, l);
75
+ s[c] = En(a, f, p);
76
76
  }
77
- const d = r[l];
78
- d !== void 0 && (r[l] = D(d, M(l) ? t : e));
77
+ const d = i[c];
78
+ d !== void 0 && (i[c] = W(d, T(c) ? t : e));
79
79
  }
80
- const i = n.bandSplit === void 0 ? void 0 : D(n.bandSplit, t);
81
- return { sizes: s, splits: r, bandSplit: i };
82
- }
83
- function Jn(n, t, e) {
84
- const o = e - Pn, c = n + t;
85
- if (c <= o) return [n, t];
86
- const s = (a) => a === 0 ? 0 : B, r = s(n) + s(t);
87
- if (o <= r)
80
+ const r = n.bandSplit === void 0 ? void 0 : W(n.bandSplit, t);
81
+ return { sizes: s, splits: i, bandSplit: r };
82
+ }
83
+ function Gn(n, t, e) {
84
+ const o = e - Nn, l = n + t;
85
+ if (l <= o) return [n, t];
86
+ const s = (a) => a === 0 ? 0 : U, i = s(n) + s(t);
87
+ if (o <= i)
88
88
  return [Math.min(n, s(n)), Math.min(t, s(t))];
89
- const i = o / c, l = Math.max(s(n), Math.round(n * i));
90
- return [l, Math.max(s(t), Math.round(o - l))];
89
+ const r = o / l, c = Math.max(s(n), Math.round(n * r));
90
+ return [c, Math.max(s(t), Math.round(o - c))];
91
91
  }
92
- function z(n) {
92
+ function F(n) {
93
93
  return n.views[n.view] ?? {};
94
94
  }
95
- function $(n, t) {
95
+ function G(n, t) {
96
96
  const e = { ...t ?? {} };
97
- for (const o of U)
98
- for (const c of Nn)
99
- e[o]?.[c] === void 0 && Zn(n, o, c) !== void 0 && (e[o] = { ...e[o], [c]: null });
97
+ for (const o of B)
98
+ for (const l of Pn)
99
+ e[o]?.[l] === void 0 && Ln(n, o, l) !== void 0 && (e[o] = { ...e[o], [l]: null });
100
100
  return e;
101
101
  }
102
- function J(n, t) {
102
+ function K(n, t) {
103
103
  return Object.hasOwn(n.views, t);
104
104
  }
105
- function Zn(n, t, e) {
105
+ function Ln(n, t, e) {
106
106
  return n.find((o) => o.zone === t && o.slot === e);
107
107
  }
108
- function C(n, t) {
108
+ function M(n, t) {
109
109
  return t == null ? void 0 : n.find((e) => e.id === t);
110
110
  }
111
- function dn(n, t, e) {
112
- const o = z(n)[t];
111
+ function fn(n, t, e) {
112
+ const o = F(n)[t];
113
113
  if (!o || !(e in o)) return;
114
- const c = C(n.registry, o[e]);
115
- return c?.zone === t && c.slot === e ? c : Zn(n.registry, t, e);
114
+ const l = M(n.registry, o[e]);
115
+ return l?.zone === t && l.slot === e ? l : Ln(n.registry, t, e);
116
116
  }
117
- function E(n, t) {
118
- const e = dn(n, t, "primary");
119
- return e?.solo === !0 ? { primary: e } : { primary: e, secondary: dn(n, t, "secondary") };
117
+ function x(n, t) {
118
+ const e = fn(n, t, "primary");
119
+ return e?.solo === !0 ? { primary: e } : { primary: e, secondary: fn(n, t, "secondary") };
120
120
  }
121
- function L(n, t) {
122
- const { primary: e, secondary: o } = E(n, t);
121
+ function A(n, t) {
122
+ const { primary: e, secondary: o } = x(n, t);
123
123
  return { primary: e?.id, secondary: o?.id };
124
124
  }
125
- function X(n, t) {
126
- return rn(t) ? $n.some((e) => j(n, e)) : j(n, t);
125
+ function Y(n, t) {
126
+ return sn(t) ? Wn.some((e) => $(n, e)) : $(n, t);
127
127
  }
128
- function j(n, t) {
129
- const e = L(n, t);
128
+ function $(n, t) {
129
+ const e = A(n, t);
130
130
  return e.primary !== void 0 || e.secondary !== void 0;
131
131
  }
132
- function K(n, t) {
133
- return Math.max(Wn[n], t?.opens ?? 0);
134
- }
135
- function Xn(n, t, e, o) {
136
- const { slot: c, id: s } = e, r = z(n)[t] ?? {}, i = { ...n.stashed };
137
- if (e.solo === !0 && c === "primary")
138
- return i[t] = r, [{ [c]: s }, i];
139
- if (o?.solo !== !0) return [{ ...r, [c]: s }, n.stashed];
140
- const l = i[t];
141
- if (delete i[t], l) return [{ ...l, [c]: s }, i];
142
- const a = { ...r, [c]: s };
143
- return c !== o.slot && delete a[o.slot], [a, i];
144
- }
145
- function Kn(n, t, e) {
146
- const o = z(n)[t] ?? {}, c = o[e], s = n.stashed[t];
147
- if (s && c !== void 0 && C(n.registry, c)?.solo === !0) {
148
- const i = { ...n.stashed };
149
- return delete i[t], [s, i];
132
+ function q(n, t) {
133
+ return Math.max(Yn[n], t?.opens ?? 0);
134
+ }
135
+ function Jn(n, t, e, o) {
136
+ const { slot: l, id: s } = e, i = F(n)[t] ?? {}, r = { ...n.stashed };
137
+ if (e.solo === !0 && l === "primary")
138
+ return r[t] = i, [{ [l]: s }, r];
139
+ if (o?.solo !== !0) return [{ ...i, [l]: s }, n.stashed];
140
+ const c = r[t];
141
+ if (delete r[t], c) return [{ ...c, [l]: s }, r];
142
+ const a = { ...i, [l]: s };
143
+ return l !== o.slot && delete a[o.slot], [a, r];
144
+ }
145
+ function Xn(n, t, e) {
146
+ const o = F(n)[t] ?? {}, l = o[e], s = n.stashed[t];
147
+ if (s && l !== void 0 && M(n.registry, l)?.solo === !0) {
148
+ const r = { ...n.stashed };
149
+ return delete r[t], [s, r];
150
150
  }
151
- const r = { ...o };
152
- return delete r[e], [r, n.stashed];
151
+ const i = { ...o };
152
+ return delete i[e], [i, n.stashed];
153
+ }
154
+ const hn = { sizes: {}, splits: {} };
155
+ function Kn(n, t) {
156
+ return n.bandSplit !== t.bandSplit ? !1 : B.every(
157
+ (e) => n.sizes[e] === t.sizes[e] && n.splits[e] === t.splits[e]
158
+ );
153
159
  }
154
- const fn = { sizes: {}, splits: {} };
155
160
  function qn(n = {}) {
156
- const t = n.initial, e = (o, c) => ({
161
+ const t = n.initial, e = (o, l) => ({
157
162
  ...o.views,
158
- [o.view]: c
163
+ [o.view]: l
159
164
  });
160
- return Un()((o, c) => ({
165
+ return jn()((o, l) => ({
161
166
  registry: [],
162
- view: n.view ?? on,
167
+ view: n.view ?? rn,
163
168
  views: t?.views ?? {},
164
- lengths: t?.lengths ?? fn,
169
+ lengths: t?.lengths ?? hn,
165
170
  focusedZone: null,
166
171
  stashed: {},
167
172
  available: { width: 0, height: 0 },
@@ -170,77 +175,78 @@ function qn(n = {}) {
170
175
  declare: (s) => o({ registry: s }),
171
176
  // Having an entry in `views` IS the record of having been settled. No second field can then
172
177
  // disagree about which views have been opened, or fall out of step when a reset clears them.
173
- // Having an entry in `views` IS the record of having been settled. No second field can then
174
- // disagree about which views have been opened, or fall out of step when a reset clears them.
175
- settle: (s) => o((r) => {
176
- const i = s ?? r.defaults;
177
- return J(r, r.view) ? i === r.defaults ? r : { defaults: i } : { views: e(r, $(r.registry, i)), defaults: i };
178
+ settle: (s) => o((i) => {
179
+ const r = s ?? i.defaults;
180
+ return K(i, i.view) ? r === i.defaults ? i : { defaults: r } : { views: e(i, G(i.registry, r)), defaults: r };
178
181
  }),
179
182
  // Settles the view it arrives at, rather than leaving that to the next render: a project
180
183
  // driving the chassis from outside React would otherwise land on an empty frame.
181
- setView: (s) => o((r) => r.view === s ? r : {
184
+ setView: (s) => o((i) => i.view === s ? i : {
182
185
  view: s,
183
- views: J(r, s) ? r.views : { ...r.views, [s]: $(r.registry, r.defaults) },
186
+ views: K(i, s) ? i.views : { ...i.views, [s]: G(i.registry, i.defaults) },
184
187
  // Session state, and it belongs to the view being left: a zone accented on arrival is
185
188
  // a zone nobody clicked, and a stash given back in another view would reopen a half
186
189
  // there.
187
190
  focusedZone: null,
188
191
  stashed: {}
189
192
  }),
190
- show: (s) => o((r) => {
191
- const i = C(r.registry, s);
192
- if (!i) return r;
193
- const { zone: l } = i, a = E(r, l);
194
- if (a[i.slot]?.id === s) return { focusedZone: l };
195
- const [d, f] = Xn(r, l, i, a.primary);
193
+ show: (s) => o((i) => {
194
+ const r = M(i.registry, s);
195
+ if (!r) return i;
196
+ const { zone: c } = r, a = x(i, c);
197
+ if (a[r.slot]?.id === s) return { focusedZone: c };
198
+ const [d, f] = Jn(i, c, r, a.primary);
196
199
  return {
197
- views: e(r, { ...z(r), [l]: d }),
200
+ views: e(i, { ...F(i), [c]: d }),
198
201
  stashed: f,
199
- focusedZone: l
202
+ focusedZone: c
200
203
  };
201
204
  }),
202
- close: (s, r) => o((i) => {
203
- const [l, a] = Kn(i, s, r), d = e(i, { ...z(i), [s]: l }), f = j({ registry: i.registry, view: i.view, views: d }, s);
205
+ close: (s, i) => o((r) => {
206
+ const [c, a] = Xn(r, s, i), d = e(r, { ...F(r), [s]: c }), f = $({ registry: r.registry, view: r.view, views: d }, s);
204
207
  return {
205
208
  views: d,
206
209
  stashed: a,
207
- focusedZone: !f && i.focusedZone === s ? null : i.focusedZone
210
+ focusedZone: !f && r.focusedZone === s ? null : r.focusedZone
208
211
  };
209
212
  }),
210
213
  toggle: (s) => {
211
- const r = c(), i = C(r.registry, s);
212
- i && (L(r, i.zone)[i.slot] === s ? r.close(i.zone, i.slot) : r.show(s));
214
+ const i = l(), r = M(i.registry, s);
215
+ r && (A(i, r.zone)[r.slot] === s ? i.close(r.zone, r.slot) : i.show(s));
213
216
  },
214
- focus: (s) => o((r) => r.focusedZone === s ? r : { focusedZone: s }),
217
+ focus: (s) => o((i) => i.focusedZone === s ? i : { focusedZone: s }),
215
218
  // Guarded: a drag past the ceiling clamps to the same number for as long as the pointer
216
219
  // keeps going, and every write notifies every subscriber.
217
- resize: (s, r, i) => o((l) => {
218
- const a = Cn(
219
- l.lengths,
220
- x[s],
221
- (h) => X(l, h),
222
- (h) => K(h, E(l, h).primary)
223
- ), d = xn(r, i, a), f = k(s);
224
- return d === l.lengths.sizes[f] ? l : { lengths: { ...l.lengths, sizes: { ...l.lengths.sizes, [f]: d } } };
220
+ resize: (s, i, r) => o((c) => {
221
+ const a = xn(
222
+ c.lengths,
223
+ C[s],
224
+ (p) => Y(c, p),
225
+ (p) => q(p, x(c, p).primary)
226
+ ), d = En(i, r, a), f = V(s);
227
+ return d === c.lengths.sizes[f] ? c : { lengths: { ...c.lengths, sizes: { ...c.lengths.sizes, [f]: d } } };
225
228
  }),
226
- resplit: (s, r, i) => o((l) => {
227
- const a = D(r, i);
228
- return a === l.lengths.splits[s] ? l : { lengths: { ...l.lengths, splits: { ...l.lengths.splits, [s]: a } } };
229
+ resplit: (s, i, r) => o((c) => {
230
+ const a = W(i, r);
231
+ return a === c.lengths.splits[s] ? c : { lengths: { ...c.lengths, splits: { ...c.lengths.splits, [s]: a } } };
229
232
  }),
230
- resplitBand: (s, r) => o((i) => {
231
- const l = D(s, r);
232
- return l === i.lengths.bandSplit ? i : { lengths: { ...i.lengths, bandSplit: l } };
233
+ resplitBand: (s, i) => o((r) => {
234
+ const c = W(s, i);
235
+ return c === r.lengths.bandSplit ? r : { lengths: { ...r.lengths, bandSplit: c } };
233
236
  }),
234
- fit: (s, r) => o((i) => ({
235
- available: { width: s, height: r },
236
- lengths: Gn(
237
- i.lengths,
237
+ // Guarded like `resize`, and for a heavier reason: the observer fires on every frame of a
238
+ // window resize, and the persistence subscriber compares `lengths` by reference. A fresh
239
+ // object carrying the same numbers had each of those frames re-serialising the whole file.
240
+ fit: (s, i) => o((r) => {
241
+ const c = $n(
242
+ r.lengths,
238
243
  s,
239
- r,
240
- (l) => X(i, l),
241
- (l) => K(l, E(i, l).primary)
242
- )
243
- })),
244
+ i,
245
+ (f) => Y(r, f),
246
+ (f) => q(f, x(r, f).primary)
247
+ ), a = Kn(r.lengths, c) ? r.lengths : c, { available: d } = r;
248
+ return a === r.lengths && d.width === s && d.height === i ? r : { available: { width: s, height: i }, lengths: a };
249
+ }),
244
250
  // Every view, not just the one in front: a reset the reader asked for must not leave the
245
251
  // arrangement they were escaping waiting for them one click away.
246
252
  reset: () => o((s) => ({
@@ -251,8 +257,8 @@ function qn(n = {}) {
251
257
  // 🛑 Unless nothing is declared yet, and then it is left UNSETTLED: settled against an
252
258
  // empty registry it would be settled EMPTY, and having an entry is what stops anything
253
259
  // reopening it. Every half would stay shut for good.
254
- views: s.registry.length === 0 ? {} : { [s.view]: $(s.registry, s.defaults) },
255
- lengths: fn,
260
+ views: s.registry.length === 0 ? {} : { [s.view]: G(s.registry, s.defaults) },
261
+ lengths: hn,
256
262
  focusedZone: null,
257
263
  // Left behind, a solo panel closed after a reset would give back the zone the reset
258
264
  // had just cleared.
@@ -261,7 +267,7 @@ function qn(n = {}) {
261
267
  }))
262
268
  }));
263
269
  }
264
- const Ct = () => {
270
+ const xt = () => {
265
271
  const n = /* @__PURE__ */ new Map();
266
272
  return {
267
273
  read: (t) => n.get(t) ?? null,
@@ -283,25 +289,25 @@ const Ct = () => {
283
289
  } catch {
284
290
  }
285
291
  }
286
- }), En = 2;
287
- function P(n) {
292
+ }), Cn = 2;
293
+ function E(n) {
288
294
  return typeof n == "object" && n !== null && !Array.isArray(n);
289
295
  }
290
- function hn(n) {
296
+ function pn(n) {
291
297
  const t = {};
292
- for (const e of U) {
298
+ for (const e of B) {
293
299
  const o = n[e];
294
- if (P(o))
295
- for (const c of Nn) {
296
- const s = o[c];
297
- s !== null && typeof s != "string" || (t[e] = { ...t[e], [c]: s });
300
+ if (E(o))
301
+ for (const l of Pn) {
302
+ const s = o[l];
303
+ s !== null && typeof s != "string" || (t[e] = { ...t[e], [l]: s });
298
304
  }
299
305
  }
300
306
  return t;
301
307
  }
302
- function pn(n) {
308
+ function gn(n) {
303
309
  const t = {};
304
- for (const e of U) {
310
+ for (const e of B) {
305
311
  const o = n[e];
306
312
  typeof o == "number" && Number.isFinite(o) && (t[e] = o);
307
313
  }
@@ -309,171 +315,178 @@ function pn(n) {
309
315
  }
310
316
  function nt(n, t) {
311
317
  if (n.version === 1)
312
- return P(n.open) ? { [t]: hn(n.open) } : void 0;
313
- if (n.version !== En || !P(n.views)) return;
318
+ return E(n.open) ? { [t]: pn(n.open) } : void 0;
319
+ if (n.version !== Cn || !E(n.views)) return;
314
320
  const e = /* @__PURE__ */ Object.create(null);
315
- for (const [o, c] of Object.entries(n.views))
316
- P(c) && (e[o] = hn(c));
321
+ for (const [o, l] of Object.entries(n.views))
322
+ E(l) && (e[o] = pn(l));
317
323
  return e;
318
324
  }
319
- function tt(n, t, e = on) {
325
+ function tt(n, t, e = rn) {
320
326
  const o = n.read(t);
321
327
  if (o === null) return;
322
- let c;
328
+ let l;
323
329
  try {
324
- c = JSON.parse(o);
330
+ l = JSON.parse(o);
325
331
  } catch {
326
332
  return;
327
333
  }
328
- if (!P(c) || !P(c.lengths)) return;
329
- const s = nt(c, e);
334
+ if (!E(l) || !E(l.lengths)) return;
335
+ const s = nt(l, e);
330
336
  if (!s) return;
331
- const r = c.lengths;
332
- if (!P(r.sizes) || !P(r.splits)) return;
333
- const i = r.bandSplit;
337
+ const i = l.lengths;
338
+ if (!E(i.sizes) || !E(i.splits)) return;
339
+ const r = i.bandSplit;
334
340
  return {
335
341
  views: s,
336
342
  lengths: {
337
- sizes: pn(r.sizes),
338
- splits: pn(r.splits),
339
- bandSplit: typeof i == "number" && Number.isFinite(i) ? i : void 0
343
+ sizes: gn(i.sizes),
344
+ splits: gn(i.splits),
345
+ bandSplit: typeof r == "number" && Number.isFinite(r) ? r : void 0
340
346
  }
341
347
  };
342
348
  }
343
349
  function et(n, t, e) {
344
350
  const o = {
345
- version: En,
351
+ version: Cn,
346
352
  views: e.views,
347
353
  lengths: e.lengths
348
354
  };
349
355
  n.write(t, JSON.stringify(o));
350
356
  }
351
- const Mn = typeof globalThis.document > "u" ? nn : kn, zn = en(null);
352
- function ot({
357
+ const Zn = typeof globalThis.document > "u" ? tn : Bn, Mn = on(null), ot = 250;
358
+ function rt({
353
359
  store: n,
354
360
  storageKey: t = "panels:layout",
355
361
  storage: e,
356
362
  defaultOpen: o,
357
- view: c,
363
+ view: l,
358
364
  children: s
359
365
  }) {
360
- const [r] = W(
366
+ const [i] = J(
361
367
  () => e === null ? null : e ?? Qn()
362
- ), [i] = W(() => {
363
- const l = c ?? on, a = r ? tt(r, t, l) : void 0;
364
- return n ? (a && n.setState(a), n) : qn({ view: l, initial: a });
368
+ ), [r] = J(() => {
369
+ const c = l ?? rn, a = i ? tt(i, t, c) : void 0;
370
+ return n ? (a && n.setState(a), n) : qn({ view: c, initial: a });
365
371
  });
366
- return Mn(() => {
367
- const l = i.getState();
368
- c !== void 0 && l.setView(c), l.settle(o);
369
- }), nn(() => {
370
- if (!r) return;
371
- let l;
372
- return i.subscribe((a) => {
373
- J(a, a.view) && (l?.views === a.views && l.lengths === a.lengths || (l = { views: a.views, lengths: a.lengths }, et(r, t, a)));
372
+ return Zn(() => {
373
+ const c = r.getState();
374
+ l !== void 0 && c.setView(l), c.settle(o);
375
+ }), tn(() => {
376
+ if (!i) return;
377
+ let c, a, d;
378
+ const f = () => {
379
+ d !== void 0 && clearTimeout(d), d = void 0, a && (c = a, a = void 0, et(i, t, c));
380
+ }, p = r.subscribe((g) => {
381
+ if (!K(g, g.view)) return;
382
+ const S = a ?? c;
383
+ S?.views === g.views && S.lengths === g.lengths || (a = { views: g.views, lengths: g.lengths }, d ??= setTimeout(f, ot));
374
384
  });
375
- }, [r, i, t]), /* @__PURE__ */ u(zn.Provider, { value: i, children: s });
385
+ return globalThis.addEventListener?.("pagehide", f), () => {
386
+ p(), globalThis.removeEventListener?.("pagehide", f), f();
387
+ };
388
+ }, [i, r, t]), /* @__PURE__ */ u(Mn.Provider, { value: r, children: s });
376
389
  }
377
- function O() {
378
- const n = tn(zn);
390
+ function k() {
391
+ const n = en(Mn);
379
392
  if (!n) throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");
380
393
  return n;
381
394
  }
382
395
  function v(n) {
383
- const t = O();
384
- return Yn(t, n);
396
+ const t = k();
397
+ return Vn(t, n);
385
398
  }
386
- function R() {
387
- const n = O();
399
+ function D() {
400
+ const n = k();
388
401
  return w(() => {
389
- const { show: t, close: e, toggle: o, focus: c, resize: s, resplit: r, resplitBand: i, fit: l, reset: a } = n.getState();
390
- return { show: t, close: e, toggle: o, focus: c, resize: s, resplit: r, resplitBand: i, fit: l, reset: a };
402
+ const { show: t, close: e, toggle: o, focus: l, resize: s, resplit: i, resplitBand: r, fit: c, reset: a } = n.getState();
403
+ return { show: t, close: e, toggle: o, focus: l, resize: s, resplit: i, resplitBand: r, fit: c, reset: a };
391
404
  }, [n]);
392
405
  }
393
- function rt({
406
+ function st({
394
407
  icon: n,
395
408
  label: t,
396
409
  active: e,
397
410
  accented: o,
398
- acts: c,
411
+ acts: l,
399
412
  className: s,
400
- children: r,
401
- ref: i,
402
- ...l
413
+ children: i,
414
+ ref: r,
415
+ ...c
403
416
  }) {
404
- return /* @__PURE__ */ g(
417
+ return /* @__PURE__ */ m(
405
418
  "button",
406
419
  {
407
420
  type: "button",
408
- ref: i,
421
+ ref: r,
409
422
  "aria-label": t,
410
- "aria-pressed": c ? void 0 : e,
423
+ "aria-pressed": l ? void 0 : e,
411
424
  className: b(
412
425
  "pnl-icon-button",
413
426
  e && "pnl-icon-button--active",
414
427
  o && "pnl-icon-button--accented",
415
428
  s
416
429
  ),
417
- ...l,
430
+ ...c,
418
431
  children: [
419
432
  n !== void 0 && /* @__PURE__ */ u("span", { className: "pnl-icon-button__glyph", children: n }),
420
- r
433
+ i
421
434
  ]
422
435
  }
423
436
  );
424
437
  }
425
- const q = { IconButton: rt }, Ln = en(q), st = Ln.Provider;
438
+ const Q = { IconButton: st }, Rn = on(Q), it = Rn.Provider;
426
439
  function On() {
427
- return tn(Ln);
428
- }
429
- function it(n) {
430
- return n === void 0 ? q : { ...q, ...n };
440
+ return en(Rn);
431
441
  }
432
442
  function ct(n) {
433
- const t = O();
434
- nn(() => {
443
+ return n === void 0 ? Q : { ...Q, ...n };
444
+ }
445
+ function lt(n) {
446
+ const t = k();
447
+ tn(() => {
435
448
  const e = n.current;
436
449
  if (!e) return;
437
450
  const o = () => {
438
- const { clientWidth: s, clientHeight: r } = e;
439
- s === 0 || r === 0 || t.getState().fit(s, r);
451
+ const { clientWidth: s, clientHeight: i } = e;
452
+ s === 0 || i === 0 || t.getState().fit(s, i);
440
453
  };
441
454
  if (o(), typeof ResizeObserver > "u") return;
442
- const c = new ResizeObserver(o);
443
- return c.observe(e), () => c.disconnect();
455
+ const l = new ResizeObserver(o);
456
+ return l.observe(e), () => l.disconnect();
444
457
  }, [n, t]);
445
458
  }
446
- function T() {
459
+ function R() {
447
460
  const n = v((o) => o.registry), t = v((o) => o.view), e = v((o) => o.views[o.view]);
448
461
  return w(
449
462
  () => ({ registry: n, view: t, views: e === void 0 ? {} : { [t]: e } }),
450
463
  [n, t, e]
451
464
  );
452
465
  }
453
- function lt(n) {
454
- const t = T();
455
- return w(() => L(t, n), [t, n]);
466
+ function at(n) {
467
+ const t = R();
468
+ return w(() => A(t, n), [t, n]);
456
469
  }
457
- function gn(n) {
458
- const t = T();
459
- return w(() => E(t, n), [t, n]);
470
+ function Lt(n) {
471
+ const t = R();
472
+ return w(() => x(t, n), [t, n]);
460
473
  }
461
474
  function mn(n) {
462
- const t = T();
463
- return w(() => j(t, n), [t, n]);
475
+ const t = R();
476
+ return w(() => $(t, n), [t, n]);
464
477
  }
465
- function at(n) {
466
- const t = T();
467
- return w(() => X(t, n), [t, n]);
478
+ function Ct(n) {
479
+ const t = R();
480
+ return w(() => Y(t, n), [t, n]);
468
481
  }
469
482
  function ut() {
470
483
  return {
471
- left: mn(G.left.band),
472
- right: mn(G.right.band)
484
+ left: mn(X.left.band),
485
+ right: mn(X.right.band)
473
486
  };
474
487
  }
475
488
  function dt() {
476
- const n = H(null);
489
+ const n = Z(null);
477
490
  return w(() => ({
478
491
  start: (e, o) => {
479
492
  e.currentTarget.setPointerCapture(e.pointerId), n.current = { ...o, pointerId: e.pointerId };
@@ -484,37 +497,37 @@ function dt() {
484
497
  }
485
498
  }), []);
486
499
  }
487
- function Q({
500
+ function nn({
488
501
  axis: n,
489
502
  invert: t = !1,
490
503
  size: e,
491
504
  onSize: o,
492
- measure: c,
505
+ measure: l,
493
506
  label: s,
494
- min: r,
495
- max: i,
496
- step: l = 16,
507
+ min: i,
508
+ max: r,
509
+ step: c = 16,
497
510
  className: a
498
511
  }) {
499
- const d = dt(), f = H(null), h = n === "vertical", m = _(
500
- (p) => (h ? p?.clientHeight : p?.clientWidth) ?? 0,
501
- [h]
502
- ), I = _(
503
- (p) => {
504
- const S = d.matching(p);
505
- if (!S) return;
506
- const Y = (h ? p.clientY : p.clientX) - S.position;
507
- o(S.size + Y * (t ? -1 : 1), S.available);
512
+ const d = dt(), f = Z(null), p = n === "vertical", g = N(
513
+ (h) => (p ? h?.clientHeight : h?.clientWidth) ?? 0,
514
+ [p]
515
+ ), S = N(
516
+ (h) => {
517
+ const _ = d.matching(h);
518
+ if (!_) return;
519
+ const P = (p ? h.clientY : h.clientX) - _.position;
520
+ o(_.size + P * (t ? -1 : 1), _.available);
508
521
  },
509
- [d, t, h, o]
510
- ), y = _(
511
- (p) => {
512
- const S = h ? "ArrowUp" : "ArrowLeft", V = h ? "ArrowDown" : "ArrowRight";
513
- if (p.key !== S && p.key !== V) return;
514
- const Y = m(f.current?.parentElement), An = e ?? c?.() ?? 0, Bn = p.key === V ? 1 : -1;
515
- p.preventDefault(), o(An + l * Bn * (t ? -1 : 1), Y);
522
+ [d, t, p, o]
523
+ ), y = N(
524
+ (h) => {
525
+ const _ = p ? "ArrowUp" : "ArrowLeft", L = p ? "ArrowDown" : "ArrowRight";
526
+ if (h.key !== _ && h.key !== L) return;
527
+ const P = g(f.current?.parentElement), O = e ?? l?.() ?? 0, An = h.key === L ? 1 : -1;
528
+ h.preventDefault(), o(O + c * An * (t ? -1 : 1), P);
516
529
  },
517
- [t, h, c, o, m, e, l]
530
+ [t, p, l, o, g, e, c]
518
531
  );
519
532
  return /* @__PURE__ */ u(
520
533
  "div",
@@ -523,50 +536,50 @@ function Q({
523
536
  role: "separator",
524
537
  tabIndex: 0,
525
538
  "aria-label": s,
526
- "aria-orientation": h ? "horizontal" : "vertical",
539
+ "aria-orientation": p ? "horizontal" : "vertical",
527
540
  "aria-valuenow": e === void 0 ? void 0 : Math.round(e),
528
- "aria-valuemin": r,
529
- "aria-valuemax": i,
530
- onPointerDown: (p) => {
531
- d.start(p, {
532
- position: h ? p.clientY : p.clientX,
533
- size: e ?? c?.() ?? 0,
534
- available: m(p.currentTarget.parentElement)
541
+ "aria-valuemin": i,
542
+ "aria-valuemax": r,
543
+ onPointerDown: (h) => {
544
+ h.button !== 0 || !h.isPrimary || d.start(h, {
545
+ position: p ? h.clientY : h.clientX,
546
+ size: e ?? l?.() ?? 0,
547
+ available: g(h.currentTarget.parentElement)
535
548
  });
536
549
  },
537
- onPointerMove: I,
550
+ onPointerMove: S,
538
551
  onPointerUp: d.cancel,
539
552
  onPointerCancel: d.cancel,
540
553
  onLostPointerCapture: d.cancel,
541
554
  onKeyDown: y,
542
- className: b("pnl-handle", h ? "pnl-handle--row" : "pnl-handle--col", a)
555
+ className: b("pnl-handle", p ? "pnl-handle--row" : "pnl-handle--col", a)
543
556
  }
544
557
  );
545
558
  }
546
559
  function vn(n, t, e, o) {
547
- return o ? t ?? K(e, n) : 0;
560
+ return o ? t ?? q(e, n) : 0;
548
561
  }
549
562
  function ft(n) {
550
- const t = gn(n), e = gn(x[n]), o = at(x[n]), c = v(
551
- (a) => a.lengths.sizes[k(n)]
552
- ), s = v(
553
- (a) => a.lengths.sizes[k(x[n])]
554
- ), r = v((a) => a.lengths.splits[n]), i = v(
555
- (a) => M(n) ? a.available.height : a.available.width
556
- ), l = v((a) => a.focusedZone === n);
563
+ const t = R(), e = v(
564
+ (r) => r.lengths.sizes[V(n)]
565
+ ), o = v(
566
+ (r) => r.lengths.sizes[V(C[n])]
567
+ ), l = v((r) => r.lengths.splits[n]), s = v(
568
+ (r) => T(n) ? r.available.height : r.available.width
569
+ ), i = v((r) => r.focusedZone === n);
557
570
  return w(() => {
558
- const { primary: a, secondary: d } = t, f = a !== void 0 || d !== void 0, h = vn(a, c, n, f), m = vn(e.primary, s, x[n], o);
571
+ const { primary: r, secondary: c } = x(t, n), a = r !== void 0 || c !== void 0, d = x(t, C[n]), f = Y(t, C[n]), p = vn(r, e, n, a), g = vn(d.primary, o, C[n], f);
559
572
  return {
560
- primary: a,
561
- secondary: d,
562
- draws: f,
573
+ primary: r,
574
+ secondary: c,
575
+ draws: a,
563
576
  // Zero until the container has been measured: bounding against nothing would collapse
564
577
  // every zone to its floor on the very first paint.
565
- size: i === 0 ? h : Jn(h, m, i)[0],
566
- split: r,
567
- focused: l
578
+ size: s === 0 ? p : Gn(p, g, s)[0],
579
+ split: l,
580
+ focused: i
568
581
  };
569
- }, [t, e, o, c, s, i, r, l, n]);
582
+ }, [t, e, o, s, l, i, n]);
570
583
  }
571
584
  function ht(n) {
572
585
  const t = v((e) => e.registry);
@@ -575,24 +588,24 @@ function ht(n) {
575
588
  ["secondary", t.filter((o) => o.zone === n && o.slot === "secondary")]
576
589
  ].filter(([, o]) => o.length > 0), [t, n]);
577
590
  }
578
- const Rn = en(/* @__PURE__ */ new Map()), pt = Rn.Provider;
591
+ const zn = on(/* @__PURE__ */ new Map()), pt = zn.Provider;
579
592
  function gt(n) {
580
- return tn(Rn).get(n);
593
+ return en(zn).get(n);
581
594
  }
582
595
  function mt({
583
596
  title: n,
584
597
  children: t,
585
598
  fillActions: e,
586
599
  trailing: o,
587
- className: c
600
+ className: l
588
601
  }) {
589
- return /* @__PURE__ */ g("header", { className: b("pnl-header", c), children: [
602
+ return /* @__PURE__ */ m("header", { className: b("pnl-header", l), children: [
590
603
  /* @__PURE__ */ u("span", { className: b("pnl-header__title", e && "pnl-header__title--fixed"), children: n }),
591
604
  /* @__PURE__ */ u("span", { className: b("pnl-header__actions", e && "pnl-header__actions--fill"), children: t }),
592
605
  /* @__PURE__ */ u("span", { className: "pnl-header__trailing", children: o })
593
606
  ] });
594
607
  }
595
- function sn({ orientation: n = "vertical", className: t }) {
608
+ function cn({ orientation: n = "vertical", className: t }) {
596
609
  return /* @__PURE__ */ u(
597
610
  "span",
598
611
  {
@@ -608,15 +621,17 @@ function vt({
608
621
  panel: n,
609
622
  length: t,
610
623
  closeLabel: e,
611
- onFocus: o
624
+ onFocus: o,
625
+ ref: l
612
626
  }) {
613
- const { close: c } = R(), { IconButton: s } = On(), r = gt(n.id);
627
+ const { close: s } = D(), { IconButton: i } = On(), r = gt(n.id);
614
628
  return (
615
629
  // The zone owns its length: a half given one keeps it, the other takes what is left. Both
616
630
  // sized here would make the pair overflow the zone the user dragged.
617
- /* @__PURE__ */ g(
631
+ /* @__PURE__ */ m(
618
632
  Tn,
619
633
  {
634
+ ref: l,
620
635
  "aria-label": n.title,
621
636
  onPointerDownCapture: o,
622
637
  className: t === void 0 ? "pnl-surface--fill" : "pnl-surface--give",
@@ -626,15 +641,15 @@ function vt({
626
641
  mt,
627
642
  {
628
643
  title: n.title,
629
- fillActions: n.fillActions ?? (r?.actions !== void 0 && M(n.zone)),
630
- trailing: /* @__PURE__ */ g(A, { children: [
631
- r?.actions !== void 0 && /* @__PURE__ */ u(sn, {}),
644
+ fillActions: n.fillActions ?? (r?.actions !== void 0 && T(n.zone)),
645
+ trailing: /* @__PURE__ */ m(j, { children: [
646
+ r?.actions !== void 0 && /* @__PURE__ */ u(cn, {}),
632
647
  /* @__PURE__ */ u(
633
- s,
648
+ i,
634
649
  {
635
650
  label: e,
636
651
  acts: !0,
637
- onClick: () => c(n.zone, n.slot),
652
+ onClick: () => s(n.zone, n.slot),
638
653
  className: "pnl-icon-button--header",
639
654
  icon: /* @__PURE__ */ u(bt, {})
640
655
  }
@@ -660,130 +675,139 @@ function bt() {
660
675
  ) });
661
676
  }
662
677
  function wt({ zone: n, labels: t }) {
663
- const e = ft(n), { focus: o, resize: c, resplit: s } = R(), r = H(null), i = _(() => o(n), [o, n]), l = M(n), a = _(
664
- () => l ? r.current?.clientHeight ?? 0 : r.current?.clientWidth ?? 0,
665
- [l]
678
+ const e = ft(n), { focus: o, resize: l, resplit: s } = D(), i = Z(null), r = Z(null), c = T(n), a = v(
679
+ (P) => c ? P.available.height : P.available.width
680
+ ), d = N(() => o(n), [o, n]), f = N(
681
+ () => c ? i.current?.clientHeight ?? 0 : i.current?.clientWidth ?? 0,
682
+ [c]
683
+ ), p = N(
684
+ () => c ? r.current?.clientWidth ?? 0 : r.current?.clientHeight ?? 0,
685
+ [c]
666
686
  );
667
687
  if (!e.draws) return null;
668
- const { primary: d, secondary: f, size: h, split: m } = e, I = /* @__PURE__ */ g(
688
+ const { primary: g, secondary: S, size: y, split: h } = e, _ = /* @__PURE__ */ m(
669
689
  "div",
670
690
  {
671
- ref: r,
672
- className: b("pnl-zone", l ? "pnl-zone--row" : "pnl-zone--col"),
673
- style: { [l ? "height" : "width"]: h },
691
+ ref: i,
692
+ className: b("pnl-zone", c ? "pnl-zone--row" : "pnl-zone--col"),
693
+ style: { [c ? "height" : "width"]: y },
674
694
  children: [
675
- d && /* @__PURE__ */ u(bn, { panel: d, closeLabel: t.closePanel, onFocus: i }),
676
- d && f && /* @__PURE__ */ u(
677
- Q,
695
+ g && /* @__PURE__ */ u(bn, { panel: g, closeLabel: t.closePanel, onFocus: d }),
696
+ g && S && /* @__PURE__ */ u(
697
+ nn,
678
698
  {
679
- axis: l ? "horizontal" : "vertical",
699
+ axis: c ? "horizontal" : "vertical",
680
700
  invert: !0,
681
- size: m,
682
- min: Z,
701
+ size: h,
702
+ min: z,
703
+ measure: p,
683
704
  label: t.resizeSplit,
684
- onSize: (p, S) => s(n, p, S)
705
+ onSize: (P, O) => s(n, P, O)
685
706
  }
686
707
  ),
687
- f && /* @__PURE__ */ u(
708
+ S && /* @__PURE__ */ u(
688
709
  bn,
689
710
  {
690
- panel: f,
691
- length: d && m !== void 0 ? m : void 0,
711
+ ref: r,
712
+ panel: S,
713
+ length: g && h !== void 0 ? h : void 0,
692
714
  closeLabel: t.closePanel,
693
- onFocus: i
715
+ onFocus: d
694
716
  }
695
717
  )
696
718
  ]
697
719
  }
698
- ), y = /* @__PURE__ */ u(
699
- Q,
720
+ ), L = /* @__PURE__ */ u(
721
+ nn,
700
722
  {
701
- axis: l ? "vertical" : "horizontal",
702
- invert: !un(n),
703
- size: h,
704
- min: B,
705
- measure: a,
723
+ axis: c ? "vertical" : "horizontal",
724
+ invert: !dn(n),
725
+ size: y,
726
+ min: U,
727
+ measure: f,
706
728
  label: t.resizeZone,
707
- onSize: (p, S) => c(n, p, S)
729
+ onSize: (P, O) => l(n, P, a || O)
708
730
  }
709
731
  );
710
- return un(n) ? /* @__PURE__ */ g(A, { children: [
711
- I,
712
- y
713
- ] }) : /* @__PURE__ */ g(A, { children: [
714
- y,
715
- I
732
+ return dn(n) ? /* @__PURE__ */ m(j, { children: [
733
+ _,
734
+ L
735
+ ] }) : /* @__PURE__ */ m(j, { children: [
736
+ L,
737
+ _
716
738
  ] });
717
739
  }
718
- const N = Sn(wt);
740
+ const I = Sn(wt);
719
741
  function yt({ left: n, right: t, labels: e }) {
720
- const o = v((r) => r.lengths.bandSplit), { resplitBand: c } = R(), s = _(
721
- (r, i) => c(r, i),
722
- [c]
723
- );
724
- return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(N, { zone: n ? "bottomLeft" : "bottomRight", labels: e }) : /* @__PURE__ */ g("div", { className: "pnl-band", children: [
742
+ const o = v((c) => c.lengths.bandSplit), { resplitBand: l } = D(), s = Z(null), i = N(
743
+ (c, a) => l(c, a),
744
+ [l]
745
+ ), r = N(() => s.current?.clientWidth ?? 0, []);
746
+ return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(I, { zone: n ? "bottomLeft" : "bottomRight", labels: e }) : /* @__PURE__ */ m("div", { className: "pnl-band", children: [
725
747
  /* @__PURE__ */ u(
726
748
  "div",
727
749
  {
750
+ ref: s,
728
751
  className: b("pnl-band__half", o === void 0 && "pnl-band__half--even"),
729
752
  style: o === void 0 ? void 0 : { width: o },
730
- children: /* @__PURE__ */ u(N, { zone: "bottomLeft", labels: e })
753
+ children: /* @__PURE__ */ u(I, { zone: "bottomLeft", labels: e })
731
754
  }
732
755
  ),
733
756
  /* @__PURE__ */ u(
734
- Q,
757
+ nn,
735
758
  {
736
759
  axis: "horizontal",
737
760
  size: o,
738
- min: Z,
761
+ min: z,
762
+ measure: r,
739
763
  label: e.resizeBand,
740
- onSize: s
764
+ onSize: i
741
765
  }
742
766
  ),
743
- /* @__PURE__ */ u("div", { className: "pnl-band__half pnl-band__half--rest", children: /* @__PURE__ */ u(N, { zone: "bottomRight", labels: e }) })
767
+ /* @__PURE__ */ u("div", { className: "pnl-band__half pnl-band__half--rest", children: /* @__PURE__ */ u(I, { zone: "bottomRight", labels: e }) })
744
768
  ] });
745
769
  }
746
- function cn(n) {
770
+ function ln(n) {
747
771
  return null;
748
772
  }
749
- cn.displayName = "Panels.Center";
773
+ ln.displayName = "Panels.Center";
750
774
  const St = {
751
775
  closePanel: "Close panel",
752
776
  resizeZone: "Resize panel area",
753
777
  resizeSplit: "Resize the two panels",
754
778
  resizeBand: "Resize the bottom panels"
755
779
  };
756
- function ln(n) {
780
+ function an(n) {
757
781
  return null;
758
782
  }
759
- ln.displayName = "Panels.Panel";
783
+ an.displayName = "Panels.Panel";
760
784
  function wn({ side: n, header: t, className: e }) {
761
- const { column: o, band: c } = G[n];
762
- return /* @__PURE__ */ g(
785
+ const { column: o, band: l } = X[n];
786
+ return /* @__PURE__ */ m(
763
787
  "div",
764
788
  {
765
789
  role: "toolbar",
766
790
  "aria-orientation": "vertical",
767
791
  className: b("pnl-rail", `pnl-rail--${n}`, e),
768
792
  children: [
769
- /* @__PURE__ */ g("div", { className: "pnl-rail__group", children: [
770
- t !== void 0 && /* @__PURE__ */ g(A, { children: [
793
+ /* @__PURE__ */ m("div", { className: "pnl-rail__group", children: [
794
+ t !== void 0 && /* @__PURE__ */ m(j, { children: [
771
795
  t,
772
- /* @__PURE__ */ u(sn, { orientation: "horizontal" })
796
+ /* @__PURE__ */ u(cn, { orientation: "horizontal" })
773
797
  ] }),
774
798
  o.map((s) => /* @__PURE__ */ u(yn, { zone: s }, s))
775
799
  ] }),
776
- /* @__PURE__ */ u(yn, { zone: c })
800
+ /* @__PURE__ */ u(yn, { zone: l })
777
801
  ]
778
802
  }
779
803
  );
780
804
  }
781
805
  function yn({ zone: n }) {
782
- const t = ht(n), e = lt(n), o = v((r) => r.focusedZone === n), { toggle: c } = R(), { IconButton: s } = On();
783
- return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([r, i], l) => /* @__PURE__ */ g(Dn, { children: [
784
- l > 0 && /* @__PURE__ */ u(sn, { orientation: "horizontal" }),
785
- i.map((a) => {
786
- const d = e[r] === a.id;
806
+ const t = ht(n), e = at(n), o = v((i) => i.focusedZone === n), { toggle: l } = D(), { IconButton: s } = On();
807
+ return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([i, r], c) => /* @__PURE__ */ m(kn, { children: [
808
+ c > 0 && /* @__PURE__ */ u(cn, { orientation: "horizontal" }),
809
+ r.map((a) => {
810
+ const d = e[i] === a.id;
787
811
  return /* @__PURE__ */ u(
788
812
  s,
789
813
  {
@@ -791,115 +815,115 @@ function yn({ zone: n }) {
791
815
  label: a.title,
792
816
  active: d,
793
817
  accented: d && o,
794
- onClick: () => c(a.id),
818
+ onClick: () => l(a.id),
795
819
  className: "pnl-rail__button"
796
820
  },
797
821
  a.id
798
822
  );
799
823
  })
800
- ] }, `${n}:${r}`)) });
824
+ ] }, `${n}:${i}`)) });
801
825
  }
802
- function Nt(n) {
826
+ function Pt(n) {
803
827
  const t = [], e = /* @__PURE__ */ new Map(), o = [];
804
- let c = null;
805
- for (const s of jn.toArray(n)) {
828
+ let l = null;
829
+ for (const s of Dn.toArray(n)) {
806
830
  if (!Hn(s)) {
807
831
  o.push(s);
808
832
  continue;
809
833
  }
810
- if (s.type === cn) {
811
- c = s;
834
+ if (s.type === ln) {
835
+ l = s;
812
836
  continue;
813
837
  }
814
- if (s.type !== ln) {
838
+ if (s.type !== an) {
815
839
  o.push(s);
816
840
  continue;
817
841
  }
818
- const r = s.props, { actions: i, children: l, slot: a = "primary", ...d } = r;
819
- t.push({ ...d, slot: a }), e.set(d.id, { content: l, actions: i });
842
+ const i = s.props, { actions: r, children: c, slot: a = "primary", ...d } = i;
843
+ t.push({ ...d, slot: a }), e.set(d.id, { content: c, actions: r });
820
844
  }
821
- return { specs: t, content: e, centre: c, loose: o };
845
+ return { specs: t, content: e, centre: l, loose: o };
822
846
  }
823
847
  function Fn({
824
848
  header: n,
825
849
  footer: t,
826
850
  railHeader: e,
827
851
  labels: o,
828
- theme: c,
852
+ theme: l,
829
853
  className: s,
830
- components: r,
831
- children: i,
832
- ...l
854
+ components: i,
855
+ children: r,
856
+ ...c
833
857
  }) {
834
- return /* @__PURE__ */ u(ot, { ...l, children: /* @__PURE__ */ u(
835
- Pt,
858
+ return /* @__PURE__ */ u(rt, { ...c, children: /* @__PURE__ */ u(
859
+ Nt,
836
860
  {
837
861
  header: n,
838
862
  footer: t,
839
863
  railHeader: e,
840
864
  labels: o,
841
- theme: c,
865
+ theme: l,
842
866
  className: s,
843
- components: r,
844
- children: i
867
+ components: i,
868
+ children: r
845
869
  }
846
870
  ) });
847
871
  }
848
- function Pt({
872
+ function Nt({
849
873
  header: n,
850
874
  footer: t,
851
875
  railHeader: e,
852
876
  labels: o,
853
- theme: c,
877
+ theme: l,
854
878
  className: s,
855
- components: r,
856
- children: i
879
+ components: i,
880
+ children: r
857
881
  }) {
858
- const l = O(), a = H(null);
859
- ct(a);
860
- const [d] = W(() => it(r)), { specs: f, content: h, centre: m, loose: I } = w(() => Nt(i), [i]), y = w(() => ({ ...St, ...o }), [o]);
861
- Mn(() => {
862
- l.getState().declare(f);
863
- }, [l, f]);
864
- const p = ut();
865
- return /* @__PURE__ */ u(st, { value: d, children: /* @__PURE__ */ u(pt, { value: h, children: /* @__PURE__ */ g("div", { "data-pnl-theme": c, className: b("pnl-root", s), children: [
882
+ const c = k(), a = Z(null);
883
+ lt(a);
884
+ const [d] = J(() => ct(i)), { specs: f, content: p, centre: g, loose: S } = w(() => Pt(r), [r]), y = w(() => ({ ...St, ...o }), [o]);
885
+ Zn(() => {
886
+ c.getState().declare(f);
887
+ }, [c, f]);
888
+ const h = ut();
889
+ return /* @__PURE__ */ u(it, { value: d, children: /* @__PURE__ */ u(pt, { value: p, children: /* @__PURE__ */ m("div", { "data-pnl-theme": l, className: b("pnl-root", s), children: [
866
890
  n,
867
- /* @__PURE__ */ g("div", { className: "pnl-middle", children: [
891
+ /* @__PURE__ */ m("div", { className: "pnl-middle", children: [
868
892
  /* @__PURE__ */ u(wn, { side: "left", header: e }),
869
- /* @__PURE__ */ g("div", { ref: a, className: "pnl-columns", children: [
870
- /* @__PURE__ */ u(N, { zone: "top", labels: y }),
871
- /* @__PURE__ */ g("div", { className: "pnl-row", children: [
872
- !p.left && /* @__PURE__ */ u(N, { zone: "left", labels: y }),
873
- /* @__PURE__ */ g("div", { className: "pnl-stack", children: [
874
- /* @__PURE__ */ g("div", { className: "pnl-row", children: [
875
- p.left && /* @__PURE__ */ u(N, { zone: "left", labels: y }),
876
- /* @__PURE__ */ u(Tn, { className: "pnl-centre", children: m?.props.children }),
877
- p.right && /* @__PURE__ */ u(N, { zone: "right", labels: y })
893
+ /* @__PURE__ */ m("div", { ref: a, className: "pnl-columns", children: [
894
+ /* @__PURE__ */ u(I, { zone: "top", labels: y }),
895
+ /* @__PURE__ */ m("div", { className: "pnl-row", children: [
896
+ !h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
897
+ /* @__PURE__ */ m("div", { className: "pnl-stack", children: [
898
+ /* @__PURE__ */ m("div", { className: "pnl-row", children: [
899
+ h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
900
+ /* @__PURE__ */ u(Tn, { className: "pnl-centre", children: g?.props.children }),
901
+ h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
878
902
  ] }),
879
- /* @__PURE__ */ u(yt, { left: p.left, right: p.right, labels: y })
903
+ /* @__PURE__ */ u(yt, { left: h.left, right: h.right, labels: y })
880
904
  ] }),
881
- !p.right && /* @__PURE__ */ u(N, { zone: "right", labels: y })
905
+ !h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
882
906
  ] })
883
907
  ] }),
884
908
  /* @__PURE__ */ u(wn, { side: "right" })
885
909
  ] }),
886
910
  t,
887
- I
911
+ S
888
912
  ] }) }) });
889
913
  }
890
- Fn.Panel = ln;
891
- Fn.Center = cn;
914
+ Fn.Panel = an;
915
+ Fn.Center = ln;
892
916
  function Zt() {
893
- const n = O(), t = T(), e = v((r) => r.focusedZone), o = R(), c = _(
894
- (r) => {
895
- const i = C(t.registry, r);
896
- return i !== void 0 && L(t, i.zone)[i.slot] === r;
917
+ const n = k(), t = R(), e = v((i) => i.focusedZone), o = D(), l = N(
918
+ (i) => {
919
+ const r = M(t.registry, i);
920
+ return r !== void 0 && A(t, r.zone)[r.slot] === i;
897
921
  },
898
922
  [t]
899
- ), s = _(
900
- (r) => {
901
- const i = C(t.registry, r);
902
- !i || L(t, i.zone)[i.slot] !== r || n.getState().close(i.zone, i.slot);
923
+ ), s = N(
924
+ (i) => {
925
+ const r = M(t.registry, i);
926
+ !r || A(t, r.zone)[r.slot] !== i || n.getState().close(r.zone, r.slot);
903
927
  },
904
928
  [t, n]
905
929
  );
@@ -909,74 +933,74 @@ function Zt() {
909
933
  reveal: o.show,
910
934
  close: s,
911
935
  toggle: o.toggle,
912
- isShown: c,
936
+ isShown: l,
913
937
  focusedZone: e,
914
938
  reset: o.reset
915
939
  }),
916
- [t, o.show, o.toggle, o.reset, s, c, e]
940
+ [t, o.show, o.toggle, o.reset, s, l, e]
917
941
  );
918
942
  }
919
943
  export {
920
- $n as BOTTOM_ZONES,
944
+ Wn as BOTTOM_ZONES,
921
945
  yt as Band,
922
- cn as Center,
946
+ ln as Center,
923
947
  pt as ContentProvider,
924
948
  St as DEFAULT_LABELS,
925
- Wn as DEFAULT_SIZES,
926
- on as DEFAULT_VIEW,
927
- rt as IconButton,
928
- En as LAYOUT_VERSION,
929
- Pn as MIN_CENTER,
930
- B as MIN_SIZE,
931
- Z as MIN_SPLIT,
932
- ln as Panel,
949
+ Yn as DEFAULT_SIZES,
950
+ rn as DEFAULT_VIEW,
951
+ st as IconButton,
952
+ Cn as LAYOUT_VERSION,
953
+ Nn as MIN_CENTER,
954
+ U as MIN_SIZE,
955
+ z as MIN_SPLIT,
956
+ an as Panel,
933
957
  bn as PanelFrame,
934
958
  mt as PanelHeader,
935
959
  Fn as Panels,
936
- ot as PanelsProvider,
960
+ rt as PanelsProvider,
937
961
  wn as Rail,
938
962
  yn as RailZone,
939
- Q as ResizeHandle,
940
- Nn as SLOTS,
941
- sn as Separator,
963
+ nn as ResizeHandle,
964
+ Pn as SLOTS,
965
+ cn as Separator,
942
966
  Tn as Surface,
943
- U as ZONES,
944
- G as ZONES_BY_SIDE,
945
- N as ZoneEdge,
967
+ B as ZONES,
968
+ X as ZONES_BY_SIDE,
969
+ I as ZoneEdge,
946
970
  Qn as browserStorage,
947
971
  qn as createPanelsStore,
948
972
  b as cx,
949
- D as fitSplit,
950
- xn as fitZoneSize,
951
- rn as isBottom,
952
- M as isHorizontal,
953
- un as isLeading,
954
- Ct as memoryStorage,
955
- z as openOf,
973
+ W as fitSplit,
974
+ En as fitZoneSize,
975
+ sn as isBottom,
976
+ T as isHorizontal,
977
+ dn as isLeading,
978
+ xt as memoryStorage,
979
+ F as openOf,
956
980
  tt as readLayout,
957
- Jn as sharedSizes,
958
- L as shownIn,
959
- E as shownSpecsIn,
960
- k as sizeKeyOf,
961
- C as specOf,
962
- K as undraggedSizeOf,
963
- T as useArrangement,
981
+ Gn as sharedSizes,
982
+ A as shownIn,
983
+ x as shownSpecsIn,
984
+ V as sizeKeyOf,
985
+ M as specOf,
986
+ q as undraggedSizeOf,
987
+ R as useArrangement,
964
988
  ut as useBandHalves,
965
- ct as useContainerFit,
989
+ lt as useContainerFit,
966
990
  gt as usePanelContent,
967
991
  Zt as usePanels,
968
- R as usePanelsActions,
992
+ D as usePanelsActions,
969
993
  On as usePanelsComponents,
970
994
  v as usePanelsState,
971
- O as usePanelsStore,
995
+ k as usePanelsStore,
972
996
  dt as usePointerDrag,
973
- lt as useShownIn,
974
- gn as useShownSpecsIn,
997
+ at as useShownIn,
998
+ Lt as useShownSpecsIn,
975
999
  ft as useZone,
976
1000
  mn as useZoneDraws,
977
1001
  ht as useZonePanels,
978
- at as useZoneTakesRoom,
1002
+ Ct as useZoneTakesRoom,
979
1003
  et as writeLayout,
980
- j as zoneDraws,
981
- X as zoneTakesRoom
1004
+ $ as zoneDraws,
1005
+ Y as zoneTakesRoom
982
1006
  };