react-resizable-panels 4.14.4 → 4.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ None
|
|
|
71
71
|
<td>id</td>
|
|
72
72
|
<td><p>Uniquely identifies this group within an application.
|
|
73
73
|
Falls back to <code>useId</code> when not provided.</p>
|
|
74
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes.</p>
|
|
74
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes; (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
75
75
|
</td>
|
|
76
76
|
</tr>
|
|
77
77
|
<tr>
|
|
@@ -114,7 +114,7 @@ Use this prop to disable that behavior for Panels and Separators in this group.<
|
|
|
114
114
|
<td><p>Exposes the following imperative API:</p>
|
|
115
115
|
<ul>
|
|
116
116
|
<li><code>getLayout(): Layout</code></li>
|
|
117
|
-
<li><code>setLayout(layout: Layout):
|
|
117
|
+
<li><code>setLayout(layout: Layout): Layout</code></li>
|
|
118
118
|
</ul>
|
|
119
119
|
<p>ℹ️ The <code>useGroupRef</code> and <code>useGroupCallbackRef</code> hooks are exported for convenience use in TypeScript projects.</p>
|
|
120
120
|
</td>
|
|
@@ -128,7 +128,7 @@ For most cases, it is recommended to use the <code>onLayoutChanged</code> callba
|
|
|
128
128
|
</tr>
|
|
129
129
|
<tr>
|
|
130
130
|
<td>onLayoutChanged</td>
|
|
131
|
-
<td><p>Called after the Group's layout has
|
|
131
|
+
<td><p>Called after the Group's layout has been changed.</p>
|
|
132
132
|
<p>ℹ️ For layout changes caused by pointer events, this method is not called until the pointer has been released.
|
|
133
133
|
This method is recommended when saving layouts to some storage api.</p>
|
|
134
134
|
<p>ℹ️ The second argument contains meta information about the layout change.
|
|
@@ -141,7 +141,7 @@ prefer it when persisting layouts.</p>
|
|
|
141
141
|
</tr>
|
|
142
142
|
<tr>
|
|
143
143
|
<td>resizePreviewMode</td>
|
|
144
|
-
<td><p>Controls whether pointer dragging updates <code>Panel</code>
|
|
144
|
+
<td><p>Controls whether pointer dragging updates <code>Panel</code> sizes immediately,
|
|
145
145
|
or renders overlay separator previews until the pointer is released.</p>
|
|
146
146
|
<p>Defaults to <code>"panel"</code> (immediate resizing); <code>"separator"</code> defers resizing until release.</p>
|
|
147
147
|
<p>Customize previews using the <code>SeparatorOverlay</code> component.</p>
|
|
@@ -149,14 +149,14 @@ or renders overlay separator previews until the pointer is released.</p>
|
|
|
149
149
|
</tr>
|
|
150
150
|
<tr>
|
|
151
151
|
<td>resizeTargetMinimumSize</td>
|
|
152
|
-
<td><p>Minimum size of the resizable hit target area (either <code>Separator</code> or <code>Panel</code> edge)
|
|
153
|
-
This threshold ensures are large enough to avoid mis-clicks.</p>
|
|
152
|
+
<td><p>Minimum size of the resizable hit target area (either <code>Separator</code> or <code>Panel</code> edge).
|
|
153
|
+
This threshold ensures targets are large enough to avoid mis-clicks.</p>
|
|
154
154
|
<ul>
|
|
155
155
|
<li>Coarse inputs (typically a finger on a touchscreen) have reduced accuracy;
|
|
156
156
|
to ensure accessibility and ease of use, hit targets should be larger to prevent mis-clicks.</li>
|
|
157
157
|
<li>Fine inputs (typically a mouse) can be smaller</li>
|
|
158
158
|
</ul>
|
|
159
|
-
<p>ℹ️ <a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">Apple interface guidelines</a> suggest <code>20pt</code> (<code>27px</code>) on desktops and <code>28pt</code> (<code>37px</code>) for touch devices
|
|
159
|
+
<p>ℹ️ <a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">Apple interface guidelines</a> suggest <code>20pt</code> (<code>27px</code>) on desktops and <code>28pt</code> (<code>37px</code>) for touch devices.
|
|
160
160
|
In practice this seems to be much larger than many of their own applications use though.</p>
|
|
161
161
|
</td>
|
|
162
162
|
</tr>
|
|
@@ -227,7 +227,7 @@ None
|
|
|
227
227
|
<td><p>Uniquely identifies this panel within the parent group.
|
|
228
228
|
Falls back to <code>useId</code> when not provided.</p>
|
|
229
229
|
<p>ℹ️ This prop is used to associate persisted group layouts with the original panel.</p>
|
|
230
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes.</p>
|
|
230
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes; (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
231
231
|
</td>
|
|
232
232
|
</tr>
|
|
233
233
|
<tr>
|
|
@@ -247,7 +247,7 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
247
247
|
or past its <code>collapsedSize</code> to expand.
|
|
248
248
|
Defaults to half the distance between <code>collapsedSize</code> and <code>minSize</code>.</p>
|
|
249
249
|
<p>For example if a panel declares <code>collapsedSize="5%"</code>, <code>collapsedThreshold="5%"</code>, and <code>minSize="25%"</code>,
|
|
250
|
-
it will collapse when resized below 20% and
|
|
250
|
+
it will collapse when resized below 20% and expand when resized above 10%.</p>
|
|
251
251
|
<p>ℹ️ Interpretation rules:</p>
|
|
252
252
|
<ul>
|
|
253
253
|
<li>Numbers are interpreted as pixels (e.g. <code>minSize={200}</code> is 200 pixels)</li>
|
|
@@ -259,7 +259,7 @@ it will collapse when resized below 20% and expands when resized above 10%.</p>
|
|
|
259
259
|
<tr>
|
|
260
260
|
<td>collapsible</td>
|
|
261
261
|
<td><p>This panel can be collapsed.</p>
|
|
262
|
-
<p>ℹ️ A collapsible panel will collapse when
|
|
262
|
+
<p>ℹ️ A collapsible panel will collapse when its size is less than the specified <code>minSize</code></p>
|
|
263
263
|
</td>
|
|
264
264
|
</tr>
|
|
265
265
|
<tr>
|
|
@@ -333,9 +333,9 @@ Defaults to <code>preserve-relative-size</code>.</p>
|
|
|
333
333
|
<ul>
|
|
334
334
|
<li><code>collapse(): void</code></li>
|
|
335
335
|
<li><code>expand(): void</code></li>
|
|
336
|
-
<li><code>getSize():
|
|
336
|
+
<li><code>getSize(): PanelSize</code></li>
|
|
337
337
|
<li><code>isCollapsed(): boolean</code></li>
|
|
338
|
-
<li><code>resize(size: number): void</code></li>
|
|
338
|
+
<li><code>resize(size: number | string): void</code></li>
|
|
339
339
|
</ul>
|
|
340
340
|
<p>ℹ️ The <code>usePanelRef</code> and <code>usePanelCallbackRef</code> hooks are exported for convenience use in TypeScript projects.</p>
|
|
341
341
|
</td>
|
|
@@ -392,7 +392,7 @@ None
|
|
|
392
392
|
<td>id</td>
|
|
393
393
|
<td><p>Uniquely identifies the separator within the parent group.
|
|
394
394
|
Falls back to <code>useId</code> when not provided.</p>
|
|
395
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes.</p>
|
|
395
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes; (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
396
396
|
</td>
|
|
397
397
|
</tr>
|
|
398
398
|
<tr>
|
|
@@ -499,7 +499,7 @@ Grid elements always include the following attributes:
|
|
|
499
499
|
<td>id</td>
|
|
500
500
|
<td><p>Uniquely identifies this grid within an application.
|
|
501
501
|
Falls back to <code>useId</code> when not provided.</p>
|
|
502
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes.</p>
|
|
502
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes; (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
503
503
|
</td>
|
|
504
504
|
</tr>
|
|
505
505
|
<tr>
|
|
@@ -564,7 +564,7 @@ This method is recommended when saving layouts to some storage api.</p>
|
|
|
564
564
|
</tr>
|
|
565
565
|
<tr>
|
|
566
566
|
<td>resizeTargetMinimumSize</td>
|
|
567
|
-
<td><p>Minimum size of the resizable hit target area (either a <code>Gridline</code> or a <code>Cell</code> edge)
|
|
567
|
+
<td><p>Minimum size of the resizable hit target area (either a <code>Gridline</code> or a <code>Cell</code> edge).
|
|
568
568
|
This threshold ensures targets are large enough to avoid mis-clicks.</p>
|
|
569
569
|
<p>ℹ️ Refer to the <code>Group</code> prop of the same name for more information.</p>
|
|
570
570
|
</td>
|
|
@@ -639,7 +639,7 @@ Cell elements always include the following attributes:
|
|
|
639
639
|
<td>id</td>
|
|
640
640
|
<td><p>Uniquely identifies this cell within the parent grid.
|
|
641
641
|
Falls back to <code>useId</code> when not provided.</p>
|
|
642
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes.</p>
|
|
642
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes; (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
643
643
|
</td>
|
|
644
644
|
</tr>
|
|
645
645
|
<tr>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react/jsx-runtime"),x=require("react");function Me(e){const t=x.useId();return`${e??t}`}const ne=typeof window<"u"?x.useLayoutEffect:x.useEffect;function he(e){const t=x.useRef(e);return ne(()=>{t.current=e},[e]),x.useCallback((...n)=>t.current?.(...n),[t])}function Fe(...e){return he(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function nt(e,t){return t?e*2+1:e+1}function wn(e,t){return t?e*2-1:e}function vt(e,t,n){const o=nt(e,n);return t===void 0?`${o} / -1`:`${o} / span ${wn(t,n)}`}function zn(e){return`${e*2} / span 1`}function In({crossCount:e,crossSpan:t,crossStart:n,hasGutters:o}){const r=t===void 0?e:n+t;if(n===0&&r===e)return"1 / -1";let i=nt(n,o),s=nt(r-1,o)+1;return o&&(n>0&&i--,r<e&&s++),`${i} / ${s}`}function st(e,t){return Number.isInteger(e)&&e>=1&&e<t}function G(e,t="Assertion error"){if(!e)throw Error(t)}const Xt=x.createContext(null);function Kt(){const e=x.useContext(Xt);return G(e,"Grid Context not found; did you render a Cell or Gridline outside of a Grid?"),e}function Jt({children:e,className:t,column:n,columnSpan:o=1,elementRef:r,id:i,row:s,rowSpan:c=1,style:a,...u}){const l=Me(i),{gutters:d,registerCell:g}=Kt(),p=x.useRef(null),m=Fe(p,r);return ne(()=>{const f=p.current;if(f!==null)return g({column:n,columnSpan:o,element:f,id:l,row:s,rowSpan:c})},[n,o,l,g,s,c]),Y.jsx("div",{...u,className:t,"data-cell":!0,"data-testid":l,id:l,ref:m,style:{overflow:"auto",...a,minHeight:0,minWidth:0,gridColumn:vt(n,o,d.column),gridRow:vt(s,c,d.row)},children:e})}Jt.displayName="Cell";let He;function Zt(){return He===void 0&&(typeof matchMedia=="function"?He=!!matchMedia("(pointer:coarse)").matches:He=!1),He}function ot({expandHitTargets:e,axis:t,rect:n}){const o=e?Zt()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(n.width<o){const r=o-n.width;n=new DOMRect(n.x-r/2,n.y,n.width+r,n.height)}if(n.height<o){const r=o-n.height;n=new DOMRect(n.x,n.y-r/2,n.width,n.height+r)}return n}function bt({axis:e,cells:t,index:n,rect:o}){let r=[o];for(const i of t){const s=e==="column"?i.column:i.row,c=e==="column"?i.columnSpan:i.rowSpan;if(s>=n||s+c<=n)continue;const a=i.element.getBoundingClientRect(),u=e==="column"?a.top:a.left,l=e==="column"?a.bottom:a.right;l<=u||(r=r.flatMap(d=>{const g=e==="column"?d.top:d.left,p=e==="column"?d.bottom:d.right;if(u>=p||l<=g)return[d];const m=[],f=(y,h)=>{m.push(e==="column"?new DOMRect(d.x,y,d.width,h-y):new DOMRect(y,d.y,h-y,d.height))};return g<u&&f(g,u),p>l&&f(l,p),m}))}return r}function Cn({axis:e,cells:t,crossTrackCount:n,expandHitTargets:o,resizeAxis:r,axisSize:i,includeDisabled:s,separatorPlacements:c}){const{items:a,separators:u}=r,l=a.length;let d=-1,g=-1,p=0;if(a.forEach((b,z)=>{b.constraintProps.disabled||(p++,d===-1&&(d=z),g=z)}),!s&&p<2)return[];const m=b=>s||b>d&&b<=g,f=[],y=(b,z,v)=>({axis:r,axisSize:i,items:[a[b-1],a[b]],rect:z,separator:v}),h=(b,z)=>{let v;for(const T of t){const $=e==="column"?T.row:T.column,M=e==="column"?T.rowSpan:T.columnSpan;if(z==="start"?$===b:$+M-1===b){const D=T.element.getBoundingClientRect();if(z==="start"){const R=e==="column"?D.top:D.left;v=v===void 0?R:Math.min(v,R)}else{const R=e==="column"?D.bottom:D.right;v=v===void 0?R:Math.max(v,R)}}}return v},S=new Set;for(const b of u){const z=c.get(b);if(!z||z.index<1||z.index>=l||(S.add(z.index),!s&&(b.disabled||b.element.hasAttribute("aria-disabled")))||!m(z.index))continue;let v=b.element.getBoundingClientRect();const{crossSpan:T,crossStart:$}=z,M=T===void 0?n:$+T;let D=e==="column"?v.top:v.left,R=e==="column"?v.bottom:v.right;if($>0){const C=h($-1,"end");C!==void 0&&C<D&&(D=C)}if(M<n){const C=h(M,"start");C!==void 0&&C>R&&(R=C)}v=e==="column"?new DOMRect(v.x,D,v.width,R-D):new DOMRect(D,v.y,R-D,v.height),v=ot({expandHitTargets:o,axis:r,rect:v}),s?f.push(y(z.index,v,b)):bt({axis:e,cells:t,index:z.index,rect:v}).forEach(C=>{f.push(y(z.index,C,b))})}const I=(b,z)=>{bt({axis:e,cells:t,index:b,rect:ot({expandHitTargets:o,axis:r,rect:z})}).forEach(v=>{f.push(y(b,v))})},w=Array.from({length:n},()=>new Array(l));for(const b of t){const[z,v,T,$]=e==="column"?[b.column,b.columnSpan,b.row,b.rowSpan]:[b.row,b.rowSpan,b.column,b.columnSpan];for(let M=Math.max(0,T);M<Math.min(n,T+$);M++)for(let D=Math.max(0,z);D<Math.min(l,z+v);D++)w[M][D]??=b}const E=new Map,N=b=>{let z=E.get(b);if(!z){const v=b.element.getBoundingClientRect();z=e==="column"?{crossEnd:v.bottom,crossStart:v.top,end:v.right,start:v.left}:{crossEnd:v.right,crossStart:v.left,end:v.bottom,start:v.top},E.set(b,z)}return z},O=({crossEnd:b,crossStart:z,end:v,start:T})=>e==="column"?new DOMRect(T,z,v-T,b-z):new DOMRect(z,T,b-z,v-T);for(let b=1;b<l;b++){if(S.has(b)||!m(b))continue;let z;for(let v=0;v<n;v++){const T=w[v][b-1],$=w[v][b];let M;if((T||$)&&T!==$){const D=T?N(T):void 0,R=$?N($):void 0,C=D?.end??R.start,P=R?.start??D.end,B=Math.max(D?.crossStart??-1/0,R?.crossStart??-1/0),J=Math.min(D?.crossEnd??1/0,R?.crossEnd??1/0);M={crossEnd:Math.max(B,J),crossStart:B,end:Math.max(C,P),start:Math.min(C,P)}}M?z=z?{crossEnd:Math.max(z.crossEnd,M.crossEnd),crossStart:Math.min(z.crossStart,M.crossStart),end:Math.max(z.end,M.end),start:Math.min(z.start,M.start)}:M:z&&(I(b,O(z)),z=void 0)}z&&I(b,O(z))}return f}function ae(e){const t=parseFloat(e??"");return Number.isFinite(t)?t:0}function Ln({axis:e,element:t,gutterSizes:n,hasGutters:o,layout:r,trackIds:i}){const s=i.length,c=o?s*2-1:s,a=t.ownerDocument.defaultView?.getComputedStyle(t),u=e==="column"?a?.gridTemplateColumns:a?.gridTemplateRows;if(u){const f=u.trim().split(/\s+/);if(f.length===c&&f.every(y=>/^-?[\d.]+px$/.test(y))){const y=i.map((h,S)=>ae(f[o?S*2:S]));return{availableSize:y.reduce((h,S)=>h+S,0),trackSizes:y}}}const l=e==="column"?t.offsetWidth:t.offsetHeight,d=e==="column"?ae(a?.paddingLeft)+ae(a?.paddingRight)+ae(a?.borderLeftWidth)+ae(a?.borderRightWidth):ae(a?.paddingTop)+ae(a?.paddingBottom)+ae(a?.borderTopWidth)+ae(a?.borderBottomWidth),g=ae(e==="column"?a?.columnGap:a?.rowGap),p=n.reduce((f,y)=>f+y,0),m=Math.max(0,l-d-g*Math.max(0,c-1)-p);return{availableSize:m,trackSizes:i.map(f=>r&&r[f]!==void 0?r[f]/100*m:m/s)}}function Qt(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,"%"]}}}class en{#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);return}let r;const i=Array.from(o);for(let s=0;s<i.length;s++){const c=i[s];try{c.call(null,n)}catch(a){r??={error:a}}}if(r)throw r.error}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}let H={cursorFlags:0,state:"inactive"};const at=new en;function re(){return H}function ct(e){return at.addListener("change",e)}function Rn(e,t=[],n,o=!1){const r=H,i={...H};i.cursorFlags=e,i.state==="active"&&(i.didPointerMove||=o,i.previews=t,n&&(i.previewLayoutMap=n)),H=i,at.emit("change",{prev:r,next:i})}function ue(e){const t=H;H=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),at.emit("change",{prev:t,next:e})}function En(e){H.state!=="active"||!H.previews.some(t=>t.separator===e)||ue({...H,previews:H.previews.map(t=>t.separator===e?{...t}:t)})}function Mn(e){if(H.state==="inactive")return;const t=H.hitRegions.filter(o=>o.axis!==e),n=H.state==="active"&&H.previews.some(o=>o.axis===e);if(!(t.length===H.hitRegions.length&&!n))if(t.length===0)ue({cursorFlags:0,state:"inactive"});else if(H.state==="active"){const o=new Map(H.initialLayoutMap),r=new Map(H.previewLayoutMap);o.delete(e),r.delete(e),ue({...H,cursorFlags:0,hitRegions:t,initialLayoutMap:o,previewLayoutMap:r,previews:H.previews.filter(i=>i.axis!==e)})}else ue({...H,hitRegions:t})}const Pn=e=>e,tt=()=>{},tn=1,nn=2,on=4,rn=8,xt=3,wt=12;let Ve;function zt(){return Ve===void 0&&(Ve=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ve=!0)),Ve}function kn({cursorFlags:e,axes:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&zt()){const i=(e&tn)!==0,s=(e&nn)!==0,c=(e&on)!==0,a=(e&rn)!==0;if(i)return c?"se-resize":a?"ne-resize":"e-resize";if(s)return c?"sw-resize":a?"nw-resize":"w-resize";if(c)return"s-resize";if(a)return"n-resize"}break}}return zt()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const It=new WeakMap;function Ct(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=It.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]));let o=re();switch(o.state!=="inactive"&&o.ownerDocument!==e&&(o={cursorFlags:0,state:"inactive"}),o.state){case"active":case"hover":{const r=kn({cursorFlags:o.cursorFlags,axes:o.hitRegions.map(s=>s.axis),state:o.state}),i=`*, *:hover {cursor: ${r} !important; }`;if(t===i)return;t=i,r?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}It.set(e,{prevStyle:t,styleSheet:n})}function Lt(e){return e.state==="inactive"?void 0:e.ownerDocument}function Tn({next:e,prev:t}){const n=Lt(t),o=Lt(e);n&&n!==o&&Ct(n),o&&Ct(o)}function Ee({axis:e}){const{layoutStrategy:t,orientation:n,items:o}=e;return t?t.calculateAvailableSize():o.reduce((r,i)=>(r+=n==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function lt(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_DISCONNECTED?0:n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}function $e(e,t){return Array.from(t).sort((n,o)=>{const r=e==="horizontal"?Dn(n,o):An(n,o);return r!==0?r:lt(n.element,o.element)})}function Dn(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function An(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function sn(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 $n({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,i=Number.MAX_VALUE;for(const s of t){const{x:c,y:a}=sn(o,s),u=e==="horizontal"?c:a;u<i&&(i=u,r=s)}return G(r,"No rect found"),r}function ut({expandHitTargets:e=!0,axis:t,includeDisabled:n=!1}){if(t.layoutStrategy)return t.layoutStrategy.calculateHitRegions({expandHitTargets:e,axis:t,includeDisabled:n});const{element:o,orientation:r,items:i,separators:s}=t,c=$e(r,Array.from(o.children).filter(rt).filter(h=>!h.hasAttribute("data-resize-preview")).map(h=>({element:h}))).map(({element:h})=>h),a=[];let u=!1,l=!1,d=-1,g,p=-1,m=0,f,y=[];{let h=-1;for(const S of c)S.hasAttribute("data-panel")&&(h++,S.hasAttribute("data-disabled")||(m++,d===-1&&(d=h),p=h))}if(n||m>1){let h=-1;for(const S of c)if(S.hasAttribute("data-panel")){h++;const I=i.find(w=>w.element===S);if(I){if(f){const w=f.element.getBoundingClientRect(),E=S.getBoundingClientRect();let N;if(l){const O=r==="horizontal"?new DOMRect(w.right,w.top,0,w.height):new DOMRect(w.left,w.bottom,w.width,0),b=r==="horizontal"?new DOMRect(E.left,E.top,0,E.height):new DOMRect(E.left,E.top,E.width,0);switch(y.length){case 0:{N=[O,b];break}case 1:{const z=y[0],v=$n({orientation:r,rects:[w,E],targetRect:z.element.getBoundingClientRect()});N=[z,v===w?b:O];break}default:{N=y;break}}}else y.length?N=y:N=[r==="horizontal"?new DOMRect(w.right,E.top,E.left-w.right,E.height):new DOMRect(E.left,w.bottom,E.width,E.top-w.bottom)];for(const O of N){const b=ot({expandHitTargets:e,axis:t,rect:"width"in O?O:O.element.getBoundingClientRect()}),z=h<=d||h>p;(n||!u&&!z)&&(g??=Ee({axis:t}),a.push({axis:t,axisSize:g,items:[f,I],separator:"width"in O?void 0:O,rect:b})),u=!1}}l=!1,f=I,y=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(u=!0);const I=s.find(w=>w.element===S);I?y.push(I):(f=void 0,y=[])}else l=!0}return a}function On(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function Gn(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function Nn(e){return e/100*window.innerHeight}function jn(e){return e/100*window.innerWidth}function Ie({axisSize:e,itemElement:t,styleProp:n}){let o;const[r,i]=Qt(n);switch(i){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=Gn(t,r);break}case"em":{o=On(t,r);break}case"vh":{o=Nn(r);break}case"vw":{o=jn(r);break}}return o}function K(e){return parseFloat(e.toFixed(3))}function it(e){const{items:t}=e,n=Ee({axis:e});return n===0?t.map(o=>({groupResizeBehavior:o.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:o.constraintProps.collapsible===!0,defaultSize:void 0,disabled:o.constraintProps.disabled,minSize:0,maxSize:100,itemId:o.id})):t.map(o=>{const{element:r,constraintProps:i}=o;let s=0;if(i.collapsedSize!==void 0){const d=Ie({axisSize:n,itemElement:r,styleProp:i.collapsedSize});s=K(d/n*100)}let c;if(i.collapsedThreshold!==void 0){const d=Ie({axisSize:n,itemElement:r,styleProp:i.collapsedThreshold});c=K(d/n*100)}let a;if(i.defaultSize!==void 0){const d=Ie({axisSize:n,itemElement:r,styleProp:i.defaultSize});a=K(d/n*100)}let u=0;if(i.minSize!==void 0){const d=Ie({axisSize:n,itemElement:r,styleProp:i.minSize});u=K(d/n*100)}let l=100;if(i.maxSize!==void 0){const d=Ie({axisSize:n,itemElement:r,styleProp:i.maxSize});l=K(d/n*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:s,collapsedThreshold:c,collapsible:i.collapsible===!0,defaultSize:a,disabled:i.disabled,minSize:u,maxSize:l,itemId:o.id}})}let le=new Map;const dt=new en;let Oe=0;const Ue=[];let We;function Xe(){Oe++}function ft(){for(let e=0;e<Ue.length;e++)try{dt.emit("axisChange",Ue[e])}catch(t){We??={error:t}}Ue.length=0}function Ke(){if(Oe===1&&ft(),Oe--,Oe===0&&We){const{error:e}=We;throw We=void 0,e}}function Fn(e){le=new Map(le),le.delete(e)}function Le(e,t){for(const[n]of le)if(n.id===e)return n}function se(e,t){for(const[n,o]of le)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function pe(){return le}function Ne(e,t){return dt.addListener("axisChange",n=>{n.axis.id===e&&t(n)})}function de(e,t,n){const o=le.get(e);le=new Map(le),le.set(e,t);const r={axis:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t};Oe>0?Ue.push(r):dt.emit("axisChange",r)}function an(e,{pointerId:t,pointerType:n}){return t===e.pointerId||n==="pen"&&e.pointerType==="pen"}function Je(e,t,n={}){return e.ownerDocument===t&&(n.pointerId===void 0||an(e,n))}function _n(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 X(e,t,n=0){return Math.abs(K(e)-K(t))<=n}function ce(e,t){return X(e,t)?0:e>t?1:-1}function Re({overrideDisabledItems:e,itemConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsedThreshold:i,collapsible:s,disabled:c,maxSize:a=100,minSize:u=0}=t;if(c&&!e)return n;if(ce(o,u)<0)if(s){const l=i??(u-r)/2,d=ce(n,r)<=0,g=d?r+l:u-l,p=ce(o,g);ce(o,r)<=0||p<0||i!==void 0&&d&&p===0?o=r:o=u}else o=u;return o=Math.min(a,o),o=K(o),o}function je({delta:e,initialLayout:t,itemConstraints:n,pivotIndices:o,prevLayout:r,trigger:i}){if(X(e,0))return t;const s=i==="imperative-api",c=n.map(({itemId:m})=>t[m]),a=n.map(({itemId:m})=>r[m]),u=[...c],[l,d]=o;G(l!=null,"Invalid first pivot index"),G(d!=null,"Invalid second pivot index");let g=0;switch(i){case"keyboard":{{const m=e<0?d:l,f=n[m];G(f,`Panel constraints not found for index ${m}`);const{collapsedSize:y=0,collapsible:h,minSize:S=0}=f;if(h){const I=c[m];if(G(I!=null,`Previous layout not found for panel index ${m}`),X(I,y)){const w=S-I;ce(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}{const m=e<0?l:d,f=n[m];G(f,`No panel constraints found for index ${m}`);const{collapsedSize:y=0,collapsible:h,minSize:S=0}=f;if(h){const I=c[m];if(G(I!=null,`Previous layout not found for panel index ${m}`),X(I,S)){const w=I-y;ce(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}break}default:{const m=e<0?d:l,f=n[m];G(f,`Panel constraints not found for index ${m}`);const y=c[m],{collapsedSize:h,collapsedThreshold:S,collapsible:I,minSize:w}=f;if(I&&ce(y,w)<0){const E=w-h,N=S??E/2,O=y+Math.abs(e);if(ce(O,w)<0){const b=ce(Math.abs(e),N),z=S===void 0&&e<0;b>0||b===0&&z?e=e<0?-E:E:e=0}}break}}{const m=e<0?1:-1;let f=e<0?d:l,y=0;for(;;){const S=c[f];G(S!=null,`Previous layout not found for panel index ${f}`);const w=Re({overrideDisabledItems:s,itemConstraints:n[f],prevSize:S,size:100})-S;if(y+=w,f+=m,f<0||f>=n.length)break}const h=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-h:h}{let f=e<0?l:d;for(;f>=0&&f<n.length;){const y=Math.abs(e)-Math.abs(g),h=c[f];G(h!=null,`Previous layout not found for panel index ${f}`);const S=h-y,I=Re({overrideDisabledItems:s,itemConstraints:n[f],prevSize:h,size:S});if(!X(h,I)&&(g+=h-I,u[f]=I,g.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?f--:f++}}if(_n(a,u))return r;{const m=e<0?d:l,f=c[m];G(f!=null,`Previous layout not found for panel index ${m}`);const y=f+g,h=Re({overrideDisabledItems:s,itemConstraints:n[m],prevSize:f,size:y});if(u[m]=h,!X(h,y)){let S=y-h,w=e<0?d:l;for(;w>=0&&w<n.length;){const E=u[w];G(E!=null,`Previous layout not found for panel index ${w}`);const N=E+S,O=Re({overrideDisabledItems:s,itemConstraints:n[w],prevSize:E,size:N});if(X(E,O)||(S-=O-E,u[w]=O),X(S,0))break;e>0?w--:w++}}}const p=Object.values(u).reduce((m,f)=>f+m,0);return X(p,100,.1)?u.reduce((m,f,y)=>(m[n[y].itemId]=f,m),{}):r}function ie(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ce(e[n],t[n])!==0)return!1;return!0}function mt(e){Xe();try{Bn(e)}finally{Ke()}}function Bn({commit:e,event:t,hitRegions:n,initialLayoutMap:o,mountedAxes:r,pointerDownAtPoint:i,prevCursorFlags:s}){let c=0;const a=re();let u=a.state==="active"?a.previews:[];const l=new Map(a.state==="active"?a.previewLayoutMap:void 0);n.forEach(p=>{const{axis:m,axisSize:f}=p,{orientation:y,items:h}=m;if(e&&m.resizePreviewMode!=="separator")return;const{disableCursor:S}=m.mutableState;let I=0;i?y==="horizontal"?I=(t.clientX-i.x)/f*100:I=(t.clientY-i.y)/f*100:y==="horizontal"?I=t.clientX<0?-100:100:I=t.clientY<0?-100:100;const w=o.get(m),E=r.get(m);if(!w||!E)return;const{defaultLayoutDeferred:N,derivedItemConstraints:O,axisSize:b,layout:z,separatorToItems:v}=E;if(O&&z&&v){const T=m.resizePreviewMode==="separator"?l.get(m)??z:z,$=je({delta:I,initialLayout:w,itemConstraints:O,pivotIndices:p.items.map(M=>h.indexOf(M)),prevLayout:T,trigger:"mouse-or-touch"});if(m.resizePreviewMode==="separator"&&!e&&!ie($,T)){l.set(m,$);let M=0;const D=h.map(R=>(M+=$[R.id]-w[R.id],M*(f/100)));u=u.map(R=>{if(R.axis!==m)return R;const C=D[R.itemIndex];return C===R.offset?R:{...R,offset:C}})}if(ie($,T)&&I!==0&&!S)switch(y){case"horizontal":{c|=I<0?tn:nn;break}case"vertical":{c|=I<0?on:rn;break}}(m.resizePreviewMode!=="separator"||e)&&!ie($,z)&&de(p.axis,{defaultLayoutDeferred:N,derivedItemConstraints:O,axisSize:b,layout:$,requestedAxisSize:b,requestedLayout:$,separatorToItems:v})}});let d=0;t.movementX===0?d|=s&xt:d|=c&xt,t.movementY===0?d|=s&wt:d|=c&wt;const g=a.state==="active"&&(t.clientX!==a.pointerDownAtPoint.x||t.clientY!==a.pointerDownAtPoint.y);Rn(d,u,l,g)}function cn(e,t){const n=re();if(n.state!=="active"||!Je(n,e,t))return;const o=pe();Xe();try{mt({commit:!0,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),ft(),ue({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(t.preventDefault?.(),n.hitRegions.forEach(r=>{if(!o.has(r.axis))return;const i=se(r.axis.id,!0);de(r.axis,i,{isUserInteraction:!0})}))}finally{Ke()}}function Rt(e){if(e.defaultPrevented)return;const{clientX:t,clientY:n,movementX:o,movementY:r}=e;cn(e.currentTarget,{clientX:t,clientY:n,movementX:o,movementY:r})}function qn(e,t,n){let o,r={x:1/0,y:1/0};for(const i of t){const s=sn(n,i.rect);switch(e){case"horizontal":{(s.x<r.x||s.x===r.x&&s.y<=r.y)&&(o=i,r=s);break}case"vertical":{(s.y<r.y||s.y===r.y&&s.x<=r.x)&&(o=i,r=s);break}}}return o?{distance:r,hitRegion:o}:void 0}function Hn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Vn(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Pt(e),b:Pt(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();G(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:Mt(Et(n.a)),b:Mt(Et(n.b))};if(r.a===r.b){const i=o.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const a=i[c];if(a===s.a)return 1;if(a===s.b)return-1}}return Math.sign(r.a-r.b)}const Un=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Wn(e){const t=getComputedStyle(ln(e)??e).display;return t==="flex"||t==="inline-flex"}function Yn(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Wn(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"||Un.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Et(e){let t=e.length;for(;t--;){const n=e[t];if(G(n,"Missing node"),Yn(n))return n}return null}function Mt(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Pt(e){const t=[];for(;e;)t.push(e),e=ln(e);return t}function ln(e){const{parentNode:t}=e;return Hn(t)?t.host:t}function Xn(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 Kn(e){try{return e.matches(":modal")}catch{return!1}}function Jn({axisElement:e,hitRegion:t,pointerEventTarget:n}){if(rt(n)){const o=n.closest("dialog");if(o&&!o.contains(e)&&Kn(o))return!1}if(!rt(n)||n.contains(e)||e.contains(n))return!0;if(Vn(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Xn(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function pt(e,t,n){const o=[];return t.forEach((r,i)=>{if(i.disabled||i.element.ownerDocument!==n)return;const s=ut({axis:i}),c=qn(i.orientation,s,{x:e.clientX,y:e.clientY});c&&c.distance.x<=0&&c.distance.y<=0&&Jn({axisElement:i.element,hitRegion:c.hitRegion.rect,pointerEventTarget:e.target})&&o.push(c.hitRegion)}),o}function ge({layout:e,itemConstraints:t}){const n=t.map(({itemId:s})=>e[s]),o=[...n],r=o.reduce((s,c)=>s+c,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(s=>`${s}%`).join(", ")}`);if(!X(r,100)&&o.length>0)for(let s=0;s<t.length;s++){const c=o[s];G(c!=null,`No layout data found for index ${s}`);const a=100/r*c;o[s]=a}let i=0;for(let s=0;s<t.length;s++){const c=n[s];G(c!=null,`No layout data found for index ${s}`);const a=o[s];G(a!=null,`No layout data found for index ${s}`);const u=Re({overrideDisabledItems:!0,itemConstraints:t[s],prevSize:c,size:a});a!=u&&(i+=a-u,o[s]=u)}if(!X(i,0))for(let s=0;s<t.length;s++){const c=o[s];G(c!=null,`No layout data found for index ${s}`);const a=c+i,u=Re({overrideDisabledItems:!0,itemConstraints:t[s],prevSize:c,size:a});if(c!==u&&(i-=u-c,o[s]=u,X(i,0)))break}return o.reduce((s,c,a)=>(s[t[a].itemId]=c,s),{})}function ht({axisId:e,itemId:t}){const n=()=>{const a=pe();for(const[u,{defaultLayoutDeferred:l,derivedItemConstraints:d,layout:g,axisSize:p,separatorToItems:m}]of a)if(u.id===e)return{defaultLayoutDeferred:l,derivedItemConstraints:d,axis:u,axisSize:p,layout:g,separatorToItems:m};throw Error(`Group ${e} not found`)},o=()=>{const a=n().derivedItemConstraints.find(u=>u.itemId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const a=n().axis.items.find(u=>u.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const a=n().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},s=({nextSize:a,items:u,prevLayout:l,derivedItemConstraints:d})=>{const g=i(),p=u.findIndex(h=>h.id===t),m=p===0,f=p===u.length-1;if(f&&a<g&&(m||u.slice(0,p).every((h,S)=>{const I=d[S];return I?.collapsible&&X(I.collapsedSize,l[I.itemId])}))){const h=u.slice(0,p).reduce((S,I)=>S+l[I.id],0);return{...l,[t]:K(100-h)}}return je({delta:f?g-a:a-g,initialLayout:l,itemConstraints:d,pivotIndices:f?[p-1,p]:[p,p+1],prevLayout:l,trigger:"imperative-api"})},c=a=>{const u=i();if(a===u)return;const{defaultLayoutDeferred:l,derivedItemConstraints:d,axis:g,axisSize:p,layout:m,separatorToItems:f}=n(),y=s({nextSize:a,items:g.items,prevLayout:m,derivedItemConstraints:d}),h=ge({layout:y,itemConstraints:d});ie(m,h)||de(g,{defaultLayoutDeferred:l,derivedItemConstraints:d,axisSize:p,layout:h,requestedAxisSize:p,requestedLayout:h,separatorToItems:f})};return{collapse:()=>{const{collapsible:a,collapsedSize:u}=o(),{mutableValues:l}=r(),d=i();a&&d!==u&&(l.expandToSize=d,c(u))},expand:()=>{const{collapsible:a,collapsedSize:u,minSize:l}=o(),{mutableValues:d}=r(),g=i();if(a&&g===u){let p=d.expandToSize??l;p===0&&(p=1),c(p)}},getSize:()=>{const{axis:a}=n(),u=i(),{element:l}=r(),d=a.layoutStrategy?a.layoutStrategy.getItemSizeInPixels(t):a.orientation==="horizontal"?l.offsetWidth:l.offsetHeight;return{asPercentage:u,inPixels:d}},isCollapsed:()=>{const{collapsible:a,collapsedSize:u}=o(),l=i();return a&&X(u,l)},resize:a=>{const{axis:u}=n(),{element:l}=r(),d=Ee({axis:u}),g=Ie({axisSize:d,itemElement:l,styleProp:a}),p=K(g/d*100);c(p)}}}function kt(e){if(e.defaultPrevented)return;const t=pe();pt(e,t,e.currentTarget).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const r=o.items.find(i=>i.constraintProps.defaultSize!==void 0);if(r){const i=r.constraintProps.defaultSize,s=ht({axisId:o.axis.id,itemId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function un(e){const t=pe();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 Ge({axisId:e}){const t=()=>{const n=pe();for(const[o,r]of n)if(o.id===e)return{axis:o,...r};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,derivedItemConstraints:r,axis:i,axisSize:s,layout:c,separatorToItems:a}=t(),u=ge({layout:n,itemConstraints:r});return o?c:(ie(c,u)||de(i,{defaultLayoutDeferred:o,derivedItemConstraints:r,axisSize:s,layout:u,requestedAxisSize:s,requestedLayout:u,separatorToItems:a}),u)}}}function be(e,t){const n=un(e),o=se(n.id,!0),r=n.separators.find(d=>d.element===e);G(r,"Matching separator not found");const i=o.separatorToItems.get(r);G(i,"Matching panels not found");const s=i.map(d=>n.items.indexOf(d)),a=Ge({axisId:n.id}).getLayout(),u=je({delta:t,initialLayout:a,itemConstraints:o.derivedItemConstraints,pivotIndices:s,prevLayout:a,trigger:"keyboard"}),l=ge({layout:u,itemConstraints:o.derivedItemConstraints});ie(a,l)||de(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedItemConstraints:o.derivedItemConstraints,axisSize:o.axisSize,layout:l,requestedAxisSize:o.axisSize,requestedLayout:l,separatorToItems:o.separatorToItems},{isUserInteraction:!0})}function Tt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=un(t);if(!(n.disabled||n.separators.find(r=>r.element===t)?.disabled))switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&be(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&be(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&be(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&be(t,-5);break}case"End":{e.preventDefault(),be(t,100);break}case"Enter":{e.preventDefault();const r=se(n.id,!0),{derivedItemConstraints:i,layout:s,separatorToItems:c}=r,a=n.separators.find(g=>g.element===t);G(a,"Matching separator not found");const u=c.get(a);G(u,"Matching panels not found");const l=u[0],d=i.find(g=>g.itemId===l.id);if(G(d,"Panel metadata not found"),d.collapsible){const g=s[l.id],p=d.collapsedSize===g?n.mutableState.expandedItemSizes[l.id]??d.minSize:d.collapsedSize;be(t,p-g)}break}case"F6":{e.preventDefault();const r=n.separators.map(a=>a.element),i=Array.from(r).findIndex(a=>a===e.currentTarget);G(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),be(t,-100);break}}}function Pe(e,t){const n=re();if(n.state!=="active"||!Je(n,e,t))return!1;const o=pe();Xe();try{n.previewLayoutMap.forEach((r,i)=>{const s=o.get(i);i.resizePreviewMode==="separator"&&s&&!ie(r,s.layout)&&de(i,{...s,layout:r,requestedAxisSize:s.axisSize,requestedLayout:r})}),ft(),ue({cursorFlags:0,state:"inactive"}),n.hitRegions.forEach(r=>{if(!o.has(r.axis))return;const i=se(r.axis.id,!0);de(r.axis,i,{isUserInteraction:!0})})}finally{Ke()}return!0}function Dt(e){const t=re();if(t.state!=="active")return;const n=t.hitRegions.flatMap(({separator:o})=>o?[o.element]:[]);!n.some(o=>o===e.target)||n.some(o=>o.hasPointerCapture?.(e.pointerId))||Pe(e.currentTarget,e)}function At(e){Pe(e.currentTarget,e)}function Zn(e,t){const{element:n,orientation:o,items:r}=e,i=n.getBoundingClientRect(),s=o==="horizontal";return ut({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:a,rect:u,separator:l},d)=>{const g=r.indexOf(a[0]),p=s?u.left+u.width/2:u.top+u.height/2;return{active:t.some(f=>{if(f.axis!==e||f.items[0]!==a[0])return!1;if(l||f.separator)return f.separator===l;const y=s?f.rect.left+f.rect.width/2:f.rect.top+f.rect.height/2;return X(p,y)}),axis:e,key:l?`separator-${l.id}`:`panel-${a[0].id}-${d}`,offset:0,itemIndex:g,rect:new DOMRect((s&&!l?p:u.left)-i.left-n.clientLeft+n.scrollLeft,(!s&&!l?p:u.top)-i.top-n.clientTop+n.scrollTop,s&&!l?0:u.width,!s&&!l?0:u.height),separator:l}})}function $t(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=re();if(t.state==="active"){an(t,e)&&Pe(t.ownerDocument,t);return}const n=pe(),o=pt(e,n,e.currentTarget);if(o.length===0)return;const r=new Map;let i=!1;o.forEach(c=>{c.separator&&(i||(i=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const a=n.get(c.axis);a&&r.set(c.axis,a.layout)});const s=Array.from(r.keys()).flatMap(c=>c.resizePreviewMode==="separator"?Zn(c,o):[]);ue({cursorFlags:0,didPointerMove:!1,hitRegions:o,initialLayoutMap:r,ownerDocument:e.currentTarget,pointerDownAtPoint:{x:e.clientX,y:e.clientY},pointerId:e.pointerId,pointerType:e.pointerType,previewLayoutMap:new Map(r),previews:s,state:"active"}),e.preventDefault()}function Ot(e){const t=e.currentTarget,n=pe(),o=re();switch(o.state){case"active":{if(!Je(o,t,e))return;mt({commit:!1,event:e,hitRegions:o.hitRegions,initialLayoutMap:o.initialLayoutMap,mountedAxes:n,prevCursorFlags:o.cursorFlags})}}}function Gt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=re(),o=pe();switch(n.state){case"active":{if(!Je(n,t,e))return;if(e.buttons===0){Pe(t,e);return}for(const r of n.hitRegions)if(r.separator){const{element:i}=r.separator;i.isConnected&&!i.hasPointerCapture?.(e.pointerId)&&i.setPointerCapture?.(e.pointerId)}mt({commit:!1,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const r=pt(e,o,t);r.length===0?n.state!=="inactive"&&ue({cursorFlags:0,state:"inactive"}):ue({cursorFlags:0,hitRegions:r,ownerDocument:t,state:"hover"});break}}}function Nt(e){if(e.relatedTarget instanceof HTMLIFrameElement){const t=re();switch(t.state){case"hover":t.ownerDocument===e.currentTarget&&ue({cursorFlags:0,state:"inactive"})}}}function jt(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||cn(e.currentTarget,e)}function Ft(e){e.target===e.currentTarget&&Pe(e.currentTarget.document)}function _t(e){Pe(e.currentTarget.document)}function Qn(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const s=K(i.defaultSize);n+=s,o[i.itemId]=s}else o[i.itemId]=void 0;const r=e.length-t;if(r!==0){const i=K((100-n)/r);for(const s of e)s.defaultSize===void 0&&(o[s.itemId]=i)}return o}function eo(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}function Bt({axis:e,itemConstraints:t}){const n=e.items.map(({id:r})=>r).join(","),o=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(o&&eo(e.items,o)?o:Qn(t))}function qt({itemIds:e,layout:t}){return ge({layout:t,itemConstraints:e.map(n=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:n,maxSize:100,minSize:0}))})}function to(e,t,n){if(!n[0])return;const r=e.items.find(u=>u.element===t);if(!r||!r.onResize)return;const i=Ee({axis:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,c=r.mutableValues.prevSize,a={asPercentage:K(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,c)}function dn(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 no(e,t){return e.length!==t.length?!1:e.every((n,o)=>dn(n,t[o]))}function oo({axis:e,nextAxisSize:t,prevAxisSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,i=0,s=!1;const c=new Map,a=[];for(const d of e.items){const g=o[d.id]??0;switch(d.constraintProps.groupResizeBehavior){case"preserve-pixel-size":{s=!0;const p=g/100*n,m=K(p/t*100);c.set(d.id,m),r+=m;break}case"preserve-relative-size":default:{a.push(d.id),i+=g;break}}}if(!s||a.length===0)return o;const u=100-r,l={...o};if(c.forEach((d,g)=>{l[g]=d}),i>0)for(const d of a){const g=o[d]??0;l[d]=K(g/i*u)}else{const d=K(u/a.length);for(const g of a)l[g]=d}return l}const ze=new Map;let Ht=!1;function fn(e){let t=!0;G(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,i=new n(m=>{let f;Xe();try{for(const y of m){const{borderBoxSize:h,target:S}=y;if(S===e.element){if(t){const I=Ee({axis:e});if(I===0)break;const w=se(e.id);if(!w)break;const E=it(e);let N=w.requestedAxisSize,O=w.requestedLayout;w.defaultLayoutDeferred&&(N=I,O=qt({itemIds:e.items.map(({id:v})=>v),layout:Bt({axis:e,itemConstraints:E})}));const b=oo({axis:e,nextAxisSize:I,prevAxisSize:N,prevLayout:O}),z=ge({layout:b,itemConstraints:E});if(!w.defaultLayoutDeferred&&ie(w.layout,z)&&no(w.derivedItemConstraints,E)&&w.axisSize===I)continue;de(e,{defaultLayoutDeferred:!1,derivedItemConstraints:E,axisSize:I,layout:z,requestedAxisSize:N,requestedLayout:O,separatorToItems:w.separatorToItems})}}else try{to(e,S,h)}catch(I){f??={error:I}}}}finally{Ke()}if(f)throw f.error});i.observe(e.element),e.items.forEach(m=>{G(!o.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),o.add(m.id),m.onResize&&i.observe(m.element)});const s=Ee({axis:e}),c=it(e),a=Bt({axis:e,itemConstraints:c}),u=ge({layout:a,itemConstraints:c}),l=e.element.ownerDocument,d=l.defaultView;ze.set(l,(ze.get(l)??0)+1);const g=new Map;return ut({axis:e,includeDisabled:!0}).forEach(m=>{m.separator&&g.set(m.separator,m.items)}),de(e,{defaultLayoutDeferred:s===0,derivedItemConstraints:c,axisSize:s,layout:u,requestedAxisSize:s,requestedLayout:qt({itemIds:e.items.map(({id:m})=>m),layout:a}),separatorToItems:g}),e.separators.forEach(m=>{G(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",Tt)}),Ht||(Ht=!0,ct(Tn)),ze.get(l)===1&&(l.addEventListener("contextmenu",Rt,!0),l.addEventListener("dblclick",kt,!0),l.addEventListener("lostpointercapture",Dt,!0),l.addEventListener("pointercancel",At,!0),l.addEventListener("pointerdown",$t,!0),l.addEventListener("pointerleave",Ot),l.addEventListener("pointermove",Gt),l.addEventListener("pointerout",Nt),l.addEventListener("pointerup",jt,!0),d?.addEventListener("blur",Ft),d?.addEventListener("pagehide",_t)),function(){t=!1,ze.set(l,Math.max(0,(ze.get(l)??0)-1)),Fn(e),Mn(e),e.separators.forEach(f=>{f.element.removeEventListener("keydown",Tt)}),ze.get(l)||(l.removeEventListener("contextmenu",Rt,!0),l.removeEventListener("dblclick",kt,!0),l.removeEventListener("lostpointercapture",Dt,!0),l.removeEventListener("pointercancel",At,!0),l.removeEventListener("pointerdown",$t,!0),l.removeEventListener("pointerleave",Ot),l.removeEventListener("pointermove",Gt),l.removeEventListener("pointerout",Nt),l.removeEventListener("pointerup",jt,!0),d?.removeEventListener("blur",Ft),d?.removeEventListener("pagehide",_t)),i.disconnect()}}function mn({derivedItemConstraints:e,axis:t,layout:n,prevLayout:o,requestedLayout:r}){const i=t.items.map(({id:s})=>s).join(",");t.mutableState.layouts[i]=r,o&&e.forEach(s=>{if(s.collapsible){const c=X(s.collapsedSize,n[s.itemId]),a=X(s.collapsedSize,o[s.itemId]);c&&!a&&(t.mutableState.expandedItemSizes[s.itemId]=o[s.itemId])}})}function pn(){const[e,t]=x.useState({}),n=x.useCallback(()=>t({}),[]);return[e,n]}function Ze(e){const t=x.useRef({...e});return ne(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const gt=x.createContext(null);function ro({layout:e,itemConstraints:t,itemId:n,itemIndex:o}){let r,i;const s=e[n],c=t.find(a=>a.itemId===n);if(c){const a=c.maxSize,u=c.collapsible?c.collapsedSize:c.minSize,l=[o,o+1];i=ge({layout:je({delta:u-s,initialLayout:e,itemConstraints:t,pivotIndices:l,prevLayout:e}),itemConstraints:t})[n],r=ge({layout:je({delta:a-s,initialLayout:e,itemConstraints:t,pivotIndices:l,prevLayout:e}),itemConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:i,valueNow:s}}function hn({attributes:e,axisId:t,axisOrientation:n,children:o,className:r,disableCursor:i,disabled:s,disableDoubleClick:c,elementRef:a,id:u,isSharedHitRegion:l,preview:d,registerSeparator:g,requiredStyle:p,style:m,styleDefaults:f,tabIndex:y=0,updateSeparatorProps:h}){const S=Ze({disabled:s,disableDoubleClick:c,children:o,className:r,preview:d,style:m}),[I,w]=x.useState({}),[E,N]=x.useState("inactive"),[O,b]=x.useState(!1),z=x.useRef(null),v=x.useRef(null),T=Fe(z,a),$=n==="horizontal"?"vertical":"horizontal";ne(()=>{const R=z.current;if(R!==null){const C={disabled:S.disabled,disableDoubleClick:S.disableDoubleClick,element:R,id:u,get children(){return S.children},get className(){return S.className},get preview(){return S.preview},get style(){return S.style}};v.current=C;const P=g(C),B=ct(q=>{N(q.next.state!=="inactive"&&q.next.hitRegions.some(Z=>Z.separator===C||(l?.(Z)??!1))?q.next.state:"inactive")}),J=Ne(t,q=>{const{derivedItemConstraints:Z,layout:ye,separatorToItems:xe}=q.next,we=xe.get(C);if(we){const Se=we[0],L=Z.findIndex(F=>F.itemId===Se.id),{layoutStrategy:k}=q.axis;w({...ro({layout:ye,itemConstraints:Z,itemId:Se.id,itemIndex:L}),...k?.getItemAriaControls&&{valueControls:k.getItemAriaControls(Se.id)}})}});return()=>{v.current=null,B(),J(),P()}}},[t,u,l,g,S]),ne(()=>{const R=v.current;R&&En(R)},[d]),x.useEffect(()=>{h(u,{disabled:s,disableDoubleClick:c})},[s,c,u,h]);let M;s&&!i&&(M="not-allowed");let D;if(s)D="disabled";else switch(E){case"active":{D="active";break}default:O?D="focus":D=E}return Y.jsx("div",{...e,"aria-controls":I.valueControls,"aria-disabled":s||void 0,"aria-orientation":$,"aria-valuemax":I.valueMax,"aria-valuemin":I.valueMin,"aria-valuenow":I.valueNow,children:o,className:r,"data-separator":D,"data-testid":u,id:u,onBlur:()=>b(!1),onFocus:()=>b(!0),ref:T,role:"separator",style:{...f,cursor:M,...m,...p,touchAction:"none"},tabIndex:s?void 0:y})}function Vt({axis:e,children:t,className:n,crossSpan:o,crossStart:r,disabled:i,elementRef:s,index:c,style:a}){const u=Me(void 0),{getDisableCursor:l,getResizeAxisId:d,gutters:g,registerSeparator:p,separatorPlacements:m,trackCounts:f,updateSeparatorProps:y}=Kt(),h=d(e),S=e==="column"?"row":"column",I=f[S],w=!!i||!st(c,f[e]);let E=!0;for(const v of m.values())if(v.axis===e&&v.index===c&&!v.disabled&&v.crossStart<r){E=!1;break}const N=x.useCallback(v=>v.axis.id===h&&v.axis.items.indexOf(v.items[1])===c,[h,c]),O=x.useCallback(v=>p({axis:e,crossSpan:o,crossStart:r,disabled:!!i,index:c},v),[e,o,r,i,c,p]),b=zn(c),z=In({crossCount:I,crossSpan:o,crossStart:r,hasGutters:g[S]});return Y.jsx(hn,{axisId:h,axisOrientation:e==="column"?"horizontal":"vertical",className:n,disableCursor:l(),disabled:w,disableDoubleClick:void 0,elementRef:s,id:u,isSharedHitRegion:N,registerSeparator:O,requiredStyle:{gridColumn:e==="column"?b:z,gridRow:e==="row"?b:z},style:a,tabIndex:E?0:-1,updateSeparatorProps:y,children:t})}function yt(e){const{children:t,className:n,disabled:o,elementRef:r,style:i}=e;return e.type==="column"?Y.jsx(Vt,{axis:"column",className:n,crossSpan:e.rowSpan,crossStart:e.row??0,disabled:o,elementRef:r,index:e.column,style:i,children:t}):Y.jsx(Vt,{axis:"row",className:n,crossSpan:e.columnSpan,crossStart:e.column??0,disabled:o,elementRef:r,index:e.row,style:i,children:t})}yt.displayName="Gridline";const Ce=["column","row"],Ut={columns:{},rows:{}};function gn({children:e,className:t,columns:n,defaultLayout:o,disableCursor:r,disabled:i,elementRef:s,gridRef:c,id:a,onLayoutChange:u,onLayoutChanged:l,resizeTargetMinimumSize:d={coarse:20,fine:10},rows:g,style:p,...m}){const f=Me(a),y=x.useCallback(L=>L==="column"?`${f}:columns`:`${f}:rows`,[f]),h=Wt(n,"columns"),S=Wt(g,"rows"),I=L=>L==="column"?h:S,w=x.useRef({onLayoutChange:Ut,onLayoutChanged:Ut}),E=he(L=>{Yt(w.current.onLayoutChange,L)||(w.current.onLayoutChange=L,u?.(L))}),N=he((L,k,F)=>{Yt(w.current.onLayoutChanged,L)||(w.current.onLayoutChanged=L,l?.(L,{isUserInteraction:k,requestedLayout:F}))}),O=x.useRef(null),b=Fe(O,s),[z,v]=pn(),T=x.useRef({cells:[],column:{expandedItemSizes:{},layouts:{}},loggedErrors:new Set,row:{expandedItemSizes:{},layouts:{}},separators:new Map}),$={column:!1,row:!1};for(const L of T.current.separators.values())$[L.axis]=!0;yn(e,$);const M=Ze({defaultLayout:o,disableCursor:r,resizeTargetMinimumSize:d}),D=he(()=>!!M.disableCursor),R=x.useCallback(L=>{const k=T.current;return k.cells=[...k.cells,L],v(),()=>{k.cells=k.cells.filter(F=>F!==L),v()}},[v]),C=x.useCallback((L,k)=>{const F=T.current;return F.separators=new Map(F.separators),F.separators.set(k,L),v(),()=>{F.separators=new Map(F.separators),F.separators.delete(k),v()}},[v]),P=x.useCallback((L,{disabled:k,disableDoubleClick:F})=>{for(const j of T.current.separators.keys())j.id===L&&(j.disabled=k,j.disableDoubleClick=F)},[]),B=T.current.separators,J=x.useMemo(()=>({getDisableCursor:D,getResizeAxisId:y,gutters:{column:$.column,row:$.row},id:f,registerCell:R,registerSeparator:C,separatorPlacements:B,trackCounts:{column:h.length,row:S.length},updateSeparatorProps:P}),[h.length,D,y,$.column,$.row,f,R,C,S.length,B,P]),q=x.useRef([]);ne(()=>{const L=O.current;if(L===null)return;const k=T.current,F=so({cells:k.cells,separatorPlacements:k.separators,trackCounts:{column:h.length,row:S.length}});F.forEach(A=>{k.loggedErrors.has(A)||console.error(A)}),k.loggedErrors=new Set(F);const j=A=>Array.from(k.separators.entries()).filter(([,W])=>W.axis===A).sort(([,W],[,fe])=>W.index-fe.index).map(([W])=>W),_=A=>{const W=A==="column"?h:S,fe=A==="column"?S:h,me=W.map(Q=>Q.id),_e=y(A),Be=j(A),ve=Be.length>0,qe=W.map(({id:Q,...oe},ee)=>({element:L,id:me[ee],idIsStable:!0,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:void 0,constraintProps:oe})),Te=()=>{const Q=[];if(ve){for(const[oe,ee]of k.separators)if(ee.axis===A&&st(ee.index,W.length)){const Ae=oe.element.getBoundingClientRect();Q[ee.index]=Math.max(Q[ee.index]??0,A==="column"?Ae.width:Ae.height)}}return Ln({axis:A,element:L,gutterSizes:Q.filter(oe=>oe!==void 0),hasGutters:ve,layout:se(_e)?.layout,trackIds:me})};let De;const et=M.defaultLayout?.[A==="column"?"columns":"rows"];if(et!==void 0&&Object.keys(et).length===me.length){De={};for(const Q of me){const oe=et[Q];oe!==void 0&&(De[Q]=oe)}}return{disabled:!!i,element:L,id:_e,layoutStrategy:{getItemAriaControls:Q=>{const oe=me.indexOf(Q);return k.cells.filter(ee=>{const Ae=A==="column"?ee.column:ee.row,xn=A==="column"?ee.columnSpan:ee.rowSpan;return Ae<=oe&&oe<Ae+xn}).map(ee=>ee.element.id).filter(Boolean).join(" ")||void 0},calculateAvailableSize:()=>Te().availableSize,calculateHitRegions:({expandHitTargets:Q,axis:oe,includeDisabled:ee})=>Cn({axis:A,cells:k.cells,crossTrackCount:fe.length,expandHitTargets:Q,resizeAxis:oe,axisSize:Te().availableSize,includeDisabled:ee,separatorPlacements:k.separators}),getItemSizeInPixels:Q=>Te().trackSizes[me.indexOf(Q)]??0},mutableState:{defaultLayout:De,disableCursor:!!M.disableCursor,expandedItemSizes:k[A].expandedItemSizes,layouts:k[A].layouts},orientation:A==="column"?"horizontal":"vertical",items:qe,resizePreviewMode:"panel",get resizeTargetMinimumSize(){return M.resizeTargetMinimumSize},separators:Be}},V=Ce.map(_);q.current=V;const U=V.map(A=>fn(A)),te=()=>{const[A,W]=V.map(fe=>se(fe.id));if(!(!A||!W||A.defaultLayoutDeferred||W.defaultLayoutDeferred))return{layout:{columns:A.layout,rows:W.layout},requestedLayout:{columns:A.requestedLayout,rows:W.requestedLayout}}};{const A=te();if(A)try{try{E(A.layout)}finally{N(A.layout,!1,A.requestedLayout)}}catch(W){throw q.current=[],U.forEach(fe=>fe()),W}}const ke=V.map(A=>Ne(A.id,W=>{const{defaultLayoutDeferred:fe,derivedItemConstraints:me,layout:_e,requestedLayout:Be}=W.next;if(fe||me.length===0)return;mn({derivedItemConstraints:me,axis:A,layout:_e,prevLayout:W.prev?.layout,requestedLayout:Be});const ve=te();if(ve){const qe=re(),Te=qe.state!=="active"||!qe.hitRegions.some(De=>V.includes(De.axis));try{E(ve.layout)}finally{Te&&N(ve.layout,W.isUserInteraction,ve.requestedLayout)}}}));return()=>{q.current=[],U.forEach(A=>A()),ke.forEach(A=>A())}},[h,i,y,f,N,E,S,z,M]),x.useEffect(()=>{q.current.forEach(L=>{L.mutableState.defaultLayout=o?.[L.orientation==="horizontal"?"columns":"rows"],L.mutableState.disableCursor=!!r})}),x.useImperativeHandle(c,()=>{const L=()=>{const[j,_]=Ce.map(y);return!Le(j)||!Le(_)?{columns:{},rows:{}}:{columns:Ge({axisId:j}).getLayout(),rows:Ge({axisId:_}).getLayout()}},k=j=>j.map(_=>`"${_}"`).join(", "),F=(j,_)=>{const V=y(j),U=()=>{const te=Le(V);return G(te,`Grid "${f}" has not been mounted`),G(te.items.some(ke=>ke.id===_),`Grid "${f}" no longer contains a ${j} with id "${_}"; ${j} ids are ${k(te.items.map(ke=>ke.id))}`),ht({axisId:V,itemId:_})};return{collapse:()=>U().collapse(),expand:()=>U().expand(),getSize:()=>U().getSize(),isCollapsed:()=>U().isCollapsed(),resize:te=>U().resize(te)}};return{getLayout:L,getTrackById:(j,_)=>{const V=j==="column"?h:S,U=`${_}`;return G(V.some(te=>te.id===U),`Grid "${f}" does not contain a ${j} with id "${U}"; ${j} ids are ${k(V.map(te=>te.id))}`),F(j,U)},getTrackByIndex:(j,_)=>{const V=j==="column"?h:S,U=Number.isInteger(_)?V[_]:void 0;return G(U,`Grid "${f}" does not contain a ${j} at index ${_}; it has ${V.length} ${j}s`),F(j,U.id)},setLayout:j=>(Ce.forEach(_=>{const V=j[_==="column"?"columns":"rows"],U=y(_);V&&Le(U)&&Ge({axisId:U}).setLayout(V)}),L())}},[h,y,f,S]);const Z=()=>Ce.map(L=>{const k=se(y(L)),F=I(L);return(k&&!k.defaultLayoutDeferred?F.map(_=>`minmax(0, ${k.layout[_.id]??1}fr)`):io(F,o?.[L==="column"?"columns":"rows"])).join($[L]?" auto ":" ")}).join("|"),ye=x.useCallback(L=>{const k=Ce.map(F=>Ne(y(F),L));return()=>k.forEach(F=>F())},[y]),xe=x.useSyncExternalStore(ye,Z,Z),[we,Se]=xe.split("|");return Y.jsx(Xt.Provider,{value:J,children:Y.jsx("div",{...m,className:t,"data-grid":!0,"data-testid":f,id:f,ref:b,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"grid",gridTemplateColumns:we,gridTemplateRows:Se,touchAction:"none"},children:Y.jsx(gt.Provider,{value:null,children:e})})})}gn.displayName="Grid";function Wt(e,t){const n=JSON.stringify(e);return x.useMemo(()=>{const o=typeof e=="number"?Array.from({length:e},(r,i)=>({id:`${i}`})):e.map((r,i)=>({...r,id:`${r.id??i}`}));return G(o.length>0,`Grid must have at least one track; "${t}" is ${n}`),o},[n])}function yn(e,t){x.Children.forEach(e,n=>{if(x.isValidElement(n))if(n.type===yt){const{type:o}=n.props;o==="column"?t.column=!0:o==="row"&&(t.row=!0)}else typeof n.type=="symbol"&&n.props!==null&&typeof n.props=="object"&&"children"in n.props&&yn(n.props.children,t)})}function io(e,t){if(t)return e.map(i=>`minmax(0, ${t[i.id]??1}fr)`);const n=e.map(i=>i.defaultSize===void 0?void 0:Qt(i.defaultSize));let o=100,r=0;return n.forEach(i=>{i===void 0?r++:i[1]==="%"&&(o-=i[0])}),n.map(i=>{if(i===void 0)return`minmax(0, ${Math.max(0,o)/Math.max(1,r)}fr)`;const[s,c]=i;return c==="%"?`minmax(0, ${s}fr)`:`${s}${c}`})}function so({cells:e,separatorPlacements:t,trackCounts:n}){const o=[];for(const c of e)Ce.forEach(a=>{const[u,l]=a==="column"?[c.column,c.columnSpan]:[c.row,c.rowSpan],d=n[a];(!Number.isInteger(u)||!Number.isInteger(l)||u<0||l<1||u+l>d)&&o.push(`Invalid Cell ${a} placement (${a}: ${u}, ${a}Span: ${l}); Grid has ${d} ${a}s`)});const r=({axis:c,crossSpan:a,crossStart:u,disabled:l,index:d})=>{const g=c==="column"?"row":"column";let p=`type="${c}" ${c}={${d}}`;return(u!==0||a!==void 0)&&(p+=` ${g}={${u}}`),a!==void 0&&(p+=` ${g}Span={${a}}`),l&&(p+=" disabled"),`<Gridline ${p} />`},i=Array.from(t.values()).filter(c=>{const{axis:a,crossSpan:u,crossStart:l,index:d}=c,g=a==="column"?"row":"column",p=n[a],m=n[g];let f=!0;return st(d,p)||(o.push(`Invalid ${a} Gridline ${a} (${d}); must be between 1 and ${p-1}`),f=!1),!Number.isInteger(l)||l<0||l>=m?(o.push(`Invalid ${a} Gridline ${g} (${l}); must be between 0 and ${m-1}`),f=!1):u!==void 0&&(!Number.isInteger(u)||u<1||l+u>m)&&(o.push(`Invalid ${a} Gridline ${g}Span (${u}); Grid has ${m} ${g}s`),f=!1),f}),s=c=>{const a=n[c.axis==="column"?"row":"column"];return[c.crossStart,c.crossSpan===void 0?a:c.crossStart+c.crossSpan]};return i.forEach((c,a)=>{const{axis:u,index:l}=c,[d,g]=s(c);for(const p of e){const[m,f,y,h]=u==="column"?[p.column,p.columnSpan,p.row,p.rowSpan]:[p.row,p.rowSpan,p.column,p.columnSpan];if(m<l&&l<m+f&&y<g&&d<y+h){const S=u==="column"?"row":"column";o.push(`${r(c)} overlaps a Cell that spans across it (${u}: ${m}, ${u}Span: ${f}, ${S}: ${y}, ${S}Span: ${h}); use the ${S} and ${S}Span props to render gridlines beside the Cell instead`)}}for(const p of i.slice(a+1))if(p.axis===u&&p.index===l){const[m,f]=s(p);m<g&&d<f&&o.push(`${r(c)} overlaps ${r(p)}`)}}),o}function Yt(e,t){return ie(e.columns,t.columns)&&ie(e.rows,t.rows)}function ao({id:e,onlySaveAfterUserInteractions:t,storage:n=localStorage}){const o=`react-resizable-panels:grid:${e}`,r=x.useSyncExternalStore(co,()=>n.getItem(o),()=>n.getItem(o)),i=x.useMemo(()=>{if(r)try{const c=JSON.parse(r);if(c!==null&&typeof c=="object")return c}catch{}},[r]),s=x.useCallback((c,a)=>{if(!(t&&!a.isUserInteraction))try{n.setItem(o,JSON.stringify(a.requestedLayout??c))}catch(u){console.error(u)}},[t,n,o]);return{defaultLayout:i,onLayoutChanged:s}}function co(){return function(){}}function lo(){return x.useState(null)}function uo(){return x.useRef(null)}function fo(e){for(let t=1;t<e.length;t++)if(lt(e[t-1],e[t])>0)return!1;return!0}function mo({separator:e}){const{element:t}=e,n=x.useRef(null);return ne(()=>{const o=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],i=[o,...o.querySelectorAll("*")],s=t.ownerDocument.defaultView;return r.forEach((c,a)=>{const u=i[a];if(u instanceof s.HTMLElement||u instanceof s.SVGElement){const l=s.getComputedStyle(c);for(let d=0;d<l.length;d++){const g=l.item(d);u.style.setProperty(g,l.getPropertyValue(g))}}u.removeAttribute("data-testid"),u.removeAttribute("id")}),Object.assign(o.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(o),()=>o.remove()},[t]),Y.jsx("div",{ref:n,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function Qe(){const e=x.useContext(gt);return G(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function St(e){const{registerOverlay:t}=Qe(),n=x.useRef(e);dn(n.current,e)||(n.current=e);const o=n.current;return ne(()=>t(o),[t,o]),null}St.displayName="SeparatorOverlay";function po({active:e,orientation:t,style:n,...o}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return Y.jsx("div",{...o,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function ho({overlay:e,preview:t}){const{axis:n,offset:o,rect:r,separator:i}=t,s=n.orientation==="horizontal";let c=i?.preview,a=e;return x.isValidElement(c)&&c.type===St&&(a=c.props,c=void 0),c==null&&(a?c=Y.jsx(po,{...a,active:t.active,orientation:n.orientation}):i&&(c=Y.jsx(mo,{separator:i}))),Y.jsx("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:s?`translateX(${o}px)`:`translateY(${o}px)`,width:r.width},children:c})}function go(e){return Array.from(e).sort(lt)}function yo(e,t){const n=x.useRef({getLayout:()=>({}),setLayout:Pn});x.useImperativeHandle(t,()=>n.current,[]),ne(()=>{Object.assign(n.current,Ge({axisId:e}))})}function So({groupId:e,resizePreviewMode:t}){const[n,o]=x.useState([]),r=x.useRef(n);return ne(()=>{const i=c=>{const a=Le(e),u=t==="separator"&&c.state==="active"?c.previews.filter(d=>d.axis===a&&(d.active||!X(d.offset,0))):[],l=r.current;l.length===u.length&&u.every((d,g)=>d===l[g])||(r.current=u,o(u))};if(t!=="separator"){i(re());return}const s=ct(({next:c})=>i(c));return i(re()),s},[e,t]),n}function Sn({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:i,groupRef:s,id:c,onLayoutChange:a,onLayoutChanged:u,orientation:l="horizontal",resizePreviewMode:d="panel",resizeTargetMinimumSize:g={coarse:20,fine:10},style:p,...m}){const f=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=he(C=>{ie(f.current.onLayoutChange,C)||(f.current.onLayoutChange=C,a?.(C))}),h=he((C,P,B)=>{ie(f.current.onLayoutChanged,C)||(f.current.onLayoutChanged=C,u?.(C,{isUserInteraction:P,requestedLayout:B}))}),S=Me(c),[I,w]=x.useState(),E=So({groupId:S,resizePreviewMode:d}),N=x.useRef(null),[O,b]=pn(),z=x.useRef([]),v=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),T=Fe(N,i);yo(S,s);const $=he((C,P)=>{const B=se(C);if(B)return{flexGrow:B.layout[P]??1};if(n?.[P])return{flexGrow:n?.[P]}}),M=Ze({defaultLayout:n,disableCursor:o,resizeTargetMinimumSize:g}),D=x.useMemo(()=>({get disableCursor(){return!!M.disableCursor},getPanelStyles:$,id:S,orientation:l,registerPanel:C=>{const P=v.current;return P.panels=$e(l,[...P.panels,C]),b(),()=>{P.panels=P.panels.filter(B=>B!==C),b()}},registerOverlay:C=>(w(C),()=>{w(void 0)}),registerSeparator:C=>{const P=v.current;return P.separators=$e(l,[...P.separators,C]),b(),()=>{P.separators=P.separators.filter(B=>B!==C),b()}},updatePanelProps:(C,{disabled:P})=>{const J=v.current.panels.find(ye=>ye.id===C);J&&(J.constraintProps.disabled=P);const q=Le(S),Z=se(S);q&&Z&&de(q,{...Z,derivedItemConstraints:it(q)})},updateSeparatorProps:(C,{disabled:P,disableDoubleClick:B})=>{const q=v.current.separators.find(Z=>Z.id===C);q&&(q.disabled=P,q.disableDoubleClick=B)}}),[$,S,b,l,M]),R=x.useRef(null);return ne(()=>{const C=N.current;if(C===null)return;const P=v.current;P.panels=$e(l,P.panels),P.separators=$e(l,P.separators),z.current=go([...P.panels.map(({element:L})=>L),...P.separators.map(({element:L})=>L)]);let B;if(M.defaultLayout!==void 0&&Object.keys(M.defaultLayout).length===P.panels.length){B={};for(const L of P.panels){const k=M.defaultLayout[L.id];k!==void 0&&(B[L.id]=k)}}const J={disabled:!!r,element:C,id:S,mutableState:{defaultLayout:B,disableCursor:!!M.disableCursor,expandedItemSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:l,items:P.panels,resizePreviewMode:d,get resizeTargetMinimumSize(){return M.resizeTargetMinimumSize},separators:P.separators};R.current=J;const q=fn(J),{defaultLayoutDeferred:Z,derivedItemConstraints:ye,layout:xe,requestedLayout:we}=se(J.id,!0);if(!Z&&ye.length>0)try{try{y(xe)}finally{h(xe,!1,we)}}catch(L){throw R.current=null,q(),L}const Se=Ne(S,L=>{const{defaultLayoutDeferred:k,derivedItemConstraints:F,layout:j,requestedLayout:_}=L.next;if(k||F.length===0)return;mn({derivedItemConstraints:F,axis:J,layout:j,prevLayout:L.prev?.layout,requestedLayout:_});const V=re(),U=V.state!=="active"||!V.hitRegions.some(te=>te.axis===J);try{y(j)}finally{U&&h(j,L.isUserInteraction,_)}});return()=>{R.current=null,q(),Se()}},[r,S,h,y,l,O,d,M]),ne(()=>{fo(z.current)||b()}),x.useEffect(()=>{const C=R.current;C&&(C.mutableState.defaultLayout=n,C.mutableState.disableCursor=!!o)}),Y.jsx(gt.Provider,{value:D,children:Y.jsxs("div",{...m,className:t,"data-group":!0,"data-testid":S,id:S,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",position:d==="separator"?"relative":void 0,...p,display:"flex",flexDirection:l==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:l==="horizontal"?"pan-y":"pan-x"},children:[e,E.map(C=>Y.jsx(ho,{overlay:I,preview:C},C.key))]})})}Sn.displayName="Group";function Ye(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function vo({id:e,panelIds:t,storage:n}){const o=Ye(e,[]),r=n.getItem(o);if(r)try{const i=JSON.parse(r);if(t){const s=t.join(","),c=i[s];if(c&&Array.isArray(c.layout)&&t.length===c.layout.length){const a={};for(let u=0;u<t.length;u++)a[t[u]]=c.layout[u];return a}}else{const s=Object.keys(i);if(s.length===1){const c=i[s[0]];if(c&&Array.isArray(c.layout)){const a=s[0].split(",");if(a.length===c.layout.length){const u={};for(let l=0;l<a.length;l++)u[a[l]]=c.layout[l];return u}}}}}catch{}}function bo({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...r}){const i=n!==void 0,s="id"in r?r.id:r.groupId,c=Ye(s,n??[]),a=x.useSyncExternalStore(xo,()=>o.getItem(c),()=>o.getItem(c)),u=x.useMemo(()=>{if(a){const y=JSON.parse(a),h=Object.values(y);if(Array.from(h).every(S=>typeof S=="number"))return y}},[a]),l=x.useMemo(()=>{if(!u)return vo({id:s,panelIds:n,storage:o})},[u,s,n,o]),d=u??l,g=x.useRef(null),p=x.useCallback(()=>{const y=g.current;y&&(g.current=null,clearTimeout(y))},[]);x.useLayoutEffect(()=>()=>{p()},[p]);const m=x.useCallback((y,h)=>{if(t&&!h.isUserInteraction)return;p();const S=h.requestedLayout??y;let I;i?I=Ye(s,Object.keys(S)):I=Ye(s,[]);try{o.setItem(I,JSON.stringify(S))}catch(w){console.error(w)}},[p,i,s,t,o]),f=x.useCallback(y=>{p(),e===0?m(y,{isUserInteraction:!1}):g.current=setTimeout(()=>{m(y,{isUserInteraction:!1})},e)},[p,e,m]);return{defaultLayout:d,onLayoutChange:f,onLayoutChanged:m}}function xo(){return function(){}}function wo(){return x.useState(null)}function zo(){return x.useRef(null)}function Io(e,t){const{id:n}=Qe(),o=x.useRef({collapse:tt,expand:tt,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:tt});x.useImperativeHandle(t,()=>o.current,[]),ne(()=>{Object.assign(o.current,ht({axisId:n,itemId:e}))})}function vn({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:r=!1,defaultSize:i,disabled:s,elementRef:c,groupResizeBehavior:a="preserve-relative-size",id:u,maxSize:l="100%",minSize:d="0%",onResize:g,panelRef:p,style:m,...f}){const y=!!u,h=Me(u),S=Ze({disabled:s}),I=x.useRef(null),w=Fe(I,c),{getPanelStyles:E,id:N,orientation:O,registerPanel:b,updatePanelProps:z}=Qe(),v=g!==null,T=he((R,C,P)=>{g?.(R,u,P)});ne(()=>{const R=I.current;if(R!==null){const C={element:R,id:h,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:v?T:void 0,constraintProps:{groupResizeBehavior:a,collapsedSize:n,collapsedThreshold:o,collapsible:r,defaultSize:i,disabled:S.disabled,maxSize:l,minSize:d}};return b(C)}},[a,n,o,r,i,v,h,y,l,d,T,b,S]),x.useEffect(()=>{z(h,{disabled:s})},[s,h,z]),Io(h,p);const $=()=>{const R=E(N,h);if(R)return JSON.stringify(R)},M=x.useSyncExternalStore(R=>Ne(N,R),$,$);let D;return M?D=JSON.parse(M):i!==void 0?D={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:D={flexGrow:1},Y.jsx("div",{...f,"data-disabled":s||void 0,"data-panel":!0,"data-testid":h,id:h,ref:w,style:{...Co,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...D},children:Y.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:O==="horizontal"?"pan-y":"pan-x"},children:e})})}vn.displayName="Panel";const Co={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Lo(){return x.useState(null)}function Ro(){return x.useRef(null)}const Eo={flexBasis:"auto"},Mo={flexGrow:0,flexShrink:0};function bn({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:i,preview:s,style:c,...a}){const u=Me(i),{disableCursor:l,id:d,orientation:g,registerSeparator:p,updateSeparatorProps:m}=Qe();return Y.jsx(hn,{attributes:a,axisId:d,axisOrientation:g,className:t,disableCursor:l,disabled:n,disableDoubleClick:o,elementRef:r,id:u,preview:s,registerSeparator:p,requiredStyle:Mo,style:c,styleDefaults:Eo,updateSeparatorProps:m,children:e})}bn.displayName="Separator";exports.Cell=Jt;exports.Grid=gn;exports.Gridline=yt;exports.Group=Sn;exports.Panel=vn;exports.Separator=bn;exports.SeparatorOverlay=St;exports.isCoarsePointer=Zt;exports.useDefaultGridLayout=ao;exports.useDefaultLayout=bo;exports.useGridCallbackRef=lo;exports.useGridRef=uo;exports.useGroupCallbackRef=wo;exports.useGroupRef=zo;exports.usePanelCallbackRef=Lo;exports.usePanelRef=Ro;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),w=require("react");function Ke(e){return(typeof e=="number"||typeof e=="string")&&e!==""}function Ee(e){const t=w.useId();return Ke(e)?`${e}`:t}const ne=typeof window<"u"?w.useLayoutEffect:w.useEffect;function ge(e){const t=w.useRef(e);return ne(()=>{t.current=e},[e]),w.useCallback((...n)=>t.current?.(...n),[t])}function Fe(...e){return ge(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function _e(e,t){const n=e?.["data-testid"];return Ke(n)?`${n}`:Ke(t)?`${t}`:void 0}function rt(e,t){return t?e*2+1:e+1}function In(e,t){return t?e*2-1:e}function xt(e,t,n){const o=rt(e,n);return t===void 0?`${o} / -1`:`${o} / span ${In(t,n)}`}function Cn(e){return`${e*2} / span 1`}function Ln({crossCount:e,crossSpan:t,crossStart:n,hasGutters:o}){const r=t===void 0?e:n+t;if(n===0&&r===e)return"1 / -1";let i=rt(n,o),a=rt(r-1,o)+1;return o&&(n>0&&i--,r<e&&a++),`${i} / ${a}`}function ct(e,t){return Number.isInteger(e)&&e>=1&&e<t}function N(e,t="Assertion error"){if(!e)throw Error(t)}const Jt=w.createContext(null);function Zt(){const e=w.useContext(Jt);return N(e,"Grid Context not found; did you render a Cell or Gridline outside of a Grid?"),e}function Qt({children:e,className:t,column:n,columnSpan:o=1,elementRef:r,id:i,row:a,rowSpan:c=1,style:s,...u}){const l=Ee(i),{gutters:d,registerCell:h}=Zt(),p=w.useRef(null),m=Fe(p,r);return ne(()=>{const f=p.current;if(f!==null)return h({column:n,columnSpan:o,element:f,id:l,row:a,rowSpan:c})},[n,o,l,h,a,c]),W.jsx("div",{...u,className:t,"data-cell":!0,"data-testid":_e(u,i),id:l,ref:m,style:{overflow:"auto",...s,minHeight:0,minWidth:0,gridColumn:xt(n,o,d.column),gridRow:xt(a,c,d.row)},children:e})}Qt.displayName="Cell";let Ve;function en(){return Ve===void 0&&(typeof matchMedia=="function"?Ve=!!matchMedia("(pointer:coarse)").matches:Ve=!1),Ve}function it({expandHitTargets:e,axis:t,rect:n}){const o=e?en()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(n.width<o){const r=o-n.width;n=new DOMRect(n.x-r/2,n.y,n.width+r,n.height)}if(n.height<o){const r=o-n.height;n=new DOMRect(n.x,n.y-r/2,n.width,n.height+r)}return n}function wt({axis:e,cells:t,index:n,rect:o}){let r=[o];for(const i of t){const a=e==="column"?i.column:i.row,c=e==="column"?i.columnSpan:i.rowSpan;if(a>=n||a+c<=n)continue;const s=i.element.getBoundingClientRect(),u=e==="column"?s.top:s.left,l=e==="column"?s.bottom:s.right;l<=u||(r=r.flatMap(d=>{const h=e==="column"?d.top:d.left,p=e==="column"?d.bottom:d.right;if(u>=p||l<=h)return[d];const m=[],f=(y,g)=>{m.push(e==="column"?new DOMRect(d.x,y,d.width,g-y):new DOMRect(y,d.y,g-y,d.height))};return h<u&&f(h,u),p>l&&f(l,p),m}))}return r}function Rn({axis:e,cells:t,crossTrackCount:n,expandHitTargets:o,resizeAxis:r,axisSize:i,includeDisabled:a,separatorPlacements:c}){const{items:s,separators:u}=r,l=s.length;let d=-1,h=-1,p=0;if(s.forEach((x,z)=>{x.constraintProps.disabled||(p++,d===-1&&(d=z),h=z)}),!a&&p<2)return[];const m=x=>a||x>d&&x<=h,f=[],y=(x,z,v)=>({axis:r,axisSize:i,items:[s[x-1],s[x]],rect:z,separator:v}),g=(x,z)=>{let v;for(const P of t){const A=e==="column"?P.row:P.column,k=e==="column"?P.rowSpan:P.columnSpan;if(z==="start"?A===x:A+k-1===x){const O=P.element.getBoundingClientRect();if(z==="start"){const R=e==="column"?O.top:O.left;v=v===void 0?R:Math.min(v,R)}else{const R=e==="column"?O.bottom:O.right;v=v===void 0?R:Math.max(v,R)}}}return v},S=new Set;for(const x of u){const z=c.get(x);if(!z||z.index<1||z.index>=l||(S.add(z.index),!a&&(x.disabled||x.element.hasAttribute("aria-disabled")))||!m(z.index))continue;let v=x.element.getBoundingClientRect();const{crossSpan:P,crossStart:A}=z,k=P===void 0?n:A+P;let O=e==="column"?v.top:v.left,R=e==="column"?v.bottom:v.right;if(A>0){const C=g(A-1,"end");C!==void 0&&C<O&&(O=C)}if(k<n){const C=g(k,"start");C!==void 0&&C>R&&(R=C)}v=e==="column"?new DOMRect(v.x,O,v.width,R-O):new DOMRect(O,v.y,R-O,v.height),v=it({expandHitTargets:o,axis:r,rect:v}),a?f.push(y(z.index,v,x)):wt({axis:e,cells:t,index:z.index,rect:v}).forEach(C=>{f.push(y(z.index,C,x))})}const I=(x,z)=>{wt({axis:e,cells:t,index:x,rect:it({expandHitTargets:o,axis:r,rect:z})}).forEach(v=>{f.push(y(x,v))})},b=Array.from({length:n},()=>new Array(l));for(const x of t){const[z,v,P,A]=e==="column"?[x.column,x.columnSpan,x.row,x.rowSpan]:[x.row,x.rowSpan,x.column,x.columnSpan];for(let k=Math.max(0,P);k<Math.min(n,P+A);k++)for(let O=Math.max(0,z);O<Math.min(l,z+v);O++)b[k][O]??=x}const E=new Map,G=x=>{let z=E.get(x);if(!z){const v=x.element.getBoundingClientRect();z=e==="column"?{crossEnd:v.bottom,crossStart:v.top,end:v.right,start:v.left}:{crossEnd:v.right,crossStart:v.left,end:v.bottom,start:v.top},E.set(x,z)}return z},$=({crossEnd:x,crossStart:z,end:v,start:P})=>e==="column"?new DOMRect(P,z,v-P,x-z):new DOMRect(z,P,x-z,v-P);for(let x=1;x<l;x++){if(S.has(x)||!m(x))continue;let z;for(let v=0;v<n;v++){const P=b[v][x-1],A=b[v][x];let k;if((P||A)&&P!==A){const O=P?G(P):void 0,R=A?G(A):void 0,C=O?.end??R.start,M=R?.start??O.end,B=Math.max(O?.crossStart??-1/0,R?.crossStart??-1/0),Z=Math.min(O?.crossEnd??1/0,R?.crossEnd??1/0);k={crossEnd:Math.max(B,Z),crossStart:B,end:Math.max(C,M),start:Math.min(C,M)}}k?z=z?{crossEnd:Math.max(z.crossEnd,k.crossEnd),crossStart:Math.min(z.crossStart,k.crossStart),end:Math.max(z.end,k.end),start:Math.min(z.start,k.start)}:k:z&&(I(x,$(z)),z=void 0)}z&&I(x,$(z))}return f}function ce(e){const t=parseFloat(e??"");return Number.isFinite(t)?t:0}function En({axis:e,element:t,gutterSizes:n,hasGutters:o,layout:r,trackIds:i}){const a=i.length,c=o?a*2-1:a,s=t.ownerDocument.defaultView?.getComputedStyle(t),u=e==="column"?s?.gridTemplateColumns:s?.gridTemplateRows;if(u){const f=u.trim().split(/\s+/);if(f.length===c&&f.every(y=>/^-?[\d.]+px$/.test(y))){const y=i.map((g,S)=>ce(f[o?S*2:S]));return{availableSize:y.reduce((g,S)=>g+S,0),trackSizes:y}}}const l=e==="column"?t.offsetWidth:t.offsetHeight,d=e==="column"?ce(s?.paddingLeft)+ce(s?.paddingRight)+ce(s?.borderLeftWidth)+ce(s?.borderRightWidth):ce(s?.paddingTop)+ce(s?.paddingBottom)+ce(s?.borderTopWidth)+ce(s?.borderBottomWidth),h=ce(e==="column"?s?.columnGap:s?.rowGap),p=n.reduce((f,y)=>f+y,0),m=Math.max(0,l-d-h*Math.max(0,c-1)-p);return{availableSize:m,trackSizes:i.map(f=>r&&r[f]!==void 0?r[f]/100*m:m/a)}}function tn(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,"%"]}}}class nn{#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);return}let r;const i=Array.from(o);for(let a=0;a<i.length;a++){const c=i[a];try{c.call(null,n)}catch(s){r??={error:s}}}if(r)throw r.error}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}let q={cursorFlags:0,state:"inactive"};const lt=new nn;function re(){return q}function ut(e){return lt.addListener("change",e)}function Mn(e,t=[],n,o=!1){const r=q,i={...q};i.cursorFlags=e,i.state==="active"&&(i.didPointerMove||=o,i.previews=t,n&&(i.previewLayoutMap=n)),q=i,lt.emit("change",{prev:r,next:i})}function de(e){const t=q;q=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),lt.emit("change",{prev:t,next:e})}function Pn(e){q.state!=="active"||!q.previews.some(t=>t.separator===e)||de({...q,previews:q.previews.map(t=>t.separator===e?{...t}:t)})}function kn(e){if(q.state==="inactive")return;const t=q.hitRegions.filter(o=>o.axis!==e),n=q.state==="active"&&q.previews.some(o=>o.axis===e);if(!(t.length===q.hitRegions.length&&!n))if(t.length===0)de({cursorFlags:0,state:"inactive"});else if(q.state==="active"){const o=new Map(q.initialLayoutMap),r=new Map(q.previewLayoutMap);o.delete(e),r.delete(e),de({...q,cursorFlags:0,hitRegions:t,initialLayoutMap:o,previewLayoutMap:r,previews:q.previews.filter(i=>i.axis!==e)})}else de({...q,hitRegions:t})}const Tn=e=>e,ot=()=>{},on=1,rn=2,sn=4,an=8,zt=3,It=12;let Ue;function Ct(){return Ue===void 0&&(Ue=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ue=!0)),Ue}function Dn({cursorFlags:e,axes:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&Ct()){const i=(e&on)!==0,a=(e&rn)!==0,c=(e&sn)!==0,s=(e&an)!==0;if(i)return c?"se-resize":s?"ne-resize":"e-resize";if(a)return c?"sw-resize":s?"nw-resize":"w-resize";if(c)return"s-resize";if(s)return"n-resize"}break}}return Ct()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Lt=new WeakMap;function Rt(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Lt.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]));let o=re();switch(o.state!=="inactive"&&o.ownerDocument!==e&&(o={cursorFlags:0,state:"inactive"}),o.state){case"active":case"hover":{const r=Dn({cursorFlags:o.cursorFlags,axes:o.hitRegions.map(a=>a.axis),state:o.state}),i=`*, *:hover {cursor: ${r} !important; }`;if(t===i)return;t=i,r?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Lt.set(e,{prevStyle:t,styleSheet:n})}function Et(e){return e.state==="inactive"?void 0:e.ownerDocument}function An({next:e,prev:t}){const n=Et(t),o=Et(e);n&&n!==o&&Rt(n),o&&Rt(o)}function Re({axis:e}){const{layoutStrategy:t,orientation:n,items:o}=e;return t?t.calculateAvailableSize():o.reduce((r,i)=>(r+=n==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function dt(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_DISCONNECTED?0:n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}function $e(e,t){return Array.from(t).sort((n,o)=>{const r=e==="horizontal"?$n(n,o):On(n,o);return r!==0?r:dt(n.element,o.element)})}function $n(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function On(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function st(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function cn(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 Gn({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,i=Number.MAX_VALUE;for(const a of t){const{x:c,y:s}=cn(o,a),u=e==="horizontal"?c:s;u<i&&(i=u,r=a)}return N(r,"No rect found"),r}function ft({expandHitTargets:e=!0,axis:t,includeDisabled:n=!1}){if(t.layoutStrategy)return t.layoutStrategy.calculateHitRegions({expandHitTargets:e,axis:t,includeDisabled:n});const{element:o,orientation:r,items:i,separators:a}=t,c=$e(r,Array.from(o.children).filter(st).filter(g=>!g.hasAttribute("data-resize-preview")).map(g=>({element:g}))).map(({element:g})=>g),s=[];let u=!1,l=!1,d=-1,h,p=-1,m=0,f,y=[];{let g=-1;for(const S of c)S.hasAttribute("data-panel")&&(g++,S.hasAttribute("data-disabled")||(m++,d===-1&&(d=g),p=g))}if(n||m>1){let g=-1;for(const S of c)if(S.hasAttribute("data-panel")){g++;const I=i.find(b=>b.element===S);if(I){if(f){const b=f.element.getBoundingClientRect(),E=S.getBoundingClientRect();let G;if(l){const $=r==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),x=r==="horizontal"?new DOMRect(E.left,E.top,0,E.height):new DOMRect(E.left,E.top,E.width,0);switch(y.length){case 0:{G=[$,x];break}case 1:{const z=y[0],v=Gn({orientation:r,rects:[b,E],targetRect:z.element.getBoundingClientRect()});G=[z,v===b?x:$];break}default:{G=y;break}}}else y.length?G=y:G=[r==="horizontal"?new DOMRect(b.right,E.top,E.left-b.right,E.height):new DOMRect(E.left,b.bottom,E.width,E.top-b.bottom)];for(const $ of G){const x=it({expandHitTargets:e,axis:t,rect:"width"in $?$:$.element.getBoundingClientRect()}),z=g<=d||g>p;(n||!u&&!z)&&(h??=Re({axis:t}),s.push({axis:t,axisSize:h,items:[f,I],separator:"width"in $?void 0:$,rect:x})),u=!1}}l=!1,f=I,y=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(u=!0);const I=a.find(b=>b.element===S);I?y.push(I):(f=void 0,y=[])}else l=!0}return s}function Nn(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function jn(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function Fn(e){return e/100*window.innerHeight}function _n(e){return e/100*window.innerWidth}function ze({axisSize:e,itemElement:t,styleProp:n}){let o;const[r,i]=tn(n);switch(i){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=jn(t,r);break}case"em":{o=Nn(t,r);break}case"vh":{o=Fn(r);break}case"vw":{o=_n(r);break}}return o}function J(e){return parseFloat(e.toFixed(3))}function at(e){const{items:t}=e,n=Re({axis:e});return n===0?t.map(o=>({groupResizeBehavior:o.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:o.constraintProps.collapsible===!0,defaultSize:void 0,disabled:o.constraintProps.disabled,minSize:0,maxSize:100,itemId:o.id})):t.map(o=>{const{element:r,constraintProps:i}=o;let a=0;if(i.collapsedSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.collapsedSize});a=J(d/n*100)}let c;if(i.collapsedThreshold!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.collapsedThreshold});c=J(d/n*100)}let s;if(i.defaultSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.defaultSize});s=J(d/n*100)}let u=0;if(i.minSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.minSize});u=J(d/n*100)}let l=100;if(i.maxSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.maxSize});l=J(d/n*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:a,collapsedThreshold:c,collapsible:i.collapsible===!0,defaultSize:s,disabled:i.disabled,minSize:u,maxSize:l,itemId:o.id}})}let ue=new Map;const mt=new nn;let Oe=0;const We=[];let Ye;function Je(){Oe++}function pt(){for(let e=0;e<We.length;e++)try{mt.emit("axisChange",We[e])}catch(t){Ye??={error:t}}We.length=0}function Ze(){if(Oe===1&&pt(),Oe--,Oe===0&&Ye){const{error:e}=Ye;throw Ye=void 0,e}}function Bn(e){ue=new Map(ue),ue.delete(e)}function Ce(e,t){for(const[n]of ue)if(n.id===e)return n}function ae(e,t){for(const[n,o]of ue)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function he(){return ue}function Ne(e,t){return mt.addListener("axisChange",n=>{n.axis.id===e&&t(n)})}function fe(e,t,n){const o=ue.get(e);ue=new Map(ue),ue.set(e,t);const r={axis:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t};Oe>0?We.push(r):mt.emit("axisChange",r)}function ln(e,{pointerId:t,pointerType:n}){return t===e.pointerId||n==="pen"&&e.pointerType==="pen"}function Qe(e,t,n={}){return e.ownerDocument===t&&(n.pointerId===void 0||ln(e,n))}function qn(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 Y(e,t,n=0){return Math.abs(J(e)-J(t))<=n}function le(e,t){return Y(e,t)?0:e>t?1:-1}function Le({overrideDisabledItems:e,itemConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsedThreshold:i,collapsible:a,disabled:c,maxSize:s=100,minSize:u=0}=t;if(c&&!e)return n;if(le(o,u)<0)if(a){const l=i??(u-r)/2,d=le(n,r)<=0,h=d?r+l:u-l,p=le(o,h);le(o,r)<=0||p<0||i!==void 0&&d&&p===0?o=r:o=u}else o=u;return o=Math.min(s,o),o=J(o),o}function je({delta:e,initialLayout:t,itemConstraints:n,pivotIndices:o,prevLayout:r,trigger:i}){if(Y(e,0))return t;const a=i==="imperative-api",c=n.map(({itemId:m})=>t[m]),s=n.map(({itemId:m})=>r[m]),u=[...c],[l,d]=o;N(l!=null,"Invalid first pivot index"),N(d!=null,"Invalid second pivot index");let h=0;switch(i){case"keyboard":{{const m=e<0?d:l,f=n[m];N(f,`Panel constraints not found for index ${m}`);const{collapsedSize:y=0,collapsible:g,minSize:S=0}=f;if(g){const I=c[m];if(N(I!=null,`Previous layout not found for panel index ${m}`),Y(I,y)){const b=S-I;le(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const m=e<0?l:d,f=n[m];N(f,`No panel constraints found for index ${m}`);const{collapsedSize:y=0,collapsible:g,minSize:S=0}=f;if(g){const I=c[m];if(N(I!=null,`Previous layout not found for panel index ${m}`),Y(I,S)){const b=I-y;le(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}break}default:{const m=e<0?d:l,f=n[m];N(f,`Panel constraints not found for index ${m}`);const y=c[m],{collapsedSize:g,collapsedThreshold:S,collapsible:I,minSize:b}=f;if(I&&le(y,b)<0){const E=b-g,G=S??E/2,$=y+Math.abs(e);if(le($,b)<0){const x=le(Math.abs(e),G),z=S===void 0&&e<0;x>0||x===0&&z?e=e<0?-E:E:e=0}}break}}{const m=e<0?1:-1;let f=e<0?d:l,y=0;for(;;){const S=c[f];N(S!=null,`Previous layout not found for panel index ${f}`);const b=Le({overrideDisabledItems:a,itemConstraints:n[f],prevSize:S,size:100})-S;if(y+=b,f+=m,f<0||f>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-g:g}{let f=e<0?l:d;for(;f>=0&&f<n.length;){const y=Math.abs(e)-Math.abs(h),g=c[f];N(g!=null,`Previous layout not found for panel index ${f}`);const S=g-y,I=Le({overrideDisabledItems:a,itemConstraints:n[f],prevSize:g,size:S});if(!Y(g,I)&&(h+=g-I,u[f]=I,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?f--:f++}}if(qn(s,u))return r;{const m=e<0?d:l,f=c[m];N(f!=null,`Previous layout not found for panel index ${m}`);const y=f+h,g=Le({overrideDisabledItems:a,itemConstraints:n[m],prevSize:f,size:y});if(u[m]=g,!Y(g,y)){let S=y-g,b=e<0?d:l;for(;b>=0&&b<n.length;){const E=u[b];N(E!=null,`Previous layout not found for panel index ${b}`);const G=E+S,$=Le({overrideDisabledItems:a,itemConstraints:n[b],prevSize:E,size:G});if(Y(E,$)||(S-=$-E,u[b]=$),Y(S,0))break;e>0?b--:b++}}}const p=Object.values(u).reduce((m,f)=>f+m,0);return Y(p,100,.1)?u.reduce((m,f,y)=>(m[n[y].itemId]=f,m),{}):r}function ie(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||le(e[n],t[n])!==0)return!1;return!0}function ht(e){Je();try{Hn(e)}finally{Ze()}}function Hn({commit:e,event:t,hitRegions:n,initialLayoutMap:o,mountedAxes:r,pointerDownAtPoint:i,prevCursorFlags:a}){let c=0;const s=re();let u=s.state==="active"?s.previews:[];const l=new Map(s.state==="active"?s.previewLayoutMap:void 0);n.forEach(p=>{const{axis:m,axisSize:f}=p,{orientation:y,items:g}=m;if(e&&m.resizePreviewMode!=="separator")return;const{disableCursor:S}=m.mutableState;let I=0;i?y==="horizontal"?I=(t.clientX-i.x)/f*100:I=(t.clientY-i.y)/f*100:y==="horizontal"?I=t.clientX<0?-100:100:I=t.clientY<0?-100:100;const b=o.get(m),E=r.get(m);if(!b||!E)return;const{defaultLayoutDeferred:G,derivedItemConstraints:$,axisSize:x,layout:z,separatorToItems:v}=E;if($&&z&&v){const P=m.resizePreviewMode==="separator"?l.get(m)??z:z,A=je({delta:I,initialLayout:b,itemConstraints:$,pivotIndices:p.items.map(k=>g.indexOf(k)),prevLayout:P,trigger:"mouse-or-touch"});if(m.resizePreviewMode==="separator"&&!e&&!ie(A,P)){l.set(m,A);let k=0;const O=g.map(R=>(k+=A[R.id]-b[R.id],k*(f/100)));u=u.map(R=>{if(R.axis!==m)return R;const C=O[R.itemIndex];return C===R.offset?R:{...R,offset:C}})}if(ie(A,P)&&I!==0&&!S)switch(y){case"horizontal":{c|=I<0?on:rn;break}case"vertical":{c|=I<0?sn:an;break}}(m.resizePreviewMode!=="separator"||e)&&!ie(A,z)&&fe(p.axis,{defaultLayoutDeferred:G,derivedItemConstraints:$,axisSize:x,layout:A,requestedAxisSize:x,requestedLayout:A,separatorToItems:v})}});let d=0;t.movementX===0?d|=a&zt:d|=c&zt,t.movementY===0?d|=a&It:d|=c&It;const h=s.state==="active"&&(t.clientX!==s.pointerDownAtPoint.x||t.clientY!==s.pointerDownAtPoint.y);Mn(d,u,l,h)}function un(e,t){const n=re();if(n.state!=="active"||!Qe(n,e,t))return;const o=he();Je();try{ht({commit:!0,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),pt(),de({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(t.preventDefault?.(),n.hitRegions.forEach(r=>{if(!o.has(r.axis))return;const i=ae(r.axis.id,!0);fe(r.axis,i,{isUserInteraction:!0})}))}finally{Ze()}}function Mt(e){if(e.defaultPrevented)return;const{clientX:t,clientY:n,movementX:o,movementY:r}=e;un(e.currentTarget,{clientX:t,clientY:n,movementX:o,movementY:r})}function Vn(e,t,n){let o,r={x:1/0,y:1/0};for(const i of t){const a=cn(n,i.rect);switch(e){case"horizontal":{(a.x<r.x||a.x===r.x&&a.y<=r.y)&&(o=i,r=a);break}case"vertical":{(a.y<r.y||a.y===r.y&&a.x<=r.x)&&(o=i,r=a);break}}}return o?{distance:r,hitRegion:o}:void 0}function Un(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Wn(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Tt(e),b:Tt(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();N(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:kt(Pt(n.a)),b:kt(Pt(n.b))};if(r.a===r.b){const i=o.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const s=i[c];if(s===a.a)return 1;if(s===a.b)return-1}}return Math.sign(r.a-r.b)}const Yn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Xn(e){const t=getComputedStyle(dn(e)??e).display;return t==="flex"||t==="inline-flex"}function Kn(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Xn(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"||Yn.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Pt(e){let t=e.length;for(;t--;){const n=e[t];if(N(n,"Missing node"),Kn(n))return n}return null}function kt(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Tt(e){const t=[];for(;e;)t.push(e),e=dn(e);return t}function dn(e){const{parentNode:t}=e;return Un(t)?t.host:t}function Jn(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 Zn(e){try{return e.matches(":modal")}catch{return!1}}function Qn({axisElement:e,hitRegion:t,pointerEventTarget:n}){if(st(n)){const o=n.closest("dialog");if(o&&!o.contains(e)&&Zn(o))return!1}if(!st(n)||n.contains(e)||e.contains(n))return!0;if(Wn(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Jn(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function gt(e,t,n){const o=[];return t.forEach((r,i)=>{if(i.disabled||i.element.ownerDocument!==n)return;const a=ft({axis:i}),c=Vn(i.orientation,a,{x:e.clientX,y:e.clientY});c&&c.distance.x<=0&&c.distance.y<=0&&Qn({axisElement:i.element,hitRegion:c.hitRegion.rect,pointerEventTarget:e.target})&&o.push(c.hitRegion)}),o}function ye({layout:e,itemConstraints:t}){const n=t.map(({itemId:a})=>e[a]),o=[...n],r=o.reduce((a,c)=>a+c,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(a=>`${a}%`).join(", ")}`);if(!Y(r,100)&&o.length>0)for(let a=0;a<t.length;a++){const c=o[a];N(c!=null,`No layout data found for index ${a}`);const s=100/r*c;o[a]=s}let i=0;for(let a=0;a<t.length;a++){const c=n[a];N(c!=null,`No layout data found for index ${a}`);const s=o[a];N(s!=null,`No layout data found for index ${a}`);const u=Le({overrideDisabledItems:!0,itemConstraints:t[a],prevSize:c,size:s});s!=u&&(i+=s-u,o[a]=u)}if(!Y(i,0))for(let a=0;a<t.length;a++){const c=o[a];N(c!=null,`No layout data found for index ${a}`);const s=c+i,u=Le({overrideDisabledItems:!0,itemConstraints:t[a],prevSize:c,size:s});if(c!==u&&(i-=u-c,o[a]=u,Y(i,0)))break}return o.reduce((a,c,s)=>(a[t[s].itemId]=c,a),{})}function yt({axisId:e,itemId:t}){const n=()=>{const s=he();for(const[u,{defaultLayoutDeferred:l,derivedItemConstraints:d,layout:h,axisSize:p,separatorToItems:m}]of s)if(u.id===e)return{defaultLayoutDeferred:l,derivedItemConstraints:d,axis:u,axisSize:p,layout:h,separatorToItems:m};throw Error(`Group ${e} not found`)},o=()=>{const s=n().derivedItemConstraints.find(u=>u.itemId===t);if(s!==void 0)return s;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const s=n().axis.items.find(u=>u.id===t);if(s!==void 0)return s;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const s=n().layout[t];if(s!==void 0)return s;throw Error(`Layout not found for Panel ${t}`)},a=({nextSize:s,items:u,prevLayout:l,derivedItemConstraints:d})=>{const h=i(),p=u.findIndex(g=>g.id===t),m=p===0,f=p===u.length-1;if(f&&s<h&&(m||u.slice(0,p).every((g,S)=>{const I=d[S];return I?.collapsible&&Y(I.collapsedSize,l[I.itemId])}))){const g=u.slice(0,p).reduce((S,I)=>S+l[I.id],0);return{...l,[t]:J(100-g)}}return je({delta:f?h-s:s-h,initialLayout:l,itemConstraints:d,pivotIndices:f?[p-1,p]:[p,p+1],prevLayout:l,trigger:"imperative-api"})},c=s=>{const u=i();if(s===u)return;const{defaultLayoutDeferred:l,derivedItemConstraints:d,axis:h,axisSize:p,layout:m,separatorToItems:f}=n(),y=a({nextSize:s,items:h.items,prevLayout:m,derivedItemConstraints:d}),g=ye({layout:y,itemConstraints:d});ie(m,g)||fe(h,{defaultLayoutDeferred:l,derivedItemConstraints:d,axisSize:p,layout:g,requestedAxisSize:p,requestedLayout:g,separatorToItems:f})};return{collapse:()=>{const{collapsible:s,collapsedSize:u}=o(),{mutableValues:l}=r(),d=i();s&&d!==u&&(l.expandToSize=d,c(u))},expand:()=>{const{collapsible:s,collapsedSize:u,minSize:l}=o(),{mutableValues:d}=r(),h=i();if(s&&h===u){let p=d.expandToSize??l;p===0&&(p=1),c(p)}},getSize:()=>{const{axis:s}=n(),u=i(),{element:l}=r(),d=s.layoutStrategy?s.layoutStrategy.getItemSizeInPixels(t):s.orientation==="horizontal"?l.offsetWidth:l.offsetHeight;return{asPercentage:u,inPixels:d}},isCollapsed:()=>{const{collapsible:s,collapsedSize:u}=o(),l=i();return s&&Y(u,l)},resize:s=>{const{axis:u}=n(),{element:l}=r(),d=Re({axis:u}),h=ze({axisSize:d,itemElement:l,styleProp:s}),p=J(h/d*100);c(p)}}}function Dt(e){if(e.defaultPrevented)return;const t=he();gt(e,t,e.currentTarget).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const r=o.items.find(i=>i.constraintProps.defaultSize!==void 0);if(r){const i=r.constraintProps.defaultSize,a=yt({axisId:o.axis.id,itemId:r.id});a&&i!==void 0&&(a.resize(i),e.preventDefault())}}})}function fn(e){const t=he();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 Ge({axisId:e}){const t=()=>{const n=he();for(const[o,r]of n)if(o.id===e)return{axis:o,...r};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,derivedItemConstraints:r,axis:i,axisSize:a,layout:c,separatorToItems:s}=t(),u=ye({layout:n,itemConstraints:r});return o?c:(ie(c,u)||fe(i,{defaultLayoutDeferred:o,derivedItemConstraints:r,axisSize:a,layout:u,requestedAxisSize:a,requestedLayout:u,separatorToItems:s}),u)}}}function ve(e,t){const n=fn(e),o=ae(n.id,!0),r=n.separators.find(d=>d.element===e);N(r,"Matching separator not found");const i=o.separatorToItems.get(r);N(i,"Matching panels not found");const a=i.map(d=>n.items.indexOf(d)),s=Ge({axisId:n.id}).getLayout(),u=je({delta:t,initialLayout:s,itemConstraints:o.derivedItemConstraints,pivotIndices:a,prevLayout:s,trigger:"keyboard"}),l=ye({layout:u,itemConstraints:o.derivedItemConstraints});ie(s,l)||fe(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedItemConstraints:o.derivedItemConstraints,axisSize:o.axisSize,layout:l,requestedAxisSize:o.axisSize,requestedLayout:l,separatorToItems:o.separatorToItems},{isUserInteraction:!0})}function At(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=fn(t);if(!(n.disabled||n.separators.find(r=>r.element===t)?.disabled))switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&ve(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&ve(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&ve(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&ve(t,-5);break}case"End":{e.preventDefault(),ve(t,100);break}case"Enter":{e.preventDefault();const r=ae(n.id,!0),{derivedItemConstraints:i,layout:a,separatorToItems:c}=r,s=n.separators.find(h=>h.element===t);N(s,"Matching separator not found");const u=c.get(s);N(u,"Matching panels not found");const l=u[0],d=i.find(h=>h.itemId===l.id);if(N(d,"Panel metadata not found"),d.collapsible){const h=a[l.id],p=d.collapsedSize===h?n.mutableState.expandedItemSizes[l.id]??d.minSize:d.collapsedSize;ve(t,p-h)}break}case"F6":{e.preventDefault();const r=n.separators.map(s=>s.element),i=Array.from(r).findIndex(s=>s===e.currentTarget);N(i!==null,"Index not found");const a=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),ve(t,-100);break}}}function Me(e,t){const n=re();if(n.state!=="active"||!Qe(n,e,t))return!1;const o=he();Je();try{n.previewLayoutMap.forEach((r,i)=>{const a=o.get(i);i.resizePreviewMode==="separator"&&a&&!ie(r,a.layout)&&fe(i,{...a,layout:r,requestedAxisSize:a.axisSize,requestedLayout:r})}),pt(),de({cursorFlags:0,state:"inactive"}),n.hitRegions.forEach(r=>{if(!o.has(r.axis))return;const i=ae(r.axis.id,!0);fe(r.axis,i,{isUserInteraction:!0})})}finally{Ze()}return!0}function $t(e){const t=re();if(t.state!=="active")return;const n=t.hitRegions.flatMap(({separator:o})=>o?[o.element]:[]);!n.some(o=>o===e.target)||n.some(o=>o.hasPointerCapture?.(e.pointerId))||Me(e.currentTarget,e)}function Ot(e){Me(e.currentTarget,e)}function eo(e,t){const{element:n,orientation:o,items:r}=e,i=n.getBoundingClientRect(),a=o==="horizontal";return ft({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:s,rect:u,separator:l},d)=>{const h=r.indexOf(s[0]),p=a?u.left+u.width/2:u.top+u.height/2;return{active:t.some(f=>{if(f.axis!==e||f.items[0]!==s[0])return!1;if(l||f.separator)return f.separator===l;const y=a?f.rect.left+f.rect.width/2:f.rect.top+f.rect.height/2;return Y(p,y)}),axis:e,key:l?`separator-${l.id}`:`panel-${s[0].id}-${d}`,offset:0,itemIndex:h,rect:new DOMRect((a&&!l?p:u.left)-i.left-n.clientLeft+n.scrollLeft,(!a&&!l?p:u.top)-i.top-n.clientTop+n.scrollTop,a&&!l?0:u.width,!a&&!l?0:u.height),separator:l}})}function Gt(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=re();if(t.state==="active"){ln(t,e)&&Me(t.ownerDocument,t);return}const n=he(),o=gt(e,n,e.currentTarget);if(o.length===0)return;const r=new Map;let i=!1;o.forEach(c=>{c.separator&&(i||(i=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const s=n.get(c.axis);s&&r.set(c.axis,s.layout)});const a=Array.from(r.keys()).flatMap(c=>c.resizePreviewMode==="separator"?eo(c,o):[]);de({cursorFlags:0,didPointerMove:!1,hitRegions:o,initialLayoutMap:r,ownerDocument:e.currentTarget,pointerDownAtPoint:{x:e.clientX,y:e.clientY},pointerId:e.pointerId,pointerType:e.pointerType,previewLayoutMap:new Map(r),previews:a,state:"active"}),e.preventDefault()}function Nt(e){const t=e.currentTarget,n=he(),o=re();switch(o.state){case"active":{if(!Qe(o,t,e))return;ht({commit:!1,event:e,hitRegions:o.hitRegions,initialLayoutMap:o.initialLayoutMap,mountedAxes:n,prevCursorFlags:o.cursorFlags})}}}function jt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=re(),o=he();switch(n.state){case"active":{if(!Qe(n,t,e))return;if(e.buttons===0){Me(t,e);return}for(const r of n.hitRegions)if(r.separator){const{element:i}=r.separator;i.isConnected&&!i.hasPointerCapture?.(e.pointerId)&&i.setPointerCapture?.(e.pointerId)}ht({commit:!1,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const r=gt(e,o,t);r.length===0?n.state!=="inactive"&&de({cursorFlags:0,state:"inactive"}):de({cursorFlags:0,hitRegions:r,ownerDocument:t,state:"hover"});break}}}function Ft(e){if(e.relatedTarget instanceof HTMLIFrameElement){const t=re();switch(t.state){case"hover":t.ownerDocument===e.currentTarget&&de({cursorFlags:0,state:"inactive"})}}}function _t(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||un(e.currentTarget,e)}function Bt(e){e.target===e.currentTarget&&Me(e.currentTarget.document)}function qt(e){Me(e.currentTarget.document)}function to(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const a=J(i.defaultSize);n+=a,o[i.itemId]=a}else o[i.itemId]=void 0;const r=e.length-t;if(r!==0){const i=J((100-n)/r);for(const a of e)a.defaultSize===void 0&&(o[a.itemId]=i)}return o}function no(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}function Ht({axis:e,itemConstraints:t}){const n=e.items.map(({id:r})=>r).join(","),o=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(o&&no(e.items,o)?o:to(t))}function Vt({itemIds:e,layout:t}){return ye({layout:t,itemConstraints:e.map(n=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:n,maxSize:100,minSize:0}))})}function oo(e,t,n){if(!n[0])return;const r=e.items.find(u=>u.element===t);if(!r||!r.onResize)return;const i=Re({axis:e}),a=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,c=r.mutableValues.prevSize,s={asPercentage:J(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,c)}function mn(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 ro(e,t){return e.length!==t.length?!1:e.every((n,o)=>mn(n,t[o]))}function io({axis:e,nextAxisSize:t,prevAxisSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,i=0,a=!1;const c=new Map,s=[];for(const d of e.items){const h=o[d.id]??0;switch(d.constraintProps.groupResizeBehavior){case"preserve-pixel-size":{a=!0;const p=h/100*n,m=J(p/t*100);c.set(d.id,m),r+=m;break}case"preserve-relative-size":default:{s.push(d.id),i+=h;break}}}if(!a||s.length===0)return o;const u=100-r,l={...o};if(c.forEach((d,h)=>{l[h]=d}),i>0)for(const d of s){const h=o[d]??0;l[d]=J(h/i*u)}else{const d=J(u/s.length);for(const h of s)l[h]=d}return l}const we=new Map;let Ut=!1;function pn(e){let t=!0;N(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,i=new n(m=>{let f;Je();try{for(const y of m){const{borderBoxSize:g,target:S}=y;if(S===e.element){if(t){const I=Re({axis:e});if(I===0)break;const b=ae(e.id);if(!b)break;const E=at(e);let G=b.requestedAxisSize,$=b.requestedLayout;b.defaultLayoutDeferred&&(G=I,$=Vt({itemIds:e.items.map(({id:v})=>v),layout:Ht({axis:e,itemConstraints:E})}));const x=io({axis:e,nextAxisSize:I,prevAxisSize:G,prevLayout:$}),z=ye({layout:x,itemConstraints:E});if(!b.defaultLayoutDeferred&&ie(b.layout,z)&&ro(b.derivedItemConstraints,E)&&b.axisSize===I)continue;fe(e,{defaultLayoutDeferred:!1,derivedItemConstraints:E,axisSize:I,layout:z,requestedAxisSize:G,requestedLayout:$,separatorToItems:b.separatorToItems})}}else try{oo(e,S,g)}catch(I){f??={error:I}}}}finally{Ze()}if(f)throw f.error});i.observe(e.element),e.items.forEach(m=>{N(!o.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),o.add(m.id),m.onResize&&i.observe(m.element)});const a=Re({axis:e}),c=at(e),s=Ht({axis:e,itemConstraints:c}),u=ye({layout:s,itemConstraints:c}),l=e.element.ownerDocument,d=l.defaultView;we.set(l,(we.get(l)??0)+1);const h=new Map;return ft({axis:e,includeDisabled:!0}).forEach(m=>{m.separator&&h.set(m.separator,m.items)}),fe(e,{defaultLayoutDeferred:a===0,derivedItemConstraints:c,axisSize:a,layout:u,requestedAxisSize:a,requestedLayout:Vt({itemIds:e.items.map(({id:m})=>m),layout:s}),separatorToItems:h}),e.separators.forEach(m=>{N(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",At)}),Ut||(Ut=!0,ut(An)),we.get(l)===1&&(l.addEventListener("contextmenu",Mt,!0),l.addEventListener("dblclick",Dt,!0),l.addEventListener("lostpointercapture",$t,!0),l.addEventListener("pointercancel",Ot,!0),l.addEventListener("pointerdown",Gt,!0),l.addEventListener("pointerleave",Nt),l.addEventListener("pointermove",jt),l.addEventListener("pointerout",Ft),l.addEventListener("pointerup",_t,!0),d?.addEventListener("blur",Bt),d?.addEventListener("pagehide",qt)),function(){t=!1,we.set(l,Math.max(0,(we.get(l)??0)-1)),Bn(e),kn(e),e.separators.forEach(f=>{f.element.removeEventListener("keydown",At)}),we.get(l)||(l.removeEventListener("contextmenu",Mt,!0),l.removeEventListener("dblclick",Dt,!0),l.removeEventListener("lostpointercapture",$t,!0),l.removeEventListener("pointercancel",Ot,!0),l.removeEventListener("pointerdown",Gt,!0),l.removeEventListener("pointerleave",Nt),l.removeEventListener("pointermove",jt),l.removeEventListener("pointerout",Ft),l.removeEventListener("pointerup",_t,!0),d?.removeEventListener("blur",Bt),d?.removeEventListener("pagehide",qt)),i.disconnect()}}function hn({derivedItemConstraints:e,axis:t,layout:n,prevLayout:o,requestedLayout:r}){const i=t.items.map(({id:a})=>a).join(",");t.mutableState.layouts[i]=r,o&&e.forEach(a=>{if(a.collapsible){const c=Y(a.collapsedSize,n[a.itemId]),s=Y(a.collapsedSize,o[a.itemId]);c&&!s&&(t.mutableState.expandedItemSizes[a.itemId]=o[a.itemId])}})}function gn(){const[e,t]=w.useState({}),n=w.useCallback(()=>t({}),[]);return[e,n]}function et(e){const t=w.useRef({...e});return ne(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const St=w.createContext(null);function so({layout:e,itemConstraints:t,itemId:n,itemIndex:o}){let r,i;const a=e[n],c=t.find(s=>s.itemId===n);if(c){const s=c.maxSize,u=c.collapsible?c.collapsedSize:c.minSize,l=[o,o+1];i=ye({layout:je({delta:u-a,initialLayout:e,itemConstraints:t,pivotIndices:l,prevLayout:e}),itemConstraints:t})[n],r=ye({layout:je({delta:s-a,initialLayout:e,itemConstraints:t,pivotIndices:l,prevLayout:e}),itemConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:i,valueNow:a}}function yn({attributes:e,axisId:t,axisOrientation:n,children:o,className:r,"data-testid":i,disableCursor:a,disabled:c,disableDoubleClick:s,elementRef:u,id:l,isSharedHitRegion:d,preview:h,registerSeparator:p,requiredStyle:m,style:f,styleDefaults:y,tabIndex:g=0,updateSeparatorProps:S}){const I=et({disabled:c,disableDoubleClick:s,children:o,className:r,preview:h,style:f}),[b,E]=w.useState({}),[G,$]=w.useState("inactive"),[x,z]=w.useState(!1),v=w.useRef(null),P=w.useRef(null),A=Fe(v,u),k=n==="horizontal"?"vertical":"horizontal";ne(()=>{const C=v.current;if(C!==null){const M={disabled:I.disabled,disableDoubleClick:I.disableDoubleClick,element:C,id:l,get children(){return I.children},get className(){return I.className},get preview(){return I.preview},get style(){return I.style}};P.current=M;const B=p(M),Z=ut(K=>{$(K.next.state!=="inactive"&&K.next.hitRegions.some(se=>se.separator===M||(d?.(se)??!1))?K.next.state:"inactive")}),X=Ne(t,K=>{const{derivedItemConstraints:se,layout:be,separatorToItems:Pe}=K.next,xe=Pe.get(M);if(xe){const L=xe[0],T=se.findIndex(j=>j.itemId===L.id),{layoutStrategy:F}=K.axis;E({...so({layout:be,itemConstraints:se,itemId:L.id,itemIndex:T}),...F?.getItemAriaControls&&{valueControls:F.getItemAriaControls(L.id)}})}});return()=>{P.current=null,Z(),X(),B()}}},[t,l,d,p,I]),ne(()=>{const C=P.current;C&&Pn(C)},[h]),w.useEffect(()=>{S(l,{disabled:c,disableDoubleClick:s})},[c,s,l,S]);let O;c&&!a&&(O="not-allowed");let R;if(c)R="disabled";else switch(G){case"active":{R="active";break}default:x?R="focus":R=G}return W.jsx("div",{...e,"aria-controls":b.valueControls,"aria-disabled":c||void 0,"aria-orientation":k,"aria-valuemax":b.valueMax,"aria-valuemin":b.valueMin,"aria-valuenow":b.valueNow,children:o,className:r,"data-separator":R,"data-testid":i,id:l,onBlur:()=>z(!1),onFocus:()=>z(!0),ref:A,role:"separator",style:{...y,cursor:O,...f,...m,touchAction:"none"},tabIndex:c?void 0:g})}function Wt({axis:e,children:t,className:n,crossSpan:o,crossStart:r,disabled:i,elementRef:a,index:c,style:s}){const u=Ee(void 0),{getDisableCursor:l,getResizeAxisId:d,gutters:h,registerSeparator:p,separatorPlacements:m,trackCounts:f,updateSeparatorProps:y}=Zt(),g=d(e),S=e==="column"?"row":"column",I=f[S],b=!!i||!ct(c,f[e]);let E=!0;for(const v of m.values())if(v.axis===e&&v.index===c&&!v.disabled&&v.crossStart<r){E=!1;break}const G=w.useCallback(v=>v.axis.id===g&&v.axis.items.indexOf(v.items[1])===c,[g,c]),$=w.useCallback(v=>p({axis:e,crossSpan:o,crossStart:r,disabled:!!i,index:c},v),[e,o,r,i,c,p]),x=Cn(c),z=Ln({crossCount:I,crossSpan:o,crossStart:r,hasGutters:h[S]});return W.jsx(yn,{axisId:g,axisOrientation:e==="column"?"horizontal":"vertical",className:n,disableCursor:l(),disabled:b,disableDoubleClick:void 0,elementRef:a,id:u,isSharedHitRegion:G,registerSeparator:$,requiredStyle:{gridColumn:e==="column"?x:z,gridRow:e==="row"?x:z},style:s,tabIndex:E?0:-1,updateSeparatorProps:y,children:t})}function vt(e){const{children:t,className:n,disabled:o,elementRef:r,style:i}=e;return e.type==="column"?W.jsx(Wt,{axis:"column",className:n,crossSpan:e.rowSpan,crossStart:e.row??0,disabled:o,elementRef:r,index:e.column,style:i,children:t}):W.jsx(Wt,{axis:"row",className:n,crossSpan:e.columnSpan,crossStart:e.column??0,disabled:o,elementRef:r,index:e.row,style:i,children:t})}vt.displayName="Gridline";const Ie=["column","row"],Yt={columns:{},rows:{}};function Sn({children:e,className:t,columns:n,defaultLayout:o,disableCursor:r,disabled:i,elementRef:a,gridRef:c,id:s,onLayoutChange:u,onLayoutChanged:l,resizeTargetMinimumSize:d={coarse:20,fine:10},rows:h,style:p,...m}){const f=Ee(s),y=w.useCallback(L=>L==="column"?`${f}:columns`:`${f}:rows`,[f]),g=Xt(n,"columns"),S=Xt(h,"rows"),I=L=>L==="column"?g:S,b=w.useRef({onLayoutChange:Yt,onLayoutChanged:Yt}),E=ge(L=>{Kt(b.current.onLayoutChange,L)||(b.current.onLayoutChange=L,u?.(L))}),G=ge((L,T,F)=>{Kt(b.current.onLayoutChanged,L)||(b.current.onLayoutChanged=L,l?.(L,{isUserInteraction:T,requestedLayout:F}))}),$=w.useRef(null),x=Fe($,a),[z,v]=gn(),P=w.useRef({cells:[],column:{expandedItemSizes:{},layouts:{}},loggedErrors:new Set,row:{expandedItemSizes:{},layouts:{}},separators:new Map}),A={column:!1,row:!1};for(const L of P.current.separators.values())A[L.axis]=!0;vn(e,A);const k=et({defaultLayout:o,disableCursor:r,resizeTargetMinimumSize:d}),O=ge(()=>!!k.disableCursor),R=w.useCallback(L=>{const T=P.current;return T.cells=[...T.cells,L],v(),()=>{T.cells=T.cells.filter(F=>F!==L),v()}},[v]),C=w.useCallback((L,T)=>{const F=P.current;return F.separators=new Map(F.separators),F.separators.set(T,L),v(),()=>{F.separators=new Map(F.separators),F.separators.delete(T),v()}},[v]),M=w.useCallback((L,{disabled:T,disableDoubleClick:F})=>{for(const j of P.current.separators.keys())j.id===L&&(j.disabled=T,j.disableDoubleClick=F)},[]),B=P.current.separators,Z=w.useMemo(()=>({getDisableCursor:O,getResizeAxisId:y,gutters:{column:A.column,row:A.row},id:f,registerCell:R,registerSeparator:C,separatorPlacements:B,trackCounts:{column:g.length,row:S.length},updateSeparatorProps:M}),[g.length,O,y,A.column,A.row,f,R,C,S.length,B,M]),X=w.useRef([]);ne(()=>{const L=$.current;if(L===null)return;const T=P.current,F=co({cells:T.cells,separatorPlacements:T.separators,trackCounts:{column:g.length,row:S.length}});F.forEach(D=>{T.loggedErrors.has(D)||console.error(D)}),T.loggedErrors=new Set(F);const j=D=>Array.from(T.separators.entries()).filter(([,U])=>U.axis===D).sort(([,U],[,me])=>U.index-me.index).map(([U])=>U),_=D=>{const U=D==="column"?g:S,me=D==="column"?S:g,pe=U.map(Q=>Q.id),Be=y(D),qe=j(D),Se=qe.length>0,He=U.map(({id:Q,...oe},ee)=>({element:L,id:pe[ee],idIsStable:!0,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:void 0,constraintProps:oe})),Te=()=>{const Q=[];if(Se){for(const[oe,ee]of T.separators)if(ee.axis===D&&ct(ee.index,U.length)){const Ae=oe.element.getBoundingClientRect();Q[ee.index]=Math.max(Q[ee.index]??0,D==="column"?Ae.width:Ae.height)}}return En({axis:D,element:L,gutterSizes:Q.filter(oe=>oe!==void 0),hasGutters:Se,layout:ae(Be)?.layout,trackIds:pe})};let De;const nt=k.defaultLayout?.[D==="column"?"columns":"rows"];if(nt!==void 0&&Object.keys(nt).length===pe.length){De={};for(const Q of pe){const oe=nt[Q];oe!==void 0&&(De[Q]=oe)}}return{disabled:!!i,element:L,id:Be,layoutStrategy:{getItemAriaControls:Q=>{const oe=pe.indexOf(Q);return T.cells.filter(ee=>{const Ae=D==="column"?ee.column:ee.row,zn=D==="column"?ee.columnSpan:ee.rowSpan;return Ae<=oe&&oe<Ae+zn}).map(ee=>ee.element.id).filter(Boolean).join(" ")||void 0},calculateAvailableSize:()=>Te().availableSize,calculateHitRegions:({expandHitTargets:Q,axis:oe,includeDisabled:ee})=>Rn({axis:D,cells:T.cells,crossTrackCount:me.length,expandHitTargets:Q,resizeAxis:oe,axisSize:Te().availableSize,includeDisabled:ee,separatorPlacements:T.separators}),getItemSizeInPixels:Q=>Te().trackSizes[pe.indexOf(Q)]??0},mutableState:{defaultLayout:De,disableCursor:!!k.disableCursor,expandedItemSizes:T[D].expandedItemSizes,layouts:T[D].layouts},orientation:D==="column"?"horizontal":"vertical",items:He,resizePreviewMode:"panel",get resizeTargetMinimumSize(){return k.resizeTargetMinimumSize},separators:qe}},H=Ie.map(_);X.current=H;const V=H.map(D=>pn(D)),te=()=>{const[D,U]=H.map(me=>ae(me.id));if(!(!D||!U||D.defaultLayoutDeferred||U.defaultLayoutDeferred))return{layout:{columns:D.layout,rows:U.layout},requestedLayout:{columns:D.requestedLayout,rows:U.requestedLayout}}};{const D=te();if(D)try{try{E(D.layout)}finally{G(D.layout,!1,D.requestedLayout)}}catch(U){throw X.current=[],V.forEach(me=>me()),U}}const ke=H.map(D=>Ne(D.id,U=>{const{defaultLayoutDeferred:me,derivedItemConstraints:pe,layout:Be,requestedLayout:qe}=U.next;if(me||pe.length===0)return;hn({derivedItemConstraints:pe,axis:D,layout:Be,prevLayout:U.prev?.layout,requestedLayout:qe});const Se=te();if(Se){const He=re(),Te=He.state!=="active"||!He.hitRegions.some(De=>H.includes(De.axis));try{E(Se.layout)}finally{Te&&G(Se.layout,U.isUserInteraction,Se.requestedLayout)}}}));return()=>{X.current=[],V.forEach(D=>D()),ke.forEach(D=>D())}},[g,i,y,f,G,E,S,z,k]),w.useEffect(()=>{X.current.forEach(L=>{L.mutableState.defaultLayout=o?.[L.orientation==="horizontal"?"columns":"rows"],L.mutableState.disableCursor=!!r})}),w.useImperativeHandle(c,()=>{const L=()=>{const[j,_]=Ie.map(y);return!Ce(j)||!Ce(_)?{columns:{},rows:{}}:{columns:Ge({axisId:j}).getLayout(),rows:Ge({axisId:_}).getLayout()}},T=j=>j.map(_=>`"${_}"`).join(", "),F=(j,_)=>{const H=y(j),V=()=>{const te=Ce(H);return N(te,`Grid "${f}" has not been mounted`),N(te.items.some(ke=>ke.id===_),`Grid "${f}" no longer contains a ${j} with id "${_}"; ${j} ids are ${T(te.items.map(ke=>ke.id))}`),yt({axisId:H,itemId:_})};return{collapse:()=>V().collapse(),expand:()=>V().expand(),getSize:()=>V().getSize(),isCollapsed:()=>V().isCollapsed(),resize:te=>V().resize(te)}};return{getLayout:L,getTrackById:(j,_)=>{const H=j==="column"?g:S,V=`${_}`;return N(H.some(te=>te.id===V),`Grid "${f}" does not contain a ${j} with id "${V}"; ${j} ids are ${T(H.map(te=>te.id))}`),F(j,V)},getTrackByIndex:(j,_)=>{const H=j==="column"?g:S,V=Number.isInteger(_)?H[_]:void 0;return N(V,`Grid "${f}" does not contain a ${j} at index ${_}; it has ${H.length} ${j}s`),F(j,V.id)},setLayout:j=>(Ie.forEach(_=>{const H=j[_==="column"?"columns":"rows"],V=y(_);H&&Ce(V)&&Ge({axisId:V}).setLayout(H)}),L())}},[g,y,f,S]);const K=()=>Ie.map(L=>{const T=ae(y(L)),F=I(L);return(T&&!T.defaultLayoutDeferred?F.map(_=>`minmax(0, ${T.layout[_.id]??1}fr)`):ao(F,o?.[L==="column"?"columns":"rows"])).join(A[L]?" auto ":" ")}).join("|"),se=w.useCallback(L=>{const T=Ie.map(F=>Ne(y(F),L));return()=>T.forEach(F=>F())},[y]),be=w.useSyncExternalStore(se,K,K),[Pe,xe]=be.split("|");return W.jsx(Jt.Provider,{value:Z,children:W.jsx("div",{...m,className:t,"data-grid":!0,"data-testid":_e(m,s),id:f,ref:x,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"grid",gridTemplateColumns:Pe,gridTemplateRows:xe,touchAction:"none"},children:W.jsx(St.Provider,{value:null,children:e})})})}Sn.displayName="Grid";function Xt(e,t){const n=JSON.stringify(e);return w.useMemo(()=>{const o=typeof e=="number"?Array.from({length:e},(r,i)=>({id:`${i}`})):e.map((r,i)=>({...r,id:`${r.id??i}`}));return N(o.length>0,`Grid must have at least one track; "${t}" is ${n}`),o},[n])}function vn(e,t){w.Children.forEach(e,n=>{if(w.isValidElement(n))if(n.type===vt){const{type:o}=n.props;o==="column"?t.column=!0:o==="row"&&(t.row=!0)}else typeof n.type=="symbol"&&n.props!==null&&typeof n.props=="object"&&"children"in n.props&&vn(n.props.children,t)})}function ao(e,t){if(t)return e.map(i=>`minmax(0, ${t[i.id]??1}fr)`);const n=e.map(i=>i.defaultSize===void 0?void 0:tn(i.defaultSize));let o=100,r=0;return n.forEach(i=>{i===void 0?r++:i[1]==="%"&&(o-=i[0])}),n.map(i=>{if(i===void 0)return`minmax(0, ${Math.max(0,o)/Math.max(1,r)}fr)`;const[a,c]=i;return c==="%"?`minmax(0, ${a}fr)`:`${a}${c}`})}function co({cells:e,separatorPlacements:t,trackCounts:n}){const o=[];for(const c of e)Ie.forEach(s=>{const[u,l]=s==="column"?[c.column,c.columnSpan]:[c.row,c.rowSpan],d=n[s];(!Number.isInteger(u)||!Number.isInteger(l)||u<0||l<1||u+l>d)&&o.push(`Invalid Cell ${s} placement (${s}: ${u}, ${s}Span: ${l}); Grid has ${d} ${s}s`)});const r=({axis:c,crossSpan:s,crossStart:u,disabled:l,index:d})=>{const h=c==="column"?"row":"column";let p=`type="${c}" ${c}={${d}}`;return(u!==0||s!==void 0)&&(p+=` ${h}={${u}}`),s!==void 0&&(p+=` ${h}Span={${s}}`),l&&(p+=" disabled"),`<Gridline ${p} />`},i=Array.from(t.values()).filter(c=>{const{axis:s,crossSpan:u,crossStart:l,index:d}=c,h=s==="column"?"row":"column",p=n[s],m=n[h];let f=!0;return ct(d,p)||(o.push(`Invalid ${s} Gridline ${s} (${d}); must be between 1 and ${p-1}`),f=!1),!Number.isInteger(l)||l<0||l>=m?(o.push(`Invalid ${s} Gridline ${h} (${l}); must be between 0 and ${m-1}`),f=!1):u!==void 0&&(!Number.isInteger(u)||u<1||l+u>m)&&(o.push(`Invalid ${s} Gridline ${h}Span (${u}); Grid has ${m} ${h}s`),f=!1),f}),a=c=>{const s=n[c.axis==="column"?"row":"column"];return[c.crossStart,c.crossSpan===void 0?s:c.crossStart+c.crossSpan]};return i.forEach((c,s)=>{const{axis:u,index:l}=c,[d,h]=a(c);for(const p of e){const[m,f,y,g]=u==="column"?[p.column,p.columnSpan,p.row,p.rowSpan]:[p.row,p.rowSpan,p.column,p.columnSpan];if(m<l&&l<m+f&&y<h&&d<y+g){const S=u==="column"?"row":"column";o.push(`${r(c)} overlaps a Cell that spans across it (${u}: ${m}, ${u}Span: ${f}, ${S}: ${y}, ${S}Span: ${g}); use the ${S} and ${S}Span props to render gridlines beside the Cell instead`)}}for(const p of i.slice(s+1))if(p.axis===u&&p.index===l){const[m,f]=a(p);m<h&&d<f&&o.push(`${r(c)} overlaps ${r(p)}`)}}),o}function Kt(e,t){return ie(e.columns,t.columns)&&ie(e.rows,t.rows)}function lo({id:e,onlySaveAfterUserInteractions:t,storage:n=localStorage}){const o=`react-resizable-panels:grid:${e}`,r=w.useSyncExternalStore(uo,()=>n.getItem(o),()=>n.getItem(o)),i=w.useMemo(()=>{if(r)try{const c=JSON.parse(r);if(c!==null&&typeof c=="object")return c}catch{}},[r]),a=w.useCallback((c,s)=>{if(!(t&&!s.isUserInteraction))try{n.setItem(o,JSON.stringify(s.requestedLayout??c))}catch(u){console.error(u)}},[t,n,o]);return{defaultLayout:i,onLayoutChanged:a}}function uo(){return function(){}}function fo(){return w.useState(null)}function mo(){return w.useRef(null)}function po(e){for(let t=1;t<e.length;t++)if(dt(e[t-1],e[t])>0)return!1;return!0}function ho({separator:e}){const{element:t}=e,n=w.useRef(null);return ne(()=>{const o=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],i=[o,...o.querySelectorAll("*")],a=t.ownerDocument.defaultView;return r.forEach((c,s)=>{const u=i[s];if(u instanceof a.HTMLElement||u instanceof a.SVGElement){const l=a.getComputedStyle(c);for(let d=0;d<l.length;d++){const h=l.item(d);u.style.setProperty(h,l.getPropertyValue(h))}}u.removeAttribute("data-testid"),u.removeAttribute("id")}),Object.assign(o.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(o),()=>o.remove()},[t]),W.jsx("div",{ref:n,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function tt(){const e=w.useContext(St);return N(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function bt(e){const{registerOverlay:t}=tt(),n=w.useRef(e);mn(n.current,e)||(n.current=e);const o=n.current;return ne(()=>t(o),[t,o]),null}bt.displayName="SeparatorOverlay";function go({active:e,orientation:t,style:n,...o}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return W.jsx("div",{...o,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function yo({overlay:e,preview:t}){const{axis:n,offset:o,rect:r,separator:i}=t,a=n.orientation==="horizontal";let c=i?.preview,s=e;return w.isValidElement(c)&&c.type===bt&&(s=c.props,c=void 0),c==null&&(s?c=W.jsx(go,{...s,active:t.active,orientation:n.orientation}):i&&(c=W.jsx(ho,{separator:i}))),W.jsx("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:a?`translateX(${o}px)`:`translateY(${o}px)`,width:r.width},children:c})}function So(e){return Array.from(e).sort(dt)}function vo(e,t){const n=w.useRef({getLayout:()=>({}),setLayout:Tn});w.useImperativeHandle(t,()=>n.current,[]),ne(()=>{Object.assign(n.current,Ge({axisId:e}))})}function bo({groupId:e,resizePreviewMode:t}){const[n,o]=w.useState([]),r=w.useRef(n);return ne(()=>{const i=c=>{const s=Ce(e),u=t==="separator"&&c.state==="active"?c.previews.filter(d=>d.axis===s&&(d.active||!Y(d.offset,0))):[],l=r.current;l.length===u.length&&u.every((d,h)=>d===l[h])||(r.current=u,o(u))};if(t!=="separator"){i(re());return}const a=ut(({next:c})=>i(c));return i(re()),a},[e,t]),n}function bn({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:i,groupRef:a,id:c,onLayoutChange:s,onLayoutChanged:u,orientation:l="horizontal",resizePreviewMode:d="panel",resizeTargetMinimumSize:h={coarse:20,fine:10},style:p,...m}){const f=w.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=ge(C=>{ie(f.current.onLayoutChange,C)||(f.current.onLayoutChange=C,s?.(C))}),g=ge((C,M,B)=>{ie(f.current.onLayoutChanged,C)||(f.current.onLayoutChanged=C,u?.(C,{isUserInteraction:M,requestedLayout:B}))}),S=Ee(c),[I,b]=w.useState(),E=bo({groupId:S,resizePreviewMode:d}),G=w.useRef(null),[$,x]=gn(),z=w.useRef([]),v=w.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),P=Fe(G,i);vo(S,a);const A=ge((C,M)=>{const B=ae(C);if(B)return{flexGrow:B.layout[M]??1};if(n?.[M])return{flexGrow:n?.[M]}}),k=et({defaultLayout:n,disableCursor:o,resizeTargetMinimumSize:h}),O=w.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:A,id:S,orientation:l,registerPanel:C=>{const M=v.current;return M.panels=$e(l,[...M.panels,C]),x(),()=>{M.panels=M.panels.filter(B=>B!==C),x()}},registerOverlay:C=>(b(C),()=>{b(void 0)}),registerSeparator:C=>{const M=v.current;return M.separators=$e(l,[...M.separators,C]),x(),()=>{M.separators=M.separators.filter(B=>B!==C),x()}},updatePanelProps:(C,{disabled:M})=>{const Z=v.current.panels.find(se=>se.id===C);Z&&(Z.constraintProps.disabled=M);const X=Ce(S),K=ae(S);X&&K&&fe(X,{...K,derivedItemConstraints:at(X)})},updateSeparatorProps:(C,{disabled:M,disableDoubleClick:B})=>{const X=v.current.separators.find(K=>K.id===C);X&&(X.disabled=M,X.disableDoubleClick=B)}}),[A,S,x,l,k]),R=w.useRef(null);return ne(()=>{const C=G.current;if(C===null)return;const M=v.current;M.panels=$e(l,M.panels),M.separators=$e(l,M.separators),z.current=So([...M.panels.map(({element:L})=>L),...M.separators.map(({element:L})=>L)]);let B;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===M.panels.length){B={};for(const L of M.panels){const T=k.defaultLayout[L.id];T!==void 0&&(B[L.id]=T)}}const Z={disabled:!!r,element:C,id:S,mutableState:{defaultLayout:B,disableCursor:!!k.disableCursor,expandedItemSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:l,items:M.panels,resizePreviewMode:d,get resizeTargetMinimumSize(){return k.resizeTargetMinimumSize},separators:M.separators};R.current=Z;const X=pn(Z),{defaultLayoutDeferred:K,derivedItemConstraints:se,layout:be,requestedLayout:Pe}=ae(Z.id,!0);if(!K&&se.length>0)try{try{y(be)}finally{g(be,!1,Pe)}}catch(L){throw R.current=null,X(),L}const xe=Ne(S,L=>{const{defaultLayoutDeferred:T,derivedItemConstraints:F,layout:j,requestedLayout:_}=L.next;if(T||F.length===0)return;hn({derivedItemConstraints:F,axis:Z,layout:j,prevLayout:L.prev?.layout,requestedLayout:_});const H=re(),V=H.state!=="active"||!H.hitRegions.some(te=>te.axis===Z);try{y(j)}finally{V&&g(j,L.isUserInteraction,_)}});return()=>{R.current=null,X(),xe()}},[r,S,g,y,l,$,d,k]),ne(()=>{po(z.current)||x()}),w.useEffect(()=>{const C=R.current;C&&(C.mutableState.defaultLayout=n,C.mutableState.disableCursor=!!o)}),W.jsx(St.Provider,{value:O,children:W.jsxs("div",{...m,className:t,"data-group":!0,"data-testid":_e(m,c),id:S,ref:P,style:{height:"100%",width:"100%",overflow:"hidden",position:d==="separator"?"relative":void 0,...p,display:"flex",flexDirection:l==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:l==="horizontal"?"pan-y":"pan-x"},children:[e,E.map(C=>W.jsx(yo,{overlay:I,preview:C},C.key))]})})}bn.displayName="Group";function Xe(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function xo({id:e,panelIds:t,storage:n}){const o=Xe(e,[]),r=n.getItem(o);if(r)try{const i=JSON.parse(r);if(t){const a=t.join(","),c=i[a];if(c&&Array.isArray(c.layout)&&t.length===c.layout.length){const s={};for(let u=0;u<t.length;u++)s[t[u]]=c.layout[u];return s}}else{const a=Object.keys(i);if(a.length===1){const c=i[a[0]];if(c&&Array.isArray(c.layout)){const s=a[0].split(",");if(s.length===c.layout.length){const u={};for(let l=0;l<s.length;l++)u[s[l]]=c.layout[l];return u}}}}}catch{}}function wo({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...r}){const i=n!==void 0,a="id"in r?r.id:r.groupId,c=Xe(a,n??[]),s=w.useSyncExternalStore(zo,()=>o.getItem(c),()=>o.getItem(c)),u=w.useMemo(()=>{if(s){const y=JSON.parse(s),g=Object.values(y);if(Array.from(g).every(S=>typeof S=="number"))return y}},[s]),l=w.useMemo(()=>{if(!u)return xo({id:a,panelIds:n,storage:o})},[u,a,n,o]),d=u??l,h=w.useRef(null),p=w.useCallback(()=>{const y=h.current;y&&(h.current=null,clearTimeout(y))},[]);w.useLayoutEffect(()=>()=>{p()},[p]);const m=w.useCallback((y,g)=>{if(t&&!g.isUserInteraction)return;p();const S=g.requestedLayout??y;let I;i?I=Xe(a,Object.keys(S)):I=Xe(a,[]);try{o.setItem(I,JSON.stringify(S))}catch(b){console.error(b)}},[p,i,a,t,o]),f=w.useCallback(y=>{p(),e===0?m(y,{isUserInteraction:!1}):h.current=setTimeout(()=>{m(y,{isUserInteraction:!1})},e)},[p,e,m]);return{defaultLayout:d,onLayoutChange:f,onLayoutChanged:m}}function zo(){return function(){}}function Io(){return w.useState(null)}function Co(){return w.useRef(null)}function Lo(e,t){const{id:n}=tt(),o=w.useRef({collapse:ot,expand:ot,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ot});w.useImperativeHandle(t,()=>o.current,[]),ne(()=>{Object.assign(o.current,yt({axisId:n,itemId:e}))})}function xn({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:c,groupResizeBehavior:s="preserve-relative-size",id:u,maxSize:l="100%",minSize:d="0%",onResize:h,panelRef:p,style:m,...f}){const y=Ke(u),g=Ee(u),S=et({disabled:a}),I=w.useRef(null),b=Fe(I,c),{getPanelStyles:E,id:G,orientation:$,registerPanel:x,updatePanelProps:z}=tt(),v=h!==null,P=ge((R,C,M)=>{h?.(R,u,M)});ne(()=>{const R=I.current;if(R!==null){const C={element:R,id:g,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:v?P:void 0,constraintProps:{groupResizeBehavior:s,collapsedSize:n,collapsedThreshold:o,collapsible:r,defaultSize:i,disabled:S.disabled,maxSize:l,minSize:d}};return x(C)}},[s,n,o,r,i,v,g,y,l,d,P,x,S]),w.useEffect(()=>{z(g,{disabled:a})},[a,g,z]),Lo(g,p);const A=()=>{const R=E(G,g);if(R)return JSON.stringify(R)},k=w.useSyncExternalStore(R=>Ne(G,R),A,A);let O;return k?O=JSON.parse(k):i!==void 0?O={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:O={flexGrow:1},W.jsx("div",{...f,"data-disabled":a||void 0,"data-panel":!0,"data-testid":_e(f,u),id:g,ref:b,style:{...Ro,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...O},children:W.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:$==="horizontal"?"pan-y":"pan-x"},children:e})})}xn.displayName="Panel";const Ro={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Eo(){return w.useState(null)}function Mo(){return w.useRef(null)}const Po={flexBasis:"auto"},ko={flexGrow:0,flexShrink:0};function wn({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:i,preview:a,style:c,...s}){const u=Ee(i),{disableCursor:l,id:d,orientation:h,registerSeparator:p,updateSeparatorProps:m}=tt();return W.jsx(yn,{attributes:s,axisId:d,axisOrientation:h,className:t,"data-testid":_e(s,i),disableCursor:l,disabled:n,disableDoubleClick:o,elementRef:r,id:u,preview:a,registerSeparator:p,requiredStyle:ko,style:c,styleDefaults:Po,updateSeparatorProps:m,children:e})}wn.displayName="Separator";exports.Cell=Qt;exports.Grid=Sn;exports.Gridline=vt;exports.Group=bn;exports.Panel=xn;exports.Separator=wn;exports.SeparatorOverlay=bt;exports.isCoarsePointer=en;exports.useDefaultGridLayout=lo;exports.useDefaultLayout=wo;exports.useGridCallbackRef=fo;exports.useGridRef=mo;exports.useGroupCallbackRef=Io;exports.useGroupRef=Co;exports.usePanelCallbackRef=Eo;exports.usePanelRef=Mo;
|
|
2
2
|
//# sourceMappingURL=react-resizable-panels.cjs.map
|