react-resizable-panels 4.0.0-alpha.2 → 4.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as j } from "react/jsx-runtime";
3
- import { useId as De, useLayoutEffect as Te, useEffect as Ae, useRef as D, useCallback as ge, createContext as $e, useImperativeHandle as Se, useState as R, useMemo as xe, useSyncExternalStore as Ne, useContext as _e } from "react";
3
+ import { useId as Te, useLayoutEffect as De, useEffect as Ae, useRef as T, useCallback as ge, createContext as $e, useImperativeHandle as Se, useState as M, useMemo as xe, useSyncExternalStore as Ne, useContext as _e } from "react";
4
+ function S(e, t = "Assertion error") {
5
+ if (!e)
6
+ throw Error(t);
7
+ }
4
8
  function re(e, t) {
5
9
  return t.sort(
6
10
  e === "horizontal" ? Fe : He
@@ -15,22 +19,22 @@ function He(e, t) {
15
19
  return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
16
20
  }
17
21
  function ze(e) {
18
- const { element: t, orientation: n, panels: o, separators: s } = e, i = re(
22
+ const { element: t, orientation: n, panels: o, separators: s } = e, r = re(
19
23
  n,
20
- Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
21
- ).map(({ element: c }) => c), a = [];
22
- let r, l;
23
- for (const c of i) {
24
+ Array.from(t.children).filter((l) => l instanceof HTMLElement).map((l) => ({ element: l }))
25
+ ).map(({ element: l }) => l), c = [];
26
+ let i, a;
27
+ for (const l of r) {
24
28
  const u = o.find(
25
- (f) => f.element === c
29
+ (f) => f.element === l
26
30
  );
27
31
  if (u) {
28
- if (r) {
29
- const f = r.element.getBoundingClientRect(), m = c.getBoundingClientRect();
30
- a.push({
32
+ if (i) {
33
+ const f = i.element.getBoundingClientRect(), m = l.getBoundingClientRect();
34
+ c.push({
31
35
  group: e,
32
- panels: [r, u],
33
- separator: l,
36
+ panels: [i, u],
37
+ separator: a,
34
38
  rect: n === "horizontal" ? new DOMRect(
35
39
  f.right,
36
40
  m.top,
@@ -44,15 +48,15 @@ function ze(e) {
44
48
  )
45
49
  });
46
50
  }
47
- r = u, l = void 0;
51
+ i = u, a = void 0;
48
52
  } else {
49
53
  const f = s.find(
50
- (m) => m.element === c
54
+ (m) => m.element === l
51
55
  );
52
- f ? l = f : (r = void 0, l = void 0);
56
+ f ? a = f : (i = void 0, a = void 0);
53
57
  }
54
58
  }
55
- return a;
59
+ return c;
56
60
  }
57
61
  function je(e, t) {
58
62
  const n = getComputedStyle(e), o = parseFloat(n.fontSize);
@@ -78,14 +82,14 @@ function Ke(e) {
78
82
  }
79
83
  }
80
84
  }
81
- function Y({
85
+ function Z({
82
86
  groupSize: e,
83
87
  panelElement: t,
84
88
  styleProp: n
85
89
  }) {
86
90
  let o;
87
- const [s, i] = Ke(n);
88
- switch (i) {
91
+ const [s, r] = Ke(n);
92
+ switch (r) {
89
93
  case "%": {
90
94
  o = s / 100 * e;
91
95
  break;
@@ -113,7 +117,7 @@ function Y({
113
117
  }
114
118
  return o;
115
119
  }
116
- function C(e) {
120
+ function R(e) {
117
121
  return parseFloat(e.toFixed(3));
118
122
  }
119
123
  function le({
@@ -125,57 +129,53 @@ function le({
125
129
  function pe(e) {
126
130
  const { panels: t } = e, n = le({ group: e });
127
131
  return t.map((o) => {
128
- const { element: s, panelConstraints: i } = o;
129
- let a = 0;
130
- if (i.collapsedSize) {
131
- const u = Y({
132
+ const { element: s, panelConstraints: r } = o;
133
+ let c = 0;
134
+ if (r.collapsedSize) {
135
+ const u = Z({
132
136
  groupSize: n,
133
137
  panelElement: s,
134
- styleProp: i.collapsedSize
138
+ styleProp: r.collapsedSize
135
139
  });
136
- a = C(u / n * 100);
140
+ c = R(u / n * 100);
137
141
  }
138
- let r;
139
- if (i.defaultSize) {
140
- const u = Y({
142
+ let i;
143
+ if (r.defaultSize) {
144
+ const u = Z({
141
145
  groupSize: n,
142
146
  panelElement: s,
143
- styleProp: i.defaultSize
147
+ styleProp: r.defaultSize
144
148
  });
145
- r = C(u / n * 100);
149
+ i = R(u / n * 100);
146
150
  }
147
- let l = 0;
148
- if (i.minSize) {
149
- const u = Y({
151
+ let a = 0;
152
+ if (r.minSize) {
153
+ const u = Z({
150
154
  groupSize: n,
151
155
  panelElement: s,
152
- styleProp: i.minSize
156
+ styleProp: r.minSize
153
157
  });
154
- l = C(u / n * 100);
158
+ a = R(u / n * 100);
155
159
  }
156
- let c = 100;
157
- if (i.maxSize) {
158
- const u = Y({
160
+ let l = 100;
161
+ if (r.maxSize) {
162
+ const u = Z({
159
163
  groupSize: n,
160
164
  panelElement: s,
161
- styleProp: i.maxSize
165
+ styleProp: r.maxSize
162
166
  });
163
- c = C(u / n * 100);
167
+ l = R(u / n * 100);
164
168
  }
165
169
  return {
166
- collapsedSize: a,
167
- collapsible: i.collapsible === !0,
168
- defaultSize: r,
169
- minSize: l,
170
- maxSize: c,
170
+ collapsedSize: c,
171
+ collapsible: r.collapsible === !0,
172
+ defaultSize: i,
173
+ minSize: a,
174
+ maxSize: l,
171
175
  panelId: o.id
172
176
  };
173
177
  });
174
178
  }
175
- function S(e, t = "Assertion error") {
176
- if (!e)
177
- throw console.error(t), Error(t);
178
- }
179
179
  class Ve {
180
180
  #e = {};
181
181
  addListener(t, n) {
@@ -190,18 +190,18 @@ class Ve {
190
190
  if (o.length === 1)
191
191
  o[0].call(null, n);
192
192
  else {
193
- let s = !1, i = null;
194
- const a = Array.from(o);
195
- for (let r = 0; r < a.length; r++) {
196
- const l = a[r];
193
+ let s = !1, r = null;
194
+ const c = Array.from(o);
195
+ for (let i = 0; i < c.length; i++) {
196
+ const a = c[i];
197
197
  try {
198
- l.call(null, n);
199
- } catch (c) {
200
- i === null && (s = !0, i = c);
198
+ a.call(null, n);
199
+ } catch (l) {
200
+ r === null && (s = !0, r = l);
201
201
  }
202
202
  }
203
203
  if (s)
204
- throw i;
204
+ throw r;
205
205
  }
206
206
  }
207
207
  removeAllListeners() {
@@ -216,7 +216,7 @@ class Ve {
216
216
  }
217
217
  }
218
218
  function L(e, t, n = 0) {
219
- return Math.abs(C(e) - C(t)) <= n;
219
+ return Math.abs(R(e) - R(t)) <= n;
220
220
  }
221
221
  let P = {
222
222
  cursorFlags: 0,
@@ -229,7 +229,7 @@ const A = new Ve();
229
229
  function k() {
230
230
  return P;
231
231
  }
232
- function M(e) {
232
+ function E(e) {
233
233
  const t = typeof e == "function" ? e(P) : e;
234
234
  if (P === t)
235
235
  return P;
@@ -238,24 +238,24 @@ function M(e) {
238
238
  ...P,
239
239
  ...t
240
240
  }, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", P.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", P.interactionState), t.mountedGroups !== void 0 && (P.mountedGroups.forEach((o, s) => {
241
- o.derivedPanelConstraints.forEach((i) => {
242
- if (i.collapsible) {
243
- const { layout: a } = n.mountedGroups.get(s) ?? {};
244
- if (a) {
245
- const r = L(
246
- i.collapsedSize,
247
- o.layout[i.panelId]
248
- ), l = L(
249
- i.collapsedSize,
250
- a[i.panelId]
241
+ o.derivedPanelConstraints.forEach((r) => {
242
+ if (r.collapsible) {
243
+ const { layout: c } = n.mountedGroups.get(s) ?? {};
244
+ if (c) {
245
+ const i = L(
246
+ r.collapsedSize,
247
+ o.layout[r.panelId]
248
+ ), a = L(
249
+ r.collapsedSize,
250
+ c[r.panelId]
251
251
  );
252
- r && !l && (s.inMemoryLastExpandedPanelSizes[i.panelId] = a[i.panelId]);
252
+ i && !a && (s.inMemoryLastExpandedPanelSizes[r.panelId] = c[r.panelId]);
253
253
  }
254
254
  }
255
255
  });
256
256
  }), A.emit("mountedGroupsChange", P.mountedGroups)), P;
257
257
  }
258
- function Xe(e, t) {
258
+ function qe(e, t) {
259
259
  if (e.length !== t.length)
260
260
  return !1;
261
261
  for (let n = 0; n < e.length; n++)
@@ -266,7 +266,7 @@ function Xe(e, t) {
266
266
  function W(e, t) {
267
267
  return L(e, t) ? 0 : e > t ? 1 : -1;
268
268
  }
269
- function _({
269
+ function F({
270
270
  panelConstraints: e,
271
271
  size: t
272
272
  }) {
@@ -274,153 +274,153 @@ function _({
274
274
  collapsedSize: n = 0,
275
275
  collapsible: o,
276
276
  maxSize: s = 100,
277
- minSize: i = 0
277
+ minSize: r = 0
278
278
  } = e;
279
- if (W(t, i) < 0)
279
+ if (W(t, r) < 0)
280
280
  if (o) {
281
- const a = (n + i) / 2;
282
- W(t, a) < 0 ? t = n : t = i;
281
+ const c = (n + r) / 2;
282
+ W(t, c) < 0 ? t = n : t = r;
283
283
  } else
284
- t = i;
285
- return t = Math.min(s, t), t = C(t), t;
284
+ t = r;
285
+ return t = Math.min(s, t), t = R(t), t;
286
286
  }
287
- function Q({
287
+ function U({
288
288
  delta: e,
289
289
  initialLayout: t,
290
290
  panelConstraints: n,
291
291
  pivotIndices: o,
292
292
  prevLayout: s,
293
- trigger: i
293
+ trigger: r
294
294
  }) {
295
295
  if (L(e, 0))
296
296
  return t;
297
- const a = Object.values(t), r = Object.values(s), l = [...a], [c, u] = o;
298
- S(c != null, "Invalid first pivot index"), S(u != null, "Invalid second pivot index");
297
+ const c = Object.values(t), i = Object.values(s), a = [...c], [l, u] = o;
298
+ S(l != null, "Invalid first pivot index"), S(u != null, "Invalid second pivot index");
299
299
  let f = 0;
300
- if (i === "keyboard") {
300
+ if (r === "keyboard") {
301
301
  {
302
- const p = e < 0 ? u : c, d = n[p];
302
+ const p = e < 0 ? u : l, d = n[p];
303
303
  S(
304
304
  d,
305
305
  `Panel constraints not found for index ${p}`
306
306
  );
307
307
  const {
308
308
  collapsedSize: h = 0,
309
- collapsible: v,
309
+ collapsible: y,
310
310
  minSize: z = 0
311
311
  } = d;
312
- if (v) {
313
- const x = a[p];
312
+ if (y) {
313
+ const x = c[p];
314
314
  if (S(
315
315
  x != null,
316
316
  `Previous layout not found for panel index ${p}`
317
317
  ), L(x, h)) {
318
- const y = z - x;
319
- W(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
318
+ const g = z - x;
319
+ W(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
320
320
  }
321
321
  }
322
322
  }
323
323
  {
324
- const p = e < 0 ? c : u, d = n[p];
324
+ const p = e < 0 ? l : u, d = n[p];
325
325
  S(
326
326
  d,
327
327
  `No panel constraints found for index ${p}`
328
328
  );
329
329
  const {
330
330
  collapsedSize: h = 0,
331
- collapsible: v,
331
+ collapsible: y,
332
332
  minSize: z = 0
333
333
  } = d;
334
- if (v) {
335
- const x = a[p];
334
+ if (y) {
335
+ const x = c[p];
336
336
  if (S(
337
337
  x != null,
338
338
  `Previous layout not found for panel index ${p}`
339
339
  ), L(x, z)) {
340
- const y = x - h;
341
- W(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
340
+ const g = x - h;
341
+ W(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
342
342
  }
343
343
  }
344
344
  }
345
345
  }
346
346
  {
347
347
  const p = e < 0 ? 1 : -1;
348
- let d = e < 0 ? u : c, h = 0;
348
+ let d = e < 0 ? u : l, h = 0;
349
349
  for (; ; ) {
350
- const z = a[d];
350
+ const z = c[d];
351
351
  S(
352
352
  z != null,
353
353
  `Previous layout not found for panel index ${d}`
354
354
  );
355
- const y = _({
355
+ const g = F({
356
356
  panelConstraints: n[d],
357
357
  size: 100
358
358
  }) - z;
359
- if (h += y, d += p, d < 0 || d >= n.length)
359
+ if (h += g, d += p, d < 0 || d >= n.length)
360
360
  break;
361
361
  }
362
- const v = Math.min(Math.abs(e), Math.abs(h));
363
- e = e < 0 ? 0 - v : v;
362
+ const y = Math.min(Math.abs(e), Math.abs(h));
363
+ e = e < 0 ? 0 - y : y;
364
364
  }
365
365
  {
366
- let d = e < 0 ? c : u;
366
+ let d = e < 0 ? l : u;
367
367
  for (; d >= 0 && d < n.length; ) {
368
- const h = Math.abs(e) - Math.abs(f), v = a[d];
368
+ const h = Math.abs(e) - Math.abs(f), y = c[d];
369
369
  S(
370
- v != null,
370
+ y != null,
371
371
  `Previous layout not found for panel index ${d}`
372
372
  );
373
- const z = v - h, x = _({
373
+ const z = y - h, x = F({
374
374
  panelConstraints: n[d],
375
375
  size: z
376
376
  });
377
- if (!L(v, x) && (f += v - x, l[d] = x, f.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
377
+ if (!L(y, x) && (f += y - x, a[d] = x, f.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
378
378
  numeric: !0
379
379
  }) >= 0))
380
380
  break;
381
381
  e < 0 ? d-- : d++;
382
382
  }
383
383
  }
384
- if (Xe(r, l))
384
+ if (qe(i, a))
385
385
  return s;
386
386
  {
387
- const p = e < 0 ? u : c, d = a[p];
387
+ const p = e < 0 ? u : l, d = c[p];
388
388
  S(
389
389
  d != null,
390
390
  `Previous layout not found for panel index ${p}`
391
391
  );
392
- const h = d + f, v = _({
392
+ const h = d + f, y = F({
393
393
  panelConstraints: n[p],
394
394
  size: h
395
395
  });
396
- if (l[p] = v, !L(v, h)) {
397
- let z = h - v, y = e < 0 ? u : c;
398
- for (; y >= 0 && y < n.length; ) {
399
- const w = l[y];
396
+ if (a[p] = y, !L(y, h)) {
397
+ let z = h - y, g = e < 0 ? u : l;
398
+ for (; g >= 0 && g < n.length; ) {
399
+ const w = a[g];
400
400
  S(
401
401
  w != null,
402
- `Previous layout not found for panel index ${y}`
402
+ `Previous layout not found for panel index ${g}`
403
403
  );
404
- const G = w + z, O = _({
405
- panelConstraints: n[y],
404
+ const G = w + z, O = F({
405
+ panelConstraints: n[g],
406
406
  size: G
407
407
  });
408
- if (L(w, O) || (z -= O - w, l[y] = O), L(z, 0))
408
+ if (L(w, O) || (z -= O - w, a[g] = O), L(z, 0))
409
409
  break;
410
- e > 0 ? y-- : y++;
410
+ e > 0 ? g-- : g++;
411
411
  }
412
412
  }
413
413
  }
414
- const m = Object.values(l).reduce(
414
+ const m = Object.values(a).reduce(
415
415
  (p, d) => d + p,
416
416
  0
417
417
  );
418
418
  if (!L(m, 100, 0.1))
419
419
  return s;
420
- const g = Object.keys(s);
421
- return l.reduce((p, d, h) => (p[g[h]] = d, p), {});
420
+ const v = Object.keys(s);
421
+ return a.reduce((p, d, h) => (p[v[h]] = d, p), {});
422
422
  }
423
- function J(e) {
423
+ function ee(e) {
424
424
  const t = e.parentElement;
425
425
  S(t, "Parent group element not found");
426
426
  const { mountedGroups: n } = k();
@@ -429,7 +429,7 @@ function J(e) {
429
429
  return o;
430
430
  throw Error("Could not find parent Group for separator element");
431
431
  }
432
- function ee(e, t) {
432
+ function B(e, t) {
433
433
  if (Object.keys(e).length !== Object.keys(t).length)
434
434
  return !1;
435
435
  for (const n in e)
@@ -437,48 +437,48 @@ function ee(e, t) {
437
437
  return !1;
438
438
  return !0;
439
439
  }
440
- function F({
440
+ function $({
441
441
  layout: e,
442
442
  panelConstraints: t
443
443
  }) {
444
444
  const o = [...Object.values(e)], s = o.reduce(
445
- (r, l) => r + l,
445
+ (i, a) => i + a,
446
446
  0
447
447
  );
448
448
  if (o.length !== t.length)
449
449
  throw Error(
450
- `Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
450
+ `Invalid ${t.length} panel layout: ${o.map((i) => `${i}%`).join(", ")}`
451
451
  );
452
452
  if (!L(s, 100) && o.length > 0)
453
- for (let r = 0; r < t.length; r++) {
454
- const l = o[r];
455
- S(l != null, `No layout data found for index ${r}`);
456
- const c = 100 / s * l;
457
- o[r] = c;
453
+ for (let i = 0; i < t.length; i++) {
454
+ const a = o[i];
455
+ S(a != null, `No layout data found for index ${i}`);
456
+ const l = 100 / s * a;
457
+ o[i] = l;
458
458
  }
459
- let i = 0;
460
- for (let r = 0; r < t.length; r++) {
461
- const l = o[r];
462
- S(l != null, `No layout data found for index ${r}`);
463
- const c = _({
464
- panelConstraints: t[r],
465
- size: l
459
+ let r = 0;
460
+ for (let i = 0; i < t.length; i++) {
461
+ const a = o[i];
462
+ S(a != null, `No layout data found for index ${i}`);
463
+ const l = F({
464
+ panelConstraints: t[i],
465
+ size: a
466
466
  });
467
- l != c && (i += l - c, o[r] = c);
467
+ a != l && (r += a - l, o[i] = l);
468
468
  }
469
- if (!L(i, 0))
470
- for (let r = 0; r < t.length; r++) {
471
- const l = o[r];
472
- S(l != null, `No layout data found for index ${r}`);
473
- const c = l + i, u = _({
474
- panelConstraints: t[r],
475
- size: c
469
+ if (!L(r, 0))
470
+ for (let i = 0; i < t.length; i++) {
471
+ const a = o[i];
472
+ S(a != null, `No layout data found for index ${i}`);
473
+ const l = a + r, u = F({
474
+ panelConstraints: t[i],
475
+ size: l
476
476
  });
477
- if (l !== u && (i -= u - l, o[r] = u, L(i, 0)))
477
+ if (a !== u && (r -= u - a, o[i] = u, L(r, 0)))
478
478
  break;
479
479
  }
480
- const a = Object.keys(e);
481
- return o.reduce((r, l, c) => (r[a[c]] = l, r), {});
480
+ const c = Object.keys(e);
481
+ return o.reduce((i, a, l) => (i[c[l]] = a, i), {});
482
482
  }
483
483
  function be({
484
484
  groupId: e
@@ -499,19 +499,19 @@ function be({
499
499
  const {
500
500
  derivedPanelConstraints: o,
501
501
  group: s,
502
- layout: i,
503
- separatorToPanels: a
504
- } = t(), r = F({
502
+ layout: r,
503
+ separatorToPanels: c
504
+ } = t(), i = $({
505
505
  layout: n,
506
506
  panelConstraints: o
507
507
  });
508
- return ee(i, r) || M((l) => ({
509
- mountedGroups: new Map(l.mountedGroups).set(s, {
508
+ return B(r, i) || E((a) => ({
509
+ mountedGroups: new Map(a.mountedGroups).set(s, {
510
510
  derivedPanelConstraints: o,
511
- layout: r,
512
- separatorToPanels: a
511
+ layout: i,
512
+ separatorToPanels: c
513
513
  })
514
- })), r;
514
+ })), i;
515
515
  }
516
516
  };
517
517
  }
@@ -519,25 +519,25 @@ function we(e) {
519
519
  const { mountedGroups: t } = k(), n = t.get(e);
520
520
  return S(n, `Mounted Group ${e.id} not found`), n;
521
521
  }
522
- function T(e, t) {
523
- const n = J(e), o = we(n), s = n.separators.find(
522
+ function D(e, t) {
523
+ const n = ee(e), o = we(n), s = n.separators.find(
524
524
  (f) => f.element === e
525
525
  );
526
526
  S(s, "Matching separator not found");
527
- const i = o.separatorToPanels.get(s);
528
- S(i, "Matching panels not found");
529
- const a = i.map((f) => n.panels.indexOf(f)), l = be({ groupId: n.id }).getLayout(), c = Q({
527
+ const r = o.separatorToPanels.get(s);
528
+ S(r, "Matching panels not found");
529
+ const c = r.map((f) => n.panels.indexOf(f)), a = be({ groupId: n.id }).getLayout(), l = U({
530
530
  delta: t,
531
- initialLayout: l,
531
+ initialLayout: a,
532
532
  panelConstraints: o.derivedPanelConstraints,
533
- pivotIndices: a,
534
- prevLayout: l,
533
+ pivotIndices: c,
534
+ prevLayout: a,
535
535
  trigger: "keyboard"
536
- }), u = F({
537
- layout: c,
536
+ }), u = $({
537
+ layout: l,
538
538
  panelConstraints: o.derivedPanelConstraints
539
539
  });
540
- ee(l, u) || M((f) => ({
540
+ B(a, u) || E((f) => ({
541
541
  mountedGroups: new Map(f.mountedGroups).set(n, {
542
542
  derivedPanelConstraints: o.derivedPanelConstraints,
543
543
  layout: u,
@@ -548,70 +548,70 @@ function T(e, t) {
548
548
  function me(e) {
549
549
  if (e.defaultPrevented)
550
550
  return;
551
- const t = e.currentTarget, n = J(t);
551
+ const t = e.currentTarget, n = ee(t);
552
552
  if (!n.disabled)
553
553
  switch (e.key) {
554
554
  case "ArrowDown": {
555
- e.preventDefault(), n.orientation === "vertical" && T(t, 5);
555
+ e.preventDefault(), n.orientation === "vertical" && D(t, 5);
556
556
  break;
557
557
  }
558
558
  case "ArrowLeft": {
559
- e.preventDefault(), n.orientation === "horizontal" && T(t, -5);
559
+ e.preventDefault(), n.orientation === "horizontal" && D(t, -5);
560
560
  break;
561
561
  }
562
562
  case "ArrowRight": {
563
- e.preventDefault(), n.orientation === "horizontal" && T(t, 5);
563
+ e.preventDefault(), n.orientation === "horizontal" && D(t, 5);
564
564
  break;
565
565
  }
566
566
  case "ArrowUp": {
567
- e.preventDefault(), n.orientation === "vertical" && T(t, -5);
567
+ e.preventDefault(), n.orientation === "vertical" && D(t, -5);
568
568
  break;
569
569
  }
570
570
  case "End": {
571
- e.preventDefault(), T(t, 100);
571
+ e.preventDefault(), D(t, 100);
572
572
  break;
573
573
  }
574
574
  case "Enter": {
575
575
  e.preventDefault();
576
- const o = J(t), { derivedPanelConstraints: s, layout: i, separatorToPanels: a } = we(o), r = o.separators.find(
576
+ const o = ee(t), { derivedPanelConstraints: s, layout: r, separatorToPanels: c } = we(o), i = o.separators.find(
577
577
  (f) => f.element === t
578
578
  );
579
- S(r, "Matching separator not found");
580
- const l = a.get(r);
581
- S(l, "Matching panels not found");
582
- const c = l[0], u = s.find(
583
- (f) => f.panelId === c.id
579
+ S(i, "Matching separator not found");
580
+ const a = c.get(i);
581
+ S(a, "Matching panels not found");
582
+ const l = a[0], u = s.find(
583
+ (f) => f.panelId === l.id
584
584
  );
585
585
  if (S(u, "Panel metadata not found"), u.collapsible) {
586
- const f = i[c.id], m = u.collapsedSize === f ? o.inMemoryLastExpandedPanelSizes[c.id] ?? u.minSize : u.collapsedSize;
587
- T(t, m - f);
586
+ const f = r[l.id], m = u.collapsedSize === f ? o.inMemoryLastExpandedPanelSizes[l.id] ?? u.minSize : u.collapsedSize;
587
+ D(t, m - f);
588
588
  }
589
589
  break;
590
590
  }
591
591
  case "F6": {
592
592
  e.preventDefault();
593
- const s = J(t).separators.map(
594
- (l) => l.element
595
- ), i = Array.from(s).findIndex(
596
- (l) => l === e.currentTarget
593
+ const s = ee(t).separators.map(
594
+ (a) => a.element
595
+ ), r = Array.from(s).findIndex(
596
+ (a) => a === e.currentTarget
597
597
  );
598
- S(i !== null, "Index not found");
599
- const a = e.shiftKey ? i > 0 ? i - 1 : s.length - 1 : i + 1 < s.length ? i + 1 : 0;
600
- s[a].focus();
598
+ S(r !== null, "Index not found");
599
+ const c = e.shiftKey ? r > 0 ? r - 1 : s.length - 1 : r + 1 < s.length ? r + 1 : 0;
600
+ s[c].focus();
601
601
  break;
602
602
  }
603
603
  case "Home": {
604
- e.preventDefault(), T(t, -100);
604
+ e.preventDefault(), D(t, -100);
605
605
  break;
606
606
  }
607
607
  }
608
608
  }
609
- const Ye = (e) => e, oe = () => {
610
- }, Le = 1, Pe = 2, Ee = 4, Re = 8, he = {
609
+ const Xe = (e) => e, oe = () => {
610
+ }, Le = 1, Pe = 2, Ee = 4, Ce = 8, he = {
611
611
  coarse: 10,
612
612
  precise: 5
613
613
  };
614
- function Ze(e, t) {
614
+ function Ye(e, t) {
615
615
  return {
616
616
  x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
617
617
  Math.abs(e.x - t.left),
@@ -623,20 +623,20 @@ function Ze(e, t) {
623
623
  )
624
624
  };
625
625
  }
626
- function qe(e, t, n) {
626
+ function Ze(e, t, n) {
627
627
  let o, s = {
628
628
  x: 1 / 0,
629
629
  y: 1 / 0
630
630
  };
631
- for (const i of t) {
632
- const a = Ze(n, i.rect);
631
+ for (const r of t) {
632
+ const c = Ye(n, r.rect);
633
633
  switch (e) {
634
634
  case "horizontal": {
635
- a.x <= s.x && (o = i, s = a);
635
+ c.x <= s.x && (o = r, s = c);
636
636
  break;
637
637
  }
638
638
  case "vertical": {
639
- a.y <= s.y && (o = i, s = a);
639
+ c.y <= s.y && (o = r, s = c);
640
640
  break;
641
641
  }
642
642
  }
@@ -646,36 +646,36 @@ function qe(e, t, n) {
646
646
  hitRegion: o
647
647
  } : void 0;
648
648
  }
649
- let Z;
649
+ let J;
650
650
  function Je() {
651
- return Z === void 0 && (typeof matchMedia == "function" ? Z = !!matchMedia("(pointer:coarse)").matches : Z = !1), Z;
651
+ return J === void 0 && (typeof matchMedia == "function" ? J = !!matchMedia("(pointer:coarse)").matches : J = !1), J;
652
652
  }
653
- function Ce(e, t) {
653
+ function Me(e, t) {
654
654
  const n = [];
655
655
  return t.forEach((o, s) => {
656
656
  if (s.disabled)
657
657
  return;
658
- const i = Je() ? he.coarse : he.precise, a = ze(s), r = qe(s.orientation, a, {
658
+ const r = Je() ? he.coarse : he.precise, c = ze(s), i = Ze(s.orientation, c, {
659
659
  x: e.clientX,
660
660
  y: e.clientY
661
661
  });
662
- r && r.distance.x <= i && r.distance.y <= i && n.push(r.hitRegion);
662
+ i && i.distance.x <= r && i.distance.y <= r && n.push(i.hitRegion);
663
663
  }), n;
664
664
  }
665
665
  function ve(e) {
666
666
  if (e.defaultPrevented)
667
667
  return;
668
- const { mountedGroups: t } = k(), n = Ce(e, t), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
669
- n.forEach((r) => {
670
- o.add(r.group), r.panels.forEach((c) => {
671
- s.add(c);
672
- }), r.separator && i.add(r.separator);
673
- const l = t.get(r.group);
674
- l && a.set(r.group, l.layout);
675
- }), M({
668
+ const { mountedGroups: t } = k(), n = Me(e, t), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
669
+ n.forEach((i) => {
670
+ o.add(i.group), i.panels.forEach((l) => {
671
+ s.add(l);
672
+ }), i.separator && r.add(i.separator);
673
+ const a = t.get(i.group);
674
+ a && c.set(i.group, a.layout);
675
+ }), E({
676
676
  interactionState: {
677
677
  hitRegions: n,
678
- initialLayoutMap: a,
678
+ initialLayoutMap: c,
679
679
  pointerDownAtPoint: { x: e.clientX, y: e.clientY },
680
680
  state: "active"
681
681
  }
@@ -690,9 +690,9 @@ function Qe({
690
690
  switch (n) {
691
691
  case "active":
692
692
  case "hover":
693
- t.forEach((i) => {
694
- if (!i.disableCursor)
695
- switch (i.orientation) {
693
+ t.forEach((r) => {
694
+ if (!r.disableCursor)
695
+ switch (r.orientation) {
696
696
  case "horizontal": {
697
697
  o++;
698
698
  break;
@@ -708,15 +708,15 @@ function Qe({
708
708
  return null;
709
709
  switch (n) {
710
710
  case "active": {
711
- const i = (e & Le) !== 0, a = (e & Pe) !== 0, r = (e & Ee) !== 0, l = (e & Re) !== 0;
711
+ const r = (e & Le) !== 0, c = (e & Pe) !== 0, i = (e & Ee) !== 0, a = (e & Ce) !== 0;
712
712
  if (e) {
713
- if (i)
714
- return r ? "se-resize" : l ? "ne-resize" : "e-resize";
715
- if (a)
716
- return r ? "sw-resize" : l ? "nw-resize" : "w-resize";
717
713
  if (r)
714
+ return i ? "se-resize" : a ? "ne-resize" : "e-resize";
715
+ if (c)
716
+ return i ? "sw-resize" : a ? "nw-resize" : "w-resize";
717
+ if (i)
718
718
  return "s-resize";
719
- if (l)
719
+ if (a)
720
720
  return "n-resize";
721
721
  }
722
722
  break;
@@ -747,7 +747,7 @@ function se() {
747
747
  }
748
748
  }
749
749
  }
750
- function q(e) {
750
+ function Q(e) {
751
751
  if (e.defaultPrevented)
752
752
  return;
753
753
  const { interactionState: t, mountedGroups: n } = k();
@@ -757,8 +757,8 @@ function q(e) {
757
757
  // Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
758
758
  e.type !== "pointerleave" && e.buttons === 0
759
759
  ) {
760
- M(
761
- (i) => i.interactionState.state === "inactive" ? i : {
760
+ E(
761
+ (r) => r.interactionState.state === "inactive" ? r : {
762
762
  cursorFlags: 0,
763
763
  interactionState: {
764
764
  state: "inactive"
@@ -769,59 +769,59 @@ function q(e) {
769
769
  }
770
770
  let o = 0;
771
771
  const s = new Map(n);
772
- t.hitRegions.forEach((i) => {
773
- const { disableCursor: a, element: r, orientation: l, panels: c } = i.group;
772
+ t.hitRegions.forEach((r) => {
773
+ const { disableCursor: c, element: i, orientation: a, panels: l } = r.group;
774
774
  let u = 0;
775
- t.state === "active" && (l === "horizontal" ? u = (e.clientX - t.pointerDownAtPoint.x) / r.offsetWidth * 100 : u = (e.clientY - t.pointerDownAtPoint.y) / r.offsetHeight * 100);
775
+ t.state === "active" && (a === "horizontal" ? u = (e.clientX - t.pointerDownAtPoint.x) / i.offsetWidth * 100 : u = (e.clientY - t.pointerDownAtPoint.y) / i.offsetHeight * 100);
776
776
  const f = t.initialLayoutMap.get(
777
- i.group
777
+ r.group
778
778
  ), {
779
779
  derivedPanelConstraints: m,
780
- layout: g,
780
+ layout: v,
781
781
  separatorToPanels: p
782
- } = n.get(i.group) ?? {};
783
- if (m && f && g && p) {
784
- const d = Q({
782
+ } = n.get(r.group) ?? {};
783
+ if (m && f && v && p) {
784
+ const d = U({
785
785
  delta: u,
786
786
  initialLayout: f,
787
787
  panelConstraints: m,
788
- pivotIndices: i.panels.map((h) => c.indexOf(h)),
789
- prevLayout: g,
788
+ pivotIndices: r.panels.map((h) => l.indexOf(h)),
789
+ prevLayout: v,
790
790
  trigger: "mouse-or-touch"
791
791
  });
792
- if (ee(d, g)) {
793
- if (u !== 0 && !a)
794
- switch (l) {
792
+ if (B(d, v)) {
793
+ if (u !== 0 && !c)
794
+ switch (a) {
795
795
  case "horizontal": {
796
796
  o |= u < 0 ? Le : Pe;
797
797
  break;
798
798
  }
799
799
  case "vertical": {
800
- o |= u < 0 ? Ee : Re;
800
+ o |= u < 0 ? Ee : Ce;
801
801
  break;
802
802
  }
803
803
  }
804
804
  } else {
805
- s.set(i.group, {
805
+ s.set(r.group, {
806
806
  derivedPanelConstraints: m,
807
807
  layout: d,
808
808
  separatorToPanels: p
809
809
  });
810
- const h = i.group.panels.map(({ id: v }) => v).join(",");
811
- i.group.inMemoryLayouts[h] = d;
810
+ const h = r.group.panels.map(({ id: y }) => y).join(",");
811
+ r.group.inMemoryLayouts[h] = d;
812
812
  }
813
813
  }
814
- }), M({
814
+ }), E({
815
815
  cursorFlags: o,
816
816
  mountedGroups: s
817
817
  }), se();
818
818
  break;
819
819
  }
820
820
  default: {
821
- const o = Ce(e, n);
822
- o.length === 0 ? t.state !== "inactive" && M({
821
+ const o = Me(e, n);
822
+ o.length === 0 ? t.state !== "inactive" && E({
823
823
  interactionState: { state: "inactive" }
824
- }) : M({
824
+ }) : E({
825
825
  interactionState: {
826
826
  hitRegions: o,
827
827
  state: "hover"
@@ -838,7 +838,7 @@ function ye(e) {
838
838
  const { interactionState: t } = k();
839
839
  switch (t.state) {
840
840
  case "active":
841
- M({
841
+ E({
842
842
  cursorFlags: 0,
843
843
  interactionState: {
844
844
  state: "inactive"
@@ -849,18 +849,18 @@ function ye(e) {
849
849
  function et(e) {
850
850
  let t = 0, n = 0;
851
851
  const o = {};
852
- for (const i of e)
853
- if (i.defaultSize !== void 0) {
852
+ for (const r of e)
853
+ if (r.defaultSize !== void 0) {
854
854
  t++;
855
- const a = C(i.defaultSize);
856
- n += a, o[i.panelId] = a;
855
+ const c = R(r.defaultSize);
856
+ n += c, o[r.panelId] = c;
857
857
  } else
858
- o[i.panelId] = void 0;
858
+ o[r.panelId] = void 0;
859
859
  const s = e.length - t;
860
860
  if (s !== 0) {
861
- const i = C((100 - n) / s);
862
- for (const a of e)
863
- a.defaultSize === void 0 && (o[a.panelId] = i);
861
+ const r = R((100 - n) / s);
862
+ for (const c of e)
863
+ c.defaultSize === void 0 && (o[c.panelId] = r);
864
864
  }
865
865
  return o;
866
866
  }
@@ -868,14 +868,14 @@ function tt(e, t, n) {
868
868
  const o = n[0];
869
869
  if (!o)
870
870
  return;
871
- const s = e.panels.find((a) => a.element === t);
871
+ const s = e.panels.find((c) => c.element === t);
872
872
  if (!s || !s.onResize)
873
873
  return;
874
- const i = le({ group: e });
874
+ const r = le({ group: e });
875
875
  s.onResize(
876
876
  {
877
- asPercentage: C(
878
- o.inlineSize / i * 100
877
+ asPercentage: R(
878
+ o.inlineSize / r * 100
879
879
  ),
880
880
  inPixels: o.inlineSize
881
881
  },
@@ -884,63 +884,73 @@ function tt(e, t, n) {
884
884
  }
885
885
  function nt(e) {
886
886
  let t = !0;
887
- const n = new ResizeObserver((c) => {
888
- for (const u of c) {
889
- const { borderBoxSize: f, target: m } = u;
890
- m === e.element ? t && M((g) => {
891
- const p = g.mountedGroups.get(e);
892
- if (p) {
893
- const d = pe(e), h = p.layout, v = F({
894
- layout: h,
895
- panelConstraints: d
887
+ S(
888
+ e.separators.length === 0 || e.separators.length < e.panels.length,
889
+ "Invalid Group configuration; too many Separator components"
890
+ );
891
+ const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = new ResizeObserver((f) => {
892
+ for (const m of f) {
893
+ const { borderBoxSize: v, target: p } = m;
894
+ p === e.element ? t && E((d) => {
895
+ const h = d.mountedGroups.get(e);
896
+ if (h) {
897
+ const y = pe(e), z = h.layout, x = $({
898
+ layout: z,
899
+ panelConstraints: y
896
900
  });
897
901
  return {
898
- mountedGroups: new Map(g.mountedGroups).set(e, {
899
- derivedPanelConstraints: d,
900
- layout: v,
901
- separatorToPanels: p.separatorToPanels
902
+ mountedGroups: new Map(d.mountedGroups).set(e, {
903
+ derivedPanelConstraints: y,
904
+ layout: x,
905
+ separatorToPanels: h.separatorToPanels
902
906
  })
903
907
  };
904
908
  }
905
- return g;
906
- }) : tt(e, m, f);
909
+ return d;
910
+ }) : tt(e, p, v);
907
911
  }
908
912
  });
909
- n.observe(e.element), e.panels.forEach((c) => {
910
- c.onResize && n.observe(c.element);
913
+ s.observe(e.element), e.panels.forEach((f) => {
914
+ S(
915
+ !n.has(f.id),
916
+ `Panel ids must be unique; id "${f.id}" was used more than once`
917
+ ), n.add(f.id), f.onResize && s.observe(f.element);
911
918
  });
912
- const o = pe(e), s = e.panels.map(({ id: c }) => c).join(","), i = e.inMemoryLayouts[s] ?? e.defaultLayout ?? et(o), a = F({
919
+ const r = pe(e), c = e.panels.map(({ id: f }) => f).join(","), i = e.inMemoryLayouts[c] ?? e.defaultLayout ?? et(r), a = $({
913
920
  layout: i,
914
- panelConstraints: o
915
- }), r = ze(e), l = M((c) => ({
916
- mountedGroups: new Map(c.mountedGroups).set(e, {
917
- derivedPanelConstraints: o,
921
+ panelConstraints: r
922
+ }), l = ze(e), u = E((f) => ({
923
+ mountedGroups: new Map(f.mountedGroups).set(e, {
924
+ derivedPanelConstraints: r,
918
925
  layout: a,
919
926
  separatorToPanels: new Map(
920
- r.filter((u) => u.separator).map((u) => [u.separator, u.panels])
927
+ l.filter((m) => m.separator).map((m) => [m.separator, m.panels])
921
928
  )
922
929
  })
923
930
  }));
924
- return e.separators.forEach((c) => {
925
- c.element.addEventListener("keydown", me);
926
- }), l.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ve), window.addEventListener("pointerleave", q), window.addEventListener("pointermove", q), window.addEventListener("pointerup", ye)), function() {
931
+ return e.separators.forEach((f) => {
932
+ S(
933
+ !o.has(f.id),
934
+ `Separator ids must be unique; id "${f.id}" was used more than once`
935
+ ), o.add(f.id), f.element.addEventListener("keydown", me);
936
+ }), u.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ve), window.addEventListener("pointerleave", Q), window.addEventListener("pointermove", Q), window.addEventListener("pointerup", ye)), function() {
927
937
  t = !1;
928
- const u = M((f) => {
929
- const m = new Map(f.mountedGroups);
930
- return m.delete(e), { mountedGroups: m };
938
+ const m = E((v) => {
939
+ const p = new Map(v.mountedGroups);
940
+ return p.delete(e), { mountedGroups: p };
931
941
  });
932
- e.separators.forEach((f) => {
933
- f.element.removeEventListener("keydown", me);
934
- }), u.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ve), window.removeEventListener("pointerleave", q), window.removeEventListener("pointermove", q), window.removeEventListener("pointerup", ye)), n.disconnect();
942
+ e.separators.forEach((v) => {
943
+ v.element.removeEventListener("keydown", me);
944
+ }), m.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ve), window.removeEventListener("pointerleave", Q), window.removeEventListener("pointermove", Q), window.removeEventListener("pointerup", ye)), s.disconnect();
935
945
  };
936
946
  }
937
947
  function ce(e) {
938
- const t = De();
948
+ const t = Te();
939
949
  return `${e ?? t}`;
940
950
  }
941
- const H = typeof window < "u" ? Te : Ae;
951
+ const H = typeof window < "u" ? De : Ae;
942
952
  function ue(e) {
943
- const t = D(e);
953
+ const t = T(e);
944
954
  return H(() => {
945
955
  t.current = e;
946
956
  }, [e]), ge((n) => t.current?.(n), [t]);
@@ -962,16 +972,16 @@ function fe(...e) {
962
972
  });
963
973
  });
964
974
  }
965
- const Me = "--react-resizable-panels--panel--pointer-events";
975
+ const Re = "--react-resizable-panels--panel--pointer-events";
966
976
  function Ge(e, t) {
967
977
  const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
968
978
  return `--react-resizable-panels--${n}--${o}`;
969
979
  }
970
980
  const Ie = $e(null);
971
981
  function ot(e, t) {
972
- const n = D({
982
+ const n = T({
973
983
  getLayout: () => ({}),
974
- setLayout: Ye
984
+ setLayout: Xe
975
985
  });
976
986
  Se(t, () => n.current, []), H(() => {
977
987
  Object.assign(
@@ -986,58 +996,58 @@ function ft({
986
996
  defaultLayout: n,
987
997
  disableCursor: o,
988
998
  disabled: s,
989
- elementRef: i,
990
- groupRef: a,
991
- id: r,
992
- onLayoutChange: l,
993
- orientation: c = "horizontal",
999
+ elementRef: r,
1000
+ groupRef: c,
1001
+ id: i,
1002
+ onLayoutChange: a,
1003
+ orientation: l = "horizontal",
994
1004
  style: u
995
1005
  }) {
996
- const f = D({}), m = ue((b) => {
997
- ee(f.current, b) || (f.current = b, l?.(b));
998
- }), g = ce(r), [p, d] = R(!1), [h, v] = R(null), [z, x] = R(n ?? {}), [y, w] = R([]), [G, O] = R([]), te = D({}), U = D({}), B = fe(v, i);
999
- ot(g, a);
1000
- const K = xe(
1006
+ const f = T({}), m = ue((b) => {
1007
+ B(f.current, b) || (f.current = b, a?.(b));
1008
+ }), v = ce(i), [p, d] = M(!1), [h, y] = M(null), [z, x] = M(n ?? {}), [g, w] = M([]), [G, O] = M([]), te = T({}), K = T({}), V = fe(y, r);
1009
+ ot(v, c);
1010
+ const q = xe(
1001
1011
  () => ({
1002
- id: g,
1003
- orientation: c,
1004
- registerPanel: (b) => (w((E) => re(c, [...E, b])), () => {
1005
- w((E) => E.filter(($) => $ !== b));
1012
+ id: v,
1013
+ orientation: l,
1014
+ registerPanel: (b) => (w((C) => re(l, [...C, b])), () => {
1015
+ w((C) => C.filter((N) => N !== b));
1006
1016
  }),
1007
1017
  registerSeparator: (b) => (O(
1008
- (E) => re(c, [...E, b])
1018
+ (C) => re(l, [...C, b])
1009
1019
  ), () => {
1010
1020
  O(
1011
- (E) => E.filter(($) => $ !== b)
1021
+ (C) => C.filter((N) => N !== b)
1012
1022
  );
1013
1023
  })
1014
1024
  }),
1015
- [g, c]
1025
+ [v, l]
1016
1026
  );
1017
1027
  H(() => {
1018
- if (h !== null && y.length > 0) {
1028
+ if (h !== null && g.length > 0) {
1019
1029
  const b = {
1020
1030
  defaultLayout: n,
1021
1031
  disableCursor: !!o,
1022
1032
  disabled: !!s,
1023
1033
  element: h,
1024
- id: g,
1034
+ id: v,
1025
1035
  inMemoryLastExpandedPanelSizes: te.current,
1026
- inMemoryLayouts: U.current,
1027
- orientation: c,
1028
- panels: y,
1036
+ inMemoryLayouts: K.current,
1037
+ orientation: l,
1038
+ panels: g,
1029
1039
  separators: G
1030
- }, E = nt(b), ne = k().mountedGroups.get(b);
1040
+ }, C = nt(b), ne = k().mountedGroups.get(b);
1031
1041
  ne && (x(ne.layout), m?.(ne.layout));
1032
1042
  const ke = A.addListener(
1033
1043
  "interactionStateChange",
1034
- (X) => {
1035
- switch (X.state) {
1044
+ (Y) => {
1045
+ switch (Y.state) {
1036
1046
  case "active":
1037
1047
  case "hover": {
1038
1048
  d(
1039
- X.hitRegions.some(
1040
- (N) => N.group === b
1049
+ Y.hitRegions.some(
1050
+ (_) => _.group === b
1041
1051
  )
1042
1052
  );
1043
1053
  break;
@@ -1046,13 +1056,13 @@ function ft({
1046
1056
  }
1047
1057
  ), Oe = A.addListener(
1048
1058
  "mountedGroupsChange",
1049
- (X) => {
1050
- const N = X.get(b);
1051
- N && N.derivedPanelConstraints.length > 0 && (x(N.layout), m?.(N.layout));
1059
+ (Y) => {
1060
+ const _ = Y.get(b);
1061
+ _ && _.derivedPanelConstraints.length > 0 && (x(_.layout), m?.(_.layout));
1052
1062
  }
1053
1063
  );
1054
1064
  return () => {
1055
- E(), ke(), Oe();
1065
+ C(), ke(), Oe();
1056
1066
  };
1057
1067
  }
1058
1068
  }, [
@@ -1060,32 +1070,32 @@ function ft({
1060
1070
  o,
1061
1071
  s,
1062
1072
  h,
1063
- g,
1073
+ v,
1064
1074
  m,
1065
- c,
1066
- y,
1075
+ l,
1076
+ g,
1067
1077
  G
1068
1078
  ]);
1069
- const V = {
1070
- [Me]: p ? "none" : void 0
1079
+ const X = {
1080
+ [Re]: p ? "none" : void 0
1071
1081
  };
1072
1082
  for (const b in z) {
1073
- const E = Ge(g, b), $ = z[b];
1074
- V[E] = $;
1083
+ const C = Ge(v, b), N = z[b];
1084
+ X[C] = N;
1075
1085
  }
1076
- return /* @__PURE__ */ j(Ie.Provider, { value: K, children: /* @__PURE__ */ j(
1086
+ return /* @__PURE__ */ j(Ie.Provider, { value: q, children: /* @__PURE__ */ j(
1077
1087
  "div",
1078
1088
  {
1079
- "aria-orientation": c,
1089
+ "aria-orientation": l,
1080
1090
  className: t,
1081
1091
  "data-group": !0,
1082
- "data-testid": r ?? void 0,
1083
- ref: B,
1092
+ "data-testid": i ?? void 0,
1093
+ ref: V,
1084
1094
  style: {
1085
1095
  ...u,
1086
- ...V,
1096
+ ...X,
1087
1097
  display: "flex",
1088
- flexDirection: c === "horizontal" ? "row" : "column",
1098
+ flexDirection: l === "horizontal" ? "row" : "column",
1089
1099
  flexWrap: "nowrap"
1090
1100
  },
1091
1101
  children: e
@@ -1119,9 +1129,9 @@ function dt({
1119
1129
  () => n ? JSON.parse(n) : null,
1120
1130
  [n]
1121
1131
  ), s = ge(
1122
- (i) => it({
1132
+ (r) => it({
1123
1133
  id: e,
1124
- layout: i,
1134
+ layout: r,
1125
1135
  storage: t
1126
1136
  }),
1127
1137
  [e, t]
@@ -1136,77 +1146,117 @@ function rt() {
1136
1146
  };
1137
1147
  }
1138
1148
  function pt() {
1139
- return R(null);
1149
+ return M(null);
1140
1150
  }
1141
1151
  function mt() {
1142
- return D(null);
1152
+ return T(null);
1143
1153
  }
1144
1154
  function de() {
1145
1155
  const e = _e(Ie);
1146
- return S(e, "Unexpected"), e;
1156
+ return S(
1157
+ e,
1158
+ "Group Context not found; did you render a Panel or Separator outside of a Group?"
1159
+ ), e;
1147
1160
  }
1148
1161
  function st({
1149
1162
  groupId: e,
1150
1163
  panelId: t
1151
1164
  }) {
1152
1165
  const n = () => {
1153
- const { mountedGroups: a } = k();
1154
- for (const [r, { derivedPanelConstraints: l, layout: c }] of a)
1155
- if (r.id === e)
1156
- return { derivedPanelConstraints: l, group: r, layout: c };
1166
+ const { mountedGroups: i } = k();
1167
+ for (const [
1168
+ a,
1169
+ { derivedPanelConstraints: l, layout: u, separatorToPanels: f }
1170
+ ] of i)
1171
+ if (a.id === e)
1172
+ return { derivedPanelConstraints: l, group: a, layout: u, separatorToPanels: f };
1157
1173
  throw Error(`Group ${e} not found`);
1158
1174
  }, o = () => {
1159
- const a = n().derivedPanelConstraints.find(
1160
- (r) => r.panelId === t
1175
+ const i = n().derivedPanelConstraints.find(
1176
+ (a) => a.panelId === t
1161
1177
  );
1162
- if (a !== void 0)
1163
- return a;
1178
+ if (i !== void 0)
1179
+ return i;
1164
1180
  throw Error(`Panel constraints not found for Panel ${t}`);
1165
1181
  }, s = () => {
1166
- const a = n().group.panels.find((r) => r.id === t);
1167
- if (a !== void 0)
1168
- return a;
1182
+ const i = n().group.panels.find((a) => a.id === t);
1183
+ if (i !== void 0)
1184
+ return i;
1169
1185
  throw Error(`Layout not found for Panel ${t}`);
1170
- }, i = () => {
1171
- const a = n().layout[t];
1172
- if (a !== void 0)
1173
- return a;
1186
+ }, r = () => {
1187
+ const i = n().layout[t];
1188
+ if (i !== void 0)
1189
+ return i;
1174
1190
  throw Error(`Layout not found for Panel ${t}`);
1191
+ }, c = (i) => {
1192
+ const a = r();
1193
+ if (i === a)
1194
+ return;
1195
+ const {
1196
+ derivedPanelConstraints: l,
1197
+ group: u,
1198
+ layout: f,
1199
+ separatorToPanels: m
1200
+ } = n(), v = u.panels.findIndex((y) => y.id === t), p = v === u.panels.length - 1, d = U({
1201
+ delta: p ? a - i : i - a,
1202
+ initialLayout: f,
1203
+ panelConstraints: l,
1204
+ pivotIndices: p ? [v - 1, v] : [v, v + 1],
1205
+ prevLayout: f,
1206
+ trigger: "imperative-api"
1207
+ }), h = $({
1208
+ layout: d,
1209
+ panelConstraints: l
1210
+ });
1211
+ B(f, h) || E((y) => ({
1212
+ mountedGroups: new Map(y.mountedGroups).set(u, {
1213
+ derivedPanelConstraints: l,
1214
+ layout: h,
1215
+ separatorToPanels: m
1216
+ })
1217
+ }));
1175
1218
  };
1176
1219
  return {
1177
1220
  collapse: () => {
1178
- const { collapsible: a, collapsedSize: r } = o();
1179
- i();
1221
+ const { collapsible: i, collapsedSize: a } = o(), l = r();
1222
+ i && l !== a && c(a);
1180
1223
  },
1181
1224
  expand: () => {
1182
- const { collapsible: a, collapsedSize: r, minSize: l } = o();
1183
- i();
1225
+ const { collapsible: i, collapsedSize: a, minSize: l } = o(), u = r();
1226
+ i && u === a && c(l);
1184
1227
  },
1185
1228
  getSize: () => {
1186
- const { group: a } = n(), r = i(), { element: l } = s(), c = a.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
1229
+ const { group: i } = n(), a = r(), { element: l } = s(), u = i.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
1187
1230
  return {
1188
- asPercentage: r,
1189
- inPixels: c
1231
+ asPercentage: a,
1232
+ inPixels: u
1190
1233
  };
1191
1234
  },
1192
1235
  isCollapsed: () => {
1193
- const { collapsible: a, collapsedSize: r } = o(), l = i();
1194
- return a && L(r, l);
1236
+ const { collapsible: i, collapsedSize: a } = o(), l = r();
1237
+ return i && L(a, l);
1195
1238
  },
1196
- resize: (a) => {
1197
- if (i() !== a)
1198
- switch (typeof a) {
1239
+ resize: (i) => {
1240
+ if (r() !== i) {
1241
+ let l;
1242
+ switch (typeof i) {
1199
1243
  case "number": {
1200
- const { group: l } = n(), c = le({ group: l });
1201
- C(a / c * 100);
1244
+ const { group: u } = n(), f = le({ group: u });
1245
+ l = R(i / f * 100);
1246
+ break;
1247
+ }
1248
+ case "string": {
1249
+ l = parseFloat(i);
1202
1250
  break;
1203
1251
  }
1204
1252
  }
1253
+ c(l);
1254
+ }
1205
1255
  }
1206
1256
  };
1207
1257
  }
1208
1258
  function at(e, t) {
1209
- const { id: n } = de(), o = D({
1259
+ const { id: n } = de(), o = T({
1210
1260
  collapse: oe,
1211
1261
  expand: oe,
1212
1262
  getSize: () => ({
@@ -1229,30 +1279,30 @@ function ht({
1229
1279
  collapsedSize: n = 0,
1230
1280
  collapsible: o = !1,
1231
1281
  defaultSize: s,
1232
- elementRef: i,
1233
- id: a,
1234
- maxSize: r = "100",
1235
- minSize: l = "0",
1236
- onResize: c,
1282
+ elementRef: r,
1283
+ id: c,
1284
+ maxSize: i = "100",
1285
+ minSize: a = "0",
1286
+ onResize: l,
1237
1287
  panelRef: u,
1238
1288
  style: f
1239
1289
  }) {
1240
- const m = !!a, g = ce(a), [p, d] = R(null), h = fe(d, i), { id: v, registerPanel: z } = de(), x = c !== null, y = ue((G) => {
1241
- c?.(G, a);
1290
+ const m = !!c, v = ce(c), [p, d] = M(null), h = fe(d, r), { id: y, registerPanel: z } = de(), x = l !== null, g = ue((G) => {
1291
+ l?.(G, c);
1242
1292
  });
1243
1293
  H(() => {
1244
1294
  if (p !== null)
1245
1295
  return z({
1246
1296
  element: p,
1247
- id: g,
1297
+ id: v,
1248
1298
  idIsStable: m,
1249
- onResize: x ? y : void 0,
1299
+ onResize: x ? g : void 0,
1250
1300
  panelConstraints: {
1251
1301
  collapsedSize: n,
1252
1302
  collapsible: o,
1253
1303
  defaultSize: s,
1254
- maxSize: r,
1255
- minSize: l
1304
+ maxSize: i,
1305
+ minSize: a
1256
1306
  }
1257
1307
  });
1258
1308
  }, [
@@ -1261,19 +1311,19 @@ function ht({
1261
1311
  s,
1262
1312
  p,
1263
1313
  x,
1264
- g,
1314
+ v,
1265
1315
  m,
1266
- r,
1267
- l,
1268
- y,
1316
+ i,
1317
+ a,
1318
+ g,
1269
1319
  z
1270
- ]), at(g, u);
1271
- const w = Ge(v, g);
1320
+ ]), at(v, u);
1321
+ const w = Ge(y, v);
1272
1322
  return /* @__PURE__ */ j(
1273
1323
  "div",
1274
1324
  {
1275
1325
  "data-panel": !0,
1276
- "data-testid": a ?? void 0,
1326
+ "data-testid": c ?? void 0,
1277
1327
  ref: h,
1278
1328
  style: {
1279
1329
  flexBasis: 0,
@@ -1283,7 +1333,7 @@ function ht({
1283
1333
  overflow: "hidden",
1284
1334
  // Disable pointer events inside of a panel during resize
1285
1335
  // This avoid edge cases like nested iframes
1286
- pointerEvents: `var(${Me})`
1336
+ pointerEvents: `var(${Re})`
1287
1337
  },
1288
1338
  children: /* @__PURE__ */ j(
1289
1339
  "div",
@@ -1301,10 +1351,10 @@ function ht({
1301
1351
  );
1302
1352
  }
1303
1353
  function vt() {
1304
- return R(null);
1354
+ return M(null);
1305
1355
  }
1306
1356
  function yt() {
1307
- return D(null);
1357
+ return T(null);
1308
1358
  }
1309
1359
  function lt({
1310
1360
  layout: e,
@@ -1312,15 +1362,15 @@ function lt({
1312
1362
  panelId: n,
1313
1363
  panelIndex: o
1314
1364
  }) {
1315
- let s, i;
1316
- const a = e[n], r = t.find(
1317
- (l) => l.panelId === n
1365
+ let s, r;
1366
+ const c = e[n], i = t.find(
1367
+ (a) => a.panelId === n
1318
1368
  );
1319
- if (r) {
1320
- const l = r.maxSize, c = i = r.collapsible ? r.collapsedSize : r.minSize, u = [o, o + 1];
1321
- i = F({
1322
- layout: Q({
1323
- delta: c - a,
1369
+ if (i) {
1370
+ const a = i.maxSize, l = r = i.collapsible ? i.collapsedSize : i.minSize, u = [o, o + 1];
1371
+ r = $({
1372
+ layout: U({
1373
+ delta: l - c,
1324
1374
  initialLayout: e,
1325
1375
  panelConstraints: t,
1326
1376
  pivotIndices: u,
@@ -1328,9 +1378,9 @@ function lt({
1328
1378
  trigger: "keyboard"
1329
1379
  }),
1330
1380
  panelConstraints: t
1331
- })[n], s = F({
1332
- layout: Q({
1333
- delta: l - a,
1381
+ })[n], s = $({
1382
+ layout: U({
1383
+ delta: a - c,
1334
1384
  initialLayout: e,
1335
1385
  panelConstraints: t,
1336
1386
  pivotIndices: u,
@@ -1342,8 +1392,8 @@ function lt({
1342
1392
  }
1343
1393
  return {
1344
1394
  valueMax: s,
1345
- valueMin: i,
1346
- valueNow: a
1395
+ valueMin: r,
1396
+ valueNow: c
1347
1397
  };
1348
1398
  }
1349
1399
  function gt({
@@ -1353,40 +1403,40 @@ function gt({
1353
1403
  id: o,
1354
1404
  style: s
1355
1405
  }) {
1356
- const i = ce(o), [a, r] = R({}), [l, c] = R("inactive"), [u, f] = R(null), m = fe(f, n), {
1357
- id: g,
1406
+ const r = ce(o), [c, i] = M({}), [a, l] = M("inactive"), [u, f] = M(null), m = fe(f, n), {
1407
+ id: v,
1358
1408
  orientation: p,
1359
1409
  registerSeparator: d
1360
1410
  } = de(), h = p === "horizontal" ? "vertical" : "horizontal";
1361
1411
  return H(() => {
1362
1412
  if (u !== null) {
1363
- const v = {
1413
+ const y = {
1364
1414
  element: u,
1365
- id: i
1366
- }, z = d(v), x = A.addListener(
1415
+ id: r
1416
+ }, z = d(y), x = A.addListener(
1367
1417
  "interactionStateChange",
1368
1418
  (w) => {
1369
- c(
1419
+ l(
1370
1420
  w.state !== "inactive" && w.hitRegions.some(
1371
- (G) => G.separator === v
1421
+ (G) => G.separator === y
1372
1422
  ) ? w.state : "inactive"
1373
1423
  );
1374
1424
  }
1375
- ), y = A.addListener(
1425
+ ), g = A.addListener(
1376
1426
  "mountedGroupsChange",
1377
1427
  (w) => {
1378
1428
  w.forEach(
1379
- ({ derivedPanelConstraints: G, layout: O, separatorToPanels: te }, U) => {
1380
- if (U.id === g) {
1381
- const B = te.get(v);
1382
- if (B) {
1383
- const K = B[0], V = U.panels.indexOf(K);
1384
- r(
1429
+ ({ derivedPanelConstraints: G, layout: O, separatorToPanels: te }, K) => {
1430
+ if (K.id === v) {
1431
+ const V = te.get(y);
1432
+ if (V) {
1433
+ const q = V[0], X = K.panels.indexOf(q);
1434
+ i(
1385
1435
  lt({
1386
1436
  layout: O,
1387
1437
  panelConstraints: G,
1388
- panelId: K.id,
1389
- panelIndex: V
1438
+ panelId: q.id,
1439
+ panelIndex: X
1390
1440
  })
1391
1441
  );
1392
1442
  }
@@ -1396,19 +1446,19 @@ function gt({
1396
1446
  }
1397
1447
  );
1398
1448
  return () => {
1399
- x(), y(), z();
1449
+ x(), g(), z();
1400
1450
  };
1401
1451
  }
1402
- }, [u, g, i, d]), /* @__PURE__ */ j(
1452
+ }, [u, v, r, d]), /* @__PURE__ */ j(
1403
1453
  "div",
1404
1454
  {
1405
1455
  "aria-orientation": h,
1406
- "aria-valuemax": a.valueMax,
1407
- "aria-valuemin": a.valueMin,
1408
- "aria-valuenow": a.valueNow,
1456
+ "aria-valuemax": c.valueMax,
1457
+ "aria-valuemin": c.valueMin,
1458
+ "aria-valuenow": c.valueNow,
1409
1459
  children: e,
1410
1460
  className: t,
1411
- "data-separator": l,
1461
+ "data-separator": a,
1412
1462
  "data-testid": o ?? void 0,
1413
1463
  ref: m,
1414
1464
  role: "separator",