@a-t-h-i/bot-lobby 0.6.31 → 0.6.32

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.
@@ -55,54 +55,54 @@ Error generating stack: `+e.message+`
55
55
  `},wx=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Tx=function(){m.useEffect(function(){return document.body.setAttribute(Sx,(wx()+1).toString()),function(){var e=wx()-1;e<=0?document.body.removeAttribute(Sx):document.body.setAttribute(Sx,e.toString())}},[])},Ex=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Tx();var a=m.useMemo(function(){return bx(i)},[i]);return m.createElement(xx,{styles:Cx(a,!t,i,n?``:`!important`)})},Dx=!1;if(typeof window<`u`)try{var Ox=Object.defineProperty({},"passive",{get:function(){return Dx=!0,!0}});window.addEventListener(`test`,Ox,Ox),window.removeEventListener(`test`,Ox,Ox)}catch{Dx=!1}var kx=Dx?{passive:!1}:!1,Ax=function(e){return e.tagName===`TEXTAREA`},jx=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ax(e)&&n[t]===`visible`)},Mx=function(e){return jx(e,`overflowY`)},Nx=function(e){return jx(e,`overflowX`)},Px=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Lx(e,r)){var i=Rx(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fx=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ix=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Lx=function(e,t){return e===`v`?Mx(t):Nx(t)},Rx=function(e,t){return e===`v`?Fx(t):Ix(t)},zx=function(e,t){return e===`h`&&t===`rtl`?-1:1},Bx=function(e,t,n,r,i){var a=zx(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Rx(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Lx(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Vx=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hx=function(e){return[e.deltaX,e.deltaY]},Ux=function(e){return e&&`current`in e?e.current:e},Wx=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Gx=function(e){return`
56
56
  .block-interactivity-${e} {pointer-events: none;}
57
57
  .allow-interactivity-${e} {pointer-events: all;}
58
- `},Kx=0,qx=[];function Jx(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(Kx++)[0],a=m.useState(gx)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Kb([e.lockRef.current],(e.shards||[]).map(Ux),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Vx(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Px(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Px(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Bx(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(qx.length&&qx[qx.length-1]===a){var r=`deltaY`in n?Hx(n):Vx(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Wx(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ux).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Yx(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=Vx(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Hx(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,Vx(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return qx.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,kx),document.addEventListener(`touchmove`,c,kx),document.addEventListener(`touchstart`,u,kx),function(){qx=qx.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,kx),document.removeEventListener(`touchmove`,c,kx),document.removeEventListener(`touchstart`,u,kx)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:Gx(i)}):null,p?m.createElement(Ex,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Yx(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Xx=ox(sx,Jx),Zx=m.forwardRef(function(e,t){return m.createElement(lx,Wb({},e,{ref:t,sideCar:Xx}))});Zx.classNames=lx.classNames;var Qx=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$x=new WeakMap,eS=new WeakMap,tS={},nS=0,rS=function(e){return e&&(e.host||rS(e.parentNode))},iS=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=rS(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},aS=function(e,t,n,r){var i=iS(t,Array.isArray(e)?e:[e]);tS[n]||(tS[n]=new WeakMap);var a=tS[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=($x.get(e)||0)+1,l=(a.get(e)||0)+1;$x.set(e,c),a.set(e,l),o.push(e),c===1&&i&&eS.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),nS++,function(){o.forEach(function(e){var t=$x.get(e)-1,i=a.get(e)-1;$x.set(e,t),a.set(e,i),t||(eS.has(e)||e.removeAttribute(r),eS.delete(e)),i||e.removeAttribute(n)}),nS--,nS||($x=new WeakMap,$x=new WeakMap,eS=new WeakMap,tS={})}},oS=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Qx(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),aS(r,i,n,`aria-hidden`)):function(){return null}},sS=Object.defineProperty,cS=(e,t)=>sS(e,`name`,{value:t,configurable:!0}),lS=`Dialog`,[uS,dS]=ey(lS),[fS,pS]=uS(lS),mS=cS(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=My({prop:r,defaultProp:i??!1,onChange:a,caller:lS}),[d,f]=m.useState(0),[p,h]=m.useState(0);return(0,L.jsx)(fS,{scope:t,triggerRef:s,contentRef:c,contentId:Xy(),titleId:Xy(),descriptionId:Xy(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:h,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),hS=`DialogTrigger`,gS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(hS,n),a=Tv(t,i.triggerRef);return(0,L.jsx)(Gv.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":IS(i.open),...r,ref:a,onClick:vy(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),_S=`DialogPortal`,[vS,yS]=uS(_S,{forceMount:void 0}),bS=cS(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=pS(_S,t);return(0,L.jsx)(vS,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,L.jsx)(By,{present:n||a.open,children:(0,L.jsx)(Ib,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),xS=`DialogOverlay`,SS=m.forwardRef(cS(function(e,t){let n=yS(xS,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pS(xS,e.__scopeDialog);return a.modal?(0,L.jsx)(By,{present:r||a.open,children:(0,L.jsx)(wS,{...i,ref:t})}):null},`DialogOverlay`)),CS=Ov(`DialogOverlay.RemoveScroll`),wS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(xS,n),a=Tv(t,fb());return(0,L.jsx)(Zx,{as:CS,allowPinchZoom:!0,shards:[i.contentRef],children:(0,L.jsx)(Gv.div,{"data-state":IS(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),TS=`DialogContent`,ES=m.forwardRef(cS(function(e,t){let n=yS(TS,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pS(TS,e.__scopeDialog);return(0,L.jsx)(By,{present:r||a.open,children:a.modal?(0,L.jsx)(DS,{...i,ref:t}):(0,L.jsx)(OS,{...i,ref:t})})},`DialogContent`)),DS=m.forwardRef(cS(function(e,t){let n=pS(TS,e.__scopeDialog),r=m.useRef(null),i=Tv(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return oS(e)},[]),(0,L.jsx)(kS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:vy(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:vy(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:vy(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),OS=m.forwardRef(cS(function(e,t){let n=pS(TS,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,L.jsx)(kS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),kS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=pS(TS,n);return Hb(),(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(Cb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(db,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":IS(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),AS=`DialogTitle`,jS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(AS,n),{setTitleCount:a}=i;return Cy(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,L.jsx)(Gv.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),MS=`DialogDescription`,NS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(MS,n),{setDescriptionCount:a}=i;return Cy(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,L.jsx)(Gv.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),PS=`DialogClose`,FS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(PS,n);return(0,L.jsx)(Gv.button,{type:`button`,...r,ref:t,onClick:vy(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function IS(e){return e?`open`:`closed`}cS(IS,`getState`);var LS=Object.defineProperty,RS=(e,t)=>LS(e,`name`,{value:t,configurable:!0}),[zS,BS]=ey(`AlertDialog`,[dS]),VS=dS(),HS=RS(e=>{let{__scopeAlertDialog:t,...n}=e,r=VS(t);return(0,L.jsx)(mS,{...r,...n,modal:!0})},`AlertDialog`);m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(gS,{...i,...r,ref:t})},`AlertDialogTrigger`));var US=RS(e=>{let{__scopeAlertDialog:t,...n}=e,r=VS(t);return(0,L.jsx)(bS,{...r,...n})},`AlertDialogPortal`),WS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(SS,{...i,...r,ref:t})},`AlertDialogOverlay`)),[GS,KS]=zS(`AlertDialogContent`),qS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=VS(n),o=Tv(t,m.useRef(null)),s=m.useRef(null);return(0,L.jsx)(GS,{scope:n,cancelRef:s,children:(0,L.jsx)(ES,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:vy(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),JS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(jS,{...i,...r,ref:t})},`AlertDialogTitle`)),YS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(NS,{...i,...r,ref:t})},`AlertDialogDescription`)),XS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(FS,{...i,...r,ref:t})},`AlertDialogAction`)),ZS=`AlertDialogCancel`,QS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=KS(ZS,n),a=VS(n),o=Tv(t,i);return(0,L.jsx)(FS,{...a,...r,ref:o})},`AlertDialogCancel`)),$S=HS,eC=US,tC=WS,nC=qS,rC=XS,iC=QS,aC=JS,oC=YS,sC=Object.defineProperty,cC=(e,t)=>sC(e,`name`,{value:t,configurable:!0});function lC(e){let[t,n]=m.useState(void 0);return Cy(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}cC(lC,`useSize`);var uC=Object.defineProperty,dC=(e,t)=>uC(e,`name`,{value:t,configurable:!0}),fC=`Checkbox`,[pC,mC]=ey(fC),[hC,gC]=pC(fC);function _C(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=My({prop:n,defaultProp:i??!1,onChange:c,caller:fC}),[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useRef(!1),[b,x]=m.useReducer(e=>e+1,0),S=!h||!!o||!!h.closest(`form`),C={checked:f,disabled:a,setChecked:p,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,userInteractionCount:b,onUserInteraction:x,required:l,defaultChecked:!EC(i)&&i,isFormControl:S,bubbleInput:_,setBubbleInput:v};return(0,L.jsx)(hC,{scope:t,...C,children:TC(d)?d(C):r})}dC(_C,`CheckboxProvider`);var vC=`CheckboxTrigger`,yC=m.forwardRef(dC(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:h,bubbleInput:g}=gC(vC,e),_=Tv(i,u),v=m.useRef(c);return m.useEffect(()=>{let e=a?.form;if(e){let t=dC(()=>d(v.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,L.jsx)(Gv.button,{type:`button`,role:`checkbox`,"aria-checked":EC(c)?`mixed`:c,"aria-required":l,"data-state":DC(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:_,onKeyDown:vy(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:vy(n,e=>{p(),d(e=>EC(e)?!0:!e),g&&h&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),bC=m.forwardRef(dC(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,L.jsx)(_C,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(yC,{...d,ref:t,__scopeCheckbox:n}),e&&(0,L.jsx)(wC,{__scopeCheckbox:n})]})})},`Checkbox`)),xC=`CheckboxIndicator`,SC=m.forwardRef(dC(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=gC(xC,n);return(0,L.jsx)(By,{present:r||EC(a.checked)||a.checked===!0,children:(0,L.jsx)(Gv.span,{"data-state":DC(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),CC=`CheckboxBubbleInput`,wC=m.forwardRef(dC(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:g}=gC(CC,e),_=Tv(r,g),v=lC(i),y=m.useRef(!1),b=m.useRef(s),x=m.useRef(o);m.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=EC(s),n.call(e,!EC(s)&&s),e.dispatchEvent(t),y.current=!1}},[h,s,a,o]);let S=m.useRef(!EC(s)&&s);return(0,L.jsx)(Gv.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:_,onClick:vy(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function TC(e){return typeof e==`function`}dC(TC,`isFunction`);function EC(e){return e===`indeterminate`}dC(EC,`isIndeterminate`);function DC(e){return EC(e)?`indeterminate`:e?`checked`:`unchecked`}dC(DC,`getState`);var OC=[`top`,`right`,`bottom`,`left`],kC=Math.min,AC=Math.max,jC=Math.round,MC=Math.floor,NC=e=>({x:e,y:e}),PC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function FC(e,t,n){return AC(e,kC(t,n))}function IC(e,t){return typeof e==`function`?e(t):e}function LC(e){return e.split(`-`)[0]}function RC(e){return e.split(`-`)[1]}function zC(e){return e===`x`?`y`:`x`}function BC(e){return e===`y`?`height`:`width`}function VC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function HC(e){return zC(VC(e))}function UC(e,t,n){n===void 0&&(n=!1);let r=RC(e),i=HC(e),a=BC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=QC(o)),[o,QC(o)]}function WC(e){let t=QC(e);return[GC(e),t,GC(t)]}function GC(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var KC=[`left`,`right`],qC=[`right`,`left`],JC=[`top`,`bottom`],YC=[`bottom`,`top`];function XC(e,t,n){switch(e){case`top`:case`bottom`:return n?t?qC:KC:t?KC:qC;case`left`:case`right`:return t?JC:YC;default:return[]}}function ZC(e,t,n,r){let i=RC(e),a=XC(LC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(GC)))),a}function QC(e){let t=LC(e);return PC[t]+e.slice(t.length)}function $C(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ew(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:$C(e)}function tw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function nw(e,t,n){let{reference:r,floating:i}=e,a=VC(t),o=HC(t),s=BC(o),c=LC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=RC(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function rw(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=IC(t,e),p=ew(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=tw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=tw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var iw=50,aw=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:rw},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=nw(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<iw&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=nw(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ow=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=IC(e,t)||{};if(l==null)return{};let d=ew(u),f={x:n,y:r},p=HC(i),m=BC(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=kC(d[_],T),D=kC(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,ee=FC(E,k,O),te=!c.arrow&&RC(i)!=null&&k!==ee&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ne=te?k<E?k-E:k-O:0;return{[p]:f[p]+ne,data:{[p]:ee,centerOffset:k-ee-ne,...te&&{alignmentOffset:ne}},reset:te}}}),sw=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=IC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=LC(r),_=VC(o),v=LC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[QC(o)]:WC(o)),x=p!==`none`;!d&&x&&b.push(...ZC(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=UC(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===VC(t)||T.every(e=>VC(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=VC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function cw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function lw(e){return OC.some(t=>e[t]>=0)}var uw=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=IC(e,t);switch(i){case`referenceHidden`:{let e=cw(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:lw(e)}}}case`escaped`:{let e=cw(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:lw(e)}}}default:return{}}}}},dw=new Set([`left`,`top`]);async function fw(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=LC(n),s=RC(n),c=VC(n)===`y`,l=dw.has(o)?-1:1,u=a&&c?-1:1,d=IC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var pw=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await fw(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},mw=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=IC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=VC(i),p=zC(f),m=u[p],h=u[f],g=(e,t)=>FC(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},hw=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=IC(e,t),u={x:n,y:r},d=VC(i),f=zC(d),p=u[f],m=u[d],h=IC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=dw.has(LC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},gw=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=IC(e,t),c=await i.detectOverflow(t,s),l=LC(n),u=RC(n),d=VC(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=kC(p-c[m],g),y=kC(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*AC(c.left,c.right):S=p-2*AC(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function _w(){return typeof window<`u`}function vw(e){return xw(e)?(e.nodeName||``).toLowerCase():`#document`}function yw(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bw(e){return((xw(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xw(e){return _w()?e instanceof Node||e instanceof yw(e).Node:!1}function Sw(e){return _w()?e instanceof Element||e instanceof yw(e).Element:!1}function Cw(e){return _w()?e instanceof HTMLElement||e instanceof yw(e).HTMLElement:!1}function ww(e){return!_w()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof yw(e).ShadowRoot}function Tw(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Iw(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ew(e){return/^(table|td|th)$/.test(vw(e))}function Dw(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ow=/transform|translate|scale|rotate|perspective|filter/,kw=/paint|layout|strict|content/,Aw=e=>!!e&&e!==`none`,jw;function Mw(e){let t=Sw(e)?Iw(e):e;return Aw(t.transform)||Aw(t.translate)||Aw(t.scale)||Aw(t.rotate)||Aw(t.perspective)||!Pw()&&(Aw(t.backdropFilter)||Aw(t.filter))||Ow.test(t.willChange||``)||kw.test(t.contain||``)}function Nw(e){let t=Rw(e);for(;Cw(t)&&!Fw(t);){if(Mw(t))return t;if(Dw(t))return null;t=Rw(t)}return null}function Pw(){return jw??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),jw}function Fw(e){return/^(html|body|#document)$/.test(vw(e))}function Iw(e){return yw(e).getComputedStyle(e)}function Lw(e){return Sw(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rw(e){if(vw(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ww(e)&&e.host||bw(e);return ww(t)?t.host:t}function zw(e){let t=Rw(e);return Fw(t)?(e.ownerDocument||e).body:Cw(t)&&Tw(t)?t:zw(t)}function Bw(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=zw(e),i=r===e.ownerDocument?.body,a=yw(r);if(i){let e=Vw(a);return t.concat(a,a.visualViewport||[],Tw(r)?r:[],e&&n?Bw(e):[])}return t.concat(r,Bw(r,[],n))}function Vw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hw(e){let t=Iw(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Cw(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=jC(n)!==a||jC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Uw(e){return Sw(e)?e:e.contextElement}function Ww(e){let t=Uw(e);if(!Cw(t))return NC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Hw(t),o=(a?jC(n.width):n.width)/r,s=(a?jC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Gw=NC(0);function Kw(e){let t=yw(e);return!Pw()||!t.visualViewport?Gw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qw(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===yw(e)}function Jw(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Uw(e),o=NC(1);t&&(r?Sw(r)&&(o=Ww(r)):o=Ww(e));let s=qw(a,n,r)?Kw(a):NC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=yw(a),t=Sw(r)?yw(r):r,n=e,i=Vw(n);for(;i&&t!==n;){let e=Ww(i),t=i.getBoundingClientRect(),r=Iw(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=yw(i),i=Vw(n)}}return tw({width:u,height:d,x:c,y:l})}function Yw(e,t){let n=Lw(e).scrollLeft;return t?t.left+n:Jw(bw(e)).left+n}function Xw(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Yw(e,n),y:n.top+t.scrollTop}}function Zw(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=bw(r),s=t?Dw(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=NC(1),u=NC(0),d=Cw(r);if((d||!a)&&((vw(r)!==`body`||Tw(o))&&(c=Lw(r)),d)){let e=Jw(r);l=Ww(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Xw(o,c):NC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Qw(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function $w(e){let t=Lw(e),n=e.ownerDocument.body,r=AC(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=AC(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Yw(e),o=-t.scrollTop;return Iw(n).direction===`rtl`&&(a+=AC(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var eT=25;function tT(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=yw(e),a=bw(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Pw()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Yw(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=eT&&(s-=o)}return{width:s,height:c,x:l,y:u}}function nT(e,t){let n=Jw(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ww(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function rT(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=tT(e,n,t);else if(t===`document`)r=$w(bw(e));else if(Sw(t))r=nT(t,n);else{let n=Kw(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return tw(r)}function iT(e,t){let n=t.get(e);if(n)return n;let r=Bw(e,[],!1).filter(e=>Sw(e)&&vw(e)!==`body`),i=null,a=Iw(e).position===`fixed`,o=a?Rw(e):e;for(;Sw(o)&&!Fw(o);){let e=Iw(o),t=Mw(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Rw(o)}return t.set(e,r),r}function aT(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Dw(t)?[]:iT(t,this._c):[].concat(n),r],o=rT(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=rT(t,a[e],i);s=AC(n.top,s),c=kC(n.right,c),l=kC(n.bottom,l),u=AC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function oT(e){let{width:t,height:n}=Hw(e);return{width:t,height:n}}function sT(e,t,n){let r=Cw(t),i=bw(t),a=n===`fixed`,o=Jw(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=NC(0);if((r||!a)&&((vw(t)!==`body`||Tw(i))&&(s=Lw(t)),r)){let e=Jw(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Yw(i));let l=i&&!r&&!a?Xw(i,s):NC(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function cT(e){return Iw(e).position===`static`}function lT(e,t){if(!Cw(e)||Iw(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return bw(e)===n&&(n=n.ownerDocument.body),n}function uT(e,t){let n=yw(e);if(Dw(e))return n;if(!Cw(e)){let t=Rw(e);for(;t&&!Fw(t);){if(Sw(t)&&!cT(t))return t;t=Rw(t)}return n}let r=lT(e,t);for(;r&&Ew(r)&&cT(r);)r=lT(r,t);return r&&Fw(r)&&cT(r)&&!Mw(r)?n:r||Nw(e)||n}var dT=async function(e){let t=this.getOffsetParent||uT,n=this.getDimensions,r=await n(e.floating);return{reference:sT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fT(e){return Iw(e).direction===`rtl`}var pT={convertOffsetParentRelativeRectToViewportRelativeRect:Zw,getDocumentElement:bw,getClippingRect:aT,getOffsetParent:uT,getElementRects:dT,getClientRects:Qw,getDimensions:oT,getScale:Ww,isElement:Sw,isRTL:fT};function mT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hT(e,t,n){let r=null,i,a=bw(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=MC(d),h=MC(a.clientWidth-(u+f)),g=MC(a.clientHeight-(d+p)),_=MC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:AC(0,kC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!mT(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=yw(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function gT(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Uw(e),u=i||a?[...l?Bw(l):[],...t?Bw(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?hT(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Jw(e):null;c&&g();function g(){let t=Jw(e);h&&!mT(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var _T=pw,vT=mw,yT=sw,bT=gw,xT=uw,ST=ow,CT=hw,wT=(e,t,n)=>{let r=new Map,i=n??{},a={...pT,...i.platform,_c:r};return aw(e,t,{...i,platform:a})},TT=typeof document<`u`?m.useLayoutEffect:function(){};function ET(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ET(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ET(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function DT(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function OT(e,t){let n=DT(e);return Math.round(t*n)/n}function kT(e){let t=m.useRef(e);return TT(()=>{t.current=e}),t}function AT(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);ET(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=kT(c),O=kT(i),k=kT(l),ee=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),wT(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};te.current&&!ET(T.current,t)&&(T.current=t,Hv.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);TT(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=m.useRef(!1);TT(()=>(te.current=!0,()=>{te.current=!1}),[]),TT(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,ee);ee()}},[x,S,ee,D,E]);let ne=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),A=m.useMemo(()=>({reference:x,floating:S}),[x,S]),re=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=OT(A.floating,u.x),r=OT(A.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...DT(A.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,A.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:ee,refs:ne,elements:A,floatingStyles:re}),[u,ee,ne,A,re])}var jT=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ST({element:r.current,padding:i}).fn(n):r?ST({element:r,padding:i}).fn(n):{}}}},MT=(e,t)=>{let n=_T(e);return{name:n.name,fn:n.fn,options:[e,t]}},NT=(e,t)=>{let n=vT(e);return{name:n.name,fn:n.fn,options:[e,t]}},PT=(e,t)=>({fn:CT(e).fn,options:[e,t]}),FT=(e,t)=>{let n=yT(e);return{name:n.name,fn:n.fn,options:[e,t]}},IT=(e,t)=>{let n=bT(e);return{name:n.name,fn:n.fn,options:[e,t]}},LT=(e,t)=>{let n=xT(e);return{name:n.name,fn:n.fn,options:[e,t]}},RT=(e,t)=>{let n=jT(e);return{name:n.name,fn:n.fn,options:[e,t]}},zT=Object.defineProperty,BT=m.forwardRef(((e,t)=>zT(e,`name`,{value:t,configurable:!0}))(function(e,t){let{children:n,width:r=10,height:i=5,...a}=e;return(0,L.jsx)(Gv.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,L.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})},`Arrow`)),VT=Object.defineProperty,HT=(e,t)=>VT(e,`name`,{value:t,configurable:!0}),UT=`Popper`,[WT,GT]=ey(UT),[KT,qT]=WT(UT),JT=HT(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,L.jsx)(KT,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),YT=`PopperAnchor`,XT=m.forwardRef(HT(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=qT(YT,n),o=m.useRef(null),s=a.onAnchorChange,c=Tv(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&oE(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,L.jsx)(Gv.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),ZT=`PopperContent`,[QT,$T]=WT(ZT),eE=m.forwardRef(HT(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:h,...g}=e,_=qT(ZT,n),[v,y]=m.useState(null),b=Tv(t,y),[x,S]=m.useState(null),C=lC(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,ee={padding:D,boundary:O.filter(iE),altBoundary:k},{refs:te,floatingStyles:ne,placement:A,isPositioned:re,middlewareData:ie}=AT({strategy:`fixed`,placement:E,whileElementsMounted:HT((...e)=>gT(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:_.anchor},middleware:[MT({mainAxis:i+T,alignmentAxis:o}),c&&NT({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?PT():void 0,...ee}),c&&FT({...ee}),IT({...ee,apply:HT(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&RT({element:x,padding:s}),aE({arrowWidth:w,arrowHeight:T}),f&&LT({strategy:`referenceHidden`,...ee,boundary:k?ee.boundary:void 0})]}),j=_.setPlacementState;Cy(()=>(j(A),()=>{j(void 0)}),[A,j]);let[ae,oe]=oE(A),se=rb(h);Cy(()=>{re&&se?.()},[re,se]);let ce=ie.arrow?.x,le=ie.arrow?.y,ue=ie.arrow?.centerOffset!==0,[de,fe]=m.useState();return Cy(()=>{v&&fe(window.getComputedStyle(v).zIndex)},[v]),(0,L.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:re?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(QT,{scope:n,placedSide:ae,placedAlign:oe,onArrowChange:S,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,L.jsx)(Gv.div,{"data-side":ae,"data-align":oe,...g,ref:b,style:{...g.style,animation:re?g.style?.animation:`none`}})})})},`PopperContent`)),tE=`PopperArrow`,nE={top:`bottom`,right:`left`,bottom:`top`,left:`right`},rE=m.forwardRef(HT(function(e,t){let{__scopePopper:n,...r}=e,i=$T(tE,n),a=nE[i.placedSide];return(0,L.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,L.jsx)(BT,{...r,ref:t,style:{...r.style,display:`block`}})})},`PopperArrow`));function iE(e){return e!==null}HT(iE,`isNotNull`);var aE=HT(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=oE(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function oE(e){let[t,n=`center`]=e.split(`-`);return[t,n]}HT(oE,`getSideAndAlignFromPlacement`);var sE=JT,cE=XT,lE=eE,uE=rE,dE=Object.defineProperty,fE=(e,t)=>dE(e,`name`,{value:t,configurable:!0}),pE=!1;function mE(){let[e,t]=m.useState(pE);return m.useEffect(()=>{pE||(pE=!0,t(!0))},[]),e}fE(mE,`useIsHydrated`);var hE=m.useSyncExternalStore;function gE(){return()=>{}}fE(gE,`subscribe`);function _E(){return hE(gE,()=>!0,()=>!1)}fE(_E,`useIsHydratedModern`);var vE=typeof hE==`function`?_E:mE,yE=Object.defineProperty,bE=(e,t)=>yE(e,`name`,{value:t,configurable:!0}),xE=`rovingFocusGroup.onEntryFocus`,SE={bubbles:!1,cancelable:!0},CE=`RovingFocusGroup`,[wE,TE,EE]=iy(CE),[DE,OE]=ey(CE,[EE]),[kE,AE]=DE(CE),jE=m.forwardRef(bE(function(e,t){return(0,L.jsx)(wE.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(wE.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(ME,{...e,ref:t})})})},`RovingFocusGroup`)),ME=m.forwardRef(bE(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=Tv(t,f),h=eb(a),[g,_]=My({prop:o,defaultProp:s??null,onChange:c,caller:CE}),[v,y]=m.useState(!1),b=rb(l),x=TE(n),S=m.useRef(!1),[C,w]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(xE,b),()=>e.removeEventListener(xE,b)},[b]),(0,L.jsx)(kE,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:m.useCallback(e=>_(e),[_]),onItemShiftTab:m.useCallback(()=>y(!0),[]),onFocusableItemAdd:m.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>w(e=>e-1),[]),children:(0,L.jsx)(Gv.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:vy(e.onMouseDown,()=>{S.current=!0}),onFocus:vy(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(xE,SE);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);RE([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:vy(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),NE=`RovingFocusGroupItem`,PE=m.forwardRef(bE(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Xy(),l=a||c,u=AE(NE,n),d=u.currentTabStopId===l,f=TE(n),{onFocusableItemAdd:p,onFocusableItemRemove:h,currentTabStopId:g}=u,_=vE();return Cy(()=>{if(_&&r)return p(),()=>h()},[_,r,p,h]),m.useEffect(()=>{if(!_&&r)return p(),()=>h()},[_,r,p,h]),(0,L.jsx)(wE.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,L.jsx)(Gv.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:vy(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:vy(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:vy(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=LE(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?zE(n,r+1):n.slice(r+1)}setTimeout(()=>RE(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})},`RovingFocusGroupItem`)),FE={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function IE(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}bE(IE,`getDirectionAwareKey`);function LE(e,t,n){let r=IE(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return FE[r]}bE(LE,`getFocusIntent`);function RE(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}bE(RE,`focusFirst`);function zE(e,t){return e.map((n,r)=>e[(t+r)%e.length])}bE(zE,`wrapArray`);var BE=jE,VE=PE,HE=Object.defineProperty,UE=(e,t)=>HE(e,`name`,{value:t,configurable:!0}),WE=`Popover`,[GE,KE]=ey(WE,[GT]),qE=GT(),[JE,YE]=GE(WE),XE=UE(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=qE(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=My({prop:r,defaultProp:i??!1,onChange:a,caller:WE});return(0,L.jsx)(sE,{...s,children:(0,L.jsx)(JE,{scope:t,contentId:Xy(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ZE=`PopoverTrigger`,QE=m.forwardRef(UE(function(e,t){let{__scopePopover:n,...r}=e,i=YE(ZE,n),a=qE(n),o=Tv(t,i.triggerRef),s=(0,L.jsx)(Gv.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":lD(i.open),...r,ref:o,onClick:vy(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(cE,{asChild:!0,...a,children:s})},`PopoverTrigger`)),$E=`PopoverPortal`,[eD,tD]=GE($E,{forceMount:void 0}),nD=UE(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=YE($E,t);return(0,L.jsx)(eD,{scope:t,forceMount:n,children:(0,L.jsx)(By,{present:n||a.open,children:(0,L.jsx)(Ib,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),rD=`PopoverContent`,iD=m.forwardRef(UE(function(e,t){let n=tD(rD,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=YE(rD,e.__scopePopover);return(0,L.jsx)(By,{present:r||a.open,children:a.modal?(0,L.jsx)(oD,{...i,ref:t}):(0,L.jsx)(sD,{...i,ref:t})})},`PopoverContent`)),aD=Ov(`PopoverContent.RemoveScroll`),oD=m.forwardRef(UE(function(e,t){let n=YE(rD,e.__scopePopover),r=m.useRef(null),i=Tv(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return oS(e)},[]),(0,L.jsx)(Zx,{as:aD,allowPinchZoom:!0,children:(0,L.jsx)(cD,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vy(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vy(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:vy(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),sD=m.forwardRef(UE(function(e,t){let n=YE(rD,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,L.jsx)(cD,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),cD=m.forwardRef(UE(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=YE(rD,n),p=qE(n);return Hb(),(0,L.jsx)(Cb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(db,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(lE,{"data-state":lD(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function lD(e){return e?`open`:`closed`}UE(lD,`getState`);var uD=XE,dD=QE,fD=nD,pD=iD,mD=Object.defineProperty,hD=(e,t)=>mD(e,`name`,{value:t,configurable:!0}),gD=`Switch`,[_D,vD]=ey(gD),[yD,bD]=_D(gD);function xD(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=My({prop:n,defaultProp:i??!1,onChange:c,caller:gD}),[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useRef(!1),[b,x]=m.useReducer(e=>e+1,0),S={checked:f,setChecked:p,disabled:a,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,userInteractionCount:b,onUserInteraction:x,required:l,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,L.jsx)(yD,{scope:t,...S,children:kD(d)?d(S):r})}hD(xD,`SwitchProvider`);var SD=`SwitchTrigger`,CD=m.forwardRef(hD(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:h,bubbleInput:g}=bD(SD,e),_=Tv(r,u),v=m.useRef(c);return m.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=hD(()=>d(v.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,L.jsx)(Gv.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":AD(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:_,onClick:vy(t,e=>{p(),d(e=>!e),g&&h&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),wD=m.forwardRef(hD(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,L.jsx)(xD,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(CD,{...d,ref:t,__scopeSwitch:n}),e&&(0,L.jsx)(OD,{__scopeSwitch:n})]})})},`Switch`)),TD=`SwitchThumb`,ED=m.forwardRef(hD(function(e,t){let{__scopeSwitch:n,...r}=e,i=bD(TD,n);return(0,L.jsx)(Gv.span,{"data-state":AD(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),DD=`SwitchBubbleInput`,OD=m.forwardRef(hD(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:g}=bD(DD,e),_=Tv(r,g),v=lC(i),y=m.useRef(!1),b=m.useRef(s),x=m.useRef(o);m.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),y.current=!1}},[h,s,a,o]);let S=m.useRef(s);return(0,L.jsx)(Gv.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:_,onClick:vy(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function kD(e){return typeof e==`function`}hD(kD,`isFunction`);function AD(e){return e?`checked`:`unchecked`}hD(AD,`getState`);var jD=Object.defineProperty,MD=(e,t)=>jD(e,`name`,{value:t,configurable:!0}),ND=`Tabs`,[PD,FD]=ey(ND,[OE]),ID=OE(),[LD,RD]=PD(ND),zD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=eb(s),[d,f]=My({prop:r,onChange:i,defaultProp:a??``,caller:ND});return(0,L.jsx)(LD,{scope:n,baseId:Xy(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,L.jsx)(Gv.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),BD=`TabsList`,VD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=RD(BD,n),o=ID(n);return(0,L.jsx)(BE,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,L.jsx)(Gv.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),HD=`TabsTrigger`,UD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=RD(HD,n),s=ID(n),c=KD(o.baseId,r),l=qD(o.baseId,r),u=r===o.value;return(0,L.jsx)(VE,{asChild:!0,...s,focusable:!i,active:u,children:(0,L.jsx)(Gv.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:vy(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:vy(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:vy(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),WD=`TabsContent`,GD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=RD(WD,n),c=KD(s.baseId,r),l=qD(s.baseId,r),u=r===s.value,d=m.useRef(u);return m.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,L.jsx)(By,{present:i||u,children:({present:n})=>(0,L.jsx)(Gv.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function KD(e,t){return`${e}-trigger-${t}`}MD(KD,`makeTriggerId`);function qD(e,t){return`${e}-content-${t}`}MD(qD,`makeContentId`);var JD=zD,YD=VD,XD=UD,ZD=GD,QD=Object.defineProperty,$D=(e,t)=>QD(e,`name`,{value:t,configurable:!0}),[eO,tO]=ey(`Tooltip`,[GT]),nO=GT(),rO=`TooltipProvider`,iO=700,aO=`tooltip.open`,[oO,sO]=eO(rO),cO=$D(e=>{let{__scopeTooltip:t,delayDuration:n=iO,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=m.useRef(!0),s=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(oO,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:m.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),lO=`Tooltip`,[uO,dO]=eO(lO),fO=$D(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=sO(lO,e.__scopeTooltip),l=nO(t),[u,d]=m.useState(null),[f,p]=m.useState(void 0),h=Xy(),g=m.useRef(0),_=o??c.disableHoverableContent,v=s??c.delayDuration,y=m.useRef(!1),[b,x]=My({prop:r,defaultProp:i??!1,onChange:$D(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(aO))):c.onClose(),a?.(e)},`onChange`),caller:lO}),S=m.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),w=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),T=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);m.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]);let E=f??h;return(0,L.jsx)(sE,{...l,children:(0,L.jsx)(uO,{scope:t,contentId:E,setContentId:p,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{_?w():(window.clearTimeout(g.current),g.current=0)},[w,_]),onOpen:C,onClose:w,disableHoverableContent:_,children:n})})},`Tooltip`),pO=`TooltipTrigger`,mO=m.forwardRef($D(function(e,t){let{__scopeTooltip:n,...r}=e,i=dO(pO,n),a=sO(pO,n),o=nO(n),s=Tv(t,m.useRef(null),i.onTriggerChange),c=m.useRef(!1),l=m.useRef(!1),u=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,L.jsx)(cE,{asChild:!0,...o,children:(0,L.jsx)(Gv.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:vy(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:vy(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:vy(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:vy(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:vy(e.onBlur,i.onClose),onClick:vy(e.onClick,i.onClose)})})},`TooltipTrigger`)),hO=`TooltipPortal`,[gO,_O]=eO(hO,{forceMount:void 0}),vO=$D(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=dO(hO,t);return(0,L.jsx)(gO,{scope:t,forceMount:n,children:(0,L.jsx)(By,{present:n||a.open,children:(0,L.jsx)(Ib,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),yO=`TooltipContent`,bO=m.forwardRef($D(function(e,t){let n=_O(yO,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=dO(yO,e.__scopeTooltip);return(0,L.jsx)(By,{present:r||o.open,children:o.disableHoverableContent?(0,L.jsx)(CO,{side:i,...a,ref:t}):(0,L.jsx)(xO,{side:i,...a,ref:t})})},`TooltipContent`)),xO=m.forwardRef($D(function(e,t){let n=dO(yO,e.__scopeTooltip),r=sO(yO,e.__scopeTooltip),i=m.useRef(null),a=Tv(t,i),[o,s]=m.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=m.useCallback(()=>{s(null),d(!1)},[d]),p=m.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=EO(r,TO(r,n.getBoundingClientRect())),a=DO(t.getBoundingClientRect()),o=kO([...i,...a]);s(o),d(!0)},[d]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&u){let e=$D(e=>p(e,u),`handleTriggerLeave`),t=$D(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),m.useEffect(()=>{if(o){let e=$D(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!OO(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,L.jsx)(CO,{...e,ref:a})},`TooltipContentHoverable`)),SO=jv(`TooltipContent`),CO=m.forwardRef($D(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=dO(yO,n),u=nO(n),{onClose:d}=l;m.useEffect(()=>(document.addEventListener(aO,d),()=>document.removeEventListener(aO,d)),[d]),m.useEffect(()=>{if(l.trigger){let e=$D(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return Cy(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,L.jsx)(db,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,L.jsxs)(lE,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(SO,{children:r}),i?(0,L.jsx)(Xv,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`)),wO=m.forwardRef($D(function(e,t){let{__scopeTooltip:n,...r}=e,i=nO(n);return(0,L.jsx)(uE,{...i,...r,ref:t})},`TooltipArrow`));function TO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}$D(TO,`getExitSideFromRect`);function EO(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}$D(EO,`getPaddedExitPoints`);function DO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}$D(DO,`getPointsFromRect`);function OO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}$D(OO,`isPointInPolygon`);function kO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),AO(t)}$D(kO,`getHull`);function AO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}$D(AO,`getHullPresorted`);var jO=cO,MO=fO,NO=mO,PO=vO,FO=bO,IO=wO,LO=Yg(`group/button motion-reduce:transition-none motion-reduce:active:translate-none inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-[0.8125rem] font-medium whitespace-nowrap transition-[transform,background-color,box-shadow,color,border-color,filter] duration-150 active:not-aria-[haspopup]:translate-y-px ease-snap outline-none select-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`btn-tint text-primary-foreground [--tint:var(--primary)] disabled:text-muted-foreground`,soft:`btn-raised btn-soft text-foreground`,outline:`btn-raised bg-card text-foreground`,secondary:`btn-raised bg-card text-secondary-foreground`,ghost:`btn-ghost text-foreground`,destructive:`btn-tint text-background [--tint:var(--destructive)] focus-visible:outline-destructive disabled:text-muted-foreground`,link:`text-link underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-3`,xs:`h-7 gap-1 px-2.5 text-xs [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1.5 px-2.5 text-xs [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-2 px-4`,icon:`size-8`,"icon-xs":`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-sm":`size-7`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function J({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?kv:`button`;return(0,L.jsx)(a,{"aria-keyshortcuts":r?void 0:`Enter Space`,"aria-description":r?`When focused, press Enter to activate.`:`When focused, press Enter or Space to activate.`,"aria-describedby":`focused-action-help`,"data-slot":`button`,"data-variant":t,"data-size":n,className:q(LO({variant:t,size:n,className:e})),...i})}var RO=q(`pointer-events-none inline-flex h-[1.125rem] min-w-[1.125rem] w-fit items-center justify-center gap-1 rounded-[5px] border border-border bg-background px-1 font-sans text-[0.7rem] leading-none font-medium text-muted-foreground shadow-[inset_0_-1px_0_var(--border)] select-none`,`in-data-[slot=tooltip-content]:border-background/25 in-data-[slot=tooltip-content]:bg-transparent in-data-[slot=tooltip-content]:text-background in-data-[slot=tooltip-content]:shadow-none`,`in-data-[variant=default]:border-primary-foreground/35 in-data-[variant=default]:bg-primary-foreground/10 in-data-[variant=default]:text-primary-foreground in-data-[variant=default]:shadow-none`,`in-data-[variant=destructive]:border-background/40 in-data-[variant=destructive]:bg-background/10 in-data-[variant=destructive]:text-background in-data-[variant=destructive]:shadow-none`,`[&_svg:not([class*='size-'])]:size-3`);function zO({className:e,...t}){return(0,L.jsx)(`kbd`,{"data-slot":`kbd`,className:q(RO,e),...t})}function BO({className:e,...t}){return(0,L.jsx)(`kbd`,{"data-slot":`kbd-group`,className:q(`inline-flex items-center gap-0.5`,e),...t})}var VO=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),HO={alt:`⌥`,ctrl:`⌃`,shift:`⇧`,meta:`⌘`,cmd:`⌘`},UO={enter:`↵`,esc:`Esc`,escape:`Esc`,arrowleft:`←`,arrowright:`→`,arrowup:`↑`,arrowdown:`↓`,space:`Space`,delete:`Del`,backspace:`⌫`};function WO(e){return e.split(`+`).map(e=>{let t=e.toLowerCase();return VO&&HO[t]?HO[t]:UO[t]??(e.length===1?e.toUpperCase():e[0].toUpperCase()+e.slice(1))})}function GO({chord:e,className:t}){let n=WO(e);return(0,L.jsx)(BO,{className:t,children:n.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[t>0?(0,L.jsx)(`span`,{className:`sr-only`,children:`plus`}):null,(0,L.jsx)(zO,{children:e})]},t))})}function KO({chord:e,children:t,className:n}){return(0,L.jsxs)(`span`,{className:q(`kbd-hint inline-flex shrink-0 items-center gap-1.5 text-xs whitespace-nowrap text-muted-foreground`,n),children:[(0,L.jsx)(GO,{chord:e}),t]})}function qO({open:e,onOpenChange:t,label:n,description:r,dismissOnBackdrop:i=!0,className:a,style:o,onCloseAutoFocus:s,children:c}){let l=Sf();return(0,L.jsx)(mS,{open:e,onOpenChange:t,children:(0,L.jsx)(Ou,{children:e?(0,L.jsxs)(bS,{forceMount:!0,children:[(0,L.jsx)(SS,{asChild:!0,forceMount:!0,children:(0,L.jsx)(z.div,{className:`fixed inset-0 z-50 bg-scrim backdrop-blur-sm`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16,ease:`easeOut`}})}),(0,L.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-50 grid place-items-center p-4`,children:(0,L.jsx)(ES,{asChild:!0,forceMount:!0,onCloseAutoFocus:s,onInteractOutside:e=>{i||e.preventDefault()},onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[data-nav], [data-autofocus], textarea`);t&&(e.preventDefault(),t.focus())},...r?{}:{"aria-describedby":void 0},children:(0,L.jsxs)(z.div,{className:q(`glass-pop pointer-events-auto flex max-h-[min(86svh,48rem)] w-full max-w-2xl flex-col overflow-hidden rounded-xl outline-none`,a),style:o,initial:{opacity:0,scale:l?1:.92,y:l?0:18},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:l?1:.96,y:l?0:8,transition:{duration:.12,ease:`easeIn`}},transition:{type:`spring`,stiffness:460,damping:32,mass:.9},children:[(0,L.jsx)(jS,{className:`sr-only`,children:n}),r?(0,L.jsx)(NS,{className:`sr-only`,children:r}):null,c]})})})]}):null})})}var JO=[],YO=0,XO=new Set;function ZO(){for(let e of[...XO])e()}function QO(e){return XO.add(e),()=>{XO.delete(e)}}function $O(){let e;for(let t of JO)(!e||t.priority>e.priority||t.priority===e.priority&&t.order<e.order)&&(e=t);return e?.id}var ek={question:30,confirm:20,help:10,sheet:5};function tk(e,t){let n=(0,m.useId)();(0,m.useEffect)(()=>{if(e)return JO=[...JO,{id:n,priority:t,order:++YO}],ZO(),()=>{JO=JO.filter(e=>e.id!==n),ZO()}},[e,t,n]);let r=(0,m.useSyncExternalStore)(QO,$O,()=>void 0);return e&&r===n}function nk(){return JO.length>0}function rk(){return(0,m.useSyncExternalStore)(QO,()=>JO.length>0,()=>!1)}var ik=[`lobby`,`tasks`,`plan`,`quickfix`,`issues`,`excalidraw`,`git`,`knowledge`,`metrics`],ak=`already answered in another window`,ok=`Attached files:`,sk=new Set(ik);function ck(e){let t=e.replace(/^#\/?/,``).split(`/`).filter(Boolean),n=t[0];if(!n||n===`lobby`)return{kind:`tab`,tab:`lobby`,rest:t.slice(1)};if(n===`settings`)return{kind:`settings`};if(n===`sessions`)return{kind:`sessions`,...t[1]?{key:t[1]}:{}};if(sk.has(n))return{kind:`tab`,tab:n,rest:t.slice(1)}}function lk(e,...t){return`#/${e}${t.filter(Boolean).map(e=>`/${encodeURIComponent(e)}`).join(``)}`}function Y(e){window.location.hash!==e&&(window.location.hash=e)}function uk(){let[e,t]=(0,m.useState)(()=>ck(window.location.hash)??{kind:`tab`,tab:`lobby`,rest:[]});return(0,m.useEffect)(()=>{let e=()=>{let e=ck(window.location.hash);e?t(e):(window.history.replaceState(null,``,`#/lobby`),t({kind:`tab`,tab:`lobby`,rest:[]}))};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function dk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty`,className:q(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 p-6 text-center text-balance`,e),...t})}function fk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty-header`,className:q(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var pk=Yg(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground [&_svg:not([class*='size-'])]:size-5`}},defaultVariants:{variant:`default`}});function mk({className:e,variant:t=`default`,...n}){return(0,L.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:q(pk({variant:t,className:e})),...n})}function hk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty-title`,className:q(`text-sm font-medium tracking-tight`,e),...t})}function gk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty-description`,className:q(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function _k({className:e,...t}){return(0,L.jsx)(`span`,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:q(`inline-flex size-4 shrink-0 items-end justify-between text-primary`,e),...t,children:[0,1,2].map(e=>(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`block aspect-square h-[28%] shrink-0 rounded-full bg-current motion-safe:animate-[hop_0.9s_ease-in-out_infinite]`,style:{animationDelay:`${e*.14}s`}},e))})}function vk({label:e=`Connecting…`}){return(0,L.jsxs)(`div`,{className:`flex min-h-48 flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(_k,{}),(0,L.jsx)(`span`,{children:e})]})}function yk({message:e,onRetry:t}){return(0,L.jsxs)(dk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(fk,{children:[(0,L.jsxs)(hk,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Eg,{className:`size-4 text-destructive`,"aria-hidden":`true`}),`Could not load this view`]}),(0,L.jsx)(gk,{children:e??`The request failed. Try again.`})]}),t?(0,L.jsxs)(J,{variant:`outline`,onClick:t,children:[(0,L.jsx)(Qh,{"aria-hidden":`true`}),`Try again`]}):null]})}function bk({onRetry:e}){return(0,L.jsxs)(`div`,{role:`status`,className:`mx-3 mb-1 flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive max-sm:mx-2`,children:[(0,L.jsx)(Rg,{className:`size-4`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{children:`Lost pi — reconnecting every 2 s. Your planning session and tasks carry on when it is back.`}),e?(0,L.jsx)(J,{variant:`link`,className:`h-8 px-1 text-destructive`,onClick:e,children:`Retry now`}):null]})}function xk(){let[e,t]=(0,m.useReducer)(e=>e+1,0);return(0,m.useEffect)(()=>me.subscribe(t),[]),e}function Sk(){return xk(),me.status()}function Ck(e){return xk(),me.get(e)}function wk(e){let t=(0,m.useCallback)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},[e]),n=(0,m.useCallback)(()=>window.matchMedia(e).matches,[e]);return(0,m.useSyncExternalStore)(t,n)}function Tk(e,t,n,r=!0){xk();let[i,a]=(0,m.useState)({loading:!0,at:0}),[o,s]=(0,m.useState)(0),c=[me.status().connection,...n.map(e=>me.get(e).version)].join(`,`),l=JSON.stringify(t);(0,m.useEffect)(()=>{if(!r)return;let t=!0,n=performance.now();return a(e=>({...e,loading:!0})),De(e,JSON.parse(l)).then(e=>t&&a({data:e,loading:!1,at:n}),e=>t&&a(t=>({...t,error:e instanceof Error?e.message:String(e),loading:!1}))),()=>{t=!1}},[e,l,c,o,r]);let u=(0,m.useCallback)(()=>s(e=>e+1),[]);return{data:i.data,error:i.error,loading:i.loading,requestedAt:i.at,reload:u}}function Ek({delayDuration:e=400,...t}){return(0,L.jsx)(jO,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Dk({...e}){return(0,L.jsx)(MO,{"data-slot":`tooltip`,...e})}function Ok({...e}){return(0,L.jsx)(NO,{"data-slot":`tooltip-trigger`,...e})}function kk({className:e,sideOffset:t=6,children:n,...r}){return(0,L.jsx)(PO,{children:(0,L.jsxs)(FO,{"data-slot":`tooltip-content`,sideOffset:t,className:q(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,L.jsx)(IO,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function Ak(e){return[...e.querySelectorAll(`[data-nav]`)].filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function jk(e,t,n){let r=Ak(e);if(r.length===0)return!1;let i=t?r.findIndex(e=>e===t||e.contains(t)):-1,a=r[n===`first`?0:n===`last`?r.length-1:Math.max(0,Math.min(r.length-1,(i<0?n>0?-1:r.length:i)+n))];return!a||a===t?!1:(a.focus({preventScroll:!1}),!0)}function Mk(e){return e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`].includes(e.type)||e instanceof HTMLElement&&e.isContentEditable}function Nk(e,t=!0){return e===`ArrowDown`||t&&e===`j`?1:e===`ArrowUp`||t&&e===`k`?-1:0}function Pk(e,t=!0){return e===`ArrowRight`||t&&e===`l`?1:e===`ArrowLeft`||t&&e===`h`?-1:0}var Fk=`button:not([disabled]), a[href], [role='button']:not([aria-disabled='true'])`;function Ik(e){return[...e.querySelectorAll(Fk)].filter(e=>e.offsetParent!==null)}function Lk(e,t,n){let r=Ik(e);if(r.length===0)return;let i=t?r.findIndex(e=>e===t||e.contains(t)):-1;r[n===`first`?0:n===`last`?r.length-1:Math.max(0,Math.min(r.length-1,(i<0?n>0?-1:r.length:i)+n))]?.focus()}function Rk(e,t=document.querySelector(`[data-pane='list']`)){if(!t)return;let n=[...t.querySelectorAll(`button[data-row]`)].filter(e=>e.offsetParent!==null),r=n.findIndex(e=>e.getAttribute(`aria-current`)===`true`),i=Math.max(0,Math.min(n.length-1,r<0?e>0?0:n.length-1:r+e));n[i]?.click(),n[i]?.focus({preventScroll:!0}),n[i]?.scrollIntoView({block:`nearest`})}function zk(e){return e.querySelector(`[aria-current='true']`)??Ik(e)[0]}function Bk(){let e=document.getElementById(`main`);if(!e)return!1;let t=e.querySelector(`[data-pane='list']`);return((t?zk(t):void 0)??Ik(e)[0]??e).focus(),!0}function Vk(){let e=document.querySelector(`[role='tab'][aria-selected='true']`);if(e)return e.focus({preventScroll:!0}),!0;let t=document.getElementById(`main`);return t?.focus({preventScroll:!0}),!!t}var Hk={active:!1},Uk=new Set([`g`,`j`,`k`,`h`,`l`,`d`,`p`,`/`,`?`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]);function Wk(e){if(!e)return!1;let t=e.toLowerCase();return t===`delete`||/^[a-z]$/.test(t)&&!Uk.has(t)}function Gk(e,t){return t.toLowerCase()===`delete`?e.key===`Delete`||e.key===`Backspace`:e.key.toLowerCase()===t.toLowerCase()}function Kk(){return nk()||!!document.querySelector(`[role='dialog'], [role='alertdialog'], [role='menu'], [role='listbox']`)}function qk(e,t,{enabled:n=!0,inDialog:r=!1}={}){let i=(0,m.useRef)(t);i.current=t,(0,m.useEffect)(()=>{if(!n||!e)return;let t=t=>{t.defaultPrevented||t.isComposing||t.repeat||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||Gk(t,e)&&(Mk(t.target)||(r||!Kk())&&(t.preventDefault(),i.current()))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n,r])}var Jk={neutral:`text-foreground`,primary:``,danger:`text-destructive hover:text-destructive`};function X({label:e,icon:t,tone:n=`neutral`,shortcut:r,href:i,pressed:a,text:o,iconOnly:s,className:c,disabled:l,...u}){let d=(0,m.useRef)(null),f=Wk(r);qk(f?r:void 0,()=>d.current?.click(),{enabled:f&&!l});let p=(0,L.jsx)(t,{"aria-hidden":`true`}),h=n===`primary`?`default`:s?`ghost`:`outline`,g=q(!s&&`px-2.5`,Jk[n],c),_=s?`icon`:`default`,v=s?p:(0,L.jsxs)(L.Fragment,{children:[p,(0,L.jsx)(`span`,{children:o??e}),r?(0,L.jsx)(GO,{chord:r,className:`kbd-hint ml-1`}):null]}),y=i?(0,L.jsx)(J,{asChild:!0,ref:d,variant:h,size:_,"data-tone":n,className:g,children:(0,L.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer noopener`,"aria-label":e,"aria-keyshortcuts":f?r:void 0,children:v})}):(0,L.jsx)(J,{ref:d,type:`button`,variant:h,size:_,"data-tone":n,"aria-label":e,"aria-pressed":a,"aria-keyshortcuts":f?r:void 0,disabled:l,className:g,...u,children:v});return s?(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:y}),(0,L.jsxs)(kk,{children:[e,(0,L.jsx)(GO,{chord:r??(i?`Enter`:`Enter / Space`)})]})]}):y}function Yk({children:e,className:t}){function n(e){let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;if(!t)return;let n=[...e.currentTarget.querySelectorAll(`button:not([disabled]), a[href]`)],r=n.indexOf(e.target);r<0||(e.preventDefault(),e.stopPropagation(),n[Math.max(0,Math.min(n.length-1,r+t))]?.focus())}return(0,L.jsx)(`div`,{role:`toolbar`,"aria-label":`Actions`,onKeyDown:n,className:q(`sticky -top-5 z-10 -mx-5 -mt-5 flex min-h-12 flex-wrap items-center gap-1 border-b border-border bg-card/90 px-4 py-2 backdrop-blur-sm [&>[data-tone=danger]:not(:first-child)]:ml-auto`,t),children:e})}function Xk({...e}){return(0,L.jsx)(mS,{"data-slot":`sheet`,...e})}function Zk({...e}){return(0,L.jsx)(FS,{"data-slot":`sheet-close`,...e})}function Qk({...e}){return(0,L.jsx)(bS,{"data-slot":`sheet-portal`,...e})}function $k({className:e,...t}){return(0,L.jsx)(SS,{"data-slot":`sheet-overlay`,className:q(`fixed inset-0 z-50 bg-scrim backdrop-blur-sm duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function eA({className:e,children:t,side:n=`right`,showCloseButton:r=!0,forceMount:i,hidden:a,...o}){return(0,L.jsxs)(Qk,{forceMount:i,children:[a?null:(0,L.jsx)($k,{}),(0,L.jsxs)(ES,{forceMount:i,hidden:a,"data-slot":`sheet-content`,"data-side":n,className:q(`glass-pop fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm transition duration-200 ease-in-out data-[side=right]:rounded-l-xl data-[side=left]:rounded-r-xl data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...o,children:[t,r&&(0,L.jsx)(FS,{"data-slot":`sheet-close`,asChild:!0,children:(0,L.jsxs)(J,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,L.jsx)(Hg,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function tA({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sheet-header`,className:q(`flex flex-col gap-0.5 p-4`,e),...t})}function nA({className:e,...t}){return(0,L.jsx)(jS,{"data-slot":`sheet-title`,className:q(`text-base font-medium text-foreground`,e),...t})}function rA({className:e,...t}){return(0,L.jsx)(NS,{"data-slot":`sheet-description`,className:q(`text-sm text-muted-foreground`,e),...t})}function iA(){return wk(`(min-width: 1024px)`)}function aA({className:e,...t}){return(0,L.jsx)(`section`,{className:q(`min-h-0 min-w-0`,e),...t})}function oA({open:e,onClose:t,describe:n,children:r}){let i=tk(e,ek.sheet),a=(0,m.useRef)(!1);return i&&(a.current=!0),e||(a.current=!1),(0,L.jsx)(Xk,{open:e&&i,onOpenChange:e=>!e&&t(),children:(0,L.jsxs)(eA,{forceMount:e&&a.current?!0:void 0,hidden:!i,showCloseButton:!1,className:q(`gap-0 data-[side=right]:w-[92%] data-[side=right]:sm:max-w-3xl`,!i&&`!hidden`),children:[(0,L.jsxs)(tA,{className:`flex-row items-center justify-between border-b px-4 py-2`,children:[(0,L.jsx)(nA,{className:`text-sm`,children:`Detail`}),(0,L.jsx)(rA,{className:`sr-only`,children:n}),(0,L.jsx)(Zk,{asChild:!0,children:(0,L.jsxs)(J,{variant:`ghost`,size:`sm`,"aria-label":`Close detail`,title:`Close · Esc`,className:`gap-2`,children:[(0,L.jsx)(Hg,{"aria-hidden":`true`}),`Close`,(0,L.jsx)(GO,{chord:`Esc`,className:`kbd-hint`})]})})]}),(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:r})]})})}function sA({list:e,detail:t,open:n,detailClassName:r}){let i=n&&t!==null;return(0,L.jsxs)(`div`,{className:q(`grid min-h-0 flex-1`,i?`grid-rows-[minmax(0,1fr)_minmax(0,2fr)]`:`grid-rows-1`),children:[(0,L.jsx)(aA,{"data-pane":`list`,className:q(`overflow-y-auto`,i?`border-b border-border`:`pb-dock`),children:e}),i?(0,L.jsx)(aA,{"data-pane":`detail`,"aria-label":`Detail`,tabIndex:0,className:q(`overflow-y-auto px-5 pt-5 pb-dock`,r),children:t}):null]})}function cA({wide:e,list:t,detail:n,open:r,onClose:i,hint:a,describe:o,inlineDetail:s,detailClassName:c}){let l=(0,m.useRef)(null),u=(0,m.useRef)(null);function d(t){let n=l.current;if(!n||t.defaultPrevented||t.nativeEvent.isComposing||nk()||t.altKey||t.ctrlKey||t.metaKey||Mk(t.target)||t.target instanceof HTMLInputElement)return;let r=Nk(t.key,!1);r?(t.preventDefault(),Lk(n,t.target,r)):t.key===`Home`||t.key===`End`?(t.preventDefault(),Lk(n,t.target,t.key===`Home`?`first`:`last`)):e&&Pk(t.key)===1&&u.current&&(t.preventDefault(),u.current.focus())}function f(e){e.defaultPrevented||e.nativeEvent.isComposing||nk()||e.altKey||e.ctrlKey||e.metaKey||Mk(e.target)||Pk(e.key)===-1&&l.current&&(e.preventDefault(),zk(l.current)?.focus())}return!e&&s?(0,L.jsx)(sA,{list:t,detail:n,open:r,detailClassName:c}):e?(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[clamp(17rem,28%,23rem)_minmax(0,1fr)]`,children:[(0,L.jsx)(aA,{"data-pane":`list`,ref:l,onKeyDown:d,className:`overflow-y-auto border-r border-border pb-dock`,children:t}),(0,L.jsx)(aA,{"data-pane":`detail`,ref:u,tabIndex:0,"aria-label":`Detail`,onKeyDown:f,className:q(`overflow-y-auto px-5 pt-5 pb-dock outline-none focus-visible:bg-muted/30`,c),children:n??(0,L.jsx)(`div`,{className:`grid h-full min-h-48 place-items-center`,children:(0,L.jsxs)(`div`,{className:`flex max-w-xs flex-col items-center gap-3 text-center`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,L.jsx)(Oh,{className:`size-5`})}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a}),(0,L.jsxs)(`p`,{className:`kbd-hint flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(GO,{chord:`ArrowUp`}),(0,L.jsx)(GO,{chord:`ArrowDown`}),`move`]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(GO,{chord:`ArrowRight`}),`open`]})]})]})})})]}):(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto pb-dock`,children:[(0,L.jsx)(aA,{"data-pane":`list`,ref:l,onKeyDown:d,children:t}),(0,L.jsx)(oA,{open:r&&n!==null,onClose:i,describe:o,children:n})]})}function lA({title:e,count:t,children:n}){return(0,L.jsxs)(`div`,{className:`sticky top-0 z-10 flex min-h-12 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-card/90 px-4 py-2 backdrop-blur-sm`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:e}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`min-w-2 flex-1`}),t?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t}):null,n?(0,L.jsx)(`div`,{className:`flex items-center gap-1.5`,children:n}):null]})}function uA(){return(0,L.jsx)(`div`,{className:`flex flex-col gap-1.5 p-3`,role:`status`,"aria-label":`Loading`,children:[0,1,2,3].map(e=>(0,L.jsx)(`div`,{className:`h-11 rounded-lg bg-muted motion-safe:animate-pulse`},e))})}function dA({className:e,...t}){return(0,L.jsx)(`textarea`,{"data-slot":`textarea`,className:q(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-background px-3.5 py-2.5 text-base transition-[border-color,box-shadow] duration-150 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:disabled:bg-input/80`,e),...t})}function fA(e){return e<10?`0${e}`:String(e)}function pA(e){if(!Number.isFinite(e))return`0`;let t=new Date(e);return`${fA(t.getHours())}:${fA(t.getMinutes())}`}function mA(e){if(!Number.isFinite(e)||e<0)return`0s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${fA(n%60)}m`}function hA(e){if(!Number.isFinite(e)||e<5e3)return`now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h`:`${Math.floor(r/24)}d`}function gA(e){let t=hA(e);return t===`now`?`just now`:`${t} ago`}function _A({...e}){return(0,L.jsx)($S,{"data-slot":`alert-dialog`,...e})}function vA({...e}){return(0,L.jsx)(eC,{"data-slot":`alert-dialog-portal`,...e})}function yA({className:e,...t}){return(0,L.jsx)(tC,{"data-slot":`alert-dialog-overlay`,className:q(`fixed inset-0 z-50 bg-scrim backdrop-blur-sm duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function bA({className:e,...t}){return(0,L.jsxs)(vA,{children:[(0,L.jsx)(yA,{}),(0,L.jsx)(nC,{"data-slot":`alert-dialog-content`,className:q(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 glass-pop rounded-xl p-5 text-sm duration-150 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})]})}function xA({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:q(`flex flex-col gap-1.5`,e),...t})}function SA({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function CA({className:e,...t}){return(0,L.jsx)(aC,{"data-slot":`alert-dialog-title`,className:q(`text-base font-medium text-foreground`,e),...t})}function wA({className:e,...t}){return(0,L.jsx)(oC,{"data-slot":`alert-dialog-description`,className:q(`text-sm text-muted-foreground`,e),...t})}function TA({className:e,variant:t=`default`,...n}){return(0,L.jsx)(J,{variant:t,size:`sm`,className:q(`h-7 gap-1 px-2.5`,e),asChild:!0,children:(0,L.jsx)(rC,{"data-slot":`alert-dialog-action`,...n})})}function EA({className:e,...t}){return(0,L.jsx)(J,{variant:`outline`,size:`sm`,className:q(`h-7 gap-1 px-2.5`,e),asChild:!0,children:(0,L.jsx)(iC,{"data-slot":`alert-dialog-cancel`,...t})})}function DA({label:e,text:t,shortcut:n,title:r,description:i,confirmLabel:a,onConfirm:o,icon:s,disabled:c,variant:l=`outline`,iconOnly:u,compact:d}){let[f,p]=(0,m.useState)(!1),h=tk(f,ek.confirm),g=l===`destructive`;return qk(`y`,()=>{p(!1),o()},{enabled:f&&h,inDialog:!0}),(0,L.jsxs)(_A,{open:f&&h,onOpenChange:p,children:[(0,L.jsx)(X,{label:e,icon:s,tone:g?`danger`:`neutral`,disabled:c,shortcut:n,iconOnly:u,...d?{"data-compact":!0,className:`size-8`}:{},...t?{text:t}:{},onClick:()=>p(!0)}),(0,L.jsxs)(bA,{children:[(0,L.jsxs)(xA,{children:[(0,L.jsx)(CA,{children:r}),(0,L.jsx)(wA,{children:i})]}),(0,L.jsxs)(SA,{children:[(0,L.jsxs)(EA,{children:[`Keep it`,(0,L.jsx)(GO,{chord:`Esc`,className:`kbd-hint ml-1`})]}),(0,L.jsxs)(TA,{variant:g?`destructive`:`default`,onClick:o,children:[a,(0,L.jsx)(GO,{chord:`Y`,className:`kbd-hint ml-1`})]})]})]})]})}function OA(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var kA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jA={};function MA(e,t){return((t||jA).jsx?AA:kA).test(e)}var NA=/[ \t\n\f\r]/g;function PA(e){return typeof e==`object`?e.type===`text`&&FA(e.value):FA(e)}function FA(e){return e.replace(NA,``)===``}var IA=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};IA.prototype.normal={},IA.prototype.property={},IA.prototype.space=void 0;function LA(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new IA(n,r,t)}function RA(e){return e.toLowerCase()}var zA=class{constructor(e,t){this.attribute=t,this.property=e}};zA.prototype.attribute=``,zA.prototype.booleanish=!1,zA.prototype.boolean=!1,zA.prototype.commaOrSpaceSeparated=!1,zA.prototype.commaSeparated=!1,zA.prototype.defined=!1,zA.prototype.mustUseProperty=!1,zA.prototype.number=!1,zA.prototype.overloadedBoolean=!1,zA.prototype.property=``,zA.prototype.spaceSeparated=!1,zA.prototype.space=void 0;var BA=s({boolean:()=>Z,booleanish:()=>HA,commaOrSpaceSeparated:()=>KA,commaSeparated:()=>GA,number:()=>Q,overloadedBoolean:()=>UA,spaceSeparated:()=>WA}),VA=0,Z=qA(),HA=qA(),UA=qA(),Q=qA(),WA=qA(),GA=qA(),KA=qA();function qA(){return 2**++VA}var JA=Object.keys(BA),YA=class extends zA{constructor(e,t,n,r){let i=-1;if(super(e,t),XA(this,`space`,r),typeof n==`number`)for(;++i<JA.length;){let e=JA[i];XA(this,JA[i],(n&BA[e])===BA[e])}}};YA.prototype.defined=!0;function XA(e,t,n){n&&(e[t]=n)}function ZA(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new YA(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[RA(r)]=r,n[RA(a.attribute)]=r}return new IA(t,n,e.space)}var QA=ZA({properties:{ariaActiveDescendant:null,ariaAtomic:HA,ariaAutoComplete:null,ariaBusy:HA,ariaChecked:HA,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:WA,ariaCurrent:null,ariaDescribedBy:WA,ariaDetails:null,ariaDisabled:HA,ariaDropEffect:WA,ariaErrorMessage:null,ariaExpanded:HA,ariaFlowTo:WA,ariaGrabbed:HA,ariaHasPopup:null,ariaHidden:HA,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:WA,ariaLevel:Q,ariaLive:null,ariaModal:HA,ariaMultiLine:HA,ariaMultiSelectable:HA,ariaOrientation:null,ariaOwns:WA,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:HA,ariaReadOnly:HA,ariaRelevant:null,ariaRequired:HA,ariaRoleDescription:WA,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:HA,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function $A(e,t){return t in e?e[t]:t}function ej(e,t){return $A(e,t.toLowerCase())}var tj=ZA({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:GA,acceptCharset:WA,accessKey:WA,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alpha:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:WA,autoFocus:Z,autoPlay:Z,blocking:WA,capture:null,charSet:null,checked:Z,cite:null,className:WA,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:HA,controls:Z,controlsList:WA,coords:Q|GA,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:UA,draggable:HA,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:WA,height:Q,hidden:UA,high:Q,href:null,hrefLang:null,htmlFor:WA,httpEquiv:WA,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:WA,itemRef:WA,itemScope:Z,itemType:WA,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,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:Z,optimum:Q,pattern:null,ping:WA,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:WA,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:WA,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootCustomElementRegistry:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shadowRootSerializable:Z,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:HA,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:HA,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:WA,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:HA,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Z,disablePictureInPicture:Z,disableRemotePlayback:Z,exportParts:GA,part:WA,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:ej}),nj=ZA({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:KA,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:WA,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:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,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:GA,g2:GA,glyphName:GA,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:KA,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,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:Q,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:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:WA,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:KA,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:KA,rev:KA,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:KA,requiredFeatures:KA,requiredFonts:KA,requiredFormats:KA,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:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:KA,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:KA,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:KA,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:$A}),rj=ZA({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()}}),ij=ZA({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ej}),aj=ZA({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),oj={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`},sj=/[A-Z]/g,cj=/-[a-z]/g,lj=/^data[-\w.:]+$/i;function uj(e,t){let n=RA(t),r=t,i=zA;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&lj.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(cj,fj);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!cj.test(e)){let n=e.replace(sj,dj);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=YA}return new i(r,t)}function dj(e){return`-`+e.toLowerCase()}function fj(e){return e.charAt(1).toUpperCase()}var pj=LA([QA,tj,rj,ij,aj],`html`),mj=LA([QA,nj,rj,ij,aj],`svg`);function hj(e){return e.join(` `).trim()}var gj=o(((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;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
59
- `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),_j=o((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(gj());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}})),vj=o((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))}})),yj=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(_j()),r=vj();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})),bj=Sj(`end`),xj=Sj(`start`);function Sj(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 Cj(e){let t=xj(e),n=bj(e);if(t&&n)return{start:t,end:n}}function wj(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ej(e.position):`start`in e||`end`in e?Ej(e):`line`in e||`column`in e?Tj(e):``}function Tj(e){return Dj(e&&e.line)+`:`+Dj(e&&e.column)}function Ej(e){return Tj(e&&e.start)+`-`+Tj(e&&e.end)}function Dj(e){return e&&typeof e==`number`?e:1}var Oj=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=wj(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}};Oj.prototype.file=``,Oj.prototype.name=``,Oj.prototype.reason=``,Oj.prototype.message=``,Oj.prototype.stack=``,Oj.prototype.column=void 0,Oj.prototype.line=void 0,Oj.prototype.ancestors=void 0,Oj.prototype.cause=void 0,Oj.prototype.fatal=void 0,Oj.prototype.place=void 0,Oj.prototype.ruleId=void 0,Oj.prototype.source=void 0;var kj=l(yj(),1),Aj={}.hasOwnProperty,jj=new Map,Mj=/[A-Z]/g,Nj=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Pj=new Set([`td`,`th`]),Fj=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ij(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=qj(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=Kj(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`?mj:pj,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Lj(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Lj(e,t,n){if(t.type===`element`)return Rj(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return zj(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Vj(e,t,n);if(t.type===`mdxjsEsm`)return Bj(e,t);if(t.type===`root`)return Hj(e,t,n);if(t.type===`text`)return Uj(e,t)}function Rj(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=mj,e.schema=i),e.ancestors.push(t);let a=$j(e,t.tagName,!1),o=Jj(e,t),s=Xj(e,t);return Nj.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!PA(e)})),Wj(e,o,a,t),Gj(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zj(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)}eM(e,t.position)}function Bj(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);eM(e,t.position)}function Vj(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=mj,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:$j(e,t.name,!0),o=Yj(e,t),s=Xj(e,t);return Wj(e,o,a,t),Gj(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Hj(e,t,n){let r={};return Gj(r,Xj(e,t)),e.create(t,e.Fragment,r,n)}function Uj(e,t){return t.value}function Wj(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gj(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Kj(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 qj(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=xj(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 Jj(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Aj.call(t.properties,i)){let a=Zj(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Pj.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 Yj(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 eM(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 eM(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Xj(e,t){let n=[],r=-1,i=e.passKeys?new Map:jj;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=Lj(e,a,o);s!==void 0&&n.push(s)}return n}function Zj(e,t,n){let r=uj(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?OA(n):hj(n)),r.property===`style`){let t=typeof n==`object`?n:Qj(e,String(n));return e.stylePropertyNameCase===`css`&&(t=tM(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?oj[r.property]||r.property:r.attribute,n]}}function Qj(e,t){try{return(0,kj.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Oj("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=Fj+`#cannot-parse-style-attribute`,r}}function $j(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=MA(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=MA(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Aj.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);eM(e)}function eM(e,t){let n=new Oj("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=Fj+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function tM(e){let t={},n;for(n in e)Aj.call(e,n)&&(t[nM(n)]=e[n]);return t}function nM(e){let t=e.replace(Mj,rM);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function rM(e){return`-`+e.toLowerCase()}var iM={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`]},aM={};function oM(e,t){let n=t||aM;return sM(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function sM(e,t,n){if(lM(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 cM(e.children,t,n)}return Array.isArray(e)?cM(e,t,n):``}function cM(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=sM(e[i],t,n);return r.join(``)}function lM(e){return!!(e&&typeof e==`object`)}var uM=document.createElement(`i`);function dM(e){let t=`&`+e+`;`;uM.innerHTML=t;let n=uM.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function fM(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 pM(e,t){return e.length>0?(fM(e,e.length,0,t),e):t}var mM={}.hasOwnProperty;function hM(e){let t={},n=-1;for(;++n<e.length;)gM(t,e[n]);return t}function gM(e,t){let n;for(n in t){let r=(mM.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){mM.call(r,a)||(r[a]=[]);let e=i[a];_M(r[a],Array.isArray(e)?e:e?[e]:[])}}}function _M(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);fM(e,0,0,r)}function vM(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 yM(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var bM=jM(/[A-Za-z]/),xM=jM(/[\dA-Za-z]/),SM=jM(/[#-'*+\--9=?A-Z^-~]/);function CM(e){return e!==null&&(e<32||e===127)}var wM=jM(/\d/),TM=jM(/[\dA-Fa-f]/),EM=jM(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function DM(e){return e!==null&&(e<0||e===32)}function OM(e){return e===-2||e===-1||e===32}var kM=jM(/\p{P}|\p{S}/u),AM=jM(/\s/);function jM(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function MM(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&xM(e.charCodeAt(n+1))&&xM(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 NM(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return OM(r)?(e.enter(n),s(r)):t(r)}function s(r){return OM(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function PM(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&OM(t)?(e.enter(r),c(t)):l(t)}function c(t){return OM(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var FM={tokenize:IM};function IM(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`),NM(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 $(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var LM=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){RM(this,e,t,n,!1)}addBefore(e,t,n){RM(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function RM(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var zM={tokenize:VM},BM={tokenize:HM};function VM(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++;let c=new LM;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),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(BM,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(BM,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 $(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++;let l=new LM;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}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 HM(e,t,n){return NM(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function UM(e){if(e===null||DM(e)||AM(e))return 1;if(kM(e))return 2}function WM(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 GM={name:`attention`,resolveAll:KM,tokenize:qM};function KM(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};JM(o,-a),JM(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=pM(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=pM(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=pM(r,WM(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=pM(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=pM(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),fM(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function qM(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=UM(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=UM(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function JM(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var YM={name:`autolink`,tokenize:XM};function XM(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 bM(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||xM(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||xM(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||CM(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):SM(t)?(e.consume(t),l):n(t)}function u(e){return xM(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||xM(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var ZM={partial:!0,tokenize:QM};function QM(e,t,n){return r;function r(t){return OM(t)?NM(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var $M={continuation:{tokenize:tN},exit:nN,name:`blockQuote`,tokenize:eN};function eN(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 OM(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function tN(e,t,n){let r=this;return i;function i(t){return OM(t)?NM(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt($M,t,n)(r)}}function nN(e){e.exit(`blockQuote`)}var rN={name:`characterEscape`,tokenize:iN};function iN(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 EM(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var aN={name:`characterReference`,tokenize:oN};function oN(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=xM,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=TM,u):(e.enter(`characterReferenceValue`),a=7,o=wM,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===xM&&!dM(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 sN={partial:!0,tokenize:cN};function cN(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 lN={concrete:!0,name:`codeFenced`,tokenize:uN};function uN(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`),OM(t)?NM(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(sN,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):OM(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),NM(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$(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&&OM(t)?NM(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(sN,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$(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`),OM(t)?NM(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`),OM(t)?NM(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var dN={name:`codeIndented`,tokenize:pN},fN={partial:!0,tokenize:mN};function pN(e,t,n){return r;function r(t){return e.enter(`codeIndented`),PM(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):$(t)?e.attempt(fN,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||$(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function mN(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):$(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):PM(e,t,a,`linePrefix`,4,4)(o)}function a(e){return $(e)?i(e):n(e)}}var hN={name:`codeText`,previous:_N,resolve:gN,tokenize:vN};function gN(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 _N(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function vN(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)):$(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||$(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 yN=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&&bN(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),bN(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),bN(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);bN(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);bN(this.left,t.reverse())}}}};function bN(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 xN(e){let t={},n=-1,r,i,a,o,s,c,l,u=new yN(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,SN(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 fM(e,0,1/0,u.slice(0)),!l}function SN(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 CN={resolve:TN,tokenize:EN},wN={partial:!0,tokenize:DN};function TN(e){return xN(e),e}function EN(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):$(t)?e.check(wN,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 DN(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),NM(e,a,`linePrefix`)}function a(i){if(i===null||$(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 ON(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||CM(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||$(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||DM(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||CM(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 kN(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):$(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||$(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!OM(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function AN(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):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),NM(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$(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 jN(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):OM(i)?NM(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var MN={name:`definition`,tokenize:PN},NN={partial:!0,tokenize:FN};function PN(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return kN.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=yM(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 DM(t)?jN(e,l)(t):l(t)}function l(t){return ON(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(NN,d,d)(t)}function d(t){return OM(t)?NM(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function FN(e,t,n){return r;function r(t){return DM(t)?jN(e,i)(t):n(t)}function i(t){return AN(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return OM(t)?NM(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var IN={name:`hardBreakEscape`,tokenize:LN};function LN(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var RN={name:`headingAtx`,resolve:zN,tokenize:BN};function zN(e,t){let n=e.length-2,r=3;if(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){let 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`};fM(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function BN(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||DM(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$(n)?(e.exit(`atxHeading`),t(n)):OM(n)?NM(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||DM(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var VN=`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(`.`),HN=[`pre`,`script`,`style`,`textarea`],UN={concrete:!0,name:`htmlFlow`,resolveTo:GN,tokenize:KN},WN={partial:!0,tokenize:qN};function GN(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 KN(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:j):bM(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):bM(a)?(e.consume(a),i=4,r.interrupt?t:j):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:j):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 bM(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||DM(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&HN.includes(l)?(i=1,r.interrupt?t(s):O(s)):VN.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||xM(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 OM(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||bM(t)?(e.consume(t),b):OM(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||xM(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):OM(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):OM(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$(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||DM(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||OM(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$(t)?O(t):OM(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),ae):t===63&&i===3?(e.consume(t),j):t===93&&i===5?(e.consume(t),ie):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(WN,oe,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(sN,ee,oe)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ne(t){return t===45?(e.consume(t),j):O(t)}function A(t){return t===47?(e.consume(t),o=``,re):O(t)}function re(t){if(t===62){let n=o.toLowerCase();return HN.includes(n)?(e.consume(t),ae):O(t)}return bM(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):O(t)}function ie(t){return t===93?(e.consume(t),j):O(t)}function j(t){return t===62?(e.consume(t),ae):t===45&&i===2?(e.consume(t),j):O(t)}function ae(t){return t===null||$(t)?(e.exit(`htmlFlowData`),oe(t)):(e.consume(t),ae)}function oe(n){return e.exit(`htmlFlow`),t(n)}}function qN(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(ZM,t,n)}}var JN={name:`htmlText`,tokenize:YN};function YN(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):bM(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):bM(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):$(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(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):$(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):$(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return bM(t)?(e.consume(t),S):n(t)}function S(t){return t===45||xM(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,A(t)):OM(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||xM(t)?(e.consume(t),w):t===47||t===62||DM(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||bM(t)?(e.consume(t),E):$(t)?(o=T,A(t)):OM(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||xM(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,A(t)):OM(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):$(t)?(o=O,A(t)):OM(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):$(t)?(o=k,A(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||DM(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||DM(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return OM(t)?NM(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var XN={name:`labelEnd`,resolveAll:eP,resolveTo:tP,tokenize:nP},ZN={tokenize:rP},QN={tokenize:iP},$N={tokenize:aP};function eP(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&&fM(e,0,e.length,n),e}function tP(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=pM(o,e.slice(i+1,i+r+3)),o=pM(o,[[`enter`,l,t]]),o=pM(o,WM(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=pM(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=pM(o,e.slice(a+1)),o=pM(o,[[`exit`,s,t]]),fM(e,i,e.length,o),e}function nP(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(yM(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(ZN,u,o?u:d)(t):t===91?e.attempt(QN,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt($N,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function rP(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 DM(t)?jN(e,a)(t):a(t)}function a(t){return t===41?u(t):ON(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return DM(t)?jN(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?AN(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return DM(t)?jN(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 iP(e,t,n){let r=this;return i;function i(t){return kN.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(yM(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function aP(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 oP={name:`labelStartImage`,resolveAll:XN.resolveAll,tokenize:sP};function sP(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var cP={name:`labelStartLink`,resolveAll:XN.resolveAll,tokenize:lP};function lP(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var uP={name:`lineEnding`,tokenize:dP};function dP(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),NM(e,t,`linePrefix`)}}var fP={name:`thematicBreak`,tokenize:pP};function pP(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||$(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),OM(t)?NM(e,s,`whitespace`)(t):s(t))}}var mP={continuation:{tokenize:vP},exit:bP,name:`list`,tokenize:_P},hP={partial:!0,tokenize:xP},gP={partial:!0,tokenize:yP};function _P(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:wM(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(fP,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 wM(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(ZM,r.interrupt?n:u,e.attempt(hP,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return OM(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 vP(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ZM,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,NM(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!OM(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(gP,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,NM(e,e.attempt(mP,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function yP(e,t,n){let r=this;return NM(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 bP(e){e.exit(this.containerState.type)}function xP(e,t,n){let r=this;return NM(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!OM(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var SP={name:`setextUnderline`,resolveTo:CP,tokenize:wP};function CP(e,t){let n=new LM,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function wP(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`),OM(t)?NM(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var TP={tokenize:EP};function EP(e){let t=this,n=e.attempt(ZM,r,e.attempt(this.parser.constructs.flowInitial,i,NM(e,e.attempt(this.parser.constructs.flow,i,e.attempt(CN,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 DP={resolveAll:jP()},OP=AP(`string`),kP=AP(`text`);function AP(e){return{resolveAll:jP(e===`text`?MP: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 jP(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 MP(e,t){let n=new LM,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var NP=s({attentionMarkers:()=>VP,contentInitial:()=>FP,disable:()=>HP,document:()=>PP,flow:()=>LP,flowInitial:()=>IP,insideSpan:()=>BP,string:()=>RP,text:()=>zP}),PP={42:mP,43:mP,45:mP,48:mP,49:mP,50:mP,51:mP,52:mP,53:mP,54:mP,55:mP,56:mP,57:mP,62:$M},FP={91:MN},IP={[-2]:dN,[-1]:dN,32:dN},LP={35:RN,42:fP,45:[SP,fP],60:UN,61:SP,95:fP,96:lN,126:lN},RP={38:aN,92:rN},zP={[-5]:uP,[-4]:uP,[-3]:uP,33:oP,38:aN,42:GM,60:[YM,JN],91:cP,92:[IN,rN],93:XN,95:GM,96:hN},BP={null:[GM,DP]},VP={null:[42,95]},HP={null:[]};function UP(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=pM(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=WM(a,l.events,l),l.events):[]}function f(e,t){return GP(p(e),t)}function p(e){return WP(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(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){$(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&&fM(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 WP(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 GP(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=`
58
+ `},Kx=0,qx=[];function Jx(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(Kx++)[0],a=m.useState(gx)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Kb([e.lockRef.current],(e.shards||[]).map(Ux),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Vx(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Px(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Px(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Bx(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(qx.length&&qx[qx.length-1]===a){var r=`deltaY`in n?Hx(n):Vx(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Wx(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ux).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=m.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Yx(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=m.useCallback(function(e){n.current=Vx(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Hx(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,Vx(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return qx.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,kx),document.addEventListener(`touchmove`,c,kx),document.addEventListener(`touchstart`,u,kx),function(){qx=qx.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,kx),document.removeEventListener(`touchmove`,c,kx),document.removeEventListener(`touchstart`,u,kx)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:Gx(i)}):null,p?m.createElement(Ex,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Yx(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Xx=ox(sx,Jx),Zx=m.forwardRef(function(e,t){return m.createElement(lx,Wb({},e,{ref:t,sideCar:Xx}))});Zx.classNames=lx.classNames;var Qx=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$x=new WeakMap,eS=new WeakMap,tS={},nS=0,rS=function(e){return e&&(e.host||rS(e.parentNode))},iS=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=rS(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},aS=function(e,t,n,r){var i=iS(t,Array.isArray(e)?e:[e]);tS[n]||(tS[n]=new WeakMap);var a=tS[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=($x.get(e)||0)+1,l=(a.get(e)||0)+1;$x.set(e,c),a.set(e,l),o.push(e),c===1&&i&&eS.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),nS++,function(){o.forEach(function(e){var t=$x.get(e)-1,i=a.get(e)-1;$x.set(e,t),a.set(e,i),t||(eS.has(e)||e.removeAttribute(r),eS.delete(e)),i||e.removeAttribute(n)}),nS--,nS||($x=new WeakMap,$x=new WeakMap,eS=new WeakMap,tS={})}},oS=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Qx(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),aS(r,i,n,`aria-hidden`)):function(){return null}},sS=Object.defineProperty,cS=(e,t)=>sS(e,`name`,{value:t,configurable:!0}),lS=`Dialog`,[uS,dS]=ey(lS),[fS,pS]=uS(lS),mS=cS(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=m.useRef(null),c=m.useRef(null),[l,u]=My({prop:r,defaultProp:i??!1,onChange:a,caller:lS}),[d,f]=m.useState(0),[p,h]=m.useState(0);return(0,L.jsx)(fS,{scope:t,triggerRef:s,contentRef:c,contentId:Xy(),titleId:Xy(),descriptionId:Xy(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:h,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),hS=`DialogTrigger`,gS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(hS,n),a=Tv(t,i.triggerRef);return(0,L.jsx)(Gv.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":IS(i.open),...r,ref:a,onClick:vy(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),_S=`DialogPortal`,[vS,yS]=uS(_S,{forceMount:void 0}),bS=cS(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=pS(_S,t);return(0,L.jsx)(vS,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,L.jsx)(By,{present:n||a.open,children:(0,L.jsx)(Ib,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),xS=`DialogOverlay`,SS=m.forwardRef(cS(function(e,t){let n=yS(xS,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pS(xS,e.__scopeDialog);return a.modal?(0,L.jsx)(By,{present:r||a.open,children:(0,L.jsx)(wS,{...i,ref:t})}):null},`DialogOverlay`)),CS=Ov(`DialogOverlay.RemoveScroll`),wS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(xS,n),a=Tv(t,fb());return(0,L.jsx)(Zx,{as:CS,allowPinchZoom:!0,shards:[i.contentRef],children:(0,L.jsx)(Gv.div,{"data-state":IS(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),TS=`DialogContent`,ES=m.forwardRef(cS(function(e,t){let n=yS(TS,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pS(TS,e.__scopeDialog);return(0,L.jsx)(By,{present:r||a.open,children:a.modal?(0,L.jsx)(DS,{...i,ref:t}):(0,L.jsx)(OS,{...i,ref:t})})},`DialogContent`)),DS=m.forwardRef(cS(function(e,t){let n=pS(TS,e.__scopeDialog),r=m.useRef(null),i=Tv(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return oS(e)},[]),(0,L.jsx)(kS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:vy(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:vy(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:vy(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),OS=m.forwardRef(cS(function(e,t){let n=pS(TS,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,L.jsx)(kS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),kS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=pS(TS,n);return Hb(),(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(Cb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(db,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":IS(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),AS=`DialogTitle`,jS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(AS,n),{setTitleCount:a}=i;return Cy(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,L.jsx)(Gv.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),MS=`DialogDescription`,NS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(MS,n),{setDescriptionCount:a}=i;return Cy(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,L.jsx)(Gv.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),PS=`DialogClose`,FS=m.forwardRef(cS(function(e,t){let{__scopeDialog:n,...r}=e,i=pS(PS,n);return(0,L.jsx)(Gv.button,{type:`button`,...r,ref:t,onClick:vy(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function IS(e){return e?`open`:`closed`}cS(IS,`getState`);var LS=Object.defineProperty,RS=(e,t)=>LS(e,`name`,{value:t,configurable:!0}),[zS,BS]=ey(`AlertDialog`,[dS]),VS=dS(),HS=RS(e=>{let{__scopeAlertDialog:t,...n}=e,r=VS(t);return(0,L.jsx)(mS,{...r,...n,modal:!0})},`AlertDialog`);m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(gS,{...i,...r,ref:t})},`AlertDialogTrigger`));var US=RS(e=>{let{__scopeAlertDialog:t,...n}=e,r=VS(t);return(0,L.jsx)(bS,{...r,...n})},`AlertDialogPortal`),WS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(SS,{...i,...r,ref:t})},`AlertDialogOverlay`)),[GS,KS]=zS(`AlertDialogContent`),qS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=VS(n),o=Tv(t,m.useRef(null)),s=m.useRef(null);return(0,L.jsx)(GS,{scope:n,cancelRef:s,children:(0,L.jsx)(ES,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:vy(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),JS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(jS,{...i,...r,ref:t})},`AlertDialogTitle`)),YS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(NS,{...i,...r,ref:t})},`AlertDialogDescription`)),XS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=VS(n);return(0,L.jsx)(FS,{...i,...r,ref:t})},`AlertDialogAction`)),ZS=`AlertDialogCancel`,QS=m.forwardRef(RS(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=KS(ZS,n),a=VS(n),o=Tv(t,i);return(0,L.jsx)(FS,{...a,...r,ref:o})},`AlertDialogCancel`)),$S=HS,eC=US,tC=WS,nC=qS,rC=XS,iC=QS,aC=JS,oC=YS,sC=Object.defineProperty,cC=(e,t)=>sC(e,`name`,{value:t,configurable:!0});function lC(e){let[t,n]=m.useState(void 0);return Cy(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}cC(lC,`useSize`);var uC=Object.defineProperty,dC=(e,t)=>uC(e,`name`,{value:t,configurable:!0}),fC=`Checkbox`,[pC,mC]=ey(fC),[hC,gC]=pC(fC);function _C(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=My({prop:n,defaultProp:i??!1,onChange:c,caller:fC}),[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useRef(!1),[b,x]=m.useReducer(e=>e+1,0),S=!h||!!o||!!h.closest(`form`),C={checked:f,disabled:a,setChecked:p,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,userInteractionCount:b,onUserInteraction:x,required:l,defaultChecked:!EC(i)&&i,isFormControl:S,bubbleInput:_,setBubbleInput:v};return(0,L.jsx)(hC,{scope:t,...C,children:TC(d)?d(C):r})}dC(_C,`CheckboxProvider`);var vC=`CheckboxTrigger`,yC=m.forwardRef(dC(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:h,bubbleInput:g}=gC(vC,e),_=Tv(i,u),v=m.useRef(c);return m.useEffect(()=>{let e=a?.form;if(e){let t=dC(()=>d(v.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,L.jsx)(Gv.button,{type:`button`,role:`checkbox`,"aria-checked":EC(c)?`mixed`:c,"aria-required":l,"data-state":DC(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:_,onKeyDown:vy(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:vy(n,e=>{p(),d(e=>EC(e)?!0:!e),g&&h&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),bC=m.forwardRef(dC(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,L.jsx)(_C,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(yC,{...d,ref:t,__scopeCheckbox:n}),e&&(0,L.jsx)(wC,{__scopeCheckbox:n})]})})},`Checkbox`)),xC=`CheckboxIndicator`,SC=m.forwardRef(dC(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=gC(xC,n);return(0,L.jsx)(By,{present:r||EC(a.checked)||a.checked===!0,children:(0,L.jsx)(Gv.span,{"data-state":DC(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),CC=`CheckboxBubbleInput`,wC=m.forwardRef(dC(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:g}=gC(CC,e),_=Tv(r,g),v=lC(i),y=m.useRef(!1),b=m.useRef(s),x=m.useRef(o);m.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=EC(s),n.call(e,!EC(s)&&s),e.dispatchEvent(t),y.current=!1}},[h,s,a,o]);let S=m.useRef(!EC(s)&&s);return(0,L.jsx)(Gv.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:_,onClick:vy(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function TC(e){return typeof e==`function`}dC(TC,`isFunction`);function EC(e){return e===`indeterminate`}dC(EC,`isIndeterminate`);function DC(e){return EC(e)?`indeterminate`:e?`checked`:`unchecked`}dC(DC,`getState`);var OC=[`top`,`right`,`bottom`,`left`],kC=Math.min,AC=Math.max,jC=Math.round,MC=Math.floor,NC=e=>({x:e,y:e}),PC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function FC(e,t,n){return AC(e,kC(t,n))}function IC(e,t){return typeof e==`function`?e(t):e}function LC(e){return e.split(`-`)[0]}function RC(e){return e.split(`-`)[1]}function zC(e){return e===`x`?`y`:`x`}function BC(e){return e===`y`?`height`:`width`}function VC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function HC(e){return zC(VC(e))}function UC(e,t,n){n===void 0&&(n=!1);let r=RC(e),i=HC(e),a=BC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=QC(o)),[o,QC(o)]}function WC(e){let t=QC(e);return[GC(e),t,GC(t)]}function GC(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var KC=[`left`,`right`],qC=[`right`,`left`],JC=[`top`,`bottom`],YC=[`bottom`,`top`];function XC(e,t,n){switch(e){case`top`:case`bottom`:return n?t?qC:KC:t?KC:qC;case`left`:case`right`:return t?JC:YC;default:return[]}}function ZC(e,t,n,r){let i=RC(e),a=XC(LC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(GC)))),a}function QC(e){let t=LC(e);return PC[t]+e.slice(t.length)}function $C(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ew(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:$C(e)}function tw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function nw(e,t,n){let{reference:r,floating:i}=e,a=VC(t),o=HC(t),s=BC(o),c=LC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=RC(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function rw(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=IC(t,e),p=ew(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=tw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=tw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var iw=50,aw=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:rw},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=nw(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<iw&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=nw(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ow=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=IC(e,t)||{};if(l==null)return{};let d=ew(u),f={x:n,y:r},p=HC(i),m=BC(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=kC(d[_],T),D=kC(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,ee=FC(E,k,O),te=!c.arrow&&RC(i)!=null&&k!==ee&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ne=te?k<E?k-E:k-O:0;return{[p]:f[p]+ne,data:{[p]:ee,centerOffset:k-ee-ne,...te&&{alignmentOffset:ne}},reset:te}}}),sw=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=IC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=LC(r),_=VC(o),v=LC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[QC(o)]:WC(o)),x=p!==`none`;!d&&x&&b.push(...ZC(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=UC(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===VC(t)||T.every(e=>VC(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=VC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function cw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function lw(e){return OC.some(t=>e[t]>=0)}var uw=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=IC(e,t);switch(i){case`referenceHidden`:{let e=cw(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:lw(e)}}}case`escaped`:{let e=cw(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:lw(e)}}}default:return{}}}}},dw=new Set([`left`,`top`]);async function fw(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=LC(n),s=RC(n),c=VC(n)===`y`,l=dw.has(o)?-1:1,u=a&&c?-1:1,d=IC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var pw=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await fw(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},mw=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=IC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=VC(i),p=zC(f),m=u[p],h=u[f],g=(e,t)=>FC(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},hw=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=IC(e,t),u={x:n,y:r},d=VC(i),f=zC(d),p=u[f],m=u[d],h=IC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=dw.has(LC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},gw=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=IC(e,t),c=await i.detectOverflow(t,s),l=LC(n),u=RC(n),d=VC(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=kC(p-c[m],g),y=kC(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*AC(c.left,c.right):S=p-2*AC(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function _w(){return typeof window<`u`}function vw(e){return xw(e)?(e.nodeName||``).toLowerCase():`#document`}function yw(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bw(e){return((xw(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xw(e){return _w()?e instanceof Node||e instanceof yw(e).Node:!1}function Sw(e){return _w()?e instanceof Element||e instanceof yw(e).Element:!1}function Cw(e){return _w()?e instanceof HTMLElement||e instanceof yw(e).HTMLElement:!1}function ww(e){return!_w()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof yw(e).ShadowRoot}function Tw(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Iw(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ew(e){return/^(table|td|th)$/.test(vw(e))}function Dw(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ow=/transform|translate|scale|rotate|perspective|filter/,kw=/paint|layout|strict|content/,Aw=e=>!!e&&e!==`none`,jw;function Mw(e){let t=Sw(e)?Iw(e):e;return Aw(t.transform)||Aw(t.translate)||Aw(t.scale)||Aw(t.rotate)||Aw(t.perspective)||!Pw()&&(Aw(t.backdropFilter)||Aw(t.filter))||Ow.test(t.willChange||``)||kw.test(t.contain||``)}function Nw(e){let t=Rw(e);for(;Cw(t)&&!Fw(t);){if(Mw(t))return t;if(Dw(t))return null;t=Rw(t)}return null}function Pw(){return jw??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),jw}function Fw(e){return/^(html|body|#document)$/.test(vw(e))}function Iw(e){return yw(e).getComputedStyle(e)}function Lw(e){return Sw(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rw(e){if(vw(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ww(e)&&e.host||bw(e);return ww(t)?t.host:t}function zw(e){let t=Rw(e);return Fw(t)?(e.ownerDocument||e).body:Cw(t)&&Tw(t)?t:zw(t)}function Bw(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=zw(e),i=r===e.ownerDocument?.body,a=yw(r);if(i){let e=Vw(a);return t.concat(a,a.visualViewport||[],Tw(r)?r:[],e&&n?Bw(e):[])}return t.concat(r,Bw(r,[],n))}function Vw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hw(e){let t=Iw(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Cw(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=jC(n)!==a||jC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Uw(e){return Sw(e)?e:e.contextElement}function Ww(e){let t=Uw(e);if(!Cw(t))return NC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Hw(t),o=(a?jC(n.width):n.width)/r,s=(a?jC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Gw=NC(0);function Kw(e){let t=yw(e);return!Pw()||!t.visualViewport?Gw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qw(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===yw(e)}function Jw(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Uw(e),o=NC(1);t&&(r?Sw(r)&&(o=Ww(r)):o=Ww(e));let s=qw(a,n,r)?Kw(a):NC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=yw(a),t=Sw(r)?yw(r):r,n=e,i=Vw(n);for(;i&&t!==n;){let e=Ww(i),t=i.getBoundingClientRect(),r=Iw(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=yw(i),i=Vw(n)}}return tw({width:u,height:d,x:c,y:l})}function Yw(e,t){let n=Lw(e).scrollLeft;return t?t.left+n:Jw(bw(e)).left+n}function Xw(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Yw(e,n),y:n.top+t.scrollTop}}function Zw(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=bw(r),s=t?Dw(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=NC(1),u=NC(0),d=Cw(r);if((d||!a)&&((vw(r)!==`body`||Tw(o))&&(c=Lw(r)),d)){let e=Jw(r);l=Ww(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Xw(o,c):NC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Qw(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function $w(e){let t=Lw(e),n=e.ownerDocument.body,r=AC(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=AC(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Yw(e),o=-t.scrollTop;return Iw(n).direction===`rtl`&&(a+=AC(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var eT=25;function tT(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=yw(e),a=bw(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Pw()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Yw(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=eT&&(s-=o)}return{width:s,height:c,x:l,y:u}}function nT(e,t){let n=Jw(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ww(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function rT(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=tT(e,n,t);else if(t===`document`)r=$w(bw(e));else if(Sw(t))r=nT(t,n);else{let n=Kw(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return tw(r)}function iT(e,t){let n=t.get(e);if(n)return n;let r=Bw(e,[],!1).filter(e=>Sw(e)&&vw(e)!==`body`),i=null,a=Iw(e).position===`fixed`,o=a?Rw(e):e;for(;Sw(o)&&!Fw(o);){let e=Iw(o),t=Mw(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Rw(o)}return t.set(e,r),r}function aT(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Dw(t)?[]:iT(t,this._c):[].concat(n),r],o=rT(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=rT(t,a[e],i);s=AC(n.top,s),c=kC(n.right,c),l=kC(n.bottom,l),u=AC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function oT(e){let{width:t,height:n}=Hw(e);return{width:t,height:n}}function sT(e,t,n){let r=Cw(t),i=bw(t),a=n===`fixed`,o=Jw(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=NC(0);if((r||!a)&&((vw(t)!==`body`||Tw(i))&&(s=Lw(t)),r)){let e=Jw(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Yw(i));let l=i&&!r&&!a?Xw(i,s):NC(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function cT(e){return Iw(e).position===`static`}function lT(e,t){if(!Cw(e)||Iw(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return bw(e)===n&&(n=n.ownerDocument.body),n}function uT(e,t){let n=yw(e);if(Dw(e))return n;if(!Cw(e)){let t=Rw(e);for(;t&&!Fw(t);){if(Sw(t)&&!cT(t))return t;t=Rw(t)}return n}let r=lT(e,t);for(;r&&Ew(r)&&cT(r);)r=lT(r,t);return r&&Fw(r)&&cT(r)&&!Mw(r)?n:r||Nw(e)||n}var dT=async function(e){let t=this.getOffsetParent||uT,n=this.getDimensions,r=await n(e.floating);return{reference:sT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fT(e){return Iw(e).direction===`rtl`}var pT={convertOffsetParentRelativeRectToViewportRelativeRect:Zw,getDocumentElement:bw,getClippingRect:aT,getOffsetParent:uT,getElementRects:dT,getClientRects:Qw,getDimensions:oT,getScale:Ww,isElement:Sw,isRTL:fT};function mT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hT(e,t,n){let r=null,i,a=bw(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=MC(d),h=MC(a.clientWidth-(u+f)),g=MC(a.clientHeight-(d+p)),_=MC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:AC(0,kC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!mT(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=yw(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function gT(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Uw(e),u=i||a?[...l?Bw(l):[],...t?Bw(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?hT(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Jw(e):null;c&&g();function g(){let t=Jw(e);h&&!mT(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var _T=pw,vT=mw,yT=sw,bT=gw,xT=uw,ST=ow,CT=hw,wT=(e,t,n)=>{let r=new Map,i=n??{},a={...pT,...i.platform,_c:r};return aw(e,t,{...i,platform:a})},TT=typeof document<`u`?m.useLayoutEffect:function(){};function ET(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ET(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ET(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function DT(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function OT(e,t){let n=DT(e);return Math.round(t*n)/n}function kT(e){let t=m.useRef(e);return TT(()=>{t.current=e}),t}function AT(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);ET(f,r)||p(r);let[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=m.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=m.useRef(null),w=m.useRef(null),T=m.useRef(u),E=c!=null,D=kT(c),O=kT(i),k=kT(l),ee=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),wT(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};te.current&&!ET(T.current,t)&&(T.current=t,Hv.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);TT(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=m.useRef(!1);TT(()=>(te.current=!0,()=>{te.current=!1}),[]),TT(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,ee);ee()}},[x,S,ee,D,E]);let ne=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),A=m.useMemo(()=>({reference:x,floating:S}),[x,S]),re=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=OT(A.floating,u.x),r=OT(A.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...DT(A.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,A.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:ee,refs:ne,elements:A,floatingStyles:re}),[u,ee,ne,A,re])}var jT=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ST({element:r.current,padding:i}).fn(n):r?ST({element:r,padding:i}).fn(n):{}}}},MT=(e,t)=>{let n=_T(e);return{name:n.name,fn:n.fn,options:[e,t]}},NT=(e,t)=>{let n=vT(e);return{name:n.name,fn:n.fn,options:[e,t]}},PT=(e,t)=>({fn:CT(e).fn,options:[e,t]}),FT=(e,t)=>{let n=yT(e);return{name:n.name,fn:n.fn,options:[e,t]}},IT=(e,t)=>{let n=bT(e);return{name:n.name,fn:n.fn,options:[e,t]}},LT=(e,t)=>{let n=xT(e);return{name:n.name,fn:n.fn,options:[e,t]}},RT=(e,t)=>{let n=jT(e);return{name:n.name,fn:n.fn,options:[e,t]}},zT=Object.defineProperty,BT=m.forwardRef(((e,t)=>zT(e,`name`,{value:t,configurable:!0}))(function(e,t){let{children:n,width:r=10,height:i=5,...a}=e;return(0,L.jsx)(Gv.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,L.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})},`Arrow`)),VT=Object.defineProperty,HT=(e,t)=>VT(e,`name`,{value:t,configurable:!0}),UT=`Popper`,[WT,GT]=ey(UT),[KT,qT]=WT(UT),JT=HT(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,L.jsx)(KT,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),YT=`PopperAnchor`,XT=m.forwardRef(HT(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=qT(YT,n),o=m.useRef(null),s=a.onAnchorChange,c=Tv(t,m.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=m.useRef(null);m.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&oE(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,L.jsx)(Gv.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),ZT=`PopperContent`,[QT,$T]=WT(ZT),eE=m.forwardRef(HT(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:h,...g}=e,_=qT(ZT,n),[v,y]=m.useState(null),b=Tv(t,y),[x,S]=m.useState(null),C=lC(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,ee={padding:D,boundary:O.filter(iE),altBoundary:k},{refs:te,floatingStyles:ne,placement:A,isPositioned:re,middlewareData:ie}=AT({strategy:`fixed`,placement:E,whileElementsMounted:HT((...e)=>gT(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:_.anchor},middleware:[MT({mainAxis:i+T,alignmentAxis:o}),c&&NT({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?PT():void 0,...ee}),c&&FT({...ee}),IT({...ee,apply:HT(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&RT({element:x,padding:s}),aE({arrowWidth:w,arrowHeight:T}),f&&LT({strategy:`referenceHidden`,...ee,boundary:k?ee.boundary:void 0})]}),j=_.setPlacementState;Cy(()=>(j(A),()=>{j(void 0)}),[A,j]);let[ae,oe]=oE(A),se=rb(h);Cy(()=>{re&&se?.()},[re,se]);let ce=ie.arrow?.x,le=ie.arrow?.y,ue=ie.arrow?.centerOffset!==0,[de,fe]=m.useState();return Cy(()=>{v&&fe(window.getComputedStyle(v).zIndex)},[v]),(0,L.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:re?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(QT,{scope:n,placedSide:ae,placedAlign:oe,onArrowChange:S,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,L.jsx)(Gv.div,{"data-side":ae,"data-align":oe,...g,ref:b,style:{...g.style,animation:re?g.style?.animation:`none`}})})})},`PopperContent`)),tE=`PopperArrow`,nE={top:`bottom`,right:`left`,bottom:`top`,left:`right`},rE=m.forwardRef(HT(function(e,t){let{__scopePopper:n,...r}=e,i=$T(tE,n),a=nE[i.placedSide];return(0,L.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,L.jsx)(BT,{...r,ref:t,style:{...r.style,display:`block`}})})},`PopperArrow`));function iE(e){return e!==null}HT(iE,`isNotNull`);var aE=HT(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=oE(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function oE(e){let[t,n=`center`]=e.split(`-`);return[t,n]}HT(oE,`getSideAndAlignFromPlacement`);var sE=JT,cE=XT,lE=eE,uE=rE,dE=Object.defineProperty,fE=(e,t)=>dE(e,`name`,{value:t,configurable:!0}),pE=!1;function mE(){let[e,t]=m.useState(pE);return m.useEffect(()=>{pE||(pE=!0,t(!0))},[]),e}fE(mE,`useIsHydrated`);var hE=m.useSyncExternalStore;function gE(){return()=>{}}fE(gE,`subscribe`);function _E(){return hE(gE,()=>!0,()=>!1)}fE(_E,`useIsHydratedModern`);var vE=typeof hE==`function`?_E:mE,yE=Object.defineProperty,bE=(e,t)=>yE(e,`name`,{value:t,configurable:!0}),xE=`rovingFocusGroup.onEntryFocus`,SE={bubbles:!1,cancelable:!0},CE=`RovingFocusGroup`,[wE,TE,EE]=iy(CE),[DE,OE]=ey(CE,[EE]),[kE,AE]=DE(CE),jE=m.forwardRef(bE(function(e,t){return(0,L.jsx)(wE.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(wE.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(ME,{...e,ref:t})})})},`RovingFocusGroup`)),ME=m.forwardRef(bE(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=m.useRef(null),p=Tv(t,f),h=eb(a),[g,_]=My({prop:o,defaultProp:s??null,onChange:c,caller:CE}),[v,y]=m.useState(!1),b=rb(l),x=TE(n),S=m.useRef(!1),[C,w]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(xE,b),()=>e.removeEventListener(xE,b)},[b]),(0,L.jsx)(kE,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:m.useCallback(e=>_(e),[_]),onItemShiftTab:m.useCallback(()=>y(!0),[]),onFocusableItemAdd:m.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:m.useCallback(()=>w(e=>e-1),[]),children:(0,L.jsx)(Gv.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:vy(e.onMouseDown,()=>{S.current=!0}),onFocus:vy(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(xE,SE);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);RE([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:vy(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),NE=`RovingFocusGroupItem`,PE=m.forwardRef(bE(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Xy(),l=a||c,u=AE(NE,n),d=u.currentTabStopId===l,f=TE(n),{onFocusableItemAdd:p,onFocusableItemRemove:h,currentTabStopId:g}=u,_=vE();return Cy(()=>{if(_&&r)return p(),()=>h()},[_,r,p,h]),m.useEffect(()=>{if(!_&&r)return p(),()=>h()},[_,r,p,h]),(0,L.jsx)(wE.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,L.jsx)(Gv.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:vy(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:vy(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:vy(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=LE(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?zE(n,r+1):n.slice(r+1)}setTimeout(()=>RE(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})},`RovingFocusGroupItem`)),FE={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function IE(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}bE(IE,`getDirectionAwareKey`);function LE(e,t,n){let r=IE(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return FE[r]}bE(LE,`getFocusIntent`);function RE(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}bE(RE,`focusFirst`);function zE(e,t){return e.map((n,r)=>e[(t+r)%e.length])}bE(zE,`wrapArray`);var BE=jE,VE=PE,HE=Object.defineProperty,UE=(e,t)=>HE(e,`name`,{value:t,configurable:!0}),WE=`Popover`,[GE,KE]=ey(WE,[GT]),qE=GT(),[JE,YE]=GE(WE),XE=UE(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=qE(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=My({prop:r,defaultProp:i??!1,onChange:a,caller:WE});return(0,L.jsx)(sE,{...s,children:(0,L.jsx)(JE,{scope:t,contentId:Xy(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ZE=`PopoverTrigger`,QE=m.forwardRef(UE(function(e,t){let{__scopePopover:n,...r}=e,i=YE(ZE,n),a=qE(n),o=Tv(t,i.triggerRef),s=(0,L.jsx)(Gv.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":lD(i.open),...r,ref:o,onClick:vy(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(cE,{asChild:!0,...a,children:s})},`PopoverTrigger`)),$E=`PopoverPortal`,[eD,tD]=GE($E,{forceMount:void 0}),nD=UE(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=YE($E,t);return(0,L.jsx)(eD,{scope:t,forceMount:n,children:(0,L.jsx)(By,{present:n||a.open,children:(0,L.jsx)(Ib,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),rD=`PopoverContent`,iD=m.forwardRef(UE(function(e,t){let n=tD(rD,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=YE(rD,e.__scopePopover);return(0,L.jsx)(By,{present:r||a.open,children:a.modal?(0,L.jsx)(oD,{...i,ref:t}):(0,L.jsx)(sD,{...i,ref:t})})},`PopoverContent`)),aD=Ov(`PopoverContent.RemoveScroll`),oD=m.forwardRef(UE(function(e,t){let n=YE(rD,e.__scopePopover),r=m.useRef(null),i=Tv(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return oS(e)},[]),(0,L.jsx)(Zx,{as:aD,allowPinchZoom:!0,children:(0,L.jsx)(cD,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vy(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vy(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:vy(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),sD=m.forwardRef(UE(function(e,t){let n=YE(rD,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,L.jsx)(cD,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),cD=m.forwardRef(UE(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=YE(rD,n),p=qE(n);return Hb(),(0,L.jsx)(Cb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(db,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(lE,{"data-state":lD(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function lD(e){return e?`open`:`closed`}UE(lD,`getState`);var uD=XE,dD=QE,fD=nD,pD=iD,mD=Object.defineProperty,hD=(e,t)=>mD(e,`name`,{value:t,configurable:!0}),gD=`Switch`,[_D,vD]=ey(gD),[yD,bD]=_D(gD);function xD(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=My({prop:n,defaultProp:i??!1,onChange:c,caller:gD}),[h,g]=m.useState(null),[_,v]=m.useState(null),y=m.useRef(!1),[b,x]=m.useReducer(e=>e+1,0),S={checked:f,setChecked:p,disabled:a,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,userInteractionCount:b,onUserInteraction:x,required:l,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,L.jsx)(yD,{scope:t,...S,children:kD(d)?d(S):r})}hD(xD,`SwitchProvider`);var SD=`SwitchTrigger`,CD=m.forwardRef(hD(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:h,bubbleInput:g}=bD(SD,e),_=Tv(r,u),v=m.useRef(c);return m.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=hD(()=>d(v.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,L.jsx)(Gv.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":AD(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:_,onClick:vy(t,e=>{p(),d(e=>!e),g&&h&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`SwitchTrigger`)),wD=m.forwardRef(hD(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,L.jsx)(xD,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(CD,{...d,ref:t,__scopeSwitch:n}),e&&(0,L.jsx)(OD,{__scopeSwitch:n})]})})},`Switch`)),TD=`SwitchThumb`,ED=m.forwardRef(hD(function(e,t){let{__scopeSwitch:n,...r}=e,i=bD(TD,n);return(0,L.jsx)(Gv.span,{"data-state":AD(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),DD=`SwitchBubbleInput`,OD=m.forwardRef(hD(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:g}=bD(DD,e),_=Tv(r,g),v=lC(i),y=m.useRef(!1),b=m.useRef(s),x=m.useRef(o);m.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});n.call(e,s),e.dispatchEvent(t),y.current=!1}},[h,s,a,o]);let S=m.useRef(s);return(0,L.jsx)(Gv.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:_,onClick:vy(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function kD(e){return typeof e==`function`}hD(kD,`isFunction`);function AD(e){return e?`checked`:`unchecked`}hD(AD,`getState`);var jD=Object.defineProperty,MD=(e,t)=>jD(e,`name`,{value:t,configurable:!0}),ND=`Tabs`,[PD,FD]=ey(ND,[OE]),ID=OE(),[LD,RD]=PD(ND),zD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=eb(s),[d,f]=My({prop:r,onChange:i,defaultProp:a??``,caller:ND});return(0,L.jsx)(LD,{scope:n,baseId:Xy(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,L.jsx)(Gv.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),BD=`TabsList`,VD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=RD(BD,n),o=ID(n);return(0,L.jsx)(BE,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,L.jsx)(Gv.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),HD=`TabsTrigger`,UD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=RD(HD,n),s=ID(n),c=KD(o.baseId,r),l=qD(o.baseId,r),u=r===o.value;return(0,L.jsx)(VE,{asChild:!0,...s,focusable:!i,active:u,children:(0,L.jsx)(Gv.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:vy(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:vy(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:vy(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),WD=`TabsContent`,GD=m.forwardRef(MD(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=RD(WD,n),c=KD(s.baseId,r),l=qD(s.baseId,r),u=r===s.value,d=m.useRef(u);return m.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,L.jsx)(By,{present:i||u,children:({present:n})=>(0,L.jsx)(Gv.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function KD(e,t){return`${e}-trigger-${t}`}MD(KD,`makeTriggerId`);function qD(e,t){return`${e}-content-${t}`}MD(qD,`makeContentId`);var JD=zD,YD=VD,XD=UD,ZD=GD,QD=Object.defineProperty,$D=(e,t)=>QD(e,`name`,{value:t,configurable:!0}),[eO,tO]=ey(`Tooltip`,[GT]),nO=GT(),rO=`TooltipProvider`,iO=700,aO=`tooltip.open`,[oO,sO]=eO(rO),cO=$D(e=>{let{__scopeTooltip:t,delayDuration:n=iO,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=m.useRef(!0),s=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(oO,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:m.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),lO=`Tooltip`,[uO,dO]=eO(lO),fO=$D(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=sO(lO,e.__scopeTooltip),l=nO(t),[u,d]=m.useState(null),[f,p]=m.useState(void 0),h=Xy(),g=m.useRef(0),_=o??c.disableHoverableContent,v=s??c.delayDuration,y=m.useRef(!1),[b,x]=My({prop:r,defaultProp:i??!1,onChange:$D(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(aO))):c.onClose(),a?.(e)},`onChange`),caller:lO}),S=m.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),w=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),T=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);m.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]);let E=f??h;return(0,L.jsx)(sE,{...l,children:(0,L.jsx)(uO,{scope:t,contentId:E,setContentId:p,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{_?w():(window.clearTimeout(g.current),g.current=0)},[w,_]),onOpen:C,onClose:w,disableHoverableContent:_,children:n})})},`Tooltip`),pO=`TooltipTrigger`,mO=m.forwardRef($D(function(e,t){let{__scopeTooltip:n,...r}=e,i=dO(pO,n),a=sO(pO,n),o=nO(n),s=Tv(t,m.useRef(null),i.onTriggerChange),c=m.useRef(!1),l=m.useRef(!1),u=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,L.jsx)(cE,{asChild:!0,...o,children:(0,L.jsx)(Gv.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:vy(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:vy(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:vy(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:vy(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:vy(e.onBlur,i.onClose),onClick:vy(e.onClick,i.onClose)})})},`TooltipTrigger`)),hO=`TooltipPortal`,[gO,_O]=eO(hO,{forceMount:void 0}),vO=$D(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=dO(hO,t);return(0,L.jsx)(gO,{scope:t,forceMount:n,children:(0,L.jsx)(By,{present:n||a.open,children:(0,L.jsx)(Ib,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),yO=`TooltipContent`,bO=m.forwardRef($D(function(e,t){let n=_O(yO,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=dO(yO,e.__scopeTooltip);return(0,L.jsx)(By,{present:r||o.open,children:o.disableHoverableContent?(0,L.jsx)(CO,{side:i,...a,ref:t}):(0,L.jsx)(xO,{side:i,...a,ref:t})})},`TooltipContent`)),xO=m.forwardRef($D(function(e,t){let n=dO(yO,e.__scopeTooltip),r=sO(yO,e.__scopeTooltip),i=m.useRef(null),a=Tv(t,i),[o,s]=m.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=m.useCallback(()=>{s(null),d(!1)},[d]),p=m.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=EO(r,TO(r,n.getBoundingClientRect())),a=DO(t.getBoundingClientRect()),o=kO([...i,...a]);s(o),d(!0)},[d]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&u){let e=$D(e=>p(e,u),`handleTriggerLeave`),t=$D(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),m.useEffect(()=>{if(o){let e=$D(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!OO(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,L.jsx)(CO,{...e,ref:a})},`TooltipContentHoverable`)),SO=jv(`TooltipContent`),CO=m.forwardRef($D(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=dO(yO,n),u=nO(n),{onClose:d}=l;m.useEffect(()=>(document.addEventListener(aO,d),()=>document.removeEventListener(aO,d)),[d]),m.useEffect(()=>{if(l.trigger){let e=$D(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return Cy(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,L.jsx)(db,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,L.jsxs)(lE,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(SO,{children:r}),i?(0,L.jsx)(Xv,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`)),wO=m.forwardRef($D(function(e,t){let{__scopeTooltip:n,...r}=e,i=nO(n);return(0,L.jsx)(uE,{...i,...r,ref:t})},`TooltipArrow`));function TO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}$D(TO,`getExitSideFromRect`);function EO(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}$D(EO,`getPaddedExitPoints`);function DO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}$D(DO,`getPointsFromRect`);function OO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}$D(OO,`isPointInPolygon`);function kO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),AO(t)}$D(kO,`getHull`);function AO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}$D(AO,`getHullPresorted`);var jO=cO,MO=fO,NO=mO,PO=vO,FO=bO,IO=wO,LO=Yg(`group/button motion-reduce:transition-none motion-reduce:active:translate-none inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-[0.8125rem] font-medium whitespace-nowrap transition-[transform,background-color,box-shadow,color,border-color,filter] duration-150 active:not-aria-[haspopup]:translate-y-px ease-snap outline-none select-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`btn-tint text-primary-foreground [--tint:var(--primary)] disabled:text-muted-foreground`,soft:`btn-raised btn-soft text-foreground`,outline:`btn-raised bg-card text-foreground`,secondary:`btn-raised bg-card text-secondary-foreground`,ghost:`btn-ghost text-foreground`,destructive:`btn-tint text-background [--tint:var(--destructive)] focus-visible:outline-destructive disabled:text-muted-foreground`,link:`text-link underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-3`,xs:`h-7 gap-1 px-2.5 text-xs [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1.5 px-2.5 text-xs [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-2 px-4`,icon:`size-8`,"icon-xs":`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-sm":`size-7`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function J({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?kv:`button`;return(0,L.jsx)(a,{"aria-keyshortcuts":r?void 0:`Enter Space`,"aria-description":r?`When focused, press Enter to activate.`:`When focused, press Enter or Space to activate.`,"aria-describedby":`focused-action-help`,"data-slot":`button`,"data-variant":t,"data-size":n,className:q(LO({variant:t,size:n,className:e})),...i})}var RO=q(`pointer-events-none inline-flex h-[1.125rem] min-w-[1.125rem] w-fit items-center justify-center gap-1 rounded-[5px] border border-border bg-background px-1 font-sans text-[0.7rem] leading-none font-medium text-muted-foreground shadow-[inset_0_-1px_0_var(--border)] select-none`,`in-data-[slot=tooltip-content]:border-background/25 in-data-[slot=tooltip-content]:bg-transparent in-data-[slot=tooltip-content]:text-background in-data-[slot=tooltip-content]:shadow-none`,`in-data-[variant=default]:border-primary-foreground/35 in-data-[variant=default]:bg-primary-foreground/10 in-data-[variant=default]:text-primary-foreground in-data-[variant=default]:shadow-none`,`in-data-[variant=destructive]:border-background/40 in-data-[variant=destructive]:bg-background/10 in-data-[variant=destructive]:text-background in-data-[variant=destructive]:shadow-none`,`[&_svg:not([class*='size-'])]:size-3`);function zO({className:e,...t}){return(0,L.jsx)(`kbd`,{"data-slot":`kbd`,className:q(RO,e),...t})}function BO({className:e,...t}){return(0,L.jsx)(`kbd`,{"data-slot":`kbd-group`,className:q(`inline-flex items-center gap-0.5`,e),...t})}var VO=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),HO={alt:`⌥`,ctrl:`⌃`,shift:`⇧`,meta:`⌘`,cmd:`⌘`},UO={enter:`↵`,esc:`Esc`,escape:`Esc`,arrowleft:`←`,arrowright:`→`,arrowup:`↑`,arrowdown:`↓`,space:`Space`,delete:`Del`,backspace:`⌫`};function WO(e){return e.split(`+`).map(e=>{let t=e.toLowerCase();return VO&&HO[t]?HO[t]:UO[t]??(e.length===1?e.toUpperCase():e[0].toUpperCase()+e.slice(1))})}function GO({chord:e,className:t}){let n=WO(e);return(0,L.jsx)(BO,{className:t,children:n.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[t>0?(0,L.jsx)(`span`,{className:`sr-only`,children:`plus`}):null,(0,L.jsx)(zO,{children:e})]},t))})}function KO({chord:e,children:t,className:n}){return(0,L.jsxs)(`span`,{className:q(`kbd-hint inline-flex shrink-0 items-center gap-1.5 text-xs whitespace-nowrap text-muted-foreground`,n),children:[(0,L.jsx)(GO,{chord:e}),t]})}function qO({open:e,onOpenChange:t,label:n,description:r,dismissOnBackdrop:i=!0,className:a,style:o,onCloseAutoFocus:s,children:c}){let l=Sf();return(0,L.jsx)(mS,{open:e,onOpenChange:t,children:(0,L.jsx)(Ou,{children:e?(0,L.jsxs)(bS,{forceMount:!0,children:[(0,L.jsx)(SS,{asChild:!0,forceMount:!0,children:(0,L.jsx)(z.div,{className:`fixed inset-0 z-50 bg-scrim backdrop-blur-sm`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16,ease:`easeOut`}})}),(0,L.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-50 grid place-items-center p-4`,children:(0,L.jsx)(ES,{asChild:!0,forceMount:!0,onCloseAutoFocus:s,onInteractOutside:e=>{i||e.preventDefault()},onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[data-nav], [data-autofocus], textarea`);t&&(e.preventDefault(),t.focus())},...r?{}:{"aria-describedby":void 0},children:(0,L.jsxs)(z.div,{className:q(`glass-pop pointer-events-auto flex max-h-[min(86svh,48rem)] w-full max-w-2xl flex-col overflow-hidden rounded-xl outline-none`,a),style:o,initial:{opacity:0,scale:l?1:.92,y:l?0:18},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:l?1:.96,y:l?0:8,transition:{duration:.12,ease:`easeIn`}},transition:{type:`spring`,stiffness:460,damping:32,mass:.9},children:[(0,L.jsx)(jS,{className:`sr-only`,children:n}),r?(0,L.jsx)(NS,{className:`sr-only`,children:r}):null,c]})})})]}):null})})}var JO=[],YO=0,XO=new Set;function ZO(){for(let e of[...XO])e()}function QO(e){return XO.add(e),()=>{XO.delete(e)}}function $O(){let e;for(let t of JO)(!e||t.priority>e.priority||t.priority===e.priority&&t.order<e.order)&&(e=t);return e?.id}var ek={question:30,confirm:20,help:10,sheet:5};function tk(e,t){let n=(0,m.useId)();(0,m.useEffect)(()=>{if(e)return JO=[...JO,{id:n,priority:t,order:++YO}],ZO(),()=>{JO=JO.filter(e=>e.id!==n),ZO()}},[e,t,n]);let r=(0,m.useSyncExternalStore)(QO,$O,()=>void 0);return e&&r===n}function nk(){return JO.length>0}function rk(){return(0,m.useSyncExternalStore)(QO,()=>JO.length>0,()=>!1)}var ik=[`lobby`,`tasks`,`plan`,`quickfix`,`issues`,`excalidraw`,`git`,`knowledge`,`metrics`],ak=`already answered in another window`,ok=`Attached files:`,sk=new Set(ik);function ck(e){let t=e.replace(/^#\/?/,``).split(`/`).filter(Boolean),n=t[0];if(!n||n===`lobby`)return{kind:`tab`,tab:`lobby`,rest:t.slice(1)};if(n===`settings`)return{kind:`settings`};if(n===`sessions`)return{kind:`sessions`,...t[1]?{key:t[1]}:{}};if(sk.has(n))return{kind:`tab`,tab:n,rest:t.slice(1)}}function lk(e,...t){return`#/${e}${t.filter(Boolean).map(e=>`/${encodeURIComponent(e)}`).join(``)}`}function uk(e){window.location.hash!==e&&(window.location.hash=e)}function dk(){let[e,t]=(0,m.useState)(()=>ck(window.location.hash)??{kind:`tab`,tab:`lobby`,rest:[]});return(0,m.useEffect)(()=>{let e=()=>{let e=ck(window.location.hash);e?t(e):(window.history.replaceState(null,``,`#/lobby`),t({kind:`tab`,tab:`lobby`,rest:[]}))};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function fk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty`,className:q(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 p-6 text-center text-balance`,e),...t})}function pk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty-header`,className:q(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var mk=Yg(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground [&_svg:not([class*='size-'])]:size-5`}},defaultVariants:{variant:`default`}});function hk({className:e,variant:t=`default`,...n}){return(0,L.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:q(mk({variant:t,className:e})),...n})}function gk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty-title`,className:q(`text-sm font-medium tracking-tight`,e),...t})}function _k({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`empty-description`,className:q(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function vk({className:e,...t}){return(0,L.jsx)(`span`,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:q(`inline-flex size-4 shrink-0 items-end justify-between text-primary`,e),...t,children:[0,1,2].map(e=>(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`block aspect-square h-[28%] shrink-0 rounded-full bg-current motion-safe:animate-[hop_0.9s_ease-in-out_infinite]`,style:{animationDelay:`${e*.14}s`}},e))})}var yk=Yg([`relative w-full text-sm border has-[>svg]:grid-cols-[calc(var(--spacing)*3)_1fr] grid-cols-[0_1fr] grid gap-y-0.5 items-center [&>svg:not([class*=size-])]:size-4`,`has-[>[data-slot=alert-title]+[data-slot=alert-description]]:[&_[data-slot=alert-action]]:sm:row-end-3`,`has-[>[data-slot=alert-title]+[data-slot=alert-description]]:items-start`,`has-[>[data-slot=alert-title]+[data-slot=alert-description]]:[&_svg]:translate-y-0.5`,`rounded-lg`,`px-3`,`py-2.5`,`has-[>svg]:gap-x-2.5`],{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`border-destructive/30 bg-destructive/4 [&>svg]:text-destructive`,info:`border-info/30 bg-info/4 [&>svg]:text-info`,success:`border-success/30 bg-success/4 [&>svg]:text-success`,warning:`border-warning/30 bg-warning/4 [&>svg]:text-warning`,invert:`border-invert bg-invert text-invert-foreground [&_[data-slot=alert-description]]:text-invert-foreground/70`}},defaultVariants:{variant:`default`}});function bk({className:e,variant:t,...n}){return(0,L.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:q(yk({variant:t}),e),...n})}function xk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-description`,className:q(`text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed`,e),...t})}function Sk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-action`,className:q(`flex gap-1.5 max-sm:col-start-2 max-sm:mt-2 max-sm:justify-start sm:col-start-3 sm:row-start-1 sm:justify-end sm:self-center`,e),...t})}function Ck({label:e=`Connecting…`}){return(0,L.jsxs)(`div`,{className:`flex min-h-48 flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(vk,{}),(0,L.jsx)(`span`,{children:e})]})}function wk({message:e,onRetry:t}){return(0,L.jsxs)(fk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(pk,{children:[(0,L.jsxs)(gk,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Eg,{className:`size-4 text-destructive`,"aria-hidden":`true`}),`Could not load this view`]}),(0,L.jsx)(_k,{children:e??`The request failed. Try again.`})]}),t?(0,L.jsxs)(J,{variant:`outline`,onClick:t,children:[(0,L.jsx)(Qh,{"aria-hidden":`true`}),`Try again`]}):null]})}function Tk({onRetry:e}){return(0,L.jsxs)(bk,{variant:`destructive`,role:`status`,className:`mx-3 mb-1 w-auto max-sm:mx-2`,children:[(0,L.jsx)(Rg,{className:`size-4`,"aria-hidden":`true`}),(0,L.jsx)(xk,{children:`Lost pi — reconnecting every 2 s. Your planning session and tasks carry on when it is back.`}),e?(0,L.jsx)(Sk,{children:(0,L.jsx)(J,{variant:`link`,className:`h-8 px-1 text-destructive`,onClick:e,children:`Retry now`})}):null]})}function Ek(){let[e,t]=(0,m.useReducer)(e=>e+1,0);return(0,m.useEffect)(()=>me.subscribe(t),[]),e}function Dk(){return Ek(),me.status()}function Ok(e){return Ek(),me.get(e)}function kk(e){let t=(0,m.useCallback)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},[e]),n=(0,m.useCallback)(()=>window.matchMedia(e).matches,[e]);return(0,m.useSyncExternalStore)(t,n)}function Ak(e,t,n,r=!0){Ek();let[i,a]=(0,m.useState)({loading:!0,at:0}),[o,s]=(0,m.useState)(0),c=[me.status().connection,...n.map(e=>me.get(e).version)].join(`,`),l=JSON.stringify(t);(0,m.useEffect)(()=>{if(!r)return;let t=!0,n=performance.now();return a(e=>({...e,loading:!0})),De(e,JSON.parse(l)).then(e=>t&&a({data:e,loading:!1,at:n}),e=>t&&a(t=>({...t,error:e instanceof Error?e.message:String(e),loading:!1}))),()=>{t=!1}},[e,l,c,o,r]);let u=(0,m.useCallback)(()=>s(e=>e+1),[]);return{data:i.data,error:i.error,loading:i.loading,requestedAt:i.at,reload:u}}function jk({delayDuration:e=400,...t}){return(0,L.jsx)(jO,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Mk({...e}){return(0,L.jsx)(MO,{"data-slot":`tooltip`,...e})}function Nk({...e}){return(0,L.jsx)(NO,{"data-slot":`tooltip-trigger`,...e})}function Pk({className:e,sideOffset:t=6,children:n,...r}){return(0,L.jsx)(PO,{children:(0,L.jsxs)(FO,{"data-slot":`tooltip-content`,sideOffset:t,className:q(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-2.5 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,L.jsx)(IO,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function Fk(e){return[...e.querySelectorAll(`[data-nav]`)].filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`)}function Ik(e,t,n){let r=Fk(e);if(r.length===0)return!1;let i=t?r.findIndex(e=>e===t||e.contains(t)):-1,a=r[n===`first`?0:n===`last`?r.length-1:Math.max(0,Math.min(r.length-1,(i<0?n>0?-1:r.length:i)+n))];return!a||a===t?!1:(a.focus({preventScroll:!1}),!0)}function Lk(e){return e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&![`checkbox`,`radio`,`button`].includes(e.type)||e instanceof HTMLElement&&e.isContentEditable}function Rk(e,t=!0){return e===`ArrowDown`||t&&e===`j`?1:e===`ArrowUp`||t&&e===`k`?-1:0}function zk(e,t=!0){return e===`ArrowRight`||t&&e===`l`?1:e===`ArrowLeft`||t&&e===`h`?-1:0}var Bk=`button:not([disabled]), a[href], [role='button']:not([aria-disabled='true'])`;function Vk(e){return[...e.querySelectorAll(Bk)].filter(e=>e.offsetParent!==null)}function Hk(e,t,n){let r=Vk(e);if(r.length===0)return;let i=t?r.findIndex(e=>e===t||e.contains(t)):-1;r[n===`first`?0:n===`last`?r.length-1:Math.max(0,Math.min(r.length-1,(i<0?n>0?-1:r.length:i)+n))]?.focus()}function Uk(e,t=document.querySelector(`[data-pane='list']`)){if(!t)return;let n=[...t.querySelectorAll(`button[data-row]`)].filter(e=>e.offsetParent!==null),r=n.findIndex(e=>e.getAttribute(`aria-current`)===`true`),i=Math.max(0,Math.min(n.length-1,r<0?e>0?0:n.length-1:r+e));n[i]?.click(),n[i]?.focus({preventScroll:!0}),n[i]?.scrollIntoView({block:`nearest`})}function Wk(e){return e.querySelector(`[aria-current='true']`)??Vk(e)[0]}function Gk(){let e=document.getElementById(`main`);if(!e)return!1;let t=e.querySelector(`[data-pane='list']`);return((t?Wk(t):void 0)??Vk(e)[0]??e).focus(),!0}function Kk(){let e=document.querySelector(`[role='tab'][aria-selected='true']`);if(e)return e.focus({preventScroll:!0}),!0;let t=document.getElementById(`main`);return t?.focus({preventScroll:!0}),!!t}var qk={active:!1},Jk=new Set([`g`,`j`,`k`,`h`,`l`,`d`,`p`,`/`,`?`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]);function Yk(e){if(!e)return!1;let t=e.toLowerCase();return t===`delete`||/^[a-z]$/.test(t)&&!Jk.has(t)}function Xk(e,t){return t.toLowerCase()===`delete`?e.key===`Delete`||e.key===`Backspace`:e.key.toLowerCase()===t.toLowerCase()}function Zk(){return nk()||!!document.querySelector(`[role='dialog'], [role='alertdialog'], [role='menu'], [role='listbox']`)}function Qk(e,t,{enabled:n=!0,inDialog:r=!1}={}){let i=(0,m.useRef)(t);i.current=t,(0,m.useEffect)(()=>{if(!n||!e)return;let t=t=>{t.defaultPrevented||t.isComposing||t.repeat||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||Xk(t,e)&&(Lk(t.target)||(r||!Zk())&&(t.preventDefault(),i.current()))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n,r])}var $k={neutral:`text-foreground`,primary:``,danger:`text-destructive hover:text-destructive`};function Y({label:e,icon:t,tone:n=`neutral`,shortcut:r,href:i,pressed:a,text:o,iconOnly:s,className:c,disabled:l,...u}){let d=(0,m.useRef)(null),f=Yk(r);Qk(f?r:void 0,()=>d.current?.click(),{enabled:f&&!l});let p=(0,L.jsx)(t,{"aria-hidden":`true`}),h=n===`primary`&&!s,g=s?n===`primary`?`default`:`ghost`:`outline`,_=q(!s&&`px-2.5`,h&&`obsidian-discover-button`,$k[n],c),v=s?`icon`:`default`,y=s?p:h?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`obsidian-discover-button__fill`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`obsidian-discover-button__icon`,children:p}),(0,L.jsxs)(`span`,{className:`obsidian-discover-button__text`,children:[o??e,r?(0,L.jsx)(GO,{chord:r,className:`kbd-hint ml-1`}):null]})]}):(0,L.jsxs)(L.Fragment,{children:[p,(0,L.jsx)(`span`,{children:o??e}),r?(0,L.jsx)(GO,{chord:r,className:`kbd-hint ml-1`}):null]}),b=i?(0,L.jsx)(J,{asChild:!0,ref:d,variant:g,size:v,"data-tone":n,className:_,children:(0,L.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer noopener`,"aria-label":e,"aria-keyshortcuts":f?r:void 0,children:y})}):(0,L.jsx)(J,{ref:d,type:`button`,variant:g,size:v,"data-tone":n,"aria-label":e,"aria-pressed":a,"aria-keyshortcuts":f?r:void 0,disabled:l,className:_,...u,children:y});return s?(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:b}),(0,L.jsxs)(Pk,{children:[e,(0,L.jsx)(GO,{chord:r??(i?`Enter`:`Enter / Space`)})]})]}):b}function eA({children:e,className:t}){function n(e){let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;if(!t)return;let n=[...e.currentTarget.querySelectorAll(`button:not([disabled]), a[href]`)],r=n.indexOf(e.target);r<0||(e.preventDefault(),e.stopPropagation(),n[Math.max(0,Math.min(n.length-1,r+t))]?.focus())}return(0,L.jsx)(`div`,{role:`toolbar`,"aria-label":`Actions`,onKeyDown:n,className:q(`sticky -top-5 z-10 -mx-5 -mt-5 flex min-h-12 flex-wrap items-center gap-1 border-b border-border bg-card/90 px-4 py-2 backdrop-blur-sm [&>[data-tone=danger]:not(:first-child)]:ml-auto`,t),children:e})}function tA({...e}){return(0,L.jsx)(mS,{"data-slot":`sheet`,...e})}function nA({...e}){return(0,L.jsx)(FS,{"data-slot":`sheet-close`,...e})}function rA({...e}){return(0,L.jsx)(bS,{"data-slot":`sheet-portal`,...e})}function iA({className:e,...t}){return(0,L.jsx)(SS,{"data-slot":`sheet-overlay`,className:q(`fixed inset-0 z-50 bg-scrim backdrop-blur-sm duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function aA({className:e,children:t,side:n=`right`,showCloseButton:r=!0,forceMount:i,hidden:a,...o}){return(0,L.jsxs)(rA,{forceMount:i,children:[a?null:(0,L.jsx)(iA,{}),(0,L.jsxs)(ES,{forceMount:i,hidden:a,"data-slot":`sheet-content`,"data-side":n,className:q(`glass-pop fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm transition duration-200 ease-in-out data-[side=right]:rounded-l-xl data-[side=left]:rounded-r-xl data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...o,children:[t,r&&(0,L.jsx)(FS,{"data-slot":`sheet-close`,asChild:!0,children:(0,L.jsxs)(J,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,L.jsx)(Hg,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function oA({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sheet-header`,className:q(`flex flex-col gap-0.5 p-4`,e),...t})}function sA({className:e,...t}){return(0,L.jsx)(jS,{"data-slot":`sheet-title`,className:q(`text-base font-medium text-foreground`,e),...t})}function cA({className:e,...t}){return(0,L.jsx)(NS,{"data-slot":`sheet-description`,className:q(`text-sm text-muted-foreground`,e),...t})}function lA(){return kk(`(min-width: 1024px)`)}function uA({className:e,...t}){return(0,L.jsx)(`section`,{className:q(`min-h-0 min-w-0`,e),...t})}function dA({open:e,onClose:t,describe:n,children:r}){let i=tk(e,ek.sheet),a=(0,m.useRef)(!1);return i&&(a.current=!0),e||(a.current=!1),(0,L.jsx)(tA,{open:e&&i,onOpenChange:e=>!e&&t(),children:(0,L.jsxs)(aA,{forceMount:e&&a.current?!0:void 0,hidden:!i,showCloseButton:!1,className:q(`gap-0 data-[side=right]:w-[92%] data-[side=right]:sm:max-w-3xl`,!i&&`!hidden`),children:[(0,L.jsxs)(oA,{className:`flex-row items-center justify-between border-b px-4 py-2`,children:[(0,L.jsx)(sA,{className:`text-sm`,children:`Detail`}),(0,L.jsx)(cA,{className:`sr-only`,children:n}),(0,L.jsx)(nA,{asChild:!0,children:(0,L.jsxs)(J,{variant:`ghost`,size:`sm`,"aria-label":`Close detail`,title:`Close · Esc`,className:`gap-2`,children:[(0,L.jsx)(Hg,{"aria-hidden":`true`}),`Close`,(0,L.jsx)(GO,{chord:`Esc`,className:`kbd-hint`})]})})]}),(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:r})]})})}function fA({list:e,detail:t,open:n,detailClassName:r}){let i=n&&t!==null;return(0,L.jsxs)(`div`,{className:q(`grid min-h-0 flex-1`,i?`grid-rows-[minmax(0,1fr)_minmax(0,2fr)]`:`grid-rows-1`),children:[(0,L.jsx)(uA,{"data-pane":`list`,className:q(`overflow-y-auto`,i?`border-b border-border`:`pb-dock`),children:e}),i?(0,L.jsx)(uA,{"data-pane":`detail`,"aria-label":`Detail`,tabIndex:0,className:q(`overflow-y-auto px-5 pt-5 pb-dock`,r),children:t}):null]})}function pA({wide:e,list:t,detail:n,open:r,onClose:i,hint:a,describe:o,inlineDetail:s,detailClassName:c}){let l=(0,m.useRef)(null),u=(0,m.useRef)(null);function d(t){let n=l.current;if(!n||t.defaultPrevented||t.nativeEvent.isComposing||nk()||t.altKey||t.ctrlKey||t.metaKey||Lk(t.target)||t.target instanceof HTMLInputElement)return;let r=Rk(t.key,!1);r?(t.preventDefault(),Hk(n,t.target,r)):t.key===`Home`||t.key===`End`?(t.preventDefault(),Hk(n,t.target,t.key===`Home`?`first`:`last`)):e&&zk(t.key)===1&&u.current&&(t.preventDefault(),u.current.focus())}function f(e){e.defaultPrevented||e.nativeEvent.isComposing||nk()||e.altKey||e.ctrlKey||e.metaKey||Lk(e.target)||zk(e.key)===-1&&l.current&&(e.preventDefault(),Wk(l.current)?.focus())}return!e&&s?(0,L.jsx)(fA,{list:t,detail:n,open:r,detailClassName:c}):e?(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[clamp(17rem,28%,23rem)_minmax(0,1fr)]`,children:[(0,L.jsx)(uA,{"data-pane":`list`,ref:l,onKeyDown:d,className:`overflow-y-auto border-r border-border pb-dock`,children:t}),(0,L.jsx)(uA,{"data-pane":`detail`,ref:u,tabIndex:0,"aria-label":`Detail`,onKeyDown:f,className:q(`overflow-y-auto px-5 pt-5 pb-dock outline-none focus-visible:bg-muted/30`,c),children:n??(0,L.jsx)(`div`,{className:`grid h-full min-h-48 place-items-center`,children:(0,L.jsxs)(`div`,{className:`flex max-w-xs flex-col items-center gap-3 text-center`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,L.jsx)(Oh,{className:`size-5`})}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a}),(0,L.jsxs)(`p`,{className:`kbd-hint flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(GO,{chord:`ArrowUp`}),(0,L.jsx)(GO,{chord:`ArrowDown`}),`move`]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(GO,{chord:`ArrowRight`}),`open`]})]})]})})})]}):(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto pb-dock`,children:[(0,L.jsx)(uA,{"data-pane":`list`,ref:l,onKeyDown:d,children:t}),(0,L.jsx)(dA,{open:r&&n!==null,onClose:i,describe:o,children:n})]})}function mA({title:e,count:t,children:n}){return(0,L.jsxs)(`div`,{className:`sticky top-0 z-10 flex min-h-12 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-card/90 px-4 py-2 backdrop-blur-sm`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:e}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`min-w-2 flex-1`}),t?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t}):null,n?(0,L.jsx)(`div`,{className:`flex items-center gap-1.5`,children:n}):null]})}function hA(){return(0,L.jsx)(`div`,{className:`flex flex-col gap-1.5 p-3`,role:`status`,"aria-label":`Loading`,children:[0,1,2,3].map(e=>(0,L.jsx)(`div`,{className:`h-11 rounded-lg bg-muted motion-safe:animate-pulse`},e))})}function gA({className:e,...t}){return(0,L.jsx)(`textarea`,{"data-slot":`textarea`,className:q(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-background px-3.5 py-2.5 text-base transition-[border-color,box-shadow] duration-150 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:disabled:bg-input/80`,e),...t})}function _A(e){return e<10?`0${e}`:String(e)}function vA(e){if(!Number.isFinite(e))return`0`;let t=new Date(e);return`${_A(t.getHours())}:${_A(t.getMinutes())}`}function yA(e){if(!Number.isFinite(e)||e<0)return`0s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${_A(n%60)}m`}function bA(e){if(!Number.isFinite(e)||e<5e3)return`now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h`:`${Math.floor(r/24)}d`}function xA(e){let t=bA(e);return t===`now`?`just now`:`${t} ago`}function SA({...e}){return(0,L.jsx)($S,{"data-slot":`alert-dialog`,...e})}function CA({...e}){return(0,L.jsx)(eC,{"data-slot":`alert-dialog-portal`,...e})}function wA({className:e,...t}){return(0,L.jsx)(tC,{"data-slot":`alert-dialog-overlay`,className:q(`fixed inset-0 z-50 bg-scrim backdrop-blur-sm duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function TA({className:e,...t}){return(0,L.jsxs)(CA,{children:[(0,L.jsx)(wA,{}),(0,L.jsx)(nC,{"data-slot":`alert-dialog-content`,className:q(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 glass-pop rounded-xl p-5 text-sm duration-150 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})]})}function EA({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:q(`flex flex-col gap-1.5`,e),...t})}function DA({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function OA({className:e,...t}){return(0,L.jsx)(aC,{"data-slot":`alert-dialog-title`,className:q(`text-base font-medium text-foreground`,e),...t})}function kA({className:e,...t}){return(0,L.jsx)(oC,{"data-slot":`alert-dialog-description`,className:q(`text-sm text-muted-foreground`,e),...t})}function AA({className:e,variant:t=`default`,...n}){return(0,L.jsx)(J,{variant:t,size:`sm`,className:q(`h-7 gap-1 px-2.5`,e),asChild:!0,children:(0,L.jsx)(rC,{"data-slot":`alert-dialog-action`,...n})})}function jA({className:e,...t}){return(0,L.jsx)(J,{variant:`outline`,size:`sm`,className:q(`h-7 gap-1 px-2.5`,e),asChild:!0,children:(0,L.jsx)(iC,{"data-slot":`alert-dialog-cancel`,...t})})}function MA({label:e,text:t,shortcut:n,title:r,description:i,confirmLabel:a,onConfirm:o,icon:s,disabled:c,variant:l=`outline`,iconOnly:u,compact:d}){let[f,p]=(0,m.useState)(!1),h=tk(f,ek.confirm),g=l===`destructive`;return Qk(`y`,()=>{p(!1),o()},{enabled:f&&h,inDialog:!0}),(0,L.jsxs)(SA,{open:f&&h,onOpenChange:p,children:[(0,L.jsx)(Y,{label:e,icon:s,tone:g?`danger`:`neutral`,disabled:c,shortcut:n,iconOnly:u,...d?{"data-compact":!0,className:`size-8`}:{},...t?{text:t}:{},onClick:()=>p(!0)}),(0,L.jsxs)(TA,{children:[(0,L.jsxs)(EA,{children:[(0,L.jsx)(OA,{children:r}),(0,L.jsx)(kA,{children:i})]}),(0,L.jsxs)(DA,{children:[(0,L.jsxs)(jA,{children:[`Keep it`,(0,L.jsx)(GO,{chord:`Esc`,className:`kbd-hint ml-1`})]}),(0,L.jsxs)(AA,{variant:g?`destructive`:`default`,onClick:o,children:[a,(0,L.jsx)(GO,{chord:`Y`,className:`kbd-hint ml-1`})]})]})]})]})}function NA(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var PA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,IA={};function LA(e,t){return((t||IA).jsx?FA:PA).test(e)}var RA=/[ \t\n\f\r]/g;function zA(e){return typeof e==`object`?e.type===`text`&&BA(e.value):BA(e)}function BA(e){return e.replace(RA,``)===``}var VA=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};VA.prototype.normal={},VA.prototype.property={},VA.prototype.space=void 0;function HA(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new VA(n,r,t)}function UA(e){return e.toLowerCase()}var WA=class{constructor(e,t){this.attribute=t,this.property=e}};WA.prototype.attribute=``,WA.prototype.booleanish=!1,WA.prototype.boolean=!1,WA.prototype.commaOrSpaceSeparated=!1,WA.prototype.commaSeparated=!1,WA.prototype.defined=!1,WA.prototype.mustUseProperty=!1,WA.prototype.number=!1,WA.prototype.overloadedBoolean=!1,WA.prototype.property=``,WA.prototype.spaceSeparated=!1,WA.prototype.space=void 0;var GA=s({boolean:()=>X,booleanish:()=>qA,commaOrSpaceSeparated:()=>ZA,commaSeparated:()=>XA,number:()=>Z,overloadedBoolean:()=>JA,spaceSeparated:()=>YA}),KA=0,X=QA(),qA=QA(),JA=QA(),Z=QA(),YA=QA(),XA=QA(),ZA=QA();function QA(){return 2**++KA}var $A=Object.keys(GA),ej=class extends WA{constructor(e,t,n,r){let i=-1;if(super(e,t),tj(this,`space`,r),typeof n==`number`)for(;++i<$A.length;){let e=$A[i];tj(this,$A[i],(n&GA[e])===GA[e])}}};ej.prototype.defined=!0;function tj(e,t,n){n&&(e[t]=n)}function nj(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ej(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[UA(r)]=r,n[UA(a.attribute)]=r}return new VA(t,n,e.space)}var rj=nj({properties:{ariaActiveDescendant:null,ariaAtomic:qA,ariaAutoComplete:null,ariaBusy:qA,ariaChecked:qA,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:YA,ariaCurrent:null,ariaDescribedBy:YA,ariaDetails:null,ariaDisabled:qA,ariaDropEffect:YA,ariaErrorMessage:null,ariaExpanded:qA,ariaFlowTo:YA,ariaGrabbed:qA,ariaHasPopup:null,ariaHidden:qA,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:YA,ariaLevel:Z,ariaLive:null,ariaModal:qA,ariaMultiLine:qA,ariaMultiSelectable:qA,ariaOrientation:null,ariaOwns:YA,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:qA,ariaReadOnly:qA,ariaRelevant:null,ariaRequired:qA,ariaRoleDescription:YA,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:qA,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ij(e,t){return t in e?e[t]:t}function aj(e,t){return ij(e,t.toLowerCase())}var oj=nj({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:XA,acceptCharset:YA,accessKey:YA,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alpha:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:YA,autoFocus:X,autoPlay:X,blocking:YA,capture:null,charSet:null,checked:X,cite:null,className:YA,closedBy:null,colorSpace:null,cols:Z,colSpan:Z,command:null,commandFor:null,content:null,contentEditable:qA,controls:X,controlsList:YA,coords:Z|XA,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:JA,draggable:qA,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:YA,height:Z,hidden:JA,high:Z,href:null,hrefLang:null,htmlFor:YA,httpEquiv:YA,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:YA,itemRef:YA,itemScope:X,itemType:YA,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,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:X,optimum:Z,pattern:null,ping:YA,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:YA,required:X,reversed:X,rows:Z,rowSpan:Z,sandbox:YA,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootCustomElementRegistry:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shadowRootSerializable:X,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:qA,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:qA,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:YA,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:qA,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:X,disablePictureInPicture:X,disableRemotePlayback:X,exportParts:XA,part:YA,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:aj}),sj=nj({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:ZA,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:YA,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:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,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:XA,g2:XA,glyphName:XA,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:ZA,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,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:Z,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:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:YA,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ZA,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ZA,rev:ZA,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ZA,requiredFeatures:ZA,requiredFonts:ZA,requiredFormats:ZA,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:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:ZA,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ZA,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ZA,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ij}),cj=nj({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()}}),lj=nj({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:aj}),uj=nj({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),dj={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`},fj=/[A-Z]/g,pj=/-[a-z]/g,mj=/^data[-\w.:]+$/i;function hj(e,t){let n=UA(t),r=t,i=WA;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&mj.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(pj,_j);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!pj.test(e)){let n=e.replace(fj,gj);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ej}return new i(r,t)}function gj(e){return`-`+e.toLowerCase()}function _j(e){return e.charAt(1).toUpperCase()}var vj=HA([rj,oj,cj,lj,uj],`html`),yj=HA([rj,sj,cj,lj,uj],`svg`);function bj(e){return e.join(` `).trim()}var xj=o(((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;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
59
+ `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Sj=o((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(xj());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}})),Cj=o((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))}})),wj=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Sj()),r=Cj();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})),Tj=Dj(`end`),Ej=Dj(`start`);function Dj(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 Oj(e){let t=Ej(e),n=Tj(e);if(t&&n)return{start:t,end:n}}function kj(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?jj(e.position):`start`in e||`end`in e?jj(e):`line`in e||`column`in e?Aj(e):``}function Aj(e){return Mj(e&&e.line)+`:`+Mj(e&&e.column)}function jj(e){return Aj(e&&e.start)+`-`+Aj(e&&e.end)}function Mj(e){return e&&typeof e==`number`?e:1}var Nj=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=kj(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}};Nj.prototype.file=``,Nj.prototype.name=``,Nj.prototype.reason=``,Nj.prototype.message=``,Nj.prototype.stack=``,Nj.prototype.column=void 0,Nj.prototype.line=void 0,Nj.prototype.ancestors=void 0,Nj.prototype.cause=void 0,Nj.prototype.fatal=void 0,Nj.prototype.place=void 0,Nj.prototype.ruleId=void 0,Nj.prototype.source=void 0;var Pj=l(wj(),1),Fj={}.hasOwnProperty,Ij=new Map,Lj=/[A-Z]/g,Rj=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),zj=new Set([`td`,`th`]),Bj=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Vj(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=Qj(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=Zj(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`?yj:vj,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Hj(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Hj(e,t,n){if(t.type===`element`)return Uj(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Wj(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Kj(e,t,n);if(t.type===`mdxjsEsm`)return Gj(e,t);if(t.type===`root`)return qj(e,t,n);if(t.type===`text`)return Jj(e,t)}function Uj(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=yj,e.schema=i),e.ancestors.push(t);let a=iM(e,t.tagName,!1),o=$j(e,t),s=tM(e,t);return Rj.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!zA(e)})),Yj(e,o,a,t),Xj(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Wj(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)}aM(e,t.position)}function Gj(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);aM(e,t.position)}function Kj(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=yj,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:iM(e,t.name,!0),o=eM(e,t),s=tM(e,t);return Yj(e,o,a,t),Xj(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function qj(e,t,n){let r={};return Xj(r,tM(e,t)),e.create(t,e.Fragment,r,n)}function Jj(e,t){return t.value}function Yj(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Xj(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Zj(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 Qj(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ej(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 $j(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Fj.call(t.properties,i)){let a=nM(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&zj.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 eM(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 aM(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 aM(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function tM(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ij;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=Hj(e,a,o);s!==void 0&&n.push(s)}return n}function nM(e,t,n){let r=hj(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?NA(n):bj(n)),r.property===`style`){let t=typeof n==`object`?n:rM(e,String(n));return e.stylePropertyNameCase===`css`&&(t=oM(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?dj[r.property]||r.property:r.attribute,n]}}function rM(e,t){try{return(0,Pj.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Nj("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=Bj+`#cannot-parse-style-attribute`,r}}function iM(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=LA(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=LA(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Fj.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);aM(e)}function aM(e,t){let n=new Nj("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=Bj+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function oM(e){let t={},n;for(n in e)Fj.call(e,n)&&(t[sM(n)]=e[n]);return t}function sM(e){let t=e.replace(Lj,cM);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function cM(e){return`-`+e.toLowerCase()}var lM={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`]},uM={};function dM(e,t){let n=t||uM;return fM(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function fM(e,t,n){if(mM(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 pM(e.children,t,n)}return Array.isArray(e)?pM(e,t,n):``}function pM(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=fM(e[i],t,n);return r.join(``)}function mM(e){return!!(e&&typeof e==`object`)}var hM=document.createElement(`i`);function gM(e){let t=`&`+e+`;`;hM.innerHTML=t;let n=hM.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function _M(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 vM(e,t){return e.length>0?(_M(e,e.length,0,t),e):t}var yM={}.hasOwnProperty;function bM(e){let t={},n=-1;for(;++n<e.length;)xM(t,e[n]);return t}function xM(e,t){let n;for(n in t){let r=(yM.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){yM.call(r,a)||(r[a]=[]);let e=i[a];SM(r[a],Array.isArray(e)?e:e?[e]:[])}}}function SM(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);_M(e,0,0,r)}function CM(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 wM(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var TM=FM(/[A-Za-z]/),EM=FM(/[\dA-Za-z]/),DM=FM(/[#-'*+\--9=?A-Z^-~]/);function OM(e){return e!==null&&(e<32||e===127)}var kM=FM(/\d/),AM=FM(/[\dA-Fa-f]/),jM=FM(/[!-/:-@[-`{-~]/);function Q(e){return e!==null&&e<-2}function MM(e){return e!==null&&(e<0||e===32)}function $(e){return e===-2||e===-1||e===32}var NM=FM(/\p{P}|\p{S}/u),PM=FM(/\s/);function FM(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function IM(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&EM(e.charCodeAt(n+1))&&EM(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 LM(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $(r)?(e.enter(n),s(r)):t(r)}function s(r){return $(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function RM(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&$(t)?(e.enter(r),c(t)):l(t)}function c(t){return $(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var zM={tokenize:BM};function BM(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`),LM(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 Q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var VM=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){HM(this,e,t,n,!1)}addBefore(e,t,n){HM(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function HM(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var UM={tokenize:GM},WM={tokenize:KM};function GM(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++;let c=new VM;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),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(WM,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(WM,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 Q(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++;let l=new VM;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}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 KM(e,t,n){return LM(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function qM(e){if(e===null||MM(e)||PM(e))return 1;if(NM(e))return 2}function JM(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 YM={name:`attention`,resolveAll:XM,tokenize:ZM};function XM(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};QM(o,-a),QM(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=vM(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=vM(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=vM(r,JM(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=vM(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=vM(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),_M(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function ZM(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=qM(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=qM(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function QM(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var $M={name:`autolink`,tokenize:eN};function eN(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 TM(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||EM(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||EM(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||OM(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):DM(t)?(e.consume(t),l):n(t)}function u(e){return EM(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||EM(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var tN={partial:!0,tokenize:nN};function nN(e,t,n){return r;function r(t){return $(t)?LM(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Q(e)?t(e):n(e)}}var rN={continuation:{tokenize:aN},exit:oN,name:`blockQuote`,tokenize:iN};function iN(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 $(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function aN(e,t,n){let r=this;return i;function i(t){return $(t)?LM(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(rN,t,n)(r)}}function oN(e){e.exit(`blockQuote`)}var sN={name:`characterEscape`,tokenize:cN};function cN(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 jM(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var lN={name:`characterReference`,tokenize:uN};function uN(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=EM,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=AM,u):(e.enter(`characterReferenceValue`),a=7,o=kM,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===EM&&!gM(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 dN={partial:!0,tokenize:fN};function fN(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 pN={concrete:!0,name:`codeFenced`,tokenize:mN};function mN(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`),$(t)?LM(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(dN,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),LM(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Q(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&&$(t)?LM(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Q(t)?e.check(dN,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Q(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`),$(t)?LM(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`),$(t)?LM(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var hN={name:`codeIndented`,tokenize:_N},gN={partial:!0,tokenize:vN};function _N(e,t,n){return r;function r(t){return e.enter(`codeIndented`),RM(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):Q(t)?e.attempt(gN,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function vN(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Q(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):RM(e,t,a,`linePrefix`,4,4)(o)}function a(e){return Q(e)?i(e):n(e)}}var yN={name:`codeText`,previous:xN,resolve:bN,tokenize:SN};function bN(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 xN(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function SN(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)):Q(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||Q(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 CN=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&&wN(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),wN(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wN(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);wN(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wN(this.left,t.reverse())}}}};function wN(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 TN(e){let t={},n=-1,r,i,a,o,s,c,l,u=new CN(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,EN(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 _M(e,0,1/0,u.slice(0)),!l}function EN(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 DN={resolve:kN,tokenize:AN},ON={partial:!0,tokenize:jN};function kN(e){return TN(e),e}function AN(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):Q(t)?e.check(ON,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 jN(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),LM(e,a,`linePrefix`)}function a(i){if(i===null||Q(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 MN(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||OM(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||Q(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||MM(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||OM(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 NN(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):Q(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||Q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!$(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function PN(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):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),LM(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Q(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 FN(e,t){let n;return r;function r(i){return Q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$(i)?LM(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var IN={name:`definition`,tokenize:RN},LN={partial:!0,tokenize:zN};function RN(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return NN.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=wM(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 MM(t)?FN(e,l)(t):l(t)}function l(t){return MN(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(LN,d,d)(t)}function d(t){return $(t)?LM(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function zN(e,t,n){return r;function r(t){return MM(t)?FN(e,i)(t):n(t)}function i(t){return PN(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $(t)?LM(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Q(e)?t(e):n(e)}}var BN={name:`hardBreakEscape`,tokenize:VN};function VN(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var HN={name:`headingAtx`,resolve:UN,tokenize:WN};function UN(e,t){let n=e.length-2,r=3;if(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){let 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`};_M(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function WN(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||MM(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Q(n)?(e.exit(`atxHeading`),t(n)):$(n)?LM(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||MM(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var GN=`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(`.`),KN=[`pre`,`script`,`style`,`textarea`],qN={concrete:!0,name:`htmlFlow`,resolveTo:YN,tokenize:XN},JN={partial:!0,tokenize:ZN};function YN(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 XN(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:j):TM(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):TM(a)?(e.consume(a),i=4,r.interrupt?t:j):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:j):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 TM(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||MM(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&KN.includes(l)?(i=1,r.interrupt?t(s):O(s)):GN.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||EM(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 $(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||TM(t)?(e.consume(t),b):$(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||EM(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$(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):$(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Q(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||MM(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||$(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Q(t)?O(t):$(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),ae):t===63&&i===3?(e.consume(t),j):t===93&&i===5?(e.consume(t),ie):Q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(JN,oe,k)(t)):t===null||Q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(dN,ee,oe)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||Q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ne(t){return t===45?(e.consume(t),j):O(t)}function A(t){return t===47?(e.consume(t),o=``,re):O(t)}function re(t){if(t===62){let n=o.toLowerCase();return KN.includes(n)?(e.consume(t),ae):O(t)}return TM(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):O(t)}function ie(t){return t===93?(e.consume(t),j):O(t)}function j(t){return t===62?(e.consume(t),ae):t===45&&i===2?(e.consume(t),j):O(t)}function ae(t){return t===null||Q(t)?(e.exit(`htmlFlowData`),oe(t)):(e.consume(t),ae)}function oe(n){return e.exit(`htmlFlow`),t(n)}}function ZN(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(tN,t,n)}}var QN={name:`htmlText`,tokenize:$N};function $N(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):TM(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):TM(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):Q(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(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):Q(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):Q(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Q(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return TM(t)?(e.consume(t),S):n(t)}function S(t){return t===45||EM(t)?(e.consume(t),S):C(t)}function C(t){return Q(t)?(o=C,A(t)):$(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||EM(t)?(e.consume(t),w):t===47||t===62||MM(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||TM(t)?(e.consume(t),E):Q(t)?(o=T,A(t)):$(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||EM(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Q(t)?(o=D,A(t)):$(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):Q(t)?(o=O,A(t)):$(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):Q(t)?(o=k,A(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||MM(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||MM(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return $(t)?LM(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var eP={name:`labelEnd`,resolveAll:iP,resolveTo:aP,tokenize:oP},tP={tokenize:sP},nP={tokenize:cP},rP={tokenize:lP};function iP(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&&_M(e,0,e.length,n),e}function aP(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=vM(o,e.slice(i+1,i+r+3)),o=vM(o,[[`enter`,l,t]]),o=vM(o,JM(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=vM(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=vM(o,e.slice(a+1)),o=vM(o,[[`exit`,s,t]]),_M(e,i,e.length,o),e}function oP(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(wM(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(tP,u,o?u:d)(t):t===91?e.attempt(nP,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(rP,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function sP(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 MM(t)?FN(e,a)(t):a(t)}function a(t){return t===41?u(t):MN(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return MM(t)?FN(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?PN(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return MM(t)?FN(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 cP(e,t,n){let r=this;return i;function i(t){return NN.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(wM(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function lP(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 uP={name:`labelStartImage`,resolveAll:eP.resolveAll,tokenize:dP};function dP(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var fP={name:`labelStartLink`,resolveAll:eP.resolveAll,tokenize:pP};function pP(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var mP={name:`lineEnding`,tokenize:hP};function hP(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),LM(e,t,`linePrefix`)}}var gP={name:`thematicBreak`,tokenize:_P};function _P(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||Q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),$(t)?LM(e,s,`whitespace`)(t):s(t))}}var vP={continuation:{tokenize:SP},exit:wP,name:`list`,tokenize:xP},yP={partial:!0,tokenize:TP},bP={partial:!0,tokenize:CP};function xP(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:kM(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(gP,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 kM(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(tN,r.interrupt?n:u,e.attempt(yP,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $(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 SP(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(tN,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,LM(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$(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(bP,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,LM(e,e.attempt(vP,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function CP(e,t,n){let r=this;return LM(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 wP(e){e.exit(this.containerState.type)}function TP(e,t,n){let r=this;return LM(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!$(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var EP={name:`setextUnderline`,resolveTo:DP,tokenize:OP};function DP(e,t){let n=new VM,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function OP(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`),$(t)?LM(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var kP={tokenize:AP};function AP(e){let t=this,n=e.attempt(tN,r,e.attempt(this.parser.constructs.flowInitial,i,LM(e,e.attempt(this.parser.constructs.flow,i,e.attempt(DN,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 jP={resolveAll:FP()},MP=PP(`string`),NP=PP(`text`);function PP(e){return{resolveAll:FP(e===`text`?IP: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 FP(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 IP(e,t){let n=new VM,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var LP=s({attentionMarkers:()=>GP,contentInitial:()=>zP,disable:()=>KP,document:()=>RP,flow:()=>VP,flowInitial:()=>BP,insideSpan:()=>WP,string:()=>HP,text:()=>UP}),RP={42:vP,43:vP,45:vP,48:vP,49:vP,50:vP,51:vP,52:vP,53:vP,54:vP,55:vP,56:vP,57:vP,62:rN},zP={91:IN},BP={[-2]:hN,[-1]:hN,32:hN},VP={35:HN,42:gP,45:[EP,gP],60:qN,61:EP,95:gP,96:pN,126:pN},HP={38:lN,92:sN},UP={[-5]:mP,[-4]:mP,[-3]:mP,33:uP,38:lN,42:YM,60:[$M,QN],91:fP,92:[BN,sN],93:eP,95:YM,96:yN},WP={null:[YM,jP]},GP={null:[42,95]},KP={null:[]};function qP(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=vM(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=JM(a,l.events,l),l.events):[]}function f(e,t){return YP(p(e),t)}function p(e){return JP(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(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){Q(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&&_M(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 JP(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 YP(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=`
60
60
  `;break;case-3:o=`\r
61
- `;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 KP(e){let t={constructs:hM([NP,...(e||{}).extensions||[]]),content:n(FM),defined:[],document:n(zM),flow:n(TP),lazy:{},string:n(OP),text:n(kP)};return t;function n(e){return n;function n(n){return UP(t,e,n)}}}function qP(e){for(;!xN(e););return e}var JP=/[\0\t\n\r]/g;function YP(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){JP.lastIndex=c;let n=JP.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var XP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ZP(e){return e.replace(XP,QP)}function QP(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return vM(n.slice(t?2:1),t?16:10)}return dM(n)||e}var $P={}.hasOwnProperty;function eF(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),tF(n)(qP(KP(n).document().write(YP()(e,t,!0))))}function tF(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(xe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(_e),blockQuote:a(me),characterEscape:T,characterReference:T,codeFenced:a(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(he,o),codeText:a(ge,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(M),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(N),hardBreakEscape:a(ve),hardBreakTrailing:a(ve),htmlFlow:a(ye,o),htmlFlowData:T,htmlText:a(ye,o),htmlTextData:T,image:a(be),label:o,link:a(xe),listItem:a(Ce),listItemValue:f,listOrdered:a(Se,d),listUnordered:a(Se),paragraph:a(we),reference:se,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(_e),strong:a(Te),thematicBreak:a(De)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:pe,autolinkProtocol:fe,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:ue,characterReference:de,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),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(ee),htmlTextData:E,image:c(A),label:ie,labelText:re,lineEnding:D,link:c(ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ce,resourceDestinationString:j,resourceTitleString:ae,resource:oe,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};rF(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]];$P.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]||aF).call(a,void 0,e[0])}for(r.position={start:nF(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:nF(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:nF(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]||aF).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+wj({start:e.start,end:e.end})+`): it’s not open`);n.position.end=nF(e.end)}function u(){return oM(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=yM(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=Ee(),n.position={start:nF(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=nF(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=nF(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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){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 A(){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 re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ZP(t),n.identifier=yM(t).toLowerCase()}function ie(){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 j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ae(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function oe(){this.data.inReference=void 0}function se(){this.data.referenceType=`collapsed`}function ce(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=yM(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function le(e){this.data.characterReferenceType=e.type}function ue(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=vM(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=dM(t);let i=this.stack[this.stack.length-1];i.value+=r}function de(e){let t=this.stack.pop();t.position.end=nF(e.end)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function pe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function me(){return{type:`blockquote`,children:[]}}function he(){return{type:`code`,lang:null,meta:null,value:``}}function ge(){return{type:`inlineCode`,value:``}}function M(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function N(){return{type:`emphasis`,children:[]}}function _e(){return{type:`heading`,depth:0,children:[]}}function ve(){return{type:`break`}}function ye(){return{type:`html`,value:``}}function be(){return{type:`image`,title:null,url:``,alt:null}}function xe(){return{type:`link`,title:null,url:``,children:[]}}function Se(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ce(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function we(){return{type:`paragraph`,children:[]}}function Te(){return{type:`strong`,children:[]}}function Ee(){return{type:`text`,value:``}}function De(){return{type:`thematicBreak`}}}function nF(e){return{line:e.line,column:e.column,offset:e.offset}}function rF(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?rF(e,r):iF(e,r)}}function iF(e,t){let n;for(n in t)if($P.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 aF(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+wj({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wj({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+wj({start:t.start,end:t.end})+`) is still open`)}function oF(e){let t=this;t.parser=n;function n(n){return eF(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function sF(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 cF(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
62
- `}]}function lF(e,t){let n=t.value?t.value+`
63
- `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function uF(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dF(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fF(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=MM(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function pF(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mF(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function hF(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function gF(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hF(e,t);let i={src:MM(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function _F(e,t){let n={src:MM(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function vF(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function yF(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hF(e,t);let i={href:MM(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function bF(e,t){let n={href:MM(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function xF(e,t,n){let r=e.all(t),i=n?SF(n):CF(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
61
+ `;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 XP(e){let t={constructs:bM([LP,...(e||{}).extensions||[]]),content:n(zM),defined:[],document:n(UM),flow:n(kP),lazy:{},string:n(MP),text:n(NP)};return t;function n(e){return n;function n(n){return qP(t,e,n)}}}function ZP(e){for(;!TN(e););return e}var QP=/[\0\t\n\r]/g;function $P(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){QP.lastIndex=c;let n=QP.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var eF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tF(e){return e.replace(eF,nF)}function nF(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return CM(n.slice(t?2:1),t?16:10)}return gM(n)||e}var rF={}.hasOwnProperty;function iF(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),aF(n)(ZP(XP(n).document().write($P()(e,t,!0))))}function aF(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(xe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(_e),blockQuote:a(me),characterEscape:T,characterReference:T,codeFenced:a(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(he,o),codeText:a(ge,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(M),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(N),hardBreakEscape:a(ve),hardBreakTrailing:a(ve),htmlFlow:a(ye,o),htmlFlowData:T,htmlText:a(ye,o),htmlTextData:T,image:a(be),label:o,link:a(xe),listItem:a(Ce),listItemValue:f,listOrdered:a(Se,d),listUnordered:a(Se),paragraph:a(we),reference:se,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(_e),strong:a(Te),thematicBreak:a(De)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:pe,autolinkProtocol:fe,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:ue,characterReference:de,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),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(ee),htmlTextData:E,image:c(A),label:ie,labelText:re,lineEnding:D,link:c(ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ce,resourceDestinationString:j,resourceTitleString:ae,resource:oe,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};sF(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]];rF.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]||lF).call(a,void 0,e[0])}for(r.position={start:oF(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:oF(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:oF(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]||lF).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+kj({start:e.start,end:e.end})+`): it’s not open`);n.position.end=oF(e.end)}function u(){return dM(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=wM(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=Ee(),n.position={start:oF(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=oF(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=oF(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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){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 A(){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 re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=tF(t),n.identifier=wM(t).toLowerCase()}function ie(){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 j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ae(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function oe(){this.data.inReference=void 0}function se(){this.data.referenceType=`collapsed`}function ce(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=wM(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function le(e){this.data.characterReferenceType=e.type}function ue(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=CM(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=gM(t);let i=this.stack[this.stack.length-1];i.value+=r}function de(e){let t=this.stack.pop();t.position.end=oF(e.end)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function pe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function me(){return{type:`blockquote`,children:[]}}function he(){return{type:`code`,lang:null,meta:null,value:``}}function ge(){return{type:`inlineCode`,value:``}}function M(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function N(){return{type:`emphasis`,children:[]}}function _e(){return{type:`heading`,depth:0,children:[]}}function ve(){return{type:`break`}}function ye(){return{type:`html`,value:``}}function be(){return{type:`image`,title:null,url:``,alt:null}}function xe(){return{type:`link`,title:null,url:``,children:[]}}function Se(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ce(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function we(){return{type:`paragraph`,children:[]}}function Te(){return{type:`strong`,children:[]}}function Ee(){return{type:`text`,value:``}}function De(){return{type:`thematicBreak`}}}function oF(e){return{line:e.line,column:e.column,offset:e.offset}}function sF(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?sF(e,r):cF(e,r)}}function cF(e,t){let n;for(n in t)if(rF.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 lF(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+kj({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kj({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+kj({start:t.start,end:t.end})+`) is still open`)}function uF(e){let t=this;t.parser=n;function n(n){return iF(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function dF(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 fF(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
62
+ `}]}function pF(e,t){let n=t.value?t.value+`
63
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function mF(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hF(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gF(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=IM(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function _F(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vF(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yF(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function bF(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yF(e,t);let i={src:IM(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function xF(e,t){let n={src:IM(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function SF(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function CF(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yF(e,t);let i={href:IM(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function wF(e,t){let n={href:IM(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function TF(e,t,n){let r=e.all(t),i=n?EF(n):DF(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
64
64
  `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
65
- `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function SF(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=CF(n[r])}return t}function CF(e){return e.spread??e.children.length>1}function wF(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function TF(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EF(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function DF(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OF(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=xj(t.children[1]),o=bj(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function kF(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function AF(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var jF=9,MF=32;function NF(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(PF(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(PF(t.slice(i),i>0,!1)),a.join(``)}function PF(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===jF||t===MF;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===jF||t===MF;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function FF(e,t){let n={type:`text`,value:NF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function IF(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var LF={blockquote:sF,break:cF,code:lF,delete:uF,emphasis:dF,footnoteReference:fF,heading:pF,html:mF,imageReference:gF,image:_F,inlineCode:vF,linkReference:yF,link:bF,listItem:xF,list:wF,paragraph:TF,root:EF,strong:DF,table:OF,tableCell:AF,tableRow:kF,text:FF,thematicBreak:IF,toml:RF,yaml:RF,definition:RF,footnoteDefinition:RF};function RF(){}var{defineProperty:zF}=Object,BF=typeof self==`object`?self:globalThis,VF=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new BF[e](t)},HF=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?zF(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof BF[e]==`function`?VF(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(VF(a,o),i)};return r},UF=e=>HF(new Map,e)(0),WF=``,{toString:GF}={},{keys:KF,is:qF}=Object,JF=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=GF.call(e).slice(8,-1);switch(n){case`Array`:return[1,WF];case`Object`:return[2,WF];case`Date`:return[3,WF];case`RegExp`:return[4,WF];case`Map`:return[5,WF];case`Set`:return[6,WF];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},YF=([e,t])=>e===0&&(t===`function`||t===`symbol`),XF=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=JF(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&qF(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of KF(o))(e||!YF(JF(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?WF:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(YF(JF(n))||YF(JF(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!YF(JF(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},ZF=(e,{json:t,lossy:n}={})=>{let r=[];return XF(!(t||n),!!t,new Map,r)(e),r},QF=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?UF(ZF(e,t)):structuredClone(e):(e,t)=>UF(ZF(e,t));function $F(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function eI(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function tI(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||$F,r=e.options.footnoteBackLabel||eI,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=MM(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...QF(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
65
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function EF(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=DF(n[r])}return t}function DF(e){return e.spread??e.children.length>1}function OF(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function kF(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AF(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function jF(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MF(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Ej(t.children[1]),o=Tj(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function NF(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function PF(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var FF=9,IF=32;function LF(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(RF(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(RF(t.slice(i),i>0,!1)),a.join(``)}function RF(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===FF||t===IF;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===FF||t===IF;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function zF(e,t){let n={type:`text`,value:LF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function BF(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var VF={blockquote:dF,break:fF,code:pF,delete:mF,emphasis:hF,footnoteReference:gF,heading:_F,html:vF,imageReference:bF,image:xF,inlineCode:SF,linkReference:CF,link:wF,listItem:TF,list:OF,paragraph:kF,root:AF,strong:jF,table:MF,tableCell:PF,tableRow:NF,text:zF,thematicBreak:BF,toml:HF,yaml:HF,definition:HF,footnoteDefinition:HF};function HF(){}var{defineProperty:UF}=Object,WF=typeof self==`object`?self:globalThis,GF=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new WF[e](t)},KF=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?UF(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof WF[e]==`function`?GF(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(GF(a,o),i)};return r},qF=e=>KF(new Map,e)(0),JF=``,{toString:YF}={},{keys:XF,is:ZF}=Object,QF=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=YF.call(e).slice(8,-1);switch(n){case`Array`:return[1,JF];case`Object`:return[2,JF];case`Date`:return[3,JF];case`RegExp`:return[4,JF];case`Map`:return[5,JF];case`Set`:return[6,JF];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},$F=([e,t])=>e===0&&(t===`function`||t===`symbol`),eI=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=QF(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&ZF(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of XF(o))(e||!$F(QF(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?JF:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!($F(QF(n))||$F(QF(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!$F(QF(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},tI=(e,{json:t,lossy:n}={})=>{let r=[];return eI(!(t||n),!!t,new Map,r)(e),r},nI=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?qF(tI(e,t)):structuredClone(e):(e,t)=>qF(tI(e,t));function rI(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function iI(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function aI(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||rI,r=e.options.footnoteBackLabel||iI,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=IM(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...nI(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
66
66
  `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
67
- `}]}}var nI=(function(e){if(e==null)return sI;if(typeof e==`function`)return oI(e);if(typeof e==`object`)return Array.isArray(e)?rI(e):iI(e);if(typeof e==`string`)return aI(e);throw Error(`Expected function, string, or object as test`)});function rI(e){let t=[],n=-1;for(;++n<e.length;)t[n]=nI(e[n]);return oI(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function iI(e){let t=e;return oI(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function aI(e){return oI(t);function t(t){return t&&t.type===e}}function oI(e){return t;function t(t,n,r){return!!(cI(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function sI(){return!0}function cI(e){return typeof e==`object`&&!!e&&`type`in e}function lI(e){return e}var uI=[];function dI(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=nI(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+lI(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=uI,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=fI(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function fI(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?uI:[e]}function pI(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),dI(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var mI={}.hasOwnProperty,hI={};function gI(e,t){let n=t||hI,r=new Map,i=new Map,a={all:s,applyData:vI,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...LF,...n.handlers},one:o,options:n,patch:_I,wrap:bI};return pI(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(mI.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=QF(n);return r.children=a.all(e),r}return QF(e)}return(a.options.unknownHandler||yI)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=xI(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=xI(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function _I(e,t){e.position&&(t.position=Cj(e))}function vI(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,QF(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function yI(e,t){let n=t.data||{},r=`value`in t&&!(mI.call(n,`hProperties`)||mI.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function bI(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
67
+ `}]}}var oI=(function(e){if(e==null)return dI;if(typeof e==`function`)return uI(e);if(typeof e==`object`)return Array.isArray(e)?sI(e):cI(e);if(typeof e==`string`)return lI(e);throw Error(`Expected function, string, or object as test`)});function sI(e){let t=[],n=-1;for(;++n<e.length;)t[n]=oI(e[n]);return uI(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function cI(e){let t=e;return uI(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function lI(e){return uI(t);function t(t){return t&&t.type===e}}function uI(e){return t;function t(t,n,r){return!!(fI(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function dI(){return!0}function fI(e){return typeof e==`object`&&!!e&&`type`in e}function pI(e){return e}var mI=[];function hI(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=oI(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+pI(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=mI,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gI(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function gI(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?mI:[e]}function _I(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),hI(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var vI={}.hasOwnProperty,yI={};function bI(e,t){let n=t||yI,r=new Map,i=new Map,a={all:s,applyData:SI,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...VF,...n.handlers},one:o,options:n,patch:xI,wrap:wI};return _I(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(vI.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=nI(n);return r.children=a.all(e),r}return nI(e)}return(a.options.unknownHandler||CI)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=TI(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=TI(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function xI(e,t){e.position&&(t.position=Oj(e))}function SI(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,nI(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function CI(e,t){let n=t.data||{},r=`value`in t&&!(vI.call(n,`hProperties`)||vI.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wI(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
68
68
  `});++r<e.length;)r&&n.push({type:`text`,value:`
69
69
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
70
- `}),n}function xI(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function SI(e,t){let n=gI(e,t),r=n.one(e,void 0),i=tI(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
71
- `},i)),a}function CI(e,t){return e&&`run`in e?async function(n,r){let i=SI(n,{file:r,...t});await e.run(i,r)}:function(n,r){return SI(n,{file:r,...e||t})}}function wI(e){if(e)throw e}var TI=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function EI(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function DI(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?OI(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function OI(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var kI={basename:AI,dirname:jI,extname:MI,join:NI,sep:`/`};function AI(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);II(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jI(e){if(II(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function MI(e){II(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function NI(...e){let t=-1,n;for(;++t<e.length;)II(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:PI(n)}function PI(e){II(e);let t=e.codePointAt(0)===47,n=FI(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function FI(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function II(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var LI={cwd:RI};function RI(){return`/`}function zI(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function BI(e){if(typeof e==`string`)e=new URL(e);else if(!zI(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return VI(e)}function VI(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var HI=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],UI=class{constructor(e){let t;t=e?zI(e)?{path:e}:typeof e==`string`||qI(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:LI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<HI.length;){let e=HI[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)HI.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?kI.basename(this.path):void 0}set basename(e){GI(e,`basename`),WI(e,`basename`),this.path=kI.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?kI.dirname(this.path):void 0}set dirname(e){KI(this.basename,`dirname`),this.path=kI.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?kI.extname(this.path):void 0}set extname(e){if(WI(e,`extname`),KI(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=kI.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){zI(e)&&(e=BI(e)),GI(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?kI.basename(this.path,this.extname):void 0}set stem(e){GI(e,`stem`),WI(e,`stem`),this.path=kI.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Oj(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function WI(e,t){if(e&&e.includes(kI.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+kI.sep+"`")}function GI(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function KI(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function qI(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var JI=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),YI=l(TI(),1),XI={}.hasOwnProperty,ZI=new class e extends JI{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=DI()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,YI.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(eL(`data`,this.frozen),this.namespace[e]=t,this):XI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(eL(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=rL(e),n=this.parser||this.Parser;return QI(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),QI(`process`,this.parser||this.Parser),$I(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=rL(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);aL(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),QI(`processSync`,this.parser||this.Parser),$I(`processSync`,this.compiler||this.Compiler),this.process(e,r),nL(`processSync`,`process`,t),n;function r(e,r){t=!0,wI(e),n=r}}run(e,t,n){tL(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=rL(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),nL(`runSync`,`run`,n),r;function i(e,t){wI(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=rL(t),r=this.compiler||this.Compiler;return $I(`stringify`,r),tL(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(eL(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,YI.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];EI(o)&&EI(r)&&(r=(0,YI.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function QI(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function $I(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function eL(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function tL(e){if(!EI(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function nL(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function rL(e){return iL(e)?e:new UI(e)}function iL(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function aL(e){return typeof e==`string`||oL(e)}function oL(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var sL=[],cL={allowDangerousHtml:!0},lL=/^(https?|ircs?|mailto|xmpp)$/i,uL=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function dL(e){let t=fL(e),n=pL(e);return mL(t.runSync(t.parse(n),n),e)}function fL(e){let t=e.rehypePlugins||sL,n=e.remarkPlugins||sL,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cL}:cL;return ZI().use(oF).use(n).use(CI,r).use(t)}function pL(e){let t=e.children||``,n=new UI;return typeof t==`string`?n.value=t:``+t,n}function mL(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||hL;for(let e of uL)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return pI(e,l),Ij(e,{Fragment:L.Fragment,components:i,ignoreInvalidStyle:!0,jsx:L.jsx,jsxs:L.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in iM)if(Object.hasOwn(iM,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=iM[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function hL(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||lL.test(e.slice(0,t))?e:``}function gL(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function _L(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function vL(e,t,n){let r=nI((n||{}).ignore||[]),i=yL(t),a=-1;for(;++a<i.length;)dI(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function yL(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([bL(e[0]),xL(e[1])])}return t}function bL(e){return typeof e==`string`?new RegExp(_L(e),`g`):e}function xL(e){return typeof e==`function`?e:function(){return e}}var SL=`phrasing`,CL=[`autolink`,`link`,`image`,`label`];function wL(){return{transforms:[ML],enter:{literalAutolink:EL,literalAutolinkEmail:DL,literalAutolinkHttp:DL,literalAutolinkWww:DL},exit:{literalAutolink:jL,literalAutolinkEmail:AL,literalAutolinkHttp:OL,literalAutolinkWww:kL}}}function TL(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:SL,notInConstruct:CL},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:SL,notInConstruct:CL},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:SL,notInConstruct:CL}]}}function EL(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function DL(e){this.config.enter.autolinkProtocol.call(this,e)}function OL(e){this.config.exit.autolinkProtocol.call(this,e)}function kL(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function AL(e){this.config.exit.autolinkEmail.call(this,e)}function jL(e){this.exit(e)}function ML(e){vL(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,NL],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,PL]],{ignore:[`link`,`linkReference`]})}function NL(e,t,n,r,i){let a=``;if(!LL(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!FL(n)))return!1;let o=IL(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function PL(e,t,n,r){return!LL(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function FL(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function IL(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=gL(e,`(`),a=gL(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function LL(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||AM(n)||kM(n))&&(!t||n!==47)}qL.peek=KL;function RL(){this.buffer()}function zL(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function BL(){this.buffer()}function VL(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function HL(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yM(this.sliceSerialize(e)).toLowerCase(),n.label=t}function UL(e){this.exit(e)}function WL(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yM(this.sliceSerialize(e)).toLowerCase(),n.label=t}function GL(e){this.exit(e)}function KL(){return`[`}function qL(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function JL(){return{enter:{gfmFootnoteCallString:RL,gfmFootnoteCall:zL,gfmFootnoteDefinitionLabelString:BL,gfmFootnoteDefinition:VL},exit:{gfmFootnoteCallString:HL,gfmFootnoteCall:UL,gfmFootnoteDefinitionLabelString:WL,gfmFootnoteDefinition:GL}}}function YL(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qL},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
72
- `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?ZL:XL))),s(),o}}function XL(e,t,n){return t===0?e:ZL(e,t,n)}function ZL(e,t,n){return(n?``:` `)+e}var QL=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];rR.attention=iR,rR.peek=aR;function $L(){return{canContainEols:[`delete`],enter:{strikethrough:tR},exit:{strikethrough:nR}}}function eR(){return{handlers:{delete:rR},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:QL}]}}function tR(e){this.enter({type:`delete`,children:[],position:void 0},e)}function nR(e){this.exit(e)}function rR(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function iR(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function aR(){return`~`}function oR(e){return e.length}function sR(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||oR,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=cR(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=lR(r[d]);else{let e=lR(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
73
- `)}function cR(e){return e==null?``:String(e)}function lR(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var uR=nI([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function dR(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),fR);return i(),o}function fR(e,t,n){return`>`+(n?``:` `)+e}function pR(e,t){return mR(e,t.inConstruct,!0)&&!mR(e,t.notInConstruct,!1)}function mR(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function hR(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
74
- `&&!e.before&&!e.after&&pR(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
75
- `}function gR(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function _R(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function vR(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function yR(e,t,n,r){let i=vR(n),a=e.value||``;if(_R(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,bR);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(gR(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
70
+ `}),n}function TI(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function EI(e,t){let n=bI(e,t),r=n.one(e,void 0),i=aI(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
71
+ `},i)),a}function DI(e,t){return e&&`run`in e?async function(n,r){let i=EI(n,{file:r,...t});await e.run(i,r)}:function(n,r){return EI(n,{file:r,...e||t})}}function OI(e){if(e)throw e}var kI=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function AI(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function jI(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?MI(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function MI(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var NI={basename:PI,dirname:FI,extname:II,join:LI,sep:`/`};function PI(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);BI(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function FI(e){if(BI(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function II(e){BI(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function LI(...e){let t=-1,n;for(;++t<e.length;)BI(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:RI(n)}function RI(e){BI(e);let t=e.codePointAt(0)===47,n=zI(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function zI(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function BI(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var VI={cwd:HI};function HI(){return`/`}function UI(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function WI(e){if(typeof e==`string`)e=new URL(e);else if(!UI(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return GI(e)}function GI(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var KI=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],qI=class{constructor(e){let t;t=e?UI(e)?{path:e}:typeof e==`string`||ZI(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:VI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<KI.length;){let e=KI[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)KI.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?NI.basename(this.path):void 0}set basename(e){YI(e,`basename`),JI(e,`basename`),this.path=NI.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?NI.dirname(this.path):void 0}set dirname(e){XI(this.basename,`dirname`),this.path=NI.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?NI.extname(this.path):void 0}set extname(e){if(JI(e,`extname`),XI(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=NI.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){UI(e)&&(e=WI(e)),YI(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?NI.basename(this.path,this.extname):void 0}set stem(e){YI(e,`stem`),JI(e,`stem`),this.path=NI.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Nj(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function JI(e,t){if(e&&e.includes(NI.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+NI.sep+"`")}function YI(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function XI(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function ZI(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var QI=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),$I=l(kI(),1),eL={}.hasOwnProperty,tL=new class e extends QI{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=jI()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,$I.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(iL(`data`,this.frozen),this.namespace[e]=t,this):eL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(iL(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=sL(e),n=this.parser||this.Parser;return nL(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),nL(`process`,this.parser||this.Parser),rL(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=sL(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);lL(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),nL(`processSync`,this.parser||this.Parser),rL(`processSync`,this.compiler||this.Compiler),this.process(e,r),oL(`processSync`,`process`,t),n;function r(e,r){t=!0,OI(e),n=r}}run(e,t,n){aL(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=sL(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),oL(`runSync`,`run`,n),r;function i(e,t){OI(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=sL(t),r=this.compiler||this.Compiler;return rL(`stringify`,r),aL(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(iL(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,$I.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];AI(o)&&AI(r)&&(r=(0,$I.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function nL(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function rL(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function iL(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function aL(e){if(!AI(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function oL(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function sL(e){return cL(e)?e:new qI(e)}function cL(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function lL(e){return typeof e==`string`||uL(e)}function uL(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var dL=[],fL={allowDangerousHtml:!0},pL=/^(https?|ircs?|mailto|xmpp)$/i,mL=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function hL(e){let t=gL(e),n=_L(e);return vL(t.runSync(t.parse(n),n),e)}function gL(e){let t=e.rehypePlugins||dL,n=e.remarkPlugins||dL,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fL}:fL;return tL().use(uF).use(n).use(DI,r).use(t)}function _L(e){let t=e.children||``,n=new qI;return typeof t==`string`?n.value=t:``+t,n}function vL(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||yL;for(let e of mL)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return _I(e,l),Vj(e,{Fragment:L.Fragment,components:i,ignoreInvalidStyle:!0,jsx:L.jsx,jsxs:L.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in lM)if(Object.hasOwn(lM,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=lM[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function yL(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||pL.test(e.slice(0,t))?e:``}function bL(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function xL(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function SL(e,t,n){let r=oI((n||{}).ignore||[]),i=CL(t),a=-1;for(;++a<i.length;)hI(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function CL(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([wL(e[0]),TL(e[1])])}return t}function wL(e){return typeof e==`string`?new RegExp(xL(e),`g`):e}function TL(e){return typeof e==`function`?e:function(){return e}}var EL=`phrasing`,DL=[`autolink`,`link`,`image`,`label`];function OL(){return{transforms:[IL],enter:{literalAutolink:AL,literalAutolinkEmail:jL,literalAutolinkHttp:jL,literalAutolinkWww:jL},exit:{literalAutolink:FL,literalAutolinkEmail:PL,literalAutolinkHttp:ML,literalAutolinkWww:NL}}}function kL(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:EL,notInConstruct:DL},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:EL,notInConstruct:DL},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:EL,notInConstruct:DL}]}}function AL(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function jL(e){this.config.enter.autolinkProtocol.call(this,e)}function ML(e){this.config.exit.autolinkProtocol.call(this,e)}function NL(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function PL(e){this.config.exit.autolinkEmail.call(this,e)}function FL(e){this.exit(e)}function IL(e){SL(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LL],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,RL]],{ignore:[`link`,`linkReference`]})}function LL(e,t,n,r,i){let a=``;if(!VL(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!zL(n)))return!1;let o=BL(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function RL(e,t,n,r){return!VL(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function zL(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function BL(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=bL(e,`(`),a=bL(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function VL(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||PM(n)||NM(n))&&(!t||n!==47)}ZL.peek=XL;function HL(){this.buffer()}function UL(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function WL(){this.buffer()}function GL(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function KL(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wM(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qL(e){this.exit(e)}function JL(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wM(this.sliceSerialize(e)).toLowerCase(),n.label=t}function YL(e){this.exit(e)}function XL(){return`[`}function ZL(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function QL(){return{enter:{gfmFootnoteCallString:HL,gfmFootnoteCall:UL,gfmFootnoteDefinitionLabelString:WL,gfmFootnoteDefinition:GL},exit:{gfmFootnoteCallString:KL,gfmFootnoteCall:qL,gfmFootnoteDefinitionLabelString:JL,gfmFootnoteDefinition:YL}}}function $L(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ZL},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
72
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?tR:eR))),s(),o}}function eR(e,t,n){return t===0?e:tR(e,t,n)}function tR(e,t,n){return(n?``:` `)+e}var nR=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];sR.attention=cR,sR.peek=lR;function rR(){return{canContainEols:[`delete`],enter:{strikethrough:aR},exit:{strikethrough:oR}}}function iR(){return{handlers:{delete:sR},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:nR}]}}function aR(e){this.enter({type:`delete`,children:[],position:void 0},e)}function oR(e){this.exit(e)}function sR(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function cR(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function lR(){return`~`}function uR(e){return e.length}function dR(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||uR,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=fR(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=pR(r[d]);else{let e=pR(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
73
+ `)}function fR(e){return e==null?``:String(e)}function pR(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var mR=oI([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function hR(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),gR);return i(),o}function gR(e,t,n){return`>`+(n?``:` `)+e}function _R(e,t){return vR(e,t.inConstruct,!0)&&!vR(e,t.notInConstruct,!1)}function vR(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function yR(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
74
+ `&&!e.before&&!e.after&&_R(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
75
+ `}function bR(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function xR(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function SR(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function CR(e,t,n,r){let i=SR(n),a=e.value||``;if(xR(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,wR);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(bR(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
76
76
  `,encode:["`"],...o.current()})),t()}return u+=o.move(`
77
77
  `),a&&(u+=o.move(a+`
78
- `)),u+=o.move(s),c(),u}function bR(e,t,n){return(n?``:` `)+e}function xR(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function SR(e,t,n,r){let i=xR(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
79
- `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function CR(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}wR.attention=TR,wR.peek=ER;function wR(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function TR(e,t){return{construct:`emphasis`,markers:CR(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function ER(e,t,n){return n.options.emphasis||`*`}function DR(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function OR(e,t){let n=!1;return pI(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&oM(e)&&(t.options.setext||n))}function kR(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(OR(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
78
+ `)),u+=o.move(s),c(),u}function wR(e,t,n){return(n?``:` `)+e}function TR(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ER(e,t,n,r){let i=TR(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
79
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function DR(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}OR.attention=kR,OR.peek=AR;function OR(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function kR(e,t){return{construct:`emphasis`,markers:DR(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function AR(e,t,n){return n.options.emphasis||`*`}function jR(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function MR(e,t){let n=!1;return _I(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&dM(e)&&(t.options.setext||n))}function NR(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(MR(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
80
80
  `,after:`
81
81
  `});return r(),t(),o+`
82
82
  `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
83
83
  `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
84
- `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=DR(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}AR.peek=jR;function AR(e){return e.value||``}function jR(){return`<`}MR.peek=NR;function MR(e,t,n,r){let i=xR(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function NR(){return`!`}PR.peek=FR;function PR(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function FR(){return`!`}IR.peek=LR;function IR(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function LR(){return"`"}function RR(e,t){let n=oM(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}zR.peek=BR;function zR(e,t,n,r){let i=xR(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(RR(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function BR(e,t,n){return RR(e,n)?`<`:`[`}VR.peek=HR;function VR(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function HR(){return`[`}function UR(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function WR(e){let t=UR(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function GR(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function KR(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function qR(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?GR(n):UR(n),s=e.ordered?o===`.`?`)`:`.`:WR(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),KR(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function JR(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function YR(e,t,n,r){let i=JR(n),a=n.bulletCurrent||UR(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function XR(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function ZR(e,t,n,r){if(!e.children.some(function(e){return uR(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function QR(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$R.attention=ez,$R.peek=tz;function $R(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function ez(e,t){return{construct:`strong`,markers:QR(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function tz(e,t,n){return n.options.strong||`*`}function nz(e,t,n,r){return n.safe(e.value,r)}function rz(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function iz(e,t,n){let r=(KR(n)+(n.options.ruleSpaces?` `:``)).repeat(rz(n));return n.options.ruleSpaces?r.slice(0,-1):r}var az={blockquote:dR,break:hR,code:yR,definition:SR,emphasis:wR,hardBreak:hR,heading:kR,html:AR,image:MR,imageReference:PR,inlineCode:IR,link:zR,linkReference:VR,list:qR,listItem:YR,paragraph:XR,root:ZR,strong:$R,text:nz,thematicBreak:iz};function oz(){return{enter:{table:sz,tableData:dz,tableHeader:dz,tableRow:lz},exit:{codeText:fz,table:cz,tableData:uz,tableHeader:uz,tableRow:uz}}}function sz(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function cz(e){this.exit(e),this.data.inTable=void 0}function lz(e){this.enter({type:`tableRow`,children:[]},e)}function uz(e){this.exit(e)}function dz(e){this.enter({type:`tableCell`,children:[]},e)}function fz(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,pz));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function pz(e,t){return t===`|`?t:e}function mz(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
84
+ `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=jR(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}PR.peek=FR;function PR(e){return e.value||``}function FR(){return`<`}IR.peek=LR;function IR(e,t,n,r){let i=TR(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function LR(){return`!`}RR.peek=zR;function RR(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function zR(){return`!`}BR.peek=VR;function BR(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function VR(){return"`"}function HR(e,t){let n=dM(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}UR.peek=WR;function UR(e,t,n,r){let i=TR(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(HR(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function WR(e,t,n){return HR(e,n)?`<`:`[`}GR.peek=KR;function GR(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function KR(){return`[`}function qR(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function JR(e){let t=qR(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function YR(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function XR(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function ZR(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?YR(n):qR(n),s=e.ordered?o===`.`?`)`:`.`:JR(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),XR(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function QR(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function $R(e,t,n,r){let i=QR(n),a=n.bulletCurrent||qR(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function ez(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function tz(e,t,n,r){if(!e.children.some(function(e){return mR(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function nz(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}rz.attention=iz,rz.peek=az;function rz(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function iz(e,t){return{construct:`strong`,markers:nz(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function az(e,t,n){return n.options.strong||`*`}function oz(e,t,n,r){return n.safe(e.value,r)}function sz(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function cz(e,t,n){let r=(XR(n)+(n.options.ruleSpaces?` `:``)).repeat(sz(n));return n.options.ruleSpaces?r.slice(0,-1):r}var lz={blockquote:hR,break:yR,code:CR,definition:ER,emphasis:OR,hardBreak:yR,heading:NR,html:PR,image:IR,imageReference:RR,inlineCode:BR,link:UR,linkReference:GR,list:ZR,listItem:$R,paragraph:ez,root:tz,strong:rz,text:oz,thematicBreak:cz};function uz(){return{enter:{table:dz,tableData:hz,tableHeader:hz,tableRow:pz},exit:{codeText:gz,table:fz,tableData:mz,tableHeader:mz,tableRow:mz}}}function dz(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function fz(e){this.exit(e),this.data.inTable=void 0}function pz(e){this.enter({type:`tableRow`,children:[]},e)}function mz(e){this.exit(e)}function hz(e){this.enter({type:`tableCell`,children:[]},e)}function gz(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_z));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function _z(e,t){return t===`|`?t:e}function vz(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
85
85
  `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
86
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return sR(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=az.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function hz(){return{exit:{taskListCheckValueChecked:_z,taskListCheckValueUnchecked:_z,paragraph:vz}}}function gz(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:yz}}}function _z(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function vz(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function yz(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=az.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function bz(){return[wL(),JL(),$L(),oz(),hz()]}function xz(e){return{extensions:[TL(),YL(e),eR(),mz(e),gz()]}}var Sz={tokenize:Iz,partial:!0},Cz={tokenize:Lz,partial:!0},wz={tokenize:Rz,partial:!0},Tz={tokenize:zz,partial:!0},Ez={tokenize:Bz,partial:!0},Dz={name:`wwwAutolink`,tokenize:Pz,previous:Vz},Oz={name:`protocolAutolink`,tokenize:Fz,previous:Hz},kz={name:`emailAutolink`,tokenize:Nz,previous:Uz},Az={};function jz(){return{text:Az}}for(var Mz=48;Mz<123;)Az[Mz]=kz,Mz++,Mz===58?Mz=65:Mz===91&&(Mz=97);Az[43]=kz,Az[45]=kz,Az[46]=kz,Az[95]=kz,Az[72]=[kz,Oz],Az[104]=[kz,Oz],Az[87]=[kz,Dz],Az[119]=[kz,Dz];function Nz(e,t,n){let r=this,i,a;return o;function o(t){return!Wz(t)||!Uz.call(r,r.previous)||Gz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Wz(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Ez,u,l)(t):t===45||t===95||xM(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&bM(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Pz(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Vz.call(r,r.previous)||Gz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Sz,e.attempt(Cz,e.attempt(wz,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Fz(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Hz.call(r,r.previous)&&!Gz(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(bM(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||CM(t)||DM(t)||AM(t)||kM(t)?n(t):e.attempt(Cz,e.attempt(wz,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Iz(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Lz(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Tz,c,s)(t):t===null||DM(t)||AM(t)||t!==45&&kM(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Rz(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Tz,t,a)(o):o===null||DM(o)||AM(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function zz(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||DM(o)||AM(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||DM(e)||AM(e)?t(e):r(e)}function a(e){return bM(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):bM(t)?(e.consume(t),o):n(t)}}function Bz(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return xM(e)?n(e):t(e)}}function Vz(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||DM(e)}function Hz(e){return!bM(e)}function Uz(e){return!(e===47||Wz(e))}function Wz(e){return e===43||e===45||e===46||e===95||xM(e)}function Gz(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Kz={tokenize:eB,partial:!0};function qz(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Zz,continuation:{tokenize:Qz},exit:$z}},text:{91:{name:`gfmFootnoteCall`,tokenize:Xz},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Jz,resolveTo:Yz}}}}function Jz(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=yM(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Yz(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Xz(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||DM(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(yM(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return DM(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Zz(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||DM(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=yM(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return DM(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),NM(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Qz(e,t,n){return e.check(ZM,t,e.attempt(Kz,t,n))}function $z(e){e.exit(`gfmFootnoteDefinition`)}function eB(e,t,n){let r=this;return NM(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function tB(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&fM(o,o.length,0,WM(s,e.slice(r+1,n),t)),fM(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),fM(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=UM(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=UM(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var nB=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){rB(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function rB(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function iB(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function aB(){return{flow:{null:{name:`table`,tokenize:oB,resolveAll:sB}}}}function oB(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):$(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):OM(t)?NM(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||DM(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,OM(t)?NM(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return OM(t)?NM(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||$(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return OM(t)?NM(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||$(n)?(e.exit(`tableRow`),t(n)):OM(n)?NM(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||DM(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function sB(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new nB;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(lB(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=cB(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=cB(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=cB(f,t,o,i,n,d)):(o[0]=o[1],d=cB(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&lB(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=iB(t.events,n))}return e}function cB(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},uB(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=uB(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=uB(t.events,n[2]),a=uB(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},uB(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function lB(e,t,n,r,i){let a=[],o=uB(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function uB(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var dB={name:`tasklistCheck`,tokenize:pB};function fB(){return{text:{91:dB}}}function pB(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return DM(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return $(r)?t(r):OM(r)?e.check({tokenize:mB},t,n)(r):n(r)}}function mB(e,t,n){return NM(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function hB(e){return hM([jz(),qz(),tB(e),aB(),fB()])}var gB={};function _B(e){let t=this,n=e||gB,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(hB(n)),a.push(bz()),o.push(xz(n))}var vB=new Set([`http:`,`https:`,`mailto:`,`tel:`]);function yB(e){let t=(e??``).trim();if(t===``)return``;if(/^[#/.]/.test(t))return t;try{let e=new URL(t,`https://example.invalid`);return vB.has(e.protocol)?t:``}catch{return``}}var bB=4e3,xB=/^\s*(?:```|~~~)/,SB=/^#{1,6}\s/,CB=/^\s{0,3}\[[^\]]+\]:\s*\S|\[\^[^\]]+\]/m;function wB(e){if(e.length<=bB||CB.test(e))return[e];let t=[],n=[],r=!1;for(let i of e.split(`
87
- `))xB.test(i)?r=!r:!r&&SB.test(i)&&n.some(e=>e.trim())&&(t.push(n.join(`
86
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return dR(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=lz.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function yz(){return{exit:{taskListCheckValueChecked:xz,taskListCheckValueUnchecked:xz,paragraph:Sz}}}function bz(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Cz}}}function xz(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Sz(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Cz(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=lz.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function wz(){return[OL(),QL(),rR(),uz(),yz()]}function Tz(e){return{extensions:[kL(),$L(e),iR(),vz(e),bz()]}}var Ez={tokenize:Bz,partial:!0},Dz={tokenize:Vz,partial:!0},Oz={tokenize:Hz,partial:!0},kz={tokenize:Uz,partial:!0},Az={tokenize:Wz,partial:!0},jz={name:`wwwAutolink`,tokenize:Rz,previous:Gz},Mz={name:`protocolAutolink`,tokenize:zz,previous:Kz},Nz={name:`emailAutolink`,tokenize:Lz,previous:qz},Pz={};function Fz(){return{text:Pz}}for(var Iz=48;Iz<123;)Pz[Iz]=Nz,Iz++,Iz===58?Iz=65:Iz===91&&(Iz=97);Pz[43]=Nz,Pz[45]=Nz,Pz[46]=Nz,Pz[95]=Nz,Pz[72]=[Nz,Mz],Pz[104]=[Nz,Mz],Pz[87]=[Nz,jz],Pz[119]=[Nz,jz];function Lz(e,t,n){let r=this,i,a;return o;function o(t){return!Jz(t)||!qz.call(r,r.previous)||Yz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Jz(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Az,u,l)(t):t===45||t===95||EM(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&TM(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Rz(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Gz.call(r,r.previous)||Yz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Ez,e.attempt(Dz,e.attempt(Oz,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function zz(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Kz.call(r,r.previous)&&!Yz(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(TM(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||OM(t)||MM(t)||PM(t)||NM(t)?n(t):e.attempt(Dz,e.attempt(Oz,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Bz(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Vz(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(kz,c,s)(t):t===null||MM(t)||PM(t)||t!==45&&NM(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Hz(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(kz,t,a)(o):o===null||MM(o)||PM(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Uz(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||MM(o)||PM(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||MM(e)||PM(e)?t(e):r(e)}function a(e){return TM(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):TM(t)?(e.consume(t),o):n(t)}}function Wz(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return EM(e)?n(e):t(e)}}function Gz(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||MM(e)}function Kz(e){return!TM(e)}function qz(e){return!(e===47||Jz(e))}function Jz(e){return e===43||e===45||e===46||e===95||EM(e)}function Yz(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Xz={tokenize:iB,partial:!0};function Zz(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:tB,continuation:{tokenize:nB},exit:rB}},text:{91:{name:`gfmFootnoteCall`,tokenize:eB},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Qz,resolveTo:$z}}}}function Qz(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=wM(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function $z(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function eB(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||MM(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(wM(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return MM(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function tB(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||MM(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=wM(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return MM(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),LM(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function nB(e,t,n){return e.check(tN,t,e.attempt(Xz,t,n))}function rB(e){e.exit(`gfmFootnoteDefinition`)}function iB(e,t,n){let r=this;return LM(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function aB(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&_M(o,o.length,0,JM(s,e.slice(r+1,n),t)),_M(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),_M(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=qM(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=qM(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var oB=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){sB(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function sB(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function cB(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function lB(){return{flow:{null:{name:`table`,tokenize:uB,resolveAll:dB}}}}function uB(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):$(t)?LM(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||MM(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,$(t)?LM(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return $(t)?LM(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return $(t)?LM(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Q(n)?(e.exit(`tableRow`),t(n)):$(n)?LM(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||MM(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function dB(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new oB;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(pB(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=fB(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=fB(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=fB(f,t,o,i,n,d)):(o[0]=o[1],d=fB(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&pB(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=cB(t.events,n))}return e}function fB(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},mB(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=mB(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=mB(t.events,n[2]),a=mB(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},mB(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function pB(e,t,n,r,i){let a=[],o=mB(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function mB(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var hB={name:`tasklistCheck`,tokenize:_B};function gB(){return{text:{91:hB}}}function _B(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return MM(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Q(r)?t(r):$(r)?e.check({tokenize:vB},t,n)(r):n(r)}}function vB(e,t,n){return LM(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function yB(e){return bM([Fz(),Zz(),aB(e),lB(),gB()])}var bB={};function xB(e){let t=this,n=e||bB,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(yB(n)),a.push(wz()),o.push(Tz(n))}var SB=new Set([`http:`,`https:`,`mailto:`,`tel:`]);function CB(e){let t=(e??``).trim();if(t===``)return``;if(/^[#/.]/.test(t))return t;try{let e=new URL(t,`https://example.invalid`);return SB.has(e.protocol)?t:``}catch{return``}}var wB=4e3,TB=/^\s*(?:```|~~~)/,EB=/^#{1,6}\s/,DB=/^\s{0,3}\[[^\]]+\]:\s*\S|\[\^[^\]]+\]/m;function OB(e){if(e.length<=wB||DB.test(e))return[e];let t=[],n=[],r=!1;for(let i of e.split(`
87
+ `))TB.test(i)?r=!r:!r&&EB.test(i)&&n.some(e=>e.trim())&&(t.push(n.join(`
88
88
  `)),n=[]),n.push(i);return t.push(n.join(`
89
- `)),t}function TB(e,t,n=!1){let r=t?.start?.offset,i=t?.end?.offset;if(r===void 0||i===void 0)return;let a=e.slice(r,i);if(!n){let e=a.match(/^`+/)?.[0];return e&&a.endsWith(e)?a.slice(e.length,-e.length):a}let o=a.match(/^ {0,3}(`{3,}|~{3,})[^\r\n]*(?:\r\n|\n|\r)/);if(!o)return a;let s=a.slice(o[0].length),c=RegExp(`^ {0,3}${o[1][0]}{${o[1].length},}[ \\t]*$`,`m`).exec(s);return c?s.slice(0,c.index):s}function EB(e,t){return!e&&!t}async function DB(e,t){if(!t)throw Error(`Clipboard is unavailable. Select the code and copy it manually.`);await t.writeText(e)}var OB=/^-\s+(.+?)\s+\(([^()\s]+\/[^()\s]+)\)\s*$/;function kB(e){let t=e.lastIndexOf(`${ok}\n`);if(t<0||t>0&&e[t-1]!==`
89
+ `)),t}function kB(e,t,n=!1){let r=t?.start?.offset,i=t?.end?.offset;if(r===void 0||i===void 0)return;let a=e.slice(r,i);if(!n){let e=a.match(/^`+/)?.[0];return e&&a.endsWith(e)?a.slice(e.length,-e.length):a}let o=a.match(/^ {0,3}(`{3,}|~{3,})[^\r\n]*(?:\r\n|\n|\r)/);if(!o)return a;let s=a.slice(o[0].length),c=RegExp(`^ {0,3}${o[1][0]}{${o[1].length},}[ \\t]*$`,`m`).exec(s);return c?s.slice(0,c.index):s}function AB(e,t){return!e&&!t}async function jB(e,t){if(!t)throw Error(`Clipboard is unavailable. Select the code and copy it manually.`);await t.writeText(e)}var MB=/^-\s+(.+?)\s+\(([^()\s]+\/[^()\s]+)\)\s*$/;function NB(e){let t=e.lastIndexOf(`${ok}\n`);if(t<0||t>0&&e[t-1]!==`
90
90
  `)return{body:e,files:[]};let n=e.slice(t+ok.length+1).split(`
91
- `).filter(Boolean),r=[];for(let t of n){let n=OB.exec(t);if(!n)return{body:e,files:[]};let i=n[1].split(/[\\/]/).pop()??``;if(!/^[\w.-]+$/.test(i))return{body:e,files:[]};r.push({id:i,name:i.replace(/^[a-z0-9]+-/,``),mime:n[2]})}return r.length>0?{body:e.slice(0,t).trimEnd(),files:r}:{body:e,files:[]}}var AB=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]);function jB({files:e}){return e.length===0?null:(0,L.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-2`,"aria-label":`Attached files`,children:e.map(e=>(0,L.jsx)(`li`,{children:AB.has(e.mime)?(0,L.jsx)(`a`,{href:N(`/files/preview/attachments/${e.id}`),target:`_blank`,rel:`noopener noreferrer`,className:`block overflow-hidden rounded-lg border border-border bg-muted/40 transition-transform duration-150 ease-snap hover:scale-[1.02]`,children:(0,L.jsx)(`img`,{src:N(`/files/preview/attachments/${e.id}`),alt:e.name,loading:`lazy`,className:`max-h-40 max-w-56 object-cover`})}):(0,L.jsxs)(`span`,{className:`inline-flex max-w-64 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground`,children:[e.mime===`application/pdf`?(0,L.jsx)(Pm,{"aria-hidden":`true`,className:`size-4 shrink-0`}):(0,L.jsx)(Ah,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.id))})}var MB=!1,NB=[],PB=0,FB=900;function IB(){MB=!0,window.clearTimeout(PB),PB=window.setTimeout(LB,FB)}function LB(){MB=!1,window.clearTimeout(PB);let e=NB;NB=[];for(let t of e)t()}function RB(e){if(!MB)return e(),()=>{};let t=()=>e();return NB.push(t),()=>{NB=NB.filter(e=>e!==t)}}var zB=8;function BB(e,t=24){let[n,r]=(0,m.useState)(t),i=(0,m.useRef)(8),a=n<e;return(0,m.useEffect)(()=>{if(!a)return;let e=0,t=RB(()=>{e=requestAnimationFrame(()=>{let e=performance.now();(0,Hv.flushSync)(()=>r(e=>e+i.current));let t=Math.max(1,performance.now()-e);i.current=Math.max(2,Math.min(400,Math.round(i.current*zB/t)))})});return()=>{t(),cancelAnimationFrame(e)}},[a,n]),Math.min(n,e)}function VB(e){return e?.type===`text`?e.value??``:(e?.children??[]).map(VB).join(``)}function HB(e,t=!1){let n=t||e.tagName===`a`;e.tagName===`code`&&(e.properties={...e.properties,copyBlocked:n,blockCode:t===!1&&e.properties?.blockCode});for(let t of e.children??[])e.tagName===`pre`&&(t.properties={...t.properties,blockCode:!0}),HB(t,n)}function UB(){return e=>HB(e)}function WB(e){let[t,n]=(0,m.useState)(!1);async function r(){try{await DB(e,navigator.clipboard),n(!0),V.success(`Code copied.`)}catch{V.error(`Could not copy code. Select it and copy manually, or allow clipboard access.`)}}return{copied:t,copy:r}}function GB({text:e,children:t,block:n=!1}){let{copy:r}=WB(e),i=(0,m.useRef)(void 0);return(0,L.jsxs)(`code`,{role:`button`,tabIndex:0,"aria-label":`Copy code`,"aria-keyshortcuts":`Enter Space`,title:`Copy code · Enter / Space`,className:`cursor-copy focus-visible:outline-2 focus-visible:outline-ring`,onPointerDown:e=>{i.current={x:e.clientX,y:e.clientY,moved:!1}},onPointerMove:e=>{let t=i.current;t&&Math.hypot(e.clientX-t.x,e.clientY-t.y)>4&&(t.moved=!0)},onClick:e=>{e.stopPropagation(),EB(window.getSelection()?.toString()??``,i.current?.moved??!1)&&r(),i.current=void 0},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),EB(window.getSelection()?.toString()??``,!1)&&r())},children:[t,n?null:(0,L.jsx)(`span`,{className:`sr-only`,children:` (activate to copy)`})]})}function KB({node:e,children:t,source:n}){let r=e,{copied:i,copy:a}=WB(TB(n,r?.position,!0)??VB(r)),o=r?.children?.find(e=>e.tagName===`code`)?.properties?.className,s=(Array.isArray(o)?o:[]).map(String).find(e=>e.startsWith(`language-`))?.slice(9);return(0,L.jsxs)(`div`,{className:`relative my-3 rounded-lg bg-muted`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between pl-3`,children:[(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[s&&/^[\w+#.-]{1,20}$/.test(s)?s:`code`,` · tap to copy`]}),(0,L.jsx)(X,{label:i?`Copied`:`Copy the code`,icon:i?Hp:Sm,iconOnly:!0,onClick:()=>void a()})]}),(0,L.jsx)(`pre`,{className:`!my-0 overflow-x-auto !rounded-t-none !bg-transparent px-3 pb-3 text-sm leading-relaxed [&>code]:block`,children:t})]})}function qB(e){return{pre:t=>(0,L.jsx)(KB,{...t,source:e}),code:({node:t,children:n})=>{let r=t;if(r?.properties?.copyBlocked)return(0,L.jsx)(`code`,{children:n});let i=!!r?.properties?.blockCode;return(0,L.jsx)(GB,{text:TB(e,r?.position,i)??VB(r),block:i,children:n})},a:({href:e,children:t})=>(0,L.jsx)(`a`,{href:e?N(e):void 0,target:`_blank`,rel:`noopener noreferrer nofollow`,children:t}),img:({src:e,alt:t})=>(0,L.jsx)(`img`,{src:e?N(e):void 0,alt:t??``,loading:`lazy`}),table:({children:e})=>(0,L.jsx)(`div`,{className:`my-3 w-full overflow-x-auto`,children:(0,L.jsx)(`table`,{className:`w-full border-collapse text-sm`,children:e})})}}var JB=(0,m.memo)(function({text:e}){return(0,L.jsx)(dL,{remarkPlugins:[_B],rehypePlugins:[UB],urlTransform:yB,components:qB(e),children:e})}),YB=(0,m.memo)(function({text:e,className:t}){let{body:n,files:r}=kB(e),i=n?wB(n):[],a=BB(i.length,3);return(0,L.jsxs)(`div`,{className:q(`md-body`,t),children:[i.slice(0,a).map((e,t)=>(0,L.jsx)(JB,{text:e},t)),(0,L.jsx)(jB,{files:r})]})});function XB({title:e,note:t,className:n,children:r,collapsed:i,onToggle:a,shortcut:o,...s}){let c=typeof e==`string`?e:`pane`;return(0,L.jsxs)(`section`,{className:q(`group/frame relative flex min-h-0 min-w-0 flex-col`,i&&`flex-none`,n),...s,children:[e||t||a?(0,L.jsxs)(`div`,{className:q(`flex min-h-12 shrink-0 items-center justify-between gap-3 px-4`,!i&&`border-b border-border`),children:[e?(0,L.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-medium`,children:e}):(0,L.jsx)(`span`,{}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,L.jsx)(`span`,{className:`flex items-center gap-2 truncate text-xs text-muted-foreground`,children:t}):null,a?(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":!i,"aria-label":i?`Expand ${c}`:`Minimize ${c}`,title:`${i?`Expand`:`Minimize`}${o?` · ${o}`:``}`,"aria-keyshortcuts":o?`${o} Enter Space`:`Enter Space`,"aria-describedby":`focused-action-help`,onClick:a,className:`btn-ghost -mr-1.5 inline-flex h-8 items-center gap-1.5 rounded-lg border border-transparent px-2 text-muted-foreground transition-[box-shadow,color,translate] duration-150 ease-snap outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`,children:[o?(0,L.jsx)(GO,{chord:o,className:`kbd-hint`}):null,(0,L.jsx)(Wp,{"aria-hidden":`true`,className:q(`size-4 transition-transform duration-200 ease-snap`,i&&`-rotate-90`)})]}):null]})]}):null,i?null:r]})}function ZB({title:e,right:t,className:n}){return(0,L.jsxs)(`span`,{className:q(`flex min-w-0 items-center gap-3`,n),children:[(0,L.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`min-w-4 flex-1`}),t?(0,L.jsx)(`span`,{className:`shrink-0 text-xs font-normal text-muted-foreground`,children:t}):null]})}function QB({title:e,right:t,prominent:n,children:r}){return(0,L.jsxs)(`section`,{className:q(`flex flex-col`,n?`gap-3`:`gap-2.5`),children:[(0,L.jsx)(`h3`,{className:n?`text-sm text-foreground`:`text-xs text-muted-foreground`,children:(0,L.jsx)(ZB,{title:e,right:t,className:n?`[&>span:first-child]:font-semibold`:void 0})}),r]})}var $B=`Pull requests`,eV=`An agent reviews it, optionally with a focus you type; Jev's quick read sizes it up first.`,tV=`nothing is posted to GitHub`,nV=`Refresh to load open pull requests with the GitHub CLI (gh).`,rV=`No open pull requests.`,iV=`loading pull requests from GitHub…`,aV=`reading the diff…`,oV=`the pull request has new commits since this review — review it again`,sV=`(no description)`,cV=`Review with a focus (optional)`,lV=`Leave it empty for a full review.`;function uV(e){return e===`passing`?`✓`:e===`failing`?`✗`:e===`pending`?`…`:``}function dV(e){return e===`passing`?`text-success`:e===`failing`?`text-destructive`:`text-muted-foreground`}function fV(e,t){return`+${e} −${t}`}function pV(e){return e===`APPROVED`?`approved`:e===`CHANGES_REQUESTED`?`changes requested`:e===`REVIEW_REQUIRED`?`review required`:``}function mV(e){return e?e.status===`running`?`reviewing`:e.status!==`done`||!e.verdict?``:e.verdict===`approve`?`approved`:e.verdict===`changes`?`changes found`:`commented`:``}function hV(e){return e===`approve`?`approve`:e===`changes`?`request changes`:e===`comment`?`comment`:``}function gV(e,t){if(e.status===`running`)return _V(e,t);if(e.status===`cancelled`)return`stopped`;let n=e.status===`done`?_V(e,t):e.status;return[hV(e.verdict),n].filter(Boolean).join(` · `)}function _V(e,t){let n=Math.max(0,Math.round(((e.finishedAt??t)-e.startedAt)/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m ${String(n%60).padStart(2,`0`)}s`}function vV(e,t){return[e.state?e.draft?`draft`:e.state.toLowerCase():e.draft?`draft`:``,e.author?`by ${e.author}`:``,e.updatedAt?`updated ${gA(t-Date.parse(e.updatedAt))}`:``].filter(Boolean).join(` · `)}function yV(e){let t=`${e.changedFiles} file${e.changedFiles===1?``:`s`}`;return`${e.headRef||`?`} → ${e.baseRef||`?`} · ${fV(e.additions,e.deletions)} · ${t}`}function bV(e){let t=e.mergeable===`CONFLICTING`?`conflicts`:e.mergeable===`MERGEABLE`?`mergeable`:``;return[e.checks?`checks ${e.checks} (${e.checkCount})`:``,pV(e.decision),t,e.labels.join(`, `)].filter(Boolean).join(` · `)}function xV(e){return[`${e.changedFiles} file${e.changedFiles===1?``:`s`}`,e.labels.join(`, `),e.review?.stale?`stale`:``].filter(Boolean).join(` · `)}function SV(e){return e.read?`${e.read.model} · ${e.read.ms} ms`:``}function CV(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),e?t:Date.now()}function wV({pull:e,now:t}){return(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:[(0,L.jsxs)(`span`,{className:`font-normal text-muted-foreground tabular-nums`,children:[`#`,e.number]}),` `,e.title]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:vV(e,t)}),(0,L.jsx)(`p`,{className:`text-sm tabular-nums`,children:yV(e)}),bV(e)?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:bV(e)}):null,e.url?(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,className:`text-xs break-all text-primary underline underline-offset-4`,children:e.url}):null]})}function TV({read:e}){return(0,L.jsxs)(QB,{title:`Jev's read`,right:SV(e),children:[e.status===`running`?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(_k,{className:`size-3.5`}),aV]}):null,e.status===`failed`?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:e.error??`Jev could not read it`}):null,e.status===`done`&&e.line?(0,L.jsx)(YB,{text:e.line}):null]})}function EV({review:e,now:t}){return(0,L.jsxs)(L.Fragment,{children:[e.model?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:[e.model,e.thinking].filter(Boolean).join(` · `)}):null,e.focus?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`focus: `,e.focus]}):null,e.saved?(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`kept from `,gA(t-e.startedAt)]}):null,e.stale?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:oV}):null,e.status===`running`?(0,L.jsx)(DV,{steps:e.steps}):null,e.status===`cancelled`?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`stopped`}):null,e.status===`failed`||e.status===`timeout`?(0,L.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`✗ `,e.error??e.status]}):null,e.text?(0,L.jsx)(YB,{text:e.text}):null]})}function DV({steps:e}){return(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm text-muted-foreground`,children:e.slice(-6).map((e,t)=>(0,L.jsxs)(`li`,{className:`break-words`,children:[`· `,e]},t))})}function OV({number:e,focus:t,onChange:n}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`label`,{htmlFor:`focus-${e}`,className:`text-[0.8125rem] font-medium text-foreground`,children:cV}),(0,L.jsx)(dA,{id:`focus-${e}`,value:t,rows:2,maxLength:2e3,onChange:e=>n(e.target.value)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:lV})]})}function kV({number:e,review:t,now:n,focus:r,onFocus:i}){return(0,L.jsxs)(QB,{title:`Review`,right:t?gV(t,n):void 0,children:[t?(0,L.jsx)(EV,{review:t,now:n}):null,(0,L.jsx)(OV,{number:e,focus:r,onChange:i}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`A read-only agent reviews it — `,tV,`.`]})]})}function AV({files:e}){return(0,L.jsx)(QB,{title:`Files`,right:String(e.length),children:(0,L.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-border`,children:(0,L.jsx)(`table`,{className:`w-full border-collapse text-sm tabular-nums`,children:(0,L.jsx)(`tbody`,{children:e.map(e=>(0,L.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,L.jsx)(`td`,{className:`max-w-0 px-3 py-1.5 break-all`,children:e.path}),(0,L.jsx)(`td`,{className:`px-3 py-1.5 text-right text-xs whitespace-nowrap text-muted-foreground`,children:fV(e.additions,e.deletions)})]},e.path))})})})})}function jV({note:e,now:t}){let n=[e.state&&e.state!==`COMMENTED`?e.state.toLowerCase().replace(/_/g,` `):``,e.at?gA(t-Date.parse(e.at)):``].filter(Boolean).join(` · `);return(0,L.jsxs)(`article`,{className:`card-raised flex flex-col gap-1.5 rounded-lg border px-3.5 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:e.author??`comment`}),n?(0,L.jsx)(`span`,{children:n}):null]}),e.body.trim()?(0,L.jsx)(YB,{text:e.body.trim()}):null]})}function MV({notes:e,now:t}){return e.length===0?null:(0,L.jsx)(QB,{title:`Discussion`,right:String(e.length),children:(0,L.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,n)=>(0,L.jsx)(jV,{note:e,now:t},n))})})}function NV({number:e,error:t}){return t?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load #`,e,`. `,t]}):(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(_k,{className:`size-3.5`}),`loading #`,e,`…`]})}function PV({number:e,onChanged:t}){let n=Tk(`git.pull`,{number:e},[`git`]),[r,i]=(0,m.useState)(``),a=n.data?.review?.status===`running`,o=CV(a);if(!n.data)return(0,L.jsx)(NV,{number:e,error:n.error});let{pull:s,review:c,read:l}=n.data,u=()=>{n.reload(),t?.()},d=async()=>{let t=r.trim();i(``),await H(`git.review`,{number:e,...t?{focus:t}:{}}),u()},f=async()=>{await H(`git.jev`,{number:e}),u()},p=async()=>{await H(`git.cancelReview`,{number:e}),u()};return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`Pull request #${e}`,children:[(0,L.jsxs)(Yk,{children:[(0,L.jsx)(X,{label:`Review`,icon:Hh,tone:`primary`,shortcut:`V`,disabled:a,onClick:()=>void d()}),(0,L.jsx)(X,{label:`Jev's read`,icon:Ip,shortcut:`Q`,disabled:a,onClick:()=>void f()}),a?(0,L.jsx)(DA,{icon:um,label:`Stop the review`,text:`Stop`,shortcut:`X`,title:`Stop this review?`,description:`The agent stops reading the pull request. Nothing is posted to GitHub.`,confirmLabel:`Stop review`,variant:`destructive`,onConfirm:()=>void p()}):null]}),(0,L.jsx)(wV,{pull:s,now:o}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:eV}),l?(0,L.jsx)(TV,{read:l}):null,(0,L.jsx)(kV,{number:e,review:c,now:o,focus:r,onFocus:i}),s.files.length>0?(0,L.jsx)(AV,{files:s.files}):null,(0,L.jsx)(QB,{title:`Description`,children:s.body.trim()?(0,L.jsx)(YB,{text:s.body.trim()}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:sV})}),(0,L.jsx)(MV,{notes:s.notes,now:o})]})}var FV=Yg(`group/badge inline-flex h-6 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-lg border border-transparent px-2.5 text-xs font-medium whitespace-nowrap transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/40 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-accent text-foreground [a]:hover:bg-primary/20`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-accent`,destructive:`bg-destructive/12 text-destructive [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-accent`,ghost:`hover:bg-accent hover:text-foreground`,link:`text-link underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function IV({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?kv:`span`;return(0,L.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:q(FV({variant:t}),e),...r})}var LV=`flex min-h-10 w-full flex-col gap-0.5 rounded-lg px-2.5 py-2 text-left outline-none transition-colors duration-150 hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/40 aria-[current=true]:bg-accent`,RV=`flex flex-col gap-0.5 px-2 pb-2`,zV=`px-4 pt-4 pb-1 text-xs font-medium text-muted-foreground`;function BV({checks:e}){let t=uV(e);return t?(0,L.jsx)(`span`,{className:q(`w-4 shrink-0 text-center`,dV(e)),"aria-hidden":`true`,children:t}):(0,L.jsx)(`span`,{className:`w-4 shrink-0`,"aria-hidden":`true`})}function VV({pull:e,selected:t,onSelect:n}){let r=mV(e.review);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(e.number),className:LV,children:[(0,L.jsxs)(`span`,{className:`flex items-start gap-2 text-sm`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:[`#`,e.number]}),(0,L.jsx)(BV,{checks:e.checks}),e.draft?(0,L.jsx)(IV,{variant:`secondary`,children:`draft`}):null,(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.title})]}),(0,L.jsxs)(`span`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:xV(e)}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[r?(0,L.jsx)(`span`,{children:r}):null,(0,L.jsx)(`span`,{className:`tabular-nums`,children:fV(e.additions,e.deletions)})]})]})]})})}function HV({pulls:e,selectedId:t,onSelect:n}){return(0,L.jsx)(`ul`,{className:RV,children:e.map(e=>(0,L.jsx)(VV,{pull:e,selected:e.number===t,onSelect:n},e.number))})}var UV=()=>Y(lk(`git`)),WV=e=>Y(lk(`git`,String(e)));function GV(e){let t=Number(e[0]);return Number.isInteger(t)&&t>0?t:void 0}function KV({loading:e,loaded:t,error:n,onRetry:r}){let i=n?`✗ ${n}`:t?rV:e?iV:nV;return(0,L.jsxs)(dk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(Hm,{"aria-hidden":`true`})}),(0,L.jsx)(gk,{className:n?`text-destructive`:void 0,children:i})]}),n?(0,L.jsx)(J,{variant:`outline`,onClick:r,children:`Retry`}):null]})}function qV({rest:e}){let t=iA(),n=Tk(`git.pulls`,{},[`git`]),r=GV(e),i=n.data?.pulls??[],a=(0,m.useCallback)(()=>{H(`git.pulls`,{refresh:!0}).then(()=>n.reload())},[n]);if(!n.data&&n.error)return(0,L.jsx)(yk,{message:`Could not load pull requests. ${n.error}`,onRetry:n.reload});if(n.data&&i.length===0)return(0,L.jsx)(KV,{loading:n.data.loading,loaded:n.data.loaded,error:n.data.error,onRetry:n.reload});let o=n.loading||!!n.data?.loading,s=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:$B,count:n.data?`${i.length} open`:void 0,children:(0,L.jsx)(X,{label:`Refresh`,icon:Kh,shortcut:`R`,disabled:o,className:q(`h-7`,o&&`[&_svg]:animate-spin`),onClick:a})}),n.data?.error?(0,L.jsxs)(`p`,{className:`px-3 pt-2 text-sm text-destructive`,children:[`✗ `,n.data.error]}):null,n.data?(0,L.jsx)(HV,{pulls:i,selectedId:r,onSelect:WV}):(0,L.jsx)(uA,{})]}),c=r===void 0?null:(0,L.jsx)(PV,{number:r,onChanged:n.reload},r);return(0,L.jsx)(cA,{wide:t,list:s,detail:c,open:r!==void 0,onClose:UV,hint:`Select a pull request to see its detail.`,describe:`Pull request detail`})}function JV(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing}function YV({label:e,hint:t,buttonLabel:n=`Send`,onSend:r}){let i=(0,m.useId)(),[a,o]=(0,m.useState)(``),[s,c]=(0,m.useState)(!1),l=async()=>{a.trim()&&!s&&(c(!0),await r(a)&&o(``),c(!1))};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium text-foreground`,children:e}),(0,L.jsx)(dA,{id:i,value:a,rows:2,"aria-describedby":t?`${i}-hint`:void 0,onChange:e=>o(e.target.value),onKeyDown:e=>{JV(e)&&(e.preventDefault(),l())}}),t?(0,L.jsx)(`p`,{id:`${i}-hint`,className:`text-xs text-muted-foreground`,children:t}):null,(0,L.jsx)(`div`,{className:`flex self-end`,children:(0,L.jsx)(X,{label:n,icon:s?nh:Pp,tone:`primary`,shortcut:`Enter`,className:s?`[&_svg]:animate-spin`:void 0,onClick:()=>void l(),disabled:!a.trim()||s})})]})}var XV=`Issues`,ZV=`Issue`,QV=`Plan it opens a planning session on this issue; save the plan as a task once the panel agrees it.`,$V=`Refresh to load open issues with the GitHub CLI (gh).`,eH=`No open issues. File one with New issue.`,tH=`loading issues from GitHub…`,nH=`issues are off (lobby.issues)`,rH=`(no description)`;function iH(e,t){return[e.state?e.state.toLowerCase():``,e.author?`by ${e.author}`:``,e.updatedAt?`updated ${gA(t-Date.parse(e.updatedAt))}`:``,e.labels.join(`, `)].filter(Boolean).join(` · `)}function aH(e,t){return[e.author?`by ${e.author}`:``,e.updatedAt?gA(t-Date.parse(e.updatedAt)):``].filter(Boolean).join(` · `)}function oH(e){return e.length>0?`[${e.slice(0,2).join(`, `)}]`:``}function sH({issue:e,now:t}){return(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:[(0,L.jsxs)(`span`,{className:`font-normal text-muted-foreground tabular-nums`,children:[`#`,e.number]}),` `,e.title]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:iH(e,t)}),e.url?(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,className:`text-xs break-all text-primary underline underline-offset-4`,children:e.url}):null]})}function cH({comment:e,now:t}){return(0,L.jsxs)(`article`,{className:`card-raised flex flex-col gap-1.5 rounded-lg border px-3.5 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:e.author??`comment`}),e.createdAt?(0,L.jsx)(`span`,{children:gA(t-Date.parse(e.createdAt))}):null]}),(0,L.jsx)(YB,{text:e.body.trim()})]})}function lH({comments:e,now:t}){return e.length===0?null:(0,L.jsx)(QB,{title:`Comments`,right:String(e.length),children:(0,L.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,n)=>(0,L.jsx)(cH,{comment:e,now:t},n))})})}function uH({issue:e}){let t=async()=>{await H(`planner.new`,{seed:{issue:{number:e.number,title:e.title,...e.url?{url:e.url}:{}},body:e.body}})&&Y(lk(`plan`))};return(0,L.jsx)(DA,{icon:Bg,label:`Plan #${e.number} with the panel`,text:`Plan it`,shortcut:`N`,title:`Plan #${e.number} with the panel?`,description:`A new planning session starts from this issue. A plan already under way waits under Plan → Previous.`,confirmLabel:`Plan it`,onConfirm:()=>void t()})}function dH({number:e}){let t=Tk(`issues.get`,{number:e},[`issues`]),n=Date.now();if(!t.data)return t.error?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load #`,e,`. `,t.error]}):(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(_k,{className:`size-3.5`}),`loading #`,e,`…`]});let r=t.data.issue;return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`${ZV} #${e}`,children:[(0,L.jsx)(Yk,{children:(0,L.jsx)(uH,{issue:r})}),(0,L.jsx)(sH,{issue:r,now:n}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:QV}),(0,L.jsx)(QB,{title:`Description`,children:r.body.trim()?(0,L.jsx)(YB,{text:r.body.trim()}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:rH})}),(0,L.jsx)(lH,{comments:r.comments,now:n})]})}function fH({issue:e,selected:t,now:n,onSelect:r}){let i=oH(e.labels);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>r(e.number),className:LV,children:[(0,L.jsxs)(`span`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:[`#`,e.number]}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.title}),i?(0,L.jsx)(`span`,{className:`max-w-full break-words text-xs text-muted-foreground`,children:i}):null]}),(0,L.jsx)(`span`,{className:`pl-9 text-xs text-muted-foreground`,children:aH(e,n)})]})})}function pH({issues:e,selectedId:t,now:n,onSelect:r}){return(0,L.jsx)(`ul`,{className:RV,children:e.map(e=>(0,L.jsx)(fH,{issue:e,selected:e.number===t,now:n,onSelect:r},e.number))})}var mH=()=>Y(lk(`issues`)),hH=e=>Y(lk(`issues`,String(e)));function gH(e){let t=Number(e[0]);return Number.isInteger(t)&&t>0?t:void 0}function _H(){return(0,L.jsx)(dk,{className:`m-4 flex-1`,children:(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(om,{"aria-hidden":`true`})}),(0,L.jsx)(hk,{children:`Issues are off`}),(0,L.jsx)(gk,{className:`font-mono`,children:nH})]})})}function vH({loading:e,loaded:t,error:n,onRetry:r}){let i=n?`✗ ${n}`:t?eH:e?tH:$V;return(0,L.jsxs)(dk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(om,{"aria-hidden":`true`})}),(0,L.jsx)(gk,{className:n?`text-destructive`:void 0,children:i})]}),n?(0,L.jsx)(J,{variant:`outline`,onClick:r,children:`Retry`}):null]})}function yH({onCreate:e}){return(0,L.jsx)(aA,{className:`shrink-0 border-t border-border p-4`,children:(0,L.jsx)(YV,{label:`New issue`,hint:`The first line becomes the title; the rest is the body. Enter files it.`,buttonLabel:`File issue`,onSend:e})})}function bH({rest:e}){let t=iA(),n=Ck(`status`).data?.issuesEnabled??!0,r=Tk(`issues.list`,{},[`issues`],n),i=gH(e),a=r.data?.issues??[],o=Date.now(),s=(0,m.useCallback)(()=>{H(`issues.list`,{refresh:!0}).then(()=>r.reload())},[r]),c=async e=>await H(`issues.create`,{text:e})?(r.reload(),!0):!1;if(!n)return(0,L.jsx)(_H,{});if(!r.data&&r.error)return r.error.includes(`issues are off`)?(0,L.jsx)(_H,{}):(0,L.jsx)(yk,{message:`Could not load issues. ${r.error}`,onRetry:r.reload});let l=r.loading||!!r.data?.loading,u=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:XV,count:r.data?`${a.length} open`:void 0,children:(0,L.jsx)(X,{label:`Refresh`,icon:Kh,shortcut:`R`,disabled:l,className:q(`h-7`,l&&`[&_svg]:animate-spin`),onClick:s})}),r.data?.error?(0,L.jsxs)(`p`,{className:`px-3 pt-2 text-sm text-destructive`,children:[`✗ `,r.data.error]}):null,r.data?(0,L.jsx)(pH,{issues:a,selectedId:i,now:o,onSelect:hH}):(0,L.jsx)(uA,{}),(0,L.jsx)(yH,{onCreate:c})]}),d=i===void 0?null:(0,L.jsx)(dH,{number:i},i),f=r.data&&a.length===0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vH,{loading:r.data.loading,loaded:r.data.loaded,error:r.data.error,onRetry:r.reload}),(0,L.jsx)(`div`,{className:`shrink-0 pb-dock`,children:(0,L.jsx)(yH,{onCreate:c})})]}):(0,L.jsx)(cA,{wide:t,list:u,detail:d,open:i!==void 0,onClose:mH,hint:`Select an issue to read it.`,describe:`Issue detail`});return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:f})}function xH(e){let t=(0,m.useRef)(null),n=(0,m.useRef)(!0),[r,i]=(0,m.useState)(!0),a=(0,m.useRef)(void 0),o=(0,m.useRef)(null),s=(0,m.useCallback)(()=>{n.current=!0,i(!0);let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[]);return(0,m.useLayoutEffect)(()=>{n.current&&s()},[e,s]),(0,m.useLayoutEffect)(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(()=>{n.current&&(e.scrollTop=e.scrollHeight)});return r.observe(e),a.current=r,()=>{r.disconnect(),a.current=void 0,o.current=null}},[]),(0,m.useLayoutEffect)(()=>{let e=a.current,n=t.current?.firstElementChild??null;e&&n!==o.current&&(o.current&&e.unobserve(o.current),n&&e.observe(n),o.current=n)},[e]),{ref:t,atBottom:r,stick:s,onScroll:(0,m.useCallback)(()=>{let e=t.current;e&&(n.current=e.scrollHeight-e.scrollTop-e.clientHeight<48,i(n.current))},[])}}var SH={DEV:vm,DESIGN:Eh,QA:cg,RESEARCH:bg,"QUICK FIX":Wg,SCOUT:bm,PLANNER:eg,CLASSIFIER:vg,LOBBY:mh,LINT:Qm};function CH(e){return e?SH[e.toUpperCase()]??Rp:Bp}function wH(e){let t=e?.toUpperCase();return t===`ORACLE`||t===`MASTER`}function TH({source:e,className:t,strokeWidth:n}){if(wH(e))return(0,L.jsx)(`span`,{"aria-hidden":`true`,"data-agent-icon":e,className:q(`agent-oracle shrink-0`,t)});let r=CH(e);return(0,L.jsx)(r,{"aria-hidden":`true`,"data-agent-icon":e??`thinking`,strokeWidth:n,className:q(`shrink-0`,t)})}var EH={MASTER:`text-primary`,DEV:`text-source-dev`,DESIGN:`text-source-design`,QA:`text-source-qa`,RESEARCH:`text-source-research`,"QUICK FIX":`text-source-quickfix`,ORACLE:`text-primary`,LOBBY:`text-muted-foreground`};function DH(e){return e.length<=2?e:e.charAt(0)+e.slice(1).toLowerCase()}function OH(e){return EH[e]??`text-muted-foreground`}var kH={MASTER:`var(--primary)`,DEV:`var(--source-dev)`,DESIGN:`var(--source-design)`,QA:`var(--source-qa)`,RESEARCH:`var(--source-research)`,"QUICK FIX":`var(--source-quickfix)`,ORACLE:`var(--primary)`,LOBBY:`var(--muted-foreground)`};function AH(e){return kH[e]??`var(--muted-foreground)`}function jH(e){if(e.role===`researcher`)return`RESEARCH`;let t=e.domain??e.role;return t===`backend`||t===`dev`?`DEV`:t===`designer`||t===`design`?`DESIGN`:t===`researcher`||t===`research`?`RESEARCH`:t===`qa`?`QA`:t?String(t).toUpperCase():`AGENT`}function MH(e){return e?.runs??[]}function NH(e,t=40){let n=new Map;for(let t of e)n.set(t.source,t);return[...n.values()].sort((e,t)=>e.at-t.at).slice(-t)}function PH({source:e,live:t}){let n=wH(e);return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`chat-avatar`,"data-live":t||void 0,"data-oracle":n||void 0,style:{"--orb":AH(e)},children:(0,L.jsx)(TH,{source:e,strokeWidth:2.25,className:n?`size-7`:`size-3.5`})})}function FH({source:e,name:t,time:n,head:r,live:i,children:a,aside:o,bubble:s=!0}){return(0,L.jsxs)(`div`,{className:`chat-row group/msg`,children:[(0,L.jsx)(`div`,{className:`chat-gutter`,children:r?(0,L.jsx)(PH,{source:e,live:i}):n?(0,L.jsx)(`time`,{className:`chat-hover-time`,children:n}):null}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,L.jsxs)(`p`,{className:`chat-speaker`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),n?(0,L.jsx)(`time`,{className:`text-xs text-muted-foreground tabular-nums`,children:n}):null,o?(0,L.jsx)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:o}):null]}):null,s?(0,L.jsx)(`div`,{className:`chat-bubble-agent`,style:{"--orb":AH(e)},children:a}):a]})]})}function IH({time:e,head:t,note:n,children:r,below:i}){return(0,L.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[t?(0,L.jsxs)(`p`,{className:`flex items-baseline gap-2 text-xs text-muted-foreground`,children:[e?(0,L.jsx)(`time`,{className:`tabular-nums`,children:e}):null,(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:`You`}),n?(0,L.jsx)(`span`,{children:n}):null]}):null,(0,L.jsx)(`div`,{className:`chat-bubble`,children:r}),i]})}function LH({failed:e,children:t}){return(0,L.jsx)(`div`,{role:`note`,className:q(`chat-note`,e&&`text-destructive`),children:(0,L.jsx)(`span`,{children:t})})}function RH({className:e}){return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:q(`typing-dots`,e),children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{})]})}var zH=3e5,BH=`No task is running in this session.`,VH=`Type a request below and press enter to start one: the oracle scouts, proposes, plans and delegates.`,HH=`Nothing said yet. Type below to talk to the oracle about this task.`;function UH({entry:e}){return(0,L.jsxs)(LH,{failed:e.text.startsWith(`✗`),children:[e.text,e.at?` · ${pA(e.at)}`:``]})}function WH({entry:e,head:t}){if(e.role===`you`)return(0,L.jsx)(IH,{time:pA(e.at),head:t,children:(0,L.jsx)(YB,{text:e.text})});let n=e.role===`panel`;return(0,L.jsx)(FH,{source:n?`PLANNER`:`ORACLE`,name:n?`Panel`:`Oracle`,time:pA(e.at),head:t,children:(0,L.jsx)(YB,{text:e.text})})}var GH=(0,m.memo)(function({entry:e,head:t,fresh:n}){return(0,L.jsx)(z.div,{initial:n?{opacity:0,y:10}:!1,animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:420,damping:32},children:e.role===`note`?(0,L.jsx)(UH,{entry:e}):(0,L.jsx)(WH,{entry:e,head:t})})},(e,t)=>e.head===t.head&&e.entry.id===t.entry.id&&e.entry.text===t.entry.text&&e.entry.at===t.entry.at);function KH({text:e,busy:t}){let n=!!e?.trim();return!n&&!t?null:(0,L.jsx)(FH,{source:`ORACLE`,name:`Oracle`,head:!0,live:t,aside:t&&n?`writing…`:void 0,children:n?(0,L.jsx)(YB,{text:e??``}):(0,L.jsx)(RH,{className:`mt-1`})})}function qH({hasTask:e}){return(0,L.jsxs)(dk,{className:`h-full border-0`,children:[(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(fh,{"aria-hidden":`true`})}),e?null:(0,L.jsx)(hk,{children:BH}),(0,L.jsx)(gk,{children:e?HH:VH})]}),e?null:(0,L.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-muted-foreground`,children:[(0,L.jsxs)(`li`,{className:`flex items-center justify-center gap-2`,children:[`Or plan it first with the whole panel in `,(0,L.jsx)(GO,{chord:`3`}),` Plan`]}),(0,L.jsxs)(`li`,{className:`flex items-center justify-center gap-2`,children:[`or make a direct change in `,(0,L.jsx)(GO,{chord:`4`}),` Quick fix`]})]})]})}async function JH(e){let t=await De(`lobby.history`,{before:e});return{entries:t.entries,hasOlder:t.hasOlder}}function YH(e,t,n){let[r,i]=(0,m.useState)([]),[a,o]=(0,m.useState)(t),[s,c]=(0,m.useState)(!1),l=(0,m.useMemo)(()=>{let t=new Set(e.map(e=>e.id));return[...r.filter(e=>!t.has(e.id)),...e]},[r,e]);return{merged:l,more:a,loading:s,load:(0,m.useCallback)(async()=>{let e=l[0]?.id;if(e===void 0||s||!a)return;c(!0);let t=n.current,r=t?.scrollHeight??0,u=t?.scrollTop??0;try{let t=await JH(e);i(e=>[...t.entries,...e]),o(t.hasOlder),window.requestAnimationFrame(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight-r+u)})}catch{o(!1)}finally{c(!1)}},[l,s,a,n])}}function XH({chat:e,reply:t,busy:n,hasOlder:r,hasTask:i}){let{ref:a,atBottom:o,stick:s,onScroll:c}=xH(e.length+(t?.length??0)),{merged:l,more:u,loading:d,load:f}=YH(e,r,a),p=(0,m.useCallback)(()=>{c();let e=a.current;e&&e.scrollTop<80&&u&&!d&&f()},[c,a,u,d,f]),h=l.length===0&&!t?.trim()&&!n,[g,_]=(0,m.useState)(!1);return(0,m.useEffect)(()=>_(!0),[]),(0,L.jsxs)(XB,{"aria-label":`Conversation`,className:`flex-1`,children:[(0,L.jsx)(`div`,{ref:a,onScroll:p,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-5 pt-4 pb-dock outline-none focus-visible:bg-muted/30`,role:`log`,"aria-label":`Conversation`,tabIndex:0,children:h?(0,L.jsx)(qH,{hasTask:i}):(0,L.jsxs)(`div`,{className:`chat-column`,children:[u?(0,L.jsx)(`p`,{className:`mb-4 text-center text-xs text-muted-foreground`,children:`Earlier messages load as you scroll up.`}):null,l.map((e,t)=>{let n=l[t-1],r=!n||n.role!==e.role||e.at-n.at>zH;return(0,L.jsx)(GH,{entry:e,head:r,fresh:g},e.id)}),(0,L.jsx)(KH,{text:t,busy:n})]})}),o?null:(0,L.jsx)(`div`,{className:`absolute right-4 bottom-dock z-10`,children:(0,L.jsx)(X,{label:`Jump to latest`,text:`Latest`,icon:Op,tone:`primary`,className:`rounded-full shadow-sm`,onClick:s})})]})}function ZH(e){let t=e[0]===`ask`,[n,r]=t?e.slice(1):e;return{chat:t,agent:n,file:r}}function QH(e,t){let{agent:n,file:r}=ZH(e);return lk(`knowledge`,...t?[`ask`]:[],n??``,r??``)}var $H=[`master`,`designer`,`backend`,`qa`],eU={master:`Master (oracle)`,designer:`Designer`,backend:`Backend`,qa:`QA`},tU={master:`Master`,designer:`Designer`,backend:`Backend`,qa:`QA`},nU=`Every write archives the version before it.`;function rU(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}function iU(e){return`over the compaction threshold — ask the oracle to compact ${e}`}function aU(e){return{text:e.text,occurrence:e.occurrence}}function oU(e){return $H.map(t=>{let n=e.filter(e=>e.agent===t);return{agent:t,files:n,notes:n.reduce((e,t)=>e+t.notes,0)}}).filter(e=>e.files.length>0)}function sU(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing}function cU({initial:e,busy:t,onSave:n,onCancel:r}){let[i,a]=(0,m.useState)(e),o=()=>{!t&&i.trim()&&n(i)};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-input p-3`,children:[(0,L.jsx)(`label`,{htmlFor:`knowledge-entry`,className:`text-sm font-medium text-foreground`,children:`Edit entry`}),(0,L.jsx)(dA,{id:`knowledge-entry`,value:i,rows:4,autoFocus:!0,onChange:e=>a(e.target.value),onKeyDown:e=>{sU(e)&&(e.preventDefault(),o())}}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:nU}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(J,{variant:`outline`,onClick:r,disabled:t,children:`Cancel`}),(0,L.jsxs)(J,{onClick:o,disabled:t||!i.trim(),children:[t?(0,L.jsx)(_k,{}):null,`Save`]})]})]})]})}function lU({open:e,file:t,initial:n,busy:r,onClose:i,onSave:a}){let[o,s]=(0,m.useState)(n),c=tk(e,ek.confirm);return(0,L.jsx)(qO,{open:e&&c,onOpenChange:e=>!e&&i(),label:`Edit ${t}`,description:nU,dismissOnBackdrop:!1,className:`max-w-3xl`,children:(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`h2`,{className:`text-base font-medium`,children:[`Edit `,t]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:nU})]}),(0,L.jsx)(dA,{value:o,rows:14,className:`min-h-0 flex-1 font-mono text-sm`,onChange:e=>s(e.target.value)}),(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(J,{variant:`outline`,onClick:i,disabled:r,children:`Cancel`}),(0,L.jsxs)(J,{onClick:()=>a(o),disabled:r,children:[r?(0,L.jsx)(_k,{}):null,`Save file`]})]})]})})}function uU({note:e,about:t,onTakeBack:n,busy:r}){let i=t?`about "${t.replace(/\s+/g,` `).trim().slice(0,50)}": ${e.text}`:e.text;return(0,L.jsxs)(`li`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(Ih,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:i}),(0,L.jsx)(X,{label:`Take the note back`,icon:Og,iconOnly:!0,className:`-my-1 size-7`,disabled:r,onClick:()=>n(e.id)})]})}function dU({entry:e,index:t,selected:n,notes:r,onPick:i,onTakeBack:a,busy:o}){let s=()=>i(t);return(0,L.jsxs)(`li`,{role:`button`,tabIndex:0,"aria-pressed":n,onClick:s,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},className:n?`flex min-h-9 cursor-pointer flex-col gap-1 rounded-lg border border-primary/30 bg-accent px-3 py-2.5 outline-none focus-visible:ring-3 focus-visible:ring-ring/40`:`flex min-h-9 cursor-pointer flex-col gap-1 rounded-lg border border-border px-3 py-2.5 outline-none transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(`div`,{className:`flex gap-2`,children:(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(YB,{text:e.text})})}),r.length>0?(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 pl-1`,children:r.map(e=>(0,L.jsx)(uU,{note:e,onTakeBack:a,busy:o},e.id))}):null]})}function fU({notes:e,onTakeBack:t,busy:n}){return e.length===0?null:(0,L.jsx)(QB,{title:`Notes on entries that changed`,right:String(e.length),children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,L.jsx)(uU,{note:e,about:e.entry,onTakeBack:t,busy:n},e.id))})})}function pU({view:e}){let t=e.entries.length;return(0,L.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:[tU[e.agent],` `,(0,L.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.file]})]}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t,` `,t===1?`entry`:`entries`,` · `,rU(e.chars),` chars`]}),e.over?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:iU(e.file)}):null]})}function mU({draft:e,picked:t,setDraft:n,onEditFile:r,onDelete:i}){let a=!!e;return(0,L.jsxs)(Yk,{children:[(0,L.jsx)(X,{label:`Edit the entry`,text:`Edit`,icon:Bh,shortcut:`E`,disabled:a||!t,onClick:()=>n({kind:`edit`,entry:t})}),(0,L.jsx)(X,{label:t?`Add an entry after it`:`Add an entry`,text:`Add`,icon:Wh,shortcut:`A`,disabled:a,onClick:()=>n({kind:`add`,entry:t})}),(0,L.jsx)(X,{label:`Comment on the entry`,text:`Comment`,icon:uh,shortcut:`C`,disabled:a||!t,onClick:()=>n({kind:`comment`,entry:t})}),(0,L.jsx)(X,{label:`Edit the whole file`,text:`Edit file`,icon:Am,shortcut:`F`,disabled:a,onClick:r}),(0,L.jsx)(DA,{icon:wg,label:`Delete the entry`,text:`Delete`,shortcut:`Delete`,title:`Delete this entry?`,description:`The entry and its notes are removed. The version before is archived.`,confirmLabel:`Delete entry`,variant:`destructive`,disabled:a||!t,onConfirm:i})]})}function hU({agent:e,file:t,onChanged:n}){let r=Tk(`knowledge.open`,{agent:e,file:t},[`knowledge`]),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),f=r.data?.view,p=f?.entries??[],h=p[Math.min(i,Math.max(0,p.length-1))],g=async e=>{d(!0),await e(),s(void 0),r.reload(),n(),d(!1)},_=e=>void g(()=>H(`knowledge.unnote`,{id:e})),v=()=>{h&&g(()=>H(`knowledge.remove`,{agent:e,file:t,ref:aU(h)}))},y=n=>{let r=o?.entry;if(o?.kind===`edit`&&r)return void g(()=>H(`knowledge.edit`,{agent:e,file:t,ref:aU(r),text:n}));if(o?.kind===`comment`&&r)return void g(()=>H(`knowledge.comment`,{agent:e,file:t,ref:aU(r),text:n}));g(()=>H(`knowledge.add`,{agent:e,file:t,...h?{ref:aU(h)}:{},text:n}))};return f?(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`${tU[e]} ${t}`,children:[(0,L.jsx)(mU,{draft:o,picked:h,setDraft:s,onEditFile:()=>l(!0),onDelete:v}),(0,L.jsx)(pU,{view:f}),p.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing here yet. Add the first entry below.`}):null,(0,L.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map((e,t)=>(0,L.jsx)(dU,{entry:e,index:t,selected:t===i,notes:f.attached.filter(t=>t.entry===e.text),onPick:a,onTakeBack:_,busy:u},`${t}-${e.text}`))}),o?.kind===`edit`?(0,L.jsx)(cU,{initial:o.entry.text,busy:u,onSave:y,onCancel:()=>s(void 0)}):null,o?.kind===`comment`?(0,L.jsx)(YV,{label:`Comment on this entry`,hint:nU,buttonLabel:`Add note`,onSend:async e=>(y(e),!0)}):null,o?.kind===`add`?(0,L.jsx)(YV,{label:`Add an entry`,hint:nU,buttonLabel:`Add entry`,onSend:async e=>(y(e),!0)}):null,u&&!o?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(_k,{}),` saving…`]}):null,(0,L.jsx)(fU,{notes:f.detached,onTakeBack:_,busy:u}),(0,L.jsx)(lU,{open:c,file:t,initial:f.content,busy:u,onClose:()=>l(!1),onSave:n=>{l(!1),g(()=>H(`knowledge.replaceFile`,{agent:e,file:t,text:n}))}})]}):r.error?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not read the file. `,r.error]}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`reading…`})}function gU(e){return`${e.agent}/${e.file}`}var _U={master:`ORACLE`,designer:`DESIGN`,backend:`DEV`,qa:`QA`},vU=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function yU({info:e}){return(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-xs text-muted-foreground tabular-nums`,children:[(0,L.jsx)(`span`,{children:rU(e.chars)}),e.over?(0,L.jsx)(`span`,{className:`text-foreground`,children:`· over`}):null,e.notes>0?(0,L.jsx)(`span`,{className:`text-primary`,children:vU(e.notes,`note`)}):null]})}function bU({info:e,selected:t,onSelect:n}){return(0,L.jsx)(`li`,{className:`ktree-leaf`,children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(gU(e)),className:q(LV,`ktree-file min-h-9 flex-row items-center gap-2 py-1.5`),children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`ktree-bud`}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 truncate text-sm text-foreground`,t&&`font-medium`),children:e.label}),(0,L.jsx)(yU,{info:e})]})})}var xU=`bot-lobby.knowledge.folded`;function SU(){try{let e=JSON.parse(window.localStorage.getItem(xU)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function CU({files:e,models:t={},selectedKey:n,onSelect:r}){let[i,a]=(0,m.useState)(SU),o=oU(e),s=e.reduce((e,t)=>e+t.notes,0);function c(e,t){a(n=>{let r=t?n.filter(t=>t!==e):[...new Set([...n,e])];try{window.localStorage.setItem(xU,JSON.stringify(r))}catch{}return r})}return(0,L.jsxs)(`div`,{className:`ktree px-3 pt-1 pb-3`,children:[(0,L.jsxs)(`p`,{className:`ktree-root`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`card-raised grid size-8 shrink-0 place-items-center rounded-lg border text-primary`,children:(0,L.jsx)(Ip,{className:`size-4`})}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium`,children:`Project knowledge`}),(0,L.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[vU(e.length,`file`),` · `,vU(o.length,`agent`),s>0?` · ${vU(s,`note`)}`:``]})]})]}),(0,L.jsx)(`ul`,{className:`ktree-branches`,"aria-label":`Agents and their knowledge`,children:o.map(e=>{let a=!i.includes(e.agent),o=_U[e.agent],s=`knowledge-${e.agent}`,l=t[e.agent];return(0,L.jsxs)(`li`,{className:`ktree-branch`,style:{"--orb":AH(o)},children:[(0,L.jsx)(`h3`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space ArrowLeft ArrowRight`,"aria-describedby":`focused-action-help`,type:`button`,"aria-expanded":a,"aria-controls":s,onClick:()=>c(e.agent,!a),onKeyDown:t=>{t.key===`ArrowLeft`||t.key===`h`?(t.preventDefault(),t.stopPropagation(),c(e.agent,!1)):(t.key===`ArrowRight`||t.key===`l`)&&(t.preventDefault(),t.stopPropagation(),a||c(e.agent,!0))},className:`ktree-node`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`ktree-tile`,children:(0,L.jsx)(TH,{source:o,strokeWidth:2.25,className:o===`ORACLE`?`size-5`:`size-3.5`})}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:eU[e.agent]}),l?(0,L.jsxs)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`runs on `}),l]}):null]}),(0,L.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[e.notes>0?(0,L.jsxs)(`span`,{className:`text-primary`,children:[vU(e.notes,`note`),` · `]}):null,vU(e.files.length,`file`)]}),(0,L.jsx)(Jp,{"aria-hidden":`true`,className:q(`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ease-snap`,a&&`rotate-90`)})]})}),(0,L.jsx)(Ou,{initial:!1,children:a?(0,L.jsx)(z.ul,{id:s,"aria-label":`${eU[e.agent]}'s knowledge`,initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{type:`spring`,stiffness:520,damping:42},className:`ktree-leaves`,children:e.files.map(e=>(0,L.jsx)(bU,{info:e,selected:gU(e)===n,onSelect:r},gU(e)))},`files`):null})]},e.agent)})})]})}var wU=()=>Y(lk(`knowledge`)),TU=e=>{let[t,n]=e.split(`/`);Y(lk(`knowledge`,t??``,n??``))};function EU(){return(0,L.jsx)(dk,{className:`m-4 flex-1`,children:(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(Ip,{"aria-hidden":`true`})}),(0,L.jsx)(gk,{children:`No knowledge files yet.`})]})})}function DU(e,t,n,r){let i=e.find(e=>e.agent===t&&e.file===n);return i?(0,L.jsx)(hU,{agent:i.agent,file:i.file,onChanged:r},gU(i)):t&&n?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That file is not on the list any more.`}):null}function OU(){let e=Ck(`lobby`),t=Ck(`status`),n=e.data,r=t.data?.busy??!1;return!n?.chat.length&&!n?.reply&&!r?(0,L.jsx)(`p`,{className:`m-auto max-w-md px-5 pb-dock text-center text-sm text-muted-foreground`,children:`Ask about this project below. The oracle checks saved knowledge, searches the codebase for missing information, and saves verified findings.`}):(0,L.jsx)(XH,{chat:n?.chat??[],reply:n?.reply,busy:r,hasOlder:n?.hasOlderChat??!1,hasTask:!!n?.task})}function kU({read:e,selected:t}){let n=e.data?.files.reduce((e,t)=>e+t.notes,0)??0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:`Knowledge`,count:n>0?`${n} note${n===1?``:`s`}`:void 0}),(0,L.jsx)(AU,{read:e,selected:t})]})}function AU({read:e,selected:t}){return!e.data&&e.error?(0,L.jsx)(yk,{message:`Could not load the knowledge files. ${e.error}`,onRetry:e.reload}):e.data?e.data.files.length?(0,L.jsx)(CU,{files:e.data.files,models:e.data.models??{},selectedKey:t,onSelect:TU}):(0,L.jsx)(EU,{}):(0,L.jsx)(uA,{})}function jU({rest:e}){let{chat:t,agent:n,file:r}=ZH(e),i=iA(),a=Tk(`knowledge.files`,{},[`knowledge`]),o=a.data?.files??[],s=o.find(e=>e.agent===n&&e.file===r);return(0,L.jsx)(cA,{wide:i,inlineDetail:!0,list:(0,L.jsx)(kU,{read:a,selected:s?gU(s):void 0}),detail:t?(0,L.jsx)(OU,{}):DU(o,n,r,a.reload),detailClassName:t?`flex flex-col overflow-hidden p-0`:void 0,open:t||!!(n&&r),onClose:wU,hint:`Select a file to read its entries, or ask about the project below.`,describe:t?`Knowledge chat`:`Knowledge file`})}function MU(e){let t=e[0]===`board`,n=e[+!!t];try{return{board:t,id:n?decodeURIComponent(n):void 0}}catch{return{board:t,id:n}}}function NU({className:e,...t}){return(0,L.jsx)(bC,{"aria-keyshortcuts":`Space`,"aria-description":`When focused, press Space to toggle.`,"data-slot":`checkbox`,className:q(`peer relative flex size-[1.125rem] shrink-0 items-center justify-center rounded-[5px] border border-input bg-background text-primary-foreground transition-colors duration-150 outline-none before:absolute before:-inset-3 before:content-[''] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary`,e),...t,children:(0,L.jsx)(SC,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center`,children:(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3`,strokeWidth:3})})})}var PU=`Sessions`,FU=`No sessions yet.`,IU=`Up to 5 sessions; each can be assigned to one agent or several.`,LU=`A session is a live Excalidraw room that you and your agents draw in together.`,RU=[{title:`Start a live room`,text:`In Excalidraw: Share → Live collaboration → Start session.`},{title:`Add it here`,text:`Paste the room link, or make a new room and open it in Excalidraw.`},{title:`Assign agents`,text:`They read the board and draw on it, under their own name.`}],zU=`Sessions`,BU=`Pick a session on the left to see its link, its room and its agents.`,VU=`Room link`,HU=`Masked until revealed. A revealed link stays in this tab and is never saved.`,UU=`Room`,WU=`Drawing`,GU=`Last check`,KU=`not checked yet`,qU=`Add a session`,JU=`https://excalidraw.com/#room=…`,YU=`Optional name`;function XU(e){return`${e} of 5 in use`}var ZU=`Agents may draw here.`,QU=`Agents may only look.`,$U=`checking the room…`,eW=`Check that the room can be reached.`,tW=`Assigned to`,nW=`Assigned agents read the board and draw on it with excalidraw_read and excalidraw_draw, and appear in the room under their own name.`,rW=`Add or rename`,iW=`Add by link`,aW=`In Excalidraw, Share → Live collaboration → Start session, then paste the link. Enter adds it.`,oW=`New room`,sW=`Makes a fresh room link to open in Excalidraw; the name is optional.`,cW=`Rename`,lW=`draw`,uW=`look only`,dW=`Copied to the clipboard`,fW=`Could not reveal the link.`,pW=[`master`,`designer`,`backend`,`qa`,`scout`,`researcher`,`quickfix`,`planner`],mW={master:`Master (oracle)`,designer:`Designer`,backend:`Backend`,qa:`QA`,scout:`Scouts`,researcher:`Researcher`,quickfix:`Quick fix`,planner:`Planner`};function hW(e){return e===0?`no agents`:`${e} agent${e===1?``:`s`}`}function gW(e){return e?e.ok?`✓`:`!`:``}function _W({title:e,right:t,className:n,children:r}){return(0,L.jsxs)(`section`,{className:q(`card-raised flex min-w-0 flex-col gap-3 rounded-xl border p-4`,n),children:[(0,L.jsxs)(`header`,{className:`flex items-baseline justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:e}),t?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t}):null]}),r]})}function vW({row:e=!1}){return(0,L.jsx)(`ol`,{className:q(`grid gap-3`,e&&`@2xl:grid-cols-3`),children:RU.map((e,t)=>(0,L.jsxs)(`li`,{className:`card-raised flex gap-3 rounded-xl border p-3.5`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-6 shrink-0 place-items-center rounded-full bg-accent text-xs font-semibold text-primary tabular-nums`,children:t+1}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.title}),(0,L.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.text})]})]},e.title))})}function yW({label:e,hint:t,buttonLabel:n,placeholder:r,initial:i=``,required:a,mono:o,primary:s,onSubmit:c}){let l=(0,m.useId)(),[u,d]=(0,m.useState)(i),[f,p]=(0,m.useState)(!1),h=a&&!u.trim(),g=async()=>{h||f||(p(!0),await c(u)&&d(i),p(!1))};return(0,L.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-2`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,L.jsx)(`label`,{htmlFor:l,className:`text-xs font-medium text-muted-foreground`,children:e}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`input`,{id:l,value:u,maxLength:o?2e3:80,placeholder:r,"aria-describedby":t?`${l}-hint`:void 0,onChange:e=>d(e.target.value),className:q(`h-8 min-w-0 flex-1 rounded-lg border border-input bg-background px-3 text-sm outline-none transition-[border-color,box-shadow] placeholder:text-muted-foreground/70 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30`,o&&`font-mono text-[0.8125rem]`)}),(0,L.jsx)(X,{type:`submit`,label:n,icon:f?nh:Wh,tone:s?`primary`:`neutral`,shortcut:`Enter`,disabled:h||f,className:f?`[&_svg]:animate-spin`:void 0})]}),t?(0,L.jsx)(`p`,{id:`${l}-hint`,className:`text-xs leading-relaxed text-muted-foreground`,children:t}):null]})}function bW({onChanged:e,primary:t}){return(0,L.jsx)(yW,{label:iW,hint:aW,buttonLabel:`Add`,placeholder:JU,required:!0,mono:!0,primary:t,onSubmit:async t=>await H(`excalidraw.add`,{link:t.trim()})?(e(),!0):!1})}function xW({onChanged:e,primary:t}){return(0,L.jsx)(yW,{label:oW,hint:sW,buttonLabel:`Create`,placeholder:YU,primary:t,onSubmit:async t=>{let n=t.trim();return await H(`excalidraw.create`,n?{name:n}:{})?(e(),!0):!1}})}function SW({onChanged:e,stacked:t=!1}){return(0,L.jsxs)(`div`,{className:q(`grid gap-4`,!t&&`@2xl:grid-cols-2`),children:[(0,L.jsx)(bW,{onChanged:e,primary:!0}),(0,L.jsx)(xW,{onChanged:e,primary:!0})]})}function CW({session:e,onChanged:t}){return(0,L.jsx)(yW,{label:cW,initial:e.name,required:!0,buttonLabel:cW,onSubmit:async n=>await H(`excalidraw.rename`,{id:e.id,name:n.trim()})?(t(),!0):!1},e.name)}function wW({icon:e,tone:t=`muted`,children:n}){return(0,L.jsxs)(`span`,{className:q(`inline-flex h-6 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium`,t===`primary`?`bg-accent text-primary`:t===`warning`?`bg-warning/10 text-warning`:`bg-muted text-muted-foreground`),children:[(0,L.jsx)(e,{"aria-hidden":`true`,className:`size-3.5`}),n]})}function TW({check:e,checking:t}){return t?(0,L.jsx)(wW,{icon:nh,children:$U}):e?e.ok?(0,L.jsx)(wW,{icon:nm,tone:`primary`,children:`reachable`}):(0,L.jsx)(wW,{icon:em,tone:`warning`,children:`unreachable`}):(0,L.jsx)(wW,{icon:im,children:KU})}function EW({label:e,children:t}){return(0,L.jsxs)(`div`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] items-baseline gap-3 text-sm`,children:[(0,L.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,L.jsx)(`dd`,{className:`min-w-0`,children:t})]})}function DW({check:e,checking:t}){return t?(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,L.jsx)(_k,{className:`size-3.5`,"aria-hidden":`true`}),$U]}):e?(0,L.jsxs)(`span`,{className:e.ok?`text-primary`:`text-foreground`,children:[e.ok?`✓`:`!`,` `,e.text]}):(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:eW})}function OW({agent:e,on:t,onToggle:n}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`label`,{className:q(`flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-lg border px-2.5 text-sm transition-[background-color,border-color,color]`,t?`border-primary/25 bg-accent text-foreground`:`border-border text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,L.jsx)(NU,{checked:t,onCheckedChange:()=>n(e)}),(0,L.jsx)(`span`,{className:`truncate`,children:mW[e]})]})})}function kW({session:e,onChanged:t}){let n=async n=>{await H(`excalidraw.toggleAgent`,{id:e.id,agent:n})&&t()},r=async()=>{await H(`excalidraw.toggleAll`,{id:e.id})&&t()},i=e.agents.length===pW.length;return(0,L.jsxs)(_W,{title:tW,right:hW(e.agents.length),children:[(0,L.jsx)(`ul`,{className:`grid grid-cols-1 gap-1.5 @md:grid-cols-2`,children:pW.map(t=>(0,L.jsx)(OW,{agent:t,on:e.agents.includes(t),onToggle:n},t))}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsx)(`p`,{className:`min-w-0 flex-1 text-xs leading-relaxed text-muted-foreground`,children:nW}),(0,L.jsx)(X,{label:i?`Take every agent off`:`Assign every agent`,icon:Qm,onClick:()=>void r()})]})]})}function AW({session:e,check:t,checking:n,onCheck:r,onChanged:i,onRemove:a}){let[o,s]=(0,m.useState)(),c=async()=>{try{s((await De(`excalidraw.reveal`,{id:e.id})).link)}catch(e){V.error(e instanceof Error?e.message:fW)}},l=()=>void navigator.clipboard?.writeText(o??``).then(()=>V(dW)).catch(()=>void 0),u=async()=>{await H(`excalidraw.toggleContribute`,{id:e.id})&&i()};return(0,L.jsxs)(`article`,{"aria-label":`Session detail`,className:`@container flex flex-col gap-4`,children:[(0,L.jsxs)(Yk,{children:[o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(X,{label:`Copy the link`,text:`Copy`,icon:Sm,shortcut:`C`,onClick:l}),(0,L.jsx)(X,{label:`Open board`,icon:Em,tone:`primary`,shortcut:`O`,href:o})]}):(0,L.jsx)(X,{label:`Reveal the link`,text:`Reveal`,icon:Om,shortcut:`R`,onClick:()=>void c()}),(0,L.jsx)(X,{label:e.contribute?`Look only: agents stop drawing`:`Let agents draw`,text:e.contribute?`Look only`:`Let agents draw`,icon:e.contribute?Rh:Bh,shortcut:`W`,pressed:e.contribute,onClick:()=>void u()}),(0,L.jsx)(X,{label:`Check the room`,text:`Check`,icon:n?nh:cg,shortcut:`T`,disabled:n,onClick:r}),(0,L.jsx)(DA,{icon:wg,label:`Remove the session`,text:`Remove`,shortcut:`Delete`,title:`Remove "${e.name}"?`,description:`Agents lose this session at once; the Excalidraw room itself is not touched.`,confirmLabel:`Remove session`,variant:`destructive`,onConfirm:a})]}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:e.name}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,L.jsx)(wW,{icon:e.contribute?Bh:Om,tone:e.contribute?`primary`:`muted`,children:e.contribute?lW:uW}),(0,L.jsx)(wW,{icon:Mg,children:hW(e.agents.length)}),(0,L.jsx)(TW,{check:t,checking:n})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,L.jsxs)(_W,{title:VU,children:[(0,L.jsx)(`p`,{className:`rounded-lg border border-border bg-muted px-3 py-2 font-mono text-[0.8125rem] break-all text-foreground`,children:o??e.masked}),(0,L.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:HU})]}),(0,L.jsx)(_W,{title:UU,children:(0,L.jsxs)(`dl`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(EW,{label:WU,children:(0,L.jsx)(`span`,{className:e.contribute?`text-primary`:`text-muted-foreground`,children:e.contribute?ZU:QU})}),(0,L.jsx)(EW,{label:GU,children:(0,L.jsx)(DW,{check:t,checking:n})})]})})]}),(0,L.jsx)(kW,{session:e,onChanged:i})]}),(0,L.jsx)(_W,{title:rW,children:(0,L.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-3`,children:[(0,L.jsx)(CW,{session:e,onChanged:i}),(0,L.jsx)(bW,{onChanged:i}),(0,L.jsx)(xW,{onChanged:i})]})})]})}function jW({check:e,checking:t}){if(t)return(0,L.jsx)(_k,{className:`size-3.5 shrink-0 text-muted-foreground`});let n=gW(e);return n?(0,L.jsx)(`span`,{className:q(`w-3.5 shrink-0 text-center`,e?.ok?`text-primary`:`text-foreground`),"aria-hidden":`true`,children:n}):(0,L.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`})}function MW({session:e,check:t,checking:n,selected:r,onSelect:i}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":r?`true`:void 0,onClick:()=>i(e.id),className:LV,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(jW,{check:t,checking:n}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,r&&`font-medium`),children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:hW(e.agents.length)})]}),(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 pl-[1.375rem] text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-mono break-all`,children:e.masked}),(0,L.jsx)(IV,{variant:`secondary`,children:e.contribute?lW:uW})]})]})})}function NW({sessions:e,checks:t,checking:n,selectedId:r,onSelect:i}){return(0,L.jsx)(`ul`,{className:RV,children:e.map(e=>(0,L.jsx)(MW,{session:e,check:t[e.id],checking:n.includes(e.id),selected:e.id===r,onSelect:i},e.id))})}var PW=()=>Y(lk(`excalidraw`)),FW=e=>Y(lk(`excalidraw`,e));function IW({count:e}){return(0,L.jsxs)(`span`,{className:`flex items-center gap-2.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1`,children:Array.from({length:5},(t,n)=>(0,L.jsx)(`span`,{className:q(`h-1.5 w-5 rounded-full`,n<e?`bg-primary`:`bg-border`)},n))}),(0,L.jsx)(`span`,{className:`tabular-nums`,children:XU(e)})]})}function LW({count:e,onChanged:t}){return(0,L.jsxs)(`div`,{className:`@container flex max-w-4xl flex-col gap-5`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:zU}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:BU})]}),(0,L.jsx)(IW,{count:e})]}),(0,L.jsx)(vW,{row:!0}),e<5?(0,L.jsx)(_W,{title:qU,children:(0,L.jsx)(SW,{onChanged:t})}):null,(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-4`,children:[(0,L.jsx)(KO,{chord:`ArrowDown`,children:`next session`}),(0,L.jsx)(KO,{chord:`ArrowRight`,children:`into its detail`})]})]})}function RW({onChanged:e}){return(0,L.jsx)(`div`,{className:`@container flex-1 overflow-y-auto px-5 pt-10 pb-dock sm:px-8`,children:(0,L.jsxs)(`div`,{className:`mx-auto grid max-w-5xl gap-8 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,24rem)]`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`card-raised grid size-11 place-items-center rounded-xl border text-primary`,children:(0,L.jsx)(Ph,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:FU}),(0,L.jsx)(`p`,{className:`max-w-prose text-sm leading-relaxed text-muted-foreground`,children:LU})]}),(0,L.jsx)(vW,{}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:IU})]}),(0,L.jsx)(_W,{title:qU,className:`self-start`,children:(0,L.jsx)(SW,{onChanged:e,stacked:!0})})]})})}function zW({id:e}){let t=iA(),n=Tk(`excalidraw.list`,{},[`excalidraw`]),[r,i]=(0,m.useState)({}),[a,o]=(0,m.useState)([]),s=n.data?.sessions??[],c=s.find(t=>t.id===e),l=async e=>{o(t=>[...t,e]);let t=await H(`excalidraw.check`,{id:e});o(t=>t.filter(t=>t!==e)),t&&i(n=>({...n,[e]:t}))},u=async()=>{c&&await H(`excalidraw.remove`,{id:c.id})&&(n.reload(),PW())};if(!n.data&&n.error)return(0,L.jsx)(yk,{message:`Could not load sessions. ${n.error}`,onRetry:n.reload});if(n.data&&s.length===0)return(0,L.jsx)(RW,{onChanged:n.reload});let d=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:PU,count:n.data?`${s.length}/5`:void 0}),n.data?(0,L.jsx)(NW,{sessions:s,checks:r,checking:a,selectedId:e,onSelect:FW}):(0,L.jsx)(uA,{})]}),f=c?(0,L.jsx)(AW,{session:c,check:r[c.id],checking:a.includes(c.id),onCheck:()=>void l(c.id),onChanged:n.reload,onRemove:()=>void u()}):t&&n.data?(0,L.jsx)(LW,{count:s.length,onChanged:n.reload}):null;return(0,L.jsx)(cA,{wide:t,list:d,detail:f,open:c!==void 0,onClose:PW,hint:`Select a session to see its link and agents.`,describe:`Session detail`})}function BW(e,t){return e===`lobby.thinking`||t===`1`}var VW=`bot-lobby.collapsed.`,HW=new Set,UW=new Map;function WW(e){if(UW.has(e))return UW.get(e);if(e===`lobby.thinking`)return BW(e);try{return BW(e,localStorage.getItem(VW+e))}catch{return!1}}function GW(e,t){UW.set(e,t);try{e!==`lobby.thinking`&&localStorage.setItem(VW+e,t?`1`:`0`)}catch{}for(let e of[...HW])e()}function KW(e){return HW.add(e),()=>{HW.delete(e)}}function qW(e){GW(e,!WW(e))}function JW(e){return[(0,m.useSyncExternalStore)(KW,()=>WW(e),()=>BW(e)),(0,m.useCallback)(()=>GW(e,!WW(e)),[e])]}function YW({entry:e}){return e.pending?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}):e.kind===`error`?(0,L.jsx)(Hg,{"aria-hidden":`true`,className:`size-3.5 text-destructive`}):e.kind===`warning`?(0,L.jsx)(Eg,{"aria-hidden":`true`,className:`size-3.5 text-warning`}):e.kind===`success`?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 text-success`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})}function XW({entry:e}){return(0,L.jsxs)(`li`,{className:`grid grid-cols-[2.75rem_5rem_1rem_minmax(0,1fr)] items-baseline gap-x-2 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-muted`,children:[(0,L.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:pA(e.at)}),(0,L.jsx)(`span`,{className:q(`overflow-hidden text-xs font-medium whitespace-nowrap`,OH(e.source)),children:DH(e.source)}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center self-center`,children:(0,L.jsx)(YW,{entry:e})}),(0,L.jsx)(`span`,{className:`sr-only`,children:e.pending?`pending`:e.kind}),(0,L.jsx)(`span`,{className:q(`min-w-0 break-words`,e.kind===`error`?`text-destructive`:e.pending?``:`text-muted-foreground`),children:e.pending?`${e.text}…`:e.text})]})}function ZW({entries:e,collapsed:t,onToggle:n,shortcut:r,bare:i}){let a=e.slice(-400),o=a.filter(e=>e.pending).length,{ref:s,atBottom:c,stick:l,onScroll:u}=xH(JSON.stringify(a));return(0,L.jsxs)(XB,{"aria-label":`Activity`,...i?{}:{title:`Activity`},collapsed:t,...n?{onToggle:n}:{},shortcut:r,className:`flex-1`,note:o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}),` `,o,` running`]}):void 0,children:[(0,L.jsx)(`div`,{ref:s,onScroll:u,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-2 pt-2 pb-dock outline-none focus-visible:bg-muted/30`,role:`log`,"aria-label":`Activity`,tabIndex:0,children:a.length===0?(0,L.jsx)(`p`,{className:`px-2 py-1 text-sm text-muted-foreground`,children:`No activity yet.`}):(0,L.jsx)(`ul`,{children:a.map(e=>(0,L.jsx)(XW,{entry:e},e.id))})}),c?null:(0,L.jsx)(`div`,{className:`absolute inset-x-0 bottom-dock z-10 flex justify-center`,children:(0,L.jsx)(X,{label:`Jump to latest`,text:`Latest`,icon:Op,className:`rounded-full bg-card shadow-card`,onClick:l})})]})}function QW(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function $W(e){return e===`running`?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3.5`}):e===`success`?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 text-success`}):e===`failed`||e===`timeout`||e===`error`?(0,L.jsx)(Hg,{"aria-hidden":`true`,className:`size-3.5 text-destructive`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`})}function eG(e,t){let n=e.startedAt?Date.parse(e.startedAt):NaN;return mA((e.finishedAt?Date.parse(e.finishedAt):t)-n)}function tG({runs:e}){let t=QW(e.some(e=>e.status===`running`));return e.length===0?null:(0,L.jsx)(`ul`,{className:`-mt-1 flex shrink-0 flex-wrap items-center gap-1.5 px-4 pb-3`,"aria-label":`Runs`,children:e.map((e,n)=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 rounded-full bg-muted py-1 pr-3 pl-2 text-xs`,children:[(0,L.jsx)(`span`,{className:`flex size-4 items-center justify-center`,children:$W(e.status)}),(0,L.jsx)(`span`,{className:`sr-only`,children:e.status??`unknown`}),(0,L.jsx)(`span`,{className:q(`font-medium`,OH(jH(e))),children:DH(jH(e))}),e.activity??e.step?(0,L.jsx)(`span`,{className:`max-w-[18rem] truncate text-muted-foreground`,children:e.activity??e.step}):null,(0,L.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:eG(e,t)})]},e.runId??n))})}function nG(e,t=0,n=!1){let r=!n&&!e.waiting&&!!e.runningSince,i=r?Date.parse(e.serverNow)-Date.parse(e.runningSince):0;return Math.max(0,e.elapsedMs)+(Number.isFinite(i)?Math.max(0,i):0)+(r?Math.max(0,t):0)}function rG(e){let t=Math.floor(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`}function iG(e,t){let[n,r]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(r(0),!e)return;let t=performance.now(),n=window.setInterval(()=>r(performance.now()-t),1e3);return()=>window.clearInterval(n)},[e,t]),e?n:0}var aG=8;function oG(e){return e?e.path===`fast`?`fast track (${e.size})`:`full workflow (${e.size})`:``}function sG(e,t){let n=Math.min(t,aG);if(n<=0)return[];let r=Math.min(n,Math.round(Math.max(0,e)/t*n));return Array.from({length:n},(e,t)=>t<r)}function cG({done:e,total:t}){return(0,L.jsx)(`span`,{className:`inline-flex items-center gap-0.5`,"aria-hidden":`true`,children:sG(e,t).map((e,t)=>(0,L.jsx)(`span`,{className:q(`h-1.5 w-3 rounded-full`,e?`bg-primary`:`bg-muted-foreground/25`)},t))})}function lG({check:e,className:t}){return(0,L.jsx)(e===`done`?nm:e===`dropped`?fm:mm,{"aria-hidden":`true`,className:q(`size-4 shrink-0`,e===`done`?`text-success`:`text-muted-foreground`,t)})}function uG({children:e}){return(0,L.jsx)(`span`,{className:`hidden shrink-0 items-center gap-1 text-xs text-muted-foreground md:inline-flex`,children:e})}function dG({ms:e,running:t,sample:n}){let r=iG(t,n);return(0,L.jsx)(`span`,{className:`tabular-nums`,children:rG(e+r)})}function fG({work:e}){return(0,L.jsxs)(`span`,{className:`hidden shrink-0 items-center gap-1 text-xs text-muted-foreground md:inline-flex`,title:`How long the agents have worked on this task (idle time left out)`,children:[(0,L.jsx)(Sg,{"aria-hidden":`true`,className:`size-3 shrink-0`}),`worked `,(0,L.jsx)(dG,{ms:e.workedMs,running:e.running,sample:e})]})}function pG({active:e,current:t}){let n=e?.[0];return n?(0,L.jsxs)(`span`,{className:`hidden max-w-[20rem] min-w-0 items-center gap-1.5 xl:inline-flex`,children:[(0,L.jsx)(`span`,{className:`truncate text-foreground`,children:n.text}),(0,L.jsxs)(`span`,{className:`shrink-0 rounded-md bg-primary/10 px-1.5 py-px font-medium text-primary`,children:[`active · `,(0,L.jsx)(dG,{ms:n.workedMs,running:!0,sample:n})]}),e.length>1?(0,L.jsxs)(`span`,{className:`shrink-0`,children:[`+`,e.length-1]}):null]}):t?(0,L.jsxs)(`span`,{className:`hidden max-w-[16rem] truncate xl:inline`,children:[`next: `,(0,L.jsx)(`span`,{className:`text-foreground`,children:t})]}):null}function mG({done:e,total:t,current:n,active:r}){let i=t>0?Math.min(100,Math.round(e/t*100)):0;return(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[e,` of `,t,` steps`]}),(0,L.jsx)(`div`,{className:`h-1.5 w-16 overflow-hidden rounded-full bg-border`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-label":`Plan progress`,children:(0,L.jsx)(z.div,{className:`h-full rounded-full bg-primary`,initial:!1,animate:{width:`${i}%`},transition:{type:`spring`,stiffness:260,damping:30}})}),(0,L.jsx)(pG,{...r?{active:r}:{},...n?{current:n}:{}})]})}function hG({task:e,status:t}){let n=t?.branch??t?.workspace.branch,r=e?.git?.branch??n;return(0,L.jsxs)(`section`,{className:`flex h-12 shrink-0 items-center gap-3 px-4`,"aria-label":`Task`,role:`group`,children:[(0,L.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-[0.8125rem] font-medium`,title:e?.title,children:[e?.title??`No task yet`,e?null:(0,L.jsx)(`span`,{className:`ml-2 font-normal text-muted-foreground`,children:t?.sessionName??`Type a request below to start one.`})]}),e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent px-2 py-0.5 text-xs font-medium`,children:e.state.replace(/_/g,` `)}),(0,L.jsx)(uG,{children:e.id}),e.track?(0,L.jsx)(uG,{children:oG(e.track)}):null,(e.domains??[]).length>0?(0,L.jsx)(uG,{children:e.domains.join(`, `)}):null,r?(0,L.jsxs)(`span`,{className:`hidden max-w-48 shrink-0 items-center gap-1 text-xs text-muted-foreground lg:inline-flex`,children:[(0,L.jsx)(Bm,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,L.jsxs)(`span`,{className:`truncate`,children:[r,e.git?.from?` · from ${e.git.from}`:``]})]}):null,e.work?(0,L.jsx)(fG,{work:e.work}):null,e.progress?(0,L.jsx)(mG,{done:e.progress.done,total:e.progress.total,...e.currentStep?{current:e.currentStep}:{},...e.activeSteps?{active:e.activeSteps}:{}}):null]}):null]})}var gG=(e,t)=>e?.keys.find(e=>e.action===t)?.label,_G=e=>e?.panels??{conversation:!0,activity:!0,thinking:!0};function vG({name:e,icon:t,shortcut:n,onClick:r}){return(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Expand ${e}`,"aria-expanded":!1,"aria-keyshortcuts":n,onClick:r,className:`btn-ghost inline-flex size-8 shrink-0 items-center justify-center rounded-lg border border-transparent text-muted-foreground transition-[box-shadow,color,translate] duration-150 ease-snap outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`,children:(0,L.jsx)(t,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsxs)(kk,{side:`left`,children:[`Expand `,e,n?(0,L.jsx)(GO,{chord:n}):null]})]})}function yG(e){let t=_G(e.status);return(0,L.jsx)(`aside`,{"aria-label":`Minimized panes`,className:`flex w-12 shrink-0 flex-col items-center gap-1 border-l border-border py-2`,children:t.activity&&e.activityFolded?(0,L.jsx)(vG,{name:`Activity`,icon:Sp,shortcut:gG(e.status,`activity`),onClick:e.toggleActivity}):null})}function bG(e){let{data:t,status:n,activityFolded:r,toggleActivity:i}=e,a=_G(n),o=a.activity&&!r;if(!a.conversation&&!o)return null;let s=a.conversation&&o;return(0,L.jsxs)(`div`,{className:q(`grid min-h-0 flex-1`,s?`grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)] divide-x divide-border`:`grid-cols-1`),children:[a.conversation?(0,L.jsx)(XH,{chat:t?.chat??[],reply:t?.reply,busy:n?.busy??!1,hasOlder:t?.hasOlderChat??!1,hasTask:!!t?.task}):null,o?(0,L.jsx)(ZW,{entries:t?.activity??[],collapsed:!1,onToggle:i,shortcut:gG(n,`activity`)}):null]})}function xG(e){let{status:t}=e,n=_G(t).activity&&e.activityFolded;return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,L.jsx)(bG,{...e})}),n?(0,L.jsx)(yG,{...e}):null]})}function SG({data:e,status:t}){let n=_G(t),r=[...n.conversation?[{id:`conversation`,label:`Conversation`,icon:fh}]:[],...n.activity?[{id:`activity`,label:`Activity`,icon:Sp}]:[]],[i,a]=(0,m.useState)(`conversation`),o=r.find(e=>e.id===i)??r[0],s=(e?.activity??[]).filter(e=>e.pending).length;return o?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[r.length>1?(0,L.jsx)(`div`,{role:`radiogroup`,"aria-label":`Pane`,className:`flex shrink-0 items-center gap-0.5 border-b border-border px-3 py-2`,children:r.map(e=>{let t=e.id===o.id,n=e.icon;return(0,L.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,onClick:()=>a(e.id),className:q(`inline-flex h-8 items-center gap-1.5 rounded-lg border border-transparent px-2.5 text-[0.8125rem] font-medium outline-none transition-[box-shadow,color] focus-visible:ring-3 focus-visible:ring-ring/40`,t?`btn-raised bg-card text-foreground`:`btn-ghost text-muted-foreground hover:text-foreground`),children:[(0,L.jsx)(n,{"aria-hidden":`true`,className:`size-4`}),e.label,e.id===`activity`&&s>0?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}):null]},e.id)})}):null,o.id===`conversation`?(0,L.jsx)(XH,{chat:e?.chat??[],reply:e?.reply,busy:t?.busy??!1,hasOlder:e?.hasOlderChat??!1,hasTask:!!e?.task}):null,o.id===`activity`?(0,L.jsx)(ZW,{entries:e?.activity??[],collapsed:!1,bare:!0}):null]}):null}function CG(e){let{data:t,status:n}=e,r=iA();return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[(0,L.jsx)(hG,{task:t?.task,status:n}),(0,L.jsx)(tG,{runs:MH(t)})]}),r?(0,L.jsx)(xG,{...e}):(0,L.jsx)(SG,{...e})]})}function wG(){let e=Ck(`lobby`),t=Ck(`status`),[n,r]=JW(`lobby.activity`);return!e.data&&e.loading?(0,L.jsxs)(`div`,{className:`flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(_k,{}),(0,L.jsx)(`span`,{children:`Connecting…`})]}):!e.data&&e.error?(0,L.jsx)(yk,{message:e.error,onRetry:()=>me.onHello({})}):(0,L.jsx)(CG,{data:e.data,status:t.data,activityFolded:n,toggleActivity:r})}var TG={master:`master`,scout:`scout`,worker:`worker`,reviewer:`QA gate`,researcher:`research`,quickfix:`quick fix`,planner:`oracle (plan)`,panel:`panel`};function EG(e){let t=Number.isFinite(e)?Math.max(0,Math.round(e/1e3)):0,n=Math.floor(t/60);if(n===0)return`${t}s`;let r=t%60;return r===0?`${n}m`:`${n}m ${String(r).padStart(2,`0`)}s`}function DG(e){return e>0?EG(e):`—`}function OG(e,t){return t>0?`${Math.round(e/t*100)}%`:`—`}function kG(e){return e<=0?`—`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function AG(e){return!Number.isFinite(e)||e<1e3?String(Math.max(0,Math.round(e||0))):e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1)}M`}function jG(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(1)}s`}function MG(e){return e>=.9?{icon:`✓`,word:`healthy`,tone:`healthy`}:e>=.7?{icon:`!`,word:`shaky`,tone:`shaky`}:{icon:`✗`,word:`failing`,tone:`failing`}}function NG(e){return e===`model`?`by model · thinking`:`by model · thinking · agent`}function PG(e,t){let n=t===`model-kind`?TG[e.kinds[0]??``]??e.kinds[0]??``:``;return[e.model,e.thinking,n].filter(Boolean).join(` · `)}var FG=[`bg-chart-1`,`bg-chart-2`,`bg-chart-3`,`bg-chart-4`,`bg-chart-5`],IG={MASTER:`bg-primary`,ORACLE:`bg-primary`,DEV:`bg-source-dev`,DESIGN:`bg-source-design`,QA:`bg-source-qa`,RESEARCH:`bg-source-research`,"QUICK FIX":`bg-source-quickfix`};function LG(e){let t=IG[e.toUpperCase()];if(t)return t;let n=0;for(let t of e)n=(n*31+t.charCodeAt(0))%FG.length;return FG[n]??FG[0]}function RG(e){return TG[e]??e}var zG=6;function BG({title:e,right:t,children:n}){return(0,L.jsxs)(`section`,{className:`card-raised flex min-w-0 flex-col gap-3 rounded-xl border p-4`,"aria-label":e,children:[(0,L.jsxs)(`h2`,{className:`flex items-baseline justify-between gap-3 text-sm font-medium`,children:[(0,L.jsx)(`span`,{children:e}),t?(0,L.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:t}):null]}),n]})}function VG({rows:e,render:t}){let[n,r]=(0,m.useState)(!1),i=n?e:e.slice(0,zG);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:i.map(t)}),e.length>zG?(0,L.jsx)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`h-6 self-start rounded-lg text-xs text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/30`,children:n?`Show fewer`:`Show all ${e.length}`}):null]})}function HG(e,t){return t>0?Math.max(1.5,e/t*100):0}function UG({label:e,value:t,marker:n,max:r,valueText:i,sub:a}){return(0,L.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-[0.8125rem]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e}),(0,L.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[i,a?(0,L.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:a}):null]})]}),(0,L.jsxs)(`div`,{className:`relative h-1.5 rounded-full bg-muted`,role:`img`,"aria-label":`${e}: ${i}`,children:[(0,L.jsx)(`div`,{className:`h-full rounded-full bg-primary/70`,style:{width:`${HG(t,r)}%`}}),n?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-1/2 h-3 w-0.5 -translate-y-1/2 rounded-full bg-foreground/40`,style:{left:`${Math.min(99.5,HG(n,r))}%`}}):null]})]})}function WG({groups:e,label:t}){let n=e.filter(e=>e.avgMs>0).sort((e,t)=>t.avgMs-e.avgMs),r=Math.max(...n.map(e=>Math.max(e.avgMs,e.p90Ms)),1);return(0,L.jsx)(BG,{title:`Average run time`,right:`per model · thinking · tick is p90`,children:n.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No timed runs yet.`}):(0,L.jsx)(VG,{rows:n,render:e=>(0,L.jsx)(UG,{label:t(e),value:e.avgMs,marker:e.p90Ms,max:r,valueText:DG(e.avgMs),sub:`p90 ${DG(e.p90Ms)}`},t(e))})})}var GG={healthy:`bg-success`,shaky:`bg-warning`,failing:`bg-destructive`},KG={healthy:`text-success`,shaky:`text-warning`,failing:`text-destructive`};function qG({label:e,rate:t,runs:n}){let r=MG(t),i=`${Math.round(t*100)}%`;return(0,L.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-[0.8125rem]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 ${KG[r.tone]}`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full ${GG[r.tone]}`}),(0,L.jsx)(`span`,{className:`sr-only`,children:r.word}),i]}),(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` run`,n===1?``:`s`]})]})]}),(0,L.jsxs)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-muted`,role:`img`,"aria-label":`${e}: ${r.word}, ${i} of ${n} runs`,children:[(0,L.jsx)(`div`,{className:`h-full bg-success/70`,style:{width:`${t*100}%`}}),(0,L.jsx)(`div`,{className:`h-full bg-destructive/45`,style:{width:`${(1-t)*100}%`}})]})]})}function JG({groups:e,label:t}){let n=e.filter(e=>e.runs>0).sort((e,t)=>e.successes/e.runs-t.successes/t.runs);return(0,L.jsx)(BG,{title:`Success rate`,right:`green worked · red failed`,children:n.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs yet.`}):(0,L.jsx)(VG,{rows:n,render:e=>(0,L.jsx)(qG,{label:t(e),rate:e.successes/e.runs,runs:e.runs},t(e))})})}function YG({share:e}){return(0,L.jsx)(`ul`,{className:`flex flex-wrap gap-x-6 gap-y-1.5 text-xs`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${LG(e.agent)}`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`text-[0.8125rem]`,children:DH(e.agent)}),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[Math.round(e.share*100),`%`]}),(0,L.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`avg `,EG(e.ms/Math.max(1,e.runs)),` ×`,e.runs]})]},e.agent))})}function XG({share:e}){return(0,L.jsx)(`div`,{className:`flex h-2.5 gap-0.5 overflow-hidden rounded-full`,role:`img`,"aria-label":`Share of run time by agent`,children:e.map(e=>(0,L.jsx)(`span`,{className:`${LG(e.agent)} opacity-75 first:rounded-l-full last:rounded-r-full`,style:{width:`${e.share*100}%`},title:`${e.agent} ${Math.round(e.share*100)}%`},e.agent))})}function ZG({times:e}){if(e.length===0)return null;let t=Math.max(...e.map(e=>e.avgMs),1);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2.5 pt-1`,children:[(0,L.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Request to done, by the oracle's model`}),(0,L.jsx)(VG,{rows:e,render:e=>(0,L.jsx)(UG,{label:[e.model,e.thinking].filter(Boolean).join(` · `),value:e.avgMs,max:t,valueText:EG(e.avgMs),sub:`×${e.tasks}`},`${e.model}-${e.thinking}`)})]})}function QG({timeShare:e}){let t=e.byAgent;return(0,L.jsx)(BG,{title:`Where the time goes`,right:`share of run time by agent`,children:t.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No timed runs yet.`}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(XG,{share:t}),(0,L.jsx)(YG,{share:t}),(0,L.jsx)(ZG,{times:e.taskTimes})]})})}function $G({label:e,value:t,sub:n}){return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,L.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:t}),n?(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n}):null]})}var eK=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function tK({summary:e}){let t=Object.entries(e.byPurpose).sort((e,t)=>t[1]-e[1]);return(0,L.jsxs)(`section`,{className:`card-raised flex flex-col gap-3 rounded-xl border p-4`,"aria-label":`Classifier (Jev)`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Classifier (Jev)`}),e.calls===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`no calls recorded`}):(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-4`,children:[(0,L.jsx)($G,{label:`Calls`,value:eK(e.calls,`call`),sub:`${OG(e.ok,e.calls)} ok`}),(0,L.jsx)($G,{label:`Speed`,value:`p50 ${jG(e.p50Ms)}`,sub:`p90 ${jG(e.p90Ms)}`}),(0,L.jsx)($G,{label:`Read`,value:e.input>0?`${AG(e.input)} tokens`:`—`}),(0,L.jsx)($G,{label:`Routed down`,value:e.routed>0?eK(e.routed,`run`):`none`,sub:e.routed>0?`${OG(e.routedOk,e.routed)} ok`:`no runs routed`})]}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`text-primary`,children:`spared`}),` `,eK(e.seatRunsSkipped,`seat run`),` skipped · `,eK(e.questionsAnswered,`question`),` answered · `,eK(e.quickFixesHeld,`quick fix`,`quick fixes`),` held`,t.length>0?(0,L.jsx)(`span`,{className:`ml-3 border-l border-border pl-3`,children:t.map(([e,t])=>`${e} ${t}`).join(` · `)}):null]})]})}var nK=[`Runs`,`OK`,`Avg`,`p50`,`p90`,`Turns`,`Tools`,`Tokens`,`tok/s`,`$/run`,`$ total`,`Stalls`];function rK(e,t=0){return e>0?e.toFixed(t):`—`}function iK(e){return[String(e.runs),OG(e.successes,e.runs),DG(e.avgMs),DG(e.p50Ms),DG(e.p90Ms),rK(e.avgTurns,1),rK(e.avgTools,1),e.avgTokens>0?AG(e.avgTokens):`—`,e.tokensPerSecond>0?e.tokensPerSecond.toFixed(0):`—`,kG(e.avgCost),kG(e.totalCost),e.timeouts>0?String(e.timeouts):`—`]}function aK(e,t){return t===`model-kind`?RG(e.kinds[0]??``):e.kinds.map(RG).join(`, `)}function oK({groups:e,groupBy:t}){return(0,L.jsxs)(`section`,{className:`card-raised flex min-h-0 flex-col gap-2 overflow-hidden rounded-xl border pt-4`,"aria-label":`All models`,children:[(0,L.jsxs)(`h2`,{className:`flex flex-wrap items-baseline justify-between gap-3 px-4 text-sm font-medium`,children:[(0,L.jsx)(`span`,{children:`All models`}),(0,L.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[t===`model`?`by model · thinking`:`by model · thinking · agent`,` · sorted by runs`]})]}),(0,L.jsx)(`div`,{className:`max-h-80 overflow-auto outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,tabIndex:0,role:`region`,"aria-label":`All model metrics, scroll horizontally to see all columns`,children:(0,L.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,L.jsx)(`thead`,{className:`sticky top-0 bg-card text-muted-foreground`,children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left font-medium`,children:`Model`}),(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left font-medium`,children:`Think`}),(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left font-medium`,children:t===`model-kind`?`Agent`:`Agents`}),nK.map(e=>(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right font-medium whitespace-nowrap`,children:e},e))]})}),(0,L.jsx)(`tbody`,{children:e.map(e=>(0,L.jsxs)(`tr`,{className:`border-t border-border/70 transition-colors hover:bg-muted`,children:[(0,L.jsx)(`th`,{scope:`row`,className:`px-3 py-1.5 text-left font-normal text-foreground`,children:e.model}),(0,L.jsx)(`td`,{className:`px-3 py-1.5 whitespace-nowrap text-muted-foreground`,children:e.thinking||`—`}),(0,L.jsx)(`td`,{className:`px-3 py-1.5 whitespace-nowrap text-muted-foreground`,children:aK(e,t)||`—`}),iK(e).map((e,t)=>(0,L.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums whitespace-nowrap text-foreground`,children:e},nK[t]))]},PG(e,t)))})]})})]})}var sK={healthy:`bg-success`,shaky:`bg-warning`,failing:`bg-destructive`};function cK({label:e,value:t,sub:n,dot:r}){return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 bg-card px-4 py-3.5`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-2xl leading-tight font-semibold tracking-tight tabular-nums`,children:[r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-full ${sK[r.tone]}`}),(0,L.jsx)(`span`,{className:`sr-only`,children:r.word})]}):null,t]}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n||`\xA0`})]})}function lK({tiles:e}){let t=MG(e.runs>0?e.successes/e.runs:0),n=e.runs-e.successes;return(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-border bg-border shadow-card sm:grid-cols-5 [&>:last-child]:col-span-2 sm:[&>:last-child]:col-span-1`,children:[(0,L.jsx)(cK,{label:`Runs`,value:String(e.runs),sub:e.runs===0?`no runs yet`:``}),(0,L.jsx)(cK,{label:`Success`,value:OG(e.successes,e.runs),sub:`${n} failed${e.stalls>0?` · ${e.stalls} stalled`:``}`,dot:{tone:t.tone,word:t.word}}),(0,L.jsx)(cK,{label:`Avg run`,value:DG(e.avgMs),sub:`p90 ${DG(e.p90Ms)}`}),(0,L.jsx)(cK,{label:`Cost`,value:kG(e.cost),sub:e.runs>0?`${kG(e.cost/e.runs)} per run`:`—`}),(0,L.jsx)(cK,{label:`Tasks`,value:`${e.completed} done`,sub:e.avgCompleteMs>0?`avg ${EG(e.avgCompleteMs)} · ${e.active} active`:`${e.active} active`})]})}var uK=`No runs recorded yet. Every Master turn, subagent run, quick fix and planning round lands here with its model, thinking level, time, tokens and cost.`;function dK({groupBy:e,onGroup:t}){return(0,L.jsx)(`div`,{role:`radiogroup`,"aria-label":`Group by`,className:`flex gap-0.5 rounded-lg bg-muted p-0.5`,onKeyDown:n=>{let r=n.key===`ArrowRight`||n.key===`ArrowDown`?1:n.key===`ArrowLeft`||n.key===`ArrowUp`?-1:0;if(!r)return;n.preventDefault();let i=[`model`,`model-kind`],a=i[(i.indexOf(e)+r+i.length)%i.length];t(a),requestAnimationFrame(()=>n.currentTarget.querySelector(`[aria-checked='true']`)?.focus())},children:[`model`,`model-kind`].map(n=>(0,L.jsx)(J,{variant:`ghost`,size:`sm`,role:`radio`,tabIndex:e===n?0:-1,className:e===n?`bg-card text-foreground shadow-card hover:bg-card`:`text-muted-foreground`,"aria-checked":e===n,onClick:()=>t(n),children:NG(n)},n))})}function fK({query:e,onQuery:t}){return(0,L.jsxs)(`label`,{className:`relative flex items-center`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`Search runs`}),(0,L.jsx)(ig,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 size-3.5 text-muted-foreground`}),(0,L.jsx)(`input`,{id:`metrics-search`,type:`search`,value:e,maxLength:500,placeholder:`Search runs: model, agent, tool…`,onChange:e=>t(e.target.value),className:`h-8 w-64 max-w-full rounded-lg border border-input bg-background pr-9 pl-8 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30`}),(0,L.jsx)(GO,{chord:`/`,className:`kbd-hint pointer-events-none absolute right-2`})]})}function pK({data:e,groupBy:t,query:n}){let r=e=>PG(e,t);return e.tiles.runs===0?(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(lK,{tiles:e.tiles}),(0,L.jsx)(`p`,{className:`card-raised rounded-xl border p-4 text-sm text-muted-foreground`,children:n?`No run matches "${n}".`:uK})]}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(lK,{tiles:e.tiles}),e.classifier?(0,L.jsx)(tK,{summary:e.classifier}):null,(0,L.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,L.jsx)(WG,{groups:e.groups,label:r}),(0,L.jsx)(JG,{groups:e.groups,label:r})]}),(0,L.jsx)(QG,{timeShare:e.timeShare}),(0,L.jsx)(oK,{groups:e.groups,groupBy:t})]})}function mK(){return(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5`,role:`status`,"aria-label":`Loading metrics`,children:[0,1,2,3,4].map(e=>(0,L.jsx)(`div`,{className:`h-20 rounded-lg bg-muted motion-safe:animate-pulse`},e))})}function hK(){let[e,t]=(0,m.useState)(`model`),[n,r]=(0,m.useState)(``),i=Tk(`metrics.get`,{groupBy:e,query:n},[`metrics`]);return!i.data&&i.error?(0,L.jsx)(yk,{message:`Could not load metrics. ${i.error}`,onRetry:i.reload}):(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-5 pt-5 pb-dock`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,L.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Metrics`}),i.loading&&i.data?(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(_k,{className:`size-3`,"aria-hidden":`true`,role:`presentation`}),` refreshing`]}):null,(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`min-w-4 flex-1`}),(0,L.jsx)(dK,{groupBy:e,onGroup:t}),(0,L.jsx)(fK,{query:n,onQuery:r})]}),i.data?(0,L.jsx)(pK,{data:i.data,groupBy:e,query:n}):(0,L.jsx)(mK,{})]})}var gK=class{seen=new Set;initialized=new Set;storage;constructor(e){this.storage=e;try{let t=JSON.parse(e?.getItem(`bot-lobby.prompt-seen`)??`[]`);Array.isArray(t)&&(this.seen=new Set(t.filter(e=>typeof e==`string`)))}catch{}}observe(e,t,n=!1){let r=this.initialized.has(e)&&!n?t.filter(e=>!this.seen.has(e)):[];this.initialized.add(e);for(let e of t)this.seen.add(e);try{this.storage?.setItem(`bot-lobby.prompt-seen`,JSON.stringify([...this.seen]))}catch{}return r}};function _K(e,t){return JSON.stringify([e,`prompt`,t])}function vK(e,t,n){return JSON.stringify([e,`dialog`,t,n])}function yK(e,t,n){return JSON.stringify([e,`delivery`,t,n])}var bK=`bot-lobby.prompt-sound-muted`,xK=new Set,SK,CK=!1;function wK(){try{return localStorage.getItem(bK)===`on`}catch{return CK}}function TK(e){CK=e;try{localStorage.setItem(bK,e?`on`:`off`)}catch{}for(let e of xK)e()}function EK(e){return xK.add(e),()=>{xK.delete(e)}}function DK(){return(0,m.useSyncExternalStore)(EK,wK,()=>!1)}function OK(){(0,m.useEffect)(()=>{let e=()=>{try{SK??=new AudioContext,SK.resume().catch(()=>void 0)}catch{}};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,e)}},[])}function kK(){if(!wK()&&SK&&SK.state===`running`)try{let e=SK.currentTime,t=SK.createOscillator(),n=SK.createGain();t.frequency.setValueAtTime(960,e),t.frequency.exponentialRampToValueAtTime(360,e+.16),n.gain.setValueAtTime(1e-4,e),n.gain.exponentialRampToValueAtTime(.12,e+.012),n.gain.exponentialRampToValueAtTime(1e-4,e+.22),t.connect(n),n.connect(SK.destination),t.start(e),t.stop(e+.24),t.onended=()=>{t.disconnect(),n.disconnect()}}catch{}}var AK=`bot-lobby.notifications`,jK=`/icon-192.png`,MK=new Set;function NK(){for(let e of[...MK])e()}function PK(){try{return localStorage.getItem(AK)===`on`}catch{return!1}}function FK(e){return MK.add(e),()=>{MK.delete(e)}}function IK(e){try{localStorage.setItem(AK,e?`on`:`off`)}catch{}NK()}function LK(){return(0,m.useSyncExternalStore)(FK,PK,()=>!1)}async function RK(){return typeof Notification>`u`?`unsupported`:(Notification.permission==="default"&&await Notification.requestPermission().catch(()=>void 0),Notification.permission===`granted`?(IK(!0),`granted`):`denied`)}function zK(){IK(!1)}function BK(e){if(e===`completed`)return`finished`;if(e===`abandoned`)return`dropped`}function VK(){return typeof Notification<`u`&&Notification.permission===`granted`&&document.hidden}function HK(e){try{new Notification(`bot-lobby`,{body:e,icon:jK,tag:`bot-lobby`})}catch{}}function UK(){try{return new gK(sessionStorage)}catch{return new gK}}function WK(e,t){let n=t.payload;return t.kind===`sessionDialog`&&n?.dialog?.id?vK(e,t.sessionId??n.key??t.from,n.dialog.id):_K(e,t.id)}function GK(){let e=LK();OK(),xk();let t=Tk(`tasks.list`,{},[`tasks`]),n=Tk(`sessions.list`,{},[`sessions`]),r=me.get(`prompts`),i=me.get(`lobby`).data,a=(0,m.useRef)(UK()),o=(0,m.useRef)(new Set([`prompts`,`sessions`,`delivery`])),s=(0,m.useRef)(void 0),c=M()??`current`,l=me.status().connection;return{enabled:e,tasks:t,sessions:n,prompts:r,lobby:i,seen:a,quiet:o,previousState:s,project:c,connection:l,lastConnection:(0,m.useRef)(l)}}function KK(e,t,n,r,i){if(!i)return;let{seen:a,project:o,quiet:s,enabled:c}=e,l=a.current.observe(`${o}:${t}`,n,s.current.has(t));s.current.delete(t),l.length&&(l.forEach(()=>kK()),c&&VK()&&HK(r),t===`delivery`&&V.info(r,{action:{label:`Review tasks`,onClick:()=>Y(`#/tasks`)}}))}function qK(e){let{prompts:t,sessions:n,tasks:r,project:i}=e,a=t.data?.prompts;KK(e,`prompts`,(a??[]).map(e=>WK(i,e)),`A question is waiting for you.`,!!a&&!t.loading),KK(e,`sessions`,n.data?.background.flatMap(e=>e.dialogs.map(t=>vK(i,e.sessionId??e.key,t.id)))??[],`A background session is asking something.`,!!n.data&&!n.loading),KK(e,`delivery`,r.data?.rows.filter(e=>e.delivery&&(e.delivery.status===`pending_approval`||e.delivery.status===`deferred`||e.delivery.status===`recoverable_failure`)).map(e=>yK(i,e.id,e.delivery.reviewId))??[],`Completed work is ready for delivery review in Tasks.`,!!r.data&&!r.loading)}function JK(e){let{lastConnection:t,connection:n,quiet:r,previousState:i,lobby:a,enabled:o}=e;if(t.current!==n||n!==`live`){t.current=n,r.current=new Set([`prompts`,`sessions`,`delivery`]),i.current=void 0;return}qK(e);let s=a?.task?.state??``,c=BK(s);i.current&&c&&s!==i.current&&o&&VK()&&HK(`${a?.task?.title??`The task`} ${c}.`),i.current=s}function YK(){let e=GK(),{connection:t,enabled:n,project:r,prompts:i,sessions:a,tasks:o,lobby:s}=e;(0,m.useEffect)(()=>JK(e),[t,n,r,i.data,i.loading,a.data,a.loading,o.data,o.loading,s])}function XK({className:e,type:t,...n}){return(0,L.jsx)(`input`,{type:t,"data-slot":`input`,className:q(`flex h-8 w-full rounded-lg border border-input bg-background px-3 py-1 text-base transition-[border-color,box-shadow] duration-150 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:disabled:bg-input/80`,e),...n})}function ZK({className:e,thumbClassName:t,...n}){return(0,L.jsx)(wD,{"aria-keyshortcuts":`Enter Space`,"aria-description":`When focused, press Enter or Space to toggle.`,"data-slot":`switch`,className:q(`peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-150 outline-none before:absolute before:-inset-x-2 before:-inset-y-3 before:content-[''] focus-visible:ring-3 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,L.jsx)(ED,{"data-slot":`switch-thumb`,className:q(`pointer-events-none block size-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-snap data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`,t)})})}var QK=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],$K={repeat:1/0},eq=`M0 -4 L1 -1 L4 0 L1 1 L0 4 L-1 1 L-4 0 L-1 -1Z`,tq=[`var(--rainbow-1)`,`var(--rainbow-2)`,`var(--rainbow-3)`,`var(--rainbow-4)`,`var(--rainbow-5)`,`var(--rainbow-6)`,`var(--rainbow-7)`],nq={transformBox:`fill-box`,transformOrigin:`center`};function rq(e){switch(e){case`off`:return{animate:{scale:[1,1.03,1],rotate:-5},transition:{...$K,duration:4,ease:`easeInOut`}};case`minimal`:return{animate:{rotate:[0,0,7,9,0,0],y:[0,0,1.5,2,0,0]},transition:{...$K,duration:4.2,times:[0,.35,.7,.82,.86,1],ease:`easeInOut`}};case`low`:return{animate:{rotate:[-4,4,-4],y:[0,-1,0]},transition:{...$K,duration:3.2,ease:`easeInOut`}};case`medium`:return{animate:{rotate:[0,-5,-5,5,5,0],y:[0,-1,-1,-1,-1,0]},transition:{...$K,duration:4,times:[0,.12,.4,.52,.8,1],ease:`easeInOut`}};case`high`:return{animate:{y:[0,-1.5,0]},transition:{...$K,duration:.6,ease:`easeInOut`}};case`xhigh`:return{animate:{y:[0,-7,0,0],scaleY:[1,1.06,.88,1],scaleX:[1,.96,1.1,1]},transition:{...$K,duration:.7,times:[0,.4,.75,1],ease:`easeInOut`}};case`max`:return{animate:{y:[-1,-4,-1],rotate:[-3,3,-3]},transition:{...$K,duration:1.6,ease:`easeInOut`}}}}function iq(){return(0,L.jsx)(`g`,{className:`fill-muted-foreground`,fontWeight:`700`,children:[0,1,2].map(e=>(0,L.jsx)(z.text,{x:44+e*4.5,y:17-e*5.5,fontSize:5.5+e*2,initial:{opacity:0},animate:{opacity:[0,1,0],y:[3,-4],x:[0,2.5]},transition:{...$K,duration:2.6,delay:e*.8,ease:`easeOut`},children:`z`},e))})}function aq(){return(0,L.jsx)(`g`,{className:`fill-primary`,fontSize:`9`,children:[0,1].map(e=>(0,L.jsx)(z.text,{x:48,y:20,initial:{opacity:0},animate:{opacity:[0,1,1,0],y:[2,-5,-11,-17],x:[0,3,1,5],rotate:[0,12,-8,10]},transition:{...$K,duration:3,delay:e*1.5,ease:`easeOut`},style:nq,children:e?`♫`:`♪`},e))})}function oq(){return(0,L.jsx)(z.text,{x:52,y:14,fontSize:`12`,fontWeight:`700`,className:`fill-primary`,initial:{opacity:0,scale:0},animate:{opacity:[0,0,1,1,0],scale:[0,0,1.2,1,.6],rotate:[0,0,-12,8,0]},transition:{...$K,duration:4,times:[0,.5,.58,.85,1]},style:nq,children:`?`})}function sq({spots:e,rainbow:t}){return(0,L.jsx)(`g`,{children:e.map(([e,n,r],i)=>(0,L.jsx)(z.path,{d:eq,className:t?void 0:`fill-primary`,style:{x:e,y:n,...t?{fill:tq[i%tq.length]}:{}},initial:{scale:0},animate:{scale:[0,1.1,0],rotate:[0,90,180]},transition:{...$K,duration:1.3,delay:r,ease:`easeInOut`}},i))})}function cq(){return(0,L.jsx)(`g`,{children:[-20,20].map((e,t)=>(0,L.jsxs)(`g`,{transform:`rotate(${e} 32 34)`,children:[(0,L.jsx)(`ellipse`,{cx:32,cy:34,rx:30,ry:9,fill:`none`,strokeWidth:.8,strokeDasharray:`2 3`,className:`stroke-primary/35`}),(0,L.jsx)(z.circle,{r:2,className:`fill-primary`,animate:{cx:[2,32,62,32,2],cy:[34,43,34,25,34]},transition:{...$K,duration:1.1,delay:t*.55,ease:`linear`}})]},e))})}function lq(){return(0,L.jsx)(z.path,{d:`M53 22 Q56 27 53 29 Q50 27 53 22Z`,className:`fill-primary/60`,animate:{y:[0,8],opacity:[0,1,0]},transition:{...$K,duration:.9,ease:`easeIn`,repeatDelay:.5}})}function uq({id:e}){return(0,L.jsx)(z.circle,{cx:32,cy:34,r:27,fill:`url(#${e}-glow)`,animate:{scale:[.92,1.08,.92],opacity:[.5,.85,.5]},transition:{...$K,duration:1.6,ease:`easeInOut`},style:{transformOrigin:`32px 34px`}})}function dq({rainbow:e}){return(0,L.jsx)(`g`,{children:Array.from({length:8},(t,n)=>{let r=n/8*Math.PI*2;return(0,L.jsx)(z.circle,{cx:32,cy:34,r:2,className:e?void 0:`fill-primary`,style:e?{fill:tq[n%tq.length]}:void 0,initial:{opacity:1,scale:1},animate:{cx:32+Math.cos(r)*32,cy:34+Math.sin(r)*30,opacity:0,scale:.3},transition:{duration:.6,ease:`easeOut`}},n)})})}function fq({level:e,move:t}){let n={fill:`none`,strokeWidth:2.2,strokeLinecap:`round`,className:`stroke-foreground`};if(e===`off`)return(0,L.jsx)(`path`,{d:`M20 33 Q24.5 36.5 29 33 M35 33 Q39.5 36.5 44 33`,...n});if(e===`low`)return(0,L.jsx)(`path`,{d:`M20 34 Q24.5 29.5 29 34 M35 34 Q39.5 29.5 44 34`,...n});if(e===`max`)return(0,L.jsx)(`g`,{children:[25,39].map((e,n)=>(0,L.jsx)(z.path,{d:`M0 -5.5 L1.6 -1.6 L5.5 0 L1.6 1.6 L0 5.5 L-1.6 1.6 L-5.5 0 L-1.6 -1.6Z`,style:{x:e,y:33,fill:tq[n?4:0]},animate:t?{rotate:[0,90,180],scale:[1,1.25,1]}:{},transition:{...$K,duration:1.2,ease:`easeInOut`,delay:n*.2}},e))});let r=e===`minimal`?.45:e===`high`?.7:e===`xhigh`?1.2:1,i=t&&e===`medium`?{x:[0,-2.5,-2.5,2.5,2.5,0]}:{x:0},a=t&&e===`medium`?{...$K,duration:4,times:[0,.12,.4,.52,.8,1]}:{duration:.2},o=e===`minimal`?3.2:e===`xhigh`?1.4:3.6,s=t?{scaleY:[r,r,.1,r,r]}:{scaleY:r},c=t?{...$K,duration:o,times:[0,.44,.5,.56,1]}:{duration:.2};return(0,L.jsx)(z.g,{animate:i,transition:a,children:[25,39].map(t=>(0,L.jsxs)(`g`,{children:[(0,L.jsx)(z.ellipse,{cx:t,cy:33,rx:3.4,ry:3.8,className:`fill-foreground`,style:nq,animate:s,transition:c}),e===`minimal`?null:(0,L.jsx)(`circle`,{cx:t+1.2,cy:31.6,r:1,className:`fill-card`})]},t))})}function pq({level:e,move:t}){let n={fill:`none`,strokeWidth:2,strokeLinecap:`round`,className:`stroke-foreground`};switch(e){case`off`:return(0,L.jsxs)(`g`,{children:[(0,L.jsx)(`circle`,{cx:32,cy:42,r:1.4,className:`fill-foreground`}),t?(0,L.jsx)(z.circle,{cx:35,cy:42,r:3,fill:`none`,strokeWidth:.9,className:`stroke-primary/60`,animate:{scale:[.2,1.3,1.5,0],opacity:[.6,.9,.9,0]},transition:{...$K,duration:4,times:[0,.7,.9,1]},style:{transformOrigin:`33px 42px`}}):null]});case`minimal`:return(0,L.jsx)(z.ellipse,{cx:32,cy:42,rx:3,ry:.8,className:`fill-foreground`,animate:t?{ry:[.8,.8,3.6,3.6,.8],rx:[3,3,3.6,3.6,3]}:{},transition:{...$K,duration:6,times:[0,.6,.7,.85,1]}});case`low`:return(0,L.jsx)(`path`,{d:`M26 40 Q32 45 38 40`,...n});case`medium`:return(0,L.jsx)(`path`,{d:`M28 41.5 Q32 43 36 41.5`,...n});case`high`:return(0,L.jsx)(`path`,{d:`M27 42 L37 41`,...n});case`xhigh`:return(0,L.jsx)(`path`,{d:`M25.5 39.5 Q32 47 38.5 39.5Z`,className:`fill-foreground`});case`max`:return(0,L.jsxs)(`g`,{children:[(0,L.jsx)(`path`,{d:`M24 38.5 Q32 50 40 38.5Z`,className:`fill-foreground`}),(0,L.jsx)(`path`,{d:`M28.5 44.5 Q32 47.5 35.5 44.5 Q32 43 28.5 44.5Z`,style:{fill:`var(--rainbow-1)`}})]})}}function mq({level:e,className:t}){let n=Sf()??!1,r=QK.includes(e)?e:`medium`,i=`m${(0,m.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,a=!n,o=QK.indexOf(r),s=(0,m.useRef)(o),[c,l]=(0,m.useState)({n:0,up:!0});(0,m.useEffect)(()=>{o!==s.current&&(l(e=>({n:e.n+1,up:o>s.current})),s.current=o)},[o]);let u=rq(r),d=r===`max`,f=d?{stroke:`url(#${i}-rainbow)`}:void 0,p=!a||c.n===0?void 0:c.up?{y:[0,-9,0,0],scaleX:[1,.9,1.1,1],scaleY:[1,1.12,.9,1]}:{y:[0,0,0],scaleX:[1,1.12,1],scaleY:[1,.84,1]};return(0,L.jsxs)(`svg`,{viewBox:`0 0 64 64`,"data-slot":`effort-mascot`,"data-level":r,"aria-hidden":`true`,focusable:`false`,className:q(`size-14 shrink-0 overflow-visible`,t),children:[(0,L.jsxs)(`defs`,{children:[(0,L.jsxs)(`linearGradient`,{id:`${i}-rainbow`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[tq.map((e,t)=>(0,L.jsx)(`stop`,{offset:t/(tq.length-1),stopColor:e},t)),a&&d?(0,L.jsx)(`animateTransform`,{attributeName:`gradientTransform`,type:`rotate`,from:`0 0.5 0.5`,to:`360 0.5 0.5`,dur:`2.4s`,repeatCount:`indefinite`}):null]}),(0,L.jsxs)(`radialGradient`,{id:`${i}-glow`,children:[(0,L.jsx)(`stop`,{offset:`0.35`,stopColor:`var(--rainbow-6)`,stopOpacity:`0.45`}),(0,L.jsx)(`stop`,{offset:`0.7`,stopColor:`var(--rainbow-1)`,stopOpacity:`0.18`}),(0,L.jsx)(`stop`,{offset:`1`,stopColor:`var(--rainbow-3)`,stopOpacity:`0`})]})]}),d?a?(0,L.jsx)(uq,{id:i}):(0,L.jsx)(`circle`,{cx:32,cy:34,r:27,fill:`url(#${i}-glow)`}):null,a&&r===`xhigh`?(0,L.jsx)(cq,{}):null,(0,L.jsx)(z.g,{animate:p,transition:{duration:c.up?.55:.45,ease:`easeOut`},style:{transformOrigin:`32px 56px`},children:(0,L.jsxs)(z.g,{animate:a?u.animate:{rotate:r===`off`?-5:0},transition:a?u.transition:{duration:0},style:{transformOrigin:`32px 56px`},children:[(0,L.jsxs)(z.g,{style:{transformOrigin:`32px 17px`},animate:r===`off`?{rotate:32}:r===`minimal`?{rotate:14}:a&&r===`medium`?{rotate:[0,-12,10,0]}:a&&(r===`xhigh`||r===`max`)?{rotate:[-10,10,-10]}:{rotate:0},transition:a&&(r===`medium`||r===`xhigh`||r===`max`)?{...$K,duration:r===`medium`?2:.5,ease:`easeInOut`}:{type:`spring`,stiffness:200,damping:14},children:[(0,L.jsx)(`path`,{d:`M32 17 V10`,strokeWidth:2,strokeLinecap:`round`,className:d?void 0:`stroke-primary/70`,style:f}),(0,L.jsx)(z.circle,{cx:32,cy:7.5,r:3.2,className:d?void 0:r===`off`?`fill-muted-foreground/40`:`fill-primary`,style:{...nq,...d?{fill:`url(#${i}-rainbow)`}:{}},animate:a?r===`high`?{opacity:[1,.3,1]}:r===`medium`?{scale:[1,1.25,1]}:d||r===`xhigh`?{scale:[1,1.5,1]}:{scale:1,opacity:1}:{scale:1,opacity:1},transition:{...$K,duration:r===`high`?.5:r===`medium`?1.6:.4}})]}),[4.5,54].map((e,t)=>(0,L.jsx)(z.rect,{x:e,y:29,width:5.5,height:11,rx:2.5,className:d?void 0:`fill-primary/25`,style:{...nq,...d?{fill:tq[t?5:1],opacity:.6}:{}},animate:a&&(r===`xhigh`||d)?{rotate:t?[0,18,0]:[0,-18,0]}:{rotate:0},transition:{...$K,duration:.35}},e)),(0,L.jsx)(`rect`,{x:10,y:17,width:44,height:36,rx:11,strokeWidth:d?2.6:2,className:d?`fill-primary/10`:`fill-primary/10 stroke-primary/75`,style:f}),(0,L.jsx)(`rect`,{x:15,y:23,width:34,height:25,rx:7.5,className:`fill-card stroke-border`,strokeWidth:1}),a&&r===`high`?(0,L.jsx)(z.rect,{y:24,width:2,height:23,rx:1,className:`fill-primary/25`,animate:{x:[16,46,16]},transition:{...$K,duration:1.6,ease:`easeInOut`}}):null,r===`low`||d?(0,L.jsxs)(`g`,{className:`fill-destructive/25`,children:[(0,L.jsx)(`ellipse`,{cx:19.5,cy:39.5,rx:2.6,ry:1.6}),(0,L.jsx)(`ellipse`,{cx:44.5,cy:39.5,rx:2.6,ry:1.6})]}):null,(0,L.jsx)(fq,{level:r,move:a}),r===`high`||r===`xhigh`?(0,L.jsx)(`path`,{d:`M20 27 L28.5 28.8 M44 27 L35.5 28.8`,strokeWidth:1.9,strokeLinecap:`round`,className:`stroke-foreground`}):null,(0,L.jsx)(pq,{level:r,move:a}),(0,L.jsx)(`rect`,{x:20,y:53,width:24,height:4,rx:2,className:d?void 0:`fill-primary/25`,style:d?{fill:`url(#${i}-rainbow)`}:void 0})]})},c.n),r===`off`?a?(0,L.jsx)(iq,{}):(0,L.jsx)(`text`,{x:48,y:14,fontSize:`9`,fontWeight:`700`,className:`fill-muted-foreground`,children:`z`}):null,a&&r===`minimal`?(0,L.jsx)(iq,{}):null,a&&r===`low`?(0,L.jsx)(aq,{}):null,a&&r===`medium`?(0,L.jsx)(oq,{}):null,a&&r===`high`?(0,L.jsx)(sq,{spots:[[6,14,0],[58,12,.6]]}):null,a&&r===`xhigh`?(0,L.jsx)(lq,{}):null,d?a?(0,L.jsx)(sq,{rainbow:!0,spots:[[5,12,0],[59,10,.2],[2,44,.45],[62,46,.65],[32,-2,.85],[14,60,1.05],[50,60,.3]]}):(0,L.jsx)(`g`,{children:[[5,12],[59,10],[32,-2]].map(([e,t],n)=>(0,L.jsx)(`path`,{d:eq,style:{x:e,y:t,fill:tq[n*2]}},n))}):null,a&&c.n>0&&c.up?(0,L.jsx)(dq,{rainbow:d},`burst-${c.n}`):null]})}var hq={minimal:`min`,medium:`med`},gq={off:`No extra reasoning: the quickest, cheapest answer.`,minimal:`A moment of reasoning, barely.`,low:`Light reasoning for simple work.`,medium:`Balanced reasoning for most work.`,high:`Careful reasoning: slower, better on hard problems.`,xhigh:`Very deep reasoning: slow and costly.`,max:`As deep as the model goes.`};function _q(e,t,n){let r=-1;for(let i=0;i<e.length;i+=1)t.includes(e[i])&&(r<0||Math.abs(i-n)<Math.abs(r-n))&&(r=i);return r}function vq(e,t,n,r){for(let i=n+r;i>=0&&i<e.length;i+=r)if(t.includes(e[i]))return i;return n}function yq({value:e,levels:t,supported:n,model:r,label:i,disabled:a,onChange:o}){let s=(0,m.useRef)(null),[c,l]=(0,m.useState)(),[u,d]=(0,m.useState)(),f=(0,m.useRef)(void 0),p=(0,m.useRef)(0),h=(0,m.useCallback)(()=>{f.current=void 0,p.current=0,d(void 0)},[]),g=Math.max(t.length-1,1),_=_q(t,n,Math.max(0,t.indexOf(e))),v=c??u??_,y=v<0?0:v/g*100,b=t[v]??e,x=v>=0&&b!==e;(0,m.useEffect)(()=>{if(u===void 0)return;let e=window.setTimeout(h,1e4);return()=>window.clearTimeout(e)},[u,h]);let S=(0,m.useCallback)(e=>{let r=s.current?.getBoundingClientRect();if(!r||r.width===0)return _;let i=Math.min(1,Math.max(0,(e-r.left)/r.width));return _q(t,n,Math.round(i*g))},[g,t,_,n]);function C(e){a||n.length===0||(e.currentTarget.setPointerCapture(e.pointerId),l(S(e.clientX)))}function w(e){if(c===void 0)return;let t=S(e.clientX);t!==c&&l(t)}function T(){if(c===void 0)return;let n=t[c];l(void 0),n&&n!==e&&o(n)}function E(e){if(a||v<0)return;let r=f.current??v,i={ArrowRight:vq(t,n,r,1),ArrowUp:vq(t,n,r,1),ArrowLeft:vq(t,n,r,-1),ArrowDown:vq(t,n,r,-1),Home:_q(t,n,0),End:_q(t,n,g)}[e.key];if(i===void 0)return;e.preventDefault();let s=t[i];s&&i!==r&&(f.current=i,d(i),p.current+=1,Promise.resolve(o(s)).catch(()=>void 0).then(()=>{--p.current,p.current<=0&&h()}))}return(0,L.jsxs)(`div`,{className:q(`flex flex-col gap-1`,a&&`opacity-60`),children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,L.jsx)(`span`,{"data-level":b,className:`effort-word text-[0.8125rem] font-medium capitalize`,"aria-hidden":`true`,children:b}),(0,L.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:gq[b]??``})]}),(0,L.jsxs)(`div`,{ref:s,role:`slider`,tabIndex:a?-1:0,"aria-label":i,"aria-valuemin":0,"aria-valuemax":t.length-1,"aria-valuenow":Math.max(v,0),"aria-valuetext":b,"aria-disabled":a||void 0,onPointerDown:C,onPointerMove:w,onPointerUp:T,onPointerCancel:()=>l(void 0),onKeyDown:E,className:`relative mx-2.5 h-6 touch-none cursor-pointer rounded-full outline-none select-none focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-x-0 top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-muted`}),(0,L.jsx)(z.span,{"aria-hidden":`true`,className:`absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-primary`,animate:{width:`${y}%`},transition:{type:`spring`,stiffness:520,damping:34}}),t.map((e,t)=>{let i=n.includes(e);return(0,L.jsx)(`span`,{"aria-hidden":`true`,title:i?e:`${r??`This model`} does not support ${e}`,className:q(`absolute top-1/2 size-1 -translate-x-1/2 -translate-y-1/2 rounded-full`,i?t<=v?`bg-primary-foreground/80`:`bg-muted-foreground/40`:`bg-transparent ring-1 ring-muted-foreground/30`),style:{left:`${t/g*100}%`}},e)}),(0,L.jsx)(z.span,{"aria-hidden":`true`,className:q(`absolute top-1/2 size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-primary bg-white shadow-sm`,c!==void 0&&`scale-110`),animate:{left:`${y}%`},transition:{type:`spring`,stiffness:520,damping:28}})]}),(0,L.jsx)(`div`,{className:`relative mx-2.5 h-3.5 text-[0.68rem] text-muted-foreground`,"aria-hidden":`true`,children:t.map((e,t)=>{let i=n.includes(e);return(0,L.jsx)(`span`,{title:i?void 0:`${r??`This model`} does not support ${e}`,className:q(`absolute -translate-x-1/2 whitespace-nowrap`,t===v&&`font-medium text-foreground`,!i&&`opacity-40`),style:{left:`${t/g*100}%`},children:hq[e]??e},e)})}),x?(0,L.jsxs)(`p`,{className:`text-xs text-warning`,children:[e,` is not supported by `,r??`this model`,`, so it runs at `,b,`.`]}):null]})}function bq(e,t){let n=`${e.label} ${e.hint??``} ${e.value}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function xq({value:e,options:t,onChange:n,label:r,className:i,disabled:a}){let[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(0),f=(0,m.useRef)(null),p=(0,m.useId)(),h=(0,m.useMemo)(()=>t.filter(e=>bq(e,c)),[t,c]),g=t.find(t=>t.value===e);(0,m.useEffect)(()=>{o&&(l(``),d(Math.max(0,t.findIndex(t=>t.value===e))))},[o]),(0,m.useEffect)(()=>{c&&d(0)},[c]),(0,m.useEffect)(()=>{f.current?.querySelector(`[data-index="${u}"]`)?.scrollIntoView({block:`nearest`})},[u,o,h.length]);function _(t){t&&(s(!1),t.value!==e&&n(t.value))}function v(e){e.key===`ArrowDown`?(e.preventDefault(),d(e=>Math.min(h.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),d(e=>Math.max(0,e-1))):e.key===`Home`&&!c?(e.preventDefault(),d(0)):e.key===`End`&&!c?(e.preventDefault(),d(Math.max(0,h.length-1))):e.key===`Tab`?s(!1):e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),_(h[u]))}return(0,L.jsxs)(uD,{open:o,onOpenChange:s,children:[(0,L.jsxs)(dD,{type:`button`,role:`combobox`,"aria-label":r,"aria-keyshortcuts":`Enter Space ArrowDown ArrowUp`,"aria-description":`When focused, press Enter, Space or an arrow key to choose. Type to search.`,"aria-expanded":o,"aria-haspopup":`listbox`,"aria-controls":o?p:void 0,disabled:a,onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(!0))},"data-slot":`select-trigger`,className:q(`btn-raised flex h-8 w-full min-w-0 items-center justify-between gap-2 overflow-hidden rounded-lg border bg-card px-2.5 text-[0.8125rem] whitespace-nowrap outline-none transition-[border-color,box-shadow] duration-150 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:opacity-50`,i),children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:g?.label??e}),(0,L.jsx)(Wp,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]}),(0,L.jsx)(fD,{children:(0,L.jsxs)(pD,{align:`start`,sideOffset:4,collisionPadding:8,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.querySelector(`input`)?.focus()},className:`glass-pop z-50 flex max-h-[min(20rem,var(--radix-popover-content-available-height))] w-[max(var(--radix-popover-trigger-width),17rem)] max-w-(--radix-popover-content-available-width) flex-col overflow-hidden rounded-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5`,children:[(0,L.jsx)(ig,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,L.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,role:`searchbox`,"aria-label":`Search ${r}`,"aria-controls":p,"aria-activedescendant":h[u]?`${p}-${u}`:void 0,placeholder:`Search…`,autoComplete:`off`,spellCheck:!1,className:`h-8 min-w-0 flex-1 bg-transparent text-[0.8125rem] outline-none placeholder:text-muted-foreground`})]}),(0,L.jsxs)(`div`,{ref:f,id:p,role:`listbox`,"aria-label":r,className:`min-h-0 flex-1 overflow-y-auto p-1`,children:[h.length===0?(0,L.jsxs)(`p`,{className:`px-2.5 py-2 text-xs text-muted-foreground`,children:[`Nothing matches “`,c,`”.`]}):null,h.map((t,n)=>(0,L.jsxs)(`div`,{id:`${p}-${n}`,role:`option`,"aria-selected":t.value===e,"data-index":n,onPointerMove:()=>d(n),onClick:()=>_(t),className:q(`flex cursor-default items-center gap-2 rounded-lg px-2.5 py-1.5 text-[0.8125rem] select-none`,n===u&&`bg-accent`),children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:t.label}),t.hint?(0,L.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:t.hint}):null]}),t.value===e?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.value))]})]})})]})}function Sq({label:e,help:t,children:n,stacked:r}){return(0,L.jsxs)(`div`,{className:r?`grid gap-1.5`:`grid gap-1.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,18rem)] sm:items-center sm:gap-6`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[0.8125rem] font-medium`,children:e}),t?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]}),(0,L.jsx)(`div`,{className:`min-w-0`,children:n})]})}function Cq({children:e}){return(0,L.jsx)(`div`,{className:`card-raised flex flex-col divide-y divide-border rounded-xl border px-4 [&>*]:py-3`,children:e})}function wq({value:e,items:t,label:n,onChange:r}){return(0,L.jsx)(xq,{value:e,options:t.map(e=>({value:e.value,label:e.label,...e.help?{hint:e.help}:{}})),label:n,onChange:r})}var Tq=`(prefers-color-scheme: dark)`,Eq=[`dark`,`light`,`system`],Dq=m.createContext(void 0);function Oq(e){return e!==null&&Eq.includes(e)}function kq(){return window.matchMedia(Tq).matches?`dark`:`light`}function Aq(){let e=document.createElement(`style`);return e.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;transition:none!important}`)),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.remove()})})}}function jq(e){return e instanceof HTMLElement&&!!(e.isContentEditable||e.closest(`input, textarea, select, [contenteditable='true']`))}function Mq({children:e,defaultTheme:t=`system`,storageKey:n=`theme`,disableTransitionOnChange:r=!0,...i}){let[a,o]=m.useState(()=>{let e=localStorage.getItem(n);return Oq(e)?e:t}),s=m.useCallback(e=>{localStorage.setItem(n,e),o(e)},[n]),c=m.useCallback(e=>{let t=document.documentElement,n=e===`system`?kq():e,i=r?Aq():null;t.classList.remove(`light`,`dark`),t.classList.add(n),i&&i()},[r]);m.useEffect(()=>{if(c(a),a!==`system`)return;let e=window.matchMedia(Tq),t=()=>{c(`system`)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},[a,c]),m.useEffect(()=>{let e=e=>{e.repeat||e.metaKey||e.ctrlKey||e.altKey||jq(e.target)||e.key.toLowerCase()===`d`&&o(e=>{let t=e===`dark`?`light`:e===`light`?`dark`:kq()===`dark`?`light`:`dark`;return localStorage.setItem(n,t),t})};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n]),m.useEffect(()=>{let e=e=>{if(e.storageArea===localStorage&&e.key===n){if(Oq(e.newValue)){o(e.newValue);return}o(t)}};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}},[t,n]);let l=m.useMemo(()=>({theme:a,setTheme:s}),[a,s]);return(0,L.jsx)(Dq.Provider,{...i,value:l,children:e})}var Nq=()=>{let e=m.useContext(Dq);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e},Pq=[`master`,`designer`,`backend`,`qa`,`scout`,`researcher`,`quickfix`,`planner`],Fq={master:`Master`,designer:`Designer`,backend:`Backend`,qa:`QA`,scout:`Scout`,researcher:`Researcher`,quickfix:`Quick fix`,planner:`Planner`},Iq={model:`Model`,thinking:`Effort`,timeout:`Time limit`,instructions:`Instructions`},Lq=`inherit`,Rq=`inherit`,zq=`Use the session's current model`,Bq=`__custom__`,Vq=`custom…`,Hq=`Type a provider/model id`,Uq=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Wq={agents:`Agents`,workflow:`Workflow`,lint:`Linting`,lobby:`Lobby`,classifier:`Classifier`,appearance:`Appearance`,notifications:`Notifications`,install:`Install as app`},Gq=[{id:`startOn`,label:`On when pi starts`,help:`off: pi starts as plain pi, and ctrl+shift+m or /bot-lobby on turns bot-lobby on (a session that owns a task under way always starts on)`},{id:`issues`,label:`Issues tab`,help:`the GitHub Issues tab`}],Kq=[{id:`conversation`,label:`Conversation pane`},{id:`activity`,label:`Activity log pane`},{id:`thinking`,label:`Thinking bubble`}],qq=`shown on the Lobby tab`,Jq=`Planning rounds`,Yq=`how many rounds the panel gets before the oracle settles the rest alone`,Xq=[2,3,5,8,0],Zq=`Split long plans`,Qq=`saving a plan with more steps offers to split it into up to 5 tasks`,$q=[6,8,10,12,0],eJ=`Port`,tJ=`the base port (then the next free up to +20); 0 means any free port; applies the next time pi starts`,nJ=`Open browser`,rJ=`open this page in the browser when pi starts`,iJ=[{id:`off`,label:`off`,help:`tasks work in the folder you started them in`},{id:`branch`,label:`branch`,help:`each new task gets a git branch named after it, checked out in the working folder`},{id:`worktree`,label:`worktree`,help:`each new task gets its own worktree and branch, named after it: every agent runs there, apart from your checkout`}],aJ=`Git isolation`,oJ=[{id:`off`,label:`off`,help:`agents' work is never linted`},{id:`advise`,label:`advise`,help:`the oracle and QA are told what the project's linter finds on the lines a task changed; nothing is held`},{id:`block`,label:`block`,help:`new lint errors also hold a task's completion until they are fixed, or you accept the work as it is`}],sJ={intro:`After every worker step, before QA and at completion, bot-lobby lints only the files the task's agents touched. Problems on the lines the task changed are the task's; anything already there is shown but never holds it. Suppressions and lint-config changes the task adds go to QA to judge.`,mode:`Lint gate`,command:`Command`,commandHelp:`empty runs the linters the project configures (ESLint, Biome, Oxlint, Ruff), each from its own folder; a command runs without a shell from the repository's top, with {files} standing for the touched files`,commandPlaceholder:`found from the project`,extensions:`File types`,extensionsHelp:`which touched files the command is given, such as .ts .tsx .py`,extensionsPlaceholder:`every touched file`,timeout:`Time limit`,timeoutHelp:`for one linter run; one that runs over reads as could not run, and holds nothing`,found:`Found in this project`,foundHelp:`config files in the project and the folders a few levels below it`,foundNone:`No linter config found. Add one to the project, or set a command above.`,foundReplaced:`The command replaces these.`,installed:`installed`,missing:`not installed`,missingHelp:`install the project's dependencies there, or lint cannot run`,top:`project root`},cJ=[{id:`auto`,label:`Auto (OpenCode's free Jev, else TypeSafe)`},{id:`opencode`,label:`OpenCode Zen`},{id:`typesafe`,label:`TypeSafe`},{id:`openrouter`,label:`OpenRouter`},{id:`vercel`,label:`Vercel AI Gateway`}],lJ=[{id:`seats`,label:`Planning seats`,help:`each round, only the seats your idea or latest answers touch sit; 1-4 in the Plan tab pins one`},{id:`answers`,label:`Obvious answers`,help:`a panel question whose recommended option the conversation already makes clearly right is answered for you (listed under Assumptions)`},{id:`triage`,label:`Task triage`,help:`a new task's size, domains and research need reach the Master as hints; a quick fix that is really a task is held for you`},{id:`effort`,label:`Effort routing`,help:`a simple step runs one thinking level lower, a trivial one on the cheaper model below; a routed run that falls short runs again on your settings`},{id:`qa`,label:`QA risk`,help:`once a task's work is in, Jev reads the diff and sizes QA to it: no QA agent for a change with nothing that runs, a light check for a small one, deep review where a defect would spread; with it off the engine's rules decide`},{id:`review`,label:`Pull request read`,help:`the Git tab's quick read of a pull request: its size, and how likely it is risky, security-relevant, breaking or untested, before an agent reviews it`},{id:`knowledge`,label:`Relevant knowledge`,help:`when an agent's knowledge, standards or decisions file is too long for its prompt, Jev picks the sections that bear on the step, and the agent is told where the rest is`},{id:`files`,label:`File hints`,help:`scouts, workers, quick fixes and the planning panel start with the files most likely needed, and can look more up with find_relevant_files`}],uJ={enabled:`Classifier`,enabledHelp:`Jev makes the obvious decisions so large models spend fewer tokens on them`,host:`Host`,model:`Model`,modelHelp:`empty uses the host's default`,key:`API key`,keyNote:`the key pi already holds for this host; it is never read by this page`,cheap:`Cheaper model`,cheapNone:`none: trivial steps keep their model and drop a thinking level`,cheapHelp:`what effort routing runs trivial steps on`},dJ={title:`Settings`,intro:`Each agent's model and effort, the workflow and its lint gate, the lobby and the classifier. Changes save as you make them.`,loading:`Loading settings…`,loadFailed:`Could not load settings.`,saved:`Settings saved`,saving:`Saving…`,appearanceHelp:`Light, dark, or follow your system. Kept in this browser only.`,themeLabel:`Mode`,themeItems:[{id:`light`,label:`Light`},{id:`dark`,label:`Dark`},{id:`system`,label:`System`}],notificationsLabel:`Browser notifications`,notificationsHelp:`While this page is hidden, tell me when a question waits, a task finishes or a background session asks something.`,notificationsBlocked:`Notifications are blocked in your browser. Allow them for this site and try again.`,notificationsUnsupported:`This browser does not offer notifications.`,notificationsOn:`Browser notifications are on.`,notificationsOff:`Browser notifications are off.`,installLabel:`Install bot-lobby`,installHelp:`Opens in its own fullscreen window, with the shell cached so it starts when Pi is not running.`,installButton:`Install as fullscreen app`,installUnavailable:`Your browser has not offered to install it. Use its menu: “Install app” (Chrome, Edge) or Share, then “Add to Home Screen” (Safari).`,installDone:`bot-lobby is installed.`,installedNow:`Running as an installed app.`,fullscreenLabel:`Fullscreen`,fullscreenHelp:`Hide the browser's own bars for this tab (F11 does the same).`,fullscreenOn:`Exit fullscreen`,fullscreenOff:`Go fullscreen`},fJ=`https://tweakcn.com/editor/theme`;function pJ(){let{theme:e}=Nq();return e===`dark`||e===`system`&&typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}function mJ({palette:e,dark:t}){let n=le(e,t);return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`flex h-9 items-center gap-1.5 rounded-lg border border-border px-2`,style:{background:n.background},children:[(0,L.jsx)(`span`,{className:`size-4 rounded-full border border-black/10`,style:{background:n.card}}),(0,L.jsx)(`span`,{className:`size-4 rounded-full`,style:{background:n.primary}}),(0,L.jsx)(`span`,{className:`h-2 flex-1 rounded-full`,style:{background:n.accent}})]})}function hJ(){let e=Ge(),t=pJ(),n=(0,m.useRef)(null);function r(t){let r=t.key===`ArrowRight`||t.key===`ArrowDown`?1:t.key===`ArrowLeft`||t.key===`ArrowUp`?-1:0;if(!r)return;t.preventDefault(),t.stopPropagation();let i=Math.max(0,e.all.findIndex(t=>t.id===e.active.id)),a=e.all[(i+r+e.all.length)%e.all.length];e.choose(a.id),window.requestAnimationFrame(()=>n.current?.querySelector(`[data-theme-id="${a.id}"]`)?.focus())}return(0,L.jsx)(`div`,{ref:n,role:`radiogroup`,"aria-label":`Colour theme`,onKeyDown:r,className:`grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4`,children:e.all.map(n=>{let r=n.id===e.active.id;return(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space ArrowLeft ArrowRight`,"aria-describedby":`focused-action-help`,type:`button`,role:`radio`,"aria-checked":r,"data-theme-id":n.id,tabIndex:r?0:-1,onClick:()=>e.choose(n.id),className:q(`grid gap-1.5 rounded-lg border p-2 text-left outline-none transition-[border-color,box-shadow,background-color] duration-150 focus-visible:ring-3 focus-visible:ring-ring/40`,r?`border-primary bg-accent shadow-[0_0_0_1px_var(--primary)]`:`border-border hover:bg-accent/50`),children:[(0,L.jsx)(mJ,{palette:n,dark:t}),(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2 px-0.5 text-[0.8125rem] font-medium`,children:[(0,L.jsxs)(`span`,{className:`truncate`,children:[n.name,e.isSaved(n.id)?(0,L.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:`saved`}):null]}),r?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]})]},n.id)})})}function gJ({entry:e}){let t=Ge(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(e.name),[o,s]=(0,m.useState)();async function c(){let n=i.trim();if(!n||n===e.name)return r(!1);try{await t.rename(e.id,n),r(!1),s(void 0),V.success(`Renamed to ${n}.`)}catch(e){s(e.message)}}return(0,L.jsxs)(`li`,{className:`flex min-h-10 flex-wrap items-center gap-2 py-1.5`,children:[n?(0,L.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-center gap-1`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,L.jsx)(XK,{autoFocus:!0,value:i,maxLength:40,"aria-label":`New name for ${e.name}`,"aria-invalid":o?!0:void 0,onChange:e=>a(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),a(e.name),r(!1))},className:`h-8 max-w-64`}),(0,L.jsx)(X,{label:`Save the name`,text:`Save`,icon:Hp,tone:`primary`,type:`submit`,disabled:!i.trim()}),(0,L.jsx)(X,{label:`Keep the old name`,icon:Hg,iconOnly:!0,onClick:()=>{a(e.name),r(!1)}})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:e.name}),(0,L.jsx)(X,{label:`Rename ${e.name}`,text:`Rename`,icon:Bh,onClick:()=>{a(e.name),r(!0)}}),(0,L.jsx)(DA,{label:`Remove ${e.name}`,text:`Remove`,title:`Remove ${e.name}?`,description:`It is removed for every pi session. Keep a copy of its CSS if you want to use it again.`,confirmLabel:`Remove theme`,icon:wg,variant:`destructive`,onConfirm:()=>void t.remove(e.id).catch(e=>V.error(e.message))})]}),o?(0,L.jsx)(`p`,{role:`alert`,className:`w-full text-xs text-destructive`,children:o}):null]})}function _J(){let e=Ge();return e.saved.length===0?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No saved themes yet. Import one below and give it a name.`}):(0,L.jsx)(`ul`,{"aria-label":`Saved themes`,className:`divide-y divide-border`,children:e.saved.map(e=>(0,L.jsx)(gJ,{entry:e},e.id))})}function vJ(){let e=Ge(),[t,n]=(0,m.useState)(``),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(),[s,c]=(0,m.useState)(!1),l=(0,m.useRef)(null);async function u(t,a){let s=te(t);if(`error`in s){o(s.error);return}o(void 0),c(!0);try{let t=await e.adopt(s,r.trim()||s.name||a);n(``),i(``);let o=s.light?s.dark?void 0:`dark`:`light`;V.success(o?`${t.name} saved and applied. It has no ${o} colours, so ${o} mode keeps the default ones.`:`${t.name} saved and applied.`)}catch(e){o(e.message)}finally{c(!1)}}async function d(e){if(e){if(e.size>2e5){o(`That file is too large to be a theme.`);return}await u(await e.text(),e.name.replace(/\.[^.]+$/,``)||`Custom theme`)}}return(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pick or build a theme in the`,` `,(0,L.jsxs)(`a`,{href:fJ,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-0.5 text-link underline-offset-2 hover:underline`,children:[`tweakcn editor `,(0,L.jsx)(Em,{"aria-hidden":`true`,className:`size-3`})]}),`, press Code, copy it, and paste it here, or save it as a file and upload that. Colours and fonts are used; corners stay the page's own.`]}),(0,L.jsxs)(`label`,{className:`grid gap-1 text-xs text-muted-foreground`,children:[`Name`,(0,L.jsx)(XK,{value:r,maxLength:40,placeholder:`the theme's own name, or the file's`,onChange:e=>i(e.target.value),className:`h-8 max-w-80 text-foreground`})]}),(0,L.jsx)(dA,{value:t,onChange:e=>{n(e.target.value),o(void 0)},rows:4,spellCheck:!1,"aria-label":`Theme CSS from tweakcn`,"aria-invalid":a?!0:void 0,placeholder:`:root {
91
+ `).filter(Boolean),r=[];for(let t of n){let n=MB.exec(t);if(!n)return{body:e,files:[]};let i=n[1].split(/[\\/]/).pop()??``;if(!/^[\w.-]+$/.test(i))return{body:e,files:[]};r.push({id:i,name:i.replace(/^[a-z0-9]+-/,``),mime:n[2]})}return r.length>0?{body:e.slice(0,t).trimEnd(),files:r}:{body:e,files:[]}}var PB=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]);function FB({files:e}){return e.length===0?null:(0,L.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-2`,"aria-label":`Attached files`,children:e.map(e=>(0,L.jsx)(`li`,{children:PB.has(e.mime)?(0,L.jsx)(`a`,{href:N(`/files/preview/attachments/${e.id}`),target:`_blank`,rel:`noopener noreferrer`,className:`block overflow-hidden rounded-lg border border-border bg-muted/40 transition-transform duration-150 ease-snap hover:scale-[1.02]`,children:(0,L.jsx)(`img`,{src:N(`/files/preview/attachments/${e.id}`),alt:e.name,loading:`lazy`,className:`max-h-40 max-w-56 object-cover`})}):(0,L.jsxs)(`span`,{className:`inline-flex max-w-64 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground`,children:[e.mime===`application/pdf`?(0,L.jsx)(Pm,{"aria-hidden":`true`,className:`size-4 shrink-0`}):(0,L.jsx)(Ah,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.id))})}var IB=!1,LB=[],RB=0,zB=900;function BB(){IB=!0,window.clearTimeout(RB),RB=window.setTimeout(VB,zB)}function VB(){IB=!1,window.clearTimeout(RB);let e=LB;LB=[];for(let t of e)t()}function HB(e){if(!IB)return e(),()=>{};let t=()=>e();return LB.push(t),()=>{LB=LB.filter(e=>e!==t)}}var UB=8;function WB(e,t=24){let[n,r]=(0,m.useState)(t),i=(0,m.useRef)(8),a=n<e;return(0,m.useEffect)(()=>{if(!a)return;let e=0,t=HB(()=>{e=requestAnimationFrame(()=>{let e=performance.now();(0,Hv.flushSync)(()=>r(e=>e+i.current));let t=Math.max(1,performance.now()-e);i.current=Math.max(2,Math.min(400,Math.round(i.current*UB/t)))})});return()=>{t(),cancelAnimationFrame(e)}},[a,n]),Math.min(n,e)}function GB(e){return e?.type===`text`?e.value??``:(e?.children??[]).map(GB).join(``)}function KB(e,t=!1){let n=t||e.tagName===`a`;e.tagName===`code`&&(e.properties={...e.properties,copyBlocked:n,blockCode:t===!1&&e.properties?.blockCode});for(let t of e.children??[])e.tagName===`pre`&&(t.properties={...t.properties,blockCode:!0}),KB(t,n)}function qB(){return e=>KB(e)}function JB(e){let[t,n]=(0,m.useState)(!1);async function r(){try{await jB(e,navigator.clipboard),n(!0),V.success(`Code copied.`)}catch{V.error(`Could not copy code. Select it and copy manually, or allow clipboard access.`)}}return{copied:t,copy:r}}function YB({text:e,children:t,block:n=!1}){let{copy:r}=JB(e),i=(0,m.useRef)(void 0);return(0,L.jsxs)(`code`,{role:`button`,tabIndex:0,"aria-label":`Copy code`,"aria-keyshortcuts":`Enter Space`,title:`Copy code · Enter / Space`,className:`cursor-copy focus-visible:outline-2 focus-visible:outline-ring`,onPointerDown:e=>{i.current={x:e.clientX,y:e.clientY,moved:!1}},onPointerMove:e=>{let t=i.current;t&&Math.hypot(e.clientX-t.x,e.clientY-t.y)>4&&(t.moved=!0)},onClick:e=>{e.stopPropagation(),AB(window.getSelection()?.toString()??``,i.current?.moved??!1)&&r(),i.current=void 0},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),AB(window.getSelection()?.toString()??``,!1)&&r())},children:[t,n?null:(0,L.jsx)(`span`,{className:`sr-only`,children:` (activate to copy)`})]})}function XB({node:e,children:t,source:n}){let r=e,{copied:i,copy:a}=JB(kB(n,r?.position,!0)??GB(r)),o=r?.children?.find(e=>e.tagName===`code`)?.properties?.className,s=(Array.isArray(o)?o:[]).map(String).find(e=>e.startsWith(`language-`))?.slice(9);return(0,L.jsxs)(`div`,{className:`relative my-3 rounded-lg bg-muted`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between pl-3`,children:[(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[s&&/^[\w+#.-]{1,20}$/.test(s)?s:`code`,` · tap to copy`]}),(0,L.jsx)(Y,{label:i?`Copied`:`Copy the code`,icon:i?Hp:Sm,iconOnly:!0,onClick:()=>void a()})]}),(0,L.jsx)(`pre`,{className:`!my-0 overflow-x-auto !rounded-t-none !bg-transparent px-3 pb-3 text-sm leading-relaxed [&>code]:block`,children:t})]})}function ZB(e){return{pre:t=>(0,L.jsx)(XB,{...t,source:e}),code:({node:t,children:n})=>{let r=t;if(r?.properties?.copyBlocked)return(0,L.jsx)(`code`,{children:n});let i=!!r?.properties?.blockCode;return(0,L.jsx)(YB,{text:kB(e,r?.position,i)??GB(r),block:i,children:n})},a:({href:e,children:t})=>(0,L.jsx)(`a`,{href:e?N(e):void 0,target:`_blank`,rel:`noopener noreferrer nofollow`,children:t}),img:({src:e,alt:t})=>(0,L.jsx)(`img`,{src:e?N(e):void 0,alt:t??``,loading:`lazy`}),table:({children:e})=>(0,L.jsx)(`div`,{className:`my-3 w-full overflow-x-auto`,children:(0,L.jsx)(`table`,{className:`w-full border-collapse text-sm`,children:e})})}}var QB=(0,m.memo)(function({text:e}){return(0,L.jsx)(hL,{remarkPlugins:[xB],rehypePlugins:[qB],urlTransform:CB,components:ZB(e),children:e})}),$B=(0,m.memo)(function({text:e,className:t}){let{body:n,files:r}=NB(e),i=n?OB(n):[],a=WB(i.length,3);return(0,L.jsxs)(`div`,{className:q(`md-body`,t),children:[i.slice(0,a).map((e,t)=>(0,L.jsx)(QB,{text:e},t)),(0,L.jsx)(FB,{files:r})]})});function eV({title:e,note:t,className:n,children:r,collapsed:i,onToggle:a,shortcut:o,...s}){let c=typeof e==`string`?e:`pane`;return(0,L.jsxs)(`section`,{className:q(`group/frame relative flex min-h-0 min-w-0 flex-col`,i&&`flex-none`,n),...s,children:[e||t||a?(0,L.jsxs)(`div`,{className:q(`flex min-h-12 shrink-0 items-center justify-between gap-3 px-4`,!i&&`border-b border-border`),children:[e?(0,L.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-medium`,children:e}):(0,L.jsx)(`span`,{}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,L.jsx)(`span`,{className:`flex items-center gap-2 truncate text-xs text-muted-foreground`,children:t}):null,a?(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":!i,"aria-label":i?`Expand ${c}`:`Minimize ${c}`,title:`${i?`Expand`:`Minimize`}${o?` · ${o}`:``}`,"aria-keyshortcuts":o?`${o} Enter Space`:`Enter Space`,"aria-describedby":`focused-action-help`,onClick:a,className:`btn-ghost -mr-1.5 inline-flex h-8 items-center gap-1.5 rounded-lg border border-transparent px-2 text-muted-foreground transition-[box-shadow,color,translate] duration-150 ease-snap outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`,children:[o?(0,L.jsx)(GO,{chord:o,className:`kbd-hint`}):null,(0,L.jsx)(Wp,{"aria-hidden":`true`,className:q(`size-4 transition-transform duration-200 ease-snap`,i&&`-rotate-90`)})]}):null]})]}):null,i?null:r]})}function tV({title:e,right:t,className:n}){return(0,L.jsxs)(`span`,{className:q(`flex min-w-0 items-center gap-3`,n),children:[(0,L.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`min-w-4 flex-1`}),t?(0,L.jsx)(`span`,{className:`shrink-0 text-xs font-normal text-muted-foreground`,children:t}):null]})}function nV({title:e,right:t,prominent:n,children:r}){return(0,L.jsxs)(`section`,{className:q(`flex flex-col`,n?`gap-3`:`gap-2.5`),children:[(0,L.jsx)(`h3`,{className:n?`text-sm text-foreground`:`text-xs text-muted-foreground`,children:(0,L.jsx)(tV,{title:e,right:t,className:n?`[&>span:first-child]:font-semibold`:void 0})}),r]})}var rV=`Pull requests`,iV=`An agent reviews it, optionally with a focus you type; Jev's quick read sizes it up first.`,aV=`nothing is posted to GitHub`,oV=`Refresh to load open pull requests with the GitHub CLI (gh).`,sV=`No open pull requests.`,cV=`loading pull requests from GitHub…`,lV=`reading the diff…`,uV=`the pull request has new commits since this review — review it again`,dV=`(no description)`,fV=`Review with a focus (optional)`,pV=`Leave it empty for a full review.`;function mV(e){return e===`passing`?`✓`:e===`failing`?`✗`:e===`pending`?`…`:``}function hV(e){return e===`passing`?`text-success`:e===`failing`?`text-destructive`:`text-muted-foreground`}function gV(e,t){return`+${e} −${t}`}function _V(e){return e===`APPROVED`?`approved`:e===`CHANGES_REQUESTED`?`changes requested`:e===`REVIEW_REQUIRED`?`review required`:``}function vV(e){return e?e.status===`running`?`reviewing`:e.status!==`done`||!e.verdict?``:e.verdict===`approve`?`approved`:e.verdict===`changes`?`changes found`:`commented`:``}function yV(e){return e===`approve`?`approve`:e===`changes`?`request changes`:e===`comment`?`comment`:``}function bV(e,t){if(e.status===`running`)return xV(e,t);if(e.status===`cancelled`)return`stopped`;let n=e.status===`done`?xV(e,t):e.status;return[yV(e.verdict),n].filter(Boolean).join(` · `)}function xV(e,t){let n=Math.max(0,Math.round(((e.finishedAt??t)-e.startedAt)/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m ${String(n%60).padStart(2,`0`)}s`}function SV(e,t){return[e.state?e.draft?`draft`:e.state.toLowerCase():e.draft?`draft`:``,e.author?`by ${e.author}`:``,e.updatedAt?`updated ${xA(t-Date.parse(e.updatedAt))}`:``].filter(Boolean).join(` · `)}function CV(e){let t=`${e.changedFiles} file${e.changedFiles===1?``:`s`}`;return`${e.headRef||`?`} → ${e.baseRef||`?`} · ${gV(e.additions,e.deletions)} · ${t}`}function wV(e){let t=e.mergeable===`CONFLICTING`?`conflicts`:e.mergeable===`MERGEABLE`?`mergeable`:``;return[e.checks?`checks ${e.checks} (${e.checkCount})`:``,_V(e.decision),t,e.labels.join(`, `)].filter(Boolean).join(` · `)}function TV(e){return[`${e.changedFiles} file${e.changedFiles===1?``:`s`}`,e.labels.join(`, `),e.review?.stale?`stale`:``].filter(Boolean).join(` · `)}function EV(e){return e.read?`${e.read.model} · ${e.read.ms} ms`:``}function DV(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),e?t:Date.now()}function OV({pull:e,now:t}){return(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:[(0,L.jsxs)(`span`,{className:`font-normal text-muted-foreground tabular-nums`,children:[`#`,e.number]}),` `,e.title]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:SV(e,t)}),(0,L.jsx)(`p`,{className:`text-sm tabular-nums`,children:CV(e)}),wV(e)?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:wV(e)}):null,e.url?(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,className:`text-xs break-all text-primary underline underline-offset-4`,children:e.url}):null]})}function kV({read:e}){return(0,L.jsxs)(nV,{title:`Jev's read`,right:EV(e),children:[e.status===`running`?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(vk,{className:`size-3.5`}),lV]}):null,e.status===`failed`?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:e.error??`Jev could not read it`}):null,e.status===`done`&&e.line?(0,L.jsx)($B,{text:e.line}):null]})}function AV({review:e,now:t}){return(0,L.jsxs)(L.Fragment,{children:[e.model?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:[e.model,e.thinking].filter(Boolean).join(` · `)}):null,e.focus?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`focus: `,e.focus]}):null,e.saved?(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`kept from `,xA(t-e.startedAt)]}):null,e.stale?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:uV}):null,e.status===`running`?(0,L.jsx)(jV,{steps:e.steps}):null,e.status===`cancelled`?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`stopped`}):null,e.status===`failed`||e.status===`timeout`?(0,L.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`✗ `,e.error??e.status]}):null,e.text?(0,L.jsx)($B,{text:e.text}):null]})}function jV({steps:e}){return(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm text-muted-foreground`,children:e.slice(-6).map((e,t)=>(0,L.jsxs)(`li`,{className:`break-words`,children:[`· `,e]},t))})}function MV({number:e,focus:t,onChange:n}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`label`,{htmlFor:`focus-${e}`,className:`text-[0.8125rem] font-medium text-foreground`,children:fV}),(0,L.jsx)(gA,{id:`focus-${e}`,value:t,rows:2,maxLength:2e3,onChange:e=>n(e.target.value)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:pV})]})}function NV({number:e,review:t,now:n,focus:r,onFocus:i}){return(0,L.jsxs)(nV,{title:`Review`,right:t?bV(t,n):void 0,children:[t?(0,L.jsx)(AV,{review:t,now:n}):null,(0,L.jsx)(MV,{number:e,focus:r,onChange:i}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`A read-only agent reviews it — `,aV,`.`]})]})}function PV({files:e}){return(0,L.jsx)(nV,{title:`Files`,right:String(e.length),children:(0,L.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-border`,children:(0,L.jsx)(`table`,{className:`w-full border-collapse text-sm tabular-nums`,children:(0,L.jsx)(`tbody`,{children:e.map(e=>(0,L.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,L.jsx)(`td`,{className:`max-w-0 px-3 py-1.5 break-all`,children:e.path}),(0,L.jsx)(`td`,{className:`px-3 py-1.5 text-right text-xs whitespace-nowrap text-muted-foreground`,children:gV(e.additions,e.deletions)})]},e.path))})})})})}function FV({note:e,now:t}){let n=[e.state&&e.state!==`COMMENTED`?e.state.toLowerCase().replace(/_/g,` `):``,e.at?xA(t-Date.parse(e.at)):``].filter(Boolean).join(` · `);return(0,L.jsxs)(`article`,{className:`card-raised flex flex-col gap-1.5 rounded-lg border px-3.5 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:e.author??`comment`}),n?(0,L.jsx)(`span`,{children:n}):null]}),e.body.trim()?(0,L.jsx)($B,{text:e.body.trim()}):null]})}function IV({notes:e,now:t}){return e.length===0?null:(0,L.jsx)(nV,{title:`Discussion`,right:String(e.length),children:(0,L.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,n)=>(0,L.jsx)(FV,{note:e,now:t},n))})})}function LV({number:e,error:t}){return t?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load #`,e,`. `,t]}):(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(vk,{className:`size-3.5`}),`loading #`,e,`…`]})}function RV({number:e,onChanged:t}){let n=Ak(`git.pull`,{number:e},[`git`]),[r,i]=(0,m.useState)(``),a=n.data?.review?.status===`running`,o=DV(a);if(!n.data)return(0,L.jsx)(LV,{number:e,error:n.error});let{pull:s,review:c,read:l}=n.data,u=()=>{n.reload(),t?.()},d=async()=>{let t=r.trim();i(``),await H(`git.review`,{number:e,...t?{focus:t}:{}}),u()},f=async()=>{await H(`git.jev`,{number:e}),u()},p=async()=>{await H(`git.cancelReview`,{number:e}),u()};return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`Pull request #${e}`,children:[(0,L.jsxs)(eA,{children:[(0,L.jsx)(Y,{label:`Review`,icon:Hh,tone:`primary`,shortcut:`V`,disabled:a,onClick:()=>void d()}),(0,L.jsx)(Y,{label:`Jev's read`,icon:Ip,shortcut:`Q`,disabled:a,onClick:()=>void f()}),a?(0,L.jsx)(MA,{icon:um,label:`Stop the review`,text:`Stop`,shortcut:`X`,title:`Stop this review?`,description:`The agent stops reading the pull request. Nothing is posted to GitHub.`,confirmLabel:`Stop review`,variant:`destructive`,onConfirm:()=>void p()}):null]}),(0,L.jsx)(OV,{pull:s,now:o}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:iV}),l?(0,L.jsx)(kV,{read:l}):null,(0,L.jsx)(NV,{number:e,review:c,now:o,focus:r,onFocus:i}),s.files.length>0?(0,L.jsx)(PV,{files:s.files}):null,(0,L.jsx)(nV,{title:`Description`,children:s.body.trim()?(0,L.jsx)($B,{text:s.body.trim()}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:dV})}),(0,L.jsx)(IV,{notes:s.notes,now:o})]})}var zV=Yg([`relative inline-flex shrink-0 items-center justify-center w-fit border border-transparent font-medium whitespace-nowrap outline-none transition-shadow`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-3`],{variants:{variant:{default:`bg-primary text-primary-foreground`,outline:`border-border bg-transparent dark:bg-input/32`,secondary:`bg-secondary text-secondary-foreground`,info:`bg-info text-white`,success:`bg-success text-white`,warning:`bg-warning text-white`,destructive:`bg-destructive text-white`,focus:`bg-focus text-focus-foreground`,invert:`bg-invert text-invert-foreground`,"primary-light":`border-primary/10 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/15 dark:text-primary`,"warning-light":`border-warning/15 bg-warning/10 text-warning-foreground dark:border-warning/25 dark:bg-warning/15 dark:text-warning`,"success-light":`border-success/15 bg-success/10 text-success-foreground dark:border-success/25 dark:bg-success/15 dark:text-success`,"info-light":`border-info/15 bg-info/10 text-info-foreground dark:border-info/25 dark:bg-info/15 dark:text-info`,"destructive-light":`border-destructive/15 bg-destructive/10 text-destructive-foreground dark:border-destructive/25 dark:bg-destructive/15 dark:text-destructive`,"invert-light":`border-invert/15 bg-invert/10 text-foreground dark:border-invert/45 dark:bg-invert/35 dark:text-invert-foreground`,"focus-light":`border-focus/15 bg-focus/10 text-focus-foreground dark:border-focus/25 dark:bg-focus/15 dark:text-focus`,"primary-outline":`bg-background border-border text-primary dark:bg-input/30`,"warning-outline":`bg-background border-border text-warning-foreground dark:bg-input/30`,"success-outline":`bg-background border-border text-success-foreground dark:bg-input/30`,"info-outline":`bg-background border-border text-info-foreground dark:bg-input/30`,"destructive-outline":`bg-background border-border text-destructive-foreground dark:bg-input/30`,"invert-outline":`bg-background border-border text-invert-foreground dark:bg-input/30`,"focus-outline":`bg-background border-border text-focus-foreground dark:bg-input/30`},size:{xs:`px-1 py-0.25 text-[0.6rem] leading-none h-4 min-w-4 gap-1`,sm:`px-1 py-0.25 text-[0.625rem] leading-none h-4.5 min-w-4.5 gap-1`,default:`px-1.25 py-0.5 text-xs h-5 min-w-5 gap-1`,lg:`px-1.5 py-0.5 text-xs h-5.5 min-w-5.5 gap-1`,xl:`px-2 py-0.75 text-sm h-6 min-w-6 gap-1.5`},radius:{default:`rounded-sm`,full:`rounded-full`}},defaultVariants:{variant:`default`,size:`default`,radius:`default`}});function BV({className:e,variant:t,size:n,radius:r,asChild:i=!1,...a}){let o=i?kv:`span`;return(0,L.jsx)(o,{"data-slot":`badge`,className:q(zV({variant:t,size:n,radius:r,className:e})),...a})}var VV=`flex min-h-10 w-full flex-col gap-0.5 rounded-lg px-2.5 py-2 text-left outline-none transition-colors duration-150 hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/40 aria-[current=true]:bg-accent`,HV=`flex flex-col gap-0.5 px-2 pb-2`,UV=`px-4 pt-4 pb-1 text-xs font-medium text-muted-foreground`;function WV({checks:e}){let t=mV(e);return t?(0,L.jsx)(`span`,{className:q(`w-4 shrink-0 text-center`,hV(e)),"aria-hidden":`true`,children:t}):(0,L.jsx)(`span`,{className:`w-4 shrink-0`,"aria-hidden":`true`})}function GV({pull:e,selected:t,onSelect:n}){let r=vV(e.review);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(e.number),className:VV,children:[(0,L.jsxs)(`span`,{className:`flex items-start gap-2 text-sm`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:[`#`,e.number]}),(0,L.jsx)(WV,{checks:e.checks}),e.draft?(0,L.jsx)(BV,{variant:`secondary`,children:`draft`}):null,(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.title})]}),(0,L.jsxs)(`span`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:TV(e)}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[r?(0,L.jsx)(`span`,{children:r}):null,(0,L.jsx)(`span`,{className:`tabular-nums`,children:gV(e.additions,e.deletions)})]})]})]})})}function KV({pulls:e,selectedId:t,onSelect:n}){return(0,L.jsx)(`ul`,{className:HV,children:e.map(e=>(0,L.jsx)(GV,{pull:e,selected:e.number===t,onSelect:n},e.number))})}var qV=()=>uk(lk(`git`)),JV=e=>uk(lk(`git`,String(e)));function YV(e){let t=Number(e[0]);return Number.isInteger(t)&&t>0?t:void 0}function XV({loading:e,loaded:t,error:n,onRetry:r}){let i=n?`✗ ${n}`:t?sV:e?cV:oV;return(0,L.jsxs)(fk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(Hm,{"aria-hidden":`true`})}),(0,L.jsx)(_k,{className:n?`text-destructive`:void 0,children:i})]}),n?(0,L.jsx)(J,{variant:`outline`,onClick:r,children:`Retry`}):null]})}function ZV({rest:e}){let t=lA(),n=Ak(`git.pulls`,{},[`git`]),r=YV(e),i=n.data?.pulls??[],a=(0,m.useCallback)(()=>{H(`git.pulls`,{refresh:!0}).then(()=>n.reload())},[n]);if(!n.data&&n.error)return(0,L.jsx)(wk,{message:`Could not load pull requests. ${n.error}`,onRetry:n.reload});if(n.data&&i.length===0)return(0,L.jsx)(XV,{loading:n.data.loading,loaded:n.data.loaded,error:n.data.error,onRetry:n.reload});let o=n.loading||!!n.data?.loading,s=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:rV,count:n.data?`${i.length} open`:void 0,children:(0,L.jsx)(Y,{label:`Refresh`,icon:Kh,shortcut:`R`,disabled:o,className:q(`h-7`,o&&`[&_svg]:animate-spin`),onClick:a})}),n.data?.error?(0,L.jsxs)(`p`,{className:`px-3 pt-2 text-sm text-destructive`,children:[`✗ `,n.data.error]}):null,n.data?(0,L.jsx)(KV,{pulls:i,selectedId:r,onSelect:JV}):(0,L.jsx)(hA,{})]}),c=r===void 0?null:(0,L.jsx)(RV,{number:r,onChanged:n.reload},r);return(0,L.jsx)(pA,{wide:t,list:s,detail:c,open:r!==void 0,onClose:qV,hint:`Select a pull request to see its detail.`,describe:`Pull request detail`})}function QV(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing}function $V({label:e,hint:t,buttonLabel:n=`Send`,onSend:r}){let i=(0,m.useId)(),[a,o]=(0,m.useState)(``),[s,c]=(0,m.useState)(!1),l=async()=>{a.trim()&&!s&&(c(!0),await r(a)&&o(``),c(!1))};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium text-foreground`,children:e}),(0,L.jsx)(gA,{id:i,value:a,rows:2,"aria-describedby":t?`${i}-hint`:void 0,onChange:e=>o(e.target.value),onKeyDown:e=>{QV(e)&&(e.preventDefault(),l())}}),t?(0,L.jsx)(`p`,{id:`${i}-hint`,className:`text-xs text-muted-foreground`,children:t}):null,(0,L.jsx)(`div`,{className:`flex self-end`,children:(0,L.jsx)(Y,{label:n,icon:s?nh:Pp,tone:`primary`,shortcut:`Enter`,className:s?`[&_svg]:animate-spin`:void 0,onClick:()=>void l(),disabled:!a.trim()||s})})]})}var eH=`Issues`,tH=`Issue`,nH=`Plan it opens a planning session on this issue; save the plan as a task once the panel agrees it.`,rH=`Refresh to load open issues with the GitHub CLI (gh).`,iH=`No open issues. File one with New issue.`,aH=`loading issues from GitHub…`,oH=`issues are off (lobby.issues)`,sH=`(no description)`;function cH(e,t){return[e.state?e.state.toLowerCase():``,e.author?`by ${e.author}`:``,e.updatedAt?`updated ${xA(t-Date.parse(e.updatedAt))}`:``,e.labels.join(`, `)].filter(Boolean).join(` · `)}function lH(e,t){return[e.author?`by ${e.author}`:``,e.updatedAt?xA(t-Date.parse(e.updatedAt)):``].filter(Boolean).join(` · `)}function uH(e){return e.length>0?`[${e.slice(0,2).join(`, `)}]`:``}function dH({issue:e,now:t}){return(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:[(0,L.jsxs)(`span`,{className:`font-normal text-muted-foreground tabular-nums`,children:[`#`,e.number]}),` `,e.title]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:cH(e,t)}),e.url?(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,className:`text-xs break-all text-primary underline underline-offset-4`,children:e.url}):null]})}function fH({comment:e,now:t}){return(0,L.jsxs)(`article`,{className:`card-raised flex flex-col gap-1.5 rounded-lg border px-3.5 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:e.author??`comment`}),e.createdAt?(0,L.jsx)(`span`,{children:xA(t-Date.parse(e.createdAt))}):null]}),(0,L.jsx)($B,{text:e.body.trim()})]})}function pH({comments:e,now:t}){return e.length===0?null:(0,L.jsx)(nV,{title:`Comments`,right:String(e.length),children:(0,L.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map((e,n)=>(0,L.jsx)(fH,{comment:e,now:t},n))})})}function mH({issue:e}){let t=async()=>{await H(`planner.new`,{seed:{issue:{number:e.number,title:e.title,...e.url?{url:e.url}:{}},body:e.body}})&&uk(lk(`plan`))};return(0,L.jsx)(MA,{icon:Bg,label:`Plan #${e.number} with the panel`,text:`Plan it`,shortcut:`N`,title:`Plan #${e.number} with the panel?`,description:`A new planning session starts from this issue. A plan already under way waits under Plan → Previous.`,confirmLabel:`Plan it`,onConfirm:()=>void t()})}function hH({number:e}){let t=Ak(`issues.get`,{number:e},[`issues`]),n=Date.now();if(!t.data)return t.error?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load #`,e,`. `,t.error]}):(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(vk,{className:`size-3.5`}),`loading #`,e,`…`]});let r=t.data.issue;return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`${tH} #${e}`,children:[(0,L.jsx)(eA,{children:(0,L.jsx)(mH,{issue:r})}),(0,L.jsx)(dH,{issue:r,now:n}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:nH}),(0,L.jsx)(nV,{title:`Description`,children:r.body.trim()?(0,L.jsx)($B,{text:r.body.trim()}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:sH})}),(0,L.jsx)(pH,{comments:r.comments,now:n})]})}function gH({issue:e,selected:t,now:n,onSelect:r}){let i=uH(e.labels);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>r(e.number),className:VV,children:[(0,L.jsxs)(`span`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:[`#`,e.number]}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.title}),i?(0,L.jsx)(`span`,{className:`max-w-full break-words text-xs text-muted-foreground`,children:i}):null]}),(0,L.jsx)(`span`,{className:`pl-9 text-xs text-muted-foreground`,children:lH(e,n)})]})})}function _H({issues:e,selectedId:t,now:n,onSelect:r}){return(0,L.jsx)(`ul`,{className:HV,children:e.map(e=>(0,L.jsx)(gH,{issue:e,selected:e.number===t,now:n,onSelect:r},e.number))})}var vH=()=>uk(lk(`issues`)),yH=e=>uk(lk(`issues`,String(e)));function bH(e){let t=Number(e[0]);return Number.isInteger(t)&&t>0?t:void 0}function xH(){return(0,L.jsx)(fk,{className:`m-4 flex-1`,children:(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(om,{"aria-hidden":`true`})}),(0,L.jsx)(gk,{children:`Issues are off`}),(0,L.jsx)(_k,{className:`font-mono`,children:oH})]})})}function SH({loading:e,loaded:t,error:n,onRetry:r}){let i=n?`✗ ${n}`:t?iH:e?aH:rH;return(0,L.jsxs)(fk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(om,{"aria-hidden":`true`})}),(0,L.jsx)(_k,{className:n?`text-destructive`:void 0,children:i})]}),n?(0,L.jsx)(J,{variant:`outline`,onClick:r,children:`Retry`}):null]})}function CH({onCreate:e}){return(0,L.jsx)(uA,{className:`shrink-0 border-t border-border p-4`,children:(0,L.jsx)($V,{label:`New issue`,hint:`The first line becomes the title; the rest is the body. Enter files it.`,buttonLabel:`File issue`,onSend:e})})}function wH({rest:e}){let t=lA(),n=Ok(`status`).data?.issuesEnabled??!0,r=Ak(`issues.list`,{},[`issues`],n),i=bH(e),a=r.data?.issues??[],o=Date.now(),s=(0,m.useCallback)(()=>{H(`issues.list`,{refresh:!0}).then(()=>r.reload())},[r]),c=async e=>await H(`issues.create`,{text:e})?(r.reload(),!0):!1;if(!n)return(0,L.jsx)(xH,{});if(!r.data&&r.error)return r.error.includes(`issues are off`)?(0,L.jsx)(xH,{}):(0,L.jsx)(wk,{message:`Could not load issues. ${r.error}`,onRetry:r.reload});let l=r.loading||!!r.data?.loading,u=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:eH,count:r.data?`${a.length} open`:void 0,children:(0,L.jsx)(Y,{label:`Refresh`,icon:Kh,shortcut:`R`,disabled:l,className:q(`h-7`,l&&`[&_svg]:animate-spin`),onClick:s})}),r.data?.error?(0,L.jsxs)(`p`,{className:`px-3 pt-2 text-sm text-destructive`,children:[`✗ `,r.data.error]}):null,r.data?(0,L.jsx)(_H,{issues:a,selectedId:i,now:o,onSelect:yH}):(0,L.jsx)(hA,{}),(0,L.jsx)(CH,{onCreate:c})]}),d=i===void 0?null:(0,L.jsx)(hH,{number:i},i),f=r.data&&a.length===0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(SH,{loading:r.data.loading,loaded:r.data.loaded,error:r.data.error,onRetry:r.reload}),(0,L.jsx)(`div`,{className:`shrink-0 pb-dock`,children:(0,L.jsx)(CH,{onCreate:c})})]}):(0,L.jsx)(pA,{wide:t,list:u,detail:d,open:i!==void 0,onClose:vH,hint:`Select an issue to read it.`,describe:`Issue detail`});return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:f})}function TH(e){let t=(0,m.useRef)(null),n=(0,m.useRef)(!0),[r,i]=(0,m.useState)(!0),a=(0,m.useRef)(void 0),o=(0,m.useRef)(null),s=(0,m.useCallback)(()=>{n.current=!0,i(!0);let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[]);return(0,m.useLayoutEffect)(()=>{n.current&&s()},[e,s]),(0,m.useLayoutEffect)(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(()=>{n.current&&(e.scrollTop=e.scrollHeight)});return r.observe(e),a.current=r,()=>{r.disconnect(),a.current=void 0,o.current=null}},[]),(0,m.useLayoutEffect)(()=>{let e=a.current,n=t.current?.firstElementChild??null;e&&n!==o.current&&(o.current&&e.unobserve(o.current),n&&e.observe(n),o.current=n)},[e]),{ref:t,atBottom:r,stick:s,onScroll:(0,m.useCallback)(()=>{let e=t.current;e&&(n.current=e.scrollHeight-e.scrollTop-e.clientHeight<48,i(n.current))},[])}}var EH={DEV:vm,DESIGN:Eh,QA:cg,RESEARCH:bg,"QUICK FIX":Wg,SCOUT:bm,PLANNER:eg,CLASSIFIER:vg,LOBBY:mh,LINT:Qm};function DH(e){return e?EH[e.toUpperCase()]??Rp:Bp}function OH(e){let t=e?.toUpperCase();return t===`ORACLE`||t===`MASTER`}function kH({source:e,className:t,strokeWidth:n}){if(OH(e))return(0,L.jsx)(`span`,{"aria-hidden":`true`,"data-agent-icon":e,className:q(`agent-oracle shrink-0`,t)});let r=DH(e);return(0,L.jsx)(r,{"aria-hidden":`true`,"data-agent-icon":e??`thinking`,strokeWidth:n,className:q(`shrink-0`,t)})}var AH={MASTER:`text-primary`,DEV:`text-source-dev`,DESIGN:`text-source-design`,QA:`text-source-qa`,RESEARCH:`text-source-research`,"QUICK FIX":`text-source-quickfix`,ORACLE:`text-primary`,LOBBY:`text-muted-foreground`};function jH(e){return e.length<=2?e:e.charAt(0)+e.slice(1).toLowerCase()}function MH(e){return AH[e]??`text-muted-foreground`}var NH={MASTER:`var(--primary)`,DEV:`var(--source-dev)`,DESIGN:`var(--source-design)`,QA:`var(--source-qa)`,RESEARCH:`var(--source-research)`,"QUICK FIX":`var(--source-quickfix)`,ORACLE:`var(--primary)`,LOBBY:`var(--muted-foreground)`};function PH(e){return NH[e]??`var(--muted-foreground)`}function FH(e){if(e.role===`researcher`)return`RESEARCH`;let t=e.domain??e.role;return t===`backend`||t===`dev`?`DEV`:t===`designer`||t===`design`?`DESIGN`:t===`researcher`||t===`research`?`RESEARCH`:t===`qa`?`QA`:t?String(t).toUpperCase():`AGENT`}function IH(e){return e?.runs??[]}function LH(e,t=40){let n=new Map;for(let t of e)n.set(t.source,t);return[...n.values()].sort((e,t)=>e.at-t.at).slice(-t)}function RH({source:e,live:t}){let n=OH(e);return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`chat-avatar`,"data-live":t||void 0,"data-oracle":n||void 0,style:{"--orb":PH(e)},children:(0,L.jsx)(kH,{source:e,strokeWidth:2.25,className:n?`size-7`:`size-3.5`})})}function zH({source:e,name:t,time:n,head:r,live:i,children:a,aside:o,bubble:s=!0}){return(0,L.jsxs)(`div`,{className:`chat-row group/msg`,children:[(0,L.jsx)(`div`,{className:`chat-gutter`,children:r?(0,L.jsx)(RH,{source:e,live:i}):n?(0,L.jsx)(`time`,{className:`chat-hover-time`,children:n}):null}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,L.jsxs)(`p`,{className:`chat-speaker`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),n?(0,L.jsx)(`time`,{className:`text-xs text-muted-foreground tabular-nums`,children:n}):null,o?(0,L.jsx)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:o}):null]}):null,s?(0,L.jsx)(`div`,{className:`chat-bubble-agent`,style:{"--orb":PH(e)},children:a}):a]})]})}function BH({time:e,head:t,note:n,children:r,below:i}){return(0,L.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[t?(0,L.jsxs)(`p`,{className:`flex items-baseline gap-2 text-xs text-muted-foreground`,children:[e?(0,L.jsx)(`time`,{className:`tabular-nums`,children:e}):null,(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:`You`}),n?(0,L.jsx)(`span`,{children:n}):null]}):null,(0,L.jsx)(`div`,{className:`chat-bubble`,children:r}),i]})}function VH({failed:e,children:t}){return(0,L.jsx)(`div`,{role:`note`,className:q(`chat-note`,e&&`text-destructive`),children:(0,L.jsx)(`span`,{children:t})})}function HH({className:e}){return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:q(`typing-dots`,e),children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{})]})}var UH=3e5,WH=`No task is running in this session.`,GH=`Type a request below and press enter to start one: the oracle scouts, proposes, plans and delegates.`,KH=`Nothing said yet. Type below to talk to the oracle about this task.`;function qH({entry:e}){return(0,L.jsxs)(VH,{failed:e.text.startsWith(`✗`),children:[e.text,e.at?` · ${vA(e.at)}`:``]})}function JH({entry:e,head:t}){if(e.role===`you`)return(0,L.jsx)(BH,{time:vA(e.at),head:t,children:(0,L.jsx)($B,{text:e.text})});let n=e.role===`panel`;return(0,L.jsx)(zH,{source:n?`PLANNER`:`ORACLE`,name:n?`Panel`:`Oracle`,time:vA(e.at),head:t,children:(0,L.jsx)($B,{text:e.text})})}var YH=(0,m.memo)(function({entry:e,head:t,fresh:n}){return(0,L.jsx)(z.div,{initial:n?{opacity:0,y:10}:!1,animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:420,damping:32},children:e.role===`note`?(0,L.jsx)(qH,{entry:e}):(0,L.jsx)(JH,{entry:e,head:t})})},(e,t)=>e.head===t.head&&e.entry.id===t.entry.id&&e.entry.text===t.entry.text&&e.entry.at===t.entry.at);function XH({text:e,busy:t}){let n=!!e?.trim();return!n&&!t?null:(0,L.jsx)(zH,{source:`ORACLE`,name:`Oracle`,head:!0,live:t,aside:t&&n?`writing…`:void 0,children:n?(0,L.jsx)($B,{text:e??``}):(0,L.jsx)(HH,{className:`mt-1`})})}function ZH({hasTask:e}){return(0,L.jsxs)(fk,{className:`h-full border-0`,children:[(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(fh,{"aria-hidden":`true`})}),e?null:(0,L.jsx)(gk,{children:WH}),(0,L.jsx)(_k,{children:e?KH:GH})]}),e?null:(0,L.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-muted-foreground`,children:[(0,L.jsxs)(`li`,{className:`flex items-center justify-center gap-2`,children:[`Or plan it first with the whole panel in `,(0,L.jsx)(GO,{chord:`3`}),` Plan`]}),(0,L.jsxs)(`li`,{className:`flex items-center justify-center gap-2`,children:[`or make a direct change in `,(0,L.jsx)(GO,{chord:`4`}),` Quick fix`]})]})]})}async function QH(e){let t=await De(`lobby.history`,{before:e});return{entries:t.entries,hasOlder:t.hasOlder}}function $H(e,t,n){let[r,i]=(0,m.useState)([]),[a,o]=(0,m.useState)(t),[s,c]=(0,m.useState)(!1),l=(0,m.useMemo)(()=>{let t=new Set(e.map(e=>e.id));return[...r.filter(e=>!t.has(e.id)),...e]},[r,e]);return{merged:l,more:a,loading:s,load:(0,m.useCallback)(async()=>{let e=l[0]?.id;if(e===void 0||s||!a)return;c(!0);let t=n.current,r=t?.scrollHeight??0,u=t?.scrollTop??0;try{let t=await QH(e);i(e=>[...t.entries,...e]),o(t.hasOlder),window.requestAnimationFrame(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight-r+u)})}catch{o(!1)}finally{c(!1)}},[l,s,a,n])}}function eU({chat:e,reply:t,busy:n,hasOlder:r,hasTask:i}){let{ref:a,atBottom:o,stick:s,onScroll:c}=TH(e.length+(t?.length??0)),{merged:l,more:u,loading:d,load:f}=$H(e,r,a),p=(0,m.useCallback)(()=>{c();let e=a.current;e&&e.scrollTop<80&&u&&!d&&f()},[c,a,u,d,f]),h=l.length===0&&!t?.trim()&&!n,[g,_]=(0,m.useState)(!1);return(0,m.useEffect)(()=>_(!0),[]),(0,L.jsxs)(eV,{"aria-label":`Conversation`,className:`flex-1`,children:[(0,L.jsx)(`div`,{ref:a,onScroll:p,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-5 pt-4 pb-dock outline-none focus-visible:bg-muted/30`,role:`log`,"aria-label":`Conversation`,tabIndex:0,children:h?(0,L.jsx)(ZH,{hasTask:i}):(0,L.jsxs)(`div`,{className:`chat-column`,children:[u?(0,L.jsx)(`p`,{className:`mb-4 text-center text-xs text-muted-foreground`,children:`Earlier messages load as you scroll up.`}):null,l.map((e,t)=>{let n=l[t-1],r=!n||n.role!==e.role||e.at-n.at>UH;return(0,L.jsx)(YH,{entry:e,head:r,fresh:g},e.id)}),(0,L.jsx)(XH,{text:t,busy:n})]})}),o?null:(0,L.jsx)(`div`,{className:`absolute right-4 bottom-dock z-10`,children:(0,L.jsx)(Y,{label:`Jump to latest`,text:`Latest`,icon:Op,tone:`primary`,className:`rounded-full shadow-sm`,onClick:s})})]})}function tU(e){let t=e[0]===`ask`,[n,r]=t?e.slice(1):e;return{chat:t,agent:n,file:r}}function nU(e,t){let{agent:n,file:r}=tU(e);return lk(`knowledge`,...t?[`ask`]:[],n??``,r??``)}var rU=[`master`,`designer`,`backend`,`qa`],iU={master:`Master (oracle)`,designer:`Designer`,backend:`Backend`,qa:`QA`},aU={master:`Master`,designer:`Designer`,backend:`Backend`,qa:`QA`},oU=`Every write archives the version before it.`;function sU(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}function cU(e){return`over the compaction threshold — ask the oracle to compact ${e}`}function lU(e){return{text:e.text,occurrence:e.occurrence}}function uU(e){return rU.map(t=>{let n=e.filter(e=>e.agent===t);return{agent:t,files:n,notes:n.reduce((e,t)=>e+t.notes,0)}}).filter(e=>e.files.length>0)}function dU(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing}function fU({initial:e,busy:t,onSave:n,onCancel:r}){let[i,a]=(0,m.useState)(e),o=()=>{!t&&i.trim()&&n(i)};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-input p-3`,children:[(0,L.jsx)(`label`,{htmlFor:`knowledge-entry`,className:`text-sm font-medium text-foreground`,children:`Edit entry`}),(0,L.jsx)(gA,{id:`knowledge-entry`,value:i,rows:4,autoFocus:!0,onChange:e=>a(e.target.value),onKeyDown:e=>{dU(e)&&(e.preventDefault(),o())}}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:oU}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(J,{variant:`outline`,onClick:r,disabled:t,children:`Cancel`}),(0,L.jsxs)(J,{onClick:o,disabled:t||!i.trim(),children:[t?(0,L.jsx)(vk,{}):null,`Save`]})]})]})]})}function pU({open:e,file:t,initial:n,busy:r,onClose:i,onSave:a}){let[o,s]=(0,m.useState)(n),c=tk(e,ek.confirm);return(0,L.jsx)(qO,{open:e&&c,onOpenChange:e=>!e&&i(),label:`Edit ${t}`,description:oU,dismissOnBackdrop:!1,className:`max-w-3xl`,children:(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`h2`,{className:`text-base font-medium`,children:[`Edit `,t]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:oU})]}),(0,L.jsx)(gA,{value:o,rows:14,className:`min-h-0 flex-1 font-mono text-sm`,onChange:e=>s(e.target.value)}),(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(J,{variant:`outline`,onClick:i,disabled:r,children:`Cancel`}),(0,L.jsxs)(J,{onClick:()=>a(o),disabled:r,children:[r?(0,L.jsx)(vk,{}):null,`Save file`]})]})]})})}function mU({note:e,about:t,onTakeBack:n,busy:r}){let i=t?`about "${t.replace(/\s+/g,` `).trim().slice(0,50)}": ${e.text}`:e.text;return(0,L.jsxs)(`li`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(Ih,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:i}),(0,L.jsx)(Y,{label:`Take the note back`,icon:Og,iconOnly:!0,className:`-my-1 size-7`,disabled:r,onClick:()=>n(e.id)})]})}function hU({entry:e,index:t,selected:n,notes:r,onPick:i,onTakeBack:a,busy:o}){let s=()=>i(t);return(0,L.jsxs)(`li`,{role:`button`,tabIndex:0,"aria-pressed":n,onClick:s,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},className:n?`flex min-h-9 cursor-pointer flex-col gap-1 rounded-lg border border-primary/30 bg-accent px-3 py-2.5 outline-none focus-visible:ring-3 focus-visible:ring-ring/40`:`flex min-h-9 cursor-pointer flex-col gap-1 rounded-lg border border-border px-3 py-2.5 outline-none transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(`div`,{className:`flex gap-2`,children:(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)($B,{text:e.text})})}),r.length>0?(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 pl-1`,children:r.map(e=>(0,L.jsx)(mU,{note:e,onTakeBack:a,busy:o},e.id))}):null]})}function gU({notes:e,onTakeBack:t,busy:n}){return e.length===0?null:(0,L.jsx)(nV,{title:`Notes on entries that changed`,right:String(e.length),children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,L.jsx)(mU,{note:e,about:e.entry,onTakeBack:t,busy:n},e.id))})})}function _U({view:e}){let t=e.entries.length;return(0,L.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:[aU[e.agent],` `,(0,L.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.file]})]}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t,` `,t===1?`entry`:`entries`,` · `,sU(e.chars),` chars`]}),e.over?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:cU(e.file)}):null]})}function vU({draft:e,picked:t,setDraft:n,onEditFile:r,onDelete:i}){let a=!!e;return(0,L.jsxs)(eA,{children:[(0,L.jsx)(Y,{label:`Edit the entry`,text:`Edit`,icon:Bh,shortcut:`E`,disabled:a||!t,onClick:()=>n({kind:`edit`,entry:t})}),(0,L.jsx)(Y,{label:t?`Add an entry after it`:`Add an entry`,text:`Add`,icon:Wh,shortcut:`A`,disabled:a,onClick:()=>n({kind:`add`,entry:t})}),(0,L.jsx)(Y,{label:`Comment on the entry`,text:`Comment`,icon:uh,shortcut:`C`,disabled:a||!t,onClick:()=>n({kind:`comment`,entry:t})}),(0,L.jsx)(Y,{label:`Edit the whole file`,text:`Edit file`,icon:Am,shortcut:`F`,disabled:a,onClick:r}),(0,L.jsx)(MA,{icon:wg,label:`Delete the entry`,text:`Delete`,shortcut:`Delete`,title:`Delete this entry?`,description:`The entry and its notes are removed. The version before is archived.`,confirmLabel:`Delete entry`,variant:`destructive`,disabled:a||!t,onConfirm:i})]})}function yU({agent:e,file:t,onChanged:n}){let r=Ak(`knowledge.open`,{agent:e,file:t},[`knowledge`]),[i,a]=(0,m.useState)(0),[o,s]=(0,m.useState)(),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),f=r.data?.view,p=f?.entries??[],h=p[Math.min(i,Math.max(0,p.length-1))],g=async e=>{d(!0),await e(),s(void 0),r.reload(),n(),d(!1)},_=e=>void g(()=>H(`knowledge.unnote`,{id:e})),v=()=>{h&&g(()=>H(`knowledge.remove`,{agent:e,file:t,ref:lU(h)}))},y=n=>{let r=o?.entry;if(o?.kind===`edit`&&r)return void g(()=>H(`knowledge.edit`,{agent:e,file:t,ref:lU(r),text:n}));if(o?.kind===`comment`&&r)return void g(()=>H(`knowledge.comment`,{agent:e,file:t,ref:lU(r),text:n}));g(()=>H(`knowledge.add`,{agent:e,file:t,...h?{ref:lU(h)}:{},text:n}))};return f?(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`${aU[e]} ${t}`,children:[(0,L.jsx)(vU,{draft:o,picked:h,setDraft:s,onEditFile:()=>l(!0),onDelete:v}),(0,L.jsx)(_U,{view:f}),p.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing here yet. Add the first entry below.`}):null,(0,L.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map((e,t)=>(0,L.jsx)(hU,{entry:e,index:t,selected:t===i,notes:f.attached.filter(t=>t.entry===e.text),onPick:a,onTakeBack:_,busy:u},`${t}-${e.text}`))}),o?.kind===`edit`?(0,L.jsx)(fU,{initial:o.entry.text,busy:u,onSave:y,onCancel:()=>s(void 0)}):null,o?.kind===`comment`?(0,L.jsx)($V,{label:`Comment on this entry`,hint:oU,buttonLabel:`Add note`,onSend:async e=>(y(e),!0)}):null,o?.kind===`add`?(0,L.jsx)($V,{label:`Add an entry`,hint:oU,buttonLabel:`Add entry`,onSend:async e=>(y(e),!0)}):null,u&&!o?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(vk,{}),` saving…`]}):null,(0,L.jsx)(gU,{notes:f.detached,onTakeBack:_,busy:u}),(0,L.jsx)(pU,{open:c,file:t,initial:f.content,busy:u,onClose:()=>l(!1),onSave:n=>{l(!1),g(()=>H(`knowledge.replaceFile`,{agent:e,file:t,text:n}))}})]}):r.error?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not read the file. `,r.error]}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`reading…`})}function bU(e){return`${e.agent}/${e.file}`}var xU={master:`ORACLE`,designer:`DESIGN`,backend:`DEV`,qa:`QA`},SU=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function CU({info:e}){return(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-xs text-muted-foreground tabular-nums`,children:[(0,L.jsx)(`span`,{children:sU(e.chars)}),e.over?(0,L.jsx)(`span`,{className:`text-foreground`,children:`· over`}):null,e.notes>0?(0,L.jsx)(`span`,{className:`text-primary`,children:SU(e.notes,`note`)}):null]})}function wU({info:e,selected:t,onSelect:n}){return(0,L.jsx)(`li`,{className:`ktree-leaf`,children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(bU(e)),className:q(VV,`ktree-file min-h-9 flex-row items-center gap-2 py-1.5`),children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`ktree-bud`}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 truncate text-sm text-foreground`,t&&`font-medium`),children:e.label}),(0,L.jsx)(CU,{info:e})]})})}var TU=`bot-lobby.knowledge.folded`;function EU(){try{let e=JSON.parse(window.localStorage.getItem(TU)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function DU({files:e,models:t={},selectedKey:n,onSelect:r}){let[i,a]=(0,m.useState)(EU),o=uU(e),s=e.reduce((e,t)=>e+t.notes,0);function c(e,t){a(n=>{let r=t?n.filter(t=>t!==e):[...new Set([...n,e])];try{window.localStorage.setItem(TU,JSON.stringify(r))}catch{}return r})}return(0,L.jsxs)(`div`,{className:`ktree px-3 pt-1 pb-3`,children:[(0,L.jsxs)(`p`,{className:`ktree-root`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`card-raised grid size-8 shrink-0 place-items-center rounded-lg border text-primary`,children:(0,L.jsx)(Ip,{className:`size-4`})}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsx)(`span`,{className:`block text-sm font-medium`,children:`Project knowledge`}),(0,L.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[SU(e.length,`file`),` · `,SU(o.length,`agent`),s>0?` · ${SU(s,`note`)}`:``]})]})]}),(0,L.jsx)(`ul`,{className:`ktree-branches`,"aria-label":`Agents and their knowledge`,children:o.map(e=>{let a=!i.includes(e.agent),o=xU[e.agent],s=`knowledge-${e.agent}`,l=t[e.agent];return(0,L.jsxs)(`li`,{className:`ktree-branch`,style:{"--orb":PH(o)},children:[(0,L.jsx)(`h3`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space ArrowLeft ArrowRight`,"aria-describedby":`focused-action-help`,type:`button`,"aria-expanded":a,"aria-controls":s,onClick:()=>c(e.agent,!a),onKeyDown:t=>{t.key===`ArrowLeft`||t.key===`h`?(t.preventDefault(),t.stopPropagation(),c(e.agent,!1)):(t.key===`ArrowRight`||t.key===`l`)&&(t.preventDefault(),t.stopPropagation(),a||c(e.agent,!0))},className:`ktree-node`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`ktree-tile`,children:(0,L.jsx)(kH,{source:o,strokeWidth:2.25,className:o===`ORACLE`?`size-5`:`size-3.5`})}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:iU[e.agent]}),l?(0,L.jsxs)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`runs on `}),l]}):null]}),(0,L.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[e.notes>0?(0,L.jsxs)(`span`,{className:`text-primary`,children:[SU(e.notes,`note`),` · `]}):null,SU(e.files.length,`file`)]}),(0,L.jsx)(Jp,{"aria-hidden":`true`,className:q(`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ease-snap`,a&&`rotate-90`)})]})}),(0,L.jsx)(Ou,{initial:!1,children:a?(0,L.jsx)(z.ul,{id:s,"aria-label":`${iU[e.agent]}'s knowledge`,initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{type:`spring`,stiffness:520,damping:42},className:`ktree-leaves`,children:e.files.map(e=>(0,L.jsx)(wU,{info:e,selected:bU(e)===n,onSelect:r},bU(e)))},`files`):null})]},e.agent)})})]})}var OU=()=>uk(lk(`knowledge`)),kU=e=>{let[t,n]=e.split(`/`);uk(lk(`knowledge`,t??``,n??``))};function AU(){return(0,L.jsx)(fk,{className:`m-4 flex-1`,children:(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(Ip,{"aria-hidden":`true`})}),(0,L.jsx)(_k,{children:`No knowledge files yet.`})]})})}function jU(e,t,n,r){let i=e.find(e=>e.agent===t&&e.file===n);return i?(0,L.jsx)(yU,{agent:i.agent,file:i.file,onChanged:r},bU(i)):t&&n?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That file is not on the list any more.`}):null}function MU(){let e=Ok(`lobby`),t=Ok(`status`),n=e.data,r=t.data?.busy??!1;return!n?.chat.length&&!n?.reply&&!r?(0,L.jsx)(`p`,{className:`m-auto max-w-md px-5 pb-dock text-center text-sm text-muted-foreground`,children:`Ask about this project below. The oracle checks saved knowledge, searches the codebase for missing information, and saves verified findings.`}):(0,L.jsx)(eU,{chat:n?.chat??[],reply:n?.reply,busy:r,hasOlder:n?.hasOlderChat??!1,hasTask:!!n?.task})}function NU({read:e,selected:t}){let n=e.data?.files.reduce((e,t)=>e+t.notes,0)??0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:`Knowledge`,count:n>0?`${n} note${n===1?``:`s`}`:void 0}),(0,L.jsx)(PU,{read:e,selected:t})]})}function PU({read:e,selected:t}){return!e.data&&e.error?(0,L.jsx)(wk,{message:`Could not load the knowledge files. ${e.error}`,onRetry:e.reload}):e.data?e.data.files.length?(0,L.jsx)(DU,{files:e.data.files,models:e.data.models??{},selectedKey:t,onSelect:kU}):(0,L.jsx)(AU,{}):(0,L.jsx)(hA,{})}function FU({rest:e}){let{chat:t,agent:n,file:r}=tU(e),i=lA(),a=Ak(`knowledge.files`,{},[`knowledge`]),o=a.data?.files??[],s=o.find(e=>e.agent===n&&e.file===r);return(0,L.jsx)(pA,{wide:i,inlineDetail:!0,list:(0,L.jsx)(NU,{read:a,selected:s?bU(s):void 0}),detail:t?(0,L.jsx)(MU,{}):jU(o,n,r,a.reload),detailClassName:t?`flex flex-col overflow-hidden p-0`:void 0,open:t||!!(n&&r),onClose:OU,hint:`Select a file to read its entries, or ask about the project below.`,describe:t?`Knowledge chat`:`Knowledge file`})}function IU(e){let t=e[0]===`board`,n=e[+!!t];try{return{board:t,id:n?decodeURIComponent(n):void 0}}catch{return{board:t,id:n}}}function LU({className:e,...t}){return(0,L.jsx)(bC,{"aria-keyshortcuts":`Space`,"aria-description":`When focused, press Space to toggle.`,"data-slot":`checkbox`,className:q(`peer relative flex size-[1.125rem] shrink-0 items-center justify-center rounded-[5px] border border-input bg-background text-primary-foreground transition-colors duration-150 outline-none before:absolute before:-inset-3 before:content-[''] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary`,e),...t,children:(0,L.jsx)(SC,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center`,children:(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3`,strokeWidth:3})})})}var RU=`Sessions`,zU=`No sessions yet.`,BU=`Up to 5 sessions; each can be assigned to one agent or several.`,VU=`A session is a live Excalidraw room that you and your agents draw in together.`,HU=[{title:`Start a live room`,text:`In Excalidraw: Share → Live collaboration → Start session.`},{title:`Add it here`,text:`Paste the room link, or make a new room and open it in Excalidraw.`},{title:`Assign agents`,text:`They read the board and draw on it, under their own name.`}],UU=`Sessions`,WU=`Pick a session on the left to see its link, its room and its agents.`,GU=`Room link`,KU=`Masked until revealed. A revealed link stays in this tab and is never saved.`,qU=`Room`,JU=`Drawing`,YU=`Last check`,XU=`not checked yet`,ZU=`Add a session`,QU=`https://excalidraw.com/#room=…`,$U=`Optional name`;function eW(e){return`${e} of 5 in use`}var tW=`Agents may draw here.`,nW=`Agents may only look.`,rW=`checking the room…`,iW=`Check that the room can be reached.`,aW=`Assigned to`,oW=`Assigned agents read the board and draw on it with excalidraw_read and excalidraw_draw, and appear in the room under their own name.`,sW=`Add or rename`,cW=`Add by link`,lW=`In Excalidraw, Share → Live collaboration → Start session, then paste the link. Enter adds it.`,uW=`New room`,dW=`Makes a fresh room link to open in Excalidraw; the name is optional.`,fW=`Rename`,pW=`draw`,mW=`look only`,hW=`Copied to the clipboard`,gW=`Could not reveal the link.`,_W=[`master`,`designer`,`backend`,`qa`,`scout`,`researcher`,`quickfix`,`planner`],vW={master:`Master (oracle)`,designer:`Designer`,backend:`Backend`,qa:`QA`,scout:`Scouts`,researcher:`Researcher`,quickfix:`Quick fix`,planner:`Planner`};function yW(e){return e===0?`no agents`:`${e} agent${e===1?``:`s`}`}function bW(e){return e?e.ok?`✓`:`!`:``}function xW({title:e,right:t,className:n,children:r}){return(0,L.jsxs)(`section`,{className:q(`card-raised flex min-w-0 flex-col gap-3 rounded-xl border p-4`,n),children:[(0,L.jsxs)(`header`,{className:`flex items-baseline justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:e}),t?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t}):null]}),r]})}function SW({row:e=!1}){return(0,L.jsx)(`ol`,{className:q(`grid gap-3`,e&&`@2xl:grid-cols-3`),children:HU.map((e,t)=>(0,L.jsxs)(`li`,{className:`card-raised flex gap-3 rounded-xl border p-3.5`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-6 shrink-0 place-items-center rounded-full bg-accent text-xs font-semibold text-primary tabular-nums`,children:t+1}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.title}),(0,L.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.text})]})]},e.title))})}function CW({label:e,hint:t,buttonLabel:n,placeholder:r,initial:i=``,required:a,mono:o,primary:s,onSubmit:c}){let l=(0,m.useId)(),[u,d]=(0,m.useState)(i),[f,p]=(0,m.useState)(!1),h=a&&!u.trim(),g=async()=>{h||f||(p(!0),await c(u)&&d(i),p(!1))};return(0,L.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-2`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,L.jsx)(`label`,{htmlFor:l,className:`text-xs font-medium text-muted-foreground`,children:e}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`input`,{id:l,value:u,maxLength:o?2e3:80,placeholder:r,"aria-describedby":t?`${l}-hint`:void 0,onChange:e=>d(e.target.value),className:q(`h-8 min-w-0 flex-1 rounded-lg border border-input bg-background px-3 text-sm outline-none transition-[border-color,box-shadow] placeholder:text-muted-foreground/70 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30`,o&&`font-mono text-[0.8125rem]`)}),(0,L.jsx)(Y,{type:`submit`,label:n,icon:f?nh:Wh,tone:s?`primary`:`neutral`,shortcut:`Enter`,disabled:h||f,className:f?`[&_svg]:animate-spin`:void 0})]}),t?(0,L.jsx)(`p`,{id:`${l}-hint`,className:`text-xs leading-relaxed text-muted-foreground`,children:t}):null]})}function wW({onChanged:e,primary:t}){return(0,L.jsx)(CW,{label:cW,hint:lW,buttonLabel:`Add`,placeholder:QU,required:!0,mono:!0,primary:t,onSubmit:async t=>await H(`excalidraw.add`,{link:t.trim()})?(e(),!0):!1})}function TW({onChanged:e,primary:t}){return(0,L.jsx)(CW,{label:uW,hint:dW,buttonLabel:`Create`,placeholder:$U,primary:t,onSubmit:async t=>{let n=t.trim();return await H(`excalidraw.create`,n?{name:n}:{})?(e(),!0):!1}})}function EW({onChanged:e,stacked:t=!1}){return(0,L.jsxs)(`div`,{className:q(`grid gap-4`,!t&&`@2xl:grid-cols-2`),children:[(0,L.jsx)(wW,{onChanged:e,primary:!0}),(0,L.jsx)(TW,{onChanged:e,primary:!0})]})}function DW({session:e,onChanged:t}){return(0,L.jsx)(CW,{label:fW,initial:e.name,required:!0,buttonLabel:fW,onSubmit:async n=>await H(`excalidraw.rename`,{id:e.id,name:n.trim()})?(t(),!0):!1},e.name)}function OW({icon:e,tone:t=`muted`,children:n}){return(0,L.jsxs)(`span`,{className:q(`inline-flex h-6 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium`,t===`primary`?`bg-accent text-primary`:t===`warning`?`bg-warning/10 text-warning`:`bg-muted text-muted-foreground`),children:[(0,L.jsx)(e,{"aria-hidden":`true`,className:`size-3.5`}),n]})}function kW({check:e,checking:t}){return t?(0,L.jsx)(OW,{icon:nh,children:rW}):e?e.ok?(0,L.jsx)(OW,{icon:nm,tone:`primary`,children:`reachable`}):(0,L.jsx)(OW,{icon:em,tone:`warning`,children:`unreachable`}):(0,L.jsx)(OW,{icon:im,children:XU})}function AW({label:e,children:t}){return(0,L.jsxs)(`div`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] items-baseline gap-3 text-sm`,children:[(0,L.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,L.jsx)(`dd`,{className:`min-w-0`,children:t})]})}function jW({check:e,checking:t}){return t?(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,L.jsx)(vk,{className:`size-3.5`,"aria-hidden":`true`}),rW]}):e?(0,L.jsxs)(`span`,{className:e.ok?`text-primary`:`text-foreground`,children:[e.ok?`✓`:`!`,` `,e.text]}):(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:iW})}function MW({agent:e,on:t,onToggle:n}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`label`,{className:q(`flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-lg border px-2.5 text-sm transition-[background-color,border-color,color]`,t?`border-primary/25 bg-accent text-foreground`:`border-border text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,L.jsx)(LU,{checked:t,onCheckedChange:()=>n(e)}),(0,L.jsx)(`span`,{className:`truncate`,children:vW[e]})]})})}function NW({session:e,onChanged:t}){let n=async n=>{await H(`excalidraw.toggleAgent`,{id:e.id,agent:n})&&t()},r=async()=>{await H(`excalidraw.toggleAll`,{id:e.id})&&t()},i=e.agents.length===_W.length;return(0,L.jsxs)(xW,{title:aW,right:yW(e.agents.length),children:[(0,L.jsx)(`ul`,{className:`grid grid-cols-1 gap-1.5 @md:grid-cols-2`,children:_W.map(t=>(0,L.jsx)(MW,{agent:t,on:e.agents.includes(t),onToggle:n},t))}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsx)(`p`,{className:`min-w-0 flex-1 text-xs leading-relaxed text-muted-foreground`,children:oW}),(0,L.jsx)(Y,{label:i?`Take every agent off`:`Assign every agent`,icon:Qm,onClick:()=>void r()})]})]})}function PW({session:e,check:t,checking:n,onCheck:r,onChanged:i,onRemove:a}){let[o,s]=(0,m.useState)(),c=async()=>{try{s((await De(`excalidraw.reveal`,{id:e.id})).link)}catch(e){V.error(e instanceof Error?e.message:gW)}},l=()=>void navigator.clipboard?.writeText(o??``).then(()=>V(hW)).catch(()=>void 0),u=async()=>{await H(`excalidraw.toggleContribute`,{id:e.id})&&i()};return(0,L.jsxs)(`article`,{"aria-label":`Session detail`,className:`@container flex flex-col gap-4`,children:[(0,L.jsxs)(eA,{children:[o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Y,{label:`Copy the link`,text:`Copy`,icon:Sm,shortcut:`C`,onClick:l}),(0,L.jsx)(Y,{label:`Open board`,icon:Em,tone:`primary`,shortcut:`O`,href:o})]}):(0,L.jsx)(Y,{label:`Reveal the link`,text:`Reveal`,icon:Om,shortcut:`R`,onClick:()=>void c()}),(0,L.jsx)(Y,{label:e.contribute?`Look only: agents stop drawing`:`Let agents draw`,text:e.contribute?`Look only`:`Let agents draw`,icon:e.contribute?Rh:Bh,shortcut:`W`,pressed:e.contribute,onClick:()=>void u()}),(0,L.jsx)(Y,{label:`Check the room`,text:`Check`,icon:n?nh:cg,shortcut:`T`,disabled:n,onClick:r}),(0,L.jsx)(MA,{icon:wg,label:`Remove the session`,text:`Remove`,shortcut:`Delete`,title:`Remove "${e.name}"?`,description:`Agents lose this session at once; the Excalidraw room itself is not touched.`,confirmLabel:`Remove session`,variant:`destructive`,onConfirm:a})]}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:e.name}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,L.jsx)(OW,{icon:e.contribute?Bh:Om,tone:e.contribute?`primary`:`muted`,children:e.contribute?pW:mW}),(0,L.jsx)(OW,{icon:Mg,children:yW(e.agents.length)}),(0,L.jsx)(kW,{check:t,checking:n})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,L.jsxs)(xW,{title:GU,children:[(0,L.jsx)(`p`,{className:`rounded-lg border border-border bg-muted px-3 py-2 font-mono text-[0.8125rem] break-all text-foreground`,children:o??e.masked}),(0,L.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:KU})]}),(0,L.jsx)(xW,{title:qU,children:(0,L.jsxs)(`dl`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(AW,{label:JU,children:(0,L.jsx)(`span`,{className:e.contribute?`text-primary`:`text-muted-foreground`,children:e.contribute?tW:nW})}),(0,L.jsx)(AW,{label:YU,children:(0,L.jsx)(jW,{check:t,checking:n})})]})})]}),(0,L.jsx)(NW,{session:e,onChanged:i})]}),(0,L.jsx)(xW,{title:sW,children:(0,L.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-3`,children:[(0,L.jsx)(DW,{session:e,onChanged:i}),(0,L.jsx)(wW,{onChanged:i}),(0,L.jsx)(TW,{onChanged:i})]})})]})}function FW({check:e,checking:t}){if(t)return(0,L.jsx)(vk,{className:`size-3.5 shrink-0 text-muted-foreground`});let n=bW(e);return n?(0,L.jsx)(`span`,{className:q(`w-3.5 shrink-0 text-center`,e?.ok?`text-primary`:`text-foreground`),"aria-hidden":`true`,children:n}):(0,L.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`})}function IW({session:e,check:t,checking:n,selected:r,onSelect:i}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":r?`true`:void 0,onClick:()=>i(e.id),className:VV,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(FW,{check:t,checking:n}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,r&&`font-medium`),children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:yW(e.agents.length)})]}),(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 pl-[1.375rem] text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-mono break-all`,children:e.masked}),(0,L.jsx)(BV,{variant:`secondary`,children:e.contribute?pW:mW})]})]})})}function LW({sessions:e,checks:t,checking:n,selectedId:r,onSelect:i}){return(0,L.jsx)(`ul`,{className:HV,children:e.map(e=>(0,L.jsx)(IW,{session:e,check:t[e.id],checking:n.includes(e.id),selected:e.id===r,onSelect:i},e.id))})}var RW=()=>uk(lk(`excalidraw`)),zW=e=>uk(lk(`excalidraw`,e));function BW({count:e}){return(0,L.jsxs)(`span`,{className:`flex items-center gap-2.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1`,children:Array.from({length:5},(t,n)=>(0,L.jsx)(`span`,{className:q(`h-1.5 w-5 rounded-full`,n<e?`bg-primary`:`bg-border`)},n))}),(0,L.jsx)(`span`,{className:`tabular-nums`,children:eW(e)})]})}function VW({count:e,onChanged:t}){return(0,L.jsxs)(`div`,{className:`@container flex max-w-4xl flex-col gap-5`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:UU}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:WU})]}),(0,L.jsx)(BW,{count:e})]}),(0,L.jsx)(SW,{row:!0}),e<5?(0,L.jsx)(xW,{title:ZU,children:(0,L.jsx)(EW,{onChanged:t})}):null,(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-4`,children:[(0,L.jsx)(KO,{chord:`ArrowDown`,children:`next session`}),(0,L.jsx)(KO,{chord:`ArrowRight`,children:`into its detail`})]})]})}function HW({onChanged:e}){return(0,L.jsx)(`div`,{className:`@container flex-1 overflow-y-auto px-5 pt-10 pb-dock sm:px-8`,children:(0,L.jsxs)(`div`,{className:`mx-auto grid max-w-5xl gap-8 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,24rem)]`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`card-raised grid size-11 place-items-center rounded-xl border text-primary`,children:(0,L.jsx)(Ph,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:zU}),(0,L.jsx)(`p`,{className:`max-w-prose text-sm leading-relaxed text-muted-foreground`,children:VU})]}),(0,L.jsx)(SW,{}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:BU})]}),(0,L.jsx)(xW,{title:ZU,className:`self-start`,children:(0,L.jsx)(EW,{onChanged:e,stacked:!0})})]})})}function UW({id:e}){let t=lA(),n=Ak(`excalidraw.list`,{},[`excalidraw`]),[r,i]=(0,m.useState)({}),[a,o]=(0,m.useState)([]),s=n.data?.sessions??[],c=s.find(t=>t.id===e),l=async e=>{o(t=>[...t,e]);let t=await H(`excalidraw.check`,{id:e});o(t=>t.filter(t=>t!==e)),t&&i(n=>({...n,[e]:t}))},u=async()=>{c&&await H(`excalidraw.remove`,{id:c.id})&&(n.reload(),RW())};if(!n.data&&n.error)return(0,L.jsx)(wk,{message:`Could not load sessions. ${n.error}`,onRetry:n.reload});if(n.data&&s.length===0)return(0,L.jsx)(HW,{onChanged:n.reload});let d=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:RU,count:n.data?`${s.length}/5`:void 0}),n.data?(0,L.jsx)(LW,{sessions:s,checks:r,checking:a,selectedId:e,onSelect:zW}):(0,L.jsx)(hA,{})]}),f=c?(0,L.jsx)(PW,{session:c,check:r[c.id],checking:a.includes(c.id),onCheck:()=>void l(c.id),onChanged:n.reload,onRemove:()=>void u()}):t&&n.data?(0,L.jsx)(VW,{count:s.length,onChanged:n.reload}):null;return(0,L.jsx)(pA,{wide:t,list:d,detail:f,open:c!==void 0,onClose:RW,hint:`Select a session to see its link and agents.`,describe:`Session detail`})}function WW(e,t){return e===`lobby.thinking`||t===`1`}var GW=`bot-lobby.collapsed.`,KW=new Set,qW=new Map;function JW(e){if(qW.has(e))return qW.get(e);if(e===`lobby.thinking`)return WW(e);try{return WW(e,localStorage.getItem(GW+e))}catch{return!1}}function YW(e,t){qW.set(e,t);try{e!==`lobby.thinking`&&localStorage.setItem(GW+e,t?`1`:`0`)}catch{}for(let e of[...KW])e()}function XW(e){return KW.add(e),()=>{KW.delete(e)}}function ZW(e){YW(e,!JW(e))}function QW(e){return[(0,m.useSyncExternalStore)(XW,()=>JW(e),()=>WW(e)),(0,m.useCallback)(()=>YW(e,!JW(e)),[e])]}function $W({entry:e}){return e.pending?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}):e.kind===`error`?(0,L.jsx)(Hg,{"aria-hidden":`true`,className:`size-3.5 text-destructive`}):e.kind===`warning`?(0,L.jsx)(Eg,{"aria-hidden":`true`,className:`size-3.5 text-warning`}):e.kind===`success`?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 text-success`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})}function eG({entry:e}){return(0,L.jsxs)(`li`,{className:`grid grid-cols-[2.75rem_5rem_1rem_minmax(0,1fr)] items-baseline gap-x-2 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-muted`,children:[(0,L.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:vA(e.at)}),(0,L.jsx)(`span`,{className:q(`overflow-hidden text-xs font-medium whitespace-nowrap`,MH(e.source)),children:jH(e.source)}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center self-center`,children:(0,L.jsx)($W,{entry:e})}),(0,L.jsx)(`span`,{className:`sr-only`,children:e.pending?`pending`:e.kind}),(0,L.jsx)(`span`,{className:q(`min-w-0 break-words`,e.kind===`error`?`text-destructive`:e.pending?``:`text-muted-foreground`),children:e.pending?`${e.text}…`:e.text})]})}function tG({entries:e,collapsed:t,onToggle:n,shortcut:r,bare:i}){let a=e.slice(-400),o=a.filter(e=>e.pending).length,{ref:s,atBottom:c,stick:l,onScroll:u}=TH(JSON.stringify(a));return(0,L.jsxs)(eV,{"aria-label":`Activity`,...i?{}:{title:`Activity`},collapsed:t,...n?{onToggle:n}:{},shortcut:r,className:`flex-1`,note:o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}),` `,o,` running`]}):void 0,children:[(0,L.jsx)(`div`,{ref:s,onScroll:u,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-2 pt-2 pb-dock outline-none focus-visible:bg-muted/30`,role:`log`,"aria-label":`Activity`,tabIndex:0,children:a.length===0?(0,L.jsx)(`p`,{className:`px-2 py-1 text-sm text-muted-foreground`,children:`No activity yet.`}):(0,L.jsx)(`ul`,{children:a.map(e=>(0,L.jsx)(eG,{entry:e},e.id))})}),c?null:(0,L.jsx)(`div`,{className:`absolute inset-x-0 bottom-dock z-10 flex justify-center`,children:(0,L.jsx)(Y,{label:`Jump to latest`,text:`Latest`,icon:Op,className:`rounded-full bg-card shadow-card`,onClick:l})})]})}function nG(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function rG(e){return e===`running`?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3.5`}):e===`success`?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 text-success`}):e===`failed`||e===`timeout`||e===`error`?(0,L.jsx)(Hg,{"aria-hidden":`true`,className:`size-3.5 text-destructive`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`})}function iG(e,t){let n=e.startedAt?Date.parse(e.startedAt):NaN;return yA((e.finishedAt?Date.parse(e.finishedAt):t)-n)}function aG({runs:e}){let t=nG(e.some(e=>e.status===`running`));return e.length===0?null:(0,L.jsx)(`ul`,{className:`-mt-1 flex shrink-0 flex-wrap items-center gap-1.5 px-4 pb-3`,"aria-label":`Runs`,children:e.map((e,n)=>(0,L.jsx)(BV,{asChild:!0,variant:`secondary`,radius:`full`,className:`h-auto gap-2 py-1 pr-3 pl-2`,children:(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`flex size-4 items-center justify-center`,children:rG(e.status)}),(0,L.jsx)(`span`,{className:`sr-only`,children:e.status??`unknown`}),(0,L.jsx)(`span`,{className:q(`font-medium`,MH(FH(e))),children:jH(FH(e))}),e.activity??e.step?(0,L.jsx)(`span`,{className:`max-w-[18rem] truncate text-muted-foreground`,children:e.activity??e.step}):null,(0,L.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:iG(e,t)})]})},e.runId??n))})}function oG(e,t=0,n=!1){let r=!n&&!e.waiting&&!!e.runningSince,i=r?Date.parse(e.serverNow)-Date.parse(e.runningSince):0;return Math.max(0,e.elapsedMs)+(Number.isFinite(i)?Math.max(0,i):0)+(r?Math.max(0,t):0)}function sG(e){let t=Math.floor(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`}function cG(e,t){let[n,r]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(r(0),!e)return;let t=performance.now(),n=window.setInterval(()=>r(performance.now()-t),1e3);return()=>window.clearInterval(n)},[e,t]),e?n:0}var lG=8;function uG(e){return e?e.path===`fast`?`fast track (${e.size})`:`full workflow (${e.size})`:``}function dG(e,t){let n=Math.min(t,lG);if(n<=0)return[];let r=Math.min(n,Math.round(Math.max(0,e)/t*n));return Array.from({length:n},(e,t)=>t<r)}function fG({done:e,total:t}){return(0,L.jsx)(`span`,{className:`inline-flex items-center gap-0.5`,"aria-hidden":`true`,children:dG(e,t).map((e,t)=>(0,L.jsx)(`span`,{className:q(`h-1.5 w-3 rounded-full`,e?`bg-primary`:`bg-muted-foreground/25`)},t))})}function pG({check:e,className:t}){return(0,L.jsx)(e===`done`?nm:e===`dropped`?fm:mm,{"aria-hidden":`true`,className:q(`size-4 shrink-0`,e===`done`?`text-success`:`text-muted-foreground`,t)})}function mG({children:e}){return(0,L.jsx)(`span`,{className:`hidden shrink-0 items-center gap-1 text-xs text-muted-foreground md:inline-flex`,children:e})}function hG({ms:e,running:t,sample:n}){let r=cG(t,n);return(0,L.jsx)(`span`,{className:`tabular-nums`,children:sG(e+r)})}function gG({work:e}){return(0,L.jsxs)(`span`,{className:`hidden shrink-0 items-center gap-1 text-xs text-muted-foreground md:inline-flex`,title:`How long the agents have worked on this task (idle time left out)`,children:[(0,L.jsx)(Sg,{"aria-hidden":`true`,className:`size-3 shrink-0`}),`worked `,(0,L.jsx)(hG,{ms:e.workedMs,running:e.running,sample:e})]})}function _G({active:e,current:t}){let n=e?.[0];return n?(0,L.jsxs)(`span`,{className:`hidden max-w-[20rem] min-w-0 items-center gap-1.5 xl:inline-flex`,children:[(0,L.jsx)(`span`,{className:`truncate text-foreground`,children:n.text}),(0,L.jsxs)(`span`,{className:`shrink-0 rounded-md bg-primary/10 px-1.5 py-px font-medium text-primary`,children:[`active · `,(0,L.jsx)(hG,{ms:n.workedMs,running:!0,sample:n})]}),e.length>1?(0,L.jsxs)(`span`,{className:`shrink-0`,children:[`+`,e.length-1]}):null]}):t?(0,L.jsxs)(`span`,{className:`hidden max-w-[16rem] truncate xl:inline`,children:[`next: `,(0,L.jsx)(`span`,{className:`text-foreground`,children:t})]}):null}function vG({done:e,total:t,current:n,active:r}){let i=t>0?Math.min(100,Math.round(e/t*100)):0;return(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[e,` of `,t,` steps`]}),(0,L.jsx)(`div`,{className:`h-1.5 w-16 overflow-hidden rounded-full bg-border`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-label":`Plan progress`,children:(0,L.jsx)(z.div,{className:`h-full rounded-full bg-primary`,initial:!1,animate:{width:`${i}%`},transition:{type:`spring`,stiffness:260,damping:30}})}),(0,L.jsx)(_G,{...r?{active:r}:{},...n?{current:n}:{}})]})}function yG({task:e,status:t}){let n=t?.branch??t?.workspace.branch,r=e?.git?.branch??n;return(0,L.jsxs)(`section`,{className:`flex h-12 shrink-0 items-center gap-3 px-4`,"aria-label":`Task`,role:`group`,children:[(0,L.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-[0.8125rem] font-medium`,title:e?.title,children:[e?.title??`No task yet`,e?null:(0,L.jsx)(`span`,{className:`ml-2 font-normal text-muted-foreground`,children:t?.sessionName??`Type a request below to start one.`})]}),e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent px-2 py-0.5 text-xs font-medium`,children:e.state.replace(/_/g,` `)}),(0,L.jsx)(mG,{children:e.id}),e.track?(0,L.jsx)(mG,{children:uG(e.track)}):null,(e.domains??[]).length>0?(0,L.jsx)(mG,{children:e.domains.join(`, `)}):null,r?(0,L.jsxs)(`span`,{className:`hidden max-w-48 shrink-0 items-center gap-1 text-xs text-muted-foreground lg:inline-flex`,children:[(0,L.jsx)(Bm,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,L.jsxs)(`span`,{className:`truncate`,children:[r,e.git?.from?` · from ${e.git.from}`:``]})]}):null,e.work?(0,L.jsx)(gG,{work:e.work}):null,e.progress?(0,L.jsx)(vG,{done:e.progress.done,total:e.progress.total,...e.currentStep?{current:e.currentStep}:{},...e.activeSteps?{active:e.activeSteps}:{}}):null]}):null]})}var bG=(e,t)=>e?.keys.find(e=>e.action===t)?.label,xG=e=>e?.panels??{conversation:!0,activity:!0,thinking:!0};function SG({name:e,icon:t,shortcut:n,onClick:r}){return(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Expand ${e}`,"aria-expanded":!1,"aria-keyshortcuts":n,onClick:r,className:`btn-ghost inline-flex size-8 shrink-0 items-center justify-center rounded-lg border border-transparent text-muted-foreground transition-[box-shadow,color,translate] duration-150 ease-snap outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`,children:(0,L.jsx)(t,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsxs)(Pk,{side:`left`,children:[`Expand `,e,n?(0,L.jsx)(GO,{chord:n}):null]})]})}function CG(e){let t=xG(e.status);return(0,L.jsx)(`aside`,{"aria-label":`Minimized panes`,className:`flex w-12 shrink-0 flex-col items-center gap-1 border-l border-border py-2`,children:t.activity&&e.activityFolded?(0,L.jsx)(SG,{name:`Activity`,icon:Sp,shortcut:bG(e.status,`activity`),onClick:e.toggleActivity}):null})}function wG(e){let{data:t,status:n,activityFolded:r,toggleActivity:i}=e,a=xG(n),o=a.activity&&!r;if(!a.conversation&&!o)return null;let s=a.conversation&&o;return(0,L.jsxs)(`div`,{className:q(`grid min-h-0 flex-1`,s?`grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)] divide-x divide-border`:`grid-cols-1`),children:[a.conversation?(0,L.jsx)(eU,{chat:t?.chat??[],reply:t?.reply,busy:n?.busy??!1,hasOlder:t?.hasOlderChat??!1,hasTask:!!t?.task}):null,o?(0,L.jsx)(tG,{entries:t?.activity??[],collapsed:!1,onToggle:i,shortcut:bG(n,`activity`)}):null]})}function TG(e){let{status:t}=e,n=xG(t).activity&&e.activityFolded;return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,L.jsx)(wG,{...e})}),n?(0,L.jsx)(CG,{...e}):null]})}function EG({data:e,status:t}){let n=xG(t),r=[...n.conversation?[{id:`conversation`,label:`Conversation`,icon:fh}]:[],...n.activity?[{id:`activity`,label:`Activity`,icon:Sp}]:[]],[i,a]=(0,m.useState)(`conversation`),o=r.find(e=>e.id===i)??r[0],s=(e?.activity??[]).filter(e=>e.pending).length;return o?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[r.length>1?(0,L.jsx)(`div`,{role:`radiogroup`,"aria-label":`Pane`,className:`flex shrink-0 items-center gap-0.5 border-b border-border px-3 py-2`,children:r.map(e=>{let t=e.id===o.id,n=e.icon;return(0,L.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,onClick:()=>a(e.id),className:q(`inline-flex h-8 items-center gap-1.5 rounded-lg border border-transparent px-2.5 text-[0.8125rem] font-medium outline-none transition-[box-shadow,color] focus-visible:ring-3 focus-visible:ring-ring/40`,t?`btn-raised bg-card text-foreground`:`btn-ghost text-muted-foreground hover:text-foreground`),children:[(0,L.jsx)(n,{"aria-hidden":`true`,className:`size-4`}),e.label,e.id===`activity`&&s>0?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}):null]},e.id)})}):null,o.id===`conversation`?(0,L.jsx)(eU,{chat:e?.chat??[],reply:e?.reply,busy:t?.busy??!1,hasOlder:e?.hasOlderChat??!1,hasTask:!!e?.task}):null,o.id===`activity`?(0,L.jsx)(tG,{entries:e?.activity??[],collapsed:!1,bare:!0}):null]}):null}function DG(e){let{data:t,status:n}=e,r=lA();return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[(0,L.jsx)(yG,{task:t?.task,status:n}),(0,L.jsx)(aG,{runs:IH(t)})]}),r?(0,L.jsx)(TG,{...e}):(0,L.jsx)(EG,{...e})]})}function OG(){let e=Ok(`lobby`),t=Ok(`status`),[n,r]=QW(`lobby.activity`);return!e.data&&e.loading?(0,L.jsxs)(`div`,{className:`flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(vk,{}),(0,L.jsx)(`span`,{children:`Connecting…`})]}):!e.data&&e.error?(0,L.jsx)(wk,{message:e.error,onRetry:()=>me.onHello({})}):(0,L.jsx)(DG,{data:e.data,status:t.data,activityFolded:n,toggleActivity:r})}var kG=Yg([`relative flex flex-col bg-muted/50 gap-(--frame-gap) px-(--frame-px) py-(--frame-py) rounded-(--frame-radius)`,`[--frame-radius:var(--radius-xl)]`,`[--frame-gap:--spacing(0.75)] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)] [--frame-panel-header-gap:0rem] [--frame-panel-footer-gap:--spacing(1)]`,`[--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px]`,`[--frame-panel-px:calc(var(--frame-panel-px-base)+var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)+var(--frame-panel-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)+var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)+var(--frame-panel-header-py-adjust))] [--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)+var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)+var(--frame-panel-footer-py-adjust))]`,``,`[--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)] [--frame-border-color:var(--color-border)]`,`[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px)-1px)]`],{variants:{variant:{default:`border border-[var(--frame-border-color)] bg-clip-padding`,inverse:`[--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)] border border-[var(--frame-border-color)] bg-background bg-clip-padding`,ghost:`[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px))]`},spacing:{xs:`[--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)]`,sm:`[--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(1.5)] [--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(1.5)]`,default:`[--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(2)] [--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(2)]`,lg:`[--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(2.5)]`},stacked:{true:[`gap-0 *:has-[+[data-slot=frame-panel]]:rounded-b-none`,`*:has-[+[data-slot=frame-panel]]:before:hidden`,`*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:rounded-t-none`,`*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:border-t-0`],false:[`data-[spacing=sm]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-0.5`,`data-[spacing=default]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1`,`data-[spacing=lg]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-2`]},dense:{true:`p-0 gap-0 border-[var(--frame-border-color)] [--frame-panel-radius:var(--frame-radius)] [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden [&_[data-slot=frame-panel]:last-child]:-mb-px [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px`,false:``}},defaultVariants:{variant:`default`,spacing:`default`,stacked:!1,dense:!1}});function AG({className:e,variant:t,spacing:n,stacked:r,dense:i,...a}){return(0,L.jsx)(`div`,{className:q(kG({variant:t,spacing:n,stacked:r,dense:i}),e),"data-slot":`frame`,"data-spacing":n,...a})}function jG({className:e,fit:t,...n}){return(0,L.jsx)(`div`,{className:q(`relative overflow-hidden rounded-(--frame-panel-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs`,!t&&`grow`,`before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-panel-radius)-1px)] before:shadow-black/5`,`dark:bg-clip-border dark:before:shadow-white/5`,`px-(--frame-panel-px) py-(--frame-panel-py)`,e),"data-slot":`frame-panel`,...n})}function MG({className:e,...t}){return(0,L.jsx)(`header`,{className:q(`flex flex-col gap-(--frame-panel-header-gap) px-(--frame-panel-header-px) py-(--frame-panel-header-py)`,e),"data-slot":`frame-panel-header`,...t})}var NG={master:`master`,scout:`scout`,worker:`worker`,reviewer:`QA gate`,researcher:`research`,quickfix:`quick fix`,planner:`oracle (plan)`,panel:`panel`};function PG(e){let t=Number.isFinite(e)?Math.max(0,Math.round(e/1e3)):0,n=Math.floor(t/60);if(n===0)return`${t}s`;let r=t%60;return r===0?`${n}m`:`${n}m ${String(r).padStart(2,`0`)}s`}function FG(e){return e>0?PG(e):`—`}function IG(e,t){return t>0?`${Math.round(e/t*100)}%`:`—`}function LG(e){return e<=0?`—`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function RG(e){return!Number.isFinite(e)||e<1e3?String(Math.max(0,Math.round(e||0))):e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1)}M`}function zG(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(1)}s`}function BG(e){return e>=.9?{icon:`✓`,word:`healthy`,tone:`healthy`}:e>=.7?{icon:`!`,word:`shaky`,tone:`shaky`}:{icon:`✗`,word:`failing`,tone:`failing`}}function VG(e){return e===`model`?`by model · thinking`:`by model · thinking · agent`}function HG(e,t){let n=t===`model-kind`?NG[e.kinds[0]??``]??e.kinds[0]??``:``;return[e.model,e.thinking,n].filter(Boolean).join(` · `)}var UG=[`bg-chart-1`,`bg-chart-2`,`bg-chart-3`,`bg-chart-4`,`bg-chart-5`],WG={MASTER:`bg-primary`,ORACLE:`bg-primary`,DEV:`bg-source-dev`,DESIGN:`bg-source-design`,QA:`bg-source-qa`,RESEARCH:`bg-source-research`,"QUICK FIX":`bg-source-quickfix`};function GG(e){let t=WG[e.toUpperCase()];if(t)return t;let n=0;for(let t of e)n=(n*31+t.charCodeAt(0))%UG.length;return UG[n]??UG[0]}function KG(e){return NG[e]??e}var qG=6;function JG({title:e,right:t,children:n}){return(0,L.jsxs)(AG,{role:`region`,className:`min-w-0`,"aria-label":e,children:[(0,L.jsx)(MG,{className:`py-2.5`,children:(0,L.jsxs)(`h2`,{className:`flex items-baseline justify-between gap-3 text-sm font-medium`,children:[(0,L.jsx)(`span`,{children:e}),t?(0,L.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:t}):null]})}),(0,L.jsx)(jG,{className:`flex min-w-0 flex-col gap-3`,children:n})]})}function YG({rows:e,render:t}){let[n,r]=(0,m.useState)(!1),i=n?e:e.slice(0,qG);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:i.map(t)}),e.length>qG?(0,L.jsx)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`h-6 self-start rounded-lg text-xs text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/30`,children:n?`Show fewer`:`Show all ${e.length}`}):null]})}function XG(e,t){return t>0?Math.max(1.5,e/t*100):0}function ZG({label:e,value:t,marker:n,max:r,valueText:i,sub:a}){return(0,L.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-[0.8125rem]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e}),(0,L.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[i,a?(0,L.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:a}):null]})]}),(0,L.jsxs)(`div`,{className:`relative h-1.5 rounded-full bg-muted`,role:`img`,"aria-label":`${e}: ${i}`,children:[(0,L.jsx)(`div`,{className:`h-full rounded-full bg-primary/70`,style:{width:`${XG(t,r)}%`}}),n?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-1/2 h-3 w-0.5 -translate-y-1/2 rounded-full bg-foreground/40`,style:{left:`${Math.min(99.5,XG(n,r))}%`}}):null]})]})}function QG({groups:e,label:t}){let n=e.filter(e=>e.avgMs>0).sort((e,t)=>t.avgMs-e.avgMs),r=Math.max(...n.map(e=>Math.max(e.avgMs,e.p90Ms)),1);return(0,L.jsx)(JG,{title:`Average run time`,right:`per model · thinking · tick is p90`,children:n.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No timed runs yet.`}):(0,L.jsx)(YG,{rows:n,render:e=>(0,L.jsx)(ZG,{label:t(e),value:e.avgMs,marker:e.p90Ms,max:r,valueText:FG(e.avgMs),sub:`p90 ${FG(e.p90Ms)}`},t(e))})})}var $G={healthy:`bg-success`,shaky:`bg-warning`,failing:`bg-destructive`},eK={healthy:`text-success`,shaky:`text-warning`,failing:`text-destructive`};function tK({label:e,rate:t,runs:n}){let r=BG(t),i=`${Math.round(t*100)}%`;return(0,L.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-[0.8125rem]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 ${eK[r.tone]}`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full ${$G[r.tone]}`}),(0,L.jsx)(`span`,{className:`sr-only`,children:r.word}),i]}),(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` run`,n===1?``:`s`]})]})]}),(0,L.jsxs)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-muted`,role:`img`,"aria-label":`${e}: ${r.word}, ${i} of ${n} runs`,children:[(0,L.jsx)(`div`,{className:`h-full bg-success/70`,style:{width:`${t*100}%`}}),(0,L.jsx)(`div`,{className:`h-full bg-destructive/45`,style:{width:`${(1-t)*100}%`}})]})]})}function nK({groups:e,label:t}){let n=e.filter(e=>e.runs>0).sort((e,t)=>e.successes/e.runs-t.successes/t.runs);return(0,L.jsx)(JG,{title:`Success rate`,right:`green worked · red failed`,children:n.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs yet.`}):(0,L.jsx)(YG,{rows:n,render:e=>(0,L.jsx)(tK,{label:t(e),rate:e.successes/e.runs,runs:e.runs},t(e))})})}function rK({share:e}){return(0,L.jsx)(`ul`,{className:`flex flex-wrap gap-x-6 gap-y-1.5 text-xs`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${GG(e.agent)}`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`text-[0.8125rem]`,children:jH(e.agent)}),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[Math.round(e.share*100),`%`]}),(0,L.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`avg `,PG(e.ms/Math.max(1,e.runs)),` ×`,e.runs]})]},e.agent))})}function iK({share:e}){return(0,L.jsx)(`div`,{className:`flex h-2.5 gap-0.5 overflow-hidden rounded-full`,role:`img`,"aria-label":`Share of run time by agent`,children:e.map(e=>(0,L.jsx)(`span`,{className:`${GG(e.agent)} opacity-75 first:rounded-l-full last:rounded-r-full`,style:{width:`${e.share*100}%`},title:`${e.agent} ${Math.round(e.share*100)}%`},e.agent))})}function aK({times:e}){if(e.length===0)return null;let t=Math.max(...e.map(e=>e.avgMs),1);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2.5 pt-1`,children:[(0,L.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Request to done, by the oracle's model`}),(0,L.jsx)(YG,{rows:e,render:e=>(0,L.jsx)(ZG,{label:[e.model,e.thinking].filter(Boolean).join(` · `),value:e.avgMs,max:t,valueText:PG(e.avgMs),sub:`×${e.tasks}`},`${e.model}-${e.thinking}`)})]})}function oK({timeShare:e}){let t=e.byAgent;return(0,L.jsx)(JG,{title:`Where the time goes`,right:`share of run time by agent`,children:t.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No timed runs yet.`}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(iK,{share:t}),(0,L.jsx)(rK,{share:t}),(0,L.jsx)(aK,{times:e.taskTimes})]})})}function sK({label:e,value:t,sub:n}){return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,L.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:t}),n?(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n}):null]})}var cK=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function lK({summary:e}){let t=Object.entries(e.byPurpose).sort((e,t)=>t[1]-e[1]);return(0,L.jsxs)(`section`,{className:`card-raised flex flex-col gap-3 rounded-xl border p-4`,"aria-label":`Classifier (Jev)`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Classifier (Jev)`}),e.calls===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`no calls recorded`}):(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-4`,children:[(0,L.jsx)(sK,{label:`Calls`,value:cK(e.calls,`call`),sub:`${IG(e.ok,e.calls)} ok`}),(0,L.jsx)(sK,{label:`Speed`,value:`p50 ${zG(e.p50Ms)}`,sub:`p90 ${zG(e.p90Ms)}`}),(0,L.jsx)(sK,{label:`Read`,value:e.input>0?`${RG(e.input)} tokens`:`—`}),(0,L.jsx)(sK,{label:`Routed down`,value:e.routed>0?cK(e.routed,`run`):`none`,sub:e.routed>0?`${IG(e.routedOk,e.routed)} ok`:`no runs routed`})]}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`text-primary`,children:`spared`}),` `,cK(e.seatRunsSkipped,`seat run`),` skipped · `,cK(e.questionsAnswered,`question`),` answered · `,cK(e.quickFixesHeld,`quick fix`,`quick fixes`),` held`,t.length>0?(0,L.jsx)(`span`,{className:`ml-3 border-l border-border pl-3`,children:t.map(([e,t])=>`${e} ${t}`).join(` · `)}):null]})]})}var uK=[`Runs`,`OK`,`Avg`,`p50`,`p90`,`Turns`,`Tools`,`Tokens`,`tok/s`,`$/run`,`$ total`,`Stalls`];function dK(e,t=0){return e>0?e.toFixed(t):`—`}function fK(e){return[String(e.runs),IG(e.successes,e.runs),FG(e.avgMs),FG(e.p50Ms),FG(e.p90Ms),dK(e.avgTurns,1),dK(e.avgTools,1),e.avgTokens>0?RG(e.avgTokens):`—`,e.tokensPerSecond>0?e.tokensPerSecond.toFixed(0):`—`,LG(e.avgCost),LG(e.totalCost),e.timeouts>0?String(e.timeouts):`—`]}function pK(e,t){return t===`model-kind`?KG(e.kinds[0]??``):e.kinds.map(KG).join(`, `)}function mK({groups:e,groupBy:t}){return(0,L.jsxs)(`section`,{className:`card-raised flex min-h-0 flex-col gap-2 overflow-hidden rounded-xl border pt-4`,"aria-label":`All models`,children:[(0,L.jsxs)(`h2`,{className:`flex flex-wrap items-baseline justify-between gap-3 px-4 text-sm font-medium`,children:[(0,L.jsx)(`span`,{children:`All models`}),(0,L.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[t===`model`?`by model · thinking`:`by model · thinking · agent`,` · sorted by runs`]})]}),(0,L.jsx)(`div`,{className:`max-h-80 overflow-auto outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,tabIndex:0,role:`region`,"aria-label":`All model metrics, scroll horizontally to see all columns`,children:(0,L.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,L.jsx)(`thead`,{className:`sticky top-0 bg-card text-muted-foreground`,children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left font-medium`,children:`Model`}),(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left font-medium`,children:`Think`}),(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left font-medium`,children:t===`model-kind`?`Agent`:`Agents`}),uK.map(e=>(0,L.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right font-medium whitespace-nowrap`,children:e},e))]})}),(0,L.jsx)(`tbody`,{children:e.map(e=>(0,L.jsxs)(`tr`,{className:`border-t border-border/70 transition-colors hover:bg-muted`,children:[(0,L.jsx)(`th`,{scope:`row`,className:`px-3 py-1.5 text-left font-normal text-foreground`,children:e.model}),(0,L.jsx)(`td`,{className:`px-3 py-1.5 whitespace-nowrap text-muted-foreground`,children:e.thinking||`—`}),(0,L.jsx)(`td`,{className:`px-3 py-1.5 whitespace-nowrap text-muted-foreground`,children:pK(e,t)||`—`}),fK(e).map((e,t)=>(0,L.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums whitespace-nowrap text-foreground`,children:e},uK[t]))]},HG(e,t)))})]})})]})}var hK={healthy:`bg-success`,shaky:`bg-warning`,failing:`bg-destructive`};function gK({label:e,value:t,sub:n,dot:r}){return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 bg-card px-4 py-3.5`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-2xl leading-tight font-semibold tracking-tight tabular-nums`,children:[r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-full ${hK[r.tone]}`}),(0,L.jsx)(`span`,{className:`sr-only`,children:r.word})]}):null,t]}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n||`\xA0`})]})}function _K({tiles:e}){let t=BG(e.runs>0?e.successes/e.runs:0),n=e.runs-e.successes;return(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-border bg-border shadow-card sm:grid-cols-5 [&>:last-child]:col-span-2 sm:[&>:last-child]:col-span-1`,children:[(0,L.jsx)(gK,{label:`Runs`,value:String(e.runs),sub:e.runs===0?`no runs yet`:``}),(0,L.jsx)(gK,{label:`Success`,value:IG(e.successes,e.runs),sub:`${n} failed${e.stalls>0?` · ${e.stalls} stalled`:``}`,dot:{tone:t.tone,word:t.word}}),(0,L.jsx)(gK,{label:`Avg run`,value:FG(e.avgMs),sub:`p90 ${FG(e.p90Ms)}`}),(0,L.jsx)(gK,{label:`Cost`,value:LG(e.cost),sub:e.runs>0?`${LG(e.cost/e.runs)} per run`:`—`}),(0,L.jsx)(gK,{label:`Tasks`,value:`${e.completed} done`,sub:e.avgCompleteMs>0?`avg ${PG(e.avgCompleteMs)} · ${e.active} active`:`${e.active} active`})]})}var vK=`No runs recorded yet. Every Master turn, subagent run, quick fix and planning round lands here with its model, thinking level, time, tokens and cost.`;function yK({groupBy:e,onGroup:t}){return(0,L.jsx)(`div`,{role:`radiogroup`,"aria-label":`Group by`,className:`flex gap-0.5 rounded-lg bg-muted p-0.5`,onKeyDown:n=>{let r=n.key===`ArrowRight`||n.key===`ArrowDown`?1:n.key===`ArrowLeft`||n.key===`ArrowUp`?-1:0;if(!r)return;n.preventDefault();let i=[`model`,`model-kind`],a=i[(i.indexOf(e)+r+i.length)%i.length];t(a),requestAnimationFrame(()=>n.currentTarget.querySelector(`[aria-checked='true']`)?.focus())},children:[`model`,`model-kind`].map(n=>(0,L.jsx)(J,{variant:`ghost`,size:`sm`,role:`radio`,tabIndex:e===n?0:-1,className:e===n?`bg-card text-foreground shadow-card hover:bg-card`:`text-muted-foreground`,"aria-checked":e===n,onClick:()=>t(n),children:VG(n)},n))})}function bK({query:e,onQuery:t}){return(0,L.jsxs)(`label`,{className:`relative flex items-center`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`Search runs`}),(0,L.jsx)(ig,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 size-3.5 text-muted-foreground`}),(0,L.jsx)(`input`,{id:`metrics-search`,type:`search`,value:e,maxLength:500,placeholder:`Search runs: model, agent, tool…`,onChange:e=>t(e.target.value),className:`h-8 w-64 max-w-full rounded-lg border border-input bg-background pr-9 pl-8 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30`}),(0,L.jsx)(GO,{chord:`/`,className:`kbd-hint pointer-events-none absolute right-2`})]})}function xK({data:e,groupBy:t,query:n}){let r=e=>HG(e,t);return e.tiles.runs===0?(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(_K,{tiles:e.tiles}),(0,L.jsx)(`p`,{className:`card-raised rounded-xl border p-4 text-sm text-muted-foreground`,children:n?`No run matches "${n}".`:vK})]}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsx)(_K,{tiles:e.tiles}),e.classifier?(0,L.jsx)(lK,{summary:e.classifier}):null,(0,L.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,L.jsx)(QG,{groups:e.groups,label:r}),(0,L.jsx)(nK,{groups:e.groups,label:r})]}),(0,L.jsx)(oK,{timeShare:e.timeShare}),(0,L.jsx)(mK,{groups:e.groups,groupBy:t})]})}function SK(){return(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5`,role:`status`,"aria-label":`Loading metrics`,children:[0,1,2,3,4].map(e=>(0,L.jsx)(`div`,{className:`h-20 rounded-lg bg-muted motion-safe:animate-pulse`},e))})}function CK(){let[e,t]=(0,m.useState)(`model`),[n,r]=(0,m.useState)(``),i=Ak(`metrics.get`,{groupBy:e,query:n},[`metrics`]);return!i.data&&i.error?(0,L.jsx)(wk,{message:`Could not load metrics. ${i.error}`,onRetry:i.reload}):(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-5 pt-5 pb-dock`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,L.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Metrics`}),i.loading&&i.data?(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(vk,{className:`size-3`,"aria-hidden":`true`,role:`presentation`}),` refreshing`]}):null,(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`min-w-4 flex-1`}),(0,L.jsx)(yK,{groupBy:e,onGroup:t}),(0,L.jsx)(bK,{query:n,onQuery:r})]}),i.data?(0,L.jsx)(xK,{data:i.data,groupBy:e,query:n}):(0,L.jsx)(SK,{})]})}var wK=class{seen=new Set;initialized=new Set;storage;constructor(e){this.storage=e;try{let t=JSON.parse(e?.getItem(`bot-lobby.prompt-seen`)??`[]`);Array.isArray(t)&&(this.seen=new Set(t.filter(e=>typeof e==`string`)))}catch{}}observe(e,t,n=!1){let r=this.initialized.has(e)&&!n?t.filter(e=>!this.seen.has(e)):[];this.initialized.add(e);for(let e of t)this.seen.add(e);try{this.storage?.setItem(`bot-lobby.prompt-seen`,JSON.stringify([...this.seen]))}catch{}return r}};function TK(e,t){return JSON.stringify([e,`prompt`,t])}function EK(e,t,n){return JSON.stringify([e,`dialog`,t,n])}function DK(e,t,n){return JSON.stringify([e,`delivery`,t,n])}var OK=`bot-lobby.prompt-sound-muted`,kK=new Set,AK,jK=!1;function MK(){try{return localStorage.getItem(OK)===`on`}catch{return jK}}function NK(e){jK=e;try{localStorage.setItem(OK,e?`on`:`off`)}catch{}for(let e of kK)e()}function PK(e){return kK.add(e),()=>{kK.delete(e)}}function FK(){return(0,m.useSyncExternalStore)(PK,MK,()=>!1)}function IK(){(0,m.useEffect)(()=>{let e=()=>{try{AK??=new AudioContext,AK.resume().catch(()=>void 0)}catch{}};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,e)}},[])}function LK(){if(!MK()&&AK&&AK.state===`running`)try{let e=AK.currentTime,t=AK.createOscillator(),n=AK.createGain();t.frequency.setValueAtTime(960,e),t.frequency.exponentialRampToValueAtTime(360,e+.16),n.gain.setValueAtTime(1e-4,e),n.gain.exponentialRampToValueAtTime(.12,e+.012),n.gain.exponentialRampToValueAtTime(1e-4,e+.22),t.connect(n),n.connect(AK.destination),t.start(e),t.stop(e+.24),t.onended=()=>{t.disconnect(),n.disconnect()}}catch{}}var RK=`bot-lobby.notifications`,zK=`/icon-192.png`,BK=new Set;function VK(){for(let e of[...BK])e()}function HK(){try{return localStorage.getItem(RK)===`on`}catch{return!1}}function UK(e){return BK.add(e),()=>{BK.delete(e)}}function WK(e){try{localStorage.setItem(RK,e?`on`:`off`)}catch{}VK()}function GK(){return(0,m.useSyncExternalStore)(UK,HK,()=>!1)}async function KK(){return typeof Notification>`u`?`unsupported`:(Notification.permission==="default"&&await Notification.requestPermission().catch(()=>void 0),Notification.permission===`granted`?(WK(!0),`granted`):`denied`)}function qK(){WK(!1)}function JK(e){if(e===`completed`)return`finished`;if(e===`abandoned`)return`dropped`}function YK(){return typeof Notification<`u`&&Notification.permission===`granted`&&document.hidden}function XK(e){try{new Notification(`bot-lobby`,{body:e,icon:zK,tag:`bot-lobby`})}catch{}}function ZK(){try{return new wK(sessionStorage)}catch{return new wK}}function QK(e,t){let n=t.payload;return t.kind===`sessionDialog`&&n?.dialog?.id?EK(e,t.sessionId??n.key??t.from,n.dialog.id):TK(e,t.id)}function $K(){let e=GK();IK(),Ek();let t=Ak(`tasks.list`,{},[`tasks`]),n=Ak(`sessions.list`,{},[`sessions`]),r=me.get(`prompts`),i=me.get(`lobby`).data,a=(0,m.useRef)(ZK()),o=(0,m.useRef)(new Set([`prompts`,`sessions`,`delivery`])),s=(0,m.useRef)(void 0),c=M()??`current`,l=me.status().connection;return{enabled:e,tasks:t,sessions:n,prompts:r,lobby:i,seen:a,quiet:o,previousState:s,project:c,connection:l,lastConnection:(0,m.useRef)(l)}}function eq(e,t,n,r,i){if(!i)return;let{seen:a,project:o,quiet:s,enabled:c}=e,l=a.current.observe(`${o}:${t}`,n,s.current.has(t));s.current.delete(t),l.length&&(l.forEach(()=>LK()),c&&YK()&&XK(r),t===`delivery`&&V.info(r,{action:{label:`Review tasks`,onClick:()=>uk(`#/tasks`)}}))}function tq(e){let{prompts:t,sessions:n,tasks:r,project:i}=e,a=t.data?.prompts;eq(e,`prompts`,(a??[]).map(e=>QK(i,e)),`A question is waiting for you.`,!!a&&!t.loading),eq(e,`sessions`,n.data?.background.flatMap(e=>e.dialogs.map(t=>EK(i,e.sessionId??e.key,t.id)))??[],`A background session is asking something.`,!!n.data&&!n.loading),eq(e,`delivery`,r.data?.rows.filter(e=>e.delivery&&(e.delivery.status===`pending_approval`||e.delivery.status===`deferred`||e.delivery.status===`recoverable_failure`)).map(e=>DK(i,e.id,e.delivery.reviewId))??[],`Completed work is ready for delivery review in Tasks.`,!!r.data&&!r.loading)}function nq(e){let{lastConnection:t,connection:n,quiet:r,previousState:i,lobby:a,enabled:o}=e;if(t.current!==n||n!==`live`){t.current=n,r.current=new Set([`prompts`,`sessions`,`delivery`]),i.current=void 0;return}tq(e);let s=a?.task?.state??``,c=JK(s);i.current&&c&&s!==i.current&&o&&YK()&&XK(`${a?.task?.title??`The task`} ${c}.`),i.current=s}function rq(){let e=$K(),{connection:t,enabled:n,project:r,prompts:i,sessions:a,tasks:o,lobby:s}=e;(0,m.useEffect)(()=>nq(e),[t,n,r,i.data,i.loading,a.data,a.loading,o.data,o.loading,s])}function iq({className:e,type:t,...n}){return(0,L.jsx)(`input`,{type:t,"data-slot":`input`,className:q(`flex h-8 w-full rounded-lg border border-input bg-background px-3 py-1 text-base transition-[border-color,box-shadow] duration-150 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:disabled:bg-input/80`,e),...n})}function aq({className:e,thumbClassName:t,...n}){return(0,L.jsx)(wD,{"aria-keyshortcuts":`Enter Space`,"aria-description":`When focused, press Enter or Space to toggle.`,"data-slot":`switch`,className:q(`peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-150 outline-none before:absolute before:-inset-x-2 before:-inset-y-3 before:content-[''] focus-visible:ring-3 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,L.jsx)(ED,{"data-slot":`switch-thumb`,className:q(`pointer-events-none block size-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-snap data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`,t)})})}var oq=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],sq=`M32 17 C28 10 19 12 17 19 C10 19 7 26 10 32 C5 38 9 46 15 47 C16 54 25 56 32 50 C39 56 48 54 49 47 C55 46 59 38 54 32 C57 26 54 19 47 19 C45 12 36 10 32 17Z`,cq=[`M19 22 C16 25 17 29 22 29 C27 29 28 33 25 36`,`M12 35 C16 32 20 35 18 39 C16 43 20 47 24 45`,`M25 17 C22 20 26 22 28 22 C31 23 29 27 26 27`,`M11 42 C13 44 16 42 15 39 M22 49 C26 49 29 45 27 41`,`M15 25 C12 27 14 31 17 31 M21 32 C22 35 20 37 22 39 C24 41 28 38 29 35`,`M20 18 C22 18 23 20 21 22 M24 24 C21 23 20 25 21 27 M12 37 C14 36 16 38 15 40 M20 43 C23 44 25 42 24 40 M28 29 C30 30 30 32 28 33`];function lq({level:e,className:t}){let n=Sf(),r=Math.max(0,oq.indexOf(e)),i=r===oq.length-1,a=`brain-${(0,m.useId)().replace(/[^a-zA-Z0-9]/g,``)}`;return(0,L.jsxs)(`svg`,{viewBox:`0 0 64 72`,"data-slot":`effort-mascot`,"data-level":e,"data-folds":r*2,"data-elevated":i||void 0,"aria-hidden":`true`,focusable:`false`,className:q(`size-16 shrink-0 overflow-visible`,t),children:[(0,L.jsxs)(`defs`,{children:[(0,L.jsxs)(`linearGradient`,{id:`${a}-ink`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,L.jsx)(`stop`,{stopColor:i?`var(--rainbow-5)`:`var(--primary)`}),(0,L.jsx)(`stop`,{offset:`0.55`,stopColor:i?`var(--rainbow-6)`:`var(--primary)`}),(0,L.jsx)(`stop`,{offset:`1`,stopColor:i?`var(--rainbow-7)`:`var(--primary)`})]}),(0,L.jsxs)(`radialGradient`,{id:`${a}-halo`,children:[(0,L.jsx)(`stop`,{stopColor:`var(--rainbow-6)`,stopOpacity:`0.38`}),(0,L.jsx)(`stop`,{offset:`0.55`,stopColor:`var(--rainbow-7)`,stopOpacity:`0.18`}),(0,L.jsx)(`stop`,{offset:`1`,stopColor:`var(--rainbow-5)`,stopOpacity:`0`})]}),(0,L.jsxs)(`filter`,{id:`${a}-glow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,L.jsx)(`feGaussianBlur`,{stdDeviation:`1.4`}),(0,L.jsxs)(`feMerge`,{children:[(0,L.jsx)(`feMergeNode`,{}),(0,L.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,L.jsx)(`ellipse`,{cx:`32`,cy:`63`,rx:i?14:19,ry:`2.5`,className:`fill-primary/10`}),i?(0,L.jsx)(z.circle,{"data-brain-halo":!0,cx:`32`,cy:`32`,r:`33`,fill:`url(#${a}-halo)`,initial:!1,animate:{opacity:n?.8:[.65,1,.65]},transition:{duration:n?0:3,repeat:n?0:1/0}}):null,(0,L.jsxs)(z.g,{"data-brain-body":!0,initial:!1,animate:{y:i?n?-5:[-5,-7,-5]:0},transition:{duration:n?0:i?3:.3,repeat:i&&!n?1/0:0,ease:`easeInOut`},stroke:`url(#${a}-ink)`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,filter:i?`url(#${a}-glow)`:void 0,children:[(0,L.jsx)(`path`,{d:`M30 49 L30 56 Q32 59 35 57 L35 51`,className:`fill-primary/15`}),(0,L.jsx)(`path`,{d:sq,className:r===0?`fill-muted`:`fill-primary/10`}),(0,L.jsx)(`path`,{d:`M32 17 C29 24 34 28 32 34 C30 40 34 45 32 50`,fill:`none`,opacity:r===0?.35:.8}),[!1,!0].map(e=>(0,L.jsx)(`g`,{transform:e?`translate(64 0) scale(-1 1)`:void 0,fill:`none`,children:cq.slice(0,r).map((e,t)=>(0,L.jsx)(z.path,{"data-brain-fold":!0,d:e,initial:!n&&{opacity:0,pathLength:0},animate:{opacity:.85,pathLength:1},transition:{duration:n?0:.3,delay:n?0:t*.025}},e))},String(e)))]}),i?(0,L.jsx)(`g`,{fill:`url(#${a}-ink)`,children:[[8,14],[56,12],[5,49],[58,46]].map(([e,t])=>(0,L.jsx)(`path`,{d:`M0 -3 L0.8 -0.8 L3 0 L0.8 0.8 L0 3 L-0.8 0.8 L-3 0 L-0.8 -0.8Z`,transform:`translate(${e} ${t})`},e))}):null]})}var uq={minimal:`min`,medium:`med`},dq={off:`No extra reasoning: the quickest, cheapest answer.`,minimal:`A moment of reasoning, barely.`,low:`Light reasoning for simple work.`,medium:`Balanced reasoning for most work.`,high:`Careful reasoning: slower, better on hard problems.`,xhigh:`Very deep reasoning: slow and costly.`,max:`As deep as the model goes.`};function fq(e,t,n){let r=-1;for(let i=0;i<e.length;i+=1)t.includes(e[i])&&(r<0||Math.abs(i-n)<Math.abs(r-n))&&(r=i);return r}function pq(e,t,n,r){for(let i=n+r;i>=0&&i<e.length;i+=r)if(t.includes(e[i]))return i;return n}function mq({value:e,levels:t,supported:n,model:r,label:i,disabled:a,onChange:o}){let s=(0,m.useRef)(null),[c,l]=(0,m.useState)(),[u,d]=(0,m.useState)(),f=(0,m.useRef)(void 0),p=(0,m.useRef)(0),h=(0,m.useCallback)(()=>{f.current=void 0,p.current=0,d(void 0)},[]),g=Math.max(t.length-1,1),_=fq(t,n,Math.max(0,t.indexOf(e))),v=c??u??_,y=v<0?0:v/g*100,b=t[v]??e,x=v>=0&&b!==e;(0,m.useEffect)(()=>{if(u===void 0)return;let e=window.setTimeout(h,1e4);return()=>window.clearTimeout(e)},[u,h]);let S=(0,m.useCallback)(e=>{let r=s.current?.getBoundingClientRect();if(!r||r.width===0)return _;let i=Math.min(1,Math.max(0,(e-r.left)/r.width));return fq(t,n,Math.round(i*g))},[g,t,_,n]);function C(e){a||n.length===0||(e.currentTarget.setPointerCapture(e.pointerId),l(S(e.clientX)))}function w(e){if(c===void 0)return;let t=S(e.clientX);t!==c&&l(t)}function T(){if(c===void 0)return;let n=t[c];l(void 0),n&&n!==e&&o(n)}function E(e){if(a||v<0)return;let r=f.current??v,i={ArrowRight:pq(t,n,r,1),ArrowUp:pq(t,n,r,1),ArrowLeft:pq(t,n,r,-1),ArrowDown:pq(t,n,r,-1),Home:fq(t,n,0),End:fq(t,n,g)}[e.key];if(i===void 0)return;e.preventDefault();let s=t[i];s&&i!==r&&(f.current=i,d(i),p.current+=1,Promise.resolve(o(s)).catch(()=>void 0).then(()=>{--p.current,p.current<=0&&h()}))}return(0,L.jsxs)(`div`,{className:q(`flex min-w-0 flex-col items-center gap-3 min-[360px]:flex-row`,a&&`opacity-60`),children:[(0,L.jsx)(lq,{level:b}),(0,L.jsxs)(`div`,{className:`flex w-full min-w-0 flex-1 flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,L.jsx)(`span`,{"data-level":b,className:`effort-word text-[0.8125rem] font-medium capitalize`,"aria-hidden":`true`,children:b}),(0,L.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:dq[b]??``})]}),(0,L.jsxs)(`div`,{ref:s,role:`slider`,tabIndex:a?-1:0,"aria-label":i,"aria-valuemin":0,"aria-valuemax":t.length-1,"aria-valuenow":Math.max(v,0),"aria-valuetext":b,"aria-disabled":a||void 0,onPointerDown:C,onPointerMove:w,onPointerUp:T,onPointerCancel:()=>l(void 0),onKeyDown:E,className:`relative mx-2.5 h-6 touch-none cursor-pointer rounded-full outline-none select-none focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-x-0 top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-muted`}),(0,L.jsx)(z.span,{"aria-hidden":`true`,className:`absolute top-1/2 left-0 h-1.5 -translate-y-1/2 rounded-full bg-primary`,animate:{width:`${y}%`},transition:{type:`spring`,stiffness:520,damping:34}}),t.map((e,t)=>{let i=n.includes(e);return(0,L.jsx)(`span`,{"aria-hidden":`true`,title:i?e:`${r??`This model`} does not support ${e}`,className:q(`absolute top-1/2 size-1 -translate-x-1/2 -translate-y-1/2 rounded-full`,i?t<=v?`bg-primary-foreground/80`:`bg-muted-foreground/40`:`bg-transparent ring-1 ring-muted-foreground/30`),style:{left:`${t/g*100}%`}},e)}),(0,L.jsx)(z.span,{"aria-hidden":`true`,className:q(`absolute top-1/2 size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-primary bg-white shadow-sm`,c!==void 0&&`scale-110`),animate:{left:`${y}%`},transition:{type:`spring`,stiffness:520,damping:28}})]}),(0,L.jsx)(`div`,{className:`relative mx-2.5 h-3.5 text-[0.68rem] text-muted-foreground`,"aria-hidden":`true`,children:t.map((e,t)=>{let i=n.includes(e);return(0,L.jsx)(`span`,{title:i?void 0:`${r??`This model`} does not support ${e}`,className:q(`absolute -translate-x-1/2 whitespace-nowrap`,t===v&&`font-medium text-foreground`,!i&&`opacity-40`),style:{left:`${t/g*100}%`},children:uq[e]??e},e)})}),x?(0,L.jsxs)(`p`,{className:`text-xs text-warning`,children:[e,` is not supported by `,r??`this model`,`, so it runs at `,b,`.`]}):null]})]})}function hq(e,t){let n=`${e.label} ${e.hint??``} ${e.value}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function gq({value:e,options:t,onChange:n,label:r,className:i,disabled:a}){let[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(0),f=(0,m.useRef)(null),p=(0,m.useId)(),h=(0,m.useMemo)(()=>t.filter(e=>hq(e,c)),[t,c]),g=t.find(t=>t.value===e);(0,m.useEffect)(()=>{o&&(l(``),d(Math.max(0,t.findIndex(t=>t.value===e))))},[o]),(0,m.useEffect)(()=>{c&&d(0)},[c]),(0,m.useEffect)(()=>{f.current?.querySelector(`[data-index="${u}"]`)?.scrollIntoView({block:`nearest`})},[u,o,h.length]);function _(t){t&&(s(!1),t.value!==e&&n(t.value))}function v(e){e.key===`ArrowDown`?(e.preventDefault(),d(e=>Math.min(h.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),d(e=>Math.max(0,e-1))):e.key===`Home`&&!c?(e.preventDefault(),d(0)):e.key===`End`&&!c?(e.preventDefault(),d(Math.max(0,h.length-1))):e.key===`Tab`?s(!1):e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),_(h[u]))}return(0,L.jsxs)(uD,{open:o,onOpenChange:s,children:[(0,L.jsxs)(dD,{type:`button`,role:`combobox`,"aria-label":r,"aria-keyshortcuts":`Enter Space ArrowDown ArrowUp`,"aria-description":`When focused, press Enter, Space or an arrow key to choose. Type to search.`,"aria-expanded":o,"aria-haspopup":`listbox`,"aria-controls":o?p:void 0,disabled:a,onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(!0))},"data-slot":`select-trigger`,className:q(`btn-raised flex h-8 w-full min-w-0 items-center justify-between gap-2 overflow-hidden rounded-lg border bg-card px-2.5 text-[0.8125rem] whitespace-nowrap outline-none transition-[border-color,box-shadow] duration-150 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:opacity-50`,i),children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:g?.label??e}),(0,L.jsx)(Wp,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]}),(0,L.jsx)(fD,{children:(0,L.jsxs)(pD,{align:`start`,sideOffset:4,collisionPadding:8,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.querySelector(`input`)?.focus()},className:`glass-pop z-50 flex max-h-[min(20rem,var(--radix-popover-content-available-height))] w-[max(var(--radix-popover-trigger-width),17rem)] max-w-(--radix-popover-content-available-width) flex-col overflow-hidden rounded-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5`,children:[(0,L.jsx)(ig,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,L.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,role:`searchbox`,"aria-label":`Search ${r}`,"aria-controls":p,"aria-activedescendant":h[u]?`${p}-${u}`:void 0,placeholder:`Search…`,autoComplete:`off`,spellCheck:!1,className:`h-8 min-w-0 flex-1 bg-transparent text-[0.8125rem] outline-none placeholder:text-muted-foreground`})]}),(0,L.jsxs)(`div`,{ref:f,id:p,role:`listbox`,"aria-label":r,className:`min-h-0 flex-1 overflow-y-auto p-1`,children:[h.length===0?(0,L.jsxs)(`p`,{className:`px-2.5 py-2 text-xs text-muted-foreground`,children:[`Nothing matches “`,c,`”.`]}):null,h.map((t,n)=>(0,L.jsxs)(`div`,{id:`${p}-${n}`,role:`option`,"aria-selected":t.value===e,"data-index":n,onPointerMove:()=>d(n),onClick:()=>_(t),className:q(`flex cursor-default items-center gap-2 rounded-lg px-2.5 py-1.5 text-[0.8125rem] select-none`,n===u&&`bg-accent`),children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:t.label}),t.hint?(0,L.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:t.hint}):null]}),t.value===e?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.value))]})]})})]})}function _q({label:e,help:t,children:n,stacked:r}){return(0,L.jsxs)(`div`,{className:r?`grid gap-1.5`:`grid gap-1.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,18rem)] sm:items-center sm:gap-6`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[0.8125rem] font-medium`,children:e}),t?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]}),(0,L.jsx)(`div`,{className:`min-w-0`,children:n})]})}function vq({children:e}){return(0,L.jsx)(AG,{dense:!0,children:(0,L.jsx)(jG,{className:`flex flex-col divide-y divide-border py-0 [&>*]:py-3`,children:e})})}function yq({value:e,items:t,label:n,onChange:r}){return(0,L.jsx)(gq,{value:e,options:t.map(e=>({value:e.value,label:e.label,...e.help?{hint:e.help}:{}})),label:n,onChange:r})}var bq=`(prefers-color-scheme: dark)`,xq=[`dark`,`light`,`system`],Sq=m.createContext(void 0);function Cq(e){return e!==null&&xq.includes(e)}function wq(){return window.matchMedia(bq).matches?`dark`:`light`}function Tq(){let e=document.createElement(`style`);return e.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;transition:none!important}`)),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.remove()})})}}function Eq(e){return e instanceof HTMLElement&&!!(e.isContentEditable||e.closest(`input, textarea, select, [contenteditable='true']`))}function Dq({children:e,defaultTheme:t=`system`,storageKey:n=`theme`,disableTransitionOnChange:r=!0,...i}){let[a,o]=m.useState(()=>{let e=localStorage.getItem(n);return Cq(e)?e:t}),s=m.useCallback(e=>{localStorage.setItem(n,e),o(e)},[n]),c=m.useCallback(e=>{let t=document.documentElement,n=e===`system`?wq():e,i=r?Tq():null;t.classList.remove(`light`,`dark`),t.classList.add(n),i&&i()},[r]);m.useEffect(()=>{if(c(a),a!==`system`)return;let e=window.matchMedia(bq),t=()=>{c(`system`)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},[a,c]),m.useEffect(()=>{let e=e=>{e.repeat||e.metaKey||e.ctrlKey||e.altKey||Eq(e.target)||e.key.toLowerCase()===`d`&&o(e=>{let t=e===`dark`?`light`:e===`light`?`dark`:wq()===`dark`?`light`:`dark`;return localStorage.setItem(n,t),t})};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n]),m.useEffect(()=>{let e=e=>{if(e.storageArea===localStorage&&e.key===n){if(Cq(e.newValue)){o(e.newValue);return}o(t)}};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}},[t,n]);let l=m.useMemo(()=>({theme:a,setTheme:s}),[a,s]);return(0,L.jsx)(Sq.Provider,{...i,value:l,children:e})}var Oq=()=>{let e=m.useContext(Sq);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e},kq=[`master`,`designer`,`backend`,`qa`,`scout`,`researcher`,`quickfix`,`planner`],Aq={master:`Master`,designer:`Designer`,backend:`Backend`,qa:`QA`,scout:`Scout`,researcher:`Researcher`,quickfix:`Quick fix`,planner:`Planner`},jq={model:`Model`,thinking:`Effort`,timeout:`Time limit`,instructions:`Instructions`},Mq=`inherit`,Nq=`inherit`,Pq=`Use the session's current model`,Fq=`__custom__`,Iq=`custom…`,Lq=`Type a provider/model id`,Rq=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],zq={agents:`Agents`,workflow:`Workflow`,lint:`Linting`,lobby:`Lobby`,classifier:`Classifier`,appearance:`Appearance`,notifications:`Notifications`,install:`Install as app`},Bq=[{id:`startOn`,label:`On when pi starts`,help:`off: pi starts as plain pi, and ctrl+shift+m or /bot-lobby on turns bot-lobby on (a session that owns a task under way always starts on)`},{id:`issues`,label:`Issues tab`,help:`the GitHub Issues tab`}],Vq=[{id:`conversation`,label:`Conversation pane`},{id:`activity`,label:`Activity log pane`},{id:`thinking`,label:`Thinking bubble`}],Hq=`shown on the Lobby tab`,Uq=`Planning rounds`,Wq=`how many rounds the panel gets before the oracle settles the rest alone`,Gq=[2,3,5,8,0],Kq=`Split long plans`,qq=`saving a plan with more steps offers to split it into up to 5 tasks`,Jq=[6,8,10,12,0],Yq=`Port`,Xq=`the base port (then the next free up to +20); 0 means any free port; applies the next time pi starts`,Zq=`Open browser`,Qq=`open this page in the browser when pi starts`,$q=[{id:`off`,label:`off`,help:`tasks work in the folder you started them in`},{id:`branch`,label:`branch`,help:`each new task gets a git branch named after it, checked out in the working folder`},{id:`worktree`,label:`worktree`,help:`each new task gets its own worktree and branch, named after it: every agent runs there, apart from your checkout`}],eJ=`Git isolation`,tJ=[{id:`off`,label:`off`,help:`agents' work is never linted`},{id:`advise`,label:`advise`,help:`the oracle and QA are told what the project's linter finds on the lines a task changed; nothing is held`},{id:`block`,label:`block`,help:`new lint errors also hold a task's completion until they are fixed, or you accept the work as it is`}],nJ={intro:`After every worker step, before QA and at completion, bot-lobby lints only the files the task's agents touched. Problems on the lines the task changed are the task's; anything already there is shown but never holds it. Suppressions and lint-config changes the task adds go to QA to judge.`,mode:`Lint gate`,command:`Command`,commandHelp:`empty runs the linters the project configures (ESLint, Biome, Oxlint, Ruff), each from its own folder; a command runs without a shell from the repository's top, with {files} standing for the touched files`,commandPlaceholder:`found from the project`,extensions:`File types`,extensionsHelp:`which touched files the command is given, such as .ts .tsx .py`,extensionsPlaceholder:`every touched file`,timeout:`Time limit`,timeoutHelp:`for one linter run; one that runs over reads as could not run, and holds nothing`,found:`Found in this project`,foundHelp:`config files in the project and the folders a few levels below it`,foundNone:`No linter config found. Add one to the project, or set a command above.`,foundReplaced:`The command replaces these.`,installed:`installed`,missing:`not installed`,missingHelp:`install the project's dependencies there, or lint cannot run`,top:`project root`},rJ=[{id:`auto`,label:`Auto (OpenCode's free Jev, else TypeSafe)`},{id:`opencode`,label:`OpenCode Zen`},{id:`typesafe`,label:`TypeSafe`},{id:`openrouter`,label:`OpenRouter`},{id:`vercel`,label:`Vercel AI Gateway`}],iJ=[{id:`seats`,label:`Planning seats`,help:`each round, only the seats your idea or latest answers touch sit; 1-4 in the Plan tab pins one`},{id:`answers`,label:`Obvious answers`,help:`a panel question whose recommended option the conversation already makes clearly right is answered for you (listed under Assumptions)`},{id:`triage`,label:`Task triage`,help:`a new task's size, domains and research need reach the Master as hints; a quick fix that is really a task is held for you`},{id:`effort`,label:`Effort routing`,help:`a simple step runs one thinking level lower, a trivial one on the cheaper model below; a routed run that falls short runs again on your settings`},{id:`qa`,label:`QA risk`,help:`once a task's work is in, Jev reads the diff and sizes QA to it: no QA agent for a change with nothing that runs, a light check for a small one, deep review where a defect would spread; with it off the engine's rules decide`},{id:`review`,label:`Pull request read`,help:`the Git tab's quick read of a pull request: its size, and how likely it is risky, security-relevant, breaking or untested, before an agent reviews it`},{id:`knowledge`,label:`Relevant knowledge`,help:`when an agent's knowledge, standards or decisions file is too long for its prompt, Jev picks the sections that bear on the step, and the agent is told where the rest is`},{id:`files`,label:`File hints`,help:`scouts, workers, quick fixes and the planning panel start with the files most likely needed, and can look more up with find_relevant_files`}],aJ={enabled:`Classifier`,enabledHelp:`Jev makes the obvious decisions so large models spend fewer tokens on them`,host:`Host`,model:`Model`,modelHelp:`empty uses the host's default`,key:`API key`,keyNote:`the key pi already holds for this host; it is never read by this page`,cheap:`Cheaper model`,cheapNone:`none: trivial steps keep their model and drop a thinking level`,cheapHelp:`what effort routing runs trivial steps on`},oJ={title:`Settings`,intro:`Each agent's model and effort, the workflow and its lint gate, the lobby and the classifier. Changes save as you make them.`,loading:`Loading settings…`,loadFailed:`Could not load settings.`,saved:`Settings saved`,saving:`Saving…`,appearanceHelp:`Light, dark, or follow your system. Kept in this browser only.`,themeLabel:`Mode`,themeItems:[{id:`light`,label:`Light`},{id:`dark`,label:`Dark`},{id:`system`,label:`System`}],notificationsLabel:`Browser notifications`,notificationsHelp:`While this page is hidden, tell me when a question waits, a task finishes or a background session asks something.`,notificationsBlocked:`Notifications are blocked in your browser. Allow them for this site and try again.`,notificationsUnsupported:`This browser does not offer notifications.`,notificationsOn:`Browser notifications are on.`,notificationsOff:`Browser notifications are off.`,installLabel:`Install bot-lobby`,installHelp:`Opens in its own fullscreen window, with the shell cached so it starts when Pi is not running.`,installButton:`Install as fullscreen app`,installUnavailable:`Your browser has not offered to install it. Use its menu: “Install app” (Chrome, Edge) or Share, then “Add to Home Screen” (Safari).`,installDone:`bot-lobby is installed.`,installedNow:`Running as an installed app.`,fullscreenLabel:`Fullscreen`,fullscreenHelp:`Hide the browser's own bars for this tab (F11 does the same).`,fullscreenOn:`Exit fullscreen`,fullscreenOff:`Go fullscreen`},sJ=`https://tweakcn.com/editor/theme`;function cJ(){let{theme:e}=Oq();return e===`dark`||e===`system`&&typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}function lJ({palette:e,dark:t}){let n=le(e,t);return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`flex h-9 items-center gap-1.5 rounded-lg border border-border px-2`,style:{background:n.background},children:[(0,L.jsx)(`span`,{className:`size-4 rounded-full border border-black/10`,style:{background:n.card}}),(0,L.jsx)(`span`,{className:`size-4 rounded-full`,style:{background:n.primary}}),(0,L.jsx)(`span`,{className:`h-2 flex-1 rounded-full`,style:{background:n.accent}})]})}function uJ(){let e=Ge(),t=cJ(),n=(0,m.useRef)(null);function r(t){let r=t.key===`ArrowRight`||t.key===`ArrowDown`?1:t.key===`ArrowLeft`||t.key===`ArrowUp`?-1:0;if(!r)return;t.preventDefault(),t.stopPropagation();let i=Math.max(0,e.all.findIndex(t=>t.id===e.active.id)),a=e.all[(i+r+e.all.length)%e.all.length];e.choose(a.id),window.requestAnimationFrame(()=>n.current?.querySelector(`[data-theme-id="${a.id}"]`)?.focus())}return(0,L.jsx)(`div`,{ref:n,role:`radiogroup`,"aria-label":`Colour theme`,onKeyDown:r,className:`grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4`,children:e.all.map(n=>{let r=n.id===e.active.id;return(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space ArrowLeft ArrowRight`,"aria-describedby":`focused-action-help`,type:`button`,role:`radio`,"aria-checked":r,"data-theme-id":n.id,tabIndex:r?0:-1,onClick:()=>e.choose(n.id),className:q(`grid gap-1.5 rounded-lg border p-2 text-left outline-none transition-[border-color,box-shadow,background-color] duration-150 focus-visible:ring-3 focus-visible:ring-ring/40`,r?`border-primary bg-accent shadow-[0_0_0_1px_var(--primary)]`:`border-border hover:bg-accent/50`),children:[(0,L.jsx)(lJ,{palette:n,dark:t}),(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2 px-0.5 text-[0.8125rem] font-medium`,children:[(0,L.jsxs)(`span`,{className:`truncate`,children:[n.name,e.isSaved(n.id)?(0,L.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:`saved`}):null]}),r?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]})]},n.id)})})}function dJ({entry:e}){let t=Ge(),[n,r]=(0,m.useState)(!1),[i,a]=(0,m.useState)(e.name),[o,s]=(0,m.useState)();async function c(){let n=i.trim();if(!n||n===e.name)return r(!1);try{await t.rename(e.id,n),r(!1),s(void 0),V.success(`Renamed to ${n}.`)}catch(e){s(e.message)}}return(0,L.jsxs)(`li`,{className:`flex min-h-10 flex-wrap items-center gap-2 py-1.5`,children:[n?(0,L.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-center gap-1`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,L.jsx)(iq,{autoFocus:!0,value:i,maxLength:40,"aria-label":`New name for ${e.name}`,"aria-invalid":o?!0:void 0,onChange:e=>a(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),a(e.name),r(!1))},className:`h-8 max-w-64`}),(0,L.jsx)(Y,{label:`Save the name`,text:`Save`,icon:Hp,tone:`primary`,type:`submit`,disabled:!i.trim()}),(0,L.jsx)(Y,{label:`Keep the old name`,icon:Hg,iconOnly:!0,onClick:()=>{a(e.name),r(!1)}})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:e.name}),(0,L.jsx)(Y,{label:`Rename ${e.name}`,text:`Rename`,icon:Bh,onClick:()=>{a(e.name),r(!0)}}),(0,L.jsx)(MA,{label:`Remove ${e.name}`,text:`Remove`,title:`Remove ${e.name}?`,description:`It is removed for every pi session. Keep a copy of its CSS if you want to use it again.`,confirmLabel:`Remove theme`,icon:wg,variant:`destructive`,onConfirm:()=>void t.remove(e.id).catch(e=>V.error(e.message))})]}),o?(0,L.jsx)(`p`,{role:`alert`,className:`w-full text-xs text-destructive`,children:o}):null]})}function fJ(){let e=Ge();return e.saved.length===0?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No saved themes yet. Import one below and give it a name.`}):(0,L.jsx)(`ul`,{"aria-label":`Saved themes`,className:`divide-y divide-border`,children:e.saved.map(e=>(0,L.jsx)(dJ,{entry:e},e.id))})}function pJ(){let e=Ge(),[t,n]=(0,m.useState)(``),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(),[s,c]=(0,m.useState)(!1),l=(0,m.useRef)(null);async function u(t,a){let s=te(t);if(`error`in s){o(s.error);return}o(void 0),c(!0);try{let t=await e.adopt(s,r.trim()||s.name||a);n(``),i(``);let o=s.light?s.dark?void 0:`dark`:`light`;V.success(o?`${t.name} saved and applied. It has no ${o} colours, so ${o} mode keeps the default ones.`:`${t.name} saved and applied.`)}catch(e){o(e.message)}finally{c(!1)}}async function d(e){if(e){if(e.size>2e5){o(`That file is too large to be a theme.`);return}await u(await e.text(),e.name.replace(/\.[^.]+$/,``)||`Custom theme`)}}return(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pick or build a theme in the`,` `,(0,L.jsxs)(`a`,{href:sJ,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-0.5 text-link underline-offset-2 hover:underline`,children:[`tweakcn editor `,(0,L.jsx)(Em,{"aria-hidden":`true`,className:`size-3`})]}),`, press Code, copy it, and paste it here, or save it as a file and upload that. Colours and fonts are used; corners stay the page's own.`]}),(0,L.jsxs)(`label`,{className:`grid gap-1 text-xs text-muted-foreground`,children:[`Name`,(0,L.jsx)(iq,{value:r,maxLength:40,placeholder:`the theme's own name, or the file's`,onChange:e=>i(e.target.value),className:`h-8 max-w-80 text-foreground`})]}),(0,L.jsx)(gA,{value:t,onChange:e=>{n(e.target.value),o(void 0)},rows:4,spellCheck:!1,"aria-label":`Theme CSS from tweakcn`,"aria-invalid":a?!0:void 0,placeholder:`:root {
92
92
  --background: oklch(0.98 0 0);
93
93
  --primary: oklch(0.55 0.2 260);
94
94
  …
95
95
  }
96
- .dark { … }`,className:`max-h-56 font-mono text-xs md:text-xs`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{ref:l,type:`file`,accept:`.css,.json,text/css,application/json`,hidden:!0,tabIndex:-1,"aria-label":`Upload a theme file`,onChange:e=>{d(e.target.files?.[0]),e.target.value=``}}),(0,L.jsx)(X,{label:`Save and apply the pasted theme`,text:`Save theme`,icon:Hp,tone:`primary`,disabled:!t.trim()||s,onClick:()=>void u(t,`Custom theme`)}),(0,L.jsx)(X,{label:`Upload a .css or .json theme file`,text:`Upload file`,icon:Ag,disabled:s,onClick:()=>l.current?.click()}),a?(0,L.jsx)(`p`,{role:`alert`,className:`ml-2 min-w-0 text-xs text-destructive`,children:a}):null]})]})}function yJ(){let{theme:e,setTheme:t}=Nq(),n=DK();return(0,L.jsx)(QB,{prominent:!0,title:Wq.appearance,children:(0,L.jsxs)(Cq,{children:[(0,L.jsx)(Sq,{label:`Prompt sounds`,help:`A droplet for each new actionable prompt or delivery review. Kept in this browser; sound starts after interaction. Desktop notifications remain separate.`,children:(0,L.jsx)(ZK,{checked:!n,onCheckedChange:e=>TK(!e),"aria-label":`Prompt sounds`})}),(0,L.jsx)(Sq,{label:dJ.themeLabel,help:dJ.appearanceHelp,children:(0,L.jsx)(wq,{value:e,items:dJ.themeItems.map(e=>({value:e.id,label:e.label})),label:dJ.themeLabel,onChange:e=>t(e)})}),(0,L.jsx)(Sq,{label:`Colour theme`,help:`The page's colours, the same in every pi session.`,stacked:!0,children:(0,L.jsx)(hJ,{})}),(0,L.jsx)(Sq,{label:`Saved themes`,help:`Themes you imported, kept with pi for every session and project.`,stacked:!0,children:(0,L.jsx)(_J,{})}),(0,L.jsx)(Sq,{label:`Import a theme`,stacked:!0,children:(0,L.jsx)(vJ,{})})]})})}var bJ={master:[`master`],designer:[`agents`,`designer`],backend:[`agents`,`backend`],qa:[`agents`,`qa`],scout:[`scout`],researcher:[`researcher`],quickfix:[`quickFix`],planner:[`planner`]},xJ=[...Gq,...Kq.map(e=>({id:`panel:${e.id}`,label:e.label,help:qq}))];function SJ(e,t){switch(t){case`master`:return e.master;case`scout`:return{model:e.scout.model,thinking:`low`,timeoutMs:e.scout.timeoutMs};case`researcher`:return e.researcher;case`quickfix`:return e.quickFix;case`planner`:return e.planner;default:return e.agents[t]}}function CJ(e,t){return bJ[e].reduceRight((e,t)=>({[t]:e}),t)}function wJ(e,t){return e.find(e=>e.id===t)?.thinkingLevels??Uq}function TJ(e,t){return Uq[_q(Uq,e,Math.max(0,Uq.indexOf(t)))]??t}var EJ=e=>e>0?`${e} round${e===1?``:`s`}`:`unlimited`,DJ=e=>e>0?`over ${e} steps`:`never`;function OJ({label:e,children:t}){return(0,L.jsxs)(`div`,{className:`grid min-w-0 gap-1`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),t]})}function kJ(e){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)(``),a=e.models.some(t=>t.id===e.value),o=[...e.inherit?[{value:Lq,label:Rq,help:zq}]:[],...e.none?[{value:Lq,label:`none`,help:`Use the primary model`}]:[],...!e.inherit&&!e.none&&e.value===`inherit`?[{value:Lq,label:Rq,help:zq}]:[],...e.models.map(e=>({value:e.id,label:e.id,...e.label&&e.label!==e.id?{help:e.label}:{}})),...!a&&e.value!==`inherit`?[{value:e.value,label:e.value,help:Hq}]:[],{value:Bq,label:Vq,help:Hq}],s=t=>{if(t!==`__custom__`)return e.onChange(t);i(a?``:e.value),n(!0)},c=()=>{let t=r.trim();n(!1),t&&t!==e.value&&e.onChange(t)};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(wq,{value:e.value,items:o,label:e.label,onChange:s}),t?(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(XK,{autoFocus:!0,value:r,placeholder:`provider/model`,"aria-label":`Model id`,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())}}),(0,L.jsx)(X,{label:`Use this model`,icon:Hp,tone:`primary`,onClick:c})]}):null]})}function AJ({label:e,help:t,checked:n,onChange:r}){return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[0.8125rem] font-medium`,children:e}),t?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]}),(0,L.jsx)(ZK,{checked:n,onCheckedChange:r,"aria-label":e})]})}function jJ({value:e,onSave:t,placeholder:n,label:r}){let[i,a]=(0,m.useState)(e);(0,m.useEffect)(()=>a(e),[e]);let o=()=>{let n=i.trim();n!==e&&t(n)};return(0,L.jsx)(XK,{value:i,placeholder:n,"aria-label":r,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())}})}function MJ({value:e,label:t,onSave:n}){let r=Math.round(e/6e4);return(0,L.jsx)(PJ,{label:t,value:String(r),min:1,suffix:`min`,onSave:e=>{let t=Number(e);return!Number.isFinite(t)||t<=0?(V.error(`"${e}" is not a positive number of minutes.`),!1):(n(Math.round(t*6e4)),!0)}})}function NJ({value:e,onSave:t}){return(0,L.jsx)(PJ,{label:eJ,value:String(e),min:0,max:65535,onSave:e=>!/^\d+$/.test(e)||Number(e)>65535?(V.error(`"${e}" is not a port (0, or 1-65535).`),!1):(t(Number(e)),!0)})}function PJ({label:e,value:t,min:n,max:r,suffix:i,onSave:a}){let[o,s]=(0,m.useState)(t);(0,m.useEffect)(()=>s(t),[t]);let c=()=>{o!==t&&(a(o.trim())||s(t))};return(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(XK,{type:`number`,inputMode:`numeric`,min:n,max:r,value:o,"aria-label":e,className:i?`pr-10`:void 0,onChange:e=>s(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())}}),i?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 right-2.5 flex items-center text-xs text-muted-foreground`,children:i}):null]})}function FJ({value:e,label:t,onSave:n}){let[r,i]=(0,m.useState)(e);return(0,m.useEffect)(()=>i(e),[e]),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(dA,{rows:2,value:r,"aria-label":t,onChange:e=>i(e.target.value),onBlur:()=>{r.trim()!==e&&n(r.trim())}}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Saved when you leave the field.`})]})}function IJ({kind:e,config:t,models:n,save:r}){let i=SJ(t,e),a=t=>r(CJ(e,t)),o=Fq[e],s=wJ(n,i.model),c=t=>{let r={model:t};e!==`scout`&&!wJ(n,t).includes(i.thinking)&&(r.thinking=TJ(wJ(n,t),i.thinking)),a(r)},l=e===`scout`?`low`:TJ(s,i.thinking),u=e!==`scout`&&e!==`researcher`,[d,f]=(0,m.useState)(!!i.instructions);return(0,L.jsxs)(`section`,{className:`glass flex min-w-0 flex-col gap-3 rounded-xl p-4`,children:[(0,L.jsxs)(`header`,{className:`flex items-baseline justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:o}),(0,L.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[i.model===`inherit`?`session model`:i.model,` · `,e===`scout`?`low`:i.thinking]})]}),(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-1`,children:(0,L.jsx)(OJ,{label:Iq.model,children:(0,L.jsx)(kJ,{value:i.model,models:n,label:`${o} model`,inherit:e===`master`,onChange:c})})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-muted p-3`,children:[(0,L.jsx)(mq,{level:l,className:`size-16`}),(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:e===`scout`?(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Iq.thinking}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`low`,` (fixed for scouts)`]})]}):(0,L.jsx)(yq,{value:i.thinking,levels:Uq,supported:s,model:i.model===`inherit`?`the session model`:i.model,label:`${o} effort`,onChange:e=>a({thinking:e})})})]}),(0,L.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[u?(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"aria-expanded":d,onClick:()=>f(e=>!e),className:`flex min-h-8 items-center gap-1 rounded-md text-xs text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/30`,children:[(0,L.jsx)(Jp,{"aria-hidden":`true`,className:q(`size-3.5 transition-transform duration-200 ease-snap`,d&&`rotate-90`)}),Iq.instructions,!d&&i.instructions?(0,L.jsx)(`span`,{className:`text-primary`,children:`· set`}):null]}):(0,L.jsx)(`span`,{}),e===`master`?null:(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Time limit`}),(0,L.jsx)(`div`,{className:`w-24`,children:(0,L.jsx)(MJ,{value:i.timeoutMs??t.workflow.agentTimeoutMs,label:`${o} time limit`,onSave:e=>a({timeoutMs:e})})})]})]}),u&&d?(0,L.jsx)(FJ,{value:i.instructions??``,label:`${o} instructions`,onSave:e=>a({instructions:e})}):null]})}function LJ(e,t){return t.startsWith(`panel:`)?e.lobby.panels[t.slice(6)]:e.lobby[t]}function RJ({config:e,item:t,save:n}){let r=t.id.startsWith(`panel:`);return(0,L.jsx)(AJ,{label:t.label,help:t.help,checked:LJ(e,t.id),onChange:e=>{n(r?{lobby:{panels:{[t.id.slice(6)]:e}}}:{lobby:{[t.id]:e}})}})}function zJ({config:e,save:t}){let n=e.workflow.gitIsolation;return(0,L.jsx)(QB,{prominent:!0,title:Wq.workflow,children:(0,L.jsx)(Cq,{children:(0,L.jsx)(Sq,{label:aJ,help:iJ.find(e=>e.id===n)?.help??`enter cycles off, branch, worktree`,children:(0,L.jsx)(wq,{value:n,items:iJ.map(e=>({value:e.id,label:e.label})),label:aJ,onChange:e=>void t({workflow:{gitIsolation:e}})})})})})}var BJ=e=>e?`${e}/`:sJ.top;function VJ(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean)}function HJ({replaced:e}){let t=Tk(`settings.linters`,{},[]),n=t.data?.linters;return(0,L.jsx)(Sq,{label:sJ.found,help:e?sJ.foundReplaced:sJ.foundHelp,children:n?n.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground sm:text-right`,children:sJ.foundNone}):(0,L.jsx)(`ul`,{"aria-label":sJ.found,className:q(`flex flex-col gap-1.5 sm:items-end`,e&&`opacity-60`),children:n.map(e=>(0,L.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.tool}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:BJ(e.folder)}),(0,L.jsxs)(`span`,{title:e.installed?void 0:sJ.missingHelp,className:q(`inline-flex shrink-0 items-center gap-1 text-xs`,e.installed?`text-success`:`text-warning`),children:[e.installed?(0,L.jsx)(nm,{"aria-hidden":`true`,className:`size-3.5`}):(0,L.jsx)(em,{"aria-hidden":`true`,className:`size-3.5`}),e.installed?sJ.installed:sJ.missing]})]},`${e.tool}:${e.folder}`))}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground sm:text-right`,children:t.error?t.error:`Looking…`})})}function UJ({config:e,save:t}){let n=e.lint,r=n.mode===`off`,i=n.command.trim().length>0;return(0,L.jsxs)(QB,{prominent:!0,title:Wq.lint,children:[(0,L.jsx)(`p`,{className:`max-w-3xl text-sm text-muted-foreground`,children:sJ.intro}),(0,L.jsxs)(Cq,{children:[(0,L.jsx)(Sq,{label:sJ.mode,help:oJ.find(e=>e.id===n.mode)?.help,children:(0,L.jsx)(wq,{value:n.mode,items:oJ.map(e=>({value:e.id,label:e.label})),label:sJ.mode,onChange:e=>void t({lint:{mode:e}})})}),(0,L.jsxs)(`div`,{className:q(`flex flex-col divide-y divide-border [&>*]:py-3 [&>*:first-child]:pt-0 [&>*:last-child]:pb-0`,r&&`opacity-60`),"aria-disabled":r||void 0,children:[(0,L.jsx)(Sq,{label:sJ.command,help:sJ.commandHelp,children:(0,L.jsx)(jJ,{value:n.command,label:sJ.command,placeholder:sJ.commandPlaceholder,onSave:e=>void t({lint:{command:e}})})}),i?(0,L.jsx)(Sq,{label:sJ.extensions,help:sJ.extensionsHelp,children:(0,L.jsx)(jJ,{value:n.extensions.join(` `),label:sJ.extensions,placeholder:sJ.extensionsPlaceholder,onSave:e=>void t({lint:{extensions:VJ(e)}})})}):null,(0,L.jsx)(Sq,{label:sJ.timeout,help:sJ.timeoutHelp,children:(0,L.jsx)(MJ,{value:n.timeoutMs,label:`Lint ${sJ.timeout.toLowerCase()}`,onSave:e=>void t({lint:{timeoutMs:e}})})}),(0,L.jsx)(HJ,{replaced:i})]})]})]})}function WJ({config:e,save:t}){let n=e.lobby.web;return(0,L.jsx)(QB,{prominent:!0,title:Wq.lobby,children:(0,L.jsxs)(Cq,{children:[xJ.map(n=>(0,L.jsx)(RJ,{config:e,item:n,save:t},n.id)),(0,L.jsx)(Sq,{label:Jq,help:Yq,children:(0,L.jsx)(wq,{value:String(e.lobby.maxPlanningRounds),items:Xq.map(e=>({value:String(e),label:EJ(e)})),label:Jq,onChange:e=>void t({lobby:{maxPlanningRounds:Number(e)}})})}),(0,L.jsx)(Sq,{label:Zq,help:Qq,children:(0,L.jsx)(wq,{value:String(e.lobby.splitPlanAbove),items:$q.map(e=>({value:String(e),label:DJ(e)})),label:Zq,onChange:e=>void t({lobby:{splitPlanAbove:Number(e)}})})}),(0,L.jsx)(Sq,{label:eJ,help:tJ,children:(0,L.jsx)(NJ,{value:n.port,onSave:e=>void t({lobby:{web:{port:e}}})})}),(0,L.jsx)(AJ,{label:nJ,help:rJ,checked:n.openBrowser,onChange:e=>void t({lobby:{web:{openBrowser:e}}})})]})})}function GJ({config:e,models:t,save:n}){let r=e.classifier,i=cJ.find(e=>e.id===r.provider)?.label;return(0,L.jsx)(QB,{prominent:!0,title:Wq.classifier,children:(0,L.jsxs)(Cq,{children:[(0,L.jsx)(AJ,{label:uJ.enabled,help:uJ.enabledHelp,checked:r.enabled,onChange:e=>void n({classifier:{enabled:e}})}),(0,L.jsx)(Sq,{label:uJ.host,children:(0,L.jsx)(wq,{value:r.provider,items:cJ.map(e=>({value:e.id,label:e.label})),label:uJ.host,onChange:e=>void n({classifier:{provider:e}})})}),(0,L.jsx)(Sq,{label:uJ.model,help:uJ.modelHelp,children:(0,L.jsx)(jJ,{value:r.model,label:uJ.model,placeholder:`the host's default`,onSave:e=>void n({classifier:{model:e}})})}),(0,L.jsx)(Sq,{label:uJ.key,help:uJ.keyNote,children:(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground sm:text-right`,children:i??r.provider})}),lJ.map(e=>(0,L.jsx)(AJ,{label:e.label,help:e.help,checked:r.features[e.id],onChange:t=>void n({classifier:{features:{[e.id]:t}}})},e.id)),(0,L.jsx)(Sq,{label:uJ.cheap,help:uJ.cheapHelp,children:(0,L.jsx)(kJ,{value:r.effort.cheapModel,models:t,label:uJ.cheap,none:!0,onChange:e=>void n({classifier:{effort:{cheapModel:e}}})})})]})})}function KJ(){let e=LK(),t=async e=>{if(!e)return zK();let t=await RK();t===`granted`?V.success(dJ.notificationsOn):V.error(t===`unsupported`?dJ.notificationsUnsupported:dJ.notificationsBlocked)};return(0,L.jsx)(QB,{prominent:!0,title:Wq.notifications,children:(0,L.jsx)(Cq,{children:(0,L.jsx)(AJ,{label:dJ.notificationsLabel,help:dJ.notificationsHelp,checked:e,onChange:e=>void t(e)})})})}function qJ(){let{available:e,install:t}=y(),n=b(),r=x();return(0,L.jsx)(QB,{prominent:!0,title:Wq.install,children:(0,L.jsxs)(Cq,{children:[(0,L.jsx)(Sq,{label:dJ.installLabel,help:n?dJ.installedNow:dJ.installHelp,children:n?null:(0,L.jsx)(`div`,{className:`flex sm:justify-end`,children:(0,L.jsx)(X,{label:dJ.installButton,icon:wm,tone:`primary`,onClick:()=>e?void t().then(()=>V.success(dJ.installDone)):V.warning(dJ.installUnavailable)})})}),r.supported?(0,L.jsx)(Sq,{label:dJ.fullscreenLabel,help:dJ.fullscreenHelp,children:(0,L.jsx)(`div`,{className:`flex sm:justify-end`,children:(0,L.jsx)(X,{label:r.on?dJ.fullscreenOn:dJ.fullscreenOff,icon:r.on?vh:oh,pressed:r.on,onClick:()=>void r.toggle()})})}):null]})})}var JJ=[`Agents`,`Workflow`,`Linting`,`Lobby`,`Classifier`,`Appearance & notifications`];function YJ({config:e,models:t,onConfig:n}){let[r,i]=(0,m.useState)(`Agents`),a=(0,m.useRef)(Promise.resolve()),o=e=>{let t=async()=>{try{return n((await De(`settings.set`,{patch:e})).config),V.success(dJ.saved),!0}catch(e){return V.error(e instanceof Error?e.message:`That did not work. Try again.`),!1}},r=a.current.then(t,t);return a.current=r,r};return(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-6 px-5 pt-5 pb-dock sm:px-8 sm:pt-8`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:dJ.title}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:dJ.intro})]}),(0,L.jsx)(`nav`,{"aria-label":`Settings sections`,className:`-mx-1 flex flex-wrap gap-1 border-b border-border pb-3`,children:JJ.map(e=>(0,L.jsx)(`button`,{type:`button`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"aria-current":r===e?`page`:void 0,"aria-controls":`settings-${e.split(` `)[0]}`,onClick:()=>i(e),className:q(`h-8 rounded-lg border border-transparent px-3 text-sm font-medium outline-none transition-[box-shadow,color] focus-visible:ring-3 focus-visible:ring-ring/40`,r===e?`btn-raised bg-card text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,L.jsx)(`div`,{id:`settings-Agents`,hidden:r!==`Agents`,"aria-hidden":r!==`Agents`,children:(0,L.jsx)(QB,{prominent:!0,title:Wq.agents,children:(0,L.jsx)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-2`,children:Pq.map(n=>(0,L.jsx)(IJ,{kind:n,config:e,models:t,save:o},n))})})}),(0,L.jsx)(`div`,{id:`settings-Workflow`,hidden:r!==`Workflow`,"aria-hidden":r!==`Workflow`,children:(0,L.jsx)(zJ,{config:e,save:o})}),(0,L.jsx)(`div`,{id:`settings-Linting`,hidden:r!==`Linting`,"aria-hidden":r!==`Linting`,children:(0,L.jsx)(UJ,{config:e,save:o})}),(0,L.jsx)(`div`,{id:`settings-Lobby`,hidden:r!==`Lobby`,"aria-hidden":r!==`Lobby`,children:(0,L.jsx)(WJ,{config:e,save:o})}),(0,L.jsx)(`div`,{id:`settings-Classifier`,hidden:r!==`Classifier`,"aria-hidden":r!==`Classifier`,children:(0,L.jsx)(GJ,{config:e,models:t,save:o})}),(0,L.jsx)(`div`,{id:`settings-Appearance`,hidden:r!==`Appearance & notifications`,"aria-hidden":r!==`Appearance & notifications`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,L.jsx)(yJ,{}),(0,L.jsx)(KJ,{}),(0,L.jsx)(qJ,{})]})})]})}function XJ(){return(0,L.jsx)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4 px-5 pt-5 pb-dock sm:px-8 sm:pt-8`,role:`status`,"aria-label":dJ.loading,children:[0,1,2,3].map(e=>(0,L.jsx)(`div`,{className:`h-48 rounded-lg bg-muted motion-safe:animate-pulse`},e))})}function ZJ(){let e=Tk(`settings.get`,{},[`status`]),[t,n]=(0,m.useState)(),r=(0,m.useRef)(0),i=(0,m.useCallback)(e=>{r.current=performance.now(),n(e)},[]);return(0,m.useEffect)(()=>{e.data&&e.requestedAt>r.current&&n(e.data.config)},[e.data,e.requestedAt]),!t&&e.error?(0,L.jsx)(yk,{message:`${dJ.loadFailed} ${e.error}`,onRetry:e.reload}):t?(0,L.jsx)(YJ,{config:t,models:e.data?.models??[],onConfig:i}):(0,L.jsx)(XJ,{})}function QJ(){let e=globalThis.DOMParser;if(!e)throw Error(`DOMParser is unavailable`);return new e}var $J=`default-src 'none'; script-src 'none'; style-src 'unsafe-inline'; img-src 'none'; font-src 'none'; connect-src 'none'; media-src 'none'; frame-src 'none'; object-src 'none'; form-action 'none'; base-uri 'none'`,eY=new Set(`div span p br hr h1 h2 h3 h4 h5 h6 section article header footer main aside nav ul ol li dl dt dd strong em b i u s small sub sup blockquote pre code table thead tbody tfoot tr th td caption colgroup col figure figcaption style`.split(` `)),tY=new Set(`class id title role aria-label aria-hidden colspan rowspan scope`.split(` `));function nY(e){if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.html!=`string`||t.html.length>1e5)&&!(t.css!==void 0&&(typeof t.css!=`string`||t.css.length>5e4)))return{html:t.html,...typeof t.css==`string`?{css:t.css}:{}}}function rY(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,``);return/\\|@import|url\s*\(|image-set\s*\(|expression\s*\(|behavior\s*:|-moz-binding/i.test(t)?``:t.replace(/<\/?style/gi,``)}function iY(e){if(!eY.has(e.localName)||e.namespaceURI!==`http://www.w3.org/1999/xhtml`){e.remove();return}for(let t of[...e.attributes])t.name===`style`?e.setAttribute(`style`,rY(t.value)):tY.has(t.name)||e.removeAttribute(t.name);e.localName===`style`&&(e.textContent=rY(e.textContent??``));for(let t of[...e.children])iY(t)}function aY(e,t){try{return oY(e,t??QJ())}catch{return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${$J}"><meta name="referrer" content="no-referrer"></head><body><p role="status">Static mockup unavailable. The preview could not be safely rendered.</p></body></html>`}}function oY(e,t){let n=t.parseFromString(e.html,`text/html`);for(let e of[...n.head.children,...n.body.children])iY(e);let r=[...n.head.querySelectorAll(`style`)].map(e=>e.outerHTML).join(``);return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${$J}"><meta name="referrer" content="no-referrer"><style>body{margin:16px;overflow-wrap:anywhere}*{box-sizing:border-box}${rY(e.css??``).replace(/</g,`\\3c `)}</style>${r}</head><body>${n.body.innerHTML}</body></html>`}function sY({preview:e,label:t,className:n,frameWidth:r,minWidth:i,onOpen:a}){let o=(0,m.useMemo)(()=>aY(e),[e]),s=(0,m.useRef)(null),[c,l]=(0,m.useState)();if((0,m.useLayoutEffect)(()=>{let e=s.current;if(!r&&!i||!e)return;let t=()=>l({width:e.clientWidth,height:e.clientHeight});if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r,i]),!r&&!i)return(0,L.jsx)(`iframe`,{title:`Static mockup: ${t}`,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:o,className:q(`h-80 w-full rounded-lg border bg-background`,n)});let u=r??Math.max(c?.width??0,i??0),d=c&&c.width>0&&u>0?Math.min(1,c.width/u):1;return(0,L.jsxs)(`div`,{ref:s,className:q(`group/mock relative h-80 w-full overflow-hidden rounded-lg border bg-background`,n),children:[(0,L.jsx)(`iframe`,{title:`Static mockup: ${t}`,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:o,tabIndex:a?-1:void 0,className:q(`absolute top-0 left-0 origin-top-left border-0`,a&&`pointer-events-none`),style:{width:u||`100%`,height:c?c.height/d:`100%`,transform:`scale(${d})`}}),a?(0,L.jsx)(`button`,{type:`button`,"data-compact":``,onClick:a,"aria-label":`Expand the mockup: ${t}`,className:`absolute inset-0 flex items-end justify-end p-2 outline-none focus-visible:ring-3 focus-visible:ring-ring/40 focus-visible:ring-inset`,children:(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-border bg-card/90 px-1.5 py-0.5 text-[0.6875rem] font-medium text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity group-hover/mock:opacity-100 group-focus-within/mock:opacity-100`,children:[(0,L.jsx)(ih,{"aria-hidden":`true`,className:`size-3`}),`Expand`]})}):null]})}var cY=/\s*\(recommended\)\s*$/i,lY=1024,uY=e=>e.replace(cY,``);function dY(e){return!!(e&&(e.htmlPreview||e.image||e.preview))}function fY({option:e}){let t=uY(e.label);return dY(e)?(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[e.htmlPreview?(0,L.jsx)(sY,{preview:e.htmlPreview,label:t,minWidth:lY,className:`h-auto min-h-[18rem] flex-1`}):null,e.image?(0,L.jsx)(`img`,{src:N(e.image),alt:`Mockup: ${t}`,className:`min-h-0 w-full flex-1 rounded-lg border bg-background object-contain`}):null,e.preview?(0,L.jsx)(YB,{text:e.preview,className:q(`overflow-auto rounded-lg border bg-background p-4 text-sm`,!e.htmlPreview&&!e.image&&`flex-1`)}):null]}):(0,L.jsx)(`p`,{className:`grid h-full place-items-center p-6 text-sm text-muted-foreground`,children:`No mockup for this option.`})}function pY({options:e,start:t,title:n,picked:r=[],multi:i=!1,onChoose:a,onClose:o,onIndex:s}){let c=Sf(),l=(0,m.useRef)(null),u=(0,m.useRef)(null),[d,f]=(0,m.useState)(()=>Math.min(Math.max(0,t),e.length-1)),p=e[d],h=e.length-1;(0,m.useEffect)(()=>s?.(d),[d,s]),(0,m.useLayoutEffect)(()=>{let e=l.current;e&&(e.scrollLeft=d*e.clientWidth),u.current?.focus()},[]);let g=(0,m.useCallback)(e=>{let t=Math.min(Math.max(0,e),h),n=l.current;f(t),n?.scrollTo({left:t*n.clientWidth,behavior:c?`auto`:`smooth`})},[h,c]);(0,m.useEffect)(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{e.scrollLeft=d*e.clientWidth});return t.observe(e),()=>t.disconnect()},[d]);function _(){let e=l.current;if(!e||e.clientWidth===0)return;let t=Math.round(e.scrollLeft/e.clientWidth);t!==d&&t>=0&&t<=h&&f(t)}function v(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=t.target;if(n.closest(`input, textarea, [contenteditable='true']`))return;let r={ArrowLeft:-1,ArrowRight:1,PageUp:-1,PageDown:1}[t.key];if(r){t.preventDefault(),g(d+r);return}if(t.key===`Home`||t.key===`End`){t.preventDefault(),g(t.key===`Home`?0:h);return}let i=Number(t.key);if(Number.isInteger(i)&&i>=1&&i<=e.length){t.preventDefault(),g(i-1);return}t.key===`Enter`&&a&&!(n instanceof HTMLButtonElement)&&(t.preventDefault(),a(d))}let y=r.includes(d);return(0,L.jsxs)(`div`,{ref:u,tabIndex:-1,"data-autofocus":``,onKeyDown:v,className:`mockup-viewer flex h-full min-h-0 flex-col outline-none`,role:`region`,"aria-label":`Mockups: ${n}`,"aria-roledescription":`carousel`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border px-4 py-3 sm:px-5`,children:[(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Back to the question`,title:`Back · Esc`,onClick:()=>o(d),children:(0,L.jsx)(gh,{"aria-hidden":`true`})}),(0,L.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:n}),(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,"aria-live":`polite`,children:[d+1,` of `,e.length]}),(0,L.jsx)(`div`,{role:`tablist`,"aria-label":`Options`,className:`flex w-full flex-wrap gap-1.5 sm:w-auto`,children:e.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===d,"aria-controls":`mockup-slide-${t}`,"data-compact":``,onClick:()=>g(t),className:q(`inline-flex h-7 max-w-48 items-center gap-1 rounded-lg border px-2.5 text-xs font-medium transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,t===d?`border-primary/50 bg-accent text-foreground`:`border-border text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,L.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t+1}),(0,L.jsx)(`span`,{className:`truncate`,children:uY(e.label)}),r.includes(t)?(0,L.jsx)(Hp,{"aria-label":`picked`,className:`size-3 text-primary`}):null]},t))})]}),(0,L.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{ref:l,onScroll:_,className:`mockup-track flex h-full snap-x snap-mandatory overflow-x-auto overflow-y-hidden overscroll-x-contain`,children:e.map((t,n)=>(0,L.jsxs)(`section`,{id:`mockup-slide-${n}`,role:`tabpanel`,"aria-roledescription":`slide`,"aria-label":`${n+1} of ${e.length}: ${uY(t.label)}`,"aria-hidden":n!==d,className:`flex h-full w-full shrink-0 snap-center snap-always flex-col gap-2 px-4 py-4 sm:px-14`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,L.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[n+1,`.`]}),(0,L.jsx)(`span`,{className:`font-medium`,children:uY(t.label)}),cY.test(t.label)?(0,L.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`Recommended`}):null,r.includes(n)?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-primary`,children:[(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3`}),`picked`]}):null]}),t.description?(0,L.jsx)(YB,{text:t.description,className:`text-sm text-muted-foreground`}):null,(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,L.jsx)(fY,{option:t})})]},n))}),d>0?(0,L.jsx)(J,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Previous option`,title:`Previous · ←`,onClick:()=>g(d-1),className:`absolute top-1/2 left-2 -translate-y-1/2 rounded-full max-sm:hidden`,children:(0,L.jsx)(Kp,{"aria-hidden":`true`})}):null,d<h?(0,L.jsx)(J,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Next option`,title:`Next · →`,onClick:()=>g(d+1),className:`absolute top-1/2 right-2 -translate-y-1/2 rounded-full max-sm:hidden`,children:(0,L.jsx)(Jp,{"aria-hidden":`true`})}):null]}),(0,L.jsxs)(`footer`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t border-border px-4 py-3 sm:px-5`,children:[(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`←→`,children:`option`}),a?(0,L.jsx)(KO,{chord:`Enter`,children:i?y?`unpick`:`pick`:`choose`}):null,(0,L.jsx)(KO,{chord:`Esc`,children:`back`})]}),a&&p?(0,L.jsxs)(J,{type:`button`,onClick:()=>a(d),className:`max-w-full`,children:[i&&y?`Unpick`:i?`Pick`:`Choose`,(0,L.jsx)(`span`,{className:`truncate`,children:uY(p.label)})]}):null]})]})}function mY(e,t,n){e.nativeEvent.isComposing||(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),e.key===`Enter`&&e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),t()))}function hY({text:e,disabled:t=!1,onSave:n,onCancel:r}){let[i,a]=(0,m.useState)(e),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(``),u=(0,m.useRef)(null);(0,m.useEffect)(()=>{u.current?.focus({preventScroll:!0}),u.current?.select()},[]);let d=async()=>{if(!(t||o||!i.trim())){s(!0),l(``);try{await n(i.trim()),r()}catch(e){l(e instanceof Error?e.message:String(e)),s(!1)}}};return(0,L.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,onKeyDown:e=>mY(e,()=>void d(),()=>{o||r()}),children:[(0,L.jsxs)(`label`,{className:`text-sm`,children:[`Edit message`,(0,L.jsx)(dA,{ref:u,value:i,onChange:e=>a(e.target.value),disabled:o,className:`mt-2 max-h-[40vh] min-h-24`})]}),c?(0,L.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Could not save. `,c]}):null,(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(J,{size:`sm`,onClick:()=>void d(),disabled:t||o||!i.trim(),children:o?`Saving…`:`Save`}),(0,L.jsx)(J,{size:`sm`,variant:`ghost`,disabled:o,onClick:r,children:`Cancel`})]})]})}var gY=1200;function _Y({question:e}){let[t,n]=(0,m.useState)(),r=tk(t!==void 0,ek.sheet),i=e.options.flatMap((e,t)=>e.mockup?[{option:e,index:t,mockup:e.mockup}]:[]);if(i.length===0)return null;let a=e.options.map(e=>({label:e.label,description:e.description,...e.mockup?{htmlPreview:e.mockup}:{}}));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`ul`,{"aria-label":`Mockups`,className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:i.map(({option:e,index:t,mockup:r})=>(0,L.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,L.jsx)(sY,{preview:r,label:uY(e.label),frameWidth:gY,onOpen:()=>n(t),className:`aspect-[3/2] h-auto`}),(0,L.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[t+1,`.`]}),` `,uY(e.label)]})]},t))}),(0,L.jsx)(qO,{open:t!==void 0&&r,onOpenChange:e=>{e||n(void 0)},label:`Mockups: ${e.text}`,className:`h-[min(92svh,60rem)] max-h-[min(92svh,60rem)] max-w-6xl`,children:t===void 0?null:(0,L.jsx)(pY,{options:a,start:t,title:e.text,onClose:()=>n(void 0)})})]})}function vY({questions:e}){return(0,L.jsx)(`ol`,{className:`mt-1 flex flex-col gap-2`,children:e.map((e,t)=>(0,L.jsxs)(`li`,{className:`card-raised flex flex-col gap-2 rounded-xl border p-3 text-sm`,style:{"--orb":AH(e.from)},children:[(0,L.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,L.jsxs)(`span`,{className:`mt-px inline-flex shrink-0 items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--orb)_12%,transparent)] px-2 py-0.5 text-xs font-medium text-[color-mix(in_oklab,var(--orb)_85%,var(--foreground))]`,children:[(0,L.jsx)(TH,{source:e.from,className:`size-3`}),DH(e.from)]}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsxs)(`span`,{className:`sr-only`,children:[`Question `,t+1,`: `]}),e.text]})]}),e.options.length?(0,L.jsx)(`ul`,{"aria-label":`Options`,className:`flex flex-wrap gap-1.5`,children:e.options.map(e=>(0,L.jsxs)(`li`,{className:`rounded-lg border border-border bg-muted/60 px-2 py-1 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),e.description?` — ${e.description}`:``]},e.label))}):null,(0,L.jsx)(_Y,{question:e})]},t))})}function yY({message:e}){let t=e.decided??[];return t.length?(0,L.jsx)(`ul`,{className:`mt-1 flex flex-col gap-1.5`,children:t.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex items-start gap-2 rounded-lg bg-muted/60 px-2.5 py-1.5 text-sm`,children:[(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-success`}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsx)(`span`,{className:q(`font-medium`,OH(e.from)),children:DH(e.from)}),` `,e.question,` → `,(0,L.jsx)(`strong`,{children:e.answer}),(0,L.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[`decided by the classifier (`,e.probability.toFixed(2),`); comment on the plan to overrule`]})]})]},t))}):null}function bY({message:e,index:t,busy:n,readOnly:r}){let[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(),c=o&&(o.editedAt??0)>(e.editedAt??0)?o:e,l=n||c!==e,u=async n=>{let r=await De(`planner.editMessage`,{messageIndex:t,at:e.at,text:n});s(r.message)},d=!r&&!e.settled?.length&&!i?(0,L.jsxs)(J,{size:`xs`,variant:`ghost`,disabled:l,onClick:()=>a(!0),className:`text-muted-foreground`,children:[(0,L.jsx)(Bh,{"aria-hidden":`true`}),`Edit`]}):null;return(0,L.jsx)(IH,{time:e.at>0?pA(e.at):void 0,head:!0,note:c.editedAt?`(edited)`:void 0,below:d,children:i?(0,L.jsx)(hY,{text:c.text,disabled:n,onSave:u,onCancel:()=>a(!1)}):(0,L.jsx)(YB,{text:c.text})})}function xY({message:e,index:t,busy:n,readOnly:r}){if(e.role===`you`)return(0,L.jsx)(bY,{message:e,index:t,busy:n,readOnly:r});let i=e.questions??[];return(0,L.jsxs)(FH,{source:`PLANNER`,name:`Panel`,time:e.at>0?pA(e.at):void 0,head:!0,bubble:i.length===0,aside:i.length?`${i.length} question${i.length===1?``:`s`}`:void 0,children:[i.length>0?(0,L.jsx)(vY,{questions:i}):(0,L.jsx)(YB,{text:e.text}),(0,L.jsx)(yY,{message:e})]})}function SY({messages:e,seed:t,busy:n=!1,readOnly:r=!1}){return(0,L.jsxs)(`div`,{className:`chat-column`,role:`log`,"aria-label":`Panel conversation`,children:[t?(0,L.jsx)(LH,{children:t}):null,e.map((e,t)=>(0,L.jsx)(xY,{message:e,index:t,busy:n,readOnly:r},`${e.at}-${t}`)),n?(0,L.jsx)(FH,{source:`PLANNER`,name:`Panel`,head:!0,live:!0,aside:`the panel is thinking`,children:(0,L.jsx)(RH,{className:`mt-1`})}):null]})}var CY=`ORACLE`,wY=`No draft yet.`,TY=`The draft appears after the panel's first round.`,EY=`What each seat needs`,DY=[`backend`,`designer`,`qa`,`researcher`],OY={backend:`DEV`,designer:`DESIGN`,qa:`QA`,researcher:`RESEARCH`},kY=`Describe a task in the box below. The panel asks what it needs to know, round by round, until the plan is clear.`,AY={ORACLE:`Chairs the panel, and settles the last round alone.`,DEV:`Code, data and the APIs it touches.`,DESIGN:`Screens, flows and the words on them.`,QA:`Tests, edge cases and what could break.`,RESEARCH:`Prior art, docs and sources.`},jY=[{title:`Describe it`,text:`Say what you want in the box below.`},{title:`The panel asks`,text:`Each seat asks what it needs to know.`},{title:`A draft forms`,text:`Answer, comment on lines, go another round.`},{title:`Save the plan`,text:`Keep it, or start it as a task.`}];function MY(e){let t=e.filter(e=>e.member);return`${t.filter(e=>e.seated).length} of ${t.length} seated`}function NY(e,t=0){return t<=0?`round ${e}`:e>t?`round ${e} · past the limit, revising`:e===t?`final round ${e}/${t}`:`round ${e}/${t}`}function PY(e,t){return`${e} ${t}${e===1?``:`s`}`}function FY(e){return e.round===0&&e.messages.length===0&&!e.busy}function IY(e){let t=e.members.find(e=>e.status===`failed`);if(t)return(t.error??`${OY[t.member]} failed`).split(`
97
- `)[0]}function LY(e){let t=[],n=IY(e);return e.busy?t.push(NY(e.round,e.limit)):n?t.push(`${n} — Retry runs the round again`):e.questions.length>0&&t.push(`${PY(e.questions.length,`question`)} waiting`),!e.busy&&e.round>0&&t.push(NY(e.round,e.limit)),!e.busy&&e.limit>0&&e.round+1===e.limit&&t.push(`the next round is the last: the oracle settles the rest`),t}function RY(e,t){let n=OY[e],r=t.seats.includes(e),i=t.members.find(t=>t.member===e),a={member:e,label:n,seated:r,working:!1};if(!r)return{...a,text:`off`};if(i?.status===`thinking`)return{...a,working:!0,text:i.step??`thinking`};if(i?.status===`failed`)return{...a,text:`failed — Retry`};if(!i)return{...a,text:`·`};if(i.reply?.status===`ready`)return{...a,text:`ready`};let o=t.questions.filter(e=>e.from===n).length;return{...a,text:o===0?`done`:PY(o,`question`)}}function zY(e){let t=e.questions.filter(e=>e.from===CY).length;return[{label:CY,seated:!0,working:e.busy,text:e.busy?`chairing`:t?PY(t,`question`):`·`},...DY.map(t=>RY(t,e))]}function BY(e){let t=!1;return e.split(`
98
- `).map(e=>{let n=e.trimStart().startsWith("```");return n&&(t=!t),{text:e,fenced:t||n}})}function VY({notes:e}){return(0,L.jsx)(L.Fragment,{children:e.map((e,t)=>(0,L.jsx)(`p`,{className:`ml-6 rounded-lg border border-primary/15 bg-accent px-3 py-1.5 text-sm text-foreground italic`,children:e},t))})}var HY=[],UY=(0,m.memo)(function({row:e,notes:t,onComment:n}){let r=e.text.trim(),i=()=>n(r);return(0,L.jsxs)(`li`,{className:`group/line [contain-intrinsic-size:auto_2.75rem] [content-visibility:auto]`,children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,L.jsx)(`span`,{className:`flex w-4 shrink-0 justify-center pt-3.5`,"aria-hidden":`true`,children:t.length>0?(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-primary`}):null}),(0,L.jsx)(`div`,{className:q(`min-w-0 flex-1 cursor-pointer rounded-lg px-2 py-1.5 transition-colors hover:bg-muted`,e.fenced&&`font-mono text-sm whitespace-pre-wrap break-words`),onClick:e=>!e.target.closest(`a`)&&i(),children:e.fenced?e.text:(0,L.jsx)(YB,{text:e.text})}),(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/line:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,"aria-label":`Comment on this line: ${r}`,onClick:i,children:(0,L.jsx)(uh,{"aria-hidden":`true`})})]}),(0,L.jsx)(VY,{notes:t})]})});function WY({draft:e,comments:t,onComment:n}){let r=(0,m.useMemo)(()=>BY(e),[e]),i=BB(r.length);return(0,L.jsx)(`ul`,{className:`flex flex-col`,"aria-label":`Draft plan lines`,children:r.slice(0,i).map((e,r)=>e.text.trim()?(0,L.jsx)(UY,{row:e,notes:t.get(e.text.trim())??HY,onComment:n},r):(0,L.jsx)(`li`,{"aria-hidden":`true`,className:`h-2`},r))})}function GY({notes:e}){return e.length===0?null:(0,L.jsx)(QB,{title:EY,children:(0,L.jsx)(`dl`,{className:`flex flex-col gap-2 text-sm`,children:e.map((e,t)=>(0,L.jsxs)(`div`,{className:`flex gap-3`,children:[(0,L.jsx)(`dt`,{className:q(`w-20 shrink-0 font-medium`,OH(e.from)),children:DH(e.from)}),(0,L.jsx)(`dd`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(YB,{text:e.text})})]},t))})})}function KY({cell:e,intro:t}){let n=t?e.member?e.seated?`seated`:`not seated`:`chairs`:e.text;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:q(`inline-flex items-center gap-1.5 font-medium`,e.seated?OH(e.label):`text-muted-foreground`),children:[(0,L.jsx)(TH,{source:e.label,className:`size-3.5`}),DH(e.label)]}),e.working&&!t?(0,L.jsx)(_k,{className:`size-3.5`,"aria-hidden":`true`}):null,(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:n})]})}function qY({cell:e,intro:t,onToggled:n}){let{member:r}=e,i=`inline-flex min-h-8 items-center gap-2 rounded-lg border border-border px-3 text-[0.8125rem]`;if(!r)return(0,L.jsx)(`li`,{className:q(i,`bg-muted`),children:(0,L.jsx)(KY,{cell:e,intro:t})});let a=async()=>{await H(`planner.toggleSeat`,{member:r})&&n()};return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`label`,{className:q(i,`cursor-pointer transition-colors`,e.seated?`btn-raised bg-card`:`border-dashed text-muted-foreground hover:bg-muted`),children:[(0,L.jsx)(NU,{checked:e.seated,onCheckedChange:()=>void a(),"aria-label":`${DH(e.label)} sits on the panel`}),(0,L.jsx)(KY,{cell:e,intro:t})]})})}function JY({cells:e,intro:t,onToggled:n}){return(0,L.jsx)(`ul`,{"aria-label":`Panel`,className:`flex flex-wrap gap-2`,children:e.map(e=>(0,L.jsx)(qY,{cell:e,intro:t,onToggled:n},e.label))})}function YY({cell:e,onToggled:t}){let{member:n}=e,r=DH(e.label),i=q(`flex h-full flex-col gap-2 rounded-xl border p-3.5 transition-[background-color,border-color,box-shadow]`,e.seated?`border-[color-mix(in_oklab,var(--orb)_26%,var(--border))] bg-[color-mix(in_oklab,var(--orb)_5%,var(--card))] shadow-card`:`border-dashed border-input bg-transparent`),a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:q(`grid size-6 place-items-center rounded-lg bg-[color-mix(in_oklab,var(--orb)_14%,transparent)] text-[color-mix(in_oklab,var(--orb)_85%,var(--foreground))]`,!e.seated&&`opacity-50 grayscale`),children:(0,L.jsx)(TH,{source:e.label,className:`size-3.5`})}),(0,L.jsx)(`span`,{className:q(`truncate text-sm font-semibold`,e.seated?OH(e.label):`text-muted-foreground`),children:r})]}),n?(0,L.jsx)(NU,{checked:e.seated,onCheckedChange:()=>void XY(n,t),"aria-label":`${r} sits on the panel`}):null]}),(0,L.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:AY[e.label]}),(0,L.jsx)(`span`,{className:q(`mt-auto text-xs font-medium`,e.seated?`text-foreground`:`text-muted-foreground`),children:n?e.seated?`seated`:`sits this one out`:`always chairs`})]}),o={"--orb":AH(e.label)};return n?(0,L.jsx)(`li`,{style:o,children:(0,L.jsx)(`label`,{className:q(i,`cursor-pointer`,e.seated?`hover:shadow-[0_0_0_3px_color-mix(in_oklab,var(--orb)_10%,transparent)]`:`hover:bg-muted`),children:a})}):(0,L.jsx)(`li`,{style:o,children:(0,L.jsx)(`div`,{className:i,children:a})})}async function XY(e,t){await H(`planner.toggleSeat`,{member:e})&&t()}function ZY({cells:e,onToggled:t}){return(0,L.jsx)(`ul`,{"aria-label":`Panel`,className:`grid grid-cols-1 gap-3 @lg:grid-cols-2 @4xl:grid-cols-5`,children:e.map(e=>(0,L.jsx)(YY,{cell:e,onToggled:t},e.label))})}function QY({snap:e}){let t=LY(e),n=!e.busy&&IY(e)!==void 0;return(0,L.jsxs)(`p`,{role:`status`,className:n?`flex items-center gap-2 text-sm text-destructive`:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e.busy?(0,L.jsx)(_k,{className:`size-3.5`,"aria-hidden":`true`}):null,t.join(` · `)]})}function $Y(){return(0,L.jsx)(X,{label:`Previous plans`,text:`Previous`,icon:Jh,shortcut:`H`,onClick:()=>Y(lk(`plan`,`previous`))})}function eX({snap:e,onDone:t}){let n=Ck(`status`).data?.keys.find(e=>e.action===`savePlan`)?.label,r=e=>async()=>{await H(e,{})&&t()};return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[e.questions.length>0&&!e.busy?(0,L.jsx)(X,{label:`Answer questions`,icon:ch,tone:`primary`,shortcut:`A`,onClick:()=>void r(`planner.answer`)()}):null,e.retryable?(0,L.jsx)(X,{label:`Retry`,icon:Qh,shortcut:`R`,onClick:()=>void r(`planner.retry`)()}):null,(0,L.jsx)($Y,{}),(0,L.jsx)(X,{"data-plan-save":!0,label:`Save the plan`,text:`Save`,icon:ng,shortcut:n??`Ctrl+S`,disabled:!e.draft||e.busy,onClick:()=>void r(`planner.save`)()}),(0,L.jsx)(DA,{icon:Mm,label:`New plan`,shortcut:`N`,title:`Start a new plan?`,description:`The conversation and the draft are left behind. Saved plans are not touched.`,confirmLabel:`New plan`,onConfirm:()=>void H(`planner.new`,{}).then(t)})]})}function tX({snap:e,onDone:t}){return(0,L.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border px-5 py-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:`Planning`}),(0,L.jsx)(QY,{snap:e})]}),(0,L.jsx)(eX,{snap:e,onDone:t})]}),(0,L.jsx)(JY,{cells:zY(e),intro:!1,onToggled:t})]})}var nX=()=>Y(lk(`plan`,`previous`)),rX=e=>Y(lk(`plan`,`previous`,e));function iX(e){let t=Date.now()-Date.parse(e);return Number.isFinite(t)?gA(Math.max(0,t)):``}function aX(e,t){return[`${t} message${t===1?``:`s`}`,`round ${e.rounds}`,iX(e.updatedAt)].filter(Boolean).join(` · `)}function oX({plan:e,selected:t}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>rX(e.id),className:LV,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.title}),e.hasDraft?(0,L.jsx)(IV,{variant:`secondary`,children:`draft`}):null]}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:aX(e,e.messages)})]})})}function sX({id:e,onGone:t}){let n=Tk(`planner.previousGet`,{id:e},[`planner`]),r=n.data;if(!r)return n.error?(0,L.jsx)(yk,{message:`Could not load that plan. ${n.error}`,onRetry:n.reload}):null;let i=!!r.archivedAt,a=async()=>{await H(`planner.previousOpen`,{id:e})&&Y(lk(`plan`))},o=async()=>{await H(`planner.previousArchive`,{id:e,archived:!i})&&t()},s=async()=>{await H(`planner.previousDelete`,{id:e})&&t()};return(0,L.jsxs)(`article`,{className:`flex flex-col gap-5`,"aria-label":r.title,children:[(0,L.jsxs)(Yk,{children:[(0,L.jsx)(X,{label:`Carry on planning`,text:`Carry on`,icon:Hh,tone:`primary`,shortcut:`C`,onClick:()=>void a()}),(0,L.jsx)(X,{label:i?`Bring it back from the archive`:`Archive`,text:i?`Unarchive`:`Archive`,icon:i?wp:Ep,shortcut:`E`,onClick:()=>void o()}),(0,L.jsx)(DA,{icon:wg,label:`Delete`,shortcut:`Delete`,title:`Delete "${r.title}"?`,description:`The conversation and the draft are removed for good.`,confirmLabel:`Delete plan`,variant:`destructive`,onConfirm:()=>void s()})]}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:r.title}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:[i?`archived`:``,aX(r,r.messages.length),r.seed??``].filter(Boolean).join(` · `)})]}),(0,L.jsxs)(QB,{title:`Draft plan`,children:[r.draft?(0,L.jsx)(YB,{text:r.draft}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The panel had not written a draft yet.`}),(0,L.jsx)(GY,{notes:r.notes})]}),(0,L.jsx)(QB,{title:`Conversation`,children:(0,L.jsx)(SY,{messages:r.messages,readOnly:!0})})]})}function cX({id:e}){let t=iA(),[n,r]=(0,m.useState)(!1),i=Tk(`planner.previous`,n?{archived:!0}:{},[`planner`]),a=i.data?.plans??[];if(!i.data&&i.error)return(0,L.jsx)(yk,{message:`Could not load the previous plans. ${i.error}`,onRetry:i.reload});let o=(0,L.jsxs)(lA,{title:n?`Archived plans`:`Previous plans`,count:i.data?String(a.length):void 0,children:[(0,L.jsx)(X,{label:`Back to the current plan`,icon:Ap,iconOnly:!0,onClick:()=>Y(lk(`plan`))}),(0,L.jsx)(X,{label:n?`Show the previous plans`:`Show the archived plans`,text:n?`Previous`:`Archived`,icon:n?Jh:Ep,pressed:n,onClick:()=>{r(e=>!e),nX()}})]}),s=i.data?a.length===0?(0,L.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground`,children:n?`No archived plans.`:`No previous plans. A plan you leave without saving it as a task waits here; one saved as a task is in the Tasks tab.`}):(0,L.jsx)(`ul`,{className:q(RV,`pt-2`),"aria-label":n?`Archived plans`:`Previous plans`,children:a.map(t=>(0,L.jsx)(oX,{plan:t,selected:t.id===e},t.id))}):(0,L.jsx)(uA,{});return(0,L.jsx)(cA,{wide:t,list:(0,L.jsxs)(L.Fragment,{children:[o,s]}),detail:e?(0,L.jsx)(sX,{id:e,onGone:()=>{i.reload(),nX()}},e):null,open:e!==void 0,onClose:nX,hint:`Pick a plan to read it, carry it on, archive it or delete it.`,describe:`A previous plan`})}function lX({line:e,onClose:t,onSent:n}){let r=tk(e!==void 0,ek.confirm);return(0,L.jsx)(qO,{open:e!==void 0&&r,onOpenChange:e=>!e&&t(),label:`Comment on this line`,className:`max-w-xl`,children:(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`text-base font-medium`,children:`Comment on this line`}),(0,L.jsx)(`p`,{className:`mt-1 line-clamp-3 text-sm break-words text-muted-foreground`,children:e})]}),(0,L.jsx)(YV,{label:`Your comment`,hint:`Enter adds the comment · Esc cancels`,buttonLabel:`Add comment`,onSend:async r=>e===void 0||!await H(`planner.commentLine`,{line:e,text:r.trim()})?!1:(n(e,r.trim()),t(),!0)})]})})}function uX({limit:e}){return e<=0?null:(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1`,children:Array.from({length:e},(t,n)=>(0,L.jsx)(`span`,{className:q(`h-1.5 w-4 rounded-full`,n===e-1?`bg-primary`:`bg-border`)},n))}),(0,L.jsxs)(`span`,{children:[`up to `,e,` rounds, the last the oracle's`]})]})}function dX({snap:e,onDone:t}){let n=zY(e);return(0,L.jsx)(`div`,{className:`@container flex-1 overflow-y-auto px-5 pt-8 pb-dock sm:px-8 sm:pt-10`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-end @3xl:justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`card-raised grid size-11 shrink-0 place-items-center rounded-xl border text-primary`,children:(0,L.jsx)(eg,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:`Plan with the panel`}),(0,L.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:kY})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-col items-start gap-2 @3xl:items-end`,children:[(0,L.jsx)($Y,{}),(0,L.jsx)(uX,{limit:e.limit})]})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`plan-panel`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`plan-panel`,className:`text-xs text-muted-foreground`,children:(0,L.jsx)(ZB,{title:`The panel`,right:MY(n)})}),(0,L.jsx)(ZY,{cells:n,onToggled:t})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`plan-steps`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`plan-steps`,className:`text-xs text-muted-foreground`,children:(0,L.jsx)(ZB,{title:`How a plan comes together`})}),(0,L.jsx)(`ol`,{className:`grid gap-3 @2xl:grid-cols-2 @4xl:grid-cols-4`,children:jY.map((e,t)=>(0,L.jsxs)(`li`,{className:`card-raised relative flex gap-3 rounded-xl border p-3.5`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-6 shrink-0 place-items-center rounded-full bg-accent text-xs font-semibold text-primary tabular-nums`,children:t+1}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,L.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.text})]})]},e.title))})]}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(Op,{"aria-hidden":`true`,className:`size-4 text-primary motion-safe:animate-bounce`}),`Start in the box below.`,(0,L.jsx)(KO,{chord:`/`,children:`write`}),(0,L.jsx)(KO,{chord:`Enter`,children:`send to the panel`})]})]})})}function fX({snap:e,wide:t}){let{ref:n,onScroll:r}=xH(JSON.stringify(e.messages));return(0,L.jsxs)(aA,{className:`flex flex-col`,children:[(0,L.jsx)(`h2`,{className:`flex min-h-12 shrink-0 items-center border-b border-border px-4 text-sm font-medium`,children:(0,L.jsx)(ZB,{title:`Conversation`,className:`w-full`})}),(0,L.jsx)(`div`,{ref:n,onScroll:r,className:q(`min-h-0 overflow-y-auto overscroll-y-contain`,t?`flex-1 px-5 pt-5 pb-dock`:`max-h-[45svh] p-5`),children:(0,L.jsx)(SY,{messages:e.messages,busy:e.busy})})]})}function pX({snap:e,comments:t,onComment:n,wide:r}){return(0,L.jsxs)(aA,{className:`flex flex-col`,children:[(0,L.jsx)(`h2`,{className:`flex min-h-12 shrink-0 items-center border-b border-border px-4 text-sm font-medium`,children:(0,L.jsx)(ZB,{title:`Draft plan`,className:`w-full`})}),(0,L.jsxs)(`div`,{className:q(`flex min-h-0 flex-col gap-5 overflow-y-auto overscroll-y-contain px-5 pt-5 pb-dock`,r&&`flex-1`),children:[e.draft?(0,L.jsx)(WY,{draft:e.draft,comments:t,onComment:n}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.busy?TY:wY}),(0,L.jsx)(GY,{notes:e.notes})]})]})}function mX({snap:e,reload:t}){let n=iA(),[r,i]=(0,m.useState)(),[a,o]=(0,m.useState)(new Map);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(tX,{snap:e,onDone:t}),(0,L.jsxs)(`div`,{className:n?`grid min-h-0 flex-1 grid-cols-[minmax(0,46fr)_minmax(0,54fr)] grid-rows-[minmax(0,1fr)] divide-x divide-border`:`flex flex-col divide-y divide-border`,children:[(0,L.jsx)(fX,{snap:e,wide:n}),(0,L.jsx)(pX,{snap:e,comments:a,onComment:i,wide:n})]}),(0,L.jsx)(lX,{line:r,onClose:()=>i(void 0),onSent:(e,t)=>o(n=>new Map(n).set(e,[...n.get(e)??[],t]))})]})}function hX({rest:e=[]}){return e[0]===`previous`?(0,L.jsx)(cX,{id:e[1]}):(0,L.jsx)(gX,{})}function gX(){let e=Tk(`planner.get`,{},[`planner`]),t=e.data;if(!t&&e.error)return(0,L.jsx)(yk,{message:`Could not load the plan. ${e.error}`,onRetry:e.reload});if(!t)return(0,L.jsx)(`p`,{role:`status`,className:`p-5 text-sm text-muted-foreground`,children:`Loading the plan…`});let n=FY(t);return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:n?(0,L.jsx)(dX,{snap:t,onDone:e.reload}):(0,L.jsx)(mX,{snap:t,reload:e.reload})})}var _X=`Describe a small change in the box below and one agent makes it now, beside any running task.`;function vX(e){return e.prompt.split(`
99
- `).find(e=>e.trim())?.trim()??`(empty)`}function yX(e){return[...e].reverse()}function bX(e){let t=Number.isFinite(e)?Math.max(0,Math.round(e/1e3)):0,n=Math.floor(t/60);if(n===0)return`${t}s`;let r=t%60;return r===0?`${n}m`:`${n}m ${String(r).padStart(2,`0`)}s`}function xX(e,t){return e.startedAt?bX((e.finishedAt??t)-e.startedAt):``}function SX(e,t){let n=e.model?`${e.model}${e.thinking?` · ${e.thinking}`:``}`:e.thinking??``;return[xX(e,t),n,e.tools?`${e.tools} tool${e.tools===1?``:`s`}`:``,e.usage?.cost?`$${e.usage.cost.toFixed(2)}`:``].filter(Boolean).join(` · `)}function CX(e){return e===`queued`?`Waiting for the quick fix ahead of it.`:e===`running`?`starting…`:e===`held`?`Not started.`:`No tool calls.`}function wX({job:e}){let t=e.status===`held`;return(0,L.jsxs)(L.Fragment,{children:[e.route?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Routed `,e.route]}):null,e.note&&t?(0,L.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-sm text-foreground`,children:[(0,L.jsx)(Eg,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,L.jsxs)(`span`,{children:[`Held: `,e.note,`.`]})]}):null,e.note&&!t?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.routed?`Routed here by the oracle — ${e.note}`:e.note}):null,e.routed&&!e.note?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Routed here by the oracle.`}):null]})}function TX({job:e}){let t=e.status===`running`;return e.steps.length===0?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[t?(0,L.jsx)(_k,{className:`size-3.5`}):null,CX(e.status)]}):(0,L.jsx)(`ol`,{className:`flex flex-col gap-1 text-sm`,children:e.steps.map((e,n)=>(0,L.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:pA(e.at)}),(0,L.jsx)(`span`,{className:`flex h-5 w-3.5 shrink-0 items-center justify-center`,"aria-hidden":`true`,children:e.pending&&t?(0,L.jsx)(_k,{className:`size-3.5`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})}),(0,L.jsx)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:e.pending&&t?`${e.text}…`:e.text})]},n))})}function EX({job:e}){return e.status===`held`?(0,L.jsxs)(Yk,{children:[(0,L.jsx)(X,{label:`Run anyway`,icon:Hh,tone:`primary`,shortcut:`R`,onClick:()=>void H(`quickfix.runAnyway`,{id:e.id})}),(0,L.jsx)(X,{label:`Turn it into a task`,text:`Make it a task`,icon:eh,shortcut:`T`,onClick:()=>void H(`quickfix.movedToTask`,{id:e.id})})]}):e.status!==`queued`&&e.status!==`running`?null:(0,L.jsx)(Yk,{children:(0,L.jsx)(DA,{icon:um,label:`Cancel the quick fix`,text:`Cancel`,shortcut:`C`,title:`Cancel this quick fix?`,description:`The agent stops. Files it already edited stay as they are.`,confirmLabel:`Cancel quick fix`,variant:`destructive`,onConfirm:()=>void H(`quickfix.cancel`,{id:e.id})})})}function DX({job:e,now:t}){return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`Quick fix detail`,children:[(0,L.jsx)(EX,{job:e}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:vX(e)}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded-md bg-accent px-2 py-0.5 text-xs font-medium text-foreground`,children:e.status}),SX(e,t)?(0,L.jsx)(`span`,{children:SX(e,t)}):null]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:e.id})]}),e.prompt.trim().includes(`
100
- `)?(0,L.jsx)(YB,{text:e.prompt}):null,(0,L.jsx)(wX,{job:e}),(0,L.jsx)(QB,{title:`Steps`,children:(0,L.jsx)(TX,{job:e})}),e.files?.length?(0,L.jsx)(QB,{title:`Edited`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm text-muted-foreground`,children:e.files.map(e=>(0,L.jsxs)(`li`,{className:`break-all`,children:[`· `,e]},e))})}):null,e.error?(0,L.jsx)(`p`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:e.error}):null,e.report?(0,L.jsx)(QB,{title:`Report`,children:(0,L.jsx)(YB,{text:e.report})}):null]})}function OX({status:e}){if(e===`running`)return(0,L.jsx)(_k,{className:`size-3.5`,"aria-label":`running`});let t={queued:gm,success:Hp,failed:Hg,timeout:Hg,cancelled:bh,held:Mh,running:gm}[e];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(t,{"aria-hidden":`true`,className:`size-4 ${e===`success`?`text-success`:e===`failed`||e===`timeout`?`text-destructive`:e===`held`?`text-warning`:`text-muted-foreground`}`}),(0,L.jsx)(`span`,{className:`sr-only`,children:e})]})}function kX({job:e,selected:t,now:n,onSelect:r}){let i=xX(e,n);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>r(e.id),className:q(LV,`flex-row items-start gap-2.5 text-sm`),children:[(0,L.jsx)(`span`,{className:`flex h-5 w-4 shrink-0 items-center justify-center`,children:(0,L.jsx)(OX,{status:e.status})}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words`,t?`font-medium text-foreground`:`text-foreground`),children:vX(e)}),i?(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:i}):null]})})}function AX({jobs:e,selectedId:t,now:n,onSelect:r}){return(0,L.jsx)(`ul`,{className:RV,children:e.map(e=>(0,L.jsx)(kX,{job:e,selected:e.id===t,now:n,onSelect:r},e.id))})}var jX=()=>Y(lk(`quickfix`)),MX=e=>Y(lk(`quickfix`,e));function NX(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),e?t:Date.now()}function PX(){return(0,L.jsx)(dk,{className:`m-4 flex-1`,children:(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(Wg,{"aria-hidden":`true`})}),(0,L.jsx)(gk,{className:`font-medium text-foreground`,children:_X})]})})}function FX({id:e}){let t=iA(),n=Tk(`quickfix.list`,{},[`quickfix`]),r=yX(n.data?.jobs??[]),i=NX(r.some(e=>e.status===`running`));if(!n.data&&n.error)return(0,L.jsx)(yk,{message:`Could not load quick fixes. ${n.error}`,onRetry:n.reload});let a=n.data&&r.length===0?(0,L.jsx)(PX,{}):(0,L.jsx)(IX,{id:e,wide:t,loaded:!!n.data,jobs:r,now:i});return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:a})}function IX({id:e,wide:t,loaded:n,jobs:r,now:i}){let a=e??(t?r[0]?.id:void 0),o=r.find(e=>e.id===a),s=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:`Quick fixes`,count:String(r.length)}),n?(0,L.jsx)(AX,{jobs:r,selectedId:a,now:i,onSelect:MX}):(0,L.jsx)(uA,{})]});return(0,L.jsx)(cA,{wide:t,list:s,detail:o?(0,L.jsx)(DX,{job:o,now:i}):e?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That quick fix is not on the list any more.`}):null,open:!!e,onClose:jX,hint:`Select a quick fix to see its steps.`,describe:`Quick fix detail`})}var LX={},RX=new Set;function zX(e){LX=e;for(let e of[...RX])e()}function BX(e){LX.taskId!==e&&zX({...LX,taskId:e})}function VX(e){(LX.session?.name!==e?.name||JSON.stringify(LX.session?.address)!==JSON.stringify(e?.address))&&zX({...LX,session:e})}function HX(e){return RX.add(e),()=>{RX.delete(e)}}function UX(){return(0,m.useSyncExternalStore)(HX,()=>LX,()=>LX)}function WX({entry:e}){let t=e.at?pA(e.at):``;return e.role===`note`?(0,L.jsxs)(`li`,{className:`text-center text-xs text-muted-foreground`,children:[e.text,t?` · ${t}`:``]}):e.role===`you`?(0,L.jsxs)(`li`,{className:`flex flex-col items-end gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2 text-xs text-muted-foreground`,children:[t,` `,(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:`You`})]}),(0,L.jsx)(`div`,{className:`max-w-[85%] rounded-xl rounded-tr-sm border border-primary/10 bg-you px-3.5 py-2`,children:(0,L.jsx)(YB,{text:e.text})})]}):(0,L.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full bg-primary`}),(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:`Oracle`}),` `,t]}),(0,L.jsx)(`div`,{className:`max-w-[90%] pl-4`,children:(0,L.jsx)(YB,{text:e.text})})]})}function GX({entries:e,more:t,loading:n,onMore:r,empty:i}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t?(0,L.jsx)(`div`,{className:`flex self-center`,children:(0,L.jsx)(X,{label:`Load earlier messages`,icon:Qp,disabled:n,onClick:r??(()=>void 0)})}):null,e.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i}):(0,L.jsx)(`ol`,{"aria-label":`Conversation`,className:`flex flex-col gap-4`,children:e.map(e=>(0,L.jsx)(WX,{entry:e},e.id))})]})}function KX({address:e,empty:t}){let n=Tk(`sessions.chat`,e,[`sessions`]),[r,i]=(0,m.useState)(),[a,o]=(0,m.useState)(!1),s=n.data?.entries??[],c=new Set(s.map(e=>e.id)),l=[...(r?.entries??[]).filter(e=>!c.has(e.id)),...s],u=async()=>{let t=l[0];if(!t)return;o(!0);let n=await H(`sessions.chat`,{...e,before:t.id});n&&i({entries:[...n.entries,...r?.entries??[]],more:n.hasOlder}),o(!1)},d=r?.more??n.data?.hasOlder??!1;return(0,L.jsx)(GX,{entries:l,more:d,loading:a,onMore:()=>void u(),empty:n.loading&&!n.data?`Loading the conversation…`:t})}var qX={"this window":`This window`,background:`Background`,"other terminal":`Other terminals`},JX=[`this window`,`background`,`other terminal`],YX=`Nothing said yet.`,XX=`This session runs in another terminal: its conversation shows here and your messages reach its oracle within seconds, but live activity only streams from sessions started in this window.`,ZX=`No other sessions. Start one below.`;function QX(e,t,n){let r=t?.task;return{id:`here`,where:`this window`,name:e?.sessionName??r?.title??`unnamed session`,status:e?.busy?`working`:r?.state??`no task`,waiting:n,alive:!0,dialogs:[],...r?{task:r}:{}}}function $X(e){let t=e.status===`exited`?`ended`:e.status===`starting`?`starting`:e.busy?`working`:`idle`;return{id:e.key,where:`background`,name:e.name,status:t,waiting:e.dialogs.length,key:e.key,alive:e.alive,dialogs:e.dialogs,...e.sessionId?{sessionId:e.sessionId}:{}}}function eZ(e){return{id:e.sessionId,where:`other terminal`,name:e.name??`unnamed session`,status:`running`,waiting:0,pid:e.pid,sessionId:e.sessionId,alive:!0,dialogs:[]}}function tZ(e,t,n,r,i){let a=new Set([e?.sessionId,...r.map(e=>e.sessionId)].filter(e=>!!e)),o=i.filter(e=>!a.has(e.sessionId));return[QX(e,t,n),...r.map($X),...o.map(eZ)]}function nZ(e){return`${e} question${e===1?``:`s`} waiting for you`}function rZ(e){return e.status===`starting`?`starting ${e.name}…`:e.alive?`${e.name} has not said anything yet.`:`${e.name} has ended.`}function iZ(e){return[e.where,e.status.replace(/_/g,` `),e.pid?`pid ${e.pid}`:``].filter(Boolean).join(` · `)}function aZ(e){return e.key?{key:e.key}:e.sessionId?{sessionId:e.sessionId}:void 0}function oZ({options:e,send:t}){return(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,L.jsx)(J,{variant:`outline`,onClick:()=>void t({value:e}),children:e},e))})}function sZ({dialog:e,send:t}){let n=(0,m.useId)(),[r,i]=(0,m.useState)(e.prefill??``);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:n,className:`sr-only`,children:e.title}),(0,L.jsx)(dA,{id:n,rows:e.method===`editor`?4:2,value:r,placeholder:e.placeholder,onChange:e=>i(e.target.value)}),(0,L.jsx)(`div`,{className:`flex self-end`,children:(0,L.jsx)(X,{label:`Send the answer`,text:`Send`,icon:Pp,tone:`primary`,disabled:!r.trim(),onClick:()=>void t({value:r.trim()})})})]})}function cZ({dialog:e,send:t}){return e.method===`select`?(0,L.jsx)(oZ,{options:e.options??[],send:t}):e.method===`confirm`?(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(J,{onClick:()=>void t({confirmed:!0}),children:`Yes`}),(0,L.jsx)(J,{variant:`outline`,onClick:()=>void t({confirmed:!1}),children:`No`})]}):(0,L.jsx)(sZ,{dialog:e,send:t})}function lZ({sessionKey:e,dialog:t,onAnswered:n}){let r=async r=>{await H(`sessions.answer`,{key:e,dialogId:t.id,answer:r})&&n()};return(0,L.jsxs)(`div`,{className:`card-raised flex flex-col gap-3 rounded-lg border p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:t.title}),t.message?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.message}):null]}),(0,L.jsx)(cZ,{dialog:t,send:r}),(0,L.jsx)(`div`,{className:`flex self-start`,children:(0,L.jsx)(X,{label:`Put it away`,text:`Put away`,icon:Hg,onClick:()=>void r({cancelled:!0})})})]})}function uZ({sessionKey:e,dialogs:t,onAnswered:n}){return t.length===0?null:(0,L.jsxs)(`section`,{"aria-label":`Questions waiting`,className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-foreground`,children:nZ(t.length)}),t.map(t=>(0,L.jsx)(lZ,{sessionKey:e,dialog:t,onAnswered:n},t.id))]})}var dZ={"this window":Sh,background:Xm,"other terminal":fg};function fZ({where:e,className:t}){let n=dZ[e];return(0,L.jsx)(n,{"aria-hidden":`true`,className:q(`size-4 shrink-0 text-muted-foreground`,t)})}function pZ({task:e}){let t=e.progress;return(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`break-all`,children:e.id}),t&&t.total>0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(cG,{done:t.done,total:t.total}),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[t.done,`/`,t.total]})]}):null]})}function mZ({entry:e}){let{key:t}=e;return e.where===`this window`?(0,L.jsx)(Yk,{children:(0,L.jsx)(X,{label:`Back to this window`,text:`Back to the Lobby`,icon:Ap,tone:`primary`,shortcut:`B`,onClick:()=>Y(`#/lobby`)})}):t?(0,L.jsxs)(Yk,{children:[(0,L.jsx)(X,{label:`Move here`,icon:Mp,tone:`primary`,shortcut:`M`,onClick:()=>void H(`sessions.switch`,{key:t})}),(0,L.jsx)(DA,{icon:um,label:`Stop the session`,text:`Stop`,shortcut:`S`,title:`Stop ${e.name}?`,description:`Its process ends. The task keeps its state and can be resumed in this window.`,confirmLabel:`Stop session`,variant:`destructive`,disabled:!e.alive,onConfirm:()=>void H(`sessions.stop`,{key:t})})]}):null}function hZ({entry:e,lobby:t}){let n=aZ(e);return e.where===`this window`?(0,L.jsx)(GX,{entries:t?.chat??[],more:!1,empty:YX}):n?(0,L.jsx)(KX,{address:n,empty:e.where===`other terminal`?`Nothing said in this session yet.`:rZ(e)},e.id):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:YX})}function gZ({entry:e,lobby:t,onChanged:n}){return(0,L.jsxs)(`article`,{"aria-label":`Session detail`,className:`flex flex-col gap-4`,children:[(0,L.jsx)(mZ,{entry:e}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`h3`,{className:`flex items-center gap-2.5 text-lg font-semibold tracking-tight text-foreground`,children:[(0,L.jsx)(fZ,{where:e.where,className:`size-[1.1rem]`}),e.name]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:iZ(e)}),e.task?(0,L.jsx)(pZ,{task:e.task}):null,e.where!==`background`&&e.waiting>0?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:nZ(e.waiting)}):null]}),e.where===`other terminal`?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:XX}):null,e.key?(0,L.jsx)(uZ,{sessionKey:e.key,dialogs:e.dialogs,onAnswered:n}):null,(0,L.jsx)(QB,{title:`Conversation`,children:(0,L.jsx)(hZ,{entry:e,lobby:t})})]})}function _Z({entry:e,selected:t,onSelect:n}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:q(LV,`flex-row items-start gap-2.5 text-sm`),children:[(0,L.jsx)(fZ,{where:e.where,className:`mt-0.5`}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.name}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[e.status===`working`||e.status===`starting`?(0,L.jsx)(_k,{className:`size-3`,"aria-hidden":`true`}):null,e.status.replace(/_/g,` `),e.waiting>0?(0,L.jsx)(`span`,{className:`rounded-md bg-warning/15 px-1.5 py-0.5 font-medium text-warning tabular-nums`,children:e.waiting}):null]})]})})}function vZ({where:e,entries:t,selectedId:n,onSelect:r}){return(0,L.jsxs)(`section`,{"aria-label":qX[e],className:`flex flex-col`,children:[(0,L.jsx)(`h3`,{className:zV,children:(0,L.jsx)(ZB,{title:qX[e],right:String(t.length),className:`[&>span:first-child]:font-medium [&>span:first-child]:text-muted-foreground`})}),(0,L.jsx)(`ul`,{className:RV,children:t.map(e=>(0,L.jsx)(_Z,{entry:e,selected:e.id===n,onSelect:r},e.id))})]})}function yZ({entries:e,selectedId:t,onSelect:n}){return(0,L.jsx)(`div`,{className:`flex flex-col pb-2`,children:JX.map(r=>{let i=e.filter(e=>e.where===r);return i.length>0?(0,L.jsx)(vZ,{where:r,entries:i,selectedId:t,onSelect:n},r):null})})}var bZ=()=>Y(`#/sessions`),xZ=e=>Y(`#/sessions/${encodeURIComponent(e)}`);function SZ({windows:e}){return e.length===0?null:(0,L.jsx)(`div`,{className:`px-4 pb-4 pt-2`,children:(0,L.jsx)(QB,{title:`Other windows`,children:(0,L.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-h-8 items-center rounded-lg px-2.5 text-sm text-foreground underline-offset-4 transition-colors hover:bg-muted hover:underline`,children:e.name})},e.url))})})})}function CZ(){return(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That session is not on the list any more.`})}function wZ({id:e}){let t=iA(),n=Ck(`status`).data,r=Ck(`lobby`).data,i=Ck(`prompts`).data?.prompts.length??0,a=Tk(`sessions.list`,{},[`sessions`]);if(!a.data&&a.error)return(0,L.jsx)(yk,{message:`Could not load sessions. ${a.error}`,onRetry:a.reload});let o=tZ(n,r,i,a.data?.background??[],a.data?.live??[]),s=e??(t?o[0]?.id:void 0),c=o.find(e=>e.id===s),l=c&&c.where!==`this window`&&c.alive?aZ(c):void 0,u=l?JSON.stringify(l):``,d=c?.name;(0,m.useEffect)(()=>(VX(l&&d?{name:d,address:l}:void 0),()=>VX(void 0)),[u,d]);let f=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:`Sessions`,count:String(o.length)}),a.data?(0,L.jsx)(yZ,{entries:o,selectedId:s,onSelect:xZ}):(0,L.jsx)(uA,{}),a.data&&o.length===1?(0,L.jsx)(`p`,{className:`px-4 pb-3 text-sm text-muted-foreground`,children:ZX}):null,(0,L.jsx)(SZ,{windows:n?.windows??[]})]}),p=c?(0,L.jsx)(gZ,{entry:c,lobby:r,onChanged:a.reload},c.id):e?(0,L.jsx)(CZ,{}):null;return(0,L.jsx)(cA,{wide:t,list:f,detail:p,open:!!e,onClose:bZ,hint:`Select a session to see its conversation.`,describe:`Session detail`})}function TZ({timing:e,stopped:t}){let[n,r]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(r(0),t||e.waiting||!e.runningSince)return;let n=performance.now(),i=window.setInterval(()=>r(performance.now()-n),1e3);return()=>window.clearInterval(i)},[e,t]),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[e.waiting?`Waiting for you · `:``,e.phase.replaceAll(`_`,` `),` · `,rG(nG(e,n,t)),` execution`]})}function EZ({work:e,timing:t,stopped:n}){let r=e.running&&!n&&!t?.waiting,i=iG(r,e);return(0,L.jsxs)(`span`,{className:`tabular-nums`,"data-work-clock":r?`running`:`stopped`,children:[t?.waiting?`Waiting for you · `:``,t?`${t.phase.replaceAll(`_`,` `)} · `:``,`worked `,rG(e.workedMs+i)]})}function DZ({timing:e,work:t,stopped:n=!1}){return t?(0,L.jsx)(EZ,{work:t,...e?{timing:e}:{},stopped:n}):e?(0,L.jsx)(TZ,{timing:e,stopped:n},JSON.stringify(e)):(0,L.jsx)(`span`,{children:`Timing unavailable`})}var OZ=`This merges the reviewed commit into main and pushes main, then removes the task worktree after verifying the merge. The task branch is kept.`,kZ={pending_approval:`Ready for your review`,deferred:`Saved for later`,in_progress:`Delivery in progress`,successful:`Delivered`,recoverable_failure:`Delivery needs attention`};function AZ({delivery:e,title:t}){return(0,L.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,L.jsx)(`p`,{className:`font-medium break-words`,children:t}),(0,L.jsxs)(`dl`,{className:`grid gap-1 break-all text-muted-foreground`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Project: `}),(0,L.jsx)(`dd`,{className:`inline`,children:e.project})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Repository: `}),(0,L.jsx)(`dd`,{className:`inline`,children:e.repository??`Unavailable — refresh review`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Source: `}),(0,L.jsxs)(`dd`,{className:`inline`,children:[e.sourceBranch,` · `,e.sourceCommit??`Commit unavailable`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Target: `}),(0,L.jsxs)(`dd`,{className:`inline`,children:[`main`,e.targetCommit?` · ${e.targetCommit}`:``]})]})]}),(0,L.jsxs)(`p`,{children:[`Checks: `,e.verification?.checks??`unavailable`]}),(0,L.jsx)(`p`,{children:e.verification?.summary??`Verification unavailable. Refresh the review before delivery.`}),e.verification?(0,L.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Local completion/QA: `,e.verification.localVerified?`passed`:`not verified`,` · Repository rules: `,e.verification.rulesKnown?`known`:`unavailable`,e.verification.requiredChecks.length?` · Required: ${e.verification.requiredChecks.join(`, `)}`:``]}):null]})}function jZ({action:e,delivery:t,busy:n,onAction:r}){let i=t.blocked[e],a=e===`merge_main`&&t.status===`successful`&&!!t.cleanupError,o=n||t.status===`in_progress`||t.status===`successful`&&!a||!!i;return(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(J,{variant:`outline`,disabled:o,onClick:()=>r(e),children:e===`create_pr`?`Create PR`:a?`Retry worktree cleanup`:`Merge to main`}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e===`create_pr`?`Pushes the task branch and opens a PR targeting main. Does not merge.`:a?`Main was delivered. Removes the retained worktree after confirmation.`:`Updates and pushes main, then removes the task worktree. Requires confirmation.`}),i?(0,L.jsxs)(`p`,{className:`text-sm text-destructive`,children:[i,` Refresh review after resolving this restriction, then choose the action again.`]}):null]})}async function MZ(e,t,n){let r={taskId:t,reviewId:n};return e===`refresh`?De(`tasks.deliveryReview`,{taskId:t}):e===`defer`?De(`tasks.deliveryDefer`,r):De(`tasks.deliver`,{...r,action:e,...e===`merge_main`?{confirmMain:!0}:{}})}function NZ({taskId:e,delivery:t}){let[n,r]=(0,m.useState)(t),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(),[c,l]=(0,m.useState)(!1),u=(0,m.useRef)(null),d=M(),f=`${d}:${e}`,p=(0,m.useRef)(f);return p.current=f,(0,m.useEffect)(()=>(p.current=f,()=>{p.current=``}),[f]),(0,m.useEffect)(()=>{r(t),l(!1)},[t,e]),{current:n,setCurrent:r,busy:i,setBusy:a,error:o,setError:s,confirm:c,setConfirm:l,trigger:u,project:d,identity:f,scope:p}}function PZ(e){return e.scope.current===e.identity&&e.project===M()}function FZ(e,t){let n=(0,m.useRef)(!1);async function r(r){if(!(n.current||r===`merge_main`&&!e.confirm)){n.current=!0,e.setBusy(!0),e.setError(void 0),e.setConfirm(!1);try{let n=await MZ(r,t.taskId,e.current.reviewId);PZ(e)&&(e.setCurrent(n.delivery),t.onChanged())}catch(t){PZ(e)&&e.setError(t instanceof Error?t.message:String(t))}finally{n.current=!1,e.scope.current&&e.setBusy(!1)}}}return r}function IZ(e){let t=NZ(e),n=FZ(t,e),r=tk(t.confirm,ek.confirm),i=t.current.status===`successful`||t.current.status===`in_progress`;function a(){t.trigger.current=document.activeElement,t.setConfirm(!0)}return{...t,request:n,slot:r,terminal:i,reviewMerge:a}}function LZ({review:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Task completion is recorded separately. Nothing is published without your approval.`}),(0,L.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.busy?`Updating delivery…`:e.current.operation?`Operation: ${e.current.operation.stage}`:kZ[e.current.status]}),e.current.error||e.error?(0,L.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[e.error??e.current.error,` Completed work is retained. Refresh review to reconcile the result before retrying.`]}):null,e.current.cleanupError?(0,L.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[e.current.cleanupError,` Retry cleanup after resolving it.`]}):null,e.current.operation?.worktreeRemoved?(0,L.jsx)(`p`,{className:`text-sm`,children:`Task worktree removed.`}):null,e.current.result?(0,L.jsxs)(`p`,{className:`text-sm break-all`,children:[e.current.result.action===`create_pr`?`PR #${e.current.result.pullNumber??``} created`:`main pushed · ${e.current.result.commit??``}`,e.current.result.pullUrl?(0,L.jsxs)(`span`,{children:[` · `,e.current.result.pullUrl]}):null]}):null]})}function RZ({review:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(jZ,{action:`create_pr`,delivery:e.current,busy:e.busy,onAction:()=>void e.request(`create_pr`)}),(0,L.jsx)(jZ,{action:`merge_main`,delivery:e.current,busy:e.busy,onAction:e.reviewMerge})]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,L.jsx)(J,{variant:`ghost`,disabled:e.busy,onClick:()=>void e.request(`refresh`),children:`Refresh review`}),(0,L.jsx)(J,{variant:`ghost`,disabled:e.busy||e.terminal,onClick:()=>void e.request(`defer`),children:`Not now`})]})]})}function zZ({review:e}){let t=e.current.status===`successful`&&!!e.current.cleanupError,n=t?`Main was already delivered. Remove the task worktree if it still contains only the reviewed commit. The task branch is kept.`:OZ;return(0,L.jsx)(qO,{open:e.slot,onOpenChange:e.setConfirm,label:t?`Confirm worktree removal`:`Confirm merge to main`,description:n,onCloseAutoFocus:t=>{t.preventDefault(),requestAnimationFrame(()=>e.trigger.current?.focus())},children:(0,L.jsxs)(`div`,{className:`grid gap-4 p-4`,children:[(0,L.jsx)(`h3`,{className:`font-medium`,children:t?`Remove task worktree?`:`Merge to main?`}),(0,L.jsx)(`p`,{className:`text-sm`,children:n}),(0,L.jsxs)(`p`,{className:`break-all text-sm text-muted-foreground`,children:[e.current.repository,` · `,e.current.sourceCommit,` → main`]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(J,{variant:`outline`,onClick:()=>e.setConfirm(!1),children:`Cancel`}),(0,L.jsx)(J,{disabled:e.busy||!!e.current.blocked.merge_main||e.terminal&&!t,onClick:()=>void e.request(`merge_main`),children:t?`Confirm worktree removal`:`Confirm merge and push main`})]})]})})}function BZ({title:e,review:t}){return(0,L.jsxs)(QB,{title:`Completed work · delivery review`,right:kZ[t.current.status],children:[(0,L.jsx)(AZ,{delivery:t.current,title:e}),(0,L.jsx)(LZ,{review:t}),(0,L.jsx)(RZ,{review:t}),(0,L.jsx)(zZ,{review:t})]})}function VZ(e){let t=IZ(e);return(0,L.jsx)(BZ,{title:e.title,review:t})}var HZ={open:mm,delivered:om,addressed:nm},UZ={open:`waiting for the owning session`,delivered:`sent to the oracle`,addressed:`plan amended`};function WZ({comment:e}){let t=gA(Date.now()-Date.parse(e.createdAt)),n=HZ[e.status];return(0,L.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(n,{"aria-hidden":`true`,className:e.status===`addressed`?`size-3.5 text-success`:`size-3.5`}),UZ[e.status],`, `,t,e.editedAt?` (edited)`:``]})}function GZ({comment:e,taskId:t,own:n}){let[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(),s=a&&(a.editedAt??``)>(e.editedAt??``)?a:e;return(0,L.jsxs)(`li`,{className:`card-raised rounded-lg border px-3.5 py-2.5`,children:[r?(0,L.jsx)(hY,{text:s.text,onSave:async n=>{let r=await De(`tasks.editComment`,{taskId:t,commentId:e.id,text:n});o(r.comment)},onCancel:()=>i(!1)}):(0,L.jsx)(YB,{text:s.text}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(WZ,{comment:s}),n&&!r?(0,L.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>i(!0),children:`Edit`}):null]})]})}function KZ({taskId:e,finished:t,canComment:n}){let r=Tk(`tasks.comments`,{taskId:e},[`tasks`]),i=Ck(`status`),a=r.data?.comments??[],o=a.filter(e=>e.status!==`addressed`).length;return(0,L.jsxs)(`section`,{"aria-labelledby":`comments-${e}`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`comments-${e}`,className:`text-sm`,children:(0,L.jsx)(ZB,{title:`Comments`,right:o>0?`${o} open`:void 0})}),a.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t?`No comments.`:n?`No comments yet. Comment on the plan in the box below (Markdown and images work); the oracle amends it.`:`No comments yet.`}):(0,L.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:a.map(t=>(0,L.jsx)(GZ,{taskId:e,comment:t,own:!!(t.by&&t.by===i.data?.sessionId)},`${e}-${t.id}`))})]})}var qZ={mine:`This session`,others:`Other sessions`,pending:`Pending`,recent:`Finished`,archived:`Archived`},JZ={open:`open`,done:`done`,dropped:`abandoned`},YZ={none:{label:`None`,depth:`nothing that runs changed: the engine's checks decide, no QA agent`,tone:`bg-accent text-muted-foreground`},low:{label:`Low`,depth:`a light check: the diff, the nearest tests, done once confident`,tone:`bg-success/10 text-success`},medium:{label:`Medium`,depth:`a standard check: the acceptance criteria and realistic regressions`,tone:`bg-warning/10 text-warning`},high:{label:`High`,depth:`a deep, adversarial review: invariants, recovery and everything the change reaches`,tone:`bg-destructive/10 text-destructive`}};function XZ(e){let t=e.source===`classifier`?`Jev`:`rules`;if(!e.qaRequired)return`${t} · no QA agent`;let{min:n,max:r}=e.testBudget;return`${t} · ${n===r?r:`${n}-${r}`} new tests at most`}var ZZ=`No tasks yet. Start one from the Lobby tab, or plan one in the Plan tab.`;function QZ(e,t){return`${e.replace(/_/g,` `)}${t?` · paused`:``}`}function $Z(e){return e===`now`?`just now`:`${e} ago`}function eQ(e){if(e.kind===`plan`)return[`planned`,e.age?e.age===`now`?`saved just now`:`saved ${e.age} ago`:``,e.issue?`#${e.issue}`:``].filter(Boolean).join(` · `);let t=e.owner??(e.section===`mine`?`this session`:``);return[QZ(e.status,e.paused),e.auto?`auto`:``,t].filter(Boolean).join(` · `)}function tQ(e){let t=[];for(let n of e){let e=t.at(-1);e&&e.section===n.section?e.rows.push(n):t.push({section:n.section,rows:[n]})}return t}function nQ(e){let t=e.filter(e=>e.kind!==`archived`),n=t.filter(e=>e.check===`open`).length,r=t.length-n,i=e.length-t.length;return[n?`${n} open`:``,r?`${r} finished`:``,i?`${i} archived`:``].filter(Boolean).join(` · `)||`0`}function rQ({step:e,stopped:t}){let n=iG(!t,e);return(0,L.jsx)(`span`,{className:`tabular-nums`,children:rG((e.workedMs??0)+n)})}function iQ(){return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`relative mt-[0.3125rem] grid size-4 shrink-0 place-items-center`,children:[(0,L.jsx)(`span`,{className:`absolute size-2.5 rounded-full bg-primary/30 motion-safe:animate-ping`}),(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-primary`})]})}function aQ({step:e,index:t,stopped:n}){let r=!!e.active&&!n,i=e.status===`done`,a=i?`text-success`:e.status===`current`?`text-primary`:`text-muted-foreground`,o=i?nm:mm;return(0,L.jsxs)(`li`,{className:`flex items-start gap-2.5 text-sm`,"data-step":r?`active`:e.status,children:[r?(0,L.jsx)(iQ,{}):(0,L.jsx)(o,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 ${a}`}),(0,L.jsxs)(`span`,{className:`shrink-0 text-xs leading-5 text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,L.jsx)(`span`,{className:q(`min-w-0 break-words`,r||e.status===`current`?`text-foreground`:`text-muted-foreground`),children:e.text}),r?(0,L.jsxs)(`span`,{className:`shrink-0 rounded-md bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:[`active · `,(0,L.jsx)(rQ,{step:e,stopped:n}),(0,L.jsx)(`span`,{className:`sr-only`,children:` (being worked on now)`})]}):e.status===`current`&&!n?(0,L.jsxs)(`span`,{className:`shrink-0 rounded-md bg-accent px-2 py-0.5 text-xs font-medium`,children:[`next`,(0,L.jsx)(`span`,{className:`sr-only`,children:` (the step up next)`})]}):null]})}function oQ({steps:e,stopped:t}){let n=e.filter(e=>e.status===`done`).length;return(0,L.jsx)(QB,{title:`Steps`,right:`${n}/${e.length} done`,children:(0,L.jsx)(`ol`,{className:`flex flex-col gap-2`,"aria-label":`Steps`,children:e.map((e,n)=>(0,L.jsx)(aQ,{step:e,index:n,stopped:t},`${n}-${e.text}`))})})}function sQ({text:e}){let[t,n]=(0,m.useState)(!1),r=(0,m.useId)();return(0,L.jsxs)(QB,{title:`Full plan`,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),className:`inline-flex w-fit items-center gap-1.5 rounded-md text-sm text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(Jp,{"aria-hidden":`true`,className:q(`size-4 transition-transform duration-200 ease-snap`,t&&`rotate-90`)}),t?`Hide the details`:`Read the details of each step`]}),t?(0,L.jsx)(`div`,{id:r,children:(0,L.jsx)(YB,{text:e})}):null]})}function cQ({detail:e,finished:t}){return e.plan&&e.planDetails?(0,L.jsx)(sQ,{text:e.planDetails}):e.plan?(0,L.jsx)(QB,{title:`Approved plan`,children:(0,L.jsx)(YB,{text:e.plan})}):e.proposal?(0,L.jsx)(QB,{title:t?`Proposal`:`Proposal (no plan yet)`,children:(0,L.jsx)(YB,{text:e.proposal})}):(0,L.jsx)(QB,{title:`Plan`,children:(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t?`It ended before a plan was made.`:`No proposal or plan yet — the oracle is still clarifying or scouting.`})})}function lQ({amendments:e}){return e.length===0?null:(0,L.jsx)(QB,{title:`Amendments`,children:(0,L.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-sm text-muted-foreground`,children:e.map(e=>(0,L.jsx)(`li`,{className:`break-words`,children:e},e))})})}function uQ({detail:e}){return e.waiting.length===0&&e.blockers.length===0?null:(0,L.jsx)(QB,{title:`Waiting on`,children:(0,L.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[e.waiting.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex gap-2`,children:[(0,L.jsx)(em,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,L.jsxs)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:[e.kind,` `,e.detail]})]},`${t}-${e.kind}`)),e.blockers.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex gap-2`,children:[(0,L.jsx)(fm,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-destructive`}),(0,L.jsxs)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:[e.reason,` (needs: `,e.need,`)`]})]},`${t}-${e.reason}`))]})})}function dQ({risk:e}){let t=YZ[e.risk];return(0,L.jsxs)(QB,{title:`QA risk`,right:XZ(e),children:[(0,L.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-sm`,"data-qa-risk":e.risk,children:[(0,L.jsx)(`span`,{className:q(`rounded-md px-2 py-0.5 text-xs font-medium`,t.tone),children:t.label}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:t.depth})]}),e.focusAreas.length>0?(0,L.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-sm text-muted-foreground`,"aria-label":`What QA looks at first`,children:e.focusAreas.map(e=>(0,L.jsx)(`li`,{className:`break-words`,children:e},e))}):null,(0,L.jsxs)(`p`,{className:`text-xs break-words text-muted-foreground`,children:[e.riskFactors.join(` · `),e.qaRequired?` · existing tests ${e.existingTestsLikelySufficient?`likely enough`:`likely not enough`}`:``]})]})}function fQ({runs:e}){return e.length===0?null:(0,L.jsx)(QB,{title:`Recent runs`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm text-muted-foreground`,children:e.map((e,t)=>(0,L.jsx)(`li`,{className:`break-words`,children:e},`${t}-${e}`))})})}function pQ({detail:e,finished:t}){return(0,L.jsxs)(L.Fragment,{children:[e.steps.length>0?(0,L.jsx)(oQ,{steps:e.steps,stopped:t}):null,e.request?(0,L.jsx)(QB,{title:`Request`,children:(0,L.jsx)(YB,{text:e.request})}):null,(0,L.jsx)(cQ,{detail:e,finished:t})]})}function mQ({detail:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lQ,{amendments:e.amendments}),(0,L.jsx)(uQ,{detail:e}),e.qaRisk?(0,L.jsx)(dQ,{risk:e.qaRisk}):null,(0,L.jsx)(fQ,{runs:e.runs})]})}function hQ({row:e,quiet:t=!1}){let n=(0,m.useRef)(!0);(0,m.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);async function r(){if(e.section===`mine`)return Y(`#/lobby`);let t=M(),r=()=>n.current&&M()===t;try{let t=await De(`tasks.open`,{taskId:e.id});if(!r())return;let n=await De(`status.get`,{});if(!r())return;if(t.sessionId&&t.sessionId===n.sessionId)return Y(`#/lobby`);if(t.sessionId&&!t.key)return V.info(`This task runs in another terminal. Switch to that terminal to work on it.`);if(n.busy)return V.info(`The oracle is working in this window. Stop it first, then open the task in its session.`);await H(`sessions.switch`,t.key?{key:t.key}:{claimTaskId:e.id})&&r()&&Y(`#/lobby`)}catch(e){r()&&V.error(e instanceof Error?e.message:String(e))}}let i=e.section===`mine`;return(0,L.jsx)(X,{label:i?`Open in its session: this window`:`Open in its session`,text:`Open in session`,icon:Mp,tone:t?`neutral`:`primary`,shortcut:`S`,onClick:()=>void r()})}function gQ({split:e}){let t=e.after.length>0?`, after ${e.after.map(e=>`part ${e}`).join(` and `)}`:``;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`font-medium text-primary`,children:[`part `,e.part,` of `,e.of]}),` of one plan that was split into tasks`,t?(0,L.jsx)(`span`,{className:`text-foreground`,children:t}):null]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.titles.map((t,n)=>(0,L.jsxs)(`span`,{children:[n>0?(0,L.jsx)(`span`,{className:`text-muted-foreground/60`,children:` · `}):null,(0,L.jsxs)(`span`,{className:n+1===e.part?`font-medium text-foreground`:void 0,children:[n+1,`. `,t]})]},`${n}-${t}`))})]})}function _Q({planId:e}){let t=Tk(`plans.get`,{planId:e},[`plans`]),n=t.data;return n?(0,L.jsxs)(L.Fragment,{children:[n.issue?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`from issue #`,n.issue.number,` — `,n.issue.title,n.issue.url?(0,L.jsxs)(`span`,{className:`break-all`,children:[` `,n.issue.url]}):null]}):null,n.split?(0,L.jsx)(gQ,{split:n.split}):null,(0,L.jsx)(QB,{title:`Agreed plan`,children:(0,L.jsx)(YB,{text:n.brief})})]}):t.error?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load the agreed plan. `,t.error]}):null}function vQ({row:e,onGone:t}){let n=async n=>{await H(`plans.start`,{planId:e.id,where:n})&&t()},r=async()=>{await H(`plans.discard`,{planId:e.id})&&t()};return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":e.title,children:[(0,L.jsxs)(Yk,{children:[(0,L.jsx)(X,{label:`Start here`,icon:Hh,tone:`primary`,shortcut:`S`,onClick:()=>void n(`here`)}),(0,L.jsx)(X,{label:`Start in a new session`,text:`New session`,icon:ug,shortcut:`N`,onClick:()=>void n(`session`)}),(0,L.jsx)(DA,{icon:wg,label:`Discard`,shortcut:`Delete`,title:`Discard "${e.title}"?`,description:`The saved plan is removed from the list. This cannot be undone.`,confirmLabel:`Discard`,variant:`destructive`,onConfirm:()=>void r()})]}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`h2`,{className:`flex items-start gap-2.5 text-lg font-medium`,children:[(0,L.jsx)(lG,{check:`open`,className:`mt-1.5`}),(0,L.jsx)(`span`,{className:`min-w-0 break-words`,children:e.title})]}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`pending`,e.age?` · saved ${$Z(e.age)}`:``]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:e.id})]}),(0,L.jsx)(_Q,{planId:e.id})]})}function yQ({row:e,onResumed:t}){let[n,r]=(0,m.useState)(!1),i=(0,m.useRef)(!0);(0,m.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);async function a(){let n=M();r(!0);try{let r=await De(`tasks.resume`,{taskId:e.id});if(M()!==n)return;let i=r.key;V(r.notice,i?{action:{label:`Watch`,onClick:()=>Y(`#/sessions/${encodeURIComponent(i)}`)}}:void 0),t()}catch(e){M()===n&&V.error(e instanceof Error?e.message:String(e))}finally{i.current&&r(!1)}}let o=e.owner===`not running`;return(0,L.jsx)(X,{label:o?`Resume: carry it on in a background session`:`Resume: unpause it where it runs`,text:`Resume`,icon:Hh,tone:`primary`,shortcut:`R`,disabled:n,onClick:()=>void a()})}function bQ(e){if(e.kind===`archived`)return{state:`archived`,rest:$Z(e.age??`now`)};let t=e.check!==`open`,n=e.owner??(e.section===`mine`?`this session`:``),r=t&&e.age?`${e.check===`dropped`?`dropped`:`done`} ${$Z(e.age)}`:``;return{state:QZ(e.status,e.paused),rest:[t?``:n,r].filter(Boolean).join(` · `)}}function xQ(e){return e?[oG(e.track),e.domains.join(`, `)].filter(Boolean).join(` · `):``}function SQ({row:e}){return e.progress?(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsx)(cG,{done:e.progress.done,total:e.progress.total}),(0,L.jsxs)(`span`,{children:[e.progress.done,` of `,e.progress.total,` steps`]})]}):null}function CQ({row:e,task:t}){let n=t?.git?`branch ${t.git.branch}${t.git.from?` · from ${t.git.from}`:``}`:``,{state:r,rest:i}=bQ(e);return(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h2`,{className:`flex items-start gap-2.5 text-lg font-semibold tracking-tight`,children:[(0,L.jsx)(lG,{check:e.check,className:`mt-1.5`}),(0,L.jsxs)(`span`,{className:`sr-only`,children:[JZ[e.check],`:`]}),(0,L.jsx)(`span`,{className:e.check===`dropped`?`min-w-0 break-words line-through`:`min-w-0 break-words`,children:e.title})]}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded-md bg-accent px-2 py-0.5 text-xs font-medium text-foreground`,children:r}),i?(0,L.jsx)(`span`,{children:i}):null]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:[e.id,xQ(t),n].filter(Boolean).join(` · `)}),(0,L.jsx)(SQ,{row:e})]})}function wQ({row:e,onGone:t,onChanged:n}){let r=e.id;return{restore:async()=>{await H(`tasks.restore`,{taskId:r},{undo:()=>void H(`tasks.archive`,{taskId:r})})&&t()},archive:async()=>{await H(`tasks.archive`,{taskId:r},{undo:()=>void H(`tasks.restore`,{taskId:r})})&&t()},remove:async()=>{await H(`tasks.delete`,{taskId:r,where:e.kind===`archived`?`archive`:`list`})&&t()},toggleAuto:()=>void H(`tasks.auto`,{taskId:r,on:!e.auto}).then(n)}}function TQ({row:e,archive:t}){return e.check===`open`?(0,L.jsx)(DA,{label:`Archive`,icon:Ep,shortcut:`E`,title:`Archive "${e.title}"?`,description:`A task still under way is abandoned first, then moved to the archive. Restore brings it back.`,confirmLabel:`Archive`,onConfirm:()=>void t()}):(0,L.jsx)(X,{label:`Archive`,icon:Ep,shortcut:`E`,onClick:()=>void t()})}function EQ({on:e,toggle:t}){return qk(`a`,t),(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsxs)(`label`,{className:`flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2.5 text-[0.8125rem] font-medium transition-colors hover:bg-accent`,children:[(0,L.jsx)(Kh,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,L.jsx)(`span`,{children:`Auto`}),(0,L.jsx)(ZK,{checked:e,onCheckedChange:t,"aria-label":`Auto mode`,"aria-keyshortcuts":`A`}),(0,L.jsx)(GO,{chord:`A`,className:`kbd-hint`})]})}),(0,L.jsx)(kk,{children:`Auto mode: the oracle decides without asking`})]})}function DQ(e){let{row:t}=e,{restore:n,archive:r,remove:i,toggleAuto:a}=wQ(e),o=t.kind===`archived`,s=t.kind===`task`&&t.check===`open`&&!!t.resumable;return(0,L.jsxs)(Yk,{children:[s?(0,L.jsx)(yQ,{row:t,onResumed:e.onChanged}):null,t.kind===`task`&&t.check===`open`?(0,L.jsx)(hQ,{row:t,quiet:s}):null,t.kind===`task`?(0,L.jsx)(OQ,{taskId:t.id}):null,o?(0,L.jsx)(X,{label:`Restore`,icon:Xh,shortcut:`R`,onClick:()=>void n()}):null,t.check===`open`&&!o?(0,L.jsx)(EQ,{on:!!t.auto,toggle:a}):null,o?null:(0,L.jsx)(TQ,{row:t,archive:r}),(0,L.jsx)(DA,{icon:wg,label:o?`Delete for good`:`Delete`,text:`Delete`,shortcut:`Delete`,title:`Delete "${t.title}" for good?`,description:`This cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,onConfirm:()=>void i()})]})}function OQ({taskId:e}){let t=(0,m.useRef)(!0);(0,m.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]);async function n(){let n=M();try{let r=await De(`tasks.open`,{taskId:e});if(!t.current||M()!==n)return;r.notice&&V.info(r.notice);let i=await De(`status.get`,{});if(!t.current||M()!==n)return;let a=r.key??(r.sessionId===i.sessionId?`here`:r.sessionId);a?Y(`#/sessions/${encodeURIComponent(a)}`):r.notice||V.info(`This task has no active session. No replacement session was created.`)}catch(e){t.current&&M()===n&&V.error(e instanceof Error?e.message:String(e))}}return(0,L.jsx)(X,{label:`Open task conversation`,text:`Conversation`,icon:fh,shortcut:`O`,onClick:()=>void n()})}function kQ(e){let{row:t}=e,n=t.kind===`plan`,r=Tk(`tasks.get`,{taskId:t.id},[`tasks`],!n),i=Ck(`lobby`).data?.task,a=i?.id===t.id?i:void 0;if(n)return(0,L.jsx)(vQ,{row:t,onGone:e.onGone});let o=t.check===`open`&&t.kind===`task`,s=r.data?r.data.work:t.work;return(0,L.jsxs)(`article`,{className:`flex flex-col gap-5`,"aria-label":t.title,children:[(0,L.jsx)(DQ,{...e}),(0,L.jsx)(CQ,{row:t,task:a}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,L.jsx)(DZ,{timing:r.data?.timing??t.timing,...s?{work:s}:{},stopped:t.check!==`open`})}),r.data?.delivery?(0,L.jsx)(VZ,{taskId:t.id,title:t.title,delivery:r.data.delivery,onChanged:r.reload},t.id):null,r.data?(0,L.jsx)(pQ,{detail:r.data,finished:!o}):null,(0,L.jsx)(KZ,{taskId:t.id,finished:!o,canComment:o}),r.data?(0,L.jsx)(mQ,{detail:r.data}):null,r.error&&!r.data?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load the plan detail. `,r.error]}):null]})}function AQ({row:e}){return e.check===`open`&&e.progress?(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground tabular-nums`,children:[(0,L.jsx)(cG,{done:e.progress.done,total:e.progress.total}),(0,L.jsxs)(`span`,{children:[e.progress.done,`/`,e.progress.total]})]}):e.age&&e.check!==`open`?(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.age}):null}function jQ(e){return e.check===`dropped`?`text-muted-foreground line-through`:e.kind===`archived`||e.check===`done`?`text-muted-foreground`:`text-foreground`}function MQ({row:e,card:t}){return(0,L.jsxs)(L.Fragment,{children:[t?(0,L.jsx)(`span`,{className:`pl-6 text-xs text-muted-foreground`,children:e.status.replaceAll(`_`,` `)}):null,e.check===`open`?(0,L.jsx)(`span`,{className:`pl-6 text-xs text-muted-foreground`,children:eQ(e)}):null,e.kind===`plan`?null:(0,L.jsx)(`span`,{className:`pl-6 text-xs text-muted-foreground`,children:(0,L.jsx)(DZ,{timing:e.timing,...e.work?{work:e.work}:{},stopped:e.check!==`open`})}),e.delivery?(0,L.jsxs)(`span`,{className:`pl-6 text-xs text-foreground`,children:[`Delivery: `,e.delivery.status.replaceAll(`_`,` `),` · open task to review`]}):null]})}function NQ({row:e,selected:t,onSelect:n,card:r=!1}){return(0,L.jsx)(`li`,{className:r?`overflow-hidden rounded-lg border border-input bg-card shadow-sm`:void 0,children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:LV,children:[(0,L.jsxs)(`span`,{className:`flex items-start gap-2 text-sm`,children:[(0,L.jsx)(lG,{check:e.check,className:`mt-0.5`}),(0,L.jsxs)(`span`,{className:`sr-only`,children:[JZ[e.check],`:`]}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words`,jQ(e),t&&`font-medium text-foreground`),children:e.title}),(0,L.jsx)(AQ,{row:e})]}),(0,L.jsx)(MQ,{row:e,card:r})]})})}function PQ({rows:e,selectedId:t,onSelect:n}){return(0,L.jsx)(`div`,{className:`flex flex-col pb-2`,children:tQ(e).map(({section:e,rows:r})=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:zV,children:(0,L.jsx)(ZB,{title:qZ[e],right:String(r.length),className:`[&>span:first-child]:font-medium [&>span:first-child]:text-muted-foreground`})}),(0,L.jsx)(`ul`,{className:RV,children:r.map(e=>(0,L.jsx)(NQ,{row:e,selected:e.id===t,onSelect:n},`${e.kind}-${e.id}`))})]},e))})}var FQ=()=>Y(lk(`tasks`,`board`)),IQ=e=>Y(lk(`tasks`,`board`,e)),LQ=[`Backlog`,`In progress`,`Completed`];function RQ(e){if(e.kind!==`archived`&&e.section!==`archived`)return e.check===`done`?`Completed`:e.kind===`plan`||e.status===`created`||e.check===`dropped`?`Backlog`:`In progress`}function zQ({title:e,rows:t,id:n}){return(0,L.jsxs)(`section`,{"aria-label":e,className:`min-w-0 rounded-xl border border-input bg-muted p-3`,children:[(0,L.jsxs)(`h2`,{className:`mb-3 flex items-center justify-between gap-2 text-sm font-semibold`,children:[e,(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:t.length})]}),(0,L.jsx)(`ul`,{className:`flex flex-col gap-3`,children:t.map(e=>(0,L.jsx)(NQ,{row:e,selected:e.id===n,onSelect:IQ,card:!0},`${e.kind}-${e.id}`))}),t.length?null:(0,L.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No tasks here.`})]})}function BQ({rows:e,id:t}){return(0,L.jsx)(`div`,{className:`grid items-start gap-4 p-4 md:grid-cols-3`,"aria-label":`Task board`,children:LQ.map(n=>(0,L.jsx)(zQ,{title:n,rows:e.filter(e=>RQ(e)===n),id:t},n))})}function VQ({id:e}){let t=Tk(`tasks.list`,{},[`tasks`,`plans`]),n=t.data?.rows??[],r=n.find(t=>t.id===e&&RQ(t)!==void 0),i=r?.kind===`task`?r.id:void 0;if((0,m.useEffect)(()=>(BX(i),()=>BX(void 0)),[i]),!t.data&&t.error)return(0,L.jsx)(yk,{message:`Could not load tasks. ${t.error}`,onRetry:t.reload});let a=r?(0,L.jsx)(kQ,{row:r,onGone:FQ,onChanged:t.reload},r.id):null;return(0,L.jsx)(cA,{wide:!1,list:t.data?(0,L.jsx)(BQ,{rows:n,id:e}):(0,L.jsx)(uA,{}),detail:a,open:!!r,onClose:FQ,hint:`Select a task to see its detail.`,describe:`Task detail`})}var HQ=()=>Y(lk(`tasks`)),UQ=e=>Y(lk(`tasks`,e));function WQ(){return(0,L.jsxs)(dk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(fk,{children:[(0,L.jsx)(mk,{variant:`icon`,children:(0,L.jsx)(Qm,{"aria-hidden":`true`})}),(0,L.jsx)(gk,{children:ZZ})]}),(0,L.jsx)(J,{onClick:()=>Y(lk(`plan`)),children:`Plan a task`})]})}function GQ({shown:e,count:t,onToggle:n}){return(0,L.jsxs)(`label`,{className:`btn-raised flex h-7 cursor-pointer items-center gap-2 rounded-lg border bg-card px-2 text-xs font-medium transition-[box-shadow]`,children:[(0,L.jsx)(NU,{checked:e,onCheckedChange:n,"aria-label":`Show archived tasks`,className:`size-4`}),`Archived`,(0,L.jsx)(IV,{variant:`secondary`,className:`h-5 px-1.5`,children:t})]})}function KQ({id:e,board:t=!1}){return(0,L.jsxs)(JD,{value:t?`board`:`list`,onValueChange:e=>Y(lk(`tasks`,...e===`board`?[`board`]:[])),className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(YD,{"aria-label":`Task views`,className:`flex gap-1 border-b border-border px-4 py-2`,children:[(0,L.jsx)(XD,{value:`list`,className:`rounded-lg border border-input px-3 py-1.5 text-sm text-muted-foreground data-[state=active]:bg-tab-fill data-[state=active]:text-foreground focus-visible:ring-3 focus-visible:ring-ring`,children:`List`}),(0,L.jsx)(XD,{value:`board`,className:`rounded-lg border border-input px-3 py-1.5 text-sm text-muted-foreground data-[state=active]:bg-tab-fill data-[state=active]:text-foreground focus-visible:ring-3 focus-visible:ring-ring`,children:`Board`})]}),(0,L.jsx)(ZD,{value:`list`,className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(qQ,{id:e})}),(0,L.jsx)(ZD,{value:`board`,className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(VQ,{id:e})})]})}function qQ({id:e}){let t=iA(),[n,r]=(0,m.useState)(!1),i=Tk(`tasks.list`,{},[`tasks`,`plans`]),a=Tk(`tasks.archived`,{},[`tasks`]),o=i.data?.rows??[],s=a.data?.rows??[],c=n?[...o,...s]:o,l=e??(t?c[0]?.id:void 0),u=[...c,...s].find(e=>e.id===l&&e.kind===`task`)?.id;if((0,m.useEffect)(()=>(BX(u),()=>BX(void 0)),[u]),!i.data&&i.error)return(0,L.jsx)(yk,{message:`Could not load tasks. ${i.error}`,onRetry:i.reload});if(i.data&&o.length===0&&s.length===0)return(0,L.jsx)(WQ,{});let d=[...c,...s].find(e=>e.id===l),f=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lA,{title:`Tasks`,count:nQ(c),children:(0,L.jsx)(GQ,{shown:n,count:s.length,onToggle:()=>r(e=>!e)})}),i.data?c.length===0?(0,L.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:ZZ}):(0,L.jsx)(PQ,{rows:c,selectedId:l,onSelect:UQ}):(0,L.jsx)(uA,{})]}),p=d?(0,L.jsx)(kQ,{row:d,onGone:HQ,onChanged:i.reload},d.id):e?(0,L.jsx)(JQ,{}):null;return(0,L.jsx)(cA,{wide:t,list:f,detail:p,open:!!e,onClose:HQ,hint:`Select a task to see its detail.`,describe:`Task detail`})}function JQ(){return(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That task is not on the list any more.`})}var YQ={l:`lobby`,p:`plan`,t:`tasks`,i:`issues`,u:`git`,s:`sessions`,n:`knowledge`,q:`quickfix`,m:`metrics`,e:`settings`,x:`excalidraw`};function XQ(e){let t=e[0];if(t)try{return decodeURIComponent(t)}catch{return t}}function ZQ(e){if(e.kind===`settings`)return(0,L.jsx)(ZJ,{});if(e.kind===`sessions`)return(0,L.jsx)(wZ,{id:XQ(e.key?[e.key]:[])});switch(e.tab){case`lobby`:return(0,L.jsx)(wG,{});case`tasks`:return(0,L.jsx)(KQ,{...MU(e.rest)});case`plan`:return(0,L.jsx)(hX,{rest:e.rest});case`quickfix`:return(0,L.jsx)(FX,{id:XQ(e.rest)});case`issues`:return(0,L.jsx)(bH,{rest:e.rest});case`metrics`:return(0,L.jsx)(hK,{});case`git`:return(0,L.jsx)(qV,{rest:e.rest});case`knowledge`:return(0,L.jsx)(jU,{rest:e.rest});case`excalidraw`:return(0,L.jsx)(zW,{id:XQ(e.rest)})}}function QQ(e,t){return t.overlay?!0:e===`savePlan`&&!t.saveAvailable}var $Q={tab:`Tab`,esc:`Escape`,escape:`Escape`,enter:`Enter`,space:`Space`,pageup:`PageUp`,pagedown:`PageDown`,home:`Home`,end:`End`,"]":`BracketRight`,"[":`BracketLeft`,"/":`Slash`,"?":`Slash`,",":`Comma`,".":`Period`};function e$(e){return e.length===1&&/[a-z]/i.test(e)?`Key${e.toUpperCase()}`:e.length===1&&/[0-9]/.test(e)?`Digit${e}`:$Q[e]}function t$(e){let t={alt:!1,ctrl:!1,shift:!1,meta:!1,code:``};for(let n of e.toLowerCase().split(`+`))if(n===`alt`)t.alt=!0;else if(n===`ctrl`||n===`control`)t.ctrl=!0;else if(n===`shift`)t.shift=!0;else if(n===`meta`||n===`cmd`)t.meta=!0;else{let e=e$(n);if(!e)return;t.code=e}return t.code?t:void 0}function n$(e,t){return e.code===t.code&&e.altKey===t.alt&&e.ctrlKey===t.ctrl&&e.shiftKey===t.shift&&e.metaKey===t.meta}function r$(e,t){let n=t$(t);return n?n$(e,n):!1}function i$(e,t){for(let n of t)if(r$(e,n.key))return n.action}function a$(e,t){for(let n of t)if(r$(e,n.key))return n.id}function o$(e){return Mk(e.target)||e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||nk()||!!document.querySelector(`[role='dialog'], [role='menu'], [role='listbox']`)}function s$(e,t,n,r){let i=!e.shiftKey&&/^[1-9]$/.test(e.key)?t[Number(e.key)-1]:void 0;if(i)r(i.id);else if(e.key===`/`)n(`search`);else if(e.key===`?`)n(`help`);else if(e.key===`j`||e.key===`k`)Rk(e.key===`j`?1:-1);else return!1;return!0}function c$(e,t){let n=a$(e,t.tabs),r=i$(e,t.keys);return!n&&!r?!1:QQ(r,{overlay:!!document.querySelector(`[role='dialog']:not([data-state='closed']), [role='menu']:not([data-state='closed']), [role='listbox']`)||nk(),typing:Mk(e.target)||e.target instanceof HTMLInputElement,saveAvailable:!!document.querySelector(`[data-plan-save]:not([disabled])`)})||(r===`search`||r===`savePlan`)&&!t.insideApp()?!0:(e.preventDefault(),n?t.onTab(n):r&&t.onAction(r),!0)}function l$(e,t,n){if(e.key===`Escape`)return Date.now()<n&&e.preventDefault(),0;if(Date.now()<n){let n=YQ[e.key];return n&&(e.preventDefault(),t.onTab(n)),0}return e.key===`g`?Date.now()+1500:(s$(e,t.tabs,t.onAction,t.onTab)&&e.preventDefault(),0)}function u$(e){(0,m.useEffect)(()=>{if(!e.enabled)return;let t=0,n=n=>{if(n.defaultPrevented||n.isComposing)return;if(!e.insideApp()){i$(n,e.keys)===`help`&&(n.preventDefault(),e.onAction(`help`));return}let r=!n.altKey&&!n.ctrlKey&&!n.metaKey;if(r&&o$(n)){t=0;return}if(c$(n,e)){t=0;return}t=r?l$(n,e,t):0};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e.enabled,e.keys,e.tabs,e.insideApp,e.onAction,e.onTab])}var d$=[{id:`focus`,caps:[`/`],help:`focus search, or the message box`},{id:`send`,label:`Enter`,help:`send the message`},{id:`newline`,label:`Shift+Enter`,help:`a new line (lists carry on)`},{id:`format`,label:`Ctrl+B`,help:`bold; Ctrl+I italic, Ctrl+E code, Ctrl+K link`},{id:`leave`,label:`Esc`,help:`leave the box for the tab bar`}],f$=[{id:`digits`,caps:[`1`,`…`,`9`],help:`jump to a tab in current order`},{id:`help`,caps:[`?`],help:`keyboard shortcuts`},...Object.entries(YQ).map(([e,t])=>({id:`go.${t}`,caps:[`g`,e],help:`jump to ${t}`})),{id:`project`,caps:[`P`],help:`open the project switcher`},{id:`theme`,caps:[`D`],help:`switch between light and dark`},{id:`edit`,label:`Ctrl+Enter`,help:`save an edited message; Esc cancels`}],p$=[{id:`tasks`,page:`Tasks`,keys:[[`E`,`archive`],[`R`,`restore`],[`A`,`auto mode`],[`Delete`,`delete`]]},{id:`saved`,page:`Saved plan`,keys:[[`S`,`start here`],[`N`,`new session`],[`Delete`,`discard`]]},{id:`plan`,page:`Plan`,keys:[[`A`,`answer`],[`R`,`retry`],[`Ctrl+S`,`save`],[`N`,`new plan`]]},{id:`quickfix`,page:`Quick fix`,keys:[[`R`,`run anyway`],[`T`,`make a task`],[`C`,`cancel`]]},{id:`git`,page:`Git`,keys:[[`R`,`refresh`],[`V`,`review`],[`Q`,`Jev's read`],[`X`,`stop`]]},{id:`issues`,page:`Issues`,keys:[[`R`,`refresh`]]},{id:`knowledge`,page:`Knowledge`,keys:[[`E`,`edit`],[`A`,`add`],[`C`,`comment`],[`F`,`edit file`],[`Delete`,`delete`]]},{id:`excalidraw`,page:`Excalidraw`,keys:[[`R`,`reveal`],[`C`,`copy`],[`O`,`open`],[`W`,`draw`],[`T`,`check`],[`Delete`,`remove`]]},{id:`sessions`,page:`Sessions`,keys:[[`M`,`move here`],[`S`,`stop`],[`B`,`back`]]},{id:`confirm`,page:`Asked to confirm`,keys:[[`Y`,`yes, do it`],[`Esc`,`keep it`]]}],m$=[{id:`enter`,caps:[`↓`],help:`from the tab bar, into the page`},{id:`rows`,caps:[`↑`,`↓`],help:`move through a list (j and k work too)`},{id:`pane`,caps:[`←`,`→`],help:`between a list and its detail (h and l)`},{id:`ends`,caps:[`Home`,`End`],help:`first and last row`},{id:`open`,caps:[`Enter`,`Space`],help:`activate the focused button or row (links: Enter; checkboxes: Space)`},{id:`back`,label:`Esc`,help:`back up to the tab bar`}],h$=[{id:`qmove`,caps:[`↑`,`↓`],help:`move between the options`},{id:`qpick`,label:`Space`,help:`pick an option (several when allowed)`},{id:`qchoose`,label:`Enter`,help:`choose and go on; in your own answer, send it`},{id:`qacross`,caps:[`←`,`→`],help:`previous and next question`},{id:`qdigit`,caps:[`1`,`2`,`…`],help:`pick that option`},{id:`qesc`,label:`Esc`,help:`put the question away for later`}];function g$({line:e}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,L.jsx)(`span`,{className:`flex w-28 shrink-0 items-center`,children:e.caps?(0,L.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:e.caps.map(e=>(0,L.jsx)(zO,{children:e},e))}):(0,L.jsx)(GO,{chord:e.label??``})}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.help})]})}function _$(){return(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h3`,{className:`mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:`Buttons on a page`}),p$.map(e=>(0,L.jsxs)(`div`,{className:`flex items-start gap-3 py-1`,children:[(0,L.jsx)(`span`,{className:`w-28 shrink-0 pt-0.5 text-sm font-medium`,children:e.page}),(0,L.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5 text-sm text-muted-foreground`,children:e.keys.map(([e,t])=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(GO,{chord:e}),t]},e))})]},e.id))]})}function v$({title:e,lines:t}){return(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h3`,{className:`mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:e}),t.map(e=>(0,L.jsx)(g$,{line:e},e.id))]})}function y$(e){return e.map(e=>({id:e.action,label:e.label,help:e.help}))}function b$(e){return e.map(e=>({id:`tab.${e.id}`,label:e.key,help:`jump to the ${e.label} tab`}))}function x$({open:e,onOpenChange:t,keys:n,tabs:r}){let i=tk(e,ek.help);return(0,m.useEffect)(()=>{if(!e||!i)return;let r=e=>{let r=n.find(e=>e.action===`help`)?.key;(e.key===`Escape`||r&&r$(e,r))&&(e.preventDefault(),t(!1))};return window.addEventListener(`keydown`,r,!0),()=>window.removeEventListener(`keydown`,r,!0)},[e,i,t,n]),(0,L.jsxs)(qO,{open:e&&i,onOpenChange:t,label:`Keys`,className:`max-w-4xl`,children:[(0,L.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border px-6 py-4`,children:[(0,L.jsx)(`h2`,{"aria-hidden":`true`,className:`text-base font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(GO,{chord:`Esc`}),(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,onClick:()=>t(!1),children:(0,L.jsx)(Hg,{"aria-hidden":`true`})})]})]}),(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-10 gap-y-6 overflow-y-auto px-6 py-5 md:grid-cols-2`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsx)(v$,{title:`Everywhere`,lines:y$(n)}),(0,L.jsx)(v$,{title:`Jump to a tab`,lines:b$(r)}),(0,L.jsx)(v$,{title:`Navigation and editing`,lines:f$}),(0,L.jsx)(v$,{title:`Message box`,lines:d$})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsx)(v$,{title:`Lists and panes`,lines:m$}),(0,L.jsx)(_$,{}),(0,L.jsx)(v$,{title:`Questions`,lines:h$})]})]})]})}function S$(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}async function C$(e){if(e.size===0)throw Error(`${e.name||`That file`} is empty.`);if(e.size>20971520)throw Error(`${e.name||`That file`} is larger than 20 MB.`);let t=new URLSearchParams({name:e.name||`pasted-file`,type:e.type}),n=await fetch(N(`/api/files.upload?${t}`),{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e,credentials:`same-origin`}),r=await n.json().catch(()=>void 0);if(!r)throw new Te(`the lobby answered ${n.status}`,`failed`,n.status);if(!r.ok)throw new Te(r.error,r.code,n.status);return r.result}function w$(e,t,n,r){let i=e.slice(0,t),a=e.slice(t,n),o=e.slice(n);if(a.length>=r.length*2&&a.startsWith(r)&&a.endsWith(r)){let e=a.slice(r.length,a.length-r.length);return{value:i+e+o,start:t,end:t+e.length}}return i.endsWith(r)&&o.startsWith(r)?{value:i.slice(0,i.length-r.length)+a+o.slice(r.length),start:t-r.length,end:n-r.length}:{value:i+r+a+r+o,start:t+r.length,end:n+r.length}}function T$(e,t,n){let r=e.slice(t,n)||`text`,i=`[${r}](url)`,a=t+r.length+3;return{value:e.slice(0,t)+i+e.slice(n),start:a,end:a+3}}var E$=/^(\s*)(?:([-*+])|(\d+)([.)]))\s+(\[[ xX]\]\s+)?/;function D$(e,t){let n=e.lastIndexOf(`
96
+ .dark { … }`,className:`max-h-56 font-mono text-xs md:text-xs`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{ref:l,type:`file`,accept:`.css,.json,text/css,application/json`,hidden:!0,tabIndex:-1,"aria-label":`Upload a theme file`,onChange:e=>{d(e.target.files?.[0]),e.target.value=``}}),(0,L.jsx)(Y,{label:`Save and apply the pasted theme`,text:`Save theme`,icon:Hp,tone:`primary`,disabled:!t.trim()||s,onClick:()=>void u(t,`Custom theme`)}),(0,L.jsx)(Y,{label:`Upload a .css or .json theme file`,text:`Upload file`,icon:Ag,disabled:s,onClick:()=>l.current?.click()}),a?(0,L.jsx)(`p`,{role:`alert`,className:`ml-2 min-w-0 text-xs text-destructive`,children:a}):null]})]})}function mJ(){let{theme:e,setTheme:t}=Oq(),n=FK();return(0,L.jsx)(nV,{prominent:!0,title:zq.appearance,children:(0,L.jsxs)(vq,{children:[(0,L.jsx)(_q,{label:`Prompt sounds`,help:`A droplet for each new actionable prompt or delivery review. Kept in this browser; sound starts after interaction. Desktop notifications remain separate.`,children:(0,L.jsx)(aq,{checked:!n,onCheckedChange:e=>NK(!e),"aria-label":`Prompt sounds`})}),(0,L.jsx)(_q,{label:oJ.themeLabel,help:oJ.appearanceHelp,children:(0,L.jsx)(yq,{value:e,items:oJ.themeItems.map(e=>({value:e.id,label:e.label})),label:oJ.themeLabel,onChange:e=>t(e)})}),(0,L.jsx)(_q,{label:`Colour theme`,help:`The page's colours, the same in every pi session.`,stacked:!0,children:(0,L.jsx)(uJ,{})}),(0,L.jsx)(_q,{label:`Saved themes`,help:`Themes you imported, kept with pi for every session and project.`,stacked:!0,children:(0,L.jsx)(fJ,{})}),(0,L.jsx)(_q,{label:`Import a theme`,stacked:!0,children:(0,L.jsx)(pJ,{})})]})})}var hJ={master:[`master`],designer:[`agents`,`designer`],backend:[`agents`,`backend`],qa:[`agents`,`qa`],scout:[`scout`],researcher:[`researcher`],quickfix:[`quickFix`],planner:[`planner`]},gJ=[...Bq,...Vq.map(e=>({id:`panel:${e.id}`,label:e.label,help:Hq}))];function _J(e,t){switch(t){case`master`:return e.master;case`scout`:return{model:e.scout.model,thinking:`low`,timeoutMs:e.scout.timeoutMs};case`researcher`:return e.researcher;case`quickfix`:return e.quickFix;case`planner`:return e.planner;default:return e.agents[t]}}function vJ(e,t){return hJ[e].reduceRight((e,t)=>({[t]:e}),t)}function yJ(e,t){return e.find(e=>e.id===t)?.thinkingLevels??Rq}function bJ(e,t){return Rq[fq(Rq,e,Math.max(0,Rq.indexOf(t)))]??t}var xJ=e=>e>0?`${e} round${e===1?``:`s`}`:`unlimited`,SJ=e=>e>0?`over ${e} steps`:`never`;function CJ({label:e,children:t}){return(0,L.jsxs)(`div`,{className:`grid min-w-0 gap-1`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),t]})}function wJ(e){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)(``),a=e.models.some(t=>t.id===e.value),o=[...e.inherit?[{value:Mq,label:Nq,help:Pq}]:[],...e.none?[{value:Mq,label:`none`,help:`Use the primary model`}]:[],...!e.inherit&&!e.none&&e.value===`inherit`?[{value:Mq,label:Nq,help:Pq}]:[],...e.models.map(e=>({value:e.id,label:e.id,...e.label&&e.label!==e.id?{help:e.label}:{}})),...!a&&e.value!==`inherit`?[{value:e.value,label:e.value,help:Lq}]:[],{value:Fq,label:Iq,help:Lq}],s=t=>{if(t!==`__custom__`)return e.onChange(t);i(a?``:e.value),n(!0)},c=()=>{let t=r.trim();n(!1),t&&t!==e.value&&e.onChange(t)};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(yq,{value:e.value,items:o,label:e.label,onChange:s}),t?(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(iq,{autoFocus:!0,value:r,placeholder:`provider/model`,"aria-label":`Model id`,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())}}),(0,L.jsx)(Y,{label:`Use this model`,icon:Hp,tone:`primary`,onClick:c})]}):null]})}function TJ({label:e,help:t,checked:n,onChange:r}){return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[0.8125rem] font-medium`,children:e}),t?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null]}),(0,L.jsx)(aq,{checked:n,onCheckedChange:r,"aria-label":e})]})}function EJ({value:e,onSave:t,placeholder:n,label:r}){let[i,a]=(0,m.useState)(e);(0,m.useEffect)(()=>a(e),[e]);let o=()=>{let n=i.trim();n!==e&&t(n)};return(0,L.jsx)(iq,{value:i,placeholder:n,"aria-label":r,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())}})}function DJ({value:e,label:t,onSave:n}){let r=Math.round(e/6e4);return(0,L.jsx)(kJ,{label:t,value:String(r),min:1,suffix:`min`,onSave:e=>{let t=Number(e);return!Number.isFinite(t)||t<=0?(V.error(`"${e}" is not a positive number of minutes.`),!1):(n(Math.round(t*6e4)),!0)}})}function OJ({value:e,onSave:t}){return(0,L.jsx)(kJ,{label:Yq,value:String(e),min:0,max:65535,onSave:e=>!/^\d+$/.test(e)||Number(e)>65535?(V.error(`"${e}" is not a port (0, or 1-65535).`),!1):(t(Number(e)),!0)})}function kJ({label:e,value:t,min:n,max:r,suffix:i,onSave:a}){let[o,s]=(0,m.useState)(t);(0,m.useEffect)(()=>s(t),[t]);let c=()=>{o!==t&&(a(o.trim())||s(t))};return(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(iq,{type:`number`,inputMode:`numeric`,min:n,max:r,value:o,"aria-label":e,className:i?`pr-10`:void 0,onChange:e=>s(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())}}),i?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0 right-2.5 flex items-center text-xs text-muted-foreground`,children:i}):null]})}function AJ({value:e,label:t,onSave:n}){let[r,i]=(0,m.useState)(e);return(0,m.useEffect)(()=>i(e),[e]),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(gA,{rows:2,value:r,"aria-label":t,onChange:e=>i(e.target.value),onBlur:()=>{r.trim()!==e&&n(r.trim())}}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Saved when you leave the field.`})]})}function jJ({kind:e,config:t,models:n,save:r}){let i=_J(t,e),a=t=>r(vJ(e,t)),o=Aq[e],s=yJ(n,i.model),c=t=>{let r={model:t};e!==`scout`&&!yJ(n,t).includes(i.thinking)&&(r.thinking=bJ(yJ(n,t),i.thinking)),a(r)},l=e===`scout`?`low`:bJ(s,i.thinking),u=e!==`scout`&&e!==`researcher`,[d,f]=(0,m.useState)(!!i.instructions);return(0,L.jsxs)(`section`,{className:q(kG({spacing:`default`}),`glass min-w-0`),children:[(0,L.jsxs)(MG,{className:`flex-row items-baseline justify-between gap-3 py-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:o}),(0,L.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[i.model===`inherit`?`session model`:i.model,` · `,e===`scout`?`low`:i.thinking]})]}),(0,L.jsxs)(jG,{className:`flex min-w-0 flex-col gap-3`,children:[(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-1`,children:(0,L.jsx)(CJ,{label:jq.model,children:(0,L.jsx)(wJ,{value:i.model,models:n,label:`${o} model`,inherit:e===`master`,onChange:c})})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-muted p-3`,children:[e===`scout`?(0,L.jsx)(lq,{level:l}):null,(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:e===`scout`?(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:jq.thinking}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`low`,` (fixed for scouts)`]})]}):(0,L.jsx)(mq,{value:i.thinking,levels:Rq,supported:s,model:i.model===`inherit`?`the session model`:i.model,label:`${o} effort`,onChange:e=>a({thinking:e})})})]}),(0,L.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[u?(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"aria-expanded":d,onClick:()=>f(e=>!e),className:`flex min-h-8 items-center gap-1 rounded-md text-xs text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/30`,children:[(0,L.jsx)(Jp,{"aria-hidden":`true`,className:q(`size-3.5 transition-transform duration-200 ease-snap`,d&&`rotate-90`)}),jq.instructions,!d&&i.instructions?(0,L.jsx)(`span`,{className:`text-primary`,children:`· set`}):null]}):(0,L.jsx)(`span`,{}),e===`master`?null:(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Time limit`}),(0,L.jsx)(`div`,{className:`w-24`,children:(0,L.jsx)(DJ,{value:i.timeoutMs??t.workflow.agentTimeoutMs,label:`${o} time limit`,onSave:e=>a({timeoutMs:e})})})]})]}),u&&d?(0,L.jsx)(AJ,{value:i.instructions??``,label:`${o} instructions`,onSave:e=>a({instructions:e})}):null]})]})}function MJ(e,t){return t.startsWith(`panel:`)?e.lobby.panels[t.slice(6)]:e.lobby[t]}function NJ({config:e,item:t,save:n}){let r=t.id.startsWith(`panel:`);return(0,L.jsx)(TJ,{label:t.label,help:t.help,checked:MJ(e,t.id),onChange:e=>{n(r?{lobby:{panels:{[t.id.slice(6)]:e}}}:{lobby:{[t.id]:e}})}})}function PJ({config:e,save:t}){let n=e.workflow.gitIsolation;return(0,L.jsx)(nV,{prominent:!0,title:zq.workflow,children:(0,L.jsx)(vq,{children:(0,L.jsx)(_q,{label:eJ,help:$q.find(e=>e.id===n)?.help??`enter cycles off, branch, worktree`,children:(0,L.jsx)(yq,{value:n,items:$q.map(e=>({value:e.id,label:e.label})),label:eJ,onChange:e=>void t({workflow:{gitIsolation:e}})})})})})}var FJ=e=>e?`${e}/`:nJ.top;function IJ(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean)}function LJ({replaced:e}){let t=Ak(`settings.linters`,{},[]),n=t.data?.linters;return(0,L.jsx)(_q,{label:nJ.found,help:e?nJ.foundReplaced:nJ.foundHelp,children:n?n.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground sm:text-right`,children:nJ.foundNone}):(0,L.jsx)(`ul`,{"aria-label":nJ.found,className:q(`flex flex-col gap-1.5 sm:items-end`,e&&`opacity-60`),children:n.map(e=>(0,L.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.tool}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:FJ(e.folder)}),(0,L.jsxs)(`span`,{title:e.installed?void 0:nJ.missingHelp,className:q(`inline-flex shrink-0 items-center gap-1 text-xs`,e.installed?`text-success`:`text-warning`),children:[e.installed?(0,L.jsx)(nm,{"aria-hidden":`true`,className:`size-3.5`}):(0,L.jsx)(em,{"aria-hidden":`true`,className:`size-3.5`}),e.installed?nJ.installed:nJ.missing]})]},`${e.tool}:${e.folder}`))}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground sm:text-right`,children:t.error?t.error:`Looking…`})})}function RJ({config:e,save:t}){let n=e.lint,r=n.mode===`off`,i=n.command.trim().length>0;return(0,L.jsxs)(nV,{prominent:!0,title:zq.lint,children:[(0,L.jsx)(`p`,{className:`max-w-3xl text-sm text-muted-foreground`,children:nJ.intro}),(0,L.jsxs)(vq,{children:[(0,L.jsx)(_q,{label:nJ.mode,help:tJ.find(e=>e.id===n.mode)?.help,children:(0,L.jsx)(yq,{value:n.mode,items:tJ.map(e=>({value:e.id,label:e.label})),label:nJ.mode,onChange:e=>void t({lint:{mode:e}})})}),(0,L.jsxs)(`div`,{className:q(`flex flex-col divide-y divide-border [&>*]:py-3 [&>*:first-child]:pt-0 [&>*:last-child]:pb-0`,r&&`opacity-60`),"aria-disabled":r||void 0,children:[(0,L.jsx)(_q,{label:nJ.command,help:nJ.commandHelp,children:(0,L.jsx)(EJ,{value:n.command,label:nJ.command,placeholder:nJ.commandPlaceholder,onSave:e=>void t({lint:{command:e}})})}),i?(0,L.jsx)(_q,{label:nJ.extensions,help:nJ.extensionsHelp,children:(0,L.jsx)(EJ,{value:n.extensions.join(` `),label:nJ.extensions,placeholder:nJ.extensionsPlaceholder,onSave:e=>void t({lint:{extensions:IJ(e)}})})}):null,(0,L.jsx)(_q,{label:nJ.timeout,help:nJ.timeoutHelp,children:(0,L.jsx)(DJ,{value:n.timeoutMs,label:`Lint ${nJ.timeout.toLowerCase()}`,onSave:e=>void t({lint:{timeoutMs:e}})})}),(0,L.jsx)(LJ,{replaced:i})]})]})]})}function zJ({config:e,save:t}){let n=e.lobby.web;return(0,L.jsx)(nV,{prominent:!0,title:zq.lobby,children:(0,L.jsxs)(vq,{children:[gJ.map(n=>(0,L.jsx)(NJ,{config:e,item:n,save:t},n.id)),(0,L.jsx)(_q,{label:Uq,help:Wq,children:(0,L.jsx)(yq,{value:String(e.lobby.maxPlanningRounds),items:Gq.map(e=>({value:String(e),label:xJ(e)})),label:Uq,onChange:e=>void t({lobby:{maxPlanningRounds:Number(e)}})})}),(0,L.jsx)(_q,{label:Kq,help:qq,children:(0,L.jsx)(yq,{value:String(e.lobby.splitPlanAbove),items:Jq.map(e=>({value:String(e),label:SJ(e)})),label:Kq,onChange:e=>void t({lobby:{splitPlanAbove:Number(e)}})})}),(0,L.jsx)(_q,{label:Yq,help:Xq,children:(0,L.jsx)(OJ,{value:n.port,onSave:e=>void t({lobby:{web:{port:e}}})})}),(0,L.jsx)(TJ,{label:Zq,help:Qq,checked:n.openBrowser,onChange:e=>void t({lobby:{web:{openBrowser:e}}})})]})})}function BJ({config:e,models:t,save:n}){let r=e.classifier,i=rJ.find(e=>e.id===r.provider)?.label;return(0,L.jsx)(nV,{prominent:!0,title:zq.classifier,children:(0,L.jsxs)(vq,{children:[(0,L.jsx)(TJ,{label:aJ.enabled,help:aJ.enabledHelp,checked:r.enabled,onChange:e=>void n({classifier:{enabled:e}})}),(0,L.jsx)(_q,{label:aJ.host,children:(0,L.jsx)(yq,{value:r.provider,items:rJ.map(e=>({value:e.id,label:e.label})),label:aJ.host,onChange:e=>void n({classifier:{provider:e}})})}),(0,L.jsx)(_q,{label:aJ.model,help:aJ.modelHelp,children:(0,L.jsx)(EJ,{value:r.model,label:aJ.model,placeholder:`the host's default`,onSave:e=>void n({classifier:{model:e}})})}),(0,L.jsx)(_q,{label:aJ.key,help:aJ.keyNote,children:(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground sm:text-right`,children:i??r.provider})}),iJ.map(e=>(0,L.jsx)(TJ,{label:e.label,help:e.help,checked:r.features[e.id],onChange:t=>void n({classifier:{features:{[e.id]:t}}})},e.id)),(0,L.jsx)(_q,{label:aJ.cheap,help:aJ.cheapHelp,children:(0,L.jsx)(wJ,{value:r.effort.cheapModel,models:t,label:aJ.cheap,none:!0,onChange:e=>void n({classifier:{effort:{cheapModel:e}}})})})]})})}function VJ(){let e=GK(),t=async e=>{if(!e)return qK();let t=await KK();t===`granted`?V.success(oJ.notificationsOn):V.error(t===`unsupported`?oJ.notificationsUnsupported:oJ.notificationsBlocked)};return(0,L.jsx)(nV,{prominent:!0,title:zq.notifications,children:(0,L.jsx)(vq,{children:(0,L.jsx)(TJ,{label:oJ.notificationsLabel,help:oJ.notificationsHelp,checked:e,onChange:e=>void t(e)})})})}function HJ(){let{available:e,install:t}=y(),n=b(),r=x();return(0,L.jsx)(nV,{prominent:!0,title:zq.install,children:(0,L.jsxs)(vq,{children:[(0,L.jsx)(_q,{label:oJ.installLabel,help:n?oJ.installedNow:oJ.installHelp,children:n?null:(0,L.jsx)(`div`,{className:`flex sm:justify-end`,children:(0,L.jsx)(Y,{label:oJ.installButton,icon:wm,tone:`primary`,onClick:()=>e?void t().then(()=>V.success(oJ.installDone)):V.warning(oJ.installUnavailable)})})}),r.supported?(0,L.jsx)(_q,{label:oJ.fullscreenLabel,help:oJ.fullscreenHelp,children:(0,L.jsx)(`div`,{className:`flex sm:justify-end`,children:(0,L.jsx)(Y,{label:r.on?oJ.fullscreenOn:oJ.fullscreenOff,icon:r.on?vh:oh,pressed:r.on,onClick:()=>void r.toggle()})})}):null]})})}var UJ=[`Agents`,`Workflow`,`Linting`,`Lobby`,`Classifier`,`Appearance & notifications`];function WJ({config:e,models:t,onConfig:n}){let[r,i]=(0,m.useState)(`Agents`),a=(0,m.useRef)(Promise.resolve()),o=e=>{let t=async()=>{try{return n((await De(`settings.set`,{patch:e})).config),V.success(oJ.saved),!0}catch(e){return V.error(e instanceof Error?e.message:`That did not work. Try again.`),!1}},r=a.current.then(t,t);return a.current=r,r};return(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-6 px-5 pt-5 pb-dock sm:px-8 sm:pt-8`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:oJ.title}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:oJ.intro})]}),(0,L.jsx)(`nav`,{"aria-label":`Settings sections`,className:`-mx-1 flex flex-wrap gap-1 border-b border-border pb-3`,children:UJ.map(e=>(0,L.jsx)(`button`,{type:`button`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"aria-current":r===e?`page`:void 0,"aria-controls":`settings-${e.split(` `)[0]}`,onClick:()=>i(e),className:q(`h-8 rounded-lg border border-transparent px-3 text-sm font-medium outline-none transition-[box-shadow,color] focus-visible:ring-3 focus-visible:ring-ring/40`,r===e?`btn-raised bg-card text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,L.jsx)(`div`,{id:`settings-Agents`,hidden:r!==`Agents`,"aria-hidden":r!==`Agents`,children:(0,L.jsx)(nV,{prominent:!0,title:zq.agents,children:(0,L.jsx)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-2`,children:kq.map(n=>(0,L.jsx)(jJ,{kind:n,config:e,models:t,save:o},n))})})}),(0,L.jsx)(`div`,{id:`settings-Workflow`,hidden:r!==`Workflow`,"aria-hidden":r!==`Workflow`,children:(0,L.jsx)(PJ,{config:e,save:o})}),(0,L.jsx)(`div`,{id:`settings-Linting`,hidden:r!==`Linting`,"aria-hidden":r!==`Linting`,children:(0,L.jsx)(RJ,{config:e,save:o})}),(0,L.jsx)(`div`,{id:`settings-Lobby`,hidden:r!==`Lobby`,"aria-hidden":r!==`Lobby`,children:(0,L.jsx)(zJ,{config:e,save:o})}),(0,L.jsx)(`div`,{id:`settings-Classifier`,hidden:r!==`Classifier`,"aria-hidden":r!==`Classifier`,children:(0,L.jsx)(BJ,{config:e,models:t,save:o})}),(0,L.jsx)(`div`,{id:`settings-Appearance`,hidden:r!==`Appearance & notifications`,"aria-hidden":r!==`Appearance & notifications`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,L.jsx)(mJ,{}),(0,L.jsx)(VJ,{}),(0,L.jsx)(HJ,{})]})})]})}function GJ(){return(0,L.jsx)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4 px-5 pt-5 pb-dock sm:px-8 sm:pt-8`,role:`status`,"aria-label":oJ.loading,children:[0,1,2,3].map(e=>(0,L.jsx)(`div`,{className:`h-48 rounded-lg bg-muted motion-safe:animate-pulse`},e))})}function KJ(){let e=Ak(`settings.get`,{},[`status`]),[t,n]=(0,m.useState)(),r=(0,m.useRef)(0),i=(0,m.useCallback)(e=>{r.current=performance.now(),n(e)},[]);return(0,m.useEffect)(()=>{e.data&&e.requestedAt>r.current&&n(e.data.config)},[e.data,e.requestedAt]),!t&&e.error?(0,L.jsx)(wk,{message:`${oJ.loadFailed} ${e.error}`,onRetry:e.reload}):t?(0,L.jsx)(WJ,{config:t,models:e.data?.models??[],onConfig:i}):(0,L.jsx)(GJ,{})}function qJ(){let e=globalThis.DOMParser;if(!e)throw Error(`DOMParser is unavailable`);return new e}var JJ=`default-src 'none'; script-src 'none'; style-src 'unsafe-inline'; img-src 'none'; font-src 'none'; connect-src 'none'; media-src 'none'; frame-src 'none'; object-src 'none'; form-action 'none'; base-uri 'none'`,YJ=new Set(`div span p br hr h1 h2 h3 h4 h5 h6 section article header footer main aside nav ul ol li dl dt dd strong em b i u s small sub sup blockquote pre code table thead tbody tfoot tr th td caption colgroup col figure figcaption style`.split(` `)),XJ=new Set(`class id title role aria-label aria-hidden colspan rowspan scope`.split(` `));function ZJ(e){if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.html!=`string`||t.html.length>1e5)&&!(t.css!==void 0&&(typeof t.css!=`string`||t.css.length>5e4)))return{html:t.html,...typeof t.css==`string`?{css:t.css}:{}}}function QJ(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,``);return/\\|@import|url\s*\(|image-set\s*\(|expression\s*\(|behavior\s*:|-moz-binding/i.test(t)?``:t.replace(/<\/?style/gi,``)}function $J(e){if(!YJ.has(e.localName)||e.namespaceURI!==`http://www.w3.org/1999/xhtml`){e.remove();return}for(let t of[...e.attributes])t.name===`style`?e.setAttribute(`style`,QJ(t.value)):XJ.has(t.name)||e.removeAttribute(t.name);e.localName===`style`&&(e.textContent=QJ(e.textContent??``));for(let t of[...e.children])$J(t)}function eY(e,t){try{return tY(e,t??qJ())}catch{return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${JJ}"><meta name="referrer" content="no-referrer"></head><body><p role="status">Static mockup unavailable. The preview could not be safely rendered.</p></body></html>`}}function tY(e,t){let n=t.parseFromString(e.html,`text/html`);for(let e of[...n.head.children,...n.body.children])$J(e);let r=[...n.head.querySelectorAll(`style`)].map(e=>e.outerHTML).join(``);return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${JJ}"><meta name="referrer" content="no-referrer"><style>body{margin:16px;overflow-wrap:anywhere}*{box-sizing:border-box}${QJ(e.css??``).replace(/</g,`\\3c `)}</style>${r}</head><body>${n.body.innerHTML}</body></html>`}function nY({preview:e,label:t,className:n,frameWidth:r,minWidth:i,onOpen:a}){let o=(0,m.useMemo)(()=>eY(e),[e]),s=(0,m.useRef)(null),[c,l]=(0,m.useState)();if((0,m.useLayoutEffect)(()=>{let e=s.current;if(!r&&!i||!e)return;let t=()=>l({width:e.clientWidth,height:e.clientHeight});if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r,i]),!r&&!i)return(0,L.jsx)(`iframe`,{title:`Static mockup: ${t}`,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:o,className:q(`h-80 w-full rounded-lg border bg-background`,n)});let u=r??Math.max(c?.width??0,i??0),d=c&&c.width>0&&u>0?Math.min(1,c.width/u):1;return(0,L.jsxs)(`div`,{ref:s,className:q(`group/mock relative h-80 w-full overflow-hidden rounded-lg border bg-background`,n),children:[(0,L.jsx)(`iframe`,{title:`Static mockup: ${t}`,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:o,tabIndex:a?-1:void 0,className:q(`absolute top-0 left-0 origin-top-left border-0`,a&&`pointer-events-none`),style:{width:u||`100%`,height:c?c.height/d:`100%`,transform:`scale(${d})`}}),a?(0,L.jsx)(`button`,{type:`button`,"data-compact":``,onClick:a,"aria-label":`Expand the mockup: ${t}`,className:`absolute inset-0 flex items-end justify-end p-2 outline-none focus-visible:ring-3 focus-visible:ring-ring/40 focus-visible:ring-inset`,children:(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-border bg-card/90 px-1.5 py-0.5 text-[0.6875rem] font-medium text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity group-hover/mock:opacity-100 group-focus-within/mock:opacity-100`,children:[(0,L.jsx)(ih,{"aria-hidden":`true`,className:`size-3`}),`Expand`]})}):null]})}var rY=/\s*\(recommended\)\s*$/i,iY=1024,aY=e=>e.replace(rY,``);function oY(e){return!!(e&&(e.htmlPreview||e.image||e.preview))}function sY({option:e}){let t=aY(e.label);return oY(e)?(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[e.htmlPreview?(0,L.jsx)(nY,{preview:e.htmlPreview,label:t,minWidth:iY,className:`h-auto min-h-[18rem] flex-1`}):null,e.image?(0,L.jsx)(`img`,{src:N(e.image),alt:`Mockup: ${t}`,className:`min-h-0 w-full flex-1 rounded-lg border bg-background object-contain`}):null,e.preview?(0,L.jsx)($B,{text:e.preview,className:q(`overflow-auto rounded-lg border bg-background p-4 text-sm`,!e.htmlPreview&&!e.image&&`flex-1`)}):null]}):(0,L.jsx)(`p`,{className:`grid h-full place-items-center p-6 text-sm text-muted-foreground`,children:`No mockup for this option.`})}function cY({options:e,start:t,title:n,picked:r=[],multi:i=!1,onChoose:a,onClose:o,onIndex:s}){let c=Sf(),l=(0,m.useRef)(null),u=(0,m.useRef)(null),[d,f]=(0,m.useState)(()=>Math.min(Math.max(0,t),e.length-1)),p=e[d],h=e.length-1;(0,m.useEffect)(()=>s?.(d),[d,s]),(0,m.useLayoutEffect)(()=>{let e=l.current;e&&(e.scrollLeft=d*e.clientWidth),u.current?.focus()},[]);let g=(0,m.useCallback)(e=>{let t=Math.min(Math.max(0,e),h),n=l.current;f(t),n?.scrollTo({left:t*n.clientWidth,behavior:c?`auto`:`smooth`})},[h,c]);(0,m.useEffect)(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{e.scrollLeft=d*e.clientWidth});return t.observe(e),()=>t.disconnect()},[d]);function _(){let e=l.current;if(!e||e.clientWidth===0)return;let t=Math.round(e.scrollLeft/e.clientWidth);t!==d&&t>=0&&t<=h&&f(t)}function v(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=t.target;if(n.closest(`input, textarea, [contenteditable='true']`))return;let r={ArrowLeft:-1,ArrowRight:1,PageUp:-1,PageDown:1}[t.key];if(r){t.preventDefault(),g(d+r);return}if(t.key===`Home`||t.key===`End`){t.preventDefault(),g(t.key===`Home`?0:h);return}let i=Number(t.key);if(Number.isInteger(i)&&i>=1&&i<=e.length){t.preventDefault(),g(i-1);return}t.key===`Enter`&&a&&!(n instanceof HTMLButtonElement)&&(t.preventDefault(),a(d))}let y=r.includes(d);return(0,L.jsxs)(`div`,{ref:u,tabIndex:-1,"data-autofocus":``,onKeyDown:v,className:`mockup-viewer flex h-full min-h-0 flex-col outline-none`,role:`region`,"aria-label":`Mockups: ${n}`,"aria-roledescription":`carousel`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border px-4 py-3 sm:px-5`,children:[(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Back to the question`,title:`Back · Esc`,onClick:()=>o(d),children:(0,L.jsx)(gh,{"aria-hidden":`true`})}),(0,L.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:n}),(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,"aria-live":`polite`,children:[d+1,` of `,e.length]}),(0,L.jsx)(`div`,{role:`tablist`,"aria-label":`Options`,className:`flex w-full flex-wrap gap-1.5 sm:w-auto`,children:e.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===d,"aria-controls":`mockup-slide-${t}`,"data-compact":``,onClick:()=>g(t),className:q(`inline-flex h-7 max-w-48 items-center gap-1 rounded-lg border px-2.5 text-xs font-medium transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,t===d?`border-primary/50 bg-accent text-foreground`:`border-border text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,L.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t+1}),(0,L.jsx)(`span`,{className:`truncate`,children:aY(e.label)}),r.includes(t)?(0,L.jsx)(Hp,{"aria-label":`picked`,className:`size-3 text-primary`}):null]},t))})]}),(0,L.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{ref:l,onScroll:_,className:`mockup-track flex h-full snap-x snap-mandatory overflow-x-auto overflow-y-hidden overscroll-x-contain`,children:e.map((t,n)=>(0,L.jsxs)(`section`,{id:`mockup-slide-${n}`,role:`tabpanel`,"aria-roledescription":`slide`,"aria-label":`${n+1} of ${e.length}: ${aY(t.label)}`,"aria-hidden":n!==d,className:`flex h-full w-full shrink-0 snap-center snap-always flex-col gap-2 px-4 py-4 sm:px-14`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,L.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[n+1,`.`]}),(0,L.jsx)(`span`,{className:`font-medium`,children:aY(t.label)}),rY.test(t.label)?(0,L.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`Recommended`}):null,r.includes(n)?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-primary`,children:[(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3`}),`picked`]}):null]}),t.description?(0,L.jsx)($B,{text:t.description,className:`text-sm text-muted-foreground`}):null,(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,L.jsx)(sY,{option:t})})]},n))}),d>0?(0,L.jsx)(J,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Previous option`,title:`Previous · ←`,onClick:()=>g(d-1),className:`absolute top-1/2 left-2 -translate-y-1/2 rounded-full max-sm:hidden`,children:(0,L.jsx)(Kp,{"aria-hidden":`true`})}):null,d<h?(0,L.jsx)(J,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Next option`,title:`Next · →`,onClick:()=>g(d+1),className:`absolute top-1/2 right-2 -translate-y-1/2 rounded-full max-sm:hidden`,children:(0,L.jsx)(Jp,{"aria-hidden":`true`})}):null]}),(0,L.jsxs)(`footer`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t border-border px-4 py-3 sm:px-5`,children:[(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`←→`,children:`option`}),a?(0,L.jsx)(KO,{chord:`Enter`,children:i?y?`unpick`:`pick`:`choose`}):null,(0,L.jsx)(KO,{chord:`Esc`,children:`back`})]}),a&&p?(0,L.jsxs)(J,{type:`button`,onClick:()=>a(d),className:`max-w-full`,children:[i&&y?`Unpick`:i?`Pick`:`Choose`,(0,L.jsx)(`span`,{className:`truncate`,children:aY(p.label)})]}):null]})]})}function lY(e,t,n){e.nativeEvent.isComposing||(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),e.key===`Enter`&&e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),t()))}function uY({text:e,disabled:t=!1,onSave:n,onCancel:r}){let[i,a]=(0,m.useState)(e),[o,s]=(0,m.useState)(!1),[c,l]=(0,m.useState)(``),u=(0,m.useRef)(null);(0,m.useEffect)(()=>{u.current?.focus({preventScroll:!0}),u.current?.select()},[]);let d=async()=>{if(!(t||o||!i.trim())){s(!0),l(``);try{await n(i.trim()),r()}catch(e){l(e instanceof Error?e.message:String(e)),s(!1)}}};return(0,L.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,onKeyDown:e=>lY(e,()=>void d(),()=>{o||r()}),children:[(0,L.jsxs)(`label`,{className:`text-sm`,children:[`Edit message`,(0,L.jsx)(gA,{ref:u,value:i,onChange:e=>a(e.target.value),disabled:o,className:`mt-2 max-h-[40vh] min-h-24`})]}),c?(0,L.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Could not save. `,c]}):null,(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(J,{size:`sm`,onClick:()=>void d(),disabled:t||o||!i.trim(),children:o?`Saving…`:`Save`}),(0,L.jsx)(J,{size:`sm`,variant:`ghost`,disabled:o,onClick:r,children:`Cancel`})]})]})}var dY=1200;function fY({question:e}){let[t,n]=(0,m.useState)(),r=tk(t!==void 0,ek.sheet),i=e.options.flatMap((e,t)=>e.mockup?[{option:e,index:t,mockup:e.mockup}]:[]);if(i.length===0)return null;let a=e.options.map(e=>({label:e.label,description:e.description,...e.mockup?{htmlPreview:e.mockup}:{}}));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`ul`,{"aria-label":`Mockups`,className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:i.map(({option:e,index:t,mockup:r})=>(0,L.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,L.jsx)(nY,{preview:r,label:aY(e.label),frameWidth:dY,onOpen:()=>n(t),className:`aspect-[3/2] h-auto`}),(0,L.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[t+1,`.`]}),` `,aY(e.label)]})]},t))}),(0,L.jsx)(qO,{open:t!==void 0&&r,onOpenChange:e=>{e||n(void 0)},label:`Mockups: ${e.text}`,className:`h-[min(92svh,60rem)] max-h-[min(92svh,60rem)] max-w-6xl`,children:t===void 0?null:(0,L.jsx)(cY,{options:a,start:t,title:e.text,onClose:()=>n(void 0)})})]})}function pY({questions:e}){return(0,L.jsx)(`ol`,{className:`mt-1 flex flex-col gap-2`,children:e.map((e,t)=>(0,L.jsxs)(`li`,{className:`card-raised flex flex-col gap-2 rounded-xl border p-3 text-sm`,style:{"--orb":PH(e.from)},children:[(0,L.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,L.jsxs)(`span`,{className:`mt-px inline-flex shrink-0 items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--orb)_12%,transparent)] px-2 py-0.5 text-xs font-medium text-[color-mix(in_oklab,var(--orb)_85%,var(--foreground))]`,children:[(0,L.jsx)(kH,{source:e.from,className:`size-3`}),jH(e.from)]}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsxs)(`span`,{className:`sr-only`,children:[`Question `,t+1,`: `]}),e.text]})]}),e.options.length?(0,L.jsx)(`ul`,{"aria-label":`Options`,className:`flex flex-wrap gap-1.5`,children:e.options.map(e=>(0,L.jsxs)(`li`,{className:`rounded-lg border border-border bg-muted/60 px-2 py-1 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),e.description?` — ${e.description}`:``]},e.label))}):null,(0,L.jsx)(fY,{question:e})]},t))})}function mY({message:e}){let t=e.decided??[];return t.length?(0,L.jsx)(`ul`,{className:`mt-1 flex flex-col gap-1.5`,children:t.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex items-start gap-2 rounded-lg bg-muted/60 px-2.5 py-1.5 text-sm`,children:[(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-success`}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[(0,L.jsx)(`span`,{className:q(`font-medium`,MH(e.from)),children:jH(e.from)}),` `,e.question,` → `,(0,L.jsx)(`strong`,{children:e.answer}),(0,L.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[`decided by the classifier (`,e.probability.toFixed(2),`); comment on the plan to overrule`]})]})]},t))}):null}function hY({message:e,index:t,busy:n,readOnly:r}){let[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(),c=o&&(o.editedAt??0)>(e.editedAt??0)?o:e,l=n||c!==e,u=async n=>{let r=await De(`planner.editMessage`,{messageIndex:t,at:e.at,text:n});s(r.message)},d=!r&&!e.settled?.length&&!i?(0,L.jsxs)(J,{size:`xs`,variant:`ghost`,disabled:l,onClick:()=>a(!0),className:`text-muted-foreground`,children:[(0,L.jsx)(Bh,{"aria-hidden":`true`}),`Edit`]}):null;return(0,L.jsx)(BH,{time:e.at>0?vA(e.at):void 0,head:!0,note:c.editedAt?`(edited)`:void 0,below:d,children:i?(0,L.jsx)(uY,{text:c.text,disabled:n,onSave:u,onCancel:()=>a(!1)}):(0,L.jsx)($B,{text:c.text})})}function gY({message:e,index:t,busy:n,readOnly:r}){if(e.role===`you`)return(0,L.jsx)(hY,{message:e,index:t,busy:n,readOnly:r});let i=e.questions??[];return(0,L.jsxs)(zH,{source:`PLANNER`,name:`Panel`,time:e.at>0?vA(e.at):void 0,head:!0,bubble:i.length===0,aside:i.length?`${i.length} question${i.length===1?``:`s`}`:void 0,children:[i.length>0?(0,L.jsx)(pY,{questions:i}):(0,L.jsx)($B,{text:e.text}),(0,L.jsx)(mY,{message:e})]})}function _Y({messages:e,seed:t,busy:n=!1,readOnly:r=!1}){return(0,L.jsxs)(`div`,{className:`chat-column`,role:`log`,"aria-label":`Panel conversation`,children:[t?(0,L.jsx)(VH,{children:t}):null,e.map((e,t)=>(0,L.jsx)(gY,{message:e,index:t,busy:n,readOnly:r},`${e.at}-${t}`)),n?(0,L.jsx)(zH,{source:`PLANNER`,name:`Panel`,head:!0,live:!0,aside:`the panel is thinking`,children:(0,L.jsx)(HH,{className:`mt-1`})}):null]})}var vY=`ORACLE`,yY=`No draft yet.`,bY=`The draft appears after the panel's first round.`,xY=`What each seat needs`,SY=[`backend`,`designer`,`qa`,`researcher`],CY={backend:`DEV`,designer:`DESIGN`,qa:`QA`,researcher:`RESEARCH`},wY=`Describe a task in the box below. The panel asks what it needs to know, round by round, until the plan is clear.`,TY={ORACLE:`Chairs the panel, and settles the last round alone.`,DEV:`Code, data and the APIs it touches.`,DESIGN:`Screens, flows and the words on them.`,QA:`Tests, edge cases and what could break.`,RESEARCH:`Prior art, docs and sources.`},EY=[{title:`Describe it`,text:`Say what you want in the box below.`},{title:`The panel asks`,text:`Each seat asks what it needs to know.`},{title:`A draft forms`,text:`Answer, comment on lines, go another round.`},{title:`Save the plan`,text:`Keep it, or start it as a task.`}];function DY(e){let t=e.filter(e=>e.member);return`${t.filter(e=>e.seated).length} of ${t.length} seated`}function OY(e,t=0){return t<=0?`round ${e}`:e>t?`round ${e} · past the limit, revising`:e===t?`final round ${e}/${t}`:`round ${e}/${t}`}function kY(e,t){return`${e} ${t}${e===1?``:`s`}`}function AY(e){return e.round===0&&e.messages.length===0&&!e.busy}function jY(e){let t=e.members.find(e=>e.status===`failed`);if(t)return(t.error??`${CY[t.member]} failed`).split(`
97
+ `)[0]}function MY(e){let t=[],n=jY(e);return e.busy?t.push(OY(e.round,e.limit)):n?t.push(`${n} — Retry runs the round again`):e.questions.length>0&&t.push(`${kY(e.questions.length,`question`)} waiting`),!e.busy&&e.round>0&&t.push(OY(e.round,e.limit)),!e.busy&&e.limit>0&&e.round+1===e.limit&&t.push(`the next round is the last: the oracle settles the rest`),t}function NY(e,t){let n=CY[e],r=t.seats.includes(e),i=t.members.find(t=>t.member===e),a={member:e,label:n,seated:r,working:!1};if(!r)return{...a,text:`off`};if(i?.status===`thinking`)return{...a,working:!0,text:i.step??`thinking`};if(i?.status===`failed`)return{...a,text:`failed — Retry`};if(!i)return{...a,text:`·`};if(i.reply?.status===`ready`)return{...a,text:`ready`};let o=t.questions.filter(e=>e.from===n).length;return{...a,text:o===0?`done`:kY(o,`question`)}}function PY(e){let t=e.questions.filter(e=>e.from===vY).length;return[{label:vY,seated:!0,working:e.busy,text:e.busy?`chairing`:t?kY(t,`question`):`·`},...SY.map(t=>NY(t,e))]}function FY(e){let t=!1;return e.split(`
98
+ `).map(e=>{let n=e.trimStart().startsWith("```");return n&&(t=!t),{text:e,fenced:t||n}})}function IY({notes:e}){return(0,L.jsx)(L.Fragment,{children:e.map((e,t)=>(0,L.jsx)(`p`,{className:`ml-6 rounded-lg border border-primary/15 bg-accent px-3 py-1.5 text-sm text-foreground italic`,children:e},t))})}var LY=[],RY=(0,m.memo)(function({row:e,notes:t,onComment:n}){let r=e.text.trim(),i=()=>n(r);return(0,L.jsxs)(`li`,{className:`group/line [contain-intrinsic-size:auto_2.75rem] [content-visibility:auto]`,children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,L.jsx)(`span`,{className:`flex w-4 shrink-0 justify-center pt-3.5`,"aria-hidden":`true`,children:t.length>0?(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-primary`}):null}),(0,L.jsx)(`div`,{className:q(`min-w-0 flex-1 cursor-pointer rounded-lg px-2 py-1.5 transition-colors hover:bg-muted`,e.fenced&&`font-mono text-sm whitespace-pre-wrap break-words`),onClick:e=>!e.target.closest(`a`)&&i(),children:e.fenced?e.text:(0,L.jsx)($B,{text:e.text})}),(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/line:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`,"aria-label":`Comment on this line: ${r}`,onClick:i,children:(0,L.jsx)(uh,{"aria-hidden":`true`})})]}),(0,L.jsx)(IY,{notes:t})]})});function zY({draft:e,comments:t,onComment:n}){let r=(0,m.useMemo)(()=>FY(e),[e]),i=WB(r.length);return(0,L.jsx)(`ul`,{className:`flex flex-col`,"aria-label":`Draft plan lines`,children:r.slice(0,i).map((e,r)=>e.text.trim()?(0,L.jsx)(RY,{row:e,notes:t.get(e.text.trim())??LY,onComment:n},r):(0,L.jsx)(`li`,{"aria-hidden":`true`,className:`h-2`},r))})}function BY({notes:e}){return e.length===0?null:(0,L.jsx)(nV,{title:xY,children:(0,L.jsx)(`dl`,{className:`flex flex-col gap-2 text-sm`,children:e.map((e,t)=>(0,L.jsxs)(`div`,{className:`flex gap-3`,children:[(0,L.jsx)(`dt`,{className:q(`w-20 shrink-0 font-medium`,MH(e.from)),children:jH(e.from)}),(0,L.jsx)(`dd`,{className:`min-w-0 flex-1`,children:(0,L.jsx)($B,{text:e.text})})]},t))})})}function VY({cell:e,intro:t}){let n=t?e.member?e.seated?`seated`:`not seated`:`chairs`:e.text;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:q(`inline-flex items-center gap-1.5 font-medium`,e.seated?MH(e.label):`text-muted-foreground`),children:[(0,L.jsx)(kH,{source:e.label,className:`size-3.5`}),jH(e.label)]}),e.working&&!t?(0,L.jsx)(vk,{className:`size-3.5`,"aria-hidden":`true`}):null,(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:n})]})}function HY({cell:e,intro:t,onToggled:n}){let{member:r}=e,i=`inline-flex min-h-8 items-center gap-2 rounded-lg border border-border px-3 text-[0.8125rem]`;if(!r)return(0,L.jsx)(`li`,{className:q(i,`bg-muted`),children:(0,L.jsx)(VY,{cell:e,intro:t})});let a=async()=>{await H(`planner.toggleSeat`,{member:r})&&n()};return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`label`,{className:q(i,`cursor-pointer transition-colors`,e.seated?`btn-raised bg-card`:`border-dashed text-muted-foreground hover:bg-muted`),children:[(0,L.jsx)(LU,{checked:e.seated,onCheckedChange:()=>void a(),"aria-label":`${jH(e.label)} sits on the panel`}),(0,L.jsx)(VY,{cell:e,intro:t})]})})}function UY({cells:e,intro:t,onToggled:n}){return(0,L.jsx)(`ul`,{"aria-label":`Panel`,className:`flex flex-wrap gap-2`,children:e.map(e=>(0,L.jsx)(HY,{cell:e,intro:t,onToggled:n},e.label))})}function WY({cell:e,onToggled:t}){let{member:n}=e,r=jH(e.label),i=q(`flex h-full flex-col gap-2 rounded-xl border p-3.5 transition-[background-color,border-color,box-shadow]`,e.seated?`border-[color-mix(in_oklab,var(--orb)_26%,var(--border))] bg-[color-mix(in_oklab,var(--orb)_5%,var(--card))] shadow-card`:`border-dashed border-input bg-transparent`),a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:q(`grid size-6 place-items-center rounded-lg bg-[color-mix(in_oklab,var(--orb)_14%,transparent)] text-[color-mix(in_oklab,var(--orb)_85%,var(--foreground))]`,!e.seated&&`opacity-50 grayscale`),children:(0,L.jsx)(kH,{source:e.label,className:`size-3.5`})}),(0,L.jsx)(`span`,{className:q(`truncate text-sm font-semibold`,e.seated?MH(e.label):`text-muted-foreground`),children:r})]}),n?(0,L.jsx)(LU,{checked:e.seated,onCheckedChange:()=>void GY(n,t),"aria-label":`${r} sits on the panel`}):null]}),(0,L.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:TY[e.label]}),(0,L.jsx)(`span`,{className:q(`mt-auto text-xs font-medium`,e.seated?`text-foreground`:`text-muted-foreground`),children:n?e.seated?`seated`:`sits this one out`:`always chairs`})]}),o={"--orb":PH(e.label)};return n?(0,L.jsx)(`li`,{style:o,children:(0,L.jsx)(`label`,{className:q(i,`cursor-pointer`,e.seated?`hover:shadow-[0_0_0_3px_color-mix(in_oklab,var(--orb)_10%,transparent)]`:`hover:bg-muted`),children:a})}):(0,L.jsx)(`li`,{style:o,children:(0,L.jsx)(`div`,{className:i,children:a})})}async function GY(e,t){await H(`planner.toggleSeat`,{member:e})&&t()}function KY({cells:e,onToggled:t}){return(0,L.jsx)(`ul`,{"aria-label":`Panel`,className:`grid grid-cols-1 gap-3 @lg:grid-cols-2 @4xl:grid-cols-5`,children:e.map(e=>(0,L.jsx)(WY,{cell:e,onToggled:t},e.label))})}function qY({snap:e}){let t=MY(e),n=!e.busy&&jY(e)!==void 0;return(0,L.jsxs)(`p`,{role:`status`,className:n?`flex items-center gap-2 text-sm text-destructive`:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e.busy?(0,L.jsx)(vk,{className:`size-3.5`,"aria-hidden":`true`}):null,t.join(` · `)]})}function JY(){return(0,L.jsx)(Y,{label:`Previous plans`,text:`Previous`,icon:Jh,shortcut:`H`,onClick:()=>uk(lk(`plan`,`previous`))})}function YY({snap:e,onDone:t}){let n=Ok(`status`).data?.keys.find(e=>e.action===`savePlan`)?.label,r=e=>async()=>{await H(e,{})&&t()};return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[e.questions.length>0&&!e.busy?(0,L.jsx)(Y,{label:`Answer questions`,icon:ch,tone:`primary`,shortcut:`A`,onClick:()=>void r(`planner.answer`)()}):null,e.retryable?(0,L.jsx)(Y,{label:`Retry`,icon:Qh,shortcut:`R`,onClick:()=>void r(`planner.retry`)()}):null,(0,L.jsx)(JY,{}),(0,L.jsx)(Y,{"data-plan-save":!0,label:`Save the plan`,text:`Save`,icon:ng,shortcut:n??`Ctrl+S`,disabled:!e.draft||e.busy,onClick:()=>void r(`planner.save`)()}),(0,L.jsx)(MA,{icon:Mm,label:`New plan`,shortcut:`N`,title:`Start a new plan?`,description:`The conversation and the draft are left behind. Saved plans are not touched.`,confirmLabel:`New plan`,onConfirm:()=>void H(`planner.new`,{}).then(t)})]})}function XY({snap:e,onDone:t}){return(0,L.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border px-5 py-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:`Planning`}),(0,L.jsx)(qY,{snap:e})]}),(0,L.jsx)(YY,{snap:e,onDone:t})]}),(0,L.jsx)(UY,{cells:PY(e),intro:!1,onToggled:t})]})}var ZY=()=>uk(lk(`plan`,`previous`)),QY=e=>uk(lk(`plan`,`previous`,e));function $Y(e){let t=Date.now()-Date.parse(e);return Number.isFinite(t)?xA(Math.max(0,t)):``}function eX(e,t){return[`${t} message${t===1?``:`s`}`,`round ${e.rounds}`,$Y(e.updatedAt)].filter(Boolean).join(` · `)}function tX({plan:e,selected:t}){return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>QY(e.id),className:VV,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words text-foreground`,t&&`font-medium`),children:e.title}),e.hasDraft?(0,L.jsx)(BV,{variant:`secondary`,children:`draft`}):null]}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:eX(e,e.messages)})]})})}function nX({id:e,onGone:t}){let n=Ak(`planner.previousGet`,{id:e},[`planner`]),r=n.data;if(!r)return n.error?(0,L.jsx)(wk,{message:`Could not load that plan. ${n.error}`,onRetry:n.reload}):null;let i=!!r.archivedAt,a=async()=>{await H(`planner.previousOpen`,{id:e})&&uk(lk(`plan`))},o=async()=>{await H(`planner.previousArchive`,{id:e,archived:!i})&&t()},s=async()=>{await H(`planner.previousDelete`,{id:e})&&t()};return(0,L.jsxs)(`article`,{className:`flex flex-col gap-5`,"aria-label":r.title,children:[(0,L.jsxs)(eA,{children:[(0,L.jsx)(Y,{label:`Carry on planning`,text:`Carry on`,icon:Hh,tone:`primary`,shortcut:`C`,onClick:()=>void a()}),(0,L.jsx)(Y,{label:i?`Bring it back from the archive`:`Archive`,text:i?`Unarchive`:`Archive`,icon:i?wp:Ep,shortcut:`E`,onClick:()=>void o()}),(0,L.jsx)(MA,{icon:wg,label:`Delete`,shortcut:`Delete`,title:`Delete "${r.title}"?`,description:`The conversation and the draft are removed for good.`,confirmLabel:`Delete plan`,variant:`destructive`,onConfirm:()=>void s()})]}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:r.title}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:[i?`archived`:``,eX(r,r.messages.length),r.seed??``].filter(Boolean).join(` · `)})]}),(0,L.jsxs)(nV,{title:`Draft plan`,children:[r.draft?(0,L.jsx)($B,{text:r.draft}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The panel had not written a draft yet.`}),(0,L.jsx)(BY,{notes:r.notes})]}),(0,L.jsx)(nV,{title:`Conversation`,children:(0,L.jsx)(_Y,{messages:r.messages,readOnly:!0})})]})}function rX({id:e}){let t=lA(),[n,r]=(0,m.useState)(!1),i=Ak(`planner.previous`,n?{archived:!0}:{},[`planner`]),a=i.data?.plans??[];if(!i.data&&i.error)return(0,L.jsx)(wk,{message:`Could not load the previous plans. ${i.error}`,onRetry:i.reload});let o=(0,L.jsxs)(mA,{title:n?`Archived plans`:`Previous plans`,count:i.data?String(a.length):void 0,children:[(0,L.jsx)(Y,{label:`Back to the current plan`,icon:Ap,iconOnly:!0,onClick:()=>uk(lk(`plan`))}),(0,L.jsx)(Y,{label:n?`Show the previous plans`:`Show the archived plans`,text:n?`Previous`:`Archived`,icon:n?Jh:Ep,pressed:n,onClick:()=>{r(e=>!e),ZY()}})]}),s=i.data?a.length===0?(0,L.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground`,children:n?`No archived plans.`:`No previous plans. A plan you leave without saving it as a task waits here; one saved as a task is in the Tasks tab.`}):(0,L.jsx)(`ul`,{className:q(HV,`pt-2`),"aria-label":n?`Archived plans`:`Previous plans`,children:a.map(t=>(0,L.jsx)(tX,{plan:t,selected:t.id===e},t.id))}):(0,L.jsx)(hA,{});return(0,L.jsx)(pA,{wide:t,list:(0,L.jsxs)(L.Fragment,{children:[o,s]}),detail:e?(0,L.jsx)(nX,{id:e,onGone:()=>{i.reload(),ZY()}},e):null,open:e!==void 0,onClose:ZY,hint:`Pick a plan to read it, carry it on, archive it or delete it.`,describe:`A previous plan`})}function iX({line:e,onClose:t,onSent:n}){let r=tk(e!==void 0,ek.confirm);return(0,L.jsx)(qO,{open:e!==void 0&&r,onOpenChange:e=>!e&&t(),label:`Comment on this line`,className:`max-w-xl`,children:(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-6`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`text-base font-medium`,children:`Comment on this line`}),(0,L.jsx)(`p`,{className:`mt-1 line-clamp-3 text-sm break-words text-muted-foreground`,children:e})]}),(0,L.jsx)($V,{label:`Your comment`,hint:`Enter adds the comment · Esc cancels`,buttonLabel:`Add comment`,onSend:async r=>e===void 0||!await H(`planner.commentLine`,{line:e,text:r.trim()})?!1:(n(e,r.trim()),t(),!0)})]})})}function aX({limit:e}){return e<=0?null:(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1`,children:Array.from({length:e},(t,n)=>(0,L.jsx)(`span`,{className:q(`h-1.5 w-4 rounded-full`,n===e-1?`bg-primary`:`bg-border`)},n))}),(0,L.jsxs)(`span`,{children:[`up to `,e,` rounds, the last the oracle's`]})]})}function oX({snap:e,onDone:t}){let n=PY(e);return(0,L.jsx)(`div`,{className:`@container flex-1 overflow-y-auto px-5 pt-8 pb-dock sm:px-8 sm:pt-10`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-end @3xl:justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`card-raised grid size-11 shrink-0 place-items-center rounded-xl border text-primary`,children:(0,L.jsx)(eg,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:`Plan with the panel`}),(0,L.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:wY})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-col items-start gap-2 @3xl:items-end`,children:[(0,L.jsx)(JY,{}),(0,L.jsx)(aX,{limit:e.limit})]})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`plan-panel`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`plan-panel`,className:`text-xs text-muted-foreground`,children:(0,L.jsx)(tV,{title:`The panel`,right:DY(n)})}),(0,L.jsx)(KY,{cells:n,onToggled:t})]}),(0,L.jsxs)(`section`,{"aria-labelledby":`plan-steps`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`plan-steps`,className:`text-xs text-muted-foreground`,children:(0,L.jsx)(tV,{title:`How a plan comes together`})}),(0,L.jsx)(`ol`,{className:`grid gap-3 @2xl:grid-cols-2 @4xl:grid-cols-4`,children:EY.map((e,t)=>(0,L.jsxs)(`li`,{className:`card-raised relative flex gap-3 rounded-xl border p-3.5`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-6 shrink-0 place-items-center rounded-full bg-accent text-xs font-semibold text-primary tabular-nums`,children:t+1}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,L.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.text})]})]},e.title))})]}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(Op,{"aria-hidden":`true`,className:`size-4 text-primary motion-safe:animate-bounce`}),`Start in the box below.`,(0,L.jsx)(KO,{chord:`/`,children:`write`}),(0,L.jsx)(KO,{chord:`Enter`,children:`send to the panel`})]})]})})}function sX({snap:e,wide:t}){let{ref:n,onScroll:r}=TH(JSON.stringify(e.messages));return(0,L.jsxs)(uA,{className:`flex flex-col`,children:[(0,L.jsx)(`h2`,{className:`flex min-h-12 shrink-0 items-center border-b border-border px-4 text-sm font-medium`,children:(0,L.jsx)(tV,{title:`Conversation`,className:`w-full`})}),(0,L.jsx)(`div`,{ref:n,onScroll:r,className:q(`min-h-0 overflow-y-auto overscroll-y-contain`,t?`flex-1 px-5 pt-5 pb-dock`:`max-h-[45svh] p-5`),children:(0,L.jsx)(_Y,{messages:e.messages,busy:e.busy})})]})}function cX({snap:e,comments:t,onComment:n,wide:r}){return(0,L.jsxs)(uA,{className:`flex flex-col`,children:[(0,L.jsx)(`h2`,{className:`flex min-h-12 shrink-0 items-center border-b border-border px-4 text-sm font-medium`,children:(0,L.jsx)(tV,{title:`Draft plan`,className:`w-full`})}),(0,L.jsxs)(`div`,{className:q(`flex min-h-0 flex-col gap-5 overflow-y-auto overscroll-y-contain px-5 pt-5 pb-dock`,r&&`flex-1`),children:[e.draft?(0,L.jsx)(zY,{draft:e.draft,comments:t,onComment:n}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.busy?bY:yY}),(0,L.jsx)(BY,{notes:e.notes})]})]})}function lX({snap:e,reload:t}){let n=lA(),[r,i]=(0,m.useState)(),[a,o]=(0,m.useState)(new Map);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(XY,{snap:e,onDone:t}),(0,L.jsxs)(`div`,{className:n?`grid min-h-0 flex-1 grid-cols-[minmax(0,46fr)_minmax(0,54fr)] grid-rows-[minmax(0,1fr)] divide-x divide-border`:`flex flex-col divide-y divide-border`,children:[(0,L.jsx)(sX,{snap:e,wide:n}),(0,L.jsx)(cX,{snap:e,comments:a,onComment:i,wide:n})]}),(0,L.jsx)(iX,{line:r,onClose:()=>i(void 0),onSent:(e,t)=>o(n=>new Map(n).set(e,[...n.get(e)??[],t]))})]})}function uX({rest:e=[]}){return e[0]===`previous`?(0,L.jsx)(rX,{id:e[1]}):(0,L.jsx)(dX,{})}function dX(){let e=Ak(`planner.get`,{},[`planner`]),t=e.data;if(!t&&e.error)return(0,L.jsx)(wk,{message:`Could not load the plan. ${e.error}`,onRetry:e.reload});if(!t)return(0,L.jsx)(`p`,{role:`status`,className:`p-5 text-sm text-muted-foreground`,children:`Loading the plan…`});let n=AY(t);return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:n?(0,L.jsx)(oX,{snap:t,onDone:e.reload}):(0,L.jsx)(lX,{snap:t,reload:e.reload})})}var fX=`Describe a small change in the box below and one agent makes it now, beside any running task.`;function pX(e){return e.prompt.split(`
99
+ `).find(e=>e.trim())?.trim()??`(empty)`}function mX(e){return[...e].reverse()}function hX(e){let t=Number.isFinite(e)?Math.max(0,Math.round(e/1e3)):0,n=Math.floor(t/60);if(n===0)return`${t}s`;let r=t%60;return r===0?`${n}m`:`${n}m ${String(r).padStart(2,`0`)}s`}function gX(e,t){return e.startedAt?hX((e.finishedAt??t)-e.startedAt):``}function _X(e,t){let n=e.model?`${e.model}${e.thinking?` · ${e.thinking}`:``}`:e.thinking??``;return[gX(e,t),n,e.tools?`${e.tools} tool${e.tools===1?``:`s`}`:``,e.usage?.cost?`$${e.usage.cost.toFixed(2)}`:``].filter(Boolean).join(` · `)}function vX(e){return e===`queued`?`Waiting for the quick fix ahead of it.`:e===`running`?`starting…`:e===`held`?`Not started.`:`No tool calls.`}function yX({job:e}){let t=e.status===`held`;return(0,L.jsxs)(L.Fragment,{children:[e.route?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Routed `,e.route]}):null,e.note&&t?(0,L.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-sm text-foreground`,children:[(0,L.jsx)(Eg,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,L.jsxs)(`span`,{children:[`Held: `,e.note,`.`]})]}):null,e.note&&!t?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.routed?`Routed here by the oracle — ${e.note}`:e.note}):null,e.routed&&!e.note?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Routed here by the oracle.`}):null]})}function bX({job:e}){let t=e.status===`running`;return e.steps.length===0?(0,L.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[t?(0,L.jsx)(vk,{className:`size-3.5`}):null,vX(e.status)]}):(0,L.jsx)(`ol`,{className:`flex flex-col gap-1 text-sm`,children:e.steps.map((e,n)=>(0,L.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:vA(e.at)}),(0,L.jsx)(`span`,{className:`flex h-5 w-3.5 shrink-0 items-center justify-center`,"aria-hidden":`true`,children:e.pending&&t?(0,L.jsx)(vk,{className:`size-3.5`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})}),(0,L.jsx)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:e.pending&&t?`${e.text}…`:e.text})]},n))})}function xX({job:e}){return e.status===`held`?(0,L.jsxs)(eA,{children:[(0,L.jsx)(Y,{label:`Run anyway`,icon:Hh,tone:`primary`,shortcut:`R`,onClick:()=>void H(`quickfix.runAnyway`,{id:e.id})}),(0,L.jsx)(Y,{label:`Turn it into a task`,text:`Make it a task`,icon:eh,shortcut:`T`,onClick:()=>void H(`quickfix.movedToTask`,{id:e.id})})]}):e.status!==`queued`&&e.status!==`running`?null:(0,L.jsx)(eA,{children:(0,L.jsx)(MA,{icon:um,label:`Cancel the quick fix`,text:`Cancel`,shortcut:`C`,title:`Cancel this quick fix?`,description:`The agent stops. Files it already edited stay as they are.`,confirmLabel:`Cancel quick fix`,variant:`destructive`,onConfirm:()=>void H(`quickfix.cancel`,{id:e.id})})})}function SX({job:e,now:t}){return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":`Quick fix detail`,children:[(0,L.jsx)(xX,{job:e}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight break-words`,children:pX(e)}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded-md bg-accent px-2 py-0.5 text-xs font-medium text-foreground`,children:e.status}),_X(e,t)?(0,L.jsx)(`span`,{children:_X(e,t)}):null]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:e.id})]}),e.prompt.trim().includes(`
100
+ `)?(0,L.jsx)($B,{text:e.prompt}):null,(0,L.jsx)(yX,{job:e}),(0,L.jsx)(nV,{title:`Steps`,children:(0,L.jsx)(bX,{job:e})}),e.files?.length?(0,L.jsx)(nV,{title:`Edited`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm text-muted-foreground`,children:e.files.map(e=>(0,L.jsxs)(`li`,{className:`break-all`,children:[`· `,e]},e))})}):null,e.error?(0,L.jsx)(`p`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:e.error}):null,e.report?(0,L.jsx)(nV,{title:`Report`,children:(0,L.jsx)($B,{text:e.report})}):null]})}function CX({status:e}){if(e===`running`)return(0,L.jsx)(vk,{className:`size-3.5`,"aria-label":`running`});let t={queued:gm,success:Hp,failed:Hg,timeout:Hg,cancelled:bh,held:Mh,running:gm}[e];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(t,{"aria-hidden":`true`,className:`size-4 ${e===`success`?`text-success`:e===`failed`||e===`timeout`?`text-destructive`:e===`held`?`text-warning`:`text-muted-foreground`}`}),(0,L.jsx)(`span`,{className:`sr-only`,children:e})]})}function wX({job:e,selected:t,now:n,onSelect:r}){let i=gX(e,n);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>r(e.id),className:q(VV,`flex-row items-start gap-2.5 text-sm`),children:[(0,L.jsx)(`span`,{className:`flex h-5 w-4 shrink-0 items-center justify-center`,children:(0,L.jsx)(CX,{status:e.status})}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words`,t?`font-medium text-foreground`:`text-foreground`),children:pX(e)}),i?(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:i}):null]})})}function TX({jobs:e,selectedId:t,now:n,onSelect:r}){return(0,L.jsx)(`ul`,{className:HV,children:e.map(e=>(0,L.jsx)(wX,{job:e,selected:e.id===t,now:n,onSelect:r},e.id))})}var EX=()=>uk(lk(`quickfix`)),DX=e=>uk(lk(`quickfix`,e));function OX(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),e?t:Date.now()}function kX(){return(0,L.jsx)(fk,{className:`m-4 flex-1`,children:(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(Wg,{"aria-hidden":`true`})}),(0,L.jsx)(_k,{className:`font-medium text-foreground`,children:fX})]})})}function AX({id:e}){let t=lA(),n=Ak(`quickfix.list`,{},[`quickfix`]),r=mX(n.data?.jobs??[]),i=OX(r.some(e=>e.status===`running`));if(!n.data&&n.error)return(0,L.jsx)(wk,{message:`Could not load quick fixes. ${n.error}`,onRetry:n.reload});let a=n.data&&r.length===0?(0,L.jsx)(kX,{}):(0,L.jsx)(jX,{id:e,wide:t,loaded:!!n.data,jobs:r,now:i});return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:a})}function jX({id:e,wide:t,loaded:n,jobs:r,now:i}){let a=e??(t?r[0]?.id:void 0),o=r.find(e=>e.id===a),s=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:`Quick fixes`,count:String(r.length)}),n?(0,L.jsx)(TX,{jobs:r,selectedId:a,now:i,onSelect:DX}):(0,L.jsx)(hA,{})]});return(0,L.jsx)(pA,{wide:t,list:s,detail:o?(0,L.jsx)(SX,{job:o,now:i}):e?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That quick fix is not on the list any more.`}):null,open:!!e,onClose:EX,hint:`Select a quick fix to see its steps.`,describe:`Quick fix detail`})}var MX={},NX=new Set;function PX(e){MX=e;for(let e of[...NX])e()}function FX(e){MX.taskId!==e&&PX({...MX,taskId:e})}function IX(e){(MX.session?.name!==e?.name||JSON.stringify(MX.session?.address)!==JSON.stringify(e?.address))&&PX({...MX,session:e})}function LX(e){return NX.add(e),()=>{NX.delete(e)}}function RX(){return(0,m.useSyncExternalStore)(LX,()=>MX,()=>MX)}function zX({entry:e}){let t=e.at?vA(e.at):``;return e.role===`note`?(0,L.jsxs)(`li`,{className:`text-center text-xs text-muted-foreground`,children:[e.text,t?` · ${t}`:``]}):e.role===`you`?(0,L.jsxs)(`li`,{className:`flex flex-col items-end gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2 text-xs text-muted-foreground`,children:[t,` `,(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:`You`})]}),(0,L.jsx)(`div`,{className:`max-w-[85%] rounded-xl rounded-tr-sm border border-primary/10 bg-you px-3.5 py-2`,children:(0,L.jsx)($B,{text:e.text})})]}):(0,L.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full bg-primary`}),(0,L.jsx)(`span`,{className:`font-medium text-foreground`,children:`Oracle`}),` `,t]}),(0,L.jsx)(`div`,{className:`max-w-[90%] pl-4`,children:(0,L.jsx)($B,{text:e.text})})]})}function BX({entries:e,more:t,loading:n,onMore:r,empty:i}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t?(0,L.jsx)(`div`,{className:`flex self-center`,children:(0,L.jsx)(Y,{label:`Load earlier messages`,icon:Qp,disabled:n,onClick:r??(()=>void 0)})}):null,e.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i}):(0,L.jsx)(`ol`,{"aria-label":`Conversation`,className:`flex flex-col gap-4`,children:e.map(e=>(0,L.jsx)(zX,{entry:e},e.id))})]})}function VX({address:e,empty:t}){let n=Ak(`sessions.chat`,e,[`sessions`]),[r,i]=(0,m.useState)(),[a,o]=(0,m.useState)(!1),s=n.data?.entries??[],c=new Set(s.map(e=>e.id)),l=[...(r?.entries??[]).filter(e=>!c.has(e.id)),...s],u=async()=>{let t=l[0];if(!t)return;o(!0);let n=await H(`sessions.chat`,{...e,before:t.id});n&&i({entries:[...n.entries,...r?.entries??[]],more:n.hasOlder}),o(!1)},d=r?.more??n.data?.hasOlder??!1;return(0,L.jsx)(BX,{entries:l,more:d,loading:a,onMore:()=>void u(),empty:n.loading&&!n.data?`Loading the conversation…`:t})}var HX={"this window":`This window`,background:`Background`,"other terminal":`Other terminals`},UX=[`this window`,`background`,`other terminal`],WX=`Nothing said yet.`,GX=`This session runs in another terminal: its conversation shows here and your messages reach its oracle within seconds, but live activity only streams from sessions started in this window.`,KX=`No other sessions. Start one below.`;function qX(e,t,n){let r=t?.task;return{id:`here`,where:`this window`,name:e?.sessionName??r?.title??`unnamed session`,status:e?.busy?`working`:r?.state??`no task`,waiting:n,alive:!0,dialogs:[],...r?{task:r}:{}}}function JX(e){let t=e.status===`exited`?`ended`:e.status===`starting`?`starting`:e.busy?`working`:`idle`;return{id:e.key,where:`background`,name:e.name,status:t,waiting:e.dialogs.length,key:e.key,alive:e.alive,dialogs:e.dialogs,...e.sessionId?{sessionId:e.sessionId}:{}}}function YX(e){return{id:e.sessionId,where:`other terminal`,name:e.name??`unnamed session`,status:`running`,waiting:0,pid:e.pid,sessionId:e.sessionId,alive:!0,dialogs:[]}}function XX(e,t,n,r,i){let a=new Set([e?.sessionId,...r.map(e=>e.sessionId)].filter(e=>!!e)),o=i.filter(e=>!a.has(e.sessionId));return[qX(e,t,n),...r.map(JX),...o.map(YX)]}function ZX(e){return`${e} question${e===1?``:`s`} waiting for you`}function QX(e){return e.status===`starting`?`starting ${e.name}…`:e.alive?`${e.name} has not said anything yet.`:`${e.name} has ended.`}function $X(e){return[e.where,e.status.replace(/_/g,` `),e.pid?`pid ${e.pid}`:``].filter(Boolean).join(` · `)}function eZ(e){return e.key?{key:e.key}:e.sessionId?{sessionId:e.sessionId}:void 0}function tZ({options:e,send:t}){return(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,L.jsx)(J,{variant:`outline`,onClick:()=>void t({value:e}),children:e},e))})}function nZ({dialog:e,send:t}){let n=(0,m.useId)(),[r,i]=(0,m.useState)(e.prefill??``);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:n,className:`sr-only`,children:e.title}),(0,L.jsx)(gA,{id:n,rows:e.method===`editor`?4:2,value:r,placeholder:e.placeholder,onChange:e=>i(e.target.value)}),(0,L.jsx)(`div`,{className:`flex self-end`,children:(0,L.jsx)(Y,{label:`Send the answer`,text:`Send`,icon:Pp,tone:`primary`,disabled:!r.trim(),onClick:()=>void t({value:r.trim()})})})]})}function rZ({dialog:e,send:t}){return e.method===`select`?(0,L.jsx)(tZ,{options:e.options??[],send:t}):e.method===`confirm`?(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(J,{onClick:()=>void t({confirmed:!0}),children:`Yes`}),(0,L.jsx)(J,{variant:`outline`,onClick:()=>void t({confirmed:!1}),children:`No`})]}):(0,L.jsx)(nZ,{dialog:e,send:t})}function iZ({sessionKey:e,dialog:t,onAnswered:n}){let r=async r=>{await H(`sessions.answer`,{key:e,dialogId:t.id,answer:r})&&n()};return(0,L.jsxs)(`div`,{className:`card-raised flex flex-col gap-3 rounded-lg border p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:t.title}),t.message?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.message}):null]}),(0,L.jsx)(rZ,{dialog:t,send:r}),(0,L.jsx)(`div`,{className:`flex self-start`,children:(0,L.jsx)(Y,{label:`Put it away`,text:`Put away`,icon:Hg,onClick:()=>void r({cancelled:!0})})})]})}function aZ({sessionKey:e,dialogs:t,onAnswered:n}){return t.length===0?null:(0,L.jsxs)(`section`,{"aria-label":`Questions waiting`,className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-foreground`,children:ZX(t.length)}),t.map(t=>(0,L.jsx)(iZ,{sessionKey:e,dialog:t,onAnswered:n},t.id))]})}var oZ={"this window":Sh,background:Xm,"other terminal":fg};function sZ({where:e,className:t}){let n=oZ[e];return(0,L.jsx)(n,{"aria-hidden":`true`,className:q(`size-4 shrink-0 text-muted-foreground`,t)})}function cZ({task:e}){let t=e.progress;return(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`break-all`,children:e.id}),t&&t.total>0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(fG,{done:t.done,total:t.total}),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[t.done,`/`,t.total]})]}):null]})}function lZ({entry:e}){let{key:t}=e;return e.where===`this window`?(0,L.jsx)(eA,{children:(0,L.jsx)(Y,{label:`Back to this window`,text:`Back to the Lobby`,icon:Ap,tone:`primary`,shortcut:`B`,onClick:()=>uk(`#/lobby`)})}):t?(0,L.jsxs)(eA,{children:[(0,L.jsx)(Y,{label:`Move here`,icon:Mp,tone:`primary`,shortcut:`M`,onClick:()=>void H(`sessions.switch`,{key:t})}),(0,L.jsx)(MA,{icon:um,label:`Stop the session`,text:`Stop`,shortcut:`S`,title:`Stop ${e.name}?`,description:`Its process ends. The task keeps its state and can be resumed in this window.`,confirmLabel:`Stop session`,variant:`destructive`,disabled:!e.alive,onConfirm:()=>void H(`sessions.stop`,{key:t})})]}):null}function uZ({entry:e,lobby:t}){let n=eZ(e);return e.where===`this window`?(0,L.jsx)(BX,{entries:t?.chat??[],more:!1,empty:WX}):n?(0,L.jsx)(VX,{address:n,empty:e.where===`other terminal`?`Nothing said in this session yet.`:QX(e)},e.id):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:WX})}function dZ({entry:e,lobby:t,onChanged:n}){return(0,L.jsxs)(`article`,{"aria-label":`Session detail`,className:`flex flex-col gap-4`,children:[(0,L.jsx)(lZ,{entry:e}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`h3`,{className:`flex items-center gap-2.5 text-lg font-semibold tracking-tight text-foreground`,children:[(0,L.jsx)(sZ,{where:e.where,className:`size-[1.1rem]`}),e.name]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:$X(e)}),e.task?(0,L.jsx)(cZ,{task:e.task}):null,e.where!==`background`&&e.waiting>0?(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:ZX(e.waiting)}):null]}),e.where===`other terminal`?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:GX}):null,e.key?(0,L.jsx)(aZ,{sessionKey:e.key,dialogs:e.dialogs,onAnswered:n}):null,(0,L.jsx)(nV,{title:`Conversation`,children:(0,L.jsx)(uZ,{entry:e,lobby:t})})]})}function fZ({entry:e,selected:t,onSelect:n}){let r=Sf();return(0,L.jsx)(z.li,{layout:!r&&`position`,initial:!1,"data-slot":`active-session`,className:`border-t border-border first:border-t-0`,children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:q(VV,`flex-row items-start gap-3 rounded-none px-4 py-3 text-sm focus-visible:ring-inset`),children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 grid size-8 shrink-0 place-items-center rounded-lg bg-foreground/4 text-foreground/75 shadow-[inset_0_0_0_1px_var(--border)]`,children:(0,L.jsx)(sZ,{where:e.where})}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,L.jsxs)(`span`,{className:q(`flex flex-wrap items-center gap-2 break-words text-foreground`,t&&`font-medium`),children:[e.name,e.where===`this window`?(0,L.jsx)(BV,{variant:`secondary`,radius:`full`,size:`sm`,children:`This window`}):null]}),(0,L.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[e.status===`working`||e.status===`starting`?(0,L.jsx)(vk,{className:`size-3`,"aria-hidden":`true`}):null,e.status.replace(/_/g,` `),e.waiting>0?(0,L.jsxs)(BV,{variant:`warning-light`,radius:`full`,className:`text-warning tabular-nums`,children:[e.waiting,` waiting`]}):null]})]})]})})}function pZ({where:e,entries:t,selectedId:n,onSelect:r}){return(0,L.jsxs)(`section`,{"aria-label":HX[e],className:`flex flex-col`,children:[(0,L.jsx)(`h3`,{className:UV,children:(0,L.jsx)(tV,{title:HX[e],right:String(t.length),className:`[&>span:first-child]:font-medium [&>span:first-child]:text-muted-foreground`})}),(0,L.jsx)(`ul`,{className:`mx-3 mb-2 flex flex-col overflow-hidden rounded-xl border border-border bg-card shadow-xs`,children:t.map(e=>(0,L.jsx)(fZ,{entry:e,selected:e.id===n,onSelect:r},e.id))})]})}function mZ({entries:e,selectedId:t,onSelect:n}){return(0,L.jsx)(`div`,{className:`flex flex-col pb-2`,children:UX.map(r=>{let i=e.filter(e=>e.where===r);return i.length>0?(0,L.jsx)(pZ,{where:r,entries:i,selectedId:t,onSelect:n},r):null})})}var hZ=()=>uk(`#/sessions`),gZ=e=>uk(`#/sessions/${encodeURIComponent(e)}`);function _Z({windows:e}){return e.length===0?null:(0,L.jsx)(`div`,{className:`px-4 pb-4 pt-2`,children:(0,L.jsx)(nV,{title:`Other windows`,children:(0,L.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-h-8 items-center rounded-lg px-2.5 text-sm text-foreground underline-offset-4 transition-colors hover:bg-muted hover:underline`,children:e.name})},e.url))})})})}function vZ(){return(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That session is not on the list any more.`})}function yZ({id:e}){let t=lA(),n=Ok(`status`).data,r=Ok(`lobby`).data,i=Ok(`prompts`).data?.prompts.length??0,a=Ak(`sessions.list`,{},[`sessions`]);if(!a.data&&a.error)return(0,L.jsx)(wk,{message:`Could not load sessions. ${a.error}`,onRetry:a.reload});let o=XX(n,r,i,a.data?.background??[],a.data?.live??[]),s=e??(t?o[0]?.id:void 0),c=o.find(e=>e.id===s),l=c&&c.where!==`this window`&&c.alive?eZ(c):void 0,u=l?JSON.stringify(l):``,d=c?.name;(0,m.useEffect)(()=>(IX(l&&d?{name:d,address:l}:void 0),()=>IX(void 0)),[u,d]);let f=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:`Sessions`,count:String(o.length)}),a.data?(0,L.jsx)(mZ,{entries:o,selectedId:s,onSelect:gZ}):(0,L.jsx)(hA,{}),a.data&&o.length===1?(0,L.jsx)(`p`,{className:`px-4 pb-3 text-sm text-muted-foreground`,children:KX}):null,(0,L.jsx)(_Z,{windows:n?.windows??[]})]}),p=c?(0,L.jsx)(dZ,{entry:c,lobby:r,onChanged:a.reload},c.id):e?(0,L.jsx)(vZ,{}):null;return(0,L.jsx)(pA,{wide:t,list:f,detail:p,open:!!e,onClose:hZ,hint:`Select a session to see its conversation.`,describe:`Session detail`})}function bZ({timing:e,stopped:t}){let[n,r]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(r(0),t||e.waiting||!e.runningSince)return;let n=performance.now(),i=window.setInterval(()=>r(performance.now()-n),1e3);return()=>window.clearInterval(i)},[e,t]),(0,L.jsxs)(`span`,{className:`tabular-nums`,children:[e.waiting?`Waiting for you · `:``,e.phase.replaceAll(`_`,` `),` · `,sG(oG(e,n,t)),` execution`]})}function xZ({work:e,timing:t,stopped:n}){let r=e.running&&!n&&!t?.waiting,i=cG(r,e);return(0,L.jsxs)(`span`,{className:`tabular-nums`,"data-work-clock":r?`running`:`stopped`,children:[t?.waiting?`Waiting for you · `:``,t?`${t.phase.replaceAll(`_`,` `)} · `:``,`worked `,sG(e.workedMs+i)]})}function SZ({timing:e,work:t,stopped:n=!1}){return t?(0,L.jsx)(xZ,{work:t,...e?{timing:e}:{},stopped:n}):e?(0,L.jsx)(bZ,{timing:e,stopped:n},JSON.stringify(e)):(0,L.jsx)(`span`,{children:`Timing unavailable`})}var CZ=`This merges the reviewed commit into main and pushes main, then removes the task worktree after verifying the merge. The task branch is kept.`,wZ={pending_approval:`Ready for your review`,deferred:`Saved for later`,in_progress:`Delivery in progress`,successful:`Delivered`,recoverable_failure:`Delivery needs attention`};function TZ({delivery:e,title:t}){return(0,L.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,L.jsx)(`p`,{className:`font-medium break-words`,children:t}),(0,L.jsxs)(`dl`,{className:`grid gap-1 break-all text-muted-foreground`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Project: `}),(0,L.jsx)(`dd`,{className:`inline`,children:e.project})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Repository: `}),(0,L.jsx)(`dd`,{className:`inline`,children:e.repository??`Unavailable — refresh review`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Source: `}),(0,L.jsxs)(`dd`,{className:`inline`,children:[e.sourceBranch,` · `,e.sourceCommit??`Commit unavailable`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`inline`,children:`Target: `}),(0,L.jsxs)(`dd`,{className:`inline`,children:[`main`,e.targetCommit?` · ${e.targetCommit}`:``]})]})]}),(0,L.jsxs)(`p`,{children:[`Checks: `,e.verification?.checks??`unavailable`]}),(0,L.jsx)(`p`,{children:e.verification?.summary??`Verification unavailable. Refresh the review before delivery.`}),e.verification?(0,L.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Local completion/QA: `,e.verification.localVerified?`passed`:`not verified`,` · Repository rules: `,e.verification.rulesKnown?`known`:`unavailable`,e.verification.requiredChecks.length?` · Required: ${e.verification.requiredChecks.join(`, `)}`:``]}):null]})}function EZ({action:e,delivery:t,busy:n,onAction:r}){let i=t.blocked[e],a=e===`merge_main`&&t.status===`successful`&&!!t.cleanupError,o=n||t.status===`in_progress`||t.status===`successful`&&!a||!!i;return(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(J,{variant:`outline`,disabled:o,onClick:()=>r(e),children:e===`create_pr`?`Create PR`:a?`Retry worktree cleanup`:`Merge to main`}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e===`create_pr`?`Pushes the task branch and opens a PR targeting main. Does not merge.`:a?`Main was delivered. Removes the retained worktree after confirmation.`:`Updates and pushes main, then removes the task worktree. Requires confirmation.`}),i?(0,L.jsxs)(`p`,{className:`text-sm text-destructive`,children:[i,` Refresh review after resolving this restriction, then choose the action again.`]}):null]})}async function DZ(e,t,n){let r={taskId:t,reviewId:n};return e===`refresh`?De(`tasks.deliveryReview`,{taskId:t}):e===`defer`?De(`tasks.deliveryDefer`,r):De(`tasks.deliver`,{...r,action:e,...e===`merge_main`?{confirmMain:!0}:{}})}function OZ({taskId:e,delivery:t}){let[n,r]=(0,m.useState)(t),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(),[c,l]=(0,m.useState)(!1),u=(0,m.useRef)(null),d=M(),f=`${d}:${e}`,p=(0,m.useRef)(f);return p.current=f,(0,m.useEffect)(()=>(p.current=f,()=>{p.current=``}),[f]),(0,m.useEffect)(()=>{r(t),l(!1)},[t,e]),{current:n,setCurrent:r,busy:i,setBusy:a,error:o,setError:s,confirm:c,setConfirm:l,trigger:u,project:d,identity:f,scope:p}}function kZ(e){return e.scope.current===e.identity&&e.project===M()}function AZ(e,t){let n=(0,m.useRef)(!1);async function r(r){if(!(n.current||r===`merge_main`&&!e.confirm)){n.current=!0,e.setBusy(!0),e.setError(void 0),e.setConfirm(!1);try{let n=await DZ(r,t.taskId,e.current.reviewId);kZ(e)&&(e.setCurrent(n.delivery),t.onChanged())}catch(t){kZ(e)&&e.setError(t instanceof Error?t.message:String(t))}finally{n.current=!1,e.scope.current&&e.setBusy(!1)}}}return r}function jZ(e){let t=OZ(e),n=AZ(t,e),r=tk(t.confirm,ek.confirm),i=t.current.status===`successful`||t.current.status===`in_progress`;function a(){t.trigger.current=document.activeElement,t.setConfirm(!0)}return{...t,request:n,slot:r,terminal:i,reviewMerge:a}}function MZ({review:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Task completion is recorded separately. Nothing is published without your approval.`}),(0,L.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.busy?`Updating delivery…`:e.current.operation?`Operation: ${e.current.operation.stage}`:wZ[e.current.status]}),e.current.error||e.error?(0,L.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[e.error??e.current.error,` Completed work is retained. Refresh review to reconcile the result before retrying.`]}):null,e.current.cleanupError?(0,L.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[e.current.cleanupError,` Retry cleanup after resolving it.`]}):null,e.current.operation?.worktreeRemoved?(0,L.jsx)(`p`,{className:`text-sm`,children:`Task worktree removed.`}):null,e.current.result?(0,L.jsxs)(`p`,{className:`text-sm break-all`,children:[e.current.result.action===`create_pr`?`PR #${e.current.result.pullNumber??``} created`:`main pushed · ${e.current.result.commit??``}`,e.current.result.pullUrl?(0,L.jsxs)(`span`,{children:[` · `,e.current.result.pullUrl]}):null]}):null]})}function NZ({review:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(EZ,{action:`create_pr`,delivery:e.current,busy:e.busy,onAction:()=>void e.request(`create_pr`)}),(0,L.jsx)(EZ,{action:`merge_main`,delivery:e.current,busy:e.busy,onAction:e.reviewMerge})]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,L.jsx)(J,{variant:`ghost`,disabled:e.busy,onClick:()=>void e.request(`refresh`),children:`Refresh review`}),(0,L.jsx)(J,{variant:`ghost`,disabled:e.busy||e.terminal,onClick:()=>void e.request(`defer`),children:`Not now`})]})]})}function PZ({review:e}){let t=e.current.status===`successful`&&!!e.current.cleanupError,n=t?`Main was already delivered. Remove the task worktree if it still contains only the reviewed commit. The task branch is kept.`:CZ;return(0,L.jsx)(qO,{open:e.slot,onOpenChange:e.setConfirm,label:t?`Confirm worktree removal`:`Confirm merge to main`,description:n,onCloseAutoFocus:t=>{t.preventDefault(),requestAnimationFrame(()=>e.trigger.current?.focus())},children:(0,L.jsxs)(`div`,{className:`grid gap-4 p-4`,children:[(0,L.jsx)(`h3`,{className:`font-medium`,children:t?`Remove task worktree?`:`Merge to main?`}),(0,L.jsx)(`p`,{className:`text-sm`,children:n}),(0,L.jsxs)(`p`,{className:`break-all text-sm text-muted-foreground`,children:[e.current.repository,` · `,e.current.sourceCommit,` → main`]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(J,{variant:`outline`,onClick:()=>e.setConfirm(!1),children:`Cancel`}),(0,L.jsx)(J,{disabled:e.busy||!!e.current.blocked.merge_main||e.terminal&&!t,onClick:()=>void e.request(`merge_main`),children:t?`Confirm worktree removal`:`Confirm merge and push main`})]})]})})}function FZ({title:e,review:t}){return(0,L.jsxs)(nV,{title:`Completed work · delivery review`,right:wZ[t.current.status],children:[(0,L.jsx)(TZ,{delivery:t.current,title:e}),(0,L.jsx)(MZ,{review:t}),(0,L.jsx)(NZ,{review:t}),(0,L.jsx)(PZ,{review:t})]})}function IZ(e){let t=jZ(e);return(0,L.jsx)(FZ,{title:e.title,review:t})}var LZ={open:mm,delivered:om,addressed:nm},RZ={open:`waiting for the owning session`,delivered:`sent to the oracle`,addressed:`plan amended`};function zZ({comment:e}){let t=xA(Date.now()-Date.parse(e.createdAt)),n=LZ[e.status];return(0,L.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(n,{"aria-hidden":`true`,className:e.status===`addressed`?`size-3.5 text-success`:`size-3.5`}),RZ[e.status],`, `,t,e.editedAt?` (edited)`:``]})}function BZ({comment:e,taskId:t,own:n}){let[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)(),s=a&&(a.editedAt??``)>(e.editedAt??``)?a:e;return(0,L.jsxs)(`li`,{className:`card-raised rounded-lg border px-3.5 py-2.5`,children:[r?(0,L.jsx)(uY,{text:s.text,onSave:async n=>{let r=await De(`tasks.editComment`,{taskId:t,commentId:e.id,text:n});o(r.comment)},onCancel:()=>i(!1)}):(0,L.jsx)($B,{text:s.text}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(zZ,{comment:s}),n&&!r?(0,L.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>i(!0),children:`Edit`}):null]})]})}function VZ({taskId:e,finished:t,canComment:n}){let r=Ak(`tasks.comments`,{taskId:e},[`tasks`]),i=Ok(`status`),a=r.data?.comments??[],o=a.filter(e=>e.status!==`addressed`).length;return(0,L.jsxs)(`section`,{"aria-labelledby":`comments-${e}`,className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h3`,{id:`comments-${e}`,className:`text-sm`,children:(0,L.jsx)(tV,{title:`Comments`,right:o>0?`${o} open`:void 0})}),a.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t?`No comments.`:n?`No comments yet. Comment on the plan in the box below (Markdown and images work); the oracle amends it.`:`No comments yet.`}):(0,L.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:a.map(t=>(0,L.jsx)(BZ,{taskId:e,comment:t,own:!!(t.by&&t.by===i.data?.sessionId)},`${e}-${t.id}`))})]})}var HZ={mine:`This session`,others:`Other sessions`,pending:`Pending`,recent:`Finished`,archived:`Archived`},UZ={open:`open`,done:`done`,dropped:`abandoned`},WZ={none:{label:`None`,depth:`nothing that runs changed: the engine's checks decide, no QA agent`,tone:`bg-accent text-muted-foreground`},low:{label:`Low`,depth:`a light check: the diff, the nearest tests, done once confident`,tone:`bg-success/10 text-success`},medium:{label:`Medium`,depth:`a standard check: the acceptance criteria and realistic regressions`,tone:`bg-warning/10 text-warning`},high:{label:`High`,depth:`a deep, adversarial review: invariants, recovery and everything the change reaches`,tone:`bg-destructive/10 text-destructive`}};function GZ(e){let t=e.source===`classifier`?`Jev`:`rules`;if(!e.qaRequired)return`${t} · no QA agent`;let{min:n,max:r}=e.testBudget;return`${t} · ${n===r?r:`${n}-${r}`} new tests at most`}var KZ=`No tasks yet. Start one from the Lobby tab, or plan one in the Plan tab.`;function qZ(e,t){return`${e.replace(/_/g,` `)}${t?` · paused`:``}`}function JZ(e){return e===`now`?`just now`:`${e} ago`}function YZ(e){if(e.kind===`plan`)return[`planned`,e.age?e.age===`now`?`saved just now`:`saved ${e.age} ago`:``,e.issue?`#${e.issue}`:``].filter(Boolean).join(` · `);let t=e.owner??(e.section===`mine`?`this session`:``);return[qZ(e.status,e.paused),e.auto?`auto`:``,t].filter(Boolean).join(` · `)}function XZ(e){let t=[];for(let n of e){let e=t.at(-1);e&&e.section===n.section?e.rows.push(n):t.push({section:n.section,rows:[n]})}return t}function ZZ(e){let t=e.filter(e=>e.kind!==`archived`),n=t.filter(e=>e.check===`open`).length,r=t.length-n,i=e.length-t.length;return[n?`${n} open`:``,r?`${r} finished`:``,i?`${i} archived`:``].filter(Boolean).join(` · `)||`0`}function QZ({step:e,stopped:t}){let n=cG(!t,e);return(0,L.jsx)(`span`,{className:`tabular-nums`,children:sG((e.workedMs??0)+n)})}function $Z(){return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`relative mt-[0.3125rem] grid size-4 shrink-0 place-items-center`,children:[(0,L.jsx)(`span`,{className:`absolute size-2.5 rounded-full bg-primary/30 motion-safe:animate-ping`}),(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-primary`})]})}function eQ({step:e,index:t,stopped:n}){let r=!!e.active&&!n,i=e.status===`done`,a=i?`text-success`:e.status===`current`?`text-primary`:`text-muted-foreground`,o=i?nm:mm;return(0,L.jsxs)(`li`,{className:`flex items-start gap-2.5 text-sm`,"data-step":r?`active`:e.status,children:[r?(0,L.jsx)($Z,{}):(0,L.jsx)(o,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 ${a}`}),(0,L.jsxs)(`span`,{className:`shrink-0 text-xs leading-5 text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,L.jsx)(`span`,{className:q(`min-w-0 break-words`,r||e.status===`current`?`text-foreground`:`text-muted-foreground`),children:e.text}),r?(0,L.jsxs)(`span`,{className:`shrink-0 rounded-md bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:[`active · `,(0,L.jsx)(QZ,{step:e,stopped:n}),(0,L.jsx)(`span`,{className:`sr-only`,children:` (being worked on now)`})]}):e.status===`current`&&!n?(0,L.jsxs)(`span`,{className:`shrink-0 rounded-md bg-accent px-2 py-0.5 text-xs font-medium`,children:[`next`,(0,L.jsx)(`span`,{className:`sr-only`,children:` (the step up next)`})]}):null]})}function tQ({steps:e,stopped:t}){let n=e.filter(e=>e.status===`done`).length;return(0,L.jsx)(nV,{title:`Steps`,right:`${n}/${e.length} done`,children:(0,L.jsx)(`ol`,{className:`flex flex-col gap-2`,"aria-label":`Steps`,children:e.map((e,n)=>(0,L.jsx)(eQ,{step:e,index:n,stopped:t},`${n}-${e.text}`))})})}function nQ({text:e}){let[t,n]=(0,m.useState)(!1),r=(0,m.useId)();return(0,L.jsxs)(nV,{title:`Full plan`,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),className:`inline-flex w-fit items-center gap-1.5 rounded-md text-sm text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(Jp,{"aria-hidden":`true`,className:q(`size-4 transition-transform duration-200 ease-snap`,t&&`rotate-90`)}),t?`Hide the details`:`Read the details of each step`]}),t?(0,L.jsx)(`div`,{id:r,children:(0,L.jsx)($B,{text:e})}):null]})}function rQ({detail:e,finished:t}){return e.plan&&e.planDetails?(0,L.jsx)(nQ,{text:e.planDetails}):e.plan?(0,L.jsx)(nV,{title:`Approved plan`,children:(0,L.jsx)($B,{text:e.plan})}):e.proposal?(0,L.jsx)(nV,{title:t?`Proposal`:`Proposal (no plan yet)`,children:(0,L.jsx)($B,{text:e.proposal})}):(0,L.jsx)(nV,{title:`Plan`,children:(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t?`It ended before a plan was made.`:`No proposal or plan yet — the oracle is still clarifying or scouting.`})})}function iQ({amendments:e}){return e.length===0?null:(0,L.jsx)(nV,{title:`Amendments`,children:(0,L.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-sm text-muted-foreground`,children:e.map(e=>(0,L.jsx)(`li`,{className:`break-words`,children:e},e))})})}function aQ({detail:e}){return e.waiting.length===0&&e.blockers.length===0?null:(0,L.jsx)(nV,{title:`Waiting on`,children:(0,L.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[e.waiting.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex gap-2`,children:[(0,L.jsx)(em,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-warning`}),(0,L.jsxs)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:[e.kind,` `,e.detail]})]},`${t}-${e.kind}`)),e.blockers.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex gap-2`,children:[(0,L.jsx)(fm,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-destructive`}),(0,L.jsxs)(`span`,{className:`min-w-0 break-words text-muted-foreground`,children:[e.reason,` (needs: `,e.need,`)`]})]},`${t}-${e.reason}`))]})})}function oQ({risk:e}){let t=WZ[e.risk];return(0,L.jsxs)(nV,{title:`QA risk`,right:GZ(e),children:[(0,L.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-sm`,"data-qa-risk":e.risk,children:[(0,L.jsx)(`span`,{className:q(`rounded-md px-2 py-0.5 text-xs font-medium`,t.tone),children:t.label}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:t.depth})]}),e.focusAreas.length>0?(0,L.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-sm text-muted-foreground`,"aria-label":`What QA looks at first`,children:e.focusAreas.map(e=>(0,L.jsx)(`li`,{className:`break-words`,children:e},e))}):null,(0,L.jsxs)(`p`,{className:`text-xs break-words text-muted-foreground`,children:[e.riskFactors.join(` · `),e.qaRequired?` · existing tests ${e.existingTestsLikelySufficient?`likely enough`:`likely not enough`}`:``]})]})}function sQ({runs:e}){return e.length===0?null:(0,L.jsx)(nV,{title:`Recent runs`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm text-muted-foreground`,children:e.map((e,t)=>(0,L.jsx)(`li`,{className:`break-words`,children:e},`${t}-${e}`))})})}function cQ({detail:e,finished:t}){return(0,L.jsxs)(L.Fragment,{children:[e.steps.length>0?(0,L.jsx)(tQ,{steps:e.steps,stopped:t}):null,e.request?(0,L.jsx)(nV,{title:`Request`,children:(0,L.jsx)($B,{text:e.request})}):null,(0,L.jsx)(rQ,{detail:e,finished:t})]})}function lQ({detail:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(iQ,{amendments:e.amendments}),(0,L.jsx)(aQ,{detail:e}),e.qaRisk?(0,L.jsx)(oQ,{risk:e.qaRisk}):null,(0,L.jsx)(sQ,{runs:e.runs})]})}function uQ({row:e,quiet:t=!1}){let n=(0,m.useRef)(!0);(0,m.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);async function r(){if(e.section===`mine`)return uk(`#/lobby`);let t=M(),r=()=>n.current&&M()===t;try{let t=await De(`tasks.open`,{taskId:e.id});if(!r())return;let n=await De(`status.get`,{});if(!r())return;if(t.sessionId&&t.sessionId===n.sessionId)return uk(`#/lobby`);if(t.sessionId&&!t.key)return V.info(`This task runs in another terminal. Switch to that terminal to work on it.`);if(n.busy)return V.info(`The oracle is working in this window. Stop it first, then open the task in its session.`);await H(`sessions.switch`,t.key?{key:t.key}:{claimTaskId:e.id})&&r()&&uk(`#/lobby`)}catch(e){r()&&V.error(e instanceof Error?e.message:String(e))}}let i=e.section===`mine`;return(0,L.jsx)(Y,{label:i?`Open in its session: this window`:`Open in its session`,text:`Open in session`,icon:Mp,tone:t?`neutral`:`primary`,shortcut:`S`,onClick:()=>void r()})}function dQ({split:e}){let t=e.after.length>0?`, after ${e.after.map(e=>`part ${e}`).join(` and `)}`:``;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[(0,L.jsxs)(`span`,{className:`font-medium text-primary`,children:[`part `,e.part,` of `,e.of]}),` of one plan that was split into tasks`,t?(0,L.jsx)(`span`,{className:`text-foreground`,children:t}):null]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.titles.map((t,n)=>(0,L.jsxs)(`span`,{children:[n>0?(0,L.jsx)(`span`,{className:`text-muted-foreground/60`,children:` · `}):null,(0,L.jsxs)(`span`,{className:n+1===e.part?`font-medium text-foreground`:void 0,children:[n+1,`. `,t]})]},`${n}-${t}`))})]})}function fQ({planId:e}){let t=Ak(`plans.get`,{planId:e},[`plans`]),n=t.data;return n?(0,L.jsxs)(L.Fragment,{children:[n.issue?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`from issue #`,n.issue.number,` — `,n.issue.title,n.issue.url?(0,L.jsxs)(`span`,{className:`break-all`,children:[` `,n.issue.url]}):null]}):null,n.split?(0,L.jsx)(dQ,{split:n.split}):null,(0,L.jsx)(nV,{title:`Agreed plan`,children:(0,L.jsx)($B,{text:n.brief})})]}):t.error?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load the agreed plan. `,t.error]}):null}function pQ({row:e,onGone:t}){let n=async n=>{await H(`plans.start`,{planId:e.id,where:n})&&t()},r=async()=>{await H(`plans.discard`,{planId:e.id})&&t()};return(0,L.jsxs)(`article`,{className:`flex flex-col gap-4`,"aria-label":e.title,children:[(0,L.jsxs)(eA,{children:[(0,L.jsx)(Y,{label:`Start here`,icon:Hh,tone:`primary`,shortcut:`S`,onClick:()=>void n(`here`)}),(0,L.jsx)(Y,{label:`Start in a new session`,text:`New session`,icon:ug,shortcut:`N`,onClick:()=>void n(`session`)}),(0,L.jsx)(MA,{icon:wg,label:`Discard`,shortcut:`Delete`,title:`Discard "${e.title}"?`,description:`The saved plan is removed from the list. This cannot be undone.`,confirmLabel:`Discard`,variant:`destructive`,onConfirm:()=>void r()})]}),(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`h2`,{className:`flex items-start gap-2.5 text-lg font-medium`,children:[(0,L.jsx)(pG,{check:`open`,className:`mt-1.5`}),(0,L.jsx)(`span`,{className:`min-w-0 break-words`,children:e.title})]}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`pending`,e.age?` · saved ${JZ(e.age)}`:``]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:e.id})]}),(0,L.jsx)(fQ,{planId:e.id})]})}function mQ({row:e,onResumed:t}){let[n,r]=(0,m.useState)(!1),i=(0,m.useRef)(!0);(0,m.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);async function a(){let n=M();r(!0);try{let r=await De(`tasks.resume`,{taskId:e.id});if(M()!==n)return;let i=r.key;V(r.notice,i?{action:{label:`Watch`,onClick:()=>uk(`#/sessions/${encodeURIComponent(i)}`)}}:void 0),t()}catch(e){M()===n&&V.error(e instanceof Error?e.message:String(e))}finally{i.current&&r(!1)}}let o=e.owner===`not running`;return(0,L.jsx)(Y,{label:o?`Resume: carry it on in a background session`:`Resume: unpause it where it runs`,text:`Resume`,icon:Hh,tone:`primary`,shortcut:`R`,disabled:n,onClick:()=>void a()})}function hQ(e){if(e.kind===`archived`)return{state:`archived`,rest:JZ(e.age??`now`)};let t=e.check!==`open`,n=e.owner??(e.section===`mine`?`this session`:``),r=t&&e.age?`${e.check===`dropped`?`dropped`:`done`} ${JZ(e.age)}`:``;return{state:qZ(e.status,e.paused),rest:[t?``:n,r].filter(Boolean).join(` · `)}}function gQ(e){return e?[uG(e.track),e.domains.join(`, `)].filter(Boolean).join(` · `):``}function _Q({row:e}){return e.progress?(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsx)(fG,{done:e.progress.done,total:e.progress.total}),(0,L.jsxs)(`span`,{children:[e.progress.done,` of `,e.progress.total,` steps`]})]}):null}function vQ({row:e,task:t}){let n=t?.git?`branch ${t.git.branch}${t.git.from?` · from ${t.git.from}`:``}`:``,{state:r,rest:i}=hQ(e);return(0,L.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h2`,{className:`flex items-start gap-2.5 text-lg font-semibold tracking-tight`,children:[(0,L.jsx)(pG,{check:e.check,className:`mt-1.5`}),(0,L.jsxs)(`span`,{className:`sr-only`,children:[UZ[e.check],`:`]}),(0,L.jsx)(`span`,{className:e.check===`dropped`?`min-w-0 break-words line-through`:`min-w-0 break-words`,children:e.title})]}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded-md bg-accent px-2 py-0.5 text-xs font-medium text-foreground`,children:r}),i?(0,L.jsx)(`span`,{children:i}):null]}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:[e.id,gQ(t),n].filter(Boolean).join(` · `)}),(0,L.jsx)(_Q,{row:e})]})}function yQ({row:e,onGone:t,onChanged:n}){let r=e.id;return{restore:async()=>{await H(`tasks.restore`,{taskId:r},{undo:()=>void H(`tasks.archive`,{taskId:r})})&&t()},archive:async()=>{await H(`tasks.archive`,{taskId:r},{undo:()=>void H(`tasks.restore`,{taskId:r})})&&t()},remove:async()=>{await H(`tasks.delete`,{taskId:r,where:e.kind===`archived`?`archive`:`list`})&&t()},toggleAuto:()=>void H(`tasks.auto`,{taskId:r,on:!e.auto}).then(n)}}function bQ({row:e,archive:t}){return e.check===`open`?(0,L.jsx)(MA,{label:`Archive`,icon:Ep,shortcut:`E`,title:`Archive "${e.title}"?`,description:`A task still under way is abandoned first, then moved to the archive. Restore brings it back.`,confirmLabel:`Archive`,onConfirm:()=>void t()}):(0,L.jsx)(Y,{label:`Archive`,icon:Ep,shortcut:`E`,onClick:()=>void t()})}function xQ({on:e,toggle:t}){return Qk(`a`,t),(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsxs)(`label`,{className:`flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2.5 text-[0.8125rem] font-medium transition-colors hover:bg-accent`,children:[(0,L.jsx)(Kh,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,L.jsx)(`span`,{children:`Auto`}),(0,L.jsx)(aq,{checked:e,onCheckedChange:t,"aria-label":`Auto mode`,"aria-keyshortcuts":`A`}),(0,L.jsx)(GO,{chord:`A`,className:`kbd-hint`})]})}),(0,L.jsx)(Pk,{children:`Auto mode: the oracle decides without asking`})]})}function SQ(e){let{row:t}=e,{restore:n,archive:r,remove:i,toggleAuto:a}=yQ(e),o=t.kind===`archived`,s=t.kind===`task`&&t.check===`open`&&!!t.resumable;return(0,L.jsxs)(eA,{children:[s?(0,L.jsx)(mQ,{row:t,onResumed:e.onChanged}):null,t.kind===`task`&&t.check===`open`?(0,L.jsx)(uQ,{row:t,quiet:s}):null,t.kind===`task`?(0,L.jsx)(CQ,{taskId:t.id}):null,o?(0,L.jsx)(Y,{label:`Restore`,icon:Xh,shortcut:`R`,onClick:()=>void n()}):null,t.check===`open`&&!o?(0,L.jsx)(xQ,{on:!!t.auto,toggle:a}):null,o?null:(0,L.jsx)(bQ,{row:t,archive:r}),(0,L.jsx)(MA,{icon:wg,label:o?`Delete for good`:`Delete`,text:`Delete`,shortcut:`Delete`,title:`Delete "${t.title}" for good?`,description:`This cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,onConfirm:()=>void i()})]})}function CQ({taskId:e}){let t=(0,m.useRef)(!0);(0,m.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]);async function n(){let n=M();try{let r=await De(`tasks.open`,{taskId:e});if(!t.current||M()!==n)return;r.notice&&V.info(r.notice);let i=await De(`status.get`,{});if(!t.current||M()!==n)return;let a=r.key??(r.sessionId===i.sessionId?`here`:r.sessionId);a?uk(`#/sessions/${encodeURIComponent(a)}`):r.notice||V.info(`This task has no active session. No replacement session was created.`)}catch(e){t.current&&M()===n&&V.error(e instanceof Error?e.message:String(e))}}return(0,L.jsx)(Y,{label:`Open task conversation`,text:`Conversation`,icon:fh,shortcut:`O`,onClick:()=>void n()})}function wQ(e){let{row:t}=e,n=t.kind===`plan`,r=Ak(`tasks.get`,{taskId:t.id},[`tasks`],!n),i=Ok(`lobby`).data?.task,a=i?.id===t.id?i:void 0;if(n)return(0,L.jsx)(pQ,{row:t,onGone:e.onGone});let o=t.check===`open`&&t.kind===`task`,s=r.data?r.data.work:t.work;return(0,L.jsxs)(`article`,{className:`flex flex-col gap-5`,"aria-label":t.title,children:[(0,L.jsx)(SQ,{...e}),(0,L.jsx)(vQ,{row:t,task:a}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,L.jsx)(SZ,{timing:r.data?.timing??t.timing,...s?{work:s}:{},stopped:t.check!==`open`})}),r.data?.delivery?(0,L.jsx)(IZ,{taskId:t.id,title:t.title,delivery:r.data.delivery,onChanged:r.reload},t.id):null,r.data?(0,L.jsx)(cQ,{detail:r.data,finished:!o}):null,(0,L.jsx)(VZ,{taskId:t.id,finished:!o,canComment:o}),r.data?(0,L.jsx)(lQ,{detail:r.data}):null,r.error&&!r.data?(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Could not load the plan detail. `,r.error]}):null]})}function TQ({row:e}){return e.check===`open`&&e.progress?(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground tabular-nums`,children:[(0,L.jsx)(fG,{done:e.progress.done,total:e.progress.total}),(0,L.jsxs)(`span`,{children:[e.progress.done,`/`,e.progress.total]})]}):e.age&&e.check!==`open`?(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.age}):null}function EQ(e){return e.check===`dropped`?`text-muted-foreground line-through`:e.kind===`archived`||e.check===`done`?`text-muted-foreground`:`text-foreground`}function DQ({row:e,card:t}){return(0,L.jsxs)(L.Fragment,{children:[t?(0,L.jsx)(`span`,{className:`pl-6 text-xs text-muted-foreground`,children:e.status.replaceAll(`_`,` `)}):null,e.check===`open`?(0,L.jsx)(`span`,{className:`pl-6 text-xs text-muted-foreground`,children:YZ(e)}):null,e.kind===`plan`?null:(0,L.jsx)(`span`,{className:`pl-6 text-xs text-muted-foreground`,children:(0,L.jsx)(SZ,{timing:e.timing,...e.work?{work:e.work}:{},stopped:e.check!==`open`})}),e.delivery?(0,L.jsxs)(`span`,{className:`pl-6 text-xs text-foreground`,children:[`Delivery: `,e.delivery.status.replaceAll(`_`,` `),` · open task to review`]}):null]})}function OQ({row:e,selected:t,onSelect:n,card:r=!1}){return(0,L.jsx)(`li`,{className:r?`overflow-hidden rounded-lg border border-input bg-card shadow-sm`:void 0,children:(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,"data-row":!0,"aria-current":t?`true`:void 0,onClick:()=>n(e.id),className:VV,children:[(0,L.jsxs)(`span`,{className:`flex items-start gap-2 text-sm`,children:[(0,L.jsx)(pG,{check:e.check,className:`mt-0.5`}),(0,L.jsxs)(`span`,{className:`sr-only`,children:[UZ[e.check],`:`]}),(0,L.jsx)(`span`,{className:q(`min-w-0 flex-1 break-words`,EQ(e),t&&`font-medium text-foreground`),children:e.title}),(0,L.jsx)(TQ,{row:e})]}),(0,L.jsx)(DQ,{row:e,card:r})]})})}function kQ({rows:e,selectedId:t,onSelect:n}){return(0,L.jsx)(`div`,{className:`flex flex-col pb-2`,children:XZ(e).map(({section:e,rows:r})=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:UV,children:(0,L.jsx)(tV,{title:HZ[e],right:String(r.length),className:`[&>span:first-child]:font-medium [&>span:first-child]:text-muted-foreground`})}),(0,L.jsx)(`ul`,{className:HV,children:r.map(e=>(0,L.jsx)(OQ,{row:e,selected:e.id===t,onSelect:n},`${e.kind}-${e.id}`))})]},e))})}var AQ=()=>uk(lk(`tasks`,`board`)),jQ=e=>uk(lk(`tasks`,`board`,e)),MQ=[`Backlog`,`In progress`,`Completed`];function NQ(e){if(e.kind!==`archived`&&e.section!==`archived`)return e.check===`done`?`Completed`:e.kind===`plan`||e.status===`created`||e.check===`dropped`?`Backlog`:`In progress`}function PQ({title:e,rows:t,id:n}){return(0,L.jsxs)(AG,{role:`region`,"aria-label":e,spacing:`sm`,className:`min-w-0`,children:[(0,L.jsx)(MG,{className:`py-2`,children:(0,L.jsxs)(`h2`,{className:`flex items-center justify-between gap-2 text-sm font-semibold`,children:[e,(0,L.jsx)(BV,{variant:`secondary`,radius:`full`,children:t.length})]})}),(0,L.jsxs)(jG,{children:[(0,L.jsx)(`ul`,{className:`flex flex-col gap-3`,children:t.map(e=>(0,L.jsx)(OQ,{row:e,selected:e.id===n,onSelect:jQ,card:!0},`${e.kind}-${e.id}`))}),t.length?null:(0,L.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No tasks here.`})]})]})}function FQ({rows:e,id:t}){return(0,L.jsx)(`div`,{className:`grid items-start gap-4 p-4 md:grid-cols-3`,"aria-label":`Task board`,children:MQ.map(n=>(0,L.jsx)(PQ,{title:n,rows:e.filter(e=>NQ(e)===n),id:t},n))})}function IQ({id:e}){let t=Ak(`tasks.list`,{},[`tasks`,`plans`]),n=t.data?.rows??[],r=n.find(t=>t.id===e&&NQ(t)!==void 0),i=r?.kind===`task`?r.id:void 0;if((0,m.useEffect)(()=>(FX(i),()=>FX(void 0)),[i]),!t.data&&t.error)return(0,L.jsx)(wk,{message:`Could not load tasks. ${t.error}`,onRetry:t.reload});let a=r?(0,L.jsx)(wQ,{row:r,onGone:AQ,onChanged:t.reload},r.id):null;return(0,L.jsx)(pA,{wide:!1,list:t.data?(0,L.jsx)(FQ,{rows:n,id:e}):(0,L.jsx)(hA,{}),detail:a,open:!!r,onClose:AQ,hint:`Select a task to see its detail.`,describe:`Task detail`})}var LQ=()=>uk(lk(`tasks`)),RQ=e=>uk(lk(`tasks`,e));function zQ(){return(0,L.jsxs)(fk,{className:`m-4 flex-1`,children:[(0,L.jsxs)(pk,{children:[(0,L.jsx)(hk,{variant:`icon`,children:(0,L.jsx)(Qm,{"aria-hidden":`true`})}),(0,L.jsx)(_k,{children:KZ})]}),(0,L.jsx)(J,{onClick:()=>uk(lk(`plan`)),children:`Plan a task`})]})}function BQ({shown:e,count:t,onToggle:n}){return(0,L.jsxs)(`label`,{className:`btn-raised flex h-7 cursor-pointer items-center gap-2 rounded-lg border bg-card px-2 text-xs font-medium transition-[box-shadow]`,children:[(0,L.jsx)(LU,{checked:e,onCheckedChange:n,"aria-label":`Show archived tasks`,className:`size-4`}),`Archived`,(0,L.jsx)(BV,{variant:`secondary`,className:`h-5 px-1.5`,children:t})]})}function VQ({id:e,board:t=!1}){return(0,L.jsxs)(JD,{value:t?`board`:`list`,onValueChange:e=>uk(lk(`tasks`,...e===`board`?[`board`]:[])),className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(YD,{"aria-label":`Task views`,className:`flex gap-1 border-b border-border px-4 py-2`,children:[(0,L.jsx)(XD,{value:`list`,className:`rounded-lg border border-input px-3 py-1.5 text-sm text-muted-foreground data-[state=active]:bg-tab-fill data-[state=active]:text-foreground focus-visible:ring-3 focus-visible:ring-ring`,children:`List`}),(0,L.jsx)(XD,{value:`board`,className:`rounded-lg border border-input px-3 py-1.5 text-sm text-muted-foreground data-[state=active]:bg-tab-fill data-[state=active]:text-foreground focus-visible:ring-3 focus-visible:ring-ring`,children:`Board`})]}),(0,L.jsx)(ZD,{value:`list`,className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(HQ,{id:e})}),(0,L.jsx)(ZD,{value:`board`,className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(IQ,{id:e})})]})}function HQ({id:e}){let t=lA(),[n,r]=(0,m.useState)(!1),i=Ak(`tasks.list`,{},[`tasks`,`plans`]),a=Ak(`tasks.archived`,{},[`tasks`]),o=i.data?.rows??[],s=a.data?.rows??[],c=n?[...o,...s]:o,l=e??(t?c[0]?.id:void 0),u=[...c,...s].find(e=>e.id===l&&e.kind===`task`)?.id;if((0,m.useEffect)(()=>(FX(u),()=>FX(void 0)),[u]),!i.data&&i.error)return(0,L.jsx)(wk,{message:`Could not load tasks. ${i.error}`,onRetry:i.reload});if(i.data&&o.length===0&&s.length===0)return(0,L.jsx)(zQ,{});let d=[...c,...s].find(e=>e.id===l),f=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(mA,{title:`Tasks`,count:ZZ(c),children:(0,L.jsx)(BQ,{shown:n,count:s.length,onToggle:()=>r(e=>!e)})}),i.data?c.length===0?(0,L.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:KZ}):(0,L.jsx)(kQ,{rows:c,selectedId:l,onSelect:RQ}):(0,L.jsx)(hA,{})]}),p=d?(0,L.jsx)(wQ,{row:d,onGone:LQ,onChanged:i.reload},d.id):e?(0,L.jsx)(UQ,{}):null;return(0,L.jsx)(pA,{wide:t,list:f,detail:p,open:!!e,onClose:LQ,hint:`Select a task to see its detail.`,describe:`Task detail`})}function UQ(){return(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`That task is not on the list any more.`})}var WQ={l:`lobby`,p:`plan`,t:`tasks`,i:`issues`,u:`git`,s:`sessions`,n:`knowledge`,q:`quickfix`,m:`metrics`,e:`settings`,x:`excalidraw`};function GQ(e){let t=e[0];if(t)try{return decodeURIComponent(t)}catch{return t}}function KQ(e){if(e.kind===`settings`)return(0,L.jsx)(KJ,{});if(e.kind===`sessions`)return(0,L.jsx)(yZ,{id:GQ(e.key?[e.key]:[])});switch(e.tab){case`lobby`:return(0,L.jsx)(OG,{});case`tasks`:return(0,L.jsx)(VQ,{...IU(e.rest)});case`plan`:return(0,L.jsx)(uX,{rest:e.rest});case`quickfix`:return(0,L.jsx)(AX,{id:GQ(e.rest)});case`issues`:return(0,L.jsx)(wH,{rest:e.rest});case`metrics`:return(0,L.jsx)(CK,{});case`git`:return(0,L.jsx)(ZV,{rest:e.rest});case`knowledge`:return(0,L.jsx)(FU,{rest:e.rest});case`excalidraw`:return(0,L.jsx)(UW,{id:GQ(e.rest)})}}function qQ(e,t){return t.overlay?!0:e===`savePlan`&&!t.saveAvailable}var JQ={tab:`Tab`,esc:`Escape`,escape:`Escape`,enter:`Enter`,space:`Space`,pageup:`PageUp`,pagedown:`PageDown`,home:`Home`,end:`End`,"]":`BracketRight`,"[":`BracketLeft`,"/":`Slash`,"?":`Slash`,",":`Comma`,".":`Period`};function YQ(e){return e.length===1&&/[a-z]/i.test(e)?`Key${e.toUpperCase()}`:e.length===1&&/[0-9]/.test(e)?`Digit${e}`:JQ[e]}function XQ(e){let t={alt:!1,ctrl:!1,shift:!1,meta:!1,code:``};for(let n of e.toLowerCase().split(`+`))if(n===`alt`)t.alt=!0;else if(n===`ctrl`||n===`control`)t.ctrl=!0;else if(n===`shift`)t.shift=!0;else if(n===`meta`||n===`cmd`)t.meta=!0;else{let e=YQ(n);if(!e)return;t.code=e}return t.code?t:void 0}function ZQ(e,t){return e.code===t.code&&e.altKey===t.alt&&e.ctrlKey===t.ctrl&&e.shiftKey===t.shift&&e.metaKey===t.meta}function QQ(e,t){let n=XQ(t);return n?ZQ(e,n):!1}function $Q(e,t){for(let n of t)if(QQ(e,n.key))return n.action}function e$(e,t){for(let n of t)if(QQ(e,n.key))return n.id}function t$(e){return Lk(e.target)||e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||nk()||!!document.querySelector(`[role='dialog'], [role='menu'], [role='listbox']`)}function n$(e,t,n,r){let i=!e.shiftKey&&/^[1-9]$/.test(e.key)?t[Number(e.key)-1]:void 0;if(i)r(i.id);else if(e.key===`/`)n(`search`);else if(e.key===`?`)n(`help`);else if(e.key===`j`||e.key===`k`)Uk(e.key===`j`?1:-1);else return!1;return!0}function r$(e,t){let n=e$(e,t.tabs),r=$Q(e,t.keys);return!n&&!r?!1:qQ(r,{overlay:!!document.querySelector(`[role='dialog']:not([data-state='closed']), [role='menu']:not([data-state='closed']), [role='listbox']`)||nk(),typing:Lk(e.target)||e.target instanceof HTMLInputElement,saveAvailable:!!document.querySelector(`[data-plan-save]:not([disabled])`)})||(r===`search`||r===`savePlan`)&&!t.insideApp()?!0:(e.preventDefault(),n?t.onTab(n):r&&t.onAction(r),!0)}function i$(e,t,n){if(e.key===`Escape`)return Date.now()<n&&e.preventDefault(),0;if(Date.now()<n){let n=WQ[e.key];return n&&(e.preventDefault(),t.onTab(n)),0}return e.key===`g`?Date.now()+1500:(n$(e,t.tabs,t.onAction,t.onTab)&&e.preventDefault(),0)}function a$(e){(0,m.useEffect)(()=>{if(!e.enabled)return;let t=0,n=n=>{if(n.defaultPrevented||n.isComposing)return;if(!e.insideApp()){$Q(n,e.keys)===`help`&&(n.preventDefault(),e.onAction(`help`));return}let r=!n.altKey&&!n.ctrlKey&&!n.metaKey;if(r&&t$(n)){t=0;return}if(r$(n,e)){t=0;return}t=r?i$(n,e,t):0};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e.enabled,e.keys,e.tabs,e.insideApp,e.onAction,e.onTab])}var o$=[{id:`focus`,caps:[`/`],help:`focus search, or the message box`},{id:`send`,label:`Enter`,help:`send the message`},{id:`newline`,label:`Shift+Enter`,help:`a new line (lists carry on)`},{id:`format`,label:`Ctrl+B`,help:`bold; Ctrl+I italic, Ctrl+E code, Ctrl+K link`},{id:`leave`,label:`Esc`,help:`leave the box for the tab bar`}],s$=[{id:`digits`,caps:[`1`,`…`,`9`],help:`jump to a tab in current order`},{id:`help`,caps:[`?`],help:`keyboard shortcuts`},...Object.entries(WQ).map(([e,t])=>({id:`go.${t}`,caps:[`g`,e],help:`jump to ${t}`})),{id:`project`,caps:[`P`],help:`open the project switcher`},{id:`theme`,caps:[`D`],help:`switch between light and dark`},{id:`edit`,label:`Ctrl+Enter`,help:`save an edited message; Esc cancels`}],c$=[{id:`tasks`,page:`Tasks`,keys:[[`E`,`archive`],[`R`,`restore`],[`A`,`auto mode`],[`Delete`,`delete`]]},{id:`saved`,page:`Saved plan`,keys:[[`S`,`start here`],[`N`,`new session`],[`Delete`,`discard`]]},{id:`plan`,page:`Plan`,keys:[[`A`,`answer`],[`R`,`retry`],[`Ctrl+S`,`save`],[`N`,`new plan`]]},{id:`quickfix`,page:`Quick fix`,keys:[[`R`,`run anyway`],[`T`,`make a task`],[`C`,`cancel`]]},{id:`git`,page:`Git`,keys:[[`R`,`refresh`],[`V`,`review`],[`Q`,`Jev's read`],[`X`,`stop`]]},{id:`issues`,page:`Issues`,keys:[[`R`,`refresh`]]},{id:`knowledge`,page:`Knowledge`,keys:[[`E`,`edit`],[`A`,`add`],[`C`,`comment`],[`F`,`edit file`],[`Delete`,`delete`]]},{id:`excalidraw`,page:`Excalidraw`,keys:[[`R`,`reveal`],[`C`,`copy`],[`O`,`open`],[`W`,`draw`],[`T`,`check`],[`Delete`,`remove`]]},{id:`sessions`,page:`Sessions`,keys:[[`M`,`move here`],[`S`,`stop`],[`B`,`back`]]},{id:`confirm`,page:`Asked to confirm`,keys:[[`Y`,`yes, do it`],[`Esc`,`keep it`]]}],l$=[{id:`enter`,caps:[`↓`],help:`from the tab bar, into the page`},{id:`rows`,caps:[`↑`,`↓`],help:`move through a list (j and k work too)`},{id:`pane`,caps:[`←`,`→`],help:`between a list and its detail (h and l)`},{id:`ends`,caps:[`Home`,`End`],help:`first and last row`},{id:`open`,caps:[`Enter`,`Space`],help:`activate the focused button or row (links: Enter; checkboxes: Space)`},{id:`back`,label:`Esc`,help:`back up to the tab bar`}],u$=[{id:`qmove`,caps:[`↑`,`↓`],help:`move between the options`},{id:`qpick`,label:`Space`,help:`pick an option (several when allowed)`},{id:`qchoose`,label:`Enter`,help:`choose and go on; in your own answer, send it`},{id:`qacross`,caps:[`←`,`→`],help:`previous and next question`},{id:`qdigit`,caps:[`1`,`2`,`…`],help:`pick that option`},{id:`qesc`,label:`Esc`,help:`put the question away for later`}];function d$({line:e}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,L.jsx)(`span`,{className:`flex w-28 shrink-0 items-center`,children:e.caps?(0,L.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:e.caps.map(e=>(0,L.jsx)(zO,{children:e},e))}):(0,L.jsx)(GO,{chord:e.label??``})}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.help})]})}function f$(){return(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h3`,{className:`mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:`Buttons on a page`}),c$.map(e=>(0,L.jsxs)(`div`,{className:`flex items-start gap-3 py-1`,children:[(0,L.jsx)(`span`,{className:`w-28 shrink-0 pt-0.5 text-sm font-medium`,children:e.page}),(0,L.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5 text-sm text-muted-foreground`,children:e.keys.map(([e,t])=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(GO,{chord:e}),t]},e))})]},e.id))]})}function p$({title:e,lines:t}){return(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h3`,{className:`mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:e}),t.map(e=>(0,L.jsx)(d$,{line:e},e.id))]})}function m$(e){return e.map(e=>({id:e.action,label:e.label,help:e.help}))}function h$(e){return e.map(e=>({id:`tab.${e.id}`,label:e.key,help:`jump to the ${e.label} tab`}))}function g$({open:e,onOpenChange:t,keys:n,tabs:r}){let i=tk(e,ek.help);return(0,m.useEffect)(()=>{if(!e||!i)return;let r=e=>{let r=n.find(e=>e.action===`help`)?.key;(e.key===`Escape`||r&&QQ(e,r))&&(e.preventDefault(),t(!1))};return window.addEventListener(`keydown`,r,!0),()=>window.removeEventListener(`keydown`,r,!0)},[e,i,t,n]),(0,L.jsxs)(qO,{open:e&&i,onOpenChange:t,label:`Keys`,className:`max-w-4xl`,children:[(0,L.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border px-6 py-4`,children:[(0,L.jsx)(`h2`,{"aria-hidden":`true`,className:`text-base font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(GO,{chord:`Esc`}),(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,onClick:()=>t(!1),children:(0,L.jsx)(Hg,{"aria-hidden":`true`})})]})]}),(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-10 gap-y-6 overflow-y-auto px-6 py-5 md:grid-cols-2`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsx)(p$,{title:`Everywhere`,lines:m$(n)}),(0,L.jsx)(p$,{title:`Jump to a tab`,lines:h$(r)}),(0,L.jsx)(p$,{title:`Navigation and editing`,lines:s$}),(0,L.jsx)(p$,{title:`Message box`,lines:o$})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsx)(p$,{title:`Lists and panes`,lines:l$}),(0,L.jsx)(f$,{}),(0,L.jsx)(p$,{title:`Questions`,lines:u$})]})]})]})}function _$(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}async function v$(e){if(e.size===0)throw Error(`${e.name||`That file`} is empty.`);if(e.size>20971520)throw Error(`${e.name||`That file`} is larger than 20 MB.`);let t=new URLSearchParams({name:e.name||`pasted-file`,type:e.type}),n=await fetch(N(`/api/files.upload?${t}`),{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e,credentials:`same-origin`}),r=await n.json().catch(()=>void 0);if(!r)throw new Te(`the lobby answered ${n.status}`,`failed`,n.status);if(!r.ok)throw new Te(r.error,r.code,n.status);return r.result}function y$(e,t,n,r){let i=e.slice(0,t),a=e.slice(t,n),o=e.slice(n);if(a.length>=r.length*2&&a.startsWith(r)&&a.endsWith(r)){let e=a.slice(r.length,a.length-r.length);return{value:i+e+o,start:t,end:t+e.length}}return i.endsWith(r)&&o.startsWith(r)?{value:i.slice(0,i.length-r.length)+a+o.slice(r.length),start:t-r.length,end:n-r.length}:{value:i+r+a+r+o,start:t+r.length,end:n+r.length}}function b$(e,t,n){let r=e.slice(t,n)||`text`,i=`[${r}](url)`,a=t+r.length+3;return{value:e.slice(0,t)+i+e.slice(n),start:a,end:a+3}}var x$=/^(\s*)(?:([-*+])|(\d+)([.)]))\s+(\[[ xX]\]\s+)?/;function S$(e,t){let n=e.lastIndexOf(`
101
101
  `,t-1)+1,r=e.indexOf(`
102
- `,t),i=e.slice(n,r<0?e.length:r),a=E$.exec(i);if(!a||t-n<a[0].length)return;let[o,s=``,c,l,u=`.`,d]=a;if(i.slice(o.length).trim()===``)return{value:e.slice(0,n)+e.slice(r<0?e.length:r),start:n,end:n};let f=`\n${s}${c??`${Number(l)+1}${u}`} ${d?`[ ] `:``}`;return{value:e.slice(0,t)+f+e.slice(t),start:t+f.length,end:t+f.length}}function O$({rest:e}){let{chat:t}=ZH(e);return(0,L.jsx)(`div`,{role:`group`,"aria-label":`Knowledge pane`,className:`flex items-center gap-0.5 rounded-lg bg-muted p-0.5`,children:[`Chat`,`Docs`].map(n=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":t===(n===`Chat`),onClick:()=>Y(QH(e,n===`Chat`)),className:q(`h-6 rounded-md px-2.5 text-xs font-medium outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,t===(n===`Chat`)?`btn-raised bg-card text-foreground`:`text-muted-foreground hover:text-foreground`),children:n},n))})}var k$={id:`oracle`,pill:`Oracle`,label:`Message the oracle`,placeholder:`Message the oracle…`};function A$(e,t,n){if(e.kind===`sessions`){let e={id:`newsession`,pill:`New session`,label:`Start a task in a new session`,placeholder:`Describe a task for a new session…`};return n?[{id:`session`,pill:`Message`,label:`Message ${n.name}`,placeholder:`Message ${n.name}…`,session:n},e,k$]:[e,k$]}if(e.kind!==`tab`)return[k$];if(e.tab===`knowledge`)return[{id:`knowledge`,pill:`Oracle`,label:`Ask the oracle about this project`,placeholder:`Ask about this project — the oracle searches the code and learns what is missing…`}];if(e.tab===`plan`)return[{id:`panel`,pill:`Panel`,label:`Message the panel`,placeholder:`Describe a task, or answer the panel…`},k$];if(e.tab===`quickfix`)return[{id:`quickfix`,pill:`Quick fix`,label:`Describe a quick fix`,placeholder:`Describe a small change…`},k$];let r=e.tab===`tasks`?MU(e.rest).id??t:void 0;return r?[{id:`comment`,pill:`Comment`,label:`Comment on ${r}`,placeholder:`Comment on ${r}'s plan…`,taskId:r},{id:`task`,pill:`Task's oracle`,label:`Message ${r}'s oracle`,placeholder:`Leave a message for ${r}'s oracle…`,taskId:r},k$]:[k$]}var j$=0,M$=`toolbar-button relative inline-flex size-8 items-center justify-center rounded-lg border text-foreground transition-[background-color,border-color,translate] duration-150 ease-snap outline-none focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`;function N$(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing}function P$({file:e,onRemove:t}){let n=(0,L.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,onClick:t,className:q(`btn-ghost flex shrink-0 items-center justify-center rounded-lg border text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40`,e.image?`absolute top-1 right-1 size-5 bg-background/80 text-foreground backdrop-blur-sm`:`size-7`),children:(0,L.jsx)(Hg,{"aria-hidden":`true`,className:`size-3.5`})});return e.image?(0,L.jsxs)(z.li,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:520,damping:32},title:`${e.name} · ${S$(e.size)}`,className:`relative size-16 shrink-0 overflow-hidden rounded-lg border border-border bg-muted`,children:[(0,L.jsx)(`img`,{src:N(e.image),alt:e.name,className:`size-full object-cover`}),e.state===`uploading`?(0,L.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-background/60`,children:(0,L.jsx)(_k,{className:`size-4`,"aria-hidden":`true`,role:`presentation`})}):null,n]}):(0,L.jsxs)(z.li,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:520,damping:32},className:`flex h-9 min-w-0 items-center gap-2 rounded-lg border border-border bg-muted pr-1 pl-2.5`,children:[(0,L.jsxs)(`span`,{className:`relative flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,L.jsx)(Pm,{"aria-hidden":`true`,className:`size-4`}),e.state===`uploading`?(0,L.jsx)(_k,{className:`absolute -right-1 -bottom-1 size-2.5`,"aria-hidden":`true`,role:`presentation`}):null]}),(0,L.jsxs)(`span`,{className:`min-w-0 max-w-40`,children:[(0,L.jsx)(`span`,{className:`block truncate text-xs font-medium`,children:e.name}),(0,L.jsx)(`span`,{className:`block text-[0.65rem] leading-tight text-muted-foreground`,children:e.state===`uploading`?`uploading…`:S$(e.size)})]}),n]})}function F$({route:e,keys:t,onHelp:n}){let[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)([]),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(!1),[p,h]=(0,m.useState)(),g=Ck(`status`),_=Ck(`lobby`),v=rk(),y=(g.data?.busy??!1)||!!_.data?.reply?.trim(),{taskId:b,session:x}=UX(),S=(0,m.useMemo)(()=>A$(e,b,x),[e,b,x]),C=S.map(e=>`${e.id}:${e.taskId??e.session?.name??``}`).join(`|`),w=S.find(e=>e.id===p)??S[0];(0,m.useEffect)(()=>h(void 0),[C]);let T=(0,m.useRef)(null),E=(0,m.useRef)(null),D=(0,m.useRef)(null),O=(0,m.useRef)(a);O.current=a;let k=(0,m.useRef)(void 0);(0,m.useLayoutEffect)(()=>{let e=k.current,t=E.current;e&&t&&(k.current=void 0,t.setSelectionRange(e.start,e.end))},[r]);let ee=(0,m.useCallback)(e=>{k.current={start:e.start,end:e.end},i(e.value)},[]);(0,m.useEffect)(()=>{let e=T.current;if(!e)return;let t=document.documentElement,n=()=>t.style.setProperty(`--composer-h`,v?`0px`:`${Math.ceil(e.getBoundingClientRect().height)}px`);n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect(),t.style.setProperty(`--composer-h`,`0px`)}},[v]);let te=(0,m.useCallback)(e=>{let t=[...e],n=8-O.current.length;t.length>n&&V.warning(`At most 8 files go with one message.`);for(let e of t.slice(0,Math.max(0,n))){let t=`f${++j$}`,n=e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0;o(r=>[...r,{key:t,name:e.name||(n?`image.png`:`file`),size:e.size,...n?{image:n}:{},state:`uploading`}]),C$(e).then(e=>o(n=>n.map(n=>n.key===t?{...n,state:`ready`,info:e}:n))).catch(e=>{V.error(e instanceof Error?e.message:`That file did not upload.`),o(e=>e.filter(e=>e.key!==t))})}},[]),ne=(0,m.useCallback)(e=>{o(t=>{let n=t.find(t=>t.key===e);return n?.image&&URL.revokeObjectURL(n.image),t.filter(t=>t.key!==e)})},[]),A=a.some(e=>e.state===`uploading`),re=a.flatMap(e=>e.info?[e.info.id]:[]),ie=(r.trim().length>0||re.length>0)&&!A&&!l,j=(0,m.useCallback)(async()=>{if(!ie)return;u(!0);let t=re.length>0?re:void 0,n={text:r,...t?{attachments:t}:{}};try{let a=!0;if(w.id===`oracle`){let e=await De(`lobby.send`,n);e.notice&&V(e.notice)}else if(w.id===`knowledge`)a=await H(`knowledge.ask`,n)!==void 0,a&&e.kind===`tab`&&Y(QH(e.rest,!0));else if(w.id===`panel`)a=await H(`planner.send`,n)!==void 0;else if(w.id===`quickfix`)a=await H(`quickfix.submit`,n)!==void 0;else if(w.id===`task`)a=await H(`tasks.message`,{taskId:w.taskId,...n})!==void 0;else if(w.id===`session`)a=await H(`sessions.message`,{...w.session.address,...n})!==void 0;else if(w.id===`newsession`){let e=await H(`sessions.start`,{request:r,...t?{attachments:t}:{}});a=e!==void 0,e?.key&&Y(`#/sessions/${encodeURIComponent(e.key)}`)}else a=await H(`tasks.comment`,{taskId:w.taskId,...n})!==void 0;if(a){i(``);for(let e of O.current)e.image&&URL.revokeObjectURL(e.image);o([])}}catch(e){V.error(e instanceof Error?e.message:`Could not send`)}finally{u(!1)}},[ie,re,w,r,e]),ae=(0,m.useCallback)(async()=>{try{await De(`lobby.abort`,{})}catch(e){V.error(e instanceof Error?e.message:`Could not stop`)}},[]);return(0,L.jsx)(`div`,{ref:T,className:q(`dock pointer-events-none absolute inset-x-0 bottom-0 z-30 px-6 pb-[max(1.25rem,env(safe-area-inset-bottom))] transition-opacity duration-200 ease-snap max-sm:px-2 max-sm:pb-[max(0.5rem,env(safe-area-inset-bottom))]`,v&&`opacity-0`),inert:v,children:(0,L.jsx)(`div`,{className:`pointer-events-auto mx-auto w-full max-w-3xl`,children:(0,L.jsxs)(`div`,{className:q(`group/composer relative rounded-2xl border border-dock-border bg-dock shadow-dock backdrop-blur-xl backdrop-saturate-150 transition-[border-color,box-shadow] duration-300 ease-snap focus-within:border-ring/45 focus-within:shadow-dock-focus`,d&&`border-primary shadow-[0_0_0_3px_color-mix(in_oklab,var(--ring)_30%,transparent)]`),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),f(!0))},onDragLeave:()=>f(!1),onDrop:e=>{e.preventDefault(),f(!1),e.dataTransfer.files.length>0&&te(e.dataTransfer.files)},children:[(0,L.jsx)(Ou,{initial:!1,children:a.length>0?(0,L.jsx)(z.ul,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{type:`spring`,stiffness:420,damping:36},"aria-label":`Attachments`,className:`flex flex-wrap items-end gap-2 overflow-hidden px-3 pt-3`,children:a.map(e=>(0,L.jsx)(P$,{file:e,onRemove:()=>ne(e.key)},e.key))},`files`):null}),s?(0,L.jsx)(`div`,{"aria-label":`Markdown preview`,role:`region`,className:`max-h-48 overflow-y-auto border-b border-border px-4 py-3`,children:r.trim()?(0,L.jsx)(YB,{text:r}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing to preview yet.`})}):null,(0,L.jsx)(`div`,{className:`flex px-4 pt-3 pb-1`,children:(0,L.jsx)(`textarea`,{ref:E,id:`composer-text`,"aria-label":w.label,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&!e.nativeEvent.isComposing){e.preventDefault(),Vk();return}let t=e.currentTarget,n=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&[`b`,`i`,`e`,`k`].includes(n)){e.preventDefault();let{selectionStart:r,selectionEnd:i,value:a}=t;ee(n===`k`?T$(a,r,i):w$(a,r,i,n===`b`?`**`:n===`i`?`_`:"`"));return}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&n===`p`){e.preventDefault(),c(e=>!e);return}if(e.key===`Enter`&&e.shiftKey&&!e.nativeEvent.isComposing&&t.selectionStart===t.selectionEnd){let n=D$(t.value,t.selectionStart);n&&(e.preventDefault(),ee(n));return}if(e.key===`Backspace`&&t.value===``&&O.current.length>0){e.preventDefault(),ne(O.current.at(-1).key);return}(N$(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey))&&(e.preventDefault(),j())},onPaste:e=>{let t=[...e.clipboardData.files];t.length!==0&&(e.preventDefault(),te(t))},placeholder:y&&w.id===`oracle`?`The oracle is working. Enter steers it…`:w.placeholder,rows:1,className:`field-sizing-content max-h-[min(45vh,20rem)] min-h-[1.75rem] w-full min-w-0 flex-1 resize-none bg-transparent text-base leading-relaxed caret-primary outline-none placeholder:text-muted-foreground md:text-[0.9375rem] md:leading-relaxed`})}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-2 px-2 pt-1 pb-2`,children:[(0,L.jsx)(`input`,{ref:D,type:`file`,multiple:!0,hidden:!0,tabIndex:-1,"aria-label":`Attach files`,onChange:e=>{te(e.target.files??[]),e.target.value=``}}),(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"aria-label":`Attach images, PDFs or files`,"data-compact":!0,onClick:()=>D.current?.click(),className:M$,children:(0,L.jsx)(Ah,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsx)(kk,{children:`Attach images, PDFs or files`})]}),(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Preview the Markdown`,"aria-pressed":s,"aria-keyshortcuts":`Alt+P`,"aria-describedby":`focused-action-help`,"data-compact":!0,onClick:()=>c(e=>!e),className:M$,children:(0,L.jsx)(Om,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsxs)(kk,{children:[`Preview `,(0,L.jsx)(GO,{chord:`Alt+P`})]})]}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-4 w-px bg-border`}),e.kind===`tab`&&e.tab===`knowledge`?(0,L.jsx)(O$,{rest:e.rest}):S.length>1?(0,L.jsx)(`div`,{role:`radiogroup`,"aria-label":`Send to`,className:`flex items-center gap-0.5 rounded-lg bg-muted p-0.5 shadow-[inset_0_1px_2px_rgb(0_0_0/0.07)]`,children:S.map(e=>(0,L.jsx)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,role:`radio`,"data-compact":!0,"aria-checked":e.id===w.id,onClick:()=>h(e.id),className:q(`h-6 rounded-md border border-transparent px-2.5 text-xs font-medium transition-[background-color,color,box-shadow] duration-150 outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,e.id===w.id?`btn-raised bg-card text-foreground`:`text-muted-foreground hover:text-foreground`),children:e.pill},e.id))}):(0,L.jsxs)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:[`To the `,w.pill.toLowerCase()]}),(0,L.jsx)(`div`,{className:`@container ml-auto flex min-w-0 flex-1 items-center justify-end overflow-hidden px-2`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-3.5`,children:[e.kind===`tab`&&e.tab===`plan`?(0,L.jsx)(KO,{chord:t.savePlan??`Ctrl+S`,className:`hidden @[34rem]:inline-flex`,children:`save plan`}):null,(0,L.jsx)(KO,{chord:`/`,className:`hidden group-focus-within/composer:!hidden @[28rem]:inline-flex`,children:`write`}),(0,L.jsx)(KO,{chord:`Esc`,className:`hidden group-[:not(:focus-within)]/composer:!hidden @[28rem]:inline-flex`,children:`tabs`}),(0,L.jsx)(KO,{chord:`Shift+Enter`,className:`hidden @[22rem]:inline-flex`,children:`new line`}),(0,L.jsx)(KO,{chord:`Enter`,className:`hidden @[11rem]:inline-flex`,children:`send`}),(0,L.jsxs)(`button`,{type:`button`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"aria-label":`Keyboard shortcuts`,"aria-haspopup":`dialog`,"data-compact":!0,onClick:n,className:`kbd-hint btn-ghost inline-flex h-7 shrink-0 items-center gap-1.5 rounded-lg border px-1.5 text-xs text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(GO,{chord:t.help??`Alt+H`,className:`kbd-hint`}),(0,L.jsx)(`span`,{className:`hidden @[8rem]:inline`,children:`shortcuts`})]})]})}),y&&w.id===`oracle`?(0,L.jsx)(DA,{label:`Stop`,icon:mg,iconOnly:!0,compact:!0,title:`Stop the oracle?`,description:`The current response stops. Work already recorded is kept.`,confirmLabel:`Stop`,variant:`destructive`,onConfirm:()=>void ae()}):null,(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Send`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"data-compact":!0,onClick:()=>void j(),disabled:!ie,className:`btn-tint relative inline-flex size-8 items-center justify-center rounded-lg border [--tint:var(--primary)] before:absolute before:-inset-1 before:content-[''] text-primary-foreground transition-[background-color,color,box-shadow,translate,filter] duration-150 ease-snap outline-none focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none disabled:text-muted-foreground`,children:l?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3.5 text-primary-foreground`}):(0,L.jsx)(Pp,{"aria-hidden":`true`,className:`size-4`,strokeWidth:2.25})})}),(0,L.jsxs)(kk,{children:[`Send `,(0,L.jsx)(GO,{chord:`Enter`})]})]})]}),d?(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-xl bg-card/90 text-sm font-medium text-primary backdrop-blur-[2px]`,children:`Drop to attach`}):null]})})})}function I$(e){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)();async function a(r){if(!t){n(!0),i(void 0);try{let{project:t}=await De(`projects.open`,{path:r});Se([t]),_e(t.id,e)}catch(e){i(e.message)}finally{n(!1)}}}return{opening:t,error:r,open:a}}function L$({path:e,busy:t,browse:n}){let[r,i]=(0,m.useState)(e);return(0,m.useEffect)(()=>i(e),[e]),(0,L.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n(r)},children:[(0,L.jsx)(XK,{"aria-label":`Folder path`,value:r,disabled:t,onChange:e=>i(e.target.value)}),(0,L.jsx)(J,{type:`submit`,disabled:t||!r.trim(),children:`Go`})]})}function R$({data:e,busy:t,browse:n}){return(0,L.jsxs)(`div`,{className:`min-h-24 max-h-64 overflow-y-auto rounded-lg border border-border`,"aria-label":`Folders`,role:`group`,children:[e?.parent?(0,L.jsxs)(J,{variant:`ghost`,className:`w-full justify-start`,disabled:t,onClick:()=>n(e.parent),children:[(0,L.jsx)(Pp,{}),` Parent folder`]}):null,e?.folders.map(e=>(0,L.jsxs)(J,{variant:`ghost`,className:`w-full justify-start`,disabled:t,onClick:()=>n(e.path),children:[(0,L.jsx)(Rm,{className:`shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),e&&!e.folders.length?(0,L.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`No subfolders. You can open this folder.`}):null,e?.truncated?(0,L.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Listing limited to 2,000 entries. Enter a path to browse further.`}):null]})}function z$({tab:e,close:t,busyChanged:n}){let[r,i]=(0,m.useState)(),a=Tk(`projects.browse`,r===void 0?{}:{path:r},[]),o=I$(e);return(0,m.useEffect)(()=>n(o.opening),[o.opening,n]),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-4 p-5`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Open project folder`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Browse folders on the machine running bot-lobby. Opening starts a separate session; your current project keeps running. Project-local extensions are not enabled automatically.`}),(0,L.jsx)(L$,{path:a.data?.path??r??``,busy:o.opening,browse:i}),(0,L.jsx)(R$,{data:a.data,busy:a.loading||o.opening,browse:i}),a.loading?(0,L.jsx)(`p`,{role:`status`,children:`Loading folders…`}):null,a.error||o.error?(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.error??o.error}):null,(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[a.error?(0,L.jsx)(J,{variant:`outline`,onClick:a.reload,disabled:a.loading,children:`Retry`}):null,(0,L.jsx)(J,{variant:`outline`,onClick:t,disabled:o.opening,children:`Cancel`}),(0,L.jsx)(J,{disabled:!a.data||a.loading||!!a.error||o.opening,onClick:()=>void o.open(a.data.path),children:o.opening?`Opening project…`:`Open this folder`})]})]})}function B$({open:e,onClose:t,tab:n}){let r=tk(e,ek.help),[i,a]=(0,m.useState)(!1);return(0,L.jsx)(qO,{open:r,label:`Open project folder`,onOpenChange:e=>{!e&&!i&&t()},dismissOnBackdrop:!i,onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[role="combobox"][aria-label="Project"]`)?.focus()},children:e?(0,L.jsx)(z$,{tab:n,close:t,busyChanged:a}):null})}function V$(){try{return{id:M()}}catch(e){return{error:e.message}}}function H$(e,t){if(e){if(t&&!e.projects.some(e=>e.id===t))return`Selected project is unknown or offline. Refresh or choose a running project.`;if(!e.projects.length)return`No authorized running projects found. Open a folder from the Project menu, or refresh.`}}function U$(){let[e,t]=(0,m.useState)(),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(!1),o=(0,m.useRef)(0);async function s(){let e=++o.current;a(!0),r(void 0);try{let n=await De(`projects.list`,{});Se(n.projects),e===o.current&&t(n)}catch(t){e===o.current&&r(t.message)}finally{e===o.current&&a(!1)}}(0,m.useEffect)(()=>(s(),()=>{o.current++}),[]);let[c,l]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!i)return l(!1);let e=setTimeout(()=>l(!0),300);return()=>clearTimeout(e)},[i]),{data:e,error:n,busy:i,slow:c,refresh:s}}function W$({data:e,error:t}){let n=V$();return n.error??t??H$(e,n.id)}function G$({projects:e}){let t=W$(e);return t?(0,L.jsxs)(`p`,{role:`alert`,className:`notice flex min-w-0 items-start gap-2 pt-1 pb-0.5 text-xs break-words text-destructive`,children:[(0,L.jsx)(Eg,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,L.jsx)(`span`,{children:t})]}):null}function K$(e){let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0,n=e.key===`Home`?`first`:e.key===`End`?`last`:void 0;if(!t&&!n)return;let r=[...e.currentTarget.querySelectorAll(`[role='option']`)];if(r.length===0)return;e.preventDefault();let i=r.indexOf(document.activeElement);r[n===`first`?0:n===`last`?r.length-1:Math.max(0,Math.min(r.length-1,(i<0?t>0?-1:r.length:i)+t))]?.focus()}function q$({projects:e,tab:t,name:n,branch:r}){let{data:i,busy:a,slow:o,refresh:s}=e,[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),f=V$(),p=W$(e),h=f.error?`invalid`:f.id??i?.currentId??``;qk(`p`,()=>l(!0)),qk(`r`,()=>void s(),{enabled:c,inDialog:!0});function g(e){l(!1),e!==h&&_e(e,t)}return(0,L.jsxs)(`div`,{"aria-busy":a,className:`flex min-w-0 items-center gap-1.5`,children:[(0,L.jsxs)(uD,{open:c,onOpenChange:l,children:[(0,L.jsxs)(dD,{type:`button`,role:`combobox`,"aria-label":`Project`,"aria-description":`${n}${r?`, branch ${r}`:``}`,"aria-haspopup":`listbox`,"aria-expanded":c,"aria-keyshortcuts":`P ArrowDown`,onKeyDown:e=>{e.key!==`ArrowDown`||e.altKey||e.metaKey||e.ctrlKey||(e.preventDefault(),l(!0))},className:`btn-ghost group flex h-8 min-w-0 items-center gap-2 rounded-lg border border-transparent px-2.5 text-sm font-medium outline-none transition-[box-shadow,background-color] duration-150 focus-visible:ring-3 focus-visible:ring-ring/40 disabled:pointer-events-none`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:q(`size-2.5 shrink-0 rounded-full`,p?`bg-destructive`:`bg-primary`)}),(0,L.jsx)(`span`,{className:`truncate`,children:n}),(0,L.jsx)(Xp,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsx)(fD,{children:(0,L.jsxs)(pD,{align:`start`,sideOffset:6,"aria-label":`Projects`,onKeyDown:K$,onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[role='option'][aria-selected='true']`)??e.currentTarget?.querySelector(`[role='option']`);t&&(e.preventDefault(),t.focus())},className:`glass-pop z-50 flex w-[min(26rem,calc(100vw-1.5rem))] origin-(--radix-popover-content-transform-origin) flex-col overflow-hidden rounded-xl outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Running projects`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:a,"aria-label":`Refresh list`,"aria-keyshortcuts":`R`,className:`inline-flex h-7 items-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 disabled:opacity-60`,children:[a?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}):(0,L.jsx)(Kh,{"aria-hidden":`true`,className:`size-3`}),`Refresh`,(0,L.jsx)(GO,{chord:`R`,className:`kbd-hint`})]})]}),(0,L.jsx)(`div`,{role:`listbox`,"aria-label":`Projects`,className:`flex max-h-72 flex-col overflow-y-auto p-1`,children:i?.projects.map(e=>{let t=e.id===h;return(0,L.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>g(e.id),className:q(`flex min-h-10 w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left outline-none transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-3 focus-visible:ring-ring/30`,t&&`bg-accent`),children:[(0,L.jsx)(`span`,{className:`flex h-5 w-4 shrink-0 items-center justify-center`,children:t?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 text-primary`}):null}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,L.jsxs)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:[e.cwd,` · :`,e.port]})]})]},e.id)})}),(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 border-t border-border px-3 py-3 text-sm font-medium outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/40`,onClick:()=>{l(!1),d(!0)},children:[(0,L.jsx)(Im,{"aria-hidden":`true`,className:`size-4`}),`Open folder…`]})]})})]}),(0,L.jsx)(B$,{open:u,onClose:()=>d(!1),tab:t}),r?(0,L.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground sm:inline-flex`,children:[(0,L.jsx)(Bm,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:r})]}):null,o||p?(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Refresh projects`,disabled:a,onClick:()=>void s(),className:`btn-ghost inline-flex size-8 shrink-0 items-center justify-center rounded-lg border border-transparent text-muted-foreground outline-none transition-[box-shadow,color,translate] hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px disabled:opacity-60`,children:a?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-4`}):(0,L.jsx)(Kh,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsx)(kk,{side:`bottom`,children:`Refresh projects`})]}):null]})}function J$({state:e}){return e===`live`?(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`span`,{role:`img`,"aria-label":`Connected`,className:`grid size-6 place-items-center`,children:(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-success`})})}),(0,L.jsx)(kk,{children:`Connected`})]}):e===`connecting`?(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}),`reconnecting…`]}):(0,L.jsx)(`span`,{className:`text-xs font-medium text-destructive`,children:`Connection lost`})}var Y$=`toolbar-button inline-flex size-8 shrink-0 items-center justify-center rounded-lg border text-foreground transition-[background-color,border-color,translate] duration-150 ease-snap outline-none focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`;function X$({label:e,hint:t,href:n,active:r,children:i}){return(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`a`,{href:n,"aria-label":e,"aria-current":r?`page`:void 0,"aria-keyshortcuts":t,"aria-describedby":`focused-action-help`,className:Y$,children:i})}),(0,L.jsxs)(kk,{side:`bottom`,children:[e,` `,(0,L.jsx)(GO,{chord:t})]})]})}function Z$({hint:e,onHelp:t}){return(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Keyboard shortcuts`,"aria-haspopup":`dialog`,"aria-keyshortcuts":e,"aria-describedby":`focused-action-help`,onClick:t,className:Y$,children:(0,L.jsx)(Jm,{"aria-hidden":`true`,className:`size-[1.05rem]`})})}),(0,L.jsxs)(kk,{side:`bottom`,children:[`Keyboard shortcuts `,(0,L.jsx)(GO,{chord:e})]})]})}function Q$(){let e=DK(),t=e?`Unmute prompt sounds`:`Mute prompt sounds`;return(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":t,"aria-pressed":e,"aria-describedby":`focused-action-help`,className:Y$,onClick:()=>TK(!e),children:e?(0,L.jsx)(Ig,{"aria-hidden":`true`,className:`size-[1.05rem]`}):(0,L.jsx)(Pg,{"aria-hidden":`true`,className:`size-[1.05rem]`})})}),(0,L.jsx)(kk,{side:`bottom`,children:t})]})}function $$(){let{theme:e,setTheme:t}=Nq(),n=e===`dark`||e===`system`&&typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;return(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":n?`Switch to light mode`:`Switch to dark mode`,"aria-keyshortcuts":`D`,"aria-describedby":`focused-action-help`,onClick:()=>t(n?`light`:`dark`),className:Y$,children:n?(0,L.jsx)(gg,{"aria-hidden":`true`,className:`size-[1.05rem]`}):(0,L.jsx)(wh,{"aria-hidden":`true`,className:`size-[1.05rem]`})})}),(0,L.jsxs)(kk,{side:`bottom`,children:[n?`Light mode`:`Dark mode`,` `,(0,L.jsx)(GO,{chord:`D`})]})]})}function e1({busy:e,task:t,sessionName:n}){return(0,L.jsxs)(`div`,{className:`mr-1 flex min-w-0 items-center gap-2 text-[0.8125rem]`,children:[e?(0,L.jsx)(_k,{"aria-hidden":`true`,role:`presentation`,className:`size-3.5`}):null,t?(0,L.jsxs)(`span`,{className:`hidden max-w-[16rem] truncate md:inline`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:t.id}),(0,L.jsxs)(`span`,{className:`hidden text-muted-foreground min-[1500px]:inline`,children:[` · `,t.state.replace(/_/g,` `)]})]}):(0,L.jsx)(`span`,{className:`hidden max-w-[10rem] truncate text-muted-foreground min-[1500px]:inline`,children:n??`no task in this session`})]})}function t1(e){if(!e)return 0;let t=[...e.children].filter(e=>e instanceof HTMLElement&&e.offsetParent!==null&&getComputedStyle(e).position!==`absolute`);if(!t.length)return 0;let n=Math.min(...t.map(e=>e.getBoundingClientRect().left)),r=Math.max(...t.map(e=>e.getBoundingClientRect().right)),i=0;for(let t of e.querySelectorAll(`*`))t.clientWidth<=1||t.offsetParent===null||t.scrollWidth<=t.clientWidth+1||getComputedStyle(t).textOverflow===`ellipsis`&&(i+=t.scrollWidth-t.clientWidth);return r-n+i}var n1=24;function r1(){let e=(0,m.useRef)(null),[t,n]=(0,m.useState)(!1),r=(0,m.useRef)(()=>{});return r.current=()=>{let t=e.current;if(!t)return;let r=t.querySelector(`[role="tablist"]`),i=getComputedStyle(t),a=parseFloat(i.columnGap)||0,o=t.clientWidth-(parseFloat(i.paddingLeft)||0)-(parseFloat(i.paddingRight)||0),s=t1(t.querySelector(`.where`))+(r?.offsetWidth??0)+t1(t.querySelector(`.tools`))+a*2;n(s+n1<=o)},(0,m.useLayoutEffect)(()=>r.current()),(0,m.useLayoutEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>r.current());n.observe(t);for(let e of t.querySelectorAll(`[role="tablist"], .where, .tools`))n.observe(e);return()=>n.disconnect()},[]),{header:e,one:t}}function i1({status:e,task:t,connection:n,route:r,tabs:i,extra:a,keys:o,onHelp:s}){let c=e?.workspace.name??`bot-lobby`,l=e?.branch??e?.workspace.branch,u=e?.busy??!1,d=U$(),{header:f,one:p}=r1();return(0,L.jsxs)(`header`,{ref:f,className:`app-header shrink-0`,"data-one-row":p||void 0,children:[(0,L.jsx)(`div`,{className:`where flex min-w-0 items-center`,children:(0,L.jsx)(q$,{projects:d,tab:r.kind===`tab`?r.tab:r.kind,name:c,branch:l})}),(0,L.jsx)(`div`,{className:`tabs min-w-0`,children:i}),(0,L.jsxs)(`div`,{className:`tools flex min-w-0 items-center justify-end gap-2`,children:[a,(0,L.jsx)(e1,{busy:u,...t?{task:t}:{},...e?.sessionName?{sessionName:e.sessionName}:{}}),(0,L.jsx)(J$,{state:n}),(0,L.jsx)(X$,{label:`Sessions`,hint:o.sessions??`Alt+O`,href:`#/sessions`,active:r.kind===`sessions`,children:(0,L.jsx)(Xm,{"aria-hidden":`true`,className:`size-[1.05rem]`})}),(0,L.jsx)(X$,{label:`Settings`,hint:o.settings??`Alt+S`,href:`#/settings`,active:r.kind===`settings`,children:(0,L.jsx)(og,{"aria-hidden":`true`,className:`size-[1.05rem]`})}),(0,L.jsx)(Z$,{hint:o.help??`Alt+H`,onHelp:s}),(0,L.jsx)($$,{}),(0,L.jsx)(Q$,{}),(0,L.jsx)(`span`,{id:`focused-action-help`,className:`sr-only`,children:`Focused buttons: Enter or Space. Links: Enter. Checkboxes: Space.`})]}),(0,L.jsx)(G$,{projects:d})]})}function a1(e){let t=e.match(/[#&?]?token=([^&\s#]+)/i);if(t?.[1])return decodeURIComponent(t[1]);let n=e.trim();return n&&!n.includes(`/`)&&!n.includes(` `)?n:void 0}function o1(){let[e,t]=(0,m.useState)(``),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(!1);async function o(e){a(!0),r(void 0),e&&(window.location.hash=`token=${encodeURIComponent(e)}`),await ke()?window.location.reload():(r(e?`That link did not sign in. Copy the link from Pi and try again.`:`Paste the link from Pi below.`),a(!1))}function s(t){t.preventDefault(),o(a1(e))}return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,L.jsxs)(`form`,{onSubmit:s,className:`glass flex w-full max-w-md flex-col gap-4 rounded-xl p-6`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Km,{className:`size-5`,"aria-hidden":`true`}),(0,L.jsx)(`h1`,{className:`text-base font-medium`,children:`Sign in to bot-lobby`})]}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Pi printed a link when it started (or run `,(0,L.jsx)(`code`,{className:`rounded-lg bg-muted px-1.5 py-0.5 font-mono text-xs`,children:`/bot-lobby web`}),`to see it again). Paste it here.`]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:`Lobby link or token`}),(0,L.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),autoComplete:`off`,spellCheck:!1,placeholder:`http://127.0.0.1:7347/#token=…`,className:`h-8 rounded-lg border border-input bg-background px-3.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30`})]}),n?(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:n}):null,(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void o(void 0),children:`Retry`}),(0,L.jsx)(J,{type:`submit`,disabled:i||!e.trim(),children:`Sign in`})]})]})})}var s1=.6;function c1(e,t,n={}){return{initial:e?void 0:!1,animate:t,transition:{duration:s1,...n}}}var l1=(e,t)=>[0,Math.max(e,.001),Math.min(Math.max(t,e+.01),.999),1];function u1(e,t=0,n=1){return c1(e,{pathLength:[0,0,1,1],strokeOpacity:[0,0,1,1]},{pathLength:{duration:s1,times:l1(t,n),ease:`easeInOut`},strokeOpacity:{duration:s1,times:l1(t,t+.02)}})}function d1(e,t){return c1(e,{scale:[0,0,1.3,1]},{times:l1(t,t+.18),ease:`easeOut`})}function f1(e,t,n=1.3){return c1(e,{scale:[1,1,n,1,1]},{times:[0,Math.max(t,.001),Math.min(t+.15,.9),Math.min(t+.35,.99),1],ease:`easeInOut`})}var p1=(e=.5,t=.5)=>({transformBox:`fill-box`,originX:e,originY:t});function m1({play:e}){return(0,L.jsxs)(z.g,{style:p1(.1,.9),...c1(e,{rotate:[0,-12,8,-4,0],scale:[1,1.12,.96,1.02,1]},{ease:`easeInOut`}),children:[(0,L.jsx)(`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}),[8,12,16].map((t,n)=>(0,L.jsx)(z.circle,{cx:t,cy:11,r:1.15,fill:`currentColor`,stroke:`none`,...c1(e,{fillOpacity:[0,0,1,1,0],y:[0,0,-1.5,0,0]},{times:[0,.12+n*.12,.24+n*.12,.72,1]})},t))]})}function h1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.path,{d:`M13 5h8`,...u1(e,.15,.45)}),(0,L.jsx)(z.path,{d:`M13 12h8`,...u1(e,.3,.6)}),(0,L.jsx)(z.path,{d:`M13 19h8`,...u1(e,.45,.75)}),(0,L.jsx)(z.path,{d:`m3 17 2 2 4-4`,...u1(e,.35,.7)}),(0,L.jsx)(z.path,{d:`m3 7 2 2 4-4`,...u1(e,0,.35)})]})}function g1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.circle,{cx:6,cy:19,r:3,style:p1(),...f1(e,0)}),(0,L.jsx)(z.path,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,...u1(e,.1,.7)}),(0,L.jsx)(z.circle,{cx:18,cy:5,r:3,style:p1(),...d1(e,.62)})]})}function _1({play:e}){return(0,L.jsx)(z.g,{style:p1(),...c1(e,{rotate:[0,-14,10,-6,0],scale:[1,1.18,.94,1.04,1]},{duration:.5,ease:`easeInOut`}),children:(0,L.jsx)(z.path,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,fill:`currentColor`,...c1(e,{fillOpacity:[0,.85,0]},{duration:.5,times:[0,.2,1]})})})}function v1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.circle,{cx:12,cy:12,r:10,style:p1(),...c1(e,{scale:[1,1,1.4],strokeOpacity:[0,.5,0]},{times:[0,.25,1],ease:`easeOut`})}),(0,L.jsx)(z.circle,{cx:12,cy:12,r:10,style:p1(),...c1(e,{scale:[1,.86,1.06,1]},{times:[0,.25,.55,1],ease:`easeInOut`})}),(0,L.jsx)(z.circle,{cx:12,cy:12,r:1,fill:`currentColor`,style:p1(),...c1(e,{scale:[1,2.4,.8,1]},{times:[0,.3,.6,1],ease:`easeInOut`})})]})}function y1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`}),[`M8 17v-3`,`M13 17V5`,`M18 17V9`].map((t,n)=>(0,L.jsx)(z.path,{d:t,style:p1(.5,1),...c1(e,{scaleY:[0,0,1.18,1]},{times:l1(.08+n*.14,.4+n*.14),ease:`easeOut`})},t))]})}function b1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.circle,{cx:6,cy:6,r:3,style:p1(),...f1(e,0)}),(0,L.jsx)(z.line,{x1:6,x2:6,y1:9,y2:21,...u1(e,.05,.45)}),(0,L.jsx)(z.path,{d:`M13 6h3a2 2 0 0 1 2 2v7`,...u1(e,.2,.62)}),(0,L.jsx)(z.circle,{cx:18,cy:18,r:3,style:p1(),...d1(e,.58)})]})}function x1({play:e}){return(0,L.jsxs)(z.g,{style:p1(),...c1(e,{scaleX:[1,.55,1.08,1],y:[0,-1,0,0]},{times:[0,.35,.65,1],ease:`easeInOut`}),children:[(0,L.jsx)(z.path,{d:`M12 5v16`,style:p1(),...c1(e,{scaleY:[1,1.12,1,1]},{times:[0,.35,.65,1]})}),(0,L.jsx)(`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`})]})}function S1({play:e}){return(0,L.jsxs)(z.g,{style:p1(.6,.6),...c1(e,{x:[0,1.5,-1.5,1,0],y:[0,-1,.5,-.5,0],rotate:[0,-8,6,-3,0]},{ease:`easeInOut`}),children:[(0,L.jsx)(`path`,{d:`M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z`}),(0,L.jsx)(`path`,{d:`m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18`}),(0,L.jsx)(z.path,{d:`m2.3 2.3 7.286 7.286`,...u1(e,.1,.6)}),(0,L.jsx)(z.circle,{cx:11,cy:11,r:2,style:p1(),...f1(e,.5,1.5)})]})}var C1={lobby:m1,tasks:h1,plan:g1,quickfix:_1,issues:v1,metrics:y1,git:b1,knowledge:x1,excalidraw:S1};function w1({id:e,play:t,className:n}){let r=C1[e];return r?(0,L.jsx)(`svg`,{"aria-hidden":`true`,"data-tab-icon":e,"data-play":t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:q(`overflow-visible`,n),children:(0,L.jsx)(r,{play:t})},t):null}function T1(e){return/(\d)$/.exec(e)?.[1]}var E1=160;function D1(e){let t=Sf(),[n,r]=(0,m.useState)(0),i=(0,m.useRef)(0),a=(0,m.useCallback)(()=>{t||performance.now()<i.current||(i.current=performance.now()+s1*1e3,r(e=>e+1))},[t]),o=(0,m.useRef)(e);return(0,m.useEffect)(()=>{let t=e&&!o.current;if(o.current=e,!t)return;let n=window.setTimeout(a,E1);return()=>window.clearTimeout(n)},[e,a]),{play:n,onPointerEnter:(0,m.useCallback)(e=>{e.pointerType!==`touch`&&a()},[a])}}var O1=(0,m.forwardRef)(function({tab:e,active:t},n){let r=T1(e.key),{play:i,onPointerEnter:a}=D1(t);return(0,L.jsxs)(Dk,{children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsxs)(`a`,{ref:n,role:`tab`,id:`tab-${e.id}`,href:`#/${e.id}`,"aria-selected":t,"aria-keyshortcuts":e.key,tabIndex:t?0:-1,onPointerEnter:a,className:q(`relative z-10 inline-flex h-7.5 shrink-0 items-center gap-1.5 rounded-lg border border-[var(--tab-outline)] px-2.5 text-[0.8125rem] leading-none font-medium whitespace-nowrap outline-none`,`transition-colors duration-200 ease-snap focus-visible:ring-3 focus-visible:ring-ring/40`,t?`text-foreground`:`bg-[var(--tab-idle)] text-muted-foreground hover:text-foreground`),children:[(0,L.jsx)(w1,{id:e.id,play:i,className:q(`size-3.5 shrink-0 transition-colors duration-200`,t&&`text-primary`)}),r?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:q(`text-[0.72rem] font-semibold tabular-nums transition-colors duration-200`,t?`text-primary`:`text-muted-foreground/75`),children:r}):null,(0,L.jsx)(`span`,{children:e.label})]})}),(0,L.jsxs)(kk,{children:[e.label,` `,(0,L.jsx)(GO,{chord:e.key})]})]})}),k1=1.5;function A1(e,t,n=t?.left??0,r=t?.right??0,i=1){if(e){if(!t||r-n<.5){e.style.opacity=`0`;return}e.style.opacity=String(Math.min(1,(r-n)/14)),e.style.top=`${t.top}px`,e.style.height=`${t.height}px`,e.style.width=`${r-n}px`,e.style.transform=`translateX(${n}px)`,e.style.scale=i===1?``:`1 ${i}`}}function j1(e,t){let n=e.right-e.left,{height:r}=e,i=k1/2,a=Math.max(0,Math.min(e.radius-i,r/2-i,n/2-i)),o=r/2,s=e=>+(t===`left`?e:n-e).toFixed(2),c=+(t===`left`),l=1-c,u=i,d=n-i,f=r-i;return[`M${s(u)} ${o}L${s(u)} ${i+a}A${a} ${a} 0 0 ${c} ${s(u+a)} ${i}L${s(d-a)} ${i}A${a} ${a} 0 0 ${c} ${s(d)} ${i+a}L${s(d)} ${o}`,`M${s(u)} ${o}L${s(u)} ${f-a}A${a} ${a} 0 0 ${l} ${s(u+a)} ${f}L${s(d-a)} ${f}A${a} ${a} 0 0 ${l} ${s(d)} ${f-a}L${s(d)} ${o}`]}function M1(e,t,n,r){if(!e)return;if(!t||r<=.002){e.style.opacity=`0`;return}let i=t.right-t.left,a=`${i}x${t.height}r${t.radius}${n}`;e.dataset.shape!==a&&(e.dataset.shape=a,e.dataset.port=n,e.setAttribute(`viewBox`,`0 0 ${i} ${t.height}`),j1(t,n).forEach((t,n)=>e.children[n]?.setAttribute(`d`,t))),e.style.opacity=String(Math.min(1,r*12)),e.style.top=`${t.top}px`,e.style.height=`${t.height}px`,e.style.width=`${i}px`,e.style.transform=`translateX(${t.left}px)`;let o=`${Math.min(1,r)} 2`;for(let t of e.children)t.style.strokeDasharray=o}var N1={type:`spring`,visualDuration:.12,bounce:0},P1={type:`spring`,visualDuration:.17,bounce:.15,delay:.015},F1={type:`spring`,visualDuration:.17,bounce:.05,delay:.07},I1={type:`spring`,visualDuration:.22,bounce:.25},L1={type:`spring`,visualDuration:.2,bounce:0},R1={type:`spring`,stiffness:900,damping:18,velocity:45,restDelta:.02,restSpeed:1},z1=(()=>{let e=wr({keyframes:[0,1],visualDuration:I1.visualDuration,bounce:I1.bounce}),t=0;for(;t<1e3&&e.next(t).value<.97;)t+=4;return t/1e3})(),B1={type:`spring`,visualDuration:.28,bounce:.6};function V1(e,t){let n=(0,m.useRef)(null),r=(0,m.useRef)(null),i=(0,m.useRef)(null),a=(0,m.useRef)(null),o=(0,m.useRef)(null),s=(0,m.useRef)({}),c=(0,m.useRef)([]),l=(0,m.useRef)(void 0),u=(0,m.useRef)([]),d=(0,m.useRef)(1),f=(0,m.useRef)(1),p=(0,m.useCallback)(e=>{let t=e?s.current[e]:void 0;if(!t)return;let n=parseFloat(getComputedStyle(t).borderTopLeftRadius)||0;return{left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,top:t.offsetTop,height:t.offsetHeight,radius:n}},[]),h=(0,m.useCallback)(()=>{for(let e of u.current)e.stop();u.current=[];for(let e of Object.values(s.current))e?.style.translate&&(e.style.translate=``)},[]),g=(0,m.useCallback)(e=>{h(),l.current=e,d.current=1,f.current=1;let t=p(e);A1(r.current,t),A1(i.current,void 0),M1(a.current,t,`left`,1),M1(o.current,void 0,`left`,0);for(let e of c.current)e&&(e.style.width=`0px`);LB()},[p,h]),_=(0,m.useCallback)((e,t)=>{let n=p(e),m=p(t);if(!n||!m)return g(t);h(),IB(),l.current=t;let _=m.left>n.left?1:-1,v=_>0?n.right:n.left,y=_>0?m.left:m.right,b=Math.abs(y-v),x=_>0?`right`:`left`,S=_>0?`left`:`right`,C=c.current.map(e=>{let t=e?.parentElement;return t?{liquid:e,from:t.offsetLeft,to:t.offsetLeft+t.offsetWidth}:void 0}),w=b>4?1-4/b:0,T={drained:1-Math.min(1,d.current),unrung:1-Math.min(1,f.current),head:0,tail:0,filled:0,rung:0,squash:1,budge:0},E=s.current[t];d.current=0,f.current=0;let D=()=>{let e=(n.right-n.left)*Math.min(1,T.drained);A1(i.current,n,_>0?n.left+e:n.left,_>0?n.right:n.right-e),M1(o.current,n,x,1-T.unrung);let t=v+_*b*T.head,s=v+_*b*T.tail,c=Math.min(t,s),l=Math.max(t,s);for(let e of C){if(!e?.liquid)continue;let t=Math.max(c,e.from),n=Math.min(l,e.to);e.liquid.style.width=`${Math.max(0,n-t)}px`,e.liquid.style.transform=`translateX(${Math.max(0,t-e.from)}px)`}let u=_*T.budge,d=u?{...m,left:m.left+u,right:m.right+u}:m;E&&(E.style.translate=Math.abs(u)>.01?`${u.toFixed(2)}px`:``);let f=(d.right-d.left)*Math.min(1,Math.max(0,T.filled));A1(r.current,d,_>0?d.left:d.right-f,_>0?d.left+f:d.right,Math.min(1,T.squash)),M1(a.current,d,S,T.rung)},O=(e,t,n,r,i=1)=>{let a=Gf(t,i,{...n,onUpdate:t=>{T[e]=t,r?.(t),D()}});return u.current.push(a),a},k=!1,ee=()=>{if(k)return;k=!0;let e=O(`filled`,0,I1,e=>{d.current=e});e.then(()=>{l.current===t&&LB()}),O(`squash`,.8,B1),O(`rung`,0,L1,e=>{f.current=e}),O(`budge`,0,{...R1,delay:z1},void 0,0),Promise.all([e,...u.current]).then(()=>{l.current===t&&u.current.includes(e)&&g(t)})};O(`drained`,T.drained,N1),O(`unrung`,T.unrung,N1),O(`head`,0,P1,e=>{e>=w&&ee()}),O(`tail`,0,F1),D()},[p,g,h]);(0,m.useLayoutEffect)(()=>{let t=l.current,n=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;!t||!e||t===e||n?g(e):_(t,e)},[e,t,_,g]);let v=(0,m.useRef)(e);return v.current=e,(0,m.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=!0,r=new ResizeObserver(()=>{if(t){t=!1;return}g(v.current)});return r.observe(e),()=>{r.disconnect(),h()}},[g,h]),{track:n,fill:r,drain:i,ring:a,unring:o,cells:s,liquids:c}}var H1=(0,m.forwardRef)(function({which:e},t){return(0,L.jsxs)(`svg`,{ref:t,"aria-hidden":`true`,[`data-tab-${e}`]:``,className:`pointer-events-none absolute left-0 z-20 overflow-visible opacity-0 will-change-transform`,fill:`none`,children:[(0,L.jsx)(`path`,{pathLength:1,strokeWidth:k1,strokeLinecap:`round`,className:`stroke-tab-rim`}),(0,L.jsx)(`path`,{pathLength:1,strokeWidth:k1,strokeLinecap:`round`,className:`stroke-tab-rim`})]})});function U1(e){if(e.left||e.right)return`linear-gradient(to right, ${e.left?`transparent 0, black 28px`:`black 0`}, ${e.right?`black calc(100% - 28px), transparent 100%`:`black 100%`})`}function W1({tabs:e,activeId:t,onSelect:n}){let{track:r,fill:i,drain:a,ring:o,unring:s,cells:c,liquids:l}=V1(t,e.length),u=(0,m.useRef)(null),[d,f]=(0,m.useState)({left:!1,right:!1}),p=(0,m.useCallback)(()=>{let e=u.current;if(!e)return;let t=e.scrollLeft>2,n=e.scrollLeft+e.clientWidth<e.scrollWidth-2;f(e=>e.left===t&&e.right===n?e:{left:t,right:n})},[]);(0,m.useEffect)(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;p();let t=new ResizeObserver(p);return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[p,e.length]),(0,m.useEffect)(()=>{let e=u.current,n=t?c.current[t]:void 0;e&&n&&(n.offsetLeft<e.scrollLeft?e.scrollLeft=n.offsetLeft-8:n.offsetLeft+n.offsetWidth>e.scrollLeft+e.clientWidth&&(e.scrollLeft=n.offsetLeft+n.offsetWidth-e.clientWidth+8))},[t,c]);function h(r){if(r.key===`ArrowDown`&&!r.altKey){Bk()&&r.preventDefault();return}let i=r.key===`ArrowRight`?1:r.key===`ArrowLeft`?-1:0;if(!i||e.length===0)return;r.preventDefault();let a=r.target.closest(`[role='tab']`)?.id.replace(/^tab-/,``)??t,o=e[(Math.max(0,e.findIndex(e=>e.id===a))+i+e.length)%e.length];Hk.active=!0,Hk.to=o.id,window.setTimeout(()=>{Hk.active=!1,Hk.to=void 0},3e3),n(o.id),c.current[o.id]?.focus({preventScroll:!0})}return(0,L.jsx)(`div`,{ref:u,onScroll:p,style:{maskImage:U1(d),WebkitMaskImage:U1(d)},className:`min-w-0 max-w-full overflow-x-auto [scrollbar-width:none] pointer-coarse:-my-1.5 pointer-coarse:py-1.5 [&::-webkit-scrollbar]:hidden`,children:(0,L.jsxs)(`div`,{ref:r,role:`tablist`,"aria-label":`Lobby tabs`,onKeyDown:h,className:`relative mx-auto flex w-max items-center py-0.5`,children:[(0,L.jsx)(`span`,{ref:a,"aria-hidden":`true`,"data-tab-drain":!0,className:`pointer-events-none absolute left-0 z-0 rounded-lg bg-tab-fill opacity-0 will-change-transform`}),(0,L.jsx)(`span`,{ref:i,"aria-hidden":`true`,"data-tab-fill":!0,className:`pointer-events-none absolute left-0 z-0 rounded-lg bg-tab-fill opacity-0 will-change-transform`}),(0,L.jsx)(H1,{ref:s,which:`unring`}),(0,L.jsx)(H1,{ref:o,which:`ring`}),e.map((e,n)=>(0,L.jsxs)(m.Fragment,{children:[n>0?(0,L.jsxs)(`span`,{"aria-hidden":`true`,"data-tab-link":!0,className:`relative h-[2px] w-3.5 shrink-0 sm:w-4`,children:[(0,L.jsx)(`span`,{className:`absolute inset-0 border-t-2 border-dotted border-input`}),(0,L.jsx)(`span`,{ref:e=>{l.current[n-1]=e},"data-tab-liquid":!0,className:`absolute top-0 left-0 h-[2px] w-0 rounded-full bg-tab-liquid shadow-[0_0_6px_var(--tab-liquid)] will-change-transform`})]}):null,(0,L.jsx)(O1,{ref:t=>{c.current[e.id]=t},tab:e,active:e.id===t})]},e.id))]})})}function G1({oracleBusy:e,runs:t,activity:n,background:r}){let i=new Set;e&&i.add(`Oracle`);for(let e of t)e.status===`running`&&i.add(DH(jH(e)));for(let e of n)e.pending&&e.source!==`LOBBY`&&i.add(e.source===`MASTER`?`Oracle`:DH(e.source));let a=r.filter(e=>e.alive&&e.busy).length;return a&&i.add(a===1?`1 in the background`:`${a} in the background`),[...i]}function K1(e){return e.length<=2?e.join(`, `):`${e.slice(0,2).join(`, `)} +${e.length-2}`}var q1=6,J1=`bot-lobby.orb`,Y1=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1;function X1(e,t,n,r){let i=e=>e+q1,a=(e,t)=>Math.max(e+q1,e+t-r-q1);return{x:Math.min(a(n.left,n.width),Math.max(i(n.left),e)),y:Math.min(a(n.top,n.height),Math.max(i(n.top),t))}}function Z1(e,t,n,r){let i=e=>Math.max(1,e-r),a=X1(e,t,n,r);return{fx:Math.min(1,Math.max(0,(a.x-n.left)/i(n.width))),fy:Math.min(1,Math.max(0,(a.y-n.top)/i(n.height)))}}function Q1(e,t,n){return X1(t.left+e.fx*Math.max(0,t.width-n),t.top+e.fy*Math.max(0,t.height-n),t,n)}function $1(e){if(e)try{let t=JSON.parse(e);return Y1(t.fx)&&Y1(t.fy)?{fx:t.fx,fy:t.fy}:void 0}catch{return}}function e0(){try{return $1(localStorage.getItem(J1))}catch{return}}function t0(e){try{localStorage.setItem(J1,JSON.stringify(e))}catch{}}var n0=5,r0=16;function i0(){let e=document.getElementById(`main`)?.getBoundingClientRect();return e?{left:e.left,top:e.top,width:e.width,height:e.height}:void 0}function a0(){let[e,t]=(0,m.useState)(i0);return(0,m.useEffect)(()=>{let e=()=>t(i0()),n=document.getElementById(`main`),r=typeof ResizeObserver>`u`||!n?void 0:new ResizeObserver(e);return n&&r?.observe(n),window.addEventListener(`resize`,e),e(),()=>{r?.disconnect(),window.removeEventListener(`resize`,e)}},[]),e}var o0=(0,m.forwardRef)(function({spotlight:e,thinking:t,busy:n=[],tone:r,expanded:i,hidden:a,shortcut:o,onOpen:s},c){let l=a0(),[u,d]=(0,m.useState)(e0),[f,p]=(0,m.useState)(),[h,g]=(0,m.useState)(!1),_=(0,m.useRef)(void 0),v=(0,m.useRef)(!1),y=(0,m.useRef)(44),b=f??(u&&l?Q1(u,l,y.current):void 0),x=(0,m.useCallback)((e,t)=>{let n=i0();if(!n)return;let r=Z1(e,t,n,y.current);d(r),t0(r)},[]);function S(e){if(e.button!==0)return;let t=e.currentTarget.getBoundingClientRect();y.current=t.width,_.current={id:e.pointerId,sx:e.clientX,sy:e.clientY,ox:t.left,oy:t.top,moved:!1},e.currentTarget.setPointerCapture?.(e.pointerId)}function C(e){let t=_.current;if(!t||t.id!==e.pointerId)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!t.moved&&Math.hypot(n,r)<n0)return;t.moved=!0;let i=i0();i&&p(X1(t.ox+n,t.oy+r,i,y.current))}function w(e){let t=_.current;_.current=void 0,t?.moved&&(v.current=!0,x(t.ox+e.clientX-t.sx,t.oy+e.clientY-t.sy),p(void 0))}function T(e){let t=e.shiftKey?64:r0,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];if(!n||e.altKey||e.ctrlKey||e.metaKey)return;e.preventDefault();let r=e.currentTarget.getBoundingClientRect();y.current=r.width,x(r.left+n[0],r.top+n[1])}let E=!e&&n.length>0,D=e?DH(e):E?K1(n):void 0,O=e?`${t.map(DH).join(`, `)} thinking. `:E?`${n.join(`, `)} at work. `:``,k=b&&l?b.x-l.left<140:!1,ee={"--orb":r,...b?{left:b.x,top:b.y,right:`auto`,bottom:`auto`}:{}};return(0,L.jsxs)(Dk,{open:h&&!f,onOpenChange:g,children:[(0,L.jsx)(Ok,{asChild:!0,children:(0,L.jsxs)(`button`,{ref:c,type:`button`,"aria-label":`Open Thinking`,"aria-description":`${O}Drag, or use the arrow keys, to move it.`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-keyshortcuts":o?`${o} Enter Space`:`Enter Space`,onClick:e=>{if(v.current){v.current=!1,e.preventDefault();return}s()},onPointerDown:S,onPointerMove:C,onPointerUp:w,onPointerCancel:()=>{_.current=void 0,p(void 0)},onKeyDown:T,style:ee,"data-thinking":e?``:void 0,"data-busy":E?``:void 0,"data-dragging":f?``:void 0,"data-placed":b?``:void 0,"data-flip":k||void 0,className:q(`thinking-bubble fixed z-20 touch-none rounded-full outline-none select-none focus-visible:ring-3 focus-visible:ring-ring/40`,a&&`invisible`),children:[(0,L.jsx)(Ou,{initial:!1,children:D?(0,L.jsx)(z.span,{className:`orb-label`,initial:{opacity:0,x:k?-8:8,scale:.9},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:k?-8:8,scale:.9},transition:{type:`spring`,visualDuration:.3,bounce:.35},children:(0,L.jsx)(Ou,{mode:`popLayout`,initial:!1,children:(0,L.jsx)(z.span,{className:`inline-flex items-center gap-1`,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{type:`spring`,visualDuration:.28,bounce:.3},children:D},D)})},`label`):null}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`orb orb-float`,children:(0,L.jsx)(`span`,{className:`orb-icon`,children:(0,L.jsx)(TH,{source:e,strokeWidth:2.25,className:`size-3.5`})})})]})}),(0,L.jsxs)(kk,{side:`top`,children:[`Thinking `,o?(0,L.jsx)(GO,{chord:o}):null,(0,L.jsx)(`span`,{className:`text-background/70`,children:` · drag to move`})]})]})}),s0=/^\s*(?:#{1,6}\s+(.+?)\s*#*|\*\*([^*\n]{2,90}?):?\*\*:?|__([^_\n]{2,90}?):?__:?)\s*$/,c0=260,l0=200,u0=/^\s*(?:[-*+]\s|\d+[.)]\s|>|```|~~~|\|)/m;function d0(e){let t=[],n=[],r=!1;for(let i of e){if(/^\s*(```|~~~)/.test(i)&&(r=!r),!r&&!i.trim()){n.length&&t.push(n.join(`
102
+ `,t),i=e.slice(n,r<0?e.length:r),a=x$.exec(i);if(!a||t-n<a[0].length)return;let[o,s=``,c,l,u=`.`,d]=a;if(i.slice(o.length).trim()===``)return{value:e.slice(0,n)+e.slice(r<0?e.length:r),start:n,end:n};let f=`\n${s}${c??`${Number(l)+1}${u}`} ${d?`[ ] `:``}`;return{value:e.slice(0,t)+f+e.slice(t),start:t+f.length,end:t+f.length}}function C$({rest:e}){let{chat:t}=tU(e);return(0,L.jsx)(`div`,{role:`group`,"aria-label":`Knowledge pane`,className:`flex items-center gap-0.5 rounded-lg bg-muted p-0.5`,children:[`Chat`,`Docs`].map(n=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":t===(n===`Chat`),onClick:()=>uk(nU(e,n===`Chat`)),className:q(`h-6 rounded-md px-2.5 text-xs font-medium outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,t===(n===`Chat`)?`btn-raised bg-card text-foreground`:`text-muted-foreground hover:text-foreground`),children:n},n))})}var w$={id:`oracle`,pill:`Oracle`,label:`Message the oracle`,placeholder:`Message the oracle…`};function T$(e,t,n){if(e.kind===`sessions`){let e={id:`newsession`,pill:`New session`,label:`Start a task in a new session`,placeholder:`Describe a task for a new session…`};return n?[{id:`session`,pill:`Message`,label:`Message ${n.name}`,placeholder:`Message ${n.name}…`,session:n},e,w$]:[e,w$]}if(e.kind!==`tab`)return[w$];if(e.tab===`knowledge`)return[{id:`knowledge`,pill:`Oracle`,label:`Ask the oracle about this project`,placeholder:`Ask about this project — the oracle searches the code and learns what is missing…`}];if(e.tab===`plan`)return[{id:`panel`,pill:`Panel`,label:`Message the panel`,placeholder:`Describe a task, or answer the panel…`},w$];if(e.tab===`quickfix`)return[{id:`quickfix`,pill:`Quick fix`,label:`Describe a quick fix`,placeholder:`Describe a small change…`},w$];let r=e.tab===`tasks`?IU(e.rest).id??t:void 0;return r?[{id:`comment`,pill:`Comment`,label:`Comment on ${r}`,placeholder:`Comment on ${r}'s plan…`,taskId:r},{id:`task`,pill:`Task's oracle`,label:`Message ${r}'s oracle`,placeholder:`Leave a message for ${r}'s oracle…`,taskId:r},w$]:[w$]}var E$=0,D$=`toolbar-button relative inline-flex size-8 items-center justify-center rounded-lg border text-foreground transition-[background-color,border-color,translate] duration-150 ease-snap outline-none focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`;function O$(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing}function k$({file:e,onRemove:t}){let n=(0,L.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,onClick:t,className:q(`btn-ghost flex shrink-0 items-center justify-center rounded-lg border text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40`,e.image?`absolute top-1 right-1 size-5 bg-background/80 text-foreground backdrop-blur-sm`:`size-7`),children:(0,L.jsx)(Hg,{"aria-hidden":`true`,className:`size-3.5`})});return e.image?(0,L.jsxs)(z.li,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:520,damping:32},title:`${e.name} · ${_$(e.size)}`,className:`relative size-16 shrink-0 overflow-hidden rounded-lg border border-border bg-muted`,children:[(0,L.jsx)(`img`,{src:N(e.image),alt:e.name,className:`size-full object-cover`}),e.state===`uploading`?(0,L.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-background/60`,children:(0,L.jsx)(vk,{className:`size-4`,"aria-hidden":`true`,role:`presentation`})}):null,n]}):(0,L.jsxs)(z.li,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:520,damping:32},className:`flex h-9 min-w-0 items-center gap-2 rounded-lg border border-border bg-muted pr-1 pl-2.5`,children:[(0,L.jsxs)(`span`,{className:`relative flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,L.jsx)(Pm,{"aria-hidden":`true`,className:`size-4`}),e.state===`uploading`?(0,L.jsx)(vk,{className:`absolute -right-1 -bottom-1 size-2.5`,"aria-hidden":`true`,role:`presentation`}):null]}),(0,L.jsxs)(`span`,{className:`min-w-0 max-w-40`,children:[(0,L.jsx)(`span`,{className:`block truncate text-xs font-medium`,children:e.name}),(0,L.jsx)(`span`,{className:`block text-[0.65rem] leading-tight text-muted-foreground`,children:e.state===`uploading`?`uploading…`:_$(e.size)})]}),n]})}function A$({route:e,keys:t,onHelp:n}){let[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)([]),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(!1),[p,h]=(0,m.useState)(),g=Ok(`status`),_=Ok(`lobby`),v=rk(),y=(g.data?.busy??!1)||!!_.data?.reply?.trim(),{taskId:b,session:x}=RX(),S=(0,m.useMemo)(()=>T$(e,b,x),[e,b,x]),C=S.map(e=>`${e.id}:${e.taskId??e.session?.name??``}`).join(`|`),w=S.find(e=>e.id===p)??S[0];(0,m.useEffect)(()=>h(void 0),[C]);let T=(0,m.useRef)(null),E=(0,m.useRef)(null),D=(0,m.useRef)(null),O=(0,m.useRef)(a);O.current=a;let k=(0,m.useRef)(void 0);(0,m.useLayoutEffect)(()=>{let e=k.current,t=E.current;e&&t&&(k.current=void 0,t.setSelectionRange(e.start,e.end))},[r]);let ee=(0,m.useCallback)(e=>{k.current={start:e.start,end:e.end},i(e.value)},[]);(0,m.useEffect)(()=>{let e=T.current;if(!e)return;let t=document.documentElement,n=()=>t.style.setProperty(`--composer-h`,v?`0px`:`${Math.ceil(e.getBoundingClientRect().height)}px`);n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect(),t.style.setProperty(`--composer-h`,`0px`)}},[v]);let te=(0,m.useCallback)(e=>{let t=[...e],n=8-O.current.length;t.length>n&&V.warning(`At most 8 files go with one message.`);for(let e of t.slice(0,Math.max(0,n))){let t=`f${++E$}`,n=e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0;o(r=>[...r,{key:t,name:e.name||(n?`image.png`:`file`),size:e.size,...n?{image:n}:{},state:`uploading`}]),v$(e).then(e=>o(n=>n.map(n=>n.key===t?{...n,state:`ready`,info:e}:n))).catch(e=>{V.error(e instanceof Error?e.message:`That file did not upload.`),o(e=>e.filter(e=>e.key!==t))})}},[]),ne=(0,m.useCallback)(e=>{o(t=>{let n=t.find(t=>t.key===e);return n?.image&&URL.revokeObjectURL(n.image),t.filter(t=>t.key!==e)})},[]),A=a.some(e=>e.state===`uploading`),re=a.flatMap(e=>e.info?[e.info.id]:[]),ie=(r.trim().length>0||re.length>0)&&!A&&!l,j=(0,m.useCallback)(async()=>{if(!ie)return;u(!0);let t=re.length>0?re:void 0,n={text:r,...t?{attachments:t}:{}};try{let a=!0;if(w.id===`oracle`){let e=await De(`lobby.send`,n);e.notice&&V(e.notice)}else if(w.id===`knowledge`)a=await H(`knowledge.ask`,n)!==void 0,a&&e.kind===`tab`&&uk(nU(e.rest,!0));else if(w.id===`panel`)a=await H(`planner.send`,n)!==void 0;else if(w.id===`quickfix`)a=await H(`quickfix.submit`,n)!==void 0;else if(w.id===`task`)a=await H(`tasks.message`,{taskId:w.taskId,...n})!==void 0;else if(w.id===`session`)a=await H(`sessions.message`,{...w.session.address,...n})!==void 0;else if(w.id===`newsession`){let e=await H(`sessions.start`,{request:r,...t?{attachments:t}:{}});a=e!==void 0,e?.key&&uk(`#/sessions/${encodeURIComponent(e.key)}`)}else a=await H(`tasks.comment`,{taskId:w.taskId,...n})!==void 0;if(a){i(``);for(let e of O.current)e.image&&URL.revokeObjectURL(e.image);o([])}}catch(e){V.error(e instanceof Error?e.message:`Could not send`)}finally{u(!1)}},[ie,re,w,r,e]),ae=(0,m.useCallback)(async()=>{try{await De(`lobby.abort`,{})}catch(e){V.error(e instanceof Error?e.message:`Could not stop`)}},[]);return(0,L.jsx)(`div`,{ref:T,className:q(`dock pointer-events-none absolute inset-x-0 bottom-0 z-30 px-6 pb-[max(1.25rem,env(safe-area-inset-bottom))] transition-opacity duration-200 ease-snap max-sm:px-2 max-sm:pb-[max(0.5rem,env(safe-area-inset-bottom))]`,v&&`opacity-0`),inert:v,children:(0,L.jsx)(`div`,{className:`pointer-events-auto mx-auto w-full max-w-3xl`,children:(0,L.jsxs)(`div`,{className:q(`group/composer relative rounded-2xl border border-dock-border bg-dock shadow-dock backdrop-blur-xl backdrop-saturate-150 transition-[border-color,box-shadow] duration-300 ease-snap focus-within:border-ring/45 focus-within:shadow-dock-focus`,d&&`border-primary shadow-[0_0_0_3px_color-mix(in_oklab,var(--ring)_30%,transparent)]`),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),f(!0))},onDragLeave:()=>f(!1),onDrop:e=>{e.preventDefault(),f(!1),e.dataTransfer.files.length>0&&te(e.dataTransfer.files)},children:[(0,L.jsx)(Ou,{initial:!1,children:a.length>0?(0,L.jsx)(z.ul,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{type:`spring`,stiffness:420,damping:36},"aria-label":`Attachments`,className:`flex flex-wrap items-end gap-2 overflow-hidden px-3 pt-3`,children:a.map(e=>(0,L.jsx)(k$,{file:e,onRemove:()=>ne(e.key)},e.key))},`files`):null}),s?(0,L.jsx)(`div`,{"aria-label":`Markdown preview`,role:`region`,className:`max-h-48 overflow-y-auto border-b border-border px-4 py-3`,children:r.trim()?(0,L.jsx)($B,{text:r}):(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing to preview yet.`})}):null,(0,L.jsx)(`div`,{className:`flex px-4 pt-3 pb-1`,children:(0,L.jsx)(`textarea`,{ref:E,id:`composer-text`,"aria-label":w.label,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&!e.nativeEvent.isComposing){e.preventDefault(),Kk();return}let t=e.currentTarget,n=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&[`b`,`i`,`e`,`k`].includes(n)){e.preventDefault();let{selectionStart:r,selectionEnd:i,value:a}=t;ee(n===`k`?b$(a,r,i):y$(a,r,i,n===`b`?`**`:n===`i`?`_`:"`"));return}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&n===`p`){e.preventDefault(),c(e=>!e);return}if(e.key===`Enter`&&e.shiftKey&&!e.nativeEvent.isComposing&&t.selectionStart===t.selectionEnd){let n=S$(t.value,t.selectionStart);n&&(e.preventDefault(),ee(n));return}if(e.key===`Backspace`&&t.value===``&&O.current.length>0){e.preventDefault(),ne(O.current.at(-1).key);return}(O$(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey))&&(e.preventDefault(),j())},onPaste:e=>{let t=[...e.clipboardData.files];t.length!==0&&(e.preventDefault(),te(t))},placeholder:y&&w.id===`oracle`?`The oracle is working. Enter steers it…`:w.placeholder,rows:1,className:`field-sizing-content max-h-[min(45vh,20rem)] min-h-[1.75rem] w-full min-w-0 flex-1 resize-none bg-transparent text-base leading-relaxed caret-primary outline-none placeholder:text-muted-foreground md:text-[0.9375rem] md:leading-relaxed`})}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-2 px-2 pt-1 pb-2`,children:[(0,L.jsx)(`input`,{ref:D,type:`file`,multiple:!0,hidden:!0,tabIndex:-1,"aria-label":`Attach files`,onChange:e=>{te(e.target.files??[]),e.target.value=``}}),(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"aria-label":`Attach images, PDFs or files`,"data-compact":!0,onClick:()=>D.current?.click(),className:D$,children:(0,L.jsx)(Ah,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsx)(Pk,{children:`Attach images, PDFs or files`})]}),(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Preview the Markdown`,"aria-pressed":s,"aria-keyshortcuts":`Alt+P`,"aria-describedby":`focused-action-help`,"data-compact":!0,onClick:()=>c(e=>!e),className:D$,children:(0,L.jsx)(Om,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsxs)(Pk,{children:[`Preview `,(0,L.jsx)(GO,{chord:`Alt+P`})]})]}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-4 w-px bg-border`}),e.kind===`tab`&&e.tab===`knowledge`?(0,L.jsx)(C$,{rest:e.rest}):S.length>1?(0,L.jsx)(`div`,{role:`radiogroup`,"aria-label":`Send to`,className:`flex items-center gap-0.5 rounded-lg bg-muted p-0.5 shadow-[inset_0_1px_2px_rgb(0_0_0/0.07)]`,children:S.map(e=>(0,L.jsx)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,role:`radio`,"data-compact":!0,"aria-checked":e.id===w.id,onClick:()=>h(e.id),className:q(`h-6 rounded-md border border-transparent px-2.5 text-xs font-medium transition-[background-color,color,box-shadow] duration-150 outline-none focus-visible:ring-3 focus-visible:ring-ring/40`,e.id===w.id?`btn-raised bg-card text-foreground`:`text-muted-foreground hover:text-foreground`),children:e.pill},e.id))}):(0,L.jsxs)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:[`To the `,w.pill.toLowerCase()]}),(0,L.jsx)(`div`,{className:`@container ml-auto flex min-w-0 flex-1 items-center justify-end overflow-hidden px-2`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-3.5`,children:[e.kind===`tab`&&e.tab===`plan`?(0,L.jsx)(KO,{chord:t.savePlan??`Ctrl+S`,className:`hidden @[34rem]:inline-flex`,children:`save plan`}):null,(0,L.jsx)(KO,{chord:`/`,className:`hidden group-focus-within/composer:!hidden @[28rem]:inline-flex`,children:`write`}),(0,L.jsx)(KO,{chord:`Esc`,className:`hidden group-[:not(:focus-within)]/composer:!hidden @[28rem]:inline-flex`,children:`tabs`}),(0,L.jsx)(KO,{chord:`Shift+Enter`,className:`hidden @[22rem]:inline-flex`,children:`new line`}),(0,L.jsx)(KO,{chord:`Enter`,className:`hidden @[11rem]:inline-flex`,children:`send`}),(0,L.jsxs)(`button`,{type:`button`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"aria-label":`Keyboard shortcuts`,"aria-haspopup":`dialog`,"data-compact":!0,onClick:n,className:`kbd-hint btn-ghost inline-flex h-7 shrink-0 items-center gap-1.5 rounded-lg border px-1.5 text-xs text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40`,children:[(0,L.jsx)(GO,{chord:t.help??`Alt+H`,className:`kbd-hint`}),(0,L.jsx)(`span`,{className:`hidden @[8rem]:inline`,children:`shortcuts`})]})]})}),y&&w.id===`oracle`?(0,L.jsx)(MA,{label:`Stop`,icon:mg,iconOnly:!0,compact:!0,title:`Stop the oracle?`,description:`The current response stops. Work already recorded is kept.`,confirmLabel:`Stop`,variant:`destructive`,onConfirm:()=>void ae()}):null,(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Send`,"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,"data-compact":!0,onClick:()=>void j(),disabled:!ie,className:`btn-tint relative inline-flex size-8 items-center justify-center rounded-lg border [--tint:var(--primary)] before:absolute before:-inset-1 before:content-[''] text-primary-foreground transition-[background-color,color,box-shadow,translate,filter] duration-150 ease-snap outline-none focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none disabled:text-muted-foreground`,children:l?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3.5 text-primary-foreground`}):(0,L.jsx)(Pp,{"aria-hidden":`true`,className:`size-4`,strokeWidth:2.25})})}),(0,L.jsxs)(Pk,{children:[`Send `,(0,L.jsx)(GO,{chord:`Enter`})]})]})]}),d?(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-xl bg-card/90 text-sm font-medium text-primary backdrop-blur-[2px]`,children:`Drop to attach`}):null]})})})}function j$(e){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)();async function a(r){if(!t){n(!0),i(void 0);try{let{project:t}=await De(`projects.open`,{path:r});Se([t]),_e(t.id,e)}catch(e){i(e.message)}finally{n(!1)}}}return{opening:t,error:r,open:a}}function M$({path:e,busy:t,browse:n}){let[r,i]=(0,m.useState)(e);return(0,m.useEffect)(()=>i(e),[e]),(0,L.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n(r)},children:[(0,L.jsx)(iq,{"aria-label":`Folder path`,value:r,disabled:t,onChange:e=>i(e.target.value)}),(0,L.jsx)(J,{type:`submit`,disabled:t||!r.trim(),children:`Go`})]})}function N$({data:e,busy:t,browse:n}){return(0,L.jsxs)(`div`,{className:`min-h-24 max-h-64 overflow-y-auto rounded-lg border border-border`,"aria-label":`Folders`,role:`group`,children:[e?.parent?(0,L.jsxs)(J,{variant:`ghost`,className:`w-full justify-start`,disabled:t,onClick:()=>n(e.parent),children:[(0,L.jsx)(Pp,{}),` Parent folder`]}):null,e?.folders.map(e=>(0,L.jsxs)(J,{variant:`ghost`,className:`w-full justify-start`,disabled:t,onClick:()=>n(e.path),children:[(0,L.jsx)(Rm,{className:`shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),e&&!e.folders.length?(0,L.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`No subfolders. You can open this folder.`}):null,e?.truncated?(0,L.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Listing limited to 2,000 entries. Enter a path to browse further.`}):null]})}function P$({tab:e,close:t,busyChanged:n}){let[r,i]=(0,m.useState)(),a=Ak(`projects.browse`,r===void 0?{}:{path:r},[]),o=j$(e);return(0,m.useEffect)(()=>n(o.opening),[o.opening,n]),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-4 p-5`,children:[(0,L.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Open project folder`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Browse folders on the machine running bot-lobby. Opening starts a separate session; your current project keeps running. Project-local extensions are not enabled automatically.`}),(0,L.jsx)(M$,{path:a.data?.path??r??``,busy:o.opening,browse:i}),(0,L.jsx)(N$,{data:a.data,busy:a.loading||o.opening,browse:i}),a.loading?(0,L.jsx)(`p`,{role:`status`,children:`Loading folders…`}):null,a.error||o.error?(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.error??o.error}):null,(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[a.error?(0,L.jsx)(J,{variant:`outline`,onClick:a.reload,disabled:a.loading,children:`Retry`}):null,(0,L.jsx)(J,{variant:`outline`,onClick:t,disabled:o.opening,children:`Cancel`}),(0,L.jsx)(J,{disabled:!a.data||a.loading||!!a.error||o.opening,onClick:()=>void o.open(a.data.path),children:o.opening?`Opening project…`:`Open this folder`})]})]})}function F$({open:e,onClose:t,tab:n}){let r=tk(e,ek.help),[i,a]=(0,m.useState)(!1);return(0,L.jsx)(qO,{open:r,label:`Open project folder`,onOpenChange:e=>{!e&&!i&&t()},dismissOnBackdrop:!i,onCloseAutoFocus:e=>{e.preventDefault(),document.querySelector(`[role="combobox"][aria-label="Project"]`)?.focus()},children:e?(0,L.jsx)(P$,{tab:n,close:t,busyChanged:a}):null})}function I$(){try{return{id:M()}}catch(e){return{error:e.message}}}function L$(e,t){if(e){if(t&&!e.projects.some(e=>e.id===t))return`Selected project is unknown or offline. Refresh or choose a running project.`;if(!e.projects.length)return`No authorized running projects found. Open a folder from the Project menu, or refresh.`}}function R$(){let[e,t]=(0,m.useState)(),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(!1),o=(0,m.useRef)(0);async function s(){let e=++o.current;a(!0),r(void 0);try{let n=await De(`projects.list`,{});Se(n.projects),e===o.current&&t(n)}catch(t){e===o.current&&r(t.message)}finally{e===o.current&&a(!1)}}(0,m.useEffect)(()=>(s(),()=>{o.current++}),[]);let[c,l]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!i)return l(!1);let e=setTimeout(()=>l(!0),300);return()=>clearTimeout(e)},[i]),{data:e,error:n,busy:i,slow:c,refresh:s}}function z$({data:e,error:t}){let n=I$();return n.error??t??L$(e,n.id)}function B$({projects:e}){let t=z$(e);return t?(0,L.jsxs)(`p`,{role:`alert`,className:`notice flex min-w-0 items-start gap-2 pt-1 pb-0.5 text-xs break-words text-destructive`,children:[(0,L.jsx)(Eg,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,L.jsx)(`span`,{children:t})]}):null}function V$(e){let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0,n=e.key===`Home`?`first`:e.key===`End`?`last`:void 0;if(!t&&!n)return;let r=[...e.currentTarget.querySelectorAll(`[role='option']`)];if(r.length===0)return;e.preventDefault();let i=r.indexOf(document.activeElement);r[n===`first`?0:n===`last`?r.length-1:Math.max(0,Math.min(r.length-1,(i<0?t>0?-1:r.length:i)+t))]?.focus()}function H$({projects:e,tab:t,name:n,branch:r}){let{data:i,busy:a,slow:o,refresh:s}=e,[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),f=I$(),p=z$(e),h=f.error?`invalid`:f.id??i?.currentId??``;Qk(`p`,()=>l(!0)),Qk(`r`,()=>void s(),{enabled:c,inDialog:!0});function g(e){l(!1),e!==h&&_e(e,t)}return(0,L.jsxs)(`div`,{"aria-busy":a,className:`flex min-w-0 items-center gap-1.5`,children:[(0,L.jsxs)(uD,{open:c,onOpenChange:l,children:[(0,L.jsxs)(dD,{type:`button`,role:`combobox`,"aria-label":`Project`,"aria-description":`${n}${r?`, branch ${r}`:``}`,"aria-haspopup":`listbox`,"aria-expanded":c,"aria-keyshortcuts":`P ArrowDown`,onKeyDown:e=>{e.key!==`ArrowDown`||e.altKey||e.metaKey||e.ctrlKey||(e.preventDefault(),l(!0))},className:`btn-ghost group flex h-8 min-w-0 items-center gap-2 rounded-lg border border-transparent px-2.5 text-sm font-medium outline-none transition-[box-shadow,background-color] duration-150 focus-visible:ring-3 focus-visible:ring-ring/40 disabled:pointer-events-none`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:q(`size-2.5 shrink-0 rounded-full`,p?`bg-destructive`:`bg-primary`)}),(0,L.jsx)(`span`,{className:`truncate`,children:n}),(0,L.jsx)(Xp,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,L.jsx)(fD,{children:(0,L.jsxs)(pD,{align:`start`,sideOffset:6,"aria-label":`Projects`,onKeyDown:V$,onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[role='option'][aria-selected='true']`)??e.currentTarget?.querySelector(`[role='option']`);t&&(e.preventDefault(),t.focus())},className:`glass-pop z-50 flex w-[min(26rem,calc(100vw-1.5rem))] origin-(--radix-popover-content-transform-origin) flex-col overflow-hidden rounded-xl outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Running projects`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:a,"aria-label":`Refresh list`,"aria-keyshortcuts":`R`,className:`inline-flex h-7 items-center gap-1.5 rounded-lg px-2 text-xs text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 disabled:opacity-60`,children:[a?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}):(0,L.jsx)(Kh,{"aria-hidden":`true`,className:`size-3`}),`Refresh`,(0,L.jsx)(GO,{chord:`R`,className:`kbd-hint`})]})]}),(0,L.jsx)(`div`,{role:`listbox`,"aria-label":`Projects`,className:`flex max-h-72 flex-col overflow-y-auto p-1`,children:i?.projects.map(e=>{let t=e.id===h;return(0,L.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,onClick:()=>g(e.id),className:q(`flex min-h-10 w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left outline-none transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-3 focus-visible:ring-ring/30`,t&&`bg-accent`),children:[(0,L.jsx)(`span`,{className:`flex h-5 w-4 shrink-0 items-center justify-center`,children:t?(0,L.jsx)(Hp,{"aria-hidden":`true`,className:`size-3.5 text-primary`}):null}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,L.jsxs)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:[e.cwd,` · :`,e.port]})]})]},e.id)})}),(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 border-t border-border px-3 py-3 text-sm font-medium outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/40`,onClick:()=>{l(!1),d(!0)},children:[(0,L.jsx)(Im,{"aria-hidden":`true`,className:`size-4`}),`Open folder…`]})]})})]}),(0,L.jsx)(F$,{open:u,onClose:()=>d(!1),tab:t}),r?(0,L.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground sm:inline-flex`,children:[(0,L.jsx)(Bm,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:r})]}):null,o||p?(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Refresh projects`,disabled:a,onClick:()=>void s(),className:`btn-ghost inline-flex size-8 shrink-0 items-center justify-center rounded-lg border border-transparent text-muted-foreground outline-none transition-[box-shadow,color,translate] hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px disabled:opacity-60`,children:a?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-4`}):(0,L.jsx)(Kh,{"aria-hidden":`true`,className:`size-4`})})}),(0,L.jsx)(Pk,{side:`bottom`,children:`Refresh projects`})]}):null]})}function U$({state:e}){return e===`live`?(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`span`,{role:`img`,"aria-label":`Connected`,className:`grid size-6 place-items-center`,children:(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-success`})})}),(0,L.jsx)(Pk,{children:`Connected`})]}):e===`connecting`?(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3`}),`reconnecting…`]}):(0,L.jsx)(`span`,{className:`text-xs font-medium text-destructive`,children:`Connection lost`})}var W$=`toolbar-button inline-flex size-8 shrink-0 items-center justify-center rounded-lg border text-foreground transition-[background-color,border-color,translate] duration-150 ease-snap outline-none focus-visible:ring-3 focus-visible:ring-ring/40 active:translate-y-px motion-reduce:active:translate-none`;function G$({label:e,hint:t,href:n,active:r,children:i}){return(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`a`,{href:n,"aria-label":e,"aria-current":r?`page`:void 0,"aria-keyshortcuts":t,"aria-describedby":`focused-action-help`,className:W$,children:i})}),(0,L.jsxs)(Pk,{side:`bottom`,children:[e,` `,(0,L.jsx)(GO,{chord:t})]})]})}function K$({hint:e,onHelp:t}){return(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Keyboard shortcuts`,"aria-haspopup":`dialog`,"aria-keyshortcuts":e,"aria-describedby":`focused-action-help`,onClick:t,className:W$,children:(0,L.jsx)(Jm,{"aria-hidden":`true`,className:`size-[1.05rem]`})})}),(0,L.jsxs)(Pk,{side:`bottom`,children:[`Keyboard shortcuts `,(0,L.jsx)(GO,{chord:e})]})]})}function q$(){let e=FK(),t=e?`Unmute prompt sounds`:`Mute prompt sounds`;return(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":t,"aria-pressed":e,"aria-describedby":`focused-action-help`,className:W$,onClick:()=>NK(!e),children:e?(0,L.jsx)(Ig,{"aria-hidden":`true`,className:`size-[1.05rem]`}):(0,L.jsx)(Pg,{"aria-hidden":`true`,className:`size-[1.05rem]`})})}),(0,L.jsx)(Pk,{side:`bottom`,children:t})]})}function J$(){let{theme:e,setTheme:t}=Oq(),n=e===`dark`||e===`system`&&typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;return(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":n?`Switch to light mode`:`Switch to dark mode`,"aria-keyshortcuts":`D`,"aria-describedby":`focused-action-help`,onClick:()=>t(n?`light`:`dark`),className:W$,children:n?(0,L.jsx)(gg,{"aria-hidden":`true`,className:`size-[1.05rem]`}):(0,L.jsx)(wh,{"aria-hidden":`true`,className:`size-[1.05rem]`})})}),(0,L.jsxs)(Pk,{side:`bottom`,children:[n?`Light mode`:`Dark mode`,` `,(0,L.jsx)(GO,{chord:`D`})]})]})}function Y$({busy:e,task:t,sessionName:n}){return(0,L.jsxs)(`div`,{className:`mr-1 flex min-w-0 items-center gap-2 text-[0.8125rem]`,children:[e?(0,L.jsx)(vk,{"aria-hidden":`true`,role:`presentation`,className:`size-3.5`}):null,t?(0,L.jsxs)(`span`,{className:`hidden max-w-[16rem] truncate md:inline`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:t.id}),(0,L.jsxs)(`span`,{className:`hidden text-muted-foreground min-[1500px]:inline`,children:[` · `,t.state.replace(/_/g,` `)]})]}):(0,L.jsx)(`span`,{className:`hidden max-w-[10rem] truncate text-muted-foreground min-[1500px]:inline`,children:n??`no task in this session`})]})}function X$(e){if(!e)return 0;let t=[...e.children].filter(e=>e instanceof HTMLElement&&e.offsetParent!==null&&getComputedStyle(e).position!==`absolute`);if(!t.length)return 0;let n=Math.min(...t.map(e=>e.getBoundingClientRect().left)),r=Math.max(...t.map(e=>e.getBoundingClientRect().right)),i=0;for(let t of e.querySelectorAll(`*`))t.clientWidth<=1||t.offsetParent===null||t.scrollWidth<=t.clientWidth+1||getComputedStyle(t).textOverflow===`ellipsis`&&(i+=t.scrollWidth-t.clientWidth);return r-n+i}var Z$=24;function Q$(){let e=(0,m.useRef)(null),[t,n]=(0,m.useState)(!1),r=(0,m.useRef)(()=>{});return r.current=()=>{let t=e.current;if(!t)return;let r=t.querySelector(`[role="tablist"]`),i=getComputedStyle(t),a=parseFloat(i.columnGap)||0,o=t.clientWidth-(parseFloat(i.paddingLeft)||0)-(parseFloat(i.paddingRight)||0),s=X$(t.querySelector(`.where`))+(r?.offsetWidth??0)+X$(t.querySelector(`.tools`))+a*2;n(s+Z$<=o)},(0,m.useLayoutEffect)(()=>r.current()),(0,m.useLayoutEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>r.current());n.observe(t);for(let e of t.querySelectorAll(`[role="tablist"], .where, .tools`))n.observe(e);return()=>n.disconnect()},[]),{header:e,one:t}}function $$({status:e,task:t,connection:n,route:r,tabs:i,extra:a,keys:o,onHelp:s}){let c=e?.workspace.name??`bot-lobby`,l=e?.branch??e?.workspace.branch,u=e?.busy??!1,d=R$(),{header:f,one:p}=Q$();return(0,L.jsxs)(`header`,{ref:f,className:`app-header shrink-0`,"data-one-row":p||void 0,children:[(0,L.jsx)(`div`,{className:`where flex min-w-0 items-center`,children:(0,L.jsx)(H$,{projects:d,tab:r.kind===`tab`?r.tab:r.kind,name:c,branch:l})}),(0,L.jsx)(`div`,{className:`tabs min-w-0`,children:i}),(0,L.jsxs)(`div`,{className:`tools flex min-w-0 items-center justify-end gap-2`,children:[a,(0,L.jsx)(Y$,{busy:u,...t?{task:t}:{},...e?.sessionName?{sessionName:e.sessionName}:{}}),(0,L.jsx)(U$,{state:n}),(0,L.jsx)(G$,{label:`Sessions`,hint:o.sessions??`Alt+O`,href:`#/sessions`,active:r.kind===`sessions`,children:(0,L.jsx)(Xm,{"aria-hidden":`true`,className:`size-[1.05rem]`})}),(0,L.jsx)(G$,{label:`Settings`,hint:o.settings??`Alt+S`,href:`#/settings`,active:r.kind===`settings`,children:(0,L.jsx)(og,{"aria-hidden":`true`,className:`size-[1.05rem]`})}),(0,L.jsx)(K$,{hint:o.help??`Alt+H`,onHelp:s}),(0,L.jsx)(J$,{}),(0,L.jsx)(q$,{}),(0,L.jsx)(`span`,{id:`focused-action-help`,className:`sr-only`,children:`Focused buttons: Enter or Space. Links: Enter. Checkboxes: Space.`})]}),(0,L.jsx)(B$,{projects:d})]})}function e1(e){let t=e.match(/[#&?]?token=([^&\s#]+)/i);if(t?.[1])return decodeURIComponent(t[1]);let n=e.trim();return n&&!n.includes(`/`)&&!n.includes(` `)?n:void 0}function t1(){let[e,t]=(0,m.useState)(``),[n,r]=(0,m.useState)(),[i,a]=(0,m.useState)(!1);async function o(e){a(!0),r(void 0),e&&(window.location.hash=`token=${encodeURIComponent(e)}`),await ke()?window.location.reload():(r(e?`That link did not sign in. Copy the link from Pi and try again.`:`Paste the link from Pi below.`),a(!1))}function s(t){t.preventDefault(),o(e1(e))}return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,L.jsxs)(`form`,{onSubmit:s,className:`glass flex w-full max-w-md flex-col gap-4 rounded-xl p-6`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Km,{className:`size-5`,"aria-hidden":`true`}),(0,L.jsx)(`h1`,{className:`text-base font-medium`,children:`Sign in to bot-lobby`})]}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Pi printed a link when it started (or run `,(0,L.jsx)(`code`,{className:`rounded-lg bg-muted px-1.5 py-0.5 font-mono text-xs`,children:`/bot-lobby web`}),`to see it again). Paste it here.`]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:`Lobby link or token`}),(0,L.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),autoComplete:`off`,spellCheck:!1,placeholder:`http://127.0.0.1:7347/#token=…`,className:`h-8 rounded-lg border border-input bg-background px-3.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30`})]}),n?(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:n}):null,(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void o(void 0),children:`Retry`}),(0,L.jsx)(J,{type:`submit`,disabled:i||!e.trim(),children:`Sign in`})]})]})})}var n1=.6;function r1(e,t,n={}){return{initial:e?void 0:!1,animate:t,transition:{duration:n1,...n}}}var i1=(e,t)=>[0,Math.max(e,.001),Math.min(Math.max(t,e+.01),.999),1];function a1(e,t=0,n=1){return r1(e,{pathLength:[0,0,1,1],strokeOpacity:[0,0,1,1]},{pathLength:{duration:n1,times:i1(t,n),ease:`easeInOut`},strokeOpacity:{duration:n1,times:i1(t,t+.02)}})}function o1(e,t){return r1(e,{scale:[0,0,1.3,1]},{times:i1(t,t+.18),ease:`easeOut`})}function s1(e,t,n=1.3){return r1(e,{scale:[1,1,n,1,1]},{times:[0,Math.max(t,.001),Math.min(t+.15,.9),Math.min(t+.35,.99),1],ease:`easeInOut`})}var c1=(e=.5,t=.5)=>({transformBox:`fill-box`,originX:e,originY:t});function l1({play:e}){return(0,L.jsxs)(z.g,{style:c1(.1,.9),...r1(e,{rotate:[0,-12,8,-4,0],scale:[1,1.12,.96,1.02,1]},{ease:`easeInOut`}),children:[(0,L.jsx)(`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}),[8,12,16].map((t,n)=>(0,L.jsx)(z.circle,{cx:t,cy:11,r:1.15,fill:`currentColor`,stroke:`none`,...r1(e,{fillOpacity:[0,0,1,1,0],y:[0,0,-1.5,0,0]},{times:[0,.12+n*.12,.24+n*.12,.72,1]})},t))]})}function u1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.path,{d:`M13 5h8`,...a1(e,.15,.45)}),(0,L.jsx)(z.path,{d:`M13 12h8`,...a1(e,.3,.6)}),(0,L.jsx)(z.path,{d:`M13 19h8`,...a1(e,.45,.75)}),(0,L.jsx)(z.path,{d:`m3 17 2 2 4-4`,...a1(e,.35,.7)}),(0,L.jsx)(z.path,{d:`m3 7 2 2 4-4`,...a1(e,0,.35)})]})}function d1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.circle,{cx:6,cy:19,r:3,style:c1(),...s1(e,0)}),(0,L.jsx)(z.path,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,...a1(e,.1,.7)}),(0,L.jsx)(z.circle,{cx:18,cy:5,r:3,style:c1(),...o1(e,.62)})]})}function f1({play:e}){return(0,L.jsx)(z.g,{style:c1(),...r1(e,{rotate:[0,-14,10,-6,0],scale:[1,1.18,.94,1.04,1]},{duration:.5,ease:`easeInOut`}),children:(0,L.jsx)(z.path,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,fill:`currentColor`,...r1(e,{fillOpacity:[0,.85,0]},{duration:.5,times:[0,.2,1]})})})}function p1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.circle,{cx:12,cy:12,r:10,style:c1(),...r1(e,{scale:[1,1,1.4],strokeOpacity:[0,.5,0]},{times:[0,.25,1],ease:`easeOut`})}),(0,L.jsx)(z.circle,{cx:12,cy:12,r:10,style:c1(),...r1(e,{scale:[1,.86,1.06,1]},{times:[0,.25,.55,1],ease:`easeInOut`})}),(0,L.jsx)(z.circle,{cx:12,cy:12,r:1,fill:`currentColor`,style:c1(),...r1(e,{scale:[1,2.4,.8,1]},{times:[0,.3,.6,1],ease:`easeInOut`})})]})}function m1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`}),[`M8 17v-3`,`M13 17V5`,`M18 17V9`].map((t,n)=>(0,L.jsx)(z.path,{d:t,style:c1(.5,1),...r1(e,{scaleY:[0,0,1.18,1]},{times:i1(.08+n*.14,.4+n*.14),ease:`easeOut`})},t))]})}function h1({play:e}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z.circle,{cx:6,cy:6,r:3,style:c1(),...s1(e,0)}),(0,L.jsx)(z.line,{x1:6,x2:6,y1:9,y2:21,...a1(e,.05,.45)}),(0,L.jsx)(z.path,{d:`M13 6h3a2 2 0 0 1 2 2v7`,...a1(e,.2,.62)}),(0,L.jsx)(z.circle,{cx:18,cy:18,r:3,style:c1(),...o1(e,.58)})]})}function g1({play:e}){return(0,L.jsxs)(z.g,{style:c1(),...r1(e,{scaleX:[1,.55,1.08,1],y:[0,-1,0,0]},{times:[0,.35,.65,1],ease:`easeInOut`}),children:[(0,L.jsx)(z.path,{d:`M12 5v16`,style:c1(),...r1(e,{scaleY:[1,1.12,1,1]},{times:[0,.35,.65,1]})}),(0,L.jsx)(`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`})]})}function _1({play:e}){return(0,L.jsxs)(z.g,{style:c1(.6,.6),...r1(e,{x:[0,1.5,-1.5,1,0],y:[0,-1,.5,-.5,0],rotate:[0,-8,6,-3,0]},{ease:`easeInOut`}),children:[(0,L.jsx)(`path`,{d:`M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z`}),(0,L.jsx)(`path`,{d:`m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18`}),(0,L.jsx)(z.path,{d:`m2.3 2.3 7.286 7.286`,...a1(e,.1,.6)}),(0,L.jsx)(z.circle,{cx:11,cy:11,r:2,style:c1(),...s1(e,.5,1.5)})]})}var v1={lobby:l1,tasks:u1,plan:d1,quickfix:f1,issues:p1,metrics:m1,git:h1,knowledge:g1,excalidraw:_1};function y1({id:e,play:t,className:n}){let r=v1[e];return r?(0,L.jsx)(`svg`,{"aria-hidden":`true`,"data-tab-icon":e,"data-play":t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:q(`overflow-visible`,n),children:(0,L.jsx)(r,{play:t})},t):null}function b1(e){return/(\d)$/.exec(e)?.[1]}var x1=160;function S1(e){let t=Sf(),[n,r]=(0,m.useState)(0),i=(0,m.useRef)(0),a=(0,m.useCallback)(()=>{t||performance.now()<i.current||(i.current=performance.now()+n1*1e3,r(e=>e+1))},[t]),o=(0,m.useRef)(e);return(0,m.useEffect)(()=>{let t=e&&!o.current;if(o.current=e,!t)return;let n=window.setTimeout(a,x1);return()=>window.clearTimeout(n)},[e,a]),{play:n,onPointerEnter:(0,m.useCallback)(e=>{e.pointerType!==`touch`&&a()},[a])}}var C1=(0,m.forwardRef)(function({tab:e,active:t},n){let r=b1(e.key),{play:i,onPointerEnter:a}=S1(t);return(0,L.jsxs)(Mk,{children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsxs)(`a`,{ref:n,role:`tab`,id:`tab-${e.id}`,href:`#/${e.id}`,"aria-selected":t,"aria-keyshortcuts":e.key,tabIndex:t?0:-1,onPointerEnter:a,className:q(`relative z-10 inline-flex h-7.5 shrink-0 items-center gap-1.5 rounded-lg border border-[var(--tab-outline)] px-2.5 text-[0.8125rem] leading-none font-medium whitespace-nowrap outline-none`,`transition-colors duration-200 ease-snap focus-visible:ring-3 focus-visible:ring-ring/40`,t?`text-foreground`:`bg-[var(--tab-idle)] text-muted-foreground hover:text-foreground`),children:[(0,L.jsx)(y1,{id:e.id,play:i,className:q(`size-3.5 shrink-0 transition-colors duration-200`,t&&`text-primary`)}),r?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:q(`text-[0.72rem] font-semibold tabular-nums transition-colors duration-200`,t?`text-primary`:`text-muted-foreground/75`),children:r}):null,(0,L.jsx)(`span`,{children:e.label})]})}),(0,L.jsxs)(Pk,{children:[e.label,` `,(0,L.jsx)(GO,{chord:e.key})]})]})}),w1=1.5;function T1(e,t,n=t?.left??0,r=t?.right??0,i=1){if(e){if(!t||r-n<.5){e.style.opacity=`0`;return}e.style.opacity=String(Math.min(1,(r-n)/14)),e.style.top=`${t.top}px`,e.style.height=`${t.height}px`,e.style.width=`${r-n}px`,e.style.transform=`translateX(${n}px)`,e.style.scale=i===1?``:`1 ${i}`}}function E1(e,t){let n=e.right-e.left,{height:r}=e,i=w1/2,a=Math.max(0,Math.min(e.radius-i,r/2-i,n/2-i)),o=r/2,s=e=>+(t===`left`?e:n-e).toFixed(2),c=+(t===`left`),l=1-c,u=i,d=n-i,f=r-i;return[`M${s(u)} ${o}L${s(u)} ${i+a}A${a} ${a} 0 0 ${c} ${s(u+a)} ${i}L${s(d-a)} ${i}A${a} ${a} 0 0 ${c} ${s(d)} ${i+a}L${s(d)} ${o}`,`M${s(u)} ${o}L${s(u)} ${f-a}A${a} ${a} 0 0 ${l} ${s(u+a)} ${f}L${s(d-a)} ${f}A${a} ${a} 0 0 ${l} ${s(d)} ${f-a}L${s(d)} ${o}`]}function D1(e,t,n,r){if(!e)return;if(!t||r<=.002){e.style.opacity=`0`;return}let i=t.right-t.left,a=`${i}x${t.height}r${t.radius}${n}`;e.dataset.shape!==a&&(e.dataset.shape=a,e.dataset.port=n,e.setAttribute(`viewBox`,`0 0 ${i} ${t.height}`),E1(t,n).forEach((t,n)=>e.children[n]?.setAttribute(`d`,t))),e.style.opacity=String(Math.min(1,r*12)),e.style.top=`${t.top}px`,e.style.height=`${t.height}px`,e.style.width=`${i}px`,e.style.transform=`translateX(${t.left}px)`;let o=`${Math.min(1,r)} 2`;for(let t of e.children)t.style.strokeDasharray=o}var O1={type:`spring`,visualDuration:.12,bounce:0},k1={type:`spring`,visualDuration:.17,bounce:.15,delay:.015},A1={type:`spring`,visualDuration:.17,bounce:.05,delay:.07},j1={type:`spring`,visualDuration:.22,bounce:.25},M1={type:`spring`,visualDuration:.2,bounce:0},N1={type:`spring`,stiffness:900,damping:18,velocity:45,restDelta:.02,restSpeed:1},P1=(()=>{let e=wr({keyframes:[0,1],visualDuration:j1.visualDuration,bounce:j1.bounce}),t=0;for(;t<1e3&&e.next(t).value<.97;)t+=4;return t/1e3})(),F1={type:`spring`,visualDuration:.28,bounce:.6};function I1(e,t){let n=(0,m.useRef)(null),r=(0,m.useRef)(null),i=(0,m.useRef)(null),a=(0,m.useRef)(null),o=(0,m.useRef)(null),s=(0,m.useRef)({}),c=(0,m.useRef)([]),l=(0,m.useRef)(void 0),u=(0,m.useRef)([]),d=(0,m.useRef)(1),f=(0,m.useRef)(1),p=(0,m.useCallback)(e=>{let t=e?s.current[e]:void 0;if(!t)return;let n=parseFloat(getComputedStyle(t).borderTopLeftRadius)||0;return{left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,top:t.offsetTop,height:t.offsetHeight,radius:n}},[]),h=(0,m.useCallback)(()=>{for(let e of u.current)e.stop();u.current=[];for(let e of Object.values(s.current))e?.style.translate&&(e.style.translate=``)},[]),g=(0,m.useCallback)(e=>{h(),l.current=e,d.current=1,f.current=1;let t=p(e);T1(r.current,t),T1(i.current,void 0),D1(a.current,t,`left`,1),D1(o.current,void 0,`left`,0);for(let e of c.current)e&&(e.style.width=`0px`);VB()},[p,h]),_=(0,m.useCallback)((e,t)=>{let n=p(e),m=p(t);if(!n||!m)return g(t);h(),BB(),l.current=t;let _=m.left>n.left?1:-1,v=_>0?n.right:n.left,y=_>0?m.left:m.right,b=Math.abs(y-v),x=_>0?`right`:`left`,S=_>0?`left`:`right`,C=c.current.map(e=>{let t=e?.parentElement;return t?{liquid:e,from:t.offsetLeft,to:t.offsetLeft+t.offsetWidth}:void 0}),w=b>4?1-4/b:0,T={drained:1-Math.min(1,d.current),unrung:1-Math.min(1,f.current),head:0,tail:0,filled:0,rung:0,squash:1,budge:0},E=s.current[t];d.current=0,f.current=0;let D=()=>{let e=(n.right-n.left)*Math.min(1,T.drained);T1(i.current,n,_>0?n.left+e:n.left,_>0?n.right:n.right-e),D1(o.current,n,x,1-T.unrung);let t=v+_*b*T.head,s=v+_*b*T.tail,c=Math.min(t,s),l=Math.max(t,s);for(let e of C){if(!e?.liquid)continue;let t=Math.max(c,e.from),n=Math.min(l,e.to);e.liquid.style.width=`${Math.max(0,n-t)}px`,e.liquid.style.transform=`translateX(${Math.max(0,t-e.from)}px)`}let u=_*T.budge,d=u?{...m,left:m.left+u,right:m.right+u}:m;E&&(E.style.translate=Math.abs(u)>.01?`${u.toFixed(2)}px`:``);let f=(d.right-d.left)*Math.min(1,Math.max(0,T.filled));T1(r.current,d,_>0?d.left:d.right-f,_>0?d.left+f:d.right,Math.min(1,T.squash)),D1(a.current,d,S,T.rung)},O=(e,t,n,r,i=1)=>{let a=Gf(t,i,{...n,onUpdate:t=>{T[e]=t,r?.(t),D()}});return u.current.push(a),a},k=!1,ee=()=>{if(k)return;k=!0;let e=O(`filled`,0,j1,e=>{d.current=e});e.then(()=>{l.current===t&&VB()}),O(`squash`,.8,F1),O(`rung`,0,M1,e=>{f.current=e}),O(`budge`,0,{...N1,delay:P1},void 0,0),Promise.all([e,...u.current]).then(()=>{l.current===t&&u.current.includes(e)&&g(t)})};O(`drained`,T.drained,O1),O(`unrung`,T.unrung,O1),O(`head`,0,k1,e=>{e>=w&&ee()}),O(`tail`,0,A1),D()},[p,g,h]);(0,m.useLayoutEffect)(()=>{let t=l.current,n=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;!t||!e||t===e||n?g(e):_(t,e)},[e,t,_,g]);let v=(0,m.useRef)(e);return v.current=e,(0,m.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=!0,r=new ResizeObserver(()=>{if(t){t=!1;return}g(v.current)});return r.observe(e),()=>{r.disconnect(),h()}},[g,h]),{track:n,fill:r,drain:i,ring:a,unring:o,cells:s,liquids:c}}var L1=(0,m.forwardRef)(function({which:e},t){return(0,L.jsxs)(`svg`,{ref:t,"aria-hidden":`true`,[`data-tab-${e}`]:``,className:`pointer-events-none absolute left-0 z-20 overflow-visible opacity-0 will-change-transform`,fill:`none`,children:[(0,L.jsx)(`path`,{pathLength:1,strokeWidth:w1,strokeLinecap:`round`,className:`stroke-tab-rim`}),(0,L.jsx)(`path`,{pathLength:1,strokeWidth:w1,strokeLinecap:`round`,className:`stroke-tab-rim`})]})});function R1(e){if(e.left||e.right)return`linear-gradient(to right, ${e.left?`transparent 0, black 28px`:`black 0`}, ${e.right?`black calc(100% - 28px), transparent 100%`:`black 100%`})`}function z1({tabs:e,activeId:t,onSelect:n}){let{track:r,fill:i,drain:a,ring:o,unring:s,cells:c,liquids:l}=I1(t,e.length),u=(0,m.useRef)(null),[d,f]=(0,m.useState)({left:!1,right:!1}),p=(0,m.useCallback)(()=>{let e=u.current;if(!e)return;let t=e.scrollLeft>2,n=e.scrollLeft+e.clientWidth<e.scrollWidth-2;f(e=>e.left===t&&e.right===n?e:{left:t,right:n})},[]);(0,m.useEffect)(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;p();let t=new ResizeObserver(p);return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[p,e.length]),(0,m.useEffect)(()=>{let e=u.current,n=t?c.current[t]:void 0;e&&n&&(n.offsetLeft<e.scrollLeft?e.scrollLeft=n.offsetLeft-8:n.offsetLeft+n.offsetWidth>e.scrollLeft+e.clientWidth&&(e.scrollLeft=n.offsetLeft+n.offsetWidth-e.clientWidth+8))},[t,c]);function h(r){if(r.key===`ArrowDown`&&!r.altKey){Gk()&&r.preventDefault();return}let i=r.key===`ArrowRight`?1:r.key===`ArrowLeft`?-1:0;if(!i||e.length===0)return;r.preventDefault();let a=r.target.closest(`[role='tab']`)?.id.replace(/^tab-/,``)??t,o=e[(Math.max(0,e.findIndex(e=>e.id===a))+i+e.length)%e.length];qk.active=!0,qk.to=o.id,window.setTimeout(()=>{qk.active=!1,qk.to=void 0},3e3),n(o.id),c.current[o.id]?.focus({preventScroll:!0})}return(0,L.jsx)(`div`,{ref:u,onScroll:p,style:{maskImage:R1(d),WebkitMaskImage:R1(d)},className:`min-w-0 max-w-full overflow-x-auto [scrollbar-width:none] pointer-coarse:-my-1.5 pointer-coarse:py-1.5 [&::-webkit-scrollbar]:hidden`,children:(0,L.jsxs)(`div`,{ref:r,role:`tablist`,"aria-label":`Lobby tabs`,onKeyDown:h,className:`relative mx-auto flex w-max items-center py-0.5`,children:[(0,L.jsx)(`span`,{ref:a,"aria-hidden":`true`,"data-tab-drain":!0,className:`pointer-events-none absolute left-0 z-0 rounded-lg bg-tab-fill opacity-0 will-change-transform`}),(0,L.jsx)(`span`,{ref:i,"aria-hidden":`true`,"data-tab-fill":!0,className:`pointer-events-none absolute left-0 z-0 rounded-lg bg-tab-fill opacity-0 will-change-transform`}),(0,L.jsx)(L1,{ref:s,which:`unring`}),(0,L.jsx)(L1,{ref:o,which:`ring`}),e.map((e,n)=>(0,L.jsxs)(m.Fragment,{children:[n>0?(0,L.jsxs)(`span`,{"aria-hidden":`true`,"data-tab-link":!0,className:`relative h-[2px] w-3.5 shrink-0 sm:w-4`,children:[(0,L.jsx)(`span`,{className:`absolute inset-0 border-t-2 border-dotted border-input`}),(0,L.jsx)(`span`,{ref:e=>{l.current[n-1]=e},"data-tab-liquid":!0,className:`absolute top-0 left-0 h-[2px] w-0 rounded-full bg-tab-liquid shadow-[0_0_6px_var(--tab-liquid)] will-change-transform`})]}):null,(0,L.jsx)(C1,{ref:t=>{c.current[e.id]=t},tab:e,active:e.id===t})]},e.id))]})})}function B1({oracleBusy:e,runs:t,activity:n,background:r}){let i=new Set;e&&i.add(`Oracle`);for(let e of t)e.status===`running`&&i.add(jH(FH(e)));for(let e of n)e.pending&&e.source!==`LOBBY`&&i.add(e.source===`MASTER`?`Oracle`:jH(e.source));let a=r.filter(e=>e.alive&&e.busy).length;return a&&i.add(a===1?`1 in the background`:`${a} in the background`),[...i]}function V1(e){return e.length<=2?e.join(`, `):`${e.slice(0,2).join(`, `)} +${e.length-2}`}var H1=6,U1=`bot-lobby.orb`,W1=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1;function G1(e,t,n,r){let i=e=>e+H1,a=(e,t)=>Math.max(e+H1,e+t-r-H1);return{x:Math.min(a(n.left,n.width),Math.max(i(n.left),e)),y:Math.min(a(n.top,n.height),Math.max(i(n.top),t))}}function K1(e,t,n,r){let i=e=>Math.max(1,e-r),a=G1(e,t,n,r);return{fx:Math.min(1,Math.max(0,(a.x-n.left)/i(n.width))),fy:Math.min(1,Math.max(0,(a.y-n.top)/i(n.height)))}}function q1(e,t,n){return G1(t.left+e.fx*Math.max(0,t.width-n),t.top+e.fy*Math.max(0,t.height-n),t,n)}function J1(e){if(e)try{let t=JSON.parse(e);return W1(t.fx)&&W1(t.fy)?{fx:t.fx,fy:t.fy}:void 0}catch{return}}function Y1(){try{return J1(localStorage.getItem(U1))}catch{return}}function X1(e){try{localStorage.setItem(U1,JSON.stringify(e))}catch{}}var Z1=5,Q1=16;function $1(){let e=document.getElementById(`main`)?.getBoundingClientRect();return e?{left:e.left,top:e.top,width:e.width,height:e.height}:void 0}function e0(){let[e,t]=(0,m.useState)($1);return(0,m.useEffect)(()=>{let e=()=>t($1()),n=document.getElementById(`main`),r=typeof ResizeObserver>`u`||!n?void 0:new ResizeObserver(e);return n&&r?.observe(n),window.addEventListener(`resize`,e),e(),()=>{r?.disconnect(),window.removeEventListener(`resize`,e)}},[]),e}var t0=(0,m.forwardRef)(function({spotlight:e,thinking:t,busy:n=[],tone:r,expanded:i,hidden:a,shortcut:o,onOpen:s},c){let l=e0(),[u,d]=(0,m.useState)(Y1),[f,p]=(0,m.useState)(),[h,g]=(0,m.useState)(!1),_=(0,m.useRef)(void 0),v=(0,m.useRef)(!1),y=(0,m.useRef)(44),b=f??(u&&l?q1(u,l,y.current):void 0),x=(0,m.useCallback)((e,t)=>{let n=$1();if(!n)return;let r=K1(e,t,n,y.current);d(r),X1(r)},[]);function S(e){if(e.button!==0)return;let t=e.currentTarget.getBoundingClientRect();y.current=t.width,_.current={id:e.pointerId,sx:e.clientX,sy:e.clientY,ox:t.left,oy:t.top,moved:!1},e.currentTarget.setPointerCapture?.(e.pointerId)}function C(e){let t=_.current;if(!t||t.id!==e.pointerId)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!t.moved&&Math.hypot(n,r)<Z1)return;t.moved=!0;let i=$1();i&&p(G1(t.ox+n,t.oy+r,i,y.current))}function w(e){let t=_.current;_.current=void 0,t?.moved&&(v.current=!0,x(t.ox+e.clientX-t.sx,t.oy+e.clientY-t.sy),p(void 0))}function T(e){let t=e.shiftKey?64:Q1,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];if(!n||e.altKey||e.ctrlKey||e.metaKey)return;e.preventDefault();let r=e.currentTarget.getBoundingClientRect();y.current=r.width,x(r.left+n[0],r.top+n[1])}let E=!e&&n.length>0,D=e?jH(e):E?V1(n):void 0,O=e?`${t.map(jH).join(`, `)} thinking. `:E?`${n.join(`, `)} at work. `:``,k=b&&l?b.x-l.left<140:!1,ee={"--orb":r,...b?{left:b.x,top:b.y,right:`auto`,bottom:`auto`}:{}};return(0,L.jsxs)(Mk,{open:h&&!f,onOpenChange:g,children:[(0,L.jsx)(Nk,{asChild:!0,children:(0,L.jsxs)(`button`,{ref:c,type:`button`,"aria-label":`Open Thinking`,"aria-description":`${O}Drag, or use the arrow keys, to move it.`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-keyshortcuts":o?`${o} Enter Space`:`Enter Space`,onClick:e=>{if(v.current){v.current=!1,e.preventDefault();return}s()},onPointerDown:S,onPointerMove:C,onPointerUp:w,onPointerCancel:()=>{_.current=void 0,p(void 0)},onKeyDown:T,style:ee,"data-thinking":e?``:void 0,"data-busy":E?``:void 0,"data-dragging":f?``:void 0,"data-placed":b?``:void 0,"data-flip":k||void 0,className:q(`thinking-bubble fixed z-20 touch-none rounded-full outline-none select-none focus-visible:ring-3 focus-visible:ring-ring/40`,a&&`invisible`),children:[(0,L.jsx)(Ou,{initial:!1,children:D?(0,L.jsx)(z.span,{className:`orb-label`,initial:{opacity:0,x:k?-8:8,scale:.9},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:k?-8:8,scale:.9},transition:{type:`spring`,visualDuration:.3,bounce:.35},children:(0,L.jsx)(Ou,{mode:`popLayout`,initial:!1,children:(0,L.jsx)(z.span,{className:`inline-flex items-center gap-1`,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{type:`spring`,visualDuration:.28,bounce:.3},children:D},D)})},`label`):null}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`orb orb-float`,children:(0,L.jsx)(`span`,{className:`orb-icon`,children:(0,L.jsx)(kH,{source:e,strokeWidth:2.25,className:`size-3.5`})})})]})}),(0,L.jsxs)(Pk,{side:`top`,children:[`Thinking `,o?(0,L.jsx)(GO,{chord:o}):null,(0,L.jsx)(`span`,{className:`text-background/70`,children:` · drag to move`})]})]})}),n0=/^\s*(?:#{1,6}\s+(.+?)\s*#*|\*\*([^*\n]{2,90}?):?\*\*:?|__([^_\n]{2,90}?):?__:?)\s*$/,r0=260,i0=200,a0=/^\s*(?:[-*+]\s|\d+[.)]\s|>|```|~~~|\|)/m;function o0(e){let t=[],n=[],r=!1;for(let i of e){if(/^\s*(```|~~~)/.test(i)&&(r=!r),!r&&!i.trim()){n.length&&t.push(n.join(`
103
103
  `).trim()),n=[];continue}n.push(i)}return n.length&&t.push(n.join(`
104
- `).trim()),t.filter(Boolean)}function f0(e){let t=e.split(/(?<=[.!?…])\s+(?=[A-Z"'“‘`(\[])/),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&(t.split("`").length-1)%2==1?n[n.length-1]=`${t} ${e}`:n.push(e)}return n}function p0(e){if(e.length<=c0||u0.test(e))return[e];let t=[],n=``;for(let r of f0(e.replace(/\s*\n\s*/g,` `)))n&&n.length+r.length+1>l0?(t.push(n),n=r):n=n?`${n} ${r}`:r;return n&&t.push(n),t}function m0(e){let t=e.replace(/\r\n?/g,`
104
+ `).trim()),t.filter(Boolean)}function s0(e){let t=e.split(/(?<=[.!?…])\s+(?=[A-Z"'“‘`(\[])/),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&(t.split("`").length-1)%2==1?n[n.length-1]=`${t} ${e}`:n.push(e)}return n}function c0(e){if(e.length<=r0||a0.test(e))return[e];let t=[],n=``;for(let r of s0(e.replace(/\s*\n\s*/g,` `)))n&&n.length+r.length+1>i0?(t.push(n),n=r):n=n?`${n} ${r}`:r;return n&&t.push(n),t}function l0(e){let t=e.replace(/\r\n?/g,`
105
105
  `).trim().split(`
106
- `),n=[{lines:[]}],r=!1;for(let e of t){/^\s*(```|~~~)/.test(e)&&(r=!r);let t=r?null:s0.exec(e),i=t?(t[1]??t[2]??t[3])?.trim():void 0;i?n.push({title:i,lines:[]}):n.at(-1).lines.push(e)}let i=[];for(let e of n){let t=d0(e.lines);if(e.title)i.push({title:e.title,text:t.join(`
106
+ `),n=[{lines:[]}],r=!1;for(let e of t){/^\s*(```|~~~)/.test(e)&&(r=!r);let t=r?null:n0.exec(e),i=t?(t[1]??t[2]??t[3])?.trim():void 0;i?n.push({title:i,lines:[]}):n.at(-1).lines.push(e)}let i=[];for(let e of n){let t=o0(e.lines);if(e.title)i.push({title:e.title,text:t.join(`
107
107
 
108
- `)});else for(let e of t)for(let t of p0(e))i.push({text:t})}return i}var h0=4,g0=1800,_0=e=>({"--orb":e});function v0(e){let[t,n]=(0,m.useState)(0),r=e.join(`|`);return(0,m.useEffect)(()=>{if(n(0),e.length<2)return;let t=window.setInterval(()=>n(e=>e+1),g0);return()=>window.clearInterval(t)},[r,e.length]),e.length?e[t%e.length]:void 0}function y0({thought:e}){let t=(0,m.useMemo)(()=>m0(e.text),[e.text]),[n,r]=(0,m.useState)(!1),i=n?0:Math.max(0,t.length-h0),a=t.slice(i),o=DH(e.source);return(0,L.jsxs)(`li`,{className:`thought`,style:_0(AH(e.source)),"data-live":e.live||void 0,"aria-label":`${o}${e.live?`, thinking`:``}`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`thought-label`,children:[(0,L.jsx)(TH,{source:e.source,strokeWidth:2.25,className:`size-3.5`}),o]}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.live?(0,L.jsxs)(`span`,{className:`thought-live`,children:[`thinking`,(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`thought-ellipsis`})]}):gA(Date.now()-e.at)}),t.length>1?(0,L.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground tabular-nums`,children:[t.length,` steps`]}):null]}),i?(0,L.jsxs)(`button`,{type:`button`,"data-compact":!0,className:`thought-more`,onClick:()=>r(!0),children:[i,` earlier `,i===1?`step`:`steps`]}):null,(0,L.jsx)(`ol`,{className:`thought-steps`,"data-single":a.length===1||void 0,children:a.map((t,n)=>(0,L.jsxs)(`li`,{"data-current":e.live&&n===a.length-1||void 0,children:[t.title?(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:t.title}):null,t.text?(0,L.jsx)(YB,{text:t.text,className:`thought-text`}):null]},i+n))})]})}function b0(e,t,n){(0,m.useEffect)(()=>{if(!e||!t)return;let r=e=>{e.defaultPrevented||e.isComposing||!r$(e,t)||e.target?.closest(`input, textarea, [contenteditable='true']`)||(e.preventDefault(),n())};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,n])}function x0(e){return[...e].sort((e,t)=>Number(t.live)-Number(e.live)||t.at-e.at||t.id-e.id)}function S0({thoughts:e,collapsed:t,onToggle:n,shortcut:r,busy:i=[]}){let a=x0(NH(e)),o=a.filter(e=>e.live).map(e=>e.source),s=v0(o),c=s?AH(s):i.length?`var(--primary)`:`var(--orb-idle)`,l=s?`thinking`:i.length?`busy`:void 0,u=(0,m.useRef)(null),d=(0,m.useRef)(t);d.current=t,(0,m.useEffect)(()=>()=>{d.current||n()},[n]);let f=tk(!t,ek.sheet),p=rk();b0(f,r,n);let h=a.length>0||i.length>0;return(0,L.jsxs)(L.Fragment,{children:[h&&(0,Hv.createPortal)((0,L.jsx)(o0,{ref:u,spotlight:s,thinking:o,busy:i,tone:c,expanded:!t,hidden:p,shortcut:r,onOpen:n}),document.body),(0,L.jsxs)(qO,{open:f,onOpenChange:e=>{!e&&!t&&n()},label:`Thinking`,className:q(`thought-pane max-w-xl`,l&&`thought-pane-live`),style:_0(c),onCloseAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{document.querySelector(`[role='dialog']`)||u.current?.focus()})},children:[(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`thought-aura`,"data-working":l}),(0,L.jsx)(`div`,{className:`relative min-h-0 overflow-y-auto p-3 outline-none sm:p-4`,role:`log`,"aria-label":`Latest thoughts`,tabIndex:0,children:a.length?(0,L.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:a.map(e=>(0,L.jsx)(y0,{thought:e},e.id))}):(0,L.jsx)(`p`,{className:`px-2 py-6 text-center text-sm text-muted-foreground`,children:`Thoughts from the oracle and every agent appear here, and only here.`})})]})]})}function C0({status:e,lobby:t}){let[n,r]=JW(`lobby.thinking`),i=Tk(`sessions.list`,{},[`sessions`]);if(!e||e.panels?.thinking===!1)return null;let a=G1({oracleBusy:e.busy,runs:MH(t),activity:t?.activity??[],background:i.data?.background??[]}),o=e.keys.find(e=>e.action===`thinking`)?.label;return(0,L.jsx)(S0,{thoughts:t?.thoughts??[],collapsed:n,onToggle:r,shortcut:o,busy:a})}var w0=/\s*\(recommended\)\s*$/i,T0=1200,E0=`Type something.`;function D0(e){return{text:e.replace(w0,``),recommended:w0.test(e)}}function O0({label:e}){let{text:t,recommended:n}=D0(e);return(0,L.jsxs)(`span`,{className:`leading-snug`,children:[t,n?(0,L.jsx)(`span`,{className:`ms-1 font-medium text-primary`,children:`(Recommended)`}):null]})}function k0({multi:e,on:t}){return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:q(`relative mt-0.5 flex size-4 shrink-0 items-center justify-center border`,e?`rounded-lg`:`rounded-full`,t?`border-primary bg-primary text-primary-foreground`:`border-input`),children:[t?(0,L.jsx)(Hp,{className:q(e?`size-3`:`hidden`)}):null,t&&!e?(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-primary-foreground`}):null]})}function A0({option:e,index:t,multi:n,name:r,selected:i,onToggle:a,onFocusOption:o}){return(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsxs)(`label`,{className:q(`flex min-h-9 cursor-pointer items-start gap-2.5 rounded-lg border px-3 py-2 text-start text-sm transition-[background-color,border-color,transform] duration-150 ease-snap active:scale-[0.99]`,i?`border-primary/50 bg-accent`:`border-input bg-background hover:bg-accent/60`,`has-[:focus-visible]:border-ring has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/30`),children:[(0,L.jsx)(`input`,{type:n?`checkbox`:`radio`,name:r,"data-nav":``,"data-option":t,className:`sr-only`,checked:i,onChange:a,onFocus:o}),(0,L.jsx)(k0,{multi:n,on:i}),(0,L.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:(0,L.jsxs)(`span`,{className:`flex gap-1.5`,children:[(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,L.jsx)(O0,{label:e.label})]})})]}),e.description?(0,L.jsx)(YB,{text:e.description,className:`px-3 text-muted-foreground`}):null]})}function j0({option:e,onExpand:t}){return!e||!dY(e)?null:(0,L.jsxs)(`div`,{className:`card-raised flex flex-col gap-2 rounded-lg border p-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`p`,{className:`min-w-0 truncate text-xs font-medium text-muted-foreground`,children:[`Preview · `,D0(e.label).text]}),(0,L.jsxs)(J,{type:`button`,variant:`ghost`,size:`xs`,onClick:t,"aria-keyshortcuts":`E`,title:`Expand · E`,className:`-my-1 shrink-0`,children:[(0,L.jsx)(ih,{"aria-hidden":`true`}),`Expand`]})]}),e.image?(0,L.jsx)(`img`,{src:N(e.image),alt:``,loading:`lazy`,className:`max-h-64 w-full rounded-lg border object-contain`}):null,e.htmlPreview?(0,L.jsx)(sY,{preview:e.htmlPreview,label:D0(e.label).text,frameWidth:T0,onOpen:t,className:`h-auto aspect-[3/2]`}):null,e.preview?(0,L.jsx)(YB,{text:e.preview,className:`text-xs`}):null]})}function M0({primary:e,primaryLabel:t,disabled:n,submitting:r,onCancel:i}){return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`ghost`,onClick:i,children:`Cancel`}),(0,L.jsx)(J,{type:e,disabled:n||r,children:r?`Sending…`:t})]})}function N0(e,t,n,r){let i=e[r];if(!i)return;let a=n[r]?.trim();if(a)return{questionIndex:r,question:i.question,kind:`custom`,answer:a};let o=(t[r]??[]).map(e=>i.options[e]?.label).filter(e=>!!e);if(o.length!==0)return i.multiSelect?{questionIndex:r,question:i.question,kind:`multi`,answer:o.join(`, `),selected:o}:{questionIndex:r,question:i.question,kind:`option`,answer:o[0]??null}}function P0({questions:e,picks:t,own:n,index:r,onGo:i}){return e.length===1?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e[0]?.header}):(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.map((e,a)=>{let o=!!n[a]?.trim()||(t[a]?.length??0)>0;return(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-description":`When focused, press Enter or Space to open this question.`,type:`button`,onClick:()=>i(a),"aria-current":a===r,className:q(`inline-flex min-h-8 items-center gap-1 rounded-lg border px-3 text-xs font-medium transition-colors`,a===r?`border-primary bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[a+1,` `,e.header,o?(0,L.jsx)(Hp,{className:`size-3`,"aria-hidden":`true`}):null]},a)})})}function F0({questions:e,submitting:t,onAnswer:n,onCancel:r,expanded:i,onExpand:a}){let[o,s]=(0,m.useState)(0),[c,l]=(0,m.useState)(!1),u=i??c,d=e=>a?a(e):l(e),[f,p]=(0,m.useState)(0),h=(0,m.useRef)(0),g=(0,m.useRef)(!1),[_,v]=(0,m.useState)({}),[y,b]=(0,m.useState)({}),[x,S]=(0,m.useState)({}),C=(0,m.useRef)(null),w=e[o],T=_[o]??[],E=y[o]??``,D=w?.options[x[o]??T[0]??0],O=N0(e,_,y,o),k=w?.multiSelect===!0;if((0,m.useEffect)(()=>{let e=C.current;e&&(e.querySelector(`[data-option="${_[o]?.[0]??0}"]`)??e.querySelector(`[data-nav]`))?.focus()},[o]),(0,m.useEffect)(()=>{let e=g.current&&!u;g.current=u,e&&(S(e=>({...e,[o]:h.current})),C.current?.querySelector(`[data-option="${h.current}"]`)?.focus())},[u]),!w)return null;let ee=w.options.some(dY);function te(e){p(Math.max(0,e)),h.current=Math.max(0,e),d(!0)}function ne(e){h.current=e,d(!1)}if(u&&ee)return(0,L.jsx)(pY,{options:w.options,start:f,title:w.header||w.question,picked:T,multi:k,onChoose:e=>{A(e),k||ne(e)},onClose:ne,onIndex:e=>{h.current=e}},o);function A(e){let t=k?T.includes(e)?T.filter(t=>t!==e):[...T,e]:[e];v({..._,[o]:t}),k||b({...y,[o]:``}),S({...x,[o]:e})}function re(t,r){if(N0(e,t,r,o)){if(o<e.length-1){s(o+1);return}n({answers:e.map((n,i)=>N0(e,t,r,i)).filter(e=>!!e),cancelled:!1})}}function ie(e){e.preventDefault(),t||re(_,y)}function j(t){t>=0&&t<e.length&&s(t)}function ae(e){let n=e.target,r=C.current;if(!r||e.altKey)return;if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),t||re(_,y);return}if(n instanceof HTMLTextAreaElement){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),t||re(_,y)):e.key===`ArrowUp`&&n.selectionStart===0&&n.selectionEnd===0&&(e.preventDefault(),jk(r,n,-1));return}let i=Nk(e.key);if(i){e.preventDefault(),jk(r,n,i);return}if(e.key===`Home`||e.key===`End`){e.preventDefault(),jk(r,n,e.key===`Home`?`first`:`last`);return}let a=Pk(e.key);if(a&&!(n instanceof HTMLButtonElement)){e.preventDefault(),j(o+a);return}let s=n instanceof HTMLInputElement&&n.dataset.option!==void 0?Number(n.dataset.option):-1;if(e.key===`Enter`&&s>=0){if(e.preventDefault(),k)T.length>0&&T.includes(s)?re(_,y):A(s);else{let e={..._,[o]:[s]},t={...y,[o]:``};v(e),b(t),re(e,t)}return}if(e.key===` `&&s>=0){e.preventDefault(),A(s);return}let c=Number(e.key);if(Number.isInteger(c)&&c>=1&&c<=w.options.length){e.preventDefault(),A(c-1),r.querySelector(`[data-option="${c-1}"]`)?.focus();return}e.key.toLowerCase()===`e`&&ee&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),te(s>=0?s:x[o]??T[0]??0))}return(0,L.jsxs)(`form`,{ref:C,className:`flex flex-col gap-3`,onSubmit:ie,onKeyDown:ae,children:[(0,L.jsx)(P0,{questions:e,picks:_,own:y,index:o,onGo:s}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.length>1?`Question ${o+1} of ${e.length}`:`Question`}),(0,L.jsx)(YB,{text:w.question,className:`mt-1 text-base`})]}),(0,L.jsxs)(`div`,{className:q(`grid min-w-0 gap-4`,D?.preview||D?.image||D?.htmlPreview?`lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)]`:``),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[w.options.map((e,t)=>(0,L.jsx)(A0,{option:e,index:t,multi:k,name:`question-${o}`,selected:T.includes(t),onToggle:()=>A(t),onFocusOption:()=>S({...x,[o]:t})},t)),(0,L.jsxs)(`label`,{className:`flex min-h-9 flex-col gap-1 rounded-lg border border-input px-3 py-1.5 text-sm focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/30`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your own answer`}),(0,L.jsx)(dA,{"data-nav":``,value:E,onChange:e=>{b({...y,[o]:e.target.value}),e.target.value&&v({..._,[o]:[]})},placeholder:E0,"aria-label":`Your own answer`,rows:2,className:`min-h-9 resize-none border-0 bg-transparent p-0 text-sm shadow-none focus-visible:ring-0 md:text-sm`})]})]}),(0,L.jsx)(j0,{option:D,onExpand:()=>te(w.options.indexOf(D))})]}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:k?`Pick several`:`Pick one`}),(0,L.jsx)(KO,{chord:`↑↓`,children:`move`}),(0,L.jsx)(KO,{chord:k?`Space`:`Enter`,children:k?`pick`:`choose`}),k?(0,L.jsx)(KO,{chord:`Enter`,children:`next`}):null,e.length>1?(0,L.jsx)(KO,{chord:`←→`,children:`question`}):null,ee?(0,L.jsx)(KO,{chord:`E`,children:`expand mockups`}):null,(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsx)(M0,{primary:`submit`,primaryLabel:o<e.length-1?`Next`:`Answer`,disabled:!O,submitting:t,onCancel:r})]})}function I0(e,t,n){let r=e.currentTarget,i=e.target;if(e.altKey||Mk(i))return;let a=Nk(e.key);if(a){e.preventDefault(),jk(r,i,a);return}let o=i instanceof HTMLInputElement&&i.dataset.option!==void 0?Number(i.dataset.option):-1;if((e.key===`Enter`||e.key===` `)&&o>=0){e.preventDefault(),n(o,e.key===`Enter`);return}let s=Number(e.key);Number.isInteger(s)&&s>=1&&s<=t&&(e.preventDefault(),n(s-1,!1),r.querySelector(`[data-option="${s-1}"]`)?.focus())}function L0({view:e,submitting:t,onAnswer:n,onCancel:r}){let[i,a]=(0,m.useState)(``),o=(0,m.useRef)(null);return(0,m.useEffect)(()=>{o.current?.querySelector(`[data-nav]`)?.focus()},[]),(0,L.jsxs)(`form`,{ref:o,className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),i&&n(i)},onKeyDown:r=>I0(r,e.options.length,(r,i)=>{let o=e.options[r];o!==void 0&&(a(o),i&&!t&&n(o))}),children:[(0,L.jsx)(YB,{text:e.title,className:`text-base`}),(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map((e,t)=>(0,L.jsx)(A0,{option:{label:e},index:t,multi:!1,name:`choice`,selected:i===e,onToggle:()=>a(e)},e))}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`↑↓`,children:`move`}),(0,L.jsx)(KO,{chord:`Enter`,children:`choose`}),(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsx)(M0,{primary:`submit`,primaryLabel:`Choose`,disabled:!i,submitting:t,onCancel:r})]})}function R0({view:e,submitting:t,onAnswer:n}){let r=(0,m.useRef)(null);(0,m.useEffect)(()=>r.current?.focus(),[]);function i(e){if(e.altKey||e.ctrlKey||e.metaKey||t)return;let r=e.key.toLowerCase();r===`y`?n(!0):r===`n`&&n(!1)}return(0,L.jsxs)(`div`,{ref:r,tabIndex:-1,"data-autofocus":``,onKeyDown:i,className:`flex flex-col gap-3 outline-none`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(YB,{text:e.question,className:`text-base`}),e.detail?(0,L.jsx)(YB,{text:e.detail,className:`mt-1 text-muted-foreground`}):null]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-x-4 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`Y`,children:`yes`}),(0,L.jsx)(KO,{chord:`N`,children:`no`}),(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,disabled:t,onClick:()=>n(!1),children:`No`}),(0,L.jsx)(J,{type:`button`,disabled:t,onClick:()=>n(!0),children:t?`Sending…`:`Yes`})]})]})]})}function z0({view:e,submitting:t,onAnswer:n,onCancel:r}){let[i,a]=(0,m.useState)(``);return(0,L.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),i.trim()&&n(i.trim())},children:[(0,L.jsx)(YB,{text:e.question,className:`text-base`}),(0,L.jsx)(dA,{autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},value:i,onChange:e=>a(e.target.value),placeholder:e.placeholder??E0,"aria-label":e.question,rows:3,className:`min-h-9 resize-none text-sm md:text-sm`}),(0,L.jsxs)(`p`,{className:`flex items-center gap-x-4 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`Enter`,children:`answer`}),(0,L.jsx)(KO,{chord:`Shift+Enter`,children:`new line`}),(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsx)(M0,{primary:`submit`,primaryLabel:`Answer`,disabled:!i.trim(),submitting:t,onCancel:r})]})}function B0({dialog:e,submitting:t,onAnswer:n}){let[r,i]=(0,m.useState)(e.method===`editor`?e.prefill??``:``),[a,o]=(0,m.useState)(``),s=e.options??[],c=e.method===`select`?a!==``:r.trim()!==``,l=(0,m.useRef)(null);(0,m.useEffect)(()=>{l.current?.querySelector(`[data-nav], textarea`)?.focus()},[]);function u(t){t.preventDefault(),e.method===`select`?n({value:a}):e.method===`confirm`?n({confirmed:!0}):(e.method===`input`||e.method===`editor`)&&n({value:r.trim()})}return(0,L.jsxs)(`form`,{ref:l,className:`flex flex-col gap-3`,onSubmit:u,onKeyDown:r=>{e.method===`select`&&I0(r,s.length,(e,r)=>{let i=s[e];i!==void 0&&(o(i),r&&!t&&n({value:i}))})},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.title}),e.message?(0,L.jsx)(YB,{text:e.message,className:`mt-1 text-base`}):null]}),e.method===`select`?(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:s.map((e,t)=>(0,L.jsx)(A0,{option:{label:e},index:t,multi:!1,name:`dialog`,selected:a===e,onToggle:()=>o(e)},e))}):null,e.method===`input`||e.method===`editor`?(0,L.jsx)(dA,{value:r,onChange:e=>i(e.target.value),placeholder:e.placeholder??E0,"aria-label":e.title,rows:e.method===`editor`?4:2,className:`min-h-9 resize-none text-sm md:text-sm`}):null,(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,disabled:t,onClick:()=>n({cancelled:!0}),children:`Cancel`}),e.method===`confirm`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,disabled:t,onClick:()=>n({confirmed:!1}),children:`No`}),(0,L.jsx)(J,{type:`button`,disabled:t,onClick:()=>n({confirmed:!0}),children:t?`Sending…`:`Yes`})]}):(0,L.jsx)(J,{type:`submit`,disabled:!c||t,children:t?`Sending…`:`Answer`})]})]})}function V0(e){let{view:t}=e;return t.kind===`questionnaire`?(0,L.jsx)(F0,{questions:t.questions,submitting:e.submitting,onAnswer:e.onAnswer,onCancel:e.onCancel,...e.onExpand?{expanded:e.expanded??!1,onExpand:e.onExpand}:{}}):t.kind===`choose`?(0,L.jsx)(L0,{...e,view:t}):t.kind===`confirm`?(0,L.jsx)(R0,{...e,view:t}):t.kind===`text`?(0,L.jsx)(z0,{...e,view:t}):(0,L.jsx)(B0,{...e,dialog:t.dialog})}function H0(e){return typeof e==`object`&&e?e:{}}function U0(e){return typeof e==`string`?e.trim():``}function W0(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function G0(e){let t=H0(e),n=U0(t.label);if(!n)return;let r=U0(t.description),i=U0(t.preview),a=U0(t.image),o=nY(t.htmlPreview);return{label:n,...r?{description:r}:{},...i?{preview:i}:{},...a?{image:a}:{},...o?{htmlPreview:o}:{}}}function K0(e){let t=H0(e),n=U0(t.question);if(!n)return;let r=(Array.isArray(t.options)?t.options:[]).map(G0).filter(e=>!!e);return{question:n,header:U0(t.header)||`Question`,options:r,...t.multiSelect===!0?{multiSelect:!0}:{}}}function q0(e){let t=H0(e),n=U0(t.method);if(n!==`select`&&n!==`confirm`&&n!==`input`&&n!==`editor`)return;let r=U0(t.message),i=W0(t.options),a=U0(t.placeholder),o=U0(t.prefill);return{id:U0(t.id),method:n,title:U0(t.title)||`Answer`,...r?{message:r}:{},...i.length>0?{options:i}:{},...a?{placeholder:a}:{},...o?{prefill:o}:{}}}function J0(e){let t=(Array.isArray(e.questions)?e.questions:[]).map(K0).filter(e=>!!e);return t.length>0?{kind:`questionnaire`,questions:t}:void 0}function Y0(e){return{kind:`choose`,title:U0(e.title)||`Choose an option`,options:W0(e.options)}}function X0(e){let t=U0(e.question)||U0(e.title)||`Continue?`,n=U0(e.detail)||U0(e.message);return{kind:`confirm`,question:t,...n?{detail:n}:{}}}function Z0(e){let t=U0(e.question)||U0(e.title)||`Type an answer`,n=U0(e.placeholder);return{kind:`text`,question:t,...n?{placeholder:n}:{}}}function Q0(e){let t=H0(e.payload);if(e.kind===`questionnaire`)return J0(t);if(e.kind===`choose`)return Y0(t);if(e.kind===`confirm`)return X0(t);if(e.kind===`text`)return Z0(t);let n=q0(t.dialog);return n?{kind:`sessionDialog`,dialog:n}:void 0}function $0({submitting:e,onKeep:t,onLeave:n}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,role:`alert`,children:[(0,L.jsx)(`p`,{className:`text-sm`,children:`Leave without answering? The oracle will not guess for you.`}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,onClick:t,children:`Keep answering`}),(0,L.jsx)(J,{type:`button`,disabled:e,onClick:n,children:e?`Leaving…`:`Leave`})]})]})}function e2({count:e,onOpen:t}){return(0,L.jsxs)(J,{type:`button`,variant:`soft`,onClick:t,"aria-label":`${e} question${e===1?``:`s`} waiting — open`,className:`gap-1.5 text-warning`,children:[(0,L.jsx)(cm,{"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`tabular-nums`,children:e}),(0,L.jsx)(`span`,{className:`hidden sm:inline`,children:`waiting`})]})}function t2({prompts:e,answer:t,dismiss:n,minimized:r,onMinimize:i}){let[a,o]=(0,m.useState)(!1),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),d=e.length,f=e[0],p=f?Q0(f):void 0,h=d>0&&!r,g=tk(h,ek.question);(0,m.useEffect)(()=>{d===0&&(o(!1),i(!1))},[d,i]);let _=f?.id;(0,m.useEffect)(()=>u(!1),[_]);async function v(e,t){c(!0);try{await e,o(!1)}catch(e){e instanceof Te&&e.code===`question_withdrawn`?V(ak):V.error(e instanceof Error?e.message:t)}finally{c(!1)}}let y=f?.from?`${f.from} asks`:`A question`;return(0,L.jsx)(qO,{open:h&&g&&!!f,label:`Question from the lobby`,dismissOnBackdrop:!1,onOpenChange:e=>{e||(l?u(!1):a?o(!1):i(!0))},className:q(`max-w-3xl`,l&&`h-[min(92svh,60rem)] max-h-[min(92svh,60rem)] max-w-6xl`),children:f?(0,L.jsxs)(`section`,{"aria-label":`Question from the lobby`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`header`,{className:q(`flex items-center gap-3 px-6 pt-5 pb-3`,l&&`hidden`),children:[(0,L.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground first-letter:uppercase`,children:[y,d>1?` · 1 of ${d}`:``]}),(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Later: put the question away`,title:`Later · Esc`,onClick:()=>i(!0),children:(0,L.jsx)(Hg,{"aria-hidden":`true`})})]}),(0,L.jsx)(`div`,{className:l?`flex min-h-0 flex-1 flex-col`:`min-h-0 flex-1 overflow-y-auto px-6 pb-6`,children:p?a?(0,L.jsx)($0,{submitting:s,onKeep:()=>o(!1),onLeave:()=>void v(n(f.id),`Could not leave the question`)}):(0,L.jsx)(V0,{view:p,submitting:s,onAnswer:e=>void v(t(f.id,e),`Could not send the answer`),onCancel:()=>o(!0),expanded:l,onExpand:u},f.id):(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This question cannot be shown here.`}),(0,L.jsx)(J,{type:`button`,disabled:s,onClick:()=>void v(n(f.id),`Could not dismiss the question`),children:`Dismiss`})]})})]}):null})}var n2=2;function r2(e){let t=globalThis.EventSource;if(!t)throw Error(`EventSource is not available in this environment`);return new t(e)}function i2(e){try{return JSON.parse(e)}catch{return}}function a2(e,t){switch(e.type){case`hello`:t.onHello?.(e.versions);return;case`changed`:t.onChanged?.(e.topic,e.version);return;case`feed`:t.onFeed?.({activity:e.activity,thoughts:e.thoughts,chat:e.chat});return;case`reply`:t.onReply?.(e.text);return;case`notice`:t.onNotice?.(e.text,e.level)}}function o2(e,t=r2){let n=t(N(`/api/events`));return e.onConnection?.(`connecting`),n.onopen=()=>e.onConnection?.(`live`),n.onerror=()=>e.onConnection?.(n.readyState===n2?`offline`:`connecting`),n.onmessage=t=>{let n=i2(t.data);n&&a2(n,e)},()=>n.close()}var s2=2e3,c2=()=>De(`projects.list`,{});async function l2(){let e;try{e=M()}catch{return}if(e&&!Ce(e))try{Se((await c2()).projects)}catch{}}function u2(){let e=(0,m.useRef)(void 0),t=(0,m.useRef)(void 0),n=(0,m.useCallback)(()=>{clearTimeout(t.current),e.current?.();try{M()}catch{me.onStatus({connection:`offline`});return}e.current=o2({onHello:e=>{me.onHello(e),l2()},onChanged:(e,t)=>me.onChanged(e,t),onFeed:e=>me.onFeedDelta(e),onReply:e=>me.onReplyDelta(e),onNotice:(e,t)=>V[t](e),onConnection:e=>{me.onStatus({connection:e}),e===`offline`&&(clearTimeout(t.current),t.current=setTimeout(()=>{we(c2).catch(()=>!1).finally(n)},s2))}})},[]);return(0,m.useEffect)(()=>(n(),()=>{clearTimeout(t.current),e.current?.()}),[n]),n}var d2=`bot-lobby.recoveredAt`,f2;function p2(e,t=m2()){try{f2===void 0&&(f2=Number(t?.getItem(d2)??0))}catch{f2??=0}if(f2!==void 0&&e<=f2)return!1;f2=e;try{t?.setItem(d2,String(e))}catch{}return!0}function m2(){try{return globalThis.sessionStorage}catch{return}}function h2(e){let t=e?.recovered?.at,n=e?.recovered?.text;(0,m.useEffect)(()=>{t!==void 0&&n&&p2(t)&&V.success(n)},[t,n])}function g2(){let e=Ck(`prompts`),t=(0,m.useCallback)(async(e,t)=>{await De(`prompts.answer`,{id:e,answer:t})},[]),n=(0,m.useCallback)(async e=>{await De(`prompts.dismiss`,{id:e})},[]);return{prompts:e.data?.prompts??[],loading:e.loading,error:e.error,answer:t,dismiss:n}}function _2(e,t,n,r){e===`search`?(document.querySelector(`#main input[type='search']`)??document.getElementById(`composer-text`))?.focus():e===`help`?n():e===`settings`?Y(`#/settings`):e===`sessions`?Y(`#/sessions`):e===`thinking`?qW(`lobby.thinking`):e===`activity`?t.kind===`tab`&&t.tab===`lobby`?qW(`lobby.activity`):Y(lk(`lobby`)):e===`nextTab`?r(1):e===`prevTab`?r(-1):e===`savePlan`&&t.kind===`tab`&&t.tab===`plan`&&H(`planner.save`,{})}var v2=2500;function y2(e){let[t,n]=(0,m.useState)(!1),r=(0,m.useRef)(!1);return e===`live`&&(r.current=!0),(0,m.useEffect)(()=>{if(e!==`connecting`||!r.current)return n(!1);let t=setTimeout(()=>n(!0),v2);return()=>clearTimeout(t)},[e]),e===`offline`||e===`connecting`&&t}function b2({connection:e,onRetry:t}){return y2(e)?(0,L.jsx)(bk,{onRetry:t}):null}var x2={tick:0,route:0,focus:0};window.addEventListener(`hashchange`,()=>{x2.route=++x2.tick}),document.addEventListener(`focusin`,()=>{x2.focus=++x2.tick});var S2=()=>x2.focus>x2.route;function C2(e){return e.kind===`tab`?e.tab:e.kind}function w2(){let e=uk(),t=Ck(`status`),n=Ck(`lobby`),{prompts:r,answer:i,dismiss:a}=g2(),{connection:o,signedOut:s}=Sk(),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),f=(0,m.useRef)(null),p=u2();YK();let h=t.data;h2(h);let g=!!h&&!s;(0,m.useEffect)(()=>{g&&Ue()},[g]);let _=h?.tabs??[],v=h?.keys??[],y=e.kind===`tab`?e.tab:void 0,b=(0,m.useCallback)(e=>Y(lk(e)),[]),x=(0,m.useCallback)(e=>{if(_.length===0)return;let t=Math.max(0,_.findIndex(e=>e.id===y)),n=_[(t+e+_.length)%_.length];n&&Y(lk(n.id))},[_,y]),S=(0,m.useCallback)(()=>l(e=>!e),[]),C=(0,m.useCallback)(t=>{(t!==`thinking`&&t!==`activity`||h?.panels?.[t]!==!1)&&_2(t,ck(window.location.hash)??e,S,x)},[e,S,x,h?.panels]),w=(0,m.useCallback)(()=>{let e=document.activeElement;return!e||e===document.body||f.current?.contains(e)===!0||e.closest(`.thinking-bubble`)?!0:e.closest(`[data-state='closed']`)!==null},[]);u$({enabled:!!h,keys:v,tabs:_,insideApp:w,onAction:C,onTab:b});let T=(0,m.useCallback)(()=>me.onHello({}),[]),E=e.kind===`tab`?e.tab:e.kind,D=!!h;(0,m.useEffect)(()=>{if(!D)return;let e=Hk.active&&Hk.to===E;if(Hk.active=!1,Hk.to=void 0,e)return;let t=requestAnimationFrame(()=>{if(S2()||document.querySelector(`[role='dialog']:not([data-state='closed'])`))return;let e=document.getElementById(`composer-text`),t=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches;e&&!e.disabled&&!t?e.focus({preventScroll:!0}):document.activeElement?.id!==`composer-text`&&document.getElementById(`main`)?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[E,D]);let O=Object.fromEntries(v.map(e=>[e.action,e.label])),k=(0,L.jsx)(i1,{status:h,task:n.data?.task,connection:o,route:e,keys:O,onHelp:S,tabs:(0,L.jsx)(W1,{tabs:_,activeId:y,onSelect:b}),extra:u&&r.length>0?(0,L.jsx)(e2,{count:r.length,onOpen:()=>d(!1)}):null});return s||!h?(0,L.jsxs)(`div`,{ref:f,className:`fixed inset-0 flex flex-col`,children:[k,(0,L.jsx)(`main`,{className:`surface mx-3 mb-3 flex min-h-0 flex-1 flex-col overflow-y-auto max-sm:mx-0 max-sm:mb-0`,children:s?(0,L.jsx)(o1,{}):t.error?(0,L.jsx)(yk,{message:t.error,onRetry:T}):(0,L.jsx)(vk,{})})]}):(0,L.jsxs)(`div`,{ref:f,className:`fixed inset-0 flex flex-col`,children:[k,(0,L.jsx)(b2,{connection:o,onRetry:p}),(0,L.jsx)(`main`,{id:`main`,tabIndex:-1,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||Mk(e.target)||e.target.closest(`[role='dialog'], [role='menu'], [role='listbox']`)||Vk()&&e.preventDefault()},role:y?`tabpanel`:void 0,"aria-labelledby":y?`tab-${y}`:void 0,className:`surface mx-3 mb-3 flex min-h-0 flex-1 flex-col overflow-y-auto outline-none max-sm:mx-0 max-sm:mb-0`,children:(0,L.jsx)(z.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.18,ease:[.2,.8,.2,1]},className:`flex min-h-0 flex-1 flex-col`,children:ZQ(e)},C2(e))}),(0,L.jsx)(F$,{route:e,keys:O,onHelp:S}),(0,L.jsx)(C0,{status:h,lobby:n.data}),(0,L.jsx)(t2,{prompts:r,answer:i,dismiss:a,minimized:u,onMinimize:d}),(0,L.jsx)(x$,{open:c,onOpenChange:l,keys:v,tabs:_})]})}async function T2(e){switch(e){case`status`:return De(`status.get`,{});case`lobby`:return De(`lobby.snapshot`,{});case`prompts`:return De(`prompts.list`,{});default:return}}var E2=[`status`,`lobby`,`prompts`];function D2(){let[e,t]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=!0;return(async()=>{await ke(),e&&(me.markUsed(E2,T2),t(!0))})(),()=>{e=!1}},[]),e}function O2(){return D2()?(0,L.jsx)(w2,{}):(0,L.jsx)(`div`,{className:`fixed inset-0 flex`,children:(0,L.jsx)(vk,{})})}var k2={info:Wm,success:nm,warning:Eg,error:fm},A2={info:`text-primary`,success:`text-success`,warning:`text-warning`,error:`text-destructive`};function j2(){let{item:e,waiting:t}=op(),n=rk(),r=e&&!n;return(0,m.useEffect)(()=>{if(!e||n)return;let r=window.setTimeout(()=>ip(e.id),t>0?Math.min(e.duration,1600):e.duration);return()=>window.clearTimeout(r)},[e,n,t]),(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`pointer-events-none fixed inset-x-0 z-40 flex justify-center px-4`,style:{bottom:`calc(var(--composer-h, 0px) + 0.25rem)`},children:(0,L.jsx)(Ou,{mode:`wait`,children:r?(0,L.jsxs)(z.div,{initial:{opacity:0,scale:.55,y:18},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.92,y:6,transition:{duration:.14,ease:`easeIn`}},transition:{type:`spring`,stiffness:560,damping:15,mass:.8},className:`pointer-events-auto flex max-w-[min(32rem,100%)] items-center gap-3 rounded-xl border border-glass-border bg-popover/80 px-4 py-2.5 text-sm text-popover-foreground shadow-glass backdrop-blur-xs`,children:[(0,L.jsx)(M2,{kind:e.kind}),(0,L.jsx)(`span`,{className:`min-w-0 break-words`,children:e.message}),e.action?(0,L.jsx)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,className:`btn-raised -my-1.5 -mr-1 h-7 shrink-0 rounded-lg border bg-card px-2.5 font-medium text-primary transition-[box-shadow,translate] active:translate-y-px focus-visible:ring-3 focus-visible:ring-ring/40 focus-visible:outline-none`,onClick:()=>{e.action?.onClick(),ip(e.id)},children:e.action.label}):null]},e.id):null})})}function M2({kind:e}){let t=k2[e];return(0,L.jsx)(t,{"aria-hidden":`true`,className:q(`size-5 shrink-0`,A2[e])})}(0,Zf.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(m.StrictMode,{children:(0,L.jsx)(Mq,{children:(0,L.jsx)(Fu,{reducedMotion:`user`,children:(0,L.jsxs)(Ek,{children:[(0,L.jsx)(O2,{}),(0,L.jsx)(j2,{})]})})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`,{updateViaCache:`none`}).catch(()=>void 0)});
108
+ `)});else for(let e of t)for(let t of c0(e))i.push({text:t})}return i}var u0=4,d0=1800,f0=e=>({"--orb":e});function p0(e){let[t,n]=(0,m.useState)(0),r=e.join(`|`);return(0,m.useEffect)(()=>{if(n(0),e.length<2)return;let t=window.setInterval(()=>n(e=>e+1),d0);return()=>window.clearInterval(t)},[r,e.length]),e.length?e[t%e.length]:void 0}function m0({thought:e}){let t=(0,m.useMemo)(()=>l0(e.text),[e.text]),[n,r]=(0,m.useState)(!1),i=n?0:Math.max(0,t.length-u0),a=t.slice(i),o=jH(e.source);return(0,L.jsxs)(`li`,{className:`thought`,style:f0(PH(e.source)),"data-live":e.live||void 0,"aria-label":`${o}${e.live?`, thinking`:``}`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`thought-label`,children:[(0,L.jsx)(kH,{source:e.source,strokeWidth:2.25,className:`size-3.5`}),o]}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.live?(0,L.jsxs)(`span`,{className:`thought-live`,children:[`thinking`,(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`thought-ellipsis`})]}):xA(Date.now()-e.at)}),t.length>1?(0,L.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground tabular-nums`,children:[t.length,` steps`]}):null]}),i?(0,L.jsxs)(`button`,{type:`button`,"data-compact":!0,className:`thought-more`,onClick:()=>r(!0),children:[i,` earlier `,i===1?`step`:`steps`]}):null,(0,L.jsx)(`ol`,{className:`thought-steps`,"data-single":a.length===1||void 0,children:a.map((t,n)=>(0,L.jsxs)(`li`,{"data-current":e.live&&n===a.length-1||void 0,children:[t.title?(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:t.title}):null,t.text?(0,L.jsx)($B,{text:t.text,className:`thought-text`}):null]},i+n))})]})}function h0(e,t,n){(0,m.useEffect)(()=>{if(!e||!t)return;let r=e=>{e.defaultPrevented||e.isComposing||!QQ(e,t)||e.target?.closest(`input, textarea, [contenteditable='true']`)||(e.preventDefault(),n())};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,n])}function g0(e){return[...e].sort((e,t)=>Number(t.live)-Number(e.live)||t.at-e.at||t.id-e.id)}function _0({thoughts:e,collapsed:t,onToggle:n,shortcut:r,busy:i=[]}){let a=g0(LH(e)),o=a.filter(e=>e.live).map(e=>e.source),s=p0(o),c=s?PH(s):i.length?`var(--primary)`:`var(--orb-idle)`,l=s?`thinking`:i.length?`busy`:void 0,u=(0,m.useRef)(null),d=(0,m.useRef)(t);d.current=t,(0,m.useEffect)(()=>()=>{d.current||n()},[n]);let f=tk(!t,ek.sheet),p=rk();h0(f,r,n);let h=a.length>0||i.length>0;return(0,L.jsxs)(L.Fragment,{children:[h&&(0,Hv.createPortal)((0,L.jsx)(t0,{ref:u,spotlight:s,thinking:o,busy:i,tone:c,expanded:!t,hidden:p,shortcut:r,onOpen:n}),document.body),(0,L.jsxs)(qO,{open:f,onOpenChange:e=>{!e&&!t&&n()},label:`Thinking`,className:q(`thought-pane max-w-xl`,l&&`thought-pane-live`),style:f0(c),onCloseAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{document.querySelector(`[role='dialog']`)||u.current?.focus()})},children:[(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`thought-aura`,"data-working":l}),(0,L.jsx)(`div`,{className:`relative min-h-0 overflow-y-auto p-3 outline-none sm:p-4`,role:`log`,"aria-label":`Latest thoughts`,tabIndex:0,children:a.length?(0,L.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:a.map(e=>(0,L.jsx)(m0,{thought:e},e.id))}):(0,L.jsx)(`p`,{className:`px-2 py-6 text-center text-sm text-muted-foreground`,children:`Thoughts from the oracle and every agent appear here, and only here.`})})]})]})}function v0({status:e,lobby:t}){let[n,r]=QW(`lobby.thinking`),i=Ak(`sessions.list`,{},[`sessions`]);if(!e||e.panels?.thinking===!1)return null;let a=B1({oracleBusy:e.busy,runs:IH(t),activity:t?.activity??[],background:i.data?.background??[]}),o=e.keys.find(e=>e.action===`thinking`)?.label;return(0,L.jsx)(_0,{thoughts:t?.thoughts??[],collapsed:n,onToggle:r,shortcut:o,busy:a})}var y0=/\s*\(recommended\)\s*$/i,b0=1200,x0=`Type something.`;function S0(e){return{text:e.replace(y0,``),recommended:y0.test(e)}}function C0({label:e}){let{text:t,recommended:n}=S0(e);return(0,L.jsxs)(`span`,{className:`leading-snug`,children:[t,n?(0,L.jsx)(`span`,{className:`ms-1 font-medium text-primary`,children:`(Recommended)`}):null]})}function w0({multi:e,on:t}){return(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:q(`relative mt-0.5 flex size-4 shrink-0 items-center justify-center border`,e?`rounded-lg`:`rounded-full`,t?`border-primary bg-primary text-primary-foreground`:`border-input`),children:[t?(0,L.jsx)(Hp,{className:q(e?`size-3`:`hidden`)}):null,t&&!e?(0,L.jsx)(`span`,{className:`size-2 rounded-full bg-primary-foreground`}):null]})}function T0({option:e,index:t,multi:n,name:r,selected:i,onToggle:a,onFocusOption:o}){return(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsxs)(`label`,{className:q(`flex min-h-9 cursor-pointer items-start gap-2.5 rounded-lg border px-3 py-2 text-start text-sm transition-[background-color,border-color,transform] duration-150 ease-snap active:scale-[0.99]`,i?`border-primary/50 bg-accent`:`border-input bg-background hover:bg-accent/60`,`has-[:focus-visible]:border-ring has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/30`),children:[(0,L.jsx)(`input`,{type:n?`checkbox`:`radio`,name:r,"data-nav":``,"data-option":t,className:`sr-only`,checked:i,onChange:a,onFocus:o}),(0,L.jsx)(w0,{multi:n,on:i}),(0,L.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:(0,L.jsxs)(`span`,{className:`flex gap-1.5`,children:[(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,L.jsx)(C0,{label:e.label})]})})]}),e.description?(0,L.jsx)($B,{text:e.description,className:`px-3 text-muted-foreground`}):null]})}function E0({option:e,onExpand:t}){return!e||!oY(e)?null:(0,L.jsxs)(`div`,{className:`card-raised flex flex-col gap-2 rounded-lg border p-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`p`,{className:`min-w-0 truncate text-xs font-medium text-muted-foreground`,children:[`Preview · `,S0(e.label).text]}),(0,L.jsxs)(J,{type:`button`,variant:`ghost`,size:`xs`,onClick:t,"aria-keyshortcuts":`E`,title:`Expand · E`,className:`-my-1 shrink-0`,children:[(0,L.jsx)(ih,{"aria-hidden":`true`}),`Expand`]})]}),e.image?(0,L.jsx)(`img`,{src:N(e.image),alt:``,loading:`lazy`,className:`max-h-64 w-full rounded-lg border object-contain`}):null,e.htmlPreview?(0,L.jsx)(nY,{preview:e.htmlPreview,label:S0(e.label).text,frameWidth:b0,onOpen:t,className:`h-auto aspect-[3/2]`}):null,e.preview?(0,L.jsx)($B,{text:e.preview,className:`text-xs`}):null]})}function D0({primary:e,primaryLabel:t,disabled:n,submitting:r,onCancel:i}){return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`ghost`,onClick:i,children:`Cancel`}),(0,L.jsx)(J,{type:e,disabled:n||r,children:r?`Sending…`:t})]})}function O0(e,t,n,r){let i=e[r];if(!i)return;let a=n[r]?.trim();if(a)return{questionIndex:r,question:i.question,kind:`custom`,answer:a};let o=(t[r]??[]).map(e=>i.options[e]?.label).filter(e=>!!e);if(o.length!==0)return i.multiSelect?{questionIndex:r,question:i.question,kind:`multi`,answer:o.join(`, `),selected:o}:{questionIndex:r,question:i.question,kind:`option`,answer:o[0]??null}}function k0({questions:e,picks:t,own:n,index:r,onGo:i}){return e.length===1?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e[0]?.header}):(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.map((e,a)=>{let o=!!n[a]?.trim()||(t[a]?.length??0)>0;return(0,L.jsxs)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-description":`When focused, press Enter or Space to open this question.`,type:`button`,onClick:()=>i(a),"aria-current":a===r,className:q(`inline-flex min-h-8 items-center gap-1 rounded-lg border px-3 text-xs font-medium transition-colors`,a===r?`border-primary bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[a+1,` `,e.header,o?(0,L.jsx)(Hp,{className:`size-3`,"aria-hidden":`true`}):null]},a)})})}function A0({questions:e,submitting:t,onAnswer:n,onCancel:r,expanded:i,onExpand:a}){let[o,s]=(0,m.useState)(0),[c,l]=(0,m.useState)(!1),u=i??c,d=e=>a?a(e):l(e),[f,p]=(0,m.useState)(0),h=(0,m.useRef)(0),g=(0,m.useRef)(!1),[_,v]=(0,m.useState)({}),[y,b]=(0,m.useState)({}),[x,S]=(0,m.useState)({}),C=(0,m.useRef)(null),w=e[o],T=_[o]??[],E=y[o]??``,D=w?.options[x[o]??T[0]??0],O=O0(e,_,y,o),k=w?.multiSelect===!0;if((0,m.useEffect)(()=>{let e=C.current;e&&(e.querySelector(`[data-option="${_[o]?.[0]??0}"]`)??e.querySelector(`[data-nav]`))?.focus()},[o]),(0,m.useEffect)(()=>{let e=g.current&&!u;g.current=u,e&&(S(e=>({...e,[o]:h.current})),C.current?.querySelector(`[data-option="${h.current}"]`)?.focus())},[u]),!w)return null;let ee=w.options.some(oY);function te(e){p(Math.max(0,e)),h.current=Math.max(0,e),d(!0)}function ne(e){h.current=e,d(!1)}if(u&&ee)return(0,L.jsx)(cY,{options:w.options,start:f,title:w.header||w.question,picked:T,multi:k,onChoose:e=>{A(e),k||ne(e)},onClose:ne,onIndex:e=>{h.current=e}},o);function A(e){let t=k?T.includes(e)?T.filter(t=>t!==e):[...T,e]:[e];v({..._,[o]:t}),k||b({...y,[o]:``}),S({...x,[o]:e})}function re(t,r){if(O0(e,t,r,o)){if(o<e.length-1){s(o+1);return}n({answers:e.map((n,i)=>O0(e,t,r,i)).filter(e=>!!e),cancelled:!1})}}function ie(e){e.preventDefault(),t||re(_,y)}function j(t){t>=0&&t<e.length&&s(t)}function ae(e){let n=e.target,r=C.current;if(!r||e.altKey)return;if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),t||re(_,y);return}if(n instanceof HTMLTextAreaElement){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),t||re(_,y)):e.key===`ArrowUp`&&n.selectionStart===0&&n.selectionEnd===0&&(e.preventDefault(),Ik(r,n,-1));return}let i=Rk(e.key);if(i){e.preventDefault(),Ik(r,n,i);return}if(e.key===`Home`||e.key===`End`){e.preventDefault(),Ik(r,n,e.key===`Home`?`first`:`last`);return}let a=zk(e.key);if(a&&!(n instanceof HTMLButtonElement)){e.preventDefault(),j(o+a);return}let s=n instanceof HTMLInputElement&&n.dataset.option!==void 0?Number(n.dataset.option):-1;if(e.key===`Enter`&&s>=0){if(e.preventDefault(),k)T.length>0&&T.includes(s)?re(_,y):A(s);else{let e={..._,[o]:[s]},t={...y,[o]:``};v(e),b(t),re(e,t)}return}if(e.key===` `&&s>=0){e.preventDefault(),A(s);return}let c=Number(e.key);if(Number.isInteger(c)&&c>=1&&c<=w.options.length){e.preventDefault(),A(c-1),r.querySelector(`[data-option="${c-1}"]`)?.focus();return}e.key.toLowerCase()===`e`&&ee&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),te(s>=0?s:x[o]??T[0]??0))}return(0,L.jsxs)(`form`,{ref:C,className:`flex flex-col gap-3`,onSubmit:ie,onKeyDown:ae,children:[(0,L.jsx)(k0,{questions:e,picks:_,own:y,index:o,onGo:s}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.length>1?`Question ${o+1} of ${e.length}`:`Question`}),(0,L.jsx)($B,{text:w.question,className:`mt-1 text-base`})]}),(0,L.jsxs)(`div`,{className:q(`grid min-w-0 gap-4`,D?.preview||D?.image||D?.htmlPreview?`lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)]`:``),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[w.options.map((e,t)=>(0,L.jsx)(T0,{option:e,index:t,multi:k,name:`question-${o}`,selected:T.includes(t),onToggle:()=>A(t),onFocusOption:()=>S({...x,[o]:t})},t)),(0,L.jsxs)(`label`,{className:`flex min-h-9 flex-col gap-1 rounded-lg border border-input px-3 py-1.5 text-sm focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/30`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your own answer`}),(0,L.jsx)(gA,{"data-nav":``,value:E,onChange:e=>{b({...y,[o]:e.target.value}),e.target.value&&v({..._,[o]:[]})},placeholder:x0,"aria-label":`Your own answer`,rows:2,className:`min-h-9 resize-none border-0 bg-transparent p-0 text-sm shadow-none focus-visible:ring-0 md:text-sm`})]})]}),(0,L.jsx)(E0,{option:D,onExpand:()=>te(w.options.indexOf(D))})]}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{children:k?`Pick several`:`Pick one`}),(0,L.jsx)(KO,{chord:`↑↓`,children:`move`}),(0,L.jsx)(KO,{chord:k?`Space`:`Enter`,children:k?`pick`:`choose`}),k?(0,L.jsx)(KO,{chord:`Enter`,children:`next`}):null,e.length>1?(0,L.jsx)(KO,{chord:`←→`,children:`question`}):null,ee?(0,L.jsx)(KO,{chord:`E`,children:`expand mockups`}):null,(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsx)(D0,{primary:`submit`,primaryLabel:o<e.length-1?`Next`:`Answer`,disabled:!O,submitting:t,onCancel:r})]})}function j0(e,t,n){let r=e.currentTarget,i=e.target;if(e.altKey||Lk(i))return;let a=Rk(e.key);if(a){e.preventDefault(),Ik(r,i,a);return}let o=i instanceof HTMLInputElement&&i.dataset.option!==void 0?Number(i.dataset.option):-1;if((e.key===`Enter`||e.key===` `)&&o>=0){e.preventDefault(),n(o,e.key===`Enter`);return}let s=Number(e.key);Number.isInteger(s)&&s>=1&&s<=t&&(e.preventDefault(),n(s-1,!1),r.querySelector(`[data-option="${s-1}"]`)?.focus())}function M0({view:e,submitting:t,onAnswer:n,onCancel:r}){let[i,a]=(0,m.useState)(``),o=(0,m.useRef)(null);return(0,m.useEffect)(()=>{o.current?.querySelector(`[data-nav]`)?.focus()},[]),(0,L.jsxs)(`form`,{ref:o,className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),i&&n(i)},onKeyDown:r=>j0(r,e.options.length,(r,i)=>{let o=e.options[r];o!==void 0&&(a(o),i&&!t&&n(o))}),children:[(0,L.jsx)($B,{text:e.title,className:`text-base`}),(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map((e,t)=>(0,L.jsx)(T0,{option:{label:e},index:t,multi:!1,name:`choice`,selected:i===e,onToggle:()=>a(e)},e))}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`↑↓`,children:`move`}),(0,L.jsx)(KO,{chord:`Enter`,children:`choose`}),(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsx)(D0,{primary:`submit`,primaryLabel:`Choose`,disabled:!i,submitting:t,onCancel:r})]})}function N0({view:e,submitting:t,onAnswer:n}){let r=(0,m.useRef)(null);(0,m.useEffect)(()=>r.current?.focus(),[]);function i(e){if(e.altKey||e.ctrlKey||e.metaKey||t)return;let r=e.key.toLowerCase();r===`y`?n(!0):r===`n`&&n(!1)}return(0,L.jsxs)(`div`,{ref:r,tabIndex:-1,"data-autofocus":``,onKeyDown:i,className:`flex flex-col gap-3 outline-none`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)($B,{text:e.question,className:`text-base`}),e.detail?(0,L.jsx)($B,{text:e.detail,className:`mt-1 text-muted-foreground`}):null]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-x-4 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`Y`,children:`yes`}),(0,L.jsx)(KO,{chord:`N`,children:`no`}),(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,disabled:t,onClick:()=>n(!1),children:`No`}),(0,L.jsx)(J,{type:`button`,disabled:t,onClick:()=>n(!0),children:t?`Sending…`:`Yes`})]})]})]})}function P0({view:e,submitting:t,onAnswer:n,onCancel:r}){let[i,a]=(0,m.useState)(``);return(0,L.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),i.trim()&&n(i.trim())},children:[(0,L.jsx)($B,{text:e.question,className:`text-base`}),(0,L.jsx)(gA,{autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},value:i,onChange:e=>a(e.target.value),placeholder:e.placeholder??x0,"aria-label":e.question,rows:3,className:`min-h-9 resize-none text-sm md:text-sm`}),(0,L.jsxs)(`p`,{className:`flex items-center gap-x-4 text-xs text-muted-foreground`,children:[(0,L.jsx)(KO,{chord:`Enter`,children:`answer`}),(0,L.jsx)(KO,{chord:`Shift+Enter`,children:`new line`}),(0,L.jsx)(KO,{chord:`Esc`,children:`later`})]}),(0,L.jsx)(D0,{primary:`submit`,primaryLabel:`Answer`,disabled:!i.trim(),submitting:t,onCancel:r})]})}function F0({dialog:e,submitting:t,onAnswer:n}){let[r,i]=(0,m.useState)(e.method===`editor`?e.prefill??``:``),[a,o]=(0,m.useState)(``),s=e.options??[],c=e.method===`select`?a!==``:r.trim()!==``,l=(0,m.useRef)(null);(0,m.useEffect)(()=>{l.current?.querySelector(`[data-nav], textarea`)?.focus()},[]);function u(t){t.preventDefault(),e.method===`select`?n({value:a}):e.method===`confirm`?n({confirmed:!0}):(e.method===`input`||e.method===`editor`)&&n({value:r.trim()})}return(0,L.jsxs)(`form`,{ref:l,className:`flex flex-col gap-3`,onSubmit:u,onKeyDown:r=>{e.method===`select`&&j0(r,s.length,(e,r)=>{let i=s[e];i!==void 0&&(o(i),r&&!t&&n({value:i}))})},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.title}),e.message?(0,L.jsx)($B,{text:e.message,className:`mt-1 text-base`}):null]}),e.method===`select`?(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:s.map((e,t)=>(0,L.jsx)(T0,{option:{label:e},index:t,multi:!1,name:`dialog`,selected:a===e,onToggle:()=>o(e)},e))}):null,e.method===`input`||e.method===`editor`?(0,L.jsx)(gA,{value:r,onChange:e=>i(e.target.value),placeholder:e.placeholder??x0,"aria-label":e.title,rows:e.method===`editor`?4:2,className:`min-h-9 resize-none text-sm md:text-sm`}):null,(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,disabled:t,onClick:()=>n({cancelled:!0}),children:`Cancel`}),e.method===`confirm`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,disabled:t,onClick:()=>n({confirmed:!1}),children:`No`}),(0,L.jsx)(J,{type:`button`,disabled:t,onClick:()=>n({confirmed:!0}),children:t?`Sending…`:`Yes`})]}):(0,L.jsx)(J,{type:`submit`,disabled:!c||t,children:t?`Sending…`:`Answer`})]})]})}function I0(e){let{view:t}=e;return t.kind===`questionnaire`?(0,L.jsx)(A0,{questions:t.questions,submitting:e.submitting,onAnswer:e.onAnswer,onCancel:e.onCancel,...e.onExpand?{expanded:e.expanded??!1,onExpand:e.onExpand}:{}}):t.kind===`choose`?(0,L.jsx)(M0,{...e,view:t}):t.kind===`confirm`?(0,L.jsx)(N0,{...e,view:t}):t.kind===`text`?(0,L.jsx)(P0,{...e,view:t}):(0,L.jsx)(F0,{...e,dialog:t.dialog})}function L0(e){return typeof e==`object`&&e?e:{}}function R0(e){return typeof e==`string`?e.trim():``}function z0(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function B0(e){let t=L0(e),n=R0(t.label);if(!n)return;let r=R0(t.description),i=R0(t.preview),a=R0(t.image),o=ZJ(t.htmlPreview);return{label:n,...r?{description:r}:{},...i?{preview:i}:{},...a?{image:a}:{},...o?{htmlPreview:o}:{}}}function V0(e){let t=L0(e),n=R0(t.question);if(!n)return;let r=(Array.isArray(t.options)?t.options:[]).map(B0).filter(e=>!!e);return{question:n,header:R0(t.header)||`Question`,options:r,...t.multiSelect===!0?{multiSelect:!0}:{}}}function H0(e){let t=L0(e),n=R0(t.method);if(n!==`select`&&n!==`confirm`&&n!==`input`&&n!==`editor`)return;let r=R0(t.message),i=z0(t.options),a=R0(t.placeholder),o=R0(t.prefill);return{id:R0(t.id),method:n,title:R0(t.title)||`Answer`,...r?{message:r}:{},...i.length>0?{options:i}:{},...a?{placeholder:a}:{},...o?{prefill:o}:{}}}function U0(e){let t=(Array.isArray(e.questions)?e.questions:[]).map(V0).filter(e=>!!e);return t.length>0?{kind:`questionnaire`,questions:t}:void 0}function W0(e){return{kind:`choose`,title:R0(e.title)||`Choose an option`,options:z0(e.options)}}function G0(e){let t=R0(e.question)||R0(e.title)||`Continue?`,n=R0(e.detail)||R0(e.message);return{kind:`confirm`,question:t,...n?{detail:n}:{}}}function K0(e){let t=R0(e.question)||R0(e.title)||`Type an answer`,n=R0(e.placeholder);return{kind:`text`,question:t,...n?{placeholder:n}:{}}}function q0(e){let t=L0(e.payload);if(e.kind===`questionnaire`)return U0(t);if(e.kind===`choose`)return W0(t);if(e.kind===`confirm`)return G0(t);if(e.kind===`text`)return K0(t);let n=H0(t.dialog);return n?{kind:`sessionDialog`,dialog:n}:void 0}function J0({submitting:e,onKeep:t,onLeave:n}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,role:`alert`,children:[(0,L.jsx)(`p`,{className:`text-sm`,children:`Leave without answering? The oracle will not guess for you.`}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,L.jsx)(J,{type:`button`,variant:`outline`,onClick:t,children:`Keep answering`}),(0,L.jsx)(J,{type:`button`,disabled:e,onClick:n,children:e?`Leaving…`:`Leave`})]})]})}function Y0({count:e,onOpen:t}){return(0,L.jsxs)(J,{type:`button`,variant:`soft`,onClick:t,"aria-label":`${e} question${e===1?``:`s`} waiting — open`,className:`gap-1.5 text-warning`,children:[(0,L.jsx)(cm,{"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`tabular-nums`,children:e}),(0,L.jsx)(`span`,{className:`hidden sm:inline`,children:`waiting`})]})}function X0({prompts:e,answer:t,dismiss:n,minimized:r,onMinimize:i}){let[a,o]=(0,m.useState)(!1),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),d=e.length,f=e[0],p=f?q0(f):void 0,h=d>0&&!r,g=tk(h,ek.question);(0,m.useEffect)(()=>{d===0&&(o(!1),i(!1))},[d,i]);let _=f?.id;(0,m.useEffect)(()=>u(!1),[_]);async function v(e,t){c(!0);try{await e,o(!1)}catch(e){e instanceof Te&&e.code===`question_withdrawn`?V(ak):V.error(e instanceof Error?e.message:t)}finally{c(!1)}}let y=f?.from?`${f.from} asks`:`A question`;return(0,L.jsx)(qO,{open:h&&g&&!!f,label:`Question from the lobby`,dismissOnBackdrop:!1,onOpenChange:e=>{e||(l?u(!1):a?o(!1):i(!0))},className:q(`max-w-3xl`,l&&`h-[min(92svh,60rem)] max-h-[min(92svh,60rem)] max-w-6xl`),children:f?(0,L.jsxs)(`section`,{"aria-label":`Question from the lobby`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`header`,{className:q(`flex items-center gap-3 px-6 pt-5 pb-3`,l&&`hidden`),children:[(0,L.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground first-letter:uppercase`,children:[y,d>1?` · 1 of ${d}`:``]}),(0,L.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Later: put the question away`,title:`Later · Esc`,onClick:()=>i(!0),children:(0,L.jsx)(Hg,{"aria-hidden":`true`})})]}),(0,L.jsx)(`div`,{className:l?`flex min-h-0 flex-1 flex-col`:`min-h-0 flex-1 overflow-y-auto px-6 pb-6`,children:p?a?(0,L.jsx)(J0,{submitting:s,onKeep:()=>o(!1),onLeave:()=>void v(n(f.id),`Could not leave the question`)}):(0,L.jsx)(I0,{view:p,submitting:s,onAnswer:e=>void v(t(f.id,e),`Could not send the answer`),onCancel:()=>o(!0),expanded:l,onExpand:u},f.id):(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This question cannot be shown here.`}),(0,L.jsx)(J,{type:`button`,disabled:s,onClick:()=>void v(n(f.id),`Could not dismiss the question`),children:`Dismiss`})]})})]}):null})}var Z0=2;function Q0(e){let t=globalThis.EventSource;if(!t)throw Error(`EventSource is not available in this environment`);return new t(e)}function $0(e){try{return JSON.parse(e)}catch{return}}function e2(e,t){switch(e.type){case`hello`:t.onHello?.(e.versions);return;case`changed`:t.onChanged?.(e.topic,e.version);return;case`feed`:t.onFeed?.({activity:e.activity,thoughts:e.thoughts,chat:e.chat});return;case`reply`:t.onReply?.(e.text);return;case`notice`:t.onNotice?.(e.text,e.level)}}function t2(e,t=Q0){let n=t(N(`/api/events`));return e.onConnection?.(`connecting`),n.onopen=()=>e.onConnection?.(`live`),n.onerror=()=>e.onConnection?.(n.readyState===Z0?`offline`:`connecting`),n.onmessage=t=>{let n=$0(t.data);n&&e2(n,e)},()=>n.close()}var n2=2e3,r2=()=>De(`projects.list`,{});async function i2(){let e;try{e=M()}catch{return}if(e&&!Ce(e))try{Se((await r2()).projects)}catch{}}function a2(){let e=(0,m.useRef)(void 0),t=(0,m.useRef)(void 0),n=(0,m.useCallback)(()=>{clearTimeout(t.current),e.current?.();try{M()}catch{me.onStatus({connection:`offline`});return}e.current=t2({onHello:e=>{me.onHello(e),i2()},onChanged:(e,t)=>me.onChanged(e,t),onFeed:e=>me.onFeedDelta(e),onReply:e=>me.onReplyDelta(e),onNotice:(e,t)=>V[t](e),onConnection:e=>{me.onStatus({connection:e}),e===`offline`&&(clearTimeout(t.current),t.current=setTimeout(()=>{we(r2).catch(()=>!1).finally(n)},n2))}})},[]);return(0,m.useEffect)(()=>(n(),()=>{clearTimeout(t.current),e.current?.()}),[n]),n}var o2=`bot-lobby.recoveredAt`,s2;function c2(e,t=l2()){try{s2===void 0&&(s2=Number(t?.getItem(o2)??0))}catch{s2??=0}if(s2!==void 0&&e<=s2)return!1;s2=e;try{t?.setItem(o2,String(e))}catch{}return!0}function l2(){try{return globalThis.sessionStorage}catch{return}}function u2(e){let t=e?.recovered?.at,n=e?.recovered?.text;(0,m.useEffect)(()=>{t!==void 0&&n&&c2(t)&&V.success(n)},[t,n])}function d2(){let e=Ok(`prompts`),t=(0,m.useCallback)(async(e,t)=>{await De(`prompts.answer`,{id:e,answer:t})},[]),n=(0,m.useCallback)(async e=>{await De(`prompts.dismiss`,{id:e})},[]);return{prompts:e.data?.prompts??[],loading:e.loading,error:e.error,answer:t,dismiss:n}}function f2(e,t,n,r){e===`search`?(document.querySelector(`#main input[type='search']`)??document.getElementById(`composer-text`))?.focus():e===`help`?n():e===`settings`?uk(`#/settings`):e===`sessions`?uk(`#/sessions`):e===`thinking`?ZW(`lobby.thinking`):e===`activity`?t.kind===`tab`&&t.tab===`lobby`?ZW(`lobby.activity`):uk(lk(`lobby`)):e===`nextTab`?r(1):e===`prevTab`?r(-1):e===`savePlan`&&t.kind===`tab`&&t.tab===`plan`&&H(`planner.save`,{})}var p2=2500;function m2(e){let[t,n]=(0,m.useState)(!1),r=(0,m.useRef)(!1);return e===`live`&&(r.current=!0),(0,m.useEffect)(()=>{if(e!==`connecting`||!r.current)return n(!1);let t=setTimeout(()=>n(!0),p2);return()=>clearTimeout(t)},[e]),e===`offline`||e===`connecting`&&t}function h2({connection:e,onRetry:t}){return m2(e)?(0,L.jsx)(Tk,{onRetry:t}):null}var g2={tick:0,route:0,focus:0};window.addEventListener(`hashchange`,()=>{g2.route=++g2.tick}),document.addEventListener(`focusin`,()=>{g2.focus=++g2.tick});var _2=()=>g2.focus>g2.route;function v2(e){return e.kind===`tab`?e.tab:e.kind}function y2(){let e=dk(),t=Ok(`status`),n=Ok(`lobby`),{prompts:r,answer:i,dismiss:a}=d2(),{connection:o,signedOut:s}=Dk(),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),f=(0,m.useRef)(null),p=a2();rq();let h=t.data;u2(h);let g=!!h&&!s;(0,m.useEffect)(()=>{g&&Ue()},[g]);let _=h?.tabs??[],v=h?.keys??[],y=e.kind===`tab`?e.tab:void 0,b=(0,m.useCallback)(e=>uk(lk(e)),[]),x=(0,m.useCallback)(e=>{if(_.length===0)return;let t=Math.max(0,_.findIndex(e=>e.id===y)),n=_[(t+e+_.length)%_.length];n&&uk(lk(n.id))},[_,y]),S=(0,m.useCallback)(()=>l(e=>!e),[]),C=(0,m.useCallback)(t=>{(t!==`thinking`&&t!==`activity`||h?.panels?.[t]!==!1)&&f2(t,ck(window.location.hash)??e,S,x)},[e,S,x,h?.panels]),w=(0,m.useCallback)(()=>{let e=document.activeElement;return!e||e===document.body||f.current?.contains(e)===!0||e.closest(`.thinking-bubble`)?!0:e.closest(`[data-state='closed']`)!==null},[]);a$({enabled:!!h,keys:v,tabs:_,insideApp:w,onAction:C,onTab:b});let T=(0,m.useCallback)(()=>me.onHello({}),[]),E=e.kind===`tab`?e.tab:e.kind,D=!!h;(0,m.useEffect)(()=>{if(!D)return;let e=qk.active&&qk.to===E;if(qk.active=!1,qk.to=void 0,e)return;let t=requestAnimationFrame(()=>{if(_2()||document.querySelector(`[role='dialog']:not([data-state='closed'])`))return;let e=document.getElementById(`composer-text`),t=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches;e&&!e.disabled&&!t?e.focus({preventScroll:!0}):document.activeElement?.id!==`composer-text`&&document.getElementById(`main`)?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[E,D]);let O=Object.fromEntries(v.map(e=>[e.action,e.label])),k=(0,L.jsx)($$,{status:h,task:n.data?.task,connection:o,route:e,keys:O,onHelp:S,tabs:(0,L.jsx)(z1,{tabs:_,activeId:y,onSelect:b}),extra:u&&r.length>0?(0,L.jsx)(Y0,{count:r.length,onOpen:()=>d(!1)}):null});return s||!h?(0,L.jsxs)(`div`,{ref:f,className:`fixed inset-0 flex flex-col`,children:[k,(0,L.jsx)(`main`,{className:`surface mx-3 mb-3 flex min-h-0 flex-1 flex-col overflow-y-auto max-sm:mx-0 max-sm:mb-0`,children:s?(0,L.jsx)(t1,{}):t.error?(0,L.jsx)(wk,{message:t.error,onRetry:T}):(0,L.jsx)(Ck,{})})]}):(0,L.jsxs)(`div`,{ref:f,className:`fixed inset-0 flex flex-col`,children:[k,(0,L.jsx)(h2,{connection:o,onRetry:p}),(0,L.jsx)(`main`,{id:`main`,tabIndex:-1,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||Lk(e.target)||e.target.closest(`[role='dialog'], [role='menu'], [role='listbox']`)||Kk()&&e.preventDefault()},role:y?`tabpanel`:void 0,"aria-labelledby":y?`tab-${y}`:void 0,className:`surface mx-3 mb-3 flex min-h-0 flex-1 flex-col overflow-y-auto outline-none max-sm:mx-0 max-sm:mb-0`,children:(0,L.jsx)(z.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.18,ease:[.2,.8,.2,1]},className:`flex min-h-0 flex-1 flex-col`,children:KQ(e)},v2(e))}),(0,L.jsx)(A$,{route:e,keys:O,onHelp:S}),(0,L.jsx)(v0,{status:h,lobby:n.data}),(0,L.jsx)(X0,{prompts:r,answer:i,dismiss:a,minimized:u,onMinimize:d}),(0,L.jsx)(g$,{open:c,onOpenChange:l,keys:v,tabs:_})]})}async function b2(e){switch(e){case`status`:return De(`status.get`,{});case`lobby`:return De(`lobby.snapshot`,{});case`prompts`:return De(`prompts.list`,{});default:return}}var x2=[`status`,`lobby`,`prompts`];function S2(){let[e,t]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{let e=!0;return(async()=>{await ke(),e&&(me.markUsed(x2,b2),t(!0))})(),()=>{e=!1}},[]),e}function C2(){return S2()?(0,L.jsx)(y2,{}):(0,L.jsx)(`div`,{className:`fixed inset-0 flex`,children:(0,L.jsx)(Ck,{})})}var w2={info:Wm,success:nm,warning:Eg,error:fm},T2={info:`text-primary`,success:`text-success`,warning:`text-warning`,error:`text-destructive`};function E2(){let{item:e,waiting:t}=op(),n=rk(),r=e&&!n;return(0,m.useEffect)(()=>{if(!e||n)return;let r=window.setTimeout(()=>ip(e.id),t>0?Math.min(e.duration,1600):e.duration);return()=>window.clearTimeout(r)},[e,n,t]),(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`pointer-events-none fixed inset-x-0 z-40 flex justify-center px-4`,style:{bottom:`calc(var(--composer-h, 0px) + 0.25rem)`},children:(0,L.jsx)(Ou,{mode:`wait`,children:r?(0,L.jsxs)(z.div,{initial:{opacity:0,scale:.55,y:18},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.92,y:6,transition:{duration:.14,ease:`easeIn`}},transition:{type:`spring`,stiffness:560,damping:15,mass:.8},className:`pointer-events-auto flex max-w-[min(32rem,100%)] items-center gap-3 rounded-xl border border-glass-border bg-popover/80 px-4 py-2.5 text-sm text-popover-foreground shadow-glass backdrop-blur-xs`,children:[(0,L.jsx)(D2,{kind:e.kind}),(0,L.jsx)(`span`,{className:`min-w-0 break-words`,children:e.message}),e.action?(0,L.jsx)(`button`,{"aria-keyshortcuts":`Enter Space`,"aria-describedby":`focused-action-help`,type:`button`,className:`btn-raised -my-1.5 -mr-1 h-7 shrink-0 rounded-lg border bg-card px-2.5 font-medium text-primary transition-[box-shadow,translate] active:translate-y-px focus-visible:ring-3 focus-visible:ring-ring/40 focus-visible:outline-none`,onClick:()=>{e.action?.onClick(),ip(e.id)},children:e.action.label}):null]},e.id):null})})}function D2({kind:e}){let t=w2[e];return(0,L.jsx)(t,{"aria-hidden":`true`,className:q(`size-5 shrink-0`,T2[e])})}(0,Zf.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(m.StrictMode,{children:(0,L.jsx)(Dq,{children:(0,L.jsx)(Fu,{reducedMotion:`user`,children:(0,L.jsxs)(jk,{children:[(0,L.jsx)(C2,{}),(0,L.jsx)(E2,{})]})})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`,{updateViaCache:`none`}).catch(()=>void 0)});