@gbasin/agentboard-darwin-x64 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/agentboard CHANGED
Binary file
@@ -49,7 +49,7 @@ Error generating stack: `+a.message+`
49
49
  To pick up a draggable item, press the space bar.
50
50
  While dragging, use the arrow keys to move the item.
51
51
  Press space again to drop the item in its new position, or press escape to cancel.
52
- `},rL={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function nL(e){let{announcements:t=rL,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=tL}=e;const{announce:a,announcement:l}=Qk(),i=Yo("DndLiveRegion"),[o,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),Zk(k.useMemo(()=>({onDragStart(u){let{active:p}=u;a(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:_}=u;t.onDragMove&&a(t.onDragMove({active:p,over:_}))},onDragOver(u){let{active:p,over:_}=u;a(t.onDragOver({active:p,over:_}))},onDragEnd(u){let{active:p,over:_}=u;a(t.onDragEnd({active:p,over:_}))},onDragCancel(u){let{active:p,over:_}=u;a(t.onDragCancel({active:p,over:_}))}}),[a,t])),!o)return null;const g=mt.createElement(mt.Fragment,null,mt.createElement(Yk,{id:n,value:s.draggable}),mt.createElement(Jk,{id:i,announcement:l}));return r?jr.createPortal(g,r):g}var wt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wt||(wt={}));function Il(){}function iL(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function sL(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Ir=Object.freeze({x:0,y:0});function oL(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function lL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function cL(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Ig(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const uL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Ig(t,t.left,t.top),a=[];for(const l of n){const{id:i}=l,o=r.get(i);if(o){const c=oL(Ig(o),s);a.push({id:i,data:{droppableContainer:l,value:c}})}}return a.sort(aL)};function hL(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=s-n,i=a-r;if(n<s&&r<a){const o=t.width*t.height,c=e.width*e.height,g=l*i,u=g/(o+c-g);return Number(u.toFixed(4))}return 0}const dL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const a of n){const{id:l}=a,i=r.get(l);if(i){const o=hL(i,t);o>0&&s.push({id:l,data:{droppableContainer:a,value:o}})}}return s.sort(lL)};function fL(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function S1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ir}function pL(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((l,i)=>({...l,top:l.top+e*i.y,bottom:l.bottom+e*i.y,left:l.left+e*i.x,right:l.right+e*i.x}),{...r})}}const mL=pL(1);function gL(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vL(e,t,r){const n=gL(t);if(!n)return e;const{scaleX:s,scaleY:a,x:l,y:i}=n,o=e.left-l-(1-s)*parseFloat(r),c=e.top-i-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=s?e.width/s:e.width,u=a?e.height/a:e.height;return{width:g,height:u,top:c,right:o+g,bottom:c+u,left:o}}const _L={ignoreTransform:!1};function _s(e,t){t===void 0&&(t=_L);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:g}=nr(e).getComputedStyle(e);c&&(r=vL(r,c,g))}const{top:n,left:s,width:a,height:l,bottom:i,right:o}=r;return{top:n,left:s,width:a,height:l,bottom:i,right:o}}function Bg(e){return _s(e,{ignoreTransform:!0})}function yL(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function wL(e,t){return t===void 0&&(t=nr(e).getComputedStyle(e)),t.position==="fixed"}function SL(e,t){t===void 0&&(t=nr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?r.test(a):!1})}function Ff(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Of(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!qo(s)||_1(s)||r.includes(s))return r;const a=nr(e).getComputedStyle(s);return s!==e&&SL(s,a)&&r.push(s),wL(s,a)?r:n(s.parentNode)}return e?n(e):r}function x1(e){const[t]=Ff(e,1);return t??null}function iu(e){return!cc||!e?null:gs(e)?e:Bf(e)?Of(e)||e===vs(e).scrollingElement?window:qo(e)?e:null:null}function b1(e){return gs(e)?e.scrollX:e.scrollLeft}function C1(e){return gs(e)?e.scrollY:e.scrollTop}function $h(e){return{x:b1(e),y:C1(e)}}var kt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kt||(kt={}));function E1(e){return!cc||!e?!1:e===document.scrollingElement}function k1(e){const t={x:0,y:0},r=E1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:a,isBottom:l,isRight:i,maxScroll:n,minScroll:t}}const xL={x:.2,y:.2};function bL(e,t,r,n,s){let{top:a,left:l,right:i,bottom:o}=r;n===void 0&&(n=10),s===void 0&&(s=xL);const{isTop:c,isBottom:g,isLeft:u,isRight:p}=k1(e),_={x:0,y:0},y={x:0,y:0},v={height:t.height*s.y,width:t.width*s.x};return!c&&a<=t.top+v.height?(_.y=kt.Backward,y.y=n*Math.abs((t.top+v.height-a)/v.height)):!g&&o>=t.bottom-v.height&&(_.y=kt.Forward,y.y=n*Math.abs((t.bottom-v.height-o)/v.height)),!p&&i>=t.right-v.width?(_.x=kt.Forward,y.x=n*Math.abs((t.right-v.width-i)/v.width)):!u&&l<=t.left+v.width&&(_.x=kt.Backward,y.x=n*Math.abs((t.left+v.width-l)/v.width)),{direction:_,speed:y}}function CL(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function L1(e){return e.reduce((t,r)=>Qi(t,$h(r)),Ir)}function EL(e){return e.reduce((t,r)=>t+b1(r),0)}function kL(e){return e.reduce((t,r)=>t+C1(r),0)}function LL(e,t){if(t===void 0&&(t=_s),!e)return;const{top:r,left:n,bottom:s,right:a}=t(e);x1(e)&&(s<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const RL=[["x",["left","right"],EL],["y",["top","bottom"],kL]];class $f{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ff(r),s=L1(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,i]of RL)for(const o of l)Object.defineProperty(this,o,{get:()=>{const c=i(n),g=s[a]-c;return this.rect[o]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class no{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function TL(e){const{EventTarget:t}=nr(e);return e instanceof t?e:vs(e)}function su(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var fr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fr||(fr={}));function Og(e){e.preventDefault()}function DL(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(qe||(qe={}));const R1={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter,qe.Tab]},ML=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case qe.Right:return{...r,x:r.x+25};case qe.Left:return{...r,x:r.x-25};case qe.Down:return{...r,y:r.y+25};case qe.Up:return{...r,y:r.y-25}}};class T1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new no(vs(r)),this.windowListeners=new no(nr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&LL(n),r(Ir)}handleKeyDown(t){if(jf(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:a=R1,coordinateGetter:l=ML,scrollBehavior:i="smooth"}=s,{code:o}=t;if(a.end.includes(o)){this.handleEnd(t);return}if(a.cancel.includes(o)){this.handleCancel(t);return}const{collisionRect:c}=n.current,g=c?{x:c.left,y:c.top}:Ir;this.referenceCoordinates||(this.referenceCoordinates=g);const u=l(t,{active:r,context:n.current,currentCoordinates:g});if(u){const p=Pl(u,g),_={x:0,y:0},{scrollableAncestors:y}=n.current;for(const v of y){const h=t.code,{isTop:f,isRight:d,isLeft:m,isBottom:w,maxScroll:b,minScroll:x}=k1(v),C=CL(v),S={x:Math.min(h===qe.Right?C.right-C.width/2:C.right,Math.max(h===qe.Right?C.left:C.left+C.width/2,u.x)),y:Math.min(h===qe.Down?C.bottom-C.height/2:C.bottom,Math.max(h===qe.Down?C.top:C.top+C.height/2,u.y))},E=h===qe.Right&&!d||h===qe.Left&&!m,L=h===qe.Down&&!w||h===qe.Up&&!f;if(E&&S.x!==u.x){const A=v.scrollLeft+p.x,M=h===qe.Right&&A<=b.x||h===qe.Left&&A>=x.x;if(M&&!p.y){v.scrollTo({left:A,behavior:i});return}M?_.x=v.scrollLeft-A:_.x=h===qe.Right?v.scrollLeft-b.x:v.scrollLeft-x.x,_.x&&v.scrollBy({left:-_.x,behavior:i});break}else if(L&&S.y!==u.y){const A=v.scrollTop+p.y,M=h===qe.Down&&A<=b.y||h===qe.Up&&A>=x.y;if(M&&!p.x){v.scrollTo({top:A,behavior:i});return}M?_.y=v.scrollTop-A:_.y=h===qe.Down?v.scrollTop-b.y:v.scrollTop-x.y,_.y&&v.scrollBy({top:-_.y,behavior:i});break}}this.handleMove(t,Qi(Pl(u,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}T1.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=R1,onActivation:s}=t,{active:a}=r;const{code:l}=e.nativeEvent;if(n.start.includes(l)){const i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Ng(e){return!!(e&&"distance"in e)}function jg(e){return!!(e&&"delay"in e)}class Hf{constructor(t,r,n){var s;n===void 0&&(n=TL(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:l}=a;this.props=t,this.events=r,this.document=vs(l),this.documentListeners=new no(this.document),this.listeners=new no(n),this.windowListeners=new no(nr(l)),this.initialCoordinates=(s=Fh(a))!=null?s:Ir,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.DragStart,Og),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),this.windowListeners.add(fr.ContextMenu,Og),this.documentListeners.add(fr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jg(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Ng(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(fr.Click,DL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:a}=this,{onMove:l,options:{activationConstraint:i}}=a;if(!s)return;const o=(r=Fh(t))!=null?r:Ir,c=Pl(s,o);if(!n&&i){if(Ng(i)){if(i.tolerance!=null&&su(c,i.tolerance))return this.handleCancel();if(su(c,i.distance))return this.handleStart()}if(jg(i)&&su(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),l(o)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const AL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class zf extends Hf{constructor(t){const{event:r}=t,n=vs(r.target);super(t,AL,n)}}zf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const PL={move:{name:"mousemove"},end:{name:"mouseup"}};var Hh;(function(e){e[e.RightClick=2]="RightClick"})(Hh||(Hh={}));class IL extends Hf{constructor(t){super(t,PL,vs(t.event.target))}}IL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Hh.RightClick?!1:(n==null||n({event:r}),!0)}}];const ou={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class BL extends Hf{constructor(t){super(t,ou)}static setup(){return window.addEventListener(ou.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ou.move.name,t)};function t(){}}}BL.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var io;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(io||(io={}));var Bl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Bl||(Bl={}));function OL(e){let{acceleration:t,activator:r=io.Pointer,canScroll:n,draggingRect:s,enabled:a,interval:l=5,order:i=Bl.TreeOrder,pointerCoordinates:o,scrollableAncestors:c,scrollableAncestorRects:g,delta:u,threshold:p}=e;const _=jL({delta:u,disabled:!a}),[y,v]=Vk(),h=k.useRef({x:0,y:0}),f=k.useRef({x:0,y:0}),d=k.useMemo(()=>{switch(r){case io.Pointer:return o?{top:o.y,bottom:o.y,left:o.x,right:o.x}:null;case io.DraggableRect:return s}},[r,s,o]),m=k.useRef(null),w=k.useCallback(()=>{const x=m.current;if(!x)return;const C=h.current.x*f.current.x,S=h.current.y*f.current.y;x.scrollBy(C,S)},[]),b=k.useMemo(()=>i===Bl.TreeOrder?[...c].reverse():c,[i,c]);k.useEffect(()=>{if(!a||!c.length||!d){v();return}for(const x of b){if((n==null?void 0:n(x))===!1)continue;const C=c.indexOf(x),S=g[C];if(!S)continue;const{direction:E,speed:L}=bL(x,S,d,t,p);for(const A of["x","y"])_[A][E[A]]||(L[A]=0,E[A]=0);if(L.x>0||L.y>0){v(),m.current=x,y(w,l),h.current=L,f.current=E;return}}h.current={x:0,y:0},f.current={x:0,y:0},v()},[t,w,n,v,a,l,JSON.stringify(d),JSON.stringify(_),y,c,b,g,JSON.stringify(p)])}const NL={x:{[kt.Backward]:!1,[kt.Forward]:!1},y:{[kt.Backward]:!1,[kt.Forward]:!1}};function jL(e){let{delta:t,disabled:r}=e;const n=jh(t);return Xo(s=>{if(r||!n||!s)return NL;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[kt.Backward]:s.x[kt.Backward]||a.x===-1,[kt.Forward]:s.x[kt.Forward]||a.x===1},y:{[kt.Backward]:s.y[kt.Backward]||a.y===-1,[kt.Forward]:s.y[kt.Forward]||a.y===1}}},[r,t,n])}function FL(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Xo(s=>{var a;return t==null?null:(a=n??s)!=null?a:null},[n,t])}function $L(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,a=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...r,...a]},[]),[e,t])}var Po;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Po||(Po={}));var zh;(function(e){e.Optimized="optimized"})(zh||(zh={}));const Fg=new Map;function HL(e,t){let{dragging:r,dependencies:n,config:s}=t;const[a,l]=k.useState(null),{frequency:i,measure:o,strategy:c}=s,g=k.useRef(e),u=h(),p=Mo(u),_=k.useCallback(function(f){f===void 0&&(f=[]),!p.current&&l(d=>d===null?f:d.concat(f.filter(m=>!d.includes(m))))},[p]),y=k.useRef(null),v=Xo(f=>{if(u&&!r)return Fg;if(!f||f===Fg||g.current!==e||a!=null){const d=new Map;for(let m of e){if(!m)continue;if(a&&a.length>0&&!a.includes(m.id)&&m.rect.current){d.set(m.id,m.rect.current);continue}const w=m.node.current,b=w?new $f(o(w),w):null;m.rect.current=b,b&&d.set(m.id,b)}return d}return f},[e,a,r,u,o]);return k.useEffect(()=>{g.current=e},[e]),k.useEffect(()=>{u||_()},[r,u]),k.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),k.useEffect(()=>{u||typeof i!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},i))},[i,u,_,...n]),{droppableRects:v,measureDroppableContainers:_,measuringScheduled:a!=null};function h(){switch(c){case Po.Always:return!1;case Po.BeforeDragging:return r;default:return!r}}}function D1(e,t){return Xo(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function zL(e,t){return D1(e,t)}function UL(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function uc(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function WL(e){return new $f(_s(e),e)}function $g(e,t,r){t===void 0&&(t=WL);const[n,s]=k.useState(null);function a(){s(o=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=o??r)!=null?c:null}const g=t(e);return JSON.stringify(o)===JSON.stringify(g)?o:g})}const l=UL({callback(o){if(e)for(const c of o){const{type:g,target:u}=c;if(g==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),i=uc({callback:a});return Ur(()=>{a(),e?(i==null||i.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[e]),n}function VL(e){const t=D1(e);return S1(e,t)}const Hg=[];function KL(e){const t=k.useRef(e),r=Xo(n=>e?n&&n!==Hg&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ff(e):Hg,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function GL(e){const[t,r]=k.useState(null),n=k.useRef(e),s=k.useCallback(a=>{const l=iu(a.target);l&&r(i=>i?(i.set(l,$h(l)),new Map(i)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){l(a);const i=e.map(o=>{const c=iu(o);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,$h(c)]):null}).filter(o=>o!=null);r(i.length?new Map(i):null),n.current=e}return()=>{l(e),l(a)};function l(i){i.forEach(o=>{const c=iu(o);c==null||c.removeEventListener("scroll",s)})}},[s,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>Qi(a,l),Ir):L1(e):Ir,[e,t])}function zg(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==Ir;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Pl(e,r.current):Ir}function qL(e){k.useEffect(()=>{if(!cc)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function XL(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:a}=n;return r[s]=l=>{a(l,t)},r},{}),[e,t])}function M1(e){return k.useMemo(()=>e?yL(e):null,[e])}const Ug=[];function YL(e,t){t===void 0&&(t=_s);const[r]=e,n=M1(r?nr(r):null),[s,a]=k.useState(Ug);function l(){a(()=>e.length?e.map(o=>E1(o)?n:new $f(t(o),o)):Ug)}const i=uc({callback:l});return Ur(()=>{i==null||i.disconnect(),l(),e.forEach(o=>i==null?void 0:i.observe(o))},[e]),s}function JL(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qo(t)?t:e}function QL(e){let{measure:t}=e;const[r,n]=k.useState(null),s=k.useCallback(c=>{for(const{target:g}of c)if(qo(g)){n(u=>{const p=t(g);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),a=uc({callback:s}),l=k.useCallback(c=>{const g=JL(c);a==null||a.disconnect(),g&&(a==null||a.observe(g)),n(g?t(g):null)},[t,a]),[i,o]=Al(l);return k.useMemo(()=>({nodeRef:i,rect:r,setRef:o}),[r,i,o])}const ZL=[{sensor:zf,options:{}},{sensor:T1,options:{}}],eR={current:{}},Xa={draggable:{measure:Bg},droppable:{measure:Bg,strategy:Po.WhileDragging,frequency:zh.Optimized},dragOverlay:{measure:_s}};class so extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const tR={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new so,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Il},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xa,measureDroppableContainers:Il,windowRect:null,measuringScheduled:!1},rR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Il,draggableNodes:new Map,over:null,measureDroppableContainers:Il},hc=k.createContext(rR),A1=k.createContext(tR);function nR(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new so}}}function iR(e,t){switch(t.type){case wt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wt.DragEnd:case wt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wt.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new so(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case wt.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const l=new so(e.droppable.containers);return l.set(r,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case wt.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const a=new so(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sR(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=k.useContext(hc),a=jh(n),l=jh(r==null?void 0:r.id);return k.useEffect(()=>{if(!t&&!n&&a&&l!=null){if(!jf(a)||document.activeElement===a.target)return;const i=s.get(l);if(!i)return;const{activatorNode:o,node:c}=i;if(!o.current&&!c.current)return;requestAnimationFrame(()=>{for(const g of[o.current,c.current]){if(!g)continue;const u=qk(g);if(u){u.focus();break}}})}},[n,t,s,l,a]),null}function oR(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...n}),r):r}function aR(e){return k.useMemo(()=>({draggable:{...Xa.draggable,...e==null?void 0:e.draggable},droppable:{...Xa.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Xa.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lR(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const a=k.useRef(!1),{x:l,y:i}=typeof s=="boolean"?{x:s,y:s}:s;Ur(()=>{if(!l&&!i||!t){a.current=!1;return}if(a.current||!n)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const g=r(c),u=S1(g,n);if(l||(u.x=0),i||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=x1(c);p&&p.scrollBy({top:u.y,left:u.x})}},[t,l,i,n,r])}const P1=k.createContext({...Ir,scaleX:1,scaleY:1});var wn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(wn||(wn={}));const cR=k.memo(function(t){var r,n,s,a;let{id:l,accessibility:i,autoScroll:o=!0,children:c,sensors:g=ZL,collisionDetection:u=dL,measuring:p,modifiers:_,...y}=t;const v=k.useReducer(iR,void 0,nR),[h,f]=v,[d,m]=eL(),[w,b]=k.useState(wn.Uninitialized),x=w===wn.Initialized,{draggable:{active:C,nodes:S,translate:E},droppable:{containers:L}}=h,A=C!=null?S.get(C):null,M=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var De;return C!=null?{id:C,data:(De=A==null?void 0:A.data)!=null?De:eR,rect:M}:null},[C,A]),O=k.useRef(null),[H,F]=k.useState(null),[$,N]=k.useState(null),R=Mo(y,Object.values(y)),P=Yo("DndDescribedBy",l),B=k.useMemo(()=>L.getEnabled(),[L]),j=aR(p),{droppableRects:W,measureDroppableContainers:K,measuringScheduled:Z}=HL(B,{dragging:x,dependencies:[E.x,E.y],config:j.droppable}),ee=FL(S,C),z=k.useMemo(()=>$?Fh($):null,[$]),I=Fe(),V=zL(ee,j.draggable.measure);lR({activeNode:C!=null?S.get(C):null,config:I.layoutShiftCompensation,initialRect:V,measure:j.draggable.measure});const U=$g(ee,j.draggable.measure,V),J=$g(ee?ee.parentElement:null),X=k.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=L.getNodeFor((r=X.current.over)==null?void 0:r.id),ce=QL({measure:j.dragOverlay.measure}),fe=(n=ce.nodeRef.current)!=null?n:ee,Ee=x?(s=ce.rect)!=null?s:U:null,ae=!!(ce.nodeRef.current&&ce.rect),Te=VL(ae?null:U),je=M1(fe?nr(fe):null),pe=KL(x?me??ee:null),_e=YL(pe),ke=oR(_,{transform:{x:E.x-Te.x,y:E.y-Te.y,scaleX:1,scaleY:1},activatorEvent:$,active:D,activeNodeRect:U,containerNodeRect:J,draggingNodeRect:Ee,over:X.current.over,overlayNodeRect:ce.rect,scrollableAncestors:pe,scrollableAncestorRects:_e,windowRect:je}),se=z?Qi(z,E):null,be=GL(pe),oe=zg(be),he=zg(be,[U]),Le=Qi(ke,oe),Re=Ee?mL(Ee,ke):null,Ce=D&&Re?u({active:D,collisionRect:Re,droppableRects:W,droppableContainers:B,pointerCoordinates:se}):null,q=cL(Ce,"id"),[Q,ge]=k.useState(null),He=ae?ke:Qi(ke,he),ie=fL(He,(a=Q==null?void 0:Q.rect)!=null?a:null,U),G=k.useRef(null),re=k.useCallback((De,Be)=>{let{sensor:Pe,options:Ue}=Be;if(O.current==null)return;const Me=S.get(O.current);if(!Me)return;const ze=De.nativeEvent,Je=new Pe({active:O.current,activeNode:Me,event:ze,options:Ue,context:X,onAbort(we){if(!S.get(we))return;const{onDragAbort:Ke}=R.current,Ge={id:we};Ke==null||Ke(Ge),d({type:"onDragAbort",event:Ge})},onPending(we,Ae,Ke,Ge){if(!S.get(we))return;const{onDragPending:xt}=R.current,dt={id:we,constraint:Ae,initialCoordinates:Ke,offset:Ge};xt==null||xt(dt),d({type:"onDragPending",event:dt})},onStart(we){const Ae=O.current;if(Ae==null)return;const Ke=S.get(Ae);if(!Ke)return;const{onDragStart:Ge}=R.current,lt={activatorEvent:ze,active:{id:Ae,data:Ke.data,rect:M}};jr.unstable_batchedUpdates(()=>{Ge==null||Ge(lt),b(wn.Initializing),f({type:wt.DragStart,initialCoordinates:we,active:Ae}),d({type:"onDragStart",event:lt}),F(G.current),N(ze)})},onMove(we){f({type:wt.DragMove,coordinates:we})},onEnd:nt(wt.DragEnd),onCancel:nt(wt.DragCancel)});G.current=Je;function nt(we){return async function(){const{active:Ke,collisions:Ge,over:lt,scrollAdjustedTranslate:xt}=X.current;let dt=null;if(Ke&&xt){const{cancelDrop:Wt}=R.current;dt={activatorEvent:ze,active:Ke,collisions:Ge,delta:xt,over:lt},we===wt.DragEnd&&typeof Wt=="function"&&await Promise.resolve(Wt(dt))&&(we=wt.DragCancel)}O.current=null,jr.unstable_batchedUpdates(()=>{f({type:we}),b(wn.Uninitialized),ge(null),F(null),N(null),G.current=null;const Wt=we===wt.DragEnd?"onDragEnd":"onDragCancel";if(dt){const Wr=R.current[Wt];Wr==null||Wr(dt),d({type:Wt,event:dt})}})}}},[S]),le=k.useCallback((De,Be)=>(Pe,Ue)=>{const Me=Pe.nativeEvent,ze=S.get(Ue);if(O.current!==null||!ze||Me.dndKit||Me.defaultPrevented)return;const Je={active:ze};De(Pe,Be.options,Je)===!0&&(Me.dndKit={capturedBy:Be.sensor},O.current=Ue,re(Pe,Be))},[S,re]),te=$L(g,le);qL(g),Ur(()=>{U&&w===wn.Initializing&&b(wn.Initialized)},[U,w]),k.useEffect(()=>{const{onDragMove:De}=R.current,{active:Be,activatorEvent:Pe,collisions:Ue,over:Me}=X.current;if(!Be||!Pe)return;const ze={active:Be,activatorEvent:Pe,collisions:Ue,delta:{x:Le.x,y:Le.y},over:Me};jr.unstable_batchedUpdates(()=>{De==null||De(ze),d({type:"onDragMove",event:ze})})},[Le.x,Le.y]),k.useEffect(()=>{const{active:De,activatorEvent:Be,collisions:Pe,droppableContainers:Ue,scrollAdjustedTranslate:Me}=X.current;if(!De||O.current==null||!Be||!Me)return;const{onDragOver:ze}=R.current,Je=Ue.get(q),nt=Je&&Je.rect.current?{id:Je.id,rect:Je.rect.current,data:Je.data,disabled:Je.disabled}:null,we={active:De,activatorEvent:Be,collisions:Pe,delta:{x:Me.x,y:Me.y},over:nt};jr.unstable_batchedUpdates(()=>{ge(nt),ze==null||ze(we),d({type:"onDragOver",event:we})})},[q]),Ur(()=>{X.current={activatorEvent:$,active:D,activeNode:ee,collisionRect:Re,collisions:Ce,droppableRects:W,draggableNodes:S,draggingNode:fe,draggingNodeRect:Ee,droppableContainers:L,over:Q,scrollableAncestors:pe,scrollAdjustedTranslate:Le},M.current={initial:Ee,translated:Re}},[D,ee,Ce,Re,S,fe,Ee,W,L,Q,pe,Le]),OL({...I,delta:E,draggingRect:Re,pointerCoordinates:se,scrollableAncestors:pe,scrollableAncestorRects:_e});const ue=k.useMemo(()=>({active:D,activeNode:ee,activeNodeRect:U,activatorEvent:$,collisions:Ce,containerNodeRect:J,dragOverlay:ce,draggableNodes:S,droppableContainers:L,droppableRects:W,over:Q,measureDroppableContainers:K,scrollableAncestors:pe,scrollableAncestorRects:_e,measuringConfiguration:j,measuringScheduled:Z,windowRect:je}),[D,ee,U,$,Ce,J,ce,S,L,W,Q,K,pe,_e,j,Z,je]),Oe=k.useMemo(()=>({activatorEvent:$,activators:te,active:D,activeNodeRect:U,ariaDescribedById:{draggable:P},dispatch:f,draggableNodes:S,over:Q,measureDroppableContainers:K}),[$,te,D,U,f,P,S,Q,K]);return mt.createElement(w1.Provider,{value:m},mt.createElement(hc.Provider,{value:Oe},mt.createElement(A1.Provider,{value:ue},mt.createElement(P1.Provider,{value:ie},c)),mt.createElement(sR,{disabled:(i==null?void 0:i.restoreFocus)===!1})),mt.createElement(nL,{...i,hiddenTextDescribedById:P}));function Fe(){const De=(H==null?void 0:H.autoScrollEnabled)===!1,Be=typeof o=="object"?o.enabled===!1:o===!1,Pe=x&&!De&&!Be;return typeof o=="object"?{...o,enabled:Pe}:{enabled:Pe}}}),uR=k.createContext(null),Wg="button",hR="Draggable";function dR(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const a=Yo(hR),{activators:l,activatorEvent:i,active:o,activeNodeRect:c,ariaDescribedById:g,draggableNodes:u,over:p}=k.useContext(hc),{role:_=Wg,roleDescription:y="draggable",tabIndex:v=0}=s??{},h=(o==null?void 0:o.id)===t,f=k.useContext(h?P1:uR),[d,m]=Al(),[w,b]=Al(),x=XL(l,t),C=Mo(r);Ur(()=>(u.set(t,{id:t,key:a,node:d,activatorNode:w,data:C}),()=>{const E=u.get(t);E&&E.key===a&&u.delete(t)}),[u,t]);const S=k.useMemo(()=>({role:_,tabIndex:v,"aria-disabled":n,"aria-pressed":h&&_===Wg?!0:void 0,"aria-roledescription":y,"aria-describedby":g.draggable}),[n,_,v,h,y,g.draggable]);return{active:o,activatorEvent:i,activeNodeRect:c,attributes:S,isDragging:h,listeners:n?void 0:x,node:d,over:p,setNodeRef:m,setActivatorNodeRef:b,transform:f}}function fR(){return k.useContext(A1)}const pR="Droppable",mR={timeout:25};function gR(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const a=Yo(pR),{active:l,dispatch:i,over:o,measureDroppableContainers:c}=k.useContext(hc),g=k.useRef({disabled:r}),u=k.useRef(!1),p=k.useRef(null),_=k.useRef(null),{disabled:y,updateMeasurementsFor:v,timeout:h}={...mR,...s},f=Mo(v??n),d=k.useCallback(()=>{if(!u.current){u.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),_.current=null},h)},[h]),m=uc({callback:d,disabled:y||!l}),w=k.useCallback((S,E)=>{m&&(E&&(m.unobserve(E),u.current=!1),S&&m.observe(S))},[m]),[b,x]=Al(w),C=Mo(t);return k.useEffect(()=>{!m||!b.current||(m.disconnect(),u.current=!1,m.observe(b.current))},[b,m]),k.useEffect(()=>(i({type:wt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:b,rect:p,data:C}}),()=>i({type:wt.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==g.current.disabled&&(i({type:wt.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,i]),{active:l,rect:p,isOver:(o==null?void 0:o.id)===n,node:b,over:o,setNodeRef:x}}function I1(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function vR(e,t){return e.reduce((r,n,s)=>{const a=t.get(n);return a&&(r[s]=a),r},Array(e.length))}function ba(e){return e!==null&&e>=0}function _R(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function yR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B1=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const a=I1(t,n,r),l=t[s],i=a[s];return!i||!l?null:{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}},Ca={scaleX:1,scaleY:1},wR=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:a,overIndex:l}=e;const i=(t=a[r])!=null?t:n;if(!i)return null;if(s===r){const c=a[l];return c?{x:0,y:r<l?c.top+c.height-(i.top+i.height):c.top-i.top,...Ca}:null}const o=SR(a,s,r);return s>r&&s<=l?{x:0,y:-i.height-o,...Ca}:s<r&&s>=l?{x:0,y:i.height+o,...Ca}:{x:0,y:0,...Ca}};function SR(e,t,r){const n=e[t],s=e[t-1],a=e[t+1];return n?r<t?s?n.top-(s.top+s.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const O1="Sortable",N1=mt.createContext({activeIndex:-1,containerId:O1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B1,disabled:{draggable:!1,droppable:!1}});function xR(e){let{children:t,id:r,items:n,strategy:s=B1,disabled:a=!1}=e;const{active:l,dragOverlay:i,droppableRects:o,over:c,measureDroppableContainers:g}=fR(),u=Yo(O1,r),p=i.rect!==null,_=k.useMemo(()=>n.map(x=>typeof x=="object"&&"id"in x?x.id:x),[n]),y=l!=null,v=l?_.indexOf(l.id):-1,h=c?_.indexOf(c.id):-1,f=k.useRef(_),d=!_R(_,f.current),m=h!==-1&&v===-1||d,w=yR(a);Ur(()=>{d&&y&&g(_)},[d,_,y,g]),k.useEffect(()=>{f.current=_},[_]);const b=k.useMemo(()=>({activeIndex:v,containerId:u,disabled:w,disableTransforms:m,items:_,overIndex:h,useDragOverlay:p,sortedRects:vR(_,o),strategy:s}),[v,u,w.draggable,w.droppable,m,_,h,o,p,s]);return mt.createElement(N1.Provider,{value:b},t)}const bR=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return I1(r,n,s).indexOf(t)},CR=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:a,newIndex:l,previousItems:i,previousContainerId:o,transition:c}=e;return!c||!n||i!==a&&s===l?!1:r?!0:l!==s&&t===o},ER={duration:200,easing:"ease"},j1="transform",kR=Ao.Transition.toString({property:j1,duration:0,easing:"linear"}),LR={roleDescription:"sortable"};function RR(e){let{disabled:t,index:r,node:n,rect:s}=e;const[a,l]=k.useState(null),i=k.useRef(r);return Ur(()=>{if(!t&&r!==i.current&&n.current){const o=s.current;if(o){const c=_s(n.current,{ignoreTransform:!0}),g={x:o.left-c.left,y:o.top-c.top,scaleX:o.width/c.width,scaleY:o.height/c.height};(g.x||g.y)&&l(g)}}r!==i.current&&(i.current=r)},[t,r,n,s]),k.useEffect(()=>{a&&l(null)},[a]),a}function TR(e){let{animateLayoutChanges:t=CR,attributes:r,disabled:n,data:s,getNewIndex:a=bR,id:l,strategy:i,resizeObserverConfig:o,transition:c=ER}=e;const{items:g,containerId:u,activeIndex:p,disabled:_,disableTransforms:y,sortedRects:v,overIndex:h,useDragOverlay:f,strategy:d}=k.useContext(N1),m=DR(n,_),w=g.indexOf(l),b=k.useMemo(()=>({sortable:{containerId:u,index:w,items:g},...s}),[u,s,w,g]),x=k.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:C,node:S,isOver:E,setNodeRef:L}=gR({id:l,data:b,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...o}}),{active:A,activatorEvent:M,activeNodeRect:D,attributes:O,setNodeRef:H,listeners:F,isDragging:$,over:N,setActivatorNodeRef:R,transform:P}=dR({id:l,data:b,attributes:{...LR,...r},disabled:m.draggable}),B=Wk(L,H),j=!!A,W=j&&!y&&ba(p)&&ba(h),K=!f&&$,Z=K&&W?P:null,z=W?Z??(i??d)({rects:v,activeNodeRect:D,activeIndex:p,overIndex:h,index:w}):null,I=ba(p)&&ba(h)?a({id:l,items:g,activeIndex:p,overIndex:h}):w,V=A==null?void 0:A.id,U=k.useRef({activeId:V,items:g,newIndex:I,containerId:u}),J=g!==U.current.items,X=t({active:A,containerId:u,isDragging:$,isSorting:j,id:l,index:w,items:g,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:c,wasDragging:U.current.activeId!=null}),me=RR({disabled:!X,index:w,node:S,rect:C});return k.useEffect(()=>{j&&U.current.newIndex!==I&&(U.current.newIndex=I),u!==U.current.containerId&&(U.current.containerId=u),g!==U.current.items&&(U.current.items=g)},[j,I,u,g]),k.useEffect(()=>{if(V===U.current.activeId)return;if(V!=null&&U.current.activeId==null){U.current.activeId=V;return}const fe=setTimeout(()=>{U.current.activeId=V},50);return()=>clearTimeout(fe)},[V]),{active:A,activeIndex:p,attributes:O,data:b,rect:C,index:w,newIndex:I,items:g,isOver:E,isSorting:j,isDragging:$,listeners:F,node:S,overIndex:h,over:N,setNodeRef:B,setActivatorNodeRef:R,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:me??z,transition:ce()};function ce(){if(me||J&&U.current.newIndex===w)return kR;if(!(K&&!jf(M)||!c)&&(j||X))return Ao.Transition.toString({...c,property:j1})}}function DR(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}qe.Down,qe.Right,qe.Up,qe.Left;const Ea={permission:0,waiting:1,working:2,unknown:3};function oo(e){var r;const t=(r=e.agentSessionId)==null?void 0:r.trim();return t&&t.length>0?t:e.id}const MR={mode:"created",direction:"desc"};function Uf(e,t=MR){const{mode:r,direction:n,manualOrder:s}=t;if(r==="manual"&&s&&s.length>0){const a=new Map(s.map((l,i)=>[l,i]));return[...e].sort((l,i)=>{const o=oo(l),c=oo(i),g=a.get(o)??a.get(l.id)??1/0,u=a.get(c)??a.get(i.id)??1/0;return g===1/0&&u===1/0?Date.parse(i.createdAt)-Date.parse(l.createdAt):g-u})}return[...e].sort((a,l)=>{if(r==="status"){const c=Ea[a.status]??Ea.unknown,g=Ea[l.status]??Ea.unknown;return c!==g?c-g:Date.parse(l.lastActivity)-Date.parse(a.lastActivity)}const i=Date.parse(a.createdAt),o=Date.parse(l.createdAt);return n==="desc"?o-i:i-o})}function AR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.projectPath)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.projectPath)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).sort((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function PR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.host)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.host)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).sort((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function Wf(e){const t=Date.parse(e);if(Number.isNaN(t))return"";const r=Date.now()-t,n=Math.floor(r/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function ui(e){const t=e.trim();if(!t)return null;const r=t.replace(/[\\/]+$/,"");if(!r)return null;const n=r.split(/[\\/]/);return n[n.length-1]||null}function IR(e){const t=e.map(i=>{const o=i.trim(),c=o.replace(/[\\/]+$/,""),g=c.split(/[\\/]/).filter(Boolean);return{path:i,parts:g,fallback:c||o||i}}),r=new Map;for(const i of t)r.set(i.path,1);let n=!0;for(;n;){n=!1;const i=new Map;for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");i.set(g,(i.get(g)??0)+1)}for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");(i.get(g)??0)>1&&c<o.parts.length&&(r.set(o.path,c+1),n=!0)}}const s=new Map,a=new Map;for(const i of t){let o=i.fallback;if(i.parts.length>0){const c=r.get(i.path)??1;o=i.parts.slice(-c).join("/")}s.set(i.path,o),a.set(o,(a.get(o)??0)+1)}const l=new Map;for(const i of t){let o=s.get(i.path)??i.fallback;(a.get(o)??0)>1&&(o=i.fallback),l.set(i.path,o)}return l}function F1(e){const t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}const We=Yd()(Jd((e,t)=>({sessions:[],agentSessions:{active:[],inactive:[]},hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,hasLoaded:!1,connectionStatus:"connecting",connectionError:null,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,setSessions:r=>{var g;const n=t(),s=n.selectedSessionId,a=n.sessions,l=n.exitingSessions,i=new Set(r.map(u=>u.id)),o=a.filter(u=>!i.has(u.id)&&!l.has(u.id));let c=s;if(s!==null&&!r.some(u=>u.id===s)){const{sessionSortMode:u,sessionSortDirection:p}=de.getState();c=((g=Uf(r,{mode:u,direction:p})[0])==null?void 0:g.id)??null}if(o.length>0){const u=new Map(l);for(const p of o)u.set(p.id,p);e({sessions:r,hasLoaded:!0,selectedSessionId:c,exitingSessions:u})}else e({sessions:r,hasLoaded:!0,selectedSessionId:c})},setAgentSessions:(r,n)=>e({agentSessions:{active:r,inactive:n}}),setHostStatuses:r=>e({hostStatuses:r}),updateSession:r=>e(n=>({sessions:n.sessions.map(s=>s.id===r.id?r:s)})),setSelectedSessionId:r=>e({selectedSessionId:r}),setConnectionStatus:r=>e({connectionStatus:r}),setConnectionError:r=>e({connectionError:r}),setRemoteAllowControl:r=>e({remoteAllowControl:r}),setRemoteAllowAttach:r=>e({remoteAllowAttach:r}),setHostLabel:r=>e({hostLabel:r}),markSessionExiting:r=>{const n=t().sessions.find(s=>s.id===r);if(n){const s=new Map(t().exitingSessions);s.set(r,n),e({exitingSessions:s})}},clearExitingSession:r=>{const n=new Map(t().exitingSessions);n.delete(r),e({exitingSessions:n})}}),{name:"agentboard-session",storage:ic(()=>Qd),partialize:e=>({selectedSessionId:e.selectedSessionId})}));function Vg(e,t,r=!1){const[n,s]=k.useState(!1),a=k.useRef(e),l=k.useRef(!1);return k.useEffect(()=>{const o=a.current;if(r?e>o:e!==o){l.current=!0;const g=setTimeout(()=>{l.current&&(s(!0),l.current=!1)},t);return a.current=e,()=>clearTimeout(g)}a.current=e},[e,t,r]),[n,()=>s(!1)]}function BR(e,t,r,n){const s=k.useRef(new Map);k.useEffect(()=>{const a=new Set(e.map(l=>l.id));for(const l of t.keys())if(a.has(l)){const i=s.current.get(l);i&&(clearTimeout(i),s.current.delete(l)),r(l)}else if(!s.current.has(l)){const i=setTimeout(()=>{s.current.delete(l),r(l)},n+100);s.current.set(l,i)}},[e,t,r,n]),k.useEffect(()=>()=>{for(const a of s.current.values())clearTimeout(a);s.current.clear()},[])}function OR({className:e}){return T.jsx("svg",{viewBox:"0 0 92.2 92.2",fill:"currentColor",className:e,"aria-label":"Anthropic",children:T.jsx("path",{d:"M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z",transform:"translate(0, 13.6)"})})}function NR({className:e}){return T.jsx("svg",{viewBox:"-1 -1 26 26",fill:"currentColor",className:e,"aria-label":"OpenAI",children:T.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function jR({className:e}){return T.jsx("svg",{viewBox:"0 0 588.42 568.88",fill:"currentColor",className:e,"aria-label":"Pi",children:T.jsx("path",{d:"M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z"})})}const FR=[["claude",OR],["codex",NR],["pi",jR]];function dc({agentType:e,command:t,className:r=""}){const n=(e||(t==null?void 0:t.split(" ")[0])||"").toLowerCase();for(const[s,a]of FR)if(n.startsWith(s))return T.jsx(a,{className:r});return T.jsx(iC,{className:r})}const $R=360;function HR(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t)}function $1(e){return{"--badge-hue":`${HR(e)%$R}`}}function H1({name:e,fullPath:t,className:r=""}){const n=$1(e);return T.jsx("span",{className:`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none ${r}`,style:n,title:t,children:e})}const zR=k.memo(function({session:t,showSessionIdPrefix:r,showProjectName:n,showLastUserMessage:s,onResume:a,onPreview:l,onSetPinned:i}){const o=Wf(t.lastActivityAt),c=ui(t.projectPath),g=t.displayName||c||t.sessionId.slice(0,8),u=n&&!!c,p=s&&!!t.lastUserMessage,_=r?F1(t.sessionId):"",y=k.useRef(null),[v,h]=k.useState(null);k.useEffect(()=>{if(!v)return;const d=w=>{y.current&&!y.current.contains(w.target)&&h(null)},m=w=>{w.key==="Escape"&&h(null)};return document.addEventListener("mousedown",d),document.addEventListener("touchstart",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("touchstart",d),document.removeEventListener("keydown",m)}},[v]);const f=d=>{d.preventDefault(),d.stopPropagation(),h({x:d.clientX,y:d.clientY})};return T.jsxs("div",{className:"group relative cursor-pointer px-3 py-2 hover:bg-hover",role:"button",tabIndex:0,title:"Click to preview",onClick:()=>l(t),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l(t))},onContextMenu:f,children:[T.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100",title:"Resume directly",onClick:d=>{d.stopPropagation(),a(t.sessionId)},children:"▶"}),T.jsxs("div",{className:"flex flex-col gap-0.5 pl-2.5 group-hover:pr-4",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:t.agentType,className:"h-3.5 w-3.5 shrink-0 text-muted"}),T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:g}),t.lastResumeError&&T.jsx(Ab,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Resume failed",title:`Last resume failed: ${t.lastResumeError}`}),t.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-muted","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),_&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:t.sessionId,children:_}),T.jsx("span",{className:"ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted",children:o})]}),(u||p)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[u&&T.jsx(H1,{name:c,fullPath:t.projectPath}),p&&T.jsxs("span",{className:"truncate text-xs italic text-muted",children:['"',t.lastUserMessage.length>200?t.lastUserMessage.slice(0,200)+"…":t.lastUserMessage,'"']})]})]}),v&&T.jsxs("div",{ref:y,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:v.x,top:v.y},role:"menu",children:[i&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),h(null),i(t.sessionId,!t.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),t.isPinned?"Unpin":"Pin"]}),t.logFilePath&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),navigator.clipboard.writeText(t.logFilePath).catch(()=>{}),h(null)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]})]})]})});function UR({name:e,className:t=""}){const r=$1(`host:${e}`);return T.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide ${t}`,style:r,title:e,children:e})}function WR({hosts:e,selectedHosts:t,onSelect:r,statuses:n=[]}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>new Set(t),[t]),c=k.useMemo(()=>new Map(n.map(_=>[_.host,_])),[n]),g=k.useMemo(()=>t.length===0?"All Hosts":t.join(", "),[t]),u=k.useMemo(()=>t.length===0?"All Hosts":t.length===1?t[0]:`${t.length} hosts`,[t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const _=v=>{var f;const h=v.target;h&&((f=i.current)!=null&&f.contains(h))||a(!1)},y=v=>{v.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",y)}},[s]);const p=_=>{const y=new Set(o);y.has(_)?y.delete(_):y.add(_);const v=e.filter(h=>y.has(h));r(v)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by host",onClick:()=>a(_=>!_),className:"flex h-6 max-w-[9rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:g,children:[T.jsx("span",{className:"truncate",children:u}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-48 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{role:"menuitemcheckbox","aria-checked":t.length===0,className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Hosts"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No hosts"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(_=>{const y=c.get(_),v=y?!y.ok:!1;return T.jsxs("label",{role:"menuitemcheckbox","aria-checked":o.has(_),className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y!=null&&y.error?`${_}: ${y.error}`:_,children:[T.jsx("input",{type:"checkbox",checked:o.has(_),onChange:()=>p(_),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:_}),v&&T.jsx("span",{className:"ml-auto text-[10px] uppercase text-danger",children:"offline"})]},_)})})]})]})}function VR({projects:e,selectedProjects:t,onSelect:r,hasHiddenPermissions:n}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>IR(e),[e]),c=k.useMemo(()=>new Set(t),[t]),g=n&&t.length>0,u=k.useMemo(()=>t.length===0?"All Projects":t.map(y=>o.get(y)??ui(y)??y).join(", "),[o,t]),p=k.useMemo(()=>{if(t.length===0)return"All Projects";if(t.length===1){const y=t[0];return o.get(y)??ui(y)??y}return`${t.length} projects`},[o,t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const y=h=>{var d;const f=h.target;f&&((d=i.current)!=null&&d.contains(f))||a(!1)},v=h=>{h.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y,{passive:!0}),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[s]);const _=y=>{const v=new Set(c);v.has(y)?v.delete(y):v.add(y);const h=e.filter(f=>v.has(f));r(h)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by project",onClick:()=>a(y=>!y),className:"flex h-6 max-w-[11rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:u,children:[T.jsx("span",{className:"truncate",children:p}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-60 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Projects"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No projects"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(y=>{const v=o.get(y)??ui(y)??y;return T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y,children:[T.jsx("input",{type:"checkbox",checked:c.has(y),onChange:()=>_(y),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:v})]},y)})})]}),g&&T.jsx("button",{type:"button",className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated",title:"Hidden sessions need attention","aria-label":"Clear project filters",onClick:y=>{y.stopPropagation(),r([])},children:T.jsx("span",{className:"sr-only",children:"Clear project filters"})})]})}function KR(e){if(!e.trim())return null;try{const t=JSON.parse(e);let r="",n="other";if(typeof t.message=="string")r=t.message;else if(typeof t.content=="string")r=t.content;else if(t.type==="user"&&typeof t.message=="object"){const s=t.message;r=typeof s.content=="string"?s.content:"",n="user"}else if(t.type==="assistant"&&t.message){const s=t.message;typeof s.content=="string"?r=s.content:Array.isArray(s.content)&&(r=s.content.filter(a=>typeof a=="object"&&a!==null&&"text"in a).map(a=>a.text).join(`
52
+ `},rL={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function nL(e){let{announcements:t=rL,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=tL}=e;const{announce:a,announcement:l}=Qk(),i=Yo("DndLiveRegion"),[o,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),Zk(k.useMemo(()=>({onDragStart(u){let{active:p}=u;a(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:_}=u;t.onDragMove&&a(t.onDragMove({active:p,over:_}))},onDragOver(u){let{active:p,over:_}=u;a(t.onDragOver({active:p,over:_}))},onDragEnd(u){let{active:p,over:_}=u;a(t.onDragEnd({active:p,over:_}))},onDragCancel(u){let{active:p,over:_}=u;a(t.onDragCancel({active:p,over:_}))}}),[a,t])),!o)return null;const g=mt.createElement(mt.Fragment,null,mt.createElement(Yk,{id:n,value:s.draggable}),mt.createElement(Jk,{id:i,announcement:l}));return r?jr.createPortal(g,r):g}var wt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wt||(wt={}));function Il(){}function iL(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function sL(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Ir=Object.freeze({x:0,y:0});function oL(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function lL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function cL(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Ig(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const uL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Ig(t,t.left,t.top),a=[];for(const l of n){const{id:i}=l,o=r.get(i);if(o){const c=oL(Ig(o),s);a.push({id:i,data:{droppableContainer:l,value:c}})}}return a.sort(aL)};function hL(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=s-n,i=a-r;if(n<s&&r<a){const o=t.width*t.height,c=e.width*e.height,g=l*i,u=g/(o+c-g);return Number(u.toFixed(4))}return 0}const dL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const a of n){const{id:l}=a,i=r.get(l);if(i){const o=hL(i,t);o>0&&s.push({id:l,data:{droppableContainer:a,value:o}})}}return s.sort(lL)};function fL(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function S1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ir}function pL(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((l,i)=>({...l,top:l.top+e*i.y,bottom:l.bottom+e*i.y,left:l.left+e*i.x,right:l.right+e*i.x}),{...r})}}const mL=pL(1);function gL(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vL(e,t,r){const n=gL(t);if(!n)return e;const{scaleX:s,scaleY:a,x:l,y:i}=n,o=e.left-l-(1-s)*parseFloat(r),c=e.top-i-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=s?e.width/s:e.width,u=a?e.height/a:e.height;return{width:g,height:u,top:c,right:o+g,bottom:c+u,left:o}}const _L={ignoreTransform:!1};function _s(e,t){t===void 0&&(t=_L);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:g}=nr(e).getComputedStyle(e);c&&(r=vL(r,c,g))}const{top:n,left:s,width:a,height:l,bottom:i,right:o}=r;return{top:n,left:s,width:a,height:l,bottom:i,right:o}}function Bg(e){return _s(e,{ignoreTransform:!0})}function yL(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function wL(e,t){return t===void 0&&(t=nr(e).getComputedStyle(e)),t.position==="fixed"}function SL(e,t){t===void 0&&(t=nr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?r.test(a):!1})}function Ff(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Of(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!qo(s)||_1(s)||r.includes(s))return r;const a=nr(e).getComputedStyle(s);return s!==e&&SL(s,a)&&r.push(s),wL(s,a)?r:n(s.parentNode)}return e?n(e):r}function x1(e){const[t]=Ff(e,1);return t??null}function iu(e){return!cc||!e?null:gs(e)?e:Bf(e)?Of(e)||e===vs(e).scrollingElement?window:qo(e)?e:null:null}function b1(e){return gs(e)?e.scrollX:e.scrollLeft}function C1(e){return gs(e)?e.scrollY:e.scrollTop}function $h(e){return{x:b1(e),y:C1(e)}}var kt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kt||(kt={}));function E1(e){return!cc||!e?!1:e===document.scrollingElement}function k1(e){const t={x:0,y:0},r=E1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:a,isBottom:l,isRight:i,maxScroll:n,minScroll:t}}const xL={x:.2,y:.2};function bL(e,t,r,n,s){let{top:a,left:l,right:i,bottom:o}=r;n===void 0&&(n=10),s===void 0&&(s=xL);const{isTop:c,isBottom:g,isLeft:u,isRight:p}=k1(e),_={x:0,y:0},y={x:0,y:0},v={height:t.height*s.y,width:t.width*s.x};return!c&&a<=t.top+v.height?(_.y=kt.Backward,y.y=n*Math.abs((t.top+v.height-a)/v.height)):!g&&o>=t.bottom-v.height&&(_.y=kt.Forward,y.y=n*Math.abs((t.bottom-v.height-o)/v.height)),!p&&i>=t.right-v.width?(_.x=kt.Forward,y.x=n*Math.abs((t.right-v.width-i)/v.width)):!u&&l<=t.left+v.width&&(_.x=kt.Backward,y.x=n*Math.abs((t.left+v.width-l)/v.width)),{direction:_,speed:y}}function CL(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function L1(e){return e.reduce((t,r)=>Qi(t,$h(r)),Ir)}function EL(e){return e.reduce((t,r)=>t+b1(r),0)}function kL(e){return e.reduce((t,r)=>t+C1(r),0)}function LL(e,t){if(t===void 0&&(t=_s),!e)return;const{top:r,left:n,bottom:s,right:a}=t(e);x1(e)&&(s<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const RL=[["x",["left","right"],EL],["y",["top","bottom"],kL]];class $f{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ff(r),s=L1(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,i]of RL)for(const o of l)Object.defineProperty(this,o,{get:()=>{const c=i(n),g=s[a]-c;return this.rect[o]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class no{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function TL(e){const{EventTarget:t}=nr(e);return e instanceof t?e:vs(e)}function su(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var fr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fr||(fr={}));function Og(e){e.preventDefault()}function DL(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(qe||(qe={}));const R1={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter,qe.Tab]},ML=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case qe.Right:return{...r,x:r.x+25};case qe.Left:return{...r,x:r.x-25};case qe.Down:return{...r,y:r.y+25};case qe.Up:return{...r,y:r.y-25}}};class T1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new no(vs(r)),this.windowListeners=new no(nr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&LL(n),r(Ir)}handleKeyDown(t){if(jf(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:a=R1,coordinateGetter:l=ML,scrollBehavior:i="smooth"}=s,{code:o}=t;if(a.end.includes(o)){this.handleEnd(t);return}if(a.cancel.includes(o)){this.handleCancel(t);return}const{collisionRect:c}=n.current,g=c?{x:c.left,y:c.top}:Ir;this.referenceCoordinates||(this.referenceCoordinates=g);const u=l(t,{active:r,context:n.current,currentCoordinates:g});if(u){const p=Pl(u,g),_={x:0,y:0},{scrollableAncestors:y}=n.current;for(const v of y){const h=t.code,{isTop:f,isRight:d,isLeft:m,isBottom:w,maxScroll:b,minScroll:x}=k1(v),C=CL(v),S={x:Math.min(h===qe.Right?C.right-C.width/2:C.right,Math.max(h===qe.Right?C.left:C.left+C.width/2,u.x)),y:Math.min(h===qe.Down?C.bottom-C.height/2:C.bottom,Math.max(h===qe.Down?C.top:C.top+C.height/2,u.y))},E=h===qe.Right&&!d||h===qe.Left&&!m,L=h===qe.Down&&!w||h===qe.Up&&!f;if(E&&S.x!==u.x){const A=v.scrollLeft+p.x,M=h===qe.Right&&A<=b.x||h===qe.Left&&A>=x.x;if(M&&!p.y){v.scrollTo({left:A,behavior:i});return}M?_.x=v.scrollLeft-A:_.x=h===qe.Right?v.scrollLeft-b.x:v.scrollLeft-x.x,_.x&&v.scrollBy({left:-_.x,behavior:i});break}else if(L&&S.y!==u.y){const A=v.scrollTop+p.y,M=h===qe.Down&&A<=b.y||h===qe.Up&&A>=x.y;if(M&&!p.x){v.scrollTo({top:A,behavior:i});return}M?_.y=v.scrollTop-A:_.y=h===qe.Down?v.scrollTop-b.y:v.scrollTop-x.y,_.y&&v.scrollBy({top:-_.y,behavior:i});break}}this.handleMove(t,Qi(Pl(u,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}T1.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=R1,onActivation:s}=t,{active:a}=r;const{code:l}=e.nativeEvent;if(n.start.includes(l)){const i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Ng(e){return!!(e&&"distance"in e)}function jg(e){return!!(e&&"delay"in e)}class Hf{constructor(t,r,n){var s;n===void 0&&(n=TL(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:l}=a;this.props=t,this.events=r,this.document=vs(l),this.documentListeners=new no(this.document),this.listeners=new no(n),this.windowListeners=new no(nr(l)),this.initialCoordinates=(s=Fh(a))!=null?s:Ir,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.DragStart,Og),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),this.windowListeners.add(fr.ContextMenu,Og),this.documentListeners.add(fr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jg(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Ng(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(fr.Click,DL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:a}=this,{onMove:l,options:{activationConstraint:i}}=a;if(!s)return;const o=(r=Fh(t))!=null?r:Ir,c=Pl(s,o);if(!n&&i){if(Ng(i)){if(i.tolerance!=null&&su(c,i.tolerance))return this.handleCancel();if(su(c,i.distance))return this.handleStart()}if(jg(i)&&su(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),l(o)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const AL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class zf extends Hf{constructor(t){const{event:r}=t,n=vs(r.target);super(t,AL,n)}}zf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const PL={move:{name:"mousemove"},end:{name:"mouseup"}};var Hh;(function(e){e[e.RightClick=2]="RightClick"})(Hh||(Hh={}));class IL extends Hf{constructor(t){super(t,PL,vs(t.event.target))}}IL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Hh.RightClick?!1:(n==null||n({event:r}),!0)}}];const ou={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class BL extends Hf{constructor(t){super(t,ou)}static setup(){return window.addEventListener(ou.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ou.move.name,t)};function t(){}}}BL.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var io;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(io||(io={}));var Bl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Bl||(Bl={}));function OL(e){let{acceleration:t,activator:r=io.Pointer,canScroll:n,draggingRect:s,enabled:a,interval:l=5,order:i=Bl.TreeOrder,pointerCoordinates:o,scrollableAncestors:c,scrollableAncestorRects:g,delta:u,threshold:p}=e;const _=jL({delta:u,disabled:!a}),[y,v]=Vk(),h=k.useRef({x:0,y:0}),f=k.useRef({x:0,y:0}),d=k.useMemo(()=>{switch(r){case io.Pointer:return o?{top:o.y,bottom:o.y,left:o.x,right:o.x}:null;case io.DraggableRect:return s}},[r,s,o]),m=k.useRef(null),w=k.useCallback(()=>{const x=m.current;if(!x)return;const C=h.current.x*f.current.x,S=h.current.y*f.current.y;x.scrollBy(C,S)},[]),b=k.useMemo(()=>i===Bl.TreeOrder?[...c].reverse():c,[i,c]);k.useEffect(()=>{if(!a||!c.length||!d){v();return}for(const x of b){if((n==null?void 0:n(x))===!1)continue;const C=c.indexOf(x),S=g[C];if(!S)continue;const{direction:E,speed:L}=bL(x,S,d,t,p);for(const A of["x","y"])_[A][E[A]]||(L[A]=0,E[A]=0);if(L.x>0||L.y>0){v(),m.current=x,y(w,l),h.current=L,f.current=E;return}}h.current={x:0,y:0},f.current={x:0,y:0},v()},[t,w,n,v,a,l,JSON.stringify(d),JSON.stringify(_),y,c,b,g,JSON.stringify(p)])}const NL={x:{[kt.Backward]:!1,[kt.Forward]:!1},y:{[kt.Backward]:!1,[kt.Forward]:!1}};function jL(e){let{delta:t,disabled:r}=e;const n=jh(t);return Xo(s=>{if(r||!n||!s)return NL;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[kt.Backward]:s.x[kt.Backward]||a.x===-1,[kt.Forward]:s.x[kt.Forward]||a.x===1},y:{[kt.Backward]:s.y[kt.Backward]||a.y===-1,[kt.Forward]:s.y[kt.Forward]||a.y===1}}},[r,t,n])}function FL(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Xo(s=>{var a;return t==null?null:(a=n??s)!=null?a:null},[n,t])}function $L(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,a=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...r,...a]},[]),[e,t])}var Po;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Po||(Po={}));var zh;(function(e){e.Optimized="optimized"})(zh||(zh={}));const Fg=new Map;function HL(e,t){let{dragging:r,dependencies:n,config:s}=t;const[a,l]=k.useState(null),{frequency:i,measure:o,strategy:c}=s,g=k.useRef(e),u=h(),p=Mo(u),_=k.useCallback(function(f){f===void 0&&(f=[]),!p.current&&l(d=>d===null?f:d.concat(f.filter(m=>!d.includes(m))))},[p]),y=k.useRef(null),v=Xo(f=>{if(u&&!r)return Fg;if(!f||f===Fg||g.current!==e||a!=null){const d=new Map;for(let m of e){if(!m)continue;if(a&&a.length>0&&!a.includes(m.id)&&m.rect.current){d.set(m.id,m.rect.current);continue}const w=m.node.current,b=w?new $f(o(w),w):null;m.rect.current=b,b&&d.set(m.id,b)}return d}return f},[e,a,r,u,o]);return k.useEffect(()=>{g.current=e},[e]),k.useEffect(()=>{u||_()},[r,u]),k.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),k.useEffect(()=>{u||typeof i!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},i))},[i,u,_,...n]),{droppableRects:v,measureDroppableContainers:_,measuringScheduled:a!=null};function h(){switch(c){case Po.Always:return!1;case Po.BeforeDragging:return r;default:return!r}}}function D1(e,t){return Xo(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function zL(e,t){return D1(e,t)}function UL(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function uc(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function WL(e){return new $f(_s(e),e)}function $g(e,t,r){t===void 0&&(t=WL);const[n,s]=k.useState(null);function a(){s(o=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=o??r)!=null?c:null}const g=t(e);return JSON.stringify(o)===JSON.stringify(g)?o:g})}const l=UL({callback(o){if(e)for(const c of o){const{type:g,target:u}=c;if(g==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),i=uc({callback:a});return Ur(()=>{a(),e?(i==null||i.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[e]),n}function VL(e){const t=D1(e);return S1(e,t)}const Hg=[];function KL(e){const t=k.useRef(e),r=Xo(n=>e?n&&n!==Hg&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ff(e):Hg,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function GL(e){const[t,r]=k.useState(null),n=k.useRef(e),s=k.useCallback(a=>{const l=iu(a.target);l&&r(i=>i?(i.set(l,$h(l)),new Map(i)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){l(a);const i=e.map(o=>{const c=iu(o);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,$h(c)]):null}).filter(o=>o!=null);r(i.length?new Map(i):null),n.current=e}return()=>{l(e),l(a)};function l(i){i.forEach(o=>{const c=iu(o);c==null||c.removeEventListener("scroll",s)})}},[s,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>Qi(a,l),Ir):L1(e):Ir,[e,t])}function zg(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==Ir;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Pl(e,r.current):Ir}function qL(e){k.useEffect(()=>{if(!cc)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function XL(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:a}=n;return r[s]=l=>{a(l,t)},r},{}),[e,t])}function M1(e){return k.useMemo(()=>e?yL(e):null,[e])}const Ug=[];function YL(e,t){t===void 0&&(t=_s);const[r]=e,n=M1(r?nr(r):null),[s,a]=k.useState(Ug);function l(){a(()=>e.length?e.map(o=>E1(o)?n:new $f(t(o),o)):Ug)}const i=uc({callback:l});return Ur(()=>{i==null||i.disconnect(),l(),e.forEach(o=>i==null?void 0:i.observe(o))},[e]),s}function JL(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qo(t)?t:e}function QL(e){let{measure:t}=e;const[r,n]=k.useState(null),s=k.useCallback(c=>{for(const{target:g}of c)if(qo(g)){n(u=>{const p=t(g);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),a=uc({callback:s}),l=k.useCallback(c=>{const g=JL(c);a==null||a.disconnect(),g&&(a==null||a.observe(g)),n(g?t(g):null)},[t,a]),[i,o]=Al(l);return k.useMemo(()=>({nodeRef:i,rect:r,setRef:o}),[r,i,o])}const ZL=[{sensor:zf,options:{}},{sensor:T1,options:{}}],eR={current:{}},Xa={draggable:{measure:Bg},droppable:{measure:Bg,strategy:Po.WhileDragging,frequency:zh.Optimized},dragOverlay:{measure:_s}};class so extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const tR={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new so,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Il},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xa,measureDroppableContainers:Il,windowRect:null,measuringScheduled:!1},rR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Il,draggableNodes:new Map,over:null,measureDroppableContainers:Il},hc=k.createContext(rR),A1=k.createContext(tR);function nR(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new so}}}function iR(e,t){switch(t.type){case wt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wt.DragEnd:case wt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wt.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new so(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case wt.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const l=new so(e.droppable.containers);return l.set(r,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case wt.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const a=new so(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sR(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=k.useContext(hc),a=jh(n),l=jh(r==null?void 0:r.id);return k.useEffect(()=>{if(!t&&!n&&a&&l!=null){if(!jf(a)||document.activeElement===a.target)return;const i=s.get(l);if(!i)return;const{activatorNode:o,node:c}=i;if(!o.current&&!c.current)return;requestAnimationFrame(()=>{for(const g of[o.current,c.current]){if(!g)continue;const u=qk(g);if(u){u.focus();break}}})}},[n,t,s,l,a]),null}function oR(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...n}),r):r}function aR(e){return k.useMemo(()=>({draggable:{...Xa.draggable,...e==null?void 0:e.draggable},droppable:{...Xa.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Xa.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lR(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const a=k.useRef(!1),{x:l,y:i}=typeof s=="boolean"?{x:s,y:s}:s;Ur(()=>{if(!l&&!i||!t){a.current=!1;return}if(a.current||!n)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const g=r(c),u=S1(g,n);if(l||(u.x=0),i||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=x1(c);p&&p.scrollBy({top:u.y,left:u.x})}},[t,l,i,n,r])}const P1=k.createContext({...Ir,scaleX:1,scaleY:1});var wn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(wn||(wn={}));const cR=k.memo(function(t){var r,n,s,a;let{id:l,accessibility:i,autoScroll:o=!0,children:c,sensors:g=ZL,collisionDetection:u=dL,measuring:p,modifiers:_,...y}=t;const v=k.useReducer(iR,void 0,nR),[h,f]=v,[d,m]=eL(),[w,b]=k.useState(wn.Uninitialized),x=w===wn.Initialized,{draggable:{active:C,nodes:S,translate:E},droppable:{containers:L}}=h,A=C!=null?S.get(C):null,M=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var De;return C!=null?{id:C,data:(De=A==null?void 0:A.data)!=null?De:eR,rect:M}:null},[C,A]),O=k.useRef(null),[H,F]=k.useState(null),[$,N]=k.useState(null),R=Mo(y,Object.values(y)),P=Yo("DndDescribedBy",l),B=k.useMemo(()=>L.getEnabled(),[L]),j=aR(p),{droppableRects:W,measureDroppableContainers:K,measuringScheduled:Z}=HL(B,{dragging:x,dependencies:[E.x,E.y],config:j.droppable}),ee=FL(S,C),z=k.useMemo(()=>$?Fh($):null,[$]),I=Fe(),V=zL(ee,j.draggable.measure);lR({activeNode:C!=null?S.get(C):null,config:I.layoutShiftCompensation,initialRect:V,measure:j.draggable.measure});const U=$g(ee,j.draggable.measure,V),J=$g(ee?ee.parentElement:null),X=k.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=L.getNodeFor((r=X.current.over)==null?void 0:r.id),ce=QL({measure:j.dragOverlay.measure}),fe=(n=ce.nodeRef.current)!=null?n:ee,Ee=x?(s=ce.rect)!=null?s:U:null,ae=!!(ce.nodeRef.current&&ce.rect),Te=VL(ae?null:U),je=M1(fe?nr(fe):null),pe=KL(x?me??ee:null),_e=YL(pe),ke=oR(_,{transform:{x:E.x-Te.x,y:E.y-Te.y,scaleX:1,scaleY:1},activatorEvent:$,active:D,activeNodeRect:U,containerNodeRect:J,draggingNodeRect:Ee,over:X.current.over,overlayNodeRect:ce.rect,scrollableAncestors:pe,scrollableAncestorRects:_e,windowRect:je}),se=z?Qi(z,E):null,be=GL(pe),oe=zg(be),he=zg(be,[U]),Le=Qi(ke,oe),Re=Ee?mL(Ee,ke):null,Ce=D&&Re?u({active:D,collisionRect:Re,droppableRects:W,droppableContainers:B,pointerCoordinates:se}):null,q=cL(Ce,"id"),[Q,ge]=k.useState(null),He=ae?ke:Qi(ke,he),ie=fL(He,(a=Q==null?void 0:Q.rect)!=null?a:null,U),G=k.useRef(null),re=k.useCallback((De,Be)=>{let{sensor:Pe,options:Ue}=Be;if(O.current==null)return;const Me=S.get(O.current);if(!Me)return;const ze=De.nativeEvent,Je=new Pe({active:O.current,activeNode:Me,event:ze,options:Ue,context:X,onAbort(we){if(!S.get(we))return;const{onDragAbort:Ke}=R.current,Ge={id:we};Ke==null||Ke(Ge),d({type:"onDragAbort",event:Ge})},onPending(we,Ae,Ke,Ge){if(!S.get(we))return;const{onDragPending:xt}=R.current,dt={id:we,constraint:Ae,initialCoordinates:Ke,offset:Ge};xt==null||xt(dt),d({type:"onDragPending",event:dt})},onStart(we){const Ae=O.current;if(Ae==null)return;const Ke=S.get(Ae);if(!Ke)return;const{onDragStart:Ge}=R.current,lt={activatorEvent:ze,active:{id:Ae,data:Ke.data,rect:M}};jr.unstable_batchedUpdates(()=>{Ge==null||Ge(lt),b(wn.Initializing),f({type:wt.DragStart,initialCoordinates:we,active:Ae}),d({type:"onDragStart",event:lt}),F(G.current),N(ze)})},onMove(we){f({type:wt.DragMove,coordinates:we})},onEnd:nt(wt.DragEnd),onCancel:nt(wt.DragCancel)});G.current=Je;function nt(we){return async function(){const{active:Ke,collisions:Ge,over:lt,scrollAdjustedTranslate:xt}=X.current;let dt=null;if(Ke&&xt){const{cancelDrop:Wt}=R.current;dt={activatorEvent:ze,active:Ke,collisions:Ge,delta:xt,over:lt},we===wt.DragEnd&&typeof Wt=="function"&&await Promise.resolve(Wt(dt))&&(we=wt.DragCancel)}O.current=null,jr.unstable_batchedUpdates(()=>{f({type:we}),b(wn.Uninitialized),ge(null),F(null),N(null),G.current=null;const Wt=we===wt.DragEnd?"onDragEnd":"onDragCancel";if(dt){const Wr=R.current[Wt];Wr==null||Wr(dt),d({type:Wt,event:dt})}})}}},[S]),le=k.useCallback((De,Be)=>(Pe,Ue)=>{const Me=Pe.nativeEvent,ze=S.get(Ue);if(O.current!==null||!ze||Me.dndKit||Me.defaultPrevented)return;const Je={active:ze};De(Pe,Be.options,Je)===!0&&(Me.dndKit={capturedBy:Be.sensor},O.current=Ue,re(Pe,Be))},[S,re]),te=$L(g,le);qL(g),Ur(()=>{U&&w===wn.Initializing&&b(wn.Initialized)},[U,w]),k.useEffect(()=>{const{onDragMove:De}=R.current,{active:Be,activatorEvent:Pe,collisions:Ue,over:Me}=X.current;if(!Be||!Pe)return;const ze={active:Be,activatorEvent:Pe,collisions:Ue,delta:{x:Le.x,y:Le.y},over:Me};jr.unstable_batchedUpdates(()=>{De==null||De(ze),d({type:"onDragMove",event:ze})})},[Le.x,Le.y]),k.useEffect(()=>{const{active:De,activatorEvent:Be,collisions:Pe,droppableContainers:Ue,scrollAdjustedTranslate:Me}=X.current;if(!De||O.current==null||!Be||!Me)return;const{onDragOver:ze}=R.current,Je=Ue.get(q),nt=Je&&Je.rect.current?{id:Je.id,rect:Je.rect.current,data:Je.data,disabled:Je.disabled}:null,we={active:De,activatorEvent:Be,collisions:Pe,delta:{x:Me.x,y:Me.y},over:nt};jr.unstable_batchedUpdates(()=>{ge(nt),ze==null||ze(we),d({type:"onDragOver",event:we})})},[q]),Ur(()=>{X.current={activatorEvent:$,active:D,activeNode:ee,collisionRect:Re,collisions:Ce,droppableRects:W,draggableNodes:S,draggingNode:fe,draggingNodeRect:Ee,droppableContainers:L,over:Q,scrollableAncestors:pe,scrollAdjustedTranslate:Le},M.current={initial:Ee,translated:Re}},[D,ee,Ce,Re,S,fe,Ee,W,L,Q,pe,Le]),OL({...I,delta:E,draggingRect:Re,pointerCoordinates:se,scrollableAncestors:pe,scrollableAncestorRects:_e});const ue=k.useMemo(()=>({active:D,activeNode:ee,activeNodeRect:U,activatorEvent:$,collisions:Ce,containerNodeRect:J,dragOverlay:ce,draggableNodes:S,droppableContainers:L,droppableRects:W,over:Q,measureDroppableContainers:K,scrollableAncestors:pe,scrollableAncestorRects:_e,measuringConfiguration:j,measuringScheduled:Z,windowRect:je}),[D,ee,U,$,Ce,J,ce,S,L,W,Q,K,pe,_e,j,Z,je]),Oe=k.useMemo(()=>({activatorEvent:$,activators:te,active:D,activeNodeRect:U,ariaDescribedById:{draggable:P},dispatch:f,draggableNodes:S,over:Q,measureDroppableContainers:K}),[$,te,D,U,f,P,S,Q,K]);return mt.createElement(w1.Provider,{value:m},mt.createElement(hc.Provider,{value:Oe},mt.createElement(A1.Provider,{value:ue},mt.createElement(P1.Provider,{value:ie},c)),mt.createElement(sR,{disabled:(i==null?void 0:i.restoreFocus)===!1})),mt.createElement(nL,{...i,hiddenTextDescribedById:P}));function Fe(){const De=(H==null?void 0:H.autoScrollEnabled)===!1,Be=typeof o=="object"?o.enabled===!1:o===!1,Pe=x&&!De&&!Be;return typeof o=="object"?{...o,enabled:Pe}:{enabled:Pe}}}),uR=k.createContext(null),Wg="button",hR="Draggable";function dR(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const a=Yo(hR),{activators:l,activatorEvent:i,active:o,activeNodeRect:c,ariaDescribedById:g,draggableNodes:u,over:p}=k.useContext(hc),{role:_=Wg,roleDescription:y="draggable",tabIndex:v=0}=s??{},h=(o==null?void 0:o.id)===t,f=k.useContext(h?P1:uR),[d,m]=Al(),[w,b]=Al(),x=XL(l,t),C=Mo(r);Ur(()=>(u.set(t,{id:t,key:a,node:d,activatorNode:w,data:C}),()=>{const E=u.get(t);E&&E.key===a&&u.delete(t)}),[u,t]);const S=k.useMemo(()=>({role:_,tabIndex:v,"aria-disabled":n,"aria-pressed":h&&_===Wg?!0:void 0,"aria-roledescription":y,"aria-describedby":g.draggable}),[n,_,v,h,y,g.draggable]);return{active:o,activatorEvent:i,activeNodeRect:c,attributes:S,isDragging:h,listeners:n?void 0:x,node:d,over:p,setNodeRef:m,setActivatorNodeRef:b,transform:f}}function fR(){return k.useContext(A1)}const pR="Droppable",mR={timeout:25};function gR(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const a=Yo(pR),{active:l,dispatch:i,over:o,measureDroppableContainers:c}=k.useContext(hc),g=k.useRef({disabled:r}),u=k.useRef(!1),p=k.useRef(null),_=k.useRef(null),{disabled:y,updateMeasurementsFor:v,timeout:h}={...mR,...s},f=Mo(v??n),d=k.useCallback(()=>{if(!u.current){u.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),_.current=null},h)},[h]),m=uc({callback:d,disabled:y||!l}),w=k.useCallback((S,E)=>{m&&(E&&(m.unobserve(E),u.current=!1),S&&m.observe(S))},[m]),[b,x]=Al(w),C=Mo(t);return k.useEffect(()=>{!m||!b.current||(m.disconnect(),u.current=!1,m.observe(b.current))},[b,m]),k.useEffect(()=>(i({type:wt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:b,rect:p,data:C}}),()=>i({type:wt.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==g.current.disabled&&(i({type:wt.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,i]),{active:l,rect:p,isOver:(o==null?void 0:o.id)===n,node:b,over:o,setNodeRef:x}}function I1(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function vR(e,t){return e.reduce((r,n,s)=>{const a=t.get(n);return a&&(r[s]=a),r},Array(e.length))}function ba(e){return e!==null&&e>=0}function _R(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function yR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B1=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const a=I1(t,n,r),l=t[s],i=a[s];return!i||!l?null:{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}},Ca={scaleX:1,scaleY:1},wR=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:a,overIndex:l}=e;const i=(t=a[r])!=null?t:n;if(!i)return null;if(s===r){const c=a[l];return c?{x:0,y:r<l?c.top+c.height-(i.top+i.height):c.top-i.top,...Ca}:null}const o=SR(a,s,r);return s>r&&s<=l?{x:0,y:-i.height-o,...Ca}:s<r&&s>=l?{x:0,y:i.height+o,...Ca}:{x:0,y:0,...Ca}};function SR(e,t,r){const n=e[t],s=e[t-1],a=e[t+1];return n?r<t?s?n.top-(s.top+s.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const O1="Sortable",N1=mt.createContext({activeIndex:-1,containerId:O1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B1,disabled:{draggable:!1,droppable:!1}});function xR(e){let{children:t,id:r,items:n,strategy:s=B1,disabled:a=!1}=e;const{active:l,dragOverlay:i,droppableRects:o,over:c,measureDroppableContainers:g}=fR(),u=Yo(O1,r),p=i.rect!==null,_=k.useMemo(()=>n.map(x=>typeof x=="object"&&"id"in x?x.id:x),[n]),y=l!=null,v=l?_.indexOf(l.id):-1,h=c?_.indexOf(c.id):-1,f=k.useRef(_),d=!_R(_,f.current),m=h!==-1&&v===-1||d,w=yR(a);Ur(()=>{d&&y&&g(_)},[d,_,y,g]),k.useEffect(()=>{f.current=_},[_]);const b=k.useMemo(()=>({activeIndex:v,containerId:u,disabled:w,disableTransforms:m,items:_,overIndex:h,useDragOverlay:p,sortedRects:vR(_,o),strategy:s}),[v,u,w.draggable,w.droppable,m,_,h,o,p,s]);return mt.createElement(N1.Provider,{value:b},t)}const bR=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return I1(r,n,s).indexOf(t)},CR=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:a,newIndex:l,previousItems:i,previousContainerId:o,transition:c}=e;return!c||!n||i!==a&&s===l?!1:r?!0:l!==s&&t===o},ER={duration:200,easing:"ease"},j1="transform",kR=Ao.Transition.toString({property:j1,duration:0,easing:"linear"}),LR={roleDescription:"sortable"};function RR(e){let{disabled:t,index:r,node:n,rect:s}=e;const[a,l]=k.useState(null),i=k.useRef(r);return Ur(()=>{if(!t&&r!==i.current&&n.current){const o=s.current;if(o){const c=_s(n.current,{ignoreTransform:!0}),g={x:o.left-c.left,y:o.top-c.top,scaleX:o.width/c.width,scaleY:o.height/c.height};(g.x||g.y)&&l(g)}}r!==i.current&&(i.current=r)},[t,r,n,s]),k.useEffect(()=>{a&&l(null)},[a]),a}function TR(e){let{animateLayoutChanges:t=CR,attributes:r,disabled:n,data:s,getNewIndex:a=bR,id:l,strategy:i,resizeObserverConfig:o,transition:c=ER}=e;const{items:g,containerId:u,activeIndex:p,disabled:_,disableTransforms:y,sortedRects:v,overIndex:h,useDragOverlay:f,strategy:d}=k.useContext(N1),m=DR(n,_),w=g.indexOf(l),b=k.useMemo(()=>({sortable:{containerId:u,index:w,items:g},...s}),[u,s,w,g]),x=k.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:C,node:S,isOver:E,setNodeRef:L}=gR({id:l,data:b,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...o}}),{active:A,activatorEvent:M,activeNodeRect:D,attributes:O,setNodeRef:H,listeners:F,isDragging:$,over:N,setActivatorNodeRef:R,transform:P}=dR({id:l,data:b,attributes:{...LR,...r},disabled:m.draggable}),B=Wk(L,H),j=!!A,W=j&&!y&&ba(p)&&ba(h),K=!f&&$,Z=K&&W?P:null,z=W?Z??(i??d)({rects:v,activeNodeRect:D,activeIndex:p,overIndex:h,index:w}):null,I=ba(p)&&ba(h)?a({id:l,items:g,activeIndex:p,overIndex:h}):w,V=A==null?void 0:A.id,U=k.useRef({activeId:V,items:g,newIndex:I,containerId:u}),J=g!==U.current.items,X=t({active:A,containerId:u,isDragging:$,isSorting:j,id:l,index:w,items:g,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:c,wasDragging:U.current.activeId!=null}),me=RR({disabled:!X,index:w,node:S,rect:C});return k.useEffect(()=>{j&&U.current.newIndex!==I&&(U.current.newIndex=I),u!==U.current.containerId&&(U.current.containerId=u),g!==U.current.items&&(U.current.items=g)},[j,I,u,g]),k.useEffect(()=>{if(V===U.current.activeId)return;if(V!=null&&U.current.activeId==null){U.current.activeId=V;return}const fe=setTimeout(()=>{U.current.activeId=V},50);return()=>clearTimeout(fe)},[V]),{active:A,activeIndex:p,attributes:O,data:b,rect:C,index:w,newIndex:I,items:g,isOver:E,isSorting:j,isDragging:$,listeners:F,node:S,overIndex:h,over:N,setNodeRef:B,setActivatorNodeRef:R,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:me??z,transition:ce()};function ce(){if(me||J&&U.current.newIndex===w)return kR;if(!(K&&!jf(M)||!c)&&(j||X))return Ao.Transition.toString({...c,property:j1})}}function DR(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}qe.Down,qe.Right,qe.Up,qe.Left;const Ea={permission:0,waiting:1,working:2,unknown:3};function oo(e){var r;const t=(r=e.agentSessionId)==null?void 0:r.trim();return t&&t.length>0?t:e.id}const MR={mode:"created",direction:"desc"};function Uf(e,t=MR){const{mode:r,direction:n,manualOrder:s}=t;if(r==="manual"&&s&&s.length>0){const a=new Map(s.map((l,i)=>[l,i]));return e.toSorted((l,i)=>{const o=oo(l),c=oo(i),g=a.get(o)??a.get(l.id)??1/0,u=a.get(c)??a.get(i.id)??1/0;return g===1/0&&u===1/0?Date.parse(i.createdAt)-Date.parse(l.createdAt):g-u})}return e.toSorted((a,l)=>{if(r==="status"){const c=Ea[a.status]??Ea.unknown,g=Ea[l.status]??Ea.unknown;return c!==g?c-g:Date.parse(l.lastActivity)-Date.parse(a.lastActivity)}const i=Date.parse(a.createdAt),o=Date.parse(l.createdAt);return n==="desc"?o-i:i-o})}function AR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.projectPath)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.projectPath)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).toSorted((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function PR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.host)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.host)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).toSorted((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function Wf(e){const t=Date.parse(e);if(Number.isNaN(t))return"";const r=Date.now()-t,n=Math.floor(r/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function ui(e){const t=e.trim();if(!t)return null;const r=t.replace(/[\\/]+$/,"");if(!r)return null;const n=r.split(/[\\/]/);return n[n.length-1]||null}function IR(e){const t=e.map(i=>{const o=i.trim(),c=o.replace(/[\\/]+$/,""),g=c.split(/[\\/]/).filter(Boolean);return{path:i,parts:g,fallback:c||o||i}}),r=new Map;for(const i of t)r.set(i.path,1);let n=!0;for(;n;){n=!1;const i=new Map;for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");i.set(g,(i.get(g)??0)+1)}for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");(i.get(g)??0)>1&&c<o.parts.length&&(r.set(o.path,c+1),n=!0)}}const s=new Map,a=new Map;for(const i of t){let o=i.fallback;if(i.parts.length>0){const c=r.get(i.path)??1;o=i.parts.slice(-c).join("/")}s.set(i.path,o),a.set(o,(a.get(o)??0)+1)}const l=new Map;for(const i of t){let o=s.get(i.path)??i.fallback;(a.get(o)??0)>1&&(o=i.fallback),l.set(i.path,o)}return l}function F1(e){const t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}const We=Yd()(Jd((e,t)=>({sessions:[],agentSessions:{active:[],inactive:[]},hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,hasLoaded:!1,connectionStatus:"connecting",connectionError:null,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,setSessions:r=>{var g;const n=t(),s=n.selectedSessionId,a=n.sessions,l=n.exitingSessions,i=new Set(r.map(u=>u.id)),o=a.filter(u=>!i.has(u.id)&&!l.has(u.id));let c=s;if(s!==null&&!r.some(u=>u.id===s)){const{sessionSortMode:u,sessionSortDirection:p}=de.getState();c=((g=Uf(r,{mode:u,direction:p})[0])==null?void 0:g.id)??null}if(o.length>0){const u=new Map(l);for(const p of o)u.set(p.id,p);e({sessions:r,hasLoaded:!0,selectedSessionId:c,exitingSessions:u})}else e({sessions:r,hasLoaded:!0,selectedSessionId:c})},setAgentSessions:(r,n)=>e({agentSessions:{active:r,inactive:n}}),setHostStatuses:r=>e({hostStatuses:r}),updateSession:r=>e(n=>({sessions:n.sessions.map(s=>s.id===r.id?r:s)})),setSelectedSessionId:r=>e({selectedSessionId:r}),setConnectionStatus:r=>e({connectionStatus:r}),setConnectionError:r=>e({connectionError:r}),setRemoteAllowControl:r=>e({remoteAllowControl:r}),setRemoteAllowAttach:r=>e({remoteAllowAttach:r}),setHostLabel:r=>e({hostLabel:r}),markSessionExiting:r=>{const n=t().sessions.find(s=>s.id===r);if(n){const s=new Map(t().exitingSessions);s.set(r,n),e({exitingSessions:s})}},clearExitingSession:r=>{const n=new Map(t().exitingSessions);n.delete(r),e({exitingSessions:n})}}),{name:"agentboard-session",storage:ic(()=>Qd),partialize:e=>({selectedSessionId:e.selectedSessionId})}));function Vg(e,t,r=!1){const[n,s]=k.useState(!1),a=k.useRef(e),l=k.useRef(!1);return k.useEffect(()=>{const o=a.current;if(r?e>o:e!==o){l.current=!0;const g=setTimeout(()=>{l.current&&(s(!0),l.current=!1)},t);return a.current=e,()=>clearTimeout(g)}a.current=e},[e,t,r]),[n,()=>s(!1)]}function BR(e,t,r,n){const s=k.useRef(new Map);k.useEffect(()=>{const a=new Set(e.map(l=>l.id));for(const l of t.keys())if(a.has(l)){const i=s.current.get(l);i&&(clearTimeout(i),s.current.delete(l)),r(l)}else if(!s.current.has(l)){const i=setTimeout(()=>{s.current.delete(l),r(l)},n+100);s.current.set(l,i)}},[e,t,r,n]),k.useEffect(()=>()=>{for(const a of s.current.values())clearTimeout(a);s.current.clear()},[])}function OR({className:e}){return T.jsx("svg",{viewBox:"0 0 92.2 92.2",fill:"currentColor",className:e,"aria-label":"Anthropic",children:T.jsx("path",{d:"M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z",transform:"translate(0, 13.6)"})})}function NR({className:e}){return T.jsx("svg",{viewBox:"-1 -1 26 26",fill:"currentColor",className:e,"aria-label":"OpenAI",children:T.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function jR({className:e}){return T.jsx("svg",{viewBox:"0 0 588.42 568.88",fill:"currentColor",className:e,"aria-label":"Pi",children:T.jsx("path",{d:"M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z"})})}const FR=[["claude",OR],["codex",NR],["pi",jR]];function dc({agentType:e,command:t,className:r=""}){const n=(e||(t==null?void 0:t.split(" ")[0])||"").toLowerCase();for(const[s,a]of FR)if(n.startsWith(s))return T.jsx(a,{className:r});return T.jsx(iC,{className:r})}const $R=360;function HR(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t)}function $1(e){return{"--badge-hue":`${HR(e)%$R}`}}function H1({name:e,fullPath:t,className:r=""}){const n=$1(e);return T.jsx("span",{className:`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none ${r}`,style:n,title:t,children:e})}const zR=k.memo(function({session:t,showSessionIdPrefix:r,showProjectName:n,showLastUserMessage:s,onResume:a,onPreview:l,onSetPinned:i}){const o=Wf(t.lastActivityAt),c=ui(t.projectPath),g=t.displayName||c||t.sessionId.slice(0,8),u=n&&!!c,p=s&&!!t.lastUserMessage,_=r?F1(t.sessionId):"",y=k.useRef(null),[v,h]=k.useState(null);k.useEffect(()=>{if(!v)return;const d=w=>{y.current&&!y.current.contains(w.target)&&h(null)},m=w=>{w.key==="Escape"&&h(null)};return document.addEventListener("mousedown",d),document.addEventListener("touchstart",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("touchstart",d),document.removeEventListener("keydown",m)}},[v]);const f=d=>{d.preventDefault(),d.stopPropagation(),h({x:d.clientX,y:d.clientY})};return T.jsxs("div",{className:"group relative cursor-pointer px-3 py-2 hover:bg-hover",role:"button",tabIndex:0,title:"Click to preview",onClick:()=>l(t),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l(t))},onContextMenu:f,children:[T.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100",title:"Resume directly",onClick:d=>{d.stopPropagation(),a(t.sessionId)},children:"▶"}),T.jsxs("div",{className:"flex flex-col gap-0.5 pl-2.5 group-hover:pr-4",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:t.agentType,className:"h-3.5 w-3.5 shrink-0 text-muted"}),T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:g}),t.lastResumeError&&T.jsx(Ab,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Resume failed",title:`Last resume failed: ${t.lastResumeError}`}),t.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-muted","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),_&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:t.sessionId,children:_}),T.jsx("span",{className:"ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted",children:o})]}),(u||p)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[u&&T.jsx(H1,{name:c,fullPath:t.projectPath}),p&&T.jsxs("span",{className:"truncate text-xs italic text-muted",children:['"',t.lastUserMessage.length>200?t.lastUserMessage.slice(0,200)+"…":t.lastUserMessage,'"']})]})]}),v&&T.jsxs("div",{ref:y,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:v.x,top:v.y},role:"menu",children:[i&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),h(null),i(t.sessionId,!t.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),t.isPinned?"Unpin":"Pin"]}),t.logFilePath&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),navigator.clipboard.writeText(t.logFilePath).catch(()=>{}),h(null)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]})]})]})});function UR({name:e,className:t=""}){const r=$1(`host:${e}`);return T.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide ${t}`,style:r,title:e,children:e})}function WR({hosts:e,selectedHosts:t,onSelect:r,statuses:n=[]}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>new Set(t),[t]),c=k.useMemo(()=>new Map(n.map(_=>[_.host,_])),[n]),g=k.useMemo(()=>t.length===0?"All Hosts":t.join(", "),[t]),u=k.useMemo(()=>t.length===0?"All Hosts":t.length===1?t[0]:`${t.length} hosts`,[t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const _=v=>{var f;const h=v.target;h&&((f=i.current)!=null&&f.contains(h))||a(!1)},y=v=>{v.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",y)}},[s]);const p=_=>{const y=new Set(o);y.has(_)?y.delete(_):y.add(_);const v=e.filter(h=>y.has(h));r(v)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by host",onClick:()=>a(_=>!_),className:"flex h-6 max-w-[9rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:g,children:[T.jsx("span",{className:"truncate",children:u}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-48 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{role:"menuitemcheckbox","aria-checked":t.length===0,className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Hosts"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No hosts"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(_=>{const y=c.get(_),v=y?!y.ok:!1;return T.jsxs("label",{role:"menuitemcheckbox","aria-checked":o.has(_),className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y!=null&&y.error?`${_}: ${y.error}`:_,children:[T.jsx("input",{type:"checkbox",checked:o.has(_),onChange:()=>p(_),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:_}),v&&T.jsx("span",{className:"ml-auto text-[10px] uppercase text-danger",children:"offline"})]},_)})})]})]})}function VR({projects:e,selectedProjects:t,onSelect:r,hasHiddenPermissions:n}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>IR(e),[e]),c=k.useMemo(()=>new Set(t),[t]),g=n&&t.length>0,u=k.useMemo(()=>t.length===0?"All Projects":t.map(y=>o.get(y)??ui(y)??y).join(", "),[o,t]),p=k.useMemo(()=>{if(t.length===0)return"All Projects";if(t.length===1){const y=t[0];return o.get(y)??ui(y)??y}return`${t.length} projects`},[o,t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const y=h=>{var d;const f=h.target;f&&((d=i.current)!=null&&d.contains(f))||a(!1)},v=h=>{h.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y,{passive:!0}),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[s]);const _=y=>{const v=new Set(c);v.has(y)?v.delete(y):v.add(y);const h=e.filter(f=>v.has(f));r(h)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by project",onClick:()=>a(y=>!y),className:"flex h-6 max-w-[11rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:u,children:[T.jsx("span",{className:"truncate",children:p}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-60 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Projects"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No projects"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(y=>{const v=o.get(y)??ui(y)??y;return T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y,children:[T.jsx("input",{type:"checkbox",checked:c.has(y),onChange:()=>_(y),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:v})]},y)})})]}),g&&T.jsx("button",{type:"button",className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated",title:"Hidden sessions need attention","aria-label":"Clear project filters",onClick:y=>{y.stopPropagation(),r([])},children:T.jsx("span",{className:"sr-only",children:"Clear project filters"})})]})}function KR(e){if(!e.trim())return null;try{const t=JSON.parse(e);let r="",n="other";if(typeof t.message=="string")r=t.message;else if(typeof t.content=="string")r=t.content;else if(t.type==="user"&&typeof t.message=="object"){const s=t.message;r=typeof s.content=="string"?s.content:"",n="user"}else if(t.type==="assistant"&&t.message){const s=t.message;typeof s.content=="string"?r=s.content:Array.isArray(s.content)&&(r=s.content.filter(a=>typeof a=="object"&&a!==null&&"text"in a).map(a=>a.text).join(`
53
53
  `)),n="assistant"}if((t.type==="tool_use"||t.event==="tool_use")&&(r=`[Tool: ${t.name??"tool"}]`,n="assistant"),t.type==="result"&&typeof t.result=="string"&&(r=t.result,n="system"),t.payload&&typeof t.payload=="object"){const s=t.payload;typeof s.content=="string"?r=s.content:typeof s.message=="string"&&(r=s.message)}return r.trim()?{type:n,content:r.trim(),raw:e}:null}catch{return{type:"other",content:e.trim(),raw:e}}}function GR({session:e,onClose:t,onResume:r}){const[n,s]=k.useState(!0),[a,l]=k.useState(null),[i,o]=k.useState(null),[c,g]=k.useState(!1),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{(async()=>{try{const f=await fetch(`/api/session-preview/${e.sessionId}`);if(!f.ok){const m=await f.json();throw new Error(m.error||"Failed to load preview")}const d=await f.json();o(d)}catch(f){l(f instanceof Error?f.message:"Failed to load preview")}finally{s(!1)}})()},[e.sessionId]),k.useEffect(()=>{u.current&&i&&(u.current.scrollTop=u.current.scrollHeight)},[i,c]),k.useEffect(()=>{const h=f=>{f.key==="Escape"?(f.stopPropagation(),t()):f.key==="Enter"&&!n&&!a&&(f.preventDefault(),r(e.sessionId))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,r,e.sessionId,n,a]),k.useEffect(()=>{var h;(h=p.current)==null||h.focus()},[]);const _=e.displayName||ui(e.projectPath)||e.sessionId.slice(0,8),y=Wf(e.lastActivityAt),v=(i==null?void 0:i.lines.map(KR).filter(h=>h!==null).slice(-30))??[];return T.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"preview-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:h=>{h.target===h.currentTarget&&t()},children:T.jsxs("div",{ref:p,tabIndex:-1,className:"flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[T.jsx(dc,{agentType:e.agentType,className:"h-5 w-5 shrink-0 text-muted"}),T.jsxs("div",{className:"min-w-0 flex-1",children:[T.jsx("h2",{id:"preview-title",className:"truncate text-sm font-semibold text-primary",children:_}),T.jsxs("p",{className:"truncate text-xs text-muted",title:e.projectPath,children:[ui(e.projectPath)," · ",y]})]}),T.jsx("button",{type:"button",onClick:()=>g(h=>!h),className:`btn text-xs ${c?"btn-primary":""}`,children:c?"Parsed":"Raw"})]}),T.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto p-4 font-mono text-xs",children:[n&&T.jsx("div",{className:"flex items-center justify-center py-8 text-muted",children:"Loading preview..."}),a&&T.jsx("div",{className:"flex items-center justify-center py-8 text-danger",children:a}),i&&!c&&T.jsx("div",{className:"space-y-2",children:v.length===0?T.jsx("div",{className:"py-8 text-center text-muted",children:"No readable content found. Try raw view."}):v.map((h,f)=>T.jsx("div",{className:`rounded px-2 py-1 ${h.type==="user"?"bg-blue-500/10 text-blue-400":h.type==="assistant"?"bg-emerald-500/10 text-emerald-400":h.type==="system"?"bg-yellow-500/10 text-yellow-400":"text-muted"}`,children:T.jsx("span",{className:"whitespace-pre-wrap break-words",children:h.content.length>500?`${h.content.slice(0,500)}...`:h.content})},f))}),i&&c&&T.jsx("div",{className:"space-y-1",children:i.lines.slice(-50).map((h,f)=>T.jsx("div",{className:"whitespace-pre-wrap break-all text-muted",children:h||" "},f))})]}),T.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>r(e.sessionId),disabled:n||!!a,className:"btn btn-primary",children:"Resume"})]})]})})}const Kg={working:"bg-green-500/20 text-green-600",waiting:"bg-zinc-500/20 text-zinc-400",permission:"bg-amber-500/20 text-amber-600",unknown:"bg-zinc-500/20 text-zinc-400"};function qR(){const[,e]=k.useState(0);k.useEffect(()=>{const t=setInterval(()=>e(r=>r+1),3e4);return()=>clearInterval(t)},[])}function z1({sessions:e,inactiveSessions:t=[],selectedSessionId:r,loading:n,error:s,onSelect:a,onRename:l,onResume:i,onKill:o,onDuplicate:c,onSetPinned:g}){qR();const[u,p]=k.useState(null),_=de(G=>G.inactiveSessionsExpanded),y=de(G=>G.setInactiveSessionsExpanded),[v,h]=k.useState(null),[f,d]=k.useState(20),m=v1();k.useEffect(()=>{_||d(20)},[_]);const w=200,[b,x]=Vg(e.length,w),[C,S]=Vg(t.length,w,!0),E=k.useRef(new Set(e.map(G=>G.id))),L=k.useRef(new Set(t.map(G=>G.sessionId))),[A,M]=k.useState(new Set);k.useEffect(()=>{var te;const G=new Set(e.map(ue=>ue.id)),re=new Set(t.map(ue=>ue.sessionId)),le=new Set;for(const ue of G)E.current.has(ue)||le.add(ue);for(const ue of e){const Oe=(te=ue.agentSessionId)==null?void 0:te.trim();Oe&&L.current.has(Oe)&&!re.has(Oe)&&le.add(ue.id)}E.current=G,L.current=re,le.size>0&&M(le)},[e,t]),k.useEffect(()=>{if(A.size===0)return;const G=setTimeout(()=>M(new Set),500);return()=>clearTimeout(G)},[A]);const D=de(G=>G.shortcutModifier),O=Yi(Uo(D)),H=de(G=>G.sessionSortMode),F=de(G=>G.setSessionSortMode),$=de(G=>G.sessionSortDirection),N=de(G=>G.manualSessionOrder),R=de(G=>G.setManualSessionOrder),P=de(G=>G.showProjectName),B=de(G=>G.showLastUserMessage),j=de(G=>G.showSessionIdPrefix),W=de(G=>G.projectFilters),K=de(G=>G.setProjectFilters),Z=de(G=>G.hostFilters),ee=de(G=>G.setHostFilters),z=We(G=>G.exitingSessions),I=We(G=>G.clearExitingSession),V=We(G=>G.hostStatuses),U=We(G=>G.remoteAllowControl);BR(e,z,I,w),k.useEffect(()=>{if(N.length===0)return;const G=new Set;for(const le of e)G.add(oo(le)),G.add(le.id);for(const le of t)G.add(le.sessionId);const re=N.filter(le=>G.has(le));re.length!==N.length&&R(re)},[e,t,N,R]);const X=k.useMemo(()=>Uf(e,{mode:H,direction:$,manualOrder:N}),[e,H,$,N]),me=k.useMemo(()=>AR(e,t),[e,t]),ce=k.useMemo(()=>{const G=PR(e,t),re=V.map(ue=>ue.host),le=new Set,te=[];for(const ue of re)!ue||le.has(ue)||(le.add(ue),te.push(ue));for(const ue of G)!ue||le.has(ue)||(le.add(ue),te.push(ue));return te},[e,t,V]),fe=k.useMemo(()=>ce.length>1,[ce]),Ee=k.useMemo(()=>{let G=X;return W.length>0&&(G=G.filter(re=>W.includes(re.projectPath))),Z.length>0&&(G=G.filter(re=>Z.includes(re.host??""))),G},[X,W,Z]),ae=k.useMemo(()=>{const G=W.length===0?"all-projects":W.join("|"),re=Z.length===0?"all-hosts":Z.join("|");return`${G}::${re}`},[W,Z]),Te=k.useRef(new Set(Ee.map(G=>G.id))),[je,pe]=k.useState(new Set);k.useEffect(()=>{const G=new Set(Ee.map(le=>le.id)),re=new Set;for(const le of G)Te.current.has(le)||A.has(le)||re.add(le);Te.current=G,re.size>0&&pe(re)},[Ee,A]),k.useEffect(()=>{if(je.size===0)return;const G=setTimeout(()=>pe(new Set),500);return()=>clearTimeout(G)},[je]);const _e=k.useMemo(()=>{let G=t;return W.length>0&&(G=G.filter(re=>W.includes(re.projectPath))),Z.length>0&&(G=G.filter(re=>Z.includes(re.host??""))),G},[t,W,Z]),ke=k.useMemo(()=>{if(W.length===0)return 0;const G=new Set(W);return e.filter(re=>!G.has(re.projectPath)&&re.status==="permission").length},[e,W]);k.useEffect(()=>{if(W.length===0||me.length===0)return;const G=new Set(me),re=W.filter(le=>G.has(le));re.length!==W.length&&K(re)},[W,me,K]),k.useEffect(()=>{if(Z.length===0||ce.length===0)return;const G=new Set(ce),re=Z.filter(le=>G.has(le));re.length!==Z.length&&ee(re)},[Z,ce,ee]);const se=sL(iL(zf,{activationConstraint:{distance:8}})),[be,oe]=k.useState(null),[he,Le]=k.useState(null),[Re,Ce]=k.useState(!1),q=k.useCallback(G=>{oe(G.active.id),Ce(!0)},[]),Q=k.useCallback(G=>{var re;Le((re=G.over)==null?void 0:re.id)},[]),ge=k.useCallback(G=>{const{active:re,over:le}=G;if(oe(null),Le(null),!le||re.id===le.id){setTimeout(()=>Ce(!1),100);return}const te=Ee.findIndex(Me=>Me.id===re.id),ue=Ee.findIndex(Me=>Me.id===le.id);if(te===-1||ue===-1){setTimeout(()=>Ce(!1),100);return}const Oe=Ee.map(Me=>oo(Me)),[Fe]=Oe.splice(te,1);Oe.splice(ue,0,Fe);const De=X.map(Me=>oo(Me)),Be=new Set(Oe);let Pe=0;const Ue=De.map(Me=>{if(!Be.has(Me))return Me;const ze=Oe[Pe];return Pe+=1,ze});H!=="manual"&&F("manual"),R(Ue),setTimeout(()=>Ce(!1),100)},[Ee,X,H,F,R]),He=k.useCallback(()=>{oe(null),Le(null),setTimeout(()=>Ce(!1),100)},[]);k.useEffect(()=>{if(!be&&!he)return;const G=new Set(Ee.map(le=>le.id));let re=!1;be&&!G.has(be)&&(oe(null),re=!0),he&&!G.has(he)&&(Le(null),re=!0),re&&Ce(!1)},[Ee,be,he]);const ie=(G,re)=>{l(G,re),p(null)};return T.jsxs("aside",{className:"flex min-h-0 flex-1 flex-col border-r border-border bg-elevated",children:[s&&T.jsx("div",{className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:s}),T.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"sticky top-0 z-10 flex h-10 items-center justify-between border-b border-border bg-elevated px-3",children:[T.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted",children:"Sessions"}),T.jsxs("div",{className:"flex items-center gap-4",children:[fe&&T.jsx(WR,{hosts:ce,selectedHosts:Z,onSelect:ee,statuses:V}),T.jsx(VR,{projects:me,selectedProjects:W,onSelect:K,hasHiddenPermissions:ke>0}),T.jsx(Nh.span,{className:"w-8 text-right text-xs text-muted",animate:b&&!m?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:x,children:Ee.length})]})]}),n?T.jsx("div",{className:"space-y-1 p-2",children:[0,1,2].map(G=>T.jsx("div",{className:"h-14 animate-pulse rounded bg-surface"},G))}):Ee.length===0?T.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted",children:"No sessions"}):T.jsx(cR,{sensors:se,collisionDetection:uL,onDragStart:q,onDragOver:Q,onDragEnd:ge,onDragCancel:He,children:T.jsx(xR,{items:Ee.map(G=>G.id),strategy:wR,children:T.jsx("div",{children:T.jsx(f5,{initial:!1,children:Ee.map((G,re)=>{const le=A.has(G.id),te=je.has(G.id),ue=G.remote===!0,Oe=G.source==="managed",Fe=!ue||U&&Oe,De=be?Ee.findIndex(Me=>Me.id===be):-1,Pe=he===G.id&&be!==G.id?De>re?"above":"below":null,Ue=le||te;return T.jsx(U1,{session:G,isNew:Ue,exitDuration:w,prefersReducedMotion:m,layoutAnimationsDisabled:Re,isSelected:G.id===r,isEditing:G.id===u,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:B,showHostInfo:fe,dropIndicator:Pe,onSelect:()=>a(G.id),onStartEdit:Fe?()=>p(G.id):void 0,onCancelEdit:()=>p(null),onRename:Me=>ie(G.id,Me),onKill:o&&Fe?()=>o(G.id):void 0,onDuplicate:c&&Fe?()=>c(G.id):void 0,onSetPinned:g&&G.agentSessionId?Me=>g(G.agentSessionId.trim(),Me):void 0},G.id)})})},ae)})}),_e.length>0&&T.jsxs("div",{className:"border-t border-border",children:[T.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary",children:[T.jsxs("span",{className:"flex items-center gap-2",children:[_?T.jsx(Zd,{className:"h-4 w-4"}):T.jsx(Bb,{className:"h-4 w-4"}),"Inactive Sessions"]}),T.jsx(Nh.span,{className:"w-8 text-right text-xs",animate:C&&!m?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:S,children:_e.length})]}),_&&T.jsxs("div",{className:"py-1",children:[_e.slice(0,f).map(G=>T.jsx(zR,{session:G,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:B,onResume:re=>i==null?void 0:i(re),onPreview:h,onSetPinned:g},G.sessionId)),_e.length>f&&T.jsxs("button",{type:"button",onClick:()=>d(G=>G+20),className:"w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover",children:["Show more (",_e.length-f," remaining)"]})]})]})]}),T.jsx("div",{className:"hidden shrink-0 border-t border-border px-3 py-2 md:block",children:T.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-muted",children:[T.jsxs("span",{children:[O,"[ ] nav"]}),T.jsxs("span",{children:[O,"N new"]}),T.jsxs("span",{children:[O,"X kill"]})]})}),v&&T.jsx(GR,{session:v,onClose:()=>h(null),onResume:G=>{h(null),i==null||i(G)}})]})}const U1=k.forwardRef(function({session:t,isNew:r,exitDuration:n,prefersReducedMotion:s,layoutAnimationsDisabled:a,isSelected:l,isEditing:i,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:g,showHostInfo:u,dropIndicator:p,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:f,onDuplicate:d,onSetPinned:m},w){const{attributes:b,listeners:x,setNodeRef:C,transform:S,transition:E,isDragging:L}=TR({id:t.id,animateLayoutChanges:({isSorting:H,wasDragging:F})=>H||F}),A=Ao.Transform.toString(S),D={...!!(s&&A)?{transform:A,transition:E}:{},zIndex:L?10:void 0,opacity:L?.9:void 0},O=k.useCallback(H=>{C(H),typeof w=="function"?w(H):w&&(w.current=H)},[C,w]);return T.jsxs(Nh.div,{ref:O,style:{...D,overflow:"hidden"},className:"relative",layout:!s&&!L&&!a&&!r,transformTemplate:(H,F)=>A?!F||F==="none"?A:`${A} ${F}`:F,initial:s||!r?!1:{opacity:0,scale:.97},animate:s?{opacity:1}:r?{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:s?{opacity:0}:{opacity:0,height:0,scale:.97},transition:s?{duration:0}:{layout:{type:"spring",stiffness:500,damping:35},opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:"easeOut"}},...b,...x,children:[p==="above"&&T.jsx("div",{className:"absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"}),T.jsx(XR,{session:t,isSelected:l,isEditing:i,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:g,showHostInfo:u,isDragging:L,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:f,onDuplicate:d,onSetPinned:m}),p==="below"&&T.jsx("div",{className:"absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"})]})});U1.displayName="SortableSessionItem";function XR({session:e,isSelected:t,isEditing:r,showSessionIdPrefix:n,showProjectName:s,showLastUserMessage:a,showHostInfo:l,isDragging:i=!1,onSelect:o,onStartEdit:c,onCancelEdit:g,onRename:u,onKill:p,onDuplicate:_,onSetPinned:y}){var ee,z,I,V;const v=Wf(e.lastActivity),h=k.useRef(null),f=k.useRef(null),d=((ee=e.agentSessionName)==null?void 0:ee.trim())||((z=e.name)==null?void 0:z.trim())||e.id,[m,w]=k.useState(d),b=k.useRef(null),[x,C]=k.useState(null),S=ui(e.projectPath),E=(I=e.host)==null?void 0:I.trim(),L=e.status==="permission",A=(V=e.agentSessionId)==null?void 0:V.trim(),M=n&&A?F1(A):"",D=s&&!!S,O=l&&!!E,H=a&&!!e.lastUserMessage,F=k.useRef(e.status),[$,N]=k.useState(!1);k.useEffect(()=>{const U=F.current,J=e.status;U==="working"&&J==="waiting"?N(!0):F.current=J},[e.status]);const R=()=>{N(!1),F.current=e.status};k.useEffect(()=>{r&&h.current&&(h.current.focus(),h.current.select())},[r]),k.useEffect(()=>{w(d)},[d]);const P=()=>{const U=m.trim();U&&U!==d?u(U):g()},B=U=>{U.key==="Enter"?(U.preventDefault(),P()):U.key==="Escape"&&(U.preventDefault(),w(d),g())},j=k.useRef(null),W=U=>{if(i)return;const J=U.touches[0];j.current={x:J.clientX,y:J.clientY},b.current=setTimeout(()=>{j.current&&C(j.current)},500)},K=()=>{b.current&&(clearTimeout(b.current),b.current=null)};k.useEffect(()=>{if(!x)return;const U=X=>{f.current&&!f.current.contains(X.target)&&C(null)},J=X=>{X.key==="Escape"&&C(null)};return document.addEventListener("mousedown",U),document.addEventListener("touchstart",U),document.addEventListener("keydown",J),()=>{document.removeEventListener("mousedown",U),document.removeEventListener("touchstart",U),document.removeEventListener("keydown",J)}},[x]);const Z=U=>{U.preventDefault(),U.stopPropagation(),C({x:U.clientX,y:U.clientY})};return T.jsxs("div",{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?"selected":""} ${i?"cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated":"cursor-grab"}`,role:"button",tabIndex:0,"data-testid":"session-card","data-session-id":e.id,onClick:i?void 0:o,onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&o()},onContextMenu:Z,onTouchStart:W,onTouchEnd:K,onTouchCancel:K,children:[T.jsxs("div",{className:"flex flex-col gap-0.5 pl-0.5",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:e.agentType,command:e.command,className:"h-3.5 w-3.5 shrink-0 text-muted"}),r?T.jsx("input",{ref:h,type:"text",value:m,onChange:U=>w(U.target.value),onBlur:P,onKeyDown:B,onClick:U=>U.stopPropagation(),className:"min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:d}),e.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-primary","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),M&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:A,children:M}),L?T.jsx("span",{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${Kg[e.status]} pulse-approval`,onAnimationEnd:R,children:T.jsx(Kb,{className:"h-3 w-3","aria-label":"Needs input"})}):T.jsx("span",{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${Kg[e.status]}${$?" pulse-complete":""}`,onAnimationEnd:R,children:v})]}),(D||O||H)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[O&&T.jsx(UR,{name:E}),D&&T.jsx(H1,{name:S,fullPath:e.projectPath}),H&&T.jsxs("span",{className:"line-clamp-2 text-xs italic text-muted",children:['"',e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+"…":e.lastUserMessage,'"']})]})]}),x&&T.jsxs("div",{ref:f,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:x.x,top:x.y},role:"menu",children:[c&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),c()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",children:[T.jsx(I0,{width:14,height:14}),"Rename"]}),_&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),_()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:"Create a copy in a new tmux window",children:[T.jsx(P0,{width:14,height:14}),"Duplicate"]}),y&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),y(!e.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),e.isPinned?"Unpin":"Pin"]}),e.logFilePath&&T.jsxs("button",{onClick:U=>{U.stopPropagation();const J=e.logFilePath;if(C(null),J){const X=document.createElement("textarea");X.value=J,X.style.position="fixed",X.style.left="-9999px",document.body.appendChild(X),X.focus(),X.select();try{document.execCommand("copy")}catch{navigator.clipboard.writeText(J).catch(()=>{})}document.body.removeChild(X)}},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]}),p&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"my-1 border-t border-border"}),T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),p()},className:"w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2",role:"menuitem",children:[T.jsx(mh,{width:14,height:14}),"Kill Session"]})]})]})]})}var W1={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(globalThis,()=>(()=>{var r={4567:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const u=o(9042),p=o(9924),_=o(844),y=o(4725),v=o(2585),h=o(3656);let f=i.AccessibilityManager=class extends _.Disposable{constructor(d,m,w,b){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=b,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(x=>this._handleResize(x.rows))),this.register(this._terminal.onRender(x=>this._refreshRows(x.start,x.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(x=>this._handleChar(x))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
54
54
  `))),this.register(this._terminal.onA11yTab(x=>this._handleTab(x))),this.register(this._terminal.onKey(x=>this._handleKey(x.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,h.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,_.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(d){for(let m=0;m<d;m++)this._handleChar(" ")}_handleChar(d){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==d&&(this._charsToAnnounce+=d):this._charsToAnnounce+=d,d===`
55
55
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(d){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(d)||this._charsToConsume.push(d)}_refreshRows(d,m){this._liveRegionDebouncer.refresh(d,m,this._terminal.rows)}_renderRows(d,m){const w=this._terminal.buffer,b=w.lines.length.toString();for(let x=d;x<=m;x++){const C=w.lines.get(w.ydisp+x),S=[],E=(C==null?void 0:C.translateToString(!0,void 0,void 0,S))||"",L=(w.ydisp+x+1).toString(),A=this._rowElements[x];A&&(E.length===0?(A.innerText=" ",this._rowColumns.set(A,[0,1])):(A.textContent=E,this._rowColumns.set(A,S)),A.setAttribute("aria-posinset",L),A.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(d,m){const w=d.target,b=this._rowElements[m===0?1:this._rowElements.length-2];if(w.getAttribute("aria-posinset")===(m===0?"1":`${this._terminal.buffer.lines.length}`)||d.relatedTarget!==b)return;let x,C;if(m===0?(x=w,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(x=this._rowElements.shift(),C=w,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),m===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(m===0?-1:1),this._rowElements[m===0?1:this._rowElements.length-2].focus(),d.preventDefault(),d.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const d=document.getSelection();if(!d)return;if(d.isCollapsed)return void(this._rowContainer.contains(d.anchorNode)&&this._terminal.clearSelection());if(!d.anchorNode||!d.focusNode)return void console.error("anchorNode and/or focusNode are null");let m={node:d.anchorNode,offset:d.anchorOffset},w={node:d.focusNode,offset:d.focusOffset};if((m.node.compareDocumentPosition(w.node)&Node.DOCUMENT_POSITION_PRECEDING||m.node===w.node&&m.offset>w.offset)&&([m,w]=[w,m]),m.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(m={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(m.node))return;const b=this._rowElements.slice(-1)[0];if(w.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(w={node:b,offset:((E=b.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(w.node))return;const x=({node:L,offset:A})=>{const M=L instanceof Text?L.parentNode:L;let D=parseInt(M==null?void 0:M.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(M);if(!O)return console.warn("columns is null. Race condition?"),null;let H=A<O.length?O[A]:O.slice(-1)[0]+1;return H>=this._terminal.cols&&(++D,H=0),{row:D,column:H}},C=x(m),S=x(w);if(C&&S){if(C.row>S.row||C.row===S.row&&C.column>=S.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(S.row-C.row)*this._terminal.cols-C.column+S.column)}}_handleResize(d){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let m=this._rowContainer.children.length;m<this._terminal.rows;m++)this._rowElements[m]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[m]);for(;this._rowElements.length>d;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const d=this._coreBrowserService.mainDocument.createElement("div");return d.setAttribute("role","listitem"),d.tabIndex=-1,this._refreshRowDimensions(d),d}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let d=0;d<this._terminal.rows;d++)this._refreshRowDimensions(this._rowElements[d])}}_refreshRowDimensions(d){d.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=f=c([g(1,v.IInstantiationService),g(2,y.ICoreBrowserService),g(3,y.IRenderService)],f)},3614:(l,i)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function c(p,_){return _?"\x1B[200~"+p+"\x1B[201~":p}function g(p,_,y,v){p=c(p=o(p),y.decPrivateModes.bracketedPasteMode&&v.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),_.value=""}function u(p,_,y){const v=y.getBoundingClientRect(),h=p.clientX-v.left-10,f=p.clientY-v.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${h}px`,_.style.top=`${f}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=o,i.bracketTextForPaste=c,i.copyHandler=function(p,_){p.clipboardData&&p.clipboardData.setData("text/plain",_.selectionText),p.preventDefault()},i.handlePasteEvent=function(p,_,y,v){p.stopPropagation(),p.clipboardData&&g(p.clipboardData.getData("text/plain"),_,y,v)},i.paste=g,i.moveTextAreaUnderMouseCursor=u,i.rightClickHandler=function(p,_,y,v,h){u(p,_,y),h&&v.rightClickSelect(p),_.value=v.selectionText,_.select()}},7239:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const c=o(1505);i.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(g,u,p){this._css.set(g,u,p)}getCss(g,u){return this._css.get(g,u)}setColor(g,u,p){this._color.set(g,u,p)}getColor(g,u){return this._color.get(g,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(o,c,g,u){o.addEventListener(c,g,u);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(c,g,u))}}}},3551:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const u=o(3656),p=o(8460),_=o(844),y=o(2585),v=o(4725);let h=i.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(f,d,m,w,b){super(),this._element=f,this._mouseService=d,this._renderService=m,this._bufferService=w,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)(()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const m=f.composedPath();for(let w=0;w<m.length;w++){const b=m[w];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,d){var w,b;this._activeProviderReplies&&d||((w=this._activeProviderReplies)==null||w.forEach(x=>{x==null||x.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=f.y);let m=!1;for(const[x,C]of this._linkProviderService.linkProviders.entries())d?(b=this._activeProviderReplies)!=null&&b.get(x)&&(m=this._checkLinkProviderResult(x,f,m)):C.provideLinks(f.y,S=>{var L,A;if(this._isMouseOut)return;const E=S==null?void 0:S.map(M=>({link:M}));(L=this._activeProviderReplies)==null||L.set(x,E),m=this._checkLinkProviderResult(x,f,m),((A=this._activeProviderReplies)==null?void 0:A.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)})}_removeIntersectingLinks(f,d){const m=new Set;for(let w=0;w<d.size;w++){const b=d.get(w);if(b)for(let x=0;x<b.length;x++){const C=b[x],S=C.link.range.start.y<f?0:C.link.range.start.x,E=C.link.range.end.y>f?this._bufferService.cols:C.link.range.end.x;for(let L=S;L<=E;L++){if(m.has(L)){b.splice(x--,1);break}m.add(L)}}}}_checkLinkProviderResult(f,d,m){var x;if(!this._activeProviderReplies)return m;const w=this._activeProviderReplies.get(f);let b=!1;for(let C=0;C<f;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(b=!0);if(!b&&w){const C=w.find(S=>this._linkAtPosition(S.link,d));C&&(m=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!m)for(let C=0;C<this._activeProviderReplies.size;C++){const S=(x=this._activeProviderReplies.get(C))==null?void 0:x.find(E=>this._linkAtPosition(E.link,d));if(S){m=!0,this._handleNewLink(S);break}}return m}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,d){this._currentLink&&this._lastMouseEvent&&(!f||!d||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(f.link,d)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var m,w;return(w=(m=this._currentLink)==null?void 0:m.state)==null?void 0:w.decorations.pointerCursor},set:m=>{var w;(w=this._currentLink)!=null&&w.state&&this._currentLink.state.decorations.pointerCursor!==m&&(this._currentLink.state.decorations.pointerCursor=m,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",m))}},underline:{get:()=>{var m,w;return(w=(m=this._currentLink)==null?void 0:m.state)==null?void 0:w.decorations.underline},set:m=>{var w,b,x;(w=this._currentLink)!=null&&w.state&&((x=(b=this._currentLink)==null?void 0:b.state)==null?void 0:x.decorations.underline)!==m&&(this._currentLink.state.decorations.underline=m,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,m))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(m=>{if(!this._currentLink)return;const w=m.start===0?0:m.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+m.end;if(this._currentLink.link.range.start.y>=w&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(w,b),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}})))}_linkHover(f,d,m){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(m,d.text)}_fireUnderlineEvent(f,d){const m=f.range,w=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(m.start.x-1,m.start.y-w-1,m.end.x,m.end.y-w-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(f,d,m){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(m,d.text)}_linkAtPosition(f,d){const m=f.range.start.y*this._bufferService.cols+f.range.start.x,w=f.range.end.y*this._bufferService.cols+f.range.end.x,b=d.y*this._bufferService.cols+d.x;return m<=b&&b<=w}_positionFromMouseEvent(f,d,m){const w=m.getCoords(f,d,this._bufferService.cols,this._bufferService.rows);if(w)return{x:w[0],y:w[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,d,m,w,b){return{x1:f,y1:d,x2:m,y2:w,cols:this._bufferService.cols,fg:b}}};i.Linkifier=h=c([g(1,v.IMouseService),g(2,v.IRenderService),g(3,y.IBufferService),g(4,v.ILinkProviderService)],h)},9042:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const u=o(511),p=o(2585);let _=i.OscLinkProvider=class{constructor(v,h,f){this._bufferService=v,this._optionsService=h,this._oscLinkService=f}provideLinks(v,h){var E;const f=this._bufferService.buffer.lines.get(v-1);if(!f)return void h(void 0);const d=[],m=this._optionsService.rawOptions.linkHandler,w=new u.CellData,b=f.getTrimmedLength();let x=-1,C=-1,S=!1;for(let L=0;L<b;L++)if(C!==-1||f.hasContent(L)){if(f.loadCell(L,w),w.hasExtendedAttrs()&&w.extended.urlId){if(C===-1){C=L,x=w.extended.urlId;continue}S=w.extended.urlId!==x}else C!==-1&&(S=!0);if(S||C!==-1&&L===b-1){const A=(E=this._oscLinkService.getLinkData(x))==null?void 0:E.uri;if(A){const M={start:{x:C+1,y:v},end:{x:L+(S||L!==b-1?0:1),y:v}};let D=!1;if(!(m!=null&&m.allowNonHttpProtocols))try{const O=new URL(A);["http:","https:"].includes(O.protocol)||(D=!0)}catch{D=!0}D||d.push({text:A,range:M,activate:(O,H)=>m?m.activate(O,H,M):y(0,H),hover:(O,H)=>{var F;return(F=m==null?void 0:m.hover)==null?void 0:F.call(m,O,H,M)},leave:(O,H)=>{var F;return(F=m==null?void 0:m.leave)==null?void 0:F.call(m,O,H,M)}})}S=!1,w.hasExtendedAttrs()&&w.extended.urlId?(C=L,x=w.extended.urlId):(C=-1,x=-1)}}h(d)}};function y(v,h){if(confirm(`Do you want to navigate to ${h}?
@@ -6,7 +6,7 @@
6
6
  <link rel="icon" href="/favicon.svg" />
7
7
  <link rel="preload" href="/fonts/jetbrains-mono-latin-wght-normal.woff2" as="font" type="font/woff2" crossorigin />
8
8
  <title>Agentboard</title>
9
- <script type="module" crossorigin src="/assets/index-QcvlFZ4K.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-DYToHsHG.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-C2t0KZah.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gbasin/agentboard-darwin-x64",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "agentboard binary for darwin-x64",
5
5
  "repository": {
6
6
  "type": "git",