@gbasin/agentboard-linux-arm64 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ Error generating stack: `+e.message+`
17
17
  To pick up a draggable item, press the space bar.
18
18
  While dragging, use the arrow keys to move the item.
19
19
  Press space again to drop the item in its new position, or press escape to cancel.
20
- `},If={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Lf(e){let{announcements:t=If,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ff}=e,{announce:a,announcement:o}=jf(),s=_f(`DndLiveRegion`),[c,l]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{l(!0)},[]),Nf((0,y.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=y.createElement(y.Fragment,null,y.createElement(kf,{id:r,value:i.draggable}),y.createElement(Af,{id:s,announcement:o}));return n?(0,Qd.createPortal)(u,n):u}var Rf;(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`})(Rf||={});function zf(){}function Bf(e,t){return(0,y.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Vf(){var e=[...arguments];return(0,y.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Hf=Object.freeze({x:0,y:0});function Uf(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Wf(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Gf(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Kf(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function qf(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Jf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=qf(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Uf(qf(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Wf)};function Yf(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Xf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Yf(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Gf)};function Zf(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qf(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Hf}function $f(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ep=$f(1);function tp(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function np(e,t,n){let r=tp(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var rp={ignoreTransform:!1};function ip(e,t){t===void 0&&(t=rp);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=rf(e).getComputedStyle(e);t&&(n=np(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ap(e){return ip(e,{ignoreTransform:!0})}function op(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function sp(e,t){return t===void 0&&(t=rf(e).getComputedStyle(e)),t.position===`fixed`}function cp(e,t){t===void 0&&(t=rf(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function lp(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(af(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!of(i)||sf(i)||n.includes(i))return n;let a=rf(e).getComputedStyle(i);return i!==e&&cp(i,a)&&n.push(i),sp(i,a)?n:r(i.parentNode)}return e?r(e):n}function up(e){let[t]=lp(e,1);return t??null}function dp(e){return!ef||!e?null:tf(e)?e:nf(e)?af(e)||e===cf(e).scrollingElement?window:of(e)?e:null:null}function fp(e){return tf(e)?e.scrollX:e.scrollLeft}function pp(e){return tf(e)?e.scrollY:e.scrollTop}function mp(e){return{x:fp(e),y:pp(e)}}var hp;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(hp||={});function gp(e){return!ef||!e?!1:e===document.scrollingElement}function _p(e){let t={x:0,y:0},n=gp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var vp={x:.2,y:.2};function yp(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=vp);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=_p(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=hp.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=hp.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=hp.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=hp.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function bp(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function xp(e){return e.reduce((e,t)=>yf(e,mp(t)),Hf)}function Sp(e){return e.reduce((e,t)=>e+fp(t),0)}function Cp(e){return e.reduce((e,t)=>e+pp(t),0)}function wp(e,t){if(t===void 0&&(t=ip),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);up(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Tp=[[`x`,[`left`,`right`],Sp],[`y`,[`top`,`bottom`],Cp]],Ep=class{constructor(e,t){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;let n=lp(t),r=xp(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Tp)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Dp=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Op(e){let{EventTarget:t}=rf(e);return e instanceof t?e:cf(e)}function kp(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Ap;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Ap||={});function jp(e){e.preventDefault()}function Mp(e){e.stopPropagation()}var Np;(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`})(Np||={});var Pp={start:[Np.Space,Np.Enter],cancel:[Np.Esc],end:[Np.Space,Np.Enter,Np.Tab]},Fp=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Np.Right:return{...n,x:n.x+25};case Np.Left:return{...n,x:n.x-25};case Np.Down:return{...n,y:n.y+25};case Np.Up:return{...n,y:n.y-25}}},Ip=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Dp(cf(t)),this.windowListeners=new Dp(rf(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ap.Resize,this.handleCancel),this.windowListeners.add(Ap.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ap.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&wp(n),t(Hf)}handleKeyDown(e){if(Sf(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Pp,coordinateGetter:a=Fp,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Hf;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=bf(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=_p(n),p=bp(n),m={x:Math.min(i===Np.Right?p.right-p.width/2:p.right,Math.max(i===Np.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Np.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Np.Down?p.top:p.top+p.height/2,u.y))},h=i===Np.Right&&!s||i===Np.Left&&!c,g=i===Np.Down&&!l||i===Np.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Np.Right&&e<=d.x||i===Np.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Np.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Np.Down&&e<=d.y||i===Np.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Np.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,yf(bf(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ip.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Pp,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Lp(e){return!!(e&&`distance`in e)}function Rp(e){return!!(e&&`delay`in e)}var zp=class{constructor(e,t,n){n===void 0&&(n=Op(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=cf(i),this.documentListeners=new Dp(this.document),this.listeners=new Dp(n),this.windowListeners=new Dp(rf(i)),this.initialCoordinates=wf(r)??Hf,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ap.Resize,this.handleCancel),this.windowListeners.add(Ap.DragStart,jp),this.windowListeners.add(Ap.VisibilityChange,this.handleCancel),this.windowListeners.add(Ap.ContextMenu,jp),this.documentListeners.add(Ap.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rp(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Lp(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ap.Click,Mp,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ap.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=wf(e)??Hf,s=bf(n,o);if(!t&&a){if(Lp(a)){if(a.tolerance!=null&&kp(s,a.tolerance))return this.handleCancel();if(kp(s,a.distance))return this.handleStart()}if(Rp(a)&&kp(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Np.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Bp={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Vp=class extends zp{constructor(e){let{event:t}=e,n=cf(t.target);super(e,Bp,n)}};Vp.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Hp={move:{name:`mousemove`},end:{name:`mouseup`}},Up;(function(e){e[e.RightClick=2]=`RightClick`})(Up||={});var Wp=class extends zp{constructor(e){super(e,Hp,cf(e.event.target))}};Wp.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Up.RightClick?!1:(r?.({event:n}),!0)}}];var Gp={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Kp=class extends zp{constructor(e){super(e,Gp)}static setup(){return window.addEventListener(Gp.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Gp.move.name,e)};function e(){}}};Kp.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var qp;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(qp||={});var Jp;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Jp||={});function Yp(e){let{acceleration:t,activator:n=qp.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Jp.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Zp({delta:d,disabled:!a}),[m,h]=df(),g=(0,y.useRef)({x:0,y:0}),_=(0,y.useRef)({x:0,y:0}),v=(0,y.useMemo)(()=>{switch(n){case qp.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qp.DraggableRect:return i}},[n,i,c]),b=(0,y.useRef)(null),x=(0,y.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,y.useMemo)(()=>s===Jp.TreeOrder?[...l].reverse():l,[s,l]);(0,y.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=yp(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var Xp={x:{[hp.Backward]:!1,[hp.Forward]:!1},y:{[hp.Backward]:!1,[hp.Forward]:!1}};function Zp(e){let{delta:t,disabled:n}=e,r=hf(t);return pf(e=>{if(n||!r||!e)return Xp;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hp.Backward]:e.x[hp.Backward]||i.x===-1,[hp.Forward]:e.x[hp.Forward]||i.x===1},y:{[hp.Backward]:e.y[hp.Backward]||i.y===-1,[hp.Forward]:e.y[hp.Forward]||i.y===1}}},[n,t,r])}function Qp(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return pf(e=>t==null?null:r??e??null,[r,t])}function $p(e,t){return(0,y.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var em;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(em||={});var tm;(function(e){e.Optimized=`optimized`})(tm||={});var nm=new Map;function rm(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,y.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,y.useRef)(e),d=g(),f=ff(d),p=(0,y.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,y.useRef)(null),h=pf(t=>{if(d&&!n)return nm;if(!t||t===nm||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Ep(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,y.useEffect)(()=>{u.current=e},[e]),(0,y.useEffect)(()=>{d||p()},[n,d]),(0,y.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,y.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case em.Always:return!1;case em.BeforeDragging:return n;default:return!n}}}function im(e,t){return pf(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function am(e,t){return im(e,t)}function om(e){let{callback:t,disabled:n}=e,r=uf(t),i=(0,y.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function sm(e){let{callback:t,disabled:n}=e,r=uf(t),i=(0,y.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function cm(e){return new Ep(ip(e),e)}function lm(e,t,n){t===void 0&&(t=cm);let[r,i]=(0,y.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=om({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=sm({callback:a});return lf(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function um(e){return Qf(e,im(e))}var dm=[];function fm(e){let t=(0,y.useRef)(e),n=pf(n=>e?n&&n!==dm&&e&&t.current&&e.parentNode===t.current.parentNode?n:lp(e):dm,[e]);return(0,y.useEffect)(()=>{t.current=e},[e]),n}function pm(e){let[t,n]=(0,y.useState)(null),r=(0,y.useRef)(e),i=(0,y.useCallback)(e=>{let t=dp(e.target);t&&n(e=>e?(e.set(t,mp(t)),new Map(e)):null)},[]);return(0,y.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=dp(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,mp(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{dp(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,y.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>yf(e,t),Hf):xp(e):Hf,[e,t])}function mm(e,t){t===void 0&&(t=[]);let n=(0,y.useRef)(null);return(0,y.useEffect)(()=>{n.current=null},t),(0,y.useEffect)(()=>{let t=e!==Hf;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?bf(e,n.current):Hf}function hm(e){(0,y.useEffect)(()=>{if(!ef)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function gm(e,t){return(0,y.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function _m(e){return(0,y.useMemo)(()=>e?op(e):null,[e])}var vm=[];function ym(e,t){t===void 0&&(t=ip);let[n]=e,r=_m(n?rf(n):null),[i,a]=(0,y.useState)(vm);function o(){a(()=>e.length?e.map(e=>gp(e)?r:new Ep(t(e),e)):vm)}let s=sm({callback:o});return lf(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function bm(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return of(t)?t:e}function xm(e){let{measure:t}=e,[n,r]=(0,y.useState)(null),i=sm({callback:(0,y.useCallback)(e=>{for(let{target:n}of e)if(of(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=mf((0,y.useCallback)(e=>{let n=bm(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,y.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Sm=[{sensor:Vp,options:{}},{sensor:Ip,options:{}}],Cm={current:{}},wm={draggable:{measure:ap},droppable:{measure:ap,strategy:em.WhileDragging,frequency:tm.Optimized},dragOverlay:{measure:ip}},Tm=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Em={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Tm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wm,measureDroppableContainers:zf,windowRect:null,measuringScheduled:!1},Dm={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:zf,draggableNodes:new Map,over:null,measureDroppableContainers:zf},Om=(0,y.createContext)(Dm),km=(0,y.createContext)(Em);function Am(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Tm}}}function jm(e,t){switch(t.type){case Rf.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Rf.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 Rf.DragEnd:case Rf.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Rf.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Tm(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Rf.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Tm(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Rf.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Tm(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Mm(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,y.useContext)(Om),a=hf(r),o=hf(n?.id);return(0,y.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Sf(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Df(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Nm(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Pm(e){return(0,y.useMemo)(()=>({draggable:{...wm.draggable,...e?.draggable},droppable:{...wm.droppable,...e?.droppable},dragOverlay:{...wm.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fm(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,y.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;lf(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Qf(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=up(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Im=(0,y.createContext)({...Hf,scaleX:1,scaleY:1}),Lm;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Lm||={});var Rm=(0,y.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Sm,collisionDetection:o=Xf,measuring:s,modifiers:c,...l}=e,[u,d]=(0,y.useReducer)(jm,void 0,Am),[f,p]=Pf(),[m,h]=(0,y.useState)(Lm.Uninitialized),g=m===Lm.Initialized,{draggable:{active:_,nodes:v,translate:b},droppable:{containers:x}}=u,S=_==null?null:v.get(_),C=(0,y.useRef)({initial:null,translated:null}),w=(0,y.useMemo)(()=>_==null?null:{id:_,data:S?.data??Cm,rect:C},[_,S]),T=(0,y.useRef)(null),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(null),A=ff(l,Object.values(l)),j=_f(`DndDescribedBy`,t),M=(0,y.useMemo)(()=>x.getEnabled(),[x]),N=Pm(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:ee}=rm(M,{dragging:g,dependencies:[b.x,b.y],config:N.droppable}),I=Qp(v,_),L=(0,y.useMemo)(()=>O?wf(O):null,[O]),R=Ee(),z=am(I,N.draggable.measure);Fm({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let B=lm(I,N.draggable.measure,z),te=lm(I?I.parentElement:null),V=(0,y.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=x.getNodeFor(V.current.over?.id),H=xm({measure:N.dragOverlay.measure}),re=H.nodeRef.current??I,ie=g?H.rect??B:null,ae=!!(H.nodeRef.current&&H.rect),U=um(ae?null:B),oe=_m(re?rf(re):null),se=fm(g?ne??I:null),ce=ym(se),le=Nm(c,{transform:{x:b.x-U.x,y:b.y-U.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:B,containerNodeRect:te,draggingNodeRect:ie,over:V.current.over,overlayNodeRect:H.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:oe}),ue=L?yf(L,b):null,de=pm(se),fe=mm(de),pe=mm(de,[B]),me=yf(le,fe),he=ie?ep(ie,le):null,ge=w&&he?o({active:w,collisionRect:he,droppableRects:P,droppableContainers:M,pointerCoordinates:ue}):null,_e=Kf(ge,`id`),[ve,ye]=(0,y.useState)(null),be=Zf(ae?le:yf(le,pe),ve?.rect??null,B),xe=(0,y.useRef)(null),Se=(0,y.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,Qd.unstable_batchedUpdates)(()=>{r?.(i),h(Lm.Initializing),d({type:Rf.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(xe.current),k(a)})},onMove(e){d({type:Rf.DragMove,coordinates:e})},onEnd:o(Rf.DragEnd),onCancel:o(Rf.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Rf.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Rf.DragCancel)}T.current=null,(0,Qd.unstable_batchedUpdates)(()=>{d({type:e}),h(Lm.Uninitialized),ye(null),D(null),k(null),xe.current=null;let t=e===Rf.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=$p(a,(0,y.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Se(n,t))},[v,Se]));hm(a),lf(()=>{B&&m===Lm.Initializing&&h(Lm.Initialized)},[B,m]),(0,y.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,Qd.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,y.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Qd.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),lf(()=>{V.current={activatorEvent:O,active:w,activeNode:I,collisionRect:he,collisions:ge,droppableRects:P,draggableNodes:v,draggingNode:re,draggingNodeRect:ie,droppableContainers:x,over:ve,scrollableAncestors:se,scrollAdjustedTranslate:me},C.current={initial:ie,translated:he}},[w,I,ge,he,v,re,ie,P,x,ve,se,me]),Yp({...R,delta:b,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let we=(0,y.useMemo)(()=>({active:w,activeNode:I,activeNodeRect:B,activatorEvent:O,collisions:ge,containerNodeRect:te,dragOverlay:H,draggableNodes:v,droppableContainers:x,droppableRects:P,over:ve,measureDroppableContainers:F,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:N,measuringScheduled:ee,windowRect:oe}),[w,I,B,O,ge,te,H,v,x,P,ve,F,se,ce,N,ee,oe]),Te=(0,y.useMemo)(()=>({activatorEvent:O,activators:Ce,active:w,activeNodeRect:B,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:ve,measureDroppableContainers:F}),[O,Ce,w,B,d,j,v,ve,F]);return y.createElement(Mf.Provider,{value:p},y.createElement(Om.Provider,{value:Te},y.createElement(km.Provider,{value:we},y.createElement(Im.Provider,{value:be},i)),y.createElement(Mm,{disabled:n?.restoreFocus===!1})),y.createElement(Lf,{...n,hiddenTextDescribedById:j}));function Ee(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),zm=(0,y.createContext)(null),Bm=`button`,Vm=`Draggable`;function Hm(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=_f(Vm),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,y.useContext)(Om),{role:p=Bm,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,y.useContext)(g?Im:zm),[v,b]=mf(),[x,S]=mf(),C=gm(o,t),w=ff(n);return lf(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,y.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Bm?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:v,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function Um(){return(0,y.useContext)(km)}var Wm=`Droppable`,Gm={timeout:25};function Km(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=_f(Wm),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,y.useContext)(Om),u=(0,y.useRef)({disabled:n}),d=(0,y.useRef)(!1),f=(0,y.useRef)(null),p=(0,y.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Gm,...i},_=ff(h??r),v=sm({callback:(0,y.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=mf((0,y.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),S=ff(t);return(0,y.useEffect)(()=>{!v||!b.current||(v.disconnect(),d.current=!1,v.observe(b.current))},[b,v]),(0,y.useEffect)(()=>(s({type:Rf.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:Rf.UnregisterDroppable,key:a,id:r})),[r]),(0,y.useEffect)(()=>{n!==u.current.disabled&&(s({type:Rf.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function qm(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Jm(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Ym(e){return e!==null&&e>=0}function Xm(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Zm(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Qm=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=qm(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},$m={scaleX:1,scaleY:1},eh=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...$m}:null}let s=th(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...$m}:r<t&&r>=a?{x:0,y:o.height+s,...$m}:{x:0,y:0,...$m}};function th(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var nh=`Sortable`,rh=y.createContext({activeIndex:-1,containerId:nh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qm,disabled:{draggable:!1,droppable:!1}});function ih(e){let{children:t,id:n,items:r,strategy:i=Qm,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Um(),d=_f(nh,n),f=s.rect!==null,p=(0,y.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,y.useRef)(p),v=!Xm(p,_.current),b=g!==-1&&h===-1||v,x=Zm(a);lf(()=>{v&&m&&u(p)},[v,p,m,u]),(0,y.useEffect)(()=>{_.current=p},[p]);let S=(0,y.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:Jm(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return y.createElement(rh.Provider,{value:S},t)}var ah=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return qm(n,r,i).indexOf(t)},oh=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},sh={duration:200,easing:`ease`},ch=`transform`,lh=Tf.Transition.toString({property:ch,duration:0,easing:`linear`}),uh={roleDescription:`sortable`};function dh(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,y.useState)(null),s=(0,y.useRef)(n);return lf(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=ip(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,y.useEffect)(()=>{a&&o(null)},[a]),a}function fh(e){let{animateLayoutChanges:t=oh,attributes:n,disabled:r,data:i,getNewIndex:a=ah,id:o,strategy:s,resizeObserverConfig:c,transition:l=sh}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,y.useContext)(rh),b=ph(r,p),x=u.indexOf(o),S=(0,y.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,y.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=Km({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:ee,transform:I}=Hm({id:o,data:S,attributes:{...uh,...n},disabled:b.draggable}),L=$d(D,M),R=!!O,z=R&&!m&&Ym(f)&&Ym(g),B=!_&&P,te=z?(B&&z?I:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,V=Ym(f)&&Ym(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,ne=O?.id,H=(0,y.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),re=u!==H.current.items,ie=t({active:O,containerId:d,isDragging:P,isSorting:R,id:o,index:x,items:u,newIndex:H.current.newIndex,previousItems:H.current.items,previousContainerId:H.current.containerId,transition:l,wasDragging:H.current.activeId!=null}),ae=dh({disabled:!ie,index:x,node:T,rect:w});return(0,y.useEffect)(()=>{R&&H.current.newIndex!==V&&(H.current.newIndex=V),d!==H.current.containerId&&(H.current.containerId=d),u!==H.current.items&&(H.current.items=u)},[R,V,d,u]),(0,y.useEffect)(()=>{if(ne===H.current.activeId)return;if(ne!=null&&H.current.activeId==null){H.current.activeId=ne;return}let e=setTimeout(()=>{H.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:V,items:u,isOver:E,isSorting:R,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:L,setActivatorNodeRef:ee,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:ae??te,transition:U()};function U(){if(ae||re&&H.current.newIndex===x)return lh;if(!(B&&!Sf(k)||!l)&&(R||ie))return Tf.Transition.toString({...l,property:ch})}}function ph(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Np.Down,Np.Right,Np.Up,Np.Left;var mh={permission:0,waiting:1,working:2,unknown:3};function hh(e){let t=e.agentSessionId?.trim();return t&&t.length>0?t:e.id}var gh={mode:`created`,direction:`desc`};function _h(e,t=gh){let{mode:n,direction:r,manualOrder:i}=t;if(n===`manual`&&i&&i.length>0){let t=new Map(i.map((e,t)=>[e,t]));return e.toSorted((e,n)=>{let r=hh(e),i=hh(n),a=t.get(r)??t.get(e.id)??1/0,o=t.get(i)??t.get(n.id)??1/0;return a===1/0&&o===1/0?Date.parse(n.createdAt)-Date.parse(e.createdAt):a-o})}return e.toSorted((e,t)=>{if(n===`status`){let n=mh[e.status]??mh.unknown,r=mh[t.status]??mh.unknown;return n===r?Date.parse(t.lastActivity)-Date.parse(e.lastActivity):n-r}let i=Date.parse(e.createdAt),a=Date.parse(t.createdAt);return r===`desc`?a-i:i-a})}function vh(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e])),r=[];for(let e of t){let t=n.get(e);t&&(r.push(t),n.delete(e))}for(let t of e)n.has(t.id)&&r.push(t);return r}function yh(e,t){let n=new Map;for(let t of e){let e=t.projectPath?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.projectPath?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function bh(e,t){let n=new Map;for(let t of e){let e=t.host?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.host?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function xh(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Sh(e){let t=e.trim();if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return null;let r=n.split(/[\\/]/);return r[r.length-1]||null}function Ch(e){let t=e.map(e=>{let t=e.trim(),n=t.replace(/[\\/]+$/,``);return{path:e,parts:n.split(/[\\/]/).filter(Boolean),fallback:n||t||e}}),n=new Map;for(let e of t)n.set(e.path,1);let r=!0;for(;r;){r=!1;let e=new Map;for(let r of t){if(r.parts.length===0)continue;let t=n.get(r.path)??1,i=r.parts.slice(-t).join(`/`);e.set(i,(e.get(i)??0)+1)}for(let i of t){if(i.parts.length===0)continue;let t=n.get(i.path)??1,a=i.parts.slice(-t).join(`/`);(e.get(a)??0)>1&&t<i.parts.length&&(n.set(i.path,t+1),r=!0)}}let i=new Map,a=new Map;for(let e of t){let t=e.fallback;if(e.parts.length>0){let r=n.get(e.path)??1;t=e.parts.slice(-r).join(`/`)}i.set(e.path,t),a.set(t,(a.get(t)??0)+1)}let o=new Map;for(let e of t){let t=i.get(e.path)??e.fallback;(a.get(t)??0)>1&&(t=e.fallback),o.set(e.path,t)}return o}function wh(e){let t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}function Th({useSafariLayoutFallback:e,isDragging:t,dndTransform:n,generatedTransform:r}){return e&&!t&&!n||!n?r:!r||r===`none`?n:`${n} ${r}`}var Eh=`agentboard-session`,Dh=T(Eh);function Oh(e,t){return e.id===t.id&&e.name===t.name&&e.tmuxWindow===t.tmuxWindow&&e.projectPath===t.projectPath&&e.status===t.status&&e.lastActivity===t.lastActivity&&e.createdAt===t.createdAt&&e.source===t.source&&e.host===t.host&&e.remote===t.remote&&e.command===t.command&&e.agentType===t.agentType&&e.agentSessionId===t.agentSessionId&&e.boardSessionId===t.boardSessionId&&e.agentSessionName===t.agentSessionName&&e.logFilePath===t.logFilePath&&e.isHibernating===t.isHibernating&&e.lastUserMessage===t.lastUserMessage}function kh(e,t){if(e.length!==t.length)return!1;let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);if(!t||!Oh(t,e))return!1}return!0}function Ah(e){return typeof e==`string`&&e.length>0?e:null}function jh(e){return Array.isArray(e)?e:[]}var Mh=nt()(at((e,t)=>({sessions:[],agentSessions:{active:[],hibernating:[],history:[]},agentSessionsEpoch:-1,hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,selectedHibernatingSessionId:null,hasLoaded:!1,connectionStatus:`connecting`,connectionError:null,connectionEpoch:0,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,preferWindowName:!1,setSessions:n=>{let r=t(),i=r.selectedSessionId,a=r.selectedHibernatingSessionId,o=r.sessions,s=r.exitingSessions;if(r.hasLoaded&&kh(o,n))return;let c=new Set(n.map(e=>e.id)),l=o.filter(e=>!c.has(e.id)&&!s.has(e.id)),u=i;if(i!==null&&!n.some(e=>e.id===i))if(a===null){let{sessionSortMode:e,sessionSortDirection:t}=W.getState();u=_h(n,{mode:e,direction:t})[0]?.id??null}else u=null;if(l.length>0){let t=new Map(s);for(let e of l)t.set(e.id,e);e({sessions:n,hasLoaded:!0,selectedSessionId:u,exitingSessions:t})}else e({sessions:n,hasLoaded:!0,selectedSessionId:u})},setAgentSessions:(t,n,r)=>e(e=>{let i={active:jh(t),hibernating:jh(n),history:jh(r)};return{agentSessions:i,agentSessionsEpoch:e.connectionEpoch,selectedHibernatingSessionId:e.selectedHibernatingSessionId&&!i.hibernating.some(t=>t.sessionId===e.selectedHibernatingSessionId)?null:e.selectedHibernatingSessionId}}),setActiveAgentSessions:t=>e(e=>({agentSessions:{active:jh(t),hibernating:e.agentSessions.hibernating,history:e.agentSessions.history}})),setHostStatuses:t=>e({hostStatuses:t}),updateSession:t=>e(e=>({sessions:e.sessions.map(e=>e.id===t.id?t:e)})),setSelectedSessionId:t=>e({selectedSessionId:t,...t===null?{}:{selectedHibernatingSessionId:null}}),setSelectedHibernatingSessionId:t=>e({selectedHibernatingSessionId:t,...t===null?{}:{selectedSessionId:null}}),setConnectionStatus:t=>e({connectionStatus:t}),setConnectionError:t=>e({connectionError:t}),setConnectionState:(t,n,r)=>e({connectionStatus:t,connectionError:n,connectionEpoch:r}),setRemoteAllowControl:t=>e({remoteAllowControl:t}),setRemoteAllowAttach:t=>e({remoteAllowAttach:t}),setHostLabel:t=>e({hostLabel:t}),setPreferWindowName:t=>e({preferWindowName:t}),markSessionExiting:n=>{let r=t().sessions.find(e=>e.id===n);if(r){let i=new Map(t().exitingSessions);i.set(n,r),e({exitingSessions:i})}},clearExitingSession:n=>{let r=new Map(t().exitingSessions);r.delete(n),e({exitingSessions:r})}}),{name:Eh,storage:rt(()=>Dh),partialize:e=>({selectedSessionId:e.selectedSessionId,selectedHibernatingSessionId:e.selectedHibernatingSessionId}),merge:(e,t)=>{let n=e,r=n?.selectedHibernatingSessionId??n?.selectedSleepingSessionId;return{...t,selectedSessionId:Ah(n?.selectedSessionId),selectedHibernatingSessionId:Ah(r)}}}));function Nh(e,t,n=!1){let[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(e),o=(0,y.useRef)(!1);return(0,y.useEffect)(()=>{let r=a.current;if(n?e>r:e!==r){o.current=!0;let n=setTimeout(()=>{o.current&&=(i(!0),!1)},t);return a.current=e,()=>clearTimeout(n)}a.current=e},[e,t,n]),[r,()=>i(!1)]}function Ph(e,t,n,r){let i=(0,y.useRef)(new Map);(0,y.useEffect)(()=>{let a=new Set(e.map(e=>e.id));for(let e of t.keys())if(a.has(e)){let t=i.current.get(e);t&&(clearTimeout(t),i.current.delete(e)),n(e)}else if(!i.current.has(e)){let t=setTimeout(()=>{i.current.delete(e),n(e)},r+100);i.current.set(e,t)}},[e,t,n,r]),(0,y.useEffect)(()=>()=>{for(let e of i.current.values())clearTimeout(e);i.current.clear()},[])}function Fh(e){return typeof CSS<`u`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Ih(e){let t=parseFloat(e);return Number.isFinite(t)?t:0}function Lh(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a,o;if(e.scrollHeight>e.clientHeight){let t=Ih(n.scrollPaddingTop),o=Ih(n.scrollPaddingBottom),s=i.top-r.top+e.scrollTop,c=s+i.height,l=e.scrollTop+t,u=e.scrollTop+e.clientHeight-o;s<l?a=s-t:c>u&&(a=c-e.clientHeight+o)}if(e.scrollWidth>e.clientWidth){let t=Ih(n.scrollPaddingLeft),a=Ih(n.scrollPaddingRight),s=i.left-r.left+e.scrollLeft,c=s+i.width,l=e.scrollLeft+t,u=e.scrollLeft+e.clientWidth-a;s<l?o=s-t:c>u&&(o=c-e.clientWidth+a)}(a!==void 0||o!==void 0)&&e.scrollTo({top:a,left:o,behavior:`instant`})}function Rh(e,t,n,r=!0){let i=(0,y.useRef)(t);(0,y.useLayoutEffect)(()=>{i.current=t},[t,r]),(0,y.useLayoutEffect)(()=>{if(!r)return;let t=i.current;if(!t)return;if(n&&!n(t)){i.current=null;return}let a=e.current,o=a?.querySelector(`[data-session-id="${Fh(t)}"]`);a&&o&&(Lh(a,o),i.current=null)})}function zh(e=`(max-width: 767px)`){let[t,n]=(0,y.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,y.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}var Bh=2;function Vh(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=Bh}function Hh(e,t,n){let r=(0,y.useRef)(!0),i=(0,y.useRef)(null),a=()=>{let t=e.current;if(!t)return;let n=`${t.scrollHeight}:${t.clientHeight}`;n!==i.current&&(i.current=n,r.current&&(t.scrollTop=t.scrollHeight))},o=(0,y.useRef)(a);o.current=a,(0,y.useLayoutEffect)(()=>{i.current=null,n&&(r.current=!0,o.current())},[n]),(0,y.useLayoutEffect)(()=>{n&&o.current()}),(0,y.useEffect)(()=>{if(!n)return;let t=e.current;if(!t||typeof t.addEventListener!=`function`)return;let i=()=>{r.current=Vh(t)};return t.addEventListener(`scroll`,i,{passive:!0}),()=>t.removeEventListener(`scroll`,i)},[n,e]),(0,y.useEffect)(()=>{if(!n||typeof ResizeObserver>`u`)return;let r=t.current;if(!r)return;let i=new ResizeObserver(()=>o.current());return i.observe(r),e.current&&i.observe(e.current),()=>i.disconnect()},[n,t,e])}function Uh(e,t){let[n,r]=(0,y.useState)(null);return(0,y.useLayoutEffect)(()=>{let n=e.current;if(!t||!n||typeof window>`u`||typeof n.getBoundingClientRect!=`function`)return;let{width:i,height:a}=n.getBoundingClientRect(),o=window.innerWidth,s=window.innerHeight,c=typeof s==`number`&&t.y+a>s?Math.max(0,t.y-a):t.y;r({key:t,left:typeof o==`number`&&t.x+i>o?Math.max(0,t.x-i):t.x,top:c})},[e,t]),t?n&&n.key===t?{left:n.left,top:n.top}:{left:t.x,top:t.y}:null}function Wh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`0 0 92.2 92.2`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.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 Gh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`-1 -1 26 26`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.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 Kh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`0 0 588.42 568.88`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.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`})})}function qh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`41 41 343 343`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.jsx)(`path`,{d:`M70 159.333V91.3471C70 88.3592 71.594 85.5983 74.1816 84.1044L133.043 50.1205C135.631 48.6265 138.819 48.6265 141.407 50.1205L200.269 84.1044C202.856 85.5983 204.45 88.3592 204.45 91.3471V126.068C204.708 137.606 210.806 148.734 221.531 154.926C232.256 161.117 244.942 160.834 255.063 155.289L285.132 137.929C287.719 136.435 290.907 136.435 293.495 137.929L352.357 171.913C354.944 173.406 356.538 176.167 356.538 179.155V247.123C356.538 250.111 354.944 252.872 352.357 254.366L293.495 288.35C290.907 289.844 287.719 289.844 285.132 288.35L255.306 271.13C245.146 265.456 232.344 265.117 221.534 271.358C210.809 277.55 204.711 288.678 204.453 300.215V334.926C204.453 337.914 202.859 340.675 200.271 342.169L141.41 376.153C138.822 377.647 135.634 377.647 133.046 376.153L74.1845 342.169C71.5969 340.675 70.0028 337.914 70.0028 334.926V266.959C70.0029 263.971 71.5969 261.21 74.1845 259.716L133.046 225.732C135.634 224.238 138.822 224.238 141.41 225.732L171.547 243.132C181.656 248.638 194.306 248.906 205.005 242.729C215.815 236.488 221.922 225.231 222.088 213.595C221.83 202.057 215.732 189.737 205.008 183.545C194.283 177.353 181.597 177.636 171.476 183.181L141.269 200.72C138.67 202.229 135.461 202.228 132.864 200.716L74.1576 166.562C71.5835 165.065 70 162.311 70 159.333Z`})})}function Jh({className:e}){return(0,k.jsxs)(`svg`,{viewBox:`0 0 512 512`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,k.jsx)(`path`,{d:`M210.484 312.759L343.465 210.383C349.984 205.364 359.302 207.322 362.408 215.117C378.758 256.231 371.454 305.64 338.925 339.563C306.397 373.487 261.137 380.927 219.768 363.983L174.577 385.803C239.394 432.008 318.104 420.581 367.289 369.251C406.303 328.564 418.386 273.104 407.088 223.091L407.19 223.198C390.807 149.726 411.218 120.359 453.03 60.3072C454.02 58.8833 455.01 57.4595 456 56L400.978 113.382V113.204L210.45 312.794`}),(0,k.jsx)(`path`,{d:`M183.042 337.641C136.519 291.294 144.54 219.567 184.236 178.203C213.59 147.59 261.683 135.096 303.666 153.464L348.755 131.75C340.632 125.627 330.221 119.042 318.275 114.414C264.277 91.2407 199.63 102.774 155.735 148.516C113.513 192.549 100.236 260.254 123.036 318.027C140.069 361.206 112.148 391.748 84.0229 422.575C74.0561 433.503 64.0553 444.431 56 456L183.007 337.677`})]})}function Yh({className:e}){return(0,k.jsxs)(`svg`,{viewBox:`0 -15 120 120`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,k.jsx)(`rect`,{x:`10`,y:`8`,width:`100`,height:`12`,rx:`2`}),(0,k.jsx)(`rect`,{x:`25`,y:`20`,width:`12`,height:`62`,rx:`2`}),(0,k.jsx)(`rect`,{x:`75`,y:`20`,width:`12`,height:`45`,rx:`2`}),(0,k.jsx)(`rect`,{x:`71`,y:`55`,width:`20`,height:`16`,rx:`3`,fill:`#f97316`}),(0,k.jsx)(`rect`,{x:`76`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,k.jsx)(`rect`,{x:`82`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,k.jsx)(`circle`,{cx:`18`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`}),(0,k.jsx)(`circle`,{cx:`102`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`})]})}var Xh=[[`claude`,Wh],[`codex`,Gh],[`omp`,Yh],[`pi`,Kh],[`devin`,qh],[`grok`,Jh]];function Zh({agentType:e,command:t,className:n=``}){let r=(e||t?.split(` `)[0]||``).toLowerCase();for(let[e,t]of Xh)if(r.startsWith(e))return(0,k.jsx)(t,{className:n});return(0,k.jsx)(qe,{className:n})}function Qh(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Qh(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function $h(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Qh(e))&&(r&&(r+=` `),r+=t);return r}var eg=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},tg=(e,t)=>({classGroupId:e,validator:t}),ng=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rg=`-`,ig=[],ag=`arbitrary..`,og=e=>{let t=lg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return cg(e);let n=e.split(rg);return sg(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?eg(i,t):t:i||ig}return n[e]||ig}}},sg=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=sg(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(rg):e.slice(t).join(rg),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},cg=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ag+r:void 0})(),lg=e=>{let{theme:t,classGroups:n}=e;return ug(n,t)},ug=(e,t)=>{let n=ng();for(let r in e){let i=e[r];dg(i,n,r,t)}return n},dg=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];fg(i,t,n,r)}},fg=(e,t,n,r)=>{if(typeof e==`string`){pg(e,t,n);return}if(typeof e==`function`){mg(e,t,n,r);return}hg(e,t,n,r)},pg=(e,t,n)=>{let r=e===``?t:gg(t,e);r.classGroupId=n},mg=(e,t,n,r)=>{if(_g(e)){dg(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(tg(n,e))},hg=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];dg(o,gg(t,a),n,r)}},gg=(e,t)=>{let n=e,r=t.split(rg),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=ng(),n.nextPart.set(t,i)),n=i}return n},_g=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,vg=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},yg=`!`,bg=`:`,xg=[],Sg=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Cg=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===bg){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(yg)?(c=s.slice(0,-1),l=!0):s.startsWith(yg)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Sg(t,l,c,u)};if(t){let e=t+bg,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Sg(xg,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},wg=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Tg=e=>({cache:vg(e.cacheSize),parseClassName:Cg(e),sortModifiers:wg(e),...og(e)}),Eg=/\s+/,Dg=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Eg),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+yg:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Og=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=kg(n))&&(i&&(i+=` `),i+=r);return i},kg=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=kg(e[r]))&&(n&&(n+=` `),n+=t);return n},Ag=(e,...t)=>{let n,r,i,a,o=o=>(n=Tg(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Dg(e,n);return i(e,a),a};return a=o,(...e)=>a(Og(...e))},jg=[],Mg=e=>{let t=t=>t[e]||jg;return t.isThemeGetter=!0,t},Ng=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fg=/^\d+\/\d+$/,Ig=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Lg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vg=e=>Fg.test(e),Hg=e=>!!e&&!Number.isNaN(Number(e)),Ug=e=>!!e&&Number.isInteger(Number(e)),Wg=e=>e.endsWith(`%`)&&Hg(e.slice(0,-1)),Gg=e=>Ig.test(e),Kg=()=>!0,qg=e=>Lg.test(e)&&!Rg.test(e),Jg=()=>!1,Yg=e=>zg.test(e),Xg=e=>Bg.test(e),Zg=e=>!J(e)&&!Y(e),Qg=e=>u_(e,m_,Jg),J=e=>Ng.test(e),$g=e=>u_(e,h_,qg),e_=e=>u_(e,g_,Hg),t_=e=>u_(e,f_,Jg),n_=e=>u_(e,p_,Xg),r_=e=>u_(e,v_,Yg),Y=e=>Pg.test(e),i_=e=>d_(e,h_),a_=e=>d_(e,__),o_=e=>d_(e,f_),s_=e=>d_(e,m_),c_=e=>d_(e,p_),l_=e=>d_(e,v_,!0),u_=(e,t,n)=>{let r=Ng.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},d_=(e,t,n=!1)=>{let r=Pg.exec(e);return r?r[1]?t(r[1]):n:!1},f_=e=>e===`position`||e===`percentage`,p_=e=>e===`image`||e===`url`,m_=e=>e===`length`||e===`size`||e===`bg-size`,h_=e=>e===`length`,g_=e=>e===`number`,__=e=>e===`family-name`,v_=e=>e===`shadow`,y_=Ag(()=>{let e=Mg(`color`),t=Mg(`font`),n=Mg(`text`),r=Mg(`font-weight`),i=Mg(`tracking`),a=Mg(`leading`),o=Mg(`breakpoint`),s=Mg(`container`),c=Mg(`spacing`),l=Mg(`radius`),u=Mg(`shadow`),d=Mg(`inset-shadow`),f=Mg(`text-shadow`),p=Mg(`drop-shadow`),m=Mg(`blur`),h=Mg(`perspective`),g=Mg(`aspect`),_=Mg(`ease`),v=Mg(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[Vg,`full`,`auto`,...w()],E=()=>[Ug,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Ug,Y,J]},Ug,Y,J],O=()=>[Ug,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Vg,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,Y,J],F=()=>[...b(),o_,t_,{position:[Y,J]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],I=()=>[`auto`,`cover`,`contain`,s_,Qg,{size:[Y,J]}],L=()=>[Wg,i_,$g],R=()=>[``,`none`,`full`,l,Y,J],z=()=>[``,Hg,i_,$g],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[Hg,Wg,o_,t_],ne=()=>[``,`none`,m,Y,J],H=()=>[`none`,Hg,Y,J],re=()=>[`none`,Hg,Y,J],ie=()=>[Hg,Y,J],ae=()=>[Vg,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Gg],breakpoint:[Gg],color:[Kg],container:[Gg],"drop-shadow":[Gg],ease:[`in`,`out`,`in-out`],font:[Zg],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Gg],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Gg],shadow:[Gg],spacing:[`px`,Hg],text:[Gg],"text-shadow":[Gg],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Vg,J,Y,g]}],container:[`container`],columns:[{columns:[Hg,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ug,`auto`,Y,J]}],basis:[{basis:[Vg,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Hg,Vg,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,Hg,Y,J]}],shrink:[{shrink:[``,Hg,Y,J]}],order:[{order:[Ug,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,i_,$g]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Y,e_]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Wg,J]}],"font-family":[{font:[a_,J,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[Hg,`none`,Y,e_]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[Hg,`from-font`,`auto`,Y,$g]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Hg,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:I()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ug,Y,J],radial:[``,Y,J],conic:[Ug,Y,J]},c_,n_]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Hg,Y,J]}],"outline-w":[{outline:[``,Hg,i_,$g]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,l_,r_]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,l_,r_]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Hg,$g]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,l_,r_]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Hg,Y,J]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Hg]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Hg]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:ne()}],brightness:[{brightness:[Hg,Y,J]}],contrast:[{contrast:[Hg,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,l_,r_]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,Hg,Y,J]}],"hue-rotate":[{"hue-rotate":[Hg,Y,J]}],invert:[{invert:[``,Hg,Y,J]}],saturate:[{saturate:[Hg,Y,J]}],sepia:[{sepia:[``,Hg,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Hg,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[Hg,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Hg,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Hg,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,Hg,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[Hg,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[Hg,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,Hg,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Hg,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[Hg,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[Hg,i_,$g,e_]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function b_(...e){return y_($h(e))}var x_=[25,50,85,110,130,150,175,200,225,255,280,305,330,355];function S_(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t^=t>>>16,t=Math.imul(t,2146121005),t^=t>>>15,t=Math.imul(t,2221713035),t^=t>>>16,t>>>0}function C_(e){return{"--badge-hue":`${w_(e)}`}}function w_(e){return x_[S_(e)%x_.length]}function T_({name:e,fullPath:t,className:n=``}){let r=C_(e);return(0,k.jsx)(`span`,{className:b_(`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none`,n),style:r,title:t,children:e})}function E_({name:e,className:t=``}){let n=C_(`host:${e}`);return(0,k.jsx)(`span`,{className:b_(`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide`,t),style:n,title:e,children:e})}var D_=6e4,O_=new Map,k_=new Map,A_=new Map,j_=new Set,M_=new Set;function N_(e){return M_.add(e),()=>{M_.delete(e)}}function P_(e){let t=O_.get(e);return t&&Date.now()-t.at<D_?t.info:void 0}function F_(e){let t=k_.get(e);return t&&Date.now()-t.at<D_?t.checks:void 0}var I_=`inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] tabular-nums`;function L_(e){if(!e||e.error||!e.state)return{StateIcon:Ce,cls:`text-muted`};switch(e.state){case`OPEN`:return{StateIcon:Ce,cls:e.isDraft?`text-muted`:`text-pr-open`};case`MERGED`:return{StateIcon:xe,cls:`text-pr-merged`};case`CLOSED`:return{StateIcon:Ce,cls:`text-pr-closed`};default:return{StateIcon:Ce,cls:`text-muted`}}}function R_({info:e}){let{StateIcon:t,cls:n}=L_(e),r=e&&!e.error?e.state===`CLOSED`?Ye:e.isDraft?ze:null:null;return r?(0,k.jsxs)(`span`,{className:`relative inline-flex shrink-0`,children:[(0,k.jsx)(t,{width:G.pill,height:G.pill,strokeWidth:2,className:n,"aria-hidden":!0}),(0,k.jsx)(r,{width:6,height:6,strokeWidth:2.5,className:`absolute bottom-0 right-0 ${n}`,"aria-hidden":!0})]}):(0,k.jsx)(t,{width:G.pill,height:G.pill,strokeWidth:2,className:`shrink-0 ${n}`,"aria-hidden":!0})}function z_(e){return!e||!e.state?``:e.isDraft&&e.state===`OPEN`?`Draft`:e.state.charAt(0)+e.state.slice(1).toLowerCase()}var B_=new Set([`SKIPPED`,`NEUTRAL`,`STALE`]);function V_(e){return e.status===`COMPLETED`?e.conclusion===`SUCCESS`?{glyph:`✓`,cls:`text-pr-open`}:e.conclusion&&B_.has(e.conclusion)?{glyph:`–`,cls:`text-muted`}:{glyph:`✗`,cls:`text-pr-closed`}:{glyph:`…`,cls:`text-pr-pending`}}async function H_(e){let t=e.filter(e=>!P_(e)&&!A_.has(e));if(t.length>0){let e=fetch(`/api/pr-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({urls:t})}).then(e=>e.json()).then(e=>{for(let t of e)t.error||O_.set(t.url,{at:Date.now(),info:t});M_.forEach(e=>e())}).catch(()=>{}).finally(()=>{t.forEach(e=>A_.delete(e))});t.forEach(t=>A_.set(t,e))}return await Promise.all(e.map(e=>A_.get(e))),e.map(e=>P_(e)).filter(Boolean)}var U_=250,W_=200,G_=3,K_=8;function q_(e,t,n){let[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null),s=(0,y.useRef)(r);s.current=r;let c=(0,y.useRef)(n);(0,y.useEffect)(()=>{c.current=n});let l=(0,y.useRef)(void 0),u=(0,y.useRef)(void 0),d=(0,y.useRef)(null),f=(0,y.useCallback)(()=>{window.clearTimeout(l.current),l.current=void 0},[]),p=(0,y.useCallback)(()=>{window.clearTimeout(u.current),u.current=void 0},[]),m=(0,y.useCallback)(()=>{f(),p();let n=e.current?.getBoundingClientRect();if(!n)return;let r=n.top-K_,a=window.innerHeight-n.bottom-K_,s=Math.max(K_,Math.min(n.left,window.innerWidth-t-K_)),c=e=>Math.max(60,e-G_);o(r>=a?{left:s,bottom:window.innerHeight-n.top+G_,maxHeight:c(r)}:{left:s,top:n.bottom+G_,maxHeight:c(a)}),i(!0)},[e,f,p,t]),h=(0,y.useCallback)(()=>{p(),!r&&(f(),l.current=window.setTimeout(m,U_))},[p,f,r,m]),g=(0,y.useCallback)(()=>{f(),p(),u.current=window.setTimeout(()=>{let t=e.current?.matches?.(`:hover`)===!0,n=d.current?.matches?.(`:hover`)===!0;if(t||n){s.current||(f(),l.current=window.setTimeout(m,U_));return}c.current?.()||i(!1)},W_)},[f,p,e,m]);return(0,y.useEffect)(()=>{if(!r)return;let t=e=>{d.current?.contains(e.target)||c.current?.()||i(!1)},n=()=>i(!1),a=t=>{if(t.key!==`Escape`)return;let n=!!d.current?.contains?.(document.activeElement);if(i(!1),n){let t=e.current;(t?.querySelector?.(`a,button`)??t)?.focus?.()}};return window.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,n),window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,n),window.removeEventListener(`keydown`,a)}},[r,e]),(0,y.useEffect)(()=>()=>{f(),p()},[f,p]),{open:r,pos:a,openCard:m,scheduleOpen:h,scheduleClose:g,cancelClose:p,cardRef:d}}var J_=(0,y.createContext)(null);function Y_({pr:e,refreshKey:t,pillClass:n=I_}){let r=(0,y.useSyncExternalStore)(N_,()=>O_.get(e.url)?.info),[i,a]=(0,y.useState)(F_(e.url)),o=(0,y.useRef)(null),{open:s,pos:c,scheduleOpen:l,scheduleClose:u,cancelClose:d,cardRef:f}=q_(o,256),p=(0,y.useContext)(J_);(0,y.useLayoutEffect)(()=>s&&p?p():void 0,[s,p]);let m=(0,y.useRef)(!0);(0,y.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=(0,y.useCallback)(()=>{H_([e.url])},[e.url]);(0,y.useEffect)(()=>{P_(e.url)||h()},[e.url,t,h]),(0,y.useEffect)(()=>{s&&!P_(e.url)&&h()},[s,e.url,h]),(0,y.useEffect)(()=>{!s||F_(e.url)||j_.has(e.url)||(j_.add(e.url),fetch(`/api/pr-checks?url=${encodeURIComponent(e.url)}`).then(e=>e.ok?e.json():null).then(t=>{t&&k_.set(e.url,{at:Date.now(),checks:t}),m.current&&t&&a(t)}).catch(()=>{}).finally(()=>j_.delete(e.url)))},[s,e.url]);let g=r??i;return(0,k.jsxs)(`span`,{ref:o,className:`relative inline-flex shrink-0`,onMouseEnter:l,onMouseLeave:u,children:[(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`${n} bg-elevated text-muted hover:text-accent`,"aria-label":`${e.repo}#${e.number}${z_(g)?` ${z_(g)}`:``}`,children:[(0,k.jsx)(R_,{info:g}),e.number]}),s&&c&&(0,Qd.createPortal)((0,k.jsxs)(`div`,{ref:f,"data-testid":`pr-hovercard`,className:`fixed z-[100] flex w-64 flex-col rounded-md border border-border bg-elevated p-2 text-left shadow-lg`,style:{left:c.left,top:c.top,bottom:c.bottom,maxHeight:c.maxHeight},onMouseEnter:d,onMouseLeave:u,onClick:e=>e.stopPropagation(),children:[(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-[11px]`,children:[(0,k.jsx)(R_,{info:g}),(0,k.jsx)(`span`,{className:`text-muted`,children:z_(g)||`PR`}),(0,k.jsx)(`span`,{className:`text-muted`,children:`·`}),(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`truncate text-muted hover:text-accent`,children:[e.repo,`#`,e.number]})]}),g?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`mt-1 block shrink-0 text-xs text-primary hover:text-accent`,children:g.title??`(title unavailable)`}),(0,k.jsx)(`div`,{className:`mt-0.5 shrink-0 text-[11px] text-muted`,children:g.author?`by ${g.author}`:``}),i?.checks&&i.checks.length>0&&(0,k.jsx)(`div`,{className:`mt-1.5 max-h-32 min-h-0 space-y-0.5 overflow-y-auto border-t border-border pt-1.5`,children:i.checks.map((e,t)=>{let n=V_(e),r=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`span`,{className:n.cls,children:n.glyph}),(0,k.jsx)(`span`,{className:`truncate text-muted group-hover:text-accent`,children:e.name})]});return e.link?(0,k.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noreferrer`,className:`group flex items-center gap-1.5 text-[11px]`,children:r},t):(0,k.jsx)(`div`,{className:`group flex items-center gap-1.5 text-[11px]`,children:r},t)})})]}):(0,k.jsxs)(`div`,{className:`mt-1 shrink-0 space-y-1`,children:[(0,k.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-border`}),(0,k.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-border`})]})]}),document.body)]})}function X_({prs:e,refreshKey:t,pillClass:n=I_}){let r=(0,y.useRef)(null),i=(0,y.useRef)(null),a=(0,y.useRef)(!1),o=(0,y.useRef)(0),{open:s,pos:c,openCard:l,scheduleOpen:u,scheduleClose:d,cancelClose:f,cardRef:p}=q_(r,288,()=>o.current>0);(0,y.useEffect)(()=>{s&&a.current&&(a.current=!1,p.current?.querySelector?.(`a`)?.focus())},[s,p]);let m=(0,y.useCallback)(()=>(o.current+=1,()=>{--o.current,r.current&&!r.current.matches?.(`:hover`)&&!p.current?.matches?.(`:hover`)&&!p.current?.contains?.(document.activeElement)&&d()}),[d,p]);return(0,k.jsxs)(`span`,{ref:r,className:`relative inline-flex shrink-0`,onMouseEnter:u,onMouseLeave:d,children:[(0,k.jsxs)(`button`,{ref:i,type:`button`,className:`${n} cursor-pointer text-muted hover:text-accent`,"aria-label":`${e.length} more PR${e.length===1?``:`s`}`,"aria-haspopup":`true`,"aria-expanded":s,onKeyDown:e=>{e.key!==`Enter`&&e.key!==`ArrowDown`||(e.preventDefault(),s?p.current?.querySelector?.(`a`)?.focus():(a.current=!0,l()))},onClick:e=>e.stopPropagation(),children:[`+`,e.length]}),s&&c&&(0,Qd.createPortal)((0,k.jsx)(J_.Provider,{value:m,children:(0,k.jsx)(`div`,{ref:p,"data-testid":`pr-flyout`,className:`fixed z-[100] flex max-w-72 flex-wrap items-center gap-1 overflow-y-auto rounded-md border border-border bg-surface p-1 shadow-lg`,style:{left:c.left,top:c.top,bottom:c.bottom,maxHeight:c.maxHeight},onMouseEnter:f,onMouseLeave:d,onFocus:f,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d()},onKeyDown:e=>{if(e.key!==`Tab`||!e.shiftKey)return;let t=p.current?.querySelector?.(`a`);e.target===t&&(e.preventDefault(),i.current?.focus())},onClick:e=>e.stopPropagation(),children:e.map(e=>(0,k.jsx)(Y_,{pr:e,refreshKey:t,pillClass:n},e.url))})}),document.body)]})}function Z_({prs:e,className:t=`pl-[1.375rem]`,pillClass:n=I_}){let r=(0,y.useRef)(null),i=(0,y.useRef)([]),a=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useMemo)(()=>[...e].reverse(),[e]),[c,l]=(0,y.useState)(s.length),[u,d]=(0,y.useState)(0);(0,y.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&d(e=>e+1)};return document.addEventListener?.(`visibilitychange`,e),()=>document.removeEventListener?.(`visibilitychange`,e)},[]),(0,y.useEffect)(()=>{let e=setInterval(()=>{document.visibilityState!==`hidden`&&H_(s.map(e=>e.url)).then(()=>d(e=>e+1))},D_);return()=>clearInterval(e)},[s]);let f=(0,y.useCallback)(()=>{let e=s.length,t=r.current;if(!t||typeof t.clientWidth!=`number`||t.clientWidth===0){l(e);return}let n=getComputedStyle(t),c=t.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),u=parseFloat(n.columnGap)||0,d=a.current?.offsetWidth??0,f=Math.max(0,(o.current?.offsetWidth??d)-d),p=e=>d+String(e).length*f,m=0,h=0;for(let t=0;t<e;t++){let n=i.current[t]?.offsetWidth??0,r=e-t-1,a=r>0?u+p(r):0,o=(h>0?u:0)+n+a;if(m+o>c)break;m+=o-a,h++}l(h)},[s]);if((0,y.useLayoutEffect)(()=>{f()},[f]),(0,y.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return window.addEventListener(`resize`,f),()=>window.removeEventListener(`resize`,f);let t=new ResizeObserver(f);return t.observe(e),()=>t.disconnect()},[f]),(0,y.useEffect)(()=>{document.fonts?.ready.then(f).catch(()=>{})},[f]),s.length===0)return null;let p=s.slice(0,c),m=s.slice(c);return(0,k.jsxs)(`div`,{ref:r,className:`relative flex flex-nowrap items-center gap-1 overflow-hidden ${t}`,children:[p.map(e=>(0,k.jsx)(Y_,{pr:e,refreshKey:u,pillClass:n},e.url)),m.length>0&&(0,k.jsx)(X_,{prs:m,refreshKey:u,pillClass:n}),(0,k.jsxs)(`span`,{"aria-hidden":!0,className:`invisible absolute left-0 top-0 flex flex-nowrap`,children:[s.map((e,t)=>(0,k.jsxs)(`span`,{ref:e=>{i.current[t]=e},className:n,children:[(0,k.jsx)(R_,{}),e.number]},e.url)),(0,k.jsx)(`span`,{ref:a,className:n,children:`+`}),(0,k.jsx)(`span`,{ref:o,className:n,children:`+0`})]})]})}var Q_=`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,$_=`h-3.5 w-3.5 shrink-0 accent-approval`;function ev({heading:e,emptyLabel:t,options:n,visibleOptions:r=n,selected:i,onSelect:a,labelFor:o,titleFor:s,noteFor:c}){let l=(0,y.useId)(),u=new Set(i),d=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),a(n.filter(e=>t.has(e)))};return(0,k.jsxs)(`div`,{role:`group`,"aria-labelledby":l,className:`shrink-0 pb-1`,children:[(0,k.jsx)(`div`,{id:l,className:`px-2 pb-1 pt-1.5 text-[10px] font-medium uppercase tracking-wider text-muted`,children:e}),n.length===0?(0,k.jsx)(`div`,{className:`px-2 py-1 text-muted`,children:t}):r.map(e=>{let t=c?.(e)??null;return(0,k.jsxs)(`label`,{role:`menuitemcheckbox`,"aria-checked":u.has(e),className:Q_,title:s?.(e),children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>d(e),className:$_}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:o(e)}),t&&(0,k.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] uppercase text-danger`,children:t})]},e)})]})}function tv(e,t){let n=t.trim().toLowerCase();return n===``||e.toLowerCase().includes(n)}function nv(){return typeof window<`u`&&!!window.matchMedia?.(`(pointer: coarse)`).matches}function rv({projects:e,selectedProjects:t,onSelectProjects:n,hosts:r,selectedHosts:i,onSelectHosts:a,hostStatuses:o=[],showHosts:s,hasHiddenPermissions:c,placement:l=`down`}){let[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(``),m=(0,y.useId)(),h=(0,y.useRef)(null),g=(0,y.useRef)(null),_=(0,y.useRef)(f);_.current=f;let v=e=>{d(e),p(``)},b=(0,y.useMemo)(()=>Ch(e),[e]),x=(0,y.useMemo)(()=>new Map(o.map(e=>[e.host,e])),[o]),S=e=>b.get(e)??Sh(e)??e,C=t.length+i.length,w=C>0,T=c&&t.length>0,E=`Filter`;if(w){let e=[];t.length>0&&e.push(`Projects: ${t.map(S).join(`, `)}`),i.length>0&&e.push(`Hosts: ${i.join(`, `)}`),E=`Filtered by ${e.join(`; `)}`}let D=w?`Filter, ${C} active filter${C===1?``:`s`}`:`Filter`,O=e.length+(s?r.length:0)>8,A=O?f:``,j=A.trim()!==``,M=(e,t,n)=>{if(!j)return e;let r=new Set(t);return e.filter(e=>r.has(e)||tv(n(e),A))},N=s?M(r,i,e=>e):[],P=M(e,t,S),F=s&&(!j||N.length>0),ee=!j||P.length>0;return(0,y.useEffect)(()=>{if(!u||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=()=>{d(!1),p(``)},t=t=>{let n=t.target;n&&h.current?.contains(n)||e()},n=t=>{if(t.key===`Escape`){if(_.current!==``){p(``);return}e()}};return document.addEventListener(`mousedown`,t),document.addEventListener(`touchstart`,t,{passive:!0}),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`mousedown`,t),document.removeEventListener(`touchstart`,t),document.removeEventListener(`keydown`,n)}},[u]),(0,y.useEffect)(()=>{u&&!nv()&&g.current?.focus()},[u]),(0,k.jsxs)(`div`,{ref:h,className:`flex shrink-0`,children:[(0,k.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,k.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":u,"aria-controls":u?m:void 0,"aria-label":D,title:E,onClick:()=>v(!u),className:`${Ot(w?`active`:`neutral`)} ${Nt}`,children:[(0,k.jsx)(_e,{width:G.default,height:G.default}),w&&(0,k.jsx)(`span`,{"data-testid":`filter-count-badge`,"aria-hidden":`true`,className:`pointer-events-none absolute -right-1.5 -top-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-accent px-1 text-[9px] font-semibold leading-none text-white`,children:C})]}),T&&(0,k.jsx)(`button`,{type:`button`,"data-testid":`hidden-attention-dot`,className:`absolute -bottom-1 -right-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:e=>{e.stopPropagation(),n([])},children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Clear project filters`})})]}),u&&(0,k.jsxs)(`div`,{id:m,role:`menu`,"aria-label":`Filter sessions`,className:`absolute left-2 right-2 z-20 ${l===`up`?`bottom-full mb-1`:`top-full mt-1`} flex max-h-[min(26rem,calc(100dvh-7rem))] flex-col overflow-hidden rounded border border-border bg-surface p-1.5 text-xs shadow-lg`,children:[(0,k.jsxs)(`div`,{"data-testid":`filter-header`,className:`flex h-[26px] shrink-0 items-center justify-between gap-2 [@media(pointer:coarse)]:h-[44px]`,children:[(0,k.jsx)(`span`,{className:`truncate pl-2 text-[11px] font-medium text-secondary`,children:`Filter`}),w&&(0,k.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n([]),a([])},className:`h-full shrink-0 rounded px-2 text-accent hover:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [@media(pointer:coarse)]:min-w-[44px]`,children:`Clear`})]}),O&&(0,k.jsx)(`div`,{className:`shrink-0 px-1 pb-1 pt-0.5`,children:(0,k.jsx)(`input`,{ref:g,type:`search`,"aria-label":`Search filters`,placeholder:`Search`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,enterKeyHint:`search`,value:f,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-base px-2 py-1 text-xs text-primary placeholder:text-muted focus:border-accent focus:outline-none [@media(pointer:coarse)]:text-[16px]`})}),(0,k.jsxs)(`div`,{"data-testid":`filter-options`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[F&&(0,k.jsx)(ev,{heading:`Hosts`,emptyLabel:`No hosts`,options:r,visibleOptions:N,selected:i,onSelect:a,labelFor:e=>e,titleFor:e=>{let t=x.get(e);return t?.error?`${e}: ${t.error}`:e},noteFor:e=>{let t=x.get(e);return t&&!t.ok?`offline`:null}}),ee&&(0,k.jsx)(ev,{heading:`Projects`,emptyLabel:`No projects`,options:e,visibleOptions:P,selected:t,onSelect:n,labelFor:S,titleFor:e=>e}),!F&&!ee&&(0,k.jsx)(`div`,{"data-testid":`filter-no-matches`,className:`px-2 py-1.5 text-muted`,children:`No matches`})]})]})]})}function iv(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function av(e){return typeof e==`string`?e:null}var ov=new Set([`tool_result`,`custom_tool_call_output`]),sv=new Set([`text`,`input_text`,`output_text`]);function cv(e){return e===`user`?`user`:e===`assistant`?`assistant`:e===`system`||e===`developer`?`system`:e===`tool`?`tool`:`other`}function lv(e){let t=av(e.type)??``,n=iv(e.payload),r=av(n?.type)??``,i=av(e.source)??av(n?.source)??``,a=av(e.agent)??``;return i.toLowerCase()===`pi`||a.toLowerCase()===`pi`?`pi`:i.toLowerCase()===`devin`||a.toLowerCase()===`devin`?`devin`:i.toLowerCase()===`grok`||a.toLowerCase()===`grok`||e.synthetic_reason!==void 0||e.prompt_index!==void 0||e.model_fingerprint!==void 0||e.encrypted_content!==void 0?`grok`:t===`response_item`||t===`event_msg`?`codex`:t===`tool_use`||t===`result`||t===`user`||t===`assistant`||t===`system`?`claude`:r===`user_message`||r===`assistant_message`?`codex`:`unknown`}function uv(e){let t=av(iv(e.payload)?.type);return{family:lv(e),rawType:av(e.type)??`unknown`,...t?{payloadType:t}:{}}}function dv(e){if(!e)return[];if(typeof e==`string`)return e.trim()?[e]:[];if(Array.isArray(e)){let t=[];for(let n of e){if(typeof n==`string`){n.trim()&&t.push(n);continue}let e=iv(n);if(!e)continue;let r=av(e.type);if(r&&ov.has(r)||r&&!sv.has(r))continue;let i=av(e.text);i&&i.trim()&&t.push(i)}return t}let t=iv(e);if(t){let e=av(t.type);if(e&&ov.has(e))return[];let n=av(t.text);return n&&n.trim()?[n]:[...dv(t.content),...dv(t.message)]}return[]}function fv(e,t){if(e.type!==`response_item`)return[];let n=iv(e.payload);if(!n||n.type!==`message`)return[];let r=cv(n.role);return dv(n.content).map(e=>({kind:`message`,role:r,text:e,source:t}))}function pv(e,t){if(e.type!==`event_msg`)return[];let n=iv(e.payload);if(!n)return[];let r=av(n.type),i=null;if(r===`user_message`?i=`user`:r===`assistant_message`||r===`agent_message`?i=`assistant`:r===`system_message`?i=`system`:r===`message`&&(i=cv(n.role)),!i||![`user`,`assistant`,`system`].includes(i))return[];let a=Array.from(new Set([...dv(n.message),...dv(n.content),...dv(n.text)]));return a.length===0?[]:a.map(e=>({kind:`message`,role:i,text:e,source:t}))}function mv(e,t){let n=cv(e.type),r=iv(e.message);if(r){let n=cv(r.role??e.type);return[...dv(r.content),...dv(r.text),...dv(r.message)].map(e=>({kind:`message`,role:n,text:e,source:t}))}return[`user`,`assistant`,`system`].includes(n)?[...dv(e.content),...dv(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function hv(e,t){let n=cv(e.role);return[`user`,`assistant`,`system`].includes(n)?[...dv(e.content),...dv(e.message),...dv(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function gv(e,t){let n=av(e.type),r=av(e.event);return n!==`tool_use`&&r!==`tool_use`?[]:[{kind:`tool_call`,role:`assistant`,text:`[Tool: ${av(e.name)??`tool`}]`,source:t}]}function _v(e,t){if(e.type!==`result`)return[];let n=av(e.result);return!n||!n.trim()?[]:[{kind:`result`,role:`system`,text:n,source:t}]}function vv(e,t){let n=iv(e.payload),r=[...dv(e.message),...dv(e.content),...dv(e.text),...dv(n?.message),...dv(n?.content)];return r.length===0?[]:r.map(e=>({kind:`unknown`,role:`other`,text:e,source:t}))}function yv(e,t){let n=av(e.type),r=av(iv(e.payload)?.type);return n&&ov.has(n)||r&&ov.has(r)?[{kind:`tool_result`,role:`tool`,text:``,source:t}]:[]}function bv(e,t){let n=e.tool_calls;return t.family!==`grok`||!Array.isArray(n)?[]:n.map(e=>iv(e)).filter(e=>e!==null).map(e=>({kind:`tool_call`,role:`assistant`,text:`[Tool: ${av(e.name)??`tool`}]`,source:t}))}function xv(e){let t=iv(e);if(!t||t.isMeta===!0||t.synthetic_reason!==void 0)return[];let n=uv(t),r=[...fv(t,n),...pv(t,n),...mv(t,n),...gv(t,n),..._v(t,n),...yv(t,n),...bv(t,n)];if(r.length>0)return r;let i=hv(t,n);return i.length>0?i:vv(t,n)}function Sv(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);return{parsed:!0,events:xv(e),raw:e}}catch{return{parsed:!1,events:[{kind:`unknown`,role:`other`,text:t,source:{family:`unknown`,rawType:`raw_text`}}],raw:e}}}function Cv(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var wv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ev={};function Dv(e,t){return((t||Ev).jsx?Tv:wv).test(e)}var Ov=/[ \t\n\f\r]/g;function kv(e){return typeof e==`object`?e.type===`text`?Av(e.value):!1:Av(e)}function Av(e){return e.replace(Ov,``)===``}var jv=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};jv.prototype.normal={},jv.prototype.property={},jv.prototype.space=void 0;function Mv(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new jv(n,r,t)}function Nv(e){return e.toLowerCase()}var Pv=class{constructor(e,t){this.attribute=t,this.property=e}};Pv.prototype.attribute=``,Pv.prototype.booleanish=!1,Pv.prototype.boolean=!1,Pv.prototype.commaOrSpaceSeparated=!1,Pv.prototype.commaSeparated=!1,Pv.prototype.defined=!1,Pv.prototype.mustUseProperty=!1,Pv.prototype.number=!1,Pv.prototype.overloadedBoolean=!1,Pv.prototype.property=``,Pv.prototype.spaceSeparated=!1,Pv.prototype.space=void 0;var Fv=c({boolean:()=>Lv,booleanish:()=>Rv,commaOrSpaceSeparated:()=>Hv,commaSeparated:()=>Vv,number:()=>X,overloadedBoolean:()=>zv,spaceSeparated:()=>Bv}),Iv=0,Lv=Uv(),Rv=Uv(),zv=Uv(),X=Uv(),Bv=Uv(),Vv=Uv(),Hv=Uv();function Uv(){return 2**++Iv}var Wv=Object.keys(Fv),Gv=class extends Pv{constructor(e,t,n,r){let i=-1;if(super(e,t),Kv(this,`space`,r),typeof n==`number`)for(;++i<Wv.length;){let e=Wv[i];Kv(this,Wv[i],(n&Fv[e])===Fv[e])}}};Gv.prototype.defined=!0;function Kv(e,t,n){n&&(e[t]=n)}function qv(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Gv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Nv(r)]=r,n[Nv(a.attribute)]=r}return new jv(t,n,e.space)}var Jv=qv({properties:{ariaActiveDescendant:null,ariaAtomic:Rv,ariaAutoComplete:null,ariaBusy:Rv,ariaChecked:Rv,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:Bv,ariaCurrent:null,ariaDescribedBy:Bv,ariaDetails:null,ariaDisabled:Rv,ariaDropEffect:Bv,ariaErrorMessage:null,ariaExpanded:Rv,ariaFlowTo:Bv,ariaGrabbed:Rv,ariaHasPopup:null,ariaHidden:Rv,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bv,ariaLevel:X,ariaLive:null,ariaModal:Rv,ariaMultiLine:Rv,ariaMultiSelectable:Rv,ariaOrientation:null,ariaOwns:Bv,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:Rv,ariaReadOnly:Rv,ariaRelevant:null,ariaRequired:Rv,ariaRoleDescription:Bv,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:Rv,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Yv(e,t){return t in e?e[t]:t}function Xv(e,t){return Yv(e,t.toLowerCase())}var Zv=qv({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Vv,acceptCharset:Bv,accessKey:Bv,action:null,allow:null,allowFullScreen:Lv,allowPaymentRequest:Lv,allowUserMedia:Lv,alpha:Lv,alt:null,as:null,async:Lv,autoCapitalize:null,autoComplete:Bv,autoFocus:Lv,autoPlay:Lv,blocking:Bv,capture:null,charSet:null,checked:Lv,cite:null,className:Bv,closedBy:null,colorSpace:null,cols:X,colSpan:X,command:null,commandFor:null,content:null,contentEditable:Rv,controls:Lv,controlsList:Bv,coords:X|Vv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Lv,defer:Lv,dir:null,dirName:null,disabled:Lv,download:zv,draggable:Rv,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Lv,formTarget:null,headers:Bv,height:X,hidden:zv,high:X,href:null,hrefLang:null,htmlFor:Bv,httpEquiv:Bv,id:null,imageSizes:null,imageSrcSet:null,inert:Lv,inputMode:null,integrity:null,is:null,isMap:Lv,itemId:null,itemProp:Bv,itemRef:Bv,itemScope:Lv,itemType:Bv,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Lv,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Lv,muted:Lv,name:null,nonce:null,noModule:Lv,noValidate:Lv,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Lv,optimum:X,pattern:null,ping:Bv,placeholder:null,playsInline:Lv,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Lv,referrerPolicy:null,rel:Bv,required:Lv,reversed:Lv,rows:X,rowSpan:X,sandbox:Bv,scope:null,scoped:Lv,seamless:Lv,selected:Lv,shadowRootClonable:Lv,shadowRootCustomElementRegistry:Lv,shadowRootDelegatesFocus:Lv,shadowRootMode:null,shadowRootSerializable:Lv,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:Rv,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Lv,useMap:null,value:Rv,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Bv,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Lv,declare:Lv,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Lv,noHref:Lv,noShade:Lv,noWrap:Lv,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:Rv,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Lv,disablePictureInPicture:Lv,disableRemotePlayback:Lv,exportParts:Vv,part:Bv,prefix:null,property:null,results:X,security:null,unselectable:null},space:`html`,transform:Xv}),Qv=qv({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Hv,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:Bv,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Lv,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vv,g2:Vv,glyphName:Vv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Hv,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Bv,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hv,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hv,rev:Hv,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hv,requiredFeatures:Hv,requiredFonts:Hv,requiredFormats:Hv,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Hv,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hv,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hv,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Yv}),$v=qv({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ey=qv({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Xv}),ty=qv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ny={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},ry=/[A-Z]/g,iy=/-[a-z]/g,ay=/^data[-\w.:]+$/i;function oy(e,t){let n=Nv(t),r=t,i=Pv;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ay.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(iy,cy);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!iy.test(e)){let n=e.replace(ry,sy);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Gv}return new i(r,t)}function sy(e){return`-`+e.toLowerCase()}function cy(e){return e.charAt(1).toUpperCase()}var ly=Mv([Jv,Zv,$v,ey,ty],`html`),uy=Mv([Jv,Qv,$v,ey,ty],`svg`);function dy(e){return e.join(` `).trim()}var fy=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
20
+ `},If={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Lf(e){let{announcements:t=If,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ff}=e,{announce:a,announcement:o}=jf(),s=_f(`DndLiveRegion`),[c,l]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{l(!0)},[]),Nf((0,y.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=y.createElement(y.Fragment,null,y.createElement(kf,{id:r,value:i.draggable}),y.createElement(Af,{id:s,announcement:o}));return n?(0,Qd.createPortal)(u,n):u}var Rf;(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`})(Rf||={});function zf(){}function Bf(e,t){return(0,y.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Vf(){var e=[...arguments];return(0,y.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Hf=Object.freeze({x:0,y:0});function Uf(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Wf(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Gf(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Kf(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function qf(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Jf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=qf(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Uf(qf(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Wf)};function Yf(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Xf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Yf(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Gf)};function Zf(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qf(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Hf}function $f(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ep=$f(1);function tp(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function np(e,t,n){let r=tp(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var rp={ignoreTransform:!1};function ip(e,t){t===void 0&&(t=rp);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=rf(e).getComputedStyle(e);t&&(n=np(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ap(e){return ip(e,{ignoreTransform:!0})}function op(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function sp(e,t){return t===void 0&&(t=rf(e).getComputedStyle(e)),t.position===`fixed`}function cp(e,t){t===void 0&&(t=rf(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function lp(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(af(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!of(i)||sf(i)||n.includes(i))return n;let a=rf(e).getComputedStyle(i);return i!==e&&cp(i,a)&&n.push(i),sp(i,a)?n:r(i.parentNode)}return e?r(e):n}function up(e){let[t]=lp(e,1);return t??null}function dp(e){return!ef||!e?null:tf(e)?e:nf(e)?af(e)||e===cf(e).scrollingElement?window:of(e)?e:null:null}function fp(e){return tf(e)?e.scrollX:e.scrollLeft}function pp(e){return tf(e)?e.scrollY:e.scrollTop}function mp(e){return{x:fp(e),y:pp(e)}}var hp;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(hp||={});function gp(e){return!ef||!e?!1:e===document.scrollingElement}function _p(e){let t={x:0,y:0},n=gp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var vp={x:.2,y:.2};function yp(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=vp);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=_p(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=hp.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=hp.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=hp.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=hp.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function bp(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function xp(e){return e.reduce((e,t)=>yf(e,mp(t)),Hf)}function Sp(e){return e.reduce((e,t)=>e+fp(t),0)}function Cp(e){return e.reduce((e,t)=>e+pp(t),0)}function wp(e,t){if(t===void 0&&(t=ip),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);up(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Tp=[[`x`,[`left`,`right`],Sp],[`y`,[`top`,`bottom`],Cp]],Ep=class{constructor(e,t){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;let n=lp(t),r=xp(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Tp)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Dp=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Op(e){let{EventTarget:t}=rf(e);return e instanceof t?e:cf(e)}function kp(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Ap;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Ap||={});function jp(e){e.preventDefault()}function Mp(e){e.stopPropagation()}var Np;(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`})(Np||={});var Pp={start:[Np.Space,Np.Enter],cancel:[Np.Esc],end:[Np.Space,Np.Enter,Np.Tab]},Fp=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Np.Right:return{...n,x:n.x+25};case Np.Left:return{...n,x:n.x-25};case Np.Down:return{...n,y:n.y+25};case Np.Up:return{...n,y:n.y-25}}},Ip=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Dp(cf(t)),this.windowListeners=new Dp(rf(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ap.Resize,this.handleCancel),this.windowListeners.add(Ap.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ap.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&wp(n),t(Hf)}handleKeyDown(e){if(Sf(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Pp,coordinateGetter:a=Fp,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Hf;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=bf(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=_p(n),p=bp(n),m={x:Math.min(i===Np.Right?p.right-p.width/2:p.right,Math.max(i===Np.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Np.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Np.Down?p.top:p.top+p.height/2,u.y))},h=i===Np.Right&&!s||i===Np.Left&&!c,g=i===Np.Down&&!l||i===Np.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Np.Right&&e<=d.x||i===Np.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Np.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Np.Down&&e<=d.y||i===Np.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Np.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,yf(bf(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ip.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Pp,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Lp(e){return!!(e&&`distance`in e)}function Rp(e){return!!(e&&`delay`in e)}var zp=class{constructor(e,t,n){n===void 0&&(n=Op(e.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=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=cf(i),this.documentListeners=new Dp(this.document),this.listeners=new Dp(n),this.windowListeners=new Dp(rf(i)),this.initialCoordinates=wf(r)??Hf,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(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ap.Resize,this.handleCancel),this.windowListeners.add(Ap.DragStart,jp),this.windowListeners.add(Ap.VisibilityChange,this.handleCancel),this.windowListeners.add(Ap.ContextMenu,jp),this.documentListeners.add(Ap.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rp(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Lp(t)){this.handlePending(t);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(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ap.Click,Mp,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ap.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=wf(e)??Hf,s=bf(n,o);if(!t&&a){if(Lp(a)){if(a.tolerance!=null&&kp(s,a.tolerance))return this.handleCancel();if(kp(s,a.distance))return this.handleStart()}if(Rp(a)&&kp(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Np.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Bp={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Vp=class extends zp{constructor(e){let{event:t}=e,n=cf(t.target);super(e,Bp,n)}};Vp.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Hp={move:{name:`mousemove`},end:{name:`mouseup`}},Up;(function(e){e[e.RightClick=2]=`RightClick`})(Up||={});var Wp=class extends zp{constructor(e){super(e,Hp,cf(e.event.target))}};Wp.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Up.RightClick?!1:(r?.({event:n}),!0)}}];var Gp={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Kp=class extends zp{constructor(e){super(e,Gp)}static setup(){return window.addEventListener(Gp.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Gp.move.name,e)};function e(){}}};Kp.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var qp;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(qp||={});var Jp;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Jp||={});function Yp(e){let{acceleration:t,activator:n=qp.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Jp.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Zp({delta:d,disabled:!a}),[m,h]=df(),g=(0,y.useRef)({x:0,y:0}),_=(0,y.useRef)({x:0,y:0}),v=(0,y.useMemo)(()=>{switch(n){case qp.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qp.DraggableRect:return i}},[n,i,c]),b=(0,y.useRef)(null),x=(0,y.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,y.useMemo)(()=>s===Jp.TreeOrder?[...l].reverse():l,[s,l]);(0,y.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=yp(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var Xp={x:{[hp.Backward]:!1,[hp.Forward]:!1},y:{[hp.Backward]:!1,[hp.Forward]:!1}};function Zp(e){let{delta:t,disabled:n}=e,r=hf(t);return pf(e=>{if(n||!r||!e)return Xp;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hp.Backward]:e.x[hp.Backward]||i.x===-1,[hp.Forward]:e.x[hp.Forward]||i.x===1},y:{[hp.Backward]:e.y[hp.Backward]||i.y===-1,[hp.Forward]:e.y[hp.Forward]||i.y===1}}},[n,t,r])}function Qp(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return pf(e=>t==null?null:r??e??null,[r,t])}function $p(e,t){return(0,y.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var em;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(em||={});var tm;(function(e){e.Optimized=`optimized`})(tm||={});var nm=new Map;function rm(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,y.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,y.useRef)(e),d=g(),f=ff(d),p=(0,y.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,y.useRef)(null),h=pf(t=>{if(d&&!n)return nm;if(!t||t===nm||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Ep(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,y.useEffect)(()=>{u.current=e},[e]),(0,y.useEffect)(()=>{d||p()},[n,d]),(0,y.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,y.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case em.Always:return!1;case em.BeforeDragging:return n;default:return!n}}}function im(e,t){return pf(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function am(e,t){return im(e,t)}function om(e){let{callback:t,disabled:n}=e,r=uf(t),i=(0,y.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function sm(e){let{callback:t,disabled:n}=e,r=uf(t),i=(0,y.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function cm(e){return new Ep(ip(e),e)}function lm(e,t,n){t===void 0&&(t=cm);let[r,i]=(0,y.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=om({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=sm({callback:a});return lf(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function um(e){return Qf(e,im(e))}var dm=[];function fm(e){let t=(0,y.useRef)(e),n=pf(n=>e?n&&n!==dm&&e&&t.current&&e.parentNode===t.current.parentNode?n:lp(e):dm,[e]);return(0,y.useEffect)(()=>{t.current=e},[e]),n}function pm(e){let[t,n]=(0,y.useState)(null),r=(0,y.useRef)(e),i=(0,y.useCallback)(e=>{let t=dp(e.target);t&&n(e=>e?(e.set(t,mp(t)),new Map(e)):null)},[]);return(0,y.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=dp(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,mp(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{dp(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,y.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>yf(e,t),Hf):xp(e):Hf,[e,t])}function mm(e,t){t===void 0&&(t=[]);let n=(0,y.useRef)(null);return(0,y.useEffect)(()=>{n.current=null},t),(0,y.useEffect)(()=>{let t=e!==Hf;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?bf(e,n.current):Hf}function hm(e){(0,y.useEffect)(()=>{if(!ef)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function gm(e,t){return(0,y.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function _m(e){return(0,y.useMemo)(()=>e?op(e):null,[e])}var vm=[];function ym(e,t){t===void 0&&(t=ip);let[n]=e,r=_m(n?rf(n):null),[i,a]=(0,y.useState)(vm);function o(){a(()=>e.length?e.map(e=>gp(e)?r:new Ep(t(e),e)):vm)}let s=sm({callback:o});return lf(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function bm(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return of(t)?t:e}function xm(e){let{measure:t}=e,[n,r]=(0,y.useState)(null),i=sm({callback:(0,y.useCallback)(e=>{for(let{target:n}of e)if(of(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=mf((0,y.useCallback)(e=>{let n=bm(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,y.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Sm=[{sensor:Vp,options:{}},{sensor:Ip,options:{}}],Cm={current:{}},wm={draggable:{measure:ap},droppable:{measure:ap,strategy:em.WhileDragging,frequency:tm.Optimized},dragOverlay:{measure:ip}},Tm=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Em={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Tm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wm,measureDroppableContainers:zf,windowRect:null,measuringScheduled:!1},Dm={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:zf,draggableNodes:new Map,over:null,measureDroppableContainers:zf},Om=(0,y.createContext)(Dm),km=(0,y.createContext)(Em);function Am(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Tm}}}function jm(e,t){switch(t.type){case Rf.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Rf.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 Rf.DragEnd:case Rf.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Rf.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Tm(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Rf.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Tm(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Rf.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Tm(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Mm(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,y.useContext)(Om),a=hf(r),o=hf(n?.id);return(0,y.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Sf(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Df(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Nm(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Pm(e){return(0,y.useMemo)(()=>({draggable:{...wm.draggable,...e?.draggable},droppable:{...wm.droppable,...e?.droppable},dragOverlay:{...wm.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fm(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,y.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;lf(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Qf(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=up(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Im=(0,y.createContext)({...Hf,scaleX:1,scaleY:1}),Lm;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Lm||={});var Rm=(0,y.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Sm,collisionDetection:o=Xf,measuring:s,modifiers:c,...l}=e,[u,d]=(0,y.useReducer)(jm,void 0,Am),[f,p]=Pf(),[m,h]=(0,y.useState)(Lm.Uninitialized),g=m===Lm.Initialized,{draggable:{active:_,nodes:v,translate:b},droppable:{containers:x}}=u,S=_==null?null:v.get(_),C=(0,y.useRef)({initial:null,translated:null}),w=(0,y.useMemo)(()=>_==null?null:{id:_,data:S?.data??Cm,rect:C},[_,S]),T=(0,y.useRef)(null),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(null),A=ff(l,Object.values(l)),j=_f(`DndDescribedBy`,t),M=(0,y.useMemo)(()=>x.getEnabled(),[x]),N=Pm(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:ee}=rm(M,{dragging:g,dependencies:[b.x,b.y],config:N.droppable}),I=Qp(v,_),L=(0,y.useMemo)(()=>O?wf(O):null,[O]),R=Ee(),z=am(I,N.draggable.measure);Fm({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let B=lm(I,N.draggable.measure,z),te=lm(I?I.parentElement:null),V=(0,y.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=x.getNodeFor(V.current.over?.id),H=xm({measure:N.dragOverlay.measure}),re=H.nodeRef.current??I,ie=g?H.rect??B:null,ae=!!(H.nodeRef.current&&H.rect),U=um(ae?null:B),oe=_m(re?rf(re):null),se=fm(g?ne??I:null),ce=ym(se),le=Nm(c,{transform:{x:b.x-U.x,y:b.y-U.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:B,containerNodeRect:te,draggingNodeRect:ie,over:V.current.over,overlayNodeRect:H.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:oe}),ue=L?yf(L,b):null,de=pm(se),fe=mm(de),pe=mm(de,[B]),me=yf(le,fe),he=ie?ep(ie,le):null,ge=w&&he?o({active:w,collisionRect:he,droppableRects:P,droppableContainers:M,pointerCoordinates:ue}):null,_e=Kf(ge,`id`),[ve,ye]=(0,y.useState)(null),be=Zf(ae?le:yf(le,pe),ve?.rect??null,B),xe=(0,y.useRef)(null),Se=(0,y.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,Qd.unstable_batchedUpdates)(()=>{r?.(i),h(Lm.Initializing),d({type:Rf.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(xe.current),k(a)})},onMove(e){d({type:Rf.DragMove,coordinates:e})},onEnd:o(Rf.DragEnd),onCancel:o(Rf.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Rf.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Rf.DragCancel)}T.current=null,(0,Qd.unstable_batchedUpdates)(()=>{d({type:e}),h(Lm.Uninitialized),ye(null),D(null),k(null),xe.current=null;let t=e===Rf.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=$p(a,(0,y.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Se(n,t))},[v,Se]));hm(a),lf(()=>{B&&m===Lm.Initializing&&h(Lm.Initialized)},[B,m]),(0,y.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,Qd.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,y.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Qd.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),lf(()=>{V.current={activatorEvent:O,active:w,activeNode:I,collisionRect:he,collisions:ge,droppableRects:P,draggableNodes:v,draggingNode:re,draggingNodeRect:ie,droppableContainers:x,over:ve,scrollableAncestors:se,scrollAdjustedTranslate:me},C.current={initial:ie,translated:he}},[w,I,ge,he,v,re,ie,P,x,ve,se,me]),Yp({...R,delta:b,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let we=(0,y.useMemo)(()=>({active:w,activeNode:I,activeNodeRect:B,activatorEvent:O,collisions:ge,containerNodeRect:te,dragOverlay:H,draggableNodes:v,droppableContainers:x,droppableRects:P,over:ve,measureDroppableContainers:F,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:N,measuringScheduled:ee,windowRect:oe}),[w,I,B,O,ge,te,H,v,x,P,ve,F,se,ce,N,ee,oe]),Te=(0,y.useMemo)(()=>({activatorEvent:O,activators:Ce,active:w,activeNodeRect:B,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:ve,measureDroppableContainers:F}),[O,Ce,w,B,d,j,v,ve,F]);return y.createElement(Mf.Provider,{value:p},y.createElement(Om.Provider,{value:Te},y.createElement(km.Provider,{value:we},y.createElement(Im.Provider,{value:be},i)),y.createElement(Mm,{disabled:n?.restoreFocus===!1})),y.createElement(Lf,{...n,hiddenTextDescribedById:j}));function Ee(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),zm=(0,y.createContext)(null),Bm=`button`,Vm=`Draggable`;function Hm(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=_f(Vm),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,y.useContext)(Om),{role:p=Bm,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,y.useContext)(g?Im:zm),[v,b]=mf(),[x,S]=mf(),C=gm(o,t),w=ff(n);return lf(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,y.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Bm?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:v,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function Um(){return(0,y.useContext)(km)}var Wm=`Droppable`,Gm={timeout:25};function Km(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=_f(Wm),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,y.useContext)(Om),u=(0,y.useRef)({disabled:n}),d=(0,y.useRef)(!1),f=(0,y.useRef)(null),p=(0,y.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Gm,...i},_=ff(h??r),v=sm({callback:(0,y.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=mf((0,y.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),S=ff(t);return(0,y.useEffect)(()=>{!v||!b.current||(v.disconnect(),d.current=!1,v.observe(b.current))},[b,v]),(0,y.useEffect)(()=>(s({type:Rf.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:Rf.UnregisterDroppable,key:a,id:r})),[r]),(0,y.useEffect)(()=>{n!==u.current.disabled&&(s({type:Rf.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function qm(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Jm(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Ym(e){return e!==null&&e>=0}function Xm(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Zm(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Qm=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=qm(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},$m={scaleX:1,scaleY:1},eh=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...$m}:null}let s=th(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...$m}:r<t&&r>=a?{x:0,y:o.height+s,...$m}:{x:0,y:0,...$m}};function th(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var nh=`Sortable`,rh=y.createContext({activeIndex:-1,containerId:nh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qm,disabled:{draggable:!1,droppable:!1}});function ih(e){let{children:t,id:n,items:r,strategy:i=Qm,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Um(),d=_f(nh,n),f=s.rect!==null,p=(0,y.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,y.useRef)(p),v=!Xm(p,_.current),b=g!==-1&&h===-1||v,x=Zm(a);lf(()=>{v&&m&&u(p)},[v,p,m,u]),(0,y.useEffect)(()=>{_.current=p},[p]);let S=(0,y.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:Jm(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return y.createElement(rh.Provider,{value:S},t)}var ah=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return qm(n,r,i).indexOf(t)},oh=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},sh={duration:200,easing:`ease`},ch=`transform`,lh=Tf.Transition.toString({property:ch,duration:0,easing:`linear`}),uh={roleDescription:`sortable`};function dh(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,y.useState)(null),s=(0,y.useRef)(n);return lf(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=ip(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,y.useEffect)(()=>{a&&o(null)},[a]),a}function fh(e){let{animateLayoutChanges:t=oh,attributes:n,disabled:r,data:i,getNewIndex:a=ah,id:o,strategy:s,resizeObserverConfig:c,transition:l=sh}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,y.useContext)(rh),b=ph(r,p),x=u.indexOf(o),S=(0,y.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,y.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=Km({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:ee,transform:I}=Hm({id:o,data:S,attributes:{...uh,...n},disabled:b.draggable}),L=$d(D,M),R=!!O,z=R&&!m&&Ym(f)&&Ym(g),B=!_&&P,te=z?(B&&z?I:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,V=Ym(f)&&Ym(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,ne=O?.id,H=(0,y.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),re=u!==H.current.items,ie=t({active:O,containerId:d,isDragging:P,isSorting:R,id:o,index:x,items:u,newIndex:H.current.newIndex,previousItems:H.current.items,previousContainerId:H.current.containerId,transition:l,wasDragging:H.current.activeId!=null}),ae=dh({disabled:!ie,index:x,node:T,rect:w});return(0,y.useEffect)(()=>{R&&H.current.newIndex!==V&&(H.current.newIndex=V),d!==H.current.containerId&&(H.current.containerId=d),u!==H.current.items&&(H.current.items=u)},[R,V,d,u]),(0,y.useEffect)(()=>{if(ne===H.current.activeId)return;if(ne!=null&&H.current.activeId==null){H.current.activeId=ne;return}let e=setTimeout(()=>{H.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:V,items:u,isOver:E,isSorting:R,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:L,setActivatorNodeRef:ee,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:ae??te,transition:U()};function U(){if(ae||re&&H.current.newIndex===x)return lh;if(!(B&&!Sf(k)||!l)&&(R||ie))return Tf.Transition.toString({...l,property:ch})}}function ph(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Np.Down,Np.Right,Np.Up,Np.Left;var mh={permission:0,waiting:1,working:1,unknown:1};function hh(e){let t=e.agentSessionId?.trim();return t&&t.length>0?t:e.id}var gh={mode:`created`,direction:`desc`};function _h(e,t=gh){let{mode:n,direction:r,manualOrder:i}=t;if(n===`manual`&&i&&i.length>0){let t=new Map(i.map((e,t)=>[e,t]));return e.toSorted((e,n)=>{let r=hh(e),i=hh(n),a=t.get(r)??t.get(e.id)??1/0,o=t.get(i)??t.get(n.id)??1/0;return a===1/0&&o===1/0?Date.parse(n.createdAt)-Date.parse(e.createdAt):a-o})}return e.toSorted((e,t)=>{if(n===`status`){let n=mh[e.status]??mh.unknown,r=mh[t.status]??mh.unknown;return n===r?Date.parse(t.lastActivity)-Date.parse(e.lastActivity):n-r}let i=Date.parse(e.createdAt),a=Date.parse(t.createdAt);return r===`desc`?a-i:i-a})}function vh(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e])),r=[];for(let e of t){let t=n.get(e);t&&(r.push(t),n.delete(e))}for(let t of e)n.has(t.id)&&r.push(t);return r}function yh(e,t){let n=new Map;for(let t of e){let e=t.projectPath?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.projectPath?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function bh(e,t){let n=new Map;for(let t of e){let e=t.host?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.host?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function xh(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Sh(e){let t=e.trim();if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return null;let r=n.split(/[\\/]/);return r[r.length-1]||null}function Ch(e){let t=e.map(e=>{let t=e.trim(),n=t.replace(/[\\/]+$/,``);return{path:e,parts:n.split(/[\\/]/).filter(Boolean),fallback:n||t||e}}),n=new Map;for(let e of t)n.set(e.path,1);let r=!0;for(;r;){r=!1;let e=new Map;for(let r of t){if(r.parts.length===0)continue;let t=n.get(r.path)??1,i=r.parts.slice(-t).join(`/`);e.set(i,(e.get(i)??0)+1)}for(let i of t){if(i.parts.length===0)continue;let t=n.get(i.path)??1,a=i.parts.slice(-t).join(`/`);(e.get(a)??0)>1&&t<i.parts.length&&(n.set(i.path,t+1),r=!0)}}let i=new Map,a=new Map;for(let e of t){let t=e.fallback;if(e.parts.length>0){let r=n.get(e.path)??1;t=e.parts.slice(-r).join(`/`)}i.set(e.path,t),a.set(t,(a.get(t)??0)+1)}let o=new Map;for(let e of t){let t=i.get(e.path)??e.fallback;(a.get(t)??0)>1&&(t=e.fallback),o.set(e.path,t)}return o}function wh(e){let t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}function Th({useSafariLayoutFallback:e,isDragging:t,dndTransform:n,generatedTransform:r}){return e&&!t&&!n||!n?r:!r||r===`none`?n:`${n} ${r}`}var Eh=`agentboard-session`,Dh=T(Eh);function Oh(e,t){return e.id===t.id&&e.name===t.name&&e.tmuxWindow===t.tmuxWindow&&e.projectPath===t.projectPath&&e.status===t.status&&e.lastActivity===t.lastActivity&&e.createdAt===t.createdAt&&e.source===t.source&&e.host===t.host&&e.remote===t.remote&&e.command===t.command&&e.agentType===t.agentType&&e.agentSessionId===t.agentSessionId&&e.boardSessionId===t.boardSessionId&&e.agentSessionName===t.agentSessionName&&e.logFilePath===t.logFilePath&&e.isHibernating===t.isHibernating&&e.lastUserMessage===t.lastUserMessage}function kh(e,t){if(e.length!==t.length)return!1;let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);if(!t||!Oh(t,e))return!1}return!0}function Ah(e){return typeof e==`string`&&e.length>0?e:null}function jh(e){return Array.isArray(e)?e:[]}var Mh=nt()(at((e,t)=>({sessions:[],agentSessions:{active:[],hibernating:[],history:[]},agentSessionsEpoch:-1,hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,selectedHibernatingSessionId:null,hasLoaded:!1,connectionStatus:`connecting`,connectionError:null,connectionEpoch:0,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,preferWindowName:!1,setSessions:n=>{let r=t(),i=r.selectedSessionId,a=r.selectedHibernatingSessionId,o=r.sessions,s=r.exitingSessions;if(r.hasLoaded&&kh(o,n))return;let c=new Set(n.map(e=>e.id)),l=o.filter(e=>!c.has(e.id)&&!s.has(e.id)),u=i;if(i!==null&&!n.some(e=>e.id===i))if(a===null){let{sessionSortMode:e,sessionSortDirection:t}=W.getState();u=_h(n,{mode:e,direction:t})[0]?.id??null}else u=null;if(l.length>0){let t=new Map(s);for(let e of l)t.set(e.id,e);e({sessions:n,hasLoaded:!0,selectedSessionId:u,exitingSessions:t})}else e({sessions:n,hasLoaded:!0,selectedSessionId:u})},setAgentSessions:(t,n,r)=>e(e=>{let i={active:jh(t),hibernating:jh(n),history:jh(r)};return{agentSessions:i,agentSessionsEpoch:e.connectionEpoch,selectedHibernatingSessionId:e.selectedHibernatingSessionId&&!i.hibernating.some(t=>t.sessionId===e.selectedHibernatingSessionId)?null:e.selectedHibernatingSessionId}}),setActiveAgentSessions:t=>e(e=>({agentSessions:{active:jh(t),hibernating:e.agentSessions.hibernating,history:e.agentSessions.history}})),setHostStatuses:t=>e({hostStatuses:t}),updateSession:t=>e(e=>({sessions:e.sessions.map(e=>e.id===t.id?t:e)})),setSelectedSessionId:t=>e({selectedSessionId:t,...t===null?{}:{selectedHibernatingSessionId:null}}),setSelectedHibernatingSessionId:t=>e({selectedHibernatingSessionId:t,...t===null?{}:{selectedSessionId:null}}),setConnectionStatus:t=>e({connectionStatus:t}),setConnectionError:t=>e({connectionError:t}),setConnectionState:(t,n,r)=>e({connectionStatus:t,connectionError:n,connectionEpoch:r}),setRemoteAllowControl:t=>e({remoteAllowControl:t}),setRemoteAllowAttach:t=>e({remoteAllowAttach:t}),setHostLabel:t=>e({hostLabel:t}),setPreferWindowName:t=>e({preferWindowName:t}),markSessionExiting:n=>{let r=t().sessions.find(e=>e.id===n);if(r){let i=new Map(t().exitingSessions);i.set(n,r),e({exitingSessions:i})}},clearExitingSession:n=>{let r=new Map(t().exitingSessions);r.delete(n),e({exitingSessions:r})}}),{name:Eh,storage:rt(()=>Dh),partialize:e=>({selectedSessionId:e.selectedSessionId,selectedHibernatingSessionId:e.selectedHibernatingSessionId}),merge:(e,t)=>{let n=e,r=n?.selectedHibernatingSessionId??n?.selectedSleepingSessionId;return{...t,selectedSessionId:Ah(n?.selectedSessionId),selectedHibernatingSessionId:Ah(r)}}}));function Nh(e,t,n=!1){let[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(e),o=(0,y.useRef)(!1);return(0,y.useEffect)(()=>{let r=a.current;if(n?e>r:e!==r){o.current=!0;let n=setTimeout(()=>{o.current&&=(i(!0),!1)},t);return a.current=e,()=>clearTimeout(n)}a.current=e},[e,t,n]),[r,()=>i(!1)]}function Ph(e,t,n,r){let i=(0,y.useRef)(new Map);(0,y.useEffect)(()=>{let a=new Set(e.map(e=>e.id));for(let e of t.keys())if(a.has(e)){let t=i.current.get(e);t&&(clearTimeout(t),i.current.delete(e)),n(e)}else if(!i.current.has(e)){let t=setTimeout(()=>{i.current.delete(e),n(e)},r+100);i.current.set(e,t)}},[e,t,n,r]),(0,y.useEffect)(()=>()=>{for(let e of i.current.values())clearTimeout(e);i.current.clear()},[])}function Fh(e){return typeof CSS<`u`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Ih(e){let t=parseFloat(e);return Number.isFinite(t)?t:0}function Lh(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a,o;if(e.scrollHeight>e.clientHeight){let t=Ih(n.scrollPaddingTop),o=Ih(n.scrollPaddingBottom),s=i.top-r.top+e.scrollTop,c=s+i.height,l=e.scrollTop+t,u=e.scrollTop+e.clientHeight-o;s<l?a=s-t:c>u&&(a=c-e.clientHeight+o)}if(e.scrollWidth>e.clientWidth){let t=Ih(n.scrollPaddingLeft),a=Ih(n.scrollPaddingRight),s=i.left-r.left+e.scrollLeft,c=s+i.width,l=e.scrollLeft+t,u=e.scrollLeft+e.clientWidth-a;s<l?o=s-t:c>u&&(o=c-e.clientWidth+a)}(a!==void 0||o!==void 0)&&e.scrollTo({top:a,left:o,behavior:`instant`})}function Rh(e,t,n,r=!0){let i=(0,y.useRef)(t);(0,y.useLayoutEffect)(()=>{i.current=t},[t,r]),(0,y.useLayoutEffect)(()=>{if(!r)return;let t=i.current;if(!t)return;if(n&&!n(t)){i.current=null;return}let a=e.current,o=a?.querySelector(`[data-session-id="${Fh(t)}"]`);a&&o&&(Lh(a,o),i.current=null)})}function zh(e=`(max-width: 767px)`){let[t,n]=(0,y.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,y.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}var Bh=2;function Vh(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=Bh}function Hh(e,t,n){let r=(0,y.useRef)(!0),i=(0,y.useRef)(null),a=()=>{let t=e.current;if(!t)return;let n=`${t.scrollHeight}:${t.clientHeight}`;n!==i.current&&(i.current=n,r.current&&(t.scrollTop=t.scrollHeight))},o=(0,y.useRef)(a);o.current=a,(0,y.useLayoutEffect)(()=>{i.current=null,n&&(r.current=!0,o.current())},[n]),(0,y.useLayoutEffect)(()=>{n&&o.current()}),(0,y.useEffect)(()=>{if(!n)return;let t=e.current;if(!t||typeof t.addEventListener!=`function`)return;let i=()=>{r.current=Vh(t)};return t.addEventListener(`scroll`,i,{passive:!0}),()=>t.removeEventListener(`scroll`,i)},[n,e]),(0,y.useEffect)(()=>{if(!n||typeof ResizeObserver>`u`)return;let r=t.current;if(!r)return;let i=new ResizeObserver(()=>o.current());return i.observe(r),e.current&&i.observe(e.current),()=>i.disconnect()},[n,t,e])}function Uh(e,t){let[n,r]=(0,y.useState)(null);return(0,y.useLayoutEffect)(()=>{let n=e.current;if(!t||!n||typeof window>`u`||typeof n.getBoundingClientRect!=`function`)return;let{width:i,height:a}=n.getBoundingClientRect(),o=window.innerWidth,s=window.innerHeight,c=typeof s==`number`&&t.y+a>s?Math.max(0,t.y-a):t.y;r({key:t,left:typeof o==`number`&&t.x+i>o?Math.max(0,t.x-i):t.x,top:c})},[e,t]),t?n&&n.key===t?{left:n.left,top:n.top}:{left:t.x,top:t.y}:null}function Wh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`0 0 92.2 92.2`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.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 Gh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`-1 -1 26 26`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.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 Kh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`0 0 588.42 568.88`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.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`})})}function qh({className:e}){return(0,k.jsx)(`svg`,{viewBox:`41 41 343 343`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,k.jsx)(`path`,{d:`M70 159.333V91.3471C70 88.3592 71.594 85.5983 74.1816 84.1044L133.043 50.1205C135.631 48.6265 138.819 48.6265 141.407 50.1205L200.269 84.1044C202.856 85.5983 204.45 88.3592 204.45 91.3471V126.068C204.708 137.606 210.806 148.734 221.531 154.926C232.256 161.117 244.942 160.834 255.063 155.289L285.132 137.929C287.719 136.435 290.907 136.435 293.495 137.929L352.357 171.913C354.944 173.406 356.538 176.167 356.538 179.155V247.123C356.538 250.111 354.944 252.872 352.357 254.366L293.495 288.35C290.907 289.844 287.719 289.844 285.132 288.35L255.306 271.13C245.146 265.456 232.344 265.117 221.534 271.358C210.809 277.55 204.711 288.678 204.453 300.215V334.926C204.453 337.914 202.859 340.675 200.271 342.169L141.41 376.153C138.822 377.647 135.634 377.647 133.046 376.153L74.1845 342.169C71.5969 340.675 70.0028 337.914 70.0028 334.926V266.959C70.0029 263.971 71.5969 261.21 74.1845 259.716L133.046 225.732C135.634 224.238 138.822 224.238 141.41 225.732L171.547 243.132C181.656 248.638 194.306 248.906 205.005 242.729C215.815 236.488 221.922 225.231 222.088 213.595C221.83 202.057 215.732 189.737 205.008 183.545C194.283 177.353 181.597 177.636 171.476 183.181L141.269 200.72C138.67 202.229 135.461 202.228 132.864 200.716L74.1576 166.562C71.5835 165.065 70 162.311 70 159.333Z`})})}function Jh({className:e}){return(0,k.jsxs)(`svg`,{viewBox:`0 0 512 512`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,k.jsx)(`path`,{d:`M210.484 312.759L343.465 210.383C349.984 205.364 359.302 207.322 362.408 215.117C378.758 256.231 371.454 305.64 338.925 339.563C306.397 373.487 261.137 380.927 219.768 363.983L174.577 385.803C239.394 432.008 318.104 420.581 367.289 369.251C406.303 328.564 418.386 273.104 407.088 223.091L407.19 223.198C390.807 149.726 411.218 120.359 453.03 60.3072C454.02 58.8833 455.01 57.4595 456 56L400.978 113.382V113.204L210.45 312.794`}),(0,k.jsx)(`path`,{d:`M183.042 337.641C136.519 291.294 144.54 219.567 184.236 178.203C213.59 147.59 261.683 135.096 303.666 153.464L348.755 131.75C340.632 125.627 330.221 119.042 318.275 114.414C264.277 91.2407 199.63 102.774 155.735 148.516C113.513 192.549 100.236 260.254 123.036 318.027C140.069 361.206 112.148 391.748 84.0229 422.575C74.0561 433.503 64.0553 444.431 56 456L183.007 337.677`})]})}function Yh({className:e}){return(0,k.jsxs)(`svg`,{viewBox:`0 -15 120 120`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,k.jsx)(`rect`,{x:`10`,y:`8`,width:`100`,height:`12`,rx:`2`}),(0,k.jsx)(`rect`,{x:`25`,y:`20`,width:`12`,height:`62`,rx:`2`}),(0,k.jsx)(`rect`,{x:`75`,y:`20`,width:`12`,height:`45`,rx:`2`}),(0,k.jsx)(`rect`,{x:`71`,y:`55`,width:`20`,height:`16`,rx:`3`,fill:`#f97316`}),(0,k.jsx)(`rect`,{x:`76`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,k.jsx)(`rect`,{x:`82`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,k.jsx)(`circle`,{cx:`18`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`}),(0,k.jsx)(`circle`,{cx:`102`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`})]})}var Xh=[[`claude`,Wh],[`codex`,Gh],[`omp`,Yh],[`pi`,Kh],[`devin`,qh],[`grok`,Jh]];function Zh({agentType:e,command:t,className:n=``}){let r=(e||t?.split(` `)[0]||``).toLowerCase();for(let[e,t]of Xh)if(r.startsWith(e))return(0,k.jsx)(t,{className:n});return(0,k.jsx)(qe,{className:n})}function Qh(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Qh(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function $h(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Qh(e))&&(r&&(r+=` `),r+=t);return r}var eg=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},tg=(e,t)=>({classGroupId:e,validator:t}),ng=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rg=`-`,ig=[],ag=`arbitrary..`,og=e=>{let t=lg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return cg(e);let n=e.split(rg);return sg(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?eg(i,t):t:i||ig}return n[e]||ig}}},sg=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=sg(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(rg):e.slice(t).join(rg),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},cg=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ag+r:void 0})(),lg=e=>{let{theme:t,classGroups:n}=e;return ug(n,t)},ug=(e,t)=>{let n=ng();for(let r in e){let i=e[r];dg(i,n,r,t)}return n},dg=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];fg(i,t,n,r)}},fg=(e,t,n,r)=>{if(typeof e==`string`){pg(e,t,n);return}if(typeof e==`function`){mg(e,t,n,r);return}hg(e,t,n,r)},pg=(e,t,n)=>{let r=e===``?t:gg(t,e);r.classGroupId=n},mg=(e,t,n,r)=>{if(_g(e)){dg(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(tg(n,e))},hg=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];dg(o,gg(t,a),n,r)}},gg=(e,t)=>{let n=e,r=t.split(rg),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=ng(),n.nextPart.set(t,i)),n=i}return n},_g=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,vg=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},yg=`!`,bg=`:`,xg=[],Sg=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Cg=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===bg){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(yg)?(c=s.slice(0,-1),l=!0):s.startsWith(yg)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Sg(t,l,c,u)};if(t){let e=t+bg,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Sg(xg,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},wg=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Tg=e=>({cache:vg(e.cacheSize),parseClassName:Cg(e),sortModifiers:wg(e),...og(e)}),Eg=/\s+/,Dg=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Eg),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+yg:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Og=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=kg(n))&&(i&&(i+=` `),i+=r);return i},kg=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=kg(e[r]))&&(n&&(n+=` `),n+=t);return n},Ag=(e,...t)=>{let n,r,i,a,o=o=>(n=Tg(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Dg(e,n);return i(e,a),a};return a=o,(...e)=>a(Og(...e))},jg=[],Mg=e=>{let t=t=>t[e]||jg;return t.isThemeGetter=!0,t},Ng=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fg=/^\d+\/\d+$/,Ig=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Lg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vg=e=>Fg.test(e),Hg=e=>!!e&&!Number.isNaN(Number(e)),Ug=e=>!!e&&Number.isInteger(Number(e)),Wg=e=>e.endsWith(`%`)&&Hg(e.slice(0,-1)),Gg=e=>Ig.test(e),Kg=()=>!0,qg=e=>Lg.test(e)&&!Rg.test(e),Jg=()=>!1,Yg=e=>zg.test(e),Xg=e=>Bg.test(e),Zg=e=>!J(e)&&!Y(e),Qg=e=>u_(e,m_,Jg),J=e=>Ng.test(e),$g=e=>u_(e,h_,qg),e_=e=>u_(e,g_,Hg),t_=e=>u_(e,f_,Jg),n_=e=>u_(e,p_,Xg),r_=e=>u_(e,v_,Yg),Y=e=>Pg.test(e),i_=e=>d_(e,h_),a_=e=>d_(e,__),o_=e=>d_(e,f_),s_=e=>d_(e,m_),c_=e=>d_(e,p_),l_=e=>d_(e,v_,!0),u_=(e,t,n)=>{let r=Ng.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},d_=(e,t,n=!1)=>{let r=Pg.exec(e);return r?r[1]?t(r[1]):n:!1},f_=e=>e===`position`||e===`percentage`,p_=e=>e===`image`||e===`url`,m_=e=>e===`length`||e===`size`||e===`bg-size`,h_=e=>e===`length`,g_=e=>e===`number`,__=e=>e===`family-name`,v_=e=>e===`shadow`,y_=Ag(()=>{let e=Mg(`color`),t=Mg(`font`),n=Mg(`text`),r=Mg(`font-weight`),i=Mg(`tracking`),a=Mg(`leading`),o=Mg(`breakpoint`),s=Mg(`container`),c=Mg(`spacing`),l=Mg(`radius`),u=Mg(`shadow`),d=Mg(`inset-shadow`),f=Mg(`text-shadow`),p=Mg(`drop-shadow`),m=Mg(`blur`),h=Mg(`perspective`),g=Mg(`aspect`),_=Mg(`ease`),v=Mg(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[Vg,`full`,`auto`,...w()],E=()=>[Ug,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Ug,Y,J]},Ug,Y,J],O=()=>[Ug,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Vg,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,Y,J],F=()=>[...b(),o_,t_,{position:[Y,J]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],I=()=>[`auto`,`cover`,`contain`,s_,Qg,{size:[Y,J]}],L=()=>[Wg,i_,$g],R=()=>[``,`none`,`full`,l,Y,J],z=()=>[``,Hg,i_,$g],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[Hg,Wg,o_,t_],ne=()=>[``,`none`,m,Y,J],H=()=>[`none`,Hg,Y,J],re=()=>[`none`,Hg,Y,J],ie=()=>[Hg,Y,J],ae=()=>[Vg,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Gg],breakpoint:[Gg],color:[Kg],container:[Gg],"drop-shadow":[Gg],ease:[`in`,`out`,`in-out`],font:[Zg],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Gg],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Gg],shadow:[Gg],spacing:[`px`,Hg],text:[Gg],"text-shadow":[Gg],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Vg,J,Y,g]}],container:[`container`],columns:[{columns:[Hg,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ug,`auto`,Y,J]}],basis:[{basis:[Vg,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Hg,Vg,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,Hg,Y,J]}],shrink:[{shrink:[``,Hg,Y,J]}],order:[{order:[Ug,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,i_,$g]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Y,e_]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Wg,J]}],"font-family":[{font:[a_,J,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[Hg,`none`,Y,e_]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[Hg,`from-font`,`auto`,Y,$g]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Hg,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:I()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ug,Y,J],radial:[``,Y,J],conic:[Ug,Y,J]},c_,n_]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Hg,Y,J]}],"outline-w":[{outline:[``,Hg,i_,$g]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,l_,r_]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,l_,r_]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Hg,$g]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,l_,r_]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Hg,Y,J]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Hg]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Hg]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:ne()}],brightness:[{brightness:[Hg,Y,J]}],contrast:[{contrast:[Hg,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,l_,r_]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,Hg,Y,J]}],"hue-rotate":[{"hue-rotate":[Hg,Y,J]}],invert:[{invert:[``,Hg,Y,J]}],saturate:[{saturate:[Hg,Y,J]}],sepia:[{sepia:[``,Hg,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Hg,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[Hg,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Hg,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Hg,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,Hg,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[Hg,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[Hg,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,Hg,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Hg,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[Hg,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[Hg,i_,$g,e_]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function b_(...e){return y_($h(e))}var x_=[25,50,85,110,130,150,175,200,225,255,280,305,330,355];function S_(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t^=t>>>16,t=Math.imul(t,2146121005),t^=t>>>15,t=Math.imul(t,2221713035),t^=t>>>16,t>>>0}function C_(e){return{"--badge-hue":`${w_(e)}`}}function w_(e){return x_[S_(e)%x_.length]}function T_({name:e,fullPath:t,className:n=``}){let r=C_(e);return(0,k.jsx)(`span`,{className:b_(`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none`,n),style:r,title:t,children:e})}function E_({name:e,className:t=``}){let n=C_(`host:${e}`);return(0,k.jsx)(`span`,{className:b_(`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide`,t),style:n,title:e,children:e})}var D_=6e4,O_=new Map,k_=new Map,A_=new Map,j_=new Set,M_=new Set;function N_(e){return M_.add(e),()=>{M_.delete(e)}}function P_(e){let t=O_.get(e);return t&&Date.now()-t.at<D_?t.info:void 0}function F_(e){let t=k_.get(e);return t&&Date.now()-t.at<D_?t.checks:void 0}var I_=`inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] tabular-nums`;function L_(e){if(!e||e.error||!e.state)return{StateIcon:Ce,cls:`text-muted`};switch(e.state){case`OPEN`:return{StateIcon:Ce,cls:e.isDraft?`text-muted`:`text-pr-open`};case`MERGED`:return{StateIcon:xe,cls:`text-pr-merged`};case`CLOSED`:return{StateIcon:Ce,cls:`text-pr-closed`};default:return{StateIcon:Ce,cls:`text-muted`}}}function R_({info:e}){let{StateIcon:t,cls:n}=L_(e),r=e&&!e.error?e.state===`CLOSED`?Ye:e.isDraft?ze:null:null;return r?(0,k.jsxs)(`span`,{className:`relative inline-flex shrink-0`,children:[(0,k.jsx)(t,{width:G.pill,height:G.pill,strokeWidth:2,className:n,"aria-hidden":!0}),(0,k.jsx)(r,{width:6,height:6,strokeWidth:2.5,className:`absolute bottom-0 right-0 ${n}`,"aria-hidden":!0})]}):(0,k.jsx)(t,{width:G.pill,height:G.pill,strokeWidth:2,className:`shrink-0 ${n}`,"aria-hidden":!0})}function z_(e){return!e||!e.state?``:e.isDraft&&e.state===`OPEN`?`Draft`:e.state.charAt(0)+e.state.slice(1).toLowerCase()}var B_=new Set([`SKIPPED`,`NEUTRAL`,`STALE`]);function V_(e){return e.status===`COMPLETED`?e.conclusion===`SUCCESS`?{glyph:`✓`,cls:`text-pr-open`}:e.conclusion&&B_.has(e.conclusion)?{glyph:`–`,cls:`text-muted`}:{glyph:`✗`,cls:`text-pr-closed`}:{glyph:`…`,cls:`text-pr-pending`}}async function H_(e){let t=e.filter(e=>!P_(e)&&!A_.has(e));if(t.length>0){let e=fetch(`/api/pr-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({urls:t})}).then(e=>e.json()).then(e=>{for(let t of e)t.error||O_.set(t.url,{at:Date.now(),info:t});M_.forEach(e=>e())}).catch(()=>{}).finally(()=>{t.forEach(e=>A_.delete(e))});t.forEach(t=>A_.set(t,e))}return await Promise.all(e.map(e=>A_.get(e))),e.map(e=>P_(e)).filter(Boolean)}var U_=250,W_=200,G_=3,K_=8;function q_(e,t,n){let[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null),s=(0,y.useRef)(r);s.current=r;let c=(0,y.useRef)(n);(0,y.useEffect)(()=>{c.current=n});let l=(0,y.useRef)(void 0),u=(0,y.useRef)(void 0),d=(0,y.useRef)(null),f=(0,y.useCallback)(()=>{window.clearTimeout(l.current),l.current=void 0},[]),p=(0,y.useCallback)(()=>{window.clearTimeout(u.current),u.current=void 0},[]),m=(0,y.useCallback)(()=>{f(),p();let n=e.current?.getBoundingClientRect();if(!n)return;let r=n.top-K_,a=window.innerHeight-n.bottom-K_,s=Math.max(K_,Math.min(n.left,window.innerWidth-t-K_)),c=e=>Math.max(60,e-G_);o(r>=a?{left:s,bottom:window.innerHeight-n.top+G_,maxHeight:c(r)}:{left:s,top:n.bottom+G_,maxHeight:c(a)}),i(!0)},[e,f,p,t]),h=(0,y.useCallback)(()=>{p(),!r&&(f(),l.current=window.setTimeout(m,U_))},[p,f,r,m]),g=(0,y.useCallback)(()=>{f(),p(),u.current=window.setTimeout(()=>{let t=e.current?.matches?.(`:hover`)===!0,n=d.current?.matches?.(`:hover`)===!0;if(t||n){s.current||(f(),l.current=window.setTimeout(m,U_));return}c.current?.()||i(!1)},W_)},[f,p,e,m]);return(0,y.useEffect)(()=>{if(!r)return;let t=e=>{d.current?.contains(e.target)||c.current?.()||i(!1)},n=()=>i(!1),a=t=>{if(t.key!==`Escape`)return;let n=!!d.current?.contains?.(document.activeElement);if(i(!1),n){let t=e.current;(t?.querySelector?.(`a,button`)??t)?.focus?.()}};return window.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,n),window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,n),window.removeEventListener(`keydown`,a)}},[r,e]),(0,y.useEffect)(()=>()=>{f(),p()},[f,p]),{open:r,pos:a,openCard:m,scheduleOpen:h,scheduleClose:g,cancelClose:p,cardRef:d}}var J_=(0,y.createContext)(null);function Y_({pr:e,refreshKey:t,pillClass:n=I_}){let r=(0,y.useSyncExternalStore)(N_,()=>O_.get(e.url)?.info),[i,a]=(0,y.useState)(F_(e.url)),o=(0,y.useRef)(null),{open:s,pos:c,scheduleOpen:l,scheduleClose:u,cancelClose:d,cardRef:f}=q_(o,256),p=(0,y.useContext)(J_);(0,y.useLayoutEffect)(()=>s&&p?p():void 0,[s,p]);let m=(0,y.useRef)(!0);(0,y.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=(0,y.useCallback)(()=>{H_([e.url])},[e.url]);(0,y.useEffect)(()=>{P_(e.url)||h()},[e.url,t,h]),(0,y.useEffect)(()=>{s&&!P_(e.url)&&h()},[s,e.url,h]),(0,y.useEffect)(()=>{!s||F_(e.url)||j_.has(e.url)||(j_.add(e.url),fetch(`/api/pr-checks?url=${encodeURIComponent(e.url)}`).then(e=>e.ok?e.json():null).then(t=>{t&&k_.set(e.url,{at:Date.now(),checks:t}),m.current&&t&&a(t)}).catch(()=>{}).finally(()=>j_.delete(e.url)))},[s,e.url]);let g=r??i;return(0,k.jsxs)(`span`,{ref:o,className:`relative inline-flex shrink-0`,onMouseEnter:l,onMouseLeave:u,children:[(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`${n} bg-elevated text-muted hover:text-accent`,"aria-label":`${e.repo}#${e.number}${z_(g)?` ${z_(g)}`:``}`,children:[(0,k.jsx)(R_,{info:g}),e.number]}),s&&c&&(0,Qd.createPortal)((0,k.jsxs)(`div`,{ref:f,"data-testid":`pr-hovercard`,className:`fixed z-[100] flex w-64 flex-col rounded-md border border-border bg-elevated p-2 text-left shadow-lg`,style:{left:c.left,top:c.top,bottom:c.bottom,maxHeight:c.maxHeight},onMouseEnter:d,onMouseLeave:u,onClick:e=>e.stopPropagation(),children:[(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-[11px]`,children:[(0,k.jsx)(R_,{info:g}),(0,k.jsx)(`span`,{className:`text-muted`,children:z_(g)||`PR`}),(0,k.jsx)(`span`,{className:`text-muted`,children:`·`}),(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`truncate text-muted hover:text-accent`,children:[e.repo,`#`,e.number]})]}),g?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`mt-1 block shrink-0 text-xs text-primary hover:text-accent`,children:g.title??`(title unavailable)`}),(0,k.jsx)(`div`,{className:`mt-0.5 shrink-0 text-[11px] text-muted`,children:g.author?`by ${g.author}`:``}),i?.checks&&i.checks.length>0&&(0,k.jsx)(`div`,{className:`mt-1.5 max-h-32 min-h-0 space-y-0.5 overflow-y-auto border-t border-border pt-1.5`,children:i.checks.map((e,t)=>{let n=V_(e),r=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`span`,{className:n.cls,children:n.glyph}),(0,k.jsx)(`span`,{className:`truncate text-muted group-hover:text-accent`,children:e.name})]});return e.link?(0,k.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noreferrer`,className:`group flex items-center gap-1.5 text-[11px]`,children:r},t):(0,k.jsx)(`div`,{className:`group flex items-center gap-1.5 text-[11px]`,children:r},t)})})]}):(0,k.jsxs)(`div`,{className:`mt-1 shrink-0 space-y-1`,children:[(0,k.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-border`}),(0,k.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-border`})]})]}),document.body)]})}function X_({prs:e,refreshKey:t,pillClass:n=I_}){let r=(0,y.useRef)(null),i=(0,y.useRef)(null),a=(0,y.useRef)(!1),o=(0,y.useRef)(0),{open:s,pos:c,openCard:l,scheduleOpen:u,scheduleClose:d,cancelClose:f,cardRef:p}=q_(r,288,()=>o.current>0);(0,y.useEffect)(()=>{s&&a.current&&(a.current=!1,p.current?.querySelector?.(`a`)?.focus())},[s,p]);let m=(0,y.useCallback)(()=>(o.current+=1,()=>{--o.current,r.current&&!r.current.matches?.(`:hover`)&&!p.current?.matches?.(`:hover`)&&!p.current?.contains?.(document.activeElement)&&d()}),[d,p]);return(0,k.jsxs)(`span`,{ref:r,className:`relative inline-flex shrink-0`,onMouseEnter:u,onMouseLeave:d,children:[(0,k.jsxs)(`button`,{ref:i,type:`button`,className:`${n} cursor-pointer text-muted hover:text-accent`,"aria-label":`${e.length} more PR${e.length===1?``:`s`}`,"aria-haspopup":`true`,"aria-expanded":s,onKeyDown:e=>{e.key!==`Enter`&&e.key!==`ArrowDown`||(e.preventDefault(),s?p.current?.querySelector?.(`a`)?.focus():(a.current=!0,l()))},onClick:e=>e.stopPropagation(),children:[`+`,e.length]}),s&&c&&(0,Qd.createPortal)((0,k.jsx)(J_.Provider,{value:m,children:(0,k.jsx)(`div`,{ref:p,"data-testid":`pr-flyout`,className:`fixed z-[100] flex max-w-72 flex-wrap items-center gap-1 overflow-y-auto rounded-md border border-border bg-surface p-1 shadow-lg`,style:{left:c.left,top:c.top,bottom:c.bottom,maxHeight:c.maxHeight},onMouseEnter:f,onMouseLeave:d,onFocus:f,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d()},onKeyDown:e=>{if(e.key!==`Tab`||!e.shiftKey)return;let t=p.current?.querySelector?.(`a`);e.target===t&&(e.preventDefault(),i.current?.focus())},onClick:e=>e.stopPropagation(),children:e.map(e=>(0,k.jsx)(Y_,{pr:e,refreshKey:t,pillClass:n},e.url))})}),document.body)]})}function Z_({prs:e,className:t=`pl-[1.375rem]`,pillClass:n=I_}){let r=(0,y.useRef)(null),i=(0,y.useRef)([]),a=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useMemo)(()=>[...e].reverse(),[e]),[c,l]=(0,y.useState)(s.length),[u,d]=(0,y.useState)(0);(0,y.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&d(e=>e+1)};return document.addEventListener?.(`visibilitychange`,e),()=>document.removeEventListener?.(`visibilitychange`,e)},[]),(0,y.useEffect)(()=>{let e=setInterval(()=>{document.visibilityState!==`hidden`&&H_(s.map(e=>e.url)).then(()=>d(e=>e+1))},D_);return()=>clearInterval(e)},[s]);let f=(0,y.useCallback)(()=>{let e=s.length,t=r.current;if(!t||typeof t.clientWidth!=`number`||t.clientWidth===0){l(e);return}let n=getComputedStyle(t),c=t.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),u=parseFloat(n.columnGap)||0,d=a.current?.offsetWidth??0,f=Math.max(0,(o.current?.offsetWidth??d)-d),p=e=>d+String(e).length*f,m=0,h=0;for(let t=0;t<e;t++){let n=i.current[t]?.offsetWidth??0,r=e-t-1,a=r>0?u+p(r):0,o=(h>0?u:0)+n+a;if(m+o>c)break;m+=o-a,h++}l(h)},[s]);if((0,y.useLayoutEffect)(()=>{f()},[f]),(0,y.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return window.addEventListener(`resize`,f),()=>window.removeEventListener(`resize`,f);let t=new ResizeObserver(f);return t.observe(e),()=>t.disconnect()},[f]),(0,y.useEffect)(()=>{document.fonts?.ready.then(f).catch(()=>{})},[f]),s.length===0)return null;let p=s.slice(0,c),m=s.slice(c);return(0,k.jsxs)(`div`,{ref:r,className:`relative flex flex-nowrap items-center gap-1 overflow-hidden ${t}`,children:[p.map(e=>(0,k.jsx)(Y_,{pr:e,refreshKey:u,pillClass:n},e.url)),m.length>0&&(0,k.jsx)(X_,{prs:m,refreshKey:u,pillClass:n}),(0,k.jsxs)(`span`,{"aria-hidden":!0,className:`invisible absolute left-0 top-0 flex flex-nowrap`,children:[s.map((e,t)=>(0,k.jsxs)(`span`,{ref:e=>{i.current[t]=e},className:n,children:[(0,k.jsx)(R_,{}),e.number]},e.url)),(0,k.jsx)(`span`,{ref:a,className:n,children:`+`}),(0,k.jsx)(`span`,{ref:o,className:n,children:`+0`})]})]})}var Q_=`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,$_=`h-3.5 w-3.5 shrink-0 accent-approval`;function ev({heading:e,emptyLabel:t,options:n,visibleOptions:r=n,selected:i,onSelect:a,labelFor:o,titleFor:s,noteFor:c}){let l=(0,y.useId)(),u=new Set(i),d=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),a(n.filter(e=>t.has(e)))};return(0,k.jsxs)(`div`,{role:`group`,"aria-labelledby":l,className:`shrink-0 pb-1`,children:[(0,k.jsx)(`div`,{id:l,className:`px-2 pb-1 pt-1.5 text-[10px] font-medium uppercase tracking-wider text-muted`,children:e}),n.length===0?(0,k.jsx)(`div`,{className:`px-2 py-1 text-muted`,children:t}):r.map(e=>{let t=c?.(e)??null;return(0,k.jsxs)(`label`,{role:`menuitemcheckbox`,"aria-checked":u.has(e),className:Q_,title:s?.(e),children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>d(e),className:$_}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:o(e)}),t&&(0,k.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] uppercase text-danger`,children:t})]},e)})]})}function tv(e,t){let n=t.trim().toLowerCase();return n===``||e.toLowerCase().includes(n)}function nv(){return typeof window<`u`&&!!window.matchMedia?.(`(pointer: coarse)`).matches}function rv({projects:e,selectedProjects:t,onSelectProjects:n,hosts:r,selectedHosts:i,onSelectHosts:a,hostStatuses:o=[],showHosts:s,hasHiddenPermissions:c,placement:l=`down`}){let[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(``),m=(0,y.useId)(),h=(0,y.useRef)(null),g=(0,y.useRef)(null),_=(0,y.useRef)(f);_.current=f;let v=e=>{d(e),p(``)},b=(0,y.useMemo)(()=>Ch(e),[e]),x=(0,y.useMemo)(()=>new Map(o.map(e=>[e.host,e])),[o]),S=e=>b.get(e)??Sh(e)??e,C=t.length+i.length,w=C>0,T=c&&t.length>0,E=`Filter`;if(w){let e=[];t.length>0&&e.push(`Projects: ${t.map(S).join(`, `)}`),i.length>0&&e.push(`Hosts: ${i.join(`, `)}`),E=`Filtered by ${e.join(`; `)}`}let D=w?`Filter, ${C} active filter${C===1?``:`s`}`:`Filter`,O=e.length+(s?r.length:0)>8,A=O?f:``,j=A.trim()!==``,M=(e,t,n)=>{if(!j)return e;let r=new Set(t);return e.filter(e=>r.has(e)||tv(n(e),A))},N=s?M(r,i,e=>e):[],P=M(e,t,S),F=s&&(!j||N.length>0),ee=!j||P.length>0;return(0,y.useEffect)(()=>{if(!u||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=()=>{d(!1),p(``)},t=t=>{let n=t.target;n&&h.current?.contains(n)||e()},n=t=>{if(t.key===`Escape`){if(_.current!==``){p(``);return}e()}};return document.addEventListener(`mousedown`,t),document.addEventListener(`touchstart`,t,{passive:!0}),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`mousedown`,t),document.removeEventListener(`touchstart`,t),document.removeEventListener(`keydown`,n)}},[u]),(0,y.useEffect)(()=>{u&&!nv()&&g.current?.focus()},[u]),(0,k.jsxs)(`div`,{ref:h,className:`flex shrink-0`,children:[(0,k.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,k.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":u,"aria-controls":u?m:void 0,"aria-label":D,title:E,onClick:()=>v(!u),className:`${Ot(w?`active`:`neutral`)} ${Nt}`,children:[(0,k.jsx)(_e,{width:G.default,height:G.default}),w&&(0,k.jsx)(`span`,{"data-testid":`filter-count-badge`,"aria-hidden":`true`,className:`pointer-events-none absolute -right-1.5 -top-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-accent px-1 text-[9px] font-semibold leading-none text-white`,children:C})]}),T&&(0,k.jsx)(`button`,{type:`button`,"data-testid":`hidden-attention-dot`,className:`absolute -bottom-1 -right-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:e=>{e.stopPropagation(),n([])},children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Clear project filters`})})]}),u&&(0,k.jsxs)(`div`,{id:m,role:`menu`,"aria-label":`Filter sessions`,className:`absolute left-2 right-2 z-20 ${l===`up`?`bottom-full mb-1`:`top-full mt-1`} flex max-h-[min(26rem,calc(100dvh-7rem))] flex-col overflow-hidden rounded border border-border bg-surface p-1.5 text-xs shadow-lg`,children:[(0,k.jsxs)(`div`,{"data-testid":`filter-header`,className:`flex h-[26px] shrink-0 items-center justify-between gap-2 [@media(pointer:coarse)]:h-[44px]`,children:[(0,k.jsx)(`span`,{className:`truncate pl-2 text-[11px] font-medium text-secondary`,children:`Filter`}),w&&(0,k.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n([]),a([])},className:`h-full shrink-0 rounded px-2 text-accent hover:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [@media(pointer:coarse)]:min-w-[44px]`,children:`Clear`})]}),O&&(0,k.jsx)(`div`,{className:`shrink-0 px-1 pb-1 pt-0.5`,children:(0,k.jsx)(`input`,{ref:g,type:`search`,"aria-label":`Search filters`,placeholder:`Search`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,enterKeyHint:`search`,value:f,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-base px-2 py-1 text-xs text-primary placeholder:text-muted focus:border-accent focus:outline-none [@media(pointer:coarse)]:text-[16px]`})}),(0,k.jsxs)(`div`,{"data-testid":`filter-options`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[F&&(0,k.jsx)(ev,{heading:`Hosts`,emptyLabel:`No hosts`,options:r,visibleOptions:N,selected:i,onSelect:a,labelFor:e=>e,titleFor:e=>{let t=x.get(e);return t?.error?`${e}: ${t.error}`:e},noteFor:e=>{let t=x.get(e);return t&&!t.ok?`offline`:null}}),ee&&(0,k.jsx)(ev,{heading:`Projects`,emptyLabel:`No projects`,options:e,visibleOptions:P,selected:t,onSelect:n,labelFor:S,titleFor:e=>e}),!F&&!ee&&(0,k.jsx)(`div`,{"data-testid":`filter-no-matches`,className:`px-2 py-1.5 text-muted`,children:`No matches`})]})]})]})}function iv(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function av(e){return typeof e==`string`?e:null}var ov=new Set([`tool_result`,`custom_tool_call_output`]),sv=new Set([`text`,`input_text`,`output_text`]);function cv(e){return e===`user`?`user`:e===`assistant`?`assistant`:e===`system`||e===`developer`?`system`:e===`tool`?`tool`:`other`}function lv(e){let t=av(e.type)??``,n=iv(e.payload),r=av(n?.type)??``,i=av(e.source)??av(n?.source)??``,a=av(e.agent)??``;return i.toLowerCase()===`pi`||a.toLowerCase()===`pi`?`pi`:i.toLowerCase()===`devin`||a.toLowerCase()===`devin`?`devin`:i.toLowerCase()===`grok`||a.toLowerCase()===`grok`||e.synthetic_reason!==void 0||e.prompt_index!==void 0||e.model_fingerprint!==void 0||e.encrypted_content!==void 0?`grok`:t===`response_item`||t===`event_msg`?`codex`:t===`tool_use`||t===`result`||t===`user`||t===`assistant`||t===`system`?`claude`:r===`user_message`||r===`assistant_message`?`codex`:`unknown`}function uv(e){let t=av(iv(e.payload)?.type);return{family:lv(e),rawType:av(e.type)??`unknown`,...t?{payloadType:t}:{}}}function dv(e){if(!e)return[];if(typeof e==`string`)return e.trim()?[e]:[];if(Array.isArray(e)){let t=[];for(let n of e){if(typeof n==`string`){n.trim()&&t.push(n);continue}let e=iv(n);if(!e)continue;let r=av(e.type);if(r&&ov.has(r)||r&&!sv.has(r))continue;let i=av(e.text);i&&i.trim()&&t.push(i)}return t}let t=iv(e);if(t){let e=av(t.type);if(e&&ov.has(e))return[];let n=av(t.text);return n&&n.trim()?[n]:[...dv(t.content),...dv(t.message)]}return[]}function fv(e,t){if(e.type!==`response_item`)return[];let n=iv(e.payload);if(!n||n.type!==`message`)return[];let r=cv(n.role);return dv(n.content).map(e=>({kind:`message`,role:r,text:e,source:t}))}function pv(e,t){if(e.type!==`event_msg`)return[];let n=iv(e.payload);if(!n)return[];let r=av(n.type),i=null;if(r===`user_message`?i=`user`:r===`assistant_message`||r===`agent_message`?i=`assistant`:r===`system_message`?i=`system`:r===`message`&&(i=cv(n.role)),!i||![`user`,`assistant`,`system`].includes(i))return[];let a=Array.from(new Set([...dv(n.message),...dv(n.content),...dv(n.text)]));return a.length===0?[]:a.map(e=>({kind:`message`,role:i,text:e,source:t}))}function mv(e,t){let n=cv(e.type),r=iv(e.message);if(r){let n=cv(r.role??e.type);return[...dv(r.content),...dv(r.text),...dv(r.message)].map(e=>({kind:`message`,role:n,text:e,source:t}))}return[`user`,`assistant`,`system`].includes(n)?[...dv(e.content),...dv(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function hv(e,t){let n=cv(e.role);return[`user`,`assistant`,`system`].includes(n)?[...dv(e.content),...dv(e.message),...dv(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function gv(e,t){let n=av(e.type),r=av(e.event);return n!==`tool_use`&&r!==`tool_use`?[]:[{kind:`tool_call`,role:`assistant`,text:`[Tool: ${av(e.name)??`tool`}]`,source:t}]}function _v(e,t){if(e.type!==`result`)return[];let n=av(e.result);return!n||!n.trim()?[]:[{kind:`result`,role:`system`,text:n,source:t}]}function vv(e,t){let n=iv(e.payload),r=[...dv(e.message),...dv(e.content),...dv(e.text),...dv(n?.message),...dv(n?.content)];return r.length===0?[]:r.map(e=>({kind:`unknown`,role:`other`,text:e,source:t}))}function yv(e,t){let n=av(e.type),r=av(iv(e.payload)?.type);return n&&ov.has(n)||r&&ov.has(r)?[{kind:`tool_result`,role:`tool`,text:``,source:t}]:[]}function bv(e,t){let n=e.tool_calls;return t.family!==`grok`||!Array.isArray(n)?[]:n.map(e=>iv(e)).filter(e=>e!==null).map(e=>({kind:`tool_call`,role:`assistant`,text:`[Tool: ${av(e.name)??`tool`}]`,source:t}))}function xv(e){let t=iv(e);if(!t||t.isMeta===!0||t.synthetic_reason!==void 0)return[];let n=uv(t),r=[...fv(t,n),...pv(t,n),...mv(t,n),...gv(t,n),..._v(t,n),...yv(t,n),...bv(t,n)];if(r.length>0)return r;let i=hv(t,n);return i.length>0?i:vv(t,n)}function Sv(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);return{parsed:!0,events:xv(e),raw:e}}catch{return{parsed:!1,events:[{kind:`unknown`,role:`other`,text:t,source:{family:`unknown`,rawType:`raw_text`}}],raw:e}}}function Cv(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var wv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ev={};function Dv(e,t){return((t||Ev).jsx?Tv:wv).test(e)}var Ov=/[ \t\n\f\r]/g;function kv(e){return typeof e==`object`?e.type===`text`?Av(e.value):!1:Av(e)}function Av(e){return e.replace(Ov,``)===``}var jv=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};jv.prototype.normal={},jv.prototype.property={},jv.prototype.space=void 0;function Mv(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new jv(n,r,t)}function Nv(e){return e.toLowerCase()}var Pv=class{constructor(e,t){this.attribute=t,this.property=e}};Pv.prototype.attribute=``,Pv.prototype.booleanish=!1,Pv.prototype.boolean=!1,Pv.prototype.commaOrSpaceSeparated=!1,Pv.prototype.commaSeparated=!1,Pv.prototype.defined=!1,Pv.prototype.mustUseProperty=!1,Pv.prototype.number=!1,Pv.prototype.overloadedBoolean=!1,Pv.prototype.property=``,Pv.prototype.spaceSeparated=!1,Pv.prototype.space=void 0;var Fv=c({boolean:()=>Lv,booleanish:()=>Rv,commaOrSpaceSeparated:()=>Hv,commaSeparated:()=>Vv,number:()=>X,overloadedBoolean:()=>zv,spaceSeparated:()=>Bv}),Iv=0,Lv=Uv(),Rv=Uv(),zv=Uv(),X=Uv(),Bv=Uv(),Vv=Uv(),Hv=Uv();function Uv(){return 2**++Iv}var Wv=Object.keys(Fv),Gv=class extends Pv{constructor(e,t,n,r){let i=-1;if(super(e,t),Kv(this,`space`,r),typeof n==`number`)for(;++i<Wv.length;){let e=Wv[i];Kv(this,Wv[i],(n&Fv[e])===Fv[e])}}};Gv.prototype.defined=!0;function Kv(e,t,n){n&&(e[t]=n)}function qv(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Gv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Nv(r)]=r,n[Nv(a.attribute)]=r}return new jv(t,n,e.space)}var Jv=qv({properties:{ariaActiveDescendant:null,ariaAtomic:Rv,ariaAutoComplete:null,ariaBusy:Rv,ariaChecked:Rv,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:Bv,ariaCurrent:null,ariaDescribedBy:Bv,ariaDetails:null,ariaDisabled:Rv,ariaDropEffect:Bv,ariaErrorMessage:null,ariaExpanded:Rv,ariaFlowTo:Bv,ariaGrabbed:Rv,ariaHasPopup:null,ariaHidden:Rv,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bv,ariaLevel:X,ariaLive:null,ariaModal:Rv,ariaMultiLine:Rv,ariaMultiSelectable:Rv,ariaOrientation:null,ariaOwns:Bv,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:Rv,ariaReadOnly:Rv,ariaRelevant:null,ariaRequired:Rv,ariaRoleDescription:Bv,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:Rv,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Yv(e,t){return t in e?e[t]:t}function Xv(e,t){return Yv(e,t.toLowerCase())}var Zv=qv({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Vv,acceptCharset:Bv,accessKey:Bv,action:null,allow:null,allowFullScreen:Lv,allowPaymentRequest:Lv,allowUserMedia:Lv,alpha:Lv,alt:null,as:null,async:Lv,autoCapitalize:null,autoComplete:Bv,autoFocus:Lv,autoPlay:Lv,blocking:Bv,capture:null,charSet:null,checked:Lv,cite:null,className:Bv,closedBy:null,colorSpace:null,cols:X,colSpan:X,command:null,commandFor:null,content:null,contentEditable:Rv,controls:Lv,controlsList:Bv,coords:X|Vv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Lv,defer:Lv,dir:null,dirName:null,disabled:Lv,download:zv,draggable:Rv,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Lv,formTarget:null,headers:Bv,height:X,hidden:zv,high:X,href:null,hrefLang:null,htmlFor:Bv,httpEquiv:Bv,id:null,imageSizes:null,imageSrcSet:null,inert:Lv,inputMode:null,integrity:null,is:null,isMap:Lv,itemId:null,itemProp:Bv,itemRef:Bv,itemScope:Lv,itemType:Bv,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Lv,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Lv,muted:Lv,name:null,nonce:null,noModule:Lv,noValidate:Lv,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Lv,optimum:X,pattern:null,ping:Bv,placeholder:null,playsInline:Lv,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Lv,referrerPolicy:null,rel:Bv,required:Lv,reversed:Lv,rows:X,rowSpan:X,sandbox:Bv,scope:null,scoped:Lv,seamless:Lv,selected:Lv,shadowRootClonable:Lv,shadowRootCustomElementRegistry:Lv,shadowRootDelegatesFocus:Lv,shadowRootMode:null,shadowRootSerializable:Lv,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:Rv,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Lv,useMap:null,value:Rv,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Bv,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Lv,declare:Lv,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Lv,noHref:Lv,noShade:Lv,noWrap:Lv,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:Rv,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Lv,disablePictureInPicture:Lv,disableRemotePlayback:Lv,exportParts:Vv,part:Bv,prefix:null,property:null,results:X,security:null,unselectable:null},space:`html`,transform:Xv}),Qv=qv({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Hv,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:Bv,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Lv,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vv,g2:Vv,glyphName:Vv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Hv,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Bv,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hv,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hv,rev:Hv,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hv,requiredFeatures:Hv,requiredFonts:Hv,requiredFormats:Hv,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Hv,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hv,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hv,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Yv}),$v=qv({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ey=qv({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Xv}),ty=qv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ny={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},ry=/[A-Z]/g,iy=/-[a-z]/g,ay=/^data[-\w.:]+$/i;function oy(e,t){let n=Nv(t),r=t,i=Pv;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ay.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(iy,cy);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!iy.test(e)){let n=e.replace(ry,sy);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Gv}return new i(r,t)}function sy(e){return`-`+e.toLowerCase()}function cy(e){return e.charAt(1).toUpperCase()}var ly=Mv([Jv,Zv,$v,ey,ty],`html`),uy=Mv([Jv,Qv,$v,ey,ty],`svg`);function dy(e){return e.join(` `).trim()}var fy=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
21
21
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),py=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(fy());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),my=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),hy=s(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(py()),r=my();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),gy=vy(`end`),_y=vy(`start`);function vy(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function yy(e){let t=_y(e),n=gy(e);if(t&&n)return{start:t,end:n}}function by(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Sy(e.position):`start`in e||`end`in e?Sy(e):`line`in e||`column`in e?xy(e):``}function xy(e){return Cy(e&&e.line)+`:`+Cy(e&&e.column)}function Sy(e){return xy(e&&e.start)+`-`+xy(e&&e.end)}function Cy(e){return e&&typeof e==`number`?e:1}var wy=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=by(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};wy.prototype.file=``,wy.prototype.name=``,wy.prototype.reason=``,wy.prototype.message=``,wy.prototype.stack=``,wy.prototype.column=void 0,wy.prototype.line=void 0,wy.prototype.ancestors=void 0,wy.prototype.cause=void 0,wy.prototype.fatal=void 0,wy.prototype.place=void 0,wy.prototype.ruleId=void 0,wy.prototype.source=void 0;var Ty=u(hy(),1),Ey={}.hasOwnProperty,Dy=new Map,Oy=/[A-Z]/g,ky=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Ay=new Set([`td`,`th`]),jy=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function My(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Uy(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Hy(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?uy:ly,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Ny(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Ny(e,t,n){if(t.type===`element`)return Py(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Fy(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ly(e,t,n);if(t.type===`mdxjsEsm`)return Iy(e,t);if(t.type===`root`)return Ry(e,t,n);if(t.type===`text`)return zy(e,t)}function Py(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=uy,e.schema=i),e.ancestors.push(t);let a=Yy(e,t.tagName,!1),o=Wy(e,t),s=Ky(e,t);return ky.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!kv(e):!0})),By(e,o,a,t),Vy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Fy(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Xy(e,t.position)}function Iy(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xy(e,t.position)}function Ly(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=uy,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Yy(e,t.name,!0),o=Gy(e,t),s=Ky(e,t);return By(e,o,a,t),Vy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ry(e,t,n){let r={};return Vy(r,Ky(e,t)),e.create(t,e.Fragment,r,n)}function zy(e,t){return t.value}function By(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vy(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Hy(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Uy(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=_y(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Wy(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ey.call(t.properties,i)){let a=qy(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Ay.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Gy(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Xy(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Xy(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Ky(e,t){let n=[],r=-1,i=e.passKeys?new Map:Dy;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Ny(e,a,o);s!==void 0&&n.push(s)}return n}function qy(e,t,n){let r=oy(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Cv(n):dy(n)),r.property===`style`){let t=typeof n==`object`?n:Jy(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Zy(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ny[r.property]||r.property:r.attribute,n]}}function Jy(e,t){try{return(0,Ty.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new wy("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=jy+`#cannot-parse-style-attribute`,r}}function Yy(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Dv(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Dv(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Ey.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Xy(e)}function Xy(e,t){let n=new wy("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=jy+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Zy(e){let t={},n;for(n in e)Ey.call(e,n)&&(t[Qy(n)]=e[n]);return t}function Qy(e){let t=e.replace(Oy,$y);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function $y(e){return`-`+e.toLowerCase()}var eb={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},tb={};function nb(e,t){let n=t||tb;return rb(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function rb(e,t,n){if(ab(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ib(e.children,t,n)}return Array.isArray(e)?ib(e,t,n):``}function ib(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=rb(e[i],t,n);return r.join(``)}function ab(e){return!!(e&&typeof e==`object`)}var ob=document.createElement(`i`);function sb(e){let t=`&`+e+`;`;ob.innerHTML=t;let n=ob.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function cb(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function lb(e,t){return e.length>0?(cb(e,e.length,0,t),e):t}var ub={}.hasOwnProperty;function db(e){let t={},n=-1;for(;++n<e.length;)fb(t,e[n]);return t}function fb(e,t){let n;for(n in t){let r=(ub.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){ub.call(r,a)||(r[a]=[]);let e=i[a];pb(r[a],Array.isArray(e)?e:e?[e]:[])}}}function pb(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);cb(e,0,0,r)}function mb(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function hb(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var gb=Ob(/[A-Za-z]/),_b=Ob(/[\dA-Za-z]/),vb=Ob(/[#-'*+\--9=?A-Z^-~]/);function yb(e){return e!==null&&(e<32||e===127)}var bb=Ob(/\d/),xb=Ob(/[\dA-Fa-f]/),Sb=Ob(/[!-/:-@[-`{-~]/);function Cb(e){return e!==null&&e<-2}function wb(e){return e!==null&&(e<0||e===32)}function Tb(e){return e===-2||e===-1||e===32}var Eb=Ob(/\p{P}|\p{S}/u),Db=Ob(/\s/);function Ob(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function kb(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&_b(e.charCodeAt(n+1))&&_b(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Ab(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Tb(r)?(e.enter(n),s(r)):t(r)}function s(r){return Tb(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var jb={tokenize:Mb};function Mb(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Ab(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Cb(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Nb={tokenize:Fb},Pb={tokenize:Ib};function Fb(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return cb(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Pb,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Pb,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Cb(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;cb(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ib(e,t,n){return Ab(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Lb(e){if(e===null||wb(e)||Db(e))return 1;if(Eb(e))return 2}function Rb(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var zb={name:`attention`,resolveAll:Bb,tokenize:Vb};function Bb(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Hb(d,-c),Hb(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=lb(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=lb(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=lb(l,Rb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=lb(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=lb(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,cb(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Vb(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Lb(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Lb(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Hb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ub={name:`autolink`,tokenize:Wb};function Wb(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return gb(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||_b(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||_b(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||yb(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):vb(t)?(e.consume(t),l):n(t)}function u(e){return _b(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||_b(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Gb={partial:!0,tokenize:Kb};function Kb(e,t,n){return r;function r(t){return Tb(t)?Ab(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Cb(e)?t(e):n(e)}}var qb={continuation:{tokenize:Yb},exit:Xb,name:`blockQuote`,tokenize:Jb};function Jb(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Tb(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Yb(e,t,n){let r=this;return i;function i(t){return Tb(t)?Ab(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(qb,t,n)(r)}}function Xb(e){e.exit(`blockQuote`)}var Zb={name:`characterEscape`,tokenize:Qb};function Qb(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Sb(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var $b={name:`characterReference`,tokenize:ex};function ex(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=_b,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=xb,u):(e.enter(`characterReferenceValue`),a=7,o=bb,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===_b&&!sb(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var tx={partial:!0,tokenize:ix},nx={concrete:!0,name:`codeFenced`,tokenize:rx};function rx(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Tb(t)?Ab(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Cb(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(tx,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Cb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Tb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Ab(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Cb(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Cb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Tb(t)?Ab(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Cb(t)?e.check(tx,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Cb(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Tb(t)?Ab(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Tb(t)?Ab(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Cb(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function ix(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ax={name:`codeIndented`,tokenize:sx},ox={partial:!0,tokenize:cx};function sx(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Ab(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Cb(t)?e.attempt(ox,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Cb(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function cx(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Cb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Ab(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Cb(e)?i(e):n(e)}}var lx={name:`codeText`,previous:dx,resolve:ux,tokenize:fx};function ux(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function dx(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function fx(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Cb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Cb(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var px=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&mx(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),mx(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),mx(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);mx(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);mx(this.left,t.reverse())}}};function mx(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function hx(e){let t={},n=-1,r,i,a,o,s,c,l,u=new px(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,gx(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return cb(e,0,1/0,u.slice(0)),!l}function gx(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var _x={resolve:yx,tokenize:bx},vx={partial:!0,tokenize:xx};function yx(e){return hx(e),e}function bx(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Cb(t)?e.check(vx,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function xx(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Ab(e,a,`linePrefix`)}function a(i){if(i===null||Cb(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Sx(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||yb(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Cb(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||wb(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||yb(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Cx(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Cb(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Cb(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Tb(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function wx(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Cb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Ab(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Cb(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Tx(e,t){let n;return r;function r(i){return Cb(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Tb(i)?Ab(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ex={name:`definition`,tokenize:Ox},Dx={partial:!0,tokenize:kx};function Ox(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Cx.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=hb(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return wb(t)?Tx(e,l)(t):l(t)}function l(t){return Sx(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Dx,d,d)(t)}function d(t){return Tb(t)?Ab(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Cb(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function kx(e,t,n){return r;function r(t){return wb(t)?Tx(e,i)(t):n(t)}function i(t){return wx(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Tb(t)?Ab(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Cb(e)?t(e):n(e)}}var Ax={name:`hardBreakEscape`,tokenize:jx};function jx(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Cb(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Mx={name:`headingAtx`,resolve:Nx,tokenize:Px};function Nx(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},cb(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Px(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||wb(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Cb(n)?(e.exit(`atxHeading`),t(n)):Tb(n)?Ab(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||wb(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Fx=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Ix=[`pre`,`script`,`style`,`textarea`],Lx={concrete:!0,name:`htmlFlow`,resolveTo:Bx,tokenize:Vx},Rx={partial:!0,tokenize:Ux},zx={partial:!0,tokenize:Hx};function Bx(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Vx(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ee):gb(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):gb(a)?(e.consume(a),i=4,r.interrupt?t:ee):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ee):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return gb(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||wb(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Ix.includes(l)?(i=1,r.interrupt?t(s):O(s)):Fx.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||_b(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Tb(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||gb(t)?(e.consume(t),b):Tb(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||_b(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Tb(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Tb(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Cb(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||wb(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Tb(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Cb(t)?O(t):Tb(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),ee):t===93&&i===5?(e.consume(t),F):Cb(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Rx,L,k)(t)):t===null||Cb(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(zx,A,L)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Cb(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ee):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Ix.includes(n)?(e.consume(t),I):O(t)}return gb(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),ee):O(t)}function ee(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),ee):O(t)}function I(t){return t===null||Cb(t)?(e.exit(`htmlFlowData`),L(t)):(e.consume(t),I)}function L(n){return e.exit(`htmlFlow`),t(n)}}function Hx(e,t,n){let r=this;return i;function i(t){return Cb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Ux(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Gb,t,n)}}var Wx={name:`htmlText`,tokenize:Gx};function Gx(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):gb(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):gb(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Cb(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Cb(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Cb(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Cb(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return gb(t)?(e.consume(t),S):n(t)}function S(t){return t===45||_b(t)?(e.consume(t),S):C(t)}function C(t){return Cb(t)?(o=C,N(t)):Tb(t)?(e.consume(t),C):M(t)}function w(t){return t===45||_b(t)?(e.consume(t),w):t===47||t===62||wb(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||gb(t)?(e.consume(t),E):Cb(t)?(o=T,N(t)):Tb(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||_b(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Cb(t)?(o=D,N(t)):Tb(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Cb(t)?(o=O,N(t)):Tb(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Cb(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||wb(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||wb(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Tb(t)?Ab(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Kx={name:`labelEnd`,resolveAll:Xx,resolveTo:Zx,tokenize:Qx},qx={tokenize:$x},Jx={tokenize:eS},Yx={tokenize:tS};function Xx(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&cb(e,0,e.length,n),e}function Zx(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=lb(s,e.slice(a+1,a+r+3)),s=lb(s,[[`enter`,u,t]]),s=lb(s,Rb(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=lb(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=lb(s,e.slice(o+1)),s=lb(s,[[`exit`,c,t]]),cb(e,a,e.length,s),e}function Qx(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(hb(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(qx,u,o?u:d)(t):t===91?e.attempt(Jx,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Yx,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function $x(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return wb(t)?Tx(e,a)(t):a(t)}function a(t){return t===41?u(t):Sx(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return wb(t)?Tx(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?wx(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return wb(t)?Tx(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function eS(e,t,n){let r=this;return i;function i(t){return Cx.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(hb(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function tS(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var nS={name:`labelStartImage`,resolveAll:Kx.resolveAll,tokenize:rS};function rS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var iS={name:`labelStartLink`,resolveAll:Kx.resolveAll,tokenize:aS};function aS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var oS={name:`lineEnding`,tokenize:sS};function sS(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Ab(e,t,`linePrefix`)}}var cS={name:`thematicBreak`,tokenize:lS};function lS(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Cb(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Tb(t)?Ab(e,s,`whitespace`)(t):s(t))}}var uS={continuation:{tokenize:mS},exit:gS,name:`list`,tokenize:pS},dS={partial:!0,tokenize:_S},fS={partial:!0,tokenize:hS};function pS(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:bb(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(cS,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return bb(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Gb,r.interrupt?n:u,e.attempt(dS,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Tb(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function mS(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Gb,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ab(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Tb(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(fS,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ab(e,e.attempt(uS,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function hS(e,t,n){let r=this;return Ab(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function gS(e){e.exit(this.containerState.type)}function _S(e,t,n){let r=this;return Ab(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Tb(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var vS={name:`setextUnderline`,resolveTo:yS,tokenize:bS};function yS(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function bS(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Tb(t)?Ab(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Cb(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var xS={tokenize:SS};function SS(e){let t=this,n=e.attempt(Gb,r,e.attempt(this.parser.constructs.flowInitial,i,Ab(e,e.attempt(this.parser.constructs.flow,i,e.attempt(_x,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var CS={resolveAll:DS()},wS=ES(`string`),TS=ES(`text`);function ES(e){return{resolveAll:DS(e===`text`?OS:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function DS(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function OS(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var kS=c({attentionMarkers:()=>LS,contentInitial:()=>jS,disable:()=>RS,document:()=>AS,flow:()=>NS,flowInitial:()=>MS,insideSpan:()=>IS,string:()=>PS,text:()=>FS}),AS={42:uS,43:uS,45:uS,48:uS,49:uS,50:uS,51:uS,52:uS,53:uS,54:uS,55:uS,56:uS,57:uS,62:qb},jS={91:Ex},MS={[-2]:ax,[-1]:ax,32:ax},NS={35:Mx,42:cS,45:[vS,cS],60:Lx,61:vS,95:cS,96:nx,126:nx},PS={38:$b,92:Zb},FS={[-5]:oS,[-4]:oS,[-3]:oS,33:nS,38:$b,42:zb,60:[Ub,Wx],91:iS,92:[Ax,Zb],93:Kx,95:zb,96:lx},IS={null:[zb,CS]},LS={null:[42,95]},RS={null:[]};function zS(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=lb(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Rb(a,l.events,l),l.events):[]}function f(e,t){return VS(p(e),t)}function p(e){return BS(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Cb(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&cb(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function BS(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function VS(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
22
22
  `;break;case-3:o=`\r
23
23
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function HS(e){let t={constructs:db([kS,...(e||{}).extensions||[]]),content:n(jb),defined:[],document:n(Nb),flow:n(xS),lazy:{},string:n(wS),text:n(TS)};return t;function n(e){return n;function n(n){return zS(t,e,n)}}}function US(e){for(;!hx(e););return e}var WS=/[\0\t\n\r]/g;function GS(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(WS.lastIndex=u,c=WS.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var KS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qS(e){return e.replace(KS,JS)}function JS(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return mb(n.slice(t?2:1),t?16:10)}return sb(n)||e}var YS={}.hasOwnProperty;function XS(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),ZS(n)(US(HS(n).document().write(GS()(e,t,!0))))}function ZS(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(de),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(se),blockQuote:a(re),characterEscape:T,characterReference:T,codeFenced:a(ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ie,o),codeText:a(ae,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(U),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(oe),hardBreakEscape:a(ce),hardBreakTrailing:a(ce),htmlFlow:a(le,o),htmlFlowData:T,htmlText:a(le,o),htmlTextData:T,image:a(ue),label:o,link:a(de),listItem:a(pe),listItemValue:f,listOrdered:a(fe,d),listUnordered:a(fe),paragraph:a(me),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(se),strong:a(he),thematicBreak:a(_e)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:H,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:B,characterReferenceMarkerNumeric:B,characterReferenceValue:te,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:ee,resourceTitleString:I,resource:L,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};$S(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];YS.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||tC).call(a,void 0,e[0])}for(r.position={start:QS(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:QS(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:QS(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||tC).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+by({start:e.start,end:e.end})+`): it’s not open`);n.position.end=QS(e.end)}function u(){return nb(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=hb(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ge(),n.position={start:QS(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=QS(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=QS(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=qS(t),n.identifier=hb(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function L(){this.data.inReference=void 0}function R(){this.data.referenceType=`collapsed`}function z(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=hb(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function B(e){this.data.characterReferenceType=e.type}function te(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=mb(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=sb(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=QS(e.end)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function H(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function re(){return{type:`blockquote`,children:[]}}function ie(){return{type:`code`,lang:null,meta:null,value:``}}function ae(){return{type:`inlineCode`,value:``}}function U(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function oe(){return{type:`emphasis`,children:[]}}function se(){return{type:`heading`,depth:0,children:[]}}function ce(){return{type:`break`}}function le(){return{type:`html`,value:``}}function ue(){return{type:`image`,title:null,url:``,alt:null}}function de(){return{type:`link`,title:null,url:``,children:[]}}function fe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function pe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function me(){return{type:`paragraph`,children:[]}}function he(){return{type:`strong`,children:[]}}function ge(){return{type:`text`,value:``}}function _e(){return{type:`thematicBreak`}}}function QS(e){return{line:e.line,column:e.column,offset:e.offset}}function $S(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?$S(e,r):eC(e,r)}}function eC(e,t){let n;for(n in t)if(YS.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function tC(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+by({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+by({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+by({start:t.start,end:t.end})+`) is still open`)}function nC(e){let t=this;t.parser=n;function n(n){return XS(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function rC(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function iC(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
@@ -303,4 +303,4 @@ ${s.join(`
303
303
  active:scale-95 transition-all duration-75
304
304
  select-none touch-manipulation
305
305
  ${r?fq[t.status]:dq[t.status]}
306
- `,onClick:()=>{pq(),d(t.id)},title:pt?t.name:void 0,children:i},t.id)})})]}),(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`div`,{ref:ke,className:`absolute inset-0`,style:{backgroundColor:T.background}}),Le&&e&&(0,k.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,k.jsx)(Xe,{width:G.pill,height:G.pill,className:`animate-spin`}),`Loading`]}),ze&&e&&(0,k.jsxs)(`div`,{className:`absolute ${F&&!L?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:hidden`,children:[(0,k.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,k.jsxs)(`button`,{type:`button`,onClick:Be,className:`relative flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,k.jsx)(ie,{width:G.default,height:G.default}),`Copy`]}),(0,k.jsx)(`button`,{type:`button`,onClick:Ve,className:`relative flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,k.jsx)(Ye,{width:G.default,height:G.default})})]}),!e&&(0,k.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:r?null:`Select a session to view terminal`}),e&&Se&&(0,k.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),r&&(0,k.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,k.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,k.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,k.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,k.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:we}),(0,k.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),Te&&(0,k.jsx)(`span`,{className:`text-muted`,children:Te}),(0,k.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Ee]})]}),r.lastResumeError&&(0,k.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${r.lastResumeError}`,children:[(0,k.jsx)(I,{width:G.pill,height:G.pill}),`Last wake failed`]}),r.lastUserMessage&&(0,k.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:r.lastUserMessage})]}),(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>_(r.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),b&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>b(r.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,k.jsx)(RO,{session:r})]})}),Ne&&e&&!L?(0,k.jsxs)(`button`,{type:`button`,onClick:He,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:hidden ${Nt}`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,k.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,k.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):F&&e&&!L?(0,k.jsxs)(`button`,{type:`button`,onClick:He,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all md:hidden ${Nt}`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,k.jsx)(R,{width:G.primary,height:G.primary}),(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,k.jsx)(JK,{...lt}),(0,k.jsx)(yK,{session:e,hibernatingSession:r,hibernatingDisplayName:we,showHostBadge:Oe,sessionCount:t.length,connectionStatus:o,isSwitching:Le,canControl:Ce,canHibernate:De,modDisplay:M,onKill:()=>te(!0),onHibernate:Je,onWake:()=>r&&_(r.sessionId),onRename:t=>{let n=e?.id??r?.sessionId;n&&h(n,t)},onDuplicate:e&&g?()=>g(e.id):void 0,onMoveToHistory:r&&b?()=>b(r.sessionId):void 0,isTmuxCopyMode:Ne,showJumpToBottom:F&&!L,onJumpToBottom:He,selectionReady:!!ze,onCopySelection:Be,onDismissSelection:Ve}),e&&(0,k.jsx)(lq,{onSendKey:at,onPasteText:ot,onPasteImage:st,disabled:o!==`connected`||Se||!Re,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!ve,onSelectSession:d,hideSessionSwitcher:!0,onRefocus:ct,isKeyboardVisible:ft,onEnterTextMode:dt}),(P||N)&&(0,k.jsx)(uq,{isOpen:H,onClose:()=>re(!1),sessions:n??t,hibernatingSessions:i,historySessions:a,selectedSessionId:e?.id??null,selectedHibernatingSessionId:r?.sessionId??null,onSelect:d,onSelectHibernating:f,onRename:h,onResume:_,onHibernate:v,onMoveToHistory:b,onNewSession:p,onOpenHistory:S,subscribe:l,loading:C,error:w}),B&&e&&(0,k.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,k.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,k.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,k.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,k.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,k.jsx)(`button`,{onClick:()=>te(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,k.jsx)(`button`,{ref:he,onClick:qe,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function hq({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,y.useState)(n||`~`),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!0),[d,f]=(0,y.useState)(-1),p=(0,y.useRef)(null),m=W(e=>e.recentPaths),h=(0,y.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,y.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,y.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,k.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,k.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,k.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,k.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,k.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,k.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,k.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,k.jsx)(`p`,{className:`text-danger`,children:s}),(0,k.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,k.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,k.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,k.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,k.jsx)(ye,{width:G.default,height:G.default,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,k.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,k.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,k.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,k.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,k.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,k.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function gq(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function _q(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?gq(o):null}function vq(e){return e?e===`claude-rp`?`claude`:e:null}function yq(e){let t=e.trim();if(!t)return``;let n=gq(t);return _q(n)??n}function bq(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function xq(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:bq(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function Sq(e){let t=yq(e);if(t)return xq(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var Cq={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},wq={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function Tq(e){let t=vq(e);return t?Cq[t]:null}function Eq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Dq(e){return RegExp(`(^|\\s)${Eq(e)}(?=\\s|$)`,`g`)}function Oq(e,t){return(t?[vq(t)].filter(e=>e!==null):Object.keys(wq)).some(t=>wq[t].some(t=>Dq(t).test(e)))}function kq(e,t){let n=xq(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function Aq(e,t){let n=Tq(t);if(!n)return e;let r=e.trim();if(!r||Oq(r,t))return r;let i=kq(r,n);if(i)return i;let a=yq(r);if(a&&a!==r){let e=kq(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function jq(e,t){let n=vq(t);if(!n||Oq(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function Mq(e,t){let n=vq(t);if(!n)return e;let r=e;for(let e of wq[n])r=r.replace(Dq(e),` `);return r.replace(/\s+/g,` `).trim()}function Nq({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(``),E=W(e=>e.yoloMode),D=W(e=>e.setYoloMode),O=(0,y.useRef)(null),A=(0,y.useRef)(null),j=(0,y.useRef)(null),M=(0,y.useRef)(!1),N=l&&c.length>0,P=e=>{if(!E)return e;let t=Sq(e);return t&&!jq(e,t)?Aq(e,t):e},F=e=>{let t=i.find(t=>t.id===e);t&&(v(e),x(P(mt(t))))},ee=()=>{v(null),x(``)};if((0,y.useEffect)(()=>{let t=M.current;if(M.current=e,!e){m(``),g(``),v(null),x(``),C(!1),T(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(t)return;if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let n=f?.trim();if(n){let e=i.find(e=>mt(e)===n);e?(v(e.id),x(mt(e))):(v(null),x(n))}else{let e=i.find(e=>e.id===a);e?(v(a),x(P(mt(e)))):i.length>0?(v(i[0].id),x(P(mt(i[0])))):(v(null),x(``))}setTimeout(()=>{if(j.current?.focus(),A.current){let e=A.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,y.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?ee():F(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let I=_===null,L=w!==``,R=Sq(b),z=Tq(R)!==null,B=R?Oq(b,R):!1,te=R&&!B?jq(b,R):null,V=!z||te!==null,ne=R?R===`pi`?`Pi has no permission prompts — nothing to enable`:te??`Append ${Tq(R)}`:`Enter a supported agent command (claude, codex, grok, devin)`,H=e=>{D(e),R&&x(e?Aq(b,R):Mq(b,R))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=b.trim();n(r,h.trim()||void 0,i||void 0,L?w:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ae=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],U=p.trim()||`~`;return(0,k.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,"data-suspends-terminal":``,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,k.jsxs)(`form`,{ref:O,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,k.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,k.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[N&&(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ae.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,k.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ae.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ae.length)%ae.length;else return;let r=ae[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?I:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,k.jsxs)(`button`,{ref:n?j:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?ee():F(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?ee():F(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,k.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,k.jsx)(Zh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,k.jsx)(`input`,{value:b,onChange:e=>x(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,k.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:ne,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:B,disabled:V,onChange:e=>H(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(`input`,{ref:A,value:p,onChange:e=>m(e.target.value),placeholder:L?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!L&&(0,k.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,k.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,k.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,k.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!L&&(0,k.jsx)(hq,{initialPath:U,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}var Pq=[{id:`new-sessions`,label:`New sessions`},{id:`session-list`,label:`Session list`},{id:`appearance`,label:`Appearance`},{id:`terminal`,label:`Terminal`},{id:`notifications`,label:`Notifications`}];function Fq(e){return Pq.some(t=>t.id===e)}function Iq(e){return Pq.find(t=>t.id===e)?.label??e}var Lq=`agentboard-settings-page`,Rq=`new-sessions`;function zq(){let e=w.getItem(Lq);return Fq(e)?e:Rq}function Bq(e){w.setItem(Lq,e)}var Vq=`h-[32px] max-md:h-[44px]`,Hq=`${Vq} inline-flex shrink-0 items-center justify-center border text-[12px] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,Uq=`${Hq} border-border bg-surface px-3 text-secondary hover:bg-hover hover:text-primary`,Wq=`${Hq} w-[32px] max-md:w-[44px] border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,Gq=`input ${Vq} px-2 py-0 text-[13px] max-md:text-[16px] focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 aria-[invalid=true]:border-danger`;function Kq(e,t){let[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(null),o=(0,y.useRef)({draft:n,stored:e,commit:t});o.current={draft:n,stored:e,commit:t},(0,y.useEffect)(()=>()=>{let{draft:e,stored:t,commit:n}=o.current;e!==null&&e!==t&&n(e)},[]);let s=()=>{if(n===null)return;if(n===e){r(null),a(null);return}let i=t(n);if(i){a(i);return}r(null),a(null)};return{value:n??e,error:i,dirty:n!==null,onChange:e=>{r(e.target.value),a(null)},onBlur:s,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),s()):e.key===`Escape`&&n!==null&&(e.preventDefault(),r(null),a(null))}}}var qq=(0,y.forwardRef)(function({value:e,onCommit:t,describedBy:n,id:r,className:i,wrapperClassName:a,...o},s){let c=Kq(e,t),l=r?`${r}-error`:void 0,u=[n,c.error?l:void 0].filter(Boolean).join(` `);return(0,k.jsxs)(`div`,{className:b_(`min-w-0`,a),children:[(0,k.jsx)(`input`,{...o,ref:s,id:r,value:c.value,onChange:c.onChange,onBlur:c.onBlur,onKeyDown:c.onKeyDown,"aria-invalid":c.error?!0:void 0,"aria-describedby":u||void 0,className:b_(Gq,i)}),c.error&&(0,k.jsx)(`p`,{id:l,className:b_(`text-[12px] leading-snug text-danger`,`mt-1`),role:`alert`,children:c.error})]})});function Jq(e,t,n){let r=e.trim();return/^-?\d+$/.test(r)?Math.min(n,Math.max(t,Number.parseInt(r,10))):null}function Yq({value:e,min:t,max:n,onChange:r,noun:i,labelledBy:a,describedBy:o}){return(0,k.jsxs)(`div`,{role:`group`,"aria-labelledby":a,"aria-describedby":o,className:`flex items-center`,children:[(0,k.jsx)(`button`,{type:`button`,className:Wq,"aria-label":`Decrease ${i}`,disabled:e<=t,onClick:()=>r(Math.max(t,e-1)),children:(0,k.jsx)(Ne,{width:G.default,height:G.default})}),(0,k.jsx)(`output`,{"aria-live":`polite`,className:b_(Vq,`flex w-10 items-center justify-center border-y border-border bg-base text-[13px] tabular-nums text-primary`),children:e}),(0,k.jsx)(`button`,{type:`button`,className:Wq,"aria-label":`Increase ${i}`,disabled:e>=n,onClick:()=>r(Math.min(n,e+1)),children:(0,k.jsx)(Ue,{width:G.default,height:G.default})})]})}function Xq({id:e,value:t,min:n,max:r,step:i,onChange:a,format:o,labelledBy:s,describedBy:c}){return(0,k.jsxs)(`div`,{className:b_(Vq,`flex items-center gap-3`),children:[(0,k.jsx)(`input`,{id:e,type:`range`,min:n,max:r,step:i,value:t,"aria-labelledby":s,"aria-describedby":c,"aria-valuetext":o(t),onChange:e=>{let t=Number.parseFloat(e.target.value);Number.isFinite(t)&&a(Math.min(r,Math.max(n,t)))},className:`h-1 w-28 max-md:w-36 cursor-pointer appearance-none bg-border accent-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,k.jsx)(`span`,{className:`w-10 text-right text-[13px] tabular-nums text-secondary`,children:o(t)})]})}function Zq({options:e,value:t,onChange:n,labelledBy:r,describedBy:i,fill:a=!1}){let o=(0,y.useRef)([]),s=Math.max(0,e.findIndex(e=>e.value===t)),c=t=>{let r=e[t];r&&(n(r.value),o.current[t]?.focus())},l=(t,n)=>{let r=e.length-1,i=null;t.key===`ArrowRight`||t.key===`ArrowDown`?i=n===r?0:n+1:t.key===`ArrowLeft`||t.key===`ArrowUp`?i=n===0?r:n-1:t.key===`Home`?i=0:t.key===`End`&&(i=r),i!==null&&(t.preventDefault(),c(i))};return(0,k.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":r,"aria-describedby":i,className:b_(`flex border border-border bg-base p-[2px]`,a?`w-full`:`w-max max-w-full`),children:e.map((e,t)=>{let n=t===s;return(0,k.jsx)(`button`,{ref:e=>{o.current[t]=e},type:`button`,role:`radio`,"aria-checked":n,tabIndex:n?0:-1,onClick:()=>c(t),onKeyDown:e=>l(e,t),className:b_(`h-[26px] max-md:h-[38px] min-w-0 whitespace-nowrap px-3 text-[12px] transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a&&`flex-1`,n?`bg-hover text-primary shadow-[inset_0_0_0_1px_var(--border)]`:`text-muted hover:text-primary`),children:e.label},e.value)})})}function Qq({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],value:ZG(e=>e.theme),onChange:ZG(e=>e.setTheme),labelledBy:e.label,describedBy:e.description})}function $q({ids:e}){let t=W(e=>e.fontOption),n=W(e=>e.setFontOption);return(0,k.jsx)(`select`,{id:e.control,value:t,"aria-describedby":e.description,onChange:e=>n(e.target.value),className:`${Gq} w-44 max-md:w-full`,children:lt.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))})}function eJ({ids:e}){let t=W(e=>e.customFontFamily);return(0,k.jsx)(qq,{id:e.control,value:t,placeholder:`"Fira Code", monospace`,describedBy:e.description,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:256,wrapperClassName:`w-60 max-md:w-full`,onCommit:e=>(W.getState().setCustomFontFamily(e.trim()),null)})}function tJ({ids:e}){return(0,k.jsx)(Yq,{value:W(e=>e.fontSize),min:6,max:24,onChange:W(e=>e.setFontSize),noun:`font size`,labelledBy:e.label,describedBy:e.description})}function nJ({ids:e}){let t=W(e=>e.lineHeight),n=W(e=>e.setLineHeight);return(0,k.jsx)(Xq,{id:e.control,value:t,min:1,max:2,step:.1,onChange:e=>n(Math.round(e*10)/10),format:e=>e.toFixed(1),labelledBy:e.label,describedBy:e.description})}function rJ({ids:e}){let t=W(e=>e.letterSpacing),n=W(e=>e.setLetterSpacing);return(0,k.jsx)(Xq,{id:e.control,value:t,min:-3,max:3,step:1,onChange:e=>n(Math.round(e)),format:e=>`${e}px`,labelledBy:e.label,describedBy:e.description})}var iJ=[{id:`theme`,page:`appearance`,label:`Theme`,description:`Light, dark, or follow the system setting.`,keywords:[`dark mode`,`light mode`,`color`,`colour`,`system`],Control:Qq},{id:`font-family`,page:`appearance`,label:`Font family`,description:`Terminal typeface. Default JetBrains Mono.`,keywords:[`font`,`typeface`,`monospace`],tags:[`device`],Control:$q},{id:`custom-font-family`,page:`appearance`,label:`Custom font family`,description:`A CSS font-family list. Empty falls back to JetBrains Mono.`,keywords:[`font`,`typeface`,`css`],tags:[`device`],layout:`wide`,visibleWhen:e=>e.fontOption===`custom`,Control:eJ},{id:`font-size`,page:`appearance`,label:`Font size`,description:`Terminal text size in pixels (6–24). Default 13.`,keywords:[`font`,`text`,`zoom`,`size`],tags:[`device`],Control:tJ},{id:`line-height`,page:`appearance`,label:`Line height`,description:`Vertical spacing, 1.0 compact to 2.0 spacious. Default 1.0.`,keywords:[`spacing`,`leading`,`line`],tags:[`device`],Control:nJ},{id:`letter-spacing`,page:`appearance`,label:`Letter spacing`,description:`Extra space between characters in pixels (−3 to 3). Default 0.`,keywords:[`spacing`,`tracking`,`kerning`],tags:[`device`],Control:rJ}],aJ=1024,oJ=[{value:``,label:`Terminal`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`},{value:`pi`,label:`Pi`},{value:`devin`,label:`Devin`},{value:`grok`,label:`Grok`},{value:`omp`,label:`OMP`}];function sJ(e,t){let n=t.trim();return e===`label`?n?n.length>64?`Name is at most 64 characters`:null:`Name is required`:n?n.length>1024?`Command is at most ${aJ} characters`:null:`Command is required`}function cJ(e){return sJ(`label`,e.label)===null&&sJ(`command`,e.command)===null}function lJ(e,t,n){return e.map(e=>e.id===t?pt({...e,...n}):e)}var uJ=`grid items-start gap-2 grid-cols-[56px_92px_minmax(0,0.8fr)_minmax(0,1.3fr)_auto] max-md:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] max-md:gap-y-2`,dJ=4e3;function fJ({preset:e,index:t,isDefault:n,pending:r=!1,autoFocusName:i=!1,onSetDefault:a,onCommitField:o,onIconChange:s,onDelete:c}){let[l,u]=(0,y.useState)(!1),d=(0,y.useRef)(null),f=`settings-preset-${e.id}`,p=e.label.trim()||`preset ${t+1}`;return(0,y.useEffect)(()=>{i&&d.current?.focus()},[i]),(0,y.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>u(!1),dJ);return()=>clearTimeout(e)},[l]),(0,k.jsxs)(`div`,{role:`listitem`,"data-preset-id":e.id,className:b_(uJ,`py-2`),children:[(0,k.jsxs)(`label`,{className:b_(Vq,`flex cursor-pointer items-center gap-2 md:justify-center`),children:[(0,k.jsx)(`input`,{type:`radio`,name:`settings-default-preset`,checked:n,disabled:r,onChange:a,"aria-label":`Default preset: ${p}`,className:`size-4 cursor-pointer accent-accent disabled:cursor-not-allowed`}),(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`text-[12px] text-secondary md:hidden`,children:`Default`})]}),e.isBuiltIn?(0,k.jsxs)(`div`,{className:b_(Vq,`flex items-center gap-2 text-muted`),children:[(0,k.jsx)(Zh,{agentType:e.agentType,command:e.command,className:`size-4`}),(0,k.jsx)(`span`,{className:`text-[11px]`,children:`Built-in`})]}):(0,k.jsx)(`select`,{id:`${f}-icon`,value:e.agentType??``,"aria-label":`Icon for ${p}`,onChange:e=>s(e.target.value||void 0),className:b_(Gq,`w-full px-1`),children:oJ.map(e=>(0,k.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,k.jsx)(qq,{ref:d,id:`${f}-label`,value:e.label,placeholder:`Name`,"aria-label":`Name of preset ${t+1}`,maxLength:64,onCommit:e=>o(`label`,e),wrapperClassName:`max-md:order-4 max-md:col-span-3`}),(0,k.jsx)(qq,{id:`${f}-command`,value:e.command,placeholder:`command --flags`,"aria-label":`Command for ${p}`,maxLength:aJ,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,onCommit:e=>o(`command`,e),wrapperClassName:`max-md:order-5 max-md:col-span-3`}),e.isBuiltIn?(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`w-[32px] max-md:order-3 max-md:w-[44px]`}):(0,k.jsx)(`button`,{type:`button`,onClick:()=>{if(r||l){c();return}u(!0)},onPointerDown:r?e=>e.preventDefault():void 0,onBlur:()=>u(!1),"aria-label":l?`Confirm delete ${p}`:r?`Discard new preset`:`Delete ${p}`,title:l?`Click again to delete`:void 0,className:b_(Hq,`max-md:order-3`,l?`border-danger bg-danger/10 px-2 text-danger hover:bg-danger/20`:`w-[32px] border-border bg-surface text-secondary hover:bg-hover hover:text-danger max-md:w-[44px]`),children:l?`Delete?`:(0,k.jsx)(le,{width:G.default,height:G.default})})]})}function pJ({ids:e}){let t=W(e=>e.commandPresets),n=W(e=>e.defaultPresetId),[r,i]=(0,y.useState)(null),a=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useRef)(!1);(0,y.useEffect)(()=>{if(!s.current)return;s.current=!1;let e=o.current;if(e&&!e.disabled){e.focus();return}let t=a.current?.id;t&&typeof document<`u`&&document.getElementById(`settings-preset-${t}-label`)?.focus()});let c=e=>{a.current=e,i(e)},l=!r&&t.length<50,u=r?[...t,r]:t,d=(e,t,n)=>{let r=sJ(t,n);if(r)return r;let{commandPresets:i,setCommandPresets:a}=W.getState();return a(lJ(i,e,{[t]:n})),null},f=(e,t)=>{let n=a.current;if(!n)return null;let r={...n,[e]:t},{commandPresets:i,setCommandPresets:o}=W.getState();return cJ(r)&&i.length<50?(o([...i,pt(r)]),c(null)):c(r),null},p=(e,t)=>{if(r?.id===e){c({...r,agentType:t});return}let{commandPresets:n,setCommandPresets:i}=W.getState();i(lJ(n,e,{agentType:t}))},m=()=>{l&&c({id:ht(new Set(t.map(e=>e.id))),label:``,command:``,isBuiltIn:!1})},h=e=>{s.current=!0,a.current?.id===e?c(null):W.getState().removePreset(e)};return(0,k.jsxs)(`div`,{className:`w-full min-w-0`,children:[(0,k.jsxs)(`div`,{"aria-hidden":`true`,className:b_(uJ,`border-b border-border pb-1 text-[11px] uppercase tracking-wide text-muted max-md:hidden`),children:[(0,k.jsx)(`span`,{className:`text-center`,children:`Default`}),(0,k.jsx)(`span`,{children:`Icon`}),(0,k.jsx)(`span`,{children:`Name`}),(0,k.jsx)(`span`,{children:`Command`}),(0,k.jsx)(`span`,{className:`w-[32px]`})]}),(0,k.jsx)(`div`,{role:`list`,"aria-labelledby":e.label,"aria-describedby":e.description,className:`divide-y divide-border-subtle`,children:u.map((e,t)=>{let i=e.id===r?.id;return(0,k.jsx)(fJ,{preset:e,index:t,isDefault:e.id===n,pending:i,autoFocusName:i,onSetDefault:()=>W.getState().setDefaultPresetId(e.id),onCommitField:(t,n)=>i?f(t,n):d(e.id,t,n),onIconChange:t=>p(e.id,t),onDelete:()=>h(e.id)},e.id)})}),r&&(0,k.jsx)(`p`,{className:b_(`text-[12px] leading-snug text-muted`,`pb-2`),role:`status`,children:`Enter a name and a command to add the preset.`}),(0,k.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,k.jsxs)(`button`,{ref:o,type:`button`,className:Uq,onClick:m,disabled:!l,children:[(0,k.jsx)(Ue,{width:G.default,height:G.default,className:`mr-1.5`}),`Add preset`]}),t.length>=50&&(0,k.jsxs)(`span`,{className:`text-[12px] leading-snug text-muted`,children:[`Maximum of `,50,` presets.`]})]})]})}function mJ({ids:e}){let t=W(e=>e.defaultProjectDir);return(0,k.jsx)(qq,{id:e.control,value:t,placeholder:ot,describedBy:e.description,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:4096,wrapperClassName:`w-72 max-md:w-full`,onCommit:e=>(W.getState().setDefaultProjectDir(e.trim()||`~/Documents/GitHub`),null)})}var hJ=[{id:`default-project-dir`,page:`new-sessions`,label:`Default project directory`,description:`Folder the new session dialog starts in. Default ${ot}.`,keywords:[`path`,`folder`,`cwd`,`directory`],layout:`wide`,Control:mJ},{id:`command-presets`,page:`new-sessions`,label:`Command presets`,description:`Commands offered when creating a session. The default preset is pre-selected.`,keywords:[`preset`,`command`,`agent`,`claude`,`codex`,`default`,`icon`],layout:`block`,Control:pJ}],gJ=null,_J=!1,vJ={},yJ=500;function bJ(){if(typeof window>`u`)return null;if(gJ?.state===`closed`&&(gJ=null),!gJ){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;gJ=new e}return gJ}function xJ(){gJ&&=(gJ.close().catch(()=>{}),null),bJ()}function SJ(){return _J}function CJ(){gJ&&(xJ(),_J=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&CJ()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&CJ()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&CJ(),e=t},5e3)}async function wJ(){let e=bJ();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),_J=!1}async function TJ(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function EJ(e){let t=bJ();if(!t||(await TJ(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function DJ(){let e=Date.now();if(!(e-(vJ.permission||0)<yJ)){vJ.permission=e;try{await EJ({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function OJ(){let e=Date.now();if(!(e-(vJ.idle||0)<yJ)){vJ.idle=e;try{await EJ({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function kJ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=y.useRef(e!==void 0),[a,o]=y.useState(t);return[i?e:a,y.useCallback(e=>{i||o(e)},[])]}var AJ={};function jJ(e,t){let n=y.useRef(AJ);return n.current===AJ&&(n.current=e(t)),n}var MJ=y[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],NJ=MJ&&MJ!==y.useLayoutEffect?MJ:e=>e();function PJ(e){let t=jJ(FJ).current;return t.next=e,NJ(t.effect),t.trampoline}function FJ(){let e={next:void 0,callback:IJ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function IJ(){}function LJ(e,t,n,r){let i=jJ(zJ).current;return BJ(i,e,t,n,r)&&HJ(i,[e,t,n,r]),i.callback}function RJ(e){let t=jJ(zJ).current;return VJ(t,e)&&HJ(t,e),t.callback}function zJ(){return{callback:null,cleanup:null,refs:[]}}function BJ(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function VJ(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function HJ(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var UJ=typeof document<`u`?y.useLayoutEffect:()=>{},WJ={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},GJ={...WJ,position:`fixed`,top:0,left:0},KJ={...WJ,position:`absolute`};function qJ(){}Object.freeze([]);var JJ=Object.freeze({});function YJ(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var XJ=18;function ZJ(e){return XJ>=e}function QJ(e){if(!y.isValidElement(e))return null;let t=e,n=t.props;return(ZJ(19)?n?.ref:t.ref)??null}function $J(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function eY(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function tY(e,t){return typeof e==`function`?e(t):e}function nY(e,t){return typeof e==`function`?e(t):e}var rY={};function iY(e,t,n,r,i){let a={...uY(e,rY)};return t&&(a=oY(a,t)),n&&(a=oY(a,n)),r&&(a=oY(a,r)),i&&(a=oY(a,i)),a}function aY(e){if(e.length===0)return rY;if(e.length===1)return uY(e[0],rY);let t={...uY(e[0],rY)};for(let n=1;n<e.length;n+=1)t=oY(t,e[n]);return t}function oY(e,t){return lY(t)?t(e):sY(e,t)}function sY(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=$J(e.style,r);break;case`className`:e[n]=pY(e.className,r);break;default:cY(n,r)?e[n]=dY(e[n],r):e[n]=r}}return e}function cY(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function lY(e){return typeof e==`function`}function uY(e,t){return lY(e)?e(t):e??rY}function dY(e,t){return t?e?n=>{if(mY(n)){let r=n;fY(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function fY(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function pY(e,t){return t?e?t+` `+e:t:e}function mY(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function hY(e,t,n={}){let r=t.render,i=gY(t,n);return n.enabled===!1?null:vY(e,r,i,n.state??JJ)}function gY(e,t={}){let{className:n,style:r,render:i}=e,{state:a=JJ,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?tY(n,a):void 0,d=l?nY(r,a):void 0,f=l?eY(a,c):JJ,p=l?$J(f,Array.isArray(s)?aY(s):s)??JJ:JJ;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=RJ([p.ref,QJ(i),...o]):p.ref=LJ(p.ref,QJ(i),o):LJ(null,null)),l?(u!==void 0&&(p.className=pY(p.className,u)),d!==void 0&&(p.style=$J(p.style,d)),p):JJ}var _Y=Symbol.for(`react.lazy`);function vY(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=iY(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===_Y&&(i=y.Children.toArray(t)[0]),y.cloneElement(i,e)}if(e&&typeof e==`string`)return yY(e,n);throw Error(YJ(8))}function yY(e,t){return e===`button`?(0,y.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,y.createElement)(`img`,{alt:``,...t,key:t.key}):y.createElement(e,t)}var bY={...y},xY=0;function SY(e,t=`mui`){let[n,r]=y.useState(e),i=e||n;return y.useEffect(()=>{n??(xY+=1,r(`${t}-${xY}`))},[n,t]),i}var CY=bY.useId;function wY(e,t){if(CY!==void 0){let n=CY();return e??(t?`${t}-${n}`:n)}return SY(e,t)}function TY(e){return wY(e,`base-ui`)}function EY(){return typeof window<`u`}function DY(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function OY(e){return EY()?e instanceof Element||e instanceof DY(e).Element:!1}function kY(e){return EY()?e instanceof HTMLElement||e instanceof DY(e).HTMLElement:!1}function AY(e){return!EY()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof DY(e).ShadowRoot}var jY=y.createContext(void 0);function MY(e=!1){let t=y.useContext(jY);if(t===void 0&&!e)throw Error(YJ(16));return t}function NY(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:y.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function PY(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=y.useRef(null),o=MY(!0)!==void 0,s=PJ(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=NY({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=y.useCallback(()=>{let e=a.current;FY(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return UJ(l,[l]),{getButtonProps:y.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return iY({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(fY(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(fY(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:PJ(e=>{a.current=e,l()})}}function FY(e){return kY(e)&&e.tagName===`BUTTON`}var IY=y.createContext(void 0);function LY(){let e=y.useContext(IY);if(e===void 0)throw Error(YJ(63));return e}var RY=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),zY={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},BY={valid(e){return e===null?null:e?{[RY.valid]:``}:{[RY.invalid]:``}}},VY=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),HY={...BY,checked(e){return e?{[VY.checked]:``}:{[VY.unchecked]:``}}};function UY(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var WY=y.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:qJ,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function GY(){return y.useContext(WY)}var KY=y.createContext({invalid:void 0,name:void 0,validityData:{state:zY,errors:[],error:``,value:``,initialValue:null},setValidityData:qJ,disabled:void 0,touched:!1,setTouched:qJ,dirty:!1,setDirty:qJ,filled:!1,setFilled:qJ,focused:!1,setFocused:qJ,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=JJ)=>e,getInputValidationProps:(e=JJ)=>e,inputRef:{current:null},commit:async()=>{}}});function qY(e=!0){let t=y.useContext(KY);if(t.setValidityData===qJ&&!e)throw Error(YJ(28));return t}function JY(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=GY(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=qY(),f=PJ(e.getValue);UJ(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),UJ(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:UY(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?Qd.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),UJ(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var YY=y.createContext({controlId:void 0,registerControlId:qJ,labelId:void 0,setLabelId:qJ,messageIds:[],setMessageIds:qJ,getDescriptionProps:e=>e});function XY(){return y.useContext(YY)}function ZY(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=XY(),o=TY(t),s=n?i:void 0,c=jJ(()=>Symbol(`labelable-control`)),l=y.useRef(!1),u=y.useRef(t!=null),d=PJ(()=>{!l.current||a===qJ||(l.current=!1,a(c.current,void 0))});return UJ(()=>{if(a===qJ)return;let e;if(n){let n=r?.current;e=OY(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),y.useEffect(()=>d,[d]),i??o}var QY=`none`;function $Y(e,t,n,r){let i=!1,a=!1,o=r??JJ;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function eX(e,t){let n=y.useRef(e),r=PJ(t);UJ(()=>{n.current!==e&&r(n.current)},[e,r]),UJ(()=>{n.current=e},[e])}var tX=y.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=GY(),{state:v,setTouched:b,setDirty:x,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:A}=qY(),{labelId:j}=XY(),M=D||f,N=O??s,P=PJ(l),F=y.useRef(null),ee=LJ(F,o,A.inputRef),I=y.useRef(null),L=TY(),R=ZY({id:a,implicit:!1,controlRef:I}),z=c?void 0:R,[B,te]=kJ({controlled:n,default:!!i,name:`Switch`,state:`checked`});JY({id:L,commit:A.commit,value:B,controlRef:I,name:N,getValue:()=>B}),UJ(()=>{F.current&&C(F.current.checked)},[F,C]),eX(B,()=>{_(N),x(B!==S.initialValue),C(B),T()?A.commit(B):A.commit(B,!0)});let{getButtonProps:V,buttonRef:ne}=PY({disabled:M,native:c}),H={id:c?R:L,role:`switch`,"aria-checked":B,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":j,onFocus(){M||w(!0)},onBlur(){let e=F.current;!e||M||(b(!0),w(!1),E===`onBlur`&&A.commit(e.checked))},onClick(e){u||M||(e.preventDefault(),F.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},re=y.useMemo(()=>iY({checked:B,disabled:M,id:z,name:N,required:d,style:N?KJ:GJ,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:ee,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=$Y(QY,e.nativeEvent);P?.(t,n),!n.isCanceled&&te(t)},onFocus(){I.current?.focus()}},A.getInputValidationProps,h===void 0?JJ:{value:h}),[B,M,ee,z,N,P,d,te,A,h]),ie=y.useMemo(()=>({...v,checked:B,disabled:M,readOnly:u,required:d}),[v,B,M,u,d]),ae=hY(`span`,e,{state:ie,ref:[t,I,ne],props:[H,A.getValidationProps,g,V],stateAttributesMapping:HY});return(0,k.jsxs)(IY.Provider,{value:ie,children:[ae,!B&&N&&m!==void 0&&(0,k.jsx)(`input`,{type:`hidden`,name:N,value:m}),(0,k.jsx)(`input`,{...re})]})}),nX=y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=qY(),o=LY();return hY(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:HY,props:i})});function rX({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i,id:a,ariaLabelledBy:o,ariaDescribedBy:s}){return(0,k.jsx)(tX,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,id:a,"aria-labelledby":o,"aria-describedby":s,className:b_(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,k.jsx)(nX,{className:b_(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}function iX(e,t,n,r){return function({ids:i}){let a=W(t=>t[e]),o=W(e=>e[t]);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,className:Uq,"aria-label":`Test ${r}`,onClick:()=>void n(),children:`Test`}),(0,k.jsx)(rX,{className:Nt,id:i.control,checked:a,onCheckedChange:e=>{o(e),e&&wJ()},ariaLabelledBy:i.label,ariaDescribedBy:i.description})]})}}var aX=[{id:`sound-permission`,page:`notifications`,label:`Permission sound`,description:`Play a ping when any session needs permission.`,keywords:[`sound`,`audio`,`alert`,`ping`,`approval`],Control:iX(`soundOnPermission`,`setSoundOnPermission`,DJ,`permission sound`)},{id:`sound-idle`,page:`notifications`,label:`Idle sound`,description:`Play a chime when a session finishes working.`,keywords:[`sound`,`audio`,`alert`,`chime`,`done`,`finished`],Control:iX(`soundOnIdle`,`setSoundOnIdle`,OJ,`idle sound`)}];function oX(e,t,n){let r=`/api/settings/${e}`,[i,a]=(0,y.useState)(n),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(!1),u=(0,y.useRef)(n),d=(0,y.useRef)(Promise.resolve()),f=(0,y.useRef)(0),p=(0,y.useRef)(!0),m=(0,y.useRef)(!1);return(0,y.useEffect)(()=>{p.current=!0;let e=!0;return fetch(r).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(n=>{if(!e)return;let r=n[t];f.current===0&&!m.current&&(u.current=r),m.current||a(r)}).catch(()=>{}).finally(()=>{e&&(l(!0),f.current===0&&s(!1))}),()=>{e=!1,p.current=!1}},[r,t]),{value:i,loading:o,loaded:c,set:(0,y.useCallback)(e=>{m.current=!0,f.current+=1,a(e),s(!0),d.current=d.current.then(()=>fetch(r,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[t]:e})}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status}`);u.current=e}).catch(()=>{p.current&&f.current===1&&a(u.current)}).finally(()=>{--f.current,p.current&&f.current===0&&s(!1)}))},[r,t])}}function sX(e,t){return function({ids:n}){let r=W(t=>t[e]),i=W(e=>e[t]);return(0,k.jsx)(rX,{className:Nt,id:n.control,checked:r,onCheckedChange:i,ariaLabelledBy:n.label,ariaDescribedBy:n.description})}}function cX({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`created`,label:`Created`},{value:`status`,label:`Status`},{value:`manual`,label:`Manual`}],value:W(e=>e.sessionSortMode),onChange:W(e=>e.setSessionSortMode),labelledBy:e.label,describedBy:e.description})}function lX(){let e=W(e=>e.sessionSortMode);return e===`status`?(0,k.jsx)(k.Fragment,{children:`Sessions re-sort by status: waiting, working, unknown.`}):e===`manual`?(0,k.jsx)(k.Fragment,{children:`Drag sessions in the sidebar to reorder them.`}):(0,k.jsx)(k.Fragment,{children:`Sessions stay in the order they were created.`})}function uX({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}],value:W(e=>e.sessionSortDirection),onChange:W(e=>e.setSessionSortDirection),labelledBy:e.label,describedBy:e.description})}function dX({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`top`,label:`Top`},{value:`bottom`,label:`Bottom`}],value:W(e=>e.sidebarAnchor),onChange:W(e=>e.setSidebarAnchor),labelledBy:e.label,describedBy:e.description})}function fX(){return W(e=>e.sidebarAnchor)===`bottom`?(0,k.jsx)(k.Fragment,{children:`The sidebar is mirrored: the first session sits at the bottom, next to the prompt.`}):(0,k.jsx)(k.Fragment,{children:`The first session sits at the top of the sidebar.`})}function pX({ids:e}){let{value:t,loaded:n,set:r}=oX(`history-max-age-hours`,`hours`,24);return(0,k.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,k.jsx)(qq,{id:e.control,type:`text`,inputMode:`numeric`,value:String(t),disabled:!n,describedBy:e.description,wrapperClassName:`w-20`,className:`text-center tabular-nums`,onCommit:e=>{let n=Jq(e,1,168);return n===null?`Enter 1–168`:(n!==t&&r(n),null)}}),(0,k.jsx)(`span`,{className:`flex h-[32px] items-center text-[12px] text-muted max-md:h-[44px]`,children:`hours`})]})}function mX({ids:e}){let{value:t,loaded:n,set:r}=oX(`prefer-window-name`,`enabled`,!1);return(0,k.jsx)(rX,{className:Nt,id:e.control,checked:t,onCheckedChange:r,disabled:!n,ariaLabelledBy:e.label,ariaDescribedBy:e.description})}var hX=[{id:`sort-order`,page:`session-list`,label:`Sort order`,description:`Created keeps creation order, Status re-sorts by status, Manual lets you drag.`,keywords:[`sort`,`order`,`created`,`status`,`manual`,`drag`],layout:`wide`,Description:lX,Control:cX},{id:`sort-direction`,page:`session-list`,label:`Sort direction`,description:`Newest or oldest sessions first.`,keywords:[`sort`,`newest`,`oldest`,`ascending`,`descending`],layout:`wide`,visibleWhen:e=>e.sessionSortMode===`created`,Control:uX},{id:`sidebar-anchor`,page:`session-list`,label:`Sidebar anchor`,description:`Top lists the first session at the top; Bottom mirrors the sidebar.`,keywords:[`sidebar`,`mirror`,`top`,`bottom`],tags:[`desktop`],Description:fX,Control:dX},{id:`show-project-name`,page:`session-list`,label:`Project name`,description:`Show the project folder name under each session.`,keywords:[`folder`,`details`],Control:sX(`showProjectName`,`setShowProjectName`)},{id:`show-last-user-message`,page:`session-list`,label:`Last user message`,description:`Show the most recent prompt next to the project name.`,keywords:[`prompt`,`input`,`details`],Control:sX(`showLastUserMessage`,`setShowLastUserMessage`)},{id:`show-session-id-prefix`,page:`session-list`,label:`Session ID prefix`,description:`Show the first 5 characters of the agent session ID.`,keywords:[`id`,`uuid`,`details`],Control:sX(`showSessionIdPrefix`,`setShowSessionIdPrefix`)},{id:`history-lookback`,page:`session-list`,label:`History lookback`,description:`Show history sessions from the last N hours (1–168), up to the 100 most recent. Default 24.`,keywords:[`history`,`hours`,`age`,`inactive`,`past`],Control:pX},{id:`prefer-window-name`,page:`session-list`,label:`Prefer window names`,description:`Label discovered sessions with their tmux window name instead of the session name.`,keywords:[`tmux`,`window`,`name`,`title`],Control:mX}],gX=`1-9 [ ] N X ,`;function _X({ids:e}){let t=W(e=>e.useWebGL),n=W(e=>e.setUseWebGL);return(0,k.jsx)(rX,{className:Nt,id:e.control,checked:t,onCheckedChange:n,ariaLabelledBy:e.label,ariaDescribedBy:e.description})}function vX(e,t){return function({ids:n}){let{value:r,loaded:i,set:a}=oX(e,`enabled`,t);return(0,k.jsx)(rX,{className:Nt,id:n.control,checked:r,onCheckedChange:a,disabled:!i,ariaLabelledBy:n.label,ariaDescribedBy:n.description})}}var yX=[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`];function bX({ids:e}){let t=W(e=>e.shortcutModifier),n=W(e=>e.setShortcutModifier);return(0,k.jsx)(Zq,{options:yX.map(e=>({value:e,label:e===`auto`?`Auto`:Ct(e)})),value:t,onChange:n,labelledBy:e.label,describedBy:e.description})}function xX(){return(0,k.jsxs)(k.Fragment,{children:[`Shortcuts: `,Ct(xt(W(e=>e.shortcutModifier))),` + `,gX,` (sessions, navigate, new, kill, settings).`]})}var SX=[{id:`webgl`,page:`terminal`,label:`WebGL acceleration`,description:`GPU rendering for better performance. Turn off if text looks fuzzy or flickers (common in Safari).`,keywords:[`gpu`,`renderer`,`canvas`,`blurry`,`performance`],tags:[`device`],Control:_X},{id:`mouse-mode`,page:`terminal`,label:`Mouse mode`,description:`tmux mouse mode for trackpad and scroll wheel support.`,keywords:[`tmux`,`scroll`,`trackpad`,`mouse`],Control:vX(`tmux-mouse-mode`,!0)},{id:`terminal-colors`,page:`terminal`,label:`Terminal colors`,description:`Preserve ANSI colors in terminal output. Hibernate then Wake running agents after changing this.`,keywords:[`ansi`,`color`,`colour`],Control:vX(`terminal-colors`,!0)},{id:`shortcut-modifier`,page:`terminal`,label:`Keyboard shortcut modifier`,description:`Modifier keys for the app shortcuts. Auto picks ⌃⌥ on macOS, ⌃⇧ elsewhere.`,keywords:[`keyboard`,`shortcut`,`hotkey`,`ctrl`,`cmd`,`option`,`shift`],tags:[`desktop`,`device`],layout:`wide`,Description:xX,Control:bX}],CX=[...hJ,...hX,...iJ,...SX,...aX];function wX(e,t=CX){return t.filter(t=>t.page===e)}function TX(e){return[e.label,e.description,...e.keywords??[]].join(` `).toLowerCase()}function EX(e,t=CX){let n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[]:t.filter(e=>{let t=TX(e);return n.every(e=>t.includes(e))})}function DX(e){return Pq.map(t=>({page:t.id,label:t.label,rows:e.filter(e=>e.page===t.id)})).filter(e=>e.rows.length>0)}var OX={desktop:`Desktop`,device:`This device`},kX={desktop:`Only affects the desktop layout`,device:`Stored in this browser only; not synced to other devices`};function AX({tag:e}){return(0,k.jsx)(`span`,{title:kX[e],className:`shrink-0 border border-border px-1 py-px text-[10px] uppercase leading-none tracking-wide text-muted`,children:OX[e]})}function jX(e){let t=`settings-${e}`;return{control:`${t}-control`,label:`${t}-label`,description:`${t}-desc`}}function MX({row:e}){let t=jX(e.id),n=e.layout??`inline`,{Control:r,Description:i}=e;return(0,k.jsxs)(`div`,{"data-setting-row":e.id,className:b_(`flex gap-x-6 gap-y-3 py-4`,n===`block`&&`flex-col`,n===`wide`&&`items-center max-md:flex-col max-md:items-stretch`,n===`inline`&&`items-center`),children:[(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,k.jsx)(`label`,{id:t.label,htmlFor:t.control,className:`text-[14px] leading-snug text-primary`,children:e.label}),e.tags?.map(e=>(0,k.jsx)(AX,{tag:e},e))]}),(0,k.jsx)(`div`,{id:t.description,className:`mt-1 text-[12px] leading-snug text-muted text-pretty`,children:i?(0,k.jsx)(i,{}):e.description})]}),(0,k.jsx)(`div`,{className:b_(`flex min-w-0 items-center gap-2`,n===`inline`?`shrink-0`:`max-w-full`),children:(0,k.jsx)(r,{ids:t})})]})}function NX(e,t){return e.visibleWhen?e.visibleWhen(t):!0}function PX({rows:e}){let t=W(t=>e.map(e=>NX(e,t)?`1`:`0`).join(``));return(0,k.jsx)(`div`,{className:`divide-y divide-border`,children:e.filter((e,n)=>t[n]===`1`).map(e=>(0,k.jsx)(MX,{row:e},e.id))})}function FX({page:e,showTitle:t}){let n=(0,y.useMemo)(()=>wX(e),[e]);return(0,k.jsxs)(`section`,{"aria-labelledby":t?`settings-page-${e}-title`:void 0,children:[t&&(0,k.jsx)(`h3`,{id:`settings-page-${e}-title`,className:`pb-1 text-[18px] font-semibold leading-tight text-primary`,children:Iq(e)}),(0,k.jsx)(PX,{rows:n})]})}function IX({query:e}){let t=(0,y.useMemo)(()=>EX(e),[e]),n=W(e=>t.some(t=>NX(t,e))),r=(0,y.useMemo)(()=>DX(t),[t]);return n?(0,k.jsx)(`div`,{className:`flex flex-col gap-6`,children:r.map(e=>(0,k.jsx)(LX,{label:e.label,rows:e.rows},e.page))}):(0,k.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-1 py-16 text-center`,children:[(0,k.jsxs)(`p`,{className:`text-[14px] text-primary`,children:[`No settings match “`,e.trim(),`”`]}),(0,k.jsx)(`p`,{className:`text-[12px] text-muted`,children:`Try a different word, like “font” or “sound”.`})]})}function LX({label:e,rows:t}){return W(e=>t.some(t=>NX(t,e)))?(0,k.jsxs)(`section`,{"aria-label":e,children:[(0,k.jsx)(`h3`,{className:`border-b border-border pb-1 text-[11px] font-medium uppercase tracking-wider text-muted`,children:e}),(0,k.jsx)(PX,{rows:t})]}):null}function RX(e){return`settings-tab-${e}`}function zX(e,t,n){return e===`ArrowDown`?(t+1)%n:e===`ArrowUp`?(t-1+n)%n:e===`Home`?0:e===`End`?n-1:null}function BX({variant:e,current:t,onSelect:n,panelId:r}){let i=(0,y.useRef)([]),a=Math.max(0,Pq.findIndex(e=>e.id===t)),o=(t,r)=>{let a=zX(t.key,r,Pq.length);a!==null&&(t.preventDefault(),i.current[a]?.focus(),e===`tabs`&&n(Pq[a].id))};return e===`list`?(0,k.jsx)(`nav`,{"aria-label":`Settings pages`,children:(0,k.jsx)(`ul`,{className:`divide-y divide-border border-y border-border`,children:Pq.map((e,t)=>(0,k.jsx)(`li`,{children:(0,k.jsxs)(`button`,{ref:e=>{i.current[t]=e},type:`button`,"data-page-id":e.id,onClick:()=>n(e.id),onKeyDown:e=>o(e,t),className:`flex min-h-[52px] w-full items-center justify-between gap-3 px-4 text-left text-[15px] text-primary active:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[e.label,(0,k.jsx)(V,{width:G.primary,height:G.primary,className:`text-muted`,"aria-hidden":`true`})]})},e.id))})}):(0,k.jsx)(`div`,{role:`tablist`,"aria-orientation":`vertical`,"aria-label":`Settings pages`,className:`flex flex-col gap-px`,children:Pq.map((e,s)=>{let c=e.id===t;return(0,k.jsx)(`button`,{ref:e=>{i.current[s]=e},id:RX(e.id),type:`button`,role:`tab`,"aria-selected":c,"aria-controls":r,tabIndex:s===a?0:-1,onClick:()=>n(e.id),onKeyDown:e=>o(e,s),className:b_(`flex h-[32px] w-full items-center border-l-2 px-3 text-left text-[13px] transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,c?`border-primary bg-hover font-medium text-primary`:`border-transparent text-secondary hover:text-primary`),children:e.label},e.id)})})}var VX=(0,y.forwardRef)(function({value:e,onChange:t,className:n},r){return(0,k.jsxs)(`div`,{className:n,children:[(0,k.jsx)(`label`,{htmlFor:`settings-search`,className:`sr-only`,children:`Search settings`}),(0,k.jsx)(`input`,{ref:r,id:`settings-search`,type:`search`,value:e,placeholder:`Search settings`,autoComplete:`off`,spellCheck:!1,onChange:e=>t(e.target.value),onKeyDown:n=>{n.key===`Escape`&&e&&(n.preventDefault(),t(``))},className:`input h-[32px] px-2 py-0 text-[13px] max-md:h-[44px] max-md:text-[16px] focus-visible:ring-2 focus-visible:ring-accent/40`})]})}),HX=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function UX(e){return Array.from(e.querySelectorAll(HX)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex!==-1)}function WX(e,t,n){if(e.length===0)return null;let r=e[0],i=e[e.length-1],a=t===null?-1:e.indexOf(t);return a===-1?n?i:r:n&&a===0?i:!n&&a===e.length-1?r:null}var GX=`.xterm-helper-textarea`,KX=300,qX=`[data-suspends-terminal]`,JX=null;function YX(e){return!e||typeof document>`u`||e===document.body?null:typeof e.focus==`function`?e:null}function XX(e,t){if(e.isConnected)return e;if(!t)return null;let n=t.replace(/["\\]/g,`\\$&`);return document.querySelector(`button[aria-label="${n}"]`)}function ZX(){(0,y.useEffect)(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;JX&&=(clearTimeout(JX),null);let e=YX(document.activeElement),t=document.querySelector(GX);t&&(t.blur(),t.setAttribute(`disabled`,`true`));let n=e?.getAttribute?.(`aria-label`)??null;return()=>{JX=setTimeout(()=>{if(JX=null,document.querySelector(qX))return;let r=document.querySelector(GX);if(r){r.removeAttribute(`disabled`),r.focus();return}(e&&e!==t?XX(e,n):null)?.focus()},KX)}},[])}function QX(e,t){let n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let t=t=>{if(t.key===`Escape`){if(t.defaultPrevented)return;t.preventDefault(),t.stopPropagation(),n.current();return}if(t.key!==`Tab`)return;let r=e.current;if(!r)return;let i=document.activeElement,a=WX(UX(r),i,t.shiftKey);a&&(t.preventDefault(),a.focus())},r=t=>{let n=e.current,r=t.target;n&&r&&!n.contains(r)&&n.focus()};return document.addEventListener(`keydown`,t),document.addEventListener(`focusin`,r),()=>{document.removeEventListener(`keydown`,t),document.removeEventListener(`focusin`,r)}},[e])}function $X({isOpen:e,onClose:t}){return e?(0,k.jsx)(nZ,{onClose:t}):null}var eZ=`settings-panel`,tZ=`flex shrink-0 items-center justify-center text-secondary transition-colors hover:bg-hover hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`;function nZ({onClose:e}){let t=zh(),[n,r]=(0,y.useState)(()=>t?null:zq()),[i,a]=(0,y.useState)(``),o=(0,y.useRef)(null),s=(0,y.useRef)(null),c=(0,y.useRef)(null),l=(0,y.useRef)(!1),u=(0,y.useRef)(null);ZX(),QX(o,e),(0,y.useEffect)(()=>{t?o.current?.focus():s.current?.focus()},[]),(0,y.useEffect)(()=>{if(t){if(n)c.current?.focus();else if(u.current){let e=o.current?.querySelector(`[data-page-id="${u.current}"]`);u.current=null,e?.focus()}}},[t,n]);let d=e=>{r(e),Bq(e),a(``)},f=i.trim().length>0,p=(0,k.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close settings`,className:b_(tZ,`size-[32px] max-md:size-[44px]`),children:(0,k.jsx)(Ye,{width:G.primary,height:G.primary})});if(t)return(0,k.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-suspends-terminal":``,tabIndex:-1,className:`fixed inset-0 z-50 flex flex-col bg-elevated outline-none`,style:{paddingTop:`env(safe-area-inset-top)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`},children:[(0,k.jsxs)(`header`,{className:`flex h-[52px] shrink-0 items-center gap-1 border-b border-border px-1`,children:[n?(0,k.jsx)(`button`,{ref:c,type:`button`,onClick:()=>{u.current=n,r(null)},"aria-label":`Back to settings`,className:b_(tZ,`size-[44px]`),children:(0,k.jsx)(V,{width:G.primary,height:G.primary,className:`rotate-180`})}):(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`size-[44px] shrink-0`}),(0,k.jsx)(`h2`,{id:`settings-title`,className:`min-w-0 flex-1 truncate text-center text-[16px] font-semibold text-primary`,children:n?Iq(n):`Settings`}),p]}),(0,k.jsx)(`div`,{id:eZ,className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-4`,style:{paddingBottom:`calc(24px + env(safe-area-inset-bottom))`},children:n?(0,k.jsx)(FX,{page:n,showTitle:!1}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(VX,{ref:s,value:i,onChange:a,className:`py-3`}),f?(0,k.jsx)(IX,{query:i}):(0,k.jsx)(`div`,{className:`-mx-4`,children:(0,k.jsx)(BX,{variant:`list`,current:null,onSelect:d})})]})})]});let m=n??zq();return(0,k.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4`,onMouseDown:e=>{l.current=e.target===e.currentTarget},onClick:t=>{l.current&&t.target===t.currentTarget&&e(),l.current=!1},children:(0,k.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-suspends-terminal":``,tabIndex:-1,className:`flex h-[600px] max-h-full w-[760px] max-w-full flex-col border border-border bg-elevated shadow-2xl outline-none`,children:[(0,k.jsxs)(`header`,{className:`flex h-[48px] shrink-0 items-center justify-between border-b border-border pl-5 pr-2`,children:[(0,k.jsx)(`h2`,{id:`settings-title`,className:`text-[13px] font-semibold uppercase tracking-wider text-primary`,children:`Settings`}),p]}),(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex w-[192px] shrink-0 flex-col gap-3 border-r border-border p-3`,children:[(0,k.jsx)(VX,{ref:s,value:i,onChange:a}),(0,k.jsx)(BX,{variant:`tabs`,current:f?null:m,onSelect:d,panelId:eZ})]}),(0,k.jsx)(`div`,{id:eZ,role:f?`region`:`tabpanel`,"aria-label":f?`Search results`:void 0,"aria-labelledby":f?void 0:RX(m),className:`min-w-0 flex-1 overflow-y-auto overflow-x-hidden px-6 py-5`,children:f?(0,k.jsx)(IX,{query:i}):(0,k.jsx)(FX,{page:m,showTitle:!0})})]})]})})}var rZ=[];function iZ(e){y.useEffect(e,rZ)}var aZ=y.createContext(void 0);function oZ(){let e=y.useContext(aZ);if(!e)throw Error(YJ(73));return e}var sZ=Symbol(`NOT_FOUND`);function cZ(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function lZ(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function uZ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var dZ=e=>Array.isArray(e)?e:[e];function fZ(e){let t=Array.isArray(e[0])?e[0]:e;return uZ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function pZ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function mZ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:sZ},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function hZ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return sZ}function i(t,i){r(t)===sZ&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var gZ=(e,t)=>e===t;function _Z(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function vZ(e,t){let{equalityCheck:n=gZ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=_Z(n),o=0,s=r<=1?mZ(a):hZ(r,a);function c(){let t=s.get(arguments);if(t===sZ){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var yZ=class{constructor(e){this.value=e}deref(){return this.value}},bZ=typeof WeakRef<`u`?WeakRef:yZ,xZ=0,SZ=1;function CZ(){return{s:xZ,v:void 0,o:null,p:null}}function wZ(e,t={}){let n=CZ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=CZ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=CZ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===SZ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new bZ(c):c}return s.s=SZ,s.v=c,c}return o.clearCache=()=>{n=CZ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function TZ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),cZ(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=wZ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=dZ(c),p=dZ(u),m=fZ(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=pZ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var EZ=TZ(wZ),DZ=Object.assign((e,t=EZ)=>{lZ(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>DZ}),OZ=TZ({memoize:vZ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),kZ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(YJ(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},AZ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(YJ(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(YJ(2))}u=OZ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},jZ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),MZ=s(((e,t)=>{t.exports=jZ()})),NZ=s((e=>{var t=p(),n=MZ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),PZ=s(((e,t)=>{t.exports=NZ()})),FZ=[],IZ=void 0;function LZ(){return IZ}function RZ(e){FZ.push(e)}var zZ=MZ(),BZ=PZ(),VZ=ZJ(19)?WZ:GZ;function HZ(e,t,n,r,i){return VZ(e,t,n,r,i)}function UZ(e,t,n,r,i){let a=y.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,zZ.useSyncExternalStore)(e.subscribe,a,a)}RZ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,zZ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function WZ(e,t,n,r,i){let a=LZ();if(!a)return UZ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function GZ(e,t,n,r,i){return(0,BZ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var KZ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return HZ(this,e,t,n,r)}},qZ=class extends KZ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){y.useDebugValue(e),UJ(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;UJ(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;UJ(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){y.useDebugValue(e);let n=t!==void 0;UJ(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return y.useDebugValue(e),HZ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){y.useDebugValue(e);let n=PJ(t??qJ);this.context[e]=n}useStateSetter(e){let t=y.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},JZ=null;globalThis.requestAnimationFrame;var YZ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},XZ=class e{static create(){return new e}static request(e){return YZ.request(e)}static cancel(e){return YZ.cancel(e)}currentId=JZ;request(e){this.cancel(),this.currentId=YZ.request(()=>{this.currentId=JZ,e()})}cancel=()=>{this.currentId!==JZ&&(YZ.cancel(this.currentId),this.currentId=JZ)};disposeEffect=()=>this.cancel};function ZZ(){let e=jJ(XZ.create).current;return iZ(e.disposeEffect),e}var QZ=0,$Z=class e{static create(){return new e}currentId=QZ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=QZ,t()},e)}isStarted(){return this.currentId!==QZ}clear=()=>{this.currentId!==QZ&&(clearTimeout(this.currentId),this.currentId=QZ)};disposeEffect=()=>this.clear};function eQ(){let e=jJ($Z.create).current;return iZ(e.disposeEffect),e}var tQ=0;function nQ(e){return tQ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${tQ}`}function rQ(e){return e?.ownerDocument||document}function iQ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var aQ=typeof navigator<`u`,oQ=dQ(),sQ=pQ(),cQ=fQ();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),oQ.platform===`MacIntel`&&oQ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(oQ.platform),aQ&&/firefox/i.test(cQ);var lQ=aQ&&/apple/i.test(navigator.vendor);aQ&&/Edg/i.test(cQ),aQ&&/android/i.test(sQ)||/android/i.test(cQ),aQ&&sQ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var uQ=cQ.includes(`jsdom/`);function dQ(){if(!aQ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function fQ(){if(!aQ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function pQ(){if(!aQ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function mQ(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function hQ(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&AY(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function gQ(e){return`composedPath`in e?e.composedPath()[0]:e.target}function _Q(e){if(!e||uQ)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var vQ=AZ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),yQ={toasts:kZ(e=>e.toasts),isEmpty:kZ(e=>e.toasts.length===0),toast:kZ(vQ,(e,t)=>e.get(t)?.value),toastIndex:kZ(vQ,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:kZ(vQ,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:kZ(vQ,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:kZ(e=>e.hovering),focused:kZ(e=>e.focused),expanded:kZ(e=>e.hovering||e.focused),expandedOrOutOfFocus:kZ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:kZ(e=>e.prevFocusElement)},bQ=class extends qZ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},yQ)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=yQ.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||nQ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),yQ.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=yQ.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),yQ.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{yQ.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=iQ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=iQ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=iQ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=$Z.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=gQ(e);hQ(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!yQ.expandedOrOutOfFocus(this.state),a=i?$Z.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=mQ(rQ(this.state.viewport));if(!this.state.viewport||!hQ(this.state.viewport,t)||!_Q(t))return;let n=yQ.toasts(this.state),r=yQ.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},xQ=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=jJ(()=>new bQ({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return iZ(a.disposeEffect),y.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,k.jsx)(aZ.Provider,{value:a,children:t})},SQ=y.forwardRef(function(e,t){let[n,r]=y.useState();UJ(()=>{lQ&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,k.jsx)(`span`,{...e,ref:t,style:GJ,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),CQ=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),wQ=y.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=oZ(),s=eQ(),c=y.useRef(!1),l=y.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=y.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);y.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(mQ(rQ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=DY(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),y.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=DY(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=gQ(n),i=mQ(rQ(e));(!hQ(e,r)||!_Q(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),y.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=rQ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}y.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function b(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function x(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||_Q(rQ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||hQ(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:b,onMouseMove:b,onMouseLeave:x,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=hY(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[CQ.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,k.jsxs)(y.Fragment,{children:[!u&&m&&(0,k.jsx)(SQ,{onFocus:_}),i,!u&&m&&(0,k.jsx)(SQ,{onFocus:_})]})}]}),D=y.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,k.jsxs)(y.Fragment,{children:[!u&&m&&(0,k.jsx)(SQ,{onFocus:_}),E,!f&&D.length>0&&(0,k.jsx)(`div`,{style:GJ,children:D.map(e=>(0,k.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,k.jsx)(`div`,{children:e.title}),(0,k.jsx)(`div`,{children:e.description})]},e.id))})]})});function TQ(e){return ZJ(19)?e:e?`true`:void 0}var EQ=y.createContext(void 0);function DQ(){let e=y.useContext(EQ);if(!e)throw Error(YJ(66));return e}var OQ=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),kQ={[OQ.startingStyle]:``},AQ={[OQ.endingStyle]:``},jQ={transitionStatus(e){return e===`starting`?kQ:e===`ending`?AQ:null}};function MQ(e){return e==null?e:`current`in e?e.current:e}function NQ(e,t=!1,n=!0){let r=ZZ();return PJ((i,a=null)=>{r.cancel();function o(){Qd.flushSync(i)}let s=MQ(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=OQ.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function PQ(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=PJ(i),o=NQ(r,n,!1);y.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var FQ=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),IQ={...jQ,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},LQ=40,RQ=10,zQ=.5,BQ=1;function VQ(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function HQ(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var UQ=y.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=oZ(),[d,f]=y.useState(void 0),[p,m]=y.useState(!1),[h,g]=y.useState(!1),[_,v]=y.useState(!1),[b,x]=y.useState({x:0,y:0}),[S,C]=y.useState({x:0,y:0,scale:1}),[w,T]=y.useState(),[E,D]=y.useState(),[O,A]=y.useState(null),j=y.useRef(null),M=y.useRef({x:0,y:0}),N=y.useRef({x:0,y:0,scale:1}),P=y.useRef(void 0),F=y.useRef(0),ee=y.useRef(!1),I=y.useRef({x:0,y:0}),L=y.useRef(!1),R=u.useState(`toastIndex`,n.id),z=u.useState(`toastVisibleIndex`,n.id),B=u.useState(`toastOffsetY`,n.id),te=u.useState(`focused`),V=u.useState(`expanded`);PQ({open:n.transitionStatus!==`ending`,ref:j,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let ne=PJ((e=!1)=>{let t=j.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:j,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?Qd.flushSync(a):a()});UJ(ne,[ne]);function H(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**zQ:-(Math.abs(e)**zQ):(!c.includes(`right`)&&e>0&&(n=e**zQ),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**zQ))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**zQ:-(Math.abs(t)**zQ):(!c.includes(`down`)&&t>0&&(r=t**zQ),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**zQ))),{x:n,y:r}}function re(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=gQ(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(ee.current=!1,P.current=void 0,F.current=0,M.current={x:e.clientX,y:e.clientY},I.current=M.current,j.current){let e=HQ(j.current);N.current=e,C(e),x({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),A(null),L.current=!0,j.current?.setPointerCapture(e.pointerId)}}function ie(e){if(!p)return;e.preventDefault(),L.current&&=(M.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-M.current.x,o=t-M.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=BQ&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&A(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!P.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(P.current=u,F.current=VQ(u,a,o),f(u));else{let e=P.current,t=VQ(e,l,s);t>LQ?(ee.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&F.current-t>=RQ&&(ee.current=!0)}let d=H(a,o),m=N.current.x,_=N.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),x({x:m,y:_})}function ae(e){if(!p)return;if(m(!1),g(!1),A(null),j.current?.releasePointerCapture(e.pointerId),ee.current){x({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=b.x-S.x,i=b.y-S.y,a;for(let e of c){switch(e){case`right`:r>LQ&&(t=!0,a=`right`);break;case`left`:r<-LQ&&(t=!0,a=`left`);break;case`down`:i>LQ&&(t=!0,a=`down`);break;case`up`:i<-LQ&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(x({x:S.x,y:S.y}),f(void 0))}function U(e){if(e.key===`Escape`){if(!j.current||!hQ(j.current,mQ(rQ(j.current))))return;u.closeToast(n.id)}}y.useEffect(()=>{if(!l)return;let e=j.current;if(!e)return;function t(t){hQ(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&b.x===S.x&&b.y===S.y&&!_)return{[FQ.swipeMovementX]:`0px`,[FQ.swipeMovementY]:`0px`};let e=b.x-S.x,t=b.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${b.x}px) translateY(${b.y}px) scale(${S.scale})`:void 0,[FQ.swipeMovementX]:`${e}px`,[FQ.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":se&&!te?!0:void 0,onPointerDown:l?re:void 0,onPointerMove:l?ie:void 0,onPointerUp:l?ae:void 0,onKeyDown:U,inert:TQ(n.limited),style:{...oe(),[FQ.index]:n.transitionStatus===`ending`?R:z,[FQ.offsetY]:`${B}px`,[FQ.height]:n.height?`${n.height}px`:void 0}},le=y.useMemo(()=>({rootRef:j,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:ne,index:R,visibleIndex:z,expanded:V}),[n,w,E,p,d,ne,R,z,V]),ue={transitionStatus:n.transitionStatus,expanded:V,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=hY(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:IQ,props:[ce,o]});return(0,k.jsx)(EQ.Provider,{value:le,children:de})}),WQ=y.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=DQ(),l=a??s.description,u=!!l,d=wY(i);UJ(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=hY(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),GQ=y.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=DQ(),l=a??s.title,u=!!l,d=wY(i);UJ(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=hY(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),KQ=y.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=oZ(),{toast:c}=DQ(),l=s.useState(`expanded`),[u,d]=y.useState(!1),{getButtonProps:f,buttonRef:p}=PY({disabled:i,native:a}),m={type:c.type};return hY(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function qQ(){let e=y.useContext(aZ);if(!e)throw Error(YJ(73));let t=e.useState(`toasts`);return y.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function JQ(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||nQ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var YQ=5e3,XQ=JQ();function ZQ({toast:e}){return(0,k.jsxs)(UQ,{toast:e,className:b_(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-danger/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,k.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,k.jsx)(GQ,{className:b_(`text-sm font-medium`,e.type===`error`&&`text-danger`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,k.jsx)(WQ,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,k.jsx)(KQ,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,k.jsx)(Ye,{width:G.default,height:G.default})})]})}function QQ(){let{toasts:e}=qQ();return(0,k.jsx)(k.Fragment,{children:e.map(e=>(0,k.jsx)(ZQ,{toast:e},e.id))})}function $Q(){return(0,k.jsxs)(xQ,{timeout:YQ,toastManager:XQ,children:[(0,k.jsx)(QQ,{}),(0,k.jsx)(wQ,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var e$=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],t$=3e3,n$=8e3,r$=15e3,i$=5e3,a$=2e4,o$=1e4,s$=1500,c$=5e3,l$=750,u$=4,d$=5e3,f$=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(rk(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,rk(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{rk(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?e$[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){rk(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){rk(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}rk(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;rk(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?n$:t$;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(rk(`ws_connect_timeout`,{wsState:e$[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){rk(`ws_onopen_stale`,this.wsSnap(),`info`);return}rk(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),rk(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(c$)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(rk(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){rk(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}rk(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>r$&&(rk(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},i$))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return rk(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(rk(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){rk(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(rk(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},s$)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){rk(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){rk(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){rk(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,rk(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},l$)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,rk(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},o$)))};e!==void 0&&e<a$?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,a$)},e):this.heartbeatTimer=window.setInterval(t,a$)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){rk(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=u$){rk(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(d$*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);rk(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){rk(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function p$(){let e=Mh(e=>e.setConnectionState);return(0,y.useEffect)(()=>{f$.connect(),f$.startLifecycleListeners();let t=f$.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),f$.stopLifecycleListeners()}},[e]),{sendMessage:(0,y.useMemo)(()=>e=>{f$.send(e)},[]),subscribe:(0,y.useMemo)(()=>f$.subscribe.bind(f$),[]),getConnectionEpoch:(0,y.useMemo)(()=>()=>f$.getConnectionEpoch(),[])}}var m$=100;function h$({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>m$?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function g$(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function _$(){(0,y.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{h$({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),g$(document)}},[])}var v$=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`sidebarAnchor`,`projectFilters`,`hostFilters`,`showProjectName`,`showLastUserMessage`,`showSessionIdPrefix`,`soundOnPermission`,`soundOnIdle`],y$=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function b$(e){return typeof e==`boolean`}function x$(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function S$(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||y$.includes(t.agentType))}var C$={theme:e=>e===`dark`||e===`light`||e===`system`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(S$),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>x$(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>x$(e,1e3),sidebarAnchor:e=>e===`top`||e===`bottom`,projectFilters:e=>x$(e,500),hostFilters:e=>x$(e,500),showProjectName:b$,showLastUserMessage:b$,showSessionIdPrefix:b$,soundOnPermission:b$,soundOnIdle:b$};function w$(e){return v$.includes(e)}function T$(e,t){return C$[e](t)}var E$=`agentboard-theme`,D$=`agentboard-settings`,O$=200,k$=new Map,A$=new Map,j$=new Set;function M$(e){return A$.has(e)||j$.has(e)}var N$=null,P$=!1;function F$(e){return e===`theme`?ZG.getState().theme:W.getState()[e]}function I$(e){let t=e===`theme`?E$:D$;return w.getItem(t)!==null}function L$(){if(N$=null,A$.size===0)return;let e={},t=new Map,n=new Map;for(let[r,i]of A$)e[r]=JSON.parse(i),t.set(r,i),n.set(r,k$.get(r)),k$.set(r,i),j$.add(r);A$.clear();let r=()=>{for(let[e,r]of t){if(k$.get(e)!==r)continue;let t=n.get(e);t===void 0?k$.delete(e):k$.set(e,t)}},i=e=>{for(let n of t.keys()){if(j$.delete(n),!e||A$.has(n))continue;let t=k$.get(n);t!==void 0&&t!==JSON.stringify(F$(n))&&R$(n,JSON.parse(t))}},a=!1;try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{a=e.ok,e.ok||(rk(`synced_settings_push_rejected`,{status:e.status},`warn`),r())}).catch(e=>{rk(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`),r()}).finally(()=>i(a))}catch(e){r(),i(!1),rk(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function R$(e,t){e===`theme`?ZG.setState({theme:t}):W.setState({[e]:t})}function z$(e,t){if(k$.get(e)===JSON.stringify(t)){A$.delete(e);return}B$(e,t)}function B$(e,t){A$.set(e,JSON.stringify(t)),!N$&&(N$=setTimeout(L$,O$))}function V$(e){let t=new Map;for(let e of v$)t.set(e,I$(e));let n={},r;for(let[t,i]of Object.entries(e))!w$(t)||!T$(t,i)||(k$.set(t,JSON.stringify(i)),!M$(t)&&(t===`theme`?r=i:n[t]=i));r!==void 0&&ZG.setState({theme:r}),Object.keys(n).length>0&&W.setState(n);for(let n of v$){if(n in e||!t.get(n))continue;let r=F$(n);T$(n,r)&&k$.get(n)!==JSON.stringify(r)&&B$(n,r)}}function H$(){if(P$)return()=>{};P$=!0;let e=W.subscribe((e,t)=>{let n=e,r=t;for(let e of v$)e!==`theme`&&n[e]!==r[e]&&z$(e,n[e])}),t=ZG.subscribe((e,t)=>{e.theme!==t.theme&&z$(`theme`,e.theme)});return()=>{e(),t(),P$=!1,N$&&=(clearTimeout(N$),null),A$.clear(),j$.clear(),k$.clear()}}function U$(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function W$(){let[e,t]=(0,y.useState)(!1),[n,r]=(0,y.useState)(void 0),[i,a]=(0,y.useState)(void 0),[o,s]=(0,y.useState)(void 0),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(null),v=Mh(e=>e.sessions),b=Mh(e=>e.agentSessions),S=Mh(e=>e.agentSessionsEpoch),C=Mh(e=>e.selectedSessionId),w=Mh(e=>e.selectedHibernatingSessionId),T=Mh(e=>e.setSessions),E=Mh(e=>e.setAgentSessions),D=Mh(e=>e.setActiveAgentSessions),O=Mh(e=>e.setHostStatuses),A=Mh(e=>e.updateSession),j=Mh(e=>e.setSelectedSessionId),M=Mh(e=>e.setSelectedHibernatingSessionId),P=Mh(e=>e.hasLoaded),ee=Mh(e=>e.connectionStatus),I=Mh(e=>e.connectionError),L=Mh(e=>e.clearExitingSession),R=Mh(e=>e.markSessionExiting),z=Mh(e=>e.setRemoteAllowControl),B=Mh(e=>e.setRemoteAllowAttach),te=Mh(e=>e.setHostLabel),V=Mh(e=>e.setPreferWindowName),ne=Mh(e=>e.hostStatuses),H=Mh(e=>e.remoteAllowControl),re=Mh(e=>e.hostLabel),ie=QG(),ae=_t(),U=W(e=>e.defaultProjectDir),oe=W(e=>e.commandPresets),se=W(e=>e.defaultPresetId),ce=W(e=>e.lastProjectPath),le=W(e=>e.setLastProjectPath),ue=W(e=>e.addRecentPath),de=W(e=>e.shortcutModifier),fe=W(e=>e.sidebarWidth),pe=W(e=>e.sidebarAnchor),me=W(e=>e.setSidebarWidth),he=W(e=>e.projectFilters),ge=W(e=>e.hostFilters),_e=W(e=>e.soundOnPermission),ve=W(e=>e.soundOnIdle),ye=Mh(e=>e.connectionEpoch),{sendMessage:be,subscribe:xe,getConnectionEpoch:Se}=p$();(0,y.useEffect)(()=>H$(),[]),_$(),(0,y.useEffect)(()=>{if(typeof document>`u`||!_e&&!ve)return;let e=!1,t=()=>{e&&!SJ()||(e=!0,wJ())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[_e,ve]);let Ce=(0,y.useRef)(!1),we=(0,y.useCallback)(e=>{e.preventDefault(),Ce.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,y.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!Ce.current)return;let t=e.clientX;me(Math.max(180,Math.min(400,t)))},t=()=>{Ce.current&&(Ce.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[me]),(0,y.useEffect)(()=>{let e=xe(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=Mh.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=W.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&DJ(),e.status===`working`&&i.status===`waiting`&&r&&OJ())}if(Be.current.size>0){let e=Se();for(let[t,n]of Be.current)n.epoch!==e&&Be.current.delete(t)}let i=Be.current.size>0?e.sessions.filter(e=>!Be.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=Mh.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(Ie.current=s),T(i);let c=Le.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=Mh.getState(),{projectFilters:d,hostFilters:f}=W.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Le.current=null,j(e.id))}}if(e.type===`host-status`&&O(e.hosts),e.type===`server-config`&&(z(e.remoteAllowControl),B(e.remoteAllowAttach),te(e.hostLabel),V(e.preferWindowName),e.clientLogLevel&&nk(e.clientLogLevel)),e.type===`synced-settings`&&V$(e.settings),e.type===`session-update`){let t=Mh.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(A(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=W.getState();t!==`permission`&&n===`permission`&&e&&DJ(),t===`working`&&n===`waiting`&&r&&OJ()}}if(e.type===`session-created`){let t=Mh.getState().sessions;t.some(t=>t.id===e.session.id)||T([e.session,...t]),j(e.session.id),ue(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=W.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){gG(e.sessionId);let t=Mh.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&T(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=Mh.getState(),a=Ie.current;i&&!n.some(e=>e.sessionId===i)&&(Le.current=i),E(t,n,r),_(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(Ie.current=null,M(a)):a&&(Ie.current=null)}if(e.type===`agent-sessions-active`&&D(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=Mh.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&T(n)}if(e.type===`session-activated`){let t=Mh.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&A({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){_(t=>t?.sessionId===e.sessionId?null:t);let t=Mh.getState().sessions;t.some(t=>t.id===e.session.id)||T([e.session,...t]),j(e.session.id)}else e.ok||(p(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>p(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&_(e.session),M(e.sessionId)):(p(e.error??`Failed to hibernate session`),window.setTimeout(()=>p(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===C)&&(p(`${e.code}: ${e.message}`),window.setTimeout(()=>p(null),6e3)),e.type===`terminal-ready`&&e.sessionId===C&&p(null),e.type===`error`&&(p(e.message),window.setTimeout(()=>p(null),6e3)),e.type===`kill-failed`){let t=Be.current.get(e.sessionId);if(t){let n=Mh.getState().sessions;n.some(t=>t.id===e.sessionId)||T([t.session,...n]),t.wasSelected&&j(e.sessionId),Be.current.delete(e.sessionId)}L(e.sessionId),p(e.message),window.setTimeout(()=>p(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(p(e.error),window.setTimeout(()=>p(null),6e3))}});return()=>{e()}},[C,w,ue,L,be,j,M,_,T,E,D,O,z,B,te,V,xe,A]);let Te=(0,y.useMemo)(()=>v.find(e=>e.id===C)||null,[C,v]),Ee=b.hibernating??[],De=b.history??[],Oe=(0,y.useMemo)(()=>U$(Ee,he,ge),[Ee,he,ge]),ke=(0,y.useMemo)(()=>Oe.find(e=>e.sessionId===w)||(g?.sessionId===w?g:null),[Oe,g,w]);(0,y.useEffect)(()=>{Te?.projectPath&&!Te.remote&&le(Te.projectPath)},[Te?.projectPath,Te?.remote,le]);let Ae=W(e=>e.sessionSortMode),je=W(e=>e.sessionSortDirection),Me=W(e=>e.manualSessionOrder),Ne=(0,y.useMemo)(()=>_h(v,{mode:Ae,direction:je,manualOrder:Me}),[v,Ae,je,Me]),Pe=(0,y.useMemo)(()=>{let e=Ne;return he.length>0&&(e=e.filter(e=>he.includes(e.projectPath))),ge.length>0&&(e=e.filter(e=>ge.includes(e.host??``))),e},[Ne,he,ge]),Fe=(0,y.useRef)(w),Ie=(0,y.useRef)(null),Le=(0,y.useRef)(null),Re=(0,y.useRef)(ye),ze=(0,y.useCallback)(()=>Pe.length>0?(j(Pe[0].id),!0):Oe.length>0?(M(Oe[0].sessionId),!0):!1,[Pe,Oe,j,M]);(0,y.useEffect)(()=>{let e=Fe.current;e&&w===null&&!Ee.some(t=>t.sessionId===e)?Le.current=e:w!==null&&(Le.current=null),Fe.current=w},[Ee,w]),(0,y.useEffect)(()=>{g&&w!==g.sessionId&&_(null)},[g,w]),(0,y.useEffect)(()=>{Re.current!==ye&&(Re.current=ye,Ie.current=null,Le.current=null,_(null))},[ye]),(0,y.useEffect)(()=>{P&&(w||C&&(Pe.some(e=>e.id===C)||ze()||j(null)))},[P,C,w,ze,j]),(0,y.useEffect)(()=>{if(!w||g?.sessionId===w||S!==ye||Oe.some(e=>e.sessionId===w))return;let e=Pe.find(e=>e.agentSessionId?.trim()===w);if(e){j(e.id);return}ze()||M(null)},[Oe,Pe,S,g,w,ze,j,M,ye]),(0,y.useEffect)(()=>{let e=Le.current;if(!e)return;if(w!==null){Le.current=null;return}let t=Pe.find(t=>t.agentSessionId?.trim()===e);if(t){Le.current=null,j(t.id);return}if(C!==null){Le.current=null;return}ze()&&(Le.current=null)},[Pe,C,w,ze,j]),(0,y.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&P&&C===null&&w===null&&(Pe.length>0||Oe.length>0)&&ze()},[Oe.length,Pe.length,P,ze,C,w]);let Be=(0,y.useRef)(new Map),Ve=(0,y.useCallback)((e,t=`unknown`)=>{gG(e);let{sessions:n,selectedSessionId:r}=Mh.getState(),i=n.find(t=>t.id===e);i&&Be.current.set(e,{session:i,wasSelected:r===e,epoch:Se()}),(0,Qd.flushSync)(()=>{R(e),T(n.filter(t=>t.id!==e))}),be({type:`session-kill`,sessionId:e,source:t})},[R,T,be]);(0,y.useEffect)(()=>{let n=xt(de),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=wt(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=pe===`bottom`&&!window.matchMedia(`(max-width: 767px)`).matches,t=(i===`BracketLeft`?-1:1)*(e?-1:1),n=Pe;if(n.length===0){let e=Oe;if(e.length===0)return;let n=e.findIndex(e=>e.sessionId===w);if(n===-1){M(e[0].sessionId);return}M(e[(n+t+e.length)%e.length].sessionId);return}let a=n.findIndex(e=>e.id===C);if(a===-1){j(n[0].id);return}j(n[(a+t+n.length)%n.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(Pe.length>0){let t=Pe[e];if(!t)return;r.preventDefault(),j(t.id);return}let t=Oe[e];if(!t)return;r.preventDefault(),M(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&!c&&ae&&t(!0);return}if(a&&i===`Comma`){r.preventDefault(),l(t=>t?!1:!e);return}if(a&&i===`KeyX`){r.preventDefault(),C&&!e&&!c&&Ve(C,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,c,C,w,j,M,Pe,Oe,Ve,pe,de,ae]);let He=()=>ae?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,Ue=()=>l(!0),We=(e,t,n,r)=>{be({type:`session-create`,operationId:x(),projectPath:e,name:t,command:n,host:r}),r||le(e)},Ge=e=>{be({type:`session-wake`,sessionId:e})},Ke=(0,y.useCallback)(e=>{be({type:`session-hibernate`,sessionId:e})},[be]),qe=(e,t)=>{be({type:`session-rename`,sessionId:e,newName:t})},Je=(0,y.useCallback)(e=>{let t=v.find(t=>t.id===e);t&&be({type:`session-create`,operationId:x(),projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[v,be]),Ye=(0,y.useCallback)(e=>{be({type:`session-move-to-history`,sessionId:e})},[be]);(0,y.useEffect)(()=>$G(),[]),(0,y.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,ie)},[ie]),(0,y.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>h(e)).catch(()=>{})},[]);let Xe=(0,y.useMemo)(()=>re?ne.filter(e=>e.host!==re):ne,[ne,re]);return(0,k.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,k.jsx)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:fe},children:(0,k.jsx)(ZO,{sessions:v,hibernatingSessions:Ee,historySessions:De,selectedSessionId:C,selectedHibernatingSessionId:w,onSelect:j,onSelectHibernating:M,onRename:qe,onResume:Ge,onHibernate:Ke,onKill:Ve,onDuplicate:Je,onMoveToHistory:Ye,onNewSession:He,loading:!P,error:I||f,anchor:pe,notice:(0,k.jsx)(N,{onOpen:()=>d(!0),subscribe:xe}),filterBarControls:(0,k.jsx)(Lt,{connectionStatus:ee,onNewSession:He,onOpenSettings:Ue,onOpenHistory:()=>d(!0),tailscaleIp:m?.tailscaleIp??null,placement:pe===`bottom`?`up`:`down`})})}),(0,k.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:we}),(0,k.jsx)(mq,{session:Te,sessions:Pe,drawerSessions:v,hibernatingSession:ke,hibernatingSessions:Ee,connectionStatus:ee,connectionEpoch:ye,sendMessage:be,subscribe:xe,onClose:()=>j(null),onSelectSession:j,onSelectHibernatingSession:M,onNewSession:He,onKillSession:Ve,onRenameSession:qe,onDuplicateSession:Je,onOpenSettings:Ue,onOpenHistory:()=>d(!0),onResumeSession:Ge,onHibernateSession:Ke,onMoveToHistory:Ye,historySessions:De,loading:!P,error:I||f}),(0,k.jsx)(Nq,{isOpen:e,onClose:()=>t(!1),onCreate:We,defaultProjectDir:U,commandPresets:oe,defaultPresetId:se,lastProjectPath:ce,activeProjectPath:Te&&!Te.remote?Te.projectPath:void 0,remoteHosts:Xe,remoteAllowControl:H,initialHost:n,initialPath:i,initialCommand:o}),(0,k.jsx)($X,{isOpen:c,onClose:()=>l(!1)}),(0,k.jsx)(F,{open:u,subscribe:xe,onClose:()=>d(!1),onOpenSession:e=>{T([e,...v.filter(t=>t.id!==e.id)]),M(null),j(e.id)}}),(0,k.jsx)($Q,{})]})}var G$=`modulepreload`,K$=function(e){return`/`+e},q$={},J$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=K$(t,n),t in q$)return;q$[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:G$,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Y$=`true`,X$=`false`,Z$=Y$===`true`,Q$=X$===`true`;function $$(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,Z$||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await J$(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!Q$)if(Z$)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}vt()&&document.documentElement.classList.add(`ios`),yt()&&document.documentElement.classList.add(`ios-pwa`),$$({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var e1=document.getElementById(`root`);if(!e1)throw Error(`Root element not found`);(0,b.createRoot)(e1).render((0,k.jsx)(y.StrictMode,{children:(0,k.jsx)(W$,{})}));
306
+ `,onClick:()=>{pq(),d(t.id)},title:pt?t.name:void 0,children:i},t.id)})})]}),(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(`div`,{ref:ke,className:`absolute inset-0`,style:{backgroundColor:T.background}}),Le&&e&&(0,k.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,k.jsx)(Xe,{width:G.pill,height:G.pill,className:`animate-spin`}),`Loading`]}),ze&&e&&(0,k.jsxs)(`div`,{className:`absolute ${F&&!L?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:hidden`,children:[(0,k.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,k.jsxs)(`button`,{type:`button`,onClick:Be,className:`relative flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,k.jsx)(ie,{width:G.default,height:G.default}),`Copy`]}),(0,k.jsx)(`button`,{type:`button`,onClick:Ve,className:`relative flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,k.jsx)(Ye,{width:G.default,height:G.default})})]}),!e&&(0,k.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:r?null:`Select a session to view terminal`}),e&&Se&&(0,k.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),r&&(0,k.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,k.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,k.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,k.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,k.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:we}),(0,k.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),Te&&(0,k.jsx)(`span`,{className:`text-muted`,children:Te}),(0,k.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Ee]})]}),r.lastResumeError&&(0,k.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${r.lastResumeError}`,children:[(0,k.jsx)(I,{width:G.pill,height:G.pill}),`Last wake failed`]}),r.lastUserMessage&&(0,k.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:r.lastUserMessage})]}),(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>_(r.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),b&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>b(r.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,k.jsx)(RO,{session:r})]})}),Ne&&e&&!L?(0,k.jsxs)(`button`,{type:`button`,onClick:He,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:hidden ${Nt}`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,k.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,k.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):F&&e&&!L?(0,k.jsxs)(`button`,{type:`button`,onClick:He,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all md:hidden ${Nt}`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,k.jsx)(R,{width:G.primary,height:G.primary}),(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,k.jsx)(JK,{...lt}),(0,k.jsx)(yK,{session:e,hibernatingSession:r,hibernatingDisplayName:we,showHostBadge:Oe,sessionCount:t.length,connectionStatus:o,isSwitching:Le,canControl:Ce,canHibernate:De,modDisplay:M,onKill:()=>te(!0),onHibernate:Je,onWake:()=>r&&_(r.sessionId),onRename:t=>{let n=e?.id??r?.sessionId;n&&h(n,t)},onDuplicate:e&&g?()=>g(e.id):void 0,onMoveToHistory:r&&b?()=>b(r.sessionId):void 0,isTmuxCopyMode:Ne,showJumpToBottom:F&&!L,onJumpToBottom:He,selectionReady:!!ze,onCopySelection:Be,onDismissSelection:Ve}),e&&(0,k.jsx)(lq,{onSendKey:at,onPasteText:ot,onPasteImage:st,disabled:o!==`connected`||Se||!Re,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!ve,onSelectSession:d,hideSessionSwitcher:!0,onRefocus:ct,isKeyboardVisible:ft,onEnterTextMode:dt}),(P||N)&&(0,k.jsx)(uq,{isOpen:H,onClose:()=>re(!1),sessions:n??t,hibernatingSessions:i,historySessions:a,selectedSessionId:e?.id??null,selectedHibernatingSessionId:r?.sessionId??null,onSelect:d,onSelectHibernating:f,onRename:h,onResume:_,onHibernate:v,onMoveToHistory:b,onNewSession:p,onOpenHistory:S,subscribe:l,loading:C,error:w}),B&&e&&(0,k.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,k.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,k.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,k.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,k.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,k.jsx)(`button`,{onClick:()=>te(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,k.jsx)(`button`,{ref:he,onClick:qe,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function hq({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,y.useState)(n||`~`),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!0),[d,f]=(0,y.useState)(-1),p=(0,y.useRef)(null),m=W(e=>e.recentPaths),h=(0,y.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,y.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,y.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,k.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,k.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,k.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,k.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,k.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,k.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,k.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,k.jsx)(`p`,{className:`text-danger`,children:s}),(0,k.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,k.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,k.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,k.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,k.jsx)(ye,{width:G.default,height:G.default,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,k.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,k.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,k.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,k.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,k.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,k.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function gq(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function _q(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?gq(o):null}function vq(e){return e?e===`claude-rp`?`claude`:e:null}function yq(e){let t=e.trim();if(!t)return``;let n=gq(t);return _q(n)??n}function bq(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function xq(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:bq(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function Sq(e){let t=yq(e);if(t)return xq(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var Cq={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},wq={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function Tq(e){let t=vq(e);return t?Cq[t]:null}function Eq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Dq(e){return RegExp(`(^|\\s)${Eq(e)}(?=\\s|$)`,`g`)}function Oq(e,t){return(t?[vq(t)].filter(e=>e!==null):Object.keys(wq)).some(t=>wq[t].some(t=>Dq(t).test(e)))}function kq(e,t){let n=xq(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function Aq(e,t){let n=Tq(t);if(!n)return e;let r=e.trim();if(!r||Oq(r,t))return r;let i=kq(r,n);if(i)return i;let a=yq(r);if(a&&a!==r){let e=kq(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function jq(e,t){let n=vq(t);if(!n||Oq(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function Mq(e,t){let n=vq(t);if(!n)return e;let r=e;for(let e of wq[n])r=r.replace(Dq(e),` `);return r.replace(/\s+/g,` `).trim()}function Nq({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(``),E=W(e=>e.yoloMode),D=W(e=>e.setYoloMode),O=(0,y.useRef)(null),A=(0,y.useRef)(null),j=(0,y.useRef)(null),M=(0,y.useRef)(!1),N=l&&c.length>0,P=e=>{if(!E)return e;let t=Sq(e);return t&&!jq(e,t)?Aq(e,t):e},F=e=>{let t=i.find(t=>t.id===e);t&&(v(e),x(P(mt(t))))},ee=()=>{v(null),x(``)};if((0,y.useEffect)(()=>{let t=M.current;if(M.current=e,!e){m(``),g(``),v(null),x(``),C(!1),T(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(t)return;if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let n=f?.trim();if(n){let e=i.find(e=>mt(e)===n);e?(v(e.id),x(mt(e))):(v(null),x(n))}else{let e=i.find(e=>e.id===a);e?(v(a),x(P(mt(e)))):i.length>0?(v(i[0].id),x(P(mt(i[0])))):(v(null),x(``))}setTimeout(()=>{if(j.current?.focus(),A.current){let e=A.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,y.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?ee():F(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let I=_===null,L=w!==``,R=Sq(b),z=Tq(R)!==null,B=R?Oq(b,R):!1,te=R&&!B?jq(b,R):null,V=!z||te!==null,ne=R?R===`pi`?`Pi has no permission prompts — nothing to enable`:te??`Append ${Tq(R)}`:`Enter a supported agent command (claude, codex, grok, devin)`,H=e=>{D(e),R&&x(e?Aq(b,R):Mq(b,R))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=b.trim();n(r,h.trim()||void 0,i||void 0,L?w:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ae=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],U=p.trim()||`~`;return(0,k.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,"data-suspends-terminal":``,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,k.jsxs)(`form`,{ref:O,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,k.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,k.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[N&&(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ae.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,k.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ae.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ae.length)%ae.length;else return;let r=ae[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?I:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,k.jsxs)(`button`,{ref:n?j:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?ee():F(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?ee():F(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,k.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,k.jsx)(Zh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,k.jsx)(`input`,{value:b,onChange:e=>x(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,k.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:ne,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:B,disabled:V,onChange:e=>H(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(`input`,{ref:A,value:p,onChange:e=>m(e.target.value),placeholder:L?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!L&&(0,k.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,k.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,k.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,k.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!L&&(0,k.jsx)(hq,{initialPath:U,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}var Pq=[{id:`new-sessions`,label:`New sessions`},{id:`session-list`,label:`Session list`},{id:`appearance`,label:`Appearance`},{id:`terminal`,label:`Terminal`},{id:`notifications`,label:`Notifications`}];function Fq(e){return Pq.some(t=>t.id===e)}function Iq(e){return Pq.find(t=>t.id===e)?.label??e}var Lq=`agentboard-settings-page`,Rq=`new-sessions`;function zq(){let e=w.getItem(Lq);return Fq(e)?e:Rq}function Bq(e){w.setItem(Lq,e)}var Vq=`h-[32px] max-md:h-[44px]`,Hq=`${Vq} inline-flex shrink-0 items-center justify-center border text-[12px] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,Uq=`${Hq} border-border bg-surface px-3 text-secondary hover:bg-hover hover:text-primary`,Wq=`${Hq} w-[32px] max-md:w-[44px] border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,Gq=`input ${Vq} px-2 py-0 text-[13px] max-md:text-[16px] focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 aria-[invalid=true]:border-danger`;function Kq(e,t){let[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(null),o=(0,y.useRef)({draft:n,stored:e,commit:t});o.current={draft:n,stored:e,commit:t},(0,y.useEffect)(()=>()=>{let{draft:e,stored:t,commit:n}=o.current;e!==null&&e!==t&&n(e)},[]);let s=()=>{if(n===null)return;if(n===e){r(null),a(null);return}let i=t(n);if(i){a(i);return}r(null),a(null)};return{value:n??e,error:i,dirty:n!==null,onChange:e=>{r(e.target.value),a(null)},onBlur:s,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),s()):e.key===`Escape`&&n!==null&&(e.preventDefault(),r(null),a(null))}}}var qq=(0,y.forwardRef)(function({value:e,onCommit:t,describedBy:n,id:r,className:i,wrapperClassName:a,...o},s){let c=Kq(e,t),l=r?`${r}-error`:void 0,u=[n,c.error?l:void 0].filter(Boolean).join(` `);return(0,k.jsxs)(`div`,{className:b_(`min-w-0`,a),children:[(0,k.jsx)(`input`,{...o,ref:s,id:r,value:c.value,onChange:c.onChange,onBlur:c.onBlur,onKeyDown:c.onKeyDown,"aria-invalid":c.error?!0:void 0,"aria-describedby":u||void 0,className:b_(Gq,i)}),c.error&&(0,k.jsx)(`p`,{id:l,className:b_(`text-[12px] leading-snug text-danger`,`mt-1`),role:`alert`,children:c.error})]})});function Jq(e,t,n){let r=e.trim();return/^-?\d+$/.test(r)?Math.min(n,Math.max(t,Number.parseInt(r,10))):null}function Yq({value:e,min:t,max:n,onChange:r,noun:i,labelledBy:a,describedBy:o}){return(0,k.jsxs)(`div`,{role:`group`,"aria-labelledby":a,"aria-describedby":o,className:`flex items-center`,children:[(0,k.jsx)(`button`,{type:`button`,className:Wq,"aria-label":`Decrease ${i}`,disabled:e<=t,onClick:()=>r(Math.max(t,e-1)),children:(0,k.jsx)(Ne,{width:G.default,height:G.default})}),(0,k.jsx)(`output`,{"aria-live":`polite`,className:b_(Vq,`flex w-10 items-center justify-center border-y border-border bg-base text-[13px] tabular-nums text-primary`),children:e}),(0,k.jsx)(`button`,{type:`button`,className:Wq,"aria-label":`Increase ${i}`,disabled:e>=n,onClick:()=>r(Math.min(n,e+1)),children:(0,k.jsx)(Ue,{width:G.default,height:G.default})})]})}function Xq({id:e,value:t,min:n,max:r,step:i,onChange:a,format:o,labelledBy:s,describedBy:c}){return(0,k.jsxs)(`div`,{className:b_(Vq,`flex items-center gap-3`),children:[(0,k.jsx)(`input`,{id:e,type:`range`,min:n,max:r,step:i,value:t,"aria-labelledby":s,"aria-describedby":c,"aria-valuetext":o(t),onChange:e=>{let t=Number.parseFloat(e.target.value);Number.isFinite(t)&&a(Math.min(r,Math.max(n,t)))},className:`h-1 w-28 max-md:w-36 cursor-pointer appearance-none bg-border accent-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,k.jsx)(`span`,{className:`w-10 text-right text-[13px] tabular-nums text-secondary`,children:o(t)})]})}function Zq({options:e,value:t,onChange:n,labelledBy:r,describedBy:i,fill:a=!1}){let o=(0,y.useRef)([]),s=Math.max(0,e.findIndex(e=>e.value===t)),c=t=>{let r=e[t];r&&(n(r.value),o.current[t]?.focus())},l=(t,n)=>{let r=e.length-1,i=null;t.key===`ArrowRight`||t.key===`ArrowDown`?i=n===r?0:n+1:t.key===`ArrowLeft`||t.key===`ArrowUp`?i=n===0?r:n-1:t.key===`Home`?i=0:t.key===`End`&&(i=r),i!==null&&(t.preventDefault(),c(i))};return(0,k.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":r,"aria-describedby":i,className:b_(`flex border border-border bg-base p-[2px]`,a?`w-full`:`w-max max-w-full`),children:e.map((e,t)=>{let n=t===s;return(0,k.jsx)(`button`,{ref:e=>{o.current[t]=e},type:`button`,role:`radio`,"aria-checked":n,tabIndex:n?0:-1,onClick:()=>c(t),onKeyDown:e=>l(e,t),className:b_(`h-[26px] max-md:h-[38px] min-w-0 whitespace-nowrap px-3 text-[12px] transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a&&`flex-1`,n?`bg-hover text-primary shadow-[inset_0_0_0_1px_var(--border)]`:`text-muted hover:text-primary`),children:e.label},e.value)})})}function Qq({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],value:ZG(e=>e.theme),onChange:ZG(e=>e.setTheme),labelledBy:e.label,describedBy:e.description})}function $q({ids:e}){let t=W(e=>e.fontOption),n=W(e=>e.setFontOption);return(0,k.jsx)(`select`,{id:e.control,value:t,"aria-describedby":e.description,onChange:e=>n(e.target.value),className:`${Gq} w-44 max-md:w-full`,children:lt.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))})}function eJ({ids:e}){let t=W(e=>e.customFontFamily);return(0,k.jsx)(qq,{id:e.control,value:t,placeholder:`"Fira Code", monospace`,describedBy:e.description,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:256,wrapperClassName:`w-60 max-md:w-full`,onCommit:e=>(W.getState().setCustomFontFamily(e.trim()),null)})}function tJ({ids:e}){return(0,k.jsx)(Yq,{value:W(e=>e.fontSize),min:6,max:24,onChange:W(e=>e.setFontSize),noun:`font size`,labelledBy:e.label,describedBy:e.description})}function nJ({ids:e}){let t=W(e=>e.lineHeight),n=W(e=>e.setLineHeight);return(0,k.jsx)(Xq,{id:e.control,value:t,min:1,max:2,step:.1,onChange:e=>n(Math.round(e*10)/10),format:e=>e.toFixed(1),labelledBy:e.label,describedBy:e.description})}function rJ({ids:e}){let t=W(e=>e.letterSpacing),n=W(e=>e.setLetterSpacing);return(0,k.jsx)(Xq,{id:e.control,value:t,min:-3,max:3,step:1,onChange:e=>n(Math.round(e)),format:e=>`${e}px`,labelledBy:e.label,describedBy:e.description})}var iJ=[{id:`theme`,page:`appearance`,label:`Theme`,description:`Light, dark, or follow the system setting.`,keywords:[`dark mode`,`light mode`,`color`,`colour`,`system`],Control:Qq},{id:`font-family`,page:`appearance`,label:`Font family`,description:`Terminal typeface. Default JetBrains Mono.`,keywords:[`font`,`typeface`,`monospace`],tags:[`device`],Control:$q},{id:`custom-font-family`,page:`appearance`,label:`Custom font family`,description:`A CSS font-family list. Empty falls back to JetBrains Mono.`,keywords:[`font`,`typeface`,`css`],tags:[`device`],layout:`wide`,visibleWhen:e=>e.fontOption===`custom`,Control:eJ},{id:`font-size`,page:`appearance`,label:`Font size`,description:`Terminal text size in pixels (6–24). Default 13.`,keywords:[`font`,`text`,`zoom`,`size`],tags:[`device`],Control:tJ},{id:`line-height`,page:`appearance`,label:`Line height`,description:`Vertical spacing, 1.0 compact to 2.0 spacious. Default 1.0.`,keywords:[`spacing`,`leading`,`line`],tags:[`device`],Control:nJ},{id:`letter-spacing`,page:`appearance`,label:`Letter spacing`,description:`Extra space between characters in pixels (−3 to 3). Default 0.`,keywords:[`spacing`,`tracking`,`kerning`],tags:[`device`],Control:rJ}],aJ=1024,oJ=[{value:``,label:`Terminal`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`},{value:`pi`,label:`Pi`},{value:`devin`,label:`Devin`},{value:`grok`,label:`Grok`},{value:`omp`,label:`OMP`}];function sJ(e,t){let n=t.trim();return e===`label`?n?n.length>64?`Name is at most 64 characters`:null:`Name is required`:n?n.length>1024?`Command is at most ${aJ} characters`:null:`Command is required`}function cJ(e){return sJ(`label`,e.label)===null&&sJ(`command`,e.command)===null}function lJ(e,t,n){return e.map(e=>e.id===t?pt({...e,...n}):e)}var uJ=`grid items-start gap-2 grid-cols-[56px_92px_minmax(0,0.8fr)_minmax(0,1.3fr)_auto] max-md:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] max-md:gap-y-2`,dJ=4e3;function fJ({preset:e,index:t,isDefault:n,pending:r=!1,autoFocusName:i=!1,onSetDefault:a,onCommitField:o,onIconChange:s,onDelete:c}){let[l,u]=(0,y.useState)(!1),d=(0,y.useRef)(null),f=`settings-preset-${e.id}`,p=e.label.trim()||`preset ${t+1}`;return(0,y.useEffect)(()=>{i&&d.current?.focus()},[i]),(0,y.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>u(!1),dJ);return()=>clearTimeout(e)},[l]),(0,k.jsxs)(`div`,{role:`listitem`,"data-preset-id":e.id,className:b_(uJ,`py-2`),children:[(0,k.jsxs)(`label`,{className:b_(Vq,`flex cursor-pointer items-center gap-2 md:justify-center`),children:[(0,k.jsx)(`input`,{type:`radio`,name:`settings-default-preset`,checked:n,disabled:r,onChange:a,"aria-label":`Default preset: ${p}`,className:`size-4 cursor-pointer accent-accent disabled:cursor-not-allowed`}),(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`text-[12px] text-secondary md:hidden`,children:`Default`})]}),e.isBuiltIn?(0,k.jsxs)(`div`,{className:b_(Vq,`flex items-center gap-2 text-muted`),children:[(0,k.jsx)(Zh,{agentType:e.agentType,command:e.command,className:`size-4`}),(0,k.jsx)(`span`,{className:`text-[11px]`,children:`Built-in`})]}):(0,k.jsx)(`select`,{id:`${f}-icon`,value:e.agentType??``,"aria-label":`Icon for ${p}`,onChange:e=>s(e.target.value||void 0),className:b_(Gq,`w-full px-1`),children:oJ.map(e=>(0,k.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,k.jsx)(qq,{ref:d,id:`${f}-label`,value:e.label,placeholder:`Name`,"aria-label":`Name of preset ${t+1}`,maxLength:64,onCommit:e=>o(`label`,e),wrapperClassName:`max-md:order-4 max-md:col-span-3`}),(0,k.jsx)(qq,{id:`${f}-command`,value:e.command,placeholder:`command --flags`,"aria-label":`Command for ${p}`,maxLength:aJ,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,onCommit:e=>o(`command`,e),wrapperClassName:`max-md:order-5 max-md:col-span-3`}),e.isBuiltIn?(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`w-[32px] max-md:order-3 max-md:w-[44px]`}):(0,k.jsx)(`button`,{type:`button`,onClick:()=>{if(r||l){c();return}u(!0)},onPointerDown:r?e=>e.preventDefault():void 0,onBlur:()=>u(!1),"aria-label":l?`Confirm delete ${p}`:r?`Discard new preset`:`Delete ${p}`,title:l?`Click again to delete`:void 0,className:b_(Hq,`max-md:order-3`,l?`border-danger bg-danger/10 px-2 text-danger hover:bg-danger/20`:`w-[32px] border-border bg-surface text-secondary hover:bg-hover hover:text-danger max-md:w-[44px]`),children:l?`Delete?`:(0,k.jsx)(le,{width:G.default,height:G.default})})]})}function pJ({ids:e}){let t=W(e=>e.commandPresets),n=W(e=>e.defaultPresetId),[r,i]=(0,y.useState)(null),a=(0,y.useRef)(null),o=(0,y.useRef)(null),s=(0,y.useRef)(!1);(0,y.useEffect)(()=>{if(!s.current)return;s.current=!1;let e=o.current;if(e&&!e.disabled){e.focus();return}let t=a.current?.id;t&&typeof document<`u`&&document.getElementById(`settings-preset-${t}-label`)?.focus()});let c=e=>{a.current=e,i(e)},l=!r&&t.length<50,u=r?[...t,r]:t,d=(e,t,n)=>{let r=sJ(t,n);if(r)return r;let{commandPresets:i,setCommandPresets:a}=W.getState();return a(lJ(i,e,{[t]:n})),null},f=(e,t)=>{let n=a.current;if(!n)return null;let r={...n,[e]:t},{commandPresets:i,setCommandPresets:o}=W.getState();return cJ(r)&&i.length<50?(o([...i,pt(r)]),c(null)):c(r),null},p=(e,t)=>{if(r?.id===e){c({...r,agentType:t});return}let{commandPresets:n,setCommandPresets:i}=W.getState();i(lJ(n,e,{agentType:t}))},m=()=>{l&&c({id:ht(new Set(t.map(e=>e.id))),label:``,command:``,isBuiltIn:!1})},h=e=>{s.current=!0,a.current?.id===e?c(null):W.getState().removePreset(e)};return(0,k.jsxs)(`div`,{className:`w-full min-w-0`,children:[(0,k.jsxs)(`div`,{"aria-hidden":`true`,className:b_(uJ,`border-b border-border pb-1 text-[11px] uppercase tracking-wide text-muted max-md:hidden`),children:[(0,k.jsx)(`span`,{className:`text-center`,children:`Default`}),(0,k.jsx)(`span`,{children:`Icon`}),(0,k.jsx)(`span`,{children:`Name`}),(0,k.jsx)(`span`,{children:`Command`}),(0,k.jsx)(`span`,{className:`w-[32px]`})]}),(0,k.jsx)(`div`,{role:`list`,"aria-labelledby":e.label,"aria-describedby":e.description,className:`divide-y divide-border-subtle`,children:u.map((e,t)=>{let i=e.id===r?.id;return(0,k.jsx)(fJ,{preset:e,index:t,isDefault:e.id===n,pending:i,autoFocusName:i,onSetDefault:()=>W.getState().setDefaultPresetId(e.id),onCommitField:(t,n)=>i?f(t,n):d(e.id,t,n),onIconChange:t=>p(e.id,t),onDelete:()=>h(e.id)},e.id)})}),r&&(0,k.jsx)(`p`,{className:b_(`text-[12px] leading-snug text-muted`,`pb-2`),role:`status`,children:`Enter a name and a command to add the preset.`}),(0,k.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,k.jsxs)(`button`,{ref:o,type:`button`,className:Uq,onClick:m,disabled:!l,children:[(0,k.jsx)(Ue,{width:G.default,height:G.default,className:`mr-1.5`}),`Add preset`]}),t.length>=50&&(0,k.jsxs)(`span`,{className:`text-[12px] leading-snug text-muted`,children:[`Maximum of `,50,` presets.`]})]})]})}function mJ({ids:e}){let t=W(e=>e.defaultProjectDir);return(0,k.jsx)(qq,{id:e.control,value:t,placeholder:ot,describedBy:e.description,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:4096,wrapperClassName:`w-72 max-md:w-full`,onCommit:e=>(W.getState().setDefaultProjectDir(e.trim()||`~/Documents/GitHub`),null)})}var hJ=[{id:`default-project-dir`,page:`new-sessions`,label:`Default project directory`,description:`Folder the new session dialog starts in. Default ${ot}.`,keywords:[`path`,`folder`,`cwd`,`directory`],layout:`wide`,Control:mJ},{id:`command-presets`,page:`new-sessions`,label:`Command presets`,description:`Commands offered when creating a session. The default preset is pre-selected.`,keywords:[`preset`,`command`,`agent`,`claude`,`codex`,`default`,`icon`],layout:`block`,Control:pJ}],gJ=null,_J=!1,vJ={},yJ=500;function bJ(){if(typeof window>`u`)return null;if(gJ?.state===`closed`&&(gJ=null),!gJ){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;gJ=new e}return gJ}function xJ(){gJ&&=(gJ.close().catch(()=>{}),null),bJ()}function SJ(){return _J}function CJ(){gJ&&(xJ(),_J=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&CJ()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&CJ()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&CJ(),e=t},5e3)}async function wJ(){let e=bJ();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),_J=!1}async function TJ(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function EJ(e){let t=bJ();if(!t||(await TJ(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function DJ(){let e=Date.now();if(!(e-(vJ.permission||0)<yJ)){vJ.permission=e;try{await EJ({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function OJ(){let e=Date.now();if(!(e-(vJ.idle||0)<yJ)){vJ.idle=e;try{await EJ({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function kJ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=y.useRef(e!==void 0),[a,o]=y.useState(t);return[i?e:a,y.useCallback(e=>{i||o(e)},[])]}var AJ={};function jJ(e,t){let n=y.useRef(AJ);return n.current===AJ&&(n.current=e(t)),n}var MJ=y[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],NJ=MJ&&MJ!==y.useLayoutEffect?MJ:e=>e();function PJ(e){let t=jJ(FJ).current;return t.next=e,NJ(t.effect),t.trampoline}function FJ(){let e={next:void 0,callback:IJ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function IJ(){}function LJ(e,t,n,r){let i=jJ(zJ).current;return BJ(i,e,t,n,r)&&HJ(i,[e,t,n,r]),i.callback}function RJ(e){let t=jJ(zJ).current;return VJ(t,e)&&HJ(t,e),t.callback}function zJ(){return{callback:null,cleanup:null,refs:[]}}function BJ(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function VJ(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function HJ(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var UJ=typeof document<`u`?y.useLayoutEffect:()=>{},WJ={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},GJ={...WJ,position:`fixed`,top:0,left:0},KJ={...WJ,position:`absolute`};function qJ(){}Object.freeze([]);var JJ=Object.freeze({});function YJ(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var XJ=18;function ZJ(e){return XJ>=e}function QJ(e){if(!y.isValidElement(e))return null;let t=e,n=t.props;return(ZJ(19)?n?.ref:t.ref)??null}function $J(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function eY(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function tY(e,t){return typeof e==`function`?e(t):e}function nY(e,t){return typeof e==`function`?e(t):e}var rY={};function iY(e,t,n,r,i){let a={...uY(e,rY)};return t&&(a=oY(a,t)),n&&(a=oY(a,n)),r&&(a=oY(a,r)),i&&(a=oY(a,i)),a}function aY(e){if(e.length===0)return rY;if(e.length===1)return uY(e[0],rY);let t={...uY(e[0],rY)};for(let n=1;n<e.length;n+=1)t=oY(t,e[n]);return t}function oY(e,t){return lY(t)?t(e):sY(e,t)}function sY(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=$J(e.style,r);break;case`className`:e[n]=pY(e.className,r);break;default:cY(n,r)?e[n]=dY(e[n],r):e[n]=r}}return e}function cY(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function lY(e){return typeof e==`function`}function uY(e,t){return lY(e)?e(t):e??rY}function dY(e,t){return t?e?n=>{if(mY(n)){let r=n;fY(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function fY(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function pY(e,t){return t?e?t+` `+e:t:e}function mY(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function hY(e,t,n={}){let r=t.render,i=gY(t,n);return n.enabled===!1?null:vY(e,r,i,n.state??JJ)}function gY(e,t={}){let{className:n,style:r,render:i}=e,{state:a=JJ,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?tY(n,a):void 0,d=l?nY(r,a):void 0,f=l?eY(a,c):JJ,p=l?$J(f,Array.isArray(s)?aY(s):s)??JJ:JJ;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=RJ([p.ref,QJ(i),...o]):p.ref=LJ(p.ref,QJ(i),o):LJ(null,null)),l?(u!==void 0&&(p.className=pY(p.className,u)),d!==void 0&&(p.style=$J(p.style,d)),p):JJ}var _Y=Symbol.for(`react.lazy`);function vY(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=iY(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===_Y&&(i=y.Children.toArray(t)[0]),y.cloneElement(i,e)}if(e&&typeof e==`string`)return yY(e,n);throw Error(YJ(8))}function yY(e,t){return e===`button`?(0,y.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,y.createElement)(`img`,{alt:``,...t,key:t.key}):y.createElement(e,t)}var bY={...y},xY=0;function SY(e,t=`mui`){let[n,r]=y.useState(e),i=e||n;return y.useEffect(()=>{n??(xY+=1,r(`${t}-${xY}`))},[n,t]),i}var CY=bY.useId;function wY(e,t){if(CY!==void 0){let n=CY();return e??(t?`${t}-${n}`:n)}return SY(e,t)}function TY(e){return wY(e,`base-ui`)}function EY(){return typeof window<`u`}function DY(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function OY(e){return EY()?e instanceof Element||e instanceof DY(e).Element:!1}function kY(e){return EY()?e instanceof HTMLElement||e instanceof DY(e).HTMLElement:!1}function AY(e){return!EY()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof DY(e).ShadowRoot}var jY=y.createContext(void 0);function MY(e=!1){let t=y.useContext(jY);if(t===void 0&&!e)throw Error(YJ(16));return t}function NY(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:y.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function PY(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=y.useRef(null),o=MY(!0)!==void 0,s=PJ(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=NY({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=y.useCallback(()=>{let e=a.current;FY(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return UJ(l,[l]),{getButtonProps:y.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return iY({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(fY(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(fY(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:PJ(e=>{a.current=e,l()})}}function FY(e){return kY(e)&&e.tagName===`BUTTON`}var IY=y.createContext(void 0);function LY(){let e=y.useContext(IY);if(e===void 0)throw Error(YJ(63));return e}var RY=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),zY={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},BY={valid(e){return e===null?null:e?{[RY.valid]:``}:{[RY.invalid]:``}}},VY=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),HY={...BY,checked(e){return e?{[VY.checked]:``}:{[VY.unchecked]:``}}};function UY(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var WY=y.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:qJ,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function GY(){return y.useContext(WY)}var KY=y.createContext({invalid:void 0,name:void 0,validityData:{state:zY,errors:[],error:``,value:``,initialValue:null},setValidityData:qJ,disabled:void 0,touched:!1,setTouched:qJ,dirty:!1,setDirty:qJ,filled:!1,setFilled:qJ,focused:!1,setFocused:qJ,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=JJ)=>e,getInputValidationProps:(e=JJ)=>e,inputRef:{current:null},commit:async()=>{}}});function qY(e=!0){let t=y.useContext(KY);if(t.setValidityData===qJ&&!e)throw Error(YJ(28));return t}function JY(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=GY(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=qY(),f=PJ(e.getValue);UJ(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),UJ(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:UY(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?Qd.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),UJ(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var YY=y.createContext({controlId:void 0,registerControlId:qJ,labelId:void 0,setLabelId:qJ,messageIds:[],setMessageIds:qJ,getDescriptionProps:e=>e});function XY(){return y.useContext(YY)}function ZY(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=XY(),o=TY(t),s=n?i:void 0,c=jJ(()=>Symbol(`labelable-control`)),l=y.useRef(!1),u=y.useRef(t!=null),d=PJ(()=>{!l.current||a===qJ||(l.current=!1,a(c.current,void 0))});return UJ(()=>{if(a===qJ)return;let e;if(n){let n=r?.current;e=OY(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),y.useEffect(()=>d,[d]),i??o}var QY=`none`;function $Y(e,t,n,r){let i=!1,a=!1,o=r??JJ;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function eX(e,t){let n=y.useRef(e),r=PJ(t);UJ(()=>{n.current!==e&&r(n.current)},[e,r]),UJ(()=>{n.current=e},[e])}var tX=y.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=GY(),{state:v,setTouched:b,setDirty:x,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:A}=qY(),{labelId:j}=XY(),M=D||f,N=O??s,P=PJ(l),F=y.useRef(null),ee=LJ(F,o,A.inputRef),I=y.useRef(null),L=TY(),R=ZY({id:a,implicit:!1,controlRef:I}),z=c?void 0:R,[B,te]=kJ({controlled:n,default:!!i,name:`Switch`,state:`checked`});JY({id:L,commit:A.commit,value:B,controlRef:I,name:N,getValue:()=>B}),UJ(()=>{F.current&&C(F.current.checked)},[F,C]),eX(B,()=>{_(N),x(B!==S.initialValue),C(B),T()?A.commit(B):A.commit(B,!0)});let{getButtonProps:V,buttonRef:ne}=PY({disabled:M,native:c}),H={id:c?R:L,role:`switch`,"aria-checked":B,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":j,onFocus(){M||w(!0)},onBlur(){let e=F.current;!e||M||(b(!0),w(!1),E===`onBlur`&&A.commit(e.checked))},onClick(e){u||M||(e.preventDefault(),F.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},re=y.useMemo(()=>iY({checked:B,disabled:M,id:z,name:N,required:d,style:N?KJ:GJ,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:ee,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=$Y(QY,e.nativeEvent);P?.(t,n),!n.isCanceled&&te(t)},onFocus(){I.current?.focus()}},A.getInputValidationProps,h===void 0?JJ:{value:h}),[B,M,ee,z,N,P,d,te,A,h]),ie=y.useMemo(()=>({...v,checked:B,disabled:M,readOnly:u,required:d}),[v,B,M,u,d]),ae=hY(`span`,e,{state:ie,ref:[t,I,ne],props:[H,A.getValidationProps,g,V],stateAttributesMapping:HY});return(0,k.jsxs)(IY.Provider,{value:ie,children:[ae,!B&&N&&m!==void 0&&(0,k.jsx)(`input`,{type:`hidden`,name:N,value:m}),(0,k.jsx)(`input`,{...re})]})}),nX=y.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=qY(),o=LY();return hY(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:HY,props:i})});function rX({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i,id:a,ariaLabelledBy:o,ariaDescribedBy:s}){return(0,k.jsx)(tX,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,id:a,"aria-labelledby":o,"aria-describedby":s,className:b_(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,k.jsx)(nX,{className:b_(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}function iX(e,t,n,r){return function({ids:i}){let a=W(t=>t[e]),o=W(e=>e[t]);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,className:Uq,"aria-label":`Test ${r}`,onClick:()=>void n(),children:`Test`}),(0,k.jsx)(rX,{className:Nt,id:i.control,checked:a,onCheckedChange:e=>{o(e),e&&wJ()},ariaLabelledBy:i.label,ariaDescribedBy:i.description})]})}}var aX=[{id:`sound-permission`,page:`notifications`,label:`Permission sound`,description:`Play a ping when any session needs permission.`,keywords:[`sound`,`audio`,`alert`,`ping`,`approval`],Control:iX(`soundOnPermission`,`setSoundOnPermission`,DJ,`permission sound`)},{id:`sound-idle`,page:`notifications`,label:`Idle sound`,description:`Play a chime when a session finishes working.`,keywords:[`sound`,`audio`,`alert`,`chime`,`done`,`finished`],Control:iX(`soundOnIdle`,`setSoundOnIdle`,OJ,`idle sound`)}];function oX(e,t,n){let r=`/api/settings/${e}`,[i,a]=(0,y.useState)(n),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(!1),u=(0,y.useRef)(n),d=(0,y.useRef)(Promise.resolve()),f=(0,y.useRef)(0),p=(0,y.useRef)(!0),m=(0,y.useRef)(!1);return(0,y.useEffect)(()=>{p.current=!0;let e=!0;return fetch(r).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(n=>{if(!e)return;let r=n[t];f.current===0&&!m.current&&(u.current=r),m.current||a(r)}).catch(()=>{}).finally(()=>{e&&(l(!0),f.current===0&&s(!1))}),()=>{e=!1,p.current=!1}},[r,t]),{value:i,loading:o,loaded:c,set:(0,y.useCallback)(e=>{m.current=!0,f.current+=1,a(e),s(!0),d.current=d.current.then(()=>fetch(r,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[t]:e})}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status}`);u.current=e}).catch(()=>{p.current&&f.current===1&&a(u.current)}).finally(()=>{--f.current,p.current&&f.current===0&&s(!1)}))},[r,t])}}function sX(e,t){return function({ids:n}){let r=W(t=>t[e]),i=W(e=>e[t]);return(0,k.jsx)(rX,{className:Nt,id:n.control,checked:r,onCheckedChange:i,ariaLabelledBy:n.label,ariaDescribedBy:n.description})}}function cX({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`created`,label:`Created`},{value:`status`,label:`Status`},{value:`manual`,label:`Manual`}],value:W(e=>e.sessionSortMode),onChange:W(e=>e.setSessionSortMode),labelledBy:e.label,describedBy:e.description})}function lX(){let e=W(e=>e.sessionSortMode);return e===`status`?(0,k.jsx)(k.Fragment,{children:`Permission sessions come first; the rest sort by newest activity.`}):e===`manual`?(0,k.jsx)(k.Fragment,{children:`Drag sessions in the sidebar to reorder them.`}):(0,k.jsx)(k.Fragment,{children:`Sessions stay in the order they were created.`})}function uX({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}],value:W(e=>e.sessionSortDirection),onChange:W(e=>e.setSessionSortDirection),labelledBy:e.label,describedBy:e.description})}function dX({ids:e}){return(0,k.jsx)(Zq,{options:[{value:`top`,label:`Top`},{value:`bottom`,label:`Bottom`}],value:W(e=>e.sidebarAnchor),onChange:W(e=>e.setSidebarAnchor),labelledBy:e.label,describedBy:e.description})}function fX(){return W(e=>e.sidebarAnchor)===`bottom`?(0,k.jsx)(k.Fragment,{children:`The sidebar is mirrored: the first session sits at the bottom, next to the prompt.`}):(0,k.jsx)(k.Fragment,{children:`The first session sits at the top of the sidebar.`})}function pX({ids:e}){let{value:t,loaded:n,set:r}=oX(`history-max-age-hours`,`hours`,24);return(0,k.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,k.jsx)(qq,{id:e.control,type:`text`,inputMode:`numeric`,value:String(t),disabled:!n,describedBy:e.description,wrapperClassName:`w-20`,className:`text-center tabular-nums`,onCommit:e=>{let n=Jq(e,1,168);return n===null?`Enter 1–168`:(n!==t&&r(n),null)}}),(0,k.jsx)(`span`,{className:`flex h-[32px] items-center text-[12px] text-muted max-md:h-[44px]`,children:`hours`})]})}function mX({ids:e}){let{value:t,loaded:n,set:r}=oX(`prefer-window-name`,`enabled`,!1);return(0,k.jsx)(rX,{className:Nt,id:e.control,checked:t,onCheckedChange:r,disabled:!n,ariaLabelledBy:e.label,ariaDescribedBy:e.description})}var hX=[{id:`sort-order`,page:`session-list`,label:`Sort order`,description:`Created keeps creation order, Status re-sorts by status, Manual lets you drag.`,keywords:[`sort`,`order`,`created`,`status`,`manual`,`drag`],layout:`wide`,Description:lX,Control:cX},{id:`sort-direction`,page:`session-list`,label:`Sort direction`,description:`Newest or oldest sessions first.`,keywords:[`sort`,`newest`,`oldest`,`ascending`,`descending`],layout:`wide`,visibleWhen:e=>e.sessionSortMode===`created`,Control:uX},{id:`sidebar-anchor`,page:`session-list`,label:`Sidebar anchor`,description:`Top lists the first session at the top; Bottom mirrors the sidebar.`,keywords:[`sidebar`,`mirror`,`top`,`bottom`],tags:[`desktop`],Description:fX,Control:dX},{id:`show-project-name`,page:`session-list`,label:`Project name`,description:`Show the project folder name under each session.`,keywords:[`folder`,`details`],Control:sX(`showProjectName`,`setShowProjectName`)},{id:`show-last-user-message`,page:`session-list`,label:`Last user message`,description:`Show the most recent prompt next to the project name.`,keywords:[`prompt`,`input`,`details`],Control:sX(`showLastUserMessage`,`setShowLastUserMessage`)},{id:`show-session-id-prefix`,page:`session-list`,label:`Session ID prefix`,description:`Show the first 5 characters of the agent session ID.`,keywords:[`id`,`uuid`,`details`],Control:sX(`showSessionIdPrefix`,`setShowSessionIdPrefix`)},{id:`history-lookback`,page:`session-list`,label:`History lookback`,description:`Show history sessions from the last N hours (1–168), up to the 100 most recent. Default 24.`,keywords:[`history`,`hours`,`age`,`inactive`,`past`],Control:pX},{id:`prefer-window-name`,page:`session-list`,label:`Prefer window names`,description:`Label discovered sessions with their tmux window name instead of the session name.`,keywords:[`tmux`,`window`,`name`,`title`],Control:mX}],gX=`1-9 [ ] N X ,`;function _X({ids:e}){let t=W(e=>e.useWebGL),n=W(e=>e.setUseWebGL);return(0,k.jsx)(rX,{className:Nt,id:e.control,checked:t,onCheckedChange:n,ariaLabelledBy:e.label,ariaDescribedBy:e.description})}function vX(e,t){return function({ids:n}){let{value:r,loaded:i,set:a}=oX(e,`enabled`,t);return(0,k.jsx)(rX,{className:Nt,id:n.control,checked:r,onCheckedChange:a,disabled:!i,ariaLabelledBy:n.label,ariaDescribedBy:n.description})}}var yX=[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`];function bX({ids:e}){let t=W(e=>e.shortcutModifier),n=W(e=>e.setShortcutModifier);return(0,k.jsx)(Zq,{options:yX.map(e=>({value:e,label:e===`auto`?`Auto`:Ct(e)})),value:t,onChange:n,labelledBy:e.label,describedBy:e.description})}function xX(){return(0,k.jsxs)(k.Fragment,{children:[`Shortcuts: `,Ct(xt(W(e=>e.shortcutModifier))),` + `,gX,` (sessions, navigate, new, kill, settings).`]})}var SX=[{id:`webgl`,page:`terminal`,label:`WebGL acceleration`,description:`GPU rendering for better performance. Turn off if text looks fuzzy or flickers (common in Safari).`,keywords:[`gpu`,`renderer`,`canvas`,`blurry`,`performance`],tags:[`device`],Control:_X},{id:`mouse-mode`,page:`terminal`,label:`Mouse mode`,description:`tmux mouse mode for trackpad and scroll wheel support.`,keywords:[`tmux`,`scroll`,`trackpad`,`mouse`],Control:vX(`tmux-mouse-mode`,!0)},{id:`terminal-colors`,page:`terminal`,label:`Terminal colors`,description:`Preserve ANSI colors in terminal output. Hibernate then Wake running agents after changing this.`,keywords:[`ansi`,`color`,`colour`],Control:vX(`terminal-colors`,!0)},{id:`shortcut-modifier`,page:`terminal`,label:`Keyboard shortcut modifier`,description:`Modifier keys for the app shortcuts. Auto picks ⌃⌥ on macOS, ⌃⇧ elsewhere.`,keywords:[`keyboard`,`shortcut`,`hotkey`,`ctrl`,`cmd`,`option`,`shift`],tags:[`desktop`,`device`],layout:`wide`,Description:xX,Control:bX}],CX=[...hJ,...hX,...iJ,...SX,...aX];function wX(e,t=CX){return t.filter(t=>t.page===e)}function TX(e){return[e.label,e.description,...e.keywords??[]].join(` `).toLowerCase()}function EX(e,t=CX){let n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[]:t.filter(e=>{let t=TX(e);return n.every(e=>t.includes(e))})}function DX(e){return Pq.map(t=>({page:t.id,label:t.label,rows:e.filter(e=>e.page===t.id)})).filter(e=>e.rows.length>0)}var OX={desktop:`Desktop`,device:`This device`},kX={desktop:`Only affects the desktop layout`,device:`Stored in this browser only; not synced to other devices`};function AX({tag:e}){return(0,k.jsx)(`span`,{title:kX[e],className:`shrink-0 border border-border px-1 py-px text-[10px] uppercase leading-none tracking-wide text-muted`,children:OX[e]})}function jX(e){let t=`settings-${e}`;return{control:`${t}-control`,label:`${t}-label`,description:`${t}-desc`}}function MX({row:e}){let t=jX(e.id),n=e.layout??`inline`,{Control:r,Description:i}=e;return(0,k.jsxs)(`div`,{"data-setting-row":e.id,className:b_(`flex gap-x-6 gap-y-3 py-4`,n===`block`&&`flex-col`,n===`wide`&&`items-center max-md:flex-col max-md:items-stretch`,n===`inline`&&`items-center`),children:[(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,k.jsx)(`label`,{id:t.label,htmlFor:t.control,className:`text-[14px] leading-snug text-primary`,children:e.label}),e.tags?.map(e=>(0,k.jsx)(AX,{tag:e},e))]}),(0,k.jsx)(`div`,{id:t.description,className:`mt-1 text-[12px] leading-snug text-muted text-pretty`,children:i?(0,k.jsx)(i,{}):e.description})]}),(0,k.jsx)(`div`,{className:b_(`flex min-w-0 items-center gap-2`,n===`inline`?`shrink-0`:`max-w-full`),children:(0,k.jsx)(r,{ids:t})})]})}function NX(e,t){return e.visibleWhen?e.visibleWhen(t):!0}function PX({rows:e}){let t=W(t=>e.map(e=>NX(e,t)?`1`:`0`).join(``));return(0,k.jsx)(`div`,{className:`divide-y divide-border`,children:e.filter((e,n)=>t[n]===`1`).map(e=>(0,k.jsx)(MX,{row:e},e.id))})}function FX({page:e,showTitle:t}){let n=(0,y.useMemo)(()=>wX(e),[e]);return(0,k.jsxs)(`section`,{"aria-labelledby":t?`settings-page-${e}-title`:void 0,children:[t&&(0,k.jsx)(`h3`,{id:`settings-page-${e}-title`,className:`pb-1 text-[18px] font-semibold leading-tight text-primary`,children:Iq(e)}),(0,k.jsx)(PX,{rows:n})]})}function IX({query:e}){let t=(0,y.useMemo)(()=>EX(e),[e]),n=W(e=>t.some(t=>NX(t,e))),r=(0,y.useMemo)(()=>DX(t),[t]);return n?(0,k.jsx)(`div`,{className:`flex flex-col gap-6`,children:r.map(e=>(0,k.jsx)(LX,{label:e.label,rows:e.rows},e.page))}):(0,k.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-1 py-16 text-center`,children:[(0,k.jsxs)(`p`,{className:`text-[14px] text-primary`,children:[`No settings match “`,e.trim(),`”`]}),(0,k.jsx)(`p`,{className:`text-[12px] text-muted`,children:`Try a different word, like “font” or “sound”.`})]})}function LX({label:e,rows:t}){return W(e=>t.some(t=>NX(t,e)))?(0,k.jsxs)(`section`,{"aria-label":e,children:[(0,k.jsx)(`h3`,{className:`border-b border-border pb-1 text-[11px] font-medium uppercase tracking-wider text-muted`,children:e}),(0,k.jsx)(PX,{rows:t})]}):null}function RX(e){return`settings-tab-${e}`}function zX(e,t,n){return e===`ArrowDown`?(t+1)%n:e===`ArrowUp`?(t-1+n)%n:e===`Home`?0:e===`End`?n-1:null}function BX({variant:e,current:t,onSelect:n,panelId:r}){let i=(0,y.useRef)([]),a=Math.max(0,Pq.findIndex(e=>e.id===t)),o=(t,r)=>{let a=zX(t.key,r,Pq.length);a!==null&&(t.preventDefault(),i.current[a]?.focus(),e===`tabs`&&n(Pq[a].id))};return e===`list`?(0,k.jsx)(`nav`,{"aria-label":`Settings pages`,children:(0,k.jsx)(`ul`,{className:`divide-y divide-border border-y border-border`,children:Pq.map((e,t)=>(0,k.jsx)(`li`,{children:(0,k.jsxs)(`button`,{ref:e=>{i.current[t]=e},type:`button`,"data-page-id":e.id,onClick:()=>n(e.id),onKeyDown:e=>o(e,t),className:`flex min-h-[52px] w-full items-center justify-between gap-3 px-4 text-left text-[15px] text-primary active:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[e.label,(0,k.jsx)(V,{width:G.primary,height:G.primary,className:`text-muted`,"aria-hidden":`true`})]})},e.id))})}):(0,k.jsx)(`div`,{role:`tablist`,"aria-orientation":`vertical`,"aria-label":`Settings pages`,className:`flex flex-col gap-px`,children:Pq.map((e,s)=>{let c=e.id===t;return(0,k.jsx)(`button`,{ref:e=>{i.current[s]=e},id:RX(e.id),type:`button`,role:`tab`,"aria-selected":c,"aria-controls":r,tabIndex:s===a?0:-1,onClick:()=>n(e.id),onKeyDown:e=>o(e,s),className:b_(`flex h-[32px] w-full items-center border-l-2 px-3 text-left text-[13px] transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,c?`border-primary bg-hover font-medium text-primary`:`border-transparent text-secondary hover:text-primary`),children:e.label},e.id)})})}var VX=(0,y.forwardRef)(function({value:e,onChange:t,className:n},r){return(0,k.jsxs)(`div`,{className:n,children:[(0,k.jsx)(`label`,{htmlFor:`settings-search`,className:`sr-only`,children:`Search settings`}),(0,k.jsx)(`input`,{ref:r,id:`settings-search`,type:`search`,value:e,placeholder:`Search settings`,autoComplete:`off`,spellCheck:!1,onChange:e=>t(e.target.value),onKeyDown:n=>{n.key===`Escape`&&e&&(n.preventDefault(),t(``))},className:`input h-[32px] px-2 py-0 text-[13px] max-md:h-[44px] max-md:text-[16px] focus-visible:ring-2 focus-visible:ring-accent/40`})]})}),HX=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function UX(e){return Array.from(e.querySelectorAll(HX)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex!==-1)}function WX(e,t,n){if(e.length===0)return null;let r=e[0],i=e[e.length-1],a=t===null?-1:e.indexOf(t);return a===-1?n?i:r:n&&a===0?i:!n&&a===e.length-1?r:null}var GX=`.xterm-helper-textarea`,KX=300,qX=`[data-suspends-terminal]`,JX=null;function YX(e){return!e||typeof document>`u`||e===document.body?null:typeof e.focus==`function`?e:null}function XX(e,t){if(e.isConnected)return e;if(!t)return null;let n=t.replace(/["\\]/g,`\\$&`);return document.querySelector(`button[aria-label="${n}"]`)}function ZX(){(0,y.useEffect)(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;JX&&=(clearTimeout(JX),null);let e=YX(document.activeElement),t=document.querySelector(GX);t&&(t.blur(),t.setAttribute(`disabled`,`true`));let n=e?.getAttribute?.(`aria-label`)??null;return()=>{JX=setTimeout(()=>{if(JX=null,document.querySelector(qX))return;let r=document.querySelector(GX);if(r){r.removeAttribute(`disabled`),r.focus();return}(e&&e!==t?XX(e,n):null)?.focus()},KX)}},[])}function QX(e,t){let n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let t=t=>{if(t.key===`Escape`){if(t.defaultPrevented)return;t.preventDefault(),t.stopPropagation(),n.current();return}if(t.key!==`Tab`)return;let r=e.current;if(!r)return;let i=document.activeElement,a=WX(UX(r),i,t.shiftKey);a&&(t.preventDefault(),a.focus())},r=t=>{let n=e.current,r=t.target;n&&r&&!n.contains(r)&&n.focus()};return document.addEventListener(`keydown`,t),document.addEventListener(`focusin`,r),()=>{document.removeEventListener(`keydown`,t),document.removeEventListener(`focusin`,r)}},[e])}function $X({isOpen:e,onClose:t}){return e?(0,k.jsx)(nZ,{onClose:t}):null}var eZ=`settings-panel`,tZ=`flex shrink-0 items-center justify-center text-secondary transition-colors hover:bg-hover hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`;function nZ({onClose:e}){let t=zh(),[n,r]=(0,y.useState)(()=>t?null:zq()),[i,a]=(0,y.useState)(``),o=(0,y.useRef)(null),s=(0,y.useRef)(null),c=(0,y.useRef)(null),l=(0,y.useRef)(!1),u=(0,y.useRef)(null);ZX(),QX(o,e),(0,y.useEffect)(()=>{t?o.current?.focus():s.current?.focus()},[]),(0,y.useEffect)(()=>{if(t){if(n)c.current?.focus();else if(u.current){let e=o.current?.querySelector(`[data-page-id="${u.current}"]`);u.current=null,e?.focus()}}},[t,n]);let d=e=>{r(e),Bq(e),a(``)},f=i.trim().length>0,p=(0,k.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close settings`,className:b_(tZ,`size-[32px] max-md:size-[44px]`),children:(0,k.jsx)(Ye,{width:G.primary,height:G.primary})});if(t)return(0,k.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-suspends-terminal":``,tabIndex:-1,className:`fixed inset-0 z-50 flex flex-col bg-elevated outline-none`,style:{paddingTop:`env(safe-area-inset-top)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`},children:[(0,k.jsxs)(`header`,{className:`flex h-[52px] shrink-0 items-center gap-1 border-b border-border px-1`,children:[n?(0,k.jsx)(`button`,{ref:c,type:`button`,onClick:()=>{u.current=n,r(null)},"aria-label":`Back to settings`,className:b_(tZ,`size-[44px]`),children:(0,k.jsx)(V,{width:G.primary,height:G.primary,className:`rotate-180`})}):(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`size-[44px] shrink-0`}),(0,k.jsx)(`h2`,{id:`settings-title`,className:`min-w-0 flex-1 truncate text-center text-[16px] font-semibold text-primary`,children:n?Iq(n):`Settings`}),p]}),(0,k.jsx)(`div`,{id:eZ,className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-4`,style:{paddingBottom:`calc(24px + env(safe-area-inset-bottom))`},children:n?(0,k.jsx)(FX,{page:n,showTitle:!1}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(VX,{ref:s,value:i,onChange:a,className:`py-3`}),f?(0,k.jsx)(IX,{query:i}):(0,k.jsx)(`div`,{className:`-mx-4`,children:(0,k.jsx)(BX,{variant:`list`,current:null,onSelect:d})})]})})]});let m=n??zq();return(0,k.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4`,onMouseDown:e=>{l.current=e.target===e.currentTarget},onClick:t=>{l.current&&t.target===t.currentTarget&&e(),l.current=!1},children:(0,k.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-suspends-terminal":``,tabIndex:-1,className:`flex h-[600px] max-h-full w-[760px] max-w-full flex-col border border-border bg-elevated shadow-2xl outline-none`,children:[(0,k.jsxs)(`header`,{className:`flex h-[48px] shrink-0 items-center justify-between border-b border-border pl-5 pr-2`,children:[(0,k.jsx)(`h2`,{id:`settings-title`,className:`text-[13px] font-semibold uppercase tracking-wider text-primary`,children:`Settings`}),p]}),(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex w-[192px] shrink-0 flex-col gap-3 border-r border-border p-3`,children:[(0,k.jsx)(VX,{ref:s,value:i,onChange:a}),(0,k.jsx)(BX,{variant:`tabs`,current:f?null:m,onSelect:d,panelId:eZ})]}),(0,k.jsx)(`div`,{id:eZ,role:f?`region`:`tabpanel`,"aria-label":f?`Search results`:void 0,"aria-labelledby":f?void 0:RX(m),className:`min-w-0 flex-1 overflow-y-auto overflow-x-hidden px-6 py-5`,children:f?(0,k.jsx)(IX,{query:i}):(0,k.jsx)(FX,{page:m,showTitle:!0})})]})]})})}var rZ=[];function iZ(e){y.useEffect(e,rZ)}var aZ=y.createContext(void 0);function oZ(){let e=y.useContext(aZ);if(!e)throw Error(YJ(73));return e}var sZ=Symbol(`NOT_FOUND`);function cZ(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function lZ(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function uZ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var dZ=e=>Array.isArray(e)?e:[e];function fZ(e){let t=Array.isArray(e[0])?e[0]:e;return uZ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function pZ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function mZ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:sZ},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function hZ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return sZ}function i(t,i){r(t)===sZ&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var gZ=(e,t)=>e===t;function _Z(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function vZ(e,t){let{equalityCheck:n=gZ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=_Z(n),o=0,s=r<=1?mZ(a):hZ(r,a);function c(){let t=s.get(arguments);if(t===sZ){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var yZ=class{constructor(e){this.value=e}deref(){return this.value}},bZ=typeof WeakRef<`u`?WeakRef:yZ,xZ=0,SZ=1;function CZ(){return{s:xZ,v:void 0,o:null,p:null}}function wZ(e,t={}){let n=CZ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=CZ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=CZ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===SZ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new bZ(c):c}return s.s=SZ,s.v=c,c}return o.clearCache=()=>{n=CZ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function TZ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),cZ(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=wZ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=dZ(c),p=dZ(u),m=fZ(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=pZ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var EZ=TZ(wZ),DZ=Object.assign((e,t=EZ)=>{lZ(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>DZ}),OZ=TZ({memoize:vZ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),kZ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(YJ(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},AZ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(YJ(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(YJ(2))}u=OZ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},jZ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),MZ=s(((e,t)=>{t.exports=jZ()})),NZ=s((e=>{var t=p(),n=MZ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),PZ=s(((e,t)=>{t.exports=NZ()})),FZ=[],IZ=void 0;function LZ(){return IZ}function RZ(e){FZ.push(e)}var zZ=MZ(),BZ=PZ(),VZ=ZJ(19)?WZ:GZ;function HZ(e,t,n,r,i){return VZ(e,t,n,r,i)}function UZ(e,t,n,r,i){let a=y.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,zZ.useSyncExternalStore)(e.subscribe,a,a)}RZ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,zZ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function WZ(e,t,n,r,i){let a=LZ();if(!a)return UZ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function GZ(e,t,n,r,i){return(0,BZ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var KZ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return HZ(this,e,t,n,r)}},qZ=class extends KZ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){y.useDebugValue(e),UJ(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;UJ(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;UJ(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){y.useDebugValue(e);let n=t!==void 0;UJ(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return y.useDebugValue(e),HZ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){y.useDebugValue(e);let n=PJ(t??qJ);this.context[e]=n}useStateSetter(e){let t=y.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},JZ=null;globalThis.requestAnimationFrame;var YZ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},XZ=class e{static create(){return new e}static request(e){return YZ.request(e)}static cancel(e){return YZ.cancel(e)}currentId=JZ;request(e){this.cancel(),this.currentId=YZ.request(()=>{this.currentId=JZ,e()})}cancel=()=>{this.currentId!==JZ&&(YZ.cancel(this.currentId),this.currentId=JZ)};disposeEffect=()=>this.cancel};function ZZ(){let e=jJ(XZ.create).current;return iZ(e.disposeEffect),e}var QZ=0,$Z=class e{static create(){return new e}currentId=QZ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=QZ,t()},e)}isStarted(){return this.currentId!==QZ}clear=()=>{this.currentId!==QZ&&(clearTimeout(this.currentId),this.currentId=QZ)};disposeEffect=()=>this.clear};function eQ(){let e=jJ($Z.create).current;return iZ(e.disposeEffect),e}var tQ=0;function nQ(e){return tQ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${tQ}`}function rQ(e){return e?.ownerDocument||document}function iQ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var aQ=typeof navigator<`u`,oQ=dQ(),sQ=pQ(),cQ=fQ();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),oQ.platform===`MacIntel`&&oQ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(oQ.platform),aQ&&/firefox/i.test(cQ);var lQ=aQ&&/apple/i.test(navigator.vendor);aQ&&/Edg/i.test(cQ),aQ&&/android/i.test(sQ)||/android/i.test(cQ),aQ&&sQ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var uQ=cQ.includes(`jsdom/`);function dQ(){if(!aQ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function fQ(){if(!aQ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function pQ(){if(!aQ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function mQ(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function hQ(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&AY(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function gQ(e){return`composedPath`in e?e.composedPath()[0]:e.target}function _Q(e){if(!e||uQ)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var vQ=AZ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),yQ={toasts:kZ(e=>e.toasts),isEmpty:kZ(e=>e.toasts.length===0),toast:kZ(vQ,(e,t)=>e.get(t)?.value),toastIndex:kZ(vQ,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:kZ(vQ,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:kZ(vQ,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:kZ(e=>e.hovering),focused:kZ(e=>e.focused),expanded:kZ(e=>e.hovering||e.focused),expandedOrOutOfFocus:kZ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:kZ(e=>e.prevFocusElement)},bQ=class extends qZ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},yQ)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=yQ.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||nQ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),yQ.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=yQ.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),yQ.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{yQ.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=iQ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=iQ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=iQ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=$Z.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=gQ(e);hQ(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!yQ.expandedOrOutOfFocus(this.state),a=i?$Z.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=mQ(rQ(this.state.viewport));if(!this.state.viewport||!hQ(this.state.viewport,t)||!_Q(t))return;let n=yQ.toasts(this.state),r=yQ.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},xQ=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=jJ(()=>new bQ({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return iZ(a.disposeEffect),y.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,k.jsx)(aZ.Provider,{value:a,children:t})},SQ=y.forwardRef(function(e,t){let[n,r]=y.useState();UJ(()=>{lQ&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,k.jsx)(`span`,{...e,ref:t,style:GJ,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),CQ=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),wQ=y.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=oZ(),s=eQ(),c=y.useRef(!1),l=y.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=y.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);y.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(mQ(rQ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=DY(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),y.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=DY(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=gQ(n),i=mQ(rQ(e));(!hQ(e,r)||!_Q(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),y.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=rQ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}y.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function b(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function x(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||_Q(rQ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||hQ(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:b,onMouseMove:b,onMouseLeave:x,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=hY(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[CQ.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,k.jsxs)(y.Fragment,{children:[!u&&m&&(0,k.jsx)(SQ,{onFocus:_}),i,!u&&m&&(0,k.jsx)(SQ,{onFocus:_})]})}]}),D=y.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,k.jsxs)(y.Fragment,{children:[!u&&m&&(0,k.jsx)(SQ,{onFocus:_}),E,!f&&D.length>0&&(0,k.jsx)(`div`,{style:GJ,children:D.map(e=>(0,k.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,k.jsx)(`div`,{children:e.title}),(0,k.jsx)(`div`,{children:e.description})]},e.id))})]})});function TQ(e){return ZJ(19)?e:e?`true`:void 0}var EQ=y.createContext(void 0);function DQ(){let e=y.useContext(EQ);if(!e)throw Error(YJ(66));return e}var OQ=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),kQ={[OQ.startingStyle]:``},AQ={[OQ.endingStyle]:``},jQ={transitionStatus(e){return e===`starting`?kQ:e===`ending`?AQ:null}};function MQ(e){return e==null?e:`current`in e?e.current:e}function NQ(e,t=!1,n=!0){let r=ZZ();return PJ((i,a=null)=>{r.cancel();function o(){Qd.flushSync(i)}let s=MQ(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=OQ.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function PQ(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=PJ(i),o=NQ(r,n,!1);y.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var FQ=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),IQ={...jQ,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},LQ=40,RQ=10,zQ=.5,BQ=1;function VQ(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function HQ(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var UQ=y.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=oZ(),[d,f]=y.useState(void 0),[p,m]=y.useState(!1),[h,g]=y.useState(!1),[_,v]=y.useState(!1),[b,x]=y.useState({x:0,y:0}),[S,C]=y.useState({x:0,y:0,scale:1}),[w,T]=y.useState(),[E,D]=y.useState(),[O,A]=y.useState(null),j=y.useRef(null),M=y.useRef({x:0,y:0}),N=y.useRef({x:0,y:0,scale:1}),P=y.useRef(void 0),F=y.useRef(0),ee=y.useRef(!1),I=y.useRef({x:0,y:0}),L=y.useRef(!1),R=u.useState(`toastIndex`,n.id),z=u.useState(`toastVisibleIndex`,n.id),B=u.useState(`toastOffsetY`,n.id),te=u.useState(`focused`),V=u.useState(`expanded`);PQ({open:n.transitionStatus!==`ending`,ref:j,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let ne=PJ((e=!1)=>{let t=j.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:j,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?Qd.flushSync(a):a()});UJ(ne,[ne]);function H(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**zQ:-(Math.abs(e)**zQ):(!c.includes(`right`)&&e>0&&(n=e**zQ),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**zQ))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**zQ:-(Math.abs(t)**zQ):(!c.includes(`down`)&&t>0&&(r=t**zQ),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**zQ))),{x:n,y:r}}function re(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=gQ(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(ee.current=!1,P.current=void 0,F.current=0,M.current={x:e.clientX,y:e.clientY},I.current=M.current,j.current){let e=HQ(j.current);N.current=e,C(e),x({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),A(null),L.current=!0,j.current?.setPointerCapture(e.pointerId)}}function ie(e){if(!p)return;e.preventDefault(),L.current&&=(M.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-M.current.x,o=t-M.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=BQ&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&A(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!P.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(P.current=u,F.current=VQ(u,a,o),f(u));else{let e=P.current,t=VQ(e,l,s);t>LQ?(ee.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&F.current-t>=RQ&&(ee.current=!0)}let d=H(a,o),m=N.current.x,_=N.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),x({x:m,y:_})}function ae(e){if(!p)return;if(m(!1),g(!1),A(null),j.current?.releasePointerCapture(e.pointerId),ee.current){x({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=b.x-S.x,i=b.y-S.y,a;for(let e of c){switch(e){case`right`:r>LQ&&(t=!0,a=`right`);break;case`left`:r<-LQ&&(t=!0,a=`left`);break;case`down`:i>LQ&&(t=!0,a=`down`);break;case`up`:i<-LQ&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(x({x:S.x,y:S.y}),f(void 0))}function U(e){if(e.key===`Escape`){if(!j.current||!hQ(j.current,mQ(rQ(j.current))))return;u.closeToast(n.id)}}y.useEffect(()=>{if(!l)return;let e=j.current;if(!e)return;function t(t){hQ(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&b.x===S.x&&b.y===S.y&&!_)return{[FQ.swipeMovementX]:`0px`,[FQ.swipeMovementY]:`0px`};let e=b.x-S.x,t=b.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${b.x}px) translateY(${b.y}px) scale(${S.scale})`:void 0,[FQ.swipeMovementX]:`${e}px`,[FQ.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":se&&!te?!0:void 0,onPointerDown:l?re:void 0,onPointerMove:l?ie:void 0,onPointerUp:l?ae:void 0,onKeyDown:U,inert:TQ(n.limited),style:{...oe(),[FQ.index]:n.transitionStatus===`ending`?R:z,[FQ.offsetY]:`${B}px`,[FQ.height]:n.height?`${n.height}px`:void 0}},le=y.useMemo(()=>({rootRef:j,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:ne,index:R,visibleIndex:z,expanded:V}),[n,w,E,p,d,ne,R,z,V]),ue={transitionStatus:n.transitionStatus,expanded:V,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=hY(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:IQ,props:[ce,o]});return(0,k.jsx)(EQ.Provider,{value:le,children:de})}),WQ=y.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=DQ(),l=a??s.description,u=!!l,d=wY(i);UJ(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=hY(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),GQ=y.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=DQ(),l=a??s.title,u=!!l,d=wY(i);UJ(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=hY(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),KQ=y.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=oZ(),{toast:c}=DQ(),l=s.useState(`expanded`),[u,d]=y.useState(!1),{getButtonProps:f,buttonRef:p}=PY({disabled:i,native:a}),m={type:c.type};return hY(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function qQ(){let e=y.useContext(aZ);if(!e)throw Error(YJ(73));let t=e.useState(`toasts`);return y.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function JQ(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||nQ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var YQ=5e3,XQ=JQ();function ZQ({toast:e}){return(0,k.jsxs)(UQ,{toast:e,className:b_(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-danger/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,k.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,k.jsx)(GQ,{className:b_(`text-sm font-medium`,e.type===`error`&&`text-danger`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,k.jsx)(WQ,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,k.jsx)(KQ,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,k.jsx)(Ye,{width:G.default,height:G.default})})]})}function QQ(){let{toasts:e}=qQ();return(0,k.jsx)(k.Fragment,{children:e.map(e=>(0,k.jsx)(ZQ,{toast:e},e.id))})}function $Q(){return(0,k.jsxs)(xQ,{timeout:YQ,toastManager:XQ,children:[(0,k.jsx)(QQ,{}),(0,k.jsx)(wQ,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var e$=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],t$=3e3,n$=8e3,r$=15e3,i$=5e3,a$=2e4,o$=1e4,s$=1500,c$=5e3,l$=750,u$=4,d$=5e3,f$=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(rk(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,rk(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{rk(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?e$[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){rk(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){rk(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}rk(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;rk(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?n$:t$;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(rk(`ws_connect_timeout`,{wsState:e$[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){rk(`ws_onopen_stale`,this.wsSnap(),`info`);return}rk(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),rk(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(c$)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(rk(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){rk(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}rk(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>r$&&(rk(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},i$))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return rk(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(rk(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){rk(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(rk(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},s$)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){rk(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){rk(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){rk(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,rk(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},l$)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,rk(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},o$)))};e!==void 0&&e<a$?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,a$)},e):this.heartbeatTimer=window.setInterval(t,a$)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){rk(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=u$){rk(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(d$*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);rk(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){rk(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function p$(){let e=Mh(e=>e.setConnectionState);return(0,y.useEffect)(()=>{f$.connect(),f$.startLifecycleListeners();let t=f$.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),f$.stopLifecycleListeners()}},[e]),{sendMessage:(0,y.useMemo)(()=>e=>{f$.send(e)},[]),subscribe:(0,y.useMemo)(()=>f$.subscribe.bind(f$),[]),getConnectionEpoch:(0,y.useMemo)(()=>()=>f$.getConnectionEpoch(),[])}}var m$=100;function h$({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>m$?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function g$(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function _$(){(0,y.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{h$({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),g$(document)}},[])}var v$=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`sidebarAnchor`,`projectFilters`,`hostFilters`,`showProjectName`,`showLastUserMessage`,`showSessionIdPrefix`,`soundOnPermission`,`soundOnIdle`],y$=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function b$(e){return typeof e==`boolean`}function x$(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function S$(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||y$.includes(t.agentType))}var C$={theme:e=>e===`dark`||e===`light`||e===`system`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(S$),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>x$(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>x$(e,1e3),sidebarAnchor:e=>e===`top`||e===`bottom`,projectFilters:e=>x$(e,500),hostFilters:e=>x$(e,500),showProjectName:b$,showLastUserMessage:b$,showSessionIdPrefix:b$,soundOnPermission:b$,soundOnIdle:b$};function w$(e){return v$.includes(e)}function T$(e,t){return C$[e](t)}var E$=`agentboard-theme`,D$=`agentboard-settings`,O$=200,k$=new Map,A$=new Map,j$=new Set;function M$(e){return A$.has(e)||j$.has(e)}var N$=null,P$=!1;function F$(e){return e===`theme`?ZG.getState().theme:W.getState()[e]}function I$(e){let t=e===`theme`?E$:D$;return w.getItem(t)!==null}function L$(){if(N$=null,A$.size===0)return;let e={},t=new Map,n=new Map;for(let[r,i]of A$)e[r]=JSON.parse(i),t.set(r,i),n.set(r,k$.get(r)),k$.set(r,i),j$.add(r);A$.clear();let r=()=>{for(let[e,r]of t){if(k$.get(e)!==r)continue;let t=n.get(e);t===void 0?k$.delete(e):k$.set(e,t)}},i=e=>{for(let n of t.keys()){if(j$.delete(n),!e||A$.has(n))continue;let t=k$.get(n);t!==void 0&&t!==JSON.stringify(F$(n))&&R$(n,JSON.parse(t))}},a=!1;try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{a=e.ok,e.ok||(rk(`synced_settings_push_rejected`,{status:e.status},`warn`),r())}).catch(e=>{rk(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`),r()}).finally(()=>i(a))}catch(e){r(),i(!1),rk(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function R$(e,t){e===`theme`?ZG.setState({theme:t}):W.setState({[e]:t})}function z$(e,t){if(k$.get(e)===JSON.stringify(t)){A$.delete(e);return}B$(e,t)}function B$(e,t){A$.set(e,JSON.stringify(t)),!N$&&(N$=setTimeout(L$,O$))}function V$(e){let t=new Map;for(let e of v$)t.set(e,I$(e));let n={},r;for(let[t,i]of Object.entries(e))!w$(t)||!T$(t,i)||(k$.set(t,JSON.stringify(i)),!M$(t)&&(t===`theme`?r=i:n[t]=i));r!==void 0&&ZG.setState({theme:r}),Object.keys(n).length>0&&W.setState(n);for(let n of v$){if(n in e||!t.get(n))continue;let r=F$(n);T$(n,r)&&k$.get(n)!==JSON.stringify(r)&&B$(n,r)}}function H$(){if(P$)return()=>{};P$=!0;let e=W.subscribe((e,t)=>{let n=e,r=t;for(let e of v$)e!==`theme`&&n[e]!==r[e]&&z$(e,n[e])}),t=ZG.subscribe((e,t)=>{e.theme!==t.theme&&z$(`theme`,e.theme)});return()=>{e(),t(),P$=!1,N$&&=(clearTimeout(N$),null),A$.clear(),j$.clear(),k$.clear()}}function U$(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function W$(){let[e,t]=(0,y.useState)(!1),[n,r]=(0,y.useState)(void 0),[i,a]=(0,y.useState)(void 0),[o,s]=(0,y.useState)(void 0),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(null),v=Mh(e=>e.sessions),b=Mh(e=>e.agentSessions),S=Mh(e=>e.agentSessionsEpoch),C=Mh(e=>e.selectedSessionId),w=Mh(e=>e.selectedHibernatingSessionId),T=Mh(e=>e.setSessions),E=Mh(e=>e.setAgentSessions),D=Mh(e=>e.setActiveAgentSessions),O=Mh(e=>e.setHostStatuses),A=Mh(e=>e.updateSession),j=Mh(e=>e.setSelectedSessionId),M=Mh(e=>e.setSelectedHibernatingSessionId),P=Mh(e=>e.hasLoaded),ee=Mh(e=>e.connectionStatus),I=Mh(e=>e.connectionError),L=Mh(e=>e.clearExitingSession),R=Mh(e=>e.markSessionExiting),z=Mh(e=>e.setRemoteAllowControl),B=Mh(e=>e.setRemoteAllowAttach),te=Mh(e=>e.setHostLabel),V=Mh(e=>e.setPreferWindowName),ne=Mh(e=>e.hostStatuses),H=Mh(e=>e.remoteAllowControl),re=Mh(e=>e.hostLabel),ie=QG(),ae=_t(),U=W(e=>e.defaultProjectDir),oe=W(e=>e.commandPresets),se=W(e=>e.defaultPresetId),ce=W(e=>e.lastProjectPath),le=W(e=>e.setLastProjectPath),ue=W(e=>e.addRecentPath),de=W(e=>e.shortcutModifier),fe=W(e=>e.sidebarWidth),pe=W(e=>e.sidebarAnchor),me=W(e=>e.setSidebarWidth),he=W(e=>e.projectFilters),ge=W(e=>e.hostFilters),_e=W(e=>e.soundOnPermission),ve=W(e=>e.soundOnIdle),ye=Mh(e=>e.connectionEpoch),{sendMessage:be,subscribe:xe,getConnectionEpoch:Se}=p$();(0,y.useEffect)(()=>H$(),[]),_$(),(0,y.useEffect)(()=>{if(typeof document>`u`||!_e&&!ve)return;let e=!1,t=()=>{e&&!SJ()||(e=!0,wJ())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[_e,ve]);let Ce=(0,y.useRef)(!1),we=(0,y.useCallback)(e=>{e.preventDefault(),Ce.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,y.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!Ce.current)return;let t=e.clientX;me(Math.max(180,Math.min(400,t)))},t=()=>{Ce.current&&(Ce.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[me]),(0,y.useEffect)(()=>{let e=xe(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=Mh.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=W.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&DJ(),e.status===`working`&&i.status===`waiting`&&r&&OJ())}if(Be.current.size>0){let e=Se();for(let[t,n]of Be.current)n.epoch!==e&&Be.current.delete(t)}let i=Be.current.size>0?e.sessions.filter(e=>!Be.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=Mh.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(Ie.current=s),T(i);let c=Le.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=Mh.getState(),{projectFilters:d,hostFilters:f}=W.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Le.current=null,j(e.id))}}if(e.type===`host-status`&&O(e.hosts),e.type===`server-config`&&(z(e.remoteAllowControl),B(e.remoteAllowAttach),te(e.hostLabel),V(e.preferWindowName),e.clientLogLevel&&nk(e.clientLogLevel)),e.type===`synced-settings`&&V$(e.settings),e.type===`session-update`){let t=Mh.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(A(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=W.getState();t!==`permission`&&n===`permission`&&e&&DJ(),t===`working`&&n===`waiting`&&r&&OJ()}}if(e.type===`session-created`){let t=Mh.getState().sessions;t.some(t=>t.id===e.session.id)||T([e.session,...t]),j(e.session.id),ue(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=W.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){gG(e.sessionId);let t=Mh.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&T(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=Mh.getState(),a=Ie.current;i&&!n.some(e=>e.sessionId===i)&&(Le.current=i),E(t,n,r),_(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(Ie.current=null,M(a)):a&&(Ie.current=null)}if(e.type===`agent-sessions-active`&&D(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=Mh.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&T(n)}if(e.type===`session-activated`){let t=Mh.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&A({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){_(t=>t?.sessionId===e.sessionId?null:t);let t=Mh.getState().sessions;t.some(t=>t.id===e.session.id)||T([e.session,...t]),j(e.session.id)}else e.ok||(p(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>p(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&_(e.session),M(e.sessionId)):(p(e.error??`Failed to hibernate session`),window.setTimeout(()=>p(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===C)&&(p(`${e.code}: ${e.message}`),window.setTimeout(()=>p(null),6e3)),e.type===`terminal-ready`&&e.sessionId===C&&p(null),e.type===`error`&&(p(e.message),window.setTimeout(()=>p(null),6e3)),e.type===`kill-failed`){let t=Be.current.get(e.sessionId);if(t){let n=Mh.getState().sessions;n.some(t=>t.id===e.sessionId)||T([t.session,...n]),t.wasSelected&&j(e.sessionId),Be.current.delete(e.sessionId)}L(e.sessionId),p(e.message),window.setTimeout(()=>p(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(p(e.error),window.setTimeout(()=>p(null),6e3))}});return()=>{e()}},[C,w,ue,L,be,j,M,_,T,E,D,O,z,B,te,V,xe,A]);let Te=(0,y.useMemo)(()=>v.find(e=>e.id===C)||null,[C,v]),Ee=b.hibernating??[],De=b.history??[],Oe=(0,y.useMemo)(()=>U$(Ee,he,ge),[Ee,he,ge]),ke=(0,y.useMemo)(()=>Oe.find(e=>e.sessionId===w)||(g?.sessionId===w?g:null),[Oe,g,w]);(0,y.useEffect)(()=>{Te?.projectPath&&!Te.remote&&le(Te.projectPath)},[Te?.projectPath,Te?.remote,le]);let Ae=W(e=>e.sessionSortMode),je=W(e=>e.sessionSortDirection),Me=W(e=>e.manualSessionOrder),Ne=(0,y.useMemo)(()=>_h(v,{mode:Ae,direction:je,manualOrder:Me}),[v,Ae,je,Me]),Pe=(0,y.useMemo)(()=>{let e=Ne;return he.length>0&&(e=e.filter(e=>he.includes(e.projectPath))),ge.length>0&&(e=e.filter(e=>ge.includes(e.host??``))),e},[Ne,he,ge]),Fe=(0,y.useRef)(w),Ie=(0,y.useRef)(null),Le=(0,y.useRef)(null),Re=(0,y.useRef)(ye),ze=(0,y.useCallback)(()=>Pe.length>0?(j(Pe[0].id),!0):Oe.length>0?(M(Oe[0].sessionId),!0):!1,[Pe,Oe,j,M]);(0,y.useEffect)(()=>{let e=Fe.current;e&&w===null&&!Ee.some(t=>t.sessionId===e)?Le.current=e:w!==null&&(Le.current=null),Fe.current=w},[Ee,w]),(0,y.useEffect)(()=>{g&&w!==g.sessionId&&_(null)},[g,w]),(0,y.useEffect)(()=>{Re.current!==ye&&(Re.current=ye,Ie.current=null,Le.current=null,_(null))},[ye]),(0,y.useEffect)(()=>{P&&(w||C&&(Pe.some(e=>e.id===C)||ze()||j(null)))},[P,C,w,ze,j]),(0,y.useEffect)(()=>{if(!w||g?.sessionId===w||S!==ye||Oe.some(e=>e.sessionId===w))return;let e=Pe.find(e=>e.agentSessionId?.trim()===w);if(e){j(e.id);return}ze()||M(null)},[Oe,Pe,S,g,w,ze,j,M,ye]),(0,y.useEffect)(()=>{let e=Le.current;if(!e)return;if(w!==null){Le.current=null;return}let t=Pe.find(t=>t.agentSessionId?.trim()===e);if(t){Le.current=null,j(t.id);return}if(C!==null){Le.current=null;return}ze()&&(Le.current=null)},[Pe,C,w,ze,j]),(0,y.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&P&&C===null&&w===null&&(Pe.length>0||Oe.length>0)&&ze()},[Oe.length,Pe.length,P,ze,C,w]);let Be=(0,y.useRef)(new Map),Ve=(0,y.useCallback)((e,t=`unknown`)=>{gG(e);let{sessions:n,selectedSessionId:r}=Mh.getState(),i=n.find(t=>t.id===e);i&&Be.current.set(e,{session:i,wasSelected:r===e,epoch:Se()}),(0,Qd.flushSync)(()=>{R(e),T(n.filter(t=>t.id!==e))}),be({type:`session-kill`,sessionId:e,source:t})},[R,T,be]);(0,y.useEffect)(()=>{let n=xt(de),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=wt(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=pe===`bottom`&&!window.matchMedia(`(max-width: 767px)`).matches,t=(i===`BracketLeft`?-1:1)*(e?-1:1),n=Pe;if(n.length===0){let e=Oe;if(e.length===0)return;let n=e.findIndex(e=>e.sessionId===w);if(n===-1){M(e[0].sessionId);return}M(e[(n+t+e.length)%e.length].sessionId);return}let a=n.findIndex(e=>e.id===C);if(a===-1){j(n[0].id);return}j(n[(a+t+n.length)%n.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(Pe.length>0){let t=Pe[e];if(!t)return;r.preventDefault(),j(t.id);return}let t=Oe[e];if(!t)return;r.preventDefault(),M(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&!c&&ae&&t(!0);return}if(a&&i===`Comma`){r.preventDefault(),l(t=>t?!1:!e);return}if(a&&i===`KeyX`){r.preventDefault(),C&&!e&&!c&&Ve(C,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,c,C,w,j,M,Pe,Oe,Ve,pe,de,ae]);let He=()=>ae?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,Ue=()=>l(!0),We=(e,t,n,r)=>{be({type:`session-create`,operationId:x(),projectPath:e,name:t,command:n,host:r}),r||le(e)},Ge=e=>{be({type:`session-wake`,sessionId:e})},Ke=(0,y.useCallback)(e=>{be({type:`session-hibernate`,sessionId:e})},[be]),qe=(e,t)=>{be({type:`session-rename`,sessionId:e,newName:t})},Je=(0,y.useCallback)(e=>{let t=v.find(t=>t.id===e);t&&be({type:`session-create`,operationId:x(),projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[v,be]),Ye=(0,y.useCallback)(e=>{be({type:`session-move-to-history`,sessionId:e})},[be]);(0,y.useEffect)(()=>$G(),[]),(0,y.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,ie)},[ie]),(0,y.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>h(e)).catch(()=>{})},[]);let Xe=(0,y.useMemo)(()=>re?ne.filter(e=>e.host!==re):ne,[ne,re]);return(0,k.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,k.jsx)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:fe},children:(0,k.jsx)(ZO,{sessions:v,hibernatingSessions:Ee,historySessions:De,selectedSessionId:C,selectedHibernatingSessionId:w,onSelect:j,onSelectHibernating:M,onRename:qe,onResume:Ge,onHibernate:Ke,onKill:Ve,onDuplicate:Je,onMoveToHistory:Ye,onNewSession:He,loading:!P,error:I||f,anchor:pe,notice:(0,k.jsx)(N,{onOpen:()=>d(!0),subscribe:xe}),filterBarControls:(0,k.jsx)(Lt,{connectionStatus:ee,onNewSession:He,onOpenSettings:Ue,onOpenHistory:()=>d(!0),tailscaleIp:m?.tailscaleIp??null,placement:pe===`bottom`?`up`:`down`})})}),(0,k.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:we}),(0,k.jsx)(mq,{session:Te,sessions:Pe,drawerSessions:v,hibernatingSession:ke,hibernatingSessions:Ee,connectionStatus:ee,connectionEpoch:ye,sendMessage:be,subscribe:xe,onClose:()=>j(null),onSelectSession:j,onSelectHibernatingSession:M,onNewSession:He,onKillSession:Ve,onRenameSession:qe,onDuplicateSession:Je,onOpenSettings:Ue,onOpenHistory:()=>d(!0),onResumeSession:Ge,onHibernateSession:Ke,onMoveToHistory:Ye,historySessions:De,loading:!P,error:I||f}),(0,k.jsx)(Nq,{isOpen:e,onClose:()=>t(!1),onCreate:We,defaultProjectDir:U,commandPresets:oe,defaultPresetId:se,lastProjectPath:ce,activeProjectPath:Te&&!Te.remote?Te.projectPath:void 0,remoteHosts:Xe,remoteAllowControl:H,initialHost:n,initialPath:i,initialCommand:o}),(0,k.jsx)($X,{isOpen:c,onClose:()=>l(!1)}),(0,k.jsx)(F,{open:u,subscribe:xe,onClose:()=>d(!1),onOpenSession:e=>{T([e,...v.filter(t=>t.id!==e.id)]),M(null),j(e.id)}}),(0,k.jsx)($Q,{})]})}var G$=`modulepreload`,K$=function(e){return`/`+e},q$={},J$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=K$(t,n),t in q$)return;q$[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:G$,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Y$=`true`,X$=`false`,Z$=Y$===`true`,Q$=X$===`true`;function $$(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,Z$||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await J$(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!Q$)if(Z$)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}vt()&&document.documentElement.classList.add(`ios`),yt()&&document.documentElement.classList.add(`ios-pwa`),$$({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var e1=document.getElementById(`root`);if(!e1)throw Error(`Root element not found`);(0,b.createRoot)(e1).render((0,k.jsx)(y.StrictMode,{children:(0,k.jsx)(W$,{})}));