Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): preserve panel widths in layout-mismatch recovery (PRD-7589) (#3123)

Andrew Mikofalvy1b58cfb58fdb
diff --git a/.changeset/fix-resizable-panel-layout-crash.md b/.changeset/fix-resizable-panel-layout-crash.md
index 818ab8ef2..1dc8ef9fb 100644
--- a/.changeset/fix-resizable-panel-layout-crash.md
+++ b/.changeset/fix-resizable-panel-layout-crash.md
@@ -2,6 +2,6 @@
'@inkeep/open-knowledge': patch
---
-Fixed a crash that could take down the whole app window, replacing it with the error screen. It hit when the set of open side panels changed — switching between files, clicking a folder, closing the right chat panel, or collapsing the right side panes — and was most likely with the document panel collapsed and a right-hand column open. The layout engine ended up validating a saved multi-panel split against fewer panels than were on screen and threw `Invalid 2 panel layout: ...`.
+Fixed a crash that could take down the whole app window, replacing it with the error screen. It hit when the set of open side panels changed (switching between files, clicking a folder, closing the right chat panel, or collapsing the right side panes), and was most likely with the document panel collapsed and a right-hand column open. The layout engine ended up validating a saved multi-panel split against fewer panels than were on screen and threw `Invalid 2 panel layout: ...`.
-The underlying resizable-panels library is now patched to recover from that momentary mismatch — it re-derives a valid split for the panels that are actually present instead of throwing — so opening, closing, and switching panels no longer risks crashing the shell. In the rare case the mismatch occurs, the affected panel widths reset to an even split rather than being preserved.
+The underlying resizable-panels library is now patched to recover from that momentary mismatch, re-deriving a valid split for the panels that are actually present instead of throwing, so opening, closing, and switching panels no longer risks crashing the shell. The recovered layout keeps each panel at its intended width rather than snapping everything to an even split.
diff --git a/packages/app/src/components/resizable-panel-layout-mismatch.dom.test.tsx b/packages/app/src/components/resizable-panel-layout-mismatch.dom.test.tsx
index 8a0ed22b0..c4cd69220 100644
--- a/packages/app/src/components/resizable-panel-layout-mismatch.dom.test.tsx
+++ b/packages/app/src/components/resizable-panel-layout-mismatch.dom.test.tsx
@@ -2,18 +2,23 @@ import { act, cleanup, render } from '@testing-library/react';
import { Group, Panel, Separator, useGroupRef } from 'react-resizable-panels';
import { afterEach, describe, expect, test } from 'vitest';
-// Regression guard for the app-shell crash reported when a user closed the
-// right chat panel: react-resizable-panels' internal
-// `validatePanelGroupLayout` threw `Invalid <n> panel layout: ...` whenever a
-// layout's entry count did not match the number of currently-mounted panels.
-// The throw is reachable from the library's own ResizeObserver resize path and
-// its per-panel-set layout-cache restore during conditional rendering, so it
-// surfaced as an uncaught render-time error and tripped the app error boundary.
+// Regression guard for the app-shell crash reported when the set of open side
+// panels changed: react-resizable-panels' internal `validatePanelGroupLayout`
+// threw `Invalid <n> panel layout: ...` whenever a layout's entry count did not
+// match the number of currently-mounted panels. It throws during render, so it
+// tripped the app error boundary and took down the whole window.
//
// We patch the library (patches/[email protected]) so a
-// panel-count mismatch is recovered (an even default is rebuilt for the current
-// panels) instead of thrown. This test drives the real (patched) library
-// through the same `validatePanelGroupLayout` path that crashed.
+// panel-count mismatch rebuilds a valid layout for the panels actually present
+// instead of throwing.
+//
+// Scope note: this drives the validator through the imperative `setLayout`
+// path. The library reaches the same function from two other directions (its
+// ResizeObserver resize path and its per-panel-set layout-cache restore) that
+// are not directly exercised here — all three funnel through the one patched
+// function, but an upstream change that added a guard BEFORE it could
+// re-introduce the crash on those paths while this test stayed green. Worth
+// re-checking on the next dependency bump.
function withOffsetWidth(px: number, fn: () => Promise<void>) {
const proto = window.HTMLElement.prototype;
@@ -21,14 +26,20 @@ function withOffsetWidth(px: number, fn: () => Promise<void>) {
Object.defineProperty(proto, 'offsetWidth', { configurable: true, get: () => px });
const restore = () => {
if (original) Object.defineProperty(proto, 'offsetWidth', original);
- else delete (proto as unknown as Record<string, unknown>).offsetWidth;
+ else Reflect.deleteProperty(proto, 'offsetWidth');
};
return fn().finally(restore);
}
-afterEach(cleanup);
-
let capturedGroupRef: ReturnType<typeof useGroupRef> | null = null;
+
+afterEach(() => {
+ cleanup();
+ capturedGroupRef = null;
+});
+
+const DOC_PANEL_DEFAULT_PCT = 20;
+
function TwoPanelGroup() {
const groupRef = useGroupRef();
capturedGroupRef = groupRef;
@@ -36,7 +47,7 @@ function TwoPanelGroup() {
<Group orientation="horizontal" groupRef={groupRef} style={{ width: 900 }}>
<Panel minSize="10%">editor</Panel>
<Separator />
- <Panel id="doc" minSize="10%" defaultSize="20%">
+ <Panel id="doc" minSize="10%" defaultSize={`${DOC_PANEL_DEFAULT_PCT}%`}>
doc
</Panel>
</Group>
@@ -58,22 +69,37 @@ describe('react-resizable-panels layout-count mismatch is not fatal', () => {
expect(secondId).toBeDefined();
// A 3-entry layout (mirrors the reported "Invalid 2 panel layout:
- // 59.477%, 15.503%, 25.02%") — the crash the user hit when the right
- // panel unmounted mid-reconcile. Before the patch this threw synchronously
- // inside validatePanelGroupLayout.
+ // 59.477%, 15.503%, 25.02%") — the shape produced when a conditionally
+ // rendered panel unmounts and the group's layout cache serves the
+ // pre-unmount entry back. Before the patch this threw synchronously.
const staleThreePanelLayout: Record<string, number> = {
[firstId]: 59.477,
[secondId]: 15.503,
phantom: 25.02,
};
- expect(() => group.setLayout(staleThreePanelLayout)).not.toThrow();
+ await act(async () => {
+ expect(() => group.setLayout(staleThreePanelLayout)).not.toThrow();
+ });
- // The group recovers to a valid two-panel layout summing to ~100.
const recovered = group.getLayout();
- expect(Object.keys(recovered)).toHaveLength(2);
+
+ // Keyed by the panels that actually exist — asserting the id set, not
+ // just the count, so a recovery that carried the `phantom` key through
+ // (or invented ids) cannot pass.
+ expect(Object.keys(recovered).sort()).toEqual([firstId, secondId].sort());
+
const total = Object.values(recovered).reduce((sum, value) => sum + value, 0);
expect(total).toBeCloseTo(100, 1);
+
+ // Recovery honors each panel's declared `defaultSize` rather than
+ // flattening to an even split. This is the assertion that distinguishes
+ // reusing the library's own default-layout builder from a hand-rolled
+ // `100 / count` rebuild: the latter would hand both panels 50%, silently
+ // discarding widths the app restores from its width store.
+ const docId = secondId as string;
+ expect(recovered[docId]).toBeCloseTo(DOC_PANEL_DEFAULT_PCT, 1);
+ expect(recovered[firstId as string]).toBeCloseTo(100 - DOC_PANEL_DEFAULT_PCT, 1);
});
});
});
diff --git a/patches/[email protected] b/patches/[email protected]
index 68e082fb7..7f46ab0cb 100644
--- a/patches/[email protected]
+++ b/patches/[email protected]
@@ -1,16 +1,16 @@
diff --git a/dist/react-resizable-panels.cjs b/dist/react-resizable-panels.cjs
-index 2083424e74cbaf3a9eac40f4803aee8fc4a943c4..081bd56948300d6d8ce670139f49f2394806fe98 100644
+index 2083424e74cbaf3a9eac40f4803aee8fc4a943c4..df2b1a2509641955a2bac2fc35d5ded2c6bf1617 100644
--- a/dist/react-resizable-panels.cjs
+++ b/dist/react-resizable-panels.cjs
@@ -1,2 +1,2 @@
-"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("react/jsx-runtime"),z=require("react");function dt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function pt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function ht(e){return e/100*window.innerHeight}function mt(e){return e/100*window.innerWidth}function gt(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function oe({groupSize:e,panelElement:t,styleProp:n}){let o;const[i,s]=gt(n);switch(s){case"%":{o=i/100*e;break}case"px":{o=i;break}case"rem":{o=pt(t,i);break}case"em":{o=dt(t,i);break}case"vh":{o=ht(i);break}case"vw":{o=mt(i);break}}return o}function O(e){return parseFloat(e.toFixed(3))}function te({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,i)=>(o+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,o),0)}function me(e){const{panels:t}=e,n=te({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:i,panelConstraints:s}=o;let u=0;if(s.collapsedSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.collapsedSize});u=O(c/n*100)}let a;if(s.defaultSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=O(c/n*100)}let r=0;if(s.minSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.minSize});r=O(c/n*100)}let l=100;if(s.maxSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.maxSize});l=O(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:u,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:r,maxSize:l,panelId:o.id}})}function C(e,t="Assertion error"){if(!e)throw Error(t)}function ge(e,t){return Array.from(t).sort(e==="horizontal"?yt:St)}function yt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function St(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Ve(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ue(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const u of t){const{x:a,y:r}=Ue(o,u),l=e==="horizontal"?a:r;l<s&&(s=l,i=u)}return C(i,"No rect found"),i}let ue;function Be(){return ue===void 0&&(typeof matchMedia=="function"?ue=!!matchMedia("(pointer:coarse)").matches:ue=!1),ue}function We(e){const{element:t,orientation:n,panels:o,separators:i}=e,s=ge(n,Array.from(t.children).filter(Ve).map(x=>({element:x}))).map(({element:x})=>x),u=[];let a=!1,r=!1,l=-1,c=-1,m=0,p,S=[];{let x=-1;for(const f of s)f.hasAttribute("data-panel")&&(x++,f.hasAttribute("data-disabled")||(m++,l===-1&&(l=x),c=x))}if(m>1){let x=-1;for(const f of s)if(f.hasAttribute("data-panel")){x++;const d=o.find(h=>h.element===f);if(d){if(p){const h=p.element.getBoundingClientRect(),y=f.getBoundingClientRect();let b;if(r){const v=n==="horizontal"?new DOMRect(h.right,h.top,0,h.height):new DOMRect(h.left,h.bottom,h.width,0),g=n==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(S.length){case 0:{b=[v,g];break}case 1:{const L=S[0],M=vt({orientation:n,rects:[h,y],targetRect:L.element.getBoundingClientRect()});b=[L,M===h?g:v];break}default:{b=S;break}}}else S.length?b=S:b=[n==="horizontal"?new DOMRect(h.right,y.top,y.left-h.right,y.height):new DOMRect(y.left,h.bottom,y.width,y.top-h.bottom)];for(const v of b){let g="width"in v?v:v.element.getBoundingClientRect();const L=Be()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(g.width<L){const R=L-g.width;g=new DOMRect(g.x-R/2,g.y,g.width+R,g.height)}if(g.height<L){const R=L-g.height;g=new DOMRect(g.x,g.y-R/2,g.width,g.height+R)}const M=x<=l||x>c;!a&&!M&&u.push({group:e,groupSize:te({group:e}),panels:[p,d],separator:"width"in v?void 0:v,rect:g}),a=!1}}r=!1,p=d,S=[]}}else if(f.hasAttribute("data-separator")){f.ariaDisabled!==null&&(a=!0);const d=i.find(h=>h.element===f);d?S.push(d):(p=void 0,S=[])}else r=!0}return u}class Ke{#e={};addListener(t,n){const o=this.#e[t];return o===void 0?this.#e[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let i=!1,s=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const r=u[a];try{r.call(null,n)}catch(l){s===null&&(i=!0,s=l)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const i=o.indexOf(n);i>=0&&o.splice(i,1)}}}let Q={cursorFlags:0,state:"inactive"};const ye=new Ke;function B(){return Q}function bt(e){return ye.addListener("change",e)}function xt(e){const t=Q,n={...Q};n.cursorFlags=e,Q=n,ye.emit("change",{prev:t,next:n})}function ee(e){const t=Q;Q=e,ye.emit("change",{prev:t,next:e})}const zt=e=>e,he=()=>{},qe=1,Xe=2,Ye=4,Je=8,Re=3,Ce=12;let ce;function Ee(){return ce===void 0&&(ce=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ce=!0)),ce}function Pt({cursorFlags:e,groups:t,state:n}){let o=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{i++;break}}})}if(!(o===0&&i===0)){switch(n){case"active":{if(e&&Ee()){const s=(e&qe)!==0,u=(e&Xe)!==0,a=(e&Ye)!==0,r=(e&Je)!==0;if(s)return a?"se-resize":r?"ne-resize":"e-resize";if(u)return a?"sw-resize":r?"nw-resize":"w-resize";if(a)return"s-resize";if(r)return"n-resize"}break}}return Ee()?o>0&&i>0?"move":o>0?"ew-resize":"ns-resize":o>0&&i>0?"grab":o>0?"col-resize":"row-resize"}}const Me=new WeakMap;function Se(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Me.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=B();switch(o.state){case"active":case"hover":{const i=Pt({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Me.set(e,{prevStyle:t,styleSheet:n})}let F=new Map;const Ze=new Ke;function wt(e){F=new Map(F),F.delete(e)}function ke(e,t){for(const[n]of F)if(n.id===e)return n}function H(e,t){for(const[n,o]of F)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function q(){return F}function ve(e,t){return Ze.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function $(e,t,n){const o=F.get(e);F=new Map(F),F.set(e,t),Ze.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t})}function Qe(e){const t=B();let n=!1;switch(t.state){case"active":ee({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Se(e),n=!0,t.hitRegions.forEach(o=>{const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})}))}return n}function Ie(e){e.defaultPrevented||Qe(e.currentTarget)}function Lt(e,t,n){let o,i={x:1/0,y:1/0};for(const s of t){const u=Ue(n,s.rect);switch(e){case"horizontal":{u.x<=i.x&&(o=s,i=u);break}case"vertical":{u.y<=i.y&&(o=s,i=u);break}}}return o?{distance:i,hitRegion:o}:void 0}function Rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ct(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Oe(e),b:Oe(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();C(o,"Stacking order can only be calculated for elements with a common ancestor");const i={a:Te(De(n.a)),b:Te(De(n.b))};if(i.a===i.b){const s=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const r=s[a];if(r===u.a)return 1;if(r===u.b)return-1}}return Math.sign(i.a-i.b)}const Et=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mt(e){const t=getComputedStyle(et(e)??e).display;return t==="flex"||t==="inline-flex"}function kt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Mt(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")}function De(e){let t=e.length;for(;t--;){const n=e[t];if(C(n,"Missing node"),kt(n))return n}return null}function Te(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Oe(e){const t=[];for(;e;)t.push(e),e=et(e);return t}function et(e){const{parentNode:t}=e;return Rt(t)?t.host:t}function It(e,t){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}function Dt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Ve(n)||n.contains(e)||e.contains(n))return!0;if(Ct(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(It(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function be(e,t){const n=[];return t.forEach((o,i)=>{if(i.disabled)return;const s=We(i),u=Lt(i.orientation,s,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&Dt({groupElement:i.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function Tt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function D(e,t,n=0){return Math.abs(O(e)-O(t))<=n}function A(e,t){return D(e,t)?0:e>t?1:-1}function Z({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:i=0,collapsible:s,disabled:u,maxSize:a=100,minSize:r=0}=t;if(u&&!e)return n;if(A(o,r)<0)if(s){const l=(i+r)/2;A(o,l)<0?o=i:o=r}else o=r;return o=Math.min(a,o),o=O(o),o}function se({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:i,trigger:s}){if(D(e,0))return t;const u=s==="imperative-api",a=Object.values(t),r=Object.values(i),l=[...a],[c,m]=o;C(c!=null,"Invalid first pivot index"),C(m!=null,"Invalid second pivot index");let p=0;switch(s){case"keyboard":{{const f=e<0?m:c,d=n[f];C(d,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(C(v!=null,`Previous layout not found for panel index ${f}`),D(v,h)){const g=b-v;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}{const f=e<0?c:m,d=n[f];C(d,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(C(v!=null,`Previous layout not found for panel index ${f}`),D(v,b)){const g=v-h;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}break}default:{const f=e<0?m:c,d=n[f];C(d,`Panel constraints not found for index ${f}`);const h=a[f],{collapsible:y,collapsedSize:b,minSize:v}=d;if(y&&A(h,v)<0)if(e>0){const g=v-b,L=g/2,M=h+e;A(M,v)<0&&(e=A(e,L)<=0?0:g)}else{const g=v-b,L=100-g/2,M=h-e;A(M,v)<0&&(e=A(100+e,L)>0?0:-g)}break}}{const f=e<0?1:-1;let d=e<0?m:c,h=0;for(;;){const b=a[d];C(b!=null,`Previous layout not found for panel index ${d}`);const g=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:b,size:100})-b;if(h+=g,d+=f,d<0||d>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-y:y}{let d=e<0?c:m;for(;d>=0&&d<n.length;){const h=Math.abs(e)-Math.abs(p),y=a[d];C(y!=null,`Previous layout not found for panel index ${d}`);const b=y-h,v=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:y,size:b});if(!D(y,v)&&(p+=y-v,l[d]=v,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(Tt(r,l))return i;{const f=e<0?m:c,d=a[f];C(d!=null,`Previous layout not found for panel index ${f}`);const h=d+p,y=Z({overrideDisabledPanels:u,panelConstraints:n[f],prevSize:d,size:h});if(l[f]=y,!D(y,h)){let b=h-y,g=e<0?m:c;for(;g>=0&&g<n.length;){const L=l[g];C(L!=null,`Previous layout not found for panel index ${g}`);const M=L+b,R=Z({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:L,size:M});if(D(L,R)||(b-=R-L,l[g]=R),D(b,0))break;e>0?g--:g++}}}const S=Object.values(l).reduce((f,d)=>d+f,0);if(!D(S,100,.1))return i;const x=Object.keys(i);return l.reduce((f,d,h)=>(f[x[h]]=d,f),{})}function W(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||A(e[n],t[n])!==0)return!1;return!0}function K({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],i=o.reduce((a,r)=>a+r,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(a=>`${a}%`).join(", ")}`);if(!D(i,100)&&o.length>0)for(let a=0;a<t.length;a++){const r=o[a];C(r!=null,`No layout data found for index ${a}`);const l=100/i*r;o[a]=l}let s=0;for(let a=0;a<t.length;a++){const r=n[a];C(r!=null,`No layout data found for index ${a}`);const l=o[a];C(l!=null,`No layout data found for index ${a}`);const c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});l!=c&&(s+=l-c,o[a]=c)}if(!D(s,0))for(let a=0;a<t.length;a++){const r=o[a];C(r!=null,`No layout data found for index ${a}`);const l=r+s,c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});if(r!==c&&(s-=c-r,o[a]=c,D(s,0)))break}const u=Object.keys(e);return o.reduce((a,r,l)=>(a[u[l]]=r,a),{})}function tt({groupId:e,panelId:t}){const n=()=>{const r=q();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:m,layout:p,groupSize:S,separatorToPanels:x}]of r)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:l,groupSize:S,layout:p,separatorToPanels:x};throw Error(`Group ${e} not found`)},o=()=>{const r=n().derivedPanelConstraints.find(l=>l.panelId===t);if(r!==void 0)return r;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const r=n().group.panels.find(l=>l.id===t);if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const r=n().layout[t];if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:r,panels:l,prevLayout:c,derivedPanelConstraints:m})=>{const p=s(),S=l.findIndex(h=>h.id===t),x=S===0,f=S===l.length-1;if(f&&r<p&&(x||l.slice(0,S).every((h,y)=>{const b=m[y];return b?.collapsible&&D(b.collapsedSize,c[b.panelId])}))){const h=l.slice(0,S).reduce((y,b)=>y+c[b.id],0);return{...c,[t]:O(100-h)}}return se({delta:f?p-r:r-p,initialLayout:c,panelConstraints:m,pivotIndices:f?[S-1,S]:[S,S+1],prevLayout:c,trigger:"imperative-api"})},a=r=>{const l=s();if(r===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:p,groupSize:S,layout:x,separatorToPanels:f}=n(),d=u({nextSize:r,panels:p.panels,prevLayout:x,derivedPanelConstraints:m}),h=K({layout:d,panelConstraints:m});W(x,h)||$(p,{defaultLayoutDeferred:c,derivedPanelConstraints:m,groupSize:S,layout:h,separatorToPanels:f})};return{collapse:()=>{const{collapsible:r,collapsedSize:l}=o(),{mutableValues:c}=i(),m=s();r&&m!==l&&(c.expandToSize=m,a(l))},expand:()=>{const{collapsible:r,collapsedSize:l,minSize:c}=o(),{mutableValues:m}=i(),p=s();if(r&&p===l){let S=m.expandToSize??c;S===0&&(S=1),a(S)}},getSize:()=>{const{group:r}=n(),l=s(),{element:c}=i(),m=r.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:m}},isCollapsed:()=>{const{collapsible:r,collapsedSize:l}=o(),c=s();return r&&D(l,c)},resize:r=>{const{group:l}=n(),{element:c}=i(),m=te({group:l}),p=oe({groupSize:m,panelElement:c,styleProp:r}),S=O(p/m*100);a(S)}}}function Ge(e){if(e.defaultPrevented)return;const t=q();be(e,t).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const i=o.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(i){const s=i.panelConstraints.defaultSize,u=tt({groupId:o.group.id,panelId:i.id});u&&s!==void 0&&(u.resize(s),e.preventDefault())}}})}function fe(e){const t=q();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function nt({groupId:e}){const t=()=>{const n=q();for(const[o,i]of n)if(o.id===e)return{group:o,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:i,group:s,groupSize:u,layout:a,separatorToPanels:r}=t(),l=K({layout:n,panelConstraints:i});return o?a:(W(a,l)||$(s,{defaultLayoutDeferred:o,derivedPanelConstraints:i,groupSize:u,layout:l,separatorToPanels:r}),l)}}}function U(e,t){const n=fe(e),o=H(n.id,!0),i=n.separators.find(m=>m.element===e);C(i,"Matching separator not found");const s=o.separatorToPanels.get(i);C(s,"Matching panels not found");const u=s.map(m=>n.panels.indexOf(m)),r=nt({groupId:n.id}).getLayout(),l=se({delta:t,initialLayout:r,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:r,trigger:"keyboard"}),c=K({layout:l,panelConstraints:o.derivedPanelConstraints});W(r,c)||$(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:c,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ae(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=fe(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&U(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&U(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&U(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&U(t,-5);break}case"End":{e.preventDefault(),U(t,100);break}case"Enter":{e.preventDefault();const o=fe(t),i=H(o.id,!0),{derivedPanelConstraints:s,layout:u,separatorToPanels:a}=i,r=o.separators.find(p=>p.element===t);C(r,"Matching separator not found");const l=a.get(r);C(l,"Matching panels not found");const c=l[0],m=s.find(p=>p.panelId===c.id);if(C(m,"Panel metadata not found"),m.collapsible){const p=u[c.id],S=m.collapsedSize===p?o.mutableState.expandedPanelSizes[c.id]??m.minSize:m.collapsedSize;U(t,S-p)}break}case"F6":{e.preventDefault();const i=fe(t).separators.map(r=>r.element),s=Array.from(i).findIndex(r=>r===e.currentTarget);C(s!==null,"Index not found");const u=e.shiftKey?s>0?s-1:i.length-1:s+1<i.length?s+1:0;i[u].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),U(t,-100);break}}}function Fe(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=q(),n=be(e,t),o=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(s.group);u&&o.set(s.group,u.layout)}),ee({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function ot({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:u}){let a=0;n.forEach(l=>{const{group:c,groupSize:m}=l,{orientation:p,panels:S}=c,{disableCursor:x}=c.mutableState;let f=0;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;const d=o.get(c),h=i.get(c);if(!d||!h)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:g,separatorToPanels:L}=h;if(b&&g&&L){const M=se({delta:f,initialLayout:d,panelConstraints:b,pivotIndices:l.panels.map(R=>S.indexOf(R)),prevLayout:g,trigger:"mouse-or-touch"});if(W(M,g)){if(f!==0&&!x)switch(p){case"horizontal":{a|=f<0?qe:Xe;break}case"vertical":{a|=f<0?Ye:Je;break}}}else $(l.group,{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:M,separatorToPanels:L})}});let r=0;t.movementX===0?r|=u&Re:r|=a&Re,t.movementY===0?r|=u&Ce:r|=a&Ce,xt(r),Se(e)}function Ne(e){const t=q(),n=B();switch(n.state){case"active":ot({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function _e(e){if(e.defaultPrevented)return;const t=B(),n=q();switch(t.state){case"active":{if(e.buttons===0){ee({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:i}=o.separator;i.hasPointerCapture?.(e.pointerId)||i.setPointerCapture?.(e.pointerId)}ot({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=be(e,n);o.length===0?t.state!=="inactive"&&ee({cursorFlags:0,state:"inactive"}):ee({cursorFlags:0,hitRegions:o,state:"hover"}),Se(e.currentTarget);break}}}function je(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(B().state){case"hover":ee({cursorFlags:0,state:"inactive"})}}function $e(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;Qe(e.currentTarget)&&e.preventDefault()}function He(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const u=O(s.defaultSize);n+=u,o[s.panelId]=u}else o[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=O((100-n)/i);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=s)}return o}function Ot(e,t,n){if(!n[0])return;const i=e.panels.find(l=>l.element===t);if(!i||!i.onResize)return;const s=te({group:e}),u=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,a=i.mutableValues.prevSize,r={asPercentage:O(u/s*100),inPixels:u};i.mutableValues.prevSize=r,i.onResize(r,i.id,a)}function Gt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e)if(e[o]!==t[o])return!1;return!0}function At({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let i=0,s=0,u=!1;const a=new Map,r=[];for(const m of e.panels){const p=o[m.id]??0;switch(m.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const S=p/100*n,x=O(S/t*100);a.set(m.id,x),i+=x;break}case"preserve-relative-size":default:{r.push(m.id),s+=p;break}}}if(!u||r.length===0)return o;const l=100-i,c={...o};if(a.forEach((m,p)=>{c[p]=m}),s>0)for(const m of r){const p=o[m]??0;c[m]=O(p/s*l)}else{const m=O(l/r.length);for(const p of r)c[p]=m}return c}function Ft(e,t){const n=e.map(i=>i.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const i of n)if(!o.includes(i))return!1;return!0}const J=new Map;function Nt(e){let t=!0;C(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,i=new Set,s=new n(f=>{for(const d of f){const{borderBoxSize:h,target:y}=d;if(y===e.element){if(t){const b=te({group:e});if(b===0)return;const v=H(e.id);if(!v)return;const g=me(e),L=v.defaultLayoutDeferred?He(g):v.layout,M=At({group:e,nextGroupSize:b,prevGroupSize:v.groupSize,prevLayout:L}),R=K({layout:M,panelConstraints:g});if(!v.defaultLayoutDeferred&&W(v.layout,R)&&Gt(v.derivedPanelConstraints,g)&&v.groupSize===b)return;$(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:g,groupSize:b,layout:R,separatorToPanels:v.separatorToPanels})}}else Ot(e,y,h)}});s.observe(e.element),e.panels.forEach(f=>{C(!o.has(f.id),`Panel ids must be unique; id "${f.id}" was used more than once`),o.add(f.id),f.onResize&&s.observe(f.element)});const u=te({group:e}),a=me(e),r=e.panels.map(({id:f})=>f).join(",");let l=e.mutableState.defaultLayout;l&&(Ft(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[r]??l??He(a),m=K({layout:c,panelConstraints:a}),p=e.element.ownerDocument;J.set(p,(J.get(p)??0)+1);const S=new Map;return We(e).forEach(f=>{f.separator&&S.set(f.separator,f.panels)}),$(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:a,groupSize:u,layout:m,separatorToPanels:S}),e.separators.forEach(f=>{C(!i.has(f.id),`Separator ids must be unique; id "${f.id}" was used more than once`),i.add(f.id),f.element.addEventListener("keydown",Ae)}),J.get(p)===1&&(p.addEventListener("contextmenu",Ie,!0),p.addEventListener("dblclick",Ge,!0),p.addEventListener("pointerdown",Fe,!0),p.addEventListener("pointerleave",Ne),p.addEventListener("pointermove",_e),p.addEventListener("pointerout",je),p.addEventListener("pointerup",$e,!0)),function(){t=!1,J.set(p,Math.max(0,(J.get(p)??0)-1)),wt(e),e.separators.forEach(d=>{d.element.removeEventListener("keydown",Ae)}),J.get(p)||(p.removeEventListener("contextmenu",Ie,!0),p.removeEventListener("dblclick",Ge,!0),p.removeEventListener("pointerdown",Fe,!0),p.removeEventListener("pointerleave",Ne),p.removeEventListener("pointermove",_e),p.removeEventListener("pointerout",je),p.removeEventListener("pointerup",$e,!0)),s.disconnect()}}function _t(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function xe(e){const t=z.useId();return`${e??t}`}const X=typeof window<"u"?z.useLayoutEffect:z.useEffect;function ie(e){const t=z.useRef(e);return X(()=>{t.current=e},[e]),z.useCallback((...n)=>t.current?.(...n),[t])}function ze(...e){return ie(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Pe(e){const t=z.useRef({...e});return X(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const it=z.createContext(null);function jt(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:zt});z.useImperativeHandle(t,()=>n.current,[]),X(()=>{Object.assign(n.current,nt({groupId:e}))})}function rt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:i,elementRef:s,groupRef:u,id:a,onLayoutChange:r,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:m={coarse:20,fine:10},style:p,...S}){const x=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),f=ie(P=>{W(x.current.onLayoutChange,P)||(x.current.onLayoutChange=P,r?.(P))}),d=ie((P,w)=>{W(x.current.onLayoutChanged,P)||(x.current.onLayoutChanged=P,l?.(P,{isUserInteraction:w}))}),h=xe(a),y=z.useRef(null),[b,v]=_t(),g=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:m,separators:[]}),L=ze(y,s);jt(h,u);const M=ie((P,w)=>{const I=B(),E=ke(P),k=H(P);if(k){let T=!1;switch(I.state){case"active":{T=I.hitRegions.some(V=>V.group===E);break}}return{flexGrow:k.layout[w]??1,pointerEvents:T?"none":void 0}}if(n?.[w])return{flexGrow:n?.[w]}}),R=Pe({defaultLayout:n,disableCursor:o}),G=z.useMemo(()=>({get disableCursor(){return!!R.disableCursor},getPanelStyles:M,id:h,orientation:c,registerPanel:P=>{const w=g.current;return w.panels=ge(c,[...w.panels,P]),v(),()=>{w.panels=w.panels.filter(I=>I!==P),v()}},registerSeparator:P=>{const w=g.current;return w.separators=ge(c,[...w.separators,P]),v(),()=>{w.separators=w.separators.filter(I=>I!==P),v()}},updatePanelProps:(P,{disabled:w})=>{const E=g.current.panels.find(V=>V.id===P);E&&(E.panelConstraints.disabled=w);const k=ke(h),T=H(h);k&&T&&$(k,{...T,derivedPanelConstraints:me(k)})},updateSeparatorProps:(P,{disabled:w,disableDoubleClick:I})=>{const k=g.current.separators.find(T=>T.id===P);k&&(k.disabled=w,k.disableDoubleClick=I)}}),[M,h,v,c,R]),N=z.useRef(null);return X(()=>{const P=y.current;if(P===null)return;const w=g.current;let I;if(R.defaultLayout!==void 0&&Object.keys(R.defaultLayout).length===w.panels.length){I={};for(const _ of w.panels){const Y=R.defaultLayout[_.id];Y!==void 0&&(I[_.id]=Y)}}const E={disabled:!!i,element:P,id:h,mutableState:{defaultLayout:I,disableCursor:!!R.disableCursor,expandedPanelSizes:g.current.lastExpandedPanelSizes,layouts:g.current.layouts},orientation:c,panels:w.panels,resizeTargetMinimumSize:w.resizeTargetMinimumSize,separators:w.separators};N.current=E;const k=Nt(E),{defaultLayoutDeferred:T,derivedPanelConstraints:V,layout:ae}=H(E.id,!0);!T&&V.length>0&&(f(ae),d(ae,!1));const ne=ve(h,_=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:Le,layout:le}=_.next;if(Y||Le.length===0)return;const lt=E.panels.map(({id:j})=>j).join(",");E.mutableState.layouts[lt]=le,Le.forEach(j=>{if(j.collapsible){const{layout:pe}=_.prev??{};if(pe){const ct=D(j.collapsedSize,le[j.panelId]),ft=D(j.collapsedSize,pe[j.panelId]);ct&&!ft&&(E.mutableState.expandedPanelSizes[j.panelId]=pe[j.panelId])}}});const ut=B().state!=="active";f(le),ut&&d(le,_.isUserInteraction)});return()=>{N.current=null,k(),ne()}},[i,h,d,f,c,b,R]),z.useEffect(()=>{const P=N.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!o)}),re.jsx(it.Provider,{value:G,children:re.jsx("div",{...S,className:t,"data-group":!0,"data-testid":h,id:h,ref:L,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}rt.displayName="Group";function de(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function $t({id:e,panelIds:t,storage:n}){const o=de(e,[]),i=n.getItem(o);if(i)try{const s=JSON.parse(i);if(t){const u=t.join(","),a=s[u];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const r={};for(let l=0;l<t.length;l++)r[t[l]]=a.layout[l];return r}}else{const u=Object.keys(s);if(u.length===1){const a=s[u[0]];if(a&&Array.isArray(a.layout)){const r=u[0].split(",");if(r.length===a.layout.length){const l={};for(let c=0;c<r.length;c++)l[r[c]]=a.layout[c];return l}}}}}catch{}}function Ht({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...i}){const s=n!==void 0,u="id"in i?i.id:i.groupId,a=de(u,n??[]),r=z.useSyncExternalStore(Vt,()=>o.getItem(a),()=>o.getItem(a)),l=z.useMemo(()=>{if(r){const d=JSON.parse(r),h=Object.values(d);if(Array.from(h).every(y=>typeof y=="number"))return d}},[r]),c=z.useMemo(()=>{if(!l)return $t({id:u,panelIds:n,storage:o})},[l,u,n,o]),m=l??c,p=z.useRef(null),S=z.useCallback(()=>{const d=p.current;d&&(p.current=null,clearTimeout(d))},[]);z.useLayoutEffect(()=>()=>{S()},[S]);const x=z.useCallback((d,h)=>{if(t&&!h.isUserInteraction)return;S();let y;s?y=de(u,Object.keys(d)):y=de(u,[]);try{o.setItem(y,JSON.stringify(d))}catch(b){console.error(b)}},[S,s,u,t,o]),f=z.useCallback(d=>{S(),e===0?x(d,{isUserInteraction:!1}):p.current=setTimeout(()=>{x(d,{isUserInteraction:!1})},e)},[S,e,x]);return{defaultLayout:m,onLayoutChange:f,onLayoutChanged:x}}function Vt(){return function(){}}function Ut(){return z.useState(null)}function Bt(){return z.useRef(null)}function we(){const e=z.useContext(it);return C(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Wt(e,t){const{id:n}=we(),o=z.useRef({collapse:he,expand:he,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:he});z.useImperativeHandle(t,()=>o.current,[]),X(()=>{Object.assign(o.current,tt({groupId:n,panelId:e}))})}function st({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:i,disabled:s,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:r,maxSize:l="100%",minSize:c="0%",onResize:m,panelRef:p,style:S,...x}){const f=!!r,d=xe(r),h=Pe({disabled:s}),y=z.useRef(null),b=ze(y,u),{getPanelStyles:v,id:g,orientation:L,registerPanel:M,updatePanelProps:R}=we(),G=m!==null,N=ie((E,k,T)=>{m?.(E,r,T)});X(()=>{const E=y.current;if(E!==null){const k={element:E,id:d,idIsStable:f,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:G?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:i,disabled:h.disabled,maxSize:l,minSize:c}};return M(k)}},[a,n,o,i,G,d,f,l,c,N,M,h]),z.useEffect(()=>{R(d,{disabled:s})},[s,d,R]),Wt(d,p);const P=()=>{const E=v(g,d);if(E)return JSON.stringify(E)},w=z.useSyncExternalStore(E=>ve(g,E),P,P);let I;return w?I=JSON.parse(w):i!==void 0?I={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:I={flexGrow:1},re.jsx("div",{...x,"data-disabled":s||void 0,"data-panel":!0,"data-testid":d,id:d,ref:b,style:{...Kt,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:re.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:L==="horizontal"?"pan-y":"pan-x"},children:e})})}st.displayName="Panel";const Kt={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function qt(){return z.useState(null)}function Xt(){return z.useRef(null)}function Yt({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let i,s;const u=e[n],a=t.find(r=>r.panelId===n);if(a){const r=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];s=K({layout:se({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],i=K({layout:se({delta:r-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:u}}function at({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:i,id:s,style:u,...a}){const r=xe(s),l=Pe({disabled:n,disableDoubleClick:o}),[c,m]=z.useState({}),[p,S]=z.useState("inactive"),[x,f]=z.useState(!1),d=z.useRef(null),h=ze(d,i),{disableCursor:y,id:b,orientation:v,registerSeparator:g,updateSeparatorProps:L}=we(),M=v==="horizontal"?"vertical":"horizontal";X(()=>{const N=d.current;if(N!==null){const P={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:N,id:r},w=g(P),I=bt(k=>{S(k.next.state!=="inactive"&&k.next.hitRegions.some(T=>T.separator===P)?k.next.state:"inactive")}),E=ve(b,k=>{const{derivedPanelConstraints:T,layout:V,separatorToPanels:ae}=k.next,ne=ae.get(P);if(ne){const _=ne[0],Y=ne.indexOf(_);m(Yt({layout:V,panelConstraints:T,panelId:_.id,panelIndex:Y}))}});return()=>{I(),E(),w()}}},[b,r,g,l]),z.useEffect(()=>{L(r,{disabled:n,disableDoubleClick:o})},[n,o,r,L]);let R;n&&!y&&(R="not-allowed");let G;if(n)G="disabled";else switch(p){case"active":{G="active";break}default:x?G="focus":G=p}return re.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":M,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":G,"data-testid":r,id:r,onBlur:()=>f(!1),onFocus:()=>f(!0),ref:h,role:"separator",style:{flexBasis:"auto",cursor:R,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}at.displayName="Separator";exports.Group=rt;exports.Panel=st;exports.Separator=at;exports.isCoarsePointer=Be;exports.useDefaultLayout=Ht;exports.useGroupCallbackRef=Ut;exports.useGroupRef=Bt;exports.usePanelCallbackRef=qt;exports.usePanelRef=Xt;
-+"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("react/jsx-runtime"),z=require("react");function dt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function pt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function ht(e){return e/100*window.innerHeight}function mt(e){return e/100*window.innerWidth}function gt(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function oe({groupSize:e,panelElement:t,styleProp:n}){let o;const[i,s]=gt(n);switch(s){case"%":{o=i/100*e;break}case"px":{o=i;break}case"rem":{o=pt(t,i);break}case"em":{o=dt(t,i);break}case"vh":{o=ht(i);break}case"vw":{o=mt(i);break}}return o}function O(e){return parseFloat(e.toFixed(3))}function te({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,i)=>(o+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,o),0)}function me(e){const{panels:t}=e,n=te({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:i,panelConstraints:s}=o;let u=0;if(s.collapsedSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.collapsedSize});u=O(c/n*100)}let a;if(s.defaultSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=O(c/n*100)}let r=0;if(s.minSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.minSize});r=O(c/n*100)}let l=100;if(s.maxSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.maxSize});l=O(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:u,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:r,maxSize:l,panelId:o.id}})}function C(e,t="Assertion error"){if(!e)throw Error(t)}function ge(e,t){return Array.from(t).sort(e==="horizontal"?yt:St)}function yt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function St(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Ve(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ue(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const u of t){const{x:a,y:r}=Ue(o,u),l=e==="horizontal"?a:r;l<s&&(s=l,i=u)}return C(i,"No rect found"),i}let ue;function Be(){return ue===void 0&&(typeof matchMedia=="function"?ue=!!matchMedia("(pointer:coarse)").matches:ue=!1),ue}function We(e){const{element:t,orientation:n,panels:o,separators:i}=e,s=ge(n,Array.from(t.children).filter(Ve).map(x=>({element:x}))).map(({element:x})=>x),u=[];let a=!1,r=!1,l=-1,c=-1,m=0,p,S=[];{let x=-1;for(const f of s)f.hasAttribute("data-panel")&&(x++,f.hasAttribute("data-disabled")||(m++,l===-1&&(l=x),c=x))}if(m>1){let x=-1;for(const f of s)if(f.hasAttribute("data-panel")){x++;const d=o.find(h=>h.element===f);if(d){if(p){const h=p.element.getBoundingClientRect(),y=f.getBoundingClientRect();let b;if(r){const v=n==="horizontal"?new DOMRect(h.right,h.top,0,h.height):new DOMRect(h.left,h.bottom,h.width,0),g=n==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(S.length){case 0:{b=[v,g];break}case 1:{const L=S[0],M=vt({orientation:n,rects:[h,y],targetRect:L.element.getBoundingClientRect()});b=[L,M===h?g:v];break}default:{b=S;break}}}else S.length?b=S:b=[n==="horizontal"?new DOMRect(h.right,y.top,y.left-h.right,y.height):new DOMRect(y.left,h.bottom,y.width,y.top-h.bottom)];for(const v of b){let g="width"in v?v:v.element.getBoundingClientRect();const L=Be()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(g.width<L){const R=L-g.width;g=new DOMRect(g.x-R/2,g.y,g.width+R,g.height)}if(g.height<L){const R=L-g.height;g=new DOMRect(g.x,g.y-R/2,g.width,g.height+R)}const M=x<=l||x>c;!a&&!M&&u.push({group:e,groupSize:te({group:e}),panels:[p,d],separator:"width"in v?void 0:v,rect:g}),a=!1}}r=!1,p=d,S=[]}}else if(f.hasAttribute("data-separator")){f.ariaDisabled!==null&&(a=!0);const d=i.find(h=>h.element===f);d?S.push(d):(p=void 0,S=[])}else r=!0}return u}class Ke{#e={};addListener(t,n){const o=this.#e[t];return o===void 0?this.#e[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let i=!1,s=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const r=u[a];try{r.call(null,n)}catch(l){s===null&&(i=!0,s=l)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const i=o.indexOf(n);i>=0&&o.splice(i,1)}}}let Q={cursorFlags:0,state:"inactive"};const ye=new Ke;function B(){return Q}function bt(e){return ye.addListener("change",e)}function xt(e){const t=Q,n={...Q};n.cursorFlags=e,Q=n,ye.emit("change",{prev:t,next:n})}function ee(e){const t=Q;Q=e,ye.emit("change",{prev:t,next:e})}const zt=e=>e,he=()=>{},qe=1,Xe=2,Ye=4,Je=8,Re=3,Ce=12;let ce;function Ee(){return ce===void 0&&(ce=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ce=!0)),ce}function Pt({cursorFlags:e,groups:t,state:n}){let o=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{i++;break}}})}if(!(o===0&&i===0)){switch(n){case"active":{if(e&&Ee()){const s=(e&qe)!==0,u=(e&Xe)!==0,a=(e&Ye)!==0,r=(e&Je)!==0;if(s)return a?"se-resize":r?"ne-resize":"e-resize";if(u)return a?"sw-resize":r?"nw-resize":"w-resize";if(a)return"s-resize";if(r)return"n-resize"}break}}return Ee()?o>0&&i>0?"move":o>0?"ew-resize":"ns-resize":o>0&&i>0?"grab":o>0?"col-resize":"row-resize"}}const Me=new WeakMap;function Se(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Me.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=B();switch(o.state){case"active":case"hover":{const i=Pt({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Me.set(e,{prevStyle:t,styleSheet:n})}let F=new Map;const Ze=new Ke;function wt(e){F=new Map(F),F.delete(e)}function ke(e,t){for(const[n]of F)if(n.id===e)return n}function H(e,t){for(const[n,o]of F)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function q(){return F}function ve(e,t){return Ze.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function $(e,t,n){const o=F.get(e);F=new Map(F),F.set(e,t),Ze.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t})}function Qe(e){const t=B();let n=!1;switch(t.state){case"active":ee({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Se(e),n=!0,t.hitRegions.forEach(o=>{const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})}))}return n}function Ie(e){e.defaultPrevented||Qe(e.currentTarget)}function Lt(e,t,n){let o,i={x:1/0,y:1/0};for(const s of t){const u=Ue(n,s.rect);switch(e){case"horizontal":{u.x<=i.x&&(o=s,i=u);break}case"vertical":{u.y<=i.y&&(o=s,i=u);break}}}return o?{distance:i,hitRegion:o}:void 0}function Rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ct(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Oe(e),b:Oe(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();C(o,"Stacking order can only be calculated for elements with a common ancestor");const i={a:Te(De(n.a)),b:Te(De(n.b))};if(i.a===i.b){const s=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const r=s[a];if(r===u.a)return 1;if(r===u.b)return-1}}return Math.sign(i.a-i.b)}const Et=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mt(e){const t=getComputedStyle(et(e)??e).display;return t==="flex"||t==="inline-flex"}function kt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Mt(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")}function De(e){let t=e.length;for(;t--;){const n=e[t];if(C(n,"Missing node"),kt(n))return n}return null}function Te(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Oe(e){const t=[];for(;e;)t.push(e),e=et(e);return t}function et(e){const{parentNode:t}=e;return Rt(t)?t.host:t}function It(e,t){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}function Dt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Ve(n)||n.contains(e)||e.contains(n))return!0;if(Ct(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(It(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function be(e,t){const n=[];return t.forEach((o,i)=>{if(i.disabled)return;const s=We(i),u=Lt(i.orientation,s,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&Dt({groupElement:i.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function Tt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function D(e,t,n=0){return Math.abs(O(e)-O(t))<=n}function A(e,t){return D(e,t)?0:e>t?1:-1}function Z({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:i=0,collapsible:s,disabled:u,maxSize:a=100,minSize:r=0}=t;if(u&&!e)return n;if(A(o,r)<0)if(s){const l=(i+r)/2;A(o,l)<0?o=i:o=r}else o=r;return o=Math.min(a,o),o=O(o),o}function se({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:i,trigger:s}){if(D(e,0))return t;const u=s==="imperative-api",a=Object.values(t),r=Object.values(i),l=[...a],[c,m]=o;C(c!=null,"Invalid first pivot index"),C(m!=null,"Invalid second pivot index");let p=0;switch(s){case"keyboard":{{const f=e<0?m:c,d=n[f];C(d,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(C(v!=null,`Previous layout not found for panel index ${f}`),D(v,h)){const g=b-v;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}{const f=e<0?c:m,d=n[f];C(d,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(C(v!=null,`Previous layout not found for panel index ${f}`),D(v,b)){const g=v-h;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}break}default:{const f=e<0?m:c,d=n[f];C(d,`Panel constraints not found for index ${f}`);const h=a[f],{collapsible:y,collapsedSize:b,minSize:v}=d;if(y&&A(h,v)<0)if(e>0){const g=v-b,L=g/2,M=h+e;A(M,v)<0&&(e=A(e,L)<=0?0:g)}else{const g=v-b,L=100-g/2,M=h-e;A(M,v)<0&&(e=A(100+e,L)>0?0:-g)}break}}{const f=e<0?1:-1;let d=e<0?m:c,h=0;for(;;){const b=a[d];C(b!=null,`Previous layout not found for panel index ${d}`);const g=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:b,size:100})-b;if(h+=g,d+=f,d<0||d>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-y:y}{let d=e<0?c:m;for(;d>=0&&d<n.length;){const h=Math.abs(e)-Math.abs(p),y=a[d];C(y!=null,`Previous layout not found for panel index ${d}`);const b=y-h,v=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:y,size:b});if(!D(y,v)&&(p+=y-v,l[d]=v,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(Tt(r,l))return i;{const f=e<0?m:c,d=a[f];C(d!=null,`Previous layout not found for panel index ${f}`);const h=d+p,y=Z({overrideDisabledPanels:u,panelConstraints:n[f],prevSize:d,size:h});if(l[f]=y,!D(y,h)){let b=h-y,g=e<0?m:c;for(;g>=0&&g<n.length;){const L=l[g];C(L!=null,`Previous layout not found for panel index ${g}`);const M=L+b,R=Z({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:L,size:M});if(D(L,R)||(b-=R-L,l[g]=R),D(b,0))break;e>0?g--:g++}}}const S=Object.values(l).reduce((f,d)=>d+f,0);if(!D(S,100,.1))return i;const x=Object.keys(i);return l.reduce((f,d,h)=>(f[x[h]]=d,f),{})}function W(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||A(e[n],t[n])!==0)return!1;return!0}function K({layout:e,panelConstraints:t}){let n=Object.values(e),o=[...n];if(o.length!==t.length){e={};const $v=O(100/t.length);for(const $c of t)e[$c.panelId]=$v;n=Object.values(e);o=[...n]}const i=o.reduce((a,r)=>a+r,0);if(!D(i,100)&&o.length>0)for(let a=0;a<t.length;a++){const r=o[a];C(r!=null,`No layout data found for index ${a}`);const l=100/i*r;o[a]=l}let s=0;for(let a=0;a<t.length;a++){const r=n[a];C(r!=null,`No layout data found for index ${a}`);const l=o[a];C(l!=null,`No layout data found for index ${a}`);const c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});l!=c&&(s+=l-c,o[a]=c)}if(!D(s,0))for(let a=0;a<t.length;a++){const r=o[a];C(r!=null,`No layout data found for index ${a}`);const l=r+s,c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});if(r!==c&&(s-=c-r,o[a]=c,D(s,0)))break}const u=Object.keys(e);return o.reduce((a,r,l)=>(a[u[l]]=r,a),{})}function tt({groupId:e,panelId:t}){const n=()=>{const r=q();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:m,layout:p,groupSize:S,separatorToPanels:x}]of r)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:l,groupSize:S,layout:p,separatorToPanels:x};throw Error(`Group ${e} not found`)},o=()=>{const r=n().derivedPanelConstraints.find(l=>l.panelId===t);if(r!==void 0)return r;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const r=n().group.panels.find(l=>l.id===t);if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const r=n().layout[t];if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:r,panels:l,prevLayout:c,derivedPanelConstraints:m})=>{const p=s(),S=l.findIndex(h=>h.id===t),x=S===0,f=S===l.length-1;if(f&&r<p&&(x||l.slice(0,S).every((h,y)=>{const b=m[y];return b?.collapsible&&D(b.collapsedSize,c[b.panelId])}))){const h=l.slice(0,S).reduce((y,b)=>y+c[b.id],0);return{...c,[t]:O(100-h)}}return se({delta:f?p-r:r-p,initialLayout:c,panelConstraints:m,pivotIndices:f?[S-1,S]:[S,S+1],prevLayout:c,trigger:"imperative-api"})},a=r=>{const l=s();if(r===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:p,groupSize:S,layout:x,separatorToPanels:f}=n(),d=u({nextSize:r,panels:p.panels,prevLayout:x,derivedPanelConstraints:m}),h=K({layout:d,panelConstraints:m});W(x,h)||$(p,{defaultLayoutDeferred:c,derivedPanelConstraints:m,groupSize:S,layout:h,separatorToPanels:f})};return{collapse:()=>{const{collapsible:r,collapsedSize:l}=o(),{mutableValues:c}=i(),m=s();r&&m!==l&&(c.expandToSize=m,a(l))},expand:()=>{const{collapsible:r,collapsedSize:l,minSize:c}=o(),{mutableValues:m}=i(),p=s();if(r&&p===l){let S=m.expandToSize??c;S===0&&(S=1),a(S)}},getSize:()=>{const{group:r}=n(),l=s(),{element:c}=i(),m=r.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:m}},isCollapsed:()=>{const{collapsible:r,collapsedSize:l}=o(),c=s();return r&&D(l,c)},resize:r=>{const{group:l}=n(),{element:c}=i(),m=te({group:l}),p=oe({groupSize:m,panelElement:c,styleProp:r}),S=O(p/m*100);a(S)}}}function Ge(e){if(e.defaultPrevented)return;const t=q();be(e,t).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const i=o.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(i){const s=i.panelConstraints.defaultSize,u=tt({groupId:o.group.id,panelId:i.id});u&&s!==void 0&&(u.resize(s),e.preventDefault())}}})}function fe(e){const t=q();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function nt({groupId:e}){const t=()=>{const n=q();for(const[o,i]of n)if(o.id===e)return{group:o,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:i,group:s,groupSize:u,layout:a,separatorToPanels:r}=t(),l=K({layout:n,panelConstraints:i});return o?a:(W(a,l)||$(s,{defaultLayoutDeferred:o,derivedPanelConstraints:i,groupSize:u,layout:l,separatorToPanels:r}),l)}}}function U(e,t){const n=fe(e),o=H(n.id,!0),i=n.separators.find(m=>m.element===e);C(i,"Matching separator not found");const s=o.separatorToPanels.get(i);C(s,"Matching panels not found");const u=s.map(m=>n.panels.indexOf(m)),r=nt({groupId:n.id}).getLayout(),l=se({delta:t,initialLayout:r,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:r,trigger:"keyboard"}),c=K({layout:l,panelConstraints:o.derivedPanelConstraints});W(r,c)||$(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:c,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ae(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=fe(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&U(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&U(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&U(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&U(t,-5);break}case"End":{e.preventDefault(),U(t,100);break}case"Enter":{e.preventDefault();const o=fe(t),i=H(o.id,!0),{derivedPanelConstraints:s,layout:u,separatorToPanels:a}=i,r=o.separators.find(p=>p.element===t);C(r,"Matching separator not found");const l=a.get(r);C(l,"Matching panels not found");const c=l[0],m=s.find(p=>p.panelId===c.id);if(C(m,"Panel metadata not found"),m.collapsible){const p=u[c.id],S=m.collapsedSize===p?o.mutableState.expandedPanelSizes[c.id]??m.minSize:m.collapsedSize;U(t,S-p)}break}case"F6":{e.preventDefault();const i=fe(t).separators.map(r=>r.element),s=Array.from(i).findIndex(r=>r===e.currentTarget);C(s!==null,"Index not found");const u=e.shiftKey?s>0?s-1:i.length-1:s+1<i.length?s+1:0;i[u].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),U(t,-100);break}}}function Fe(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=q(),n=be(e,t),o=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(s.group);u&&o.set(s.group,u.layout)}),ee({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function ot({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:u}){let a=0;n.forEach(l=>{const{group:c,groupSize:m}=l,{orientation:p,panels:S}=c,{disableCursor:x}=c.mutableState;let f=0;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;const d=o.get(c),h=i.get(c);if(!d||!h)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:g,separatorToPanels:L}=h;if(b&&g&&L){const M=se({delta:f,initialLayout:d,panelConstraints:b,pivotIndices:l.panels.map(R=>S.indexOf(R)),prevLayout:g,trigger:"mouse-or-touch"});if(W(M,g)){if(f!==0&&!x)switch(p){case"horizontal":{a|=f<0?qe:Xe;break}case"vertical":{a|=f<0?Ye:Je;break}}}else $(l.group,{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:M,separatorToPanels:L})}});let r=0;t.movementX===0?r|=u&Re:r|=a&Re,t.movementY===0?r|=u&Ce:r|=a&Ce,xt(r),Se(e)}function Ne(e){const t=q(),n=B();switch(n.state){case"active":ot({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function _e(e){if(e.defaultPrevented)return;const t=B(),n=q();switch(t.state){case"active":{if(e.buttons===0){ee({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:i}=o.separator;i.hasPointerCapture?.(e.pointerId)||i.setPointerCapture?.(e.pointerId)}ot({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=be(e,n);o.length===0?t.state!=="inactive"&&ee({cursorFlags:0,state:"inactive"}):ee({cursorFlags:0,hitRegions:o,state:"hover"}),Se(e.currentTarget);break}}}function je(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(B().state){case"hover":ee({cursorFlags:0,state:"inactive"})}}function $e(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;Qe(e.currentTarget)&&e.preventDefault()}function He(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const u=O(s.defaultSize);n+=u,o[s.panelId]=u}else o[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=O((100-n)/i);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=s)}return o}function Ot(e,t,n){if(!n[0])return;const i=e.panels.find(l=>l.element===t);if(!i||!i.onResize)return;const s=te({group:e}),u=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,a=i.mutableValues.prevSize,r={asPercentage:O(u/s*100),inPixels:u};i.mutableValues.prevSize=r,i.onResize(r,i.id,a)}function Gt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e)if(e[o]!==t[o])return!1;return!0}function At({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let i=0,s=0,u=!1;const a=new Map,r=[];for(const m of e.panels){const p=o[m.id]??0;switch(m.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const S=p/100*n,x=O(S/t*100);a.set(m.id,x),i+=x;break}case"preserve-relative-size":default:{r.push(m.id),s+=p;break}}}if(!u||r.length===0)return o;const l=100-i,c={...o};if(a.forEach((m,p)=>{c[p]=m}),s>0)for(const m of r){const p=o[m]??0;c[m]=O(p/s*l)}else{const m=O(l/r.length);for(const p of r)c[p]=m}return c}function Ft(e,t){const n=e.map(i=>i.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const i of n)if(!o.includes(i))return!1;return!0}const J=new Map;function Nt(e){let t=!0;C(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,i=new Set,s=new n(f=>{for(const d of f){const{borderBoxSize:h,target:y}=d;if(y===e.element){if(t){const b=te({group:e});if(b===0)return;const v=H(e.id);if(!v)return;const g=me(e),L=v.defaultLayoutDeferred?He(g):v.layout,M=At({group:e,nextGroupSize:b,prevGroupSize:v.groupSize,prevLayout:L}),R=K({layout:M,panelConstraints:g});if(!v.defaultLayoutDeferred&&W(v.layout,R)&&Gt(v.derivedPanelConstraints,g)&&v.groupSize===b)return;$(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:g,groupSize:b,layout:R,separatorToPanels:v.separatorToPanels})}}else Ot(e,y,h)}});s.observe(e.element),e.panels.forEach(f=>{C(!o.has(f.id),`Panel ids must be unique; id "${f.id}" was used more than once`),o.add(f.id),f.onResize&&s.observe(f.element)});const u=te({group:e}),a=me(e),r=e.panels.map(({id:f})=>f).join(",");let l=e.mutableState.defaultLayout;l&&(Ft(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[r]??l??He(a),m=K({layout:c,panelConstraints:a}),p=e.element.ownerDocument;J.set(p,(J.get(p)??0)+1);const S=new Map;return We(e).forEach(f=>{f.separator&&S.set(f.separator,f.panels)}),$(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:a,groupSize:u,layout:m,separatorToPanels:S}),e.separators.forEach(f=>{C(!i.has(f.id),`Separator ids must be unique; id "${f.id}" was used more than once`),i.add(f.id),f.element.addEventListener("keydown",Ae)}),J.get(p)===1&&(p.addEventListener("contextmenu",Ie,!0),p.addEventListener("dblclick",Ge,!0),p.addEventListener("pointerdown",Fe,!0),p.addEventListener("pointerleave",Ne),p.addEventListener("pointermove",_e),p.addEventListener("pointerout",je),p.addEventListener("pointerup",$e,!0)),function(){t=!1,J.set(p,Math.max(0,(J.get(p)??0)-1)),wt(e),e.separators.forEach(d=>{d.element.removeEventListener("keydown",Ae)}),J.get(p)||(p.removeEventListener("contextmenu",Ie,!0),p.removeEventListener("dblclick",Ge,!0),p.removeEventListener("pointerdown",Fe,!0),p.removeEventListener("pointerleave",Ne),p.removeEventListener("pointermove",_e),p.removeEventListener("pointerout",je),p.removeEventListener("pointerup",$e,!0)),s.disconnect()}}function _t(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function xe(e){const t=z.useId();return`${e??t}`}const X=typeof window<"u"?z.useLayoutEffect:z.useEffect;function ie(e){const t=z.useRef(e);return X(()=>{t.current=e},[e]),z.useCallback((...n)=>t.current?.(...n),[t])}function ze(...e){return ie(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Pe(e){const t=z.useRef({...e});return X(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const it=z.createContext(null);function jt(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:zt});z.useImperativeHandle(t,()=>n.current,[]),X(()=>{Object.assign(n.current,nt({groupId:e}))})}function rt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:i,elementRef:s,groupRef:u,id:a,onLayoutChange:r,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:m={coarse:20,fine:10},style:p,...S}){const x=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),f=ie(P=>{W(x.current.onLayoutChange,P)||(x.current.onLayoutChange=P,r?.(P))}),d=ie((P,w)=>{W(x.current.onLayoutChanged,P)||(x.current.onLayoutChanged=P,l?.(P,{isUserInteraction:w}))}),h=xe(a),y=z.useRef(null),[b,v]=_t(),g=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:m,separators:[]}),L=ze(y,s);jt(h,u);const M=ie((P,w)=>{const I=B(),E=ke(P),k=H(P);if(k){let T=!1;switch(I.state){case"active":{T=I.hitRegions.some(V=>V.group===E);break}}return{flexGrow:k.layout[w]??1,pointerEvents:T?"none":void 0}}if(n?.[w])return{flexGrow:n?.[w]}}),R=Pe({defaultLayout:n,disableCursor:o}),G=z.useMemo(()=>({get disableCursor(){return!!R.disableCursor},getPanelStyles:M,id:h,orientation:c,registerPanel:P=>{const w=g.current;return w.panels=ge(c,[...w.panels,P]),v(),()=>{w.panels=w.panels.filter(I=>I!==P),v()}},registerSeparator:P=>{const w=g.current;return w.separators=ge(c,[...w.separators,P]),v(),()=>{w.separators=w.separators.filter(I=>I!==P),v()}},updatePanelProps:(P,{disabled:w})=>{const E=g.current.panels.find(V=>V.id===P);E&&(E.panelConstraints.disabled=w);const k=ke(h),T=H(h);k&&T&&$(k,{...T,derivedPanelConstraints:me(k)})},updateSeparatorProps:(P,{disabled:w,disableDoubleClick:I})=>{const k=g.current.separators.find(T=>T.id===P);k&&(k.disabled=w,k.disableDoubleClick=I)}}),[M,h,v,c,R]),N=z.useRef(null);return X(()=>{const P=y.current;if(P===null)return;const w=g.current;let I;if(R.defaultLayout!==void 0&&Object.keys(R.defaultLayout).length===w.panels.length){I={};for(const _ of w.panels){const Y=R.defaultLayout[_.id];Y!==void 0&&(I[_.id]=Y)}}const E={disabled:!!i,element:P,id:h,mutableState:{defaultLayout:I,disableCursor:!!R.disableCursor,expandedPanelSizes:g.current.lastExpandedPanelSizes,layouts:g.current.layouts},orientation:c,panels:w.panels,resizeTargetMinimumSize:w.resizeTargetMinimumSize,separators:w.separators};N.current=E;const k=Nt(E),{defaultLayoutDeferred:T,derivedPanelConstraints:V,layout:ae}=H(E.id,!0);!T&&V.length>0&&(f(ae),d(ae,!1));const ne=ve(h,_=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:Le,layout:le}=_.next;if(Y||Le.length===0)return;const lt=E.panels.map(({id:j})=>j).join(",");E.mutableState.layouts[lt]=le,Le.forEach(j=>{if(j.collapsible){const{layout:pe}=_.prev??{};if(pe){const ct=D(j.collapsedSize,le[j.panelId]),ft=D(j.collapsedSize,pe[j.panelId]);ct&&!ft&&(E.mutableState.expandedPanelSizes[j.panelId]=pe[j.panelId])}}});const ut=B().state!=="active";f(le),ut&&d(le,_.isUserInteraction)});return()=>{N.current=null,k(),ne()}},[i,h,d,f,c,b,R]),z.useEffect(()=>{const P=N.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!o)}),re.jsx(it.Provider,{value:G,children:re.jsx("div",{...S,className:t,"data-group":!0,"data-testid":h,id:h,ref:L,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}rt.displayName="Group";function de(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function $t({id:e,panelIds:t,storage:n}){const o=de(e,[]),i=n.getItem(o);if(i)try{const s=JSON.parse(i);if(t){const u=t.join(","),a=s[u];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const r={};for(let l=0;l<t.length;l++)r[t[l]]=a.layout[l];return r}}else{const u=Object.keys(s);if(u.length===1){const a=s[u[0]];if(a&&Array.isArray(a.layout)){const r=u[0].split(",");if(r.length===a.layout.length){const l={};for(let c=0;c<r.length;c++)l[r[c]]=a.layout[c];return l}}}}}catch{}}function Ht({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...i}){const s=n!==void 0,u="id"in i?i.id:i.groupId,a=de(u,n??[]),r=z.useSyncExternalStore(Vt,()=>o.getItem(a),()=>o.getItem(a)),l=z.useMemo(()=>{if(r){const d=JSON.parse(r),h=Object.values(d);if(Array.from(h).every(y=>typeof y=="number"))return d}},[r]),c=z.useMemo(()=>{if(!l)return $t({id:u,panelIds:n,storage:o})},[l,u,n,o]),m=l??c,p=z.useRef(null),S=z.useCallback(()=>{const d=p.current;d&&(p.current=null,clearTimeout(d))},[]);z.useLayoutEffect(()=>()=>{S()},[S]);const x=z.useCallback((d,h)=>{if(t&&!h.isUserInteraction)return;S();let y;s?y=de(u,Object.keys(d)):y=de(u,[]);try{o.setItem(y,JSON.stringify(d))}catch(b){console.error(b)}},[S,s,u,t,o]),f=z.useCallback(d=>{S(),e===0?x(d,{isUserInteraction:!1}):p.current=setTimeout(()=>{x(d,{isUserInteraction:!1})},e)},[S,e,x]);return{defaultLayout:m,onLayoutChange:f,onLayoutChanged:x}}function Vt(){return function(){}}function Ut(){return z.useState(null)}function Bt(){return z.useRef(null)}function we(){const e=z.useContext(it);return C(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Wt(e,t){const{id:n}=we(),o=z.useRef({collapse:he,expand:he,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:he});z.useImperativeHandle(t,()=>o.current,[]),X(()=>{Object.assign(o.current,tt({groupId:n,panelId:e}))})}function st({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:i,disabled:s,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:r,maxSize:l="100%",minSize:c="0%",onResize:m,panelRef:p,style:S,...x}){const f=!!r,d=xe(r),h=Pe({disabled:s}),y=z.useRef(null),b=ze(y,u),{getPanelStyles:v,id:g,orientation:L,registerPanel:M,updatePanelProps:R}=we(),G=m!==null,N=ie((E,k,T)=>{m?.(E,r,T)});X(()=>{const E=y.current;if(E!==null){const k={element:E,id:d,idIsStable:f,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:G?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:i,disabled:h.disabled,maxSize:l,minSize:c}};return M(k)}},[a,n,o,i,G,d,f,l,c,N,M,h]),z.useEffect(()=>{R(d,{disabled:s})},[s,d,R]),Wt(d,p);const P=()=>{const E=v(g,d);if(E)return JSON.stringify(E)},w=z.useSyncExternalStore(E=>ve(g,E),P,P);let I;return w?I=JSON.parse(w):i!==void 0?I={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:I={flexGrow:1},re.jsx("div",{...x,"data-disabled":s||void 0,"data-panel":!0,"data-testid":d,id:d,ref:b,style:{...Kt,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:re.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:L==="horizontal"?"pan-y":"pan-x"},children:e})})}st.displayName="Panel";const Kt={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function qt(){return z.useState(null)}function Xt(){return z.useRef(null)}function Yt({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let i,s;const u=e[n],a=t.find(r=>r.panelId===n);if(a){const r=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];s=K({layout:se({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],i=K({layout:se({delta:r-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:u}}function at({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:i,id:s,style:u,...a}){const r=xe(s),l=Pe({disabled:n,disableDoubleClick:o}),[c,m]=z.useState({}),[p,S]=z.useState("inactive"),[x,f]=z.useState(!1),d=z.useRef(null),h=ze(d,i),{disableCursor:y,id:b,orientation:v,registerSeparator:g,updateSeparatorProps:L}=we(),M=v==="horizontal"?"vertical":"horizontal";X(()=>{const N=d.current;if(N!==null){const P={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:N,id:r},w=g(P),I=bt(k=>{S(k.next.state!=="inactive"&&k.next.hitRegions.some(T=>T.separator===P)?k.next.state:"inactive")}),E=ve(b,k=>{const{derivedPanelConstraints:T,layout:V,separatorToPanels:ae}=k.next,ne=ae.get(P);if(ne){const _=ne[0],Y=ne.indexOf(_);m(Yt({layout:V,panelConstraints:T,panelId:_.id,panelIndex:Y}))}});return()=>{I(),E(),w()}}},[b,r,g,l]),z.useEffect(()=>{L(r,{disabled:n,disableDoubleClick:o})},[n,o,r,L]);let R;n&&!y&&(R="not-allowed");let G;if(n)G="disabled";else switch(p){case"active":{G="active";break}default:x?G="focus":G=p}return re.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":M,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":G,"data-testid":r,id:r,onBlur:()=>f(!1),onFocus:()=>f(!0),ref:h,role:"separator",style:{flexBasis:"auto",cursor:R,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}at.displayName="Separator";exports.Group=rt;exports.Panel=st;exports.Separator=at;exports.isCoarsePointer=Be;exports.useDefaultLayout=Ht;exports.useGroupCallbackRef=Ut;exports.useGroupRef=Bt;exports.usePanelCallbackRef=qt;exports.usePanelRef=Xt;
++"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("react/jsx-runtime"),z=require("react");function dt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function pt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function ht(e){return e/100*window.innerHeight}function mt(e){return e/100*window.innerWidth}function gt(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function oe({groupSize:e,panelElement:t,styleProp:n}){let o;const[i,s]=gt(n);switch(s){case"%":{o=i/100*e;break}case"px":{o=i;break}case"rem":{o=pt(t,i);break}case"em":{o=dt(t,i);break}case"vh":{o=ht(i);break}case"vw":{o=mt(i);break}}return o}function O(e){return parseFloat(e.toFixed(3))}function te({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,i)=>(o+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,o),0)}function me(e){const{panels:t}=e,n=te({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:i,panelConstraints:s}=o;let u=0;if(s.collapsedSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.collapsedSize});u=O(c/n*100)}let a;if(s.defaultSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=O(c/n*100)}let r=0;if(s.minSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.minSize});r=O(c/n*100)}let l=100;if(s.maxSize!==void 0){const c=oe({groupSize:n,panelElement:i,styleProp:s.maxSize});l=O(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:u,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:r,maxSize:l,panelId:o.id}})}function C(e,t="Assertion error"){if(!e)throw Error(t)}function ge(e,t){return Array.from(t).sort(e==="horizontal"?yt:St)}function yt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function St(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Ve(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ue(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const u of t){const{x:a,y:r}=Ue(o,u),l=e==="horizontal"?a:r;l<s&&(s=l,i=u)}return C(i,"No rect found"),i}let ue;function Be(){return ue===void 0&&(typeof matchMedia=="function"?ue=!!matchMedia("(pointer:coarse)").matches:ue=!1),ue}function We(e){const{element:t,orientation:n,panels:o,separators:i}=e,s=ge(n,Array.from(t.children).filter(Ve).map(x=>({element:x}))).map(({element:x})=>x),u=[];let a=!1,r=!1,l=-1,c=-1,m=0,p,S=[];{let x=-1;for(const f of s)f.hasAttribute("data-panel")&&(x++,f.hasAttribute("data-disabled")||(m++,l===-1&&(l=x),c=x))}if(m>1){let x=-1;for(const f of s)if(f.hasAttribute("data-panel")){x++;const d=o.find(h=>h.element===f);if(d){if(p){const h=p.element.getBoundingClientRect(),y=f.getBoundingClientRect();let b;if(r){const v=n==="horizontal"?new DOMRect(h.right,h.top,0,h.height):new DOMRect(h.left,h.bottom,h.width,0),g=n==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(S.length){case 0:{b=[v,g];break}case 1:{const L=S[0],M=vt({orientation:n,rects:[h,y],targetRect:L.element.getBoundingClientRect()});b=[L,M===h?g:v];break}default:{b=S;break}}}else S.length?b=S:b=[n==="horizontal"?new DOMRect(h.right,y.top,y.left-h.right,y.height):new DOMRect(y.left,h.bottom,y.width,y.top-h.bottom)];for(const v of b){let g="width"in v?v:v.element.getBoundingClientRect();const L=Be()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(g.width<L){const R=L-g.width;g=new DOMRect(g.x-R/2,g.y,g.width+R,g.height)}if(g.height<L){const R=L-g.height;g=new DOMRect(g.x,g.y-R/2,g.width,g.height+R)}const M=x<=l||x>c;!a&&!M&&u.push({group:e,groupSize:te({group:e}),panels:[p,d],separator:"width"in v?void 0:v,rect:g}),a=!1}}r=!1,p=d,S=[]}}else if(f.hasAttribute("data-separator")){f.ariaDisabled!==null&&(a=!0);const d=i.find(h=>h.element===f);d?S.push(d):(p=void 0,S=[])}else r=!0}return u}class Ke{#e={};addListener(t,n){const o=this.#e[t];return o===void 0?this.#e[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let i=!1,s=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const r=u[a];try{r.call(null,n)}catch(l){s===null&&(i=!0,s=l)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const i=o.indexOf(n);i>=0&&o.splice(i,1)}}}let Q={cursorFlags:0,state:"inactive"};const ye=new Ke;function B(){return Q}function bt(e){return ye.addListener("change",e)}function xt(e){const t=Q,n={...Q};n.cursorFlags=e,Q=n,ye.emit("change",{prev:t,next:n})}function ee(e){const t=Q;Q=e,ye.emit("change",{prev:t,next:e})}const zt=e=>e,he=()=>{},qe=1,Xe=2,Ye=4,Je=8,Re=3,Ce=12;let ce;function Ee(){return ce===void 0&&(ce=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ce=!0)),ce}function Pt({cursorFlags:e,groups:t,state:n}){let o=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{i++;break}}})}if(!(o===0&&i===0)){switch(n){case"active":{if(e&&Ee()){const s=(e&qe)!==0,u=(e&Xe)!==0,a=(e&Ye)!==0,r=(e&Je)!==0;if(s)return a?"se-resize":r?"ne-resize":"e-resize";if(u)return a?"sw-resize":r?"nw-resize":"w-resize";if(a)return"s-resize";if(r)return"n-resize"}break}}return Ee()?o>0&&i>0?"move":o>0?"ew-resize":"ns-resize":o>0&&i>0?"grab":o>0?"col-resize":"row-resize"}}const Me=new WeakMap;function Se(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Me.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=B();switch(o.state){case"active":case"hover":{const i=Pt({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Me.set(e,{prevStyle:t,styleSheet:n})}let F=new Map;const Ze=new Ke;function wt(e){F=new Map(F),F.delete(e)}function ke(e,t){for(const[n]of F)if(n.id===e)return n}function H(e,t){for(const[n,o]of F)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function q(){return F}function ve(e,t){return Ze.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function $(e,t,n){const o=F.get(e);F=new Map(F),F.set(e,t),Ze.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t})}function Qe(e){const t=B();let n=!1;switch(t.state){case"active":ee({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Se(e),n=!0,t.hitRegions.forEach(o=>{const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})}))}return n}function Ie(e){e.defaultPrevented||Qe(e.currentTarget)}function Lt(e,t,n){let o,i={x:1/0,y:1/0};for(const s of t){const u=Ue(n,s.rect);switch(e){case"horizontal":{u.x<=i.x&&(o=s,i=u);break}case"vertical":{u.y<=i.y&&(o=s,i=u);break}}}return o?{distance:i,hitRegion:o}:void 0}function Rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ct(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Oe(e),b:Oe(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();C(o,"Stacking order can only be calculated for elements with a common ancestor");const i={a:Te(De(n.a)),b:Te(De(n.b))};if(i.a===i.b){const s=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const r=s[a];if(r===u.a)return 1;if(r===u.b)return-1}}return Math.sign(i.a-i.b)}const Et=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mt(e){const t=getComputedStyle(et(e)??e).display;return t==="flex"||t==="inline-flex"}function kt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Mt(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")}function De(e){let t=e.length;for(;t--;){const n=e[t];if(C(n,"Missing node"),kt(n))return n}return null}function Te(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Oe(e){const t=[];for(;e;)t.push(e),e=et(e);return t}function et(e){const{parentNode:t}=e;return Rt(t)?t.host:t}function It(e,t){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}function Dt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Ve(n)||n.contains(e)||e.contains(n))return!0;if(Ct(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(It(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function be(e,t){const n=[];return t.forEach((o,i)=>{if(i.disabled)return;const s=We(i),u=Lt(i.orientation,s,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&Dt({groupElement:i.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function Tt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function D(e,t,n=0){return Math.abs(O(e)-O(t))<=n}function A(e,t){return D(e,t)?0:e>t?1:-1}function Z({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:i=0,collapsible:s,disabled:u,maxSize:a=100,minSize:r=0}=t;if(u&&!e)return n;if(A(o,r)<0)if(s){const l=(i+r)/2;A(o,l)<0?o=i:o=r}else o=r;return o=Math.min(a,o),o=O(o),o}function se({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:i,trigger:s}){if(D(e,0))return t;const u=s==="imperative-api",a=Object.values(t),r=Object.values(i),l=[...a],[c,m]=o;C(c!=null,"Invalid first pivot index"),C(m!=null,"Invalid second pivot index");let p=0;switch(s){case"keyboard":{{const f=e<0?m:c,d=n[f];C(d,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(C(v!=null,`Previous layout not found for panel index ${f}`),D(v,h)){const g=b-v;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}{const f=e<0?c:m,d=n[f];C(d,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(C(v!=null,`Previous layout not found for panel index ${f}`),D(v,b)){const g=v-h;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}break}default:{const f=e<0?m:c,d=n[f];C(d,`Panel constraints not found for index ${f}`);const h=a[f],{collapsible:y,collapsedSize:b,minSize:v}=d;if(y&&A(h,v)<0)if(e>0){const g=v-b,L=g/2,M=h+e;A(M,v)<0&&(e=A(e,L)<=0?0:g)}else{const g=v-b,L=100-g/2,M=h-e;A(M,v)<0&&(e=A(100+e,L)>0?0:-g)}break}}{const f=e<0?1:-1;let d=e<0?m:c,h=0;for(;;){const b=a[d];C(b!=null,`Previous layout not found for panel index ${d}`);const g=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:b,size:100})-b;if(h+=g,d+=f,d<0||d>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-y:y}{let d=e<0?c:m;for(;d>=0&&d<n.length;){const h=Math.abs(e)-Math.abs(p),y=a[d];C(y!=null,`Previous layout not found for panel index ${d}`);const b=y-h,v=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:y,size:b});if(!D(y,v)&&(p+=y-v,l[d]=v,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(Tt(r,l))return i;{const f=e<0?m:c,d=a[f];C(d!=null,`Previous layout not found for panel index ${f}`);const h=d+p,y=Z({overrideDisabledPanels:u,panelConstraints:n[f],prevSize:d,size:h});if(l[f]=y,!D(y,h)){let b=h-y,g=e<0?m:c;for(;g>=0&&g<n.length;){const L=l[g];C(L!=null,`Previous layout not found for panel index ${g}`);const M=L+b,R=Z({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:L,size:M});if(D(L,R)||(b-=R-L,l[g]=R),D(b,0))break;e>0?g--:g++}}}const S=Object.values(l).reduce((f,d)=>d+f,0);if(!D(S,100,.1))return i;const x=Object.keys(i);return l.reduce((f,d,h)=>(f[x[h]]=d,f),{})}function W(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||A(e[n],t[n])!==0)return!1;return!0}function K({layout:e,panelConstraints:t}){let n=Object.values(e),o=[...n];if(o.length!==t.length){e=He(t);n=Object.values(e);o=[...n]}const i=o.reduce((a,r)=>a+r,0);if(!D(i,100)&&o.length>0)for(let a=0;a<t.length;a++){const r=o[a];C(r!=null,`No layout data found for index ${a}`);const l=100/i*r;o[a]=l}let s=0;for(let a=0;a<t.length;a++){const r=n[a];C(r!=null,`No layout data found for index ${a}`);const l=o[a];C(l!=null,`No layout data found for index ${a}`);const c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});l!=c&&(s+=l-c,o[a]=c)}if(!D(s,0))for(let a=0;a<t.length;a++){const r=o[a];C(r!=null,`No layout data found for index ${a}`);const l=r+s,c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});if(r!==c&&(s-=c-r,o[a]=c,D(s,0)))break}const u=Object.keys(e);return o.reduce((a,r,l)=>(a[u[l]]=r,a),{})}function tt({groupId:e,panelId:t}){const n=()=>{const r=q();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:m,layout:p,groupSize:S,separatorToPanels:x}]of r)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:l,groupSize:S,layout:p,separatorToPanels:x};throw Error(`Group ${e} not found`)},o=()=>{const r=n().derivedPanelConstraints.find(l=>l.panelId===t);if(r!==void 0)return r;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const r=n().group.panels.find(l=>l.id===t);if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const r=n().layout[t];if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:r,panels:l,prevLayout:c,derivedPanelConstraints:m})=>{const p=s(),S=l.findIndex(h=>h.id===t),x=S===0,f=S===l.length-1;if(f&&r<p&&(x||l.slice(0,S).every((h,y)=>{const b=m[y];return b?.collapsible&&D(b.collapsedSize,c[b.panelId])}))){const h=l.slice(0,S).reduce((y,b)=>y+c[b.id],0);return{...c,[t]:O(100-h)}}return se({delta:f?p-r:r-p,initialLayout:c,panelConstraints:m,pivotIndices:f?[S-1,S]:[S,S+1],prevLayout:c,trigger:"imperative-api"})},a=r=>{const l=s();if(r===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:p,groupSize:S,layout:x,separatorToPanels:f}=n(),d=u({nextSize:r,panels:p.panels,prevLayout:x,derivedPanelConstraints:m}),h=K({layout:d,panelConstraints:m});W(x,h)||$(p,{defaultLayoutDeferred:c,derivedPanelConstraints:m,groupSize:S,layout:h,separatorToPanels:f})};return{collapse:()=>{const{collapsible:r,collapsedSize:l}=o(),{mutableValues:c}=i(),m=s();r&&m!==l&&(c.expandToSize=m,a(l))},expand:()=>{const{collapsible:r,collapsedSize:l,minSize:c}=o(),{mutableValues:m}=i(),p=s();if(r&&p===l){let S=m.expandToSize??c;S===0&&(S=1),a(S)}},getSize:()=>{const{group:r}=n(),l=s(),{element:c}=i(),m=r.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:m}},isCollapsed:()=>{const{collapsible:r,collapsedSize:l}=o(),c=s();return r&&D(l,c)},resize:r=>{const{group:l}=n(),{element:c}=i(),m=te({group:l}),p=oe({groupSize:m,panelElement:c,styleProp:r}),S=O(p/m*100);a(S)}}}function Ge(e){if(e.defaultPrevented)return;const t=q();be(e,t).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const i=o.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(i){const s=i.panelConstraints.defaultSize,u=tt({groupId:o.group.id,panelId:i.id});u&&s!==void 0&&(u.resize(s),e.preventDefault())}}})}function fe(e){const t=q();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function nt({groupId:e}){const t=()=>{const n=q();for(const[o,i]of n)if(o.id===e)return{group:o,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:i,group:s,groupSize:u,layout:a,separatorToPanels:r}=t(),l=K({layout:n,panelConstraints:i});return o?a:(W(a,l)||$(s,{defaultLayoutDeferred:o,derivedPanelConstraints:i,groupSize:u,layout:l,separatorToPanels:r}),l)}}}function U(e,t){const n=fe(e),o=H(n.id,!0),i=n.separators.find(m=>m.element===e);C(i,"Matching separator not found");const s=o.separatorToPanels.get(i);C(s,"Matching panels not found");const u=s.map(m=>n.panels.indexOf(m)),r=nt({groupId:n.id}).getLayout(),l=se({delta:t,initialLayout:r,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:r,trigger:"keyboard"}),c=K({layout:l,panelConstraints:o.derivedPanelConstraints});W(r,c)||$(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:c,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ae(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=fe(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&U(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&U(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&U(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&U(t,-5);break}case"End":{e.preventDefault(),U(t,100);break}case"Enter":{e.preventDefault();const o=fe(t),i=H(o.id,!0),{derivedPanelConstraints:s,layout:u,separatorToPanels:a}=i,r=o.separators.find(p=>p.element===t);C(r,"Matching separator not found");const l=a.get(r);C(l,"Matching panels not found");const c=l[0],m=s.find(p=>p.panelId===c.id);if(C(m,"Panel metadata not found"),m.collapsible){const p=u[c.id],S=m.collapsedSize===p?o.mutableState.expandedPanelSizes[c.id]??m.minSize:m.collapsedSize;U(t,S-p)}break}case"F6":{e.preventDefault();const i=fe(t).separators.map(r=>r.element),s=Array.from(i).findIndex(r=>r===e.currentTarget);C(s!==null,"Index not found");const u=e.shiftKey?s>0?s-1:i.length-1:s+1<i.length?s+1:0;i[u].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),U(t,-100);break}}}function Fe(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=q(),n=be(e,t),o=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(s.group);u&&o.set(s.group,u.layout)}),ee({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function ot({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:u}){let a=0;n.forEach(l=>{const{group:c,groupSize:m}=l,{orientation:p,panels:S}=c,{disableCursor:x}=c.mutableState;let f=0;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;const d=o.get(c),h=i.get(c);if(!d||!h)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:g,separatorToPanels:L}=h;if(b&&g&&L){const M=se({delta:f,initialLayout:d,panelConstraints:b,pivotIndices:l.panels.map(R=>S.indexOf(R)),prevLayout:g,trigger:"mouse-or-touch"});if(W(M,g)){if(f!==0&&!x)switch(p){case"horizontal":{a|=f<0?qe:Xe;break}case"vertical":{a|=f<0?Ye:Je;break}}}else $(l.group,{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:M,separatorToPanels:L})}});let r=0;t.movementX===0?r|=u&Re:r|=a&Re,t.movementY===0?r|=u&Ce:r|=a&Ce,xt(r),Se(e)}function Ne(e){const t=q(),n=B();switch(n.state){case"active":ot({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function _e(e){if(e.defaultPrevented)return;const t=B(),n=q();switch(t.state){case"active":{if(e.buttons===0){ee({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:i}=o.separator;i.hasPointerCapture?.(e.pointerId)||i.setPointerCapture?.(e.pointerId)}ot({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=be(e,n);o.length===0?t.state!=="inactive"&&ee({cursorFlags:0,state:"inactive"}):ee({cursorFlags:0,hitRegions:o,state:"hover"}),Se(e.currentTarget);break}}}function je(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(B().state){case"hover":ee({cursorFlags:0,state:"inactive"})}}function $e(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;Qe(e.currentTarget)&&e.preventDefault()}function He(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const u=O(s.defaultSize);n+=u,o[s.panelId]=u}else o[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=O((100-n)/i);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=s)}return o}function Ot(e,t,n){if(!n[0])return;const i=e.panels.find(l=>l.element===t);if(!i||!i.onResize)return;const s=te({group:e}),u=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,a=i.mutableValues.prevSize,r={asPercentage:O(u/s*100),inPixels:u};i.mutableValues.prevSize=r,i.onResize(r,i.id,a)}function Gt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e)if(e[o]!==t[o])return!1;return!0}function At({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let i=0,s=0,u=!1;const a=new Map,r=[];for(const m of e.panels){const p=o[m.id]??0;switch(m.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const S=p/100*n,x=O(S/t*100);a.set(m.id,x),i+=x;break}case"preserve-relative-size":default:{r.push(m.id),s+=p;break}}}if(!u||r.length===0)return o;const l=100-i,c={...o};if(a.forEach((m,p)=>{c[p]=m}),s>0)for(const m of r){const p=o[m]??0;c[m]=O(p/s*l)}else{const m=O(l/r.length);for(const p of r)c[p]=m}return c}function Ft(e,t){const n=e.map(i=>i.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const i of n)if(!o.includes(i))return!1;return!0}const J=new Map;function Nt(e){let t=!0;C(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,i=new Set,s=new n(f=>{for(const d of f){const{borderBoxSize:h,target:y}=d;if(y===e.element){if(t){const b=te({group:e});if(b===0)return;const v=H(e.id);if(!v)return;const g=me(e),L=v.defaultLayoutDeferred?He(g):v.layout,M=At({group:e,nextGroupSize:b,prevGroupSize:v.groupSize,prevLayout:L}),R=K({layout:M,panelConstraints:g});if(!v.defaultLayoutDeferred&&W(v.layout,R)&&Gt(v.derivedPanelConstraints,g)&&v.groupSize===b)return;$(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:g,groupSize:b,layout:R,separatorToPanels:v.separatorToPanels})}}else Ot(e,y,h)}});s.observe(e.element),e.panels.forEach(f=>{C(!o.has(f.id),`Panel ids must be unique; id "${f.id}" was used more than once`),o.add(f.id),f.onResize&&s.observe(f.element)});const u=te({group:e}),a=me(e),r=e.panels.map(({id:f})=>f).join(",");let l=e.mutableState.defaultLayout;l&&(Ft(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[r]??l??He(a),m=K({layout:c,panelConstraints:a}),p=e.element.ownerDocument;J.set(p,(J.get(p)??0)+1);const S=new Map;return We(e).forEach(f=>{f.separator&&S.set(f.separator,f.panels)}),$(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:a,groupSize:u,layout:m,separatorToPanels:S}),e.separators.forEach(f=>{C(!i.has(f.id),`Separator ids must be unique; id "${f.id}" was used more than once`),i.add(f.id),f.element.addEventListener("keydown",Ae)}),J.get(p)===1&&(p.addEventListener("contextmenu",Ie,!0),p.addEventListener("dblclick",Ge,!0),p.addEventListener("pointerdown",Fe,!0),p.addEventListener("pointerleave",Ne),p.addEventListener("pointermove",_e),p.addEventListener("pointerout",je),p.addEventListener("pointerup",$e,!0)),function(){t=!1,J.set(p,Math.max(0,(J.get(p)??0)-1)),wt(e),e.separators.forEach(d=>{d.element.removeEventListener("keydown",Ae)}),J.get(p)||(p.removeEventListener("contextmenu",Ie,!0),p.removeEventListener("dblclick",Ge,!0),p.removeEventListener("pointerdown",Fe,!0),p.removeEventListener("pointerleave",Ne),p.removeEventListener("pointermove",_e),p.removeEventListener("pointerout",je),p.removeEventListener("pointerup",$e,!0)),s.disconnect()}}function _t(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function xe(e){const t=z.useId();return`${e??t}`}const X=typeof window<"u"?z.useLayoutEffect:z.useEffect;function ie(e){const t=z.useRef(e);return X(()=>{t.current=e},[e]),z.useCallback((...n)=>t.current?.(...n),[t])}function ze(...e){return ie(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Pe(e){const t=z.useRef({...e});return X(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const it=z.createContext(null);function jt(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:zt});z.useImperativeHandle(t,()=>n.current,[]),X(()=>{Object.assign(n.current,nt({groupId:e}))})}function rt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:i,elementRef:s,groupRef:u,id:a,onLayoutChange:r,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:m={coarse:20,fine:10},style:p,...S}){const x=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),f=ie(P=>{W(x.current.onLayoutChange,P)||(x.current.onLayoutChange=P,r?.(P))}),d=ie((P,w)=>{W(x.current.onLayoutChanged,P)||(x.current.onLayoutChanged=P,l?.(P,{isUserInteraction:w}))}),h=xe(a),y=z.useRef(null),[b,v]=_t(),g=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:m,separators:[]}),L=ze(y,s);jt(h,u);const M=ie((P,w)=>{const I=B(),E=ke(P),k=H(P);if(k){let T=!1;switch(I.state){case"active":{T=I.hitRegions.some(V=>V.group===E);break}}return{flexGrow:k.layout[w]??1,pointerEvents:T?"none":void 0}}if(n?.[w])return{flexGrow:n?.[w]}}),R=Pe({defaultLayout:n,disableCursor:o}),G=z.useMemo(()=>({get disableCursor(){return!!R.disableCursor},getPanelStyles:M,id:h,orientation:c,registerPanel:P=>{const w=g.current;return w.panels=ge(c,[...w.panels,P]),v(),()=>{w.panels=w.panels.filter(I=>I!==P),v()}},registerSeparator:P=>{const w=g.current;return w.separators=ge(c,[...w.separators,P]),v(),()=>{w.separators=w.separators.filter(I=>I!==P),v()}},updatePanelProps:(P,{disabled:w})=>{const E=g.current.panels.find(V=>V.id===P);E&&(E.panelConstraints.disabled=w);const k=ke(h),T=H(h);k&&T&&$(k,{...T,derivedPanelConstraints:me(k)})},updateSeparatorProps:(P,{disabled:w,disableDoubleClick:I})=>{const k=g.current.separators.find(T=>T.id===P);k&&(k.disabled=w,k.disableDoubleClick=I)}}),[M,h,v,c,R]),N=z.useRef(null);return X(()=>{const P=y.current;if(P===null)return;const w=g.current;let I;if(R.defaultLayout!==void 0&&Object.keys(R.defaultLayout).length===w.panels.length){I={};for(const _ of w.panels){const Y=R.defaultLayout[_.id];Y!==void 0&&(I[_.id]=Y)}}const E={disabled:!!i,element:P,id:h,mutableState:{defaultLayout:I,disableCursor:!!R.disableCursor,expandedPanelSizes:g.current.lastExpandedPanelSizes,layouts:g.current.layouts},orientation:c,panels:w.panels,resizeTargetMinimumSize:w.resizeTargetMinimumSize,separators:w.separators};N.current=E;const k=Nt(E),{defaultLayoutDeferred:T,derivedPanelConstraints:V,layout:ae}=H(E.id,!0);!T&&V.length>0&&(f(ae),d(ae,!1));const ne=ve(h,_=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:Le,layout:le}=_.next;if(Y||Le.length===0)return;const lt=E.panels.map(({id:j})=>j).join(",");E.mutableState.layouts[lt]=le,Le.forEach(j=>{if(j.collapsible){const{layout:pe}=_.prev??{};if(pe){const ct=D(j.collapsedSize,le[j.panelId]),ft=D(j.collapsedSize,pe[j.panelId]);ct&&!ft&&(E.mutableState.expandedPanelSizes[j.panelId]=pe[j.panelId])}}});const ut=B().state!=="active";f(le),ut&&d(le,_.isUserInteraction)});return()=>{N.current=null,k(),ne()}},[i,h,d,f,c,b,R]),z.useEffect(()=>{const P=N.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!o)}),re.jsx(it.Provider,{value:G,children:re.jsx("div",{...S,className:t,"data-group":!0,"data-testid":h,id:h,ref:L,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}rt.displayName="Group";function de(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function $t({id:e,panelIds:t,storage:n}){const o=de(e,[]),i=n.getItem(o);if(i)try{const s=JSON.parse(i);if(t){const u=t.join(","),a=s[u];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const r={};for(let l=0;l<t.length;l++)r[t[l]]=a.layout[l];return r}}else{const u=Object.keys(s);if(u.length===1){const a=s[u[0]];if(a&&Array.isArray(a.layout)){const r=u[0].split(",");if(r.length===a.layout.length){const l={};for(let c=0;c<r.length;c++)l[r[c]]=a.layout[c];return l}}}}}catch{}}function Ht({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...i}){const s=n!==void 0,u="id"in i?i.id:i.groupId,a=de(u,n??[]),r=z.useSyncExternalStore(Vt,()=>o.getItem(a),()=>o.getItem(a)),l=z.useMemo(()=>{if(r){const d=JSON.parse(r),h=Object.values(d);if(Array.from(h).every(y=>typeof y=="number"))return d}},[r]),c=z.useMemo(()=>{if(!l)return $t({id:u,panelIds:n,storage:o})},[l,u,n,o]),m=l??c,p=z.useRef(null),S=z.useCallback(()=>{const d=p.current;d&&(p.current=null,clearTimeout(d))},[]);z.useLayoutEffect(()=>()=>{S()},[S]);const x=z.useCallback((d,h)=>{if(t&&!h.isUserInteraction)return;S();let y;s?y=de(u,Object.keys(d)):y=de(u,[]);try{o.setItem(y,JSON.stringify(d))}catch(b){console.error(b)}},[S,s,u,t,o]),f=z.useCallback(d=>{S(),e===0?x(d,{isUserInteraction:!1}):p.current=setTimeout(()=>{x(d,{isUserInteraction:!1})},e)},[S,e,x]);return{defaultLayout:m,onLayoutChange:f,onLayoutChanged:x}}function Vt(){return function(){}}function Ut(){return z.useState(null)}function Bt(){return z.useRef(null)}function we(){const e=z.useContext(it);return C(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Wt(e,t){const{id:n}=we(),o=z.useRef({collapse:he,expand:he,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:he});z.useImperativeHandle(t,()=>o.current,[]),X(()=>{Object.assign(o.current,tt({groupId:n,panelId:e}))})}function st({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:i,disabled:s,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:r,maxSize:l="100%",minSize:c="0%",onResize:m,panelRef:p,style:S,...x}){const f=!!r,d=xe(r),h=Pe({disabled:s}),y=z.useRef(null),b=ze(y,u),{getPanelStyles:v,id:g,orientation:L,registerPanel:M,updatePanelProps:R}=we(),G=m!==null,N=ie((E,k,T)=>{m?.(E,r,T)});X(()=>{const E=y.current;if(E!==null){const k={element:E,id:d,idIsStable:f,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:G?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:i,disabled:h.disabled,maxSize:l,minSize:c}};return M(k)}},[a,n,o,i,G,d,f,l,c,N,M,h]),z.useEffect(()=>{R(d,{disabled:s})},[s,d,R]),Wt(d,p);const P=()=>{const E=v(g,d);if(E)return JSON.stringify(E)},w=z.useSyncExternalStore(E=>ve(g,E),P,P);let I;return w?I=JSON.parse(w):i!==void 0?I={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:I={flexGrow:1},re.jsx("div",{...x,"data-disabled":s||void 0,"data-panel":!0,"data-testid":d,id:d,ref:b,style:{...Kt,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:re.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:L==="horizontal"?"pan-y":"pan-x"},children:e})})}st.displayName="Panel";const Kt={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function qt(){return z.useState(null)}function Xt(){return z.useRef(null)}function Yt({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let i,s;const u=e[n],a=t.find(r=>r.panelId===n);if(a){const r=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];s=K({layout:se({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],i=K({layout:se({delta:r-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:u}}function at({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:i,id:s,style:u,...a}){const r=xe(s),l=Pe({disabled:n,disableDoubleClick:o}),[c,m]=z.useState({}),[p,S]=z.useState("inactive"),[x,f]=z.useState(!1),d=z.useRef(null),h=ze(d,i),{disableCursor:y,id:b,orientation:v,registerSeparator:g,updateSeparatorProps:L}=we(),M=v==="horizontal"?"vertical":"horizontal";X(()=>{const N=d.current;if(N!==null){const P={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:N,id:r},w=g(P),I=bt(k=>{S(k.next.state!=="inactive"&&k.next.hitRegions.some(T=>T.separator===P)?k.next.state:"inactive")}),E=ve(b,k=>{const{derivedPanelConstraints:T,layout:V,separatorToPanels:ae}=k.next,ne=ae.get(P);if(ne){const _=ne[0],Y=ne.indexOf(_);m(Yt({layout:V,panelConstraints:T,panelId:_.id,panelIndex:Y}))}});return()=>{I(),E(),w()}}},[b,r,g,l]),z.useEffect(()=>{L(r,{disabled:n,disableDoubleClick:o})},[n,o,r,L]);let R;n&&!y&&(R="not-allowed");let G;if(n)G="disabled";else switch(p){case"active":{G="active";break}default:x?G="focus":G=p}return re.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":M,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":G,"data-testid":r,id:r,onBlur:()=>f(!1),onFocus:()=>f(!0),ref:h,role:"separator",style:{flexBasis:"auto",cursor:R,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}at.displayName="Separator";exports.Group=rt;exports.Panel=st;exports.Separator=at;exports.isCoarsePointer=Be;exports.useDefaultLayout=Ht;exports.useGroupCallbackRef=Ut;exports.useGroupRef=Bt;exports.usePanelCallbackRef=qt;exports.usePanelRef=Xt;
//# sourceMappingURL=react-resizable-panels.cjs.map
diff --git a/dist/react-resizable-panels.js b/dist/react-resizable-panels.js
-index a7428e98b76a49794309fb68733c4b0854f9e2c4..aceb02242070d895fe9d84c8fd5c54be52832b5a 100644
+index a7428e98b76a49794309fb68733c4b0854f9e2c4..2b6af644043ee242f662e8341e966a91c2ec622b 100644
--- a/dist/react-resizable-panels.js
+++ b/dist/react-resizable-panels.js
-@@ -838,14 +838,15 @@ function K({
+@@ -838,14 +838,13 @@ function K({
layout: e,
panelConstraints: t
}) {
@@ -24,9 +24,7 @@ index a7428e98b76a49794309fb68733c4b0854f9e2c4..aceb02242070d895fe9d84c8fd5c54be
- );
+ let n = Object.values(e), o = [...n];
+ if (o.length !== t.length) {
-+ e = {};
-+ const $v = T(100 / t.length);
-+ for (const $c of t) e[$c.panelId] = $v;
++ e = We(t);
+ n = Object.values(e);
+ o = [...n];
+ }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2c61b729d..92d7dc358 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -138,7 +138,7 @@ patchedDependencies:
hash: d59ed459a6ae570e843d0829f844dde24c0697b883351b198034f47606766517
path: patches/[email protected]
- hash: a6c1092d95d93ea1b560ab78f6e1d35abb4d8400622e8f45aad8052e6ccaac7f
+ hash: 57bd789941845510ee2a01f477777cb3906f16e3d9396b6f20224a999d6fc38b
path: patches/[email protected]
hash: bc95fab9af70f704280673eafabcb5a40cc180fd5122d62e6c44cac2f7076245
@@ -580,7 +580,7 @@ importers:
version: 5.4.3(patch_hash=d59ed459a6ae570e843d0829f844dde24c0697b883351b198034f47606766517)([email protected]([email protected]))([email protected])
react-resizable-panels:
specifier: ^4.9.0
- version: 4.12.1(patch_hash=a6c1092d95d93ea1b560ab78f6e1d35abb4d8400622e8f45aad8052e6ccaac7f)([email protected]([email protected]))([email protected])
+ version: 4.12.1(patch_hash=57bd789941845510ee2a01f477777cb3906f16e3d9396b6f20224a999d6fc38b)([email protected]([email protected]))([email protected])
scheduler-polyfill:
specifier: ^1.3.0
version: 1.3.0
@@ -21357,7 +21357,7 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.17
- [email protected](patch_hash=a6c1092d95d93ea1b560ab78f6e1d35abb4d8400622e8f45aad8052e6ccaac7f)([email protected]([email protected]))([email protected]):
+ [email protected](patch_hash=57bd789941845510ee2a01f477777cb3906f16e3d9396b6f20224a999d6fc38b)([email protected]([email protected]))([email protected]):
dependencies:
react: 19.2.5
react-dom: 19.2.5([email protected])