react-resizable-panels 4.11.2 → 4.12.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,21 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as ae } from "react/jsx-runtime";
3
- import { useState as Q, useCallback as re, useId as pt, useLayoutEffect as Ue, useEffect as me, useRef as T, createContext as ht, useImperativeHandle as Ke, useMemo as Se, useSyncExternalStore as Xe, useContext as mt } from "react";
4
- function gt(e, t) {
3
+ import { useState as Q, useCallback as re, useId as mt, useLayoutEffect as Ke, useEffect as me, useRef as O, createContext as gt, useImperativeHandle as Xe, useMemo as Se, useSyncExternalStore as qe, useContext as yt } from "react";
4
+ function St(e, t) {
5
5
  const n = getComputedStyle(e), o = parseFloat(n.fontSize);
6
6
  return t * o;
7
7
  }
8
- function yt(e, t) {
8
+ function vt(e, t) {
9
9
  const n = getComputedStyle(e.ownerDocument.documentElement), o = parseFloat(n.fontSize);
10
10
  return t * o;
11
11
  }
12
- function St(e) {
12
+ function bt(e) {
13
13
  return e / 100 * window.innerHeight;
14
14
  }
15
- function vt(e) {
15
+ function zt(e) {
16
16
  return e / 100 * window.innerWidth;
17
17
  }
18
- function bt(e) {
18
+ function xt(e) {
19
19
  switch (typeof e) {
20
20
  case "number":
21
21
  return [e, "px"];
@@ -31,8 +31,8 @@ function ie({
31
31
  styleProp: n
32
32
  }) {
33
33
  let o;
34
- const [i, r] = bt(n);
35
- switch (r) {
34
+ const [i, s] = xt(n);
35
+ switch (s) {
36
36
  case "%": {
37
37
  o = i / 100 * e;
38
38
  break;
@@ -42,25 +42,25 @@ function ie({
42
42
  break;
43
43
  }
44
44
  case "rem": {
45
- o = yt(t, i);
45
+ o = vt(t, i);
46
46
  break;
47
47
  }
48
48
  case "em": {
49
- o = gt(t, i);
49
+ o = St(t, i);
50
50
  break;
51
51
  }
52
52
  case "vh": {
53
- o = St(i);
53
+ o = bt(i);
54
54
  break;
55
55
  }
56
56
  case "vw": {
57
- o = vt(i);
57
+ o = zt(i);
58
58
  break;
59
59
  }
60
60
  }
61
61
  return o;
62
62
  }
63
- function O(e) {
63
+ function T(e) {
64
64
  return parseFloat(e.toFixed(3));
65
65
  }
66
66
  function ne({
@@ -81,50 +81,50 @@ function ve(e) {
81
81
  maxSize: 100,
82
82
  panelId: o.id
83
83
  })) : t.map((o) => {
84
- const { element: i, panelConstraints: r } = o;
85
- let f = 0;
86
- if (r.collapsedSize !== void 0) {
87
- const u = ie({
84
+ const { element: i, panelConstraints: s } = o;
85
+ let u = 0;
86
+ if (s.collapsedSize !== void 0) {
87
+ const c = ie({
88
88
  groupSize: n,
89
89
  panelElement: i,
90
- styleProp: r.collapsedSize
90
+ styleProp: s.collapsedSize
91
91
  });
92
- f = O(u / n * 100);
92
+ u = T(c / n * 100);
93
93
  }
94
94
  let a;
95
- if (r.defaultSize !== void 0) {
96
- const u = ie({
95
+ if (s.defaultSize !== void 0) {
96
+ const c = ie({
97
97
  groupSize: n,
98
98
  panelElement: i,
99
- styleProp: r.defaultSize
99
+ styleProp: s.defaultSize
100
100
  });
101
- a = O(u / n * 100);
101
+ a = T(c / n * 100);
102
102
  }
103
- let s = 0;
104
- if (r.minSize !== void 0) {
105
- const u = ie({
103
+ let r = 0;
104
+ if (s.minSize !== void 0) {
105
+ const c = ie({
106
106
  groupSize: n,
107
107
  panelElement: i,
108
- styleProp: r.minSize
108
+ styleProp: s.minSize
109
109
  });
110
- s = O(u / n * 100);
110
+ r = T(c / n * 100);
111
111
  }
112
112
  let l = 100;
113
- if (r.maxSize !== void 0) {
114
- const u = ie({
113
+ if (s.maxSize !== void 0) {
114
+ const c = ie({
115
115
  groupSize: n,
116
116
  panelElement: i,
117
- styleProp: r.maxSize
117
+ styleProp: s.maxSize
118
118
  });
119
- l = O(u / n * 100);
119
+ l = T(c / n * 100);
120
120
  }
121
121
  return {
122
- groupResizeBehavior: r.groupResizeBehavior,
123
- collapsedSize: f,
124
- collapsible: r.collapsible === !0,
122
+ groupResizeBehavior: s.groupResizeBehavior,
123
+ collapsedSize: u,
124
+ collapsible: s.collapsible === !0,
125
125
  defaultSize: a,
126
- disabled: r.disabled,
127
- minSize: s,
126
+ disabled: s.disabled,
127
+ minSize: r,
128
128
  maxSize: l,
129
129
  panelId: o.id
130
130
  };
@@ -136,21 +136,21 @@ function C(e, t = "Assertion error") {
136
136
  }
137
137
  function be(e, t) {
138
138
  return Array.from(t).sort(
139
- e === "horizontal" ? zt : xt
139
+ e === "horizontal" ? Pt : wt
140
140
  );
141
141
  }
142
- function zt(e, t) {
142
+ function Pt(e, t) {
143
143
  const n = e.element.offsetLeft - t.element.offsetLeft;
144
144
  return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
145
145
  }
146
- function xt(e, t) {
146
+ function wt(e, t) {
147
147
  const n = e.element.offsetTop - t.element.offsetTop;
148
148
  return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
149
149
  }
150
- function qe(e) {
150
+ function Ye(e) {
151
151
  return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
152
152
  }
153
- function Ye(e, t) {
153
+ function Je(e, t) {
154
154
  return {
155
155
  x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
156
156
  Math.abs(e.x - t.left),
@@ -162,7 +162,7 @@ function Ye(e, t) {
162
162
  )
163
163
  };
164
164
  }
165
- function Pt({
165
+ function Lt({
166
166
  orientation: e,
167
167
  rects: t,
168
168
  targetRect: n
@@ -171,69 +171,69 @@ function Pt({
171
171
  x: n.x + n.width / 2,
172
172
  y: n.y + n.height / 2
173
173
  };
174
- let i, r = Number.MAX_VALUE;
175
- for (const f of t) {
176
- const { x: a, y: s } = Ye(o, f), l = e === "horizontal" ? a : s;
177
- l < r && (r = l, i = f);
174
+ let i, s = Number.MAX_VALUE;
175
+ for (const u of t) {
176
+ const { x: a, y: r } = Je(o, u), l = e === "horizontal" ? a : r;
177
+ l < s && (s = l, i = u);
178
178
  }
179
179
  return C(i, "No rect found"), i;
180
180
  }
181
181
  let fe;
182
- function wt() {
182
+ function Ct() {
183
183
  return fe === void 0 && (typeof matchMedia == "function" ? fe = !!matchMedia("(pointer:coarse)").matches : fe = !1), fe;
184
184
  }
185
- function Je(e) {
186
- const { element: t, orientation: n, panels: o, separators: i } = e, r = be(
185
+ function Ze(e) {
186
+ const { element: t, orientation: n, panels: o, separators: i } = e, s = be(
187
187
  n,
188
- Array.from(t.children).filter(qe).map((z) => ({ element: z }))
189
- ).map(({ element: z }) => z), f = [];
190
- let a = !1, s = !1, l = -1, u = -1, h = 0, d, S = [];
188
+ Array.from(t.children).filter(Ye).map((z) => ({ element: z }))
189
+ ).map(({ element: z }) => z), u = [];
190
+ let a = !1, r = !1, l = -1, c = -1, m = 0, p, S = [];
191
191
  {
192
192
  let z = -1;
193
- for (const c of r)
194
- c.hasAttribute("data-panel") && (z++, c.hasAttribute("data-disabled") || (h++, l === -1 && (l = z), u = z));
193
+ for (const f of s)
194
+ f.hasAttribute("data-panel") && (z++, f.hasAttribute("data-disabled") || (m++, l === -1 && (l = z), c = z));
195
195
  }
196
- if (h > 1) {
196
+ if (m > 1) {
197
197
  let z = -1;
198
- for (const c of r)
199
- if (c.hasAttribute("data-panel")) {
198
+ for (const f of s)
199
+ if (f.hasAttribute("data-panel")) {
200
200
  z++;
201
- const p = o.find(
202
- (m) => m.element === c
201
+ const d = o.find(
202
+ (h) => h.element === f
203
203
  );
204
- if (p) {
205
- if (d) {
206
- const m = d.element.getBoundingClientRect(), v = c.getBoundingClientRect();
204
+ if (d) {
205
+ if (p) {
206
+ const h = p.element.getBoundingClientRect(), y = f.getBoundingClientRect();
207
207
  let b;
208
- if (s) {
209
- const y = n === "horizontal" ? new DOMRect(
210
- m.right,
211
- m.top,
208
+ if (r) {
209
+ const v = n === "horizontal" ? new DOMRect(
210
+ h.right,
211
+ h.top,
212
212
  0,
213
- m.height
213
+ h.height
214
214
  ) : new DOMRect(
215
- m.left,
216
- m.bottom,
217
- m.width,
215
+ h.left,
216
+ h.bottom,
217
+ h.width,
218
218
  0
219
- ), g = n === "horizontal" ? new DOMRect(v.left, v.top, 0, v.height) : new DOMRect(v.left, v.top, v.width, 0);
219
+ ), g = n === "horizontal" ? new DOMRect(y.left, y.top, 0, y.height) : new DOMRect(y.left, y.top, y.width, 0);
220
220
  switch (S.length) {
221
221
  case 0: {
222
222
  b = [
223
- y,
223
+ v,
224
224
  g
225
225
  ];
226
226
  break;
227
227
  }
228
228
  case 1: {
229
- const P = S[0], M = Pt({
229
+ const w = S[0], M = Lt({
230
230
  orientation: n,
231
- rects: [m, v],
232
- targetRect: P.element.getBoundingClientRect()
231
+ rects: [h, y],
232
+ targetRect: w.element.getBoundingClientRect()
233
233
  });
234
234
  b = [
235
- P,
236
- M === m ? g : y
235
+ w,
236
+ M === h ? g : v
237
237
  ];
238
238
  break;
239
239
  }
@@ -245,62 +245,62 @@ function Je(e) {
245
245
  } else
246
246
  S.length ? b = S : b = [
247
247
  n === "horizontal" ? new DOMRect(
248
- m.right,
249
- v.top,
250
- v.left - m.right,
251
- v.height
248
+ h.right,
249
+ y.top,
250
+ y.left - h.right,
251
+ y.height
252
252
  ) : new DOMRect(
253
- v.left,
254
- m.bottom,
255
- v.width,
256
- v.top - m.bottom
253
+ y.left,
254
+ h.bottom,
255
+ y.width,
256
+ y.top - h.bottom
257
257
  )
258
258
  ];
259
- for (const y of b) {
260
- let g = "width" in y ? y : y.element.getBoundingClientRect();
261
- const P = wt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
262
- if (g.width < P) {
263
- const w = P - g.width;
259
+ for (const v of b) {
260
+ let g = "width" in v ? v : v.element.getBoundingClientRect();
261
+ const w = Ct() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
262
+ if (g.width < w) {
263
+ const L = w - g.width;
264
264
  g = new DOMRect(
265
- g.x - w / 2,
265
+ g.x - L / 2,
266
266
  g.y,
267
- g.width + w,
267
+ g.width + L,
268
268
  g.height
269
269
  );
270
270
  }
271
- if (g.height < P) {
272
- const w = P - g.height;
271
+ if (g.height < w) {
272
+ const L = w - g.height;
273
273
  g = new DOMRect(
274
274
  g.x,
275
- g.y - w / 2,
275
+ g.y - L / 2,
276
276
  g.width,
277
- g.height + w
277
+ g.height + L
278
278
  );
279
279
  }
280
- const M = z <= l || z > u;
281
- !a && !M && f.push({
280
+ const M = z <= l || z > c;
281
+ !a && !M && u.push({
282
282
  group: e,
283
283
  groupSize: ne({ group: e }),
284
- panels: [d, p],
285
- separator: "width" in y ? void 0 : y,
284
+ panels: [p, d],
285
+ separator: "width" in v ? void 0 : v,
286
286
  rect: g
287
287
  }), a = !1;
288
288
  }
289
289
  }
290
- s = !1, d = p, S = [];
290
+ r = !1, p = d, S = [];
291
291
  }
292
- } else if (c.hasAttribute("data-separator")) {
293
- c.ariaDisabled !== null && (a = !0);
294
- const p = i.find(
295
- (m) => m.element === c
292
+ } else if (f.hasAttribute("data-separator")) {
293
+ f.ariaDisabled !== null && (a = !0);
294
+ const d = i.find(
295
+ (h) => h.element === f
296
296
  );
297
- p ? S.push(p) : (d = void 0, S = []);
297
+ d ? S.push(d) : (p = void 0, S = []);
298
298
  } else
299
- s = !0;
299
+ r = !0;
300
300
  }
301
- return f;
301
+ return u;
302
302
  }
303
- class Ze {
303
+ class Qe {
304
304
  #e = {};
305
305
  addListener(t, n) {
306
306
  const o = this.#e[t];
@@ -314,18 +314,18 @@ class Ze {
314
314
  if (o.length === 1)
315
315
  o[0].call(null, n);
316
316
  else {
317
- let i = !1, r = null;
318
- const f = Array.from(o);
319
- for (let a = 0; a < f.length; a++) {
320
- const s = f[a];
317
+ let i = !1, s = null;
318
+ const u = Array.from(o);
319
+ for (let a = 0; a < u.length; a++) {
320
+ const r = u[a];
321
321
  try {
322
- s.call(null, n);
322
+ r.call(null, n);
323
323
  } catch (l) {
324
- r === null && (i = !0, r = l);
324
+ s === null && (i = !0, s = l);
325
325
  }
326
326
  }
327
327
  if (i)
328
- throw r;
328
+ throw s;
329
329
  }
330
330
  }
331
331
  removeAllListeners() {
@@ -339,12 +339,119 @@ class Ze {
339
339
  }
340
340
  }
341
341
  }
342
+ let ee = {
343
+ cursorFlags: 0,
344
+ state: "inactive"
345
+ };
346
+ const ze = new Qe();
347
+ function B() {
348
+ return ee;
349
+ }
350
+ function Rt(e) {
351
+ return ze.addListener("change", e);
352
+ }
353
+ function Mt(e) {
354
+ const t = ee, n = { ...ee };
355
+ n.cursorFlags = e, ee = n, ze.emit("change", {
356
+ prev: t,
357
+ next: n
358
+ });
359
+ }
360
+ function te(e) {
361
+ const t = ee;
362
+ ee = e, ze.emit("change", {
363
+ prev: t,
364
+ next: e
365
+ });
366
+ }
367
+ const Et = (e) => e, ye = () => {
368
+ }, et = 1, tt = 2, nt = 4, ot = 8, Ie = 3, ke = 12;
369
+ let de;
370
+ function De() {
371
+ return de === void 0 && (de = !1, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (de = !0)), de;
372
+ }
373
+ function It({
374
+ cursorFlags: e,
375
+ groups: t,
376
+ state: n
377
+ }) {
378
+ let o = 0, i = 0;
379
+ switch (n) {
380
+ case "active":
381
+ case "hover":
382
+ t.forEach((s) => {
383
+ if (!s.mutableState.disableCursor)
384
+ switch (s.orientation) {
385
+ case "horizontal": {
386
+ o++;
387
+ break;
388
+ }
389
+ case "vertical": {
390
+ i++;
391
+ break;
392
+ }
393
+ }
394
+ });
395
+ }
396
+ if (!(o === 0 && i === 0)) {
397
+ switch (n) {
398
+ case "active": {
399
+ if (e && De()) {
400
+ const s = (e & et) !== 0, u = (e & tt) !== 0, a = (e & nt) !== 0, r = (e & ot) !== 0;
401
+ if (s)
402
+ return a ? "se-resize" : r ? "ne-resize" : "e-resize";
403
+ if (u)
404
+ return a ? "sw-resize" : r ? "nw-resize" : "w-resize";
405
+ if (a)
406
+ return "s-resize";
407
+ if (r)
408
+ return "n-resize";
409
+ }
410
+ break;
411
+ }
412
+ }
413
+ return De() ? o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize" : o > 0 && i > 0 ? "grab" : o > 0 ? "col-resize" : "row-resize";
414
+ }
415
+ }
416
+ const Te = /* @__PURE__ */ new WeakMap();
417
+ function xe(e) {
418
+ if (e.defaultView === null || e.defaultView === void 0)
419
+ return;
420
+ let { prevStyle: t, styleSheet: n } = Te.get(e) ?? {};
421
+ n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets && (Object.isExtensible(e.adoptedStyleSheets) ? e.adoptedStyleSheets.push(n) : e.adoptedStyleSheets = [
422
+ ...e.adoptedStyleSheets,
423
+ n
424
+ ]));
425
+ const o = B();
426
+ switch (o.state) {
427
+ case "active":
428
+ case "hover": {
429
+ const i = It({
430
+ cursorFlags: o.cursorFlags,
431
+ groups: o.hitRegions.map((u) => u.group),
432
+ state: o.state
433
+ }), s = `*, *:hover {cursor: ${i} !important; }`;
434
+ if (t === s)
435
+ return;
436
+ t = s, i ? n.cssRules.length === 0 ? n.insertRule(s) : n.replaceSync(s) : n.cssRules.length === 1 && n.deleteRule(0);
437
+ break;
438
+ }
439
+ case "inactive": {
440
+ t = void 0, n.cssRules.length === 1 && n.deleteRule(0);
441
+ break;
442
+ }
443
+ }
444
+ Te.set(e, {
445
+ prevStyle: t,
446
+ styleSheet: n
447
+ });
448
+ }
342
449
  let F = /* @__PURE__ */ new Map();
343
- const Qe = new Ze();
344
- function Lt(e) {
450
+ const it = new Qe();
451
+ function kt(e) {
345
452
  F = new Map(F), F.delete(e);
346
453
  }
347
- function ke(e, t) {
454
+ function Oe(e, t) {
348
455
  for (const [n] of F)
349
456
  if (n.id === e)
350
457
  return n;
@@ -359,33 +466,54 @@ function H(e, t) {
359
466
  function X() {
360
467
  return F;
361
468
  }
362
- function ze(e, t) {
363
- return Qe.addListener("groupChange", (n) => {
469
+ function Pe(e, t) {
470
+ return it.addListener("groupChange", (n) => {
364
471
  n.group.id === e && t(n);
365
472
  });
366
473
  }
367
- function $(e, t) {
368
- const n = F.get(e);
369
- F = new Map(F), F.set(e, t), Qe.emit("groupChange", {
474
+ function j(e, t, n) {
475
+ const o = F.get(e);
476
+ F = new Map(F), F.set(e, t), it.emit("groupChange", {
370
477
  group: e,
371
- prev: n,
478
+ isUserInteraction: n?.isUserInteraction === !0,
479
+ prev: o,
372
480
  next: t
373
481
  });
374
482
  }
375
- function Ct(e, t, n) {
483
+ function rt(e) {
484
+ const t = B();
485
+ let n = !1;
486
+ switch (t.state) {
487
+ case "active":
488
+ te({
489
+ cursorFlags: 0,
490
+ state: "inactive"
491
+ }), t.hitRegions.length > 0 && (xe(e), n = !0, t.hitRegions.forEach((o) => {
492
+ const i = H(o.group.id, !0);
493
+ j(o.group, i, {
494
+ isUserInteraction: !0
495
+ });
496
+ }));
497
+ }
498
+ return n;
499
+ }
500
+ function Ge(e) {
501
+ e.defaultPrevented || rt(e.currentTarget);
502
+ }
503
+ function Dt(e, t, n) {
376
504
  let o, i = {
377
505
  x: 1 / 0,
378
506
  y: 1 / 0
379
507
  };
380
- for (const r of t) {
381
- const f = Ye(n, r.rect);
508
+ for (const s of t) {
509
+ const u = Je(n, s.rect);
382
510
  switch (e) {
383
511
  case "horizontal": {
384
- f.x <= i.x && (o = r, i = f);
512
+ u.x <= i.x && (o = s, i = u);
385
513
  break;
386
514
  }
387
515
  case "vertical": {
388
- f.y <= i.y && (o = r, i = f);
516
+ u.y <= i.y && (o = s, i = u);
389
517
  break;
390
518
  }
391
519
  }
@@ -395,14 +523,14 @@ function Ct(e, t, n) {
395
523
  hitRegion: o
396
524
  } : void 0;
397
525
  }
398
- function Rt(e) {
526
+ function Tt(e) {
399
527
  return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
400
528
  }
401
- function Mt(e, t) {
529
+ function Ot(e, t) {
402
530
  if (e === t) throw new Error("Cannot compare node with itself");
403
531
  const n = {
404
- a: Oe(e),
405
- b: Oe(t)
532
+ a: Ne(e),
533
+ b: Ne(t)
406
534
  };
407
535
  let o;
408
536
  for (; n.a.at(-1) === n.b.at(-1); )
@@ -412,92 +540,92 @@ function Mt(e, t) {
412
540
  "Stacking order can only be calculated for elements with a common ancestor"
413
541
  );
414
542
  const i = {
415
- a: De(Ie(n.a)),
416
- b: De(Ie(n.b))
543
+ a: Fe(Ae(n.a)),
544
+ b: Fe(Ae(n.b))
417
545
  };
418
546
  if (i.a === i.b) {
419
- const r = o.childNodes, f = {
547
+ const s = o.childNodes, u = {
420
548
  a: n.a.at(-1),
421
549
  b: n.b.at(-1)
422
550
  };
423
- let a = r.length;
551
+ let a = s.length;
424
552
  for (; a--; ) {
425
- const s = r[a];
426
- if (s === f.a) return 1;
427
- if (s === f.b) return -1;
553
+ const r = s[a];
554
+ if (r === u.a) return 1;
555
+ if (r === u.b) return -1;
428
556
  }
429
557
  }
430
558
  return Math.sign(i.a - i.b);
431
559
  }
432
- const Et = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
433
- function kt(e) {
434
- const t = getComputedStyle(et(e) ?? e).display;
560
+ const Gt = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
561
+ function At(e) {
562
+ const t = getComputedStyle(st(e) ?? e).display;
435
563
  return t === "flex" || t === "inline-flex";
436
564
  }
437
- function It(e) {
565
+ function Ft(e) {
438
566
  const t = getComputedStyle(e);
439
- return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || kt(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || Et.test(t.willChange) || t.webkitOverflowScrolling === "touch");
567
+ return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || At(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || Gt.test(t.willChange) || t.webkitOverflowScrolling === "touch");
440
568
  }
441
- function Ie(e) {
569
+ function Ae(e) {
442
570
  let t = e.length;
443
571
  for (; t--; ) {
444
572
  const n = e[t];
445
- if (C(n, "Missing node"), It(n)) return n;
573
+ if (C(n, "Missing node"), Ft(n)) return n;
446
574
  }
447
575
  return null;
448
576
  }
449
- function De(e) {
577
+ function Fe(e) {
450
578
  return e && Number(getComputedStyle(e).zIndex) || 0;
451
579
  }
452
- function Oe(e) {
580
+ function Ne(e) {
453
581
  const t = [];
454
582
  for (; e; )
455
- t.push(e), e = et(e);
583
+ t.push(e), e = st(e);
456
584
  return t;
457
585
  }
458
- function et(e) {
586
+ function st(e) {
459
587
  const { parentNode: t } = e;
460
- return Rt(t) ? t.host : t;
588
+ return Tt(t) ? t.host : t;
461
589
  }
462
- function Dt(e, t) {
590
+ function Nt(e, t) {
463
591
  return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
464
592
  }
465
- function Ot({
593
+ function _t({
466
594
  groupElement: e,
467
595
  hitRegion: t,
468
596
  pointerEventTarget: n
469
597
  }) {
470
- if (!qe(n) || n.contains(e) || e.contains(n))
598
+ if (!Ye(n) || n.contains(e) || e.contains(n))
471
599
  return !0;
472
- if (Mt(n, e) > 0) {
600
+ if (Ot(n, e) > 0) {
473
601
  let o = n;
474
602
  for (; o; ) {
475
603
  if (o.contains(e))
476
604
  return !0;
477
- if (Dt(o.getBoundingClientRect(), t))
605
+ if (Nt(o.getBoundingClientRect(), t))
478
606
  return !1;
479
607
  o = o.parentElement;
480
608
  }
481
609
  }
482
610
  return !0;
483
611
  }
484
- function xe(e, t) {
612
+ function we(e, t) {
485
613
  const n = [];
486
614
  return t.forEach((o, i) => {
487
615
  if (i.disabled)
488
616
  return;
489
- const r = Je(i), f = Ct(i.orientation, r, {
617
+ const s = Ze(i), u = Dt(i.orientation, s, {
490
618
  x: e.clientX,
491
619
  y: e.clientY
492
620
  });
493
- f && f.distance.x <= 0 && f.distance.y <= 0 && Ot({
621
+ u && u.distance.x <= 0 && u.distance.y <= 0 && _t({
494
622
  groupElement: i.element,
495
- hitRegion: f.hitRegion.rect,
623
+ hitRegion: u.hitRegion.rect,
496
624
  pointerEventTarget: e.target
497
- }) && n.push(f.hitRegion);
625
+ }) && n.push(u.hitRegion);
498
626
  }), n;
499
627
  }
500
- function Tt(e, t) {
628
+ function $t(e, t) {
501
629
  if (e.length !== t.length)
502
630
  return !1;
503
631
  for (let n = 0; n < e.length; n++)
@@ -505,11 +633,11 @@ function Tt(e, t) {
505
633
  return !1;
506
634
  return !0;
507
635
  }
508
- function I(e, t, n = 0) {
509
- return Math.abs(O(e) - O(t)) <= n;
636
+ function k(e, t, n = 0) {
637
+ return Math.abs(T(e) - T(t)) <= n;
510
638
  }
511
639
  function A(e, t) {
512
- return I(e, t) ? 0 : e > t ? 1 : -1;
640
+ return k(e, t) ? 0 : e > t ? 1 : -1;
513
641
  }
514
642
  function Z({
515
643
  overrideDisabledPanels: e,
@@ -519,20 +647,20 @@ function Z({
519
647
  }) {
520
648
  const {
521
649
  collapsedSize: i = 0,
522
- collapsible: r,
523
- disabled: f,
650
+ collapsible: s,
651
+ disabled: u,
524
652
  maxSize: a = 100,
525
- minSize: s = 0
653
+ minSize: r = 0
526
654
  } = t;
527
- if (f && !e)
655
+ if (u && !e)
528
656
  return n;
529
- if (A(o, s) < 0)
530
- if (r) {
531
- const l = (i + s) / 2;
532
- A(o, l) < 0 ? o = i : o = s;
657
+ if (A(o, r) < 0)
658
+ if (s) {
659
+ const l = (i + r) / 2;
660
+ A(o, l) < 0 ? o = i : o = r;
533
661
  } else
534
- o = s;
535
- return o = Math.min(a, o), o = O(o), o;
662
+ o = r;
663
+ return o = Math.min(a, o), o = T(o), o;
536
664
  }
537
665
  function le({
538
666
  delta: e,
@@ -540,55 +668,55 @@ function le({
540
668
  panelConstraints: n,
541
669
  pivotIndices: o,
542
670
  prevLayout: i,
543
- trigger: r
671
+ trigger: s
544
672
  }) {
545
- if (I(e, 0))
673
+ if (k(e, 0))
546
674
  return t;
547
- const f = r === "imperative-api", a = Object.values(t), s = Object.values(i), l = [...a], [u, h] = o;
548
- C(u != null, "Invalid first pivot index"), C(h != null, "Invalid second pivot index");
549
- let d = 0;
550
- switch (r) {
675
+ const u = s === "imperative-api", a = Object.values(t), r = Object.values(i), l = [...a], [c, m] = o;
676
+ C(c != null, "Invalid first pivot index"), C(m != null, "Invalid second pivot index");
677
+ let p = 0;
678
+ switch (s) {
551
679
  case "keyboard": {
552
680
  {
553
- const c = e < 0 ? h : u, p = n[c];
681
+ const f = e < 0 ? m : c, d = n[f];
554
682
  C(
555
- p,
556
- `Panel constraints not found for index ${c}`
683
+ d,
684
+ `Panel constraints not found for index ${f}`
557
685
  );
558
686
  const {
559
- collapsedSize: m = 0,
560
- collapsible: v,
687
+ collapsedSize: h = 0,
688
+ collapsible: y,
561
689
  minSize: b = 0
562
- } = p;
563
- if (v) {
564
- const y = a[c];
690
+ } = d;
691
+ if (y) {
692
+ const v = a[f];
565
693
  if (C(
566
- y != null,
567
- `Previous layout not found for panel index ${c}`
568
- ), I(y, m)) {
569
- const g = b - y;
694
+ v != null,
695
+ `Previous layout not found for panel index ${f}`
696
+ ), k(v, h)) {
697
+ const g = b - v;
570
698
  A(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
571
699
  }
572
700
  }
573
701
  }
574
702
  {
575
- const c = e < 0 ? u : h, p = n[c];
703
+ const f = e < 0 ? c : m, d = n[f];
576
704
  C(
577
- p,
578
- `No panel constraints found for index ${c}`
705
+ d,
706
+ `No panel constraints found for index ${f}`
579
707
  );
580
708
  const {
581
- collapsedSize: m = 0,
582
- collapsible: v,
709
+ collapsedSize: h = 0,
710
+ collapsible: y,
583
711
  minSize: b = 0
584
- } = p;
585
- if (v) {
586
- const y = a[c];
712
+ } = d;
713
+ if (y) {
714
+ const v = a[f];
587
715
  if (C(
588
- y != null,
589
- `Previous layout not found for panel index ${c}`
590
- ), I(y, b)) {
591
- const g = y - m;
716
+ v != null,
717
+ `Previous layout not found for panel index ${f}`
718
+ ), k(v, b)) {
719
+ const g = v - h;
592
720
  A(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
593
721
  }
594
722
  }
@@ -596,107 +724,107 @@ function le({
596
724
  break;
597
725
  }
598
726
  default: {
599
- const c = e < 0 ? h : u, p = n[c];
727
+ const f = e < 0 ? m : c, d = n[f];
600
728
  C(
601
- p,
602
- `Panel constraints not found for index ${c}`
729
+ d,
730
+ `Panel constraints not found for index ${f}`
603
731
  );
604
- const m = a[c], { collapsible: v, collapsedSize: b, minSize: y } = p;
605
- if (v && A(m, y) < 0)
732
+ const h = a[f], { collapsible: y, collapsedSize: b, minSize: v } = d;
733
+ if (y && A(h, v) < 0)
606
734
  if (e > 0) {
607
- const g = y - b, P = g / 2, M = m + e;
608
- A(M, y) < 0 && (e = A(e, P) <= 0 ? 0 : g);
735
+ const g = v - b, w = g / 2, M = h + e;
736
+ A(M, v) < 0 && (e = A(e, w) <= 0 ? 0 : g);
609
737
  } else {
610
- const g = y - b, P = 100 - g / 2, M = m - e;
611
- A(M, y) < 0 && (e = A(100 + e, P) > 0 ? 0 : -g);
738
+ const g = v - b, w = 100 - g / 2, M = h - e;
739
+ A(M, v) < 0 && (e = A(100 + e, w) > 0 ? 0 : -g);
612
740
  }
613
741
  break;
614
742
  }
615
743
  }
616
744
  {
617
- const c = e < 0 ? 1 : -1;
618
- let p = e < 0 ? h : u, m = 0;
745
+ const f = e < 0 ? 1 : -1;
746
+ let d = e < 0 ? m : c, h = 0;
619
747
  for (; ; ) {
620
- const b = a[p];
748
+ const b = a[d];
621
749
  C(
622
750
  b != null,
623
- `Previous layout not found for panel index ${p}`
751
+ `Previous layout not found for panel index ${d}`
624
752
  );
625
753
  const g = Z({
626
- overrideDisabledPanels: f,
627
- panelConstraints: n[p],
754
+ overrideDisabledPanels: u,
755
+ panelConstraints: n[d],
628
756
  prevSize: b,
629
757
  size: 100
630
758
  }) - b;
631
- if (m += g, p += c, p < 0 || p >= n.length)
759
+ if (h += g, d += f, d < 0 || d >= n.length)
632
760
  break;
633
761
  }
634
- const v = Math.min(Math.abs(e), Math.abs(m));
635
- e = e < 0 ? 0 - v : v;
762
+ const y = Math.min(Math.abs(e), Math.abs(h));
763
+ e = e < 0 ? 0 - y : y;
636
764
  }
637
765
  {
638
- let p = e < 0 ? u : h;
639
- for (; p >= 0 && p < n.length; ) {
640
- const m = Math.abs(e) - Math.abs(d), v = a[p];
766
+ let d = e < 0 ? c : m;
767
+ for (; d >= 0 && d < n.length; ) {
768
+ const h = Math.abs(e) - Math.abs(p), y = a[d];
641
769
  C(
642
- v != null,
643
- `Previous layout not found for panel index ${p}`
770
+ y != null,
771
+ `Previous layout not found for panel index ${d}`
644
772
  );
645
- const b = v - m, y = Z({
646
- overrideDisabledPanels: f,
647
- panelConstraints: n[p],
648
- prevSize: v,
773
+ const b = y - h, v = Z({
774
+ overrideDisabledPanels: u,
775
+ panelConstraints: n[d],
776
+ prevSize: y,
649
777
  size: b
650
778
  });
651
- if (!I(v, y) && (d += v - y, l[p] = y, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
779
+ if (!k(y, v) && (p += y - v, l[d] = v, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
652
780
  numeric: !0
653
781
  }) >= 0))
654
782
  break;
655
- e < 0 ? p-- : p++;
783
+ e < 0 ? d-- : d++;
656
784
  }
657
785
  }
658
- if (Tt(s, l))
786
+ if ($t(r, l))
659
787
  return i;
660
788
  {
661
- const c = e < 0 ? h : u, p = a[c];
789
+ const f = e < 0 ? m : c, d = a[f];
662
790
  C(
663
- p != null,
664
- `Previous layout not found for panel index ${c}`
791
+ d != null,
792
+ `Previous layout not found for panel index ${f}`
665
793
  );
666
- const m = p + d, v = Z({
667
- overrideDisabledPanels: f,
668
- panelConstraints: n[c],
669
- prevSize: p,
670
- size: m
794
+ const h = d + p, y = Z({
795
+ overrideDisabledPanels: u,
796
+ panelConstraints: n[f],
797
+ prevSize: d,
798
+ size: h
671
799
  });
672
- if (l[c] = v, !I(v, m)) {
673
- let b = m - v, g = e < 0 ? h : u;
800
+ if (l[f] = y, !k(y, h)) {
801
+ let b = h - y, g = e < 0 ? m : c;
674
802
  for (; g >= 0 && g < n.length; ) {
675
- const P = l[g];
803
+ const w = l[g];
676
804
  C(
677
- P != null,
805
+ w != null,
678
806
  `Previous layout not found for panel index ${g}`
679
807
  );
680
- const M = P + b, w = Z({
681
- overrideDisabledPanels: f,
808
+ const M = w + b, L = Z({
809
+ overrideDisabledPanels: u,
682
810
  panelConstraints: n[g],
683
- prevSize: P,
811
+ prevSize: w,
684
812
  size: M
685
813
  });
686
- if (I(P, w) || (b -= w - P, l[g] = w), I(b, 0))
814
+ if (k(w, L) || (b -= L - w, l[g] = L), k(b, 0))
687
815
  break;
688
816
  e > 0 ? g-- : g++;
689
817
  }
690
818
  }
691
819
  }
692
820
  const S = Object.values(l).reduce(
693
- (c, p) => p + c,
821
+ (f, d) => d + f,
694
822
  0
695
823
  );
696
- if (!I(S, 100, 0.1))
824
+ if (!k(S, 100, 0.1))
697
825
  return i;
698
826
  const z = Object.keys(i);
699
- return l.reduce((c, p, m) => (c[z[m]] = p, c), {});
827
+ return l.reduce((f, d, h) => (f[z[h]] = d, f), {});
700
828
  }
701
829
  function W(e, t) {
702
830
  if (Object.keys(e).length !== Object.keys(t).length)
@@ -706,199 +834,199 @@ function W(e, t) {
706
834
  return !1;
707
835
  return !0;
708
836
  }
709
- function U({
837
+ function K({
710
838
  layout: e,
711
839
  panelConstraints: t
712
840
  }) {
713
841
  const n = Object.values(e), o = [...n], i = o.reduce(
714
- (a, s) => a + s,
842
+ (a, r) => a + r,
715
843
  0
716
844
  );
717
845
  if (o.length !== t.length)
718
846
  throw Error(
719
847
  `Invalid ${t.length} panel layout: ${o.map((a) => `${a}%`).join(", ")}`
720
848
  );
721
- if (!I(i, 100) && o.length > 0)
849
+ if (!k(i, 100) && o.length > 0)
722
850
  for (let a = 0; a < t.length; a++) {
723
- const s = o[a];
724
- C(s != null, `No layout data found for index ${a}`);
725
- const l = 100 / i * s;
851
+ const r = o[a];
852
+ C(r != null, `No layout data found for index ${a}`);
853
+ const l = 100 / i * r;
726
854
  o[a] = l;
727
855
  }
728
- let r = 0;
856
+ let s = 0;
729
857
  for (let a = 0; a < t.length; a++) {
730
- const s = n[a];
731
- C(s != null, `No layout data found for index ${a}`);
858
+ const r = n[a];
859
+ C(r != null, `No layout data found for index ${a}`);
732
860
  const l = o[a];
733
861
  C(l != null, `No layout data found for index ${a}`);
734
- const u = Z({
862
+ const c = Z({
735
863
  overrideDisabledPanels: !0,
736
864
  panelConstraints: t[a],
737
- prevSize: s,
865
+ prevSize: r,
738
866
  size: l
739
867
  });
740
- l != u && (r += l - u, o[a] = u);
868
+ l != c && (s += l - c, o[a] = c);
741
869
  }
742
- if (!I(r, 0))
870
+ if (!k(s, 0))
743
871
  for (let a = 0; a < t.length; a++) {
744
- const s = o[a];
745
- C(s != null, `No layout data found for index ${a}`);
746
- const l = s + r, u = Z({
872
+ const r = o[a];
873
+ C(r != null, `No layout data found for index ${a}`);
874
+ const l = r + s, c = Z({
747
875
  overrideDisabledPanels: !0,
748
876
  panelConstraints: t[a],
749
- prevSize: s,
877
+ prevSize: r,
750
878
  size: l
751
879
  });
752
- if (s !== u && (r -= u - s, o[a] = u, I(r, 0)))
880
+ if (r !== c && (s -= c - r, o[a] = c, k(s, 0)))
753
881
  break;
754
882
  }
755
- const f = Object.keys(e);
756
- return o.reduce((a, s, l) => (a[f[l]] = s, a), {});
883
+ const u = Object.keys(e);
884
+ return o.reduce((a, r, l) => (a[u[l]] = r, a), {});
757
885
  }
758
- function tt({
886
+ function at({
759
887
  groupId: e,
760
888
  panelId: t
761
889
  }) {
762
890
  const n = () => {
763
- const s = X();
891
+ const r = X();
764
892
  for (const [
765
893
  l,
766
894
  {
767
- defaultLayoutDeferred: u,
768
- derivedPanelConstraints: h,
769
- layout: d,
895
+ defaultLayoutDeferred: c,
896
+ derivedPanelConstraints: m,
897
+ layout: p,
770
898
  groupSize: S,
771
899
  separatorToPanels: z
772
900
  }
773
- ] of s)
901
+ ] of r)
774
902
  if (l.id === e)
775
903
  return {
776
- defaultLayoutDeferred: u,
777
- derivedPanelConstraints: h,
904
+ defaultLayoutDeferred: c,
905
+ derivedPanelConstraints: m,
778
906
  group: l,
779
907
  groupSize: S,
780
- layout: d,
908
+ layout: p,
781
909
  separatorToPanels: z
782
910
  };
783
911
  throw Error(`Group ${e} not found`);
784
912
  }, o = () => {
785
- const s = n().derivedPanelConstraints.find(
913
+ const r = n().derivedPanelConstraints.find(
786
914
  (l) => l.panelId === t
787
915
  );
788
- if (s !== void 0)
789
- return s;
916
+ if (r !== void 0)
917
+ return r;
790
918
  throw Error(`Panel constraints not found for Panel ${t}`);
791
919
  }, i = () => {
792
- const s = n().group.panels.find((l) => l.id === t);
793
- if (s !== void 0)
794
- return s;
920
+ const r = n().group.panels.find((l) => l.id === t);
921
+ if (r !== void 0)
922
+ return r;
795
923
  throw Error(`Layout not found for Panel ${t}`);
796
- }, r = () => {
797
- const s = n().layout[t];
798
- if (s !== void 0)
799
- return s;
924
+ }, s = () => {
925
+ const r = n().layout[t];
926
+ if (r !== void 0)
927
+ return r;
800
928
  throw Error(`Layout not found for Panel ${t}`);
801
- }, f = ({
802
- nextSize: s,
929
+ }, u = ({
930
+ nextSize: r,
803
931
  panels: l,
804
- prevLayout: u,
805
- derivedPanelConstraints: h
932
+ prevLayout: c,
933
+ derivedPanelConstraints: m
806
934
  }) => {
807
- const d = r(), S = l.findIndex((m) => m.id === t), z = S === 0, c = S === l.length - 1;
808
- if (c && s < d && (z || l.slice(0, S).every((m, v) => {
809
- const b = h[v];
810
- return b?.collapsible && I(b.collapsedSize, u[b.panelId]);
935
+ const p = s(), S = l.findIndex((h) => h.id === t), z = S === 0, f = S === l.length - 1;
936
+ if (f && r < p && (z || l.slice(0, S).every((h, y) => {
937
+ const b = m[y];
938
+ return b?.collapsible && k(b.collapsedSize, c[b.panelId]);
811
939
  }))) {
812
- const m = l.slice(0, S).reduce((v, b) => v + u[b.id], 0);
940
+ const h = l.slice(0, S).reduce((y, b) => y + c[b.id], 0);
813
941
  return {
814
- ...u,
815
- [t]: O(100 - m)
942
+ ...c,
943
+ [t]: T(100 - h)
816
944
  };
817
945
  }
818
946
  return le({
819
- delta: c ? d - s : s - d,
820
- initialLayout: u,
821
- panelConstraints: h,
822
- pivotIndices: c ? [S - 1, S] : [S, S + 1],
823
- prevLayout: u,
947
+ delta: f ? p - r : r - p,
948
+ initialLayout: c,
949
+ panelConstraints: m,
950
+ pivotIndices: f ? [S - 1, S] : [S, S + 1],
951
+ prevLayout: c,
824
952
  trigger: "imperative-api"
825
953
  });
826
- }, a = (s) => {
827
- const l = r();
828
- if (s === l)
954
+ }, a = (r) => {
955
+ const l = s();
956
+ if (r === l)
829
957
  return;
830
958
  const {
831
- defaultLayoutDeferred: u,
832
- derivedPanelConstraints: h,
833
- group: d,
959
+ defaultLayoutDeferred: c,
960
+ derivedPanelConstraints: m,
961
+ group: p,
834
962
  groupSize: S,
835
963
  layout: z,
836
- separatorToPanels: c
837
- } = n(), p = f({
838
- nextSize: s,
839
- panels: d.panels,
964
+ separatorToPanels: f
965
+ } = n(), d = u({
966
+ nextSize: r,
967
+ panels: p.panels,
840
968
  prevLayout: z,
841
- derivedPanelConstraints: h
842
- }), m = U({
843
- layout: p,
844
- panelConstraints: h
969
+ derivedPanelConstraints: m
970
+ }), h = K({
971
+ layout: d,
972
+ panelConstraints: m
845
973
  });
846
- W(z, m) || $(d, {
847
- defaultLayoutDeferred: u,
848
- derivedPanelConstraints: h,
974
+ W(z, h) || j(p, {
975
+ defaultLayoutDeferred: c,
976
+ derivedPanelConstraints: m,
849
977
  groupSize: S,
850
- layout: m,
851
- separatorToPanels: c
978
+ layout: h,
979
+ separatorToPanels: f
852
980
  });
853
981
  };
854
982
  return {
855
983
  collapse: () => {
856
- const { collapsible: s, collapsedSize: l } = o(), { mutableValues: u } = i(), h = r();
857
- s && h !== l && (u.expandToSize = h, a(l));
984
+ const { collapsible: r, collapsedSize: l } = o(), { mutableValues: c } = i(), m = s();
985
+ r && m !== l && (c.expandToSize = m, a(l));
858
986
  },
859
987
  expand: () => {
860
- const { collapsible: s, collapsedSize: l, minSize: u } = o(), { mutableValues: h } = i(), d = r();
861
- if (s && d === l) {
862
- let S = h.expandToSize ?? u;
988
+ const { collapsible: r, collapsedSize: l, minSize: c } = o(), { mutableValues: m } = i(), p = s();
989
+ if (r && p === l) {
990
+ let S = m.expandToSize ?? c;
863
991
  S === 0 && (S = 1), a(S);
864
992
  }
865
993
  },
866
994
  getSize: () => {
867
- const { group: s } = n(), l = r(), { element: u } = i(), h = s.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
995
+ const { group: r } = n(), l = s(), { element: c } = i(), m = r.orientation === "horizontal" ? c.offsetWidth : c.offsetHeight;
868
996
  return {
869
997
  asPercentage: l,
870
- inPixels: h
998
+ inPixels: m
871
999
  };
872
1000
  },
873
1001
  isCollapsed: () => {
874
- const { collapsible: s, collapsedSize: l } = o(), u = r();
875
- return s && I(l, u);
1002
+ const { collapsible: r, collapsedSize: l } = o(), c = s();
1003
+ return r && k(l, c);
876
1004
  },
877
- resize: (s) => {
878
- const { group: l } = n(), { element: u } = i(), h = ne({ group: l }), d = ie({
879
- groupSize: h,
880
- panelElement: u,
881
- styleProp: s
882
- }), S = O(d / h * 100);
1005
+ resize: (r) => {
1006
+ const { group: l } = n(), { element: c } = i(), m = ne({ group: l }), p = ie({
1007
+ groupSize: m,
1008
+ panelElement: c,
1009
+ styleProp: r
1010
+ }), S = T(p / m * 100);
883
1011
  a(S);
884
1012
  }
885
1013
  };
886
1014
  }
887
- function Te(e) {
1015
+ function _e(e) {
888
1016
  if (e.defaultPrevented)
889
1017
  return;
890
1018
  const t = X();
891
- xe(e, t).forEach((o) => {
1019
+ we(e, t).forEach((o) => {
892
1020
  if (o.separator && !o.separator.disableDoubleClick) {
893
1021
  const i = o.panels.find(
894
- (r) => r.panelConstraints.defaultSize !== void 0
1022
+ (s) => s.panelConstraints.defaultSize !== void 0
895
1023
  );
896
1024
  if (i) {
897
- const r = i.panelConstraints.defaultSize, f = tt({
1025
+ const s = i.panelConstraints.defaultSize, u = at({
898
1026
  groupId: o.group.id,
899
1027
  panelId: i.id
900
1028
  });
901
- f && r !== void 0 && (f.resize(r), e.preventDefault());
1029
+ u && s !== void 0 && (u.resize(s), e.preventDefault());
902
1030
  }
903
1031
  }
904
1032
  });
@@ -912,7 +1040,7 @@ function pe(e) {
912
1040
  return n;
913
1041
  throw Error("Could not find parent Group for separator element");
914
1042
  }
915
- function nt({
1043
+ function lt({
916
1044
  groupId: e
917
1045
  }) {
918
1046
  const t = () => {
@@ -931,153 +1059,136 @@ function nt({
931
1059
  const {
932
1060
  defaultLayoutDeferred: o,
933
1061
  derivedPanelConstraints: i,
934
- group: r,
935
- groupSize: f,
1062
+ group: s,
1063
+ groupSize: u,
936
1064
  layout: a,
937
- separatorToPanels: s
938
- } = t(), l = U({
1065
+ separatorToPanels: r
1066
+ } = t(), l = K({
939
1067
  layout: n,
940
1068
  panelConstraints: i
941
1069
  });
942
- return o ? a : (W(a, l) || $(r, {
1070
+ return o ? a : (W(a, l) || j(s, {
943
1071
  defaultLayoutDeferred: o,
944
1072
  derivedPanelConstraints: i,
945
- groupSize: f,
1073
+ groupSize: u,
946
1074
  layout: l,
947
- separatorToPanels: s
1075
+ separatorToPanels: r
948
1076
  }), l);
949
1077
  }
950
1078
  };
951
1079
  }
952
- function B(e, t) {
1080
+ function U(e, t) {
953
1081
  const n = pe(e), o = H(n.id, !0), i = n.separators.find(
954
- (h) => h.element === e
1082
+ (m) => m.element === e
955
1083
  );
956
1084
  C(i, "Matching separator not found");
957
- const r = o.separatorToPanels.get(i);
958
- C(r, "Matching panels not found");
959
- const f = r.map((h) => n.panels.indexOf(h)), s = nt({ groupId: n.id }).getLayout(), l = le({
1085
+ const s = o.separatorToPanels.get(i);
1086
+ C(s, "Matching panels not found");
1087
+ const u = s.map((m) => n.panels.indexOf(m)), r = lt({ groupId: n.id }).getLayout(), l = le({
960
1088
  delta: t,
961
- initialLayout: s,
1089
+ initialLayout: r,
962
1090
  panelConstraints: o.derivedPanelConstraints,
963
- pivotIndices: f,
964
- prevLayout: s,
1091
+ pivotIndices: u,
1092
+ prevLayout: r,
965
1093
  trigger: "keyboard"
966
- }), u = U({
1094
+ }), c = K({
967
1095
  layout: l,
968
1096
  panelConstraints: o.derivedPanelConstraints
969
1097
  });
970
- W(s, u) || $(n, {
971
- defaultLayoutDeferred: o.defaultLayoutDeferred,
972
- derivedPanelConstraints: o.derivedPanelConstraints,
973
- groupSize: o.groupSize,
974
- layout: u,
975
- separatorToPanels: o.separatorToPanels
976
- });
1098
+ W(r, c) || j(
1099
+ n,
1100
+ {
1101
+ defaultLayoutDeferred: o.defaultLayoutDeferred,
1102
+ derivedPanelConstraints: o.derivedPanelConstraints,
1103
+ groupSize: o.groupSize,
1104
+ layout: c,
1105
+ separatorToPanels: o.separatorToPanels
1106
+ },
1107
+ // Keyboard resizes (arrow keys, Home/End, Enter collapse/expand) originate
1108
+ // from a real DOM event on the separator, so they are user interactions
1109
+ // just like pointer drags. This function is only reached from
1110
+ // onDocumentKeyDown. See #716.
1111
+ { isUserInteraction: !0 }
1112
+ );
977
1113
  }
978
- function Ge(e) {
1114
+ function $e(e) {
979
1115
  if (e.defaultPrevented)
980
1116
  return;
981
1117
  const t = e.currentTarget, n = pe(t);
982
1118
  if (!n.disabled)
983
1119
  switch (e.key) {
984
1120
  case "ArrowDown": {
985
- e.preventDefault(), n.orientation === "vertical" && B(t, 5);
1121
+ e.preventDefault(), n.orientation === "vertical" && U(t, 5);
986
1122
  break;
987
1123
  }
988
1124
  case "ArrowLeft": {
989
- e.preventDefault(), n.orientation === "horizontal" && B(t, -5);
1125
+ e.preventDefault(), n.orientation === "horizontal" && U(t, -5);
990
1126
  break;
991
1127
  }
992
1128
  case "ArrowRight": {
993
- e.preventDefault(), n.orientation === "horizontal" && B(t, 5);
1129
+ e.preventDefault(), n.orientation === "horizontal" && U(t, 5);
994
1130
  break;
995
1131
  }
996
1132
  case "ArrowUp": {
997
- e.preventDefault(), n.orientation === "vertical" && B(t, -5);
1133
+ e.preventDefault(), n.orientation === "vertical" && U(t, -5);
998
1134
  break;
999
1135
  }
1000
1136
  case "End": {
1001
- e.preventDefault(), B(t, 100);
1137
+ e.preventDefault(), U(t, 100);
1002
1138
  break;
1003
1139
  }
1004
1140
  case "Enter": {
1005
1141
  e.preventDefault();
1006
- const o = pe(t), i = H(o.id, !0), { derivedPanelConstraints: r, layout: f, separatorToPanels: a } = i, s = o.separators.find(
1007
- (d) => d.element === t
1142
+ const o = pe(t), i = H(o.id, !0), { derivedPanelConstraints: s, layout: u, separatorToPanels: a } = i, r = o.separators.find(
1143
+ (p) => p.element === t
1008
1144
  );
1009
- C(s, "Matching separator not found");
1010
- const l = a.get(s);
1145
+ C(r, "Matching separator not found");
1146
+ const l = a.get(r);
1011
1147
  C(l, "Matching panels not found");
1012
- const u = l[0], h = r.find(
1013
- (d) => d.panelId === u.id
1148
+ const c = l[0], m = s.find(
1149
+ (p) => p.panelId === c.id
1014
1150
  );
1015
- if (C(h, "Panel metadata not found"), h.collapsible) {
1016
- const d = f[u.id], S = h.collapsedSize === d ? o.mutableState.expandedPanelSizes[u.id] ?? h.minSize : h.collapsedSize;
1017
- B(t, S - d);
1151
+ if (C(m, "Panel metadata not found"), m.collapsible) {
1152
+ const p = u[c.id], S = m.collapsedSize === p ? o.mutableState.expandedPanelSizes[c.id] ?? m.minSize : m.collapsedSize;
1153
+ U(t, S - p);
1018
1154
  }
1019
1155
  break;
1020
1156
  }
1021
1157
  case "F6": {
1022
1158
  e.preventDefault();
1023
1159
  const i = pe(t).separators.map(
1024
- (s) => s.element
1025
- ), r = Array.from(i).findIndex(
1026
- (s) => s === e.currentTarget
1160
+ (r) => r.element
1161
+ ), s = Array.from(i).findIndex(
1162
+ (r) => r === e.currentTarget
1027
1163
  );
1028
- C(r !== null, "Index not found");
1029
- const f = e.shiftKey ? r > 0 ? r - 1 : i.length - 1 : r + 1 < i.length ? r + 1 : 0;
1030
- i[f].focus({
1164
+ C(s !== null, "Index not found");
1165
+ const u = e.shiftKey ? s > 0 ? s - 1 : i.length - 1 : s + 1 < i.length ? s + 1 : 0;
1166
+ i[u].focus({
1031
1167
  preventScroll: !0
1032
1168
  });
1033
1169
  break;
1034
1170
  }
1035
1171
  case "Home": {
1036
- e.preventDefault(), B(t, -100);
1172
+ e.preventDefault(), U(t, -100);
1037
1173
  break;
1038
1174
  }
1039
1175
  }
1040
1176
  }
1041
- let ee = {
1042
- cursorFlags: 0,
1043
- state: "inactive"
1044
- };
1045
- const Pe = new Ze();
1046
- function K() {
1047
- return ee;
1048
- }
1049
- function Gt(e) {
1050
- return Pe.addListener("change", e);
1051
- }
1052
- function At(e) {
1053
- const t = ee, n = { ...ee };
1054
- n.cursorFlags = e, ee = n, Pe.emit("change", {
1055
- prev: t,
1056
- next: n
1057
- });
1058
- }
1059
- function te(e) {
1060
- const t = ee;
1061
- ee = e, Pe.emit("change", {
1062
- prev: t,
1063
- next: e
1064
- });
1065
- }
1066
- function Ae(e) {
1177
+ function je(e) {
1067
1178
  if (e.defaultPrevented)
1068
1179
  return;
1069
1180
  if (e.pointerType === "mouse" && e.button > 0)
1070
1181
  return;
1071
- const t = X(), n = xe(e, t), o = /* @__PURE__ */ new Map();
1182
+ const t = X(), n = we(e, t), o = /* @__PURE__ */ new Map();
1072
1183
  let i = !1;
1073
- n.forEach((r) => {
1074
- r.separator && (i || (i = !0, r.separator.element.focus({
1184
+ n.forEach((s) => {
1185
+ s.separator && (i || (i = !0, s.separator.element.focus({
1075
1186
  // @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#browser_compatibility
1076
1187
  focusVisible: !1,
1077
1188
  preventScroll: !0
1078
1189
  })));
1079
- const f = t.get(r.group);
1080
- f && o.set(r.group, f.layout);
1190
+ const u = t.get(s.group);
1191
+ u && o.set(s.group, u.layout);
1081
1192
  }), te({
1082
1193
  cursorFlags: 0,
1083
1194
  hitRegions: n,
@@ -1086,151 +1197,69 @@ function Ae(e) {
1086
1197
  state: "active"
1087
1198
  }), n.length && e.preventDefault();
1088
1199
  }
1089
- const Ft = (e) => e, ye = () => {
1090
- }, ot = 1, it = 2, rt = 4, st = 8, Fe = 3, Ne = 12;
1091
- let de;
1092
- function _e() {
1093
- return de === void 0 && (de = !1, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (de = !0)), de;
1094
- }
1095
- function Nt({
1096
- cursorFlags: e,
1097
- groups: t,
1098
- state: n
1099
- }) {
1100
- let o = 0, i = 0;
1101
- switch (n) {
1102
- case "active":
1103
- case "hover":
1104
- t.forEach((r) => {
1105
- if (!r.mutableState.disableCursor)
1106
- switch (r.orientation) {
1107
- case "horizontal": {
1108
- o++;
1109
- break;
1110
- }
1111
- case "vertical": {
1112
- i++;
1113
- break;
1114
- }
1115
- }
1116
- });
1117
- }
1118
- if (!(o === 0 && i === 0)) {
1119
- switch (n) {
1120
- case "active": {
1121
- if (e && _e()) {
1122
- const r = (e & ot) !== 0, f = (e & it) !== 0, a = (e & rt) !== 0, s = (e & st) !== 0;
1123
- if (r)
1124
- return a ? "se-resize" : s ? "ne-resize" : "e-resize";
1125
- if (f)
1126
- return a ? "sw-resize" : s ? "nw-resize" : "w-resize";
1127
- if (a)
1128
- return "s-resize";
1129
- if (s)
1130
- return "n-resize";
1131
- }
1132
- break;
1133
- }
1134
- }
1135
- return _e() ? o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize" : o > 0 && i > 0 ? "grab" : o > 0 ? "col-resize" : "row-resize";
1136
- }
1137
- }
1138
- const $e = /* @__PURE__ */ new WeakMap();
1139
- function we(e) {
1140
- if (e.defaultView === null || e.defaultView === void 0)
1141
- return;
1142
- let { prevStyle: t, styleSheet: n } = $e.get(e) ?? {};
1143
- n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets && (Object.isExtensible(e.adoptedStyleSheets) ? e.adoptedStyleSheets.push(n) : e.adoptedStyleSheets = [
1144
- ...e.adoptedStyleSheets,
1145
- n
1146
- ]));
1147
- const o = K();
1148
- switch (o.state) {
1149
- case "active":
1150
- case "hover": {
1151
- const i = Nt({
1152
- cursorFlags: o.cursorFlags,
1153
- groups: o.hitRegions.map((f) => f.group),
1154
- state: o.state
1155
- }), r = `*, *:hover {cursor: ${i} !important; }`;
1156
- if (t === r)
1157
- return;
1158
- t = r, i ? n.cssRules.length === 0 ? n.insertRule(r) : n.replaceSync(r) : n.cssRules.length === 1 && n.deleteRule(0);
1159
- break;
1160
- }
1161
- case "inactive": {
1162
- t = void 0, n.cssRules.length === 1 && n.deleteRule(0);
1163
- break;
1164
- }
1165
- }
1166
- $e.set(e, {
1167
- prevStyle: t,
1168
- styleSheet: n
1169
- });
1170
- }
1171
- function at({
1200
+ function ut({
1172
1201
  document: e,
1173
1202
  event: t,
1174
1203
  hitRegions: n,
1175
1204
  initialLayoutMap: o,
1176
1205
  mountedGroups: i,
1177
- pointerDownAtPoint: r,
1178
- prevCursorFlags: f
1206
+ pointerDownAtPoint: s,
1207
+ prevCursorFlags: u
1179
1208
  }) {
1180
1209
  let a = 0;
1181
1210
  n.forEach((l) => {
1182
- const { group: u, groupSize: h } = l, { orientation: d, panels: S } = u, { disableCursor: z } = u.mutableState;
1183
- let c = 0;
1184
- r ? d === "horizontal" ? c = (t.clientX - r.x) / h * 100 : c = (t.clientY - r.y) / h * 100 : d === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
1185
- const p = o.get(u), m = i.get(u);
1186
- if (!p || !m)
1211
+ const { group: c, groupSize: m } = l, { orientation: p, panels: S } = c, { disableCursor: z } = c.mutableState;
1212
+ let f = 0;
1213
+ s ? p === "horizontal" ? f = (t.clientX - s.x) / m * 100 : f = (t.clientY - s.y) / m * 100 : p === "horizontal" ? f = t.clientX < 0 ? -100 : 100 : f = t.clientY < 0 ? -100 : 100;
1214
+ const d = o.get(c), h = i.get(c);
1215
+ if (!d || !h)
1187
1216
  return;
1188
1217
  const {
1189
- defaultLayoutDeferred: v,
1218
+ defaultLayoutDeferred: y,
1190
1219
  derivedPanelConstraints: b,
1191
- groupSize: y,
1220
+ groupSize: v,
1192
1221
  layout: g,
1193
- separatorToPanels: P
1194
- } = m;
1195
- if (b && g && P) {
1222
+ separatorToPanels: w
1223
+ } = h;
1224
+ if (b && g && w) {
1196
1225
  const M = le({
1197
- delta: c,
1198
- initialLayout: p,
1226
+ delta: f,
1227
+ initialLayout: d,
1199
1228
  panelConstraints: b,
1200
- pivotIndices: l.panels.map((w) => S.indexOf(w)),
1229
+ pivotIndices: l.panels.map((L) => S.indexOf(L)),
1201
1230
  prevLayout: g,
1202
1231
  trigger: "mouse-or-touch"
1203
1232
  });
1204
1233
  if (W(M, g)) {
1205
- if (c !== 0 && !z)
1206
- switch (d) {
1234
+ if (f !== 0 && !z)
1235
+ switch (p) {
1207
1236
  case "horizontal": {
1208
- a |= c < 0 ? ot : it;
1237
+ a |= f < 0 ? et : tt;
1209
1238
  break;
1210
1239
  }
1211
1240
  case "vertical": {
1212
- a |= c < 0 ? rt : st;
1241
+ a |= f < 0 ? nt : ot;
1213
1242
  break;
1214
1243
  }
1215
1244
  }
1216
1245
  } else
1217
- $(l.group, {
1218
- defaultLayoutDeferred: v,
1246
+ j(l.group, {
1247
+ defaultLayoutDeferred: y,
1219
1248
  derivedPanelConstraints: b,
1220
- groupSize: y,
1249
+ groupSize: v,
1221
1250
  layout: M,
1222
- separatorToPanels: P
1251
+ separatorToPanels: w
1223
1252
  });
1224
1253
  }
1225
1254
  });
1226
- let s = 0;
1227
- t.movementX === 0 ? s |= f & Fe : s |= a & Fe, t.movementY === 0 ? s |= f & Ne : s |= a & Ne, At(s), we(e);
1255
+ let r = 0;
1256
+ t.movementX === 0 ? r |= u & Ie : r |= a & Ie, t.movementY === 0 ? r |= u & ke : r |= a & ke, Mt(r), xe(e);
1228
1257
  }
1229
- function je(e) {
1230
- const t = X(), n = K();
1258
+ function He(e) {
1259
+ const t = X(), n = B();
1231
1260
  switch (n.state) {
1232
1261
  case "active":
1233
- at({
1262
+ ut({
1234
1263
  document: e.currentTarget,
1235
1264
  event: e,
1236
1265
  hitRegions: n.hitRegions,
@@ -1240,10 +1269,10 @@ function je(e) {
1240
1269
  });
1241
1270
  }
1242
1271
  }
1243
- function He(e) {
1272
+ function Ve(e) {
1244
1273
  if (e.defaultPrevented)
1245
1274
  return;
1246
- const t = K(), n = X();
1275
+ const t = B(), n = X();
1247
1276
  switch (t.state) {
1248
1277
  case "active": {
1249
1278
  if (
@@ -1255,7 +1284,9 @@ function He(e) {
1255
1284
  state: "inactive"
1256
1285
  }), t.hitRegions.forEach((o) => {
1257
1286
  const i = H(o.group.id, !0);
1258
- $(o.group, i);
1287
+ j(o.group, i, {
1288
+ isUserInteraction: !0
1289
+ });
1259
1290
  });
1260
1291
  return;
1261
1292
  }
@@ -1264,7 +1295,7 @@ function He(e) {
1264
1295
  const { element: i } = o.separator;
1265
1296
  i.hasPointerCapture?.(e.pointerId) || i.setPointerCapture?.(e.pointerId);
1266
1297
  }
1267
- at({
1298
+ ut({
1268
1299
  document: e.currentTarget,
1269
1300
  event: e,
1270
1301
  hitRegions: t.hitRegions,
@@ -1276,7 +1307,7 @@ function He(e) {
1276
1307
  break;
1277
1308
  }
1278
1309
  default: {
1279
- const o = xe(e, n);
1310
+ const o = we(e, n);
1280
1311
  o.length === 0 ? t.state !== "inactive" && te({
1281
1312
  cursorFlags: 0,
1282
1313
  state: "inactive"
@@ -1284,14 +1315,14 @@ function He(e) {
1284
1315
  cursorFlags: 0,
1285
1316
  hitRegions: o,
1286
1317
  state: "hover"
1287
- }), we(e.currentTarget);
1318
+ }), xe(e.currentTarget);
1288
1319
  break;
1289
1320
  }
1290
1321
  }
1291
1322
  }
1292
- function Ve(e) {
1323
+ function Ue(e) {
1293
1324
  if (e.relatedTarget instanceof HTMLIFrameElement)
1294
- switch (K().state) {
1325
+ switch (B().state) {
1295
1326
  case "hover":
1296
1327
  te({
1297
1328
  cursorFlags: 0,
@@ -1304,49 +1335,39 @@ function Be(e) {
1304
1335
  return;
1305
1336
  if (e.pointerType === "mouse" && e.button > 0)
1306
1337
  return;
1307
- const t = K();
1308
- switch (t.state) {
1309
- case "active":
1310
- te({
1311
- cursorFlags: 0,
1312
- state: "inactive"
1313
- }), t.hitRegions.length > 0 && (we(e.currentTarget), t.hitRegions.forEach((n) => {
1314
- const o = H(n.group.id, !0);
1315
- $(n.group, o);
1316
- }), e.preventDefault());
1317
- }
1338
+ rt(e.currentTarget) && e.preventDefault();
1318
1339
  }
1319
1340
  function We(e) {
1320
1341
  let t = 0, n = 0;
1321
1342
  const o = {};
1322
- for (const r of e)
1323
- if (r.defaultSize !== void 0) {
1343
+ for (const s of e)
1344
+ if (s.defaultSize !== void 0) {
1324
1345
  t++;
1325
- const f = O(r.defaultSize);
1326
- n += f, o[r.panelId] = f;
1346
+ const u = T(s.defaultSize);
1347
+ n += u, o[s.panelId] = u;
1327
1348
  } else
1328
- o[r.panelId] = void 0;
1349
+ o[s.panelId] = void 0;
1329
1350
  const i = e.length - t;
1330
1351
  if (i !== 0) {
1331
- const r = O((100 - n) / i);
1332
- for (const f of e)
1333
- f.defaultSize === void 0 && (o[f.panelId] = r);
1352
+ const s = T((100 - n) / i);
1353
+ for (const u of e)
1354
+ u.defaultSize === void 0 && (o[u.panelId] = s);
1334
1355
  }
1335
1356
  return o;
1336
1357
  }
1337
- function _t(e, t, n) {
1358
+ function jt(e, t, n) {
1338
1359
  if (!n[0])
1339
1360
  return;
1340
1361
  const i = e.panels.find((l) => l.element === t);
1341
1362
  if (!i || !i.onResize)
1342
1363
  return;
1343
- const r = ne({ group: e }), f = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, a = i.mutableValues.prevSize, s = {
1344
- asPercentage: O(f / r * 100),
1345
- inPixels: f
1364
+ const s = ne({ group: e }), u = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, a = i.mutableValues.prevSize, r = {
1365
+ asPercentage: T(u / s * 100),
1366
+ inPixels: u
1346
1367
  };
1347
- i.mutableValues.prevSize = s, i.onResize(s, i.id, a);
1368
+ i.mutableValues.prevSize = r, i.onResize(r, i.id, a);
1348
1369
  }
1349
- function $t(e, t) {
1370
+ function Ht(e, t) {
1350
1371
  if (Object.keys(e).length !== Object.keys(t).length)
1351
1372
  return !1;
1352
1373
  for (const o in e)
@@ -1354,7 +1375,7 @@ function $t(e, t) {
1354
1375
  return !1;
1355
1376
  return !0;
1356
1377
  }
1357
- function jt({
1378
+ function Vt({
1358
1379
  group: e,
1359
1380
  nextGroupSize: t,
1360
1381
  prevGroupSize: n,
@@ -1362,48 +1383,48 @@ function jt({
1362
1383
  }) {
1363
1384
  if (n <= 0 || t <= 0 || n === t)
1364
1385
  return o;
1365
- let i = 0, r = 0, f = !1;
1366
- const a = /* @__PURE__ */ new Map(), s = [];
1367
- for (const h of e.panels) {
1368
- const d = o[h.id] ?? 0;
1369
- switch (h.panelConstraints.groupResizeBehavior) {
1386
+ let i = 0, s = 0, u = !1;
1387
+ const a = /* @__PURE__ */ new Map(), r = [];
1388
+ for (const m of e.panels) {
1389
+ const p = o[m.id] ?? 0;
1390
+ switch (m.panelConstraints.groupResizeBehavior) {
1370
1391
  case "preserve-pixel-size": {
1371
- f = !0;
1372
- const S = d / 100 * n, z = O(
1392
+ u = !0;
1393
+ const S = p / 100 * n, z = T(
1373
1394
  S / t * 100
1374
1395
  );
1375
- a.set(h.id, z), i += z;
1396
+ a.set(m.id, z), i += z;
1376
1397
  break;
1377
1398
  }
1378
1399
  case "preserve-relative-size":
1379
1400
  default: {
1380
- s.push(h.id), r += d;
1401
+ r.push(m.id), s += p;
1381
1402
  break;
1382
1403
  }
1383
1404
  }
1384
1405
  }
1385
- if (!f || s.length === 0)
1406
+ if (!u || r.length === 0)
1386
1407
  return o;
1387
- const l = 100 - i, u = { ...o };
1388
- if (a.forEach((h, d) => {
1389
- u[d] = h;
1390
- }), r > 0)
1391
- for (const h of s) {
1392
- const d = o[h] ?? 0;
1393
- u[h] = O(
1394
- d / r * l
1408
+ const l = 100 - i, c = { ...o };
1409
+ if (a.forEach((m, p) => {
1410
+ c[p] = m;
1411
+ }), s > 0)
1412
+ for (const m of r) {
1413
+ const p = o[m] ?? 0;
1414
+ c[m] = T(
1415
+ p / s * l
1395
1416
  );
1396
1417
  }
1397
1418
  else {
1398
- const h = O(
1399
- l / s.length
1419
+ const m = T(
1420
+ l / r.length
1400
1421
  );
1401
- for (const d of s)
1402
- u[d] = h;
1422
+ for (const p of r)
1423
+ c[p] = m;
1403
1424
  }
1404
- return u;
1425
+ return c;
1405
1426
  }
1406
- function Ht(e, t) {
1427
+ function Ut(e, t) {
1407
1428
  const n = e.map((i) => i.id), o = Object.keys(t);
1408
1429
  if (n.length !== o.length)
1409
1430
  return !1;
@@ -1413,108 +1434,112 @@ function Ht(e, t) {
1413
1434
  return !0;
1414
1435
  }
1415
1436
  const J = /* @__PURE__ */ new Map();
1416
- function Vt(e) {
1437
+ function Bt(e) {
1417
1438
  let t = !0;
1418
1439
  C(
1419
1440
  e.element.ownerDocument.defaultView,
1420
1441
  "Cannot register an unmounted Group"
1421
1442
  );
1422
- const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), r = new n((c) => {
1423
- for (const p of c) {
1424
- const { borderBoxSize: m, target: v } = p;
1425
- if (v === e.element) {
1443
+ const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = new n((f) => {
1444
+ for (const d of f) {
1445
+ const { borderBoxSize: h, target: y } = d;
1446
+ if (y === e.element) {
1426
1447
  if (t) {
1427
1448
  const b = ne({ group: e });
1428
1449
  if (b === 0)
1429
1450
  return;
1430
- const y = H(e.id);
1431
- if (!y)
1451
+ const v = H(e.id);
1452
+ if (!v)
1432
1453
  return;
1433
- const g = ve(e), P = y.defaultLayoutDeferred ? We(g) : y.layout, M = jt({
1454
+ const g = ve(e), w = v.defaultLayoutDeferred ? We(g) : v.layout, M = Vt({
1434
1455
  group: e,
1435
1456
  nextGroupSize: b,
1436
- prevGroupSize: y.groupSize,
1437
- prevLayout: P
1438
- }), w = U({
1457
+ prevGroupSize: v.groupSize,
1458
+ prevLayout: w
1459
+ }), L = K({
1439
1460
  layout: M,
1440
1461
  panelConstraints: g
1441
1462
  });
1442
- if (!y.defaultLayoutDeferred && W(y.layout, w) && $t(
1443
- y.derivedPanelConstraints,
1463
+ if (!v.defaultLayoutDeferred && W(v.layout, L) && Ht(
1464
+ v.derivedPanelConstraints,
1444
1465
  g
1445
- ) && y.groupSize === b)
1466
+ ) && v.groupSize === b)
1446
1467
  return;
1447
- $(e, {
1468
+ j(e, {
1448
1469
  defaultLayoutDeferred: !1,
1449
1470
  derivedPanelConstraints: g,
1450
1471
  groupSize: b,
1451
- layout: w,
1452
- separatorToPanels: y.separatorToPanels
1472
+ layout: L,
1473
+ separatorToPanels: v.separatorToPanels
1453
1474
  });
1454
1475
  }
1455
1476
  } else
1456
- _t(e, v, m);
1477
+ jt(e, y, h);
1457
1478
  }
1458
1479
  });
1459
- r.observe(e.element), e.panels.forEach((c) => {
1480
+ s.observe(e.element), e.panels.forEach((f) => {
1460
1481
  C(
1461
- !o.has(c.id),
1462
- `Panel ids must be unique; id "${c.id}" was used more than once`
1463
- ), o.add(c.id), c.onResize && r.observe(c.element);
1482
+ !o.has(f.id),
1483
+ `Panel ids must be unique; id "${f.id}" was used more than once`
1484
+ ), o.add(f.id), f.onResize && s.observe(f.element);
1464
1485
  });
1465
- const f = ne({ group: e }), a = ve(e), s = e.panels.map(({ id: c }) => c).join(",");
1486
+ const u = ne({ group: e }), a = ve(e), r = e.panels.map(({ id: f }) => f).join(",");
1466
1487
  let l = e.mutableState.defaultLayout;
1467
- l && (Ht(e.panels, l) || (l = void 0));
1468
- const u = e.mutableState.layouts[s] ?? l ?? We(a), h = U({
1469
- layout: u,
1488
+ l && (Ut(e.panels, l) || (l = void 0));
1489
+ const c = e.mutableState.layouts[r] ?? l ?? We(a), m = K({
1490
+ layout: c,
1470
1491
  panelConstraints: a
1471
- }), d = e.element.ownerDocument;
1492
+ }), p = e.element.ownerDocument;
1472
1493
  J.set(
1473
- d,
1474
- (J.get(d) ?? 0) + 1
1494
+ p,
1495
+ (J.get(p) ?? 0) + 1
1475
1496
  );
1476
1497
  const S = /* @__PURE__ */ new Map();
1477
- return Je(e).forEach((c) => {
1478
- c.separator && S.set(c.separator, c.panels);
1479
- }), $(e, {
1480
- defaultLayoutDeferred: f === 0,
1498
+ return Ze(e).forEach((f) => {
1499
+ f.separator && S.set(f.separator, f.panels);
1500
+ }), j(e, {
1501
+ defaultLayoutDeferred: u === 0,
1481
1502
  derivedPanelConstraints: a,
1482
- groupSize: f,
1483
- layout: h,
1503
+ groupSize: u,
1504
+ layout: m,
1484
1505
  separatorToPanels: S
1485
- }), e.separators.forEach((c) => {
1506
+ }), e.separators.forEach((f) => {
1486
1507
  C(
1487
- !i.has(c.id),
1488
- `Separator ids must be unique; id "${c.id}" was used more than once`
1489
- ), i.add(c.id), c.element.addEventListener("keydown", Ge);
1490
- }), J.get(d) === 1 && (d.addEventListener("dblclick", Te, !0), d.addEventListener("pointerdown", Ae, !0), d.addEventListener("pointerleave", je), d.addEventListener("pointermove", He), d.addEventListener("pointerout", Ve), d.addEventListener("pointerup", Be, !0)), function() {
1508
+ !i.has(f.id),
1509
+ `Separator ids must be unique; id "${f.id}" was used more than once`
1510
+ ), i.add(f.id), f.element.addEventListener("keydown", $e);
1511
+ }), J.get(p) === 1 && (p.addEventListener("contextmenu", Ge, !0), p.addEventListener("dblclick", _e, !0), p.addEventListener("pointerdown", je, !0), p.addEventListener("pointerleave", He), p.addEventListener("pointermove", Ve), p.addEventListener("pointerout", Ue), p.addEventListener("pointerup", Be, !0)), function() {
1491
1512
  t = !1, J.set(
1492
- d,
1493
- Math.max(0, (J.get(d) ?? 0) - 1)
1494
- ), Lt(e), e.separators.forEach((p) => {
1495
- p.element.removeEventListener("keydown", Ge);
1496
- }), J.get(d) || (d.removeEventListener(
1513
+ p,
1514
+ Math.max(0, (J.get(p) ?? 0) - 1)
1515
+ ), kt(e), e.separators.forEach((d) => {
1516
+ d.element.removeEventListener("keydown", $e);
1517
+ }), J.get(p) || (p.removeEventListener(
1518
+ "contextmenu",
1519
+ Ge,
1520
+ !0
1521
+ ), p.removeEventListener(
1497
1522
  "dblclick",
1498
- Te,
1523
+ _e,
1499
1524
  !0
1500
- ), d.removeEventListener(
1525
+ ), p.removeEventListener(
1501
1526
  "pointerdown",
1502
- Ae,
1527
+ je,
1503
1528
  !0
1504
- ), d.removeEventListener("pointerleave", je), d.removeEventListener("pointermove", He), d.removeEventListener("pointerout", Ve), d.removeEventListener("pointerup", Be, !0)), r.disconnect();
1529
+ ), p.removeEventListener("pointerleave", He), p.removeEventListener("pointermove", Ve), p.removeEventListener("pointerout", Ue), p.removeEventListener("pointerup", Be, !0)), s.disconnect();
1505
1530
  };
1506
1531
  }
1507
- function Bt() {
1532
+ function Wt() {
1508
1533
  const [e, t] = Q({}), n = re(() => t({}), []);
1509
1534
  return [e, n];
1510
1535
  }
1511
1536
  function Le(e) {
1512
- const t = pt();
1537
+ const t = mt();
1513
1538
  return `${e ?? t}`;
1514
1539
  }
1515
- const q = typeof window < "u" ? Ue : me;
1540
+ const q = typeof window < "u" ? Ke : me;
1516
1541
  function se(e) {
1517
- const t = T(e);
1542
+ const t = O(e);
1518
1543
  return q(() => {
1519
1544
  t.current = e;
1520
1545
  }, [e]), re(
@@ -1540,238 +1565,240 @@ function Ce(...e) {
1540
1565
  });
1541
1566
  }
1542
1567
  function Re(e) {
1543
- const t = T({ ...e });
1568
+ const t = O({ ...e });
1544
1569
  return q(() => {
1545
1570
  for (const n in e)
1546
1571
  t.current[n] = e[n];
1547
1572
  }, [e]), t.current;
1548
1573
  }
1549
- const lt = ht(null);
1550
- function Wt(e, t) {
1551
- const n = T({
1574
+ const ct = gt(null);
1575
+ function Kt(e, t) {
1576
+ const n = O({
1552
1577
  getLayout: () => ({}),
1553
- setLayout: Ft
1578
+ setLayout: Et
1554
1579
  });
1555
- Ke(t, () => n.current, []), q(() => {
1580
+ Xe(t, () => n.current, []), q(() => {
1556
1581
  Object.assign(
1557
1582
  n.current,
1558
- nt({ groupId: e })
1583
+ lt({ groupId: e })
1559
1584
  );
1560
1585
  });
1561
1586
  }
1562
- function Ut({
1587
+ function Xt({
1563
1588
  children: e,
1564
1589
  className: t,
1565
1590
  defaultLayout: n,
1566
1591
  disableCursor: o,
1567
1592
  disabled: i,
1568
- elementRef: r,
1569
- groupRef: f,
1593
+ elementRef: s,
1594
+ groupRef: u,
1570
1595
  id: a,
1571
- onLayoutChange: s,
1596
+ onLayoutChange: r,
1572
1597
  onLayoutChanged: l,
1573
- orientation: u = "horizontal",
1574
- resizeTargetMinimumSize: h = {
1598
+ orientation: c = "horizontal",
1599
+ resizeTargetMinimumSize: m = {
1575
1600
  coarse: 20,
1576
1601
  fine: 10
1577
1602
  },
1578
- style: d,
1603
+ style: p,
1579
1604
  ...S
1580
1605
  }) {
1581
- const z = T({
1606
+ const z = O({
1582
1607
  onLayoutChange: {},
1583
1608
  onLayoutChanged: {}
1584
- }), c = se((x) => {
1585
- W(z.current.onLayoutChange, x) || (z.current.onLayoutChange = x, s?.(x));
1586
- }), p = se((x) => {
1587
- W(z.current.onLayoutChanged, x) || (z.current.onLayoutChanged = x, l?.(x));
1588
- }), m = Le(a), v = T(null), [b, y] = Bt(), g = T({
1609
+ }), f = se((x) => {
1610
+ W(z.current.onLayoutChange, x) || (z.current.onLayoutChange = x, r?.(x));
1611
+ }), d = se(
1612
+ (x, P) => {
1613
+ W(z.current.onLayoutChanged, x) || (z.current.onLayoutChanged = x, l?.(x, { isUserInteraction: P }));
1614
+ }
1615
+ ), h = Le(a), y = O(null), [b, v] = Wt(), g = O({
1589
1616
  lastExpandedPanelSizes: {},
1590
1617
  layouts: {},
1591
1618
  panels: [],
1592
- resizeTargetMinimumSize: h,
1619
+ resizeTargetMinimumSize: m,
1593
1620
  separators: []
1594
- }), P = Ce(v, r);
1595
- Wt(m, f);
1621
+ }), w = Ce(y, s);
1622
+ Kt(h, u);
1596
1623
  const M = se(
1597
- (x, L) => {
1598
- const k = K(), R = ke(x), E = H(x);
1624
+ (x, P) => {
1625
+ const I = B(), R = Oe(x), E = H(x);
1599
1626
  if (E) {
1600
1627
  let D = !1;
1601
- switch (k.state) {
1628
+ switch (I.state) {
1602
1629
  case "active": {
1603
- D = k.hitRegions.some(
1630
+ D = I.hitRegions.some(
1604
1631
  (V) => V.group === R
1605
1632
  );
1606
1633
  break;
1607
1634
  }
1608
1635
  }
1609
1636
  return {
1610
- flexGrow: E.layout[L] ?? 1,
1637
+ flexGrow: E.layout[P] ?? 1,
1611
1638
  pointerEvents: D ? "none" : void 0
1612
1639
  };
1613
1640
  }
1614
- if (n?.[L])
1641
+ if (n?.[P])
1615
1642
  return {
1616
- flexGrow: n?.[L]
1643
+ flexGrow: n?.[P]
1617
1644
  };
1618
1645
  }
1619
- ), w = Re({
1646
+ ), L = Re({
1620
1647
  defaultLayout: n,
1621
1648
  disableCursor: o
1622
1649
  }), G = Se(
1623
1650
  () => ({
1624
1651
  get disableCursor() {
1625
- return !!w.disableCursor;
1652
+ return !!L.disableCursor;
1626
1653
  },
1627
1654
  getPanelStyles: M,
1628
- id: m,
1629
- orientation: u,
1655
+ id: h,
1656
+ orientation: c,
1630
1657
  registerPanel: (x) => {
1631
- const L = g.current;
1632
- return L.panels = be(u, [
1633
- ...L.panels,
1658
+ const P = g.current;
1659
+ return P.panels = be(c, [
1660
+ ...P.panels,
1634
1661
  x
1635
- ]), y(), () => {
1636
- L.panels = L.panels.filter(
1637
- (k) => k !== x
1638
- ), y();
1662
+ ]), v(), () => {
1663
+ P.panels = P.panels.filter(
1664
+ (I) => I !== x
1665
+ ), v();
1639
1666
  };
1640
1667
  },
1641
1668
  registerSeparator: (x) => {
1642
- const L = g.current;
1643
- return L.separators = be(u, [
1644
- ...L.separators,
1669
+ const P = g.current;
1670
+ return P.separators = be(c, [
1671
+ ...P.separators,
1645
1672
  x
1646
- ]), y(), () => {
1647
- L.separators = L.separators.filter(
1648
- (k) => k !== x
1649
- ), y();
1673
+ ]), v(), () => {
1674
+ P.separators = P.separators.filter(
1675
+ (I) => I !== x
1676
+ ), v();
1650
1677
  };
1651
1678
  },
1652
- updatePanelProps: (x, { disabled: L }) => {
1679
+ updatePanelProps: (x, { disabled: P }) => {
1653
1680
  const R = g.current.panels.find(
1654
1681
  (V) => V.id === x
1655
1682
  );
1656
- R && (R.panelConstraints.disabled = L);
1657
- const E = ke(m), D = H(m);
1658
- E && D && $(E, {
1683
+ R && (R.panelConstraints.disabled = P);
1684
+ const E = Oe(h), D = H(h);
1685
+ E && D && j(E, {
1659
1686
  ...D,
1660
1687
  derivedPanelConstraints: ve(E)
1661
1688
  });
1662
1689
  },
1663
1690
  updateSeparatorProps: (x, {
1664
- disabled: L,
1665
- disableDoubleClick: k
1691
+ disabled: P,
1692
+ disableDoubleClick: I
1666
1693
  }) => {
1667
1694
  const E = g.current.separators.find(
1668
1695
  (D) => D.id === x
1669
1696
  );
1670
- E && (E.disabled = L, E.disableDoubleClick = k);
1697
+ E && (E.disabled = P, E.disableDoubleClick = I);
1671
1698
  }
1672
1699
  }),
1673
- [M, m, y, u, w]
1674
- ), N = T(null);
1700
+ [M, h, v, c, L]
1701
+ ), N = O(null);
1675
1702
  return q(() => {
1676
- const x = v.current;
1703
+ const x = y.current;
1677
1704
  if (x === null)
1678
1705
  return;
1679
- const L = g.current;
1680
- let k;
1681
- if (w.defaultLayout !== void 0 && Object.keys(w.defaultLayout).length === L.panels.length) {
1682
- k = {};
1683
- for (const j of L.panels) {
1684
- const Y = w.defaultLayout[j.id];
1685
- Y !== void 0 && (k[j.id] = Y);
1706
+ const P = g.current;
1707
+ let I;
1708
+ if (L.defaultLayout !== void 0 && Object.keys(L.defaultLayout).length === P.panels.length) {
1709
+ I = {};
1710
+ for (const _ of P.panels) {
1711
+ const Y = L.defaultLayout[_.id];
1712
+ Y !== void 0 && (I[_.id] = Y);
1686
1713
  }
1687
1714
  }
1688
1715
  const R = {
1689
1716
  disabled: !!i,
1690
1717
  element: x,
1691
- id: m,
1718
+ id: h,
1692
1719
  mutableState: {
1693
- defaultLayout: k,
1694
- disableCursor: !!w.disableCursor,
1720
+ defaultLayout: I,
1721
+ disableCursor: !!L.disableCursor,
1695
1722
  expandedPanelSizes: g.current.lastExpandedPanelSizes,
1696
1723
  layouts: g.current.layouts
1697
1724
  },
1698
- orientation: u,
1699
- panels: L.panels,
1700
- resizeTargetMinimumSize: L.resizeTargetMinimumSize,
1701
- separators: L.separators
1725
+ orientation: c,
1726
+ panels: P.panels,
1727
+ resizeTargetMinimumSize: P.resizeTargetMinimumSize,
1728
+ separators: P.separators
1702
1729
  };
1703
1730
  N.current = R;
1704
- const E = Vt(R), { defaultLayoutDeferred: D, derivedPanelConstraints: V, layout: ue } = H(R.id, !0);
1705
- !D && V.length > 0 && (c(ue), p(ue));
1706
- const oe = ze(m, (j) => {
1707
- const { defaultLayoutDeferred: Y, derivedPanelConstraints: Ee, layout: ce } = j.next;
1731
+ const E = Bt(R), { defaultLayoutDeferred: D, derivedPanelConstraints: V, layout: ue } = H(R.id, !0);
1732
+ !D && V.length > 0 && (f(ue), d(ue, !1));
1733
+ const oe = Pe(h, (_) => {
1734
+ const { defaultLayoutDeferred: Y, derivedPanelConstraints: Ee, layout: ce } = _.next;
1708
1735
  if (Y || Ee.length === 0)
1709
1736
  return;
1710
- const ut = R.panels.map(({ id: _ }) => _).join(",");
1711
- R.mutableState.layouts[ut] = ce, Ee.forEach((_) => {
1712
- if (_.collapsible) {
1713
- const { layout: ge } = j.prev ?? {};
1737
+ const ft = R.panels.map(({ id: $ }) => $).join(",");
1738
+ R.mutableState.layouts[ft] = ce, Ee.forEach(($) => {
1739
+ if ($.collapsible) {
1740
+ const { layout: ge } = _.prev ?? {};
1714
1741
  if (ge) {
1715
- const ft = I(
1716
- _.collapsedSize,
1717
- ce[_.panelId]
1718
- ), dt = I(
1719
- _.collapsedSize,
1720
- ge[_.panelId]
1742
+ const pt = k(
1743
+ $.collapsedSize,
1744
+ ce[$.panelId]
1745
+ ), ht = k(
1746
+ $.collapsedSize,
1747
+ ge[$.panelId]
1721
1748
  );
1722
- ft && !dt && (R.mutableState.expandedPanelSizes[_.panelId] = ge[_.panelId]);
1749
+ pt && !ht && (R.mutableState.expandedPanelSizes[$.panelId] = ge[$.panelId]);
1723
1750
  }
1724
1751
  }
1725
1752
  });
1726
- const ct = K().state !== "active";
1727
- c(ce), ct && p(ce);
1753
+ const dt = B().state !== "active";
1754
+ f(ce), dt && d(ce, _.isUserInteraction);
1728
1755
  });
1729
1756
  return () => {
1730
1757
  N.current = null, E(), oe();
1731
1758
  };
1732
1759
  }, [
1733
1760
  i,
1734
- m,
1735
- p,
1761
+ h,
1762
+ d,
1763
+ f,
1736
1764
  c,
1737
- u,
1738
1765
  b,
1739
- w
1766
+ L
1740
1767
  ]), me(() => {
1741
1768
  const x = N.current;
1742
1769
  x && (x.mutableState.defaultLayout = n, x.mutableState.disableCursor = !!o);
1743
- }), /* @__PURE__ */ ae(lt.Provider, { value: G, children: /* @__PURE__ */ ae(
1770
+ }), /* @__PURE__ */ ae(ct.Provider, { value: G, children: /* @__PURE__ */ ae(
1744
1771
  "div",
1745
1772
  {
1746
1773
  ...S,
1747
1774
  className: t,
1748
1775
  "data-group": !0,
1749
- "data-testid": m,
1750
- id: m,
1751
- ref: P,
1776
+ "data-testid": h,
1777
+ id: h,
1778
+ ref: w,
1752
1779
  style: {
1753
1780
  height: "100%",
1754
1781
  width: "100%",
1755
1782
  overflow: "hidden",
1756
- ...d,
1783
+ ...p,
1757
1784
  display: "flex",
1758
- flexDirection: u === "horizontal" ? "row" : "column",
1785
+ flexDirection: c === "horizontal" ? "row" : "column",
1759
1786
  flexWrap: "nowrap",
1760
1787
  // Inform the browser that the library is handling touch events for this element
1761
1788
  // but still allow users to scroll content within panels in the non-resizing direction
1762
1789
  // NOTE This is not an inherited style
1763
1790
  // See github.com/bvaughn/react-resizable-panels/issues/662
1764
- touchAction: u === "horizontal" ? "pan-y" : "pan-x"
1791
+ touchAction: c === "horizontal" ? "pan-y" : "pan-x"
1765
1792
  },
1766
1793
  children: e
1767
1794
  }
1768
1795
  ) });
1769
1796
  }
1770
- Ut.displayName = "Group";
1797
+ Xt.displayName = "Group";
1771
1798
  function he(e, t) {
1772
1799
  return `react-resizable-panels:${[e, ...t].join(":")}`;
1773
1800
  }
1774
- function Kt({
1801
+ function qt({
1775
1802
  id: e,
1776
1803
  panelIds: t,
1777
1804
  storage: n
@@ -1779,25 +1806,25 @@ function Kt({
1779
1806
  const o = he(e, []), i = n.getItem(o);
1780
1807
  if (i)
1781
1808
  try {
1782
- const r = JSON.parse(i);
1809
+ const s = JSON.parse(i);
1783
1810
  if (t) {
1784
- const f = t.join(","), a = r[f];
1811
+ const u = t.join(","), a = s[u];
1785
1812
  if (a && Array.isArray(a.layout) && t.length === a.layout.length) {
1786
- const s = {};
1813
+ const r = {};
1787
1814
  for (let l = 0; l < t.length; l++)
1788
- s[t[l]] = a.layout[l];
1789
- return s;
1815
+ r[t[l]] = a.layout[l];
1816
+ return r;
1790
1817
  }
1791
1818
  } else {
1792
- const f = Object.keys(r);
1793
- if (f.length === 1) {
1794
- const a = r[f[0]];
1819
+ const u = Object.keys(s);
1820
+ if (u.length === 1) {
1821
+ const a = s[u[0]];
1795
1822
  if (a && Array.isArray(a.layout)) {
1796
- const s = f[0].split(",");
1797
- if (s.length === a.layout.length) {
1823
+ const r = u[0].split(",");
1824
+ if (r.length === a.layout.length) {
1798
1825
  const l = {};
1799
- for (let u = 0; u < s.length; u++)
1800
- l[s[u]] = a.layout[u];
1826
+ for (let c = 0; c < r.length; c++)
1827
+ l[r[c]] = a.layout[c];
1801
1828
  return l;
1802
1829
  }
1803
1830
  }
@@ -1806,92 +1833,106 @@ function Kt({
1806
1833
  } catch {
1807
1834
  }
1808
1835
  }
1809
- function on({
1836
+ function sn({
1810
1837
  debounceSaveMs: e = 100,
1811
- panelIds: t,
1812
- storage: n = localStorage,
1813
- ...o
1838
+ onlySaveAfterUserInteractions: t,
1839
+ panelIds: n,
1840
+ storage: o = localStorage,
1841
+ ...i
1814
1842
  }) {
1815
- const i = t !== void 0, r = "id" in o ? o.id : o.groupId, f = he(r, t ?? []), a = Xe(
1816
- Xt,
1817
- () => n.getItem(f),
1818
- () => n.getItem(f)
1819
- ), s = Se(() => {
1820
- if (a) {
1821
- const c = JSON.parse(a), p = Object.values(c);
1822
- if (Array.from(p).every((m) => typeof m == "number"))
1823
- return c;
1843
+ const s = n !== void 0, u = "id" in i ? i.id : i.groupId, a = he(u, n ?? []), r = qe(
1844
+ Yt,
1845
+ () => o.getItem(a),
1846
+ () => o.getItem(a)
1847
+ ), l = Se(() => {
1848
+ if (r) {
1849
+ const d = JSON.parse(r), h = Object.values(d);
1850
+ if (Array.from(h).every((y) => typeof y == "number"))
1851
+ return d;
1824
1852
  }
1825
- }, [a]), l = Se(() => {
1826
- if (!s)
1827
- return Kt({
1828
- id: r,
1829
- panelIds: t,
1830
- storage: n
1853
+ }, [r]), c = Se(() => {
1854
+ if (!l)
1855
+ return qt({
1856
+ id: u,
1857
+ panelIds: n,
1858
+ storage: o
1831
1859
  });
1832
- }, [s, r, t, n]), u = s ?? l, h = T(null), d = re(() => {
1833
- const c = h.current;
1834
- c && (h.current = null, clearTimeout(c));
1860
+ }, [l, u, n, o]), m = l ?? c, p = O(null), S = re(() => {
1861
+ const d = p.current;
1862
+ d && (p.current = null, clearTimeout(d));
1835
1863
  }, []);
1836
- Ue(() => () => {
1837
- d();
1838
- }, [d]);
1839
- const S = re(
1840
- (c) => {
1841
- d();
1842
- let p;
1843
- i ? p = he(r, Object.keys(c)) : p = he(r, []);
1864
+ Ke(() => () => {
1865
+ S();
1866
+ }, [S]);
1867
+ const z = re(
1868
+ // The hook persists every layout commit -- including library-driven ones --
1869
+ // because it owns its own storage and the goal is to remember whatever
1870
+ // layout the user is currently looking at. Consumers that only want to
1871
+ // persist on user interaction should branch on `isUserInteraction` in
1872
+ // their own callback (see #716) rather than via this hook.
1873
+ (d, h) => {
1874
+ if (t && !h.isUserInteraction)
1875
+ return;
1876
+ S();
1877
+ let y;
1878
+ s ? y = he(u, Object.keys(d)) : y = he(u, []);
1844
1879
  try {
1845
- n.setItem(p, JSON.stringify(c));
1846
- } catch (m) {
1847
- console.error(m);
1880
+ o.setItem(y, JSON.stringify(d));
1881
+ } catch (b) {
1882
+ console.error(b);
1848
1883
  }
1849
1884
  },
1850
- [d, i, r, n]
1851
- ), z = re(
1852
- (c) => {
1853
- d(), e === 0 ? S(c) : h.current = setTimeout(() => {
1854
- S(c);
1885
+ [
1886
+ S,
1887
+ s,
1888
+ u,
1889
+ t,
1890
+ o
1891
+ ]
1892
+ ), f = re(
1893
+ (d) => {
1894
+ S(), e === 0 ? z(d, { isUserInteraction: !1 }) : p.current = setTimeout(() => {
1895
+ z(d, { isUserInteraction: !1 });
1855
1896
  }, e);
1856
1897
  },
1857
- [d, e, S]
1898
+ [S, e, z]
1858
1899
  );
1859
1900
  return {
1860
1901
  /**
1861
1902
  * Pass this value to `Group` as the `defaultLayout` prop.
1862
1903
  */
1863
- defaultLayout: u,
1904
+ defaultLayout: m,
1864
1905
  /**
1865
1906
  * Attach this callback on the `Group` as the `onLayoutChange` prop.
1866
1907
  *
1867
1908
  * @deprecated Use the {@link onLayoutChanged} prop instead.
1868
1909
  */
1869
- onLayoutChange: z,
1910
+ onLayoutChange: f,
1870
1911
  /**
1871
1912
  * Attach this callback on the `Group` as the `onLayoutChanged` prop.
1872
1913
  */
1873
- onLayoutChanged: S
1914
+ onLayoutChanged: z
1874
1915
  };
1875
1916
  }
1876
- function Xt() {
1917
+ function Yt() {
1877
1918
  return function() {
1878
1919
  };
1879
1920
  }
1880
- function rn() {
1921
+ function an() {
1881
1922
  return Q(null);
1882
1923
  }
1883
- function sn() {
1884
- return T(null);
1924
+ function ln() {
1925
+ return O(null);
1885
1926
  }
1886
1927
  function Me() {
1887
- const e = mt(lt);
1928
+ const e = yt(ct);
1888
1929
  return C(
1889
1930
  e,
1890
1931
  "Group Context not found; did you render a Panel or Separator outside of a Group?"
1891
1932
  ), e;
1892
1933
  }
1893
- function qt(e, t) {
1894
- const { id: n } = Me(), o = T({
1934
+ function Jt(e, t) {
1935
+ const { id: n } = Me(), o = O({
1895
1936
  collapse: ye,
1896
1937
  expand: ye,
1897
1938
  getSize: () => ({
@@ -1901,50 +1942,50 @@ function qt(e, t) {
1901
1942
  isCollapsed: () => !1,
1902
1943
  resize: ye
1903
1944
  });
1904
- Ke(t, () => o.current, []), q(() => {
1945
+ Xe(t, () => o.current, []), q(() => {
1905
1946
  Object.assign(
1906
1947
  o.current,
1907
- tt({ groupId: n, panelId: e })
1948
+ at({ groupId: n, panelId: e })
1908
1949
  );
1909
1950
  });
1910
1951
  }
1911
- function Yt({
1952
+ function Zt({
1912
1953
  children: e,
1913
1954
  className: t,
1914
1955
  collapsedSize: n = "0%",
1915
1956
  collapsible: o = !1,
1916
1957
  defaultSize: i,
1917
- disabled: r,
1918
- elementRef: f,
1958
+ disabled: s,
1959
+ elementRef: u,
1919
1960
  groupResizeBehavior: a = "preserve-relative-size",
1920
- id: s,
1961
+ id: r,
1921
1962
  maxSize: l = "100%",
1922
- minSize: u = "0%",
1923
- onResize: h,
1924
- panelRef: d,
1963
+ minSize: c = "0%",
1964
+ onResize: m,
1965
+ panelRef: p,
1925
1966
  style: S,
1926
1967
  ...z
1927
1968
  }) {
1928
- const c = !!s, p = Le(s), m = Re({
1929
- disabled: r
1930
- }), v = T(null), b = Ce(v, f), {
1931
- getPanelStyles: y,
1969
+ const f = !!r, d = Le(r), h = Re({
1970
+ disabled: s
1971
+ }), y = O(null), b = Ce(y, u), {
1972
+ getPanelStyles: v,
1932
1973
  id: g,
1933
- orientation: P,
1974
+ orientation: w,
1934
1975
  registerPanel: M,
1935
- updatePanelProps: w
1936
- } = Me(), G = h !== null, N = se(
1976
+ updatePanelProps: L
1977
+ } = Me(), G = m !== null, N = se(
1937
1978
  (R, E, D) => {
1938
- h?.(R, s, D);
1979
+ m?.(R, r, D);
1939
1980
  }
1940
1981
  );
1941
1982
  q(() => {
1942
- const R = v.current;
1983
+ const R = y.current;
1943
1984
  if (R !== null) {
1944
1985
  const E = {
1945
1986
  element: R,
1946
- id: p,
1947
- idIsStable: c,
1987
+ id: d,
1988
+ idIsStable: f,
1948
1989
  mutableValues: {
1949
1990
  expandToSize: void 0,
1950
1991
  prevSize: void 0
@@ -1955,9 +1996,9 @@ function Yt({
1955
1996
  collapsedSize: n,
1956
1997
  collapsible: o,
1957
1998
  defaultSize: i,
1958
- disabled: m.disabled,
1999
+ disabled: h.disabled,
1959
2000
  maxSize: l,
1960
- minSize: u
2001
+ minSize: c
1961
2002
  }
1962
2003
  };
1963
2004
  return M(E);
@@ -1968,46 +2009,46 @@ function Yt({
1968
2009
  o,
1969
2010
  i,
1970
2011
  G,
1971
- p,
1972
- c,
2012
+ d,
2013
+ f,
1973
2014
  l,
1974
- u,
2015
+ c,
1975
2016
  N,
1976
2017
  M,
1977
- m
2018
+ h
1978
2019
  ]), me(() => {
1979
- w(p, { disabled: r });
1980
- }, [r, p, w]), qt(p, d);
2020
+ L(d, { disabled: s });
2021
+ }, [s, d, L]), Jt(d, p);
1981
2022
  const x = () => {
1982
- const R = y(g, p);
2023
+ const R = v(g, d);
1983
2024
  if (R)
1984
2025
  return JSON.stringify(R);
1985
- }, L = Xe(
1986
- (R) => ze(g, R),
2026
+ }, P = qe(
2027
+ (R) => Pe(g, R),
1987
2028
  x,
1988
2029
  x
1989
2030
  );
1990
- let k;
1991
- return L ? k = JSON.parse(L) : i !== void 0 ? k = {
2031
+ let I;
2032
+ return P ? I = JSON.parse(P) : i !== void 0 ? I = {
1992
2033
  flexGrow: void 0,
1993
2034
  flexShrink: void 0,
1994
2035
  flexBasis: i
1995
- } : k = { flexGrow: 1 }, /* @__PURE__ */ ae(
2036
+ } : I = { flexGrow: 1 }, /* @__PURE__ */ ae(
1996
2037
  "div",
1997
2038
  {
1998
2039
  ...z,
1999
- "data-disabled": r || void 0,
2040
+ "data-disabled": s || void 0,
2000
2041
  "data-panel": !0,
2001
- "data-testid": p,
2002
- id: p,
2042
+ "data-testid": d,
2043
+ id: d,
2003
2044
  ref: b,
2004
2045
  style: {
2005
- ...Jt,
2046
+ ...Qt,
2006
2047
  display: "flex",
2007
2048
  flexBasis: 0,
2008
2049
  flexShrink: 1,
2009
2050
  overflow: "visible",
2010
- ...k
2051
+ ...I
2011
2052
  },
2012
2053
  children: /* @__PURE__ */ ae(
2013
2054
  "div",
@@ -2023,7 +2064,7 @@ function Yt({
2023
2064
  // but still allow users to scroll content within panels in the non-resizing direction
2024
2065
  // NOTE This is not an inherited style
2025
2066
  // See github.com/bvaughn/react-resizable-panels/issues/662
2026
- touchAction: P === "horizontal" ? "pan-y" : "pan-x"
2067
+ touchAction: w === "horizontal" ? "pan-y" : "pan-x"
2027
2068
  },
2028
2069
  children: e
2029
2070
  }
@@ -2031,8 +2072,8 @@ function Yt({
2031
2072
  }
2032
2073
  );
2033
2074
  }
2034
- Yt.displayName = "Panel";
2035
- const Jt = {
2075
+ Zt.displayName = "Panel";
2076
+ const Qt = {
2036
2077
  minHeight: 0,
2037
2078
  maxHeight: "100%",
2038
2079
  height: "auto",
@@ -2044,39 +2085,39 @@ const Jt = {
2044
2085
  padding: 0,
2045
2086
  margin: 0
2046
2087
  };
2047
- function an() {
2088
+ function un() {
2048
2089
  return Q(null);
2049
2090
  }
2050
- function ln() {
2051
- return T(null);
2091
+ function cn() {
2092
+ return O(null);
2052
2093
  }
2053
- function Zt({
2094
+ function en({
2054
2095
  layout: e,
2055
2096
  panelConstraints: t,
2056
2097
  panelId: n,
2057
2098
  panelIndex: o
2058
2099
  }) {
2059
- let i, r;
2060
- const f = e[n], a = t.find(
2061
- (s) => s.panelId === n
2100
+ let i, s;
2101
+ const u = e[n], a = t.find(
2102
+ (r) => r.panelId === n
2062
2103
  );
2063
2104
  if (a) {
2064
- const s = a.maxSize, l = a.collapsible ? a.collapsedSize : a.minSize, u = [o, o + 1];
2065
- r = U({
2105
+ const r = a.maxSize, l = a.collapsible ? a.collapsedSize : a.minSize, c = [o, o + 1];
2106
+ s = K({
2066
2107
  layout: le({
2067
- delta: l - f,
2108
+ delta: l - u,
2068
2109
  initialLayout: e,
2069
2110
  panelConstraints: t,
2070
- pivotIndices: u,
2111
+ pivotIndices: c,
2071
2112
  prevLayout: e
2072
2113
  }),
2073
2114
  panelConstraints: t
2074
- })[n], i = U({
2115
+ })[n], i = K({
2075
2116
  layout: le({
2076
- delta: s - f,
2117
+ delta: r - u,
2077
2118
  initialLayout: e,
2078
2119
  panelConstraints: t,
2079
- pivotIndices: u,
2120
+ pivotIndices: c,
2080
2121
  prevLayout: e
2081
2122
  }),
2082
2123
  panelConstraints: t
@@ -2085,39 +2126,39 @@ function Zt({
2085
2126
  return {
2086
2127
  valueControls: n,
2087
2128
  valueMax: i,
2088
- valueMin: r,
2089
- valueNow: f
2129
+ valueMin: s,
2130
+ valueNow: u
2090
2131
  };
2091
2132
  }
2092
- function Qt({
2133
+ function tn({
2093
2134
  children: e,
2094
2135
  className: t,
2095
2136
  disabled: n,
2096
2137
  disableDoubleClick: o,
2097
2138
  elementRef: i,
2098
- id: r,
2099
- style: f,
2139
+ id: s,
2140
+ style: u,
2100
2141
  ...a
2101
2142
  }) {
2102
- const s = Le(r), l = Re({
2143
+ const r = Le(s), l = Re({
2103
2144
  disabled: n,
2104
2145
  disableDoubleClick: o
2105
- }), [u, h] = Q({}), [d, S] = Q("inactive"), [z, c] = Q(!1), p = T(null), m = Ce(p, i), {
2106
- disableCursor: v,
2146
+ }), [c, m] = Q({}), [p, S] = Q("inactive"), [z, f] = Q(!1), d = O(null), h = Ce(d, i), {
2147
+ disableCursor: y,
2107
2148
  id: b,
2108
- orientation: y,
2149
+ orientation: v,
2109
2150
  registerSeparator: g,
2110
- updateSeparatorProps: P
2111
- } = Me(), M = y === "horizontal" ? "vertical" : "horizontal";
2151
+ updateSeparatorProps: w
2152
+ } = Me(), M = v === "horizontal" ? "vertical" : "horizontal";
2112
2153
  q(() => {
2113
- const N = p.current;
2154
+ const N = d.current;
2114
2155
  if (N !== null) {
2115
2156
  const x = {
2116
2157
  disabled: l.disabled,
2117
2158
  disableDoubleClick: l.disableDoubleClick,
2118
2159
  element: N,
2119
- id: s
2120
- }, L = g(x), k = Gt(
2160
+ id: r
2161
+ }, P = g(x), I = Rt(
2121
2162
  (E) => {
2122
2163
  S(
2123
2164
  E.next.state !== "inactive" && E.next.hitRegions.some(
@@ -2125,17 +2166,17 @@ function Qt({
2125
2166
  ) ? E.next.state : "inactive"
2126
2167
  );
2127
2168
  }
2128
- ), R = ze(
2169
+ ), R = Pe(
2129
2170
  b,
2130
2171
  (E) => {
2131
2172
  const { derivedPanelConstraints: D, layout: V, separatorToPanels: ue } = E.next, oe = ue.get(x);
2132
2173
  if (oe) {
2133
- const j = oe[0], Y = oe.indexOf(j);
2134
- h(
2135
- Zt({
2174
+ const _ = oe[0], Y = oe.indexOf(_);
2175
+ m(
2176
+ en({
2136
2177
  layout: V,
2137
2178
  panelConstraints: D,
2138
- panelId: j.id,
2179
+ panelId: _.id,
2139
2180
  panelIndex: Y
2140
2181
  })
2141
2182
  );
@@ -2143,49 +2184,49 @@ function Qt({
2143
2184
  }
2144
2185
  );
2145
2186
  return () => {
2146
- k(), R(), L();
2187
+ I(), R(), P();
2147
2188
  };
2148
2189
  }
2149
- }, [b, s, g, l]), me(() => {
2150
- P(s, { disabled: n, disableDoubleClick: o });
2151
- }, [n, o, s, P]);
2152
- let w;
2153
- n && !v && (w = "not-allowed");
2190
+ }, [b, r, g, l]), me(() => {
2191
+ w(r, { disabled: n, disableDoubleClick: o });
2192
+ }, [n, o, r, w]);
2193
+ let L;
2194
+ n && !y && (L = "not-allowed");
2154
2195
  let G;
2155
2196
  if (n)
2156
2197
  G = "disabled";
2157
2198
  else
2158
- switch (d) {
2199
+ switch (p) {
2159
2200
  case "active": {
2160
2201
  G = "active";
2161
2202
  break;
2162
2203
  }
2163
2204
  default:
2164
- z ? G = "focus" : G = d;
2205
+ z ? G = "focus" : G = p;
2165
2206
  }
2166
2207
  return /* @__PURE__ */ ae(
2167
2208
  "div",
2168
2209
  {
2169
2210
  ...a,
2170
- "aria-controls": u.valueControls,
2211
+ "aria-controls": c.valueControls,
2171
2212
  "aria-disabled": n || void 0,
2172
2213
  "aria-orientation": M,
2173
- "aria-valuemax": u.valueMax,
2174
- "aria-valuemin": u.valueMin,
2175
- "aria-valuenow": u.valueNow,
2214
+ "aria-valuemax": c.valueMax,
2215
+ "aria-valuemin": c.valueMin,
2216
+ "aria-valuenow": c.valueNow,
2176
2217
  children: e,
2177
2218
  className: t,
2178
2219
  "data-separator": G,
2179
- "data-testid": s,
2180
- id: s,
2181
- onBlur: () => c(!1),
2182
- onFocus: () => c(!0),
2183
- ref: m,
2220
+ "data-testid": r,
2221
+ id: r,
2222
+ onBlur: () => f(!1),
2223
+ onFocus: () => f(!0),
2224
+ ref: h,
2184
2225
  role: "separator",
2185
2226
  style: {
2186
2227
  flexBasis: "auto",
2187
- cursor: w,
2188
- ...f,
2228
+ cursor: L,
2229
+ ...u,
2189
2230
  flexGrow: 0,
2190
2231
  flexShrink: 0,
2191
2232
  // Inform the browser that the library is handling touch events for this element
@@ -2196,16 +2237,16 @@ function Qt({
2196
2237
  }
2197
2238
  );
2198
2239
  }
2199
- Qt.displayName = "Separator";
2240
+ tn.displayName = "Separator";
2200
2241
  export {
2201
- Ut as Group,
2202
- Yt as Panel,
2203
- Qt as Separator,
2204
- wt as isCoarsePointer,
2205
- on as useDefaultLayout,
2206
- rn as useGroupCallbackRef,
2207
- sn as useGroupRef,
2208
- an as usePanelCallbackRef,
2209
- ln as usePanelRef
2242
+ Xt as Group,
2243
+ Zt as Panel,
2244
+ tn as Separator,
2245
+ Ct as isCoarsePointer,
2246
+ sn as useDefaultLayout,
2247
+ an as useGroupCallbackRef,
2248
+ ln as useGroupRef,
2249
+ un as usePanelCallbackRef,
2250
+ cn as usePanelRef
2210
2251
  };
2211
2252
  //# sourceMappingURL=react-resizable-panels.js.map