react-resizable-panels 4.14.5 → 4.14.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
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;
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),K=Math.min(O?.crossEnd??1/0,R?.crossEnd??1/0);k={crossEnd:Math.max(B,K),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 Z(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=Z(d/n*100)}let c;if(i.collapsedThreshold!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.collapsedThreshold});c=Z(d/n*100)}let s;if(i.defaultSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.defaultSize});s=Z(d/n*100)}let u=0;if(i.minSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.minSize});u=Z(d/n*100)}let l=100;if(i.maxSize!==void 0){const d=ze({axisSize:n,itemElement:r,styleProp:i.maxSize});l=Z(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(Z(e)-Z(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=Z(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]:Z(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=Z(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 eo(e){return e.separators.filter(t=>!t.disabled)}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=eo(n).map(s=>s.element),i=r.findIndex(s=>s===e.currentTarget);N(i!==-1,"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 to(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"?to(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 no(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const a=Z(i.defaultSize);n+=a,o[i.itemId]=a}else o[i.itemId]=void 0;const r=e.length-t;if(r!==0){const i=Z((100-n)/r);for(const a of e)a.defaultSize===void 0&&(o[a.itemId]=i)}return o}function oo(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&&oo(e.items,o)?o:no(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 ro(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:Z(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 io(e,t){return e.length!==t.length?!1:e.every((n,o)=>mn(n,t[o]))}function so({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=Z(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]=Z(h/i*u)}else{const d=Z(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=so({axis:e,nextAxisSize:I,prevAxisSize:G,prevLayout:$}),z=ye({layout:x,itemConstraints:E});if(!b.defaultLayoutDeferred&&ie(b.layout,z)&&io(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{ro(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 ao({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),K=ut(J=>{$(J.next.state!=="inactive"&&J.next.hitRegions.some(se=>se.separator===M||(d?.(se)??!1))?J.next.state:"inactive")}),X=Ne(t,J=>{const{derivedItemConstraints:se,layout:be,separatorToItems:Pe}=J.next,xe=Pe.get(M);if(xe){const L=xe[0],T=se.findIndex(j=>j.itemId===L.id),{layoutStrategy:F}=J.axis;E({...ao({layout:be,itemConstraints:se,itemId:L.id,itemIndex:T}),...F?.getItemAriaControls&&{valueControls:F.getItemAriaControls(L.id)}})}});return()=>{P.current=null,K(),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,K=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=lo({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 J=()=>Ie.map(L=>{const T=ae(y(L)),F=I(L);return(T&&!T.defaultLayoutDeferred?F.map(_=>`minmax(0, ${T.layout[_.id]??1}fr)`):co(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,J,J),[Pe,xe]=be.split("|");return W.jsx(Jt.Provider,{value:K,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 co(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 lo({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 uo({id:e,onlySaveAfterUserInteractions:t,storage:n=localStorage}){const o=`react-resizable-panels:grid:${e}`,r=w.useSyncExternalStore(fo,()=>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 fo(){return function(){}}function mo(){return w.useState(null)}function po(){return w.useRef(null)}function ho(e){for(let t=1;t<e.length;t++)if(dt(e[t-1],e[t])>0)return!1;return!0}function go({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 yo({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 So({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(yo,{...s,active:t.active,orientation:n.orientation}):i&&(c=W.jsx(go,{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 vo(e){return Array.from(e).sort(dt)}function bo(e,t){const n=w.useRef({getLayout:()=>({}),setLayout:Tn});w.useImperativeHandle(t,()=>n.current,[]),ne(()=>{Object.assign(n.current,Ge({axisId:e}))})}function xo({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=xo({groupId:S,resizePreviewMode:d}),G=w.useRef(null),[$,x]=gn(),z=w.useRef([]),v=w.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),P=Fe(G,i);bo(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 K=v.current.panels.find(se=>se.id===C);if(!K||K.constraintProps.disabled===M)return;K.constraintProps.disabled=M;const X=Ce(S),J=ae(S);X&&J&&fe(X,{...J,derivedItemConstraints:at(X)})},updateSeparatorProps:(C,{disabled:M,disableDoubleClick:B})=>{const X=v.current.separators.find(J=>J.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=vo([...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 K={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=K;const X=pn(K),{defaultLayoutDeferred:J,derivedItemConstraints:se,layout:be,requestedLayout:Pe}=ae(K.id,!0);if(!J&&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:K,layout:j,prevLayout:L.prev?.layout,requestedLayout:_});const H=re(),V=H.state!=="active"||!H.hitRegions.some(te=>te.axis===K);try{y(j)}finally{V&&g(j,L.isUserInteraction,_)}});return()=>{R.current=null,X(),xe()}},[r,S,g,y,l,$,d,k]),ne(()=>{ho(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(So,{overlay:I,preview:C},C.key))]})})}bn.displayName="Group";function Xe(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function wo({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 zo({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(Io,()=>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 wo({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 Io(){return function(){}}function Co(){return w.useState(null)}function Lo(){return w.useRef(null)}function Ro(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]),Ro(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:{...Eo,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 Eo={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Mo(){return w.useState(null)}function Po(){return w.useRef(null)}const ko={flexBasis:"auto"},To={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:To,style:c,styleDefaults:ko,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=uo;exports.useDefaultLayout=zo;exports.useGridCallbackRef=mo;exports.useGridRef=po;exports.useGroupCallbackRef=Co;exports.useGroupRef=Lo;exports.usePanelCallbackRef=Mo;exports.usePanelRef=Po;
2
2
  //# sourceMappingURL=react-resizable-panels.cjs.map