react-resizable-panels 4.14.7 → 4.14.8
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),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;
|
|
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 Re(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 je(...e){return ge(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Fe(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 wt(e,t,n){const o=rt(e,n);return t===void 0?`${o} / -1`:`${o} / span ${In(t,n)}`}function Ln(e){return`${e*2} / span 1`}function Rn({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),s=rt(r-1,o)+1;return o&&(n>0&&i--,r<e&&s++),`${i} / ${s}`}function at(e,t){return Number.isInteger(e)&&e>=1&&e<t}function O(e,t="Assertion error"){if(!e)throw Error(t)}const Kt=w.createContext(null);function Jt(){const e=w.useContext(Kt);return O(e,"Grid Context not found; did you render a Cell or Gridline outside of a Grid?"),e}function Zt({children:e,className:t,column:n,columnSpan:o=1,elementRef:r,id:i,row:s,rowSpan:a=1,style:u,...l}){const c=Re(i),{gutters:d,registerCell:p}=Jt(),g=w.useRef(null),f=je(g,r);return ne(()=>{const m=g.current;if(m!==null)return p({column:n,columnSpan:o,element:m,id:c,row:s,rowSpan:a})},[n,o,c,p,s,a]),W.jsx("div",{...l,className:t,"data-cell":!0,"data-testid":Fe(l,i),id:c,ref:f,style:{overflow:"auto",...u,minHeight:0,minWidth:0,gridColumn:wt(n,o,d.column),gridRow:wt(s,a,d.row)},children:e})}Zt.displayName="Cell";let Ve;function Qt(){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?Qt()?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 zt({axis:e,cells:t,index:n,rect:o}){let r=[o];for(const i of t){const s=e==="column"?i.column:i.row,a=e==="column"?i.columnSpan:i.rowSpan;if(s>=n||s+a<=n)continue;const u=i.element.getBoundingClientRect(),l=e==="column"?u.top:u.left,c=e==="column"?u.bottom:u.right;c<=l||(r=r.flatMap(d=>{const p=e==="column"?d.top:d.left,g=e==="column"?d.bottom:d.right;if(l>=g||c<=p)return[d];const f=[],m=(h,S)=>{f.push(e==="column"?new DOMRect(d.x,h,d.width,S-h):new DOMRect(h,d.y,S-h,d.height))};return p<l&&m(p,l),g>c&&m(c,g),f}))}return r}function En({axis:e,cells:t,crossTrackCount:n,expandHitTargets:o,resizeAxis:r,axisSize:i,includeDisabled:s,separatorPlacements:a}){const{items:u,separators:l}=r,c=u.length;let d=-1,p=-1,g=0;if(u.forEach((x,z)=>{x.constraintProps.disabled||(g++,d===-1&&(d=z),p=z)}),!s&&g<2)return[];const f=x=>s||x>d&&x<=p,m=[],h=(x,z,v)=>({axis:r,axisSize:i,items:[u[x-1],u[x]],rect:z,separator:v}),S=(x,z)=>{let v;for(const P of t){const D=e==="column"?P.row:P.column,k=e==="column"?P.rowSpan:P.columnSpan;if(z==="start"?D===x:D+k-1===x){const $=P.element.getBoundingClientRect();if(z==="start"){const R=e==="column"?$.top:$.left;v=v===void 0?R:Math.min(v,R)}else{const R=e==="column"?$.bottom:$.right;v=v===void 0?R:Math.max(v,R)}}}return v},y=new Set;for(const x of l){const z=a.get(x);if(!z||z.index<1||z.index>=c||(y.add(z.index),!s&&(x.disabled||x.element.hasAttribute("aria-disabled")))||!f(z.index))continue;let v=x.element.getBoundingClientRect();const{crossSpan:P,crossStart:D}=z,k=P===void 0?n:D+P;let $=e==="column"?v.top:v.left,R=e==="column"?v.bottom:v.right;if(D>0){const I=S(D-1,"end");I!==void 0&&I<$&&($=I)}if(k<n){const I=S(k,"start");I!==void 0&&I>R&&(R=I)}v=e==="column"?new DOMRect(v.x,$,v.width,R-$):new DOMRect($,v.y,R-$,v.height),v=it({expandHitTargets:o,axis:r,rect:v}),s?m.push(h(z.index,v,x)):zt({axis:e,cells:t,index:z.index,rect:v}).forEach(I=>{m.push(h(z.index,I,x))})}const C=(x,z)=>{zt({axis:e,cells:t,index:x,rect:it({expandHitTargets:o,axis:r,rect:z})}).forEach(v=>{m.push(h(x,v))})},b=Array.from({length:n},()=>new Array(c));for(const x of t){const[z,v,P,D]=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+D);k++)for(let $=Math.max(0,z);$<Math.min(c,z+v);$++)b[k][$]??=x}const M=new Map,F=x=>{let z=M.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},M.set(x,z)}return z},N=({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<c;x++){if(y.has(x)||!f(x))continue;let z;for(let v=0;v<n;v++){const P=b[v][x-1],D=b[v][x];let k;if((P||D)&&P!==D){const $=P?F(P):void 0,R=D?F(D):void 0,I=$?.end??R.start,E=R?.start??$.end,B=Math.max($?.crossStart??-1/0,R?.crossStart??-1/0),K=Math.min($?.crossEnd??1/0,R?.crossEnd??1/0);k={crossEnd:Math.max(B,K),crossStart:B,end:Math.max(I,E),start:Math.min(I,E)}}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&&(C(x,N(z)),z=void 0)}z&&C(x,N(z))}return m}function ce(e){const t=parseFloat(e??"");return Number.isFinite(t)?t:0}function Mn({axis:e,element:t,gutterSizes:n,hasGutters:o,layout:r,trackIds:i}){const s=i.length,a=o?s*2-1:s,u=t.ownerDocument.defaultView?.getComputedStyle(t),l=e==="column"?u?.gridTemplateColumns:u?.gridTemplateRows;if(l){const m=l.trim().split(/\s+/);if(m.length===a&&m.every(h=>/^-?[\d.]+px$/.test(h))){const h=i.map((S,y)=>ce(m[o?y*2:y]));return{availableSize:h.reduce((S,y)=>S+y,0),trackSizes:h}}}const c=e==="column"?t.offsetWidth:t.offsetHeight,d=e==="column"?ce(u?.paddingLeft)+ce(u?.paddingRight)+ce(u?.borderLeftWidth)+ce(u?.borderRightWidth):ce(u?.paddingTop)+ce(u?.paddingBottom)+ce(u?.borderTopWidth)+ce(u?.borderBottomWidth),p=ce(e==="column"?u?.columnGap:u?.rowGap),g=n.reduce((m,h)=>m+h,0),f=Math.max(0,c-d-p*Math.max(0,a-1)-g);return{availableSize:f,trackSizes:i.map(m=>r&&r[m]!==void 0?r[m]/100*f:f/s)}}function en(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 tn{#e={};addListener(t,n){const o=this.#e[t];return o===void 0?this.#e[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=this.#e[t];if(o!==void 0){if(o.length===1){o[0].call(null,n);return}let r;const i=Array.from(o);for(let s=0;s<i.length;s++){const a=i[s];try{a.call(null,n)}catch(u){r??={error:u}}}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 ct=new tn;function re(){return q}function lt(e){return ct.addListener("change",e)}function Pn(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,ct.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()}),ct.emit("change",{prev:t,next:e})}function kn(e){q.state!=="active"||!q.previews.some(t=>t.separator===e)||de({...q,previews:q.previews.map(t=>t.separator===e?{...t}:t)})}function Tn(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 An=e=>e,ot=()=>{},nn=1,on=2,rn=4,sn=8,Ct=3,It=12;let Ue;function Lt(){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&&Lt()){const i=(e&nn)!==0,s=(e&on)!==0,a=(e&rn)!==0,u=(e&sn)!==0;if(i)return a?"se-resize":u?"ne-resize":"e-resize";if(s)return a?"sw-resize":u?"nw-resize":"w-resize";if(a)return"s-resize";if(u)return"n-resize"}break}}return Lt()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Rt=new WeakMap;function Et(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Rt.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(s=>s.axis),state:o.state}),i=`*, *:hover {cursor: ${r} !important; }`;if(t===i)return;t=i,r?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Rt.set(e,{prevStyle:t,styleSheet:n})}function Mt(e){return e.state==="inactive"?void 0:e.ownerDocument}function $n({next:e,prev:t}){const n=Mt(t),o=Mt(e);n&&n!==o&&Et(n),o&&Et(o)}function _e({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 ut(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 De(e,t){return Array.from(t).sort((n,o)=>{const r=e==="horizontal"?On(n,o):Gn(n,o);return r!==0?r:ut(n.element,o.element)})}function On(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Gn(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 an(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 Nn({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,i=Number.MAX_VALUE;for(const s of t){const{x:a,y:u}=an(o,s),l=e==="horizontal"?a:u;l<i&&(i=l,r=s)}return O(r,"No rect found"),r}function dt({expandHitTargets:e=!0,axis:t,includeDisabled:n=!1}){if(t.layoutStrategy)return t.layoutStrategy.calculateHitRegions({expandHitTargets:e,axis:t,includeDisabled:n});const{element:o,orientation:r,items:i,separators:s}=t,a=De(r,Array.from(o.children).filter(st).filter(S=>!S.hasAttribute("data-resize-preview")).map(S=>({element:S}))).map(({element:S})=>S),u=[];let l=!1,c=!1,d=-1,p,g=-1,f=0,m,h=[];{let S=-1;for(const y of a)y.hasAttribute("data-panel")&&(S++,y.hasAttribute("data-disabled")||(f++,d===-1&&(d=S),g=S))}if(n||f>1){let S=-1;for(const y of a)if(y.hasAttribute("data-panel")){S++;const C=i.find(b=>b.element===y);if(C){if(m){const b=m.element.getBoundingClientRect(),M=y.getBoundingClientRect();let F;if(c){const N=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(M.left,M.top,0,M.height):new DOMRect(M.left,M.top,M.width,0);switch(h.length){case 0:{F=[N,x];break}case 1:{const z=h[0],v=Nn({orientation:r,rects:[b,M],targetRect:z.element.getBoundingClientRect()});F=[z,v===b?x:N];break}default:{F=h;break}}}else h.length?F=h:F=[r==="horizontal"?new DOMRect(b.right,M.top,M.left-b.right,M.height):new DOMRect(M.left,b.bottom,M.width,M.top-b.bottom)];for(const N of F){const x=it({expandHitTargets:e,axis:t,rect:"width"in N?N:N.element.getBoundingClientRect()}),z=S<=d||S>g;(n||!l&&!z)&&(p??=_e({axis:t}),u.push({axis:t,axisSize:p,items:[m,C],separator:"width"in N?void 0:N,rect:x})),l=!1}}c=!1,m=C,h=[]}}else if(y.hasAttribute("data-separator")){y.ariaDisabled!==null&&(l=!0);const C=s.find(b=>b.element===y);C?h.push(C):(m=void 0,h=[])}else c=!0}return u}function jn(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function Fn(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function _n(e){return e/100*window.innerHeight}function Bn(e){return e/100*window.innerWidth}function ze({axisSize:e,itemElement:t,styleProp:n}){let o;const[r,i]=en(n);switch(i){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=Fn(t,r);break}case"em":{o=jn(t,r);break}case"vh":{o=_n(r);break}case"vw":{o=Bn(r);break}}return o}function Z(e){return parseFloat(e.toFixed(3))}function ft(e,t=_e({axis:e})){const{items:n}=e;return t===0?n.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})):n.map(o=>{const{element:r,constraintProps:i}=o;let s=0;if(i.collapsedSize!==void 0){const d=ze({axisSize:t,itemElement:r,styleProp:i.collapsedSize});s=Z(d/t*100)}let a;if(i.collapsedThreshold!==void 0){const d=ze({axisSize:t,itemElement:r,styleProp:i.collapsedThreshold});a=Z(d/t*100)}let u;if(i.defaultSize!==void 0){const d=ze({axisSize:t,itemElement:r,styleProp:i.defaultSize});u=Z(d/t*100)}let l=0;if(i.minSize!==void 0){const d=ze({axisSize:t,itemElement:r,styleProp:i.minSize});l=Z(d/t*100)}let c=100;if(i.maxSize!==void 0){const d=ze({axisSize:t,itemElement:r,styleProp:i.maxSize});c=Z(d/t*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:s,collapsedThreshold:a,collapsible:i.collapsible===!0,defaultSize:u,disabled:i.disabled,minSize:l,maxSize:c,itemId:o.id}})}let ue=new Map;const mt=new tn;let $e=0;const We=[];let Ye;function Je(){$e++}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($e===1&&pt(),$e--,$e===0&&Ye){const{error:e}=Ye;throw Ye=void 0,e}}function qn(e){ue=new Map(ue),ue.delete(e)}function Ie(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 Ge(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};$e>0?We.push(r):mt.emit("axisChange",r)}function cn(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||cn(e,n))}function Hn(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:s,disabled:a,maxSize:u=100,minSize:l=0}=t;if(a&&!e)return n;if(le(o,l)<0)if(s){const c=i??(l-r)/2,d=le(n,r)<=0,p=d?r+c:l-c,g=le(o,p);le(o,r)<=0||g<0||i!==void 0&&d&&g===0?o=r:o=l}else o=l;return o=Math.min(u,o),o=Z(o),o}function Ne({delta:e,initialLayout:t,itemConstraints:n,pivotIndices:o,prevLayout:r,trigger:i}){if(Y(e,0))return t;const s=i==="imperative-api",a=n.map(({itemId:f})=>t[f]),u=n.map(({itemId:f})=>r[f]),l=[...a],[c,d]=o;O(c!=null,"Invalid first pivot index"),O(d!=null,"Invalid second pivot index");let p=0;switch(i){case"keyboard":{{const f=e<0?d:c,m=n[f];O(m,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:S,minSize:y=0}=m;if(S){const C=a[f];if(O(C!=null,`Previous layout not found for panel index ${f}`),Y(C,h)){const b=y-C;le(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const f=e<0?c:d,m=n[f];O(m,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:S,minSize:y=0}=m;if(S){const C=a[f];if(O(C!=null,`Previous layout not found for panel index ${f}`),Y(C,y)){const b=C-h;le(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}break}default:{const f=e<0?d:c,m=n[f];O(m,`Panel constraints not found for index ${f}`);const h=a[f],{collapsedSize:S,collapsedThreshold:y,collapsible:C,minSize:b}=m;if(C&&le(h,b)<0){const M=b-S,F=y??M/2,N=h+Math.abs(e);if(le(N,b)<0){const x=le(Math.abs(e),F),z=y===void 0&&e<0;x>0||x===0&&z?e=e<0?-M:M:e=0}}break}}{const f=e<0?1:-1;let m=e<0?d:c,h=0;for(;;){const y=a[m];O(y!=null,`Previous layout not found for panel index ${m}`);const b=Le({overrideDisabledItems:s,itemConstraints:n[m],prevSize:y,size:100})-y;if(h+=b,m+=f,m<0||m>=n.length)break}const S=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-S:S}{let m=e<0?c:d;for(;m>=0&&m<n.length;){const h=Math.abs(e)-Math.abs(p),S=a[m];O(S!=null,`Previous layout not found for panel index ${m}`);const y=S-h,C=Le({overrideDisabledItems:s,itemConstraints:n[m],prevSize:S,size:y});if(!Y(S,C)&&(p+=S-C,l[m]=C,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Hn(u,l))return r;{const f=e<0?d:c,m=a[f];O(m!=null,`Previous layout not found for panel index ${f}`);const h=m+p,S=Le({overrideDisabledItems:s,itemConstraints:n[f],prevSize:m,size:h});if(l[f]=S,!Y(S,h)){let y=h-S,b=e<0?d:c;for(;b>=0&&b<n.length;){const M=l[b];O(M!=null,`Previous layout not found for panel index ${b}`);const F=M+y,N=Le({overrideDisabledItems:s,itemConstraints:n[b],prevSize:M,size:F});if(Y(M,N)||(y-=N-M,l[b]=N),Y(y,0))break;e>0?b--:b++}}}const g=Object.values(l).reduce((f,m)=>m+f,0);return Y(g,100,.1)?l.reduce((f,m,h)=>(f[n[h].itemId]=m,f),{}):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{Vn(e)}finally{Ze()}}function Vn({commit:e,event:t,hitRegions:n,initialLayoutMap:o,mountedAxes:r,pointerDownAtPoint:i,prevCursorFlags:s}){let a=0;const u=re();let l=u.state==="active"?u.previews:[];const c=new Map(u.state==="active"?u.previewLayoutMap:void 0);n.forEach(g=>{const{axis:f,axisSize:m}=g,{orientation:h,items:S}=f;if(e&&f.resizePreviewMode!=="separator")return;const{disableCursor:y}=f.mutableState;let C=0;i?h==="horizontal"?C=(t.clientX-i.x)/m*100:C=(t.clientY-i.y)/m*100:h==="horizontal"?C=t.clientX<0?-100:100:C=t.clientY<0?-100:100;const b=o.get(f),M=r.get(f);if(!b||!M)return;const{defaultLayoutDeferred:F,derivedItemConstraints:N,axisSize:x,layout:z,separatorToItems:v}=M;if(N&&z&&v){const P=f.resizePreviewMode==="separator"?c.get(f)??z:z,D=Ne({delta:C,initialLayout:b,itemConstraints:N,pivotIndices:g.items.map(k=>S.indexOf(k)),prevLayout:P,trigger:"mouse-or-touch"});if(f.resizePreviewMode==="separator"&&!e&&!ie(D,P)){c.set(f,D);let k=0;const $=S.map(R=>(k+=D[R.id]-b[R.id],k*(m/100)));l=l.map(R=>{if(R.axis!==f)return R;const I=$[R.itemIndex];return I===R.offset?R:{...R,offset:I}})}if(ie(D,P)&&C!==0&&!y)switch(h){case"horizontal":{a|=C<0?nn:on;break}case"vertical":{a|=C<0?rn:sn;break}}(f.resizePreviewMode!=="separator"||e)&&!ie(D,z)&&fe(g.axis,{defaultLayoutDeferred:F,derivedItemConstraints:N,axisSize:x,layout:D,requestedAxisSize:x,requestedLayout:D,separatorToItems:v})}});let d=0;t.movementX===0?d|=s&Ct:d|=a&Ct,t.movementY===0?d|=s&It:d|=a&It;const p=u.state==="active"&&(t.clientX!==u.pointerDownAtPoint.x||t.clientY!==u.pointerDownAtPoint.y);Pn(d,l,c,p)}function ln(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 Pt(e){if(e.defaultPrevented)return;const{clientX:t,clientY:n,movementX:o,movementY:r}=e;ln(e.currentTarget,{clientX:t,clientY:n,movementX:o,movementY:r})}function Un(e,t,n){let o,r={x:1/0,y:1/0};for(const i of t){const s=an(n,i.rect);switch(e){case"horizontal":{(s.x<r.x||s.x===r.x&&s.y<=r.y)&&(o=i,r=s);break}case"vertical":{(s.y<r.y||s.y===r.y&&s.x<=r.x)&&(o=i,r=s);break}}}return o?{distance:r,hitRegion:o}:void 0}function Wn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Yn(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:At(e),b:At(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();O(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:Tt(kt(n.a)),b:Tt(kt(n.b))};if(r.a===r.b){const i=o.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const u=i[a];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(r.a-r.b)}const Xn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Kn(e){const t=getComputedStyle(un(e)??e).display;return t==="flex"||t==="inline-flex"}function Jn(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Kn(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"||Xn.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function kt(e){let t=e.length;for(;t--;){const n=e[t];if(O(n,"Missing node"),Jn(n))return n}return null}function Tt(e){return e&&Number(getComputedStyle(e).zIndex)||0}function At(e){const t=[];for(;e;)t.push(e),e=un(e);return t}function un(e){const{parentNode:t}=e;return Wn(t)?t.host:t}function Zn(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 Qn(e){try{return e.matches(":modal")}catch{return!1}}function eo({axisElement:e,hitRegion:t,pointerEventTarget:n}){if(st(n)){const o=n.closest("dialog");if(o&&!o.contains(e)&&Qn(o))return!1}if(!st(n)||n.contains(e)||e.contains(n)||!n.isConnected||!e.isConnected)return!0;if(Yn(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Zn(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 s=dt({axis:i}),a=Un(i.orientation,s,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&eo({axisElement:i.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&o.push(a.hitRegion)}),o}function to(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const s=Z(i.defaultSize);n+=s,o[i.itemId]=s}else o[i.itemId]=void 0;const r=e.length-t;if(r!==0){const i=Z((100-n)/r);for(const s of e)s.defaultSize===void 0&&(o[s.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 dn({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 fn(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 oo(e,t){return e.length!==t.length?!1:e.every((n,o)=>fn(n,t[o]))}function ye({layout:e,itemConstraints:t}){const n=t.map(({itemId:s})=>e[s]),o=[...n],r=o.reduce((s,a)=>s+a,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(s=>`${s}%`).join(", ")}`);if(!Y(r,100)&&o.length>0)for(let s=0;s<t.length;s++){const a=o[s];O(a!=null,`No layout data found for index ${s}`);const u=100/r*a;o[s]=u}let i=0;for(let s=0;s<t.length;s++){const a=n[s];O(a!=null,`No layout data found for index ${s}`);const u=o[s];O(u!=null,`No layout data found for index ${s}`);const l=Le({overrideDisabledItems:!0,itemConstraints:t[s],prevSize:a,size:u});u!=l&&(i+=u-l,o[s]=l)}if(!Y(i,0))for(let s=0;s<t.length;s++){const a=o[s];O(a!=null,`No layout data found for index ${s}`);const u=a+i,l=Le({overrideDisabledItems:!0,itemConstraints:t[s],prevSize:a,size:u});if(a!==l&&(i-=l-a,o[s]=l,Y(i,0)))break}return o.reduce((s,a,u)=>(s[t[u].itemId]=a,s),{})}function mn({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({axis:e,nextAxisSize:t,prevAxisSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,i=0,s=!1;const a=new Map,u=[];for(const d of e.items){const p=o[d.id]??0;switch(d.constraintProps.groupResizeBehavior){case"preserve-pixel-size":{s=!0;const g=p/100*n,f=Z(g/t*100);a.set(d.id,f),r+=f;break}case"preserve-relative-size":default:{u.push(d.id),i+=p;break}}}if(!s||u.length===0)return o;const l=100-r,c={...o};if(a.forEach((d,p)=>{c[p]=d}),i>0)for(const d of u){const p=o[d]??0;c[d]=Z(p/i*l)}else{const d=Z(l/u.length);for(const p of u)c[p]=d}return c}function yt({axis:e,axisState:t}){const n=_e({axis:e});if(n===0)return;const o=ft(e,n);let r=t.requestedAxisSize,i=t.requestedLayout;t.defaultLayoutDeferred&&(r=n,i=mn({itemIds:e.items.map(({id:l})=>l),layout:dn({axis:e,itemConstraints:o})}));const s=ro({axis:e,nextAxisSize:n,prevAxisSize:r,prevLayout:i}),a=ye({layout:s,itemConstraints:o});return{changed:t.defaultLayoutDeferred||!ie(t.layout,a)||!oo(t.derivedItemConstraints,o)||t.axisSize!==n,state:{defaultLayoutDeferred:!1,derivedItemConstraints:o,axisSize:n,layout:a,requestedAxisSize:r,requestedLayout:i,separatorToItems:t.separatorToItems}}}function St({axisId:e,itemId:t}){const n=()=>{const l=he();for(const[c,d]of l)if(c.id===e)return{axis:c,...d};throw Error(`Group ${e} not found`)},o=()=>{const l=n().derivedItemConstraints.find(c=>c.itemId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const{axis:l,...c}=n(),d=yt({axis:l,axisState:c}),p=d?.state??c,g=p.derivedItemConstraints.find(m=>m.itemId===t);if(g===void 0)throw Error(`Panel constraints not found for Panel ${t}`);const f=p.layout[t];if(f===void 0)throw Error(`Layout not found for Panel ${t}`);return{axis:l,changed:d?.changed===!0,itemConstraints:g,itemSize:f,state:p}},i=()=>{const l=n().axis.items.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},a=({nextSize:l,items:c,prevLayout:d,derivedItemConstraints:p})=>{const g=d[t],f=c.findIndex(y=>y.id===t),m=f===0,h=f===c.length-1;if(h&&l<g&&(m||c.slice(0,f).every((y,C)=>{const b=p[C];return b?.collapsible&&Y(b.collapsedSize,d[b.itemId])}))){const y=c.slice(0,f).reduce((C,b)=>C+d[b.id],0);return{...d,[t]:Z(100-y)}}return Ne({delta:h?g-l:l-g,initialLayout:d,itemConstraints:p,pivotIndices:h?[f-1,f]:[f,f+1],prevLayout:d,trigger:"imperative-api"})},u=(l,{axis:c,changed:d,itemSize:p,state:g})=>{if(l===p)return;const{derivedItemConstraints:f,axisSize:m,layout:h}=g,S=a({nextSize:l,items:c.items,prevLayout:h,derivedItemConstraints:f}),y=ye({layout:S,itemConstraints:f});(d||!ie(h,y))&&fe(c,{...g,layout:y,requestedAxisSize:m,requestedLayout:y})};return{collapse:()=>{const l=r(),{collapsible:c,collapsedSize:d}=l.itemConstraints,{mutableValues:p}=i(),g=l.itemSize;c&&g!==d&&(p.expandToSize=g,u(d,l))},expand:()=>{const l=r(),{collapsible:c,collapsedSize:d,minSize:p}=l.itemConstraints,{mutableValues:g}=i(),f=l.itemSize;if(c&&f===d){let m=g.expandToSize??p;m===0&&(m=1),u(m,l)}},getSize:()=>{const{axis:l}=n(),c=s(),{element:d}=i(),p=l.layoutStrategy?l.layoutStrategy.getItemSizeInPixels(t):l.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:c,inPixels:p}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=o(),d=s();return l&&Y(c,d)},resize:l=>{const c=r(),{axisSize:d}=c.state,{element:p}=i(),g=ze({axisSize:d,itemElement:p,styleProp:l}),f=Z(g/d*100);u(f,c)}}}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,s=St({axisId:o.axis.id,itemId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function pn(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 Oe({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{axis:o,...r}=t(),i=yt({axis:o,axisState:r}),s=i?.state??r,{defaultLayoutDeferred:a,derivedItemConstraints:u,axisSize:l,layout:c}=s,d=ye({layout:n,itemConstraints:u});return a?c:((i?.changed||!ie(c,d))&&fe(o,{...s,layout:d,requestedAxisSize:l,requestedLayout:d}),d)}}}function ve(e,t){const n=pn(e),o=ae(n.id,!0),r=n.separators.find(d=>d.element===e);O(r,"Matching separator not found");const i=o.separatorToItems.get(r);O(i,"Matching panels not found");const s=i.map(d=>n.items.indexOf(d)),u=Oe({axisId:n.id}).getLayout(),l=Ne({delta:t,initialLayout:u,itemConstraints:o.derivedItemConstraints,pivotIndices:s,prevLayout:u,trigger:"keyboard"}),c=ye({layout:l,itemConstraints:o.derivedItemConstraints});ie(u,c)||fe(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedItemConstraints:o.derivedItemConstraints,axisSize:o.axisSize,layout:c,requestedAxisSize:o.axisSize,requestedLayout:c,separatorToItems:o.separatorToItems},{isUserInteraction:!0})}function io(e){return e.separators.filter(t=>!t.disabled)}function $t(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=pn(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:s,separatorToItems:a}=r,u=n.separators.find(p=>p.element===t);O(u,"Matching separator not found");const l=a.get(u);O(l,"Matching panels not found");const c=l[0],d=i.find(p=>p.itemId===c.id);if(O(d,"Panel metadata not found"),d.collapsible){const p=s[c.id],g=d.collapsedSize===p?n.mutableState.expandedItemSizes[c.id]??d.minSize:d.collapsedSize;ve(t,g-p)}break}case"F6":{e.preventDefault();const r=io(n).map(u=>u.element),i=r.findIndex(u=>u===e.currentTarget);O(i!==-1,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),ve(t,-100);break}}}function Ee(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 s=o.get(i);i.resizePreviewMode==="separator"&&s&&!ie(r,s.layout)&&fe(i,{...s,layout:r,requestedAxisSize:s.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 Ot(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))||Ee(e.currentTarget,e)}function Gt(e){Ee(e.currentTarget,e)}function so(e,t){const{element:n,orientation:o,items:r}=e,i=n.getBoundingClientRect(),s=o==="horizontal";return dt({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:u,rect:l,separator:c},d)=>{const p=r.indexOf(u[0]),g=s?l.left+l.width/2:l.top+l.height/2;return{active:t.some(m=>{if(m.axis!==e||m.items[0]!==u[0])return!1;if(c||m.separator)return m.separator===c;const h=s?m.rect.left+m.rect.width/2:m.rect.top+m.rect.height/2;return Y(g,h)}),axis:e,key:c?`separator-${c.id}`:`panel-${u[0].id}-${d}`,offset:0,itemIndex:p,rect:new DOMRect((s&&!c?g:l.left)-i.left-n.clientLeft+n.scrollLeft,(!s&&!c?g:l.top)-i.top-n.clientTop+n.scrollTop,s&&!c?0:l.width,!s&&!c?0:l.height),separator:c}})}function Nt(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=re();if(t.state==="active"){cn(t,e)&&Ee(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(a=>{a.separator&&(i||(i=!0,a.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=n.get(a.axis);u&&r.set(a.axis,u.layout)});const s=Array.from(r.keys()).flatMap(a=>a.resizePreviewMode==="separator"?so(a,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:s,state:"active"}),e.preventDefault()}function jt(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 Ft(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){Ee(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 _t(e){if(e.relatedTarget instanceof HTMLIFrameElement){const t=re();switch(t.state){case"hover":t.ownerDocument===e.currentTarget&&de({cursorFlags:0,state:"inactive"})}}}function Bt(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||ln(e.currentTarget,e)}function qt(e){e.target===e.currentTarget&&Ee(e.currentTarget.document)}function Ht(e){Ee(e.currentTarget.document)}function ao(e,t,n){if(!n[0])return;const r=e.items.find(l=>l.element===t);if(!r||!r.onResize)return;const i=_e({axis:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,a=r.mutableValues.prevSize,u={asPercentage:Z(s/i*100),inPixels:s};r.mutableValues.prevSize=u,r.onResize(u,r.id,a)}const we=new Map;let Vt=!1;function hn(e){let t=!0;O(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(f=>{let m;Je();try{for(const h of f){const{borderBoxSize:S,target:y}=h;if(y===e.element){if(t){const C=ae(e.id);if(!C)break;const b=yt({axis:e,axisState:C});if(!b)break;if(!b.changed)continue;fe(e,b.state)}}else try{ao(e,y,S)}catch(C){m??={error:C}}}}finally{Ze()}if(m)throw m.error});i.observe(e.element),e.items.forEach(f=>{O(!o.has(f.id),`Panel ids must be unique; id "${f.id}" was used more than once`),o.add(f.id),f.onResize&&i.observe(f.element)});const s=_e({axis:e}),a=ft(e,s),u=dn({axis:e,itemConstraints:a}),l=ye({layout:u,itemConstraints:a}),c=e.element.ownerDocument,d=c.defaultView;we.set(c,(we.get(c)??0)+1);const p=new Map;return dt({axis:e,includeDisabled:!0}).forEach(f=>{f.separator&&p.set(f.separator,f.items)}),fe(e,{defaultLayoutDeferred:s===0,derivedItemConstraints:a,axisSize:s,layout:l,requestedAxisSize:s,requestedLayout:mn({itemIds:e.items.map(({id:f})=>f),layout:u}),separatorToItems:p}),e.separators.forEach(f=>{O(!r.has(f.id),`Separator ids must be unique; id "${f.id}" was used more than once`),r.add(f.id),f.element.addEventListener("keydown",$t)}),Vt||(Vt=!0,lt($n)),we.get(c)===1&&(c.addEventListener("contextmenu",Pt,!0),c.addEventListener("dblclick",Dt,!0),c.addEventListener("lostpointercapture",Ot,!0),c.addEventListener("pointercancel",Gt,!0),c.addEventListener("pointerdown",Nt,!0),c.addEventListener("pointerleave",jt),c.addEventListener("pointermove",Ft),c.addEventListener("pointerout",_t),c.addEventListener("pointerup",Bt,!0),d?.addEventListener("blur",qt),d?.addEventListener("pagehide",Ht)),function(){t=!1,we.set(c,Math.max(0,(we.get(c)??0)-1)),qn(e),Tn(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",$t)}),we.get(c)||(c.removeEventListener("contextmenu",Pt,!0),c.removeEventListener("dblclick",Dt,!0),c.removeEventListener("lostpointercapture",Ot,!0),c.removeEventListener("pointercancel",Gt,!0),c.removeEventListener("pointerdown",Nt,!0),c.removeEventListener("pointerleave",jt),c.removeEventListener("pointermove",Ft),c.removeEventListener("pointerout",_t),c.removeEventListener("pointerup",Bt,!0),d?.removeEventListener("blur",qt),d?.removeEventListener("pagehide",Ht)),i.disconnect()}}function gn({derivedItemConstraints:e,axis:t,layout:n,prevLayout:o,requestedLayout:r}){const i=t.items.map(({id:s})=>s).join(",");t.mutableState.layouts[i]=r,o&&e.forEach(s=>{if(s.collapsible){const a=Y(s.collapsedSize,n[s.itemId]),u=Y(s.collapsedSize,o[s.itemId]);a&&!u&&(t.mutableState.expandedItemSizes[s.itemId]=o[s.itemId])}})}function yn(){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 vt=w.createContext(null);function co({layout:e,itemConstraints:t,itemId:n,itemIndex:o}){let r,i;const s=e[n],a=t.find(u=>u.itemId===n);if(a){const u=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];i=ye({layout:Ne({delta:l-s,initialLayout:e,itemConstraints:t,pivotIndices:c,prevLayout:e}),itemConstraints:t})[n],r=ye({layout:Ne({delta:u-s,initialLayout:e,itemConstraints:t,pivotIndices:c,prevLayout:e}),itemConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:i,valueNow:s}}function Sn({attributes:e,axisId:t,axisOrientation:n,children:o,className:r,"data-testid":i,disableCursor:s,disabled:a,disableDoubleClick:u,elementRef:l,id:c,isSharedHitRegion:d,preview:p,registerSeparator:g,requiredStyle:f,style:m,styleDefaults:h,tabIndex:S=0,updateSeparatorProps:y}){const C=et({disabled:a,disableDoubleClick:u,children:o,className:r,preview:p,style:m}),[b,M]=w.useState({}),[F,N]=w.useState("inactive"),[x,z]=w.useState(!1),v=w.useRef(null),P=w.useRef(null),D=je(v,l),k=n==="horizontal"?"vertical":"horizontal";ne(()=>{const I=v.current;if(I!==null){const E={disabled:C.disabled,disableDoubleClick:C.disableDoubleClick,element:I,id:c,get children(){return C.children},get className(){return C.className},get preview(){return C.preview},get style(){return C.style}};P.current=E;const B=g(E),K=lt(J=>{N(J.next.state!=="inactive"&&J.next.hitRegions.some(se=>se.separator===E||(d?.(se)??!1))?J.next.state:"inactive")}),X=Ge(t,J=>{const{derivedItemConstraints:se,layout:be,separatorToItems:Me}=J.next,xe=Me.get(E);if(xe){const L=xe[0],T=se.findIndex(G=>G.itemId===L.id),{layoutStrategy:j}=J.axis;M({...co({layout:be,itemConstraints:se,itemId:L.id,itemIndex:T}),...j?.getItemAriaControls&&{valueControls:j.getItemAriaControls(L.id)}})}});return()=>{P.current=null,K(),X(),B()}}},[t,c,d,g,C]),ne(()=>{const I=P.current;I&&kn(I)},[p]),w.useEffect(()=>{y(c,{disabled:a,disableDoubleClick:u})},[a,u,c,y]);let $;a&&!s&&($="not-allowed");let R;if(a)R="disabled";else switch(F){case"active":{R="active";break}default:x?R="focus":R=F}return W.jsx("div",{...e,"aria-controls":b.valueControls,"aria-disabled":a||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:c,onBlur:()=>z(!1),onFocus:()=>z(!0),ref:D,role:"separator",style:{...h,cursor:$,...m,...f,touchAction:"none"},tabIndex:a?void 0:S})}function Ut({axis:e,children:t,className:n,crossSpan:o,crossStart:r,disabled:i,elementRef:s,index:a,style:u}){const l=Re(void 0),{getDisableCursor:c,getResizeAxisId:d,gutters:p,registerSeparator:g,separatorPlacements:f,trackCounts:m,updateSeparatorProps:h}=Jt(),S=d(e),y=e==="column"?"row":"column",C=m[y],b=!!i||!at(a,m[e]);let M=!0;for(const v of f.values())if(v.axis===e&&v.index===a&&!v.disabled&&v.crossStart<r){M=!1;break}const F=w.useCallback(v=>v.axis.id===S&&v.axis.items.indexOf(v.items[1])===a,[S,a]),N=w.useCallback(v=>g({axis:e,crossSpan:o,crossStart:r,disabled:!!i,index:a},v),[e,o,r,i,a,g]),x=Ln(a),z=Rn({crossCount:C,crossSpan:o,crossStart:r,hasGutters:p[y]});return W.jsx(Sn,{axisId:S,axisOrientation:e==="column"?"horizontal":"vertical",className:n,disableCursor:c(),disabled:b,disableDoubleClick:void 0,elementRef:s,id:l,isSharedHitRegion:F,registerSeparator:N,requiredStyle:{gridColumn:e==="column"?x:z,gridRow:e==="row"?x:z},style:u,tabIndex:M?0:-1,updateSeparatorProps:h,children:t})}function bt(e){const{children:t,className:n,disabled:o,elementRef:r,style:i}=e;return e.type==="column"?W.jsx(Ut,{axis:"column",className:n,crossSpan:e.rowSpan,crossStart:e.row??0,disabled:o,elementRef:r,index:e.column,style:i,children:t}):W.jsx(Ut,{axis:"row",className:n,crossSpan:e.columnSpan,crossStart:e.column??0,disabled:o,elementRef:r,index:e.row,style:i,children:t})}bt.displayName="Gridline";const Ce=["column","row"],Wt={columns:{},rows:{}};function vn({children:e,className:t,columns:n,defaultLayout:o,disableCursor:r,disabled:i,elementRef:s,gridRef:a,id:u,onLayoutChange:l,onLayoutChanged:c,resizeTargetMinimumSize:d={coarse:20,fine:10},rows:p,style:g,...f}){const m=Re(u),h=w.useCallback(L=>L==="column"?`${m}:columns`:`${m}:rows`,[m]),S=Yt(n,"columns"),y=Yt(p,"rows"),C=L=>L==="column"?S:y,b=w.useRef({onLayoutChange:Wt,onLayoutChanged:Wt}),M=ge(L=>{Xt(b.current.onLayoutChange,L)||(b.current.onLayoutChange=L,l?.(L))}),F=ge((L,T,j)=>{Xt(b.current.onLayoutChanged,L)||(b.current.onLayoutChanged=L,c?.(L,{isUserInteraction:T,requestedLayout:j}))}),N=w.useRef(null),x=je(N,s),[z,v]=yn(),P=w.useRef({cells:[],column:{expandedItemSizes:{},layouts:{}},loggedErrors:new Set,row:{expandedItemSizes:{},layouts:{}},separators:new Map}),D={column:!1,row:!1};for(const L of P.current.separators.values())D[L.axis]=!0;bn(e,D);const k=et({defaultLayout:o,disableCursor:r,resizeTargetMinimumSize:d}),$=ge(()=>!!k.disableCursor),R=w.useCallback(L=>{const T=P.current;return T.cells=[...T.cells,L],v(),()=>{T.cells=T.cells.filter(j=>j!==L),v()}},[v]),I=w.useCallback((L,T)=>{const j=P.current;return j.separators=new Map(j.separators),j.separators.set(T,L),v(),()=>{j.separators=new Map(j.separators),j.separators.delete(T),v()}},[v]),E=w.useCallback((L,{disabled:T,disableDoubleClick:j})=>{for(const G of P.current.separators.keys())G.id===L&&(G.disabled=T,G.disableDoubleClick=j)},[]),B=P.current.separators,K=w.useMemo(()=>({getDisableCursor:$,getResizeAxisId:h,gutters:{column:D.column,row:D.row},id:m,registerCell:R,registerSeparator:I,separatorPlacements:B,trackCounts:{column:S.length,row:y.length},updateSeparatorProps:E}),[S.length,$,h,D.column,D.row,m,R,I,y.length,B,E]),X=w.useRef([]);ne(()=>{const L=N.current;if(L===null)return;const T=P.current,j=uo({cells:T.cells,separatorPlacements:T.separators,trackCounts:{column:S.length,row:y.length}});j.forEach(A=>{T.loggedErrors.has(A)||console.error(A)}),T.loggedErrors=new Set(j);const G=A=>Array.from(T.separators.entries()).filter(([,U])=>U.axis===A).sort(([,U],[,me])=>U.index-me.index).map(([U])=>U),_=A=>{const U=A==="column"?S:y,me=A==="column"?y:S,pe=U.map(Q=>Q.id),Be=h(A),qe=G(A),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})),ke=()=>{const Q=[];if(Se){for(const[oe,ee]of T.separators)if(ee.axis===A&&at(ee.index,U.length)){const Ae=oe.element.getBoundingClientRect();Q[ee.index]=Math.max(Q[ee.index]??0,A==="column"?Ae.width:Ae.height)}}return Mn({axis:A,element:L,gutterSizes:Q.filter(oe=>oe!==void 0),hasGutters:Se,layout:ae(Be)?.layout,trackIds:pe})};let Te;const nt=k.defaultLayout?.[A==="column"?"columns":"rows"];if(nt!==void 0&&Object.keys(nt).length===pe.length){Te={};for(const Q of pe){const oe=nt[Q];oe!==void 0&&(Te[Q]=oe)}}return{disabled:!!i,element:L,id:Be,layoutStrategy:{getItemAriaControls:Q=>{const oe=pe.indexOf(Q);return T.cells.filter(ee=>{const Ae=A==="column"?ee.column:ee.row,Cn=A==="column"?ee.columnSpan:ee.rowSpan;return Ae<=oe&&oe<Ae+Cn}).map(ee=>ee.element.id).filter(Boolean).join(" ")||void 0},calculateAvailableSize:()=>ke().availableSize,calculateHitRegions:({expandHitTargets:Q,axis:oe,includeDisabled:ee})=>En({axis:A,cells:T.cells,crossTrackCount:me.length,expandHitTargets:Q,resizeAxis:oe,axisSize:ke().availableSize,includeDisabled:ee,separatorPlacements:T.separators}),getItemSizeInPixels:Q=>ke().trackSizes[pe.indexOf(Q)]??0},mutableState:{defaultLayout:Te,disableCursor:!!k.disableCursor,expandedItemSizes:T[A].expandedItemSizes,layouts:T[A].layouts},orientation:A==="column"?"horizontal":"vertical",items:He,resizePreviewMode:"panel",get resizeTargetMinimumSize(){return k.resizeTargetMinimumSize},separators:qe}},H=Ce.map(_);X.current=H;const V=H.map(A=>hn(A)),te=()=>{const[A,U]=H.map(me=>ae(me.id));if(!(!A||!U||A.defaultLayoutDeferred||U.defaultLayoutDeferred))return{layout:{columns:A.layout,rows:U.layout},requestedLayout:{columns:A.requestedLayout,rows:U.requestedLayout}}};{const A=te();if(A)try{try{M(A.layout)}finally{F(A.layout,!1,A.requestedLayout)}}catch(U){throw X.current=[],V.forEach(me=>me()),U}}const Pe=H.map(A=>Ge(A.id,U=>{const{defaultLayoutDeferred:me,derivedItemConstraints:pe,layout:Be,requestedLayout:qe}=U.next;if(me||pe.length===0)return;gn({derivedItemConstraints:pe,axis:A,layout:Be,prevLayout:U.prev?.layout,requestedLayout:qe});const Se=te();if(Se){const He=re(),ke=He.state!=="active"||!He.hitRegions.some(Te=>H.includes(Te.axis));try{M(Se.layout)}finally{ke&&F(Se.layout,U.isUserInteraction,Se.requestedLayout)}}}));return()=>{X.current=[],V.forEach(A=>A()),Pe.forEach(A=>A())}},[S,i,h,m,F,M,y,z,k]),w.useEffect(()=>{X.current.forEach(L=>{L.mutableState.defaultLayout=o?.[L.orientation==="horizontal"?"columns":"rows"],L.mutableState.disableCursor=!!r})}),w.useImperativeHandle(a,()=>{const L=()=>{const[G,_]=Ce.map(h);return!Ie(G)||!Ie(_)?{columns:{},rows:{}}:{columns:Oe({axisId:G}).getLayout(),rows:Oe({axisId:_}).getLayout()}},T=G=>G.map(_=>`"${_}"`).join(", "),j=(G,_)=>{const H=h(G),V=()=>{const te=Ie(H);return O(te,`Grid "${m}" has not been mounted`),O(te.items.some(Pe=>Pe.id===_),`Grid "${m}" no longer contains a ${G} with id "${_}"; ${G} ids are ${T(te.items.map(Pe=>Pe.id))}`),St({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:(G,_)=>{const H=G==="column"?S:y,V=`${_}`;return O(H.some(te=>te.id===V),`Grid "${m}" does not contain a ${G} with id "${V}"; ${G} ids are ${T(H.map(te=>te.id))}`),j(G,V)},getTrackByIndex:(G,_)=>{const H=G==="column"?S:y,V=Number.isInteger(_)?H[_]:void 0;return O(V,`Grid "${m}" does not contain a ${G} at index ${_}; it has ${H.length} ${G}s`),j(G,V.id)},setLayout:G=>(Ce.forEach(_=>{const H=G[_==="column"?"columns":"rows"],V=h(_);H&&Ie(V)&&Oe({axisId:V}).setLayout(H)}),L())}},[S,h,m,y]);const J=()=>Ce.map(L=>{const T=ae(h(L)),j=C(L);return(T&&!T.defaultLayoutDeferred?j.map(_=>`minmax(0, ${T.layout[_.id]??1}fr)`):lo(j,o?.[L==="column"?"columns":"rows"])).join(D[L]?" auto ":" ")}).join("|"),se=w.useCallback(L=>{const T=Ce.map(j=>Ge(h(j),L));return()=>T.forEach(j=>j())},[h]),be=w.useSyncExternalStore(se,J,J),[Me,xe]=be.split("|");return W.jsx(Kt.Provider,{value:K,children:W.jsx("div",{...f,className:t,"data-grid":!0,"data-testid":Fe(f,u),id:m,ref:x,style:{height:"100%",width:"100%",overflow:"hidden",...g,display:"grid",gridTemplateColumns:Me,gridTemplateRows:xe,touchAction:"none"},children:W.jsx(vt.Provider,{value:null,children:e})})})}vn.displayName="Grid";function Yt(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 O(o.length>0,`Grid must have at least one track; "${t}" is ${n}`),o},[n])}function bn(e,t){w.Children.forEach(e,n=>{if(w.isValidElement(n))if(n.type===bt){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&&bn(n.props.children,t)})}function lo(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:en(i.defaultSize));let o=100,r=0;return n.forEach(i=>{i===void 0?r++:i[1]==="%"&&(o-=i[0])}),n.map(i=>{if(i===void 0)return`minmax(0, ${Math.max(0,o)/Math.max(1,r)}fr)`;const[s,a]=i;return a==="%"?`minmax(0, ${s}fr)`:`${s}${a}`})}function uo({cells:e,separatorPlacements:t,trackCounts:n}){const o=[];for(const a of e)Ce.forEach(u=>{const[l,c]=u==="column"?[a.column,a.columnSpan]:[a.row,a.rowSpan],d=n[u];(!Number.isInteger(l)||!Number.isInteger(c)||l<0||c<1||l+c>d)&&o.push(`Invalid Cell ${u} placement (${u}: ${l}, ${u}Span: ${c}); Grid has ${d} ${u}s`)});const r=({axis:a,crossSpan:u,crossStart:l,disabled:c,index:d})=>{const p=a==="column"?"row":"column";let g=`type="${a}" ${a}={${d}}`;return(l!==0||u!==void 0)&&(g+=` ${p}={${l}}`),u!==void 0&&(g+=` ${p}Span={${u}}`),c&&(g+=" disabled"),`<Gridline ${g} />`},i=Array.from(t.values()).filter(a=>{const{axis:u,crossSpan:l,crossStart:c,index:d}=a,p=u==="column"?"row":"column",g=n[u],f=n[p];let m=!0;return at(d,g)||(o.push(`Invalid ${u} Gridline ${u} (${d}); must be between 1 and ${g-1}`),m=!1),!Number.isInteger(c)||c<0||c>=f?(o.push(`Invalid ${u} Gridline ${p} (${c}); must be between 0 and ${f-1}`),m=!1):l!==void 0&&(!Number.isInteger(l)||l<1||c+l>f)&&(o.push(`Invalid ${u} Gridline ${p}Span (${l}); Grid has ${f} ${p}s`),m=!1),m}),s=a=>{const u=n[a.axis==="column"?"row":"column"];return[a.crossStart,a.crossSpan===void 0?u:a.crossStart+a.crossSpan]};return i.forEach((a,u)=>{const{axis:l,index:c}=a,[d,p]=s(a);for(const g of e){const[f,m,h,S]=l==="column"?[g.column,g.columnSpan,g.row,g.rowSpan]:[g.row,g.rowSpan,g.column,g.columnSpan];if(f<c&&c<f+m&&h<p&&d<h+S){const y=l==="column"?"row":"column";o.push(`${r(a)} overlaps a Cell that spans across it (${l}: ${f}, ${l}Span: ${m}, ${y}: ${h}, ${y}Span: ${S}); use the ${y} and ${y}Span props to render gridlines beside the Cell instead`)}}for(const g of i.slice(u+1))if(g.axis===l&&g.index===c){const[f,m]=s(g);f<p&&d<m&&o.push(`${r(a)} overlaps ${r(g)}`)}}),o}function Xt(e,t){return ie(e.columns,t.columns)&&ie(e.rows,t.rows)}function fo({id:e,onlySaveAfterUserInteractions:t,storage:n=localStorage}){const o=`react-resizable-panels:grid:${e}`,r=w.useSyncExternalStore(mo,()=>n.getItem(o),()=>n.getItem(o)),i=w.useMemo(()=>{if(r)try{const a=JSON.parse(r);if(a!==null&&typeof a=="object")return a}catch{}},[r]),s=w.useCallback((a,u)=>{if(!(t&&!u.isUserInteraction))try{n.setItem(o,JSON.stringify(u.requestedLayout??a))}catch(l){console.error(l)}},[t,n,o]);return{defaultLayout:i,onLayoutChanged:s}}function mo(){return function(){}}function po(){return w.useState(null)}function ho(){return w.useRef(null)}function go(e){for(let t=1;t<e.length;t++)if(ut(e[t-1],e[t])>0)return!1;return!0}function yo({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("*")],s=t.ownerDocument.defaultView;return r.forEach((a,u)=>{const l=i[u];if(l instanceof s.HTMLElement||l instanceof s.SVGElement){const c=s.getComputedStyle(a);for(let d=0;d<c.length;d++){const p=c.item(d);l.style.setProperty(p,c.getPropertyValue(p))}}l.removeAttribute("data-testid"),l.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(vt);return O(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function xt(e){const{registerOverlay:t}=tt(),n=w.useRef(e);fn(n.current,e)||(n.current=e);const o=n.current;return ne(()=>t(o),[t,o]),null}xt.displayName="SeparatorOverlay";function So({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 vo({overlay:e,preview:t}){const{axis:n,offset:o,rect:r,separator:i}=t,s=n.orientation==="horizontal";let a=i?.preview,u=e;return w.isValidElement(a)&&a.type===xt&&(u=a.props,a=void 0),a==null&&(u?a=W.jsx(So,{...u,active:t.active,orientation:n.orientation}):i&&(a=W.jsx(yo,{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:s?`translateX(${o}px)`:`translateY(${o}px)`,width:r.width},children:a})}function bo(e){return Array.from(e).sort(ut)}function xo(e,t){const n=w.useRef({getLayout:()=>({}),setLayout:An});w.useImperativeHandle(t,()=>n.current,[]),ne(()=>{Object.assign(n.current,Oe({axisId:e}))})}function wo({groupId:e,resizePreviewMode:t}){const[n,o]=w.useState([]),r=w.useRef(n);return ne(()=>{const i=a=>{const u=Ie(e),l=t==="separator"&&a.state==="active"?a.previews.filter(d=>d.axis===u&&(d.active||!Y(d.offset,0))):[],c=r.current;c.length===l.length&&l.every((d,p)=>d===c[p])||(r.current=l,o(l))};if(t!=="separator"){i(re());return}const s=lt(({next:a})=>i(a));return i(re()),s},[e,t]),n}function xn({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:i,groupRef:s,id:a,onLayoutChange:u,onLayoutChanged:l,orientation:c="horizontal",resizePreviewMode:d="panel",resizeTargetMinimumSize:p={coarse:20,fine:10},style:g,...f}){const m=w.useRef({onLayoutChange:{},onLayoutChanged:{}}),h=ge(I=>{ie(m.current.onLayoutChange,I)||(m.current.onLayoutChange=I,u?.(I))}),S=ge((I,E,B)=>{ie(m.current.onLayoutChanged,I)||(m.current.onLayoutChanged=I,l?.(I,{isUserInteraction:E,requestedLayout:B}))}),y=Re(a),[C,b]=w.useState(),M=wo({groupId:y,resizePreviewMode:d}),F=w.useRef(null),[N,x]=yn(),z=w.useRef([]),v=w.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),P=je(F,i);xo(y,s);const D=ge((I,E)=>{const B=ae(I);if(B)return{flexGrow:B.layout[E]??1};if(n?.[E])return{flexGrow:n?.[E]}}),k=et({defaultLayout:n,disableCursor:o,resizeTargetMinimumSize:p}),$=w.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:D,id:y,orientation:c,registerPanel:I=>{const E=v.current;return E.panels=De(c,[...E.panels,I]),x(),()=>{E.panels=E.panels.filter(B=>B!==I),x()}},registerOverlay:I=>(b(I),()=>{b(void 0)}),registerSeparator:I=>{const E=v.current;return E.separators=De(c,[...E.separators,I]),x(),()=>{E.separators=E.separators.filter(B=>B!==I),x()}},updatePanelProps:(I,{disabled:E})=>{const K=v.current.panels.find(se=>se.id===I);if(!K||K.constraintProps.disabled===E)return;K.constraintProps.disabled=E;const X=Ie(y),J=ae(y);X&&J&&fe(X,{...J,derivedItemConstraints:ft(X)})},updateSeparatorProps:(I,{disabled:E,disableDoubleClick:B})=>{const X=v.current.separators.find(J=>J.id===I);X&&(X.disabled=E,X.disableDoubleClick=B)}}),[D,y,x,c,k]),R=w.useRef(null);return ne(()=>{const I=F.current;if(I===null)return;const E=v.current;E.panels=De(c,E.panels),E.separators=De(c,E.separators),z.current=bo([...E.panels.map(({element:L})=>L),...E.separators.map(({element:L})=>L)]);let B;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===E.panels.length){B={};for(const L of E.panels){const T=k.defaultLayout[L.id];T!==void 0&&(B[L.id]=T)}}const K={disabled:!!r,element:I,id:y,mutableState:{defaultLayout:B,disableCursor:!!k.disableCursor,expandedItemSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:c,items:E.panels,resizePreviewMode:d,get resizeTargetMinimumSize(){return k.resizeTargetMinimumSize},separators:E.separators};R.current=K;const X=hn(K),{defaultLayoutDeferred:J,derivedItemConstraints:se,layout:be,requestedLayout:Me}=ae(K.id,!0);if(!J&&se.length>0)try{try{h(be)}finally{S(be,!1,Me)}}catch(L){throw R.current=null,X(),L}const xe=Ge(y,L=>{const{defaultLayoutDeferred:T,derivedItemConstraints:j,layout:G,requestedLayout:_}=L.next;if(T||j.length===0)return;gn({derivedItemConstraints:j,axis:K,layout:G,prevLayout:L.prev?.layout,requestedLayout:_});const H=re(),V=H.state!=="active"||!H.hitRegions.some(te=>te.axis===K);try{h(G)}finally{V&&S(G,L.isUserInteraction,_)}});return()=>{R.current=null,X(),xe()}},[r,y,S,h,c,N,d,k]),ne(()=>{go(z.current)||x()}),w.useEffect(()=>{const I=R.current;I&&(I.mutableState.defaultLayout=n,I.mutableState.disableCursor=!!o)}),W.jsx(vt.Provider,{value:$,children:W.jsxs("div",{...f,className:t,"data-group":!0,"data-testid":Fe(f,a),id:y,ref:P,style:{height:"100%",width:"100%",overflow:"hidden",position:d==="separator"?"relative":void 0,...g,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:[e,M.map(I=>W.jsx(vo,{overlay:C,preview:I},I.key))]})})}xn.displayName="Group";function Xe(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function zo({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 s=t.join(","),a=i[s];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const u={};for(let l=0;l<t.length;l++)u[t[l]]=a.layout[l];return u}}else{const s=Object.keys(i);if(s.length===1){const a=i[s[0]];if(a&&Array.isArray(a.layout)){const u=s[0].split(",");if(u.length===a.layout.length){const l={};for(let c=0;c<u.length;c++)l[u[c]]=a.layout[c];return l}}}}}catch{}}function Co({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...r}){const i=n!==void 0,s="id"in r?r.id:r.groupId,a=Xe(s,n??[]),u=w.useSyncExternalStore(Io,()=>o.getItem(a),()=>o.getItem(a)),l=w.useMemo(()=>{if(u){const h=JSON.parse(u),S=Object.values(h);if(Array.from(S).every(y=>typeof y=="number"))return h}},[u]),c=w.useMemo(()=>{if(!l)return zo({id:s,panelIds:n,storage:o})},[l,s,n,o]),d=l??c,p=w.useRef(null),g=w.useCallback(()=>{const h=p.current;h&&(p.current=null,clearTimeout(h))},[]);w.useLayoutEffect(()=>()=>{g()},[g]);const f=w.useCallback((h,S)=>{if(t&&!S.isUserInteraction)return;g();const y=S.requestedLayout??h;let C;i?C=Xe(s,Object.keys(y)):C=Xe(s,[]);try{o.setItem(C,JSON.stringify(y))}catch(b){console.error(b)}},[g,i,s,t,o]),m=w.useCallback(h=>{g(),e===0?f(h,{isUserInteraction:!1}):p.current=setTimeout(()=>{f(h,{isUserInteraction:!1})},e)},[g,e,f]);return{defaultLayout:d,onLayoutChange:m,onLayoutChanged:f}}function Io(){return function(){}}function Lo(){return w.useState(null)}function Ro(){return w.useRef(null)}function Eo(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,St({axisId:n,itemId:e}))})}function wn({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:r=!1,defaultSize:i,disabled:s,elementRef:a,groupResizeBehavior:u="preserve-relative-size",id:l,maxSize:c="100%",minSize:d="0%",onResize:p,panelRef:g,style:f,...m}){const h=Ke(l),S=Re(l),y=et({disabled:s}),C=w.useRef(null),b=je(C,a),{getPanelStyles:M,id:F,orientation:N,registerPanel:x,updatePanelProps:z}=tt(),v=p!==null,P=ge((R,I,E)=>{p?.(R,l,E)});ne(()=>{const R=C.current;if(R!==null){const I={element:R,id:S,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:v?P:void 0,constraintProps:{groupResizeBehavior:u,collapsedSize:n,collapsedThreshold:o,collapsible:r,defaultSize:i,disabled:y.disabled,maxSize:c,minSize:d}};return x(I)}},[u,n,o,r,i,v,S,h,c,d,P,x,y]),w.useEffect(()=>{z(S,{disabled:s})},[s,S,z]),Eo(S,g);const D=()=>{const R=M(F,S);if(R)return JSON.stringify(R)},k=w.useSyncExternalStore(R=>Ge(F,R),D,D);let $;return k?$=JSON.parse(k):i!==void 0?$={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:$={flexGrow:1},W.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":Fe(m,l),id:S,ref:b,style:{...Mo,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...$},children:W.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...f,touchAction:N==="horizontal"?"pan-y":"pan-x"},children:e})})}wn.displayName="Panel";const Mo={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Po(){return w.useState(null)}function ko(){return w.useRef(null)}const To={flexBasis:"auto"},Ao={flexGrow:0,flexShrink:0};function zn({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:i,preview:s,style:a,...u}){const l=Re(i),{disableCursor:c,id:d,orientation:p,registerSeparator:g,updateSeparatorProps:f}=tt();return W.jsx(Sn,{attributes:u,axisId:d,axisOrientation:p,className:t,"data-testid":Fe(u,i),disableCursor:c,disabled:n,disableDoubleClick:o,elementRef:r,id:l,preview:s,registerSeparator:g,requiredStyle:Ao,style:a,styleDefaults:To,updateSeparatorProps:f,children:e})}zn.displayName="Separator";exports.Cell=Zt;exports.Grid=vn;exports.Gridline=bt;exports.Group=xn;exports.Panel=wn;exports.Separator=zn;exports.SeparatorOverlay=xt;exports.isCoarsePointer=Qt;exports.useDefaultGridLayout=fo;exports.useDefaultLayout=Co;exports.useGridCallbackRef=po;exports.useGridRef=ho;exports.useGroupCallbackRef=Lo;exports.useGroupRef=Ro;exports.usePanelCallbackRef=Po;exports.usePanelRef=ko;
|
|
2
2
|
//# sourceMappingURL=react-resizable-panels.cjs.map
|