react-resizable-panels 4.21.0 → 4.22.0

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,3 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),f=require("react"),br=require("react-dom");function yr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const vr=yr(f);function ln(e){return(typeof e=="number"||typeof e=="string")&&e!==""}function st(e){const t=f.useId();return ln(e)?`${e}`:t}const ce=typeof window<"u"?f.useLayoutEffect:f.useEffect;function ge(e){const t=f.useRef(e);return ce(()=>{t.current=e},[e]),f.useCallback((...n)=>t.current?.(...n),[t])}function Ke(...e){return ge(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function xt(e,t){const n=e?.["data-testid"];return ln(n)?`${n}`:ln(t)?`${t}`:void 0}function Yn(e,t){return t?e*2+1:e+1}function Sr(e,t){return t?e*2-1:e}function Ko(e,t,n){return`${Yn(e,n)} / span ${Sr(t,n)}`}function xr(e){return`${e*2} / span 1`}function wr({crossCount:e,crossSpan:t,crossStart:n,hasGutters:o}){const s=t===void 0?e:n+t;if(n===0&&s===e)return"1 / -1";let i=Yn(n,o),r=Yn(s-1,o)+1;return o&&(n>0&&i--,s<e&&r++),`${i} / ${r}`}function co(e,t){return Number.isInteger(e)&&e>=1&&e<t}function ie(e,t="Assertion error"){if(!e)throw Error(t)}const Vs=f.createContext(null);function qs(){const e=f.useContext(Vs);return ie(e,"Grid Context not found; did you render a Cell or Gridline outside of a Grid?"),e}function zr({children:e,className:t,column:n,columnSpan:o=1,elementRef:s,id:i,row:r,rowSpan:a=1,style:l,...c}){const u=st(i),{gutters:d,registerCell:h}=qs(),m=f.useRef(null),p=Ke(m,s);return ce(()=>{const g=m.current;if(g!==null)return h({column:n,columnSpan:o,element:g,id:u,row:r,rowSpan:a})},[n,o,u,h,r,a]),W.jsx("div",{...c,className:t,"data-cell":!0,"data-testid":xt(c,i),id:u,ref:p,style:{overflow:"auto",...l,minHeight:0,minWidth:0,gridColumn:Ko(n,o,d.column),gridRow:Ko(r,a,d.row)},children:e})}const Cr=Object.assign(zr,{displayName:"Cell"});let Jt;function Us(){return Jt===void 0&&(typeof matchMedia=="function"?Jt=!!matchMedia("(pointer:coarse)").matches:Jt=!1),Jt}function Xn({expandHitTargets:e,axis:t,rect:n}){const o=e?Us()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(n.width<o){const s=o-n.width;n=new DOMRect(n.x-s/2,n.y,n.width+s,n.height)}if(n.height<o){const s=o-n.height;n=new DOMRect(n.x,n.y-s/2,n.width,n.height+s)}return n}function vt(e,t){return t==="column"?[e.column,e.columnSpan,e.row,e.rowSpan]:[e.row,e.rowSpan,e.column,e.columnSpan]}function Kn(e,t){return t==="column"?{crossEnd:e.bottom,crossStart:e.top,end:e.right,start:e.left}:{crossEnd:e.right,crossStart:e.left,end:e.bottom,start:e.top}}function Jn(e,t,n,o){return t==="column"?new DOMRect(e.x,n,e.width,o-n):new DOMRect(n,e.y,o-n,e.height)}function Jo({axis:e,cells:t,getCellBounds:n,index:o,rect:s}){let i=[s];for(const r of t){const[a,l]=vt(r,e);if(a>=o||a+l<=o)continue;const{crossStart:c,crossEnd:u}=n(r);u<=c||(i=i.flatMap(d=>{const{crossStart:h,crossEnd:m}=Kn(d,e);if(c>=m||u<=h)return[d];const p=[];return h<c&&p.push(Jn(d,e,h,c)),m>u&&p.push(Jn(d,e,u,m)),p}))}return i}function Ys({axis:e,cells:t,crossTrackCount:n,trackCount:o}){const s=Array.from({length:n},()=>new Array(o));for(const i of t){const[r,a,l,c]=vt(i,e);for(let u=Math.max(0,l);u<Math.min(n,l+c);u++)for(let d=Math.max(0,r);d<Math.min(o,r+a);d++)s[u][d]??=i}return s}function Zo({crossEnd:e,crossStart:t,end:n,start:o},s){return s==="column"?new DOMRect(o,t,n-o,e-t):new DOMRect(t,o,e-t,n-o)}function Tr({axis:e,cells:t,crossTrackCount:n,expandHitTargets:o,getAxisSize:s,getSlots:i,includeDisabled:r,resizeAxis:a,separatorPlacements:l}){const{items:c,separators:u}=a,d=c.length;let h=-1,m=-1,p=0;if(c.forEach((P,T)=>{P.constraintProps.disabled||(p++,h===-1&&(h=T),m=T)}),!r&&p<2)return[];const g=s(),y=P=>r||P>h&&P<=m,b=[],w=(P,T,R)=>({axis:a,axisSize:g,items:[c[P-1],c[P]],rect:T,separator:R}),S=new Map,C=P=>{let T=S.get(P);return T||(T=Kn(P.element.getBoundingClientRect(),e),S.set(P,T)),T},k=(P,T)=>{let R;for(const D of t){const[,,q,N]=vt(D,e);if(T==="start"){if(q===P){const{crossStart:$}=C(D);R=R===void 0?$:Math.min(R,$)}}else if(q+N-1===P){const{crossEnd:$}=C(D);R=R===void 0?$:Math.max(R,$)}}return R},E=new Set;for(const P of u){const T=l.get(P);if(!T||T.index<1||T.index>=d||(E.add(T.index),!r&&(P.disabled||P.element.hasAttribute("aria-disabled")))||!y(T.index))continue;let R=P.element.getBoundingClientRect();const{crossSpan:D,crossStart:q}=T,N=D===void 0?n:q+D;let{crossStart:$,crossEnd:V}=Kn(R,e);if(q>0){const B=k(q-1,"end");B!==void 0&&B<$&&($=B)}if(N<n){const B=k(N,"start");B!==void 0&&B>V&&(V=B)}R=Jn(R,e,$,V),R=Xn({expandHitTargets:o,axis:a,rect:R}),r?b.push(w(T.index,R,P)):Jo({axis:e,cells:t,getCellBounds:C,index:T.index,rect:R}).forEach(B=>{b.push(w(T.index,B,P))})}const _=(P,T)=>{Jo({axis:e,cells:t,getCellBounds:C,index:P,rect:Xn({expandHitTargets:o,axis:a,rect:T})}).forEach(R=>{b.push(w(P,R))})},Y=i?i():Ys({axis:e,cells:t,crossTrackCount:n,trackCount:d});for(let P=1;P<d;P++){if(E.has(P)||!y(P))continue;let T;for(let R=0;R<n;R++){const D=Y[R][P-1],q=Y[R][P];let N;if((D||q)&&D!==q){const $=D?C(D):void 0,V=q?C(q):void 0,B=$?.end??V.start,I=V?.start??$.end,H=Math.max($?.crossStart??-1/0,V?.crossStart??-1/0),G=Math.min($?.crossEnd??1/0,V?.crossEnd??1/0);N={crossEnd:Math.max(H,G),crossStart:H,end:Math.max(B,I),start:Math.min(B,I)}}N?T=T?{crossEnd:Math.max(T.crossEnd,N.crossEnd),crossStart:Math.min(T.crossStart,N.crossStart),end:Math.max(T.end,N.end),start:Math.min(T.start,N.start)}:N:T&&(_(P,Zo(T,e)),T=void 0)}T&&_(P,Zo(T,e))}return b}function je(e){const t=parseFloat(e??"");return Number.isFinite(t)?t:0}function Ir({axis:e,element:t,getGutterSizes:n,hasGutters:o,layout:s,trackIds:i}){const r=i.length,a=o?r*2-1:r,l=t.ownerDocument.defaultView?.getComputedStyle(t),c=e==="column",u=c?l?.gridTemplateColumns:l?.gridTemplateRows;if(u){const y=u.trim().split(/\s+/);if(y.length===a&&y.every(b=>/^-?[\d.]+px$/.test(b))){const b=i.map((w,S)=>je(y[o?S*2:S]));return{availableSize:b.reduce((w,S)=>w+S,0),trackSizes:b}}}const d=c?t.offsetWidth:t.offsetHeight,h=c?je(l?.paddingLeft)+je(l?.paddingRight)+je(l?.borderLeftWidth)+je(l?.borderRightWidth):je(l?.paddingTop)+je(l?.paddingBottom)+je(l?.borderTopWidth)+je(l?.borderBottomWidth),m=je(c?l?.columnGap:l?.rowGap),p=n().reduce((y,b)=>y+b,0),g=Math.max(0,d-h-m*Math.max(0,a-1)-p);return{availableSize:g,trackSizes:i.map(y=>s&&s[y]!==void 0?s[y]/100*g:g/r)}}class $t{#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 s;const i=Array.from(o);for(let r=0;r<i.length;r++){const a=i[r];try{a.call(null,n)}catch(l){s??={error:l}}}if(s)throw s.error}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const s=o.indexOf(n);s>=0&&o.splice(s,1)}}}function un(e){const t=o=>{o.preventDefault(),o.stopPropagation(),n()},n=()=>{e.removeEventListener("click",t,!0)};e.addEventListener("click",t,!0),setTimeout(n,0)}let pe={cursorFlags:0,state:"inactive"};const lo=new $t;function Ee(){return pe}function yn(e){return lo.addListener("change",e)}function Rr(e,t=[],n,o=!1){const s=pe,i={...pe};i.cursorFlags=e,i.state==="active"&&(i.didPointerMove||=o,i.previews=t,n&&(i.previewLayoutMap=n)),pe=i,lo.emit("change",{prev:s,next:i})}function We(e){const t=pe;pe=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&(t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),un(t.ownerDocument)),lo.emit("change",{prev:t,next:e})}function Er(e){pe.state!=="active"||!pe.previews.some(t=>t.separator===e)||We({...pe,previews:pe.previews.map(t=>t.separator===e?{...t}:t)})}function Lr(e){if(pe.state==="inactive")return;const t=pe.hitRegions.filter(o=>o.axis!==e),n=pe.state==="active"&&pe.previews.some(o=>o.axis===e);if(!(t.length===pe.hitRegions.length&&!n))if(t.length===0)We({cursorFlags:0,state:"inactive"});else if(pe.state==="active"){const o=new Map(pe.initialLayoutMap),s=new Map(pe.previewLayoutMap);o.delete(e),s.delete(e),We({...pe,cursorFlags:0,hitRegions:t,initialLayoutMap:o,previewLayoutMap:s,previews:pe.previews.filter(i=>i.axis!==e)})}else We({...pe,hitRegions:t})}const Mr=e=>e,Fn=()=>{},Xs=1,Ks=2,Js=4,Zs=8,Qo=3,es=12;let Zt;function ts(){return Zt===void 0&&(Zt=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Zt=!0)),Zt}function Dr({cursorFlags:e,axes:t,state:n}){let o=0,s=0;switch(n){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{o++;break}case"vertical":{s++;break}}})}if(!(o===0&&s===0)){switch(n){case"active":{if(e&&ts()){const i=(e&Xs)!==0,r=(e&Ks)!==0,a=(e&Js)!==0,l=(e&Zs)!==0;if(i)return a?"se-resize":l?"ne-resize":"e-resize";if(r)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return ts()?o>0&&s>0?"move":o>0?"ew-resize":"ns-resize":o>0&&s>0?"grab":o>0?"col-resize":"row-resize"}}const ns=new WeakMap;function os(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=ns.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=Ee();switch(o.state!=="inactive"&&o.ownerDocument!==e&&(o={cursorFlags:0,state:"inactive"}),o.state){case"active":case"hover":{const s=Dr({cursorFlags:o.cursorFlags,axes:o.hitRegions.map(r=>r.axis),state:o.state}),i=`*, *:hover {cursor: ${s} !important; }`;if(t===i)return;t=i,s?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}}ns.set(e,{prevStyle:t,styleSheet:n})}function ss(e){return e.state==="inactive"?void 0:e.ownerDocument}function kr({next:e,prev:t}){const n=ss(t),o=ss(e);n&&n!==o&&os(n),o&&os(o)}function he(e,t){const n=t==="horizontal"?e.offsetWidth:e.offsetHeight;if(n===0)return 1;const o=e.getBoundingClientRect(),s=t==="horizontal"?o.width:o.height;return s<=0||Math.abs(s-n)<1?1:s/n}function jt({axis:e}){const{element:t,layoutStrategy:n,orientation:o,items:s}=e;if(n)return n.calculateAvailableSize();const i=he(t,o);return s.reduce((r,a)=>{const l=a.element.getBoundingClientRect(),c=(o==="horizontal"?l.width:l.height)/i,u=o==="horizontal"?a.element.offsetWidth:a.element.offsetHeight;return r+=Math.abs(c-u)<1?c:u,r},0)}function uo(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 It(e,t){return Array.from(t).sort((n,o)=>{const s=e==="horizontal"?Pr(n,o):Or(n,o);return s!==0?s:uo(n.element,o.element)})}function Pr(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Or(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Pe(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Qs(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 Ar({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let s,i=Number.MAX_VALUE;for(const r of t){const{x:a,y:l}=Qs(o,r),c=e==="horizontal"?a:l;c<i&&(i=c,s=r)}return ie(s,"No rect found"),s}function fo({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:s,items:i,separators:r}=t,a=It(s,Array.from(o.children).filter(Pe).filter(w=>!w.hasAttribute("data-resize-preview")).map(w=>({element:w}))).map(({element:w})=>w),l=[];let c=!1,u=!1,d=-1,h,m=-1,p=0,g,y,b=[];{let w=-1;for(const S of a)S.hasAttribute("data-panel")&&(w++,S.hasAttribute("data-disabled")||(p++,d===-1&&(d=w),m=w))}if(n||p>1){let w=-1;for(const S of a)if(S.hasAttribute("data-panel")){w++;const C=i.find(k=>k.element===S);if(C){const k=S.getBoundingClientRect();if(g&&y){const E=y;let _;if(u){const Y=s==="horizontal"?new DOMRect(E.right,E.top,0,E.height):new DOMRect(E.left,E.bottom,E.width,0),P=s==="horizontal"?new DOMRect(k.left,k.top,0,k.height):new DOMRect(k.left,k.top,k.width,0);switch(b.length){case 0:{_=[Y,P];break}case 1:{const T=b[0],R=Ar({orientation:s,rects:[E,k],targetRect:T.element.getBoundingClientRect()});_=[T,R===E?P:Y];break}default:{_=b;break}}}else b.length?_=b:_=[s==="horizontal"?new DOMRect(E.right,k.top,k.left-E.right,k.height):new DOMRect(k.left,E.bottom,k.width,k.top-E.bottom)];for(const Y of _){const P=Xn({expandHitTargets:e,axis:t,rect:"width"in Y?Y:Y.element.getBoundingClientRect()}),T=w<=d||w>m;(n||!c&&!T)&&(h??=jt({axis:t})*he(t.element,t.orientation),l.push({axis:t,axisSize:h,items:[g,C],separator:"width"in Y?void 0:Y,rect:P})),c=!1}}u=!1,g=C,y=k,b=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(c=!0);const C=r.find(k=>k.element===S);C?b.push(C):(g=void 0,b=[])}else u=!0}return l}function po(e){return e.ownerDocument.defaultView??window}function Nr(e,t){const n=po(e).getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function $r(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function jr(e,t){return t/100*po(e).innerHeight}function Br(e,t){return t/100*po(e).innerWidth}function ho(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function tt({axisSize:e,itemElement:t,styleProp:n}){let o;const[s,i]=ho(n);switch(i){case"%":{o=s/100*e;break}case"px":{o=s;break}case"rem":{o=$r(t,s);break}case"em":{o=Nr(t,s);break}case"vh":{o=jr(t,s);break}case"vw":{o=Br(t,s);break}}return o}function be(e){return parseFloat(e.toFixed(3))}function mo(e,t=jt({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:s,constraintProps:i}=o;let r=0;if(i.collapsedSize!==void 0){const d=tt({axisSize:t,itemElement:s,styleProp:i.collapsedSize});r=be(d/t*100)}let a;if(i.collapsedThreshold!==void 0){const d=tt({axisSize:t,itemElement:s,styleProp:i.collapsedThreshold});a=be(d/t*100)}let l;if(i.defaultSize!==void 0){const d=tt({axisSize:t,itemElement:s,styleProp:i.defaultSize});l=be(d/t*100)}let c=0;if(i.minSize!==void 0){const d=tt({axisSize:t,itemElement:s,styleProp:i.minSize});c=be(d/t*100)}let u=100;if(i.maxSize!==void 0){const d=tt({axisSize:t,itemElement:s,styleProp:i.maxSize});u=be(d/t*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:r,collapsedThreshold:a,collapsible:i.collapsible===!0,defaultSize:l,disabled:i.disabled,minSize:c,maxSize:u,itemId:o.id}})}let Be=new Map;const go=new $t;let Et=0;const on=[];let sn;function vn(){Et++}function ei(){for(let e=0;e<on.length;e++)try{go.emit("axisChange",on[e])}catch(t){sn??={error:t}}on.length=0}function Sn(){if(Et===1&&ei(),Et--,Et===0&&sn){const{error:e}=sn;throw sn=void 0,e}}function Fr(e){Be=new Map(Be),Be.delete(e)}function mt(e,t){for(const[n]of Be)if(n.id===e)return n}function Te(e,t){for(const[n,o]of Be)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function He(){return Be}function St(e,t){return go.addListener("axisChange",n=>{n.axis.id===e&&t(n)})}function _e(e,t,n){const o=Be.get(e);Be=new Map(Be),Be.set(e,t);const s={axis:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t};Et>0?on.push(s):go.emit("axisChange",s)}function ti(e,t){ei(),We({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{if(!t.has(n.axis))return;const o=Te(n.axis.id,!0);_e(n.axis,o,{isUserInteraction:!0})})}function ni(e,{pointerId:t,pointerType:n}){return t===e.pointerId||n==="pen"&&e.pointerType==="pen"}function Bt(e,t,n={}){return e.ownerDocument===t&&(n.pointerId===void 0||ni(e,n))}function Gr(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 de(e,t,n=0){return Math.abs(be(e)-be(t))<=n}function Ie(e,t){return de(e,t)?0:e>t?1:-1}function nt({overrideDisabledItems:e,itemConstraints:t,prevSize:n,size:o}){const{collapsedSize:s=0,collapsedThreshold:i,collapsible:r,disabled:a,maxSize:l=100,minSize:c=0}=t;if(a&&!e)return n;if(Ie(o,c)<0)if(r){const u=i??(c-s)/2,d=Ie(n,s)<=0,h=d?s+u:c-u,m=Ie(o,h);Ie(o,s)<=0||m<0||i!==void 0&&d&&m===0?o=s:o=c}else o=c;return o=Math.min(l,o),o=be(o),o}function Mt({delta:e,initialLayout:t,itemConstraints:n,pivotIndices:o,prevLayout:s,trigger:i}){if(de(e,0))return t;const r=i==="imperative-api",a=n.map(({itemId:p})=>t[p]),l=n.map(({itemId:p})=>s[p]),c=[...a],[u,d]=o;ie(u!=null,"Invalid first pivot index"),ie(d!=null,"Invalid second pivot index");let h=0;switch(i){case"keyboard":{{const p=e<0?d:u,g=n[p];ie(g,`Panel constraints not found for index ${p}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=g;if(b){const S=a[p];if(ie(S!=null,`Previous layout not found for panel index ${p}`),de(S,y)){const C=w-S;Ie(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const p=e<0?u:d,g=n[p];ie(g,`No panel constraints found for index ${p}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=g;if(b){const S=a[p];if(ie(S!=null,`Previous layout not found for panel index ${p}`),de(S,w)){const C=S-y;Ie(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break}default:{const p=e<0?d:u,g=n[p];ie(g,`Panel constraints not found for index ${p}`);const y=a[p],{collapsedSize:b,collapsedThreshold:w,collapsible:S,minSize:C}=g;if(S&&Ie(y,C)<0){const k=C-b,E=w??k/2,_=y+Math.abs(e);if(Ie(_,C)<0){const Y=Ie(Math.abs(e),E),P=w===void 0&&e<0;Y>0||Y===0&&P?e=e<0?-k:k:e=0}}break}}{const p=e<0?1:-1;let g=e<0?d:u,y=0;for(;;){const w=a[g];ie(w!=null,`Previous layout not found for panel index ${g}`);const C=nt({overrideDisabledItems:r,itemConstraints:n[g],prevSize:w,size:100})-w;if(y+=C,g+=p,g<0||g>=n.length)break}const b=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-b:b}{let g=e<0?u:d;for(;g>=0&&g<n.length;){const y=Math.abs(e)-Math.abs(h),b=a[g];ie(b!=null,`Previous layout not found for panel index ${g}`);const w=b-y,S=nt({overrideDisabledItems:r,itemConstraints:n[g],prevSize:b,size:w});if(!de(b,S)&&(h+=b-S,c[g]=S,Ie(h,Math.abs(e))>=0))break;e<0?g--:g++}}if(Gr(l,c))return s;{const p=e<0?d:u,g=a[p];ie(g!=null,`Previous layout not found for panel index ${p}`);const y=g+h,b=nt({overrideDisabledItems:r,itemConstraints:n[p],prevSize:g,size:y});if(c[p]=b,!de(b,y)){let w=y-b,C=e<0?d:u;for(;C>=0&&C<n.length;){const k=c[C];ie(k!=null,`Previous layout not found for panel index ${C}`);const E=k+w,_=nt({overrideDisabledItems:r,itemConstraints:n[C],prevSize:k,size:E});if(de(k,_)||(w-=_-k,c[C]=_),de(w,0))break;e>0?C--:C++}}}const m=c.reduce((p,g)=>g+p,0);return de(m,100,.1)?c.reduce((p,g,y)=>(p[n[y].itemId]=g,p),{}):s}function $e(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Ie(e[n],t[n])!==0)return!1;return!0}function bo(e){vn();try{Wr(e)}finally{Sn()}}function Wr({commit:e,event:t,hitRegions:n,initialLayoutMap:o,mountedAxes:s,pointerDownAtPoint:i,prevCursorFlags:r}){let a=0;const l=Ee();let c=l.state==="active"?l.previews:[];const u=new Map(l.state==="active"?l.previewLayoutMap:void 0);n.forEach(m=>{const{axis:p,axisSize:g}=m,{orientation:y,items:b}=p;if(e&&p.resizePreviewMode!=="separator")return;const{disableCursor:w}=p.mutableState;let S=0;i?y==="horizontal"?S=(t.clientX-i.x)/g*100:S=(t.clientY-i.y)/g*100:y==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=o.get(p),k=s.get(p);if(!C||!k)return;const{defaultLayoutDeferred:E,derivedItemConstraints:_,axisSize:Y,layout:P,separatorToItems:T}=k;if(_&&P&&T){const R=p.resizePreviewMode==="separator"?u.get(p)??P:P,D=Mt({delta:S,initialLayout:C,itemConstraints:_,pivotIndices:m.items.map(q=>b.indexOf(q)),prevLayout:R,trigger:"mouse-or-touch"});if(p.resizePreviewMode==="separator"&&!e&&!$e(D,R)){u.set(p,D);let q=0;const N=b.map($=>(q+=D[$.id]-C[$.id],q*(g/100)));c=c.map($=>{if($.axis!==p)return $;const V=N[$.itemIndex];return V===$.offset?$:{...$,offset:V}})}if($e(D,R)&&S!==0&&!w)switch(y){case"horizontal":{a|=S<0?Xs:Ks;break}case"vertical":{a|=S<0?Js:Zs;break}}(p.resizePreviewMode!=="separator"||e)&&!$e(D,P)&&_e(m.axis,{defaultLayoutDeferred:E,derivedItemConstraints:_,axisSize:Y,layout:D,requestedAxisSize:Y,requestedLayout:D,separatorToItems:T})}});let d=0;t.movementX===0?d|=r&Qo:d|=a&Qo,t.movementY===0?d|=r&es:d|=a&es;const h=l.state==="active"&&(t.clientX!==l.pointerDownAtPoint.x||t.clientY!==l.pointerDownAtPoint.y);Rr(d,c,u,h)}function oi(e,t){const n=Ee();if(n.state!=="active"||!Bt(n,e,t))return;const o=He();vn();try{bo({commit:!0,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),n.hitRegions.length>0&&t.preventDefault?.(),ti(n,o)}finally{Sn()}}function is(e){if(e.defaultPrevented)return;const{clientX:t,clientY:n,movementX:o,movementY:s}=e;oi(e.currentTarget,{clientX:t,clientY:n,movementX:o,movementY:s})}function _r(e,t,n){let o,s={x:1/0,y:1/0};for(const i of t){const r=Qs(n,i.rect);switch(e){case"horizontal":{(r.x<s.x||r.x===s.x&&r.y<=s.y)&&(o=i,s=r);break}case"vertical":{(r.y<s.y||r.y===s.y&&r.x<=s.x)&&(o=i,s=r);break}}}return o?{distance:s,hitRegion:o}:void 0}function Hr(e,t){const{coarse:n,fine:o}=e.resizeTargetMinimumSize,s=Math.max(n,o),i=e.element.getBoundingClientRect();return t.x>=i.left-s&&t.x<=i.right+s&&t.y>=i.top-s&&t.y<=i.bottom+s}function si(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Vr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:cs(e),b:cs(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();ie(o,"Stacking order can only be calculated for elements with a common ancestor");const s={a:as(rs(n.a)),b:as(rs(n.b))};if(s.a===s.b){const i=o.childNodes,r={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===r.a)return 1;if(l===r.b)return-1}}return Math.sign(s.a-s.b)}const qr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ur(e){const t=getComputedStyle(ii(e)??e).display;return t==="flex"||t==="inline-flex"}function Yr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Ur(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"||qr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function rs(e){let t=e.length;for(;t--;){const n=e[t];if(ie(n,"Missing node"),Yr(n))return n}return null}function as(e){return e&&Number(getComputedStyle(e).zIndex)||0}function cs(e){const t=[];for(;e;)t.push(e),e=ii(e);return t}function ii(e){const{parentNode:t}=e;return si(t)?t.host:t}function Xr(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 Kr(e){try{return e.matches(":modal")}catch{return!1}}function Jr({axisElement:e,hitRegion:t,pointerEventTarget:n}){if(Pe(n)){const o=n.closest("dialog");if(o&&!o.contains(e)&&Kr(o))return!1}if(!Pe(n)||n.contains(e)||e.contains(n)||!n.isConnected||!e.isConnected)return!0;if(Vr(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Xr(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function yo(e,t,n){const o=[];return t.forEach((s,i)=>{if(i.disabled||i.element.ownerDocument!==n)return;const r={x:e.clientX,y:e.clientY};if(!Hr(i,r))return;const a=fo({axis:i}),l=_r(i.orientation,a,r);l&&l.distance.x<=0&&l.distance.y<=0&&Jr({axisElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&o.push(l.hitRegion)}),o}function ri(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const r=be(i.defaultSize);n+=r,o[i.itemId]=r}else o[i.itemId]=void 0;const s=e.length-t;if(s!==0){const i=be((100-n)/s);for(const r of e)r.defaultSize===void 0&&(o[r.itemId]=i)}return o}function Zr(e,t){const n=e.map(s=>s.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const s of n)if(!o.includes(s))return!1;return!0}function ai({axis:e,itemConstraints:t}){const n=e.items.map(({id:s})=>s).join(","),o=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(o&&Zr(e.items,o)?o:ri(t))}function xn(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 Qr(e,t){return e.length!==t.length?!1:e.every((n,o)=>xn(n,t[o]))}function Ye({layout:e,itemConstraints:t}){const n=t.map(({itemId:r})=>e[r]),o=[...n],s=o.reduce((r,a)=>r+a,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(r=>`${r}%`).join(", ")}`);if(!de(s,100)&&o.length>0)for(let r=0;r<t.length;r++){const a=o[r];ie(a!=null,`No layout data found for index ${r}`);const l=100/s*a;o[r]=l}let i=0;for(let r=0;r<t.length;r++){const a=n[r];ie(a!=null,`No layout data found for index ${r}`);const l=o[r];ie(l!=null,`No layout data found for index ${r}`);const c=nt({overrideDisabledItems:!0,itemConstraints:t[r],prevSize:a,size:l});l!=c&&(i+=l-c,o[r]=c)}if(!de(i,0))for(let r=0;r<t.length;r++){const a=o[r];ie(a!=null,`No layout data found for index ${r}`);const l=a+i,c=nt({overrideDisabledItems:!0,itemConstraints:t[r],prevSize:a,size:l});if(a!==c&&(i-=c-a,o[r]=c,de(i,0)))break}return o.reduce((r,a,l)=>(r[t[l].itemId]=a,r),{})}function ci({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 ea({axis:e,nextAxisSize:t,prevAxisSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let s=0,i=0,r=!1;const a=new Map,l=[];for(const d of e.items){const h=o[d.id]??0;switch(d.constraintProps.groupResizeBehavior){case"preserve-pixel-size":{r=!0;const m=h/100*n,p=be(m/t*100);a.set(d.id,p),s+=p;break}case"preserve-relative-size":default:{l.push(d.id),i+=h;break}}}if(!r||l.length===0)return o;const c=100-s,u={...o};if(a.forEach((d,h)=>{u[h]=d}),i>0)for(const d of l){const h=o[d]??0;u[d]=be(h/i*c)}else{const d=be(c/l.length);for(const h of l)u[h]=d}return u}function vo({axis:e,axisState:t}){const n=jt({axis:e});if(n===0)return;const o=mo(e,n);let s=t.requestedAxisSize,i=t.requestedLayout;t.defaultLayoutDeferred&&(s=n,i=ci({itemIds:e.items.map(({id:c})=>c),layout:ai({axis:e,itemConstraints:o})}));const r=ea({axis:e,nextAxisSize:n,prevAxisSize:s,prevLayout:i}),a=Ye({layout:r,itemConstraints:o});return{changed:t.defaultLayoutDeferred||!$e(t.layout,a)||!Qr(t.derivedItemConstraints,o)||t.axisSize!==n,state:{defaultLayoutDeferred:!1,derivedItemConstraints:o,axisSize:n,layout:a,requestedAxisSize:s,requestedLayout:i,separatorToItems:t.separatorToItems}}}function So({axisId:e,itemId:t}){const n=()=>{const c=He();for(const[u,d]of c)if(u.id===e)return{axis:u,...d};throw Error(`Group ${e} not found`)},o=()=>{const c=n().derivedItemConstraints.find(u=>u.itemId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const{axis:c,...u}=n(),d=vo({axis:c,axisState:u}),h=d?.state??u,m=h.derivedItemConstraints.find(g=>g.itemId===t);if(m===void 0)throw Error(`Panel constraints not found for Panel ${t}`);const p=h.layout[t];if(p===void 0)throw Error(`Layout not found for Panel ${t}`);return{axis:c,changed:d?.changed===!0,itemConstraints:m,itemSize:p,state:h}},i=()=>{const c=n().axis.items.find(u=>u.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},r=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},a=({allowPartialSize:c=!1,nextSize:u,items:d,prevLayout:h,derivedItemConstraints:m})=>{const p=h[t],g=d.findIndex(T=>T.id===t),y=g===0,b=g===d.length-1;if(b&&u<p&&(y||d.slice(0,g).every((T,R)=>{const D=m[R];return D?.collapsible&&de(D.collapsedSize,h[D.itemId])}))){const T=d.slice(0,g).reduce((R,D)=>R+h[D.id],0);return{...h,[t]:be(100-T)}}const S=m[g],C=nt({overrideDisabledItems:!0,itemConstraints:S,prevSize:p,size:u}),k={...h};let E=C-p;for(const T of y?[1]:b?[-1]:[1,-1])for(let R=g+T;R>=0&&R<d.length&&!de(E,0);R+=T){const D=m[R],q=k[D.itemId];if(dn(D,k)||(E>0?Ie(q,D.minSize)<=0:Ie(q,D.maxSize)>=0))continue;const N=E>0?Math.max(D.minSize,q-E):Math.min(D.maxSize,q-E);E-=q-N,k[D.itemId]=be(N)}if(k[t]=be(C-E),de(E,0)||c&&Ie(k[t],S.minSize)>=0)return k;const _=(T,R,D)=>{const q=T==="after"?1:-1,N=V=>{for(let B=g+q;B>=0&&B<d.length;B+=q){const I=m[B];if(!dn(I,R)&&V(I))return B}},$=N(({itemId:V,maxSize:B,minSize:I})=>D>0?Ie(R[V],I)>0:Ie(R[V],B)<0)??N(()=>!0)??g+q;return Mt({delta:T==="after"?D:-D,initialLayout:R,itemConstraints:m,pivotIndices:T==="after"?[g,$]:[$,g],prevLayout:R,trigger:"imperative-api"})};if(y||b)return _(b?"before":"after",h,u-p);const Y=T=>{const R=_(T,h,u-p),D=u-R[t];return de(D,0)?R:_(T==="after"?"before":"after",R,D)},P=Y("after");if(ls({itemConstraints:m,itemId:t,nextLayout:P,prevLayout:h})){const T=Y("before");if(!ls({itemConstraints:m,itemId:t,nextLayout:T,prevLayout:h}))return T}return P},l=(c,{axis:u,changed:d,itemSize:h,state:m},{allowPartialSize:p=!1}={})=>{if(c===h)return;const{derivedItemConstraints:g,axisSize:y,layout:b}=m,w=a({allowPartialSize:p,nextSize:c,items:u.items,prevLayout:b,derivedItemConstraints:g}),S=Ye({layout:w,itemConstraints:g});(d||!$e(b,S))&&_e(u,{...m,layout:S,requestedAxisSize:y,requestedLayout:S})};return{collapse:()=>{const c=s(),{collapsible:u,collapsedSize:d}=c.itemConstraints,{mutableValues:h}=i(),m=c.itemSize;u&&m!==d&&(h.expandToSize=m,l(d,c))},expand:()=>{const c=s(),{collapsible:u,collapsedSize:d,minSize:h}=c.itemConstraints,{mutableValues:m}=i(),p=c.itemSize;if(u&&p===d){let g=m.expandToSize??h;g===0&&(g=1),l(g,c,{allowPartialSize:!0})}},getSize:()=>{const{axis:c}=n(),u=r(),{element:d}=i(),h=c.layoutStrategy?c.layoutStrategy.getItemSizeInPixels(t):c.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:u,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:u}=o(),d=r();return c&&de(u,d)},resize:c=>{const u=s(),{axisSize:d}=u.state,{element:h}=i(),m=tt({axisSize:d,itemElement:h,styleProp:c}),p=be(m/d*100);l(p,u)}}}function dn({collapsedSize:e,collapsible:t,itemId:n},o){return t&&de(o[n],e)}function ls({itemConstraints:e,itemId:t,nextLayout:n,prevLayout:o}){return e.some(s=>s.itemId!==t&&dn(s,o)!==dn(s,n))}function us(e){if(e.defaultPrevented)return;const t=He();yo(e,t,e.currentTarget).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const s=o.items.find(i=>i.constraintProps.defaultSize!==void 0);if(s){const i=s.constraintProps.defaultSize,r=So({axisId:o.axis.id,itemId:s.id});r&&i!==void 0&&(r.resize(i),e.preventDefault())}}})}function ds({axis:e,axisState:t,delta:n,separator:o}){const s=t.separatorToItems.get(o);ie(s,"Matching panels not found");const i=s.map(c=>e.items.indexOf(c)),r=t.defaultLayoutDeferred?{}:t.layout,a=Mt({delta:n,initialLayout:r,itemConstraints:t.derivedItemConstraints,pivotIndices:i,prevLayout:r,trigger:"keyboard"}),l=Ye({layout:a,itemConstraints:t.derivedItemConstraints});$e(r,l)||_e(e,{defaultLayoutDeferred:t.defaultLayoutDeferred,derivedItemConstraints:t.derivedItemConstraints,axisSize:t.axisSize,layout:l,requestedAxisSize:t.axisSize,requestedLayout:l,separatorToItems:t.separatorToItems},{isUserInteraction:!0})}function ta(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 na(e){return e.separators.filter(t=>!t.disabled)}function fs(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ta(t);if(n.disabled)return;const o=n.separators.find(i=>i.element===t);if(ie(o,"Matching separator not found"),o.disabled)return;const s=i=>ds({axis:n,axisState:Te(n.id,!0),delta:i,separator:o});switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&s(5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&s(-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&s(5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&s(-5);break}case"End":{e.preventDefault(),s(100);break}case"Enter":{e.preventDefault();const i=Te(n.id,!0),{derivedItemConstraints:r,layout:a,separatorToItems:l}=i,c=l.get(o);ie(c,"Matching panels not found");const u=c[0],d=r.find(h=>h.itemId===u.id);if(ie(d,"Panel metadata not found"),d.collapsible){const h=a[u.id],m=d.collapsedSize===h?n.mutableState.expandedItemSizes[u.id]??d.minSize:d.collapsedSize;ds({axis:n,axisState:i,delta:m-h,separator:o})}break}case"F6":{e.preventDefault();const i=na(n).map(c=>c.element),r=i.findIndex(c=>c===e.currentTarget);ie(r!==-1,"Index not found");const a=e.shiftKey?r>0?r-1:i.length-1:r+1<i.length?r+1:0;i[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),s(-100);break}}}function wt(e,t){const n=Ee();if(n.state!=="active"||!Bt(n,e,t))return!1;const o=He();vn();try{n.previewLayoutMap.forEach((s,i)=>{const r=o.get(i);i.resizePreviewMode==="separator"&&r&&!$e(s,r.layout)&&_e(i,{...r,layout:s,requestedAxisSize:r.axisSize,requestedLayout:s})}),ti(n,o)}finally{Sn()}return!0}function ps(e){const t=Ee();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))||wt(e.currentTarget,e)}function hs(e){wt(e.currentTarget,e)}function oa(e,t){const{element:n,orientation:o,items:s}=e,i=n.getBoundingClientRect(),r=o==="horizontal";return fo({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:l,rect:c,separator:u},d)=>{const h=s.indexOf(l[0]),m=r?c.left+c.width/2:c.top+c.height/2;return{active:t.some(g=>{if(g.axis!==e||g.items[0]!==l[0])return!1;if(u||g.separator)return g.separator===u;const y=r?g.rect.left+g.rect.width/2:g.rect.top+g.rect.height/2;return de(m,y)}),axis:e,key:u?`separator-${u.id}`:`panel-${l[0].id}-${d}`,offset:0,itemIndex:h,rect:new DOMRect((r&&!u?m:c.left)-i.left-n.clientLeft+n.scrollLeft,(!r&&!u?m:c.top)-i.top-n.clientTop+n.scrollTop,r&&!u?0:c.width,!r&&!u?0:c.height),separator:u}})}function ms(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=Ee();if(t.state==="active"){ni(t,e)&&wt(t.ownerDocument,t);return}const n=He(),o=yo(e,n,e.currentTarget);if(o.length===0)return;const s=new Map;let i=!1;o.forEach(a=>{a.separator&&(i||(i=!0,a.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=n.get(a.axis);l&&s.set(a.axis,l.layout)});const r=Array.from(s.keys()).flatMap(a=>a.resizePreviewMode==="separator"?oa(a,o):[]);We({cursorFlags:0,didPointerMove:!1,hitRegions:o,initialLayoutMap:s,ownerDocument:e.currentTarget,pointerDownAtPoint:{x:e.clientX,y:e.clientY},pointerId:e.pointerId,pointerType:e.pointerType,previewLayoutMap:new Map(s),previews:r,state:"active"}),e.preventDefault()}function gs(e){const t=e.currentTarget,n=He(),o=Ee();switch(o.state){case"active":{if(!Bt(o,t,e))return;bo({commit:!1,event:e,hitRegions:o.hitRegions,initialLayoutMap:o.initialLayoutMap,mountedAxes:n,prevCursorFlags:o.cursorFlags})}}}function sa(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const o=e[n],s=t[n];if(o.axis!==s.axis||o.separator!==s.separator||o.items[0]!==s.items[0]||o.items[1]!==s.items[1])return!1}return!0}function bs(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ee(),o=He();switch(n.state){case"active":{if(!Bt(n,t,e))return;if(e.buttons===0){wt(t,e);return}for(const s of n.hitRegions)if(s.separator){const{element:i}=s.separator;i.isConnected&&!i.hasPointerCapture?.(e.pointerId)&&i.setPointerCapture?.(e.pointerId)}bo({commit:!1,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const s=yo(e,o,t);s.length===0?n.state!=="inactive"&&We({cursorFlags:0,state:"inactive"}):(n.state!=="hover"||n.ownerDocument!==t||!sa(n.hitRegions,s))&&We({cursorFlags:0,hitRegions:s,ownerDocument:t,state:"hover"});break}}}function ys(e){const t=e.relatedTarget;if(Pe(t)&&t.localName==="iframe"){const n=Ee();switch(n.state){case"hover":n.ownerDocument===e.currentTarget&&We({cursorFlags:0,state:"inactive"})}}}function vs(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||oi(e.currentTarget,e)}function Ss(e){e.target===e.currentTarget&&wt(e.currentTarget.document)}function xs(e){wt(e.currentTarget.document)}function ia(e,t,n){const o=n[0];if(!o)return;const s=e.items.find(d=>d.element===t);if(!s||!s.onResize)return;const i=jt({axis:e}),r=e.orientation==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,a=e.orientation==="horizontal"?o.inlineSize:o.blockSize,l=Number.isFinite(a)&&a>0&&Math.abs(a-r)<1?a:r,c=s.mutableValues.prevSize,u={asPercentage:be(l/i*100),inPixels:r};s.mutableValues.prevSize=u,s.onResize(u,s.id,c)}const dt=new Map;let ws=!1;function li(e){let t=!0;ie(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,s=new Set,i=new n(p=>{let g;vn();try{for(const y of p){const{borderBoxSize:b,target:w}=y;if(w===e.element){if(t){const S=Te(e.id);if(!S)break;const C=vo({axis:e,axisState:S});if(!C)break;if(!C.changed)continue;_e(e,C.state)}}else try{ia(e,w,b)}catch(S){g??={error:S}}}}finally{Sn()}if(g)throw g.error});i.observe(e.element),e.items.forEach(p=>{ie(!o.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),o.add(p.id),p.onResize&&i.observe(p.element)});const r=jt({axis:e}),a=mo(e,r),l=ai({axis:e,itemConstraints:a}),c=Ye({layout:l,itemConstraints:a}),u=e.element.ownerDocument,d=u.defaultView;dt.set(u,(dt.get(u)??0)+1);const h=new Map;return fo({axis:e,includeDisabled:!0}).forEach(p=>{p.separator&&h.set(p.separator,p.items)}),_e(e,{defaultLayoutDeferred:r===0,derivedItemConstraints:a,axisSize:r,layout:c,requestedAxisSize:r,requestedLayout:ci({itemIds:e.items.map(({id:p})=>p),layout:l}),separatorToItems:h}),e.separators.forEach(p=>{ie(!s.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),s.add(p.id),p.element.addEventListener("keydown",fs)}),ws||(ws=!0,yn(kr)),dt.get(u)===1&&(u.addEventListener("contextmenu",is,!0),u.addEventListener("dblclick",us,!0),u.addEventListener("lostpointercapture",ps,!0),u.addEventListener("pointercancel",hs,!0),u.addEventListener("pointerdown",ms,!0),u.addEventListener("pointerleave",gs),u.addEventListener("pointermove",bs),u.addEventListener("pointerout",ys),u.addEventListener("pointerup",vs,!0),d?.addEventListener("blur",Ss),d?.addEventListener("pagehide",xs)),function(){t=!1,dt.set(u,Math.max(0,(dt.get(u)??0)-1)),Fr(e),Lr(e),e.separators.forEach(g=>{g.element.removeEventListener("keydown",fs)}),dt.get(u)||(u.removeEventListener("contextmenu",is,!0),u.removeEventListener("dblclick",us,!0),u.removeEventListener("lostpointercapture",ps,!0),u.removeEventListener("pointercancel",hs,!0),u.removeEventListener("pointerdown",ms,!0),u.removeEventListener("pointerleave",gs),u.removeEventListener("pointermove",bs),u.removeEventListener("pointerout",ys),u.removeEventListener("pointerup",vs,!0),d?.removeEventListener("blur",Ss),d?.removeEventListener("pagehide",xs)),i.disconnect()}}function rn({axisId:e}){const t=()=>{const n=He();for(const[o,s]of n)if(o.id===e)return{axis:o,...s};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,...s}=t(),i=vo({axis:o,axisState:s}),r=i?.state??s,{defaultLayoutDeferred:a,derivedItemConstraints:l,axisSize:c,layout:u}=r,d=Ye({layout:n,itemConstraints:l});return a?u:((i?.changed||!$e(u,d))&&_e(o,{...r,layout:d,requestedAxisSize:c,requestedLayout:d}),d)}}}function ui({derivedItemConstraints:e,axis:t,layout:n,prevLayout:o,requestedLayout:s}){const i=t.items.map(({id:r})=>r).join(",");t.mutableState.layouts[i]=s,o&&e.forEach(r=>{if(r.collapsible){const a=de(r.collapsedSize,n[r.itemId]),l=de(r.collapsedSize,o[r.itemId]);a&&!l&&(t.mutableState.expandedItemSizes[r.itemId]=o[r.itemId])}})}function di(){const[e,t]=f.useState({}),n=f.useCallback(()=>t({}),[]);return[e,n]}function fi({initialLayout:e,layoutsEqual:t,onLayoutChange:n,onLayoutChanged:o}){const s=f.useRef({onLayoutChange:e,onLayoutChanged:e}),i=ge(a=>{t(s.current.onLayoutChange,a)||(s.current.onLayoutChange=a,n?.(a))}),r=ge((a,l,c)=>{t(s.current.onLayoutChanged,a)||(s.current.onLayoutChanged=a,o?.(a,{isUserInteraction:l,requestedLayout:c}))});return{onLayoutChangeStable:i,onLayoutChangedStable:r}}function fn({isCompleted:e,isUserInteraction:t,layout:n,onLayoutChange:o,onLayoutChanged:s,requestedLayout:i}){try{o(n)}finally{e&&s(n,t,i)}}function wn(e){const t=f.useRef({...e});return ce(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const xo=f.createContext(null),ht=["column","row"],zn=f.createContext(null);function Qt(e){return e==="column"?"columns":"rows"}function ra({layout:e,itemConstraints:t,itemId:n,itemIndex:o}){let s,i;const r=e[n],a=t.find(l=>l.itemId===n);if(a){const l=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,u=[o,o+1];i=Ye({layout:Mt({delta:c-r,initialLayout:e,itemConstraints:t,pivotIndices:u,prevLayout:e}),itemConstraints:t})[n],s=Ye({layout:Mt({delta:l-r,initialLayout:e,itemConstraints:t,pivotIndices:u,prevLayout:e}),itemConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:i,valueNow:r}}function pi({attributes:e,axisId:t,axisOrientation:n,children:o,className:s,"data-testid":i,disableCursor:r,disabled:a,disableDoubleClick:l,elementRef:c,id:u,isSharedHitRegion:d,preview:h,registerSeparator:m,requiredStyle:p,style:g,styleDefaults:y,tabIndex:b=0,updateSeparatorProps:w}){const S=wn({disabled:a,disableDoubleClick:l,children:o,className:s,preview:h,style:g}),[C,k]=f.useState({}),[E,_]=f.useState("inactive"),[Y,P]=f.useState(!1),T=f.useRef(null),R=f.useRef(null),D=Ke(T,c),q=n==="horizontal"?"vertical":"horizontal";ce(()=>{const V=T.current;if(V!==null){const B={disabled:S.disabled,disableDoubleClick:S.disableDoubleClick,element:V,id:u,get children(){return S.children},get className(){return S.className},get preview(){return S.preview},get style(){return S.style}};R.current=B;const I=m(B),H=yn(oe=>{_(oe.next.state!=="inactive"&&oe.next.hitRegions.some(ne=>ne.separator===B||(d?.(ne)??!1))?oe.next.state:"inactive")}),G=St(t,oe=>{const{derivedItemConstraints:ne,layout:se,separatorToItems:Q}=oe.next,re=Q.get(B);if(re){const L=re[0],U=ne.findIndex(A=>A.itemId===L.id),{layoutStrategy:M}=oe.axis,x={...ra({layout:se,itemConstraints:ne,itemId:L.id,itemIndex:U}),...M?.getItemAriaControls&&{valueControls:M.getItemAriaControls(L.id)}};k(A=>xn(A,x)?A:x)}});return()=>{R.current=null,H(),G(),I()}}},[t,u,d,m,S]),ce(()=>{const V=R.current;V&&Er(V)},[h]),f.useEffect(()=>{w(u,{disabled:a,disableDoubleClick:l})},[a,l,u,w]);let N;a&&!r&&(N="not-allowed");let $;if(a)$="disabled";else switch(E){case"active":{$="active";break}default:Y?$="focus":$=E}return W.jsx("div",{...e,"aria-controls":C.valueControls,"aria-disabled":a||void 0,"aria-orientation":q,"aria-valuemax":C.valueMax,"aria-valuemin":C.valueMin,"aria-valuenow":C.valueNow,children:o,className:s,"data-separator":$,"data-testid":i,id:u,onBlur:()=>P(!1),onFocus:()=>P(!0),ref:D,role:"separator",style:{...y,cursor:N,...g,...p,touchAction:"none"},tabIndex:a?void 0:b})}function Rt(e){return e==="column"?"row":"column"}function aa(e){const{children:t,className:n,disabled:o,elementRef:s,style:i,type:r}=e,[a,l,c]=e.type==="column"?[e.column,e.row,e.rowSpan]:[e.row,e.column,e.columnSpan],u=l??0,d=st(void 0),{getDisableCursor:h,getResizeAxisId:m,gutters:p,registerSeparator:g,separatorPlacements:y,trackCounts:b,updateSeparatorProps:w}=qs(),S=m(r),C=Rt(r),k=b[C],E=!!o||!co(a,b[r]);let _=!0;for(const D of y.values())if(D.axis===r&&D.index===a&&!D.disabled&&D.crossStart<u){_=!1;break}const Y=f.useCallback(D=>D.axis.id===S&&D.axis.items.indexOf(D.items[1])===a,[S,a]),P=f.useCallback(D=>g({axis:r,crossSpan:c,crossStart:u,disabled:!!o,index:a},D),[r,c,u,o,a,g]),T=xr(a),R=wr({crossCount:k,crossSpan:c,crossStart:u,hasGutters:p[C]});return W.jsx(pi,{axisId:S,axisOrientation:r==="column"?"horizontal":"vertical",className:n,disableCursor:h(),disabled:E,disableDoubleClick:void 0,elementRef:s,id:d,isSharedHitRegion:Y,registerSeparator:P,requiredStyle:{gridColumn:r==="column"?T:R,gridRow:r==="row"?T:R},style:i,tabIndex:_?0:-1,updateSeparatorProps:w,children:t})}const hi=Object.assign(aa,{displayName:"Gridline"});function mi(e,t){f.Children.forEach(e,n=>{if(f.isValidElement(n))if(n.type===hi){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&&mi(n.props.children,t)})}function ca(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:ho(i.defaultSize));let o=100,s=0;return n.forEach(i=>{i===void 0?s++:i[1]==="%"&&(o-=i[0])}),n.map(i=>{if(i===void 0)return`minmax(0, ${Math.max(0,o)/Math.max(1,s)}fr)`;const[r,a]=i;return a==="%"?`minmax(0, ${r}fr)`:`${r}${a}`})}function la({cells:e,separatorPlacements:t,trackCounts:n}){const o=[];for(const a of e)ht.forEach(l=>{const[c,u]=vt(a,l),d=n[l];(!Number.isInteger(c)||!Number.isInteger(u)||c<0||u<1||c+u>d)&&o.push(`Invalid Cell ${l} placement (${l}: ${c}, ${l}Span: ${u}); Grid has ${d} ${l}s`)});const s=({axis:a,crossSpan:l,crossStart:c,disabled:u,index:d})=>{const h=Rt(a);let m=`type="${a}" ${a}={${d}}`;return(c!==0||l!==void 0)&&(m+=` ${h}={${c}}`),l!==void 0&&(m+=` ${h}Span={${l}}`),u&&(m+=" disabled"),`<Gridline ${m} />`},i=Array.from(t.values()).filter(a=>{const{axis:l,crossSpan:c,crossStart:u,index:d}=a,h=Rt(l),m=n[l],p=n[h];let g=!0;return co(d,m)||(o.push(`Invalid ${l} Gridline ${l} (${d}); must be between 1 and ${m-1}`),g=!1),!Number.isInteger(u)||u<0||u>=p?(o.push(`Invalid ${l} Gridline ${h} (${u}); must be between 0 and ${p-1}`),g=!1):c!==void 0&&(!Number.isInteger(c)||c<1||u+c>p)&&(o.push(`Invalid ${l} Gridline ${h}Span (${c}); Grid has ${p} ${h}s`),g=!1),g}),r=a=>{const l=n[Rt(a.axis)];return[a.crossStart,a.crossSpan===void 0?l:a.crossStart+a.crossSpan]};return i.forEach((a,l)=>{const{axis:c,index:u}=a,[d,h]=r(a);for(const m of e){const[p,g,y,b]=vt(m,c);if(p<u&&u<p+g&&y<h&&d<y+b){const w=Rt(c);o.push(`${s(a)} overlaps a Cell that spans across it (${c}: ${p}, ${c}Span: ${g}, ${w}: ${y}, ${w}Span: ${b}); use the ${w} and ${w}Span props to render gridlines beside the Cell instead`)}}for(const m of i.slice(l+1))if(m.axis===c&&m.index===u){const[p,g]=r(m);p<h&&d<g&&o.push(`${s(a)} overlaps ${s(m)}`)}}),o}function ua(e,t){return $e(e.columns,t.columns)&&$e(e.rows,t.rows)}const da={columns:{},rows:{}};function fa({children:e,className:t,columns:n,defaultLayout:o,disableCursor:s,disabled:i,elementRef:r,gridRef:a,id:l,onLayoutChange:c,onLayoutChanged:u,resizeTargetMinimumSize:d={coarse:20,fine:10},rows:h,style:m,...p}){const g=st(l),y=f.useCallback(M=>`${g}:${Qt(M)}`,[g]),b=zs(n,"columns"),w=zs(h,"rows"),S=M=>M==="column"?b:w,{onLayoutChangeStable:C,onLayoutChangedStable:k}=fi({initialLayout:da,layoutsEqual:ua,onLayoutChange:c,onLayoutChanged:u}),E=f.useRef(null),_=Ke(E,r),[Y,P]=di(),T=f.useRef({cells:[],column:{expandedItemSizes:{},layouts:{}},loggedErrors:new Set,row:{expandedItemSizes:{},layouts:{}},separators:new Map}),R={column:!1,row:!1};for(const M of T.current.separators.values())R[M.axis]=!0;mi(e,R);const D=wn({defaultLayout:o,disableCursor:s,resizeTargetMinimumSize:d}),q=ge(()=>!!D.disableCursor),N=f.useCallback(M=>{const x=T.current;return x.cells=[...x.cells,M],P(),()=>{x.cells=x.cells.filter(A=>A!==M),P()}},[P]),$=f.useCallback((M,x)=>{const A=T.current;return A.separators=new Map(A.separators),A.separators.set(x,M),P(),()=>{A.separators=new Map(A.separators),A.separators.delete(x),P()}},[P]),V=f.useCallback((M,{disabled:x,disableDoubleClick:A})=>{for(const O of T.current.separators.keys())O.id===M&&(O.disabled=x,O.disableDoubleClick=A)},[]),B=T.current.separators,I=f.useMemo(()=>({getDisableCursor:q,getResizeAxisId:y,gutters:{column:R.column,row:R.row},registerCell:N,registerSeparator:$,separatorPlacements:B,trackCounts:{column:b.length,row:w.length},updateSeparatorProps:V}),[b.length,q,y,R.column,R.row,N,$,w.length,B,V]),H=f.useRef([]);ce(()=>{const M=E.current;if(M===null)return;const x=T.current;if(process.env.NODE_ENV!=="production"){const J=la({cells:x.cells,separatorPlacements:x.separators,trackCounts:{column:b.length,row:w.length}});J.forEach(te=>{x.loggedErrors.has(te)||console.error(te)}),x.loggedErrors=new Set(J)}const A=J=>Array.from(x.separators.entries()).filter(([,te])=>te.axis===J).sort(([,te],[,ze])=>te.index-ze.index).map(([te])=>te),O=J=>{const[te,ze]=J==="column"?[b,w]:[w,b],ye=te.map(ae=>ae.id),ke=y(J),ue=A(J),Se=ue.length>0,fe=te.map(({id:ae,...ve},xe)=>({element:M,id:ye[xe],idIsStable:!0,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:void 0,constraintProps:ve})),Ae=()=>{const ae=[];if(Se){for(const[ve,xe]of x.separators)if(xe.axis===J&&co(xe.index,te.length)){const Ne=ve.element.getBoundingClientRect();ae[xe.index]=Math.max(ae[xe.index]??0,J==="column"?Ne.width:Ne.height)}}return ae.filter(ve=>ve!==void 0)},Le=()=>Ir({axis:J,element:M,getGutterSizes:Ae,hasGutters:Se,layout:Te(ke)?.layout,trackIds:ye});let Me;const le=()=>{const{cells:ae}=x;return Me?.cells!==ae&&(Me={ariaControls:void 0,cells:ae,slots:void 0}),Me},it=()=>{const ae=le();if(!ae.ariaControls){const ve=ye.map(()=>[]);for(const xe of ae.cells){const[Ne,Ht]=vt(xe,J);if(xe.element.id)for(let ct=Math.max(0,Ne);ct<Math.min(ye.length,Ne+Ht);ct++)ve[ct].push(xe.element.id)}ae.ariaControls=new Map(ye.map((xe,Ne)=>[xe,ve[Ne].join(" ")||void 0]))}return ae.ariaControls},rt=()=>{const ae=le();return ae.slots??=Ys({axis:J,cells:ae.cells,crossTrackCount:ze.length,trackCount:te.length}),ae.slots};let at;const Qe=D.defaultLayout?.[Qt(J)];if(Qe!==void 0&&Object.keys(Qe).length===ye.length){at={};for(const ae of ye){const ve=Qe[ae];ve!==void 0&&(at[ae]=ve)}}return{disabled:!!i,element:M,id:ke,layoutStrategy:{getItemAriaControls:ae=>it().get(ae),calculateAvailableSize:()=>Le().availableSize,calculateHitRegions:({expandHitTargets:ae,axis:ve,includeDisabled:xe})=>Tr({axis:J,cells:x.cells,crossTrackCount:ze.length,expandHitTargets:ae,getAxisSize:()=>Le().availableSize*he(ve.element,ve.orientation),getSlots:rt,includeDisabled:xe,resizeAxis:ve,separatorPlacements:x.separators}),getItemSizeInPixels:ae=>Le().trackSizes[ye.indexOf(ae)]??0},mutableState:{defaultLayout:at,disableCursor:!!D.disableCursor,expandedItemSizes:x[J].expandedItemSizes,layouts:x[J].layouts},orientation:J==="column"?"horizontal":"vertical",items:fe,resizePreviewMode:"panel",get resizeTargetMinimumSize(){return D.resizeTargetMinimumSize},separators:ue}},F=ht.map(O);H.current=F;const X=F.map(J=>li(J)),K=()=>{const[J,te]=F.map(ze=>Te(ze.id));if(!(!J||!te||J.defaultLayoutDeferred||te.defaultLayoutDeferred))return{layout:{columns:J.layout,rows:te.layout},requestedLayout:{columns:J.requestedLayout,rows:te.requestedLayout}}};{const J=K();if(J)try{fn({isCompleted:!0,isUserInteraction:!1,layout:J.layout,onLayoutChange:C,onLayoutChanged:k,requestedLayout:J.requestedLayout})}catch(te){throw H.current=[],X.forEach(ze=>ze()),te}}const Z=F.map(J=>St(J.id,te=>{const{defaultLayoutDeferred:ze,derivedItemConstraints:ye,layout:ke,requestedLayout:ue}=te.next;if(ze||ye.length===0)return;ui({derivedItemConstraints:ye,axis:J,layout:ke,prevLayout:te.prev?.layout,requestedLayout:ue});const Se=K();if(Se){const fe=Ee(),Ae=fe.state!=="active"||!fe.hitRegions.some(Le=>F.includes(Le.axis));fn({isCompleted:Ae,isUserInteraction:te.isUserInteraction,layout:Se.layout,onLayoutChange:C,onLayoutChanged:k,requestedLayout:Se.requestedLayout})}}));return()=>{H.current=[],X.forEach(J=>J()),Z.forEach(J=>J())}},[b,i,y,g,k,C,w,Y,D]),f.useEffect(()=>{H.current.forEach(M=>{M.mutableState.defaultLayout=o?.[M.orientation==="horizontal"?"columns":"rows"],M.mutableState.disableCursor=!!s})});const G=f.useMemo(()=>{const M=()=>{const[O,F]=ht.map(y);return!mt(O)||!mt(F)?{columns:{},rows:{}}:{columns:rn({axisId:O}).getLayout(),rows:rn({axisId:F}).getLayout()}},x=O=>O.map(F=>`"${F}"`).join(", "),A=(O,F)=>{const X=y(O),K=()=>{const Z=mt(X);return ie(Z,`Grid "${g}" has not been mounted`),ie(Z.items.some(J=>J.id===F),`Grid "${g}" no longer contains a ${O} with id "${F}"; ${O} ids are ${x(Z.items.map(J=>J.id))}`),So({axisId:X,itemId:F})};return{collapse:()=>K().collapse(),expand:()=>K().expand(),getSize:()=>K().getSize(),isCollapsed:()=>K().isCollapsed(),resize:Z=>K().resize(Z)}};return{getLayout:M,getTrackById:(O,F)=>{const X=O==="column"?b:w,K=`${F}`;return ie(X.some(Z=>Z.id===K),`Grid "${g}" does not contain a ${O} with id "${K}"; ${O} ids are ${x(X.map(Z=>Z.id))}`),A(O,K)},getTrackByIndex:(O,F)=>{const X=O==="column"?b:w,K=Number.isInteger(F)?X[F]:void 0;return ie(K,`Grid "${g}" does not contain a ${O} at index ${F}; it has ${X.length} ${O}s`),A(O,K.id)},setLayout:O=>(ht.forEach(F=>{const X=O[Qt(F)],K=y(F);X&&mt(K)&&rn({axisId:K}).setLayout(X)}),M())}},[b,y,g,w]);f.useImperativeHandle(a,()=>G,[G]);const oe=f.useRef(G);ce(()=>{oe.current=G});const ne=f.useMemo(()=>({getLayout:()=>oe.current.getLayout(),getTrackById:(M,x)=>oe.current.getTrackById(M,x),getTrackByIndex:(M,x)=>oe.current.getTrackByIndex(M,x),id:g,setLayout:M=>oe.current.setLayout(M)}),[g]),se=()=>ht.map(M=>{const x=Te(y(M)),A=S(M);return(x&&!x.defaultLayoutDeferred?A.map(F=>`minmax(0, ${x.layout[F.id]??1}fr)`):ca(A,o?.[Qt(M)])).join(R[M]?" auto ":" ")}).join("|"),Q=f.useCallback(M=>{const x=ht.map(A=>St(y(A),M));return()=>x.forEach(A=>A())},[y]),re=f.useSyncExternalStore(Q,se,se),[L,U]=re.split("|");return W.jsx(Vs.Provider,{value:I,children:W.jsx("div",{...p,className:t,"data-grid":!0,"data-testid":xt(p,l),id:g,ref:_,style:{height:"100%",width:"100%",overflow:"hidden",...m,display:"grid",gridTemplateColumns:L,gridTemplateRows:U,touchAction:"none"},children:W.jsx(xo.Provider,{value:null,children:W.jsx(zn.Provider,{value:ne,children:e})})})})}const pa=Object.assign(fa,{displayName:"Grid"});function zs(e,t){const n=JSON.stringify(e);return f.useMemo(()=>{const o=typeof e=="number"?Array.from({length:e},(s,i)=>({id:`${i}`})):e.map((s,i)=>({...s,id:`${s.id??i}`}));return ie(o.length>0,`Grid must have at least one track; "${t}" is ${n}`),o},[n])}function Cn(){return()=>{}}function ha({id:e,onlySaveAfterUserInteractions:t,storage:n=localStorage}){const o=`react-resizable-panels:grid:${e}`,s=f.useSyncExternalStore(Cn,()=>n.getItem(o),()=>n.getItem(o)),i=f.useMemo(()=>{if(s)try{const a=JSON.parse(s);if(a!==null&&typeof a=="object")return a}catch{}},[s]),r=f.useCallback((a,l)=>{if(!(t&&!l.isUserInteraction))try{n.setItem(o,JSON.stringify(l.requestedLayout??a))}catch(c){console.error(c)}},[t,n,o]);return{defaultLayout:i,onLayoutChanged:r}}function ma(){return f.useState(null)}function ga(){return f.useRef(null)}function ba(){return f.useContext(zn)}function ya(e){for(let t=1;t<e.length;t++)if(uo(e[t-1],e[t])>0)return!1;return!0}function va({separator:e}){const{element:t}=e,n=f.useRef(null);return ce(()=>{const o=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],i=[o,...o.querySelectorAll("*")],r=t.ownerDocument.defaultView;return s.forEach((a,l)=>{const c=i[l],{style:u}=c;if(u){const d=r.getComputedStyle(a);for(let h=0;h<d.length;h++){const m=d.item(h);u.setProperty(m,d.getPropertyValue(m))}}c.removeAttribute("data-testid"),c.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 Tn(){const e=f.useContext(xo);return ie(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Sa(e){const{registerOverlay:t}=Tn(),n=f.useRef(e);xn(n.current,e)||(n.current=e);const o=n.current;return ce(()=>t(o),[t,o]),null}const gi=Object.assign(Sa,{displayName:"SeparatorOverlay"});function xa({active:e,orientation:t,style:n,...o}){let s;switch(t){case"horizontal":{s={height:"100%",minWidth:"1px"};break}case"vertical":{s={minHeight:"1px",width:"100%"};break}}return W.jsx("div",{...o,"data-separator-overlay":e?"active":"inactive",style:{...s,...n,flexShrink:0,pointerEvents:"none"}})}function wa({overlay:e,preview:t}){const{axis:n,offset:o,rect:s,separator:i}=t,r=n.orientation==="horizontal";let a=i?.preview,l=e;return f.isValidElement(a)&&a.type===gi&&(l=a.props,a=void 0),a==null&&(l?a=W.jsx(xa,{...l,active:t.active,orientation:n.orientation}):i&&(a=W.jsx(va,{separator:i}))),W.jsx("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:s.height,left:s.left,pointerEvents:"none",position:"absolute",top:s.top,transform:r?`translateX(${o}px)`:`translateY(${o}px)`,width:s.width},children:a})}function za(e){return Array.from(e).sort(uo)}const In=f.createContext(null);function Ca(e,t){const n=f.useRef({getLayout:()=>({}),setLayout:Mr});return f.useImperativeHandle(t,()=>n.current,[]),ce(()=>{Object.assign(n.current,rn({axisId:e}))}),n}function Ta({groupId:e,resizePreviewMode:t}){const[n,o]=f.useState([]),s=f.useRef(n);return ce(()=>{const i=a=>{const l=mt(e),c=t==="separator"&&a.state==="active"?a.previews.filter(d=>d.axis===l&&(d.active||!de(d.offset,0))):[],u=s.current;u.length===c.length&&c.every((d,h)=>d===u[h])||(s.current=c,o(c))};if(t!=="separator"){i(Ee());return}const r=yn(({next:a})=>i(a));return i(Ee()),r},[e,t]),n}function Ia({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:s,elementRef:i,groupRef:r,id:a,onLayoutChange:l,onLayoutChanged:c,orientation:u="horizontal",resizePreviewMode:d="panel",resizeTargetMinimumSize:h={coarse:20,fine:10},style:m,...p}){const{onLayoutChangeStable:g,onLayoutChangedStable:y}=fi({initialLayout:{},layoutsEqual:$e,onLayoutChange:l,onLayoutChanged:c}),b=st(a),[w,S]=f.useState(),C=Ta({groupId:b,resizePreviewMode:d}),k=f.useRef(null),[E,_]=di(),Y=f.useRef([]),P=f.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),T=Ke(k,i),R=Ca(b,r),D=f.useMemo(()=>({getLayout:()=>R.current.getLayout(),id:b,orientation:u,setLayout:B=>R.current.setLayout(B)}),[b,R,u]),q=ge((B,I)=>{const H=Te(B);if(H)return{flexGrow:H.layout[I]??1};if(n?.[I])return{flexGrow:n?.[I]}}),N=wn({defaultLayout:n,disableCursor:o,resizeTargetMinimumSize:h}),$=f.useMemo(()=>({get disableCursor(){return!!N.disableCursor},getPanelStyles:q,id:b,orientation:u,registerPanel:B=>{const I=P.current;return I.panels=It(u,[...I.panels,B]),_(),()=>{I.panels=I.panels.filter(H=>H!==B),_()}},registerOverlay:B=>(S(B),()=>{S(void 0)}),registerSeparator:B=>{const I=P.current;return I.separators=It(u,[...I.separators,B]),_(),()=>{I.separators=I.separators.filter(H=>H!==B),_()}},updatePanelProps:(B,{disabled:I})=>{const G=P.current.panels.find(se=>se.id===B);if(!G||G.constraintProps.disabled===I)return;G.constraintProps.disabled=I;const oe=mt(b),ne=Te(b);oe&&ne&&_e(oe,{...ne,derivedItemConstraints:mo(oe)})},updateSeparatorProps:(B,{disabled:I,disableDoubleClick:H})=>{const oe=P.current.separators.find(ne=>ne.id===B);oe&&(oe.disabled=I,oe.disableDoubleClick=H)}}),[q,b,_,u,N]),V=f.useRef(null);return ce(()=>{const B=k.current;if(B===null)return;const I=P.current;I.panels=It(u,I.panels),I.separators=It(u,I.separators),Y.current=za([...I.panels.map(({element:U})=>U),...I.separators.map(({element:U})=>U)]);let H;if(N.defaultLayout!==void 0&&Object.keys(N.defaultLayout).length===I.panels.length){H={};for(const U of I.panels){const M=N.defaultLayout[U.id];M!==void 0&&(H[U.id]=M)}}const G={disabled:!!s,element:B,id:b,mutableState:{defaultLayout:H,disableCursor:!!N.disableCursor,expandedItemSizes:P.current.lastExpandedPanelSizes,layouts:P.current.layouts},orientation:u,items:I.panels,resizePreviewMode:d,get resizeTargetMinimumSize(){return N.resizeTargetMinimumSize},separators:I.separators};V.current=G;const oe=li(G),{defaultLayoutDeferred:ne,derivedItemConstraints:se,layout:Q,requestedLayout:re}=Te(G.id,!0);if(!ne&&se.length>0)try{fn({isCompleted:!0,isUserInteraction:!1,layout:Q,onLayoutChange:g,onLayoutChanged:y,requestedLayout:re})}catch(U){throw V.current=null,oe(),U}const L=St(b,U=>{const{defaultLayoutDeferred:M,derivedItemConstraints:x,layout:A,requestedLayout:O}=U.next;if(M||x.length===0)return;ui({derivedItemConstraints:x,axis:G,layout:A,prevLayout:U.prev?.layout,requestedLayout:O});const F=Ee(),X=F.state!=="active"||!F.hitRegions.some(K=>K.axis===G);fn({isCompleted:X,isUserInteraction:U.isUserInteraction,layout:A,onLayoutChange:g,onLayoutChanged:y,requestedLayout:O})});return()=>{V.current=null,oe(),L()}},[s,b,y,g,u,E,d,N]),ce(()=>{ya(Y.current)||_()}),f.useEffect(()=>{const B=V.current;B&&(B.mutableState.defaultLayout=n,B.mutableState.disableCursor=!!o)}),W.jsx(In.Provider,{value:D,children:W.jsx(xo.Provider,{value:$,children:W.jsxs("div",{...p,className:t,"data-group":!0,"data-testid":xt(p,a),id:b,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",position:d==="separator"?"relative":void 0,...m,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:[e,C.map(B=>W.jsx(wa,{overlay:w,preview:B},B.key))]})})})}const bi=Object.assign(Ia,{displayName:"Group"});function an(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function Ra({id:e,panelIds:t,storage:n}){const o=an(e,[]),s=n.getItem(o);if(s)try{const i=JSON.parse(s);if(t){const r=t.join(","),a=i[r];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const l={};for(let c=0;c<t.length;c++)l[t[c]]=a.layout[c];return l}}else{const r=Object.keys(i);if(r.length===1){const a=i[r[0]];if(a&&Array.isArray(a.layout)){const l=r[0].split(",");if(l.length===a.layout.length){const c={};for(let u=0;u<l.length;u++)c[l[u]]=a.layout[u];return c}}}}}catch{}}function Ea({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...s}){const i=n!==void 0,r="id"in s?s.id:s.groupId,a=an(r,n??[]),l=f.useSyncExternalStore(Cn,()=>o.getItem(a),()=>o.getItem(a)),c=f.useMemo(()=>{if(l){const y=JSON.parse(l),b=Object.values(y);if(Array.from(b).every(w=>typeof w=="number"))return y}},[l]),u=f.useMemo(()=>{if(!c)return Ra({id:r,panelIds:n,storage:o})},[c,r,n,o]),d=c??u,h=f.useRef(null),m=f.useCallback(()=>{const y=h.current;y&&(h.current=null,clearTimeout(y))},[]);f.useLayoutEffect(()=>()=>{m()},[m]);const p=f.useCallback((y,b)=>{if(t&&!b.isUserInteraction)return;m();const w=b.requestedLayout??y;let S;i?S=an(r,Object.keys(w)):S=an(r,[]);try{o.setItem(S,JSON.stringify(w))}catch(C){console.error(C)}},[m,i,r,t,o]),g=f.useCallback(y=>{m(),e===0?p(y,{isUserInteraction:!1}):h.current=setTimeout(()=>{p(y,{isUserInteraction:!1})},e)},[m,e,p]);return{defaultLayout:d,onLayoutChange:g,onLayoutChanged:p}}function La(){return f.useState(null)}function yi(){return f.useRef(null)}function Ma(){return f.useContext(In)}const Rn=f.createContext(null);function Da(e,t){const{id:n}=Tn(),o=f.useRef({collapse:Fn,expand:Fn,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Fn});return f.useImperativeHandle(t,()=>o.current,[]),ce(()=>{Object.assign(o.current,So({axisId:n,itemId:e}))}),o}function ka({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:s=!1,defaultSize:i,disabled:r,elementRef:a,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:h,panelRef:m,style:p,...g}){const y=ln(c),b=st(c),w=wn({disabled:r}),S=f.useRef(null),C=Ke(S,a),{getPanelStyles:k,id:E,orientation:_,registerPanel:Y,updatePanelProps:P}=Tn(),T=h!=null,R=ge((I,H,G)=>{h?.(I,c,G)});ce(()=>{const I=S.current;if(I!==null){const H={element:I,id:b,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?R:void 0,constraintProps:{groupResizeBehavior:l,collapsedSize:n,collapsedThreshold:o,collapsible:s,defaultSize:i,disabled:w.disabled,maxSize:u,minSize:d}};return Y(H)}},[l,n,o,s,i,T,b,y,u,d,R,Y,w]),f.useEffect(()=>{P(b,{disabled:r})},[r,b,P]);const D=Da(b,m),q=f.useMemo(()=>({collapse:()=>D.current.collapse(),expand:()=>D.current.expand(),getSize:()=>D.current.getSize(),groupId:E,id:b,isCollapsed:()=>D.current.isCollapsed(),resize:I=>D.current.resize(I)}),[E,b,D]),N=f.useCallback(I=>St(E,I),[E]),$=()=>k(E,b)?.flexGrow,V=f.useSyncExternalStore(N,$,$);let B;return V!==void 0?B={flexGrow:V}:i!==void 0?B={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:B={flexGrow:1},W.jsx("div",{...g,"data-disabled":r||void 0,"data-panel":!0,"data-testid":xt(g,c),id:b,ref:C,style:{...Pa,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...B},children:W.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:_==="horizontal"?"pan-y":"pan-x"},children:W.jsx(Rn.Provider,{value:q,children:e})})})}const vi=Object.assign(ka,{displayName:"Panel"}),Pa={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Oa(){return f.useState(null)}function Aa(){return f.useRef(null)}function Na(){return f.useContext(Rn)}const $a={flexBasis:"auto"},ja={flexGrow:0,flexShrink:0};function Ba({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:s,id:i,preview:r,style:a,...l}){const c=st(i),{disableCursor:u,id:d,orientation:h,registerSeparator:m,updateSeparatorProps:p}=Tn();return W.jsx(pi,{attributes:l,axisId:d,axisOrientation:h,className:t,"data-testid":xt(l,i),disableCursor:u,disabled:n,disableDoubleClick:o,elementRef:s,id:c,preview:r,registerSeparator:m,requiredStyle:ja,style:a,styleDefaults:$a,updateSeparatorProps:p,children:e})}const Si=Object.assign(Ba,{displayName:"Separator"}),Cs=new Set;function Oe(e){Cs.has(e)||(Cs.add(e),console.warn(`react-resizable-panels: ${e}`))}const zt=f.createContext(null),Ft=f.createContext(null);function Dt(e){return e.type==="split"?{...e,children:e.children.map(Dt)}:{...e,tabs:e.tabs.map(t=>({...t}))}}function De(e){const t={...e,root:Dt(e.root)};return e.floating&&(t.floating=e.floating.map(Dt)),t}function Gt(e){return e.type==="tabset"?[e]:e.children.flatMap(t=>Gt(t))}function xi(e){const t=Gt(e.root);return e.floating?[...t,...e.floating]:t}function Xe(e,t){return xi(e).find(({tabs:n})=>n.some(({id:o})=>o===t))}function kt(e,t){return Xe(e,t)?.tabs.find(({id:n})=>n===t)}function wo(e,t){if(e.type==="tabset"){if(e.tabs.some(({id:i})=>i===e.selectedId)||(e.selectedId=e.tabs[0]?.id),e.collapsible||delete e.collapsed,e.recentTabIds!==void 0){const i=Array.isArray(e.recentTabIds)?e.recentTabIds.filter((r,a,l)=>l.indexOf(r)===a&&e.tabs.some(c=>c.id===r)):[];i.length>0?e.recentTabIds=i:delete e.recentTabIds}return e.tabs.length>0||t||e.keepWhenEmpty?e:null}const n=[];for(const i of e.children){const r=wo(i,!1);if(r!==null)if(r.type==="split"&&r.orientation===e.orientation)for(const a of r.children)n.push({...a,size:typeof a.size=="number"&&typeof r.size=="number"?a.size*r.size/100:void 0});else n.push(r)}if(n.length===0)return null;if(n.length===1)return{...n[0],size:e.size};const o=i=>i.type==="tabset"&&!!i.collapsed;n.every(o)&&delete n[n.length-1].collapsed;const s=n.filter(i=>!o(i));if(s.every(({size:i})=>typeof i=="number")){const i=s.reduce((r,{size:a})=>r+a,0);if(i>0)for(const r of s)r.size=r.size/i*100}return{...e,children:n}}const wi=320,zi=240;function Fa(e){const t=e;delete t.collapsible,delete t.size;const n=t.collapsed===!0;return t.x=en(t.x)?t.x:0,t.y=en(t.y)?t.y:0,t.width=en(t.width)&&t.width>0?t.width:wi,t.height=en(t.height)&&t.height>0?t.height:zi,wo(t,!1)?(n&&(t.collapsed=!0),t):null}function en(e){return typeof e=="number"&&Number.isFinite(e)}function Re(e){const t=wo(e.root,!0)??{id:e.root.id,tabs:[],type:"tabset"};t.type==="tabset"&&delete t.collapsed;const n={root:t,version:1},o=(e.floating??[]).flatMap(s=>{const i=Fa(s);return i?[i]:[]});return o.length>0&&(n.floating=o),e.maximizedTabsetId!==void 0&&t.type==="split"&&Gt(t).some(({id:s})=>s===e.maximizedTabsetId)&&(n.maximizedTabsetId=e.maximizedTabsetId),n}function Ci(e,t){const n=e.recentTabIds?.find(s=>s!==t&&e.tabs.some(i=>i.id===s));if(n!==void 0)return n;const o=e.tabs.findIndex(({id:s})=>s===t);return(e.tabs[o+1]??e.tabs[o-1])?.id}function pn(e,t){const n=e.tabs.findIndex(({id:o})=>o===t);n<0||(e.selectedId===t&&(e.selectedId=Ci(e,t)),e.tabs.splice(n,1))}function Lt(e,t){if(!kt(e,t))return e;const n=De(e),o=Xe(n,t);return o&&pn(o,t),Re(n)}function tn(e,t){return typeof e=="function"?e(t):e}function En({children:e,className:t,style:n,title:o},s){return{children:tn(e,s),className:tn(t,s),style:tn(n,s),title:tn(o,s)}}function hn(e,t){return t[e.id]??!!e.collapsed}function zo(e){const t=f.useContext(Ft),n=f.useRef(null),o=()=>{const s=t?e(t.getState()):null,i=n.current;return i&&(i.value===s||i.value!==null&&s!==null&&xn(i.value,s))?i.value:(n.current={value:s},s)};return f.useSyncExternalStore(t?.subscribe??Cn,o,o)}function Ti(){const t=f.useContext(zt)?.id;return zo(({collapseOverrides:n,disabled:o,model:s,modelIndex:i})=>{const r=t!==void 0?i.tabsetsByTabId.get(t):void 0,a=r?.tabs.find(({id:u})=>u===t);if(!r||!a)return null;const l=r.selectedId===a.id,c=s.maximizedTabsetId;return{isCloseDisabled:o||!!a.disableClose,isDragDisabled:o||!!a.disableDrag,isSelected:l,isVisible:l&&(c===void 0?!hn(r,n):c===r.id),tabsetId:r.id}})}function Ga({"aria-label":e,children:t="×",className:n,onClick:o,style:s,title:i,...r}){const a=f.useContext(Ft),l=f.useContext(zt),c=Ti(),u=l?.id,d=zo(({modelIndex:p})=>{const g=u!==void 0?p.tabsById.get(u):void 0;return g?{title:g.title??g.id}:null});if(!a||!l)process.env.NODE_ENV!=="production"&&Oe("TabCloseButton must be rendered within a tab (see renderTab)");else if(c?.isCloseDisabled)return null;const h=d?.title??"tab",m=En({children:t,className:n,style:s,title:i},{tabTitle:h});return W.jsx("button",{"aria-label":e??`Close ${h}`,tabIndex:-1,type:"button",...r,className:m.className,style:m.style,title:m.title,onClick:p=>{o?.(p),!p.defaultPrevented&&a&&l&&a.updateModel("close",!0,g=>Lt(g,l.id))},children:m.children})}const Ii=Object.assign(Ga,{displayName:"TabCloseButton"}),Je=f.createContext(null);function Co(e,t){return!!t.collapsible&&!!e&&e.children.some(n=>n.id!==t.id&&!(n.type==="tabset"&&n.collapsed))}function Wa(e){const t={floatingTabsetIds:new Set,nodeIds:new Set,parentsById:new Map,tabsetsById:new Map,tabsetsByTabId:new Map,tabsById:new Map},n=o=>{if(t.nodeIds.add(o.id),o.type==="tabset"){t.tabsetsById.set(o.id,o);for(const s of o.tabs)t.tabsetsByTabId.set(s.id,o),t.tabsById.set(s.id,s)}else for(const s of o.children)t.parentsById.set(s.id,o),n(s)};n(e.root);for(const o of e.floating??[])t.floatingTabsetIds.add(o.id),n(o);return t}const Ts=new WeakMap;function Ce(e){let t=Ts.get(e);return t||(t=Wa(e),Ts.set(e,t)),t}function To(e,t,n,o){return Ce(e).floatingTabsetIds.has(t.id)?n||!!t.disableDrag:n||!!t.disableDrag||t.tabs.some(({disableDrag:s})=>s)||e.root.id===t.id&&(o===void 0||!!t.keepWhenEmpty)||e.maximizedTabsetId!==void 0}function Ln(){const t=f.useContext(Je)?.id;return zo(({activeTabsetId:n,collapseOverrides:o,collapseToFit:s,disabled:i,dragGroup:r,model:a,modelIndex:l})=>{const c=t!==void 0?l.tabsetsById.get(t):void 0;return c?{isActive:n===c.id,isCollapsed:hn(c,o),isCollapsedToFit:hn(c,o)&&s[c.id]===!0,isCollapsible:!!c.collapsed||l.floatingTabsetIds.has(c.id)||Co(l.parentsById.get(c.id),c),isDragDisabled:To(a,c,i,r),isFloating:l.floatingTabsetIds.has(c.id),isMaximized:a.maximizedTabsetId===c.id,isRoot:a.root.id===c.id,selectedTabId:c.selectedId}:null})}function ot(e,t){if(e.type==="split")for(const n of e.children){if(n.id===t)return e;const o=ot(n,t);if(o)return o}}function we(e,t){return xi(e).find(({id:n})=>n===t)}function Wt(e,t){return!!e.floating?.includes(t)}function Ri(e,t){const n=we(e,t);if(!n||n.collapsed||!(Wt(e,n)||Co(ot(e.root,t),n)))return e;const o=De(e),s=we(o,t);return s&&(s.collapsed=!0),Re(o)}function Ei(e,t){const n=we(e,t);if(!n?.collapsed)return!1;delete n.collapsed;const o=n.size,s=ot(e.root,t)?.children.filter(i=>i!==n&&!(i.type==="tabset"&&i.collapsed))??[];if(typeof o=="number"&&o<100&&s.every(i=>typeof i.size=="number"))for(const i of s)i.size=i.size*(100-o)/100;return!0}function Mn(e,t){if(!we(e,t)?.collapsed)return e;const n=De(e);return Ei(n,t),Re(n)}function _a({"aria-label":e="Collapse tabset",children:t,className:n,onClick:o,style:s,title:i,...r}){const a=f.useContext(Ft),l=f.useContext(Je),c=Ln();if((!a||!l)&&process.env.NODE_ENV!=="production"&&Oe("TabsetCollapseButton must be rendered within a tabset (see renderTabsetToolbar)"),!c?.isCollapsible||c.isMaximized)return null;const{isCollapsed:u,isCollapsedToFit:d,selectedTabId:h}=c,m=En({children:t,className:n,style:s,title:i},{isCollapsed:u,isCollapsedToFit:d});return W.jsx("button",{"aria-controls":a&&h!==void 0?a.getTabPanelId(h):void 0,"aria-disabled":d||void 0,"aria-expanded":!u,"aria-label":e,type:"button",...r,className:m.className,onClick:p=>{if(o?.(p),!p.defaultPrevented&&!d&&a&&l){const g=l.id;u?a.updateModel("expand",!0,y=>Mn(y,g)):a.updateModel("collapse",!0,y=>Ri(y,g))}},style:m.style,title:m.title,children:m.children})}const Ha=Object.assign(_a,{displayName:"TabsetCollapseButton"});function Va({children:e,className:t,style:n,title:o,...s}){const i=f.useContext(Je),r=Ln();i||process.env.NODE_ENV!=="production"&&Oe("TabsetDragHandle must be rendered within a tabset's header (see renderTabsetToolbar)");const a=r?.isDragDisabled??!0,l=En({children:e,className:t,style:n,title:o},{isDisabled:a});return W.jsx("div",{"data-disabled":a||void 0,"data-tabset-drag-handle":"",...s,className:l.className,style:a?l.style:{touchAction:"none",...l.style},title:l.title,children:l.children})}const qa=Object.assign(Va,{displayName:"TabsetDragHandle"});function Li(e,t){return e.maximizedTabsetId===t||e.root.id===t||!Gt(e.root).some(({id:n})=>n===t)?e:{...e,maximizedTabsetId:t}}function Mi(e){if(e.maximizedTabsetId===void 0)return e;const t={...e};return delete t.maximizedTabsetId,t}function Ua({"aria-label":e="Maximize tabset",children:t,className:n,onClick:o,style:s,title:i,...r}){const a=f.useContext(Ft),l=f.useContext(Je),c=Ln();if((!a||!l)&&process.env.NODE_ENV!=="production"&&Oe("TabsetMaximizeButton must be rendered within a tabset (see renderTabsetToolbar)"),!c||c.isRoot||c.isFloating)return null;const{isMaximized:u}=c,d=En({children:t,className:n,style:s,title:i},{isMaximized:u});return W.jsx("button",{"aria-label":e,"aria-pressed":u,type:"button",...r,className:d.className,onClick:h=>{if(o?.(h),!h.defaultPrevented&&a&&l){const m=l.id;u?a.updateModel("restore",!0,Mi):a.updateModel("maximize",!0,p=>Li(p,m))}},style:d.style,title:d.title,children:d.children})}const Ya=Object.assign(Ua,{displayName:"TabsetMaximizeButton"});function Xa(){return f.useContext(zt)}function Ka(){return f.useContext(Je)}const Io=f.createContext(null);function Ja(){return f.useContext(Io)}function Za(){const e=f.useContext(Io),t=f.useContext(Je)?.id,n=f.useCallback(s=>e&&t!==void 0?e.subscribeToTabListFreeSpace(t,s):()=>{},[t,e]),o=()=>e&&t!==void 0?e.getTabListFreeSpace(t):void 0;return f.useSyncExternalStore(n,o,Qa)}function Qa(){}function ec(){return f.useState(null)}function tc(){return f.useRef(null)}const Di=f.createContext(null);function nc(e,{getChromeSize:t,getCollapsedSize:n,getContentMaximumSize:o,getContentMinimumSize:s,getSeparatorsSize:i}){const r=new Map,a=new Map,l=new Map,c=d=>{let h,m;if(d.type==="tabset"){const p=t(d.id)??{height:0,width:0},g=s(d),y=o(d);r.set(d.id,y),m={height:g.height+p.height,width:g.width+p.width},h={height:y.height+p.height,width:y.width+p.width}}else{const p=d.orientation==="horizontal"?"width":"height",g=p==="width"?"height":"width",y=i(d.id)??0;let b=0,w=0,S=0,C=1/0;for(const k of d.children){const E=c(k);if(k.type==="tabset"&&k.collapsed){const _=n(k.id)??0;b+=_,S+=_,C=Math.min(C,E.max[g])}else b+=E.min[p],w=Math.max(w,E.min[g]),S+=E.max[p],C=Math.min(C,E.max[g])}m={[p]:b+y,[g]:w},h={[p]:S+y,[g]:C}}return l.set(d.id,m),a.set(d.id,h),{max:h,min:m}},u=(d,h)=>{const m=a.get(d.id);if(d.type==="tabset"){const p=r.get(d.id);for(const g of["height","width"])!h[g]&&Number.isFinite(p[g])&&process.env.NODE_ENV!=="production"&&Oe(`Tabset "${d.id}" can't be limited to its ${g==="height"?"maxHeight":"maxWidth"}, since nothing else can take up the rest of the space (e.g. every other tabset in its split has a maximum ${g}, or it fills the workspace)`)}else{const p=d.orientation==="horizontal"?"width":"height",g=p==="width"?"height":"width",y=d.children.filter(b=>!(b.type==="tabset"&&b.collapsed)&&!Number.isFinite(a.get(b.id)[p])).map(({id:b})=>b);for(const b of d.children){const w=y.some(S=>S!==b.id);u(b,{[p]:w||h[p],[g]:h[g]})}}a.set(d.id,{height:h.height?m.height:1/0,width:h.width?m.width:1/0})};return c(e),u(e,{height:!1,width:!1}),{maximumSizes:a,minimumSizes:l}}function Zn(e,t){return e===void 0||t===void 0?e===t:"edge"in e||"edge"in t?"edge"in e&&"edge"in t&&e.edge===t.edge:e.tabsetId!==t.tabsetId?!1:"index"in e&&"index"in t?e.index===t.index:"region"in e&&"region"in t?e.region===t.region:!1}function oc(){const e=new $t;let t={dragSource:void 0,dropTarget:void 0};return{getState:()=>t,setDragSource:n=>{t.dragSource!==n&&(t={...t,dragSource:n},e.emit("change",void 0))},setDropTarget:n=>{Zn(t.dropTarget,n)||(t={...t,dropTarget:n},e.emit("change",void 0))},subscribe:n=>e.addListener("change",n)}}function sc(){const e=new Map,t=new Map,n=new Map,o=(s,i)=>{if(e.get(s)===i)return;i===void 0?e.delete(s):e.set(s,i);const r=t.get(s);if(!r)return;let a;for(const l of Array.from(r))try{l(i)}catch(c){a??={error:c}}if(a)throw a.error};return{get:s=>e.get(s),retain:s=>(n.set(s,(n.get(s)??0)+1),()=>{n.set(s,n.get(s)-1),queueMicrotask(()=>{n.get(s)||(n.delete(s),o(s,void 0))})}),set:o,subscribe:(s,i)=>{let r=t.get(s);return r||(r=new Set,t.set(s,r)),r.add(i),()=>{r.delete(i),r.size===0&&t.get(s)===r&&t.delete(s)}}}}function ic(){const e=new Map;return{get:t=>{const n=e.get(t);if(n){for(const o of n)if(o.tabset)return o}},register:(t,n)=>{let o=e.get(t);o||(o=new Set,e.set(t,o)),o.add(n);const s=o;return()=>{s.delete(n),s.size===0&&e.get(t)===s&&e.delete(t)}}}}function rc(e,t,n){const o=new $t;let s=e,i=e;return{getState:()=>i,getTabPanelId:n,notify:()=>{s!==i&&(s=i,o.emit("change",void 0))},setState:r=>{i=r},subscribe:r=>o.addListener("change",r),updateModel:t}}function mn(e,t){const n=Xe(e,t);if(!n||n.selectedId===t)return e;const o=De(e),s=Xe(o,t);return s&&(s.selectedId=t),o}function ac(e,t,{index:n,select:o=!0,tabsetId:s}={}){if(kt(e,t.id))return{added:!1,model:mn(e,t.id)};const i=De(e);let r=we(i,s);r||(s!==void 0&&process.env.NODE_ENV!=="production"&&Oe(`Tabset "${s}" not found in workspace model; adding tab to the first tabset instead`),r=Gt(i.root)[0]);const a=n===void 0?r.tabs.length:Math.max(0,Math.min(n,r.tabs.length));return r.tabs.splice(a,0,{...t}),(o||r.selectedId===void 0)&&(r.selectedId=t.id),{added:!0,model:Re(i)}}function Gn(e,t){if(!we(e,t))return e;const n=De(e),o=we(n,t);return o&&(o.tabs=[],o.selectedId=void 0,delete o.keepWhenEmpty),Re(n)}function _t(){return Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")}function cc(e,t){let n;if(t.type==="tab"){const o=kt(e,t.tabId);if(!o)return;n={id:_t(),selectedId:o.id,tabs:[{...o}],type:"tabset"}}else{const o=we(e,t.tabsetId);if(!o)return;const{height:s,width:i,x:r,y:a,...l}=Dt(o);n=l,delete n.collapsed,delete n.size}return Re({root:n})}function Pt(e,t){return{id:_t(),selectedId:e[0]?.id,size:t,tabs:e,type:"tabset"}}function lc(e,t,n){const o=Xe(e,t);if(!o||Wt(e,o)&&o.tabs.length===1&&!o.keepWhenEmpty)return e;const s=De(e),i=Xe(s,t),r=i?.tabs.find(({id:u})=>u===t);if(!i||!r)return e;pn(i,t);const{size:a,...l}=Pt([r]),c={...l,...n};return s.floating=[...s.floating??[],c],Re(s)}function uc(e,t,n){const o=we(e,t);if(!o||Wt(e,o))return e;const s=De(e),i=we(s,t),r=ot(s.root,t);if(!i||!r)return e;r.children.splice(r.children.indexOf(i),1);const{collapsed:a,collapsible:l,size:c,...u}=i,d={...u,...n};return s.floating=[...s.floating??[],d],s.maximizedTabsetId===t&&delete s.maximizedTabsetId,Re(s)}function ki(e){return gn(e)&&Qn(e.root)&&(e.floating===void 0||Array.isArray(e.floating)&&e.floating.every(t=>gn(t)&&t.type==="tabset"&&Qn(t)))}function gn(e){return typeof e=="object"&&e!==null}function Is(e){return e===void 0||typeof e=="string"}function Qn(e){if(!gn(e)||!Is(e.id))return!1;switch(e.type){case"split":return(e.orientation==="horizontal"||e.orientation==="vertical")&&Array.isArray(e.children)&&e.children.every(Qn);case"tabset":return Array.isArray(e.tabs)&&e.tabs.every(t=>gn(t)&&typeof t.id=="string"&&Is(t.title));default:return!1}}function Rs(e){return ki(e)?e:(process.env.NODE_ENV!=="production"&&Oe("Invalid workspace model; using an empty workspace instead"),{root:{tabs:[],type:"tabset"},version:1})}function dc(e,t,n){const{nodeIds:o,tabsetsByTabId:s}=Ce(e),i=a=>o.has(a)||s.has(a);return t.type==="tab"?i(t.tab.id):("edge"in n||"region"in n&&n.region!=="center")&&i(t.tabset.id)||t.tabset.tabs.some(({id:a})=>i(a))}function fc(e,t,n,o){const s=o==="left"||o==="right"?"horizontal":"vertical",i=o==="left"||o==="top",r=ot(e,t.id);if(r&&r.orientation===s){const l=r.children.indexOf(t);return typeof t.size=="number"?(t.size/=2,n.size=t.size):n.size=void 0,r.children.splice(i?l:l+1,0,n),e}const a={children:i?[n,t]:[t,n],id:_t(),orientation:s,size:t.size,type:"split"};return t.size=50,n.size=50,r?(r.children[r.children.indexOf(t)]=a,e):a}function Dn(e,t,n,o,{expandCollapsedDestination:s=!0}={}){if("index"in o||o.region==="center"){const i="index"in o?Math.max(0,Math.min(o.index,t.tabs.length)):t.tabs.length;if(t.tabs.splice(i,0,...n.tabs),t.selectedId=n.selectedId??n.tabs[0].id,n.recentTabIds&&(t.recentTabIds=[...t.recentTabIds??[],...n.recentTabIds]),t.collapsed&&s){const r=Re(e);return Ei(r,t.id)?Re(r):r}}else delete n.collapsed,e.root=fc(e.root,t,n,o.region),e.maximizedTabsetId===t.id&&(e.maximizedTabsetId=void 0);return Re(e)}function Ot(e,t,n){const o=n==="left"||n==="right"?"horizontal":"vertical",s=n==="left"||n==="top";delete t.collapsed;const i=Re(e),{root:r}=i;if(r.type==="split"&&r.orientation===o){const a=r.children.filter(l=>l.type!=="tabset"||!l.collapsed);t.size=a.every(({size:l})=>typeof l=="number")?100/a.length:void 0,s?r.children.unshift(t):r.children.push(t)}else{r.size=50,t.size=50;const a={children:s?[t,r]:[r,t],id:_t(),orientation:o,type:"split"};i.root=a}return Re(i)}function kn(e,t,n){return"region"in n&&n.region!=="center"&&Wt(e,t)?{region:"center",tabsetId:n.tabsetId}:n}function pc(e,t,n){const o=De(e);if("edge"in n)return Ot(o,Pt([{...t}]),n.edge);const s=we(o,n.tabsetId);return s?Dn(o,s,Pt([{...t}]),kn(o,s,n)):e}function hc(e,t,n){const o=De(e),s=Dt(t);if(delete s.size,"edge"in n)return Ot(o,s,n.edge);const i=we(o,n.tabsetId);if(!i)return e;const r=kn(o,i,n);return("index"in r||r.region==="center")&&t.tabs.length===0?e:Dn(o,i,s,r)}function Ro(e,t,n){if(e.type==="tabset")return e.id===t.id;const o=n==="left"||n==="right"?"horizontal":"vertical";return e.orientation!==o?!1:(n==="left"||n==="top"?e.children[0]:e.children[e.children.length-1])?.id===t.id}function eo(e,t,n){const o=De(e),s=Xe(o,t);if(!s)return e;const i=s.tabs.findIndex(({id:u})=>u===t),r=s.tabs[i];if("edge"in n)return s.tabs.length===1&&!s.keepWhenEmpty&&Ro(o.root,s,n.edge)?e:(pn(s,t),Ot(o,Pt([r]),n.edge));const a=we(o,n.tabsetId);if(!a)return e;const l=kn(o,a,n);let c=l;if("index"in l||l.region==="center"){if(s===a){let u="index"in l?Math.max(0,Math.min(l.index,a.tabs.length)):a.tabs.length;if(u>i&&u--,u===i&&a.selectedId===t)return e;c={index:u,tabsetId:a.id}}}else if(s===a&&s.tabs.length===1&&!s.keepWhenEmpty)return e;return pn(s,t),Dn(o,a,Pt([r]),c,{expandCollapsedDestination:s!==a})}function Es(e,t){const n=e.floating?.indexOf(t)??-1;if(!e.floating||n<0)return;const[o]=e.floating.splice(n,1),{height:s,width:i,x:r,y:a,...l}=o;return l}function to(e,t,n){const o=De(e),s=we(o,t);if(!s)return e;if("edge"in n){const l=Es(o,s);if(l)return Ot(o,l,n.edge);const c=ot(o.root,s.id);return!c||Ro(o.root,s,n.edge)?e:(c.children.splice(c.children.indexOf(s),1),Ot(o,s,n.edge))}const i=we(o,n.tabsetId);if(!i||s===i)return e;const r=kn(o,i,n);let a;if("index"in r||r.region==="center"){if(s.tabs.length===0)return e;a={...s},s.tabs=[],s.selectedId=void 0}else{const l=Es(o,s);if(l)a=l;else{const c=ot(o.root,s.id);if(!c)return e;c.children.splice(c.children.indexOf(s),1),a=s}}return Dn(o,i,a,r)}function mc(e,t){const n=new Set,o=s=>{n.add(s.id),s.type==="split"&&s.children.forEach(o)};o(t);for(const s of e)s.id!==void 0&&n.add(s.id);return e.map((s,i)=>{let r=s.id;if(r===void 0){const a=`floating-${i}`;r=a;let l=1;for(;n.has(r);)l++,r=`${a}-${l}`;n.add(r)}return{...s,id:r,tabs:s.tabs.map(a=>({...a}))}})}function gc(e){const t=new Set,n=i=>{i.id!==void 0&&t.add(i.id),i.type==="split"&&i.children.forEach(n)};n(e);const o=(i,r)=>{if(i.id!==void 0)return i.id;const a=`${i.type}-${r.length>0?r.join("-"):"root"}`;let l=a,c=1;for(;t.has(l);)c++,l=`${a}-${c}`;return t.add(l),l},s=(i,r)=>i.type==="split"?{...i,children:i.children.map((a,l)=>s(a,[...r,l])),id:o(i,r)}:{...i,id:o(i,r),tabs:i.tabs.map(a=>({...a}))};return s(e,[])}function bc(e){const t=new Set,n=s=>{t.has(s)&&process.env.NODE_ENV!=="production"&&Oe(`Duplicate id found in workspace model: "${s}"`),t.add(s)},o=s=>{n(s.id),s.type==="split"?s.children.forEach(o):s.tabs.forEach(({id:i})=>n(i))};o(e.root),e.floating?.forEach(o)}function bn(e){e.version!==1&&process.env.NODE_ENV!=="production"&&Oe(`Unsupported workspace model version: ${e.version}`);const t=gc(e.root),n=Re({floating:Array.isArray(e.floating)?mc(e.floating,t):void 0,maximizedTabsetId:e.maximizedTabsetId,root:t});return process.env.NODE_ENV!=="production"&&bc(n),n}function yc(e,t,n){if(!kt(e,t))return e;const o=De(e),s=kt(o,t);return s&&Object.assign(s,n),o}function Wn(e,t){const n=no(e.root,t),o=e.floating?.map(i=>no(i,t)),s=!!o?.some((i,r)=>i!==e.floating?.[r]);return n===e.root&&!s?e:s?{...e,floating:o,root:n}:{...e,root:n}}function no(e,t){if(e.type==="split"){const s=e.children.map(i=>no(i,t));return s.every((i,r)=>i===e.children[r])?e:{...e,children:s}}const n=e.recentTabIds,o=e.selectedId;if(t==="adjacent"||o===void 0){if(n===void 0)return e;const{recentTabIds:s,...i}=e;return i}return n?.[0]===o?e:{...e,recentTabIds:[o,...(n??[]).filter(s=>s!==o)]}}function Pi(e,t,n){if(!we(e,t))return e;const o=De(e),s=we(o,t);if(s)if(Wt(o,s))Object.assign(s,n);else{const{height:i,width:r,x:a,y:l,...c}=n;Object.assign(s,c)}return Re(o)}const Oi=f.createContext(null);function Ze(e){const t=f.useContext(Di);return ie(t,`${e} must be rendered within a Workspace`),t}function Pn(e){const t=f.useContext(Oi);return ie(t,`${e} must be rendered within a tabset`),t}const vc=f.memo(function({render:t,tab:n}){return t(n)},(e,t)=>e.render===t.render&&e.tab.id===t.tab.id&&e.tab.data===t.tab.data&&e.tab.title===t.tab.title&&e.tab.disableClose===t.tab.disableClose&&e.tab.disableDrag===t.tab.disableDrag),Sc=Object.assign(vc,{displayName:"Workspace.MemoizedContent"});function xc({hiddenTabBehavior:e,renderTabContent:t,tab:n}){const{classNames:o,getTabHandle:s,getTabHost:i,getTabsetHandle:r,modelIndex:a,styles:l}=Ze("TabContent"),c=a.tabsetsByTabId.get(n.id);if(!c)return null;const u=c.selectedId===n.id;let d=null;if((e!=="unmount"||u)&&(d=W.jsx(Sc,{render:t,tab:n}),e==="activity")){const p=vr.Activity;p?d=W.jsx(p,{mode:u?"visible":"hidden",children:d}):process.env.NODE_ENV!=="production"&&Oe('hiddenTabBehavior "activity" requires React 19.2 or newer; falling back to "keep-mounted"')}const{panelId:h,tabElementId:m}=i(n.id);return W.jsx("div",{"aria-labelledby":m,className:o?.tabContent,"data-tab-content":"",id:h,role:"tabpanel",style:l?.tabContent,children:W.jsx(Je.Provider,{value:r(c.id),children:W.jsx(zt.Provider,{value:s(n.id),children:d})})})}const Ai=Object.assign(xc,{displayName:"Workspace.TabContent"});function Ni(e,t,n){return n.width<=0||n.height<=0?e:{x:Ls(e.x,t.left,t.width,n.width),y:Ls(e.y,t.top,t.height,n.height)}}function Ls(e,t,n,o){return Math.max(0-t,Math.min(e,o-n-t))}function oo(e,t){return Array.from(e.querySelectorAll(t)).find(n=>n.closest("[data-tabset-id]")===e)}function $i(e){const t=e.querySelector("[data-tabset-id]"),n=t?oo(t,"[data-tabset-header]"):void 0;if(!n)return;const o=he(e,"horizontal"),s=he(e,"vertical"),i=e.getBoundingClientRect(),r=n.getBoundingClientRect();return{height:r.height/s,left:(r.left-i.left)/o,top:(r.top-i.top)/s,width:r.width/o}}const wc=3,so="data-floating-gesture",ji={bottom:"ns-resize","bottom-left":"nesw-resize","bottom-right":"nwse-resize",left:"ew-resize",right:"ew-resize",top:"ns-resize","top-left":"nwse-resize","top-right":"nesw-resize"};function zc({getMinimumSize:e,updateModel:t}){const n=f.useRef(null);return f.useEffect(()=>()=>n.current?.(),[]),f.useCallback((o,s,i)=>{const r=Tc(i.currentTarget,o),a=r?.parentElement;if(!r||!a)return;n.current?.();const l=i.currentTarget,c=l.ownerDocument,u=c.defaultView,{clientX:d,clientY:h,pointerId:m}=i;l.setPointerCapture?.(m);const p=he(r,"horizontal"),g=he(r,"vertical"),y={height:a.offsetHeight,width:a.offsetWidth},b={height:r.offsetHeight,width:r.offsetWidth,x:r.offsetLeft,y:r.offsetTop},w=$i(r)??{height:0,left:0,top:0,width:0},S=e(o),C=Cc(s),k=Object.fromEntries(C.map($=>[$,r.style[_n[$]]])),E={cursor:c.documentElement.style.cursor,userSelect:c.body.style.userSelect};let _=!1,Y=b;const P=$=>{if($.pointerId!==m)return;const{clientX:V,clientY:B}=$;if(!_){if(Math.hypot(V-d,B-h)<wc)return;_=!0,r.setAttribute(so,""),c.body.style.userSelect="none",s!=="move"&&(c.documentElement.style.cursor=ji[s])}const I=(V-d)/p,H=(B-h)/g;Y=s==="move"?{...b,...Ni({x:b.x+I,y:b.y+H},w,y)}:Ic(b,s,I,H,S,y);for(const G of C)r.style[_n[G]]=`${Y[G]}px`},T=$=>{if(n.current=null,c.removeEventListener("pointermove",P),c.removeEventListener("pointerup",R),c.removeEventListener("pointercancel",D),c.removeEventListener("keydown",q,!0),u?.removeEventListener("blur",N),r.removeAttribute(so),!!_)if(c.body.style.userSelect=E.userSelect,c.documentElement.style.cursor=E.cursor,un(c),$){const V=Object.fromEntries(C.map(B=>[B,Math.round(Y[B])]));t(s==="move"?"move":"resize",!0,B=>Ce(B).floatingTabsetIds.has(o)?Pi(B,o,V):B)}else for(const V of C)r.style[_n[V]]=k[V]??""},R=$=>{$.pointerId===m&&T(!0)},D=$=>{$.pointerId===m&&T(!1)},q=$=>{$.key==="Escape"&&(_&&($.preventDefault(),$.stopPropagation()),T(!1))},N=()=>T(!1);n.current=()=>T(!1),c.addEventListener("pointermove",P),c.addEventListener("pointerup",R),c.addEventListener("pointercancel",D),c.addEventListener("keydown",q,!0),u?.addEventListener("blur",N)},[e,t])}const _n={height:"height",width:"width",x:"left",y:"top"};function Cc(e){if(e==="move")return["x","y"];const t=[];return e.includes("left")?t.push("x","width"):e.includes("right")&&t.push("width"),e.includes("top")?t.push("y","height"):e.includes("bottom")&&t.push("height"),t}function Tc(e,t){let n=e.closest("[data-floating-tabset]");for(;n&&n.dataset.floatingTabset!==t;)n=n.parentElement?.closest("[data-floating-tabset]")??null;return n}function Ic(e,t,n,o,s,i){let{height:r,width:a,x:l,y:c}=e;const u=e.x+e.width,d=e.y+e.height;return t.includes("left")?(l=Math.max(Math.min(e.x+n,u-s.width),Math.min(0,e.x)),a=u-l):t.includes("right")&&(a=Math.min(Math.max(e.width+n,s.width),Math.max(i.width-e.x,e.width))),t.includes("top")?(c=Math.max(Math.min(e.y+o,d-s.height),Math.min(0,e.y)),r=d-c):t.includes("bottom")&&(r=Math.min(Math.max(e.height+o,s.height),Math.max(i.height-e.y,e.height))),{height:r,width:a,x:l,y:c}}let io=null;const Eo=new $t;function cn(){return io}function qe(e){io!==e&&(io=e,Eo.emit("change",e))}function Bi(e,t){e.lastDocument!==t&&(e.lastDocument=t,Eo.emit("change",e))}function Fi(e){return Eo.addListener("change",e)}const Rc="react-resizable-panels-workspace",At=1,Ec=50,Lc=5e3;let gt=null,Ms=0,Hn=null,yt=null;const Lo=new Map;let Vn={id:"",time:0};function On(e){try{return gt?.postMessage(e),gt!==null}catch{return!1}}function Gi(){if(yt){const{id:e}=yt;yt=null,On({id:e,type:"end",version:At}),setTimeout(()=>Lo.delete(e),Lc)}}function Mc(e){yt&&e!==yt&&Gi()}function Dc(e){const t=e.data;if(t?.version!==At)return;const n=cn();switch(t.type){case"start":{const{dragGroup:o,id:s,node:i,source:r}=t;qe({dragGroup:o,hasSource:()=>!0,id:s,isDropped:!1,isRemote:!0,isShared:!0,lastDocument:void 0,lastDragover:void 0,lastMoveStep:0,lastRemoteDragoverTime:Date.now(),node:i,previewOwners:new Map,removeFromSource:()=>On({id:s,type:"remove",version:At}),source:r,sourceOwner:{}});break}case"over":{n?.id===t.id&&(n.lastRemoteDragoverTime=Date.now(),Bi(n,void 0));break}case"remove":{const o=Lo.get(t.id);o&&!o.isDropped&&(o.isDropped=!0,n===o&&qe(null),o.removeFromSource());break}case"end":{n?.isRemote&&n.id===t.id&&qe(null);break}}}function kc(){if(typeof BroadcastChannel>"u")return()=>{};Ms++===0&&(gt=new BroadcastChannel(Rc),gt.addEventListener("message",Dc),Hn=Fi(Mc));let e=!0;return()=>{e&&(e=!1,--Ms===0&&(gt?.close(),gt=null,Hn?.(),Hn=null))}}function Pc(e){Gi();const{dragGroup:t,id:n,node:o,source:s}=e;return On({dragGroup:t,id:n,node:o,source:s,type:"start",version:At})?(e.isShared=!0,yt=e,Lo.set(n,e),!0):!1}function Oc(e){const t=Date.now();e.isShared&&(Vn.id!==e.id||t-Vn.time>=Ec)&&(Vn={id:e.id,time:t},On({id:e.id,type:"over",version:At}))}const Ds=new WeakMap;function ro(e,t){if(!e)return;let n=Ds.get(e);if(!n){const{margin:i,translate:r}=e.style;e.style.margin="0",e.style.transform="none",e.style.translate="none";const a=e.getBoundingClientRect();n={scaleX:he(e,"horizontal"),scaleY:he(e,"vertical"),x:a.left,y:a.top},Ds.set(e,n),e.style.margin=i,e.style.translate=r}const o=(t.clientX-n.x)/n.scaleX,s=(t.clientY-n.y)/n.scaleY;e.style.transform=`translate(${o}px, ${s}px)`}const Ac=.25;function Wi(e,t,n){const o=e.width>0?(t-e.left)/e.width:.5,s=e.height>0?(n-e.top)/e.height:.5,i={bottom:1-s,left:o,right:1-o,top:s},r=Object.keys(i).reduce((a,l)=>i[l]<i[a]?l:a,"left");return i[r]<Ac?r:"center"}function Ue(e){return e?.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl"}function _i(e,t,n){const o=e.dataset.orientation==="vertical",s=!o&&Ue(e),i=Array.from(e.querySelectorAll("[data-tab]")).filter(a=>a.closest("[data-tab-list]")===e),r=i.findIndex(a=>{const l=a.getBoundingClientRect();if(o)return n<l.top+l.height/2;const c=l.left+l.width/2;return s?t>c:t<c});return r===-1?i.length:r}const ks=16;function Nc({clientX:e,clientY:t,element:n,layoutElement:o,rootElement:s}){const i=he(s,"horizontal"),r=he(s,"vertical"),a=s.getBoundingClientRect(),l=s.ownerDocument.defaultView?.getComputedStyle(s),c=b=>parseFloat(l?.[`border${b}Width`]??"")||0;if(e<a.left+c("Left")*i||e>a.right-c("Right")*i||t<a.top+c("Top")*r||t>a.bottom-c("Bottom")*r)return;const u=o.getBoundingClientRect(),d={bottom:u.bottom-t,left:e-u.left,right:u.right-e,top:t-u.top},h=$c(n,s),m=h?0:ks*i,p=h?0:ks*r,g={bottom:p,left:m,right:m,top:p};let y;for(const b of Object.keys(d))d[b]<g[b]&&(y===void 0||d[b]<d[y])&&(y=b);return y}function $c(e,t){return e.closest("[data-tabset-header]")?.closest("[data-workspace]")===t}function bt(e,t){if(!t||"index"in e)return e;if("edge"in e)switch(e.edge){case"left":return{edge:"right"};case"right":return{edge:"left"};default:return e}switch(e.region){case"left":return{...e,region:"right"};case"right":return{...e,region:"left"};default:return e}}function Ps({clientX:e,clientY:t,isExternal:n=!1,model:o,rootElement:s,source:i,tabsetElements:r}){const a=s.getRootNode(),l=(si(a)?a:s.ownerDocument).elementFromPoint(e,t);if(!l||!s.contains(l))return;const c=Ce(o),u=jc({clientX:e,clientY:t,element:l,isExternal:n,model:o,rootElement:s,source:i});if(u)return{edge:u};let d=l.closest("[data-tabset-id]");for(;d&&d.closest("[data-workspace]")!==s;)d=d.parentElement?.closest("[data-tabset-id]")??null;const h=d?.dataset.tabsetId,m=h!==void 0?c.tabsetsById.get(h):void 0;if(!d||!m||o.maximizedTabsetId!==void 0&&o.maximizedTabsetId!==m.id&&!c.floatingTabsetIds.has(m.id))return;const p=r?.get(m.id),{tabList:g,tabPanels:y}=p?.tabset===d?{tabList:p.tabList,tabPanels:p.panels}:{tabList:oo(d,"[data-tab-list]"),tabPanels:oo(d,"[data-tab-panels]")},b=(m.tabs.length>0||!!m.keepWhenEmpty)&&!c.floatingTabsetIds.has(m.id);if(i.type==="tabset")return Gc({clientX:e,clientY:t,element:l,isExternal:n,isMoveOnly:!n&&!!c.tabsetsById.get(i.tabsetId)?.keepWhenEmpty,isSplittable:b,sourceTabsetId:i.tabsetId,tabList:g,tabPanels:y,tabsetId:m.id});if(g?.contains(l))return{index:_i(g,e,t),tabsetId:m.id};if(y?.contains(l)){const w=!n&&m.tabs.some(({id:k})=>k===i.tabId),C=b&&(!!m.keepWhenEmpty||!(m.tabs.length===1&&w))?Wi(y.getBoundingClientRect(),e,t):"center";return C==="center"&&w?void 0:{region:C,tabsetId:m.id}}}function jc({clientX:e,clientY:t,element:n,isExternal:o,model:s,rootElement:i,source:r}){if(s.maximizedTabsetId!==void 0||s.root.type!=="split"||Bc(n,i))return;const a=Fc(i),l=a?Nc({clientX:e,clientY:t,element:n,layoutElement:a,rootElement:i}):void 0;if(!l||o)return l;const c=bt({edge:l},Ue(i)),u="edge"in c?c.edge:l,d=Ce(s),h=r.type==="tabset"?d.tabsetsById.get(r.tabsetId):d.tabsetsByTabId.get(r.tabId);if(!(h&&(r.type==="tabset"||h.tabs.length===1&&!h.keepWhenEmpty)&&Ro(s.root,h,u)))return l}function Bc(e,t){let n=e.closest("[data-floating-tabset]");for(;n;){if(n.closest("[data-workspace]")===t)return!0;n=n.parentElement?.closest("[data-floating-tabset]")??null}return!1}function Fc(e){return Array.from(e.children).find(t=>t.hasAttribute("data-workspace-layout"))}function Gc({clientX:e,clientY:t,element:n,isExternal:o,isMoveOnly:s,isSplittable:i,sourceTabsetId:r,tabList:a,tabPanels:l,tabsetId:c}){if(!(!o&&c===r)){if(a?.contains(n))return s?void 0:{index:_i(a,e,t),tabsetId:c};if(l?.contains(n)){const u=i?Wi(l.getBoundingClientRect(),e,t):"center";return u==="center"&&s?void 0:{region:u,tabsetId:c}}}}const Wc="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Os=new WeakMap;function As(e){let t=Os.get(e);return t||(t=e.createElement("img"),t.src=Wc,Os.set(e,t)),t}const Ns=250,_c=20;function Hc(e,t){const{isDropped:n,lastDragover:o,lastMoveStep:s,lastRemoteDragoverTime:i}=e;if(n||!o||t-o.time<Ns||t-i<Ns)return!1;const{clientX:r,clientY:a,view:l}=o;return Math.min(r,a,l.innerWidth-r,l.innerHeight-a)<=Math.max(s*2,_c)}function Vc(e,t,n){return e?t<0||n<0||t>=e.innerWidth||n>=e.innerHeight:!1}const qc=5,Hi="application/x-react-resizable-panels-workspace",$s=e=>`${Hi};id=${e}`;function Uc({canTearOff:e,disableDragBetweenApps:t,dragGroup:n,dragStore:o,getDragNode:s,getModel:i,getRootElement:r,isDropDisabled:a,isExternalDropDisabled:l,onDrop:c,onTearOff:u,onTransferIn:d,onTransferOut:h,rootElement:m,tabsetElements:p}){const[g,y]=f.useState(),b=f.useCallback(H=>{y(H),o.setDragSource(H)},[o]),w=o.setDropTarget,[S,C]=f.useState(!1),[k,E]=f.useState(!1),[_,Y]=f.useState(),[P,T]=f.useState(!1),[R]=f.useState(()=>({})),D=f.useRef(null),q=f.useRef({clientX:0,clientY:0}),N=f.useRef(null);f.useEffect(()=>()=>N.current?.(),[]);const $=f.useCallback((H,G,oe)=>{const ne=G.ownerDocument,se=G.getAttribute("draggable");G.draggable=!0;let Q=null;const re=()=>{N.current===A&&(N.current=null),G.removeEventListener("dragstart",U),G.removeEventListener("dragend",M),ne.removeEventListener("pointerup",x),ne.removeEventListener("pointercancel",x),se===null?G.removeAttribute("draggable"):G.setAttribute("draggable",se)},L=O=>{const F=O.target;return F===G||!!F&&G.contains(F)&&F.getAttribute?.("draggable")!=="true"},U=O=>{if(!L(O)){re();return}ne.removeEventListener("pointerup",x),ne.removeEventListener("pointercancel",x);const F=s(H),{dataTransfer:X}=O;if(!F||!X){O.preventDefault(),re();return}X.effectAllowed="move";const K=_t();X.setData(Hi,""),X.setData($s(K),""),X.setDragImage(As(ne),0,0),Q={dragGroup:oe,hasSource:()=>s(H)!==void 0,id:K,isDropped:!1,isRemote:!1,isShared:!1,lastDocument:ne,lastDragover:void 0,lastMoveStep:0,lastRemoteDragoverTime:0,node:F,previewOwners:new Map([[ne,R]]),removeFromSource:()=>h(H),source:H,sourceOwner:R},q.current={clientX:O.clientX,clientY:O.clientY},b(H),E(!0),Y(F),t||Pc(Q),qe(Q)},M=O=>{if(!L(O))return;const F=Q;if(re(),!(!F||cn()!==F)&&(qe(null),e(H)&&Hc(F,Date.now()))){const{lastDragover:X}=F,K=O.screenX===0&&O.screenY===0;u(H,K&&X?{screenX:X.view.screenX+X.clientX,screenY:X.view.screenY+X.clientY}:{screenX:O.screenX,screenY:O.screenY})}},x=()=>re(),A=()=>{re(),Q&&cn()===Q&&qe(null)};N.current=A,G.addEventListener("dragstart",U),G.addEventListener("dragend",M),ne.addEventListener("pointerup",x),ne.addEventListener("pointercancel",x)},[e,t,s,u,h,R,b]);f.useEffect(()=>{if(n===void 0||!m)return;const H=m.ownerDocument,G=H.defaultView;As(H);const oe=t?void 0:kc(),ne=M=>{const x=cn();return x?.dragGroup!==n||x.isRemote&&(t||!Array.from(M.dataTransfer?.types??[]).includes($s(x.id)))?null:x.hasSource()?x:(qe(null),null)};let se=null;const Q=(M,x)=>{const A=M.composedPath()[0];if(typeof A?.closest!="function"||A.closest("[data-workspace]")!==m)return;const O=i(),F=Ps({clientX:M.clientX,clientY:M.clientY,model:O,isExternal:x.sourceOwner!==R,rootElement:m,source:x.source,tabsetElements:p});if(F)return(se?.drag!==x||se.model!==O||!Zn(se.target,F))&&(se={drag:x,isDisabled:x.sourceOwner===R?a(x.source,F):l(x.node,F),model:O,target:F}),se.isDisabled?void 0:se.target},re=M=>{const x=ne(M);if(!x)return;const{clientX:A,clientY:O}=M,F=x.lastDragover;G&&(F?.view!==G||F.clientX!==A||F.clientY!==O)?(F?.view===G&&(x.lastMoveStep=Math.hypot(A-F.clientX,O-F.clientY)),x.lastDragover={clientX:A,clientY:O,time:Date.now(),view:G}):F&&(F.time=Date.now()),Bi(x,H),Oc(x),T(!0),x.previewOwners.has(H)||x.previewOwners.set(H,R),x.previewOwners.get(H)===R&&(q.current={clientX:A,clientY:O},ro(D.current,q.current),Y(x.node));const X=Q(M,x);X&&(M.preventDefault(),M.dataTransfer&&(M.dataTransfer.dropEffect="move")),w(X)},L=M=>{const x=ne(M),A=x?Q(M,x):void 0;!x||!A||(M.preventDefault(),x.isDropped=!0,qe(null),x.sourceOwner===R?c(x.source,A):d(x.node,A)&&x.removeFromSource())},U=Fi(M=>{M?.dragGroup!==n?(b(void 0),w(void 0),T(!1),E(!1),Y(void 0)):M.lastDocument!==H&&(w(void 0),T(!1),Y(void 0))});return H.addEventListener("dragenter",re),H.addEventListener("dragover",re),H.addEventListener("drop",L),()=>{oe?.(),U(),H.removeEventListener("dragenter",re),H.removeEventListener("dragover",re),H.removeEventListener("drop",L)}},[t,n,i,a,l,c,d,R,m,b,w,p]);const V=f.useCallback((H,G)=>{const oe=r();if(!oe)return;const ne=Ee();if(ne.state==="active"&&Bt(ne,G.currentTarget.ownerDocument,G))return;if(N.current?.(),n!==void 0&&G.pointerType!=="touch"&&G.pointerType!=="pen"){$(H,G.currentTarget,n);return}const se=G.currentTarget,Q=se.ownerDocument,{clientX:re,clientY:L,pointerId:U}=G;se.setPointerCapture?.(U);let M=!1,x=!1,A,O;const F={cursor:Q.documentElement.style.cursor,sourceCursor:se.style.cursor,userSelect:Q.body.style.userSelect},X=ue=>{Q.documentElement.style.cursor=ue??F.cursor,se.style.cursor=ue??F.sourceCursor},K=ue=>{if(ue.pointerId!==U)return;const{clientX:Se,clientY:fe}=ue;if(!M){if(Math.hypot(Se-re,fe-L)<qc)return;M=!0,Q.body.style.userSelect="none",b(H)}q.current={clientX:Se,clientY:fe},ro(D.current,q.current);const Ae=Vc(ye,Se,fe),Le=Ae&&e(H);x!==Le&&(x=Le,C(Le));const Me=Ae?void 0:Ps({clientX:Se,clientY:fe,model:i(),rootElement:oe,source:H,tabsetElements:p});if(!Zn(O,Me)){O=Me;const le=Me!==void 0&&a(H,Me);A=le?void 0:Me,X(le?"not-allowed":void 0),w(A)}},Z=(ue,{isPointerDown:Se=!1,screenPoint:fe}={})=>{if(N.current=null,Q.removeEventListener("pointermove",K),Q.removeEventListener("pointerup",J),Q.removeEventListener("pointercancel",te),Q.removeEventListener("keydown",ze,!0),ye?.removeEventListener("blur",ke),M){if(Q.body.style.userSelect=F.userSelect,X(void 0),b(void 0),w(void 0),C(!1),Se){const Ae=Le=>{Le.pointerId===U&&(Q.removeEventListener("pointerup",Ae),Q.removeEventListener("pointercancel",Ae),un(Q))};Q.addEventListener("pointerup",Ae),Q.addEventListener("pointercancel",Ae)}else un(Q);ue&&(x&&fe?u(H,fe):A&&c(H,A))}},J=ue=>{if(ue.pointerId===U){const{screenX:Se,screenY:fe}=ue;Z(!0,{screenPoint:{screenX:Se,screenY:fe}})}},te=ue=>{ue.pointerId===U&&Z(!1)},ze=ue=>{ue.key==="Escape"&&(M&&(ue.preventDefault(),ue.stopPropagation()),Z(!1,{isPointerDown:!0}))},ye=Q.defaultView,ke=()=>Z(!1);N.current=()=>Z(!1),Q.addEventListener("pointermove",K),Q.addEventListener("pointerup",J),Q.addEventListener("pointercancel",te),Q.addEventListener("keydown",ze,!0),ye?.addEventListener("blur",ke)},[e,n,i,r,a,c,u,b,w,$,p]),B=f.useCallback((H,G)=>V({tabId:H,type:"tab"},G),[V]),I=f.useCallback((H,G)=>V({tabsetId:H,type:"tabset"},G),[V]);return{dragSource:g,isNativeDragOver:P,isNativeDragSource:k,isTearOff:S,nativePreviewNode:_,previewElementRef:D,previewPointRef:q,startTabDrag:B,startTabsetDrag:I}}const nn=24;function js(e,t,n={}){let o={height:zi,width:wi,x:nn,y:nn};if(e){const s=e.offsetWidth,i=e.offsetHeight;if(t){const l=he(e,"horizontal"),c=he(e,"vertical"),u=e.getBoundingClientRect(),d=t.getBoundingClientRect();if(d.width>0&&d.height>0){const h=t.hasAttribute("data-tabset-collapsed");o={height:h?o.height:d.height/c,width:h?o.width:d.width/l,x:(d.left-u.left)/l+nn,y:(d.top-u.top)/c+nn}}}const r=n.width??Math.min(o.width,s||o.width),a=n.height??Math.min(o.height,i||o.height);s>0&&i>0&&(o={height:a,width:r,x:Math.max(0,Math.min(o.x,s-r)),y:Math.max(0,Math.min(o.y,i-a))})}return{...o,...Yc(n)}}function Yc(e){const t={};for(const n of["height","width","x","y"])typeof e[n]=="number"&&(t[n]=e[n]);return t}function Xc(e,t){const n=e.floating,o=n?.findIndex(({id:s})=>s===t)??-1;return!n||o<0||o===n.length-1?e:{...e,floating:[...n.slice(0,o),...n.slice(o+1),n[o]]}}const Vi=f.createContext({isOverflowing:!1,orientation:"horizontal"});function Nt(e,t){const n=()=>t(e.getState());return f.useSyncExternalStore(e.subscribe,n,n)}const Kc='button, [role="button"], [data-tab-ignore]';function qn(e){const t=e.target.closest?.(Kc);return!!t&&t!==e.currentTarget&&e.currentTarget.contains(t)}function Jc({tab:e}){const{classNames:t,disabled:n,dragStore:o,getTabHandle:s,getTabHost:i,modelIndex:r,renderTab:a,requestFocus:l,startTabDrag:c,styles:u,takeFocusRequest:d,updateModel:h}=Ze("Tab"),{isCollapsed:m,tabPlacement:p,tabset:g}=Pn("Tab"),{isOverflowing:y,orientation:b}=f.useContext(Vi),w=f.useRef(null),S=f.useCallback(I=>{w.current=I},[]),C=r.tabsetsByTabId.get(e.id)??g,k=C.tabs.findIndex(({id:I})=>I===e.id),E=C.tabs[k]??e,_=C.selectedId===E.id,Y=n||!!E.disableClose,P=n||!!E.disableDrag;let T=u?.tab?.touchAction;P||(y?T=b==="horizontal"?"pan-x":"pan-y":T="none");const R=Nt(o,({dropTarget:I})=>{if(!(I===void 0||!("index"in I)||I.tabsetId!==C.id)){if(I.index===k)return"before";if(I.index===C.tabs.length&&k===C.tabs.length-1)return"after"}}),D=Nt(o,({dragSource:I})=>I?.type==="tab"&&I.tabId===E.id);ce(()=>{d(E.id)&&w.current?.focus()}),ce(()=>{const I=w.current;I?!P&&"touchAction"in I.style&&I.style.touchAction!==T&&process.env.NODE_ENV!=="production"&&Oe("The element returned by renderTab replaced props.style (rather than merging it, e.g. style={{ ...props.style, padding: 4 }}); tabs can't be dragged by touch without its touch-action"):process.env.NODE_ENV!=="production"&&Oe("The element returned by renderTab must receive its props (including ref); otherwise tabs can't be selected, dragged, or focused")},[P,T]);const{panelId:q,tabElementId:N}=i(E.id),$=()=>m&&C.collapsed?h("expand",!0,I=>Mn(mn(I,E.id),C.id)):h("select",!0,I=>mn(I,E.id)),V=I=>{if(I.target!==I.currentTarget)return;const H=I.currentTarget.closest("[data-tab-list]"),G=H?Array.from(H.querySelectorAll("[data-tab]")).filter(re=>re.closest("[data-tab-list]")===H):[],oe=G.indexOf(I.currentTarget),ne=re=>{I.preventDefault(),G[(re+G.length)%G.length]?.focus()};let[se,Q]=b==="horizontal"?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"];switch(b==="horizontal"&&Ue(H)&&([se,Q]=[Q,se]),I.key){case se:{ne(oe-1);break}case Q:{ne(oe+1);break}case"Home":{ne(0);break}case"End":{ne(G.length-1);break}case"Enter":case" ":{I.preventDefault(),$();break}case"Backspace":case"Delete":{if(!Y){I.preventDefault();const re=_?Ci(C,E.id):(C.tabs[k+1]??C.tabs[k-1])?.id;re!==void 0&&l(re),h("close",!0,L=>Lt(L,E.id))}break}}},B={"aria-controls":q,"aria-selected":_,className:t?.tab,"data-drop-after":R==="after"||void 0,"data-drop-before":R==="before"||void 0,"data-tab":"","data-tab-dragging":D||void 0,"data-tab-id":E.id,"data-tab-placement":p,"data-tabset-collapsed":m||void 0,"data-tab-selected":_||void 0,id:N,onClick:I=>{qn(I)||$()},onKeyDown:I=>{qn(I)||V(I)},onPointerDown:I=>{I.button===0&&!P&&!qn(I)&&c(E.id,I)},ref:S,role:"tab",style:{...u?.tab,touchAction:T,WebkitTouchCallout:"none"},tabIndex:_?0:-1};return W.jsx(zt.Provider,{value:s(E.id),children:a?a(E,B):W.jsxs("div",{...B,children:[E.title??E.id,W.jsx(Ii,{})]})})}const Zc=Object.assign(Jc,{displayName:"Workspace.Tab"});function qi(e){const t=[];for(const n of e.children){if(!Pe(n))continue;const o=n.ownerDocument.defaultView?.getComputedStyle(n);o?.display==="contents"?t.push(...qi(n)):n.offsetParent!==null&&o?.position!=="absolute"&&o?.position!=="fixed"&&t.push(n)}return t}function Qc(e){const t=e.dataset.orientation==="vertical",n=e.parentElement,o=he(n&&Pe(n)?n:e,t?"vertical":"horizontal"),s=Array.from(e.children).filter(a=>Pe(a)&&a.offsetParent!==null),i=Bs(e,s,t,o);let r=0;if(n){const a=e.getBoundingClientRect(),[l,c]=t?[a.left,a.right]:[a.top,a.bottom],u=qi(n).filter(d=>{if(d===e)return!0;const h=d.getBoundingClientRect(),[m,p]=t?[h.left,h.right]:[h.top,h.bottom];return c>l?m<c&&p>l:m<=l&&p>=l});r=Math.max(0,-Bs(n,u,t,o))}return Math.round(i-r)}function Bs(e,t,n,o){const s=p=>p.ownerDocument.defaultView?.getComputedStyle(p),i=(p,g)=>parseFloat(p?.getPropertyValue(g)??"")||0,[r,a]=n?["top","bottom"]:["left","right"],l=s(e),c=e.getBoundingClientRect(),u=(n?c.height:c.width)/o-i(l,`border-${r}-width`)-i(l,`border-${a}-width`)-i(l,`padding-${r}`)-i(l,`padding-${a}`);let d,h;for(const p of t){const g=p.getBoundingClientRect(),y=n?g.top:g.left,b=n?g.bottom:g.right;(!d||y<d.position)&&(d={element:p,position:y}),(!h||b>h.position)&&(h={element:p,position:b})}if(!d||!h)return u;const m=i(s(d.element),`margin-${r}`)+i(s(h.element),`margin-${a}`);return u-m-(h.position-d.position)/o}function el({children:e}){const{classNames:t,disabled:n,dragGroup:o,model:s,styles:i,tabListFreeSpaceStore:r}=Ze("TabList"),{isCollapsed:a,setTabListElement:l,tabPlacement:c,tabset:u}=Pn("TabList"),d=c==="left"||c==="right"?"vertical":"horizontal",h=f.useRef(null),m=Ke(h,l),[p,g]=f.useState(!1),y=u.id;ce(()=>{const S=h.current;if(!S)return;const C=()=>{const T=S.dataset.orientation==="vertical",R=Math.abs(T?S.scrollTop:S.scrollLeft),D=T?S.scrollHeight-S.offsetHeight:S.scrollWidth-S.offsetWidth;S.toggleAttribute("data-overflow-start",R>1),S.toggleAttribute("data-overflow-end",D-R>1),g(D>1)};let k;const E=()=>{C();const T=Qc(S);T!==k&&(k=T,S.style.setProperty("--tab-list-free-space",`${T}px`)),r.set(y,T)};let _=null,Y=null;C();let P=!1;return queueMicrotask(()=>{const T=S.ownerDocument.defaultView;if(P||!T)return;const R=S.parentElement,D=N=>{if(T.getComputedStyle(N).display==="contents"){Y?.observe(N,{childList:!0});for(const $ of N.children)Pe($)&&D($)}else _?.observe(N)},q=N=>{_?.unobserve(N);for(const $ of N.children)Pe($)&&q($)};_=T.ResizeObserver?new T.ResizeObserver(E):null,Y=T.MutationObserver?new T.MutationObserver(N=>{for(const $ of N){for(const V of $.addedNodes)if(Pe(V))$.target===S?_?.observe(V):D(V);else continue;for(const V of $.removedNodes)Pe(V)&&q(V)}E()}):null,_?.observe(S);for(const N of S.children)_?.observe(N);if(Y?.observe(S,{childList:!0}),R){_?.observe(R);for(const N of R.children)Pe(N)&&N!==S&&D(N);Y?.observe(R,{childList:!0})}E()}),S.addEventListener("scroll",C,{passive:!0}),()=>{P=!0,_?.disconnect(),Y?.disconnect(),S.removeEventListener("scroll",C)}},[d,r,y]),ce(()=>r.retain(y),[r,y]);let b=i?.tabList?.touchAction;To(s,u,n,o)||(p?b=d==="horizontal"?"pan-x":"pan-y":b="none");const w=f.useMemo(()=>({isOverflowing:p,orientation:d}),[p,d]);return W.jsx(Vi.Provider,{value:w,children:W.jsx("div",{"aria-orientation":d,className:t?.tabList,"data-orientation":d,"data-tab-list":!0,"data-tab-placement":c,"data-tabset-collapsed":a||void 0,ref:m,role:"tablist",style:{...i?.tabList,touchAction:b},children:e})})}const tl=Object.assign(el,{displayName:"Workspace.TabList"});function nl(){const{classNames:e,getHiddenTabBehavior:t,getTabHost:n,isHydrating:o,renderEmptyTabset:s,renderTabContent:i,shouldServerRenderTabContent:r,styles:a}=Ze("TabPanels"),{isCollapsed:l,setPanelsElement:c,tabPlacement:u,tabset:d}=Pn("TabPanels"),h=f.useRef(null),m=Ke(h,c);ce(()=>{const y=h.current;if(y&&!o)for(const b of d.tabs){const{element:w}=n(b.id);w&&(w.parentElement!==y&&y.appendChild(w),w.style.display=b.id===d.selectedId?"contents":"none")}});const p=d.tabs.find(({id:y})=>y===d.selectedId),g=o&&p&&r(p)?p:void 0;return W.jsxs("div",{className:e?.tabPanels,"data-tab-panels":!0,"data-tab-placement":u,"data-tabset-collapsed":l||void 0,ref:m,style:{position:"relative",...a?.tabPanels,...l&&{display:"none"}},children:[d.tabs.length===0&&s?.(d),g&&W.jsx("div",{style:{display:"contents"},children:W.jsx(Ai,{hiddenTabBehavior:t(g),renderTabContent:i,tab:g})})]})}const Fs=Object.assign(nl,{displayName:"Workspace.TabPanels"});function Ui(e,t){return t===e||t.hasAttribute("data-tab-list")&&t.closest("[data-tabset-header]")===e}function ol(e,t){const n=Array.from(e.querySelectorAll("[data-tabset-drag-handle]")).filter(o=>o.closest("[data-tabset-header]")===e);return n.length>0?n.some(o=>o.contains(t)):Ui(e,t)}function sl(){const{activeTabsetId:e,classNames:t,disabled:n,dragGroup:o,dragStore:s,model:i,modelIndex:r,renderTabsetToolbar:a,setActiveTabsetId:l,startFloatingGesture:c,startTabsetDrag:u,styles:d,updateModel:h}=Ze("TabsetView"),{isCollapsed:m,setHeaderElement:p,setTabsetElement:g,tabPlacement:y,tabset:b}=Pn("TabsetView"),w=Nt(s,({dragSource:E})=>E?.type==="tabset"&&E.tabsetId===b.id),S=r.floatingTabsetIds.has(b.id),C=To(i,b,n,o),k=W.jsxs("div",{className:t?.header,"data-tab-placement":y,"data-tabset-collapsed":m||void 0,"data-tabset-header":!0,onClick:E=>{m&&Ui(E.currentTarget,E.target)&&h("expand",!0,_=>Mn(_,b.id))},onPointerDown:E=>{E.button===0&&!C&&ol(E.currentTarget,E.target)&&(S?c(b.id,"move",E):u(b.id,E))},ref:p,style:d?.header,children:[W.jsx(tl,{children:b.tabs.map(E=>W.jsx(Zc,{tab:E},E.id))}),a&&W.jsx("div",{className:t?.toolbar,"data-tab-placement":y,"data-tabset-collapsed":m||void 0,"data-tabset-toolbar":!0,style:d?.toolbar,children:a(b)})]});return W.jsx("div",{className:t?.tabset,"data-tab-placement":y,"data-tabset":!0,"data-tabset-active":e===b.id||void 0,"data-tabset-collapsed":m||void 0,"data-tabset-dragging":w||void 0,"data-tabset-floating":S||void 0,"data-tabset-id":b.id,"data-tabset-maximized":i.maximizedTabsetId===b.id||void 0,onFocusCapture:()=>l(b.id),onPointerDownCapture:()=>l(b.id),ref:g,style:d?.tabset,children:y==="bottom"||y==="right"?W.jsxs(W.Fragment,{children:[W.jsx(Fs,{}),k]}):W.jsxs(W.Fragment,{children:[k,W.jsx(Fs,{})]})})}const il=Object.assign(sl,{displayName:"Workspace.TabsetView"});function rl(e,t){const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{height:Math.max(0,Math.round((n.height-o.height)/he(e,"vertical"))),width:Math.max(0,Math.round((n.width-o.width)/he(e,"horizontal")))}}function al(e,t,n){const o=t.dataset.tabPlacement==="left"||t.dataset.tabPlacement==="right",s=o?"width":"height",i=t.style,r=i.flex,a=i[s];i.flex="none",i[s]="max-content";const l=t.getBoundingClientRect();i.flex=r,i[s]=a;const c=o?l.width/he(t,"horizontal"):l.height/he(t,"vertical"),u=e.ownerDocument.defaultView?.getComputedStyle(e),d=n==="horizontal"?["left","right"]:["top","bottom"];let h=0;for(const m of d)h+=(parseFloat(u?.getPropertyValue(`padding-${m}`)??"")||0)+(parseFloat(u?.getPropertyValue(`border-${m}-width`)??"")||0);return Math.round(c+h)}function cl({isMaximizedOverlay:e=!1,tabset:t}){const{collapseOverrides:n,collapsePreview:o,getTabsetHandle:s,model:i,modelIndex:r,outerParents:a,reportChromeSize:l,reportCollapsedSize:c,tabPlacement:u,tabsetElements:d}=Ze("TabsetSlot"),h=r.parentsById.get(t.id),m=h?.orientation,p=!e&&hn(t,n),g=o[t.id]!==void 0;let y=t.tabPlacement??u;if(p&&h){const N=h.children[h.children.length-1]?.id===t.id,$=y==="left"||y==="right";m==="horizontal"&&!$?y=N?"right":"left":m==="vertical"&&$&&(y=N?"bottom":"top")}const[b,w]=f.useState(null),[S,C]=f.useState(null),[k,E]=f.useState(null),[_]=f.useState(()=>({panels:null,tabList:null,tabset:null})),Y=f.useCallback(N=>{_.tabset=N,w(N)},[_]),P=f.useCallback(N=>{_.panels=N,E(N)},[_]),T=f.useCallback(N=>{_.tabList=N},[_]);ce(()=>d.register(t.id,_),[_,t.id,d]);const R=t.collapsible&&!e?m:void 0,D=f.useRef(null);ce(()=>{if(!b||!k)return;const N=()=>{if(!g){if(!p){const V=k.getBoundingClientRect();(m==="horizontal"?V.width<=0:m==="vertical"?V.height<=0:V.width<=0||V.height<=0)||l(t.id,rl(b,k))}if(S&&R){const V=al(b,S,R),B=D.current;p?(D.current={orientation:R,size:V},c(t.id,V)):B?.orientation!==R&&c(t.id,V)}}};N();const $=b.ownerDocument.defaultView?.ResizeObserver;if($){const V=new $(N);return V.observe(b),V.observe(k),S&&V.observe(S),()=>{V.disconnect()}}},[R,S,p,g,m,k,l,c,y,t.id,b]);const q=f.useMemo(()=>({isCollapsed:p,setHeaderElement:C,setPanelsElement:P,setTabListElement:T,setTabsetElement:Y,tabPlacement:y,tabset:t}),[p,P,T,Y,y,t]);return!e&&i.maximizedTabsetId===t.id?null:W.jsx(zn.Provider,{value:a.grid,children:W.jsx(In.Provider,{value:a.group,children:W.jsx(Rn.Provider,{value:a.panel,children:W.jsx(zt.Provider,{value:null,children:W.jsx(Je.Provider,{value:s(t.id),children:W.jsx(Oi.Provider,{value:q,children:W.jsx(il,{})})})})})})})}const Mo=Object.assign(cl,{displayName:"Workspace.TabsetSlot"}),Gs=["top","right","bottom","left","top-left","top-right","bottom-right","bottom-left"],Un=8,Ws=12;function ll({floating:e,layoutElementRef:t}){const[n,o]=f.useState(null);ce(()=>{const a=t.current;if(!a)return;const l=()=>o(u=>{const d={height:a.offsetHeight,left:a.offsetLeft,top:a.offsetTop,width:a.offsetWidth};return u&&u.height===d.height&&u.left===d.left&&u.top===d.top&&u.width===d.width?u:d});l();const c=a.ownerDocument.defaultView?.ResizeObserver;if(c){const u=new c(l);return u.observe(a),a.parentElement&&u.observe(a.parentElement),()=>{u.disconnect()}}},[t]);const s=f.useRef([]),i=e.map(({id:a})=>a),r=[...s.current.filter(a=>i.includes(a)),...i.filter(a=>!s.current.includes(a))];return s.current=r,W.jsx("div",{"data-workspace-floating":!0,style:{overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:1,...n?{height:n.height,left:n.left,top:n.top,width:n.width}:{inset:0}},children:r.map(a=>{const l=i.indexOf(a);return W.jsx(ul,{layoutBox:n,stackIndex:l,tabset:e[l]},a)})})}function ul({layoutBox:e,stackIndex:t,tabset:n}){const{classNames:o,disabled:s,startFloatingGesture:i,styles:r,tabPlacement:a,updateModel:l}=Ze("FloatingTabset"),c=s||!!n.disableDrag,u=!!n.collapsed,d=n.tabPlacement??a,h=d==="left"||d==="right",m=u?Gs.filter(w=>h?w==="top"||w==="bottom":w==="left"||w==="right"):Gs,p=f.useRef(null),g=e?.width,y=e?.height;ce(()=>{const w=p.current;if(!w||g===void 0||y===void 0||w.hasAttribute(so))return;const S=$i(w);if(!S)return;const{x:C,y:k}=Ni({x:n.x,y:n.y},S,{height:y,width:g});w.style.left=`${C}px`,w.style.top=`${k}px`});const b=n.id;return f.useEffect(()=>{const w=p.current;if(!w)return;const S=()=>l("raise",!0,C=>Xc(C,b));return w.addEventListener("pointerdown",S,!0),()=>{w.removeEventListener("pointerdown",S,!0)}},[b,l]),W.jsxs("div",{className:o?.floatingTabset,"data-floating-tabset":n.id,"data-tabset-collapsed":u||void 0,ref:p,style:{...r?.floatingTabset,height:u&&!h?"auto":n.height,left:n.x,pointerEvents:"auto",position:"absolute",top:n.y,width:u&&h?"auto":n.width,zIndex:t+1},children:[W.jsx(Mo,{tabset:n}),!c&&m.map(w=>W.jsx("div",{className:o?.floatingResizeHandle,"data-floating-resize-handle":w,onPointerDown:S=>{S.button===0&&i(n.id,w,S)},style:{...r?.floatingResizeHandle,...dl(w)}},w))]})}function dl(e){const t=-Un/2,n={cursor:ji[e],position:"absolute",touchAction:"none"};return e.includes("-")?{...n,height:Ws,width:Ws,zIndex:1,[e.startsWith("top")?"top":"bottom"]:t,[e.endsWith("left")?"left":"right"]:t}:e==="top"||e==="bottom"?{...n,[e]:t,height:Un,left:0,right:0}:{...n,[e]:t,bottom:0,top:0,width:Un}}const fl=Object.assign(ll,{displayName:"Workspace.FloatingTabsets"});function ao(e,t){if(e.type==="split"){if(e.id===t)return e;for(const n of e.children){const o=ao(n,t);if(o)return o}}}function pl(e,t,n,o,s){const i=ao(e.root,t);if(!i||i.children.length!==Object.keys(n).length||i.children.some(({id:c})=>n[c]===void 0))return e;const r=De(e),a=ao(r.root,t);if(!a)return e;let l=!1;for(const c of a.children){if(s?.has(c.id))continue;const u=c.type==="tabset"&&(o?o.has(c.id):!!c.collapsed);c.type==="tabset"&&u!==!!c.collapsed&&(l=!0,u?c.collapsed=!0:delete c.collapsed),u||(c.size=n[c.id]??c.size)}return l||(s?.size??0)>0||a.children.some(c=>c.type==="tabset"&&c.collapsed)?Re(r):r}function _s(e,t,n){const o=ri(e.map(l=>{const c=n[l.itemId];return typeof c=="number"?{...l,defaultSize:c}:l}));let s=0;const i=[];for(const l of e)t.has(l.itemId)?s+=l.collapsedSize:i.push(l);const r=hl(i.map(({itemId:l,maxSize:c,minSize:u})=>({maxSize:c,minSize:u,weight:o[l]})),Math.max(0,100-s)),a={};for(const{collapsedSize:l,itemId:c}of e)a[c]=be(t.has(c)?l:r[i.findIndex(u=>u.itemId===c)]);return a}function hl(e,t){const n=(r,a)=>{const l=r.reduce((c,u)=>c+u,0);return r.map(c=>l>0?c/l*a:a/r.length)},o=new Map;for(;o.size<e.length;){const r=e.map((h,m)=>({...h,index:m})).filter(({index:h})=>!o.has(h)),a=t-Array.from(o.values()).reduce((h,m)=>h+m,0),l=n(r.map(({weight:h})=>h),a);let c=0;const u=[];if(r.forEach(({index:h,maxSize:m,minSize:p},g)=>{const y=l[g],b=Math.min(m,Math.max(p,y));b!==y&&(c+=b-y,u.push({index:h,isMinimum:b>y,size:b}))}),u.length===0){r.forEach(({index:h},m)=>o.set(h,l[m]));break}let d=0;for(const{index:h,isMinimum:m,size:p}of u)(c===0||c>0===m)&&(o.set(h,p),d++);if(d===0)for(const{index:h,size:m}of u)o.set(h,m)}const s=e.map((r,a)=>o.get(a)),i=s.reduce((r,a)=>r+a,0);return Math.abs(i-t)>.001?n(e.map(({weight:r})=>r),t):s}function ml(e,t){let n=!1;for(const o of e){if(o.type!=="tabset")continue;const s=t.has(o.id);if(s!==!!o.collapsed){if(!s)return"expand";n=!0}}return n?"collapse":"resize"}function gl({split:e}){const{classNames:t,collapsedSizes:n,collapseToFit:o,disabled:s,id:i,maximumSizes:r,minimumSizes:a,renderSeparator:l,reportCollapsePreview:c,reportCollapseToFit:u,reportSeparatorsSize:d,resizePreviewMode:h,splitGeneration:m,styles:p,updateModel:g}=Ze("SplitView"),y=`${i}-${e.id}`,b=L=>`${i}:${L}`,w=yi(),[S,C]=f.useState(null),k=f.useRef(null),E=f.useCallback(L=>{k.current=L,C(L)},[]),_=()=>{const L=k.current;return L?e.orientation==="horizontal"?L.offsetWidth:L.offsetHeight:0},Y=e.children.map(({id:L})=>L).join(),P=e.children.map(({id:L})=>b(L)).join(),T=new Set(e.children.filter(L=>L.type==="tabset"&&L.collapsed).map(({id:L})=>b(L))),R=e.children.filter(L=>L.type==="tabset"&&L.collapsed).map(({id:L})=>`${L}=${n[L]??0}`).join(),D=`${m}:${e.orientation}:${Y}:${R}`,q=f.useRef(null),[,N]=f.useState(0),$=()=>{const L=Te(y);return!L||L.defaultLayoutDeferred||L.derivedItemConstraints.map(({itemId:U})=>U).join()!==P?null:`${D}|${L.derivedItemConstraints.filter(({itemId:U})=>T.has(U)).map(({collapsedSize:U})=>U).join()}`},V=()=>{const L={};for(const U of e.children)L[b(U.id)]=U.size;return L},B=L=>{const U=Te(y)?.derivedItemConstraints??[],M=new Set;for(const{id:x}of e.children){const A=b(x),O=U.find(({itemId:F})=>F===A);O?.collapsible&&L[A]!==void 0&&L[A]<=O.collapsedSize+.01&&M.add(x)}return M},I=(L,U)=>{const M=B(L),x={};for(const A of e.children)if(A.type==="tabset"){const O=M.has(A.id);x[A.id]=U||O!==!!A.collapsed?O:void 0}return x},H=()=>{const L=Ee();return L.state==="active"&&L.hitRegions.some(U=>U.axis.id===y)},G=ge(L=>c(I(L,!0))),oe=L=>{H()||u(I(L,!1))},ne=f.useRef(null),se=f.useRef(null),Q=ge(()=>{const L=$();if(L===null||q.current!==L||H())return;const U=_(),M=se.current;if(se.current=U,M===null||M===U)return;const{derivedItemConstraints:x,layout:A}=Te(y),O=_s(x,T,V()),F=B(A);e.children.some(K=>{const Z=b(K.id);return K.type==="tabset"&&F.has(K.id)!==!!K.collapsed||typeof K.size=="number"&&!de(A[Z],O[Z],.01)})&&w.current?.setLayout(O)}),re=e.children.some(L=>L.type==="tabset"&&L.collapsible);return f.useEffect(()=>St(y,({axis:L,next:U,prev:M})=>{M?.derivedItemConstraints!==U.derivedItemConstraints&&(Q(),re&&N(A=>A+1));const x=Ee();re&&x.state==="active"&&x.hitRegions.some(A=>A.axis===L)&&G(U.layout)}),[Q,y,re,G]),ce(()=>{const L=$();if(L===null||(q.current!==L&&(q.current=L,w.current?.setLayout(_s(Te(y).derivedItemConstraints,T,V())),se.current=_()),H()))return;const{derivedItemConstraints:U}=Te(y),M=ne.current,x=_(),{layout:A}=Te(y);(M?.constraints!==U||M.layout!==A||M.size!==x||M.structureKey!==D)&&(ne.current={constraints:U,layout:A,size:x,structureKey:D},oe(A))}),ce(()=>{const L=S?.ownerDocument.defaultView;if(!S||!L)return;const U=O=>Pe(O)&&O.hasAttribute("data-separator"),M=()=>{let O=0,F=0;const X=L.getComputedStyle(S),K=parseFloat(e.orientation==="horizontal"?X.columnGap:X.rowGap)||0;for(const Z of S.children)if(Pe(Z)&&Z.hasAttribute("data-panel")&&F++,U(Z))if(F++,"offsetWidth"in Z){const{offsetHeight:J,offsetWidth:te}=Z;O+=e.orientation==="horizontal"?te:J}else{const J=Z.getBoundingClientRect();O+=e.orientation==="horizontal"?J.width:J.height}O+=K*Math.max(0,F-1),d(e.id,O)},x=L.ResizeObserver?new L.ResizeObserver(M):null;x?.observe(S);for(const O of S.children)U(O)&&x?.observe(O);const A=L.MutationObserver?new L.MutationObserver(O=>{for(const F of O)F.addedNodes.forEach(X=>{U(X)&&x?.observe(X)}),F.removedNodes.forEach(X=>{U(X)&&x?.unobserve(X)});M()}):null;return A?.observe(S,{childList:!0}),M(),()=>{x?.disconnect(),A?.disconnect()}},[t?.split,S,d,e.id,e.orientation,p?.split]),W.jsx(bi,{className:t?.split,"data-split":"","data-split-id":e.id,disabled:s,elementRef:E,groupRef:w,id:y,onLayoutChanged:(L,{isUserInteraction:U,requestedLayout:M})=>{if(U){const x=M??L,A={};for(const{id:K}of e.children){const Z=x[b(K)];Z!==void 0&&(A[K]=Z)}const O=B(L),F=new Set;for(const K of O)o[K]===!0&&(O.delete(K),F.add(K));const X=ml(e.children,O);g(X,!0,K=>pl(K,e.id,A,O,F))}else{const x=$();x!==null&&q.current===x?oe(L):N(A=>A+1)}},orientation:e.orientation,resizePreviewMode:h,style:p?.split,children:e.children.map((L,U)=>{const M=a.get(L.id),x=e.orientation==="horizontal"?M?.width:M?.height,A=r.get(L.id),O=e.orientation==="horizontal"?A?.width:A?.height;return W.jsxs(f.Fragment,{children:[U>0&&(l?l(e.orientation):W.jsx(Si,{})),W.jsx(vi,{collapsedSize:L.type==="tabset"&&L.collapsible?`${n[L.id]??0}px`:void 0,collapsible:L.type==="tabset"&&(!!L.collapsed||Co(e,L)),defaultSize:typeof L.size=="number"?`${L.size}%`:L.size,id:b(L.id),maxSize:O!==void 0&&Number.isFinite(O)?`${Math.max(O,x??0)}px`:void 0,minSize:x||void 0,children:W.jsx(Yi,{node:L})})]},L.id)})})}const bl=Object.assign(gl,{displayName:"Workspace.SplitView"});function yl({node:e}){return e.type==="split"?W.jsx(bl,{split:e}):W.jsx(Mo,{tabset:e})}const Yi=Object.assign(yl,{displayName:"Workspace.NodeView"});function ft(e,t){const n=Object.keys(e).filter(s=>!t.has(s));if(n.length===0)return e;const o={...e};for(const s of n)delete o[s];return o}function Hs(e,t){let n=e;for(const[o,s]of Object.entries(t))e[o]!==s&&(n===e&&(n={...e}),s===void 0?delete n[o]:n[o]=s);return n}function pt(e,t){if(e===void 0)return;if(typeof e!="string"){process.env.NODE_ENV!=="production"&&Oe(`Workspace tabset sizes (e.g. minWidth or maxWidth) must be strings with units (e.g. "200px"); received ${e}`);return}const[n,o]=ho(e);switch(o){case"%":{process.env.NODE_ENV!=="production"&&Oe(`Workspace tabset sizes (e.g. minWidth or maxWidth) must use absolute units (px, em, rem, vh, or vw); received "${e}". Use "vw" or "vh" for sizes relative to the viewport.`);return}case"px":return n;default:return t?tt({axisSize:0,itemElement:t,styleProp:e}):void 0}}function vl({children:e,className:t,dragType:n,elementRef:o,isTearOff:s,pointRef:i,style:r}){const a=f.useRef(null);return ce(()=>(o.current=a.current,ro(a.current,i.current),()=>{o.current=null}),[o,i]),W.jsx("div",{className:t,"data-drag-preview":!0,"data-drag-type":n,"data-tear-off":s||void 0,ref:a,style:{zIndex:2,...r,left:0,pointerEvents:"none",position:"fixed",top:0},children:e})}const Sl=Object.assign(vl,{displayName:"Workspace.DragPreview"});function xl(e,t,n,o=!1){const s=t==="left"||t==="right"?"horizontal":"vertical",i=bt({edge:t},o),r="edge"in i?i.edge:t;let a,l;if(n?.type==="tab"?(a=eo(e,n.tabId,{edge:r}),l=Xe(a,n.tabId)?.id):n?.type==="tabset"&&(a=to(e,n.tabsetId,{edge:r}),l=n.tabsetId),a!==void 0&&a!==e){const{root:u}=a,d=u.type==="split"&&u.orientation===s?u.children.find(({id:h})=>h===l):void 0;if(typeof d?.size=="number")return d.size/100}const{root:c}=e;return c.type==="split"&&c.orientation===s?1/(c.children.filter(d=>d.type!=="tabset"||!d.collapsed).length+1):.5}function wl(e,t){return e===void 0||t===void 0?e===t:e.bottom===t.bottom&&e.left===t.left&&e.right===t.right&&e.top===t.top}function zl(e,t,n,o=.5){const s=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=he(e,"horizontal"),a=he(e,"vertical");let l=(i.left-s.left)/r,c=(i.top-s.top)/a,u=i.width/r,d=i.height/a;switch(n){case"bottom":{c+=d*(1-o),d*=o;break}case"left":{u*=o;break}case"right":{l+=u*(1-o),u*=o;break}case"top":{d*=o;break}}return{bottom:s.height/a-c-d,left:l,right:s.width/r-l-u,top:c}}function Cl({className:e,dragStore:t,layoutElementRef:n,model:o,style:s,tabsetElements:i}){const r=Nt(t,p=>p.dropTarget),a=Nt(t,p=>p.dragSource),l=f.useRef(null),[c,u]=f.useState(),d=r&&"region"in r?r.region:void 0,h=r&&"tabsetId"in r?r.tabsetId:void 0,m=r&&"edge"in r?r.edge:void 0;return ce(()=>{const p=l.current,g=m?n.current:d&&h?i.get(h)?.panels:void 0,y=m??d;if(!p||!g||!y)return;const b=m?xl(o,m,a,Ue(n.current)):void 0,w=()=>{if(!g.isConnected)return;const C=zl(p,g,y,b);u(k=>wl(k,C)?k:C)};w();const S=p.ownerDocument.defaultView?.ResizeObserver;if(S){const C=new S(w);return C.observe(p),C.observe(g),()=>{C.disconnect()}}},[a,m,n,o,d,i,h]),W.jsx("div",{ref:l,style:{inset:0,pointerEvents:"none",position:"absolute",zIndex:1},children:W.jsx("div",{className:e,"data-drop-indicator":!0,"data-edge":m,"data-region":d,style:{...s,...c,...!d&&!m&&{opacity:0},pointerEvents:"none",position:"absolute"}})})}const Tl=Object.assign(Cl,{displayName:"Workspace.DropIndicator"});function Il({className:e,classNames:t,defaultModel:n,disabled:o=!1,disableDragBetweenApps:s=!1,disableDrop:i,dragGroup:r,elementRef:a,hiddenTabBehavior:l="keep-mounted",id:c,onModelChanged:u,onTearOff:d,renderDragPreview:h,renderEmptyTabset:m,renderSeparator:p,renderTab:g,renderTabContent:y,renderTabsetDragPreview:b,renderTabsetToolbar:w,resizePreviewMode:S,serverRenderTabContent:C=!1,style:k,styles:E,tabPlacement:_="top",tabRemovalSelectionBehavior:Y="adjacent",tabsetMinHeight:P,tabsetMinWidth:T,workspaceRef:R,...D}){const q=st(c),N=f.useContext(zn),$=f.useContext(In),V=f.useContext(Rn),B=f.useMemo(()=>({grid:N,group:$,panel:V}),[N,$,V]),[I,H]=f.useState(()=>Wn(bn(Rs(n)),Y)),G=f.useRef(I),[oe,ne]=f.useState(0),[se,Q]=f.useState(),re=f.useRef(void 0),L=f.useCallback(v=>{re.current!==v&&(re.current=v,Q(v))},[]),U=ge((...v)=>u?.(...v)),M=ge(()=>Y),x=f.useCallback((v,z,j)=>{const ee=M(),me=Wn(G.current,ee),Ge=j(me);if(Ge!==me){const et=Wn(Ge,ee);G.current=et,H(et),U(et,{isUserInteraction:z,reason:v})}},[M,U]),[A]=f.useState(sc),[O]=f.useState(oc),[F]=f.useState(ic),X=f.useRef(null),K=f.useRef(null),Z=f.useMemo(()=>{const v=()=>{const z=re.current;return z!==void 0&&Ce(G.current).tabsetsById.has(z)?z:void 0};return{addTab:(z,j={})=>{const ee=ac(G.current,z,{...j,tabsetId:j.tabsetId??v()});return x(ee.added?"add":"select",!1,()=>ee.model),ee.added},closeTab:z=>x("close",!1,j=>Lt(j,z)),closeTabset:z=>x("close",!1,j=>Gn(j,z)),collapseTabset:z=>x("collapse",!1,j=>Ri(j,z)),expandTabset:z=>x("expand",!1,j=>Mn(j,z)),floatTab:(z,j)=>x("float",!1,ee=>{const me=Ce(ee).tabsetsByTabId.get(z)?.id;return lc(ee,z,js(K.current,me!==void 0?F.get(me)?.tabset:void 0,j))}),floatTabset:(z,j)=>x("float",!1,ee=>uc(ee,z,js(K.current,F.get(z)?.tabset,j))),getActiveTabsetId:v,getModel:()=>G.current,getTabListFreeSpace:z=>A.get(z),maximizeTabset:z=>x("maximize",!1,j=>Li(j,z)),moveTab:(z,j)=>x("move",!1,ee=>eo(ee,z,bt(j,Ue(X.current)))),moveTabset:(z,j)=>x("move",!1,ee=>to(ee,z,bt(j,Ue(X.current)))),restoreTabset:()=>x("restore",!1,Mi),selectTab:z=>x("select",!1,j=>mn(j,z)),setModel:z=>(x("set-model",!1,()=>bn(Rs(z))),ne(j=>j+1),G.current),subscribeToTabListFreeSpace:(z,j)=>A.subscribe(z,j),updateTab:(z,j)=>x("update",!1,ee=>yc(ee,z,j)),updateTabset:(z,j)=>x("update",!1,ee=>Pi(ee,z,j))}},[A,F,x]);f.useImperativeHandle(R,()=>Z,[Z]);const J=f.useMemo(()=>({...Z,id:q}),[Z,q]),[te]=f.useState(()=>({tabs:new Map,tabsets:new Map})),ze=f.useCallback(v=>{let z=te.tabs.get(v);return z||(z={close:()=>Z.closeTab(v),float:j=>Z.floatTab(v,j),getTabsetId:()=>Ce(G.current).tabsetsByTabId.get(v)?.id??"",id:v,isSelected:()=>Ce(G.current).tabsetsByTabId.get(v)?.selectedId===v,select:()=>Z.selectTab(v),workspaceId:q},te.tabs.set(v,z)),z},[Z,te,q]),ye=f.useCallback(v=>{let z=te.tabsets.get(v);return z||(z={addTab:(j,ee={})=>Z.addTab(j,{...ee,tabsetId:v}),close:()=>Z.closeTabset(v),collapse:()=>Z.collapseTabset(v),expand:()=>Z.expandTabset(v),float:j=>Z.floatTabset(v,j),id:v,isCollapsed:()=>!!Ce(G.current).tabsetsById.get(v)?.collapsed,isFloating:()=>Ce(G.current).floatingTabsetIds.has(v),isMaximized:()=>G.current.maximizedTabsetId===v,maximize:()=>Z.maximizeTabset(v),restore:()=>{G.current.maximizedTabsetId===v&&Z.restoreTabset()},workspaceId:q},te.tabsets.set(v,z)),z},[Z,te,q]),[ke,ue]=f.useState(null),Se=Ke(X,ue,a),[fe]=f.useState(()=>new Map),Ae=f.useRef(0),Le=ke?.ownerDocument,Me=f.useCallback(v=>{let z=fe.get(v);if(!z){const j=++Ae.current;z={element:null,panelId:`${q}-tab-panel-${j}`,tabElementId:`${q}-tab-${j}`},fe.set(v,z)}return!z.element&&Le&&(z.element=Le.createElement("div")),z},[q,Le,fe]),le=Ce(I);f.useEffect(()=>{for(const[v,z]of fe)le.tabsById.has(v)||(z.element?.remove(),fe.delete(v),te.tabs.delete(v));for(const v of te.tabs.keys())le.tabsById.has(v)||te.tabs.delete(v);for(const v of te.tabsets.keys())le.tabsetsById.has(v)||te.tabsets.delete(v)},[te,le,fe]);const it=f.useSyncExternalStore(Cn,()=>!1,()=>!0),rt=f.useCallback(v=>typeof l=="function"?l(v):l,[l]),at=f.useCallback(v=>typeof C=="function"?C(v):C,[C]),[Qe,ae]=f.useState({}),[ve,xe]=f.useState({}),[Ne,Ht]=f.useState({}),ct=f.useCallback((v,z)=>ae(j=>j[v]?.height===z.height&&j[v]?.width===z.width?j:{...j,[v]:z}),[]),[lt,An]=f.useState({}),Do=f.useCallback(v=>An(z=>Hs(z,v)),[]),[ko,Po]=f.useState({}),Oo=f.useCallback(v=>Po(z=>Hs(z,v)),[]),Vt=f.useMemo(()=>new Set(le.parentsById.keys()),[le]),Ve=f.useMemo(()=>ft(ko,Vt),[ko,Vt]),qt=f.useMemo(()=>Object.keys(Ve).length===0?lt:Object.keys(lt).length===0?Ve:{...Ve,...lt},[lt,Ve]);f.useEffect(()=>yn(({next:v,prev:z})=>{z.state==="active"&&v.state!=="active"&&An(j=>Object.keys(j).length>0?{}:j)}),[]);const Ao=f.useCallback((v,z)=>Ht(j=>j[v]===z?j:{...j,[v]:z}),[]),No=f.useCallback((v,z)=>xe(j=>j[v]===z?j:{...j,[v]:z}),[]);f.useEffect(()=>{ae(v=>ft(v,le.nodeIds)),xe(v=>ft(v,le.nodeIds)),Ht(v=>ft(v,le.nodeIds)),An(v=>ft(v,le.nodeIds)),Po(v=>ft(v,Vt))},[le,Vt]);const[Nn,Xi]=f.useState(null);f.useEffect(()=>{if(!ke)return;const v=()=>Xi({element:ke});v();const z=ke.ownerDocument.defaultView;return z?.addEventListener("resize",v),()=>{z?.removeEventListener("resize",v)}},[ke]);const{maximumSizes:$o,minimumSizes:jo}=f.useMemo(()=>{const v=Nn?.element??null;return nc(I.root,{getChromeSize:z=>Qe[z],getCollapsedSize:z=>Ne[z],getContentMaximumSize:z=>({height:pt(z.maxHeight,v)??1/0,width:pt(z.maxWidth,v)??1/0}),getContentMinimumSize:z=>({height:pt(z.minHeight??P,v)??0,width:pt(z.minWidth??T,v)??0}),getSeparatorsSize:z=>ve[z]})},[Qe,Ne,I.root,ve,P,T,Nn]),Ki=ge(v=>{const z=Ce(G.current).tabsetsById.get(v),j=Qe[v]??{height:0,width:0},ee=Nn?.element??null;return{height:j.height+(pt(z?.minHeight??P,ee)??0),width:j.width+(pt(z?.minWidth??T,ee)??0)}}),Bo=zc({getMinimumSize:Ki,updateModel:x}),Fo=ge(v=>{const{tabsById:z,tabsetsById:j}=Ce(G.current);if(v.type==="tab"){const me=z.get(v.tabId);return me?{tab:me,type:"tab"}:void 0}const ee=j.get(v.tabsetId);return ee?{tabset:ee,type:"tabset"}:void 0}),Go=(v,z,j)=>{if(typeof i!="function")return!!i;const ee=G.current;if(v.type==="tab")return i({model:ee,source:z,tab:v.tab,tabset:void 0,target:j});const me=v.tabset;return me.tabs.length===0?i({model:ee,source:z,tab:void 0,tabset:me,target:j}):me.tabs.some((Ge,et)=>i({model:ee,source:z,tab:Ge,tabset:me,target:"index"in j?{...j,index:j.index+et}:j}))},Ji=ge((v,z)=>{if(typeof i!="function")return!!i;const j=Fo(v);return j?Go(j,"local",z):!0}),Zi=ge((v,z)=>o||v.type==="tabset"&&!!v.tabset.keepWhenEmpty||dc(G.current,v,z)||Go(v,"external",z)),Qi=f.useCallback((v,z)=>x("move",!0,j=>{const ee=bt(z,Ue(X.current));return v.type==="tab"?eo(j,v.tabId,ee):to(j,v.tabsetId,ee)}),[x]),Wo=ge(v=>{if(!d)return!1;const{tabsById:z,tabsetsById:j}=Ce(G.current);if(v.type==="tab")return z.has(v.tabId);const ee=j.get(v.tabsetId);return!!ee&&!ee.keepWhenEmpty}),er=ge((v,{screenX:z,screenY:j})=>{if(!d||!Wo(v))return;const ee=G.current,me=cc(ee,v);if(!me)return;const{tabsById:Ge,tabsetsById:et,tabsetsByTabId:mr}=Ce(ee),Kt=v.type==="tab"?{tab:Ge.get(v.tabId),tabset:mr.get(v.tabId),type:"tab"}:{tabset:et.get(v.tabsetId),type:"tabset"},Yo=F.get(Kt.tabset.id)?.tabset?.getBoundingClientRect(),gr={...Kt.type==="tab"?{tab:Kt.tab,type:"tab"}:{tabset:Kt.tabset,type:"tabset"},height:Yo?.height??0,model:me,screenX:z,screenY:j,width:Yo?.width??0};d(gr)===!0&&x("tear-off",!0,Xo=>v.type==="tab"?Lt(Xo,v.tabId):Gn(Xo,v.tabsetId))}),tr=ge((v,z)=>{let j=!1;return x("transfer",!0,ee=>{const me=bt(z,Ue(X.current)),Ge=v.type==="tab"?pc(ee,v.tab,me):hc(ee,v.tabset,me);return j=Ge!==ee,Ge}),j}),nr=ge(v=>x("transfer",!0,z=>v.type==="tab"?Lt(z,v.tabId):Gn(z,v.tabsetId))),or=f.useCallback(()=>G.current,[]),sr=f.useCallback(()=>X.current,[]),{dragSource:Ct,isNativeDragOver:ir,isNativeDragSource:rr,isTearOff:$n,nativePreviewNode:Ut,previewElementRef:ar,previewPointRef:cr,startTabDrag:_o,startTabsetDrag:Ho}=Uc({canTearOff:Wo,disableDragBetweenApps:s,dragGroup:r,dragStore:O,getDragNode:Fo,getModel:or,getRootElement:sr,isDropDisabled:Ji,isExternalDropDisabled:Zi,onDrop:Qi,onTearOff:er,onTransferIn:tr,onTransferOut:nr,rootElement:ke,tabsetElements:F}),jn=f.useRef(void 0),Vo=f.useCallback(v=>{jn.current=v},[]),qo=f.useCallback(v=>jn.current===v?(jn.current=void 0,!0):!1,[]),lr=f.useMemo(()=>({activeTabsetId:se,collapsedSizes:Ne,collapseOverrides:qt,collapsePreview:lt,collapseToFit:Ve,disabled:o,dragGroup:r,dragStore:O,getTabHandle:ze,getTabHost:Me,getHiddenTabBehavior:rt,getTabsetHandle:ye,id:q,isHydrating:it,maximumSizes:$o,minimumSizes:jo,model:I,modelIndex:le,outerParents:B,classNames:t,renderEmptyTabset:m,renderSeparator:p,renderTab:g,renderTabContent:y,renderTabsetToolbar:w,reportChromeSize:ct,reportCollapsePreview:Do,reportCollapseToFit:Oo,reportCollapsedSize:Ao,reportSeparatorsSize:No,requestFocus:Vo,resizePreviewMode:S,setActiveTabsetId:L,shouldServerRenderTabContent:at,splitGeneration:oe,startFloatingGesture:Bo,startTabDrag:_o,startTabsetDrag:Ho,styles:E,tabListFreeSpaceStore:A,tabPlacement:_,tabsetElements:F,takeFocusRequest:qo,updateModel:x}),[se,Ne,qt,lt,Ve,o,r,O,ze,Me,rt,ye,q,it,$o,jo,I,le,B,t,m,p,g,y,w,ct,Do,Oo,Ao,No,Vo,S,L,at,oe,Bo,_o,Ho,E,A,_,F,qo,x]),Bn=f.useMemo(()=>({activeTabsetId:se,collapseOverrides:qt,collapseToFit:Ve,disabled:o,dragGroup:r,model:I,modelIndex:le}),[se,qt,Ve,o,r,I,le]),ur=ge(v=>Me(v).panelId),[Yt]=f.useState(()=>rc(Bn,x,ur));Yt.setState(Bn),ce(()=>{Yt.notify()},[Yt,Bn]);const Tt=I.maximizedTabsetId!==void 0?le.tabsetsById.get(I.maximizedTabsetId):void 0;ce(()=>{K.current?.toggleAttribute("inert",!!Tt)},[Tt]);const dr=f.useMemo(()=>W.jsx(Yi,{node:I.root}),[I.root]),fr=f.useMemo(()=>Tt&&W.jsx("div",{"data-workspace-maximized":!0,style:{inset:0,position:"absolute",zIndex:1},children:W.jsx(Mo,{isMaximizedOverlay:!0,tabset:Tt})}),[Tt]),pr=f.useMemo(()=>I.floating&&W.jsx(fl,{floating:I.floating,layoutElementRef:K}),[I.floating]),hr=f.useMemo(()=>it?null:Array.from(le.tabsById.values(),v=>{const z=Me(v.id).element;return z?br.createPortal(W.jsx(Ai,{hiddenTabBehavior:rt(v),renderTabContent:y,tab:v}),z,v.id):null}),[rt,Me,it,le,y]);let ut,Fe;Ut?Ut.type==="tab"?ut=Ut.tab:Fe=Ut.tabset:rr||(ut=Ct?.type==="tab"?le.tabsById.get(Ct.tabId):void 0,Fe=Ct?.type==="tabset"?le.tabsetsById.get(Ct.tabsetId):void 0);const Uo=(v,z=0)=>{if(h)return h(v,{isTearOff:$n});const j=v.title??v.id;return z>0?`${j} (+${z})`:j};let Xt=null;if(ut)Xt=Uo(ut);else if(Fe)if(b)Xt=b(Fe,{isTearOff:$n});else{const v=Fe.tabs.find(({id:z})=>z===Fe.selectedId);Xt=v?Uo(v,Fe.tabs.length-1):Fe.id}return W.jsx(Io.Provider,{value:J,children:W.jsx(Ft.Provider,{value:Yt,children:W.jsxs(Di.Provider,{value:lr,children:[W.jsxs("div",{...D,className:e,"data-testid":xt(D,c),"data-workspace":!0,id:q,ref:Se,style:{position:"relative",...k},children:[W.jsx("div",{"data-workspace-layout":!0,ref:K,style:{height:"100%",width:"100%"},children:dr}),fr,pr,(Ct!==void 0||ir)&&W.jsx(Tl,{className:t?.dropIndicator,dragStore:O,layoutElementRef:K,model:I,style:E?.dropIndicator,tabsetElements:F}),(ut||Fe)&&W.jsx(Sl,{className:t?.dragPreview,dragType:ut?"tab":"tabset",elementRef:ar,isTearOff:$n,pointRef:cr,style:E?.dragPreview,children:Xt})]}),hr]})})})}const Rl=Object.assign(Il,{displayName:"Workspace"});function El(e,{mapTab:t}={}){if(!ki(e)||e.version!==1)return null;if(!t)return bn(e);const n=i=>i.flatMap(r=>{const a=t(r);return a?[a]:[]}),o=i=>i.type==="split"?{...i,children:i.children.map(o)}:{...i,tabs:n(i.tabs)},s={...e,floating:e.floating?.map(i=>({...i,tabs:n(i.tabs)})),root:o(e.root)};return bn(s)}exports.Cell=Cr;exports.Grid=pa;exports.Gridline=hi;exports.Group=bi;exports.Panel=vi;exports.Separator=Si;exports.SeparatorOverlay=gi;exports.TabCloseButton=Ii;exports.TabsetCollapseButton=Ha;exports.TabsetDragHandle=qa;exports.TabsetMaximizeButton=Ya;exports.Workspace=Rl;exports.isCoarsePointer=Us;exports.normalizeWorkspaceModel=El;exports.useDefaultGridLayout=ha;exports.useDefaultLayout=Ea;exports.useGridCallbackRef=ma;exports.useGridRef=ga;exports.useGroupCallbackRef=La;exports.useGroupRef=yi;exports.usePanelCallbackRef=Oa;exports.usePanelRef=Aa;exports.useParentGrid=ba;exports.useParentGroup=Ma;exports.useParentPanel=Na;exports.useParentTab=Xa;exports.useParentTabState=Ti;exports.useParentTabset=Ka;exports.useParentTabsetState=Ln;exports.useParentWorkspace=Ja;exports.useTabListFreeSpace=Za;exports.useWorkspaceCallbackRef=ec;exports.useWorkspaceRef=tc;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),f=require("react"),xr=require("react-dom");function Ji(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Zi=Ji(f);function Tn(e){return(typeof e=="number"||typeof e=="string")&&e!==""}function bt(e){const t=f.useId();return Tn(e)?`${e}`:t}const ue=typeof window<"u"?f.useLayoutEffect:f.useEffect;function he(e){const t=f.useRef(e);return ue(()=>{t.current=e},[e]),f.useCallback((...n)=>t.current?.(...n),[t])}function dt(...e){return he(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Dt(e,t){const n=e?.["data-testid"];return Tn(n)?`${n}`:Tn(t)?`${t}`:void 0}function ho(e,t){return t?e*2+1:e+1}function Qi(e,t){return t?e*2-1:e}function vs(e,t,n){return`${ho(e,n)} / span ${Qi(t,n)}`}function ea(e){return`${e*2} / span 1`}function ta({crossCount:e,crossSpan:t,crossStart:n,hasGutters:o}){const s=t===void 0?e:n+t;if(n===0&&s===e)return"1 / -1";let r=ho(n,o),i=ho(s-1,o)+1;return o&&(n>0&&r--,s<e&&i++),`${r} / ${i}`}function Ro(e,t){return Number.isInteger(e)&&e>=1&&e<t}function ce(e,t="Assertion error"){if(!e)throw Error(t)}const wr=f.createContext(null);function Cr(){const e=f.useContext(wr);return ce(e,"Grid Context not found; did you render a Cell or Gridline outside of a Grid?"),e}function na({children:e,className:t,column:n,columnSpan:o=1,elementRef:s,id:r,row:i,rowSpan:a=1,style:l,...c}){const u=bt(r),{gutters:d,registerCell:h}=Cr(),g=f.useRef(null),p=dt(g,s);return ue(()=>{const m=g.current;if(m!==null)return h({column:n,columnSpan:o,element:m,id:u,row:i,rowSpan:a})},[n,o,u,h,i,a]),_.jsx("div",{...c,className:t,"data-cell":!0,"data-testid":Dt(c,r),id:u,ref:p,style:{overflow:"auto",...l,minHeight:0,minWidth:0,gridColumn:vs(n,o,d.column),gridRow:vs(i,a,d.row)},children:e})}const oa=Object.assign(na,{displayName:"Cell"});let fn;function Tr(){return fn===void 0&&(typeof matchMedia=="function"?fn=!!matchMedia("(pointer:coarse)").matches:fn=!1),fn}function mo({expandHitTargets:e,axis:t,rect:n}){const o=e?Tr()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(n.width<o){const s=o-n.width;n=new DOMRect(n.x-s/2,n.y,n.width+s,n.height)}if(n.height<o){const s=o-n.height;n=new DOMRect(n.x,n.y-s/2,n.width,n.height+s)}return n}function Rt(e,t){return t==="column"?[e.column,e.columnSpan,e.row,e.rowSpan]:[e.row,e.rowSpan,e.column,e.columnSpan]}function go(e,t){return t==="column"?{crossEnd:e.bottom,crossStart:e.top,end:e.right,start:e.left}:{crossEnd:e.right,crossStart:e.left,end:e.bottom,start:e.top}}function bo(e,t,n,o){return t==="column"?new DOMRect(e.x,n,e.width,o-n):new DOMRect(n,e.y,o-n,e.height)}function Ss({axis:e,cells:t,getCellBounds:n,index:o,rect:s}){let r=[s];for(const i of t){const[a,l]=Rt(i,e);if(a>=o||a+l<=o)continue;const{crossStart:c,crossEnd:u}=n(i);u<=c||(r=r.flatMap(d=>{const{crossStart:h,crossEnd:g}=go(d,e);if(c>=g||u<=h)return[d];const p=[];return h<c&&p.push(bo(d,e,h,c)),g>u&&p.push(bo(d,e,u,g)),p}))}return r}function zr({axis:e,cells:t,crossTrackCount:n,trackCount:o}){const s=Array.from({length:n},()=>new Array(o));for(const r of t){const[i,a,l,c]=Rt(r,e);for(let u=Math.max(0,l);u<Math.min(n,l+c);u++)for(let d=Math.max(0,i);d<Math.min(o,i+a);d++)s[u][d]??=r}return s}function xs({crossEnd:e,crossStart:t,end:n,start:o},s){return s==="column"?new DOMRect(o,t,n-o,e-t):new DOMRect(t,o,e-t,n-o)}function sa({axis:e,cells:t,crossTrackCount:n,expandHitTargets:o,getAxisSize:s,getSlots:r,includeDisabled:i,resizeAxis:a,separatorPlacements:l}){const{items:c,separators:u}=a,d=c.length;let h=-1,g=-1,p=0;if(c.forEach((L,R)=>{L.constraintProps.disabled||(p++,h===-1&&(h=R),g=R)}),!i&&p<2)return[];const m=s(),y=L=>i||L>h&&L<=g,b=[],w=(L,R,A)=>({axis:a,axisSize:m,items:[c[L-1],c[L]],rect:R,separator:A}),C=new Map,x=L=>{let R=C.get(L);return R||(R=go(L.element.getBoundingClientRect(),e),C.set(L,R)),R},T=(L,R)=>{let A;for(const $ of t){const[,,J,U]=Rt($,e);if(R==="start"){if(J===L){const{crossStart:W}=x($);A=A===void 0?W:Math.min(A,W)}}else if(J+U-1===L){const{crossEnd:W}=x($);A=A===void 0?W:Math.max(A,W)}}return A},z=new Set;for(const L of u){const R=l.get(L);if(!R||R.index<1||R.index>=d||(z.add(R.index),!i&&(L.disabled||L.element.hasAttribute("aria-disabled")))||!y(R.index))continue;let A=L.element.getBoundingClientRect();const{crossSpan:$,crossStart:J}=R,U=$===void 0?n:J+$;let{crossStart:W,crossEnd:V}=go(A,e);if(J>0){const M=T(J-1,"end");M!==void 0&&M<W&&(W=M)}if(U<n){const M=T(U,"start");M!==void 0&&M>V&&(V=M)}A=bo(A,e,W,V),A=mo({expandHitTargets:o,axis:a,rect:A}),i?b.push(w(R.index,A,L)):Ss({axis:e,cells:t,getCellBounds:x,index:R.index,rect:A}).forEach(M=>{b.push(w(R.index,M,L))})}const N=(L,R)=>{Ss({axis:e,cells:t,getCellBounds:x,index:L,rect:mo({expandHitTargets:o,axis:a,rect:R})}).forEach(A=>{b.push(w(L,A))})},H=r?r():zr({axis:e,cells:t,crossTrackCount:n,trackCount:d});for(let L=1;L<d;L++){if(z.has(L)||!y(L))continue;let R;for(let A=0;A<n;A++){const $=H[A][L-1],J=H[A][L];let U;if(($||J)&&$!==J){const W=$?x($):void 0,V=J?x(J):void 0,M=W?.end??V.start,I=V?.start??W.end,ee=Math.max(W?.crossStart??-1/0,V?.crossStart??-1/0),se=Math.min(W?.crossEnd??1/0,V?.crossEnd??1/0);U={crossEnd:Math.max(ee,se),crossStart:ee,end:Math.max(M,I),start:Math.min(M,I)}}U?R=R?{crossEnd:Math.max(R.crossEnd,U.crossEnd),crossStart:Math.min(R.crossStart,U.crossStart),end:Math.max(R.end,U.end),start:Math.min(R.start,U.start)}:U:R&&(N(L,xs(R,e)),R=void 0)}R&&N(L,xs(R,e))}return b}function Xe(e){const t=parseFloat(e??"");return Number.isFinite(t)?t:0}function ra({axis:e,element:t,getGutterSizes:n,hasGutters:o,layout:s,trackIds:r}){const i=r.length,a=o?i*2-1:i,l=t.ownerDocument.defaultView?.getComputedStyle(t),c=e==="column",u=c?l?.gridTemplateColumns:l?.gridTemplateRows;if(u){const y=u.trim().split(/\s+/);if(y.length===a&&y.every(b=>/^-?[\d.]+px$/.test(b))){const b=r.map((w,C)=>Xe(y[o?C*2:C]));return{availableSize:b.reduce((w,C)=>w+C,0),trackSizes:b}}}const d=c?t.offsetWidth:t.offsetHeight,h=c?Xe(l?.paddingLeft)+Xe(l?.paddingRight)+Xe(l?.borderLeftWidth)+Xe(l?.borderRightWidth):Xe(l?.paddingTop)+Xe(l?.paddingBottom)+Xe(l?.borderTopWidth)+Xe(l?.borderBottomWidth),g=Xe(c?l?.columnGap:l?.rowGap),p=n().reduce((y,b)=>y+b,0),m=Math.max(0,d-h-g*Math.max(0,a-1)-p);return{availableSize:m,trackSizes:r.map(y=>s&&s[y]!==void 0?s[y]/100*m:m/i)}}class Zt{#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 s;const r=Array.from(o);for(let i=0;i<r.length;i++){const a=r[i];try{a.call(null,n)}catch(l){s??={error:l}}}if(s)throw s.error}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const s=o.indexOf(n);s>=0&&o.splice(s,1)}}}function zn(e){const t=o=>{o.preventDefault(),o.stopPropagation(),n()},n=()=>{e.removeEventListener("click",t,!0)};e.addEventListener("click",t,!0),setTimeout(n,0)}let Ce={cursorFlags:0,state:"inactive"};const Lo=new Zt;function Ne(){return Ce}function Pn(e){return Lo.addListener("change",e)}function ia(e,t=[],n,o=!1){const s=Ce,r={...Ce};r.cursorFlags=e,r.state==="active"&&(r.didPointerMove||=o,r.previews=t,n&&(r.previewLayoutMap=n)),Ce=r,Lo.emit("change",{prev:s,next:r})}function nt(e){const t=Ce;Ce=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&(t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),zn(t.ownerDocument)),Lo.emit("change",{prev:t,next:e})}function aa(e){Ce.state!=="active"||!Ce.previews.some(t=>t.separator===e)||nt({...Ce,previews:Ce.previews.map(t=>t.separator===e?{...t}:t)})}function ca(e){if(Ce.state==="inactive")return;const t=Ce.hitRegions.filter(o=>o.axis!==e),n=Ce.state==="active"&&Ce.previews.some(o=>o.axis===e);if(!(t.length===Ce.hitRegions.length&&!n))if(t.length===0)nt({cursorFlags:0,state:"inactive"});else if(Ce.state==="active"){const o=new Map(Ce.initialLayoutMap),s=new Map(Ce.previewLayoutMap);o.delete(e),s.delete(e),nt({...Ce,cursorFlags:0,hitRegions:t,initialLayoutMap:o,previewLayoutMap:s,previews:Ce.previews.filter(r=>r.axis!==e)})}else nt({...Ce,hitRegions:t})}const la=e=>e,so=()=>{},Ir=1,Er=2,Rr=4,Lr=8,ws=3,Cs=12;let pn;function Ts(){return pn===void 0&&(pn=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(pn=!0)),pn}function ua({cursorFlags:e,axes:t,state:n}){let o=0,s=0;switch(n){case"active":case"hover":t.forEach(r=>{if(!r.mutableState.disableCursor)switch(r.orientation){case"horizontal":{o++;break}case"vertical":{s++;break}}})}if(!(o===0&&s===0)){switch(n){case"active":{if(e&&Ts()){const r=(e&Ir)!==0,i=(e&Er)!==0,a=(e&Rr)!==0,l=(e&Lr)!==0;if(r)return a?"se-resize":l?"ne-resize":"e-resize";if(i)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return Ts()?o>0&&s>0?"move":o>0?"ew-resize":"ns-resize":o>0&&s>0?"grab":o>0?"col-resize":"row-resize"}}const zs=new WeakMap;function Is(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=zs.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=Ne();switch(o.state!=="inactive"&&o.ownerDocument!==e&&(o={cursorFlags:0,state:"inactive"}),o.state){case"active":case"hover":{const s=ua({cursorFlags:o.cursorFlags,axes:o.hitRegions.map(i=>i.axis),state:o.state}),r=`*, *:hover {cursor: ${s} !important; }`;if(t===r)return;t=r,s?n.cssRules.length===0?n.insertRule(r):n.replaceSync(r):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}zs.set(e,{prevStyle:t,styleSheet:n})}function Es(e){return e.state==="inactive"?void 0:e.ownerDocument}function da({next:e,prev:t}){const n=Es(t),o=Es(e);n&&n!==o&&Is(n),o&&Is(o)}function Te(e,t){const n=t==="horizontal"?e.offsetWidth:e.offsetHeight;if(n===0)return 1;const o=e.getBoundingClientRect(),s=t==="horizontal"?o.width:o.height;return s<=0||Math.abs(s-n)<1?1:s/n}function Qt({axis:e}){const{element:t,layoutStrategy:n,orientation:o,items:s}=e;if(n)return n.calculateAvailableSize();const r=Te(t,o);return s.reduce((i,a)=>{const l=a.element.getBoundingClientRect(),c=(o==="horizontal"?l.width:l.height)/r,u=o==="horizontal"?a.element.offsetWidth:a.element.offsetHeight;return i+=Math.abs(c-u)<1?c:u,i},0)}function Do(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 Bt(e,t){return Array.from(t).sort((n,o)=>{const s=e==="horizontal"?fa(n,o):pa(n,o);return s!==0?s:Do(n.element,o.element)})}function fa(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function pa(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Re(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Dr(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 ha({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let s,r=Number.MAX_VALUE;for(const i of t){const{x:a,y:l}=Dr(o,i),c=e==="horizontal"?a:l;c<r&&(r=c,s=i)}return ce(s,"No rect found"),s}function Mo({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:s,items:r,separators:i}=t,a=Bt(s,Array.from(o.children).filter(Re).filter(w=>!w.hasAttribute("data-resize-preview")).map(w=>({element:w}))).map(({element:w})=>w),l=[];let c=!1,u=!1,d=-1,h,g=-1,p=0,m,y,b=[];{let w=-1;for(const C of a)C.hasAttribute("data-panel")&&(w++,C.hasAttribute("data-disabled")||(p++,d===-1&&(d=w),g=w))}if(n||p>1){let w=-1;for(const C of a)if(C.hasAttribute("data-panel")){w++;const x=r.find(T=>T.element===C);if(x){const T=C.getBoundingClientRect();if(m&&y){const z=y;let N;if(u){const H=s==="horizontal"?new DOMRect(z.right,z.top,0,z.height):new DOMRect(z.left,z.bottom,z.width,0),L=s==="horizontal"?new DOMRect(T.left,T.top,0,T.height):new DOMRect(T.left,T.top,T.width,0);switch(b.length){case 0:{N=[H,L];break}case 1:{const R=b[0],A=ha({orientation:s,rects:[z,T],targetRect:R.element.getBoundingClientRect()});N=[R,A===z?L:H];break}default:{N=b;break}}}else b.length?N=b:N=[s==="horizontal"?new DOMRect(z.right,T.top,T.left-z.right,T.height):new DOMRect(T.left,z.bottom,T.width,T.top-z.bottom)];for(const H of N){const L=mo({expandHitTargets:e,axis:t,rect:"width"in H?H:H.element.getBoundingClientRect()}),R=w<=d||w>g;(n||!c&&!R)&&(h??=Qt({axis:t})*Te(t.element,t.orientation),l.push({axis:t,axisSize:h,items:[m,x],separator:"width"in H?void 0:H,rect:L})),c=!1}}u=!1,m=x,y=T,b=[]}}else if(C.hasAttribute("data-separator")){C.ariaDisabled!==null&&(c=!0);const x=i.find(T=>T.element===C);x?b.push(x):(m=void 0,b=[])}else u=!0}return l}function ko(e){return e.ownerDocument.defaultView??window}function ma(e,t){const n=ko(e).getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function ga(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function ba(e,t){return t/100*ko(e).innerHeight}function ya(e,t){return t/100*ko(e).innerWidth}function Po(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function ht({axisSize:e,itemElement:t,styleProp:n}){let o;const[s,r]=Po(n);switch(r){case"%":{o=s/100*e;break}case"px":{o=s;break}case"rem":{o=ga(t,s);break}case"em":{o=ma(t,s);break}case"vh":{o=ba(t,s);break}case"vw":{o=ya(t,s);break}}return o}function Ie(e){return parseFloat(e.toFixed(3))}function Oo(e,t=Qt({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:s,constraintProps:r}=o;let i=0;if(r.collapsedSize!==void 0){const d=ht({axisSize:t,itemElement:s,styleProp:r.collapsedSize});i=Ie(d/t*100)}let a;if(r.collapsedThreshold!==void 0){const d=ht({axisSize:t,itemElement:s,styleProp:r.collapsedThreshold});a=Ie(d/t*100)}let l;if(r.defaultSize!==void 0){const d=ht({axisSize:t,itemElement:s,styleProp:r.defaultSize});l=Ie(d/t*100)}let c=0;if(r.minSize!==void 0){const d=ht({axisSize:t,itemElement:s,styleProp:r.minSize});c=Ie(d/t*100)}let u=100;if(r.maxSize!==void 0){const d=ht({axisSize:t,itemElement:s,styleProp:r.maxSize});u=Ie(d/t*100)}return{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsedThreshold:a,collapsible:r.collapsible===!0,defaultSize:l,disabled:r.disabled,minSize:c,maxSize:u,itemId:o.id}})}let Ke=new Map;const Ao=new Zt;let Gt=0;const vn=[];let Sn;function On(){Gt++}function Mr(){for(let e=0;e<vn.length;e++)try{Ao.emit("axisChange",vn[e])}catch(t){Sn??={error:t}}vn.length=0}function An(){if(Gt===1&&Mr(),Gt--,Gt===0&&Sn){const{error:e}=Sn;throw Sn=void 0,e}}function va(e){Ke=new Map(Ke),Ke.delete(e)}function Ct(e,t){for(const[n]of Ke)if(n.id===e)return n}function Pe(e,t){for(const[n,o]of Ke)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function st(){return Ke}function Lt(e,t){return Ao.addListener("axisChange",n=>{n.axis.id===e&&t(n)})}function ot(e,t,n){const o=Ke.get(e);Ke=new Map(Ke),Ke.set(e,t);const s={axis:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t};Gt>0?vn.push(s):Ao.emit("axisChange",s)}function kr(e,t){Mr(),nt({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{if(!t.has(n.axis))return;const o=Pe(n.axis.id,!0);ot(n.axis,o,{isUserInteraction:!0})})}function Pr(e,{pointerId:t,pointerType:n}){return t===e.pointerId||n==="pen"&&e.pointerType==="pen"}function en(e,t,n={}){return e.ownerDocument===t&&(n.pointerId===void 0||Pr(e,n))}function Sa(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 be(e,t,n=0){return Math.abs(Ie(e)-Ie(t))<=n}function Oe(e,t){return be(e,t)?0:e>t?1:-1}function mt({overrideDisabledItems:e,itemConstraints:t,prevSize:n,size:o}){const{collapsedSize:s=0,collapsedThreshold:r,collapsible:i,disabled:a,maxSize:l=100,minSize:c=0}=t;if(a&&!e)return n;if(Oe(o,c)<0)if(i){const u=r??(c-s)/2,d=Oe(n,s)<=0,h=d?s+u:c-u,g=Oe(o,h);Oe(o,s)<=0||g<0||r!==void 0&&d&&g===0?o=s:o=c}else o=c;return o=Math.min(l,o),o=Ie(o),o}function Ht({delta:e,initialLayout:t,itemConstraints:n,pivotIndices:o,prevLayout:s,trigger:r}){if(be(e,0))return t;const i=r==="imperative-api",a=n.map(({itemId:p})=>t[p]),l=n.map(({itemId:p})=>s[p]),c=[...a],[u,d]=o;ce(u!=null,"Invalid first pivot index"),ce(d!=null,"Invalid second pivot index");let h=0;switch(r){case"keyboard":{{const p=e<0?d:u,m=n[p];ce(m,`Panel constraints not found for index ${p}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=m;if(b){const C=a[p];if(ce(C!=null,`Previous layout not found for panel index ${p}`),be(C,y)){const x=w-C;Oe(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const p=e<0?u:d,m=n[p];ce(m,`No panel constraints found for index ${p}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=m;if(b){const C=a[p];if(ce(C!=null,`Previous layout not found for panel index ${p}`),be(C,w)){const x=C-y;Oe(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}break}default:{const p=e<0?d:u,m=n[p];ce(m,`Panel constraints not found for index ${p}`);const y=a[p],{collapsedSize:b,collapsedThreshold:w,collapsible:C,minSize:x}=m;if(C&&Oe(y,x)<0){const T=x-b,z=w??T/2,N=y+Math.abs(e);if(Oe(N,x)<0){const H=Oe(Math.abs(e),z),L=w===void 0&&e<0;H>0||H===0&&L?e=e<0?-T:T:e=0}}break}}{const p=e<0?1:-1;let m=e<0?d:u,y=0;for(;;){const w=a[m];ce(w!=null,`Previous layout not found for panel index ${m}`);const x=mt({overrideDisabledItems:i,itemConstraints:n[m],prevSize:w,size:100})-w;if(y+=x,m+=p,m<0||m>=n.length)break}const b=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-b:b}{let m=e<0?u:d;for(;m>=0&&m<n.length;){const y=Math.abs(e)-Math.abs(h),b=a[m];ce(b!=null,`Previous layout not found for panel index ${m}`);const w=b-y,C=mt({overrideDisabledItems:i,itemConstraints:n[m],prevSize:b,size:w});if(!be(b,C)&&(h+=b-C,c[m]=C,Oe(h,Math.abs(e))>=0))break;e<0?m--:m++}}if(Sa(l,c))return s;{const p=e<0?d:u,m=a[p];ce(m!=null,`Previous layout not found for panel index ${p}`);const y=m+h,b=mt({overrideDisabledItems:i,itemConstraints:n[p],prevSize:m,size:y});if(c[p]=b,!be(b,y)){let w=y-b,x=e<0?d:u;for(;x>=0&&x<n.length;){const T=c[x];ce(T!=null,`Previous layout not found for panel index ${x}`);const z=T+w,N=mt({overrideDisabledItems:i,itemConstraints:n[x],prevSize:T,size:z});if(be(T,N)||(w-=N-T,c[x]=N),be(w,0))break;e>0?x--:x++}}}const g=c.reduce((p,m)=>m+p,0);return be(g,100,.1)?c.reduce((p,m,y)=>(p[n[y].itemId]=m,p),{}):s}function qe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Oe(e[n],t[n])!==0)return!1;return!0}function No(e){On();try{xa(e)}finally{An()}}function xa({commit:e,event:t,hitRegions:n,initialLayoutMap:o,mountedAxes:s,pointerDownAtPoint:r,prevCursorFlags:i}){let a=0;const l=Ne();let c=l.state==="active"?l.previews:[];const u=new Map(l.state==="active"?l.previewLayoutMap:void 0);n.forEach(g=>{const{axis:p,axisSize:m}=g,{orientation:y,items:b}=p;if(e&&p.resizePreviewMode!=="separator")return;const{disableCursor:w}=p.mutableState;let C=0;r?y==="horizontal"?C=(t.clientX-r.x)/m*100:C=(t.clientY-r.y)/m*100:y==="horizontal"?C=t.clientX<0?-100:100:C=t.clientY<0?-100:100;const x=o.get(p),T=s.get(p);if(!x||!T)return;const{defaultLayoutDeferred:z,derivedItemConstraints:N,axisSize:H,layout:L,separatorToItems:R}=T;if(N&&L&&R){const A=p.resizePreviewMode==="separator"?u.get(p)??L:L,$=Ht({delta:C,initialLayout:x,itemConstraints:N,pivotIndices:g.items.map(J=>b.indexOf(J)),prevLayout:A,trigger:"mouse-or-touch"});if(p.resizePreviewMode==="separator"&&!e&&!qe($,A)){u.set(p,$);let J=0;const U=b.map(W=>(J+=$[W.id]-x[W.id],J*(m/100)));c=c.map(W=>{if(W.axis!==p)return W;const V=U[W.itemIndex];return V===W.offset?W:{...W,offset:V}})}if(qe($,A)&&C!==0&&!w)switch(y){case"horizontal":{a|=C<0?Ir:Er;break}case"vertical":{a|=C<0?Rr:Lr;break}}(p.resizePreviewMode!=="separator"||e)&&!qe($,L)&&ot(g.axis,{defaultLayoutDeferred:z,derivedItemConstraints:N,axisSize:H,layout:$,requestedAxisSize:H,requestedLayout:$,separatorToItems:R})}});let d=0;t.movementX===0?d|=i&ws:d|=a&ws,t.movementY===0?d|=i&Cs:d|=a&Cs;const h=l.state==="active"&&(t.clientX!==l.pointerDownAtPoint.x||t.clientY!==l.pointerDownAtPoint.y);ia(d,c,u,h)}function Or(e,t){const n=Ne();if(n.state!=="active"||!en(n,e,t))return;const o=st();On();try{No({commit:!0,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),n.hitRegions.length>0&&t.preventDefault?.(),kr(n,o)}finally{An()}}function Rs(e){if(e.defaultPrevented)return;const{clientX:t,clientY:n,movementX:o,movementY:s}=e;Or(e.currentTarget,{clientX:t,clientY:n,movementX:o,movementY:s})}function wa(e,t,n){let o,s={x:1/0,y:1/0};for(const r of t){const i=Dr(n,r.rect);switch(e){case"horizontal":{(i.x<s.x||i.x===s.x&&i.y<=s.y)&&(o=r,s=i);break}case"vertical":{(i.y<s.y||i.y===s.y&&i.x<=s.x)&&(o=r,s=i);break}}}return o?{distance:s,hitRegion:o}:void 0}function Ca(e,t){const{coarse:n,fine:o}=e.resizeTargetMinimumSize,s=Math.max(n,o),r=e.element.getBoundingClientRect();return t.x>=r.left-s&&t.x<=r.right+s&&t.y>=r.top-s&&t.y<=r.bottom+s}function Ar(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ta(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ms(e),b:Ms(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();ce(o,"Stacking order can only be calculated for elements with a common ancestor");const s={a:Ds(Ls(n.a)),b:Ds(Ls(n.b))};if(s.a===s.b){const r=o.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let a=r.length;for(;a--;){const l=r[a];if(l===i.a)return 1;if(l===i.b)return-1}}return Math.sign(s.a-s.b)}const za=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ia(e){const t=getComputedStyle(Nr(e)??e).display;return t==="flex"||t==="inline-flex"}function Ea(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Ia(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"||za.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Ls(e){let t=e.length;for(;t--;){const n=e[t];if(ce(n,"Missing node"),Ea(n))return n}return null}function Ds(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ms(e){const t=[];for(;e;)t.push(e),e=Nr(e);return t}function Nr(e){const{parentNode:t}=e;return Ar(t)?t.host:t}function Ra(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 La(e){try{return e.matches(":modal")}catch{return!1}}function Da({axisElement:e,hitRegion:t,pointerEventTarget:n}){if(Re(n)){const o=n.closest("dialog");if(o&&!o.contains(e)&&La(o))return!1}if(!Re(n)||n.contains(e)||e.contains(n)||!n.isConnected||!e.isConnected)return!0;if(Ta(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Ra(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function $o(e,t,n){const o=[];return t.forEach((s,r)=>{if(r.disabled||r.element.ownerDocument!==n)return;const i={x:e.clientX,y:e.clientY};if(!Ca(r,i))return;const a=Mo({axis:r}),l=wa(r.orientation,a,i);l&&l.distance.x<=0&&l.distance.y<=0&&Da({axisElement:r.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&o.push(l.hitRegion)}),o}function $r(e){let t=0,n=0;const o={};for(const r of e)if(r.defaultSize!==void 0){t++;const i=Ie(r.defaultSize);n+=i,o[r.itemId]=i}else o[r.itemId]=void 0;const s=e.length-t;if(s!==0){const r=Ie((100-n)/s);for(const i of e)i.defaultSize===void 0&&(o[i.itemId]=r)}return o}function Ma(e,t){const n=e.map(s=>s.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const s of n)if(!o.includes(s))return!1;return!0}function jr({axis:e,itemConstraints:t}){const n=e.items.map(({id:s})=>s).join(","),o=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(o&&Ma(e.items,o)?o:$r(t))}function Nn(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 ka(e,t){return e.length!==t.length?!1:e.every((n,o)=>Nn(n,t[o]))}function lt({layout:e,itemConstraints:t}){const n=t.map(({itemId:i})=>e[i]),o=[...n],s=o.reduce((i,a)=>i+a,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(i=>`${i}%`).join(", ")}`);if(!be(s,100)&&o.length>0)for(let i=0;i<t.length;i++){const a=o[i];ce(a!=null,`No layout data found for index ${i}`);const l=100/s*a;o[i]=l}let r=0;for(let i=0;i<t.length;i++){const a=n[i];ce(a!=null,`No layout data found for index ${i}`);const l=o[i];ce(l!=null,`No layout data found for index ${i}`);const c=mt({overrideDisabledItems:!0,itemConstraints:t[i],prevSize:a,size:l});l!=c&&(r+=l-c,o[i]=c)}if(!be(r,0))for(let i=0;i<t.length;i++){const a=o[i];ce(a!=null,`No layout data found for index ${i}`);const l=a+r,c=mt({overrideDisabledItems:!0,itemConstraints:t[i],prevSize:a,size:l});if(a!==c&&(r-=c-a,o[i]=c,be(r,0)))break}return o.reduce((i,a,l)=>(i[t[l].itemId]=a,i),{})}function Br({itemIds:e,layout:t}){return lt({layout:t,itemConstraints:e.map(n=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:n,maxSize:100,minSize:0}))})}function Pa({axis:e,nextAxisSize:t,prevAxisSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let s=0,r=0,i=!1;const a=new Map,l=[];for(const d of e.items){const h=o[d.id]??0;switch(d.constraintProps.groupResizeBehavior){case"preserve-pixel-size":{i=!0;const g=h/100*n,p=Ie(g/t*100);a.set(d.id,p),s+=p;break}case"preserve-relative-size":default:{l.push(d.id),r+=h;break}}}if(!i||l.length===0)return o;const c=100-s,u={...o};if(a.forEach((d,h)=>{u[h]=d}),r>0)for(const d of l){const h=o[d]??0;u[d]=Ie(h/r*c)}else{const d=Ie(c/l.length);for(const h of l)u[h]=d}return u}function jo({axis:e,axisState:t}){const n=Qt({axis:e});if(n===0)return;const o=Oo(e,n);let s=t.requestedAxisSize,r=t.requestedLayout;t.defaultLayoutDeferred&&(s=n,r=Br({itemIds:e.items.map(({id:c})=>c),layout:jr({axis:e,itemConstraints:o})}));const i=Pa({axis:e,nextAxisSize:n,prevAxisSize:s,prevLayout:r}),a=lt({layout:i,itemConstraints:o});return{changed:t.defaultLayoutDeferred||!qe(t.layout,a)||!ka(t.derivedItemConstraints,o)||t.axisSize!==n,state:{defaultLayoutDeferred:!1,derivedItemConstraints:o,axisSize:n,layout:a,requestedAxisSize:s,requestedLayout:r,separatorToItems:t.separatorToItems}}}function Bo({axisId:e,itemId:t}){const n=()=>{const c=st();for(const[u,d]of c)if(u.id===e)return{axis:u,...d};throw Error(`Group ${e} not found`)},o=()=>{const c=n().derivedItemConstraints.find(u=>u.itemId===t);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const{axis:c,...u}=n(),d=jo({axis:c,axisState:u}),h=d?.state??u,g=h.derivedItemConstraints.find(m=>m.itemId===t);if(g===void 0)throw Error(`Panel constraints not found for Panel ${t}`);const p=h.layout[t];if(p===void 0)throw Error(`Layout not found for Panel ${t}`);return{axis:c,changed:d?.changed===!0,itemConstraints:g,itemSize:p,state:h}},r=()=>{const c=n().axis.items.find(u=>u.id===t);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const c=n().layout[t];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${t}`)},a=({allowPartialSize:c=!1,nextSize:u,items:d,prevLayout:h,derivedItemConstraints:g})=>{const p=h[t],m=d.findIndex(R=>R.id===t),y=m===0,b=m===d.length-1;if(b&&u<p&&(y||d.slice(0,m).every((R,A)=>{const $=g[A];return $?.collapsible&&be($.collapsedSize,h[$.itemId])}))){const R=d.slice(0,m).reduce((A,$)=>A+h[$.id],0);return{...h,[t]:Ie(100-R)}}const C=g[m],x=mt({overrideDisabledItems:!0,itemConstraints:C,prevSize:p,size:u}),T={...h};let z=x-p;for(const R of y?[1]:b?[-1]:[1,-1])for(let A=m+R;A>=0&&A<d.length&&!be(z,0);A+=R){const $=g[A],J=T[$.itemId];if(In($,T)||(z>0?Oe(J,$.minSize)<=0:Oe(J,$.maxSize)>=0))continue;const U=z>0?Math.max($.minSize,J-z):Math.min($.maxSize,J-z);z-=J-U,T[$.itemId]=Ie(U)}if(T[t]=Ie(x-z),be(z,0)||c&&Oe(T[t],C.minSize)>=0)return T;const N=(R,A,$)=>{const J=R==="after"?1:-1,U=V=>{for(let M=m+J;M>=0&&M<d.length;M+=J){const I=g[M];if(!In(I,A)&&V(I))return M}},W=U(({itemId:V,maxSize:M,minSize:I})=>$>0?Oe(A[V],I)>0:Oe(A[V],M)<0)??U(()=>!0)??m+J;return Ht({delta:R==="after"?$:-$,initialLayout:A,itemConstraints:g,pivotIndices:R==="after"?[m,W]:[W,m],prevLayout:A,trigger:"imperative-api"})};if(y||b)return N(b?"before":"after",h,u-p);const H=R=>{const A=N(R,h,u-p),$=u-A[t];return be($,0)?A:N(R==="after"?"before":"after",A,$)},L=H("after");if(ks({itemConstraints:g,itemId:t,nextLayout:L,prevLayout:h})){const R=H("before");if(!ks({itemConstraints:g,itemId:t,nextLayout:R,prevLayout:h}))return R}return L},l=(c,{axis:u,changed:d,itemSize:h,state:g},{allowPartialSize:p=!1}={})=>{if(c===h)return;const{derivedItemConstraints:m,axisSize:y,layout:b}=g,w=a({allowPartialSize:p,nextSize:c,items:u.items,prevLayout:b,derivedItemConstraints:m}),C=lt({layout:w,itemConstraints:m});(d||!qe(b,C))&&ot(u,{...g,layout:C,requestedAxisSize:y,requestedLayout:C})};return{collapse:()=>{const c=s(),{collapsible:u,collapsedSize:d}=c.itemConstraints,{mutableValues:h}=r(),g=c.itemSize;u&&g!==d&&(h.expandToSize=g,l(d,c))},expand:()=>{const c=s(),{collapsible:u,collapsedSize:d,minSize:h}=c.itemConstraints,{mutableValues:g}=r(),p=c.itemSize;if(u&&p===d){let m=g.expandToSize??h;m===0&&(m=1),l(m,c,{allowPartialSize:!0})}},getSize:()=>{const{axis:c}=n(),u=i(),{element:d}=r(),h=c.layoutStrategy?c.layoutStrategy.getItemSizeInPixels(t):c.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:u,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:u}=o(),d=i();return c&&be(u,d)},resize:c=>{const u=s(),{axisSize:d}=u.state,{element:h}=r(),g=ht({axisSize:d,itemElement:h,styleProp:c}),p=Ie(g/d*100);l(p,u)}}}function In({collapsedSize:e,collapsible:t,itemId:n},o){return t&&be(o[n],e)}function ks({itemConstraints:e,itemId:t,nextLayout:n,prevLayout:o}){return e.some(s=>s.itemId!==t&&In(s,o)!==In(s,n))}function Ps(e){if(e.defaultPrevented)return;const t=st();$o(e,t,e.currentTarget).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const s=o.items.find(r=>r.constraintProps.defaultSize!==void 0);if(s){const r=s.constraintProps.defaultSize,i=Bo({axisId:o.axis.id,itemId:s.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Os({axis:e,axisState:t,delta:n,separator:o}){const s=t.separatorToItems.get(o);ce(s,"Matching panels not found");const r=s.map(c=>e.items.indexOf(c)),i=t.defaultLayoutDeferred?{}:t.layout,a=Ht({delta:n,initialLayout:i,itemConstraints:t.derivedItemConstraints,pivotIndices:r,prevLayout:i,trigger:"keyboard"}),l=lt({layout:a,itemConstraints:t.derivedItemConstraints});qe(i,l)||ot(e,{defaultLayoutDeferred:t.defaultLayoutDeferred,derivedItemConstraints:t.derivedItemConstraints,axisSize:t.axisSize,layout:l,requestedAxisSize:t.axisSize,requestedLayout:l,separatorToItems:t.separatorToItems},{isUserInteraction:!0})}function Oa(e){const t=st();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 Aa(e){return e.separators.filter(t=>!t.disabled)}function As(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Oa(t);if(n.disabled)return;const o=n.separators.find(r=>r.element===t);if(ce(o,"Matching separator not found"),o.disabled)return;const s=r=>Os({axis:n,axisState:Pe(n.id,!0),delta:r,separator:o});switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&s(5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&s(-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&s(5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&s(-5);break}case"End":{e.preventDefault(),s(100);break}case"Enter":{e.preventDefault();const r=Pe(n.id,!0),{derivedItemConstraints:i,layout:a,separatorToItems:l}=r,c=l.get(o);ce(c,"Matching panels not found");const u=c[0],d=i.find(h=>h.itemId===u.id);if(ce(d,"Panel metadata not found"),d.collapsible){const h=a[u.id],g=d.collapsedSize===h?n.mutableState.expandedItemSizes[u.id]??d.minSize:d.collapsedSize;Os({axis:n,axisState:r,delta:g-h,separator:o})}break}case"F6":{e.preventDefault();const r=Aa(n).map(c=>c.element),i=r.findIndex(c=>c===e.currentTarget);ce(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(),s(-100);break}}}function Mt(e,t){const n=Ne();if(n.state!=="active"||!en(n,e,t))return!1;const o=st();On();try{n.previewLayoutMap.forEach((s,r)=>{const i=o.get(r);r.resizePreviewMode==="separator"&&i&&!qe(s,i.layout)&&ot(r,{...i,layout:s,requestedAxisSize:i.axisSize,requestedLayout:s})}),kr(n,o)}finally{An()}return!0}function Ns(e){const t=Ne();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))||Mt(e.currentTarget,e)}function $s(e){Mt(e.currentTarget,e)}function Na(e,t){const{element:n,orientation:o,items:s}=e,r=n.getBoundingClientRect(),i=o==="horizontal";return Mo({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:l,rect:c,separator:u},d)=>{const h=s.indexOf(l[0]),g=i?c.left+c.width/2:c.top+c.height/2;return{active:t.some(m=>{if(m.axis!==e||m.items[0]!==l[0])return!1;if(u||m.separator)return m.separator===u;const y=i?m.rect.left+m.rect.width/2:m.rect.top+m.rect.height/2;return be(g,y)}),axis:e,key:u?`separator-${u.id}`:`panel-${l[0].id}-${d}`,offset:0,itemIndex:h,rect:new DOMRect((i&&!u?g:c.left)-r.left-n.clientLeft+n.scrollLeft,(!i&&!u?g:c.top)-r.top-n.clientTop+n.scrollTop,i&&!u?0:c.width,!i&&!u?0:c.height),separator:u}})}function js(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=Ne();if(t.state==="active"){Pr(t,e)&&Mt(t.ownerDocument,t);return}const n=st(),o=$o(e,n,e.currentTarget);if(o.length===0)return;const s=new Map;let r=!1;o.forEach(a=>{a.separator&&(r||(r=!0,a.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=n.get(a.axis);l&&s.set(a.axis,l.layout)});const i=Array.from(s.keys()).flatMap(a=>a.resizePreviewMode==="separator"?Na(a,o):[]);nt({cursorFlags:0,didPointerMove:!1,hitRegions:o,initialLayoutMap:s,ownerDocument:e.currentTarget,pointerDownAtPoint:{x:e.clientX,y:e.clientY},pointerId:e.pointerId,pointerType:e.pointerType,previewLayoutMap:new Map(s),previews:i,state:"active"}),e.preventDefault()}function Bs(e){const t=e.currentTarget,n=st(),o=Ne();switch(o.state){case"active":{if(!en(o,t,e))return;No({commit:!1,event:e,hitRegions:o.hitRegions,initialLayoutMap:o.initialLayoutMap,mountedAxes:n,prevCursorFlags:o.cursorFlags})}}}function $a(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const o=e[n],s=t[n];if(o.axis!==s.axis||o.separator!==s.separator||o.items[0]!==s.items[0]||o.items[1]!==s.items[1])return!1}return!0}function Fs(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ne(),o=st();switch(n.state){case"active":{if(!en(n,t,e))return;if(e.buttons===0){Mt(t,e);return}for(const s of n.hitRegions)if(s.separator){const{element:r}=s.separator;r.isConnected&&!r.hasPointerCapture?.(e.pointerId)&&r.setPointerCapture?.(e.pointerId)}No({commit:!1,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const s=$o(e,o,t);s.length===0?n.state!=="inactive"&&nt({cursorFlags:0,state:"inactive"}):(n.state!=="hover"||n.ownerDocument!==t||!$a(n.hitRegions,s))&&nt({cursorFlags:0,hitRegions:s,ownerDocument:t,state:"hover"});break}}}function _s(e){const t=e.relatedTarget;if(Re(t)&&t.localName==="iframe"){const n=Ne();switch(n.state){case"hover":n.ownerDocument===e.currentTarget&&nt({cursorFlags:0,state:"inactive"})}}}function Ws(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||Or(e.currentTarget,e)}function Gs(e){e.target===e.currentTarget&&Mt(e.currentTarget.document)}function Vs(e){Mt(e.currentTarget.document)}function ja(e,t,n){const o=n[0];if(!o)return;const s=e.items.find(d=>d.element===t);if(!s||!s.onResize)return;const r=Qt({axis:e}),i=e.orientation==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,a=e.orientation==="horizontal"?o.inlineSize:o.blockSize,l=Number.isFinite(a)&&a>0&&Math.abs(a-i)<1?a:i,c=s.mutableValues.prevSize,u={asPercentage:Ie(l/r*100),inPixels:i};s.mutableValues.prevSize=u,s.onResize(u,s.id,c)}const vt=new Map;let Hs=!1;function Fr(e){let t=!0;ce(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,s=new Set,r=new n(p=>{let m;On();try{for(const y of p){const{borderBoxSize:b,target:w}=y;if(w===e.element){if(t){const C=Pe(e.id);if(!C)break;const x=jo({axis:e,axisState:C});if(!x)break;if(!x.changed)continue;ot(e,x.state)}}else try{ja(e,w,b)}catch(C){m??={error:C}}}}finally{An()}if(m)throw m.error});r.observe(e.element),e.items.forEach(p=>{ce(!o.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),o.add(p.id),p.onResize&&r.observe(p.element)});const i=Qt({axis:e}),a=Oo(e,i),l=jr({axis:e,itemConstraints:a}),c=lt({layout:l,itemConstraints:a}),u=e.element.ownerDocument,d=u.defaultView;vt.set(u,(vt.get(u)??0)+1);const h=new Map;return Mo({axis:e,includeDisabled:!0}).forEach(p=>{p.separator&&h.set(p.separator,p.items)}),ot(e,{defaultLayoutDeferred:i===0,derivedItemConstraints:a,axisSize:i,layout:c,requestedAxisSize:i,requestedLayout:Br({itemIds:e.items.map(({id:p})=>p),layout:l}),separatorToItems:h}),e.separators.forEach(p=>{ce(!s.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),s.add(p.id),p.element.addEventListener("keydown",As)}),Hs||(Hs=!0,Pn(da)),vt.get(u)===1&&(u.addEventListener("contextmenu",Rs,!0),u.addEventListener("dblclick",Ps,!0),u.addEventListener("lostpointercapture",Ns,!0),u.addEventListener("pointercancel",$s,!0),u.addEventListener("pointerdown",js,!0),u.addEventListener("pointerleave",Bs),u.addEventListener("pointermove",Fs),u.addEventListener("pointerout",_s),u.addEventListener("pointerup",Ws,!0),d?.addEventListener("blur",Gs),d?.addEventListener("pagehide",Vs)),function(){t=!1,vt.set(u,Math.max(0,(vt.get(u)??0)-1)),va(e),ca(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",As)}),vt.get(u)||(u.removeEventListener("contextmenu",Rs,!0),u.removeEventListener("dblclick",Ps,!0),u.removeEventListener("lostpointercapture",Ns,!0),u.removeEventListener("pointercancel",$s,!0),u.removeEventListener("pointerdown",js,!0),u.removeEventListener("pointerleave",Bs),u.removeEventListener("pointermove",Fs),u.removeEventListener("pointerout",_s),u.removeEventListener("pointerup",Ws,!0),d?.removeEventListener("blur",Gs),d?.removeEventListener("pagehide",Vs)),r.disconnect()}}function xn({axisId:e}){const t=()=>{const n=st();for(const[o,s]of n)if(o.id===e)return{axis:o,...s};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,...s}=t(),r=jo({axis:o,axisState:s}),i=r?.state??s,{defaultLayoutDeferred:a,derivedItemConstraints:l,axisSize:c,layout:u}=i,d=lt({layout:n,itemConstraints:l});return a?u:((r?.changed||!qe(u,d))&&ot(o,{...i,layout:d,requestedAxisSize:c,requestedLayout:d}),d)}}}function _r({derivedItemConstraints:e,axis:t,layout:n,prevLayout:o,requestedLayout:s}){const r=t.items.map(({id:i})=>i).join(",");t.mutableState.layouts[r]=s,o&&e.forEach(i=>{if(i.collapsible){const a=be(i.collapsedSize,n[i.itemId]),l=be(i.collapsedSize,o[i.itemId]);a&&!l&&(t.mutableState.expandedItemSizes[i.itemId]=o[i.itemId])}})}function Wr(){const[e,t]=f.useState({}),n=f.useCallback(()=>t({}),[]);return[e,n]}function Gr({initialLayout:e,layoutsEqual:t,onLayoutChange:n,onLayoutChanged:o}){const s=f.useRef({onLayoutChange:e,onLayoutChanged:e}),r=he(a=>{t(s.current.onLayoutChange,a)||(s.current.onLayoutChange=a,n?.(a))}),i=he((a,l,c)=>{t(s.current.onLayoutChanged,a)||(s.current.onLayoutChanged=a,o?.(a,{isUserInteraction:l,requestedLayout:c}))});return{onLayoutChangeStable:r,onLayoutChangedStable:i}}function En({isCompleted:e,isUserInteraction:t,layout:n,onLayoutChange:o,onLayoutChanged:s,requestedLayout:r}){try{o(n)}finally{e&&s(n,t,r)}}function $n(e){const t=f.useRef({...e});return ue(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Fo=f.createContext(null),wt=["column","row"],jn=f.createContext(null);function hn(e){return e==="column"?"columns":"rows"}function Ba({layout:e,itemConstraints:t,itemId:n,itemIndex:o}){let s,r;const i=e[n],a=t.find(l=>l.itemId===n);if(a){const l=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,u=[o,o+1];r=lt({layout:Ht({delta:c-i,initialLayout:e,itemConstraints:t,pivotIndices:u,prevLayout:e}),itemConstraints:t})[n],s=lt({layout:Ht({delta:l-i,initialLayout:e,itemConstraints:t,pivotIndices:u,prevLayout:e}),itemConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:r,valueNow:i}}function Vr({attributes:e,axisId:t,axisOrientation:n,children:o,className:s,"data-testid":r,disableCursor:i,disabled:a,disableDoubleClick:l,elementRef:c,id:u,isSharedHitRegion:d,preview:h,registerSeparator:g,requiredStyle:p,style:m,styleDefaults:y,tabIndex:b=0,updateSeparatorProps:w}){const C=$n({disabled:a,disableDoubleClick:l,children:o,className:s,preview:h,style:m}),[x,T]=f.useState({}),[z,N]=f.useState("inactive"),[H,L]=f.useState(!1),R=f.useRef(null),A=f.useRef(null),$=dt(R,c),J=n==="horizontal"?"vertical":"horizontal";ue(()=>{const V=R.current;if(V!==null){const M={disabled:C.disabled,disableDoubleClick:C.disableDoubleClick,element:V,id:u,get children(){return C.children},get className(){return C.className},get preview(){return C.preview},get style(){return C.style}};A.current=M;const I=g(M),ee=Pn(Y=>{N(Y.next.state!=="inactive"&&Y.next.hitRegions.some(ae=>ae.separator===M||(d?.(ae)??!1))?Y.next.state:"inactive")}),se=Lt(t,Y=>{const{derivedItemConstraints:ae,layout:Q,separatorToItems:Le}=Y.next,xe=Le.get(M);if(xe){const P=xe[0],k=ae.findIndex(j=>j.itemId===P.id),{layoutStrategy:E}=Y.axis,O={...Ba({layout:Q,itemConstraints:ae,itemId:P.id,itemIndex:k}),...E?.getItemAriaControls&&{valueControls:E.getItemAriaControls(P.id)}};T(j=>Nn(j,O)?j:O)}});return()=>{A.current=null,ee(),se(),I()}}},[t,u,d,g,C]),ue(()=>{const V=A.current;V&&aa(V)},[h]),f.useEffect(()=>{w(u,{disabled:a,disableDoubleClick:l})},[a,l,u,w]);let U;a&&!i&&(U="not-allowed");let W;if(a)W="disabled";else switch(z){case"active":{W="active";break}default:H?W="focus":W=z}return _.jsx("div",{...e,"aria-controls":x.valueControls,"aria-disabled":a||void 0,"aria-orientation":J,"aria-valuemax":x.valueMax,"aria-valuemin":x.valueMin,"aria-valuenow":x.valueNow,children:o,className:s,"data-separator":W,"data-testid":r,id:u,onBlur:()=>L(!1),onFocus:()=>L(!0),ref:$,role:"separator",style:{...y,cursor:U,...m,...p,touchAction:"none"},tabIndex:a?void 0:b})}function Ft(e){return e==="column"?"row":"column"}function Fa(e){const{children:t,className:n,disabled:o,elementRef:s,style:r,type:i}=e,[a,l,c]=e.type==="column"?[e.column,e.row,e.rowSpan]:[e.row,e.column,e.columnSpan],u=l??0,d=bt(void 0),{getDisableCursor:h,getResizeAxisId:g,gutters:p,registerSeparator:m,separatorPlacements:y,trackCounts:b,updateSeparatorProps:w}=Cr(),C=g(i),x=Ft(i),T=b[x],z=!!o||!Ro(a,b[i]);let N=!0;for(const $ of y.values())if($.axis===i&&$.index===a&&!$.disabled&&$.crossStart<u){N=!1;break}const H=f.useCallback($=>$.axis.id===C&&$.axis.items.indexOf($.items[1])===a,[C,a]),L=f.useCallback($=>m({axis:i,crossSpan:c,crossStart:u,disabled:!!o,index:a},$),[i,c,u,o,a,m]),R=ea(a),A=ta({crossCount:T,crossSpan:c,crossStart:u,hasGutters:p[x]});return _.jsx(Vr,{axisId:C,axisOrientation:i==="column"?"horizontal":"vertical",className:n,disableCursor:h(),disabled:z,disableDoubleClick:void 0,elementRef:s,id:d,isSharedHitRegion:H,registerSeparator:L,requiredStyle:{gridColumn:i==="column"?R:A,gridRow:i==="row"?R:A},style:r,tabIndex:N?0:-1,updateSeparatorProps:w,children:t})}const Hr=Object.assign(Fa,{displayName:"Gridline"});function qr(e,t){f.Children.forEach(e,n=>{if(f.isValidElement(n))if(n.type===Hr){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&&qr(n.props.children,t)})}function _a(e,t){if(t)return e.map(r=>`minmax(0, ${t[r.id]??1}fr)`);const n=e.map(r=>r.defaultSize===void 0?void 0:Po(r.defaultSize));let o=100,s=0;return n.forEach(r=>{r===void 0?s++:r[1]==="%"&&(o-=r[0])}),n.map(r=>{if(r===void 0)return`minmax(0, ${Math.max(0,o)/Math.max(1,s)}fr)`;const[i,a]=r;return a==="%"?`minmax(0, ${i}fr)`:`${i}${a}`})}function Wa({cells:e,separatorPlacements:t,trackCounts:n}){const o=[];for(const a of e)wt.forEach(l=>{const[c,u]=Rt(a,l),d=n[l];(!Number.isInteger(c)||!Number.isInteger(u)||c<0||u<1||c+u>d)&&o.push(`Invalid Cell ${l} placement (${l}: ${c}, ${l}Span: ${u}); Grid has ${d} ${l}s`)});const s=({axis:a,crossSpan:l,crossStart:c,disabled:u,index:d})=>{const h=Ft(a);let g=`type="${a}" ${a}={${d}}`;return(c!==0||l!==void 0)&&(g+=` ${h}={${c}}`),l!==void 0&&(g+=` ${h}Span={${l}}`),u&&(g+=" disabled"),`<Gridline ${g} />`},r=Array.from(t.values()).filter(a=>{const{axis:l,crossSpan:c,crossStart:u,index:d}=a,h=Ft(l),g=n[l],p=n[h];let m=!0;return Ro(d,g)||(o.push(`Invalid ${l} Gridline ${l} (${d}); must be between 1 and ${g-1}`),m=!1),!Number.isInteger(u)||u<0||u>=p?(o.push(`Invalid ${l} Gridline ${h} (${u}); must be between 0 and ${p-1}`),m=!1):c!==void 0&&(!Number.isInteger(c)||c<1||u+c>p)&&(o.push(`Invalid ${l} Gridline ${h}Span (${c}); Grid has ${p} ${h}s`),m=!1),m}),i=a=>{const l=n[Ft(a.axis)];return[a.crossStart,a.crossSpan===void 0?l:a.crossStart+a.crossSpan]};return r.forEach((a,l)=>{const{axis:c,index:u}=a,[d,h]=i(a);for(const g of e){const[p,m,y,b]=Rt(g,c);if(p<u&&u<p+m&&y<h&&d<y+b){const w=Ft(c);o.push(`${s(a)} overlaps a Cell that spans across it (${c}: ${p}, ${c}Span: ${m}, ${w}: ${y}, ${w}Span: ${b}); use the ${w} and ${w}Span props to render gridlines beside the Cell instead`)}}for(const g of r.slice(l+1))if(g.axis===c&&g.index===u){const[p,m]=i(g);p<h&&d<m&&o.push(`${s(a)} overlaps ${s(g)}`)}}),o}function Ga(e,t){return qe(e.columns,t.columns)&&qe(e.rows,t.rows)}const Va={columns:{},rows:{}};function Ha({children:e,className:t,columns:n,defaultLayout:o,disableCursor:s,disabled:r,elementRef:i,gridRef:a,id:l,onLayoutChange:c,onLayoutChanged:u,resizeTargetMinimumSize:d={coarse:20,fine:10},rows:h,style:g,...p}){const m=bt(l),y=f.useCallback(E=>`${m}:${hn(E)}`,[m]),b=qs(n,"columns"),w=qs(h,"rows"),C=E=>E==="column"?b:w,{onLayoutChangeStable:x,onLayoutChangedStable:T}=Gr({initialLayout:Va,layoutsEqual:Ga,onLayoutChange:c,onLayoutChanged:u}),z=f.useRef(null),N=dt(z,i),[H,L]=Wr(),R=f.useRef({cells:[],column:{expandedItemSizes:{},layouts:{}},loggedErrors:new Set,row:{expandedItemSizes:{},layouts:{}},separators:new Map}),A={column:!1,row:!1};for(const E of R.current.separators.values())A[E.axis]=!0;qr(e,A);const $=$n({defaultLayout:o,disableCursor:s,resizeTargetMinimumSize:d}),J=he(()=>!!$.disableCursor),U=f.useCallback(E=>{const O=R.current;return O.cells=[...O.cells,E],L(),()=>{O.cells=O.cells.filter(j=>j!==E),L()}},[L]),W=f.useCallback((E,O)=>{const j=R.current;return j.separators=new Map(j.separators),j.separators.set(O,E),L(),()=>{j.separators=new Map(j.separators),j.separators.delete(O),L()}},[L]),V=f.useCallback((E,{disabled:O,disableDoubleClick:j})=>{for(const F of R.current.separators.keys())F.id===E&&(F.disabled=O,F.disableDoubleClick=j)},[]),M=R.current.separators,I=f.useMemo(()=>({getDisableCursor:J,getResizeAxisId:y,gutters:{column:A.column,row:A.row},registerCell:U,registerSeparator:W,separatorPlacements:M,trackCounts:{column:b.length,row:w.length},updateSeparatorProps:V}),[b.length,J,y,A.column,A.row,U,W,w.length,M,V]),ee=f.useRef([]);ue(()=>{const E=z.current;if(E===null)return;const O=R.current;if(process.env.NODE_ENV!=="production"){const K=Wa({cells:O.cells,separatorPlacements:O.separators,trackCounts:{column:b.length,row:w.length}});K.forEach(ne=>{O.loggedErrors.has(ne)||console.error(ne)}),O.loggedErrors=new Set(K)}const j=K=>Array.from(O.separators.entries()).filter(([,ne])=>ne.axis===K).sort(([,ne],[,ye])=>ne.index-ye.index).map(([ne])=>ne),F=K=>{const[ne,ye]=K==="column"?[b,w]:[w,b],q=ne.map(te=>te.id),G=y(K),le=j(K),ie=le.length>0,fe=ne.map(({id:te,...ge},we)=>({element:E,id:q[we],idIsStable:!0,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:void 0,constraintProps:ge})),ve=()=>{const te=[];if(ie){for(const[ge,we]of O.separators)if(we.axis===K&&Ro(we.index,ne.length)){const Fe=ge.element.getBoundingClientRect();te[we.index]=Math.max(te[we.index]??0,K==="column"?Fe.width:Fe.height)}}return te.filter(ge=>ge!==void 0)},me=()=>ra({axis:K,element:E,getGutterSizes:ve,hasGutters:ie,layout:Pe(G)?.layout,trackIds:q});let Ge;const Je=()=>{const{cells:te}=O;return Ge?.cells!==te&&(Ge={ariaControls:void 0,cells:te,slots:void 0}),Ge},Ve=()=>{const te=Je();if(!te.ariaControls){const ge=q.map(()=>[]);for(const we of te.cells){const[Fe,Ue]=Rt(we,K);if(we.element.id)for(let Qe=Math.max(0,Fe);Qe<Math.min(q.length,Fe+Ue);Qe++)ge[Qe].push(we.element.id)}te.ariaControls=new Map(q.map((we,Fe)=>[we,ge[Fe].join(" ")||void 0]))}return te.ariaControls},Ze=()=>{const te=Je();return te.slots??=zr({axis:K,cells:te.cells,crossTrackCount:ye.length,trackCount:ne.length}),te.slots};let Ye;const We=$.defaultLayout?.[hn(K)];if(We!==void 0&&Object.keys(We).length===q.length){Ye={};for(const te of q){const ge=We[te];ge!==void 0&&(Ye[te]=ge)}}return{disabled:!!r,element:E,id:G,layoutStrategy:{getItemAriaControls:te=>Ve().get(te),calculateAvailableSize:()=>me().availableSize,calculateHitRegions:({expandHitTargets:te,axis:ge,includeDisabled:we})=>sa({axis:K,cells:O.cells,crossTrackCount:ye.length,expandHitTargets:te,getAxisSize:()=>me().availableSize*Te(ge.element,ge.orientation),getSlots:Ze,includeDisabled:we,resizeAxis:ge,separatorPlacements:O.separators}),getItemSizeInPixels:te=>me().trackSizes[q.indexOf(te)]??0},mutableState:{defaultLayout:Ye,disableCursor:!!$.disableCursor,expandedItemSizes:O[K].expandedItemSizes,layouts:O[K].layouts},orientation:K==="column"?"horizontal":"vertical",items:fe,resizePreviewMode:"panel",get resizeTargetMinimumSize(){return $.resizeTargetMinimumSize},separators:le}},B=wt.map(F);ee.current=B;const X=B.map(K=>Fr(K)),Z=()=>{const[K,ne]=B.map(ye=>Pe(ye.id));if(!(!K||!ne||K.defaultLayoutDeferred||ne.defaultLayoutDeferred))return{layout:{columns:K.layout,rows:ne.layout},requestedLayout:{columns:K.requestedLayout,rows:ne.requestedLayout}}};{const K=Z();if(K)try{En({isCompleted:!0,isUserInteraction:!1,layout:K.layout,onLayoutChange:x,onLayoutChanged:T,requestedLayout:K.requestedLayout})}catch(ne){throw ee.current=[],X.forEach(ye=>ye()),ne}}const re=B.map(K=>Lt(K.id,ne=>{const{defaultLayoutDeferred:ye,derivedItemConstraints:q,layout:G,requestedLayout:le}=ne.next;if(ye||q.length===0)return;_r({derivedItemConstraints:q,axis:K,layout:G,prevLayout:ne.prev?.layout,requestedLayout:le});const ie=Z();if(ie){const fe=Ne(),ve=fe.state!=="active"||!fe.hitRegions.some(me=>B.includes(me.axis));En({isCompleted:ve,isUserInteraction:ne.isUserInteraction,layout:ie.layout,onLayoutChange:x,onLayoutChanged:T,requestedLayout:ie.requestedLayout})}}));return()=>{ee.current=[],X.forEach(K=>K()),re.forEach(K=>K())}},[b,r,y,m,T,x,w,H,$]),f.useEffect(()=>{ee.current.forEach(E=>{E.mutableState.defaultLayout=o?.[E.orientation==="horizontal"?"columns":"rows"],E.mutableState.disableCursor=!!s})});const se=f.useMemo(()=>{const E=()=>{const[F,B]=wt.map(y);return!Ct(F)||!Ct(B)?{columns:{},rows:{}}:{columns:xn({axisId:F}).getLayout(),rows:xn({axisId:B}).getLayout()}},O=F=>F.map(B=>`"${B}"`).join(", "),j=(F,B)=>{const X=y(F),Z=()=>{const re=Ct(X);return ce(re,`Grid "${m}" has not been mounted`),ce(re.items.some(K=>K.id===B),`Grid "${m}" no longer contains a ${F} with id "${B}"; ${F} ids are ${O(re.items.map(K=>K.id))}`),Bo({axisId:X,itemId:B})};return{collapse:()=>Z().collapse(),expand:()=>Z().expand(),getSize:()=>Z().getSize(),isCollapsed:()=>Z().isCollapsed(),resize:re=>Z().resize(re)}};return{getLayout:E,getTrackById:(F,B)=>{const X=F==="column"?b:w,Z=`${B}`;return ce(X.some(re=>re.id===Z),`Grid "${m}" does not contain a ${F} with id "${Z}"; ${F} ids are ${O(X.map(re=>re.id))}`),j(F,Z)},getTrackByIndex:(F,B)=>{const X=F==="column"?b:w,Z=Number.isInteger(B)?X[B]:void 0;return ce(Z,`Grid "${m}" does not contain a ${F} at index ${B}; it has ${X.length} ${F}s`),j(F,Z.id)},setLayout:F=>(wt.forEach(B=>{const X=F[hn(B)],Z=y(B);X&&Ct(Z)&&xn({axisId:Z}).setLayout(X)}),E())}},[b,y,m,w]);f.useImperativeHandle(a,()=>se,[se]);const Y=f.useRef(se);ue(()=>{Y.current=se});const ae=f.useMemo(()=>({getLayout:()=>Y.current.getLayout(),getTrackById:(E,O)=>Y.current.getTrackById(E,O),getTrackByIndex:(E,O)=>Y.current.getTrackByIndex(E,O),id:m,setLayout:E=>Y.current.setLayout(E)}),[m]),Q=()=>wt.map(E=>{const O=Pe(y(E)),j=C(E);return(O&&!O.defaultLayoutDeferred?j.map(B=>`minmax(0, ${O.layout[B.id]??1}fr)`):_a(j,o?.[hn(E)])).join(A[E]?" auto ":" ")}).join("|"),Le=f.useCallback(E=>{const O=wt.map(j=>Lt(y(j),E));return()=>O.forEach(j=>j())},[y]),xe=f.useSyncExternalStore(Le,Q,Q),[P,k]=xe.split("|");return _.jsx(wr.Provider,{value:I,children:_.jsx("div",{...p,className:t,"data-grid":!0,"data-testid":Dt(p,l),id:m,ref:N,style:{height:"100%",width:"100%",overflow:"hidden",...g,display:"grid",gridTemplateColumns:P,gridTemplateRows:k,touchAction:"none"},children:_.jsx(Fo.Provider,{value:null,children:_.jsx(jn.Provider,{value:ae,children:e})})})})}const qa=Object.assign(Ha,{displayName:"Grid"});function qs(e,t){const n=JSON.stringify(e);return f.useMemo(()=>{const o=typeof e=="number"?Array.from({length:e},(s,r)=>({id:`${r}`})):e.map((s,r)=>({...s,id:`${s.id??r}`}));return ce(o.length>0,`Grid must have at least one track; "${t}" is ${n}`),o},[n])}function Bn(){return()=>{}}function Ya({id:e,onlySaveAfterUserInteractions:t,storage:n=localStorage}){const o=`react-resizable-panels:grid:${e}`,s=f.useSyncExternalStore(Bn,()=>n.getItem(o),()=>n.getItem(o)),r=f.useMemo(()=>{if(s)try{const a=JSON.parse(s);if(a!==null&&typeof a=="object")return a}catch{}},[s]),i=f.useCallback((a,l)=>{if(!(t&&!l.isUserInteraction))try{n.setItem(o,JSON.stringify(l.requestedLayout??a))}catch(c){console.error(c)}},[t,n,o]);return{defaultLayout:r,onLayoutChanged:i}}function Ua(){return f.useState(null)}function Xa(){return f.useRef(null)}function Ka(){return f.useContext(jn)}function Ja(e){for(let t=1;t<e.length;t++)if(Do(e[t-1],e[t])>0)return!1;return!0}function Za({separator:e}){const{element:t}=e,n=f.useRef(null);return ue(()=>{const o=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],r=[o,...o.querySelectorAll("*")],i=t.ownerDocument.defaultView;return s.forEach((a,l)=>{const c=r[l],{style:u}=c;if(u){const d=i.getComputedStyle(a);for(let h=0;h<d.length;h++){const g=d.item(h);u.setProperty(g,d.getPropertyValue(g))}}c.removeAttribute("data-testid"),c.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]),_.jsx("div",{ref:n,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function Fn(){const e=f.useContext(Fo);return ce(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Qa(e){const{registerOverlay:t}=Fn(),n=f.useRef(e);Nn(n.current,e)||(n.current=e);const o=n.current;return ue(()=>t(o),[t,o]),null}const Yr=Object.assign(Qa,{displayName:"SeparatorOverlay"});function ec({active:e,orientation:t,style:n,...o}){let s;switch(t){case"horizontal":{s={height:"100%",minWidth:"1px"};break}case"vertical":{s={minHeight:"1px",width:"100%"};break}}return _.jsx("div",{...o,"data-separator-overlay":e?"active":"inactive",style:{...s,...n,flexShrink:0,pointerEvents:"none"}})}function tc({overlay:e,preview:t}){const{axis:n,offset:o,rect:s,separator:r}=t,i=n.orientation==="horizontal";let a=r?.preview,l=e;return f.isValidElement(a)&&a.type===Yr&&(l=a.props,a=void 0),a==null&&(l?a=_.jsx(ec,{...l,active:t.active,orientation:n.orientation}):r&&(a=_.jsx(Za,{separator:r}))),_.jsx("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:s.height,left:s.left,pointerEvents:"none",position:"absolute",top:s.top,transform:i?`translateX(${o}px)`:`translateY(${o}px)`,width:s.width},children:a})}function nc(e){return Array.from(e).sort(Do)}const _n=f.createContext(null);function oc(e,t){const n=f.useRef({getLayout:()=>({}),setLayout:la});return f.useImperativeHandle(t,()=>n.current,[]),ue(()=>{Object.assign(n.current,xn({axisId:e}))}),n}function sc({groupId:e,resizePreviewMode:t}){const[n,o]=f.useState([]),s=f.useRef(n);return ue(()=>{const r=a=>{const l=Ct(e),c=t==="separator"&&a.state==="active"?a.previews.filter(d=>d.axis===l&&(d.active||!be(d.offset,0))):[],u=s.current;u.length===c.length&&c.every((d,h)=>d===u[h])||(s.current=c,o(c))};if(t!=="separator"){r(Ne());return}const i=Pn(({next:a})=>r(a));return r(Ne()),i},[e,t]),n}function rc({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:s,elementRef:r,groupRef:i,id:a,onLayoutChange:l,onLayoutChanged:c,orientation:u="horizontal",resizePreviewMode:d="panel",resizeTargetMinimumSize:h={coarse:20,fine:10},style:g,...p}){const{onLayoutChangeStable:m,onLayoutChangedStable:y}=Gr({initialLayout:{},layoutsEqual:qe,onLayoutChange:l,onLayoutChanged:c}),b=bt(a),[w,C]=f.useState(),x=sc({groupId:b,resizePreviewMode:d}),T=f.useRef(null),[z,N]=Wr(),H=f.useRef([]),L=f.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),R=dt(T,r),A=oc(b,i),$=f.useMemo(()=>({getLayout:()=>A.current.getLayout(),id:b,orientation:u,setLayout:M=>A.current.setLayout(M)}),[b,A,u]),J=he((M,I)=>{const ee=Pe(M);if(ee)return{flexGrow:ee.layout[I]??1};if(n?.[I])return{flexGrow:n?.[I]}}),U=$n({defaultLayout:n,disableCursor:o,resizeTargetMinimumSize:h}),W=f.useMemo(()=>({get disableCursor(){return!!U.disableCursor},getPanelStyles:J,id:b,orientation:u,registerPanel:M=>{const I=L.current;return I.panels=Bt(u,[...I.panels,M]),N(),()=>{I.panels=I.panels.filter(ee=>ee!==M),N()}},registerOverlay:M=>(C(M),()=>{C(void 0)}),registerSeparator:M=>{const I=L.current;return I.separators=Bt(u,[...I.separators,M]),N(),()=>{I.separators=I.separators.filter(ee=>ee!==M),N()}},updatePanelProps:(M,{disabled:I})=>{const se=L.current.panels.find(Q=>Q.id===M);if(!se||se.constraintProps.disabled===I)return;se.constraintProps.disabled=I;const Y=Ct(b),ae=Pe(b);Y&&ae&&ot(Y,{...ae,derivedItemConstraints:Oo(Y)})},updateSeparatorProps:(M,{disabled:I,disableDoubleClick:ee})=>{const Y=L.current.separators.find(ae=>ae.id===M);Y&&(Y.disabled=I,Y.disableDoubleClick=ee)}}),[J,b,N,u,U]),V=f.useRef(null);return ue(()=>{const M=T.current;if(M===null)return;const I=L.current;I.panels=Bt(u,I.panels),I.separators=Bt(u,I.separators),H.current=nc([...I.panels.map(({element:k})=>k),...I.separators.map(({element:k})=>k)]);let ee;if(U.defaultLayout!==void 0&&Object.keys(U.defaultLayout).length===I.panels.length){ee={};for(const k of I.panels){const E=U.defaultLayout[k.id];E!==void 0&&(ee[k.id]=E)}}const se={disabled:!!s,element:M,id:b,mutableState:{defaultLayout:ee,disableCursor:!!U.disableCursor,expandedItemSizes:L.current.lastExpandedPanelSizes,layouts:L.current.layouts},orientation:u,items:I.panels,resizePreviewMode:d,get resizeTargetMinimumSize(){return U.resizeTargetMinimumSize},separators:I.separators};V.current=se;const Y=Fr(se),{defaultLayoutDeferred:ae,derivedItemConstraints:Q,layout:Le,requestedLayout:xe}=Pe(se.id,!0);if(!ae&&Q.length>0)try{En({isCompleted:!0,isUserInteraction:!1,layout:Le,onLayoutChange:m,onLayoutChanged:y,requestedLayout:xe})}catch(k){throw V.current=null,Y(),k}const P=Lt(b,k=>{const{defaultLayoutDeferred:E,derivedItemConstraints:O,layout:j,requestedLayout:F}=k.next;if(E||O.length===0)return;_r({derivedItemConstraints:O,axis:se,layout:j,prevLayout:k.prev?.layout,requestedLayout:F});const B=Ne(),X=B.state!=="active"||!B.hitRegions.some(Z=>Z.axis===se);En({isCompleted:X,isUserInteraction:k.isUserInteraction,layout:j,onLayoutChange:m,onLayoutChanged:y,requestedLayout:F})});return()=>{V.current=null,Y(),P()}},[s,b,y,m,u,z,d,U]),ue(()=>{Ja(H.current)||N()}),f.useEffect(()=>{const M=V.current;M&&(M.mutableState.defaultLayout=n,M.mutableState.disableCursor=!!o)}),_.jsx(_n.Provider,{value:$,children:_.jsx(Fo.Provider,{value:W,children:_.jsxs("div",{...p,className:t,"data-group":!0,"data-testid":Dt(p,a),id:b,ref:R,style:{height:"100%",width:"100%",overflow:"hidden",position:d==="separator"?"relative":void 0,...g,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:[e,x.map(M=>_.jsx(tc,{overlay:w,preview:M},M.key))]})})})}const Ur=Object.assign(rc,{displayName:"Group"});function wn(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function ic({id:e,panelIds:t,storage:n}){const o=wn(e,[]),s=n.getItem(o);if(s)try{const r=JSON.parse(s);if(t){const i=t.join(","),a=r[i];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const l={};for(let c=0;c<t.length;c++)l[t[c]]=a.layout[c];return l}}else{const i=Object.keys(r);if(i.length===1){const a=r[i[0]];if(a&&Array.isArray(a.layout)){const l=i[0].split(",");if(l.length===a.layout.length){const c={};for(let u=0;u<l.length;u++)c[l[u]]=a.layout[u];return c}}}}}catch{}}function ac({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...s}){const r=n!==void 0,i="id"in s?s.id:s.groupId,a=wn(i,n??[]),l=f.useSyncExternalStore(Bn,()=>o.getItem(a),()=>o.getItem(a)),c=f.useMemo(()=>{if(l){const y=JSON.parse(l),b=Object.values(y);if(Array.from(b).every(w=>typeof w=="number"))return y}},[l]),u=f.useMemo(()=>{if(!c)return ic({id:i,panelIds:n,storage:o})},[c,i,n,o]),d=c??u,h=f.useRef(null),g=f.useCallback(()=>{const y=h.current;y&&(h.current=null,clearTimeout(y))},[]);f.useLayoutEffect(()=>()=>{g()},[g]);const p=f.useCallback((y,b)=>{if(t&&!b.isUserInteraction)return;g();const w=b.requestedLayout??y;let C;r?C=wn(i,Object.keys(w)):C=wn(i,[]);try{o.setItem(C,JSON.stringify(w))}catch(x){console.error(x)}},[g,r,i,t,o]),m=f.useCallback(y=>{g(),e===0?p(y,{isUserInteraction:!1}):h.current=setTimeout(()=>{p(y,{isUserInteraction:!1})},e)},[g,e,p]);return{defaultLayout:d,onLayoutChange:m,onLayoutChanged:p}}function cc(){return f.useState(null)}function Xr(){return f.useRef(null)}function lc(){return f.useContext(_n)}const Wn=f.createContext(null);function uc(e,t){const{id:n}=Fn(),o=f.useRef({collapse:so,expand:so,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:so});return f.useImperativeHandle(t,()=>o.current,[]),ue(()=>{Object.assign(o.current,Bo({axisId:n,itemId:e}))}),o}function dc({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:s=!1,defaultSize:r,disabled:i,elementRef:a,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:h,panelRef:g,style:p,...m}){const y=Tn(c),b=bt(c),w=$n({disabled:i}),C=f.useRef(null),x=dt(C,a),{getPanelStyles:T,id:z,orientation:N,registerPanel:H,updatePanelProps:L}=Fn(),R=h!=null,A=he((I,ee,se)=>{h?.(I,c,se)});ue(()=>{const I=C.current;if(I!==null){const ee={element:I,id:b,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:R?A:void 0,constraintProps:{groupResizeBehavior:l,collapsedSize:n,collapsedThreshold:o,collapsible:s,defaultSize:r,disabled:w.disabled,maxSize:u,minSize:d}};return H(ee)}},[l,n,o,s,r,R,b,y,u,d,A,H,w]),f.useEffect(()=>{L(b,{disabled:i})},[i,b,L]);const $=uc(b,g),J=f.useMemo(()=>({collapse:()=>$.current.collapse(),expand:()=>$.current.expand(),getSize:()=>$.current.getSize(),groupId:z,id:b,isCollapsed:()=>$.current.isCollapsed(),resize:I=>$.current.resize(I)}),[z,b,$]),U=f.useCallback(I=>Lt(z,I),[z]),W=()=>T(z,b)?.flexGrow,V=f.useSyncExternalStore(U,W,W);let M;return V!==void 0?M={flexGrow:V}:r!==void 0?M={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:M={flexGrow:1},_.jsx("div",{...m,"data-disabled":i||void 0,"data-panel":!0,"data-testid":Dt(m,c),id:b,ref:x,style:{...fc,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...M},children:_.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:N==="horizontal"?"pan-y":"pan-x"},children:_.jsx(Wn.Provider,{value:J,children:e})})})}const Kr=Object.assign(dc,{displayName:"Panel"}),fc={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function pc(){return f.useState(null)}function hc(){return f.useRef(null)}function mc(){return f.useContext(Wn)}const gc={flexBasis:"auto"},bc={flexGrow:0,flexShrink:0};function yc({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:s,id:r,preview:i,style:a,...l}){const c=bt(r),{disableCursor:u,id:d,orientation:h,registerSeparator:g,updateSeparatorProps:p}=Fn();return _.jsx(Vr,{attributes:l,axisId:d,axisOrientation:h,className:t,"data-testid":Dt(l,r),disableCursor:u,disabled:n,disableDoubleClick:o,elementRef:s,id:c,preview:i,registerSeparator:g,requiredStyle:bc,style:a,styleDefaults:gc,updateSeparatorProps:p,children:e})}const Jr=Object.assign(yc,{displayName:"Separator"}),Ys=new Set;function Se(e){Ys.has(e)||(Ys.add(e),console.warn(`react-resizable-panels: ${e}`))}const kt=f.createContext(null),tn=f.createContext(null);function qt(e){return e.type==="split"?{...e,children:e.children.map(qt)}:{...e,tabs:e.tabs.map(t=>({...t}))}}function $e(e){const t={...e,root:qt(e.root)};return e.floating&&(t.floating=e.floating.map(qt)),t}function nn(e){return e.type==="tabset"?[e]:e.children.flatMap(t=>nn(t))}function Tt(e){const t=nn(e.root);return e.floating?[...t,...e.floating]:t}function ut(e,t){return Tt(e).find(({tabs:n})=>n.some(({id:o})=>o===t))}function Yt(e,t){return ut(e,t)?.tabs.find(({id:n})=>n===t)}function _o(e,t){if(e.type==="tabset"){if(e.tabs.some(({id:r})=>r===e.selectedId)||(e.selectedId=e.tabs[0]?.id),e.collapsible||delete e.collapsed,e.recentTabIds!==void 0){const r=Array.isArray(e.recentTabIds)?e.recentTabIds.filter((i,a,l)=>l.indexOf(i)===a&&e.tabs.some(c=>c.id===i)):[];r.length>0?e.recentTabIds=r:delete e.recentTabIds}return e.tabs.length>0||t||e.keepWhenEmpty?e:null}const n=[];for(const r of e.children){const i=_o(r,!1);if(i!==null)if(i.type==="split"&&i.orientation===e.orientation)for(const a of i.children)n.push({...a,size:typeof a.size=="number"&&typeof i.size=="number"?a.size*i.size/100:void 0});else n.push(i)}if(n.length===0)return null;if(n.length===1)return{...n[0],size:e.size};const o=r=>r.type==="tabset"&&!!r.collapsed;n.every(o)&&delete n[n.length-1].collapsed;const s=n.filter(r=>!o(r));if(s.every(({size:r})=>typeof r=="number")){const r=s.reduce((i,{size:a})=>i+a,0);if(r>0)for(const i of s)i.size=i.size/r*100}return{...e,children:n}}const Zr=320,Qr=240;function vc(e){const t=e;delete t.collapsible,delete t.size;const n=t.collapsed===!0;return t.x=mn(t.x)?t.x:0,t.y=mn(t.y)?t.y:0,t.width=mn(t.width)&&t.width>0?t.width:Zr,t.height=mn(t.height)&&t.height>0?t.height:Qr,_o(t,!1)?(n&&(t.collapsed=!0),t):null}function mn(e){return typeof e=="number"&&Number.isFinite(e)}function Ae(e){const t=_o(e.root,!0)??{id:e.root.id,tabs:[],type:"tabset"};t.type==="tabset"&&delete t.collapsed;const n={root:t,version:1},o=(e.floating??[]).flatMap(s=>{const r=vc(s);return r?[r]:[]});return o.length>0&&(n.floating=o),e.maximizedTabsetId!==void 0&&t.type==="split"&&nn(t).some(({id:s})=>s===e.maximizedTabsetId)&&(n.maximizedTabsetId=e.maximizedTabsetId),n}function ei(e,t){const n=e.recentTabIds?.find(s=>s!==t&&e.tabs.some(r=>r.id===s));if(n!==void 0)return n;const o=e.tabs.findIndex(({id:s})=>s===t);return(e.tabs[o+1]??e.tabs[o-1])?.id}function Rn(e,t){const n=e.tabs.findIndex(({id:o})=>o===t);n<0||(e.selectedId===t&&(e.selectedId=ei(e,t)),e.tabs.splice(n,1))}function Vt(e,t){if(!Yt(e,t))return e;const n=$e(e),o=ut(n,t);return o&&Rn(o,t),Ae(n)}function gn(e,t){return typeof e=="function"?e(t):e}function Gn({children:e,className:t,style:n,title:o},s){return{children:gn(e,s),className:gn(t,s),style:gn(n,s),title:gn(o,s)}}function Ln(e,t){return t[e.id]??!!e.collapsed}function Wo(e){const t=f.useContext(tn),n=f.useRef(null),o=()=>{const s=t?e(t.getState()):null,r=n.current;return r&&(r.value===s||r.value!==null&&s!==null&&Nn(r.value,s))?r.value:(n.current={value:s},s)};return f.useSyncExternalStore(t?.subscribe??Bn,o,o)}function ti(){const t=f.useContext(kt)?.id;return Wo(({collapseOverrides:n,disabled:o,model:s,modelIndex:r})=>{const i=t!==void 0?r.tabsetsByTabId.get(t):void 0,a=i?.tabs.find(({id:u})=>u===t);if(!i||!a)return null;const l=i.selectedId===a.id,c=s.maximizedTabsetId;return{isCloseDisabled:o||!!a.disableClose,isDragDisabled:o||!!a.disableDrag,isSelected:l,isVisible:l&&(c===void 0?!Ln(i,n):c===i.id),tabsetId:i.id}})}function Sc({"aria-label":e,children:t="×",className:n,onClick:o,style:s,title:r,...i}){const a=f.useContext(tn),l=f.useContext(kt),c=ti(),u=l?.id,d=Wo(({modelIndex:p})=>{const m=u!==void 0?p.tabsById.get(u):void 0;return m?{title:m.title??m.id}:null});if(!a||!l)process.env.NODE_ENV!=="production"&&Se("TabCloseButton must be rendered within a tab (see renderTab)");else if(c?.isCloseDisabled)return null;const h=d?.title??"tab",g=Gn({children:t,className:n,style:s,title:r},{tabTitle:h});return _.jsx("button",{"aria-label":e??`Close ${h}`,tabIndex:-1,type:"button",...i,className:g.className,style:g.style,title:g.title,onClick:p=>{o?.(p),!p.defaultPrevented&&a&&l&&a.updateModel("close",!0,m=>Vt(m,l.id))},children:g.children})}const ni=Object.assign(Sc,{displayName:"TabCloseButton"}),rt=f.createContext(null);function Go(e,t){return!!t.collapsible&&!!e&&e.children.some(n=>n.id!==t.id&&!(n.type==="tabset"&&n.collapsed))}function xc(e){const t={floatingTabsetIds:new Set,nodeIds:new Set,parentsById:new Map,tabsetsById:new Map,tabsetsByTabId:new Map,tabsById:new Map},n=o=>{if(t.nodeIds.add(o.id),o.type==="tabset"){t.tabsetsById.set(o.id,o);for(const s of o.tabs)t.tabsetsByTabId.set(s.id,o),t.tabsById.set(s.id,s)}else for(const s of o.children)t.parentsById.set(s.id,o),n(s)};n(e.root);for(const o of e.floating??[])t.floatingTabsetIds.add(o.id),n(o);return t}const Us=new WeakMap;function Ee(e){let t=Us.get(e);return t||(t=xc(e),Us.set(e,t)),t}function Vo(e,t,n,o){return Ee(e).floatingTabsetIds.has(t.id)?n||!!t.disableDrag:n||!!t.disableDrag||t.tabs.some(({disableDrag:s})=>s)||e.root.id===t.id&&(o===void 0||!!t.keepWhenEmpty)||e.maximizedTabsetId!==void 0}function Vn(){const t=f.useContext(rt)?.id;return Wo(({activeTabsetId:n,collapseOverrides:o,collapseToFit:s,disabled:r,dragGroup:i,model:a,modelIndex:l})=>{const c=t!==void 0?l.tabsetsById.get(t):void 0;return c?{isActive:n===c.id,isCollapsed:Ln(c,o),isCollapsedToFit:Ln(c,o)&&s[c.id]===!0,isCollapsible:!!c.collapsed||l.floatingTabsetIds.has(c.id)||Go(l.parentsById.get(c.id),c),isDragDisabled:Vo(a,c,r,i),isFloating:l.floatingTabsetIds.has(c.id),isMaximized:a.maximizedTabsetId===c.id,isRoot:a.root.id===c.id,selectedTabId:c.selectedId}:null})}function gt(e,t){if(e.type==="split")for(const n of e.children){if(n.id===t)return e;const o=gt(n,t);if(o)return o}}function Me(e,t){return Tt(e).find(({id:n})=>n===t)}function on(e,t){return!!e.floating?.includes(t)}function oi(e,t){const n=Me(e,t);if(!n||n.collapsed||!(on(e,n)||Go(gt(e.root,t),n)))return e;const o=$e(e),s=Me(o,t);return s&&(s.collapsed=!0),Ae(o)}function si(e,t){const n=Me(e,t);if(!n?.collapsed)return!1;delete n.collapsed;const o=n.size,s=gt(e.root,t)?.children.filter(r=>r!==n&&!(r.type==="tabset"&&r.collapsed))??[];if(typeof o=="number"&&o<100&&s.every(r=>typeof r.size=="number"))for(const r of s)r.size=r.size*(100-o)/100;return!0}function Hn(e,t){if(!Me(e,t)?.collapsed)return e;const n=$e(e);return si(n,t),Ae(n)}function wc({"aria-label":e="Collapse tabset",children:t,className:n,onClick:o,style:s,title:r,...i}){const a=f.useContext(tn),l=f.useContext(rt),c=Vn();if((!a||!l)&&process.env.NODE_ENV!=="production"&&Se("TabsetCollapseButton must be rendered within a tabset (see renderTabsetToolbar)"),!c?.isCollapsible||c.isMaximized)return null;const{isCollapsed:u,isCollapsedToFit:d,selectedTabId:h}=c,g=Gn({children:t,className:n,style:s,title:r},{isCollapsed:u,isCollapsedToFit:d});return _.jsx("button",{"aria-controls":a&&h!==void 0?a.getTabPanelId(h):void 0,"aria-disabled":d||void 0,"aria-expanded":!u,"aria-label":e,type:"button",...i,className:g.className,onClick:p=>{if(o?.(p),!p.defaultPrevented&&!d&&a&&l){const m=l.id;u?a.updateModel("expand",!0,y=>Hn(y,m)):a.updateModel("collapse",!0,y=>oi(y,m))}},style:g.style,title:g.title,children:g.children})}const Cc=Object.assign(wc,{displayName:"TabsetCollapseButton"});function Tc({children:e,className:t,style:n,title:o,...s}){const r=f.useContext(rt),i=Vn();r||process.env.NODE_ENV!=="production"&&Se("TabsetDragHandle must be rendered within a tabset's header (see renderTabsetToolbar)");const a=i?.isDragDisabled??!0,l=Gn({children:e,className:t,style:n,title:o},{isDisabled:a});return _.jsx("div",{"data-disabled":a||void 0,"data-tabset-drag-handle":"",...s,className:l.className,style:a?l.style:{touchAction:"none",...l.style},title:l.title,children:l.children})}const zc=Object.assign(Tc,{displayName:"TabsetDragHandle"});function ri(e,t){return e.maximizedTabsetId===t||e.root.id===t||!nn(e.root).some(({id:n})=>n===t)?e:{...e,maximizedTabsetId:t}}function ii(e){if(e.maximizedTabsetId===void 0)return e;const t={...e};return delete t.maximizedTabsetId,t}function Ic({"aria-label":e="Maximize tabset",children:t,className:n,onClick:o,style:s,title:r,...i}){const a=f.useContext(tn),l=f.useContext(rt),c=Vn();if((!a||!l)&&process.env.NODE_ENV!=="production"&&Se("TabsetMaximizeButton must be rendered within a tabset (see renderTabsetToolbar)"),!c||c.isRoot||c.isFloating)return null;const{isMaximized:u}=c,d=Gn({children:t,className:n,style:s,title:r},{isMaximized:u});return _.jsx("button",{"aria-label":e,"aria-pressed":u,type:"button",...i,className:d.className,onClick:h=>{if(o?.(h),!h.defaultPrevented&&a&&l){const g=l.id;u?a.updateModel("restore",!0,ii):a.updateModel("maximize",!0,p=>ri(p,g))}},style:d.style,title:d.title,children:d.children})}const Ec=Object.assign(Ic,{displayName:"TabsetMaximizeButton"});function Rc(){return f.useContext(kt)}function Lc(){return f.useContext(rt)}const qn=f.createContext(null);function Dc(){return f.useContext(qn)}function ai(e){return Dn(e)&&yo(e.root)&&(e.floating===void 0||Array.isArray(e.floating)&&e.floating.every(t=>Dn(t)&&t.type==="tabset"&&yo(t)))}function Dn(e){return typeof e=="object"&&e!==null}function Xs(e){return e===void 0||typeof e=="string"}function yo(e){if(!Dn(e)||!Xs(e.id))return!1;switch(e.type){case"split":return(e.orientation==="horizontal"||e.orientation==="vertical")&&Array.isArray(e.children)&&e.children.every(yo);case"tabset":return Array.isArray(e.tabs)&&e.tabs.every(t=>Dn(t)&&typeof t.id=="string"&&Xs(t.title));default:return!1}}function Mc(e,t){const n=new Set,o=s=>{n.add(s.id),s.type==="split"&&s.children.forEach(o)};o(t);for(const s of e)s.id!==void 0&&n.add(s.id);return e.map((s,r)=>{let i=s.id;if(i===void 0){const a=`floating-${r}`;i=a;let l=1;for(;n.has(i);)l++,i=`${a}-${l}`;n.add(i)}return{...s,id:i,tabs:s.tabs.map(a=>({...a}))}})}function kc(e){const t=new Set,n=r=>{r.id!==void 0&&t.add(r.id),r.type==="split"&&r.children.forEach(n)};n(e);const o=(r,i)=>{if(r.id!==void 0)return r.id;const a=`${r.type}-${i.length>0?i.join("-"):"root"}`;let l=a,c=1;for(;t.has(l);)c++,l=`${a}-${c}`;return t.add(l),l},s=(r,i)=>r.type==="split"?{...r,children:r.children.map((a,l)=>s(a,[...i,l])),id:o(r,i)}:{...r,id:o(r,i),tabs:r.tabs.map(a=>({...a}))};return s(e,[])}function Pc(e){const t=new Set,n=s=>{t.has(s)&&process.env.NODE_ENV!=="production"&&Se(`Duplicate id found in workspace model: "${s}"`),t.add(s)},o=s=>{n(s.id),s.type==="split"?s.children.forEach(o):s.tabs.forEach(({id:r})=>n(r))};o(e.root),e.floating?.forEach(o)}function Mn(e){e.version!==1&&process.env.NODE_ENV!=="production"&&Se(`Unsupported workspace model version: ${e.version}`);const t=kc(e.root),n=Ae({floating:Array.isArray(e.floating)?Mc(e.floating,t):void 0,maximizedTabsetId:e.maximizedTabsetId,root:t});return process.env.NODE_ENV!=="production"&&Pc(n),n}function ci(e,{mapTab:t}={}){if(!ai(e)||e.version!==1)return null;if(!t)return Mn(e);const n=r=>r.flatMap(i=>{const a=t(i);return a?[a]:[]}),o=r=>r.type==="split"?{...r,children:r.children.map(o)}:{...r,tabs:n(r.tabs)},s={...e,floating:e.floating?.map(r=>({...r,tabs:n(r.tabs)})),root:o(e.root)};return Mn(s)}function Oc(e,t){const n=a=>t.head.append(a);for(const a of Array.from(e.querySelectorAll('link[rel~="stylesheet"], style'))){const l=a.nodeName==="STYLE"?Ks(a.sheet):void 0;n(l!==void 0?Js(t,l,a.getAttribute("media")??"",a.nonce):t.importNode(a,!0))}const o=a=>Array.from(e.querySelectorAll(a)).map(l=>l.nonce).find(Boolean),s=o("style, link[rel~='stylesheet']")??o("script");for(const a of e.adoptedStyleSheets??[]){const l=Ks(a);l!==void 0&&n(Js(t,l,a.media?.mediaText??"",s))}const r=e.defaultView?.MutationObserver;if(!r)return()=>{};const i=new r(a=>{for(const l of a)for(const c of l.addedNodes)Re(c)&&(c.nodeName==="STYLE"||c.nodeName==="LINK"&&/(^|\s)stylesheet(\s|$)/i.test(c.getAttribute("rel")??""))&&n(t.importNode(c,!0))});return i.observe(e.head,{childList:!0}),()=>i.disconnect()}function Ks(e){if(e)try{return Array.from(e.cssRules,t=>t.cssText).join(`
2
+ `)}catch{return}}function Js(e,t,n,o){const s=e.createElement("style");return o&&(s.nonce=o),n&&(s.media=n),s.textContent=t,s}function Ac(e,t,n){return e.screenX===t.screenX&&e.screenY===t.screenY?n:{screenX:e.screenX,screenY:e.screenY}}let Nc=0;function $c(e){const t=f.useRef(e);ue(()=>{t.current=e});const[n,o]=f.useState([]),s=f.useRef(new Map),r=f.useCallback((c,u)=>{if(!c.isClosed){if(c.isClosed=!0,c.dispose(),s.current.delete(c.popout.id),o(d=>d.filter(h=>h!==c)),u==="user"){const{onClose:d="dock",workspaceRef:h}=t.current,g=c.props.workspaceRef.current?.getModel()??c.model;if(typeof d=="function")d(g);else if(d==="dock"){const p=h.current,m=p?.getModel(),y=Tt(g),b=y.find(({selectedId:w})=>w!==void 0)?.selectedId;for(const w of y)for(const C of w.tabs)p?(Tt(m).some(({tabs:x})=>x.some(({id:T})=>T===C.id))||!p.addTab(C,{select:C.id===b}))&&process.env.NODE_ENV!=="production"&&Se(`usePopoutWindows: a popout window's tab "${C.id}" wasn't docked because the main workspace could not add it (e.g. a tab with the same id already exists)`):process.env.NODE_ENV!=="production"&&Se("usePopoutWindows: the workspaceRef is not set, so the tabs of a closed popout window can't be docked")}}c.popout.window.closed||c.popout.window.close()}},[]),i=f.useCallback(()=>{for(const c of Array.from(s.current.values()))r(c,"app")},[r]),a=f.useCallback(()=>Array.from(s.current.values(),c=>{const{window:u}=c.popout,{screenX:d,screenY:h}=Ac(u,window,c.openedAt);return{model:c.props.workspaceRef.current?.getModel()??c.model,rect:{height:u.innerHeight,screenX:d,screenY:h,width:u.innerWidth}}}),[]);f.useEffect(()=>{const c=()=>{try{s.current.size>0&&t.current.onCloseAll?.(a())}finally{i()}};return window.addEventListener("pagehide",c),()=>{window.removeEventListener("pagehide",c),c()}},[i,a]);const l=f.useCallback((c,u)=>{const d=ci(c);if(!d||Tt(d).every(({tabs:N})=>!N.length))return!1;const{height:h,screenX:g,screenY:p,width:m}=u,y=window.open("","",[`left=${Math.round(g)}`,`top=${Math.round(p)}`,`width=${Math.round(m)}`,`height=${Math.round(h)}`].join(","));if(!y)return!1;const{copyStyles:b=!0,onOpen:w}=t.current,C=b?Oc(document,y.document):()=>{},x=y.document.createElement("div");y.document.body.append(x);const T={dispose:()=>{C(),y.removeEventListener("pagehide",z)},isClosed:!1,model:d,openedAt:{screenX:Math.round(g),screenY:Math.round(p)},popout:{container:x,id:`popout-${Nc++}`,window:y},props:{defaultModel:d,onModelChanged:N=>{T.model=N,Tt(N).every(({tabs:H})=>!H.length)&&r(T,"empty")},workspaceRef:{current:null}}},z=()=>r(T,"user");y.addEventListener("pagehide",z),s.current.set(T.popout.id,T),o(N=>[...N,T]);try{w?.(T.popout)}catch(N){throw r(T,"app"),N}return!0},[r]);return f.useMemo(()=>({closeAll:i,getState:a,open:l,popouts:n.map(({popout:c})=>c),render:c=>n.map(({popout:u,props:d})=>xr.createPortal(c(d,u),u.container,u.id))}),[i,n,a,l])}function jc(){const e=f.useContext(qn),t=f.useContext(rt)?.id,n=f.useCallback(s=>e&&t!==void 0?e.subscribeToTabListFreeSpace(t,s):()=>{},[t,e]),o=()=>e&&t!==void 0?e.getTabListFreeSpace(t):void 0;return f.useSyncExternalStore(n,o,Bc)}function Bc(){}const li=[];function Fc({includePartiallyVisible:e=!1}={}){const t=f.useContext(qn),n=f.useContext(rt)?.id,o=f.useCallback(r=>t&&n!==void 0?t.subscribeToTabListOverflow(n,r,{includePartiallyVisible:e}):()=>{},[e,n,t]),s=()=>(t&&n!==void 0?t.getTabListOverflow(n,{includePartiallyVisible:e}):void 0)??li;return f.useSyncExternalStore(o,s,_c)}function _c(){return li}function Wc(){return f.useState(null)}function Gc(){return f.useRef(null)}const ui=f.createContext(null);function Vc(e,{getChromeSize:t,getCollapsedSize:n,getContentMaximumSize:o,getContentMinimumSize:s,getSeparatorsSize:r}){const i=new Map,a=new Map,l=new Map,c=d=>{let h,g;if(d.type==="tabset"){const p=t(d.id)??{height:0,width:0},m=s(d),y=o(d);i.set(d.id,y),g={height:m.height+p.height,width:m.width+p.width},h={height:y.height+p.height,width:y.width+p.width}}else{const p=d.orientation==="horizontal"?"width":"height",m=p==="width"?"height":"width",y=r(d.id)??0;let b=0,w=0,C=0,x=1/0;for(const T of d.children){const z=c(T);if(T.type==="tabset"&&T.collapsed){const N=n(T.id)??0;b+=N,C+=N,x=Math.min(x,z.max[m])}else b+=z.min[p],w=Math.max(w,z.min[m]),C+=z.max[p],x=Math.min(x,z.max[m])}g={[p]:b+y,[m]:w},h={[p]:C+y,[m]:x}}return l.set(d.id,g),a.set(d.id,h),{max:h,min:g}},u=(d,h)=>{const g=a.get(d.id);if(d.type==="tabset"){const p=i.get(d.id);for(const m of["height","width"])!h[m]&&Number.isFinite(p[m])&&process.env.NODE_ENV!=="production"&&Se(`Tabset "${d.id}" can't be limited to its ${m==="height"?"maxHeight":"maxWidth"}, since nothing else can take up the rest of the space (e.g. every other tabset in its split has a maximum ${m}, or it fills the workspace)`)}else{const p=d.orientation==="horizontal"?"width":"height",m=p==="width"?"height":"width",y=d.children.filter(b=>!(b.type==="tabset"&&b.collapsed)&&!Number.isFinite(a.get(b.id)[p])).map(({id:b})=>b);for(const b of d.children){const w=y.some(C=>C!==b.id);u(b,{[p]:w||h[p],[m]:h[m]})}}a.set(d.id,{height:h.height?g.height:1/0,width:h.width?g.width:1/0})};return c(e),u(e,{height:!1,width:!1}),{maximumSizes:a,minimumSizes:l}}function _t(e,t){return e===void 0||t===void 0?e===t:"edge"in e||"edge"in t?"edge"in e&&"edge"in t&&e.edge===t.edge:e.tabsetId!==t.tabsetId?!1:"index"in e&&"index"in t?e.index===t.index:"region"in e&&"region"in t?e.region===t.region:!1}function Hc(){const e=new Zt;let t={dragSource:void 0,dropTarget:void 0};return{getState:()=>t,setDragSource:n=>{t.dragSource!==n&&(t={...t,dragSource:n},e.emit("change",void 0))},setDropTarget:n=>{_t(t.dropTarget,n)||(t={...t,dropTarget:n},e.emit("change",void 0))},subscribe:n=>e.addListener("change",n)}}function Zs(e=Object.is){const t=new Map,n=new Map,o=new Map,s=(r,i)=>{const a=t.get(r);if(a===i||a!==void 0&&i!==void 0&&e(a,i))return;i===void 0?t.delete(r):t.set(r,i);const l=n.get(r);if(!l)return;let c;for(const u of Array.from(l))try{u(i)}catch(d){c??={error:d}}if(c)throw c.error};return{get:r=>t.get(r),retain:r=>(o.set(r,(o.get(r)??0)+1),()=>{o.set(r,o.get(r)-1),queueMicrotask(()=>{o.get(r)||(o.delete(r),s(r,void 0))})}),set:s,subscribe:(r,i)=>{let a=n.get(r);return a||(a=new Set,n.set(r,a)),a.add(i),()=>{a.delete(i),a.size===0&&n.get(r)===a&&n.delete(r)}}}}function ro(e,t){return t?.includePartiallyVisible?e?.hiddenOrClipped:e?.hidden}function qc(){const e=new Map;return{get:t=>{const n=e.get(t);if(n){for(const o of n)if(o.tabset)return o}},register:(t,n)=>{let o=e.get(t);o||(o=new Set,e.set(t,o)),o.add(n);const s=o;return()=>{s.delete(n),s.size===0&&e.get(t)===s&&e.delete(t)}}}}function Yc(e,t,n){const o=new Zt;let s=e,r=e;return{getState:()=>r,getTabPanelId:n,notify:()=>{s!==r&&(s=r,o.emit("change",void 0))},setState:i=>{r=i},subscribe:i=>o.addListener("change",i),updateModel:t}}function kn(e,t){const n=ut(e,t);if(!n||n.selectedId===t)return e;const o=$e(e),s=ut(o,t);return s&&(s.selectedId=t),o}function Uc(e,t,{index:n,select:o=!0,tabsetId:s}={}){if(Yt(e,t.id))return{added:!1,model:kn(e,t.id)};const r=$e(e);let i=Me(r,s);i||(s!==void 0&&process.env.NODE_ENV!=="production"&&Se(`Tabset "${s}" not found in workspace model; adding tab to the first tabset instead`),i=nn(r.root)[0]);const a=n===void 0?i.tabs.length:Math.max(0,Math.min(n,i.tabs.length));return i.tabs.splice(a,0,{...t}),(o||i.selectedId===void 0)&&(i.selectedId=t.id),{added:!0,model:Ae(r)}}function io(e,t){if(!Me(e,t))return e;const n=$e(e),o=Me(n,t);return o&&(o.tabs=[],o.selectedId=void 0,delete o.keepWhenEmpty),Ae(n)}function Pt(){return Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")}function Xc(e,t){let n;if(t.type==="tab"){const o=Yt(e,t.tabId);if(!o)return;n={id:Pt(),selectedId:o.id,tabs:[{...o}],type:"tabset"}}else{const o=Me(e,t.tabsetId);if(!o)return;const{height:s,width:r,x:i,y:a,...l}=qt(o);n=l,delete n.collapsed,delete n.size}return Ae({root:n})}function Ut(e,t){return{id:Pt(),selectedId:e[0]?.id,size:t,tabs:e,type:"tabset"}}function Kc(e,t,n){const o=ut(e,t);if(!o||on(e,o)&&o.tabs.length===1&&!o.keepWhenEmpty)return e;const s=$e(e),r=ut(s,t),i=r?.tabs.find(({id:u})=>u===t);if(!r||!i)return e;Rn(r,t);const{size:a,...l}=Ut([i]),c={...l,...n};return s.floating=[...s.floating??[],c],Ae(s)}function Jc(e,t,n){const o=Me(e,t);if(!o||on(e,o))return e;const s=$e(e),r=Me(s,t),i=gt(s.root,t);if(!r||!i)return e;i.children.splice(i.children.indexOf(r),1);const{collapsed:a,collapsible:l,size:c,...u}=r,d={...u,...n};return s.floating=[...s.floating??[],d],s.maximizedTabsetId===t&&delete s.maximizedTabsetId,Ae(s)}function Qs(e){return ai(e)?e:(process.env.NODE_ENV!=="production"&&Se("Invalid workspace model; using an empty workspace instead"),{root:{tabs:[],type:"tabset"},version:1})}function vo(e,t,n){const{nodeIds:o,tabsetsByTabId:s}=Ee(e),r=a=>o.has(a)||s.has(a);return t.type==="tab"?r(t.tab.id):("edge"in n||"region"in n&&n.region!=="center")&&r(t.tabset.id)||t.tabset.tabs.some(({id:a})=>r(a))}function Zc(e,t,n,o){const s=o==="left"||o==="right"?"horizontal":"vertical",r=o==="left"||o==="top",i=gt(e,t.id);if(i&&i.orientation===s){const l=i.children.indexOf(t);return typeof t.size=="number"?(t.size/=2,n.size=t.size):n.size=void 0,i.children.splice(r?l:l+1,0,n),e}const a={children:r?[n,t]:[t,n],id:Pt(),orientation:s,size:t.size,type:"split"};return t.size=50,n.size=50,i?(i.children[i.children.indexOf(t)]=a,e):a}function Yn(e,t,n,o,{expandCollapsedDestination:s=!0}={}){if("index"in o||o.region==="center"){const r="index"in o?Math.max(0,Math.min(o.index,t.tabs.length)):t.tabs.length;if(t.tabs.splice(r,0,...n.tabs),t.selectedId=n.selectedId??n.tabs[0].id,n.recentTabIds&&(t.recentTabIds=[...t.recentTabIds??[],...n.recentTabIds]),t.collapsed&&s){const i=Ae(e);return si(i,t.id)?Ae(i):i}}else delete n.collapsed,e.root=Zc(e.root,t,n,o.region),e.maximizedTabsetId===t.id&&(e.maximizedTabsetId=void 0);return Ae(e)}function Xt(e,t,n){const o=n==="left"||n==="right"?"horizontal":"vertical",s=n==="left"||n==="top";delete t.collapsed;const r=Ae(e),{root:i}=r;if(i.type==="split"&&i.orientation===o){const a=i.children.filter(l=>l.type!=="tabset"||!l.collapsed);t.size=a.every(({size:l})=>typeof l=="number")?100/a.length:void 0,s?i.children.unshift(t):i.children.push(t)}else{i.size=50,t.size=50;const a={children:s?[t,i]:[i,t],id:Pt(),orientation:o,type:"split"};r.root=a}return Ae(r)}function Un(e,t,n){return"region"in n&&n.region!=="center"&&on(e,t)?{region:"center",tabsetId:n.tabsetId}:n}function Qc(e,t,n){const o=$e(e);if("edge"in n)return Xt(o,Ut([{...t}]),n.edge);const s=Me(o,n.tabsetId);return s?Yn(o,s,Ut([{...t}]),Un(o,s,n)):e}function el(e,t,n){const o=$e(e),s=qt(t);if(delete s.size,"edge"in n)return Xt(o,s,n.edge);const r=Me(o,n.tabsetId);if(!r)return e;const i=Un(o,r,n);return("index"in i||i.region==="center")&&t.tabs.length===0?e:Yn(o,r,s,i)}function Ho(e,t,n){if(e.type==="tabset")return e.id===t.id;const o=n==="left"||n==="right"?"horizontal":"vertical";return e.orientation!==o?!1:(n==="left"||n==="top"?e.children[0]:e.children[e.children.length-1])?.id===t.id}function So(e,t,n){const o=$e(e),s=ut(o,t);if(!s)return e;const r=s.tabs.findIndex(({id:u})=>u===t),i=s.tabs[r];if("edge"in n)return s.tabs.length===1&&!s.keepWhenEmpty&&Ho(o.root,s,n.edge)?e:(Rn(s,t),Xt(o,Ut([i]),n.edge));const a=Me(o,n.tabsetId);if(!a)return e;const l=Un(o,a,n);let c=l;if("index"in l||l.region==="center"){if(s===a){let u="index"in l?Math.max(0,Math.min(l.index,a.tabs.length)):a.tabs.length;if(u>r&&u--,u===r&&a.selectedId===t)return e;c={index:u,tabsetId:a.id}}}else if(s===a&&s.tabs.length===1&&!s.keepWhenEmpty)return e;return Rn(s,t),Yn(o,a,Ut([i]),c,{expandCollapsedDestination:s!==a})}function er(e,t){const n=e.floating?.indexOf(t)??-1;if(!e.floating||n<0)return;const[o]=e.floating.splice(n,1),{height:s,width:r,x:i,y:a,...l}=o;return l}function xo(e,t,n){const o=$e(e),s=Me(o,t);if(!s)return e;if("edge"in n){const l=er(o,s);if(l)return Xt(o,l,n.edge);const c=gt(o.root,s.id);return!c||Ho(o.root,s,n.edge)?e:(c.children.splice(c.children.indexOf(s),1),Xt(o,s,n.edge))}const r=Me(o,n.tabsetId);if(!r||s===r)return e;const i=Un(o,r,n);let a;if("index"in i||i.region==="center"){if(s.tabs.length===0)return e;a={...s},s.tabs=[],s.selectedId=void 0}else{const l=er(o,s);if(l)a=l;else{const c=gt(o.root,s.id);if(!c)return e;c.children.splice(c.children.indexOf(s),1),a=s}}return Yn(o,r,a,i)}function tl(e,t,n){if(!Yt(e,t))return e;const o=$e(e),s=Yt(o,t);return s&&Object.assign(s,n),o}function ao(e,t){const n=wo(e.root,t),o=e.floating?.map(r=>wo(r,t)),s=!!o?.some((r,i)=>r!==e.floating?.[i]);return n===e.root&&!s?e:s?{...e,floating:o,root:n}:{...e,root:n}}function wo(e,t){if(e.type==="split"){const s=e.children.map(r=>wo(r,t));return s.every((r,i)=>r===e.children[i])?e:{...e,children:s}}const n=e.recentTabIds,o=e.selectedId;if(t==="adjacent"||o===void 0){if(n===void 0)return e;const{recentTabIds:s,...r}=e;return r}return n?.[0]===o?e:{...e,recentTabIds:[o,...(n??[]).filter(s=>s!==o)]}}function di(e,t,n){if(!Me(e,t))return e;const o=$e(e),s=Me(o,t);if(s)if(on(o,s))Object.assign(s,n);else{const{height:r,width:i,x:a,y:l,...c}=n;Object.assign(s,c)}return Ae(o)}const fi=f.createContext(null);function ft(e){const t=f.useContext(ui);return ce(t,`${e} must be rendered within a Workspace`),t}function Xn(e){const t=f.useContext(fi);return ce(t,`${e} must be rendered within a tabset`),t}const nl=f.memo(function({render:t,tab:n}){return t(n)},(e,t)=>e.render===t.render&&e.tab.id===t.tab.id&&e.tab.data===t.tab.data&&e.tab.title===t.tab.title&&e.tab.disableClose===t.tab.disableClose&&e.tab.disableDrag===t.tab.disableDrag),ol=Object.assign(nl,{displayName:"Workspace.MemoizedContent"});function sl({hiddenTabBehavior:e,renderTabContent:t,tab:n}){const{classNames:o,getTabHandle:s,getTabHost:r,getTabsetHandle:i,modelIndex:a,styles:l}=ft("TabContent"),c=a.tabsetsByTabId.get(n.id);if(!c)return null;const u=c.selectedId===n.id;let d=null;if((e!=="unmount"||u)&&(d=_.jsx(ol,{render:t,tab:n}),e==="activity")){const p=Zi.Activity;p?d=_.jsx(p,{mode:u?"visible":"hidden",children:d}):process.env.NODE_ENV!=="production"&&Se('hiddenTabBehavior "activity" requires React 19.2 or newer; falling back to "keep-mounted"')}const{panelId:h,tabElementId:g}=r(n.id);return _.jsx("div",{"aria-labelledby":g,className:o?.tabContent,"data-tab-content":"",id:h,role:"tabpanel",style:l?.tabContent,children:_.jsx(rt.Provider,{value:i(c.id),children:_.jsx(kt.Provider,{value:s(n.id),children:d})})})}const pi=Object.assign(sl,{displayName:"Workspace.TabContent"});function hi(e,t,n){return n.width<=0||n.height<=0?e:{x:tr(e.x,t.left,t.width,n.width),y:tr(e.y,t.top,t.height,n.height)}}function tr(e,t,n,o){return Math.max(0-t,Math.min(e,o-n-t))}function Co(e,t){return Array.from(e.querySelectorAll(t)).find(n=>n.closest("[data-tabset-id]")===e)}function mi(e){const t=e.querySelector("[data-tabset-id]"),n=t?Co(t,"[data-tabset-header]"):void 0;if(!n)return;const o=Te(e,"horizontal"),s=Te(e,"vertical"),r=e.getBoundingClientRect(),i=n.getBoundingClientRect();return{height:i.height/s,left:(i.left-r.left)/o,top:(i.top-r.top)/s,width:i.width/o}}const rl=3,To="data-floating-gesture",gi={bottom:"ns-resize","bottom-left":"nesw-resize","bottom-right":"nwse-resize",left:"ew-resize",right:"ew-resize",top:"ns-resize","top-left":"nwse-resize","top-right":"nesw-resize"};function il({getMinimumSize:e,updateModel:t}){const n=f.useRef(null);return f.useEffect(()=>()=>n.current?.(),[]),f.useCallback((o,s,r)=>{const i=cl(r.currentTarget,o),a=i?.parentElement;if(!i||!a)return;n.current?.();const l=r.currentTarget,c=l.ownerDocument,u=c.defaultView,{clientX:d,clientY:h,pointerId:g}=r;l.setPointerCapture?.(g);const p=Te(i,"horizontal"),m=Te(i,"vertical"),y={height:a.offsetHeight,width:a.offsetWidth},b={height:i.offsetHeight,width:i.offsetWidth,x:i.offsetLeft,y:i.offsetTop},w=mi(i)??{height:0,left:0,top:0,width:0},C=e(o),x=al(s),T=Object.fromEntries(x.map(W=>[W,i.style[co[W]]])),z={cursor:c.documentElement.style.cursor,userSelect:c.body.style.userSelect};let N=!1,H=b;const L=W=>{if(W.pointerId!==g)return;const{clientX:V,clientY:M}=W;if(!N){if(Math.hypot(V-d,M-h)<rl)return;N=!0,i.setAttribute(To,""),c.body.style.userSelect="none",s!=="move"&&(c.documentElement.style.cursor=gi[s])}const I=(V-d)/p,ee=(M-h)/m;H=s==="move"?{...b,...hi({x:b.x+I,y:b.y+ee},w,y)}:ll(b,s,I,ee,C,y);for(const se of x)i.style[co[se]]=`${H[se]}px`},R=W=>{if(n.current=null,c.removeEventListener("pointermove",L),c.removeEventListener("pointerup",A),c.removeEventListener("pointercancel",$),c.removeEventListener("keydown",J,!0),u?.removeEventListener("blur",U),i.removeAttribute(To),!!N)if(c.body.style.userSelect=z.userSelect,c.documentElement.style.cursor=z.cursor,zn(c),W){const V=Object.fromEntries(x.map(M=>[M,Math.round(H[M])]));t(s==="move"?"move":"resize",!0,M=>Ee(M).floatingTabsetIds.has(o)?di(M,o,V):M)}else for(const V of x)i.style[co[V]]=T[V]??""},A=W=>{W.pointerId===g&&R(!0)},$=W=>{W.pointerId===g&&R(!1)},J=W=>{W.key==="Escape"&&(N&&(W.preventDefault(),W.stopPropagation()),R(!1))},U=()=>R(!1);n.current=()=>R(!1),c.addEventListener("pointermove",L),c.addEventListener("pointerup",A),c.addEventListener("pointercancel",$),c.addEventListener("keydown",J,!0),u?.addEventListener("blur",U)},[e,t])}const co={height:"height",width:"width",x:"left",y:"top"};function al(e){if(e==="move")return["x","y"];const t=[];return e.includes("left")?t.push("x","width"):e.includes("right")&&t.push("width"),e.includes("top")?t.push("y","height"):e.includes("bottom")&&t.push("height"),t}function cl(e,t){let n=e.closest("[data-floating-tabset]");for(;n&&n.dataset.floatingTabset!==t;)n=n.parentElement?.closest("[data-floating-tabset]")??null;return n}function ll(e,t,n,o,s,r){let{height:i,width:a,x:l,y:c}=e;const u=e.x+e.width,d=e.y+e.height;return t.includes("left")?(l=Math.max(Math.min(e.x+n,u-s.width),Math.min(0,e.x)),a=u-l):t.includes("right")&&(a=Math.min(Math.max(e.width+n,s.width),Math.max(r.width-e.x,e.width))),t.includes("top")?(c=Math.max(Math.min(e.y+o,d-s.height),Math.min(0,e.y)),i=d-c):t.includes("bottom")&&(i=Math.min(Math.max(e.height+o,s.height),Math.max(r.height-e.y,e.height))),{height:i,width:a,x:l,y:c}}const qo="application/x-react-resizable-panels-workspace",ul=.25;function bi(e,t,n){const o=e.width>0?(t-e.left)/e.width:.5,s=e.height>0?(n-e.top)/e.height:.5,r={bottom:1-s,left:o,right:1-o,top:s},i=Object.keys(r).reduce((a,l)=>r[l]<r[a]?l:a,"left");return r[i]<ul?i:"center"}function ct(e){return e?.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl"}function yi(e,t,n){const o=e.dataset.orientation==="vertical",s=!o&&ct(e),r=Array.from(e.querySelectorAll("[data-tab]")).filter(a=>a.closest("[data-tab-list]")===e),i=r.findIndex(a=>{const l=a.getBoundingClientRect();if(o)return n<l.top+l.height/2;const c=l.left+l.width/2;return s?t>c:t<c});return i===-1?r.length:i}const nr=16;function dl({clientX:e,clientY:t,element:n,layoutElement:o,rootElement:s}){const r=Te(s,"horizontal"),i=Te(s,"vertical"),a=s.getBoundingClientRect(),l=s.ownerDocument.defaultView?.getComputedStyle(s),c=b=>parseFloat(l?.[`border${b}Width`]??"")||0;if(e<a.left+c("Left")*r||e>a.right-c("Right")*r||t<a.top+c("Top")*i||t>a.bottom-c("Bottom")*i)return;const u=o.getBoundingClientRect(),d={bottom:u.bottom-t,left:e-u.left,right:u.right-e,top:t-u.top},h=fl(n,s),g=h?0:nr*r,p=h?0:nr*i,m={bottom:p,left:g,right:g,top:p};let y;for(const b of Object.keys(d))d[b]<m[b]&&(y===void 0||d[b]<d[y])&&(y=b);return y}function fl(e,t){return e.closest("[data-tabset-header]")?.closest("[data-workspace]")===t}function zt(e,t){if(!t||"index"in e)return e;if("edge"in e)switch(e.edge){case"left":return{edge:"right"};case"right":return{edge:"left"};default:return e}switch(e.region){case"left":return{...e,region:"right"};case"right":return{...e,region:"left"};default:return e}}function Wt({clientX:e,clientY:t,isExternal:n=!1,model:o,rootElement:s,source:r,tabsetElements:i}){const a=s.getRootNode(),l=(Ar(a)?a:s.ownerDocument).elementFromPoint(e,t);if(!l||!s.contains(l))return;const c=Ee(o),u=pl({clientX:e,clientY:t,element:l,isExternal:n,model:o,rootElement:s,source:r});if(u)return{edge:u};let d=l.closest("[data-tabset-id]");for(;d&&d.closest("[data-workspace]")!==s;)d=d.parentElement?.closest("[data-tabset-id]")??null;const h=d?.dataset.tabsetId,g=h!==void 0?c.tabsetsById.get(h):void 0;if(!d||!g||o.maximizedTabsetId!==void 0&&o.maximizedTabsetId!==g.id&&!c.floatingTabsetIds.has(g.id))return;const p=i?.get(g.id),{tabList:m,tabPanels:y}=p?.tabset===d?{tabList:p.tabList,tabPanels:p.panels}:{tabList:Co(d,"[data-tab-list]"),tabPanels:Co(d,"[data-tab-panels]")},b=(g.tabs.length>0||!!g.keepWhenEmpty)&&!c.floatingTabsetIds.has(g.id);if(r.type==="tabset")return gl({clientX:e,clientY:t,element:l,isExternal:n,isMoveOnly:!n&&!!c.tabsetsById.get(r.tabsetId)?.keepWhenEmpty,isSplittable:b,sourceTabsetId:r.tabsetId,tabList:m,tabPanels:y,tabsetId:g.id});if(m?.contains(l))return{index:yi(m,e,t),tabsetId:g.id};if(y?.contains(l)){const w=!n&&g.tabs.some(({id:T})=>T===r.tabId),x=b&&(!!g.keepWhenEmpty||!(g.tabs.length===1&&w))?bi(y.getBoundingClientRect(),e,t):"center";return x==="center"&&w?void 0:{region:x,tabsetId:g.id}}}function pl({clientX:e,clientY:t,element:n,isExternal:o,model:s,rootElement:r,source:i}){if(s.maximizedTabsetId!==void 0||s.root.type!=="split"||hl(n,r))return;const a=ml(r),l=a?dl({clientX:e,clientY:t,element:n,layoutElement:a,rootElement:r}):void 0;if(!l||o)return l;const c=zt({edge:l},ct(r)),u="edge"in c?c.edge:l,d=Ee(s),h=i.type==="tabset"?d.tabsetsById.get(i.tabsetId):d.tabsetsByTabId.get(i.tabId);if(!(h&&(i.type==="tabset"||h.tabs.length===1&&!h.keepWhenEmpty)&&Ho(s.root,h,u)))return l}function hl(e,t){let n=e.closest("[data-floating-tabset]");for(;n;){if(n.closest("[data-workspace]")===t)return!0;n=n.parentElement?.closest("[data-floating-tabset]")??null}return!1}function ml(e){return Array.from(e.children).find(t=>t.hasAttribute("data-workspace-layout"))}function gl({clientX:e,clientY:t,element:n,isExternal:o,isMoveOnly:s,isSplittable:r,sourceTabsetId:i,tabList:a,tabPanels:l,tabsetId:c}){if(!(!o&&c===i)){if(a?.contains(n))return s?void 0:{index:yi(a,e,t),tabsetId:c};if(l?.contains(n)){const u=r?bi(l.getBoundingClientRect(),e,t):"center";return u==="center"&&s?void 0:{region:u,tabsetId:c}}}}function bl(e){switch(e){case"all":case"copy":case"copyLink":case"copyMove":case"uninitialized":return"copy";case"linkMove":case"move":return"move";case"link":return"link";default:return}}const yl=100;function vl({areDropsDisabled:e,dragStore:t,getAcceptExternalDrop:n,getModel:o,isEnabled:s,isNewTabDropDisabled:r,onNewTabDrop:i,rootElement:a,tabsetElements:l}){const[c,u]=f.useState(!1);return f.useEffect(()=>{if(!s||!a)return;const d=a.ownerDocument;let h=!1,g;const p=()=>{clearTimeout(g),h&&(h=!1,u(!1),t.setDropTarget(void 0))},m=x=>{const T=n(),z=Array.from(x.dataTransfer?.types??[],N=>N.toLowerCase());return!!T&&!z.includes(qo)&&T.types.some(N=>z.includes(N.toLowerCase()))},y=x=>{const T=x.composedPath()[0];if(!(typeof T?.closest!="function"||T.closest("[data-workspace]")!==a||e()))return Wt({clientX:x.clientX,clientY:x.clientY,isExternal:!0,model:o(),rootElement:a,source:{tabId:"",type:"tab"},tabsetElements:l})},b=x=>{if(!m(x))return;clearTimeout(g),h||(h=!0,u(!0));const T=bl(x.dataTransfer?.effectAllowed??"uninitialized"),z=x.defaultPrevented||!T?void 0:y(x);z&&T&&x.dataTransfer&&(x.preventDefault(),x.dataTransfer.dropEffect=T),t.setDropTarget(z)},w=()=>{h&&(clearTimeout(g),g=setTimeout(p,yl))},C=x=>{if(!m(x)||x.defaultPrevented)return;const T=y(x),{dataTransfer:z}=x;if(!T||!z)return;x.preventDefault();const N=n()?.createTab(z,T);N&&!r(N,T)&&i(N,T)};return d.addEventListener("dragenter",b),d.addEventListener("dragover",b),d.addEventListener("dragleave",w),d.addEventListener("drop",p,!0),d.addEventListener("drop",C),()=>{p(),d.removeEventListener("dragenter",b),d.removeEventListener("dragover",b),d.removeEventListener("dragleave",w),d.removeEventListener("drop",p,!0),d.removeEventListener("drop",C)}},[e,t,n,o,s,r,i,a,l]),c}let zo=null;const Yo=new Zt;function Cn(){return zo}function at(e){zo!==e&&(zo=e,Yo.emit("change",e))}function vi(e,t){e.lastDocument!==t&&(e.lastDocument=t,Yo.emit("change",e))}function Si(e){return Yo.addListener("change",e)}const Sl="react-resizable-panels-workspace",Kt=1,xl=50,wl=5e3;let It=null,or=0,lo=null,Et=null;const Uo=new Map;let uo={id:"",time:0};function Kn(e){try{return It?.postMessage(e),It!==null}catch{return!1}}function xi(){if(Et){const{id:e}=Et;Et=null,Kn({id:e,type:"end",version:Kt}),setTimeout(()=>Uo.delete(e),wl)}}function Cl(e){Et&&e!==Et&&xi()}function Tl(e){const t=e.data;if(t?.version!==Kt)return;const n=Cn();switch(t.type){case"start":{const{dragGroup:o,id:s,node:r,source:i}=t;at({dragGroup:o,hasSource:()=>!0,id:s,isDropped:!1,isRemote:!0,isShared:!0,lastCopyEvent:void 0,lastDocument:void 0,lastDragover:void 0,lastMoveStep:0,lastRemoteDragoverTime:Date.now(),node:r,previewOwners:new Map,removeFromSource:()=>Kn({id:s,type:"remove",version:Kt}),source:i,sourceOwner:{}});break}case"over":{n?.id===t.id&&(n.lastRemoteDragoverTime=Date.now(),vi(n,void 0));break}case"remove":{const o=Uo.get(t.id);o&&!o.isDropped&&(o.isDropped=!0,n===o&&at(null),o.removeFromSource());break}case"end":{n?.isRemote&&n.id===t.id&&at(null);break}}}function zl(){if(typeof BroadcastChannel>"u")return()=>{};or++===0&&(It=new BroadcastChannel(Sl),It.addEventListener("message",Tl),lo=Si(Cl));let e=!0;return()=>{e&&(e=!1,--or===0&&(It?.close(),It=null,lo?.(),lo=null))}}function Il(e){xi();const{dragGroup:t,id:n,node:o,source:s}=e;return Kn({dragGroup:t,id:n,node:o,source:s,type:"start",version:Kt})?(e.isShared=!0,Et=e,Uo.set(n,e),!0):!1}function El(e){const t=Date.now();e.isShared&&(uo.id!==e.id||t-uo.time>=xl)&&(uo={id:e.id,time:t},Kn({id:e.id,type:"over",version:Kt}))}const sr=new WeakMap;function Io(e,t){if(!e)return;let n=sr.get(e);if(!n){const{margin:r,translate:i}=e.style;e.style.margin="0",e.style.transform="none",e.style.translate="none";const a=e.getBoundingClientRect();n={scaleX:Te(e,"horizontal"),scaleY:Te(e,"vertical"),x:a.left,y:a.top},sr.set(e,n),e.style.margin=r,e.style.translate=i}const o=(t.clientX-n.x)/n.scaleX,s=(t.clientY-n.y)/n.scaleY;e.style.transform=`translate(${o}px, ${s}px)`}function wi(e){const t=e?.navigator,n=t?.userAgentData?.platform??t?.platform??"";return/mac|iphone|ipad|ipod/i.test(n)?"Alt":"Control"}const Rl="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",rr=new WeakMap;function ir(e){let t=rr.get(e);return t||(t=e.createElement("img"),t.src=Rl,rr.set(e,t)),t}function ar(e,t){return wi(t)==="Alt"?e.altKey:e.ctrlKey}const cr=250,Ll=20;function Dl(e,t){const{isDropped:n,lastDragover:o,lastMoveStep:s,lastRemoteDragoverTime:r}=e;if(n||!o||t-o.time<cr||t-r<cr)return!1;const{clientX:i,clientY:a,view:l}=o;return Math.min(i,a,l.innerWidth-i,l.innerHeight-a)<=Math.max(s*2,Ll)}function Ml(e,t,n){return e?t<0||n<0||t>=e.innerWidth||n>=e.innerHeight:!1}function lr(e){return{clientX:e.clientX,clientY:e.clientY,element:e.currentTarget,pointerId:e.pointerId,pointerType:e.pointerType}}const kl=5,ur=e=>`${qo};id=${e}`;function Pl({canCopy:e,canTearOff:t,disableDragBetweenApps:n,dragGroup:o,dragStore:s,getDragNode:r,getModel:i,getRootElement:a,isDropDisabled:l,isExternalDropDisabled:c,isNewTabDropDisabled:u,onDrop:d,onNewTabDrop:h,onTearOff:g,onTransferIn:p,onTransferOut:m,rootElement:y,tabsetElements:b}){const[w,C]=f.useState(),x=f.useCallback(k=>{C(k),s.setDragSource(k)},[s]),T=s.setDropTarget,[z,N]=f.useState(!1),[H,L]=f.useState(!1),[R,A]=f.useState(),[$,J]=f.useState(!1),[U,W]=f.useState(),[V,M]=f.useState(!1),[I]=f.useState(()=>({})),ee=f.useRef(null),se=f.useRef({clientX:0,clientY:0}),Y=f.useRef(null);f.useEffect(()=>()=>Y.current?.(),[]);const ae=f.useCallback((k,E,O)=>{const j=E.ownerDocument,F=E.getAttribute("draggable");E.draggable=!0;let B=null;const X=()=>{Y.current===ye&&(Y.current=null),E.removeEventListener("dragstart",re),E.removeEventListener("dragend",K),j.removeEventListener("pointerup",ne),j.removeEventListener("pointercancel",ne),F===null?E.removeAttribute("draggable"):E.setAttribute("draggable",F)},Z=q=>{const G=q.target;return G===E||!!G&&E.contains(G)&&G.getAttribute?.("draggable")!=="true"},re=q=>{if(!Z(q)){X();return}j.removeEventListener("pointerup",ne),j.removeEventListener("pointercancel",ne);const G=r(k),{dataTransfer:le}=q;if(!G||!le){q.preventDefault(),X();return}le.effectAllowed="copyMove";const ie=Pt();le.setData(qo,""),le.setData(ur(ie),""),le.setDragImage(ir(j),0,0),B={dragGroup:O,hasSource:()=>r(k)!==void 0,id:ie,isDropped:!1,isRemote:!1,isShared:!1,lastCopyEvent:void 0,lastDocument:j,lastDragover:void 0,lastMoveStep:0,lastRemoteDragoverTime:0,node:G,previewOwners:new Map([[j,I]]),removeFromSource:()=>m(k),source:k,sourceOwner:I},se.current={clientX:q.clientX,clientY:q.clientY},x(k),J(!0),W(G),n||Il(B),at(B)},K=q=>{if(!Z(q))return;const G=B;if(X(),!(!G||Cn()!==G)&&(at(null),t(k)&&Dl(G,Date.now()))){const{lastDragover:le}=G,ie=q.screenX===0&&q.screenY===0;g(k,ie&&le?{screenX:le.view.screenX+le.clientX,screenY:le.view.screenY+le.clientY}:{screenX:q.screenX,screenY:q.screenY})}},ne=()=>X(),ye=()=>{X(),B&&Cn()===B&&at(null)};Y.current=ye,E.addEventListener("dragstart",re),E.addEventListener("dragend",K),j.addEventListener("pointerup",ne),j.addEventListener("pointercancel",ne)},[t,n,r,g,m,I,x]);f.useEffect(()=>{if(o===void 0||!y)return;const k=y.ownerDocument,E=k.defaultView;ir(k);const O=n?void 0:zl(),j=q=>{const G=Cn();return G?.dragGroup!==o||G.isRemote&&(n||!Array.from(q.dataTransfer?.types??[]).includes(ur(G.id)))?null:G.hasSource()?G:(at(null),null)};let F=null;const B=(q,G)=>{const le=q.composedPath()[0];if(typeof le?.closest!="function"||le.closest("[data-workspace]")!==y)return;const ie=G.sourceOwner!==I,fe=ar(q,E)&&e(G.node),ve=i(),me=Wt({clientX:q.clientX,clientY:q.clientY,model:ve,isExternal:ie||fe,rootElement:y,source:G.source,tabsetElements:b});if(!me||((F?.drag!==G||F.isCopy!==fe||F.model!==ve||!_t(F.target,me))&&(F={drag:G,isCopy:fe,isDisabled:ie?c(G.node,me,fe):l(G.source,me,fe),model:ve,target:me}),F.isDisabled))return;const Ge=fe&&!ie?Wt({clientX:q.clientX,clientY:q.clientY,model:ve,rootElement:y,source:G.source,tabsetElements:b}):void 0,Je=fe?ie||!!Ge&&_t(Ge,me):!0;return{...F,canMove:Je}};let X,Z;const re=q=>{const G=j(q);if(!G)return;const{clientX:le,clientY:ie}=q,fe=G.lastDragover;E&&(fe?.view!==E||fe.clientX!==le||fe.clientY!==ie)?(fe?.view===E&&(G.lastMoveStep=Math.hypot(le-fe.clientX,ie-fe.clientY)),G.lastDragover={clientX:le,clientY:ie,time:Date.now(),view:E}):fe&&(fe.time=Date.now()),vi(G,k),El(G),M(!0),G.previewOwners.has(k)||G.previewOwners.set(k,I),G.previewOwners.get(k)===I&&(se.current={clientX:le,clientY:ie},Io(ee.current,se.current),W(G.node));const ve=B(q,G);ve&&(q.preventDefault(),q.dataTransfer&&(q.dataTransfer.dropEffect=ve.isCopy?"copy":"move"),ve.isCopy&&(G.lastCopyEvent=q)),T(ve?.target),clearTimeout(Z),Z=setTimeout(()=>{X!==q&&L(!1)},0)},K=q=>{X=q;const G=j(q);L(!!G&&G.lastCopyEvent===q)},ne=q=>{const G=j(q),le=G?B(q,G):void 0;if(!G||!le)return;q.preventDefault(),G.isDropped=!0,at(null);const{canMove:ie,isCopy:fe,target:ve}=le;G.sourceOwner===I?d(G.source,ve,fe,ie):p(G.node,ve,fe)&&G.removeFromSource()},ye=Si(q=>{q?.dragGroup!==o?(x(void 0),T(void 0),L(!1),M(!1),J(!1),W(void 0)):q.lastDocument!==k&&(T(void 0),L(!1),M(!1),W(void 0))});return k.addEventListener("dragenter",re),k.addEventListener("dragover",re),k.addEventListener("drop",ne),E?.addEventListener("dragenter",K),E?.addEventListener("dragover",K),()=>{clearTimeout(Z),O?.(),ye(),k.removeEventListener("dragenter",re),k.removeEventListener("dragover",re),k.removeEventListener("drop",ne),E?.removeEventListener("dragenter",K),E?.removeEventListener("dragover",K)}},[e,n,o,i,l,c,d,p,I,y,x,T,b]);const Q=f.useCallback((k,E,O)=>{const j=a(),F=Ne();if(!j||F.state==="active"&&en(F,E.element.ownerDocument,E)){O?.onEnd(void 0);return}if(Y.current?.(),!O&&Re(E.element)&&o!==void 0&&E.pointerType!=="touch"&&E.pointerType!=="pen"){ae(k,E.element,o);return}const B=E.element,X=B.ownerDocument,{clientX:Z,clientY:re,pointerId:K}=E;B.setPointerCapture?.(K);let ne=!1,ye=!1,q,G,le=!1,ie=!1,fe=!0,ve={clientX:Z,clientY:re};const me={cursor:X.documentElement.style.cursor,sourceCursor:B.style.cursor,userSelect:X.body.style.userSelect},Ge=de=>{X.documentElement.style.cursor=de??me.cursor,B.style.cursor=de??me.sourceCursor},Je=de=>{if(de.pointerId!==K)return;const{clientX:ze,clientY:je}=de;if(!ne){if(Math.hypot(ze-Z,je-re)<kl)return;ne=!0,X.body.style.userSelect="none",O?A({preview:O.preview,tab:O.tab}):x(k)}se.current={clientX:ze,clientY:je},Io(ee.current,se.current),ve={clientX:ze,clientY:je},le=ar(de,Ue),Ve()},Ve=()=>{const{clientX:de,clientY:ze}=ve,je=Ml(Ue,de,ze),et=je&&!O&&t(k);ye!==et&&(ye=et,N(et));const ke=O||!le?void 0:r(k),_e=!!ke&&e(ke),He=je?void 0:Wt({clientX:de,clientY:ze,isExternal:!!O||_e,model:i(),rootElement:j,source:k,tabsetElements:b});if(ie!==_e||!_t(G,He)){G=He,ie=_e,fe=!_e||!!He&&_t(He,Wt({clientX:de,clientY:ze,model:i(),rootElement:j,source:k,tabsetElements:b}));const At=He!==void 0&&(O?u(O.tab,He):l(k,He,_e));q=At?void 0:He,Ge(At?"not-allowed":q&&_e?"copy":void 0),T(q),L(_e&&q!==void 0)}},Ze=(de,{isPointerDown:ze=!1,screenPoint:je}={})=>{Y.current=null,X.removeEventListener("pointermove",Je),X.removeEventListener("pointerup",Ye),X.removeEventListener("pointercancel",We),X.removeEventListener("keydown",te,!0),X.removeEventListener("keyup",ge,!0),O&&X.removeEventListener("dragstart",Ot,!0),Ue?.removeEventListener("blur",Qe);let et;if(ne){if(X.body.style.userSelect=me.userSelect,Ge(void 0),x(void 0),A(void 0),T(void 0),N(!1),L(!1),ze){const ke=_e=>{_e.pointerId===K&&(X.removeEventListener("pointerup",ke),X.removeEventListener("pointercancel",ke),zn(X))};X.addEventListener("pointerup",ke),X.addEventListener("pointercancel",ke)}else zn(X);if(de){if(ye&&je)g(k,je);else if(q)if(!O)d(k,q,ie,fe);else try{h(O.tab,q)&&(et=q)}catch(ke){throw O.onEnd(Ee(i()).tabsetsByTabId.has(O.tab.id)?q:void 0),ke}}}O?.onEnd(et)},Ye=de=>{if(de.pointerId===K){const{screenX:ze,screenY:je}=de;Ze(!0,{screenPoint:{screenX:ze,screenY:je}})}},We=de=>{de.pointerId===K&&Ze(!1)},te=de=>{de.key==="Escape"?(ne&&(de.preventDefault(),de.stopPropagation()),Ze(!1,{isPointerDown:!0})):Fe(de,!0)},ge=de=>Fe(de,!1),we=wi(X.defaultView),Fe=(de,ze)=>{de.key===we&&le!==ze&&(le=ze,ne&&Ve())},Ue=X.defaultView,Qe=()=>Ze(!1),Ot=de=>{B.contains(de.target)&&de.preventDefault()};Y.current=()=>Ze(!1),X.addEventListener("pointermove",Je),X.addEventListener("pointerup",Ye),X.addEventListener("pointercancel",We),X.addEventListener("keydown",te,!0),X.addEventListener("keyup",ge,!0),O&&X.addEventListener("dragstart",Ot,!0),Ue?.addEventListener("blur",Qe)},[e,t,o,r,i,a,l,u,d,h,g,x,T,ae,b]),Le=f.useCallback((k,E)=>Q({tabId:k,type:"tab"},lr(E)),[Q]),xe=f.useCallback((k,E)=>Q({tabsetId:k,type:"tabset"},lr(E)),[Q]),P=f.useCallback((k,{preview:E,tab:O})=>new Promise(j=>{const F=k.currentTarget??k.target;if(!Re(F)||F.ownerDocument!==a()?.ownerDocument){process.env.NODE_ENV!=="production"&&Se("startExternalDrag requires an event for an element in the same document as the workspace"),j(null);return}if(k.button!==0||k.buttons===0){j(null);return}Q({tabId:O.id,type:"tab"},{clientX:k.clientX,clientY:k.clientY,element:F,pointerId:k.pointerId,pointerType:k.pointerType},{onEnd:B=>j(B?{target:B}:null),preview:E,tab:O})}),[a,Q]);return{dragSource:w,isCopy:H,isNativeDragOver:V,isNativeDragSource:$,isTearOff:z,nativePreviewNode:U,newTabPreview:R,previewElementRef:ee,previewPointRef:se,startExternalDrag:P,startTabDrag:Le,startTabsetDrag:xe}}const bn=24;function dr(e,t,n={}){let o={height:Qr,width:Zr,x:bn,y:bn};if(e){const s=e.offsetWidth,r=e.offsetHeight;if(t){const l=Te(e,"horizontal"),c=Te(e,"vertical"),u=e.getBoundingClientRect(),d=t.getBoundingClientRect();if(d.width>0&&d.height>0){const h=t.hasAttribute("data-tabset-collapsed");o={height:h?o.height:d.height/c,width:h?o.width:d.width/l,x:(d.left-u.left)/l+bn,y:(d.top-u.top)/c+bn}}}const i=n.width??Math.min(o.width,s||o.width),a=n.height??Math.min(o.height,r||o.height);s>0&&r>0&&(o={height:a,width:i,x:Math.max(0,Math.min(o.x,s-i)),y:Math.max(0,Math.min(o.y,r-a))})}return{...o,...Ol(n)}}function Ol(e){const t={};for(const n of["height","width","x","y"])typeof e[n]=="number"&&(t[n]=e[n]);return t}function Al(e,t){const n=e.floating,o=n?.findIndex(({id:s})=>s===t)??-1;return!n||o<0||o===n.length-1?e:{...e,floating:[...n.slice(0,o),...n.slice(o+1),n[o]]}}const Ci=f.createContext({isOverflowing:!1,orientation:"horizontal"});function Jt(e,t){const n=()=>t(e.getState());return f.useSyncExternalStore(e.subscribe,n,n)}const Nl='button, [role="button"], [data-tab-ignore]';function fo(e){const t=e.target.closest?.(Nl);return!!t&&t!==e.currentTarget&&e.currentTarget.contains(t)}function $l({tab:e}){const{classNames:t,disabled:n,dragStore:o,getTabHandle:s,getTabHost:r,modelIndex:i,renderTab:a,requestFocus:l,startTabDrag:c,styles:u,takeFocusRequest:d,updateModel:h}=ft("Tab"),{isCollapsed:g,tabPlacement:p,tabset:m}=Xn("Tab"),{isOverflowing:y,orientation:b}=f.useContext(Ci),w=f.useRef(null),C=f.useCallback(I=>{w.current=I},[]),x=i.tabsetsByTabId.get(e.id)??m,T=x.tabs.findIndex(({id:I})=>I===e.id),z=x.tabs[T]??e,N=x.selectedId===z.id,H=n||!!z.disableClose,L=n||!!z.disableDrag;let R=u?.tab?.touchAction;L||(y?R=b==="horizontal"?"pan-x":"pan-y":R="none");const A=Jt(o,({dropTarget:I})=>{if(!(I===void 0||!("index"in I)||I.tabsetId!==x.id)){if(I.index===T)return"before";if(I.index===x.tabs.length&&T===x.tabs.length-1)return"after"}}),$=Jt(o,({dragSource:I})=>I?.type==="tab"&&I.tabId===z.id);ue(()=>{d(z.id)&&w.current?.focus()}),ue(()=>{const I=w.current;I?!L&&"touchAction"in I.style&&I.style.touchAction!==R&&process.env.NODE_ENV!=="production"&&Se("The element returned by renderTab replaced props.style (rather than merging it, e.g. style={{ ...props.style, padding: 4 }}); tabs can't be dragged by touch without its touch-action"):process.env.NODE_ENV!=="production"&&Se("The element returned by renderTab must receive its props (including ref); otherwise tabs can't be selected, dragged, or focused")},[L,R]);const{panelId:J,tabElementId:U}=r(z.id),W=()=>g&&x.collapsed?h("expand",!0,I=>Hn(kn(I,z.id),x.id)):h("select",!0,I=>kn(I,z.id)),V=I=>{if(I.target!==I.currentTarget)return;const ee=I.currentTarget.closest("[data-tab-list]"),se=ee?Array.from(ee.querySelectorAll("[data-tab]")).filter(xe=>xe.closest("[data-tab-list]")===ee):[],Y=se.indexOf(I.currentTarget),ae=xe=>{I.preventDefault(),se[(xe+se.length)%se.length]?.focus()};let[Q,Le]=b==="horizontal"?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"];switch(b==="horizontal"&&ct(ee)&&([Q,Le]=[Le,Q]),I.key){case Q:{ae(Y-1);break}case Le:{ae(Y+1);break}case"Home":{ae(0);break}case"End":{ae(se.length-1);break}case"Enter":case" ":{I.preventDefault(),W();break}case"Backspace":case"Delete":{if(!H){I.preventDefault();const xe=N?ei(x,z.id):(x.tabs[T+1]??x.tabs[T-1])?.id;xe!==void 0&&l(xe),h("close",!0,P=>Vt(P,z.id))}break}}},M={"aria-controls":J,"aria-selected":N,className:t?.tab,"data-drop-after":A==="after"||void 0,"data-drop-before":A==="before"||void 0,"data-tab":"","data-tab-dragging":$||void 0,"data-tab-id":z.id,"data-tab-placement":p,"data-tabset-collapsed":g||void 0,"data-tab-selected":N||void 0,id:U,onClick:I=>{fo(I)||W()},onKeyDown:I=>{fo(I)||V(I)},onPointerDown:I=>{I.button===0&&!L&&!fo(I)&&c(z.id,I)},ref:C,role:"tab",style:{...u?.tab,touchAction:R,WebkitTouchCallout:"none"},tabIndex:N?0:-1};return _.jsx(kt.Provider,{value:s(z.id),children:a?a(z,M):_.jsxs("div",{...M,children:[z.title??z.id,_.jsx(ni,{})]})})}const jl=Object.assign($l,{displayName:"Workspace.Tab"});function Ti(e){return Array.from(e.querySelectorAll("[data-tab][data-tab-id]")).filter(t=>Re(t)&&t.closest("[data-tab-list]")===e)}function zi(e){const t=[];for(const n of e.children){if(!Re(n))continue;const o=n.ownerDocument.defaultView?.getComputedStyle(n);o?.display==="contents"?t.push(...zi(n)):n.offsetParent!==null&&o?.position!=="absolute"&&o?.position!=="fixed"&&t.push(n)}return t}function Bl(e){const t=e.dataset.orientation==="vertical",n=e.parentElement,o=Te(n&&Re(n)?n:e,t?"vertical":"horizontal"),s=Array.from(e.children).filter(a=>Re(a)&&a.offsetParent!==null),r=fr(e,s,t,o);let i=0;if(n){const a=e.getBoundingClientRect(),[l,c]=t?[a.left,a.right]:[a.top,a.bottom],u=zi(n).filter(d=>{if(d===e)return!0;const h=d.getBoundingClientRect(),[g,p]=t?[h.left,h.right]:[h.top,h.bottom];return c>l?g<c&&p>l:g<=l&&p>=l});i=Math.max(0,-fr(n,u,t,o))}return Math.round(r-i)}function fr(e,t,n,o){const s=p=>p.ownerDocument.defaultView?.getComputedStyle(p),r=(p,m)=>parseFloat(p?.getPropertyValue(m)??"")||0,[i,a]=n?["top","bottom"]:["left","right"],l=s(e),c=e.getBoundingClientRect(),u=(n?c.height:c.width)/o-r(l,`border-${i}-width`)-r(l,`border-${a}-width`)-r(l,`padding-${i}`)-r(l,`padding-${a}`);let d,h;for(const p of t){const m=p.getBoundingClientRect(),y=n?m.top:m.left,b=n?m.bottom:m.right;(!d||y<d.position)&&(d={element:p,position:y}),(!h||b>h.position)&&(h={element:p,position:b})}if(!d||!h)return u;const g=r(s(d.element),`margin-${i}`)+r(s(h.element),`margin-${a}`);return u-g-(h.position-d.position)/o}function Ii(e){const t=e.dataset.orientation==="vertical";if((t?e.offsetHeight:e.offsetWidth)===0)return;const o=e.getBoundingClientRect(),s=Te(e,t?"vertical":"horizontal"),r=e.ownerDocument.defaultView?.getComputedStyle(e),i=c=>(parseFloat(r?.getPropertyValue(c)??"")||0)*s,[a,l]=t?["top","bottom"]:["left","right"];return{end:(t?o.bottom:o.right)-i(`border-${l}-width`),scale:s,start:(t?o.top:o.left)+i(`border-${a}-width`)}}const yn=1;function Fl(e,t){const n=e.dataset.orientation==="vertical";if(e.getClientRects().length===0)return pr({hidden:[],hiddenOrClipped:[]},t);const o=Ii(e),s=[],r=[];for(const i of Ti(e)){if(i.getClientRects().length===0)continue;const a=i.dataset.tabId;if(!o){s.push(a),r.push(a);continue}const l=i.getBoundingClientRect(),[c,u]=n?[l.top,l.bottom]:[l.left,l.right];u<=o.start+yn||c>=o.end-yn?(s.push(a),r.push(a)):(c<o.start-yn||u>o.end+yn)&&r.push(a)}return pr({hidden:s,hiddenOrClipped:r},t)}function pr(e,t){return{hidden:t&&hr(t.hidden,e.hidden)?t.hidden:e.hidden,hiddenOrClipped:t&&hr(t.hiddenOrClipped,e.hiddenOrClipped)?t.hiddenOrClipped:e.hiddenOrClipped}}function hr(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}function _l(e,t){const n=e.dataset.orientation==="vertical",o=Ii(e);if(!o)return!1;if(typeof e.scrollBy!="function")return!0;const s=t.getBoundingClientRect(),[r,i]=n?[s.top,s.bottom]:[s.left,s.right];let a=0;return r<o.start?a=r-o.start:i>o.end&&(a=Math.min(i-o.end,r-o.start)),Math.abs(a)<1||e.scrollBy(n?{top:a/o.scale}:{left:a/o.scale}),!0}function Wl({children:e}){const{classNames:t,disabled:n,dragGroup:o,model:s,styles:r,tabListFreeSpaceStore:i,tabListOverflowStore:a}=ft("TabList"),{isCollapsed:l,setTabListElement:c,tabPlacement:u,tabset:d}=Xn("TabList"),h=u==="left"||u==="right"?"vertical":"horizontal",g=f.useRef(null),p=dt(g,c),[m,y]=f.useState(!1),b=d.selectedId,w=f.useRef(b);w.current=b;const C=f.useRef(!0),x=f.useCallback(()=>{const H=g.current,L=w.current;if(!H||L===void 0){C.current=!1;return}const R=Ti(H).find(A=>A.dataset.tabId===L);(!R||_l(H,R))&&(C.current=!1)},[]),T=d.id;ue(()=>{const H=g.current;if(!H)return;const L=()=>{const M=H.dataset.orientation==="vertical",I=Math.abs(M?H.scrollTop:H.scrollLeft),ee=M?H.scrollHeight-H.offsetHeight:H.scrollWidth-H.offsetWidth;H.toggleAttribute("data-overflow-start",I>1),H.toggleAttribute("data-overflow-end",ee-I>1),y(ee>1)},R=()=>{a.set(T,Fl(H,a.get(T)))};let A;const $=()=>{C.current&&x(),L(),R();const M=Bl(H);M!==A&&(A=M,H.style.setProperty("--tab-list-free-space",`${M}px`)),i.set(T,M)};let J=null,U=null;L();let W=!1;queueMicrotask(()=>{const M=H.ownerDocument.defaultView;if(W||!M)return;const I=H.parentElement,ee=Y=>{if(M.getComputedStyle(Y).display==="contents"){U?.observe(Y,{childList:!0});for(const ae of Y.children)Re(ae)&&ee(ae)}else J?.observe(Y)},se=Y=>{J?.unobserve(Y);for(const ae of Y.children)Re(ae)&&se(ae)};J=M.ResizeObserver?new M.ResizeObserver($):null,U=M.MutationObserver?new M.MutationObserver(Y=>{for(const ae of Y){for(const Q of ae.addedNodes)if(Re(Q))ae.target===H?J?.observe(Q):ee(Q);else continue;for(const Q of ae.removedNodes)Re(Q)&&se(Q)}$()}):null,J?.observe(H);for(const Y of H.children)J?.observe(Y);if(U?.observe(H,{childList:!0}),I){J?.observe(I);for(const Y of I.children)Re(Y)&&Y!==H&&ee(Y);U?.observe(I,{childList:!0})}$()});const V=()=>{L(),R()};return H.addEventListener("scroll",V,{passive:!0}),()=>{W=!0,J?.disconnect(),U?.disconnect(),H.removeEventListener("scroll",V)}},[h,x,i,a,T]),ue(()=>i.retain(T),[i,T]),ue(()=>a.retain(T),[a,T]),ue(()=>{C.current=!0,x()},[h,x,b]);let z=r?.tabList?.touchAction;Vo(s,d,n,o)||(m?z=h==="horizontal"?"pan-x":"pan-y":z="none");const N=f.useMemo(()=>({isOverflowing:m,orientation:h}),[m,h]);return _.jsx(Ci.Provider,{value:N,children:_.jsx("div",{"aria-orientation":h,className:t?.tabList,"data-orientation":h,"data-tab-list":!0,"data-tab-placement":u,"data-tabset-collapsed":l||void 0,ref:p,role:"tablist",style:{...r?.tabList,touchAction:z},children:e})})}const Gl=Object.assign(Wl,{displayName:"Workspace.TabList"});function Vl(){const{classNames:e,getHiddenTabBehavior:t,getTabHost:n,isHydrating:o,renderEmptyTabset:s,renderTabContent:r,shouldServerRenderTabContent:i,styles:a}=ft("TabPanels"),{isCollapsed:l,setPanelsElement:c,tabPlacement:u,tabset:d}=Xn("TabPanels"),h=f.useRef(null),g=dt(h,c);ue(()=>{const y=h.current;if(y&&!o)for(const b of d.tabs){const{element:w}=n(b.id);w&&(w.parentElement!==y&&y.appendChild(w),w.style.display=b.id===d.selectedId?"contents":"none")}});const p=d.tabs.find(({id:y})=>y===d.selectedId),m=o&&p&&i(p)?p:void 0;return _.jsxs("div",{className:e?.tabPanels,"data-tab-panels":!0,"data-tab-placement":u,"data-tabset-collapsed":l||void 0,ref:g,style:{position:"relative",...a?.tabPanels,...l&&{display:"none"}},children:[d.tabs.length===0&&s?.(d),m&&_.jsx("div",{style:{display:"contents"},children:_.jsx(pi,{hiddenTabBehavior:t(m),renderTabContent:r,tab:m})})]})}const mr=Object.assign(Vl,{displayName:"Workspace.TabPanels"});function Ei(e,t){return t===e||t.hasAttribute("data-tab-list")&&t.closest("[data-tabset-header]")===e}function Hl(e,t){const n=Array.from(e.querySelectorAll("[data-tabset-drag-handle]")).filter(o=>o.closest("[data-tabset-header]")===e);return n.length>0?n.some(o=>o.contains(t)):Ei(e,t)}function ql(){const{activeTabsetId:e,classNames:t,disabled:n,dragGroup:o,dragStore:s,model:r,modelIndex:i,renderTabsetToolbar:a,setActiveTabsetId:l,startFloatingGesture:c,startTabsetDrag:u,styles:d,updateModel:h}=ft("TabsetView"),{isCollapsed:g,setHeaderElement:p,setTabsetElement:m,tabPlacement:y,tabset:b}=Xn("TabsetView"),w=Jt(s,({dragSource:z})=>z?.type==="tabset"&&z.tabsetId===b.id),C=i.floatingTabsetIds.has(b.id),x=Vo(r,b,n,o),T=_.jsxs("div",{className:t?.header,"data-tab-placement":y,"data-tabset-collapsed":g||void 0,"data-tabset-header":!0,onClick:z=>{g&&Ei(z.currentTarget,z.target)&&h("expand",!0,N=>Hn(N,b.id))},onPointerDown:z=>{z.button===0&&!x&&Hl(z.currentTarget,z.target)&&(C?c(b.id,"move",z):u(b.id,z))},ref:p,style:d?.header,children:[_.jsx(Gl,{children:b.tabs.map(z=>_.jsx(jl,{tab:z},z.id))}),a&&_.jsx("div",{className:t?.toolbar,"data-tab-placement":y,"data-tabset-collapsed":g||void 0,"data-tabset-toolbar":!0,style:d?.toolbar,children:a(b)})]});return _.jsx("div",{className:t?.tabset,"data-tab-placement":y,"data-tabset":!0,"data-tabset-active":e===b.id||void 0,"data-tabset-collapsed":g||void 0,"data-tabset-dragging":w||void 0,"data-tabset-floating":C||void 0,"data-tabset-id":b.id,"data-tabset-maximized":r.maximizedTabsetId===b.id||void 0,onFocusCapture:()=>l(b.id),onPointerDownCapture:()=>l(b.id),ref:m,style:d?.tabset,children:y==="bottom"||y==="right"?_.jsxs(_.Fragment,{children:[_.jsx(mr,{}),T]}):_.jsxs(_.Fragment,{children:[T,_.jsx(mr,{})]})})}const Yl=Object.assign(ql,{displayName:"Workspace.TabsetView"});function Ul(e,t){const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{height:Math.max(0,Math.round((n.height-o.height)/Te(e,"vertical"))),width:Math.max(0,Math.round((n.width-o.width)/Te(e,"horizontal")))}}function Xl(e,t,n){const o=t.dataset.tabPlacement==="left"||t.dataset.tabPlacement==="right",s=o?"width":"height",r=t.style,i=r.flex,a=r[s];r.flex="none",r[s]="max-content";const l=t.getBoundingClientRect();r.flex=i,r[s]=a;const c=o?l.width/Te(t,"horizontal"):l.height/Te(t,"vertical"),u=e.ownerDocument.defaultView?.getComputedStyle(e),d=n==="horizontal"?["left","right"]:["top","bottom"];let h=0;for(const g of d)h+=(parseFloat(u?.getPropertyValue(`padding-${g}`)??"")||0)+(parseFloat(u?.getPropertyValue(`border-${g}-width`)??"")||0);return Math.round(c+h)}function Kl({isMaximizedOverlay:e=!1,tabset:t}){const{collapseOverrides:n,collapsePreview:o,getTabsetHandle:s,model:r,modelIndex:i,outerParents:a,reportChromeSize:l,reportCollapsedSize:c,tabPlacement:u,tabsetElements:d}=ft("TabsetSlot"),h=i.parentsById.get(t.id),g=h?.orientation,p=!e&&Ln(t,n),m=o[t.id]!==void 0;let y=t.tabPlacement??u;if(p&&h){const U=h.children[h.children.length-1]?.id===t.id,W=y==="left"||y==="right";g==="horizontal"&&!W?y=U?"right":"left":g==="vertical"&&W&&(y=U?"bottom":"top")}const[b,w]=f.useState(null),[C,x]=f.useState(null),[T,z]=f.useState(null),[N]=f.useState(()=>({panels:null,tabList:null,tabset:null})),H=f.useCallback(U=>{N.tabset=U,w(U)},[N]),L=f.useCallback(U=>{N.panels=U,z(U)},[N]),R=f.useCallback(U=>{N.tabList=U},[N]);ue(()=>d.register(t.id,N),[N,t.id,d]);const A=t.collapsible&&!e?g:void 0,$=f.useRef(null);ue(()=>{if(!b||!T)return;const U=()=>{if(!m){if(!p){const V=T.getBoundingClientRect();(g==="horizontal"?V.width<=0:g==="vertical"?V.height<=0:V.width<=0||V.height<=0)||l(t.id,Ul(b,T))}if(C&&A){const V=Xl(b,C,A),M=$.current;p?($.current={orientation:A,size:V},c(t.id,V)):M?.orientation!==A&&c(t.id,V)}}};U();const W=b.ownerDocument.defaultView?.ResizeObserver;if(W){const V=new W(U);return V.observe(b),V.observe(T),C&&V.observe(C),()=>{V.disconnect()}}},[A,C,p,m,g,T,l,c,y,t.id,b]);const J=f.useMemo(()=>({isCollapsed:p,setHeaderElement:x,setPanelsElement:L,setTabListElement:R,setTabsetElement:H,tabPlacement:y,tabset:t}),[p,L,R,H,y,t]);return!e&&r.maximizedTabsetId===t.id?null:_.jsx(jn.Provider,{value:a.grid,children:_.jsx(_n.Provider,{value:a.group,children:_.jsx(Wn.Provider,{value:a.panel,children:_.jsx(kt.Provider,{value:null,children:_.jsx(rt.Provider,{value:s(t.id),children:_.jsx(fi.Provider,{value:J,children:_.jsx(Yl,{})})})})})})})}const Xo=Object.assign(Kl,{displayName:"Workspace.TabsetSlot"}),gr=["top","right","bottom","left","top-left","top-right","bottom-right","bottom-left"],po=8,br=12;function Jl({floating:e,layoutElementRef:t}){const[n,o]=f.useState(null);ue(()=>{const a=t.current;if(!a)return;const l=()=>o(u=>{const d={height:a.offsetHeight,left:a.offsetLeft,top:a.offsetTop,width:a.offsetWidth};return u&&u.height===d.height&&u.left===d.left&&u.top===d.top&&u.width===d.width?u:d});l();const c=a.ownerDocument.defaultView?.ResizeObserver;if(c){const u=new c(l);return u.observe(a),a.parentElement&&u.observe(a.parentElement),()=>{u.disconnect()}}},[t]);const s=f.useRef([]),r=e.map(({id:a})=>a),i=[...s.current.filter(a=>r.includes(a)),...r.filter(a=>!s.current.includes(a))];return s.current=i,_.jsx("div",{"data-workspace-floating":!0,style:{overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:1,...n?{height:n.height,left:n.left,top:n.top,width:n.width}:{inset:0}},children:i.map(a=>{const l=r.indexOf(a);return _.jsx(Zl,{layoutBox:n,stackIndex:l,tabset:e[l]},a)})})}function Zl({layoutBox:e,stackIndex:t,tabset:n}){const{classNames:o,disabled:s,startFloatingGesture:r,styles:i,tabPlacement:a,updateModel:l}=ft("FloatingTabset"),c=s||!!n.disableDrag,u=!!n.collapsed,d=n.tabPlacement??a,h=d==="left"||d==="right",g=u?gr.filter(w=>h?w==="top"||w==="bottom":w==="left"||w==="right"):gr,p=f.useRef(null),m=e?.width,y=e?.height;ue(()=>{const w=p.current;if(!w||m===void 0||y===void 0||w.hasAttribute(To))return;const C=mi(w);if(!C)return;const{x,y:T}=hi({x:n.x,y:n.y},C,{height:y,width:m});w.style.left=`${x}px`,w.style.top=`${T}px`});const b=n.id;return f.useEffect(()=>{const w=p.current;if(!w)return;const C=()=>l("raise",!0,x=>Al(x,b));return w.addEventListener("pointerdown",C,!0),()=>{w.removeEventListener("pointerdown",C,!0)}},[b,l]),_.jsxs("div",{className:o?.floatingTabset,"data-floating-tabset":n.id,"data-tabset-collapsed":u||void 0,ref:p,style:{...i?.floatingTabset,height:u&&!h?"auto":n.height,left:n.x,pointerEvents:"auto",position:"absolute",top:n.y,width:u&&h?"auto":n.width,zIndex:t+1},children:[_.jsx(Xo,{tabset:n}),!c&&g.map(w=>_.jsx("div",{className:o?.floatingResizeHandle,"data-floating-resize-handle":w,onPointerDown:C=>{C.button===0&&r(n.id,w,C)},style:{...i?.floatingResizeHandle,...Ql(w)}},w))]})}function Ql(e){const t=-po/2,n={cursor:gi[e],position:"absolute",touchAction:"none"};return e.includes("-")?{...n,height:br,width:br,zIndex:1,[e.startsWith("top")?"top":"bottom"]:t,[e.endsWith("left")?"left":"right"]:t}:e==="top"||e==="bottom"?{...n,[e]:t,height:po,left:0,right:0}:{...n,[e]:t,bottom:0,top:0,width:po}}const eu=Object.assign(Jl,{displayName:"Workspace.FloatingTabsets"});function Eo(e,t){if(e.type==="split"){if(e.id===t)return e;for(const n of e.children){const o=Eo(n,t);if(o)return o}}}function tu(e,t,n,o,s){const r=Eo(e.root,t);if(!r||r.children.length!==Object.keys(n).length||r.children.some(({id:c})=>n[c]===void 0))return e;const i=$e(e),a=Eo(i.root,t);if(!a)return e;let l=!1;for(const c of a.children){if(s?.has(c.id))continue;const u=c.type==="tabset"&&(o?o.has(c.id):!!c.collapsed);c.type==="tabset"&&u!==!!c.collapsed&&(l=!0,u?c.collapsed=!0:delete c.collapsed),u||(c.size=n[c.id]??c.size)}return l||(s?.size??0)>0||a.children.some(c=>c.type==="tabset"&&c.collapsed)?Ae(i):i}function yr(e,t,n){const o=$r(e.map(l=>{const c=n[l.itemId];return typeof c=="number"?{...l,defaultSize:c}:l}));let s=0;const r=[];for(const l of e)t.has(l.itemId)?s+=l.collapsedSize:r.push(l);const i=nu(r.map(({itemId:l,maxSize:c,minSize:u})=>({maxSize:c,minSize:u,weight:o[l]})),Math.max(0,100-s)),a={};for(const{collapsedSize:l,itemId:c}of e)a[c]=Ie(t.has(c)?l:i[r.findIndex(u=>u.itemId===c)]);return a}function nu(e,t){const n=(i,a)=>{const l=i.reduce((c,u)=>c+u,0);return i.map(c=>l>0?c/l*a:a/i.length)},o=new Map;for(;o.size<e.length;){const i=e.map((h,g)=>({...h,index:g})).filter(({index:h})=>!o.has(h)),a=t-Array.from(o.values()).reduce((h,g)=>h+g,0),l=n(i.map(({weight:h})=>h),a);let c=0;const u=[];if(i.forEach(({index:h,maxSize:g,minSize:p},m)=>{const y=l[m],b=Math.min(g,Math.max(p,y));b!==y&&(c+=b-y,u.push({index:h,isMinimum:b>y,size:b}))}),u.length===0){i.forEach(({index:h},g)=>o.set(h,l[g]));break}let d=0;for(const{index:h,isMinimum:g,size:p}of u)(c===0||c>0===g)&&(o.set(h,p),d++);if(d===0)for(const{index:h,size:g}of u)o.set(h,g)}const s=e.map((i,a)=>o.get(a)),r=s.reduce((i,a)=>i+a,0);return Math.abs(r-t)>.001?n(e.map(({weight:i})=>i),t):s}function ou(e,t){let n=!1;for(const o of e){if(o.type!=="tabset")continue;const s=t.has(o.id);if(s!==!!o.collapsed){if(!s)return"expand";n=!0}}return n?"collapse":"resize"}function su({split:e}){const{classNames:t,collapsedSizes:n,collapseToFit:o,disabled:s,id:r,maximumSizes:i,minimumSizes:a,renderSeparator:l,reportCollapsePreview:c,reportCollapseToFit:u,reportSeparatorsSize:d,resizePreviewMode:h,splitGeneration:g,styles:p,updateModel:m}=ft("SplitView"),y=`${r}-${e.id}`,b=P=>`${r}:${P}`,w=Xr(),[C,x]=f.useState(null),T=f.useRef(null),z=f.useCallback(P=>{T.current=P,x(P)},[]),N=()=>{const P=T.current;return P?e.orientation==="horizontal"?P.offsetWidth:P.offsetHeight:0},H=e.children.map(({id:P})=>P).join(),L=e.children.map(({id:P})=>b(P)).join(),R=new Set(e.children.filter(P=>P.type==="tabset"&&P.collapsed).map(({id:P})=>b(P))),A=e.children.filter(P=>P.type==="tabset"&&P.collapsed).map(({id:P})=>`${P}=${n[P]??0}`).join(),$=`${g}:${e.orientation}:${H}:${A}`,J=f.useRef(null),[,U]=f.useState(0),W=()=>{const P=Pe(y);return!P||P.defaultLayoutDeferred||P.derivedItemConstraints.map(({itemId:k})=>k).join()!==L?null:`${$}|${P.derivedItemConstraints.filter(({itemId:k})=>R.has(k)).map(({collapsedSize:k})=>k).join()}`},V=()=>{const P={};for(const k of e.children)P[b(k.id)]=k.size;return P},M=P=>{const k=Pe(y)?.derivedItemConstraints??[],E=new Set;for(const{id:O}of e.children){const j=b(O),F=k.find(({itemId:B})=>B===j);F?.collapsible&&P[j]!==void 0&&P[j]<=F.collapsedSize+.01&&E.add(O)}return E},I=(P,k)=>{const E=M(P),O={};for(const j of e.children)if(j.type==="tabset"){const F=E.has(j.id);O[j.id]=k||F!==!!j.collapsed?F:void 0}return O},ee=()=>{const P=Ne();return P.state==="active"&&P.hitRegions.some(k=>k.axis.id===y)},se=he(P=>c(I(P,!0))),Y=P=>{ee()||u(I(P,!1))},ae=f.useRef(null),Q=f.useRef(null),Le=he(()=>{const P=W();if(P===null||J.current!==P||ee())return;const k=N(),E=Q.current;if(Q.current=k,E===null||E===k)return;const{derivedItemConstraints:O,layout:j}=Pe(y),F=yr(O,R,V()),B=M(j);e.children.some(Z=>{const re=b(Z.id);return Z.type==="tabset"&&B.has(Z.id)!==!!Z.collapsed||typeof Z.size=="number"&&!be(j[re],F[re],.01)})&&w.current?.setLayout(F)}),xe=e.children.some(P=>P.type==="tabset"&&P.collapsible);return f.useEffect(()=>Lt(y,({axis:P,next:k,prev:E})=>{E?.derivedItemConstraints!==k.derivedItemConstraints&&(Le(),xe&&U(j=>j+1));const O=Ne();xe&&O.state==="active"&&O.hitRegions.some(j=>j.axis===P)&&se(k.layout)}),[Le,y,xe,se]),ue(()=>{const P=W();if(P===null||(J.current!==P&&(J.current=P,w.current?.setLayout(yr(Pe(y).derivedItemConstraints,R,V())),Q.current=N()),ee()))return;const{derivedItemConstraints:k}=Pe(y),E=ae.current,O=N(),{layout:j}=Pe(y);(E?.constraints!==k||E.layout!==j||E.size!==O||E.structureKey!==$)&&(ae.current={constraints:k,layout:j,size:O,structureKey:$},Y(j))}),ue(()=>{const P=C?.ownerDocument.defaultView;if(!C||!P)return;const k=F=>Re(F)&&F.hasAttribute("data-separator"),E=()=>{let F=0,B=0;const X=P.getComputedStyle(C),Z=parseFloat(e.orientation==="horizontal"?X.columnGap:X.rowGap)||0;for(const re of C.children)if(Re(re)&&re.hasAttribute("data-panel")&&B++,k(re))if(B++,"offsetWidth"in re){const{offsetHeight:K,offsetWidth:ne}=re;F+=e.orientation==="horizontal"?ne:K}else{const K=re.getBoundingClientRect();F+=e.orientation==="horizontal"?K.width:K.height}F+=Z*Math.max(0,B-1),d(e.id,F)},O=P.ResizeObserver?new P.ResizeObserver(E):null;O?.observe(C);for(const F of C.children)k(F)&&O?.observe(F);const j=P.MutationObserver?new P.MutationObserver(F=>{for(const B of F)B.addedNodes.forEach(X=>{k(X)&&O?.observe(X)}),B.removedNodes.forEach(X=>{k(X)&&O?.unobserve(X)});E()}):null;return j?.observe(C,{childList:!0}),E(),()=>{O?.disconnect(),j?.disconnect()}},[t?.split,C,d,e.id,e.orientation,p?.split]),_.jsx(Ur,{className:t?.split,"data-split":"","data-split-id":e.id,disabled:s,elementRef:z,groupRef:w,id:y,onLayoutChanged:(P,{isUserInteraction:k,requestedLayout:E})=>{if(k){const O=E??P,j={};for(const{id:Z}of e.children){const re=O[b(Z)];re!==void 0&&(j[Z]=re)}const F=M(P),B=new Set;for(const Z of F)o[Z]===!0&&(F.delete(Z),B.add(Z));const X=ou(e.children,F);m(X,!0,Z=>tu(Z,e.id,j,F,B))}else{const O=W();O!==null&&J.current===O?Y(P):U(j=>j+1)}},orientation:e.orientation,resizePreviewMode:h,style:p?.split,children:e.children.map((P,k)=>{const E=a.get(P.id),O=e.orientation==="horizontal"?E?.width:E?.height,j=i.get(P.id),F=e.orientation==="horizontal"?j?.width:j?.height;return _.jsxs(f.Fragment,{children:[k>0&&(l?l(e.orientation):_.jsx(Jr,{})),_.jsx(Kr,{collapsedSize:P.type==="tabset"&&P.collapsible?`${n[P.id]??0}px`:void 0,collapsible:P.type==="tabset"&&(!!P.collapsed||Go(e,P)),defaultSize:typeof P.size=="number"?`${P.size}%`:P.size,id:b(P.id),maxSize:F!==void 0&&Number.isFinite(F)?`${Math.max(F,O??0)}px`:void 0,minSize:O||void 0,children:_.jsx(Ri,{node:P})})]},P.id)})})}const ru=Object.assign(su,{displayName:"Workspace.SplitView"});function iu({node:e}){return e.type==="split"?_.jsx(ru,{split:e}):_.jsx(Xo,{tabset:e})}const Ri=Object.assign(iu,{displayName:"Workspace.NodeView"});function St(e,t){const n=Object.keys(e).filter(s=>!t.has(s));if(n.length===0)return e;const o={...e};for(const s of n)delete o[s];return o}function vr(e,t){let n=e;for(const[o,s]of Object.entries(t))e[o]!==s&&(n===e&&(n={...e}),s===void 0?delete n[o]:n[o]=s);return n}function xt(e,t){if(e===void 0)return;if(typeof e!="string"){process.env.NODE_ENV!=="production"&&Se(`Workspace tabset sizes (e.g. minWidth or maxWidth) must be strings with units (e.g. "200px"); received ${e}`);return}const[n,o]=Po(e);switch(o){case"%":{process.env.NODE_ENV!=="production"&&Se(`Workspace tabset sizes (e.g. minWidth or maxWidth) must use absolute units (px, em, rem, vh, or vw); received "${e}". Use "vw" or "vh" for sizes relative to the viewport.`);return}case"px":return n;default:return t?ht({axisSize:0,itemElement:t,styleProp:e}):void 0}}function au({copyTab:e,copyTabset:t,model:n,node:o,target:s}){let r;if(o.type==="tab"){const i=e?.(o.tab,s);if(!i)return;if(!Sr(i)){process.env.NODE_ENV!=="production"&&Se("copyTab must return a tab (with an id) or null");return}r={tab:i,type:"tab"}}else{const i=t?.(o.tabset,l=>e?.(l,s)??{...l,id:Pt()},s);if(!i)return;if(i.type!=="tabset"||typeof i.id!="string"||!Array.isArray(i.tabs)||!i.tabs.every(Sr)){process.env.NODE_ENV!=="production"&&Se("copyTabset must return a tabset (with an id and tabs) or null");return}if(new Set([i.id,...i.tabs.map(({id:l})=>l)]).size!==i.tabs.length+1){process.env.NODE_ENV!=="production"&&Se("copyTabset returned a tabset with duplicate ids");return}r={tabset:{...i,selectedId:cu(o.tabset,i)},type:"tabset"}}if(vo(n,r,s)){process.env.NODE_ENV!=="production"&&Se(o.type==="tab"?"copyTab returned a tab with an id that's already in use":"copyTabset returned a tabset with an id that's already in use");return}return r}function Sr(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}function cu(e,t){if(t.tabs.some(({id:o})=>o===t.selectedId))return t.selectedId;const n=e.tabs.findIndex(({id:o})=>o===e.selectedId);return t.tabs[n]?.id??t.tabs[0]?.id}function lu({children:e,className:t,dragType:n,elementRef:o,isCopy:s,isTearOff:r,pointRef:i,style:a}){const l=f.useRef(null);return ue(()=>(o.current=l.current,Io(l.current,i.current),()=>{o.current=null}),[o,i]),_.jsx("div",{className:t,"data-drag-copy":s||void 0,"data-drag-preview":!0,"data-drag-type":n,"data-tear-off":r||void 0,ref:l,style:{zIndex:2,...a,left:0,pointerEvents:"none",position:"fixed",top:0},children:e})}const uu=Object.assign(lu,{displayName:"Workspace.DragPreview"});function du(e,t,n,o=!1){const s=t==="left"||t==="right"?"horizontal":"vertical",r=zt({edge:t},o),i="edge"in r?r.edge:t;let a,l;if(n?.type==="tab"?(a=So(e,n.tabId,{edge:i}),l=ut(a,n.tabId)?.id):n?.type==="tabset"&&(a=xo(e,n.tabsetId,{edge:i}),l=n.tabsetId),a!==void 0&&a!==e){const{root:u}=a,d=u.type==="split"&&u.orientation===s?u.children.find(({id:h})=>h===l):void 0;if(typeof d?.size=="number")return d.size/100}const{root:c}=e;return c.type==="split"&&c.orientation===s?1/(c.children.filter(d=>d.type!=="tabset"||!d.collapsed).length+1):.5}function fu(e,t){return e===void 0||t===void 0?e===t:e.bottom===t.bottom&&e.left===t.left&&e.right===t.right&&e.top===t.top}function pu(e,t,n,o=.5){const s=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=Te(e,"horizontal"),a=Te(e,"vertical");let l=(r.left-s.left)/i,c=(r.top-s.top)/a,u=r.width/i,d=r.height/a;switch(n){case"bottom":{c+=d*(1-o),d*=o;break}case"left":{u*=o;break}case"right":{l+=u*(1-o),u*=o;break}case"top":{d*=o;break}}return{bottom:s.height/a-c-d,left:l,right:s.width/i-l-u,top:c}}function hu({className:e,dragStore:t,isCopy:n,layoutElementRef:o,model:s,style:r,tabsetElements:i}){const a=Jt(t,m=>m.dropTarget),l=Jt(t,m=>m.dragSource),c=f.useRef(null),[u,d]=f.useState(),h=a&&"region"in a?a.region:void 0,g=a&&"tabsetId"in a?a.tabsetId:void 0,p=a&&"edge"in a?a.edge:void 0;return ue(()=>{const m=c.current,y=p?o.current:h&&g?i.get(g)?.panels:void 0,b=p??h;if(!m||!y||!b)return;const w=p?du(s,p,n?void 0:l,ct(o.current)):void 0,C=()=>{if(!y.isConnected)return;const T=pu(m,y,b,w);d(z=>fu(z,T)?z:T)};C();const x=m.ownerDocument.defaultView?.ResizeObserver;if(x){const T=new x(C);return T.observe(m),T.observe(y),()=>{T.disconnect()}}},[l,p,n,o,s,h,i,g]),_.jsx("div",{ref:c,style:{inset:0,pointerEvents:"none",position:"absolute",zIndex:1},children:_.jsx("div",{className:e,"data-drag-copy":n||void 0,"data-drop-indicator":!0,"data-edge":p,"data-region":h,style:{...r,...u,...!h&&!p&&{opacity:0},pointerEvents:"none",position:"absolute"}})})}const mu=Object.assign(hu,{displayName:"Workspace.DropIndicator"});function gu({acceptExternalDrop:e,className:t,classNames:n,copyTab:o,copyTabset:s,defaultModel:r,disabled:i=!1,disableDragBetweenApps:a=!1,disableDrop:l,dragGroup:c,elementRef:u,hiddenTabBehavior:d="keep-mounted",id:h,onModelChanged:g,onTearOff:p,renderDragPreview:m,renderEmptyTabset:y,renderSeparator:b,renderTab:w,renderTabContent:C,renderTabsetDragPreview:x,renderTabsetToolbar:T,resizePreviewMode:z,serverRenderTabContent:N=!1,style:H,styles:L,tabPlacement:R="top",tabRemovalSelectionBehavior:A="adjacent",tabsetMinHeight:$,tabsetMinWidth:J,workspaceRef:U,...W}){const V=bt(h),M=f.useContext(jn),I=f.useContext(_n),ee=f.useContext(Wn),se=f.useMemo(()=>({grid:M,group:I,panel:ee}),[M,I,ee]),[Y,ae]=f.useState(()=>ao(Mn(Qs(r)),A)),Q=f.useRef(Y),[Le,xe]=f.useState(0),[P,k]=f.useState(),E=f.useRef(void 0),O=f.useCallback(v=>{E.current!==v&&(E.current=v,k(v))},[]),j=he((...v)=>g?.(...v)),F=he(()=>A),B=f.useCallback((v,S,D)=>{const oe=F(),pe=ao(Q.current,oe),De=D(pe);if(De!==pe){const Be=ao(De,oe);Q.current=Be,ae(Be),j(Be,{isUserInteraction:S,reason:v})}},[F,j]),[X]=f.useState(()=>Zs()),[Z]=f.useState(()=>Zs((v,S)=>v.hidden===S.hidden&&v.hiddenOrClipped===S.hiddenOrClipped)),[re]=f.useState(Hc),[K]=f.useState(qc),ne=f.useRef(null),ye=f.useRef(null),q=f.useRef(null),G=f.useMemo(()=>{const v=()=>{const S=E.current;return S!==void 0&&Ee(Q.current).tabsetsById.has(S)?S:void 0};return{addTab:(S,D={})=>{const oe=Uc(Q.current,S,{...D,tabsetId:D.tabsetId??v()});return B(oe.added?"add":"select",!1,()=>oe.model),oe.added},closeTab:S=>B("close",!1,D=>Vt(D,S)),closeTabset:S=>B("close",!1,D=>io(D,S)),collapseTabset:S=>B("collapse",!1,D=>oi(D,S)),expandTabset:S=>B("expand",!1,D=>Hn(D,S)),floatTab:(S,D)=>B("float",!1,oe=>{const pe=Ee(oe).tabsetsByTabId.get(S)?.id;return Kc(oe,S,dr(q.current,pe!==void 0?K.get(pe)?.tabset:void 0,D))}),floatTabset:(S,D)=>B("float",!1,oe=>Jc(oe,S,dr(q.current,K.get(S)?.tabset,D))),getActiveTabsetId:v,getModel:()=>Q.current,getTabListFreeSpace:S=>X.get(S),getTabListOverflow:(S,D)=>ro(Z.get(S),D),maximizeTabset:S=>B("maximize",!1,D=>ri(D,S)),moveTab:(S,D)=>B("move",!1,oe=>So(oe,S,zt(D,ct(ne.current)))),moveTabset:(S,D)=>B("move",!1,oe=>xo(oe,S,zt(D,ct(ne.current)))),restoreTabset:()=>B("restore",!1,ii),selectTab:S=>B("select",!1,D=>kn(D,S)),setModel:S=>(B("set-model",!1,()=>Mn(Qs(S))),xe(D=>D+1),Q.current),startExternalDrag:(S,D)=>ye.current?.(S,D)??Promise.resolve(null),subscribeToTabListFreeSpace:(S,D)=>X.subscribe(S,D),subscribeToTabListOverflow:(S,D,oe)=>{let pe=ro(Z.get(S),oe);return Z.subscribe(S,De=>{const Be=ro(De,oe);Be!==pe&&(pe=Be,D(Be))})},updateTab:(S,D)=>B("update",!1,oe=>tl(oe,S,D)),updateTabset:(S,D)=>B("update",!1,oe=>di(oe,S,D))}},[X,Z,K,B]);f.useImperativeHandle(U,()=>G,[G]);const le=f.useMemo(()=>({...G,id:V}),[G,V]),[ie]=f.useState(()=>({tabs:new Map,tabsets:new Map})),fe=f.useCallback(v=>{let S=ie.tabs.get(v);return S||(S={close:()=>G.closeTab(v),float:D=>G.floatTab(v,D),getTabsetId:()=>Ee(Q.current).tabsetsByTabId.get(v)?.id??"",id:v,isSelected:()=>Ee(Q.current).tabsetsByTabId.get(v)?.selectedId===v,select:()=>G.selectTab(v),workspaceId:V},ie.tabs.set(v,S)),S},[G,ie,V]),ve=f.useCallback(v=>{let S=ie.tabsets.get(v);return S||(S={addTab:(D,oe={})=>G.addTab(D,{...oe,tabsetId:v}),close:()=>G.closeTabset(v),collapse:()=>G.collapseTabset(v),expand:()=>G.expandTabset(v),float:D=>G.floatTabset(v,D),id:v,isCollapsed:()=>!!Ee(Q.current).tabsetsById.get(v)?.collapsed,isFloating:()=>Ee(Q.current).floatingTabsetIds.has(v),isMaximized:()=>Q.current.maximizedTabsetId===v,maximize:()=>G.maximizeTabset(v),restore:()=>{Q.current.maximizedTabsetId===v&&G.restoreTabset()},selectTab:D=>{Ee(Q.current).tabsetsByTabId.get(D)?.id===v&&G.selectTab(D)},workspaceId:V},ie.tabsets.set(v,S)),S},[G,ie,V]),[me,Ge]=f.useState(null),Je=dt(ne,Ge,u),[Ve]=f.useState(()=>new Map),Ze=f.useRef(0),Ye=me?.ownerDocument,We=f.useCallback(v=>{let S=Ve.get(v);if(!S){const D=++Ze.current;S={element:null,panelId:`${V}-tab-panel-${D}`,tabElementId:`${V}-tab-${D}`},Ve.set(v,S)}return!S.element&&Ye&&(S.element=Ye.createElement("div")),S},[V,Ye,Ve]),te=Ee(Y);f.useEffect(()=>{for(const[v,S]of Ve)te.tabsById.has(v)||(S.element?.remove(),Ve.delete(v),ie.tabs.delete(v));for(const v of ie.tabs.keys())te.tabsById.has(v)||ie.tabs.delete(v);for(const v of ie.tabsets.keys())te.tabsetsById.has(v)||ie.tabsets.delete(v)},[ie,te,Ve]);const ge=f.useSyncExternalStore(Bn,()=>!1,()=>!0),we=f.useCallback(v=>typeof d=="function"?d(v):d,[d]),Fe=f.useCallback(v=>typeof N=="function"?N(v):N,[N]),[Ue,Qe]=f.useState({}),[Ot,de]=f.useState({}),[ze,je]=f.useState({}),et=f.useCallback((v,S)=>Qe(D=>D[v]?.height===S.height&&D[v]?.width===S.width?D:{...D,[v]:S}),[]),[ke,_e]=f.useState({}),He=f.useCallback(v=>_e(S=>vr(S,v)),[]),[At,Ko]=f.useState({}),Jo=f.useCallback(v=>Ko(S=>vr(S,v)),[]),sn=f.useMemo(()=>new Set(te.parentsById.keys()),[te]),it=f.useMemo(()=>St(At,sn),[At,sn]),rn=f.useMemo(()=>Object.keys(it).length===0?ke:Object.keys(ke).length===0?it:{...it,...ke},[ke,it]);f.useEffect(()=>Pn(({next:v,prev:S})=>{S.state==="active"&&v.state!=="active"&&_e(D=>Object.keys(D).length>0?{}:D)}),[]);const Zo=f.useCallback((v,S)=>je(D=>D[v]===S?D:{...D,[v]:S}),[]),Qo=f.useCallback((v,S)=>de(D=>D[v]===S?D:{...D,[v]:S}),[]);f.useEffect(()=>{Qe(v=>St(v,te.nodeIds)),de(v=>St(v,te.nodeIds)),je(v=>St(v,te.nodeIds)),_e(v=>St(v,te.nodeIds)),Ko(v=>St(v,sn))},[te,sn]);const[Jn,Li]=f.useState(null);f.useEffect(()=>{if(!me)return;const v=()=>Li({element:me});v();const S=me.ownerDocument.defaultView;return S?.addEventListener("resize",v),()=>{S?.removeEventListener("resize",v)}},[me]);const{maximumSizes:es,minimumSizes:ts}=f.useMemo(()=>{const v=Jn?.element??null;return Vc(Y.root,{getChromeSize:S=>Ue[S],getCollapsedSize:S=>ze[S],getContentMaximumSize:S=>({height:xt(S.maxHeight,v)??1/0,width:xt(S.maxWidth,v)??1/0}),getContentMinimumSize:S=>({height:xt(S.minHeight??$,v)??0,width:xt(S.minWidth??J,v)??0}),getSeparatorsSize:S=>Ot[S]})},[Ue,ze,Y.root,Ot,$,J,Jn]),Di=he(v=>{const S=Ee(Q.current).tabsetsById.get(v),D=Ue[v]??{height:0,width:0},oe=Jn?.element??null;return{height:D.height+(xt(S?.minHeight??$,oe)??0),width:D.width+(xt(S?.minWidth??J,oe)??0)}}),ns=il({getMinimumSize:Di,updateModel:B}),Zn=he(v=>{const{tabsById:S,tabsetsById:D}=Ee(Q.current);if(v.type==="tab"){const pe=S.get(v.tabId);return pe?{tab:pe,type:"tab"}:void 0}const oe=D.get(v.tabsetId);return oe?{tabset:oe,type:"tabset"}:void 0}),Qn=(v,S,D,oe)=>{if(typeof l!="function")return!!l;const pe=Q.current;if(v.type==="tab")return l({isCopy:oe,model:pe,source:S,tab:v.tab,tabset:void 0,target:D});const De=v.tabset;return De.tabs.length===0?l({isCopy:oe,model:pe,source:S,tab:void 0,tabset:De,target:D}):De.tabs.some((Be,oo)=>l({isCopy:oe,model:pe,source:S,tab:Be,tabset:De,target:"index"in D?{...D,index:D.index+oo}:D}))},os=he((v,S,D)=>{if(typeof l!="function")return!!l;const oe=Zn(v);return oe?Qn(oe,"local",S,D):!0}),ss=he((v,S,D)=>i||!D&&(v.type==="tabset"&&!!v.tabset.keepWhenEmpty||vo(Q.current,v,S))||Qn(v,"external",S,D)),Mi=he(v=>!i&&(v.type==="tab"?!!o:!!s)),rs=he((v,S)=>{const D={tab:v,type:"tab"};return i||vo(Q.current,D,S)||Qn(D,"new",S,!1)}),ki=he(()=>i||l===!0),Pi=he((v,S,D,oe)=>{if(D){const pe=Zn(v);if(pe&&cs(pe,S)||!oe||os(v,S,!1))return}B("move",!0,pe=>{const De=zt(S,ct(ne.current));return v.type==="tab"?So(pe,v.tabId,De):xo(pe,v.tabsetId,De)})}),is=!!p;f.useEffect(()=>{process.env.NODE_ENV!=="production"&&is&&Se("The Workspace onTearOff prop is deprecated and will be removed in the next major version; open popout windows from a button instead (see usePopoutWindows)")},[is]);const as=he(v=>{if(!p)return!1;const{tabsById:S,tabsetsById:D}=Ee(Q.current);if(v.type==="tab")return S.has(v.tabId);const oe=D.get(v.tabsetId);return!!oe&&!oe.keepWhenEmpty}),Oi=he((v,{screenX:S,screenY:D})=>{if(!p||!as(v))return;const oe=Q.current,pe=Xc(oe,v);if(!pe)return;const{tabsById:De,tabsetsById:Be,tabsetsByTabId:oo}=Ee(oe),dn=v.type==="tab"?{tab:De.get(v.tabId),tabset:oo.get(v.tabId),type:"tab"}:{tabset:Be.get(v.tabsetId),type:"tabset"},bs=K.get(dn.tabset.id)?.tabset?.getBoundingClientRect(),Ki={...dn.type==="tab"?{tab:dn.tab,type:"tab"}:{tabset:dn.tabset,type:"tabset"},height:bs?.height??0,model:pe,screenX:S,screenY:D,width:bs?.width??0};p(Ki)===!0&&B("tear-off",!0,ys=>v.type==="tab"?Vt(ys,v.tabId):io(ys,v.tabsetId))}),an=he((v,S,D)=>{let oe=!1;return B(v,!0,pe=>{const De=zt(D,ct(ne.current)),Be=S.type==="tab"?Qc(pe,S.tab,De):el(pe,S.tabset,De);return oe=Be!==pe,Be}),oe}),cs=he((v,S)=>{const D=au({copyTab:o,copyTabset:s,model:Q.current,node:v,target:S});return!!D&&an("copy",D,S)}),Ai=he((v,S,D)=>D&&(cs(v,S)||ss(v,S,!1))?!1:an("transfer",v,S)),ls=f.useCallback((v,S)=>an("add",{tab:v,type:"tab"},S),[an]),Ni=he(v=>B("transfer",!0,S=>v.type==="tab"?Vt(S,v.tabId):io(S,v.tabsetId))),us=f.useCallback(()=>Q.current,[]),$i=f.useCallback(()=>ne.current,[]),{dragSource:Nt,isCopy:cn,isNativeDragOver:ji,isNativeDragSource:Bi,isTearOff:eo,nativePreviewNode:ln,newTabPreview:yt,previewElementRef:Fi,previewPointRef:_i,startExternalDrag:ds,startTabDrag:fs,startTabsetDrag:ps}=Pl({canCopy:Mi,canTearOff:as,disableDragBetweenApps:a,dragGroup:c,dragStore:re,getDragNode:Zn,getModel:us,getRootElement:$i,isDropDisabled:os,isExternalDropDisabled:ss,isNewTabDropDisabled:rs,onDrop:Pi,onNewTabDrop:ls,onTearOff:Oi,onTransferIn:Ai,onTransferOut:Ni,rootElement:me,tabsetElements:K});ue(()=>{ye.current=ds},[ds]);const Wi=he(()=>e),Gi=vl({areDropsDisabled:ki,dragStore:re,getAcceptExternalDrop:Wi,getModel:us,isEnabled:e!==void 0,isNewTabDropDisabled:rs,onNewTabDrop:ls,rootElement:me,tabsetElements:K}),to=f.useRef(void 0),hs=f.useCallback(v=>{to.current=v},[]),ms=f.useCallback(v=>to.current===v?(to.current=void 0,!0):!1,[]),Vi=f.useMemo(()=>({activeTabsetId:P,collapsedSizes:ze,collapseOverrides:rn,collapsePreview:ke,collapseToFit:it,disabled:i,dragGroup:c,dragStore:re,getTabHandle:fe,getTabHost:We,getHiddenTabBehavior:we,getTabsetHandle:ve,id:V,isHydrating:ge,maximumSizes:es,minimumSizes:ts,model:Y,modelIndex:te,outerParents:se,classNames:n,renderEmptyTabset:y,renderSeparator:b,renderTab:w,renderTabContent:C,renderTabsetToolbar:T,reportChromeSize:et,reportCollapsePreview:He,reportCollapseToFit:Jo,reportCollapsedSize:Zo,reportSeparatorsSize:Qo,requestFocus:hs,resizePreviewMode:z,setActiveTabsetId:O,shouldServerRenderTabContent:Fe,splitGeneration:Le,startFloatingGesture:ns,startTabDrag:fs,startTabsetDrag:ps,styles:L,tabListFreeSpaceStore:X,tabListOverflowStore:Z,tabPlacement:R,tabsetElements:K,takeFocusRequest:ms,updateModel:B}),[P,ze,rn,ke,it,i,c,re,fe,We,we,ve,V,ge,es,ts,Y,te,se,n,y,b,w,C,T,et,He,Jo,Zo,Qo,hs,z,O,Fe,Le,ns,fs,ps,L,X,Z,R,K,ms,B]),no=f.useMemo(()=>({activeTabsetId:P,collapseOverrides:rn,collapseToFit:it,disabled:i,dragGroup:c,model:Y,modelIndex:te}),[P,rn,it,i,c,Y,te]),Hi=he(v=>We(v).panelId),[un]=f.useState(()=>Yc(no,B,Hi));un.setState(no),ue(()=>{un.notify()},[un,no]);const $t=Y.maximizedTabsetId!==void 0?te.tabsetsById.get(Y.maximizedTabsetId):void 0;ue(()=>{q.current?.toggleAttribute("inert",!!$t)},[$t]);const qi=f.useMemo(()=>_.jsx(Ri,{node:Y.root}),[Y.root]),Yi=f.useMemo(()=>$t&&_.jsx("div",{"data-workspace-maximized":!0,style:{inset:0,position:"absolute",zIndex:1},children:_.jsx(Xo,{isMaximizedOverlay:!0,tabset:$t})}),[$t]),Ui=f.useMemo(()=>Y.floating&&_.jsx(eu,{floating:Y.floating,layoutElementRef:q}),[Y.floating]),Xi=f.useMemo(()=>ge?null:Array.from(te.tabsById.values(),v=>{const S=We(v.id).element;return S?xr.createPortal(_.jsx(pi,{hiddenTabBehavior:we(v),renderTabContent:C,tab:v}),S,v.id):null}),[we,We,ge,te,C]);let pt,tt;yt?pt=yt.tab:ln?ln.type==="tab"?pt=ln.tab:tt=ln.tabset:Bi||(pt=Nt?.type==="tab"?te.tabsById.get(Nt.tabId):void 0,tt=Nt?.type==="tabset"?te.tabsetsById.get(Nt.tabsetId):void 0);const gs=(v,S=0)=>{if(m)return m(v,{isCopy:cn,isTearOff:eo});const D=v.title??v.id;return S>0?`${D} (+${S})`:D};let jt=null;if(yt&&yt.preview!==void 0)jt=yt.preview;else if(pt)jt=gs(pt);else if(tt)if(x)jt=x(tt,{isCopy:cn,isTearOff:eo});else{const v=tt.tabs.find(({id:S})=>S===tt.selectedId);jt=v?gs(v,tt.tabs.length-1):tt.id}return _.jsx(qn.Provider,{value:le,children:_.jsx(tn.Provider,{value:un,children:_.jsxs(ui.Provider,{value:Vi,children:[_.jsxs("div",{...W,className:t,"data-testid":Dt(W,h),"data-workspace":!0,id:V,ref:Je,style:{position:"relative",...H},children:[_.jsx("div",{"data-workspace-layout":!0,ref:q,style:{height:"100%",width:"100%"},children:qi}),Yi,Ui,(Nt!==void 0||yt!==void 0||ji||Gi)&&_.jsx(mu,{className:n?.dropIndicator,isCopy:cn,dragStore:re,layoutElementRef:q,model:Y,style:L?.dropIndicator,tabsetElements:K}),(pt||tt)&&_.jsx(uu,{className:n?.dragPreview,dragType:pt?"tab":"tabset",elementRef:Fi,isCopy:cn,isTearOff:eo,pointRef:_i,style:L?.dragPreview,children:jt})]}),Xi]})})})}const bu=Object.assign(gu,{displayName:"Workspace"});exports.Cell=oa;exports.Grid=qa;exports.Gridline=Hr;exports.Group=Ur;exports.Panel=Kr;exports.Separator=Jr;exports.SeparatorOverlay=Yr;exports.TabCloseButton=ni;exports.TabsetCollapseButton=Cc;exports.TabsetDragHandle=zc;exports.TabsetMaximizeButton=Ec;exports.Workspace=bu;exports.isCoarsePointer=Tr;exports.normalizeWorkspaceModel=ci;exports.useDefaultGridLayout=Ya;exports.useDefaultLayout=ac;exports.useGridCallbackRef=Ua;exports.useGridRef=Xa;exports.useGroupCallbackRef=cc;exports.useGroupRef=Xr;exports.usePanelCallbackRef=pc;exports.usePanelRef=hc;exports.useParentGrid=Ka;exports.useParentGroup=lc;exports.useParentPanel=mc;exports.useParentTab=Rc;exports.useParentTabState=ti;exports.useParentTabset=Lc;exports.useParentTabsetState=Vn;exports.useParentWorkspace=Dc;exports.usePopoutWindows=$c;exports.useTabListFreeSpace=jc;exports.useTabListOverflow=Fc;exports.useWorkspaceCallbackRef=Wc;exports.useWorkspaceRef=Gc;
2
3
  //# sourceMappingURL=react-resizable-panels.cjs.map