@staff0rd/assist 0.936.0 → 0.937.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4019,7 +4019,7 @@ ${f.join(`
|
|
|
4019
4019
|
`,Nti=po`
|
|
4020
4020
|
0%, 100% { transform: scale(1); }
|
|
4021
4021
|
50% { transform: scale(1.08); }
|
|
4022
|
-
`,VSr={content:'""',position:"absolute",borderRadius:"inherit",background:"conic-gradient(from calc(var(--rainbow-pill-h) * 1deg) in oklch longer hue, oklch(66% 0.21 0), oklch(66% 0.21 0))",animation:`${Dti} 1.8s linear infinite`},Oti={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${Nti} 1.6s ease-in-out infinite`,"&::before":{...VSr,inset:0,zIndex:-1},"&::after":{...VSr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gs.rainbowPill.text,textShadow:Gs.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function qSr({children:e}){return(0,zA.jsxs)(zA.Fragment,{children:[(0,zA.jsx)(J_,{styles:Iti}),(0,zA.jsx)(ne,{component:"span","data-testid":"rainbow-pill",sx:Oti,children:e})]})}function jSr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function YSr(e){if(e.length!==2)return!1;let[t,r]=e;return jSr(t)===jSr(r)}var fT=E($(),1);function V1e({rateLimits:e}){let t=c_(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(o=>o.window?.used_percentage!=null),n=YSr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:W1e(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,fT.jsxs)(KSr.Fragment,{children:[a>0?(0,fT.jsx)(ne,{component:"span",sx:{color:o$,mr:.5},children:","}):null,(0,fT.jsx)(GSr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,fT.jsx)(qSr,{children:i}):(0,fT.jsx)(fT.Fragment,{children:i})}var k_=E($(),1);function ZSr({groups:e}){return(0,k_.jsx)(k_.Fragment,{children:e.map((t,r)=>(0,k_.jsxs)(XSr.Fragment,{children:[(0,k_.jsx)(ne,{component:"span",sx:{color:o$,ml:r>0?1:0,mr:.5},children:Mu(t.harness)}),(0,k_.jsx)(V1e,{rateLimits:t.rateLimits})]},t.harness))})}function Bti(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function Fti(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function $ti(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function eCr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=xWe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=l_(e,t,r,n),a=Bti(o),s=Fti(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:$ti(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function q1e(e){return t=>t.tokens.color.onAppBar.level[e]}function tCr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${i1e(e.at,t)}`}var N0=E($(),1);function UWe({direction:e,threshold:t}){let r=e==="back",n={display:"inline-flex",gap:.5,minWidth:"6ch",justifyContent:r?"flex-end":"flex-start"};if(!t)return(0,N0.jsx)(ne,{component:"span",sx:n});let i=(0,N0.jsx)(ne,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,N0.jsxs)(ne,{component:"span",sx:{color:q1e(t.level)},children:[Math.round(t.pct),"%"]});return(0,N0.jsx)(ne,{component:"span",sx:n,children:r?(0,N0.jsxs)(N0.Fragment,{children:[o,i]}):(0,N0.jsxs)(N0.Fragment,{children:[i,o]})})}var __=E($(),1);function rCr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=l_(t,r,n,i),a=eCr(t,r,n,i),s=a.kind==="projected"?a:void 0;return(0,__.jsxs)(ne,{sx:{display:"flex",alignItems:"baseline",gap:.75},children:[(0,__.jsx)(ne,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,__.jsx)(UWe,{direction:"back",threshold:s?.recovery}),(0,__.jsxs)(ne,{component:"span",sx:{minWidth:"4ch",textAlign:"right",color:q1e(o)},children:[Math.round(t),"%"]}),(0,__.jsx)(UWe,{direction:"forward",threshold:s?.worse}),(0,__.jsx)(ne,{component:"span",sx:{opacity:.6},children:s?s.recovery&&tCr(s.recovery,i):"no projection yet"})]})}function nCr(e){return[{label:"5h",window:e.five_hour,windowSeconds:18e3},{label:"7d",window:e.seven_day,windowSeconds:604800}].flatMap(t=>t.window?.used_percentage==null?[]:[{label:t.label,pct:t.window.used_percentage,resetsAt:t.window.resets_at,windowSeconds:t.windowSeconds}])}var iCr=E($(),1);function j1e({rateLimits:e,now:t}){return nCr(e).map(r=>(0,iCr.jsx)(rCr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var HA=E($(),1);function oCr({groups:e}){let t=c_(3e4);return(0,HA.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[e.map(r=>(0,HA.jsxs)(ne,{sx:{mb:.5},children:[(0,HA.jsx)(ne,{sx:{opacity:.8},children:Mu(r.harness)}),(0,HA.jsx)(j1e,{rateLimits:r.rateLimits,now:t})]},r.harness)),(0,HA.jsx)(ne,{sx:{mt:.5,opacity:.6},children:"Account usage per harness \u2014 view history"})]})}function aCr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function sCr(e,t){let r=[];aCr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,i]of Object.entries(t))aCr(i)&&r.push({harness:n,rateLimits:i});return r}var zti={display:"flex",alignItems:"center",ml:2,fontFamily:"fontFamilyMono",fontSize:13},Hti={display:"flex",alignItems:"center",height:22,px:1,borderRadius:1,fontSize:"inherit","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar?.hover,color:e=>e.tokens.color.statusBar?.hoverText}},lCr=e=>e?Hti:zti;var TX=E($(),1),WWe="Claude account usage (5h / 7d windows) \u2014 view history";function cCr({rateLimits:e}){let t=c_(3e4);return(0,TX.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[(0,TX.jsx)(j1e,{rateLimits:e,now:t}),(0,TX.jsx)(ne,{sx:{mt:.5,opacity:.6},children:WWe})]})}var UA=E($(),1),Uti={};function Y1e({rateLimits:e,harnessRateLimits:t=Uti,onStatusBar:r=!1}){let n=sCr(e,t),i=n.every(l=>l.harness==="claude"),o=e,a=WWe,s="Usage";return n.length>0&&i?(a=(0,UA.jsx)(cCr,{rateLimits:o}),s=(0,UA.jsx)(V1e,{rateLimits:o})):n.length>0&&(a=(0,UA.jsx)(oCr,{groups:n}),s=(0,UA.jsx)(ZSr,{groups:n})),(0,UA.jsx)(lr,{title:a,placement:r?"top-start":"bottom",children:(0,UA.jsx)(Xr,{component:ws,to:"/usage",underline:r?"none":"hover",color:"inherit",sx:lCr(r),children:s})})}var dCr=E(fe(),1);var E_="0.936.0";var K1e=E(fe(),1),GWe=(0,K1e.createContext)(null);function X1e(){return(0,K1e.useContext)(GWe)}var VWe=E($(),1);function uCr(){let e=X1e();return!e||e===E_?null:(0,VWe.jsx)(lr,{title:`Daemon is running v${e}, but this page was served by v${E_}. Restart the daemon to match.`,children:(0,VWe.jsx)(D1e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var qWe=e=>e.tokens.color.statusBar,Wti={height:22,py:0,borderRadius:1,fontSize:"inherit",opacity:1,"&:hover, &:focus-visible":{bgcolor:e=>qWe(e)?.hover,color:e=>qWe(e)?.hoverText},"& .ready-count":{fontWeight:500,color:e=>qWe(e)?.readyText}},fCr=(e,t=!1)=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:.25,borderRadius:999,fontSize:12,lineHeight:1.5,color:"inherit",opacity:e?1:.55,bgcolor:r=>e?w_(r).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{opacity:1,bgcolor:r=>w_(r).hover},"& .ready-dot":{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r=>w_(r).dot,boxShadow:r=>`0 0 0 ${t?3:2}px ${w_(r).dotRing}`},"& .ready-count":{fontWeight:500},...t&&Wti});var sg=E($(),1);function Z1e({onStatusBar:e=!1}){let{entries:t}=kF(),r=Oi(),n=(0,dCr.useCallback)(()=>r("/updates"),[r]),{matches:i,chords:o}=Yn("openUpdates");if(Eo(i,n),!E_)return null;let a=t.filter(MF).length;return(0,sg.jsxs)(sg.Fragment,{children:[(0,sg.jsx)(lr,{describeChild:!0,placement:e?"top-end":"bottom",title:(0,sg.jsx)(Iu,{label:"Updates",chords:o}),children:(0,sg.jsxs)(mn,{component:ws,to:"/updates","aria-label":a?`Updates: ${a} node${a>1?"s have":" has"} an update ready`:"Updates",sx:fCr(a>0,e),children:[a>0&&(0,sg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,sg.jsxs)("span",{children:["v",E_]}),a>0&&(0,sg.jsxs)("span",{className:"ready-count",children:[a," ready"]})]})}),(0,sg.jsx)(uCr,{})]})}var Q1e=E($(),1);function hCr({socket:e}){return(0,Q1e.jsx)(USr,{start:(0,Q1e.jsx)(Y1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits,onStatusBar:!0}),end:(0,Q1e.jsx)(Z1e,{onStatusBar:!0})})}var nve=E(fe(),1);var rve=E(fe(),1);function pCr(e,t,r){if(!e)return"Select a repo to search files.";if(r.error)return"Couldn't search files in this repo.";if(!(r.files.length>0||r.loading))return t?"No matching files.":"No files in this repo."}var R_=E($(),1),Gti={display:"flex",gap:1,alignItems:"center",minWidth:0},Vti={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},qti={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},jti={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Yti(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function mCr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,R_.jsx)(Hp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=Yti(i);return(0,R_.jsxs)(ln,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:Gti,children:[(0,R_.jsx)(dB,{path:i}),(0,R_.jsxs)(ne,{sx:Vti,children:[(0,R_.jsx)(Le,{component:"span",sx:qti,children:s}),(0,R_.jsx)(Le,{component:"span",color:"text.secondary",sx:jti,children:a})]})]},i)})})}var J1e=E($(),1),Kti={maxHeight:420,overflowY:"auto"},Xti={px:2,py:2,fontSize:13};function gCr({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,J1e.jsx)(ne,{sx:Kti,children:e?(0,J1e.jsx)(Le,{color:"text.secondary",sx:Xti,children:e}):(0,J1e.jsx)(mCr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var yCr=E($(),1),Zti={mt:6,alignSelf:"flex-start"};function eve({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,yCr.jsx)(Wl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Zti},transition:{onEntered:t}},children:n})}var tve=E(fe(),1);var vCr={files:[],loading:!1,error:!1};function bCr(e,t){let[r,n]=(0,tve.useState)(vCr),i=yr();return(0,tve.useEffect)(()=>{if(!e){n(vCr);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fetch(jr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,i));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(o)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch{o||n({files:[],loading:!1,error:!0})}})(),()=>{o=!0}},[e,t,i]),r}var WA=E($(),1);function Qti(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function xCr({onClose:e}){let{worktreeNode:t}=zn();return(0,WA.jsx)(mf.Provider,{value:t,children:(0,WA.jsx)(Jti,{onClose:e})})}function Jti({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=zn(),[n,i]=(0,rve.useState)(""),o=bCr(t,n),a=Oi(),s=(0,rve.useRef)(null),l=p=>a(Qti(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=g_(o.files,n,l,e),h=p=>{l(p),e()};return(0,WA.jsxs)(eve,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,WA.jsx)(gS,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,WA.jsx)(gCr,{message:pCr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function TCr(e){Eo(Yn("quickOpen").matches,e)}var CCr=E($(),1);function SCr(){let[e,t]=(0,nve.useState)(!1);return TCr((0,nve.useCallback)(()=>t(!0),[])),e?(0,CCr.jsx)(xCr,{onClose:()=>t(!1)}):null}var ive=E($(),1);function wCr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,ive.jsx)(Bh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,ive.jsx)(yi,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,ive.jsx)(Dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var wX=E(fe(),1);function kCr(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var FCr=E(fe(),1);var _Cr=E($(),1),ECr=st((0,_Cr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var eri={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function RCr(e){return e?eri[e]:"success.main"}function ACr(e){return e.split("-")[0].split(".").map(Number)}function PCr(e,t){if(!e||!t||e===t)return;let r=ACr(e),n=ACr(t);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]??0)-(n[i]??0);if(Number.isNaN(o))return;if(o!==0)return o<0?"behind":"ahead"}}var GA=E($(),1),tri={height:16,fontSize:10},rri={opacity:.6,fontSize:"0.85em"};function nri(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function SX({nodes:e,name:t,showVersion:r=!1}){let n=X1e()??E_,i=e.links.find(a=>a.name===t),o=PCr(i?.peerVersion,n);return(0,GA.jsx)(lr,{title:nri(e,t),placement:"right",children:(0,GA.jsxs)(ne,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,GA.jsx)(ECr,{sx:{fontSize:8,color:RCr(i?.state)}}),t,r&&i?.peerVersion&&(0,GA.jsxs)(ne,{component:"span",sx:rri,children:["v",i.peerVersion]}),o&&(0,GA.jsx)(dn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:tri})]})})}var VA=E($(),1),iri={opacity:.6},ori={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function LCr({nodes:e,name:t,clone:r}){let n=(0,VA.jsx)(SX,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,VA.jsx)(ne,{component:"span",sx:iri,children:n}):(0,VA.jsx)(lr,{title:VF(t,r.cloneTarget),children:(0,VA.jsxs)(ne,{component:"span",sx:ori,children:[(0,VA.jsx)(GF,{sx:{fontSize:14}}),n]})})}var ICr=E($(),1),ari={px:1.5,borderRadius:.75,fontSize:12,fontWeight:600,color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"},"&[aria-checked='true']":{color:"primary.main",bgcolor:"action.selected"},"&.Mui-focusVisible":{outline:2,outlineColor:"primary.main"}};function MCr({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,ICr.jsx)(mn,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:ari,children:t})}var DCr={ArrowRight:1,ArrowLeft:-1};function sri(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+DCr[e.key]+r)%r}function NCr(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!DCr[i.key]){A2(i);return}let o=sri(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var OCr=E(fe(),1);function a$(e){return e?.querySelector('[aria-checked="true"]')}function BCr(e,t){(0,OCr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=a$(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jWe=E($(),1),lri={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function ove({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return BCr(o,r),(0,jWe.jsx)(Rt,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:NCr(t,r,n,l),sx:lri,children:t.map(u=>(0,jWe.jsx)(MCr,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var YWe=E($(),1);function $Cr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=_c(),a=(0,FCr.useRef)(null);return!o||!n||!e?null:(0,YWe.jsx)(ove,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,YWe.jsx)(LCr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var HCr=E($(),1);function zCr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,HCr.jsx)(ei,{value:e,onChange:a=>t(a.target.value),onKeyDown:A2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"},input:{sx:{fontSize:14}}}})}var VCr=E(fe(),1);var dT={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",sessionMode:"assist-bug"},prompt:{placeholder:$ge,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},UCr=Object.keys(dT);var KWe=E($(),1);function WCr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,KWe.jsx)(Bs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,KWe.jsx)(ln,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Mu(o)},o))})}var qA=E($(),1);function GCr(e){return t=>t==="prompt"&&e?(0,qA.jsxs)(qA.Fragment,{children:["prompt",(0,qA.jsx)(ne,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Mu(e)}`}),(0,qA.jsx)(bd,{sx:{fontSize:18,mr:-.75}})]}):t}var jA=E($(),1);function qCr({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,VCr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(a$(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,jA.jsxs)(jA.Fragment,{children:[(0,jA.jsx)(ove,{label:"Mode",options:UCr,value:e.mode,onChange:l,optionLabel:GCr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,jA.jsx)(WCr,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var nwr=E(fe(),1);var XWe=E($(),1),cri={zIndex:e=>e.zIndex.modal+1};function jCr({open:e,anchor:t,children:r}){return(0,XWe.jsx)(J6,{open:e,anchorEl:t,placement:"bottom-start",sx:cri,children:(0,XWe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}function YCr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:{fontSize:13,height:40}}}}var KCr=E(F6(),1);function XCr({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}A2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,KCr.flushSync)(()=>{r(t),n()}),A2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function ZCr(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tv(n).toLowerCase().includes(r)):e}var ZWe=E(fe(),1);function QCr(){let[e,t]=(0,ZWe.useState)(!1),[r,n]=(0,ZWe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var ewr=E(fe(),1);var JCr=e=>e?Tv(e):"";function twr(e){let[t,r]=(0,ewr.useState)(()=>JCr(e));return{text:t,setText:r,showRepo:n=>r(JCr(n))}}function rwr(e,t,r){let n=QCr(),i=twr(t),o=ZCr(e,n.query),a=f=>{r(f),i.showRepo(f)},s=g_(o,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:i.text,filtered:o,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:XCr({open:n.open,highlighted:o[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{i.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),i.showRepo(t)},pick:f=>{a(f),n.close()}}}var s$=E($(),1);function iwr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=rwr(e,t,r),s=(0,nwr.useRef)(null);return(0,s$.jsxs)(ne,{ref:s,sx:{flex:1,minWidth:0},children:[(0,s$.jsx)(ei,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),o()},inputRef:n,autoFocus:i,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:YCr(a.open)}),(0,s$.jsx)(jCr,{open:a.open,anchor:s.current,children:(0,s$.jsx)(A1e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var A_=E($(),1);function owr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=zn();return(0,A_.jsxs)(Rt,{spacing:1,sx:{p:1},children:[(0,A_.jsx)(zCr,{value:r.prompt,onChange:r.setPrompt,placeholder:dT[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),(0,A_.jsxs)(Rt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,A_.jsx)(iwr,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,A_.jsx)(qCr,{...t})]}),(0,A_.jsx)($Cr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var l$=E($(),1),uri=["Enter start","Shift+Enter newline","Esc close"],fri={alignItems:"center",px:1.5,py:1,borderTop:1,borderColor:"divider",bgcolor:"action.hover"};function awr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,l$.jsxs)(Rt,{direction:"row",spacing:1.5,sx:fri,children:[(0,l$.jsx)(Rt,{direction:"row",spacing:1.5,sx:{mr:"auto"},children:uri.map(n=>(0,l$.jsx)(Le,{variant:"caption",color:"text.secondary",children:n},n))}),(0,l$.jsx)(Dt,{type:"submit",variant:"contained",size:"small",disabled:t,loading:r,children:e})]})}var YA=E(fe(),1);function swr(e,t){let r=(0,YA.useRef)(e),n=(0,YA.useRef)(null),i=(0,YA.useRef)(null),o=(0,YA.useRef)(null),a=(0,YA.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:h}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,h)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(o.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:i.current,mode:a$(o.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:i,modeRef:o,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function dri(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:L1e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function lwr(e,t){let{names:r,visible:n}=_c(),i=_1e(t,n?r:[void 0]);return{cloneState:i,target:dri(t,e,i(e))}}function cwr({mode:e,harness:t,prompt:r,cwd:n,node:i},o){let a=n||void 0,s=i?[i]:[];if(e==="prompt"){t==="claude"?o.onCreate(r,a,...s):o.onCreateHarness(t,r,a,...s);return}if(e==="design"){o.onCreateDesign(r,a,...s);return}let l=i?[{node:i}]:[];Pur(dT[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function uwr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(v1e(r.prompt,n.onCreateAssist),!0):(cwr({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var ave=E(fe(),1);function fwr(e,t){let[r,n]=(0,ave.useState)(!1);return(0,ave.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function dwr(e,t,r,n,i){let o=fwr(e,()=>{uwr(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var CX=E(fe(),1);function hwr(e,t){let r=(0,CX.useRef)(e),n=(0,CX.useRef)(null);return(0,CX.useEffect)(()=>{if(r.current&&!e){let i=n.current;i?.isConnected?i.focus():t()}r.current=e},[e,t]),i=>{n.current=i.target}}var mwr=E($(),1),hri={border:0,margin:0,padding:0,minWidth:0};function pwr({loading:e,restoreFocus:t,children:r}){let n=hwr(e,t);return(0,mwr.jsx)("fieldset",{disabled:e,style:hri,onFocus:n,children:r})}var KA=E($(),1);function gwr({draft:e,launchers:t,onClose:r}){let n=swr(e.focus,e.setFocus),i=kCr(f_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=lwr(e.node,e.cwd),l=dwr(e,o,a,t,r);return(0,KA.jsx)(eve,{onClose:r,onEntered:n.restore,centered:!0,children:(0,KA.jsx)("form",{onSubmit:l,children:(0,KA.jsxs)(pwr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,KA.jsx)(owr,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,KA.jsx)(awr,{submitLabel:a.kind==="clone"?"Clone":dT[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var sve=E(fe(),1);var pri=1e3;async function mri(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fetch(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(dT,n?.mode)?n.mode:null}catch{return null}}function ywr(e,t=0){let[r,n]=(0,sve.useState)(null);return(0,sve.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await mri(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,pri))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function vwr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var hT=E(fe(),1),bwr={field:"prompt",selectionStart:0,selectionEnd:0};function xwr(){let[e,t]=(0,hT.useState)(""),[r,n]=(0,hT.useState)(),[i,o]=(0,hT.useState)(),[a,s]=(0,hT.useState)("claude"),[l,u]=(0,hT.useState)(),[f,d]=(0,hT.useState)(bwr),h=(0,hT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(bwr)},[]);return{prompt:e,cwd:r,mode:i,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:o,setHarness:s,setFocus:d,clear:h}}function Twr(e,t=ywr){let{selectedCwd:r}=zn(),n=_c(),i=xwr(),o=i.cwd??r,a=t(o,e);return a?{...i,cwd:o,mode:i.mode??a.mode,modePending:i.mode===void 0&&a.pending,node:vwr(i.node,n)}:null}function Swr(e){Eo(Yn("newSession").matches,e)}var Cwr=E(fe(),1);function wwr(e,t){let{selectedCwd:r}=zn(),[n,i]=Uc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Cwr.useEffect)(()=>{o===null||!s||!l||!u||(o&&(s(o),l(a),u({field:"prompt",selectionStart:o.length,selectionEnd:o.length})),t(),i(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[o,a,s,l,u,t,i])}var _wr=E($(),1);function kwr({launchers:e}){let[t,r]=(0,wX.useState)(!1),[n,i]=(0,wX.useState)(0),o=Twr(n),a=(0,wX.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return Swr(a),wwr(o,a),!t||!o?null:(0,_wr.jsx)(gwr,{draft:o,launchers:e,onClose:()=>r(!1)})}var lve=E($(),1);function Ewr({reconnecting:e}){return(0,lve.jsx)(Bh,{open:e,children:(0,lve.jsx)(yi,{severity:"info",variant:"filled",icon:(0,lve.jsx)(oo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Rv=E($(),1);function Rwr({socket:e,onViewLaunchedSession:t}){return(0,Rv.jsxs)(Rv.Fragment,{children:[(0,Rv.jsx)(SCr,{}),(0,Rv.jsx)(kwr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Rv.jsx)(Ewr,{reconnecting:e.reconnecting}),(0,Rv.jsx)(Xl,{error:e.error,onClose:e.clearError}),(0,Rv.jsx)(wCr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Av=E(fe(),1);var gri=6e4;function yri(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function Awr(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4022
|
+
`,VSr={content:'""',position:"absolute",borderRadius:"inherit",background:"conic-gradient(from calc(var(--rainbow-pill-h) * 1deg) in oklch longer hue, oklch(66% 0.21 0), oklch(66% 0.21 0))",animation:`${Dti} 1.8s linear infinite`},Oti={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${Nti} 1.6s ease-in-out infinite`,"&::before":{...VSr,inset:0,zIndex:-1},"&::after":{...VSr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gs.rainbowPill.text,textShadow:Gs.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function qSr({children:e}){return(0,zA.jsxs)(zA.Fragment,{children:[(0,zA.jsx)(J_,{styles:Iti}),(0,zA.jsx)(ne,{component:"span","data-testid":"rainbow-pill",sx:Oti,children:e})]})}function jSr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function YSr(e){if(e.length!==2)return!1;let[t,r]=e;return jSr(t)===jSr(r)}var fT=E($(),1);function V1e({rateLimits:e}){let t=c_(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(o=>o.window?.used_percentage!=null),n=YSr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:W1e(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,fT.jsxs)(KSr.Fragment,{children:[a>0?(0,fT.jsx)(ne,{component:"span",sx:{color:o$,mr:.5},children:","}):null,(0,fT.jsx)(GSr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,fT.jsx)(qSr,{children:i}):(0,fT.jsx)(fT.Fragment,{children:i})}var k_=E($(),1);function ZSr({groups:e}){return(0,k_.jsx)(k_.Fragment,{children:e.map((t,r)=>(0,k_.jsxs)(XSr.Fragment,{children:[(0,k_.jsx)(ne,{component:"span",sx:{color:o$,ml:r>0?1:0,mr:.5},children:Mu(t.harness)}),(0,k_.jsx)(V1e,{rateLimits:t.rateLimits})]},t.harness))})}function Bti(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function Fti(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function $ti(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function eCr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=xWe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=l_(e,t,r,n),a=Bti(o),s=Fti(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:$ti(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function q1e(e){return t=>t.tokens.color.onAppBar.level[e]}function tCr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${i1e(e.at,t)}`}var N0=E($(),1);function UWe({direction:e,threshold:t}){let r=e==="back",n={display:"inline-flex",gap:.5,minWidth:"6ch",justifyContent:r?"flex-end":"flex-start"};if(!t)return(0,N0.jsx)(ne,{component:"span",sx:n});let i=(0,N0.jsx)(ne,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,N0.jsxs)(ne,{component:"span",sx:{color:q1e(t.level)},children:[Math.round(t.pct),"%"]});return(0,N0.jsx)(ne,{component:"span",sx:n,children:r?(0,N0.jsxs)(N0.Fragment,{children:[o,i]}):(0,N0.jsxs)(N0.Fragment,{children:[i,o]})})}var __=E($(),1);function rCr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=l_(t,r,n,i),a=eCr(t,r,n,i),s=a.kind==="projected"?a:void 0;return(0,__.jsxs)(ne,{sx:{display:"flex",alignItems:"baseline",gap:.75},children:[(0,__.jsx)(ne,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,__.jsx)(UWe,{direction:"back",threshold:s?.recovery}),(0,__.jsxs)(ne,{component:"span",sx:{minWidth:"4ch",textAlign:"right",color:q1e(o)},children:[Math.round(t),"%"]}),(0,__.jsx)(UWe,{direction:"forward",threshold:s?.worse}),(0,__.jsx)(ne,{component:"span",sx:{opacity:.6},children:s?s.recovery&&tCr(s.recovery,i):"no projection yet"})]})}function nCr(e){return[{label:"5h",window:e.five_hour,windowSeconds:18e3},{label:"7d",window:e.seven_day,windowSeconds:604800}].flatMap(t=>t.window?.used_percentage==null?[]:[{label:t.label,pct:t.window.used_percentage,resetsAt:t.window.resets_at,windowSeconds:t.windowSeconds}])}var iCr=E($(),1);function j1e({rateLimits:e,now:t}){return nCr(e).map(r=>(0,iCr.jsx)(rCr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var HA=E($(),1);function oCr({groups:e}){let t=c_(3e4);return(0,HA.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[e.map(r=>(0,HA.jsxs)(ne,{sx:{mb:.5},children:[(0,HA.jsx)(ne,{sx:{opacity:.8},children:Mu(r.harness)}),(0,HA.jsx)(j1e,{rateLimits:r.rateLimits,now:t})]},r.harness)),(0,HA.jsx)(ne,{sx:{mt:.5,opacity:.6},children:"Account usage per harness \u2014 view history"})]})}function aCr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function sCr(e,t){let r=[];aCr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,i]of Object.entries(t))aCr(i)&&r.push({harness:n,rateLimits:i});return r}var zti={display:"flex",alignItems:"center",ml:2,fontFamily:"fontFamilyMono",fontSize:13},Hti={display:"flex",alignItems:"center",height:22,px:1,borderRadius:1,fontSize:"inherit","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar?.hover,color:e=>e.tokens.color.statusBar?.hoverText}},lCr=e=>e?Hti:zti;var TX=E($(),1),WWe="Claude account usage (5h / 7d windows) \u2014 view history";function cCr({rateLimits:e}){let t=c_(3e4);return(0,TX.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[(0,TX.jsx)(j1e,{rateLimits:e,now:t}),(0,TX.jsx)(ne,{sx:{mt:.5,opacity:.6},children:WWe})]})}var UA=E($(),1),Uti={};function Y1e({rateLimits:e,harnessRateLimits:t=Uti,onStatusBar:r=!1}){let n=sCr(e,t),i=n.every(l=>l.harness==="claude"),o=e,a=WWe,s="Usage";return n.length>0&&i?(a=(0,UA.jsx)(cCr,{rateLimits:o}),s=(0,UA.jsx)(V1e,{rateLimits:o})):n.length>0&&(a=(0,UA.jsx)(oCr,{groups:n}),s=(0,UA.jsx)(ZSr,{groups:n})),(0,UA.jsx)(lr,{title:a,placement:r?"top-start":"bottom",children:(0,UA.jsx)(Xr,{component:ws,to:"/usage",underline:r?"none":"hover",color:"inherit",sx:lCr(r),children:s})})}var dCr=E(fe(),1);var E_="0.937.0";var K1e=E(fe(),1),GWe=(0,K1e.createContext)(null);function X1e(){return(0,K1e.useContext)(GWe)}var VWe=E($(),1);function uCr(){let e=X1e();return!e||e===E_?null:(0,VWe.jsx)(lr,{title:`Daemon is running v${e}, but this page was served by v${E_}. Restart the daemon to match.`,children:(0,VWe.jsx)(D1e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var qWe=e=>e.tokens.color.statusBar,Wti={height:22,py:0,borderRadius:1,fontSize:"inherit",opacity:1,"&:hover, &:focus-visible":{bgcolor:e=>qWe(e)?.hover,color:e=>qWe(e)?.hoverText},"& .ready-count":{fontWeight:500,color:e=>qWe(e)?.readyText}},fCr=(e,t=!1)=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:.25,borderRadius:999,fontSize:12,lineHeight:1.5,color:"inherit",opacity:e?1:.55,bgcolor:r=>e?w_(r).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{opacity:1,bgcolor:r=>w_(r).hover},"& .ready-dot":{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r=>w_(r).dot,boxShadow:r=>`0 0 0 ${t?3:2}px ${w_(r).dotRing}`},"& .ready-count":{fontWeight:500},...t&&Wti});var sg=E($(),1);function Z1e({onStatusBar:e=!1}){let{entries:t}=kF(),r=Oi(),n=(0,dCr.useCallback)(()=>r("/updates"),[r]),{matches:i,chords:o}=Yn("openUpdates");if(Eo(i,n),!E_)return null;let a=t.filter(MF).length;return(0,sg.jsxs)(sg.Fragment,{children:[(0,sg.jsx)(lr,{describeChild:!0,placement:e?"top-end":"bottom",title:(0,sg.jsx)(Iu,{label:"Updates",chords:o}),children:(0,sg.jsxs)(mn,{component:ws,to:"/updates","aria-label":a?`Updates: ${a} node${a>1?"s have":" has"} an update ready`:"Updates",sx:fCr(a>0,e),children:[a>0&&(0,sg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,sg.jsxs)("span",{children:["v",E_]}),a>0&&(0,sg.jsxs)("span",{className:"ready-count",children:[a," ready"]})]})}),(0,sg.jsx)(uCr,{})]})}var Q1e=E($(),1);function hCr({socket:e}){return(0,Q1e.jsx)(USr,{start:(0,Q1e.jsx)(Y1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits,onStatusBar:!0}),end:(0,Q1e.jsx)(Z1e,{onStatusBar:!0})})}var nve=E(fe(),1);var rve=E(fe(),1);function pCr(e,t,r){if(!e)return"Select a repo to search files.";if(r.error)return"Couldn't search files in this repo.";if(!(r.files.length>0||r.loading))return t?"No matching files.":"No files in this repo."}var R_=E($(),1),Gti={display:"flex",gap:1,alignItems:"center",minWidth:0},Vti={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},qti={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},jti={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Yti(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function mCr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,R_.jsx)(Hp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=Yti(i);return(0,R_.jsxs)(ln,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:Gti,children:[(0,R_.jsx)(dB,{path:i}),(0,R_.jsxs)(ne,{sx:Vti,children:[(0,R_.jsx)(Le,{component:"span",sx:qti,children:s}),(0,R_.jsx)(Le,{component:"span",color:"text.secondary",sx:jti,children:a})]})]},i)})})}var J1e=E($(),1),Kti={maxHeight:420,overflowY:"auto"},Xti={px:2,py:2,fontSize:13};function gCr({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,J1e.jsx)(ne,{sx:Kti,children:e?(0,J1e.jsx)(Le,{color:"text.secondary",sx:Xti,children:e}):(0,J1e.jsx)(mCr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var yCr=E($(),1),Zti={mt:6,alignSelf:"flex-start"};function eve({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,yCr.jsx)(Wl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Zti},transition:{onEntered:t}},children:n})}var tve=E(fe(),1);var vCr={files:[],loading:!1,error:!1};function bCr(e,t){let[r,n]=(0,tve.useState)(vCr),i=yr();return(0,tve.useEffect)(()=>{if(!e){n(vCr);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fetch(jr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,i));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(o)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch{o||n({files:[],loading:!1,error:!0})}})(),()=>{o=!0}},[e,t,i]),r}var WA=E($(),1);function Qti(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function xCr({onClose:e}){let{worktreeNode:t}=zn();return(0,WA.jsx)(mf.Provider,{value:t,children:(0,WA.jsx)(Jti,{onClose:e})})}function Jti({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=zn(),[n,i]=(0,rve.useState)(""),o=bCr(t,n),a=Oi(),s=(0,rve.useRef)(null),l=p=>a(Qti(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=g_(o.files,n,l,e),h=p=>{l(p),e()};return(0,WA.jsxs)(eve,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,WA.jsx)(gS,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,WA.jsx)(gCr,{message:pCr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function TCr(e){Eo(Yn("quickOpen").matches,e)}var CCr=E($(),1);function SCr(){let[e,t]=(0,nve.useState)(!1);return TCr((0,nve.useCallback)(()=>t(!0),[])),e?(0,CCr.jsx)(xCr,{onClose:()=>t(!1)}):null}var ive=E($(),1);function wCr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,ive.jsx)(Bh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,ive.jsx)(yi,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,ive.jsx)(Dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var wX=E(fe(),1);function kCr(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var FCr=E(fe(),1);var _Cr=E($(),1),ECr=st((0,_Cr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var eri={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function RCr(e){return e?eri[e]:"success.main"}function ACr(e){return e.split("-")[0].split(".").map(Number)}function PCr(e,t){if(!e||!t||e===t)return;let r=ACr(e),n=ACr(t);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]??0)-(n[i]??0);if(Number.isNaN(o))return;if(o!==0)return o<0?"behind":"ahead"}}var GA=E($(),1),tri={height:16,fontSize:10},rri={opacity:.6,fontSize:"0.85em"};function nri(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function SX({nodes:e,name:t,showVersion:r=!1}){let n=X1e()??E_,i=e.links.find(a=>a.name===t),o=PCr(i?.peerVersion,n);return(0,GA.jsx)(lr,{title:nri(e,t),placement:"right",children:(0,GA.jsxs)(ne,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,GA.jsx)(ECr,{sx:{fontSize:8,color:RCr(i?.state)}}),t,r&&i?.peerVersion&&(0,GA.jsxs)(ne,{component:"span",sx:rri,children:["v",i.peerVersion]}),o&&(0,GA.jsx)(dn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:tri})]})})}var VA=E($(),1),iri={opacity:.6},ori={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function LCr({nodes:e,name:t,clone:r}){let n=(0,VA.jsx)(SX,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,VA.jsx)(ne,{component:"span",sx:iri,children:n}):(0,VA.jsx)(lr,{title:VF(t,r.cloneTarget),children:(0,VA.jsxs)(ne,{component:"span",sx:ori,children:[(0,VA.jsx)(GF,{sx:{fontSize:14}}),n]})})}var ICr=E($(),1),ari={px:1.5,borderRadius:.75,fontSize:12,fontWeight:600,color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"},"&[aria-checked='true']":{color:"primary.main",bgcolor:"action.selected"},"&.Mui-focusVisible":{outline:2,outlineColor:"primary.main"}};function MCr({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,ICr.jsx)(mn,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:ari,children:t})}var DCr={ArrowRight:1,ArrowLeft:-1};function sri(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+DCr[e.key]+r)%r}function NCr(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!DCr[i.key]){A2(i);return}let o=sri(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var OCr=E(fe(),1);function a$(e){return e?.querySelector('[aria-checked="true"]')}function BCr(e,t){(0,OCr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=a$(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jWe=E($(),1),lri={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function ove({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return BCr(o,r),(0,jWe.jsx)(Rt,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:NCr(t,r,n,l),sx:lri,children:t.map(u=>(0,jWe.jsx)(MCr,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var YWe=E($(),1);function $Cr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=_c(),a=(0,FCr.useRef)(null);return!o||!n||!e?null:(0,YWe.jsx)(ove,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,YWe.jsx)(LCr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var HCr=E($(),1);function zCr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,HCr.jsx)(ei,{value:e,onChange:a=>t(a.target.value),onKeyDown:A2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"},input:{sx:{fontSize:14}}}})}var VCr=E(fe(),1);var dT={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",sessionMode:"assist-bug"},prompt:{placeholder:$ge,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},UCr=Object.keys(dT);var KWe=E($(),1);function WCr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,KWe.jsx)(Bs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,KWe.jsx)(ln,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Mu(o)},o))})}var qA=E($(),1);function GCr(e){return t=>t==="prompt"&&e?(0,qA.jsxs)(qA.Fragment,{children:["prompt",(0,qA.jsx)(ne,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Mu(e)}`}),(0,qA.jsx)(bd,{sx:{fontSize:18,mr:-.75}})]}):t}var jA=E($(),1);function qCr({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,VCr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(a$(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,jA.jsxs)(jA.Fragment,{children:[(0,jA.jsx)(ove,{label:"Mode",options:UCr,value:e.mode,onChange:l,optionLabel:GCr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,jA.jsx)(WCr,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var nwr=E(fe(),1);var XWe=E($(),1),cri={zIndex:e=>e.zIndex.modal+1};function jCr({open:e,anchor:t,children:r}){return(0,XWe.jsx)(J6,{open:e,anchorEl:t,placement:"bottom-start",sx:cri,children:(0,XWe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}function YCr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:{fontSize:13,height:40}}}}var KCr=E(F6(),1);function XCr({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}A2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,KCr.flushSync)(()=>{r(t),n()}),A2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function ZCr(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tv(n).toLowerCase().includes(r)):e}var ZWe=E(fe(),1);function QCr(){let[e,t]=(0,ZWe.useState)(!1),[r,n]=(0,ZWe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var ewr=E(fe(),1);var JCr=e=>e?Tv(e):"";function twr(e){let[t,r]=(0,ewr.useState)(()=>JCr(e));return{text:t,setText:r,showRepo:n=>r(JCr(n))}}function rwr(e,t,r){let n=QCr(),i=twr(t),o=ZCr(e,n.query),a=f=>{r(f),i.showRepo(f)},s=g_(o,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:i.text,filtered:o,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:XCr({open:n.open,highlighted:o[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{i.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),i.showRepo(t)},pick:f=>{a(f),n.close()}}}var s$=E($(),1);function iwr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=rwr(e,t,r),s=(0,nwr.useRef)(null);return(0,s$.jsxs)(ne,{ref:s,sx:{flex:1,minWidth:0},children:[(0,s$.jsx)(ei,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),o()},inputRef:n,autoFocus:i,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:YCr(a.open)}),(0,s$.jsx)(jCr,{open:a.open,anchor:s.current,children:(0,s$.jsx)(A1e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var A_=E($(),1);function owr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=zn();return(0,A_.jsxs)(Rt,{spacing:1,sx:{p:1},children:[(0,A_.jsx)(zCr,{value:r.prompt,onChange:r.setPrompt,placeholder:dT[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),(0,A_.jsxs)(Rt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,A_.jsx)(iwr,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,A_.jsx)(qCr,{...t})]}),(0,A_.jsx)($Cr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var l$=E($(),1),uri=["Enter start","Shift+Enter newline","Esc close"],fri={alignItems:"center",px:1.5,py:1,borderTop:1,borderColor:"divider",bgcolor:"action.hover"};function awr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,l$.jsxs)(Rt,{direction:"row",spacing:1.5,sx:fri,children:[(0,l$.jsx)(Rt,{direction:"row",spacing:1.5,sx:{mr:"auto"},children:uri.map(n=>(0,l$.jsx)(Le,{variant:"caption",color:"text.secondary",children:n},n))}),(0,l$.jsx)(Dt,{type:"submit",variant:"contained",size:"small",disabled:t,loading:r,children:e})]})}var YA=E(fe(),1);function swr(e,t){let r=(0,YA.useRef)(e),n=(0,YA.useRef)(null),i=(0,YA.useRef)(null),o=(0,YA.useRef)(null),a=(0,YA.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:h}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,h)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(o.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:i.current,mode:a$(o.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:i,modeRef:o,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function dri(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:L1e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function lwr(e,t){let{names:r,visible:n}=_c(),i=_1e(t,n?r:[void 0]);return{cloneState:i,target:dri(t,e,i(e))}}function cwr({mode:e,harness:t,prompt:r,cwd:n,node:i},o){let a=n||void 0,s=i?[i]:[];if(e==="prompt"){t==="claude"?o.onCreate(r,a,...s):o.onCreateHarness(t,r,a,...s);return}if(e==="design"){o.onCreateDesign(r,a,...s);return}let l=i?[{node:i}]:[];Pur(dT[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function uwr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(v1e(r.prompt,n.onCreateAssist),!0):(cwr({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var ave=E(fe(),1);function fwr(e,t){let[r,n]=(0,ave.useState)(!1);return(0,ave.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function dwr(e,t,r,n,i){let o=fwr(e,()=>{uwr(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var CX=E(fe(),1);function hwr(e,t){let r=(0,CX.useRef)(e),n=(0,CX.useRef)(null);return(0,CX.useEffect)(()=>{if(r.current&&!e){let i=n.current;i?.isConnected?i.focus():t()}r.current=e},[e,t]),i=>{n.current=i.target}}var mwr=E($(),1),hri={border:0,margin:0,padding:0,minWidth:0};function pwr({loading:e,restoreFocus:t,children:r}){let n=hwr(e,t);return(0,mwr.jsx)("fieldset",{disabled:e,style:hri,onFocus:n,children:r})}var KA=E($(),1);function gwr({draft:e,launchers:t,onClose:r}){let n=swr(e.focus,e.setFocus),i=kCr(f_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=lwr(e.node,e.cwd),l=dwr(e,o,a,t,r);return(0,KA.jsx)(eve,{onClose:r,onEntered:n.restore,centered:!0,children:(0,KA.jsx)("form",{onSubmit:l,children:(0,KA.jsxs)(pwr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,KA.jsx)(owr,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,KA.jsx)(awr,{submitLabel:a.kind==="clone"?"Clone":dT[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var sve=E(fe(),1);var pri=1e3;async function mri(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fetch(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(dT,n?.mode)?n.mode:null}catch{return null}}function ywr(e,t=0){let[r,n]=(0,sve.useState)(null);return(0,sve.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await mri(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,pri))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function vwr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var hT=E(fe(),1),bwr={field:"prompt",selectionStart:0,selectionEnd:0};function xwr(){let[e,t]=(0,hT.useState)(""),[r,n]=(0,hT.useState)(),[i,o]=(0,hT.useState)(),[a,s]=(0,hT.useState)("claude"),[l,u]=(0,hT.useState)(),[f,d]=(0,hT.useState)(bwr),h=(0,hT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(bwr)},[]);return{prompt:e,cwd:r,mode:i,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:o,setHarness:s,setFocus:d,clear:h}}function Twr(e,t=ywr){let{selectedCwd:r}=zn(),n=_c(),i=xwr(),o=i.cwd??r,a=t(o,e);return a?{...i,cwd:o,mode:i.mode??a.mode,modePending:i.mode===void 0&&a.pending,node:vwr(i.node,n)}:null}function Swr(e){Eo(Yn("newSession").matches,e)}var Cwr=E(fe(),1);function wwr(e,t){let{selectedCwd:r}=zn(),[n,i]=Uc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Cwr.useEffect)(()=>{o===null||!s||!l||!u||(o&&(s(o),l(a),u({field:"prompt",selectionStart:o.length,selectionEnd:o.length})),t(),i(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[o,a,s,l,u,t,i])}var _wr=E($(),1);function kwr({launchers:e}){let[t,r]=(0,wX.useState)(!1),[n,i]=(0,wX.useState)(0),o=Twr(n),a=(0,wX.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return Swr(a),wwr(o,a),!t||!o?null:(0,_wr.jsx)(gwr,{draft:o,launchers:e,onClose:()=>r(!1)})}var lve=E($(),1);function Ewr({reconnecting:e}){return(0,lve.jsx)(Bh,{open:e,children:(0,lve.jsx)(yi,{severity:"info",variant:"filled",icon:(0,lve.jsx)(oo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Rv=E($(),1);function Rwr({socket:e,onViewLaunchedSession:t}){return(0,Rv.jsxs)(Rv.Fragment,{children:[(0,Rv.jsx)(SCr,{}),(0,Rv.jsx)(kwr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Rv.jsx)(Ewr,{reconnecting:e.reconnecting}),(0,Rv.jsx)(Xl,{error:e.error,onClose:e.clearError}),(0,Rv.jsx)(wCr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Av=E(fe(),1);var gri=6e4;function yri(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function Awr(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4023
4023
|
`),[n,i]=(0,Av.useState)([]),o=(0,Av.useRef)(0),a=(0,Av.useCallback)(()=>{let l=r?r.split(`
|
|
4024
4024
|
`):[];if(l.length===0)return;let u=++o.current;i(f=>yri(f,l,t));for(let f of l)Xye(f,f===t).then(d=>{u===o.current&&i(h=>h.map(p=>p.name===f?d:p))})},[r,t]);(0,Av.useEffect)(()=>{a();let l=setInterval(a,gri);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Av.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var P_=E($(),1);function Pwr({shell:e,children:t}){let{socket:r,selection:n,launch:i,sidebarCollapse:o}=e,a=Awr(r.nodeSelection);return(0,P_.jsx)(fWe.Provider,{value:a,children:(0,P_.jsx)(dwe.Provider,{value:o,children:(0,P_.jsx)(sU.Provider,{value:n,children:(0,P_.jsx)(PWe.Provider,{value:r.nodeSelection,children:(0,P_.jsx)(mf.Provider,{value:n.selectedNode,children:(0,P_.jsx)(J$e.Provider,{value:i,children:(0,P_.jsx)(eit,{children:t})})})})})})})}var Lwr=E($(),1),Mwr=st((0,Lwr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var Iwr=E(fe(),1);var O0=E($(),1),vri={ml:1,textTransform:"none",fontSize:12};function Dwr(){let{nodes:e,names:t,visible:r,selected:n,select:i}=_c(),[o,a]=(0,Iwr.useState)(null);return!r||!e||!n?null:(0,O0.jsxs)(O0.Fragment,{children:[(0,O0.jsx)(Dt,{size:"small",color:"inherit",startIcon:(0,O0.jsx)(Mwr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:vri,children:(0,O0.jsx)(SX,{nodes:e,name:n})}),(0,O0.jsx)(Bs,{anchorEl:o,open:!!o,onClose:()=>a(null),children:t.map(s=>(0,O0.jsx)(ln,{selected:s===n,onClick:()=>{i(s),a(null)},sx:{fontSize:13},children:(0,O0.jsx)(SX,{nodes:e,name:s,showVersion:!0})},s))})]})}var kX=E(fe(),1);function Nwr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var cve=E($(),1);function Owr({index:e,label:t,...r}){let{chords:n}=Yn("navTab");return(0,cve.jsx)(lr,{describeChild:!0,title:(0,cve.jsx)(Iu,{label:t,chords:[Nwr(n,e)]}),children:(0,cve.jsx)(tb,{label:t,...r})})}var QWe=E(fe(),1);function Bwr(e,t){let{bound:r}=Yn("navTab"),n=e.length,i=(0,QWe.useCallback)(a=>(gU(a,r)??n)<n,[r,n]),o=(0,QWe.useCallback)(a=>{let s=e[gU(a,r)??-1];s&&t(s)},[e,t,r]);Eo(i,o)}var uve=E(fe(),1);function Fwr(){let[e,t]=(0,uve.useState)(!1);return(0,uve.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fetch("/api/news/nav")).json();r||t(i?.showInNav===!0)}catch{r||t(!1)}})(),()=>{r=!0}},[]),e}var fve=E(fe(),1);async function bri(e,t){let r=await fetch(jr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function $wr(e){let[t,r]=(0,fve.useState)(null),n=yr(),i=`${n??""}\0${e}`;return(0,fve.useEffect)(()=>{if(!e)return;let o=!1;return bri(e,n).catch(()=>{}).then(a=>{o||r({key:i,configured:a})}),()=>{o=!0}},[e,n,i]),t?.key===i?t.configured:void 0}var zwr=E(fe(),1);function Hwr(e){let{pathname:t}=Uo(),r=Oi(),n=t==="/releases"||t.startsWith("/releases/");(0,zwr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var xri={path:"/sessions",label:"Sessions"},Tri={path:"/backlog",label:"Backlog"},Sri={path:"/next",label:"Next"},Cri={path:"/releases",label:"Releases"},wri={path:"/news",label:"News"};function Uwr(e,t){return[xri,Tri,Sri,...e?[Cri]:[],...t?[wri]:[]]}var JWe=E($(),1);function Wwr({cwd:e}){let t=Uo(),r=Oi(),n=$wr(e),i=Fwr();Hwr(n);let o=n===!0,a=(0,kX.useMemo)(()=>Uwr(o,i),[o,i]),s=(0,kX.useMemo)(()=>a.map(f=>f.path),[a]),l=a.findIndex(f=>t.pathname.startsWith(f.path)),u=(0,kX.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return Bwr(s,u),(0,JWe.jsx)(A5,{value:l===-1?!1:l,textColor:"inherit",indicatorColor:"secondary",children:a.map((f,d)=>(0,JWe.jsx)(Owr,{index:d,label:f.label,onClick:()=>u(f.path)},f.path))})}var Gwr=E($(),1),Vwr=st((0,Gwr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddCircle");var _X=E($(),1),kri={color:"success.light"};function qwr(){let[,e]=Uc(),{label:t,chords:r}=Yn("newSession");return(0,_X.jsx)(lr,{title:(0,_X.jsx)(Iu,{label:t,chords:r}),children:(0,_X.jsx)(ir,{size:"small",sx:kri,"aria-label":"New session",onClick:()=>e(i=>(i.set("new",""),i),{replace:!0}),children:(0,_X.jsx)(Vwr,{})})})}var hve=E(fe(),1);var dve=E($(),1),_ri={color:"inherit"};function jwr({cwd:e}){let[t,r]=(0,hve.useState)(null),n=yr();return(0,hve.useEffect)(()=>{if(!e){r(null);return}let i=!1;return(async()=>{try{let a=await(await fetch(jr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();i||r(a?.url??null)}catch{i||r(null)}})(),()=>{i=!0}},[e,n]),t?(0,dve.jsx)(lr,{title:"Open in GitHub",children:(0,dve.jsx)(ir,{sx:_ri,onClick:()=>window.open(t,"_blank"),children:(0,dve.jsx)(SL,{})})}):null}var B0=E($(),1),Eri={color:"inherit",mr:1.5};function Ywr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:i}=s_("webserver",e);return(0,B0.jsxs)(B0.Fragment,{children:[(0,B0.jsx)(lr,{title:"Restart web server",children:(0,B0.jsx)("span",{children:(0,B0.jsx)(ir,{sx:Eri,disabled:t,onClick:i,children:t?(0,B0.jsx)(oo,{size:24}):(0,B0.jsx)(Yye,{})})})}),(0,B0.jsx)(Xl,{error:r,onClose:n})]})}var Zwr=E(fe(),1);var Kwr=E(fe(),1);function Xwr(e){let t=Nr().palette.primary.main;Eo(Yn("focusRepoPicker").matches,(0,Kwr.useCallback)(()=>jl({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var EX=E($(),1),Rri={width:240,ml:2};function Qwr({repos:e,selected:t,onSelect:r}){let n=(0,Zwr.useRef)(null);Xwr(n);let{chords:i}=Yn("focusRepoPicker");return(0,EX.jsx)(ne,{ref:n,sx:Rri,children:(0,EX.jsx)(zge,{label:t?Tv(t):"Select repo...",tooltip:(0,EX.jsx)(Iu,{label:"Repo",chords:i}),typeToOpen:!0,children:(o,a)=>(0,EX.jsx)($2r,{repos:e,selected:t,onSelect:r,close:o,initialFilter:a})})})}var lkr=E(fe(),1);var RX=E(fe(),1);function pve(e){let[t,r]=(0,RX.useState)([]),[n,i]=(0,RX.useState)(!0),o=yr();return(0,RX.useEffect)(()=>{if(!e){r([]),i(!1);return}let a=!1;return i(!0),fetch(jr(`/api/pr-list?cwd=${encodeURIComponent(e)}`,o)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),i(!1))}).catch(()=>{a||(r([]),i(!1))}),()=>{a=!0}},[e,o]),{prs:t,loading:n}}var eGe=E($(),1);function tGe({text:e}){return(0,eGe.jsx)(ne,{sx:{p:1.5},children:(0,eGe.jsx)(Le,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var XA=E($(),1);function Jwr({pr:e,highlighted:t,onHover:r,onPick:n}){let i=R1e(t);return(0,XA.jsx)(ln,{ref:i,selected:t,onMouseDown:o=>o.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,XA.jsxs)(Rt,{spacing:.25,sx:{minWidth:0},children:[(0,XA.jsxs)(Le,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,XA.jsx)(dn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,XA.jsxs)(Le,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",_o(e.createdAt)]})]})})}var rGe=E($(),1);function ekr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,rGe.jsx)(Hp,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((i,o)=>(0,rGe.jsx)(Jwr,{pr:i,highlighted:o===t,onHover:()=>r(o),onPick:n},i.number))})}var rkr=E(fe(),1);function tkr(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(i=>i.title.toLowerCase().includes(r)||i.author.toLowerCase().includes(r)||n!==""&&String(i.number).includes(n))}function nkr(e,t,r){let[n,i]=(0,rkr.useState)(""),o=tkr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=g_(o,n,t,r);return{filter:n,setFilter:i,filtered:o,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var L_=E($(),1),ikr={...OB,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function okr({cwd:e,onPick:t,close:r}){let{prs:n,loading:i}=pve(e),o=nkr(n,t,r);return i||n.length===0?(0,L_.jsx)(rn,{elevation:4,sx:ikr,children:(0,L_.jsx)(tGe,{text:i?"Loading open PRs\u2026":"No open PRs"})}):(0,L_.jsxs)(rn,{elevation:4,sx:ikr,children:[(0,L_.jsx)(gS,{autoFocus:!0,value:o.filter,onChange:o.setFilter,onKeyDown:o.onKeyDown,placeholder:"Filter PRs..."}),o.filtered.length===0?(0,L_.jsx)(tGe,{text:"No PRs match"}):(0,L_.jsx)(ekr,{prs:o.filtered,highlight:o.highlight,onHighlight:o.setHighlight,onPick:o.select})]})}var skr=E($(),1);function akr({cwd:e,onPick:t,close:r}){return(0,skr.jsx)(okr,{cwd:e,onPick:t,close:r})}var M_=E($(),1);function ckr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:i}=pve(e),[o,a]=(0,lkr.useState)(null);return i||n.length===0?null:(0,M_.jsxs)(M_.Fragment,{children:[(0,M_.jsx)(zge,{label:"prs",disabled:t,children:s=>(0,M_.jsx)(akr,{cwd:e,onPick:a,close:s})}),o&&(0,M_.jsx)(yge,{pr:o,onSelect:s=>{r(o,s),a(null)},onCancel:()=>a(null)})]})}var fkr=E($(),1);function ukr({onStartRun:e,cwd:t}){let r=Nge(t);return!t||r.length===0?null:(0,fkr.jsx)(Ige,{runs:r,onSelect:n=>e(n,t)})}var AX=E($(),1);function dkr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=zn();return(0,AX.jsxs)(Rt,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:2}},children:[(0,AX.jsx)(ckr,{cwd:r,disabled:!r,onSelect:(i,o)=>e([...o,String(i.number)],r,{...xB(i),node:n})}),(0,AX.jsx)(ukr,{onStartRun:(i,o)=>t(i,o,void 0,void 0,n),cwd:r})]})}var ch=E($(),1),Ari={minHeight:48,pl:1,pr:14};function hkr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=RS(),{design:i}=Nr();return(0,ch.jsxs)(R5,{variant:"dense",disableGutters:!0,sx:Ari,children:[r&&(0,ch.jsx)(wre,{collapsed:r,onToggleCollapsed:n}),(0,ch.jsx)(Ywr,{reconnecting:e.reconnecting}),(0,ch.jsx)(Wwr,{cwd:t.selectedCwd}),(0,ch.jsx)(Dwr,{}),(0,ch.jsx)(Qwr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,ch.jsxs)(ne,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,ch.jsx)(Uge,{cwd:t.selectedCwd}),(0,ch.jsx)(jwr,{cwd:t.selectedCwd}),(0,ch.jsx)(qwr,{})]}),(0,ch.jsx)(dkr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun}),i!=="slate"&&(0,ch.jsx)(Y1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var mve=E(fe(),1);function pkr(){let[e,t]=(0,mve.useState)(null);return(0,mve.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fetch("/api/health")).json();!r&&typeof i?.nodeName=="string"&&t(i.nodeName)}catch{}})(),()=>{r=!0}},[]),e}var gkr=E($(),1),Pri={lineHeight:"32px",bgcolor:"transparent"};function mkr(){let e=pkr();return e?(0,gkr.jsx)(_xe,{sx:Pri,children:e}):null}var ykr=E($(),1),vkr=st((0,ykr.jsx)("path",{d:"M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"}),"Keyboard");var bkr=E($(),1),xkr=st((0,bkr.jsx)("path",{d:"M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9m5.5 11c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m-3-4c-.83 0-1.5-.67-1.5-1.5S13.67 6 14.5 6s1.5.67 1.5 1.5S15.33 9 14.5 9M5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S7.33 13 6.5 13 5 12.33 5 11.5m6-4c0 .83-.67 1.5-1.5 1.5S8 8.33 8 7.5 8.67 6 9.5 6s1.5.67 1.5 1.5"}),"Palette");var Tkr=E($(),1),Skr=st((0,Tkr.jsx)("path",{d:"m12 16.5 4-4h-3v-9h-2v9H8zm9-13h-6v1.99h6v14.03H3V5.49h6V3.5H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2"}),"SystemUpdateAlt");var Ckr=E($(),1),wkr=st((0,Ckr.jsx)("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness4");var kkr=E($(),1),_kr=st((0,kkr.jsx)("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7");var nGe=E($(),1);function Ekr({mode:e}){return e==="dark"?(0,nGe.jsx)(_kr,{fontSize:"small"}):(0,nGe.jsx)(wkr,{fontSize:"small"})}var Rkr=E($(),1),Akr=st((0,Rkr.jsx)("path",{d:"m20.38 8.57-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83"}),"Speed");var c$=E($(),1);function Pkr(){let e=kge();return(0,c$.jsxs)(ln,{onClick:()=>dmt(!e),children:[(0,c$.jsx)(Xv,{children:(0,c$.jsx)(Akr,{fontSize:"small"})}),(0,c$.jsx)(Th,{children:e?"Hide render HUD":"Show render HUD"})]})}var La=E($(),1);function Lkr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onToggleDesign:i,onShowShortcuts:o,onRestart:a,onUpdate:s}){return[(0,La.jsxs)(ln,{onClick:n,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(Ekr,{mode:e})}),(0,La.jsx)(Th,{children:"Toggle dark mode"})]},"color-mode"),(0,La.jsxs)(ln,{onClick:i,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(xkr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:"Toggle Slate design"})]},"design"),(0,La.jsx)(Pkr,{},"render-hud"),(0,La.jsxs)(ln,{onClick:o,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(vkr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,La.jsx)(Ci,{},"restart-divider"),(0,La.jsxs)(ln,{onClick:a,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(WL,{fontSize:"small"})}),(0,La.jsx)(Th,{children:t})]},"restart"),(0,La.jsxs)(ln,{onClick:s,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(Skr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:r})]},"update")]}var Mkr=E(fe(),1);var Dkr=E($(),1);function Ikr({peer:e,onRestart:t,onClose:r}){let[n,i]=(0,Mkr.useState)(!1);return(0,Dkr.jsx)(bi,{title:`Restart ${e}?`,message:`Restarts the sessions daemon and web server on ${e}. Its sessions resume when the daemon is back. This page stays open.`,confirmLabel:"Restart",busy:n,autoFocusConfirm:!0,onConfirm:()=>{i(!0),t(e).finally(r)},onCancel:r})}function Nkr(e){let t=new Map;for(let r of e){let n=t.get(r.group)??[];n.push(r),t.set(r.group,n)}return[...t].map(([r,n])=>({name:r,shortcuts:n}))}var Lri=Object.keys(FL);function Okr(){let e=$L();return Nkr(Lri.map(t=>SS(t,e)))}var Rp=E($(),1),Mri={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},Iri={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function Bkr({onClose:e}){let t=Okr();return(0,Rp.jsxs)(Wl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Rp.jsxs)(ku,{id:"shortcuts-dialog-title",sx:Mri,children:["Keyboard shortcuts",(0,Rp.jsx)(ir,{size:"small","aria-label":"Close",onClick:e,children:(0,Rp.jsx)(Wo,{fontSize:"small"})})]}),(0,Rp.jsx)(wu,{dividers:!0,children:t.map(r=>(0,Rp.jsxs)(ne,{component:"section",sx:{mb:1.5},children:[(0,Rp.jsx)(Le,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Rp.jsxs)(ne,{sx:Iri,children:[(0,Rp.jsx)(Le,{variant:"body2",children:n.label}),(0,Rp.jsx)(Rt,{direction:"row",spacing:.5,children:(0,Rp.jsx)(tre,{chords:n.chords})})]},n.label))]},r.name))})]})}var ZA=E($(),1);function Fkr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:i,restart:o}=s_(NF.target,e);return(0,ZA.jsxs)(ZA.Fragment,{children:[(0,ZA.jsx)(bi,{title:NF.label,message:NF.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{o()},onCancel:t}),(0,ZA.jsx)(Xl,{error:n,onClose:i})]})}var zkr=E($(),1);function Dri(e){return e?{title:`Update assist on ${e}?`,message:`This runs 'assist update' on ${e} as a new session, then restarts its web server. This page stays open.`}:{title:"Update assist",message:"This starts a new session running 'assist update'. Its output will appear in the terminal."}}function $kr({peer:e,onConfirm:t,onClose:r}){return(0,zkr.jsx)(bi,{...Dri(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var F0=E(fe(),1);async function Nri(e){try{let t=await fetch(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch{return null}}async function Hkr(e,t){let r=await Nri(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var pT=E(fe(),1);function Ukr(e){let{nodes:t}=_c(),[r,n]=(0,pT.useState)(null),i=(0,pT.useRef)(!1),o=r?t?.links.find(l=>l.name===r.peer):void 0;(0,pT.useEffect)(()=>{if(!(!r||!o)){if(o.state!=="connected"){i.current=!0;return}i.current&&(n(null),e(r.describe(r.peer,o.peerVersion)))}},[r,o,e]);let a=(0,pT.useCallback)((l,u)=>{i.current=!1,n({peer:l,describe:u})},[]),s=(0,pT.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var Ori=9e4;function gve(){let[e,t]=(0,F0.useState)(null),[r,n]=(0,F0.useState)(null),i=(0,F0.useRef)(void 0),o=(0,F0.useCallback)(f=>{clearTimeout(i.current),t(f)},[]),{watch:a,stop:s}=Ukr(o);(0,F0.useEffect)(()=>()=>clearTimeout(i.current),[]);let l=(0,F0.useCallback)(async(f,d)=>{n(await Hkr(f,d))},[]);return{requestThenAwait:(0,F0.useCallback)(async(f,d,h,p)=>{let m;try{m=await h()}catch{}return m?.ok?(a(f,p),clearTimeout(i.current),i.current=setTimeout(()=>{s(),l(f,`${f} did not come back`)},Ori),!0):(await l(f,`${d} failed (${await DF(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var Bri=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function Wkr(){let{requestThenAwait:e,...t}=gve();return{restart:n=>e(n,`Restart ${n}`,()=>a_("both",n),Bri),...t}}var PX=E(fe(),1);var $0=E(fe(),1);function Gkr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function yve(e,t,r){let[n,i]=(0,$0.useState)(!1),[o,a]=(0,$0.useState)(!1),s=(0,$0.useRef)(!1),l=(0,$0.useRef)(e);l.current=e;let u=(0,$0.useRef)(new Set),f=(0,$0.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(Gkr).map(d=>d.id)),i(!0)},[]);return(0,$0.useEffect)(()=>{if(!n||o)return;if(t){s.current=!0;return}if(!s.current)return;e.some(h=>Gkr(h)&&h.node===r&&!u.current.has(h.id))&&a(!0)},[n,o,t,e,r]),{arm:f,completed:o}}var Vkr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function Fri(e){return fetch(`/api/self-update?node=${encodeURIComponent(e)}`,{method:"POST"})}function qkr(e){let{nodes:t}=_c(),{launchAssist:r}=al(),{requestThenAwait:n,...i}=gve(),[o,a]=(0,PX.useState)(null),[s,l]=(0,PX.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=yve(e,u(s)!=="connected",s);(0,PX.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>a_("webserver",s),Vkr))},[d,s,n]);let h=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>Fri(m),Vkr),a(null)};return{update:m=>{if(u(m)!=="connected"){h(m);return}l(m),f(),r(["update"],void 0,{node:m})},progress:o,...i}}var z0=E($(),1);function jkr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:i}){let{launchAssist:o,armUpdateReload:a}=al(),s=Wkr(),l=qkr(r);return(0,z0.jsxs)(z0.Fragment,{children:[e==="shortcuts"&&(0,z0.jsx)(Bkr,{onClose:i}),e==="restart"&&t&&(0,z0.jsx)(Ikr,{peer:t,onRestart:s.restart,onClose:i}),e==="restart"&&!t&&(0,z0.jsx)(Fkr,{reconnecting:n,onClose:i}),e==="update"&&(0,z0.jsx)($kr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),o(["update"])},onClose:i}),(0,z0.jsx)(jK,{notices:s}),(0,z0.jsx)(jK,{notices:l})]})}var Ykr=E($(),1),Kkr=st((0,Ykr.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var Xkr=E(fe(),1);var LX=E($(),1);function Zkr(){let e=Oi(),t=(0,Xkr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=Yn("openConfig");return Eo(r,t),(0,LX.jsx)(lr,{describeChild:!0,title:(0,LX.jsx)(Iu,{label:"Config",chords:n}),children:(0,LX.jsx)(ir,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,LX.jsx)(Kkr,{fontSize:"small"})})})}var Qkr=E($(),1),Jkr=st((0,Qkr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var vve=E(fe(),1);var MX=E($(),1);function e_r({open:e,onOpen:t}){let r=(0,vve.useRef)(null),{matches:n,chords:i}=Yn("openMenu");return Eo(n,(0,vve.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,MX.jsx)(lr,{describeChild:!0,title:(0,MX.jsx)(Iu,{label:"Menu",chords:i}),children:(0,MX.jsx)(ir,{ref:r,onClick:o=>t(o.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,MX.jsx)(Jkr,{fontSize:"small"})})})}var u$=E($(),1);function t_r({open:e,onOpen:t}){let{design:r}=Nr();return(0,u$.jsxs)(ne,{sx:{position:"fixed",top:8,right:16,zIndex:n=>n.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:"inherit"},children:[r!=="slate"&&(0,u$.jsx)(Z1e,{}),(0,u$.jsx)(Zkr,{}),(0,u$.jsx)(e_r,{open:e,onOpen:t})]})}var QA=E(fe(),1);var n_r=E(fe(),1);var r_r=!0,$ri=new Set(["openMenu","cycleCards"]),zri=Object.keys(FL).filter(e=>!$ri.has(e));function i_r(e,t){let r=$L();(0,n_r.useEffect)(()=>{if(!e)return;let n=i=>{zri.some(o=>SS(o,r).matches(i))&&t()};return globalThis.addEventListener("keydown",n,r_r),()=>globalThis.removeEventListener("keydown",n,r_r)},[e,t,r])}function o_r(){let[e,t]=(0,QA.useState)(null),[r,n]=(0,QA.useState)(!0),i=!!e,o=(0,QA.useCallback)(()=>t(null),[]),a=(0,QA.useCallback)(s=>{n(!0),t(s)},[]);return i_r(i,(0,QA.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:i,close:o,openAt:a,restoreFocus:r}}var IX=E(fe(),1);function a_r(e){Eo(Yn("shortcutsSheet").matches,e)}function s_r(){let[e,t]=(0,IX.useState)(null);a_r((0,IX.useCallback)(()=>t("shortcuts"),[]));let r=(0,IX.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function l_r(){let{nodes:e,selected:t}=_c();return e&&t&&t!==e.local?t:void 0}function c_r(e){return{restartLabel:e?`Restart ${e}`:NF.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}function u_r(e,t,r){let n=i=>()=>{i(),e()};return{onToggleColorMode:n(t),onToggleDesign:n(r)}}var mT=E($(),1);function f_r({mode:e,toggle:t,toggleDesign:r,sessions:n,reconnecting:i}){let{anchorEl:o,open:a,close:s,openAt:l,restoreFocus:u}=o_r(),{dialog:f,showDialog:d,closeDialog:h}=s_r(),p=l_r(),m=g=>()=>{s(),d(g)};return(0,mT.jsxs)(mT.Fragment,{children:[(0,mT.jsx)(t_r,{open:a,onOpen:l}),(0,mT.jsxs)(Bs,{anchorEl:o,open:a,onClose:s,disableRestoreFocus:!u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,mT.jsx)(mkr,{}),Lkr({mode:e,...c_r(p),...u_r(s,t,r),onShowShortcuts:m("shortcuts"),onRestart:m("restart"),onUpdate:m("update")})]}),(0,mT.jsx)(jkr,{dialog:f,peer:p,sessions:n,reconnecting:i,onClose:h})]})}var p_r=E(fe(),1);var h_r=E($(),1);function d_r({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:i,port:o,group:a}=e.existing,s=nm(i),l=o?` on port ${o}`:"",u=s?` in ${s}`:"",f=a?`, holding the ${a} server slot`:"";return(0,h_r.jsx)(bi,{title:a?`Replace the ${a} server?`:"Replace running server?",message:`"${n}" is already serving${l}${u}${f}. Replace it \u2014 stop the running server and start this one?`,confirmLabel:"Replace",confirmColor:"error",onConfirm:t,onCancel:r})}var bve=E($(),1);function m_r({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:i,stopSession:o,startRun:a,discardSession:s}=e,l=(0,p_r.useMemo)(()=>({onStop:o,onStart:a,onDiscard:s}),[o,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&i(r.sessionId,!0),n())};return(0,bve.jsxs)(iwe.Provider,{value:l,children:[t,r&&(0,bve.jsx)(d_r,{conflict:r,onConfirm:u,onCancel:n})]})}var g_r=new Map;function y_r(e,t){if(!fie())return;let r=g_r.get(e);if(g_r.set(e,t),!!r)for(let[n,i]of Object.entries(t))Object.is(i,r[n])||ky(`\u0394 ${e}.${n}`)}var Tve=E(fe(),1);function v_r(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let i=r.find(o=>o.id===n);return!i||im(i)!==t?null:n}function Pv(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function xve(){let{pathname:e}=Uo();return e.startsWith("/backlog")||e.startsWith("/usage")}function b_r({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:i,onSelect:o}){let a=Pv(t,r,n),s=a&&im(a),l=!!(s&&s===e),u=v_r(i,e,r),f=(0,Tve.useRef)(t),d=xve();(0,Tve.useEffect)(()=>{let h=f.current!==t&&!!s;f.current=t,!(d||h||l||!u)&&o(u)},[t,s,l,u,o,d])}var wve=E(fe(),1);function x_r(e,t,r,n){return Pv(e,t,r)?.cwd||n}function T_r(e,t,r,n){let i=x_r(e,t,r,n.cwd),o=Pv(e,t,r);return{cwd:i,node:o?.cwd?o.node:n.node}}var iGe=E(fe(),1);function S_r(e,t,r){let{cwd:n,node:i,origin:o}=r,a=(0,iGe.useCallback)((l,u)=>{let f=lT(u,t),d=pX(e,l);return d?d.clones[f]:f===(l===n?i:Ep)?l:void 0},[e,t,n,i]),s=(0,iGe.useCallback)(l=>pX(e,l)?.origin??(l===n?o:void 0),[e,n,o]);return{cloneOn:a,originOf:s}}var Sve=E(fe(),1);function C_r(e,t,r,n){let i=(0,Sve.useRef)(e);(0,Sve.useEffect)(()=>{if(i.current===e)return;i.current=e;let o=pX(t,r)?.clones[e];o&&n(o,e)},[e,t,r,n])}var f$=E(fe(),1);function w_r(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(i=>Object.entries(i.clones).filter(([,o])=>o===t.cwd).map(([o])=>o)));return n.has(r)?r:n.size===0||n.has(Ep)?Ep:[...n][0]}function k_r(e,t,r,n){let[i,o]=(0,f$.useState)({cwd:e}),a=(0,f$.useCallback)((l,u,f)=>o({cwd:l,node:u,origin:f}),[]);(0,f$.useEffect)(()=>{e&&!i.cwd&&o({cwd:e})},[e,i.cwd]);let s=w_r(t,{cwd:i.cwd,node:i.node===void 0?void 0:lT(i.node,n)},r);return{selectedCwd:i.cwd,selectedNode:s||void 0,selectedPick:{cwd:i.cwd,node:s,origin:i.origin},setSelectedCwd:a}}var __r=E(fe(),1);function Cve(e,t,r){let n=Pv(e,t,r);return n&&im(n)}function E_r(e,t,r,n){let i=Cve(e,t,r),o=Pv(e,t,r),a=o?.node??Ep,s=o?.repoGroup?.origin;(0,__r.useEffect)(()=>{i&&n(i,a,s)},[i,a,s,n])}function R_r(e,t,r,n,i){let o=i.nodes?.local,a=lT(i.selected,o),s=(0,wve.useMemo)(()=>fTr(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=k_r(e,s,a,o);E_r(r,n,t,d),C_r(a,s,l,d);let{cloneOn:h,originOf:p}=S_r(s,o,f),m=(0,wve.useMemo)(()=>s.map(v=>dTr(v,a)),[s,a]),{cwd:g,node:y}=T_r(r,n,t,{cwd:l,node:u});return(0,wve.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:d,cloneOn:h,originOf:p}),[m,l,u,g,y,d,h,p])}var _ve=E(fe(),1);var I_=E(fe(),1);var A_r=E(fe(),1),kve="assist:reloaded-after-update";function P_r(e){(0,A_r.useEffect)(()=>{globalThis.sessionStorage?.getItem(kve)&&(globalThis.sessionStorage.removeItem(kve),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function L_r(e,t,r,n){let{arm:i,completed:o}=yve(e,t),a=(0,I_.useRef)(!1),s=(0,I_.useCallback)(()=>{globalThis.sessionStorage?.setItem(kve,"1")},[]),{error:l,restart:u}=s_("webserver",t,s);return P_r(r),(0,I_.useEffect)(()=>{l&&n(l)},[l,n]),(0,I_.useEffect)(()=>{!o||a.current||(a.current=!0,u())},[o,u]),{armUpdateReload:(0,I_.useCallback)(()=>{a.current=!1,i()},[i])}}function M_r(e){let{armUpdateReload:t}=L_r(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=yy(e.selectSession),n=(0,_ve.useMemo)(()=>({launchAssist:e.createAssistSession,launchAgentInStream:e.createSessionInStream,resumeSession:e.resumeSession,armUpdateReload:t,activateSession:r,sendInput:e.sendInput}),[e.createAssistSession,e.createSessionInStream,e.resumeSession,t,r,e.sendInput]),i=Oi(),o=(0,_ve.useCallback)(a=>{e.selectSession(a),i("/sessions"),e.clearSuccess()},[i,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:o}}var I_r=E(fe(),1);function D_r(e,t,r,n){let i=Cve(e,t,r);(0,I_r.useEffect)(()=>{e&&i&&n({type:"set-active",cwd:i,sessionId:e})},[e,i,n])}var Eve=E(fe(),1);function N_r(e,t){let r=(0,Eve.useRef)(new Map);(0,Eve.useEffect)(()=>{let n=new Set;for(let{id:i,status:o}of e)n.add(i),r.current.get(i)!==o&&(r.current.set(i,o),console.debug(`[sessions] render session ${i} status=${o}`),t({type:"ui-status",sessionId:i,status:o}));for(let i of r.current.keys())n.has(i)||r.current.delete(i)},[e,t])}var d$=E(fe(),1),O_r="assist.sessions.node";function Hri(){try{return localStorage.getItem(O_r)}catch{return null}}function Uri(e){try{localStorage.setItem(O_r,e)}catch{}}function B_r(e){let[t,r]=(0,d$.useState)(Hri),n=(0,d$.useCallback)(i=>{r(i),Uri(i)},[]);return(0,d$.useMemo)(()=>{let i=e?[e.local,...e.links.map(o=>o.name)]:[];return{nodes:e,names:i,visible:i.length>1,selected:t&&i.includes(t)?t:e?.local,select:n}},[e,t,n])}var $_r=E(fe(),1);function F_r(e){let t=e;if(t.type==="create")return{cwd:t.cwd,title:t.prompt?.trim()||(t.design?"New design session":"New session"),node:t.node};if(t.type==="create-assist"){let r=t.title?.trim();return{cwd:t.cwd,title:r||"New session",named:!!r,node:t.node}}return null}function z_r(e,t){return(0,$_r.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let i=F_r(r);i&&t(i)},[e,t])}var Lv=E(fe(),1);function Rve(e,t,r,n,i){e({type:"create",prompt:r||void 0,cwd:n,...t,...i?{node:i}:{}})}function H_r(e){return(t,r,n)=>Rve(e,{design:!0},t,r,n)}function U_r(e){return(t,r,n,i)=>Rve(e,{harness:t},r,n,i)}function W_r(e){return(t,r,n)=>Rve(e,{auto:!0},t,r,n)}function G_r(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function V_r(e){return(t,r,n,i,o)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:i,node:o})}function q_r(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function j_r(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function Y_r(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function K_r(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function X_r(e){return t=>e({type:"stop",sessionId:t})}function Z_r(e){return(t,r,n,i,o)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:i,node:o})}function Q_r(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function J_r(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function e5r(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function t5r(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:qK})}function r5r(e){return(t,r,n,i)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:qK,claim:i==="claim",refresh:i==="refresh"})}function n5r(e){return(t,r,n,i)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...i})}var JA=E(fe(),1);function i5r(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function o5r(e){return{createSession:(0,JA.useMemo)(()=>W_r(e),[e]),createSessionInStream:(0,JA.useMemo)(()=>i5r(e),[e]),createDesignSession:(0,JA.useMemo)(()=>H_r(e),[e]),createHarnessSession:(0,JA.useMemo)(()=>U_r(e),[e]),createAssistSession:(0,JA.useMemo)(()=>G_r(e),[e]),resumeSession:(0,JA.useMemo)(()=>V_r(e),[e])}}var DX=E(fe(),1);function a5r(e,t){let r=(0,DX.useCallback)((a,s)=>{q_r(e,t.current)(a,s)},[e,t]),n=(0,DX.useCallback)(a=>{j_r(e,t.current)(a)},[e,t]),i=(0,DX.useCallback)(a=>{Y_r(e,t.current)(a)},[e,t]),o=(0,DX.useCallback)(a=>{K_r(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:i,discardSession:o}}function s5r(e,t,r){return(n,i)=>{let o=t.get(n);return o&&(i(o),e({type:"snapshot",sessionId:n})),r.set(n,i),()=>r.delete(n)}}function l5r(e,t,r){let n={...o5r(e),sendInput:(0,Lv.useMemo)(()=>t5r(e),[e]),sendResize:(0,Lv.useMemo)(()=>r5r(e),[e]),sendPrDecision:(0,Lv.useMemo)(()=>n5r(e),[e]),setAutoApprove:(0,Lv.useMemo)(()=>Q_r(e),[e]),setAutoAdvance:(0,Lv.useMemo)(()=>J_r(e),[e]),setStarred:(0,Lv.useMemo)(()=>e5r(e),[e]),stopSession:(0,Lv.useMemo)(()=>X_r(e),[e]),startRun:(0,Lv.useMemo)(()=>Z_r(e),[e])},i=(0,Lv.useMemo)(()=>s5r(e,t.current,r.current),[e,t,r]);return{...n,...a5r(e,t),onOutput:i}}var NX=E(fe(),1);function c5r(e,t,r){let n=(0,NX.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),i=(0,NX.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),o=(0,NX.useCallback)(()=>{r(null)},[r]),a=(0,NX.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:i,clearTranscript:o,selectSession:a}}var Mve=E(fe(),1);function u5r(e,t){let r=new Set(t.map(i=>i.id)),n=null;for(let i of Object.values(e))r.has(i)&&(n=i);return n}var h$=E(fe(),1);function f5r(){let[e,t]=(0,h$.useState)(null),r=(0,h$.useRef)(e);r.current=e;let n=(0,h$.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var h5r=E(fe(),1);function d5r(e,t,r=null){return t!==null?e.some(n=>n.id===t)?t:e[0]?.id??null:r&&e.some(n=>n.id===r)?r:e[0]?.id??null}function p5r(e,t,r){let n=xve();(0,h5r.useEffect)(()=>{if(n){t(null);return}t(i=>d5r(e,i,r))},[e,t,r,n])}var Ave=E(fe(),1);function m5r(){let[e,t]=(0,Ave.useState)({}),[r,n]=(0,Ave.useState)(null),[i,o]=(0,Ave.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:i,setNodes:o}}var H0=E(fe(),1);function g5r(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function y5r(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function v5r(e,t){if(!t.some(n=>e.has(n)))return e;let r=new Set(e);for(let n of t)r.delete(n);return r}function b5r(e,t){let r=[];for(let n of t){let i=e.get(n.id);i!==void 0&&i!==n.startedAt&&r.push(n.id)}return r}function x5r(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var Wri=1500;function T5r(){let[e,t]=(0,H0.useState)(new Set),r=(0,H0.useRef)(new Map),n=(0,H0.useRef)(new Map),i=(0,H0.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),o=(0,H0.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),i(u)},Wri))},[i]);(0,H0.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,H0.useCallback)(s=>{let l=y5r(r.current,s),u=[...b5r(r.current,s),...l],f=x5r(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),g5r(n.current,l),u.length&&t(d=>v5r(d,u)),o(f)},[o]);return{initialized:e,markInitialized:i,syncSessions:a}}var D_=E(fe(),1);function S5r(){let[e,t]=(0,D_.useState)(null),[r,n]=(0,D_.useState)(null),[i,o]=(0,D_.useState)(null),a=(0,D_.useCallback)(()=>t(null),[]),s=(0,D_.useCallback)(()=>n(null),[]),l=(0,D_.useCallback)(()=>o(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:i,setServerConflict:o,clearServerConflict:l}}var Mv=E(fe(),1);function C5r(e,t){return[...e,{...t,status:"launching"}]}function Pve(e){return e.find(t=>t.status==="launching")}function w5r(e){let t=Pve(e);return t?e.filter(r=>r.id!==t.id):e}function k5r(e,t){let r=Pve(e);return r?oGe(e,r.id,t):e}function oGe(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function _5r(e,t){return e.filter(r=>r.id!==t)}var E5r=E(fe(),1);var Gri=6e4,Vri="Launch timed out \u2014 the session did not start.";function R5r(e,t){(0,E5r.useEffect)(()=>{let r=e.filter(i=>i.status==="launching");if(r.length===0)return;let n=r.map(i=>setTimeout(()=>t(o=>oGe(o,i.id,Vri)),Math.max(0,Gri-(Date.now()-i.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function A5r(){let[e,t]=(0,Mv.useState)([]),r=(0,Mv.useRef)([]),n=(0,Mv.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),i=(0,Mv.useCallback)(l=>{n(u=>C5r(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),o=(0,Mv.useCallback)(()=>{let l=Pve(r.current);return n(w5r),l?.named?l.title:void 0},[n]),a=(0,Mv.useCallback)(l=>n(u=>k5r(u,l)),[n]),s=(0,Mv.useCallback)(l=>n(u=>_5r(u,l)),[n]);return R5r(e,n),{pendingLaunches:e,addPendingLaunch:i,resolvePendingLaunch:o,failPendingLaunch:a,dismissPendingLaunch:s}}var OX=E(fe(),1);function P5r(){let[e,t]=(0,OX.useState)(null),[r,n]=(0,OX.useState)({}),i=(0,OX.useCallback)((o,a)=>{o!=="claude"&&n(s=>({...s,[o]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:i}}var L5r=E(fe(),1);function M5r(e,t){return(0,L5r.useCallback)(r=>{e(r),t(r)},[e,t])}var aGe=E(fe(),1);function I5r(){let e=(0,aGe.useRef)(new Map),t=(0,aGe.useRef)(new Map);return{buffers:e,handlers:t}}var Lve=E(fe(),1);function D5r(){let[e,t]=(0,Lve.useState)(null),[r,n]=(0,Lve.useState)(null),[i,o]=(0,Lve.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:i,setUserMessages:o}}var N_=E(fe(),1);function N5r(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function O5r(e,t){let r=e.sessionId,n=t.resolvePendingLaunch();e.isNew&&t.getActiveId()!==null||(t.setViewingTranscriptSessionId(null),t.setActiveId(r)),e.isNew&&t.setSuccess({message:n?`Started ${n}`:"New session started",sessionId:r})}function B5r(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function F5r(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function $5r(e,t){t.setNodes({local:e.local,links:e.links??[]})}function z5r(e,t){t.setSuccess({message:e.message,sessionId:null})}function H5r(e,t){let r=e.sessionId,n=t.buffers.current?.get(r)??"";t.buffers.current?.set(r,n+e.data),t.handlers.current?.get(r)?.(e.data),t.markInitialized(r)}function U5r(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function W5r(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function G5r(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var qri={sessions:W5r,created:O5r,history:(e,t)=>t.setHistory(e.sessions),transcript:(e,t)=>t.setTranscript({sessionId:e.sessionId,messages:e.messages}),"user-messages":(e,t)=>t.setUserMessages({sessionId:e.sessionId,messages:e.messages}),hello:(e,t)=>t.setDaemonVersion(e.version),nodes:$5r,error:B5r,notice:z5r,"run-conflict":U5r,limits:F5r,clear:N5r,output:H5r,snapshot:G5r};function V5r(e,t){qri[e.type]?.(e,t)}function q5r(e,t={}){let r=location.protocol==="https:"?"wss:":"ws:",n=new WebSocket(`${r}//${location.host}/ws`);return n.onopen=()=>{t.onOpen?.(),n.send(JSON.stringify({type:"hello"})),n.send(JSON.stringify({type:"history"}))},n.onmessage=i=>{V5r(JSON.parse(i.data),e)},n.onclose=()=>t.onClose?.(),n}function j5r(e,t,r,n){let i=!1,o,a=0,s=!1,l=()=>{i||t(q5r(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(i)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,o=setTimeout(l,u)}}))};return l(),()=>{i=!0,o&&clearTimeout(o)}}function Y5r(e){let t=(0,N_.useRef)(null),[r,n]=(0,N_.useState)(!1),{handleSessions:i,markInitialized:o,buffers:a,handlers:s}=e;(0,N_.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let h of d.values())h("\x1Bc")},f=j5r({...e,setSessions:i},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[i,o,a,s]);let l=(0,N_.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function K5r(){let[e,t]=(0,Mve.useState)([]),[r,n]=(0,Mve.useState)([]),{activeId:i,setActiveId:o,getActiveId:a}=f5r(),s=m5r(),l=D5r(),[u,f]=(0,Mve.useState)(""),d=S5r(),h=A5r(),p=P5r(),{initialized:m,markInitialized:g,syncSessions:y}=T5r(),v=I5r(),b=M5r(y,t),{wsRef:x,requestHistory:C,reconnecting:S}=Y5r({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:o,...s,...l,setCurrentCwd:f,...d,...h,...p,markInitialized:g,...v});return p5r(e,o,u5r(s.activeByRepo,e)),{sessions:e,history:r,activeId:i,setActiveId:o,...s,...l,currentCwd:u,...d,...h,...p,initialized:m,wsRef:x,...v,requestHistory:C,reconnecting:S}}function X5r(){let e=K5r(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:i,activeId:o,sessions:a}=e,s=B_r(e.nodes),l=z_r(t,i),u=l5r(l,r,n);D_r(o,a,e.history,l),N_r(a,l);let f=c5r(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var p$=E(fe(),1);var Z5r="assist:sidebar-collapsed";function Q5r(){let[e,t]=(0,p$.useState)(()=>Xu(Z5r).length>0),r=(0,p$.useCallback)(()=>{t(n=>{let i=!n;return Zu(Z5r,i?[!0]:[]),i})},[]);return(0,p$.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var J5r=E(fe(),1);function eEr(){(0,J5r.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||sE.set(r)}catch{}})(),()=>{e=!0}},[])}function tEr(){let e=X5r(),t=qme(e),r=R_r(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);b_r({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:i}=M_r(e);eEr();let o=Q5r();return y_r("shell",{...e,selection:r,launch:n,sidebarCollapse:o}),{socket:e,selection:r,launch:n,viewLaunchedSession:i,sidebarCollapse:o}}var lg=E($(),1),jri={zIndex:e=>e.zIndex.drawer+1},Yri={minHeight:48};function rEr({mode:e,toggle:t,toggleDesign:r}){let n=tEr(),{socket:i,selection:o,viewLaunchedSession:a}=n,{design:s}=Nr();return(0,lg.jsx)(Pwr,{shell:n,children:(0,lg.jsxs)(GWe.Provider,{value:i.daemonVersion,children:[(0,lg.jsx)(f_r,{mode:e,toggle:t,toggleDesign:r,sessions:i.sessions,reconnecting:i.reconnecting}),(0,lg.jsx)(uxe,{position:"fixed",sx:jri,"data-testid":"toolbar",children:(0,lg.jsx)(hkr,{socket:i,selection:o})}),(0,lg.jsx)(R5,{variant:"dense",sx:Yri}),(0,lg.jsx)(m_r,{socket:i,children:(0,lg.jsx)($Sr,{socket:i})}),s==="slate"&&(0,lg.jsx)(hCr,{socket:i}),(0,lg.jsx)(Rwr,{socket:i,onViewLaunchedSession:a})]})})}var nEr=E(fe(),1);function iEr(){let[e,t]=(0,nEr.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let i=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",i)}catch{}return i})}}var Kri={black:"#2e3436",red:"#cc0000",green:"#4e9a06",yellow:"#c4a000",blue:"#3465a4",magenta:"#75507b",cyan:"#06989a",white:"#d3d7cf",brightBlack:"#555753",brightRed:"#ef2929",brightGreen:"#8ae234",brightYellow:"#fce94f",brightBlue:"#729fcf",brightMagenta:"#ad7fa8",brightCyan:"#34e2e2",brightWhite:"#eeeeec"},BX="rgba(0, 0, 0, 0.87)",oEr={background:"rgba(97, 97, 97, 0.92)",text:"#fff"},aEr={warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)"},sEr={secondary:"rgba(255, 255, 255, 0.7)",hover:"rgba(255, 255, 255, 0.12)",active:"rgba(255, 255, 255, 0.16)",dot:"#ffb74d",dotRing:"rgba(0, 0, 0, 0.15)"},m$={name:"classic",dark:{color:{background:"#1e1e1e",surface:"#252526",raised:"rgba(255, 255, 255, 0.08)",line:"rgba(255, 255, 255, 0.12)",lineSoft:"rgba(255, 255, 255, 0.12)",text:{primary:"#fff",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},selected:"rgba(255, 255, 255, 0.16)",wash:aEr,well:"#1b1b1c",stripe:"rgba(255, 255, 255, 0.1)",overlay:oEr,onAppBar:{...sEr,level:{ok:"#66bb6a",warn:"#ffa726",over:"#f44336"}},primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5",contrastText:BX},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc",contrastText:BX},success:{main:"#66bb6a",light:"#81c784",dark:"#388e3c",contrastText:BX},warning:{main:"#ffa726",light:"#ffb74d",dark:"#f57c00",contrastText:BX},error:{main:"#f44336",light:"#e57373",dark:"#d32f2f",contrastText:"#fff"},info:{main:"#29b6f6",light:"#4fc3f7",dark:"#0288d1",contrastText:BX}},terminal:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selectionBackground:"rgba(255, 255, 255, 0.3)",...Kri},elevation:{appBar:1}},light:{color:{background:"#fff",surface:"#fff",raised:"rgba(0, 0, 0, 0.04)",line:"rgba(0, 0, 0, 0.12)",lineSoft:"rgba(0, 0, 0, 0.12)",text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},selected:"rgba(0, 0, 0, 0.08)",wash:aEr,well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",overlay:oEr,onAppBar:{...sEr,level:{ok:"#b9f6ca",warn:"#ffe57f",over:"#ffcdd2"}},primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0",contrastText:"#fff"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"}},terminal:{background:"#ffffff",foreground:"#333333",cursor:"#333333",cursorAccent:"#ffffff",selectionBackground:"#add6ff",black:"#000000",red:"#cd3131",green:"#107c10",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},elevation:{appBar:1}},font:{ui:'"Roboto", "Helvetica", "Arial", sans-serif',mono:"monospace",terminal:"'Cascadia Code', 'Fira Code', Consolas, monospace"},type:{fontSize:14,terminalFontSize:14,scale:{caption:12,body2:14,body1:16,subtitle2:14,subtitle1:16,h6:20,h5:24,h4:34,button:14},button:{textTransform:"uppercase",fontWeight:500}},radius:{sm:4,md:4},spacing:8};function lEr({color:e,radius:t,elevation:r,type:n}){let i={border:`1px solid ${e.line}`};return{MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:e.overlay.background,color:e.overlay.text,borderRadius:t.md,boxShadow:r.overlay,fontSize:`${n.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:e.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:r.overlay}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:e.surface,borderRadius:t.md+4,boxShadow:r.dialog}}}}}var Ive=["primary","secondary","success","warning","error","info"];function FX(e,t){return{backgroundColor:Mn(e,t),borderColor:Mn(e,.35),color:e}}function cEr({color:e}){return[{props:{variant:"tonal"},style:{backgroundColor:e.raised,border:`1px solid ${e.line}`,color:e.text.primary,"&:hover":{backgroundColor:e.raised,borderColor:e.text.disabled}}},...Ive.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...FX(e[t].main,.16),"&:hover":FX(e[t].main,.24)}}))]}function uEr({color:e}){return[{props:{variant:"tonal"},style:{backgroundColor:"transparent",border:`1px solid ${e.line}`,color:e.text.secondary}},...Ive.map(t=>({props:{variant:"tonal",color:t},style:{...FX(e[t].main,.14),borderColor:"transparent"}}))]}function fEr(e){let{color:t,radius:r}=e;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{borderRadius:r.sm}},variants:[...cEr(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Mn(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Mn(t.error.main,.1)}}}]},MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},MuiChip:{styleOverrides:{root:{fontWeight:600,borderRadius:999},sizeSmall:{height:22},outlined:{borderColor:t.line}},variants:uEr(e)}}}var sGe=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`;function dEr({radius:e}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:e.sm,textTransform:"none",fontWeight:500,"&:hover":{backgroundColor:sGe(8)},"&.Mui-selected":{backgroundColor:sGe(12),boxShadow:`inset 0 0 0 1px ${sGe(18)}`}}}}}}function hEr(e){let{appBar:t}=e.color;return{...lEr(e),...fEr(e),...dEr(e),MuiPaper:{styleOverrides:{root:{backgroundImage:"none"},outlined:{borderColor:e.color.line}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar},styleOverrides:{root:t&&{backgroundColor:t.background,color:t.text,borderBottom:`1px solid ${e.color.line}`}}}}}var Iv="#0e1116",lGe="#141820",Dve="#1b202a",Nve="#e3e7ee",cGe="#8a93a3",$X="#8b9cff",Ove="#5fd0a0",Bve="#f2b45a",Fve="#f27a7a",$ve={name:"slate",dark:{color:{background:Iv,surface:lGe,raised:Dve,line:"#262c37",lineSoft:"#1d222b",text:{primary:Nve,secondary:cGe,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)"},well:Iv,stripe:Dve,overlay:{background:Dve,text:Nve},appBar:{background:lGe,text:Nve},onAppBar:{...m$.dark.color.onAppBar,secondary:cGe,level:{ok:Ove,warn:Bve,over:Fve}},statusBar:{background:lGe,text:cGe,hoverText:Nve,secondary:"#5c6473",hover:Dve,active:"transparent",dot:$X,dotRing:"rgba(139, 156, 255, 0.14)",readyText:$X,level:{ok:Ove,warn:Bve,over:Fve}},primary:{main:$X,contrastText:Iv},secondary:{main:"#c99bff",contrastText:Iv},success:{main:Ove,contrastText:Iv},warning:{main:Bve,contrastText:Iv},error:{main:Fve,contrastText:Iv},info:{main:"#6cb6ff",contrastText:Iv}},terminal:{background:Iv,foreground:"#d6dbe4",cursor:$X,cursorAccent:Iv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:Fve,green:Ove,yellow:Bve,blue:$X,magenta:"#c99bff",cyan:"#6cc8d8",white:"#c3c9d4",brightBlack:"#5c6473",brightRed:"#ff9a9a",brightGreen:"#82e0b6",brightYellow:"#ffc97a",brightBlue:"#a9b6ff",brightMagenta:"#dcb8ff",brightCyan:"#8fdbe8",brightWhite:"#eef1f6"},elevation:{appBar:0,overlay:"0 14px 34px rgba(0, 0, 0, 0.45)",dialog:"0 30px 60px rgba(0, 0, 0, 0.5)"}},light:{...m$.light,color:{...m$.light.color,statusBar:{background:"#f3f4f6",text:"rgba(0, 0, 0, 0.6)",hoverText:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.38)",hover:"rgba(0, 0, 0, 0.06)",active:"transparent",dot:"#1976d2",dotRing:"rgba(25, 118, 210, 0.16)",readyText:"#1976d2",level:{ok:"#2e7d32",warn:"#ed6c02",over:"#d32f2f"}}},elevation:{appBar:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)"}},font:{ui:'"Geist Variable", "Segoe UI", system-ui, sans-serif',mono:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace',terminal:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace'},type:{fontSize:14,terminalFontSize:13,scale:{caption:12,body2:14,body1:15,subtitle2:14,subtitle1:15,h6:16,h5:18,h4:24,button:14},button:{textTransform:"none",fontWeight:600}},radius:{sm:6,md:8},spacing:8};var gT=e=>`${e/16}rem`;function pEr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:gT(r.button)},caption:{fontSize:gT(r.caption)},body2:{fontSize:gT(r.body2)},body1:{fontSize:gT(r.body1)},subtitle2:{fontSize:gT(r.subtitle2)},subtitle1:{fontSize:gT(r.subtitle1)},h6:{fontSize:gT(r.h6)},h5:{fontSize:gT(r.h5)},h4:{fontSize:gT(r.h4)}}}function mEr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}var Xri={classic:m$,slate:$ve};function Zri(e,t){let{dark:r,light:n,...i}=Xri[e];return{...i,...t==="dark"?r:n,mode:t}}function gEr(e,t){let r=Zri(e,t),{color:n}=r;return Y0({design:e,tokens:r,palette:{mode:t,background:{default:n.background,paper:n.surface},primary:n.primary,secondary:n.secondary,success:n.success,warning:n.warning,error:n.error,info:n.info,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:pEr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...mEr(r),...e==="slate"&&hEr(r)}})}function yEr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=$ve;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var vEr=E(fe(),1),bEr="design";function Qri(){try{return localStorage.getItem(bEr)==="slate"?"slate":"classic"}catch{return"classic"}}function xEr(){let[e,t]=(0,vEr.useState)(Qri);return{design:e,toggleDesign:()=>t(n=>{let i=n==="slate"?"classic":"slate";try{localStorage.setItem(bEr,i)}catch{}return i})}}var TEr=E(fe(),1);var zve=E($(),1),Jri=5;function SEr({children:e}){let[t,r]=(0,TEr.useState)(null);return(0,zve.jsxs)(Pwe.Provider,{value:t,children:[e,(0,zve.jsx)(ne,{ref:r,"data-testid":"toast-stack",sx:{position:"fixed",zIndex:"snackbar",bottom:{xs:1,sm:3},left:{xs:1,sm:"50%"},right:{xs:1,sm:"auto"},transform:{sm:"translateX(-50%)"},display:"flex",flexDirection:"column",alignItems:{xs:"stretch",sm:"center"},gap:1,pointerEvents:"none","& > *":{pointerEvents:"auto"},[`& > :nth-last-of-type(n+${Jri+1})`]:{display:"none"}}})]})}var yT=E($(),1);function eni(){let{mode:e,toggle:t}=iEr(),{design:r,toggleDesign:n}=xEr(),i=(0,wEr.useMemo)(()=>gEr(r,e),[r,e]);return(0,yT.jsxs)(jZ,{theme:i,children:[(0,yT.jsx)(DQ,{}),(0,yT.jsx)(SEr,{children:(0,yT.jsx)(rEr,{mode:e,toggle:t,toggleDesign:n})})]})}var tni=DCe([{path:"*",element:(0,yT.jsx)(eni,{})}]);function rni(){return(0,yT.jsx)(_Ce,{router:tni})}var CEr=document.getElementById("app");CEr&&yEr().then(()=>{(0,kEr.createRoot)(CEr).render((0,yT.jsx)(rni,{}))});})();
|
|
4025
4025
|
/*! Bundled license information:
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.937.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -539,6 +539,18 @@ function deepMergeRawConfig(base, override) {
|
|
|
539
539
|
return merged;
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
+
// src/shared/mergeAdviceRules.ts
|
|
543
|
+
function adviceRules(raw) {
|
|
544
|
+
const advice = raw.advice;
|
|
545
|
+
return Array.isArray(advice?.rules) ? advice.rules : void 0;
|
|
546
|
+
}
|
|
547
|
+
function mergeAdviceRules(globalRaw, projectRaw) {
|
|
548
|
+
const globalRules = adviceRules(globalRaw);
|
|
549
|
+
const projectRules = adviceRules(projectRaw);
|
|
550
|
+
if (!globalRules || !projectRules) return void 0;
|
|
551
|
+
return [...globalRules, ...projectRules];
|
|
552
|
+
}
|
|
553
|
+
|
|
542
554
|
// src/shared/mergeDenyRules.ts
|
|
543
555
|
function mergeDenyRules(globalDeny, projectDeny) {
|
|
544
556
|
if (!globalDeny && !projectDeny) return void 0;
|
|
@@ -573,7 +585,11 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
573
585
|
globalRaw.run,
|
|
574
586
|
projectRaw.run
|
|
575
587
|
);
|
|
588
|
+
const adviceRules2 = mergeAdviceRules(globalRaw, projectRaw);
|
|
576
589
|
const merged = deepMergeRawConfig(globalRaw, projectRaw);
|
|
590
|
+
if (adviceRules2 !== void 0) {
|
|
591
|
+
merged.advice = { ...merged.advice, rules: adviceRules2 };
|
|
592
|
+
}
|
|
577
593
|
if (deny !== void 0) {
|
|
578
594
|
merged.deny = deny;
|
|
579
595
|
}
|
|
@@ -1163,7 +1179,8 @@ var assistConfigShape = {
|
|
|
1163
1179
|
advice: z6.strictObject({
|
|
1164
1180
|
sections: z6.partialRecord(z6.enum(adviceFragmentNames), z6.boolean()).default({}),
|
|
1165
1181
|
extra: z6.string().optional(),
|
|
1166
|
-
verify: z6.string().optional()
|
|
1182
|
+
verify: z6.string().optional(),
|
|
1183
|
+
rules: z6.array(z6.strictObject({ title: z6.string(), text: z6.string() })).optional()
|
|
1167
1184
|
}).optional(),
|
|
1168
1185
|
backup: z6.strictObject({
|
|
1169
1186
|
dir: z6.string().default(DEFAULT_BACKUP_DIR),
|
|
@@ -6191,6 +6208,11 @@ var adviceConfigHelp = [
|
|
|
6191
6208
|
key: "advice.verify",
|
|
6192
6209
|
setter: 'assist config set advice.verify "Run make check"',
|
|
6193
6210
|
note: "replaces the verify fragment's text and forces it in"
|
|
6211
|
+
},
|
|
6212
|
+
{
|
|
6213
|
+
key: "advice.rules",
|
|
6214
|
+
setter: "edit advice.rules ({ title, text } entries) in ~/.assist.yml or the repo's assist.yml",
|
|
6215
|
+
note: 'listed under "Your rules"; global and repo entries are concatenated, global first'
|
|
6194
6216
|
}
|
|
6195
6217
|
];
|
|
6196
6218
|
|
|
@@ -14128,6 +14150,13 @@ ${renderAdviceBody(fragment, context)}`
|
|
|
14128
14150
|
if (extra) sections.push(`## Repo notes
|
|
14129
14151
|
|
|
14130
14152
|
${extra}`);
|
|
14153
|
+
const rules2 = context.config.advice?.rules ?? [];
|
|
14154
|
+
if (rules2.length > 0)
|
|
14155
|
+
sections.push(
|
|
14156
|
+
`## Your rules
|
|
14157
|
+
|
|
14158
|
+
${rules2.map(({ title, text: text17 }) => `- **${title}** \u2014 ${text17}`).join("\n")}`
|
|
14159
|
+
);
|
|
14131
14160
|
if (sections.length === 0) return "";
|
|
14132
14161
|
return [heading, ...sections].join("\n\n");
|
|
14133
14162
|
}
|