react-resizable-panels 4.0.16 → 4.1.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.
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  import { jsx as K } from "react/jsx-runtime";
3
- import { useId as Ke, useLayoutEffect as Xe, useEffect as Ce, useRef as D, useCallback as qe, createContext as Ye, useImperativeHandle as Ee, useState as I, useMemo as ie, useSyncExternalStore as Ze, useContext as Je } from "react";
3
+ import { useId as Ke, useLayoutEffect as Xe, useEffect as Ce, useRef as I, useCallback as qe, createContext as Ye, useImperativeHandle as Ee, useState as D, useMemo as se, useSyncExternalStore as Ze, useContext as Je } from "react";
4
4
  function z(e, t = "Assertion error") {
5
5
  if (!e)
6
6
  throw Error(t);
7
7
  }
8
- function V({
8
+ function W({
9
9
  group: e
10
10
  }) {
11
11
  const { orientation: t, panels: n } = e;
12
12
  return n.reduce((o, i) => (o += t === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, o), 0);
13
13
  }
14
- function se(e, t) {
14
+ function ae(e, t) {
15
15
  return t.sort(
16
16
  e === "horizontal" ? Qe : et
17
17
  );
@@ -56,7 +56,7 @@ function tt({
56
56
  return z(i, "No rect found"), i;
57
57
  }
58
58
  function ke(e) {
59
- const { element: t, orientation: n, panels: o, separators: i } = e, s = se(
59
+ const { element: t, orientation: n, panels: o, separators: i } = e, s = ae(
60
60
  n,
61
61
  Array.from(t.children).filter(Me).map((f) => ({ element: f }))
62
62
  ).map(({ element: f }) => f), l = [];
@@ -119,7 +119,7 @@ function ke(e) {
119
119
  for (const d of c)
120
120
  l.push({
121
121
  group: e,
122
- groupSize: V({ group: e }),
122
+ groupSize: W({ group: e }),
123
123
  panels: [a, p],
124
124
  separator: "width" in d ? void 0 : d,
125
125
  rect: "width" in d ? d : d.element.getBoundingClientRect()
@@ -160,7 +160,7 @@ function st(e) {
160
160
  }
161
161
  }
162
162
  }
163
- function te({
163
+ function ee({
164
164
  groupSize: e,
165
165
  panelElement: t,
166
166
  styleProp: n
@@ -199,7 +199,7 @@ function k(e) {
199
199
  return parseFloat(e.toFixed(3));
200
200
  }
201
201
  function me(e) {
202
- const { panels: t } = e, n = V({ group: e });
202
+ const { panels: t } = e, n = W({ group: e });
203
203
  return n === 0 ? t.map((o) => ({
204
204
  collapsedSize: 0,
205
205
  collapsible: o.panelConstraints.collapsible === !0,
@@ -211,7 +211,7 @@ function me(e) {
211
211
  const { element: i, panelConstraints: s } = o;
212
212
  let l = 0;
213
213
  if (s.collapsedSize) {
214
- const f = te({
214
+ const f = ee({
215
215
  groupSize: n,
216
216
  panelElement: i,
217
217
  styleProp: s.collapsedSize
@@ -220,7 +220,7 @@ function me(e) {
220
220
  }
221
221
  let r;
222
222
  if (s.defaultSize) {
223
- const f = te({
223
+ const f = ee({
224
224
  groupSize: n,
225
225
  panelElement: i,
226
226
  styleProp: s.defaultSize
@@ -229,7 +229,7 @@ function me(e) {
229
229
  }
230
230
  let a = 0;
231
231
  if (s.minSize) {
232
- const f = te({
232
+ const f = ee({
233
233
  groupSize: n,
234
234
  panelElement: i,
235
235
  styleProp: s.minSize
@@ -238,7 +238,7 @@ function me(e) {
238
238
  }
239
239
  let u = 100;
240
240
  if (s.maxSize) {
241
- const f = te({
241
+ const f = ee({
242
242
  groupSize: n,
243
243
  panelElement: i,
244
244
  styleProp: s.maxSize
@@ -297,26 +297,26 @@ class at {
297
297
  function R(e, t, n = 0) {
298
298
  return Math.abs(k(e) - k(t)) <= n;
299
299
  }
300
- let C = {
300
+ let E = {
301
301
  cursorFlags: 0,
302
302
  interactionState: {
303
303
  state: "inactive"
304
304
  },
305
305
  mountedGroups: /* @__PURE__ */ new Map()
306
306
  };
307
- const O = new at();
307
+ const _ = new at();
308
308
  function G() {
309
- return C;
310
- }
311
- function E(e) {
312
- const t = typeof e == "function" ? e(C) : e;
313
- if (C === t)
314
- return C;
315
- const n = C;
316
- return C = {
317
- ...C,
309
+ return E;
310
+ }
311
+ function M(e) {
312
+ const t = typeof e == "function" ? e(E) : e;
313
+ if (E === t)
314
+ return E;
315
+ const n = E;
316
+ return E = {
317
+ ...E,
318
318
  ...t
319
- }, t.cursorFlags !== void 0 && O.emit("cursorFlagsChange", C.cursorFlags), t.interactionState !== void 0 && O.emit("interactionStateChange", C.interactionState), t.mountedGroups !== void 0 && (C.mountedGroups.forEach((o, i) => {
319
+ }, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange", E.cursorFlags), t.interactionState !== void 0 && _.emit("interactionStateChange", E.interactionState), t.mountedGroups !== void 0 && (E.mountedGroups.forEach((o, i) => {
320
320
  o.derivedPanelConstraints.forEach((s) => {
321
321
  if (s.collapsible) {
322
322
  const { layout: l } = n.mountedGroups.get(i) ?? {};
@@ -332,7 +332,7 @@ function E(e) {
332
332
  }
333
333
  }
334
334
  });
335
- }), O.emit("mountedGroupsChange", C.mountedGroups)), C;
335
+ }), _.emit("mountedGroupsChange", E.mountedGroups)), E;
336
336
  }
337
337
  function lt(e, t) {
338
338
  if (e.length !== t.length)
@@ -345,7 +345,7 @@ function lt(e, t) {
345
345
  function X(e, t) {
346
346
  return R(e, t) ? 0 : e > t ? 1 : -1;
347
347
  }
348
- function B({
348
+ function V({
349
349
  panelConstraints: e,
350
350
  size: t
351
351
  }) {
@@ -431,7 +431,7 @@ function q({
431
431
  S != null,
432
432
  `Previous layout not found for panel index ${d}`
433
433
  );
434
- const g = B({
434
+ const g = V({
435
435
  panelConstraints: n[d],
436
436
  size: 100
437
437
  }) - S;
@@ -449,7 +449,7 @@ function q({
449
449
  v != null,
450
450
  `Previous layout not found for panel index ${d}`
451
451
  );
452
- const S = v - y, x = B({
452
+ const S = v - y, x = V({
453
453
  panelConstraints: n[d],
454
454
  size: S
455
455
  });
@@ -468,23 +468,23 @@ function q({
468
468
  d != null,
469
469
  `Previous layout not found for panel index ${c}`
470
470
  );
471
- const y = d + p, v = B({
471
+ const y = d + p, v = V({
472
472
  panelConstraints: n[c],
473
473
  size: y
474
474
  });
475
475
  if (a[c] = v, !R(v, y)) {
476
476
  let S = y - v, g = e < 0 ? f : u;
477
477
  for (; g >= 0 && g < n.length; ) {
478
- const w = a[g];
478
+ const b = a[g];
479
479
  z(
480
- w != null,
480
+ b != null,
481
481
  `Previous layout not found for panel index ${g}`
482
482
  );
483
- const L = w + S, P = B({
483
+ const w = b + S, C = V({
484
484
  panelConstraints: n[g],
485
- size: L
485
+ size: w
486
486
  });
487
- if (R(w, P) || (S -= P - w, a[g] = P), R(S, 0))
487
+ if (R(b, C) || (S -= C - b, a[g] = C), R(S, 0))
488
488
  break;
489
489
  e > 0 ? g-- : g++;
490
490
  }
@@ -499,7 +499,7 @@ function q({
499
499
  const m = Object.keys(i);
500
500
  return a.reduce((c, d, y) => (c[m[y]] = d, c), {});
501
501
  }
502
- function oe(e) {
502
+ function ne(e) {
503
503
  const t = e.parentElement;
504
504
  z(t, "Parent group element not found");
505
505
  const { mountedGroups: n } = G();
@@ -508,7 +508,7 @@ function oe(e) {
508
508
  return o;
509
509
  throw Error("Could not find parent Group for separator element");
510
510
  }
511
- function W(e, t) {
511
+ function U(e, t) {
512
512
  if (Object.keys(e).length !== Object.keys(t).length)
513
513
  return !1;
514
514
  for (const n in e)
@@ -516,7 +516,7 @@ function W(e, t) {
516
516
  return !1;
517
517
  return !0;
518
518
  }
519
- function _({
519
+ function N({
520
520
  layout: e,
521
521
  panelConstraints: t
522
522
  }) {
@@ -539,7 +539,7 @@ function _({
539
539
  for (let r = 0; r < t.length; r++) {
540
540
  const a = o[r];
541
541
  z(a != null, `No layout data found for index ${r}`);
542
- const u = B({
542
+ const u = V({
543
543
  panelConstraints: t[r],
544
544
  size: a
545
545
  });
@@ -549,7 +549,7 @@ function _({
549
549
  for (let r = 0; r < t.length; r++) {
550
550
  const a = o[r];
551
551
  z(a != null, `No layout data found for index ${r}`);
552
- const u = a + s, f = B({
552
+ const u = a + s, f = V({
553
553
  panelConstraints: t[r],
554
554
  size: u
555
555
  });
@@ -581,11 +581,11 @@ function Ge({
581
581
  group: s,
582
582
  layout: l,
583
583
  separatorToPanels: r
584
- } = t(), a = _({
584
+ } = t(), a = N({
585
585
  layout: n,
586
586
  panelConstraints: i
587
587
  });
588
- return o ? l : (W(l, a) || E((u) => ({
588
+ return o ? l : (U(l, a) || M((u) => ({
589
589
  mountedGroups: new Map(u.mountedGroups).set(s, {
590
590
  defaultLayoutDeferred: o,
591
591
  derivedPanelConstraints: i,
@@ -601,7 +601,7 @@ function De(e) {
601
601
  return z(n, `Mounted Group ${e.id} not found`), n;
602
602
  }
603
603
  function T(e, t) {
604
- const n = oe(e), o = De(n), i = n.separators.find(
604
+ const n = ne(e), o = De(n), i = n.separators.find(
605
605
  (p) => p.element === e
606
606
  );
607
607
  z(i, "Matching separator not found");
@@ -614,11 +614,11 @@ function T(e, t) {
614
614
  pivotIndices: l,
615
615
  prevLayout: a,
616
616
  trigger: "keyboard"
617
- }), f = _({
617
+ }), f = N({
618
618
  layout: u,
619
619
  panelConstraints: o.derivedPanelConstraints
620
620
  });
621
- W(a, f) || E((p) => ({
621
+ U(a, f) || M((p) => ({
622
622
  mountedGroups: new Map(p.mountedGroups).set(n, {
623
623
  defaultLayoutDeferred: o.defaultLayoutDeferred,
624
624
  derivedPanelConstraints: o.derivedPanelConstraints,
@@ -630,7 +630,7 @@ function T(e, t) {
630
630
  function ye(e) {
631
631
  if (e.defaultPrevented)
632
632
  return;
633
- const t = e.currentTarget, n = oe(t);
633
+ const t = e.currentTarget, n = ne(t);
634
634
  if (!n.disabled)
635
635
  switch (e.key) {
636
636
  case "ArrowDown": {
@@ -655,7 +655,7 @@ function ye(e) {
655
655
  }
656
656
  case "Enter": {
657
657
  e.preventDefault();
658
- const o = oe(t), { derivedPanelConstraints: i, layout: s, separatorToPanels: l } = De(o), r = o.separators.find(
658
+ const o = ne(t), { derivedPanelConstraints: i, layout: s, separatorToPanels: l } = De(o), r = o.separators.find(
659
659
  (p) => p.element === t
660
660
  );
661
661
  z(r, "Matching separator not found");
@@ -672,7 +672,7 @@ function ye(e) {
672
672
  }
673
673
  case "F6": {
674
674
  e.preventDefault();
675
- const i = oe(t).separators.map(
675
+ const i = ne(t).separators.map(
676
676
  (a) => a.element
677
677
  ), s = Array.from(i).findIndex(
678
678
  (a) => a === e.currentTarget
@@ -689,7 +689,7 @@ function ye(e) {
689
689
  }
690
690
  }
691
691
  const ut = (e) => e, re = () => {
692
- }, Te = 1, Oe = 2, _e = 4, Ne = 8, ge = {
692
+ }, Oe = 1, Te = 2, _e = 4, Ne = 8, ge = {
693
693
  coarse: 10,
694
694
  precise: 5
695
695
  };
@@ -716,9 +716,9 @@ function ct(e, t, n) {
716
716
  hitRegion: o
717
717
  } : void 0;
718
718
  }
719
- let ne;
719
+ let te;
720
720
  function ft() {
721
- return ne === void 0 && (typeof matchMedia == "function" ? ne = !!matchMedia("(pointer:coarse)").matches : ne = !1), ne;
721
+ return te === void 0 && (typeof matchMedia == "function" ? te = !!matchMedia("(pointer:coarse)").matches : te = !1), te;
722
722
  }
723
723
  function dt(e) {
724
724
  return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
@@ -833,7 +833,7 @@ function ze(e) {
833
833
  }), a.separator && (s.add(a.separator), r || (r = !0, a.separator.element.focus()));
834
834
  const u = t.get(a.group);
835
835
  u && l.set(a.group, u.layout);
836
- }), E({
836
+ }), M({
837
837
  interactionState: {
838
838
  hitRegions: n,
839
839
  initialLayoutMap: l,
@@ -869,7 +869,7 @@ function St({
869
869
  return null;
870
870
  switch (n) {
871
871
  case "active": {
872
- const s = (e & Te) !== 0, l = (e & Oe) !== 0, r = (e & _e) !== 0, a = (e & Ne) !== 0;
872
+ const s = (e & Oe) !== 0, l = (e & Te) !== 0, r = (e & _e) !== 0, a = (e & Ne) !== 0;
873
873
  if (e) {
874
874
  if (s)
875
875
  return r ? "se-resize" : a ? "ne-resize" : "e-resize";
@@ -886,7 +886,7 @@ function St({
886
886
  return o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
887
887
  }
888
888
  const be = /* @__PURE__ */ new WeakMap();
889
- function ae(e) {
889
+ function le(e) {
890
890
  if (e.defaultView === null || e.defaultView === void 0)
891
891
  return;
892
892
  let { prevStyle: t, styleSheet: n } = be.get(e) ?? {};
@@ -940,15 +940,15 @@ function Fe({
940
940
  delta: c,
941
941
  initialLayout: d,
942
942
  panelConstraints: v,
943
- pivotIndices: a.panels.map((w) => m.indexOf(w)),
943
+ pivotIndices: a.panels.map((b) => m.indexOf(b)),
944
944
  prevLayout: S,
945
945
  trigger: "mouse-or-touch"
946
946
  });
947
- if (W(g, S)) {
947
+ if (U(g, S)) {
948
948
  if (c !== 0 && !p)
949
949
  switch (h) {
950
950
  case "horizontal": {
951
- l |= c < 0 ? Te : Oe;
951
+ l |= c < 0 ? Oe : Te;
952
952
  break;
953
953
  }
954
954
  case "vertical": {
@@ -963,14 +963,14 @@ function Fe({
963
963
  layout: g,
964
964
  separatorToPanels: x
965
965
  });
966
- const w = a.group.panels.map(({ id: L }) => L).join(",");
967
- a.group.inMemoryLayouts[w] = g;
966
+ const b = a.group.panels.map(({ id: w }) => w).join(",");
967
+ a.group.inMemoryLayouts[b] = g;
968
968
  }
969
969
  }
970
- }), E({
970
+ }), M({
971
971
  cursorFlags: l,
972
972
  mountedGroups: r
973
- }), ae(e);
973
+ }), le(e);
974
974
  }
975
975
  function we(e) {
976
976
  const { interactionState: t, mountedGroups: n } = G();
@@ -995,7 +995,7 @@ function Le(e) {
995
995
  // Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
996
996
  e.buttons === 0
997
997
  ) {
998
- E(
998
+ M(
999
999
  (o) => o.interactionState.state === "inactive" ? o : {
1000
1000
  cursorFlags: 0,
1001
1001
  interactionState: {
@@ -1017,14 +1017,14 @@ function Le(e) {
1017
1017
  }
1018
1018
  default: {
1019
1019
  const o = $e(e, n);
1020
- o.length === 0 ? t.state !== "inactive" && E({
1020
+ o.length === 0 ? t.state !== "inactive" && M({
1021
1021
  interactionState: { state: "inactive" }
1022
- }) : E({
1022
+ }) : M({
1023
1023
  interactionState: {
1024
1024
  hitRegions: o,
1025
1025
  state: "hover"
1026
1026
  }
1027
- }), ae(e.currentTarget);
1027
+ }), le(e.currentTarget);
1028
1028
  break;
1029
1029
  }
1030
1030
  }
@@ -1036,12 +1036,12 @@ function Pe(e) {
1036
1036
  const { interactionState: t } = G();
1037
1037
  switch (t.state) {
1038
1038
  case "active":
1039
- E({
1039
+ M({
1040
1040
  cursorFlags: 0,
1041
1041
  interactionState: {
1042
1042
  state: "inactive"
1043
1043
  }
1044
- }), ae(e.currentTarget);
1044
+ }), le(e.currentTarget);
1045
1045
  }
1046
1046
  }
1047
1047
  function Re(e) {
@@ -1069,7 +1069,7 @@ function xt(e, t, n) {
1069
1069
  const i = e.panels.find((l) => l.element === t);
1070
1070
  if (!i || !i.onResize)
1071
1071
  return;
1072
- const s = V({ group: e });
1072
+ const s = W({ group: e });
1073
1073
  i.onResize(
1074
1074
  {
1075
1075
  asPercentage: k(
@@ -1097,7 +1097,7 @@ function bt(e, t) {
1097
1097
  return !1;
1098
1098
  return !0;
1099
1099
  }
1100
- const j = /* @__PURE__ */ new Map();
1100
+ const B = /* @__PURE__ */ new Map();
1101
1101
  function wt(e) {
1102
1102
  let t = !0;
1103
1103
  z(
@@ -1109,23 +1109,23 @@ function wt(e) {
1109
1109
  const { borderBoxSize: y, target: v } = d;
1110
1110
  if (v === e.element) {
1111
1111
  if (t) {
1112
- if (V({ group: e }) === 0)
1112
+ if (W({ group: e }) === 0)
1113
1113
  return;
1114
- E((x) => {
1114
+ M((x) => {
1115
1115
  const g = x.mountedGroups.get(e);
1116
1116
  if (g) {
1117
- const w = me(e), L = g.defaultLayoutDeferred ? Re(w) : g.layout, P = _({
1118
- layout: L,
1119
- panelConstraints: w
1117
+ const b = me(e), w = g.defaultLayoutDeferred ? Re(b) : g.layout, C = N({
1118
+ layout: w,
1119
+ panelConstraints: b
1120
1120
  });
1121
- return !g.defaultLayoutDeferred && W(L, P) && zt(
1121
+ return !g.defaultLayoutDeferred && U(w, C) && zt(
1122
1122
  g.derivedPanelConstraints,
1123
- w
1123
+ b
1124
1124
  ) ? x : {
1125
1125
  mountedGroups: new Map(x.mountedGroups).set(e, {
1126
1126
  defaultLayoutDeferred: !1,
1127
- derivedPanelConstraints: w,
1128
- layout: P,
1127
+ derivedPanelConstraints: b,
1128
+ layout: C,
1129
1129
  separatorToPanels: g.separatorToPanels
1130
1130
  })
1131
1131
  };
@@ -1143,18 +1143,18 @@ function wt(e) {
1143
1143
  `Panel ids must be unique; id "${c.id}" was used more than once`
1144
1144
  ), o.add(c.id), c.onResize && s.observe(c.element);
1145
1145
  });
1146
- const l = V({ group: e }), r = me(e), a = e.panels.map(({ id: c }) => c).join(",");
1146
+ const l = W({ group: e }), r = me(e), a = e.panels.map(({ id: c }) => c).join(",");
1147
1147
  let u = e.defaultLayout;
1148
1148
  u && (bt(e.panels, u) || (u = void 0));
1149
- const f = e.inMemoryLayouts[a] ?? u ?? Re(r), p = _({
1149
+ const f = e.inMemoryLayouts[a] ?? u ?? Re(r), p = N({
1150
1150
  layout: f,
1151
1151
  panelConstraints: r
1152
1152
  }), h = ke(e), m = e.element.ownerDocument;
1153
- return E((c) => {
1153
+ return M((c) => {
1154
1154
  const d = /* @__PURE__ */ new Map();
1155
- return j.set(
1155
+ return B.set(
1156
1156
  m,
1157
- (j.get(m) ?? 0) + 1
1157
+ (B.get(m) ?? 0) + 1
1158
1158
  ), h.forEach((y) => {
1159
1159
  y.separator && d.set(y.separator, y.panels);
1160
1160
  }), {
@@ -1170,31 +1170,31 @@ function wt(e) {
1170
1170
  !i.has(c.id),
1171
1171
  `Separator ids must be unique; id "${c.id}" was used more than once`
1172
1172
  ), i.add(c.id), c.element.addEventListener("keydown", ye);
1173
- }), j.get(m) === 1 && (m.addEventListener("pointerdown", ze), m.addEventListener("pointerleave", we), m.addEventListener("pointermove", Le), m.addEventListener("pointerup", Pe)), function() {
1174
- t = !1, j.set(
1173
+ }), B.get(m) === 1 && (m.addEventListener("pointerdown", ze), m.addEventListener("pointerleave", we), m.addEventListener("pointermove", Le), m.addEventListener("pointerup", Pe)), function() {
1174
+ t = !1, B.set(
1175
1175
  m,
1176
- Math.max(0, (j.get(m) ?? 0) - 1)
1177
- ), E((d) => {
1176
+ Math.max(0, (B.get(m) ?? 0) - 1)
1177
+ ), M((d) => {
1178
1178
  const y = new Map(d.mountedGroups);
1179
1179
  return y.delete(e), { mountedGroups: y };
1180
1180
  }), e.separators.forEach((d) => {
1181
1181
  d.element.removeEventListener("keydown", ye);
1182
- }), j.get(m) || (m.removeEventListener("pointerdown", ze), m.removeEventListener("pointerleave", we), m.removeEventListener("pointermove", Le), m.removeEventListener("pointerup", Pe)), s.disconnect();
1182
+ }), B.get(m) || (m.removeEventListener("pointerdown", ze), m.removeEventListener("pointerleave", we), m.removeEventListener("pointermove", Le), m.removeEventListener("pointerup", Pe)), s.disconnect();
1183
1183
  };
1184
1184
  }
1185
- function le(e) {
1185
+ function ue(e) {
1186
1186
  const t = Ke();
1187
1187
  return `${e ?? t}`;
1188
1188
  }
1189
- const N = typeof window < "u" ? Xe : Ce;
1190
- function ue(e) {
1191
- const t = D(e);
1192
- return N(() => {
1189
+ const A = typeof window < "u" ? Xe : Ce;
1190
+ function ce(e) {
1191
+ const t = I(e);
1192
+ return A(() => {
1193
1193
  t.current = e;
1194
1194
  }, [e]), qe((n) => t.current?.(n), [t]);
1195
1195
  }
1196
- function ce(...e) {
1197
- return ue((t) => {
1196
+ function fe(...e) {
1197
+ return ce((t) => {
1198
1198
  e.forEach((n) => {
1199
1199
  if (n)
1200
1200
  switch (typeof n) {
@@ -1211,31 +1211,31 @@ function ce(...e) {
1211
1211
  });
1212
1212
  }
1213
1213
  function Lt(e) {
1214
- const t = D({ ...e });
1215
- return N(() => {
1214
+ const t = I({ ...e });
1215
+ return A(() => {
1216
1216
  for (const n in e)
1217
1217
  t.current[n] = e[n];
1218
1218
  }, [e]), t.current;
1219
1219
  }
1220
- const He = "--react-resizable-panels--panel--pointer-events";
1221
- function je(e, t) {
1220
+ const je = "--react-resizable-panels--panel--pointer-events";
1221
+ function He(e, t) {
1222
1222
  const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
1223
1223
  return `--react-resizable-panels--${n}--${o}`;
1224
1224
  }
1225
1225
  const Be = Ye(null);
1226
1226
  function Pt(e, t) {
1227
- const n = D({
1227
+ const n = I({
1228
1228
  getLayout: () => ({}),
1229
1229
  setLayout: ut
1230
1230
  });
1231
- Ee(t, () => n.current, []), N(() => {
1231
+ Ee(t, () => n.current, []), A(() => {
1232
1232
  Object.assign(
1233
1233
  n.current,
1234
1234
  Ge({ groupId: e })
1235
1235
  );
1236
1236
  });
1237
1237
  }
1238
- function Ot({
1238
+ function Tt({
1239
1239
  children: e,
1240
1240
  className: t,
1241
1241
  defaultLayout: n,
@@ -1249,62 +1249,63 @@ function Ot({
1249
1249
  style: f,
1250
1250
  ...p
1251
1251
  }) {
1252
- const h = D({}), m = ue((b) => {
1253
- W(h.current, b) || (h.current = b, a?.(b));
1254
- }), c = le(r), [d, y] = I(!1), [v, S] = I(null), [x, g] = I(n ?? {}), [w, L] = I([]), [P, Y] = I([]), Z = D({
1252
+ const h = I({}), m = ce((L) => {
1253
+ U(h.current, L) || (h.current = L, a?.(L));
1254
+ }), c = ue(r), [d, y] = D(!1), v = I(null), [S, x] = D(n ?? {}), [g, b] = D([]), [w, C] = D([]), Y = I({
1255
1255
  lastExpandedPanelSizes: {},
1256
1256
  layouts: {}
1257
- }), J = ce(S, s);
1257
+ }), oe = fe(v, s);
1258
1258
  Pt(c, l);
1259
- const Q = ie(
1259
+ const Z = se(
1260
1260
  () => ({
1261
1261
  id: c,
1262
1262
  orientation: u,
1263
- registerPanel: (b) => (L((M) => se(u, [...M, b])), () => {
1264
- L((M) => M.filter(($) => $ !== b));
1263
+ registerPanel: (L) => (b((P) => ae(u, [...P, L])), () => {
1264
+ b((P) => P.filter((O) => O !== L));
1265
1265
  }),
1266
- registerSeparator: (b) => (Y(
1267
- (M) => se(u, [...M, b])
1266
+ registerSeparator: (L) => (C(
1267
+ (P) => ae(u, [...P, L])
1268
1268
  ), () => {
1269
- Y(
1270
- (M) => M.filter(($) => $ !== b)
1269
+ C(
1270
+ (P) => P.filter((O) => O !== L)
1271
1271
  );
1272
1272
  })
1273
1273
  }),
1274
1274
  [c, u]
1275
- ), A = Lt({
1275
+ ), $ = Lt({
1276
1276
  defaultLayout: n,
1277
1277
  disableCursor: o
1278
- }), U = D(null);
1279
- N(() => {
1280
- if (v === null)
1278
+ }), F = I(null);
1279
+ A(() => {
1280
+ const L = v.current;
1281
+ if (L === null)
1281
1282
  return;
1282
- const b = {
1283
- defaultLayout: A.defaultLayout,
1284
- disableCursor: !!A.disableCursor,
1283
+ const P = {
1284
+ defaultLayout: $.defaultLayout,
1285
+ disableCursor: !!$.disableCursor,
1285
1286
  disabled: !!i,
1286
- element: v,
1287
+ element: L,
1287
1288
  id: c,
1288
- inMemoryLastExpandedPanelSizes: Z.current.lastExpandedPanelSizes,
1289
- inMemoryLayouts: Z.current.layouts,
1289
+ inMemoryLastExpandedPanelSizes: Y.current.lastExpandedPanelSizes,
1290
+ inMemoryLayouts: Y.current.layouts,
1290
1291
  orientation: u,
1291
- panels: w,
1292
- separators: P
1292
+ panels: g,
1293
+ separators: w
1293
1294
  };
1294
- U.current = b;
1295
- const M = wt(b), pe = G().mountedGroups.get(b);
1295
+ F.current = P;
1296
+ const O = wt(P), pe = G().mountedGroups.get(P);
1296
1297
  if (pe) {
1297
- const { defaultLayoutDeferred: F, derivedPanelConstraints: H, layout: ee } = pe;
1298
- !F && H.length > 0 && (g(ee), m?.(ee));
1298
+ const { defaultLayoutDeferred: j, derivedPanelConstraints: H, layout: Q } = pe;
1299
+ !j && H.length > 0 && (x(Q), m?.(Q));
1299
1300
  }
1300
- const Ve = O.addListener(
1301
+ const Ve = _.addListener(
1301
1302
  "interactionStateChange",
1302
- (F) => {
1303
- switch (F.state) {
1303
+ (j) => {
1304
+ switch (j.state) {
1304
1305
  case "active": {
1305
1306
  y(
1306
- F.hitRegions.some(
1307
- (H) => H.group === b
1307
+ j.hitRegions.some(
1308
+ (H) => H.group === P
1308
1309
  )
1309
1310
  );
1310
1311
  break;
@@ -1315,42 +1316,41 @@ function Ot({
1315
1316
  }
1316
1317
  }
1317
1318
  }
1318
- ), We = O.addListener(
1319
+ ), We = _.addListener(
1319
1320
  "mountedGroupsChange",
1320
- (F) => {
1321
- const H = F.get(b);
1321
+ (j) => {
1322
+ const H = j.get(P);
1322
1323
  if (H) {
1323
- const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ue, layout: he } = H;
1324
- if (ee || Ue.length === 0)
1324
+ const { defaultLayoutDeferred: Q, derivedPanelConstraints: Ue, layout: he } = H;
1325
+ if (Q || Ue.length === 0)
1325
1326
  return;
1326
- g(he), m?.(he);
1327
+ x(he), m?.(he);
1327
1328
  }
1328
1329
  }
1329
1330
  );
1330
1331
  return () => {
1331
- U.current = null, M(), Ve(), We();
1332
+ F.current = null, O(), Ve(), We();
1332
1333
  };
1333
1334
  }, [
1334
1335
  i,
1335
- v,
1336
1336
  c,
1337
1337
  m,
1338
1338
  u,
1339
+ g,
1339
1340
  w,
1340
- P,
1341
- A
1341
+ $
1342
1342
  ]), Ce(() => {
1343
- const b = U.current;
1344
- b && (b.defaultLayout = n, b.disableCursor = !!o);
1343
+ const L = F.current;
1344
+ L && (L.defaultLayout = n, L.disableCursor = !!o);
1345
1345
  });
1346
- const de = {
1347
- [He]: d ? "none" : void 0
1346
+ const J = {
1347
+ [je]: d ? "none" : void 0
1348
1348
  };
1349
- for (const b in x) {
1350
- const M = je(c, b), $ = x[b];
1351
- de[M] = $;
1349
+ for (const L in S) {
1350
+ const P = He(c, L), O = S[L];
1351
+ J[P] = O;
1352
1352
  }
1353
- return /* @__PURE__ */ K(Be.Provider, { value: Q, children: /* @__PURE__ */ K(
1353
+ return /* @__PURE__ */ K(Be.Provider, { value: Z, children: /* @__PURE__ */ K(
1354
1354
  "div",
1355
1355
  {
1356
1356
  ...p,
@@ -1359,10 +1359,10 @@ function Ot({
1359
1359
  "data-group": !0,
1360
1360
  "data-testid": c,
1361
1361
  id: c,
1362
- ref: J,
1362
+ ref: oe,
1363
1363
  style: {
1364
1364
  ...f,
1365
- ...de,
1365
+ ...J,
1366
1366
  display: "flex",
1367
1367
  flexDirection: u === "horizontal" ? "row" : "column",
1368
1368
  flexWrap: "nowrap"
@@ -1379,54 +1379,57 @@ function Rt(e, t = 10) {
1379
1379
  }, t);
1380
1380
  };
1381
1381
  }
1382
- function Ct(e) {
1383
- return `react-resizable-panels:${e}`;
1382
+ function ie(e, t) {
1383
+ return `react-resizable-panels:${[e, ...t].join(":")}`;
1384
1384
  }
1385
1385
  function _t({
1386
1386
  debounceSaveMs: e = 100,
1387
- storage: t,
1388
- ...n
1387
+ panelIds: t,
1388
+ storage: n,
1389
+ ...o
1389
1390
  }) {
1390
- const o = "id" in n ? n.id : n.groupId, i = Ct(o), s = Ze(
1391
- Et,
1392
- () => t.getItem(i),
1393
- () => t.getItem(i)
1394
- ), l = ie(
1395
- () => s ? JSON.parse(s) : void 0,
1396
- [s]
1397
- ), r = ie(() => {
1398
- const a = (u) => {
1391
+ const i = t !== void 0, s = "id" in o ? o.id : o.groupId, l = ie(s, t ?? []), r = Ze(
1392
+ Ct,
1393
+ () => n.getItem(l),
1394
+ () => n.getItem(l)
1395
+ ), a = se(
1396
+ () => r ? JSON.parse(r) : void 0,
1397
+ [r]
1398
+ ), u = se(() => {
1399
+ const f = (p) => {
1400
+ let h;
1401
+ i ? h = ie(s, Object.keys(p)) : h = ie(s, []);
1399
1402
  try {
1400
- t.setItem(i, JSON.stringify(u));
1401
- } catch (f) {
1402
- console.error(f);
1403
+ n.setItem(h, JSON.stringify(p));
1404
+ } catch (m) {
1405
+ console.error(m);
1403
1406
  }
1404
1407
  };
1405
- return e > 0 ? Rt(a, e) : a;
1406
- }, [e, t, i]);
1408
+ return e > 0 ? Rt(f, e) : f;
1409
+ }, [e, i, s, n]);
1407
1410
  return {
1408
- defaultLayout: l,
1409
- onLayoutChange: r
1411
+ defaultLayout: a,
1412
+ onLayoutChange: u
1410
1413
  };
1411
1414
  }
1412
- function Et() {
1415
+ function Ct() {
1413
1416
  return function() {
1414
1417
  };
1415
1418
  }
1416
1419
  function Nt() {
1417
- return I(null);
1420
+ return D(null);
1418
1421
  }
1419
1422
  function At() {
1420
- return D(null);
1423
+ return I(null);
1421
1424
  }
1422
- function fe() {
1425
+ function de() {
1423
1426
  const e = Je(Be);
1424
1427
  return z(
1425
1428
  e,
1426
1429
  "Group Context not found; did you render a Panel or Separator outside of a Group?"
1427
1430
  ), e;
1428
1431
  }
1429
- function Mt({
1432
+ function Et({
1430
1433
  groupId: e,
1431
1434
  panelId: t
1432
1435
  }) {
@@ -1484,11 +1487,11 @@ function Mt({
1484
1487
  pivotIndices: d ? [c - 1, c] : [c, c + 1],
1485
1488
  prevLayout: h,
1486
1489
  trigger: "imperative-api"
1487
- }), v = _({
1490
+ }), v = N({
1488
1491
  layout: y,
1489
1492
  panelConstraints: f
1490
1493
  });
1491
- W(h, v) || E((S) => ({
1494
+ U(h, v) || M((S) => ({
1492
1495
  mountedGroups: new Map(S.mountedGroups).set(p, {
1493
1496
  defaultLayoutDeferred: u,
1494
1497
  derivedPanelConstraints: f,
@@ -1525,7 +1528,7 @@ function Mt({
1525
1528
  let u;
1526
1529
  switch (typeof r) {
1527
1530
  case "number": {
1528
- const { group: f } = n(), p = V({ group: f });
1531
+ const { group: f } = n(), p = W({ group: f });
1529
1532
  u = k(r / p * 100);
1530
1533
  break;
1531
1534
  }
@@ -1539,8 +1542,8 @@ function Mt({
1539
1542
  }
1540
1543
  };
1541
1544
  }
1542
- function It(e, t) {
1543
- const { id: n } = fe(), o = D({
1545
+ function Mt(e, t) {
1546
+ const { id: n } = de(), o = I({
1544
1547
  collapse: re,
1545
1548
  expand: re,
1546
1549
  getSize: () => ({
@@ -1550,10 +1553,10 @@ function It(e, t) {
1550
1553
  isCollapsed: () => !1,
1551
1554
  resize: re
1552
1555
  });
1553
- Ee(t, () => o.current, []), N(() => {
1556
+ Ee(t, () => o.current, []), A(() => {
1554
1557
  Object.assign(
1555
1558
  o.current,
1556
- Mt({ groupId: n, panelId: e })
1559
+ Et({ groupId: n, panelId: e })
1557
1560
  );
1558
1561
  });
1559
1562
  }
@@ -1572,17 +1575,18 @@ function $t({
1572
1575
  style: p,
1573
1576
  ...h
1574
1577
  }) {
1575
- const m = !!l, c = le(l), [d, y] = I(null), v = ce(y, s), { id: S, registerPanel: x } = fe(), g = u !== null, w = ue((P) => {
1576
- u?.(P, l);
1578
+ const m = !!l, c = ue(l), d = I(null), y = fe(d, s), { id: v, registerPanel: S } = de(), x = u !== null, g = ce((w) => {
1579
+ u?.(w, l);
1577
1580
  });
1578
- N(() => {
1579
- if (d !== null)
1580
- return x({
1581
- element: d,
1581
+ A(() => {
1582
+ const w = d.current;
1583
+ if (w !== null)
1584
+ return S({
1585
+ element: w,
1582
1586
  expandToSizeRef: { current: void 0 },
1583
1587
  id: c,
1584
1588
  idIsStable: m,
1585
- onResize: g ? w : void 0,
1589
+ onResize: x ? g : void 0,
1586
1590
  panelConstraints: {
1587
1591
  collapsedSize: n,
1588
1592
  collapsible: o,
@@ -1595,16 +1599,15 @@ function $t({
1595
1599
  n,
1596
1600
  o,
1597
1601
  i,
1598
- d,
1599
- g,
1602
+ x,
1600
1603
  c,
1601
1604
  m,
1602
1605
  r,
1603
1606
  a,
1604
- w,
1605
- x
1606
- ]), It(c, f);
1607
- const L = je(S, c);
1607
+ g,
1608
+ S
1609
+ ]), Mt(c, f);
1610
+ const b = He(v, c);
1608
1611
  return /* @__PURE__ */ K(
1609
1612
  "div",
1610
1613
  {
@@ -1612,17 +1615,17 @@ function $t({
1612
1615
  "data-panel": !0,
1613
1616
  "data-testid": c,
1614
1617
  id: c,
1615
- ref: v,
1618
+ ref: y,
1616
1619
  style: {
1617
- ...kt,
1620
+ ...It,
1618
1621
  flexBasis: 0,
1619
- flexGrow: `var(${L}, 1)`,
1622
+ flexGrow: `var(${b}, 1)`,
1620
1623
  flexShrink: 1,
1621
1624
  // Prevent Panel content from interfering with panel size
1622
1625
  overflow: "hidden",
1623
1626
  // Disable pointer events inside of a panel during resize
1624
1627
  // This avoid edge cases like nested iframes
1625
- pointerEvents: `var(${He})`
1628
+ pointerEvents: `var(${je})`
1626
1629
  },
1627
1630
  children: /* @__PURE__ */ K(
1628
1631
  "div",
@@ -1639,7 +1642,7 @@ function $t({
1639
1642
  }
1640
1643
  );
1641
1644
  }
1642
- const kt = {
1645
+ const It = {
1643
1646
  minHeight: "unset",
1644
1647
  maxHeight: "unset",
1645
1648
  height: "unset",
@@ -1656,12 +1659,12 @@ const kt = {
1656
1659
  margin: "unset"
1657
1660
  };
1658
1661
  function Ft() {
1659
- return I(null);
1660
- }
1661
- function Ht() {
1662
1662
  return D(null);
1663
1663
  }
1664
- function Gt({
1664
+ function jt() {
1665
+ return I(null);
1666
+ }
1667
+ function kt({
1665
1668
  layout: e,
1666
1669
  panelConstraints: t,
1667
1670
  panelId: n,
@@ -1673,7 +1676,7 @@ function Gt({
1673
1676
  );
1674
1677
  if (r) {
1675
1678
  const a = r.maxSize, u = s = r.collapsible ? r.collapsedSize : r.minSize, f = [o, o + 1];
1676
- s = _({
1679
+ s = N({
1677
1680
  layout: q({
1678
1681
  delta: u - l,
1679
1682
  initialLayout: e,
@@ -1683,7 +1686,7 @@ function Gt({
1683
1686
  trigger: "keyboard"
1684
1687
  }),
1685
1688
  panelConstraints: t
1686
- })[n], i = _({
1689
+ })[n], i = N({
1687
1690
  layout: q({
1688
1691
  delta: a - l,
1689
1692
  initialLayout: e,
@@ -1702,7 +1705,7 @@ function Gt({
1702
1705
  valueNow: l
1703
1706
  };
1704
1707
  }
1705
- function jt({
1708
+ function Ht({
1706
1709
  children: e,
1707
1710
  className: t,
1708
1711
  elementRef: n,
@@ -1710,40 +1713,40 @@ function jt({
1710
1713
  style: i,
1711
1714
  ...s
1712
1715
  }) {
1713
- const l = le(o), [r, a] = I({}), [u, f] = I("inactive"), [p, h] = I(null), m = ce(h, n), {
1716
+ const l = ue(o), [r, a] = D({}), [u, f] = D("inactive"), [p, h] = D(null), m = fe(h, n), {
1714
1717
  id: c,
1715
1718
  orientation: d,
1716
1719
  registerSeparator: y
1717
- } = fe(), v = d === "horizontal" ? "vertical" : "horizontal";
1718
- return N(() => {
1720
+ } = de(), v = d === "horizontal" ? "vertical" : "horizontal";
1721
+ return A(() => {
1719
1722
  if (p !== null) {
1720
1723
  const S = {
1721
1724
  element: p,
1722
1725
  id: l
1723
- }, x = y(S), g = O.addListener(
1726
+ }, x = y(S), g = _.addListener(
1724
1727
  "interactionStateChange",
1725
- (L) => {
1728
+ (w) => {
1726
1729
  f(
1727
- L.state !== "inactive" && L.hitRegions.some(
1728
- (P) => P.separator === S
1729
- ) ? L.state : "inactive"
1730
+ w.state !== "inactive" && w.hitRegions.some(
1731
+ (C) => C.separator === S
1732
+ ) ? w.state : "inactive"
1730
1733
  );
1731
1734
  }
1732
- ), w = O.addListener(
1735
+ ), b = _.addListener(
1733
1736
  "mountedGroupsChange",
1734
- (L) => {
1735
- L.forEach(
1736
- ({ derivedPanelConstraints: P, layout: Y, separatorToPanels: Z }, J) => {
1737
- if (J.id === c) {
1738
- const Q = Z.get(S);
1739
- if (Q) {
1740
- const A = Q[0], U = J.panels.indexOf(A);
1737
+ (w) => {
1738
+ w.forEach(
1739
+ ({ derivedPanelConstraints: C, layout: Y, separatorToPanels: oe }, Z) => {
1740
+ if (Z.id === c) {
1741
+ const $ = oe.get(S);
1742
+ if ($) {
1743
+ const F = $[0], J = Z.panels.indexOf(F);
1741
1744
  a(
1742
- Gt({
1745
+ kt({
1743
1746
  layout: Y,
1744
- panelConstraints: P,
1745
- panelId: A.id,
1746
- panelIndex: U
1747
+ panelConstraints: C,
1748
+ panelId: F.id,
1749
+ panelIndex: J
1747
1750
  })
1748
1751
  );
1749
1752
  }
@@ -1753,7 +1756,7 @@ function jt({
1753
1756
  }
1754
1757
  );
1755
1758
  return () => {
1756
- g(), w(), x();
1759
+ g(), b(), x();
1757
1760
  };
1758
1761
  }
1759
1762
  }, [p, c, l, y]), /* @__PURE__ */ K(
@@ -1783,13 +1786,13 @@ function jt({
1783
1786
  );
1784
1787
  }
1785
1788
  export {
1786
- Ot as Group,
1789
+ Tt as Group,
1787
1790
  $t as Panel,
1788
- jt as Separator,
1791
+ Ht as Separator,
1789
1792
  _t as useDefaultLayout,
1790
1793
  Nt as useGroupCallbackRef,
1791
1794
  At as useGroupRef,
1792
1795
  Ft as usePanelCallbackRef,
1793
- Ht as usePanelRef
1796
+ jt as usePanelRef
1794
1797
  };
1795
1798
  //# sourceMappingURL=react-resizable-panels.js.map