@staff0rd/assist 0.966.1 → 0.966.2

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
  `,psi=go`
4020
4020
  0%, 100% { transform: scale(1); }
4021
4021
  50% { transform: scale(1.08); }
4022
- `,S_r={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:`${hsi} 1.8s linear infinite`},msi={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${psi} 1.6s ease-in-out infinite`,"&::before":{...S_r,inset:0,zIndex:-1},"&::after":{...S_r,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:ul.rainbowPill.text,textShadow:ul.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function T_r({children:e}){return(0,C6.jsxs)(C6.Fragment,{children:[(0,C6.jsx)(I5,{styles:dsi}),(0,C6.jsx)(X,{component:"span","data-testid":"rainbow-pill",sx:msi,children:e})]})}function C_r({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function w_r(e){if(e.length!==2)return!1;let[t,r]=e;return C_r(t)===C_r(r)}var DS=E(F(),1);function __r({rateLimits:e}){let t=O_(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=w_r(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:xbe(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,DS.jsxs)(k_r.Fragment,{children:[a>0?(0,DS.jsx)(X,{component:"span",sx:{color:tz,mr:.5},children:","}):null,(0,DS.jsx)(x_r,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,DS.jsx)(T_r,{children:i}):(0,DS.jsx)(DS.Fragment,{children:i})}var Q_=E(F(),1);function R_r({groups:e}){return(0,Q_.jsx)(Q_.Fragment,{children:e.map((t,r)=>(0,Q_.jsxs)(E_r.Fragment,{children:[(0,Q_.jsx)(X,{component:"span",sx:{color:tz,ml:r>0?1:0,mr:.5},children:Bu(t.harness)}),(0,Q_.jsx)(__r,{rateLimits:t.rateLimits})]},t.harness))})}var A_r={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function gsi(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function ysi(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function vsi(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function M_r(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=bVe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=N_(e,t,r,n),a=gsi(o),s=ysi(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:vsi(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function Tbe(e){return t=>t.tokens.color.onAppBar.level[e]}function I_r(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${Dve(e.at,t)}`}var J_=E(F(),1),D_r={display:"contents"};function UVe({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,J_.jsxs)(X,{component:"span",sx:D_r,children:[(0,J_.jsx)("span",{}),(0,J_.jsx)("span",{})]});let n=(0,J_.jsx)(X,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),i=(0,J_.jsxs)(X,{component:"span",sx:{color:Tbe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,J_.jsxs)(X,{component:"span",sx:D_r,children:[r?i:n,r?n:i]})}var N_r={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var e5=E(F(),1);function O_r({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=N_r,a=N_(t,r,n,i),s=M_r(t,r,n,i),l=s.kind==="projected"?s:void 0;return(0,e5.jsxs)(X,{sx:o.row,children:[(0,e5.jsx)(X,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,e5.jsx)(UVe,{direction:"back",threshold:l?.recovery}),(0,e5.jsxs)(X,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:o.pctWeight,color:Tbe(a)},children:[Math.round(t),"%"]}),(0,e5.jsx)(UVe,{direction:"forward",threshold:l?.worse}),(0,e5.jsx)(X,{component:"span",sx:o.note,children:l?l.recovery&&I_r(l.recovery,i):"no projection yet"})]})}function B_r(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 $_r=E(F(),1);function F_r({rateLimits:e,now:t}){return B_r(e).map(r=>(0,$_r.jsx)(O_r,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var w6=E(F(),1);function z_r({groups:e}){let t=O_(3e4),r=A_r;return(0,w6.jsxs)(X,{sx:r.root,children:[e.map(n=>(0,w6.jsxs)(X,{sx:r.group,children:[(0,w6.jsx)(X,{sx:r.heading,children:Bu(n.harness)}),(0,w6.jsx)(F_r,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,w6.jsx)(X,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var WVe=E(F(),1),bsi="Claude account usage (5h / 7d windows) \u2014 view history";function H_r(e){return e.length===0?{title:bsi,content:"Usage"}:{title:(0,WVe.jsx)(z_r,{groups:e}),content:(0,WVe.jsx)(R_r,{groups:e})}}var U_r={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}},W_r={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var GVe=E(F(),1),xsi={};function G_r({rateLimits:e,harnessRateLimits:t=xsi}){let{title:r,content:n}=H_r(v_r(e,t));return(0,GVe.jsx)(sr,{title:r,placement:"top-start",slotProps:W_r,children:(0,GVe.jsx)(Vr,{component:Ua,to:"/usage",underline:"none",color:"inherit",sx:U_r,children:n})})}var j_r=E(le(),1);var t5="0.966.1";var Cbe=E(le(),1),VVe=(0,Cbe.createContext)(null);function wbe(){return(0,Cbe.useContext)(VVe)}var qVe=E(F(),1);function V_r(){let e=wbe();return!e||e===t5?null:(0,qVe.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${t5}. Restart the daemon to match.`,children:(0,qVe.jsx)(fbe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var q_r=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?$v(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>$v(t).hover,color:t=>$v(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>$v(t).dot,boxShadow:t=>`0 0 0 3px ${$v(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>$v(t).readyText}});var gg=E(F(),1);function Y_r(){let{entries:e}=x$(),t=Xn(),r=(0,j_r.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:i}=Zn("openUpdates");if(Po(n,r),!t5)return null;let o=e.filter(E$).length;return(0,gg.jsxs)(gg.Fragment,{children:[(0,gg.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,gg.jsx)(Fu,{label:"Updates",chords:i}),children:(0,gg.jsxs)(Or,{component:Ua,to:"/updates","aria-label":o?`Updates: ${o} node${o>1?"s have":" has"} an update ready`:"Updates",sx:q_r(o>0),children:[o>0&&(0,gg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,gg.jsxs)("span",{children:["v",t5]}),o>0&&(0,gg.jsxs)("span",{className:"ready-count",children:[o," ready"]})]})}),(0,gg.jsx)(V_r,{})]})}var kbe=E(F(),1);function K_r({socket:e}){return(0,kbe.jsx)(g_r,{start:(0,kbe.jsx)(G_r,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,kbe.jsx)(Y_r,{})})}var Pbe=E(le(),1);var Abe=E(le(),1);function X_r(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 r5=E(F(),1),Ssi={display:"flex",gap:1,alignItems:"center",minWidth:0},Tsi={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},Csi={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},wsi={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function ksi(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function Z_r({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,r5.jsx)(Yp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=ksi(i);return(0,r5.jsxs)(pn,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:Ssi,children:[(0,r5.jsx)(f0e,{path:i}),(0,r5.jsxs)(X,{sx:Tsi,children:[(0,r5.jsx)(Le,{component:"span",sx:Csi,children:s}),(0,r5.jsx)(Le,{component:"span",color:"text.secondary",sx:wsi,children:a})]})]},i)})})}var _be=E(F(),1),_si={maxHeight:420,overflowY:"auto"},Esi={px:2,py:2,fontSize:13};function Q_r({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,_be.jsx)(X,{sx:_si,children:e?(0,_be.jsx)(Le,{color:"text.secondary",sx:Esi,children:e}):(0,_be.jsx)(Z_r,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var J_r=E(F(),1),Rsi={mt:6,alignSelf:"flex-start"};function Ebe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,J_r.jsx)(Xl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Rsi},transition:{onEntered:t}},children:n})}var Rbe=E(le(),1);var e5r={files:[],loading:!1,error:!1};function t5r(e,t){let[r,n]=(0,Rbe.useState)(e5r),i=gr();return(0,Rbe.useEffect)(()=>{if(!e){n(e5r);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await hr(Xr(`/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 k6=E(F(),1);function Asi(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function r5r({onClose:e}){let{worktreeNode:t}=zn();return(0,k6.jsx)(xf.Provider,{value:t,children:(0,k6.jsx)(Psi,{onClose:e})})}function Psi({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=zn(),[n,i]=(0,Abe.useState)(""),o=t5r(t,n),a=Xn(),s=(0,Abe.useRef)(null),l=p=>a(Asi(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=W_(o.files,n,l,e),h=p=>{l(p),e()};return(0,k6.jsxs)(Ebe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,k6.jsx)(VT,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,k6.jsx)(Q_r,{message:X_r(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function n5r(e){Po(Zn("quickOpen").matches,e)}var o5r=E(F(),1);function i5r(){let[e,t]=(0,Pbe.useState)(!1);return n5r((0,Pbe.useCallback)(()=>t(!0),[])),e?(0,o5r.jsx)(r5r,{onClose:()=>t(!1)}):null}var Lbe=E(F(),1);function a5r({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,Lbe.jsx)(zh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,Lbe.jsx)(Ci,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,Lbe.jsx)(Mt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var IZ=E(le(),1);function s5r(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var x5r=E(le(),1);var l5r=E(F(),1),c5r=at((0,l5r.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 Lsi={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function u5r(e){return e?Lsi[e]:"success.main"}function f5r(e){return e.split("-")[0].split(".").map(Number)}function d5r(e,t){if(!e||!t||e===t)return;let r=f5r(e),n=f5r(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 _6=E(F(),1),Msi={height:16,fontSize:10},Isi={opacity:.6,fontSize:"0.85em"};function Dsi(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 LZ({nodes:e,name:t,showVersion:r=!1}){let n=wbe()??t5,i=e.links.find(a=>a.name===t),o=d5r(i?.peerVersion,n);return(0,_6.jsx)(sr,{title:Dsi(e,t),placement:"right",children:(0,_6.jsxs)(X,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,_6.jsx)(c5r,{sx:{fontSize:8,color:u5r(i?.state)}}),t,r&&i?.peerVersion&&(0,_6.jsxs)(X,{component:"span",sx:Isi,children:["v",i.peerVersion]}),o&&(0,_6.jsx)(Un,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:Msi})]})})}var E6=E(F(),1),Nsi={opacity:.6},Osi={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function h5r({nodes:e,name:t,clone:r}){let n=(0,E6.jsx)(LZ,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,E6.jsx)(X,{component:"span",sx:Nsi,children:n}):(0,E6.jsx)(sr,{title:z$(t,r.cloneTarget),children:(0,E6.jsxs)(X,{component:"span",sx:Osi,children:[(0,E6.jsx)($$,{sx:{fontSize:14}}),n]})})}var m5r=E(F(),1),Bsi={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 p5r({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,m5r.jsx)(Or,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:Bsi,children:t})}var g5r={ArrowRight:1,ArrowLeft:-1};function Fsi(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+g5r[e.key]+r)%r}function y5r(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!g5r[i.key]){K2(i);return}let o=Fsi(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var v5r=E(le(),1);function rz(e){return e?.querySelector('[aria-checked="true"]')}function b5r(e,t){(0,v5r.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=rz(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jVe=E(F(),1),$si={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function Mbe({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return b5r(o,r),(0,jVe.jsx)(_t,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:y5r(t,r,n,l),sx:$si,children:t.map(u=>(0,jVe.jsx)(p5r,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var YVe=E(F(),1);function S5r({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=Ic(),a=(0,x5r.useRef)(null);return!o||!n||!e?null:(0,YVe.jsx)(Mbe,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,YVe.jsx)(h5r,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var Ibe=E(F(),1);function T5r({prompt:e,children:t}){return(0,Ibe.jsxs)(_t,{children:[e,(0,Ibe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var w5r=E(F(),1),zsi=".MuiOutlinedInput-notchedOutline",Hsi={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${zsi}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function C5r({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,w5r.jsx)(Gn,{sx:Hsi,value:e,onChange:a=>t(a.target.value),onKeyDown:K2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var R5r=E(le(),1);var NS={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:lye,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},k5r=Object.keys(NS);var KVe=E(F(),1);function _5r({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,KVe.jsx)($s,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,KVe.jsx)(pn,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Bu(o)},o))})}var R6=E(F(),1);function E5r(e){return t=>t==="prompt"&&e?(0,R6.jsxs)(R6.Fragment,{children:["prompt",(0,R6.jsx)(X,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Bu(e)}`}),(0,R6.jsx)(_d,{sx:{fontSize:18,mr:-.75}})]}):t}var A6=E(F(),1);function A5r({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,R5r.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(rz(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,A6.jsxs)(A6.Fragment,{children:[(0,A6.jsx)(Mbe,{label:"Mode",options:k5r,value:e.mode,onChange:l,optionLabel:E5r(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,A6.jsx)(_5r,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var U5r=E(le(),1);var XVe=E(F(),1),Usi={zIndex:e=>e.zIndex.modal+1};function P5r({open:e,anchor:t,children:r}){return(0,XVe.jsx)(WP,{open:e,anchorEl:t,placement:"bottom-start",sx:Usi,children:(0,XVe.jsx)(on,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var L5r=E(F(),1),M5r=at((0,L5r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var ZVe=E(F(),1),Wsi={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},Gsi={fontSize:16,color:"text.disabled"};function I5r(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Wsi,endAdornment:(0,ZVe.jsx)(NSe,{position:"end",children:(0,ZVe.jsx)(M5r,{sx:Gsi})})}}}var D5r=E(RP(),1);function N5r({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}K2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,D5r.flushSync)(()=>{r(t),n()}),K2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function O5r(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Lv(n).toLowerCase().includes(r)):e}var QVe=E(le(),1);function B5r(){let[e,t]=(0,QVe.useState)(!1),[r,n]=(0,QVe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var $5r=E(le(),1);var F5r=e=>e?Lv(e):"";function z5r(e){let[t,r]=(0,$5r.useState)(()=>F5r(e));return{text:t,setText:r,showRepo:n=>r(F5r(n))}}function H5r(e,t,r){let n=B5r(),i=z5r(t),o=O5r(e,n.query),a=f=>{r(f),i.showRepo(f)},s=W_(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:N5r({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 nz=E(F(),1);function W5r({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=H5r(e,t,r),s=(0,U5r.useRef)(null);return(0,nz.jsxs)(X,{ref:s,sx:{flex:1,minWidth:0},children:[(0,nz.jsx)(Gn,{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:I5r(a.open)}),(0,nz.jsx)(P5r,{open:a.open,anchor:s.current,children:(0,nz.jsx)(abe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var n5=E(F(),1);function G5r({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=zn();return(0,n5.jsxs)(T5r,{prompt:(0,n5.jsx)(C5r,{value:r.prompt,onChange:r.setPrompt,placeholder:NS[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,n5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,n5.jsx)(W5r,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,n5.jsx)(A5r,{...t})]}),(0,n5.jsx)(S5r,{value:r.node,onChange:r.setNode,cloneState:e})]})}var j5r=E(F(),1),V5r=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function q5r({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,j5r.jsx)(Mt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var P6=E(F(),1),Vsi=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),qsi=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Y5r(e){return(0,P6.jsxs)(_t,{direction:"row",sx:Vsi,children:[V5r.map(([t,r])=>(0,P6.jsxs)("span",{children:[(0,P6.jsx)(X,{component:"kbd",sx:qsi,children:t}),r]},t)),(0,P6.jsx)(X,{sx:{flex:1}}),(0,P6.jsx)(q5r,{...e})]})}var L6=E(le(),1);function K5r(e,t){let r=(0,L6.useRef)(e),n=(0,L6.useRef)(null),i=(0,L6.useRef)(null),o=(0,L6.useRef)(null),a=(0,L6.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:rz(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 jsi(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:lbe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function X5r(e,t){let{names:r,visible:n}=Ic(),i=nbe(t,n?r:[void 0]);return{cloneState:i,target:jsi(t,e,i(e))}}function Z5r({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}]:[];Phr(NS[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function Q5r(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(Kve(r.prompt,n.onCreateAssist),!0):(Z5r({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var Dbe=E(le(),1);function J5r(e,t){let[r,n]=(0,Dbe.useState)(!1);return(0,Dbe.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function eEr(e,t,r,n,i){let o=J5r(e,()=>{Q5r(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var MZ=E(le(),1);function tEr(e,t){let r=(0,MZ.useRef)(e),n=(0,MZ.useRef)(null);return(0,MZ.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 nEr=E(F(),1),Ysi={border:0,margin:0,padding:0,minWidth:0};function rEr({loading:e,restoreFocus:t,children:r}){let n=tEr(e,t);return(0,nEr.jsx)("fieldset",{disabled:e,style:Ysi,onFocus:n,children:r})}var M6=E(F(),1);function iEr({draft:e,launchers:t,onClose:r}){let n=K5r(e.focus,e.setFocus),i=s5r(F_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=X5r(e.node,e.cwd),l=eEr(e,o,a,t,r);return(0,M6.jsx)(Ebe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,M6.jsx)("form",{onSubmit:l,children:(0,M6.jsxs)(rEr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,M6.jsx)(G5r,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,M6.jsx)(Y5r,{submitLabel:a.kind==="clone"?"Clone":NS[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var Nbe=E(le(),1);var Ksi=1e3;async function Xsi(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await hr(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(NS,n?.mode)?n.mode:null}catch{return null}}function oEr(e,t=0){let[r,n]=(0,Nbe.useState)(null);return(0,Nbe.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await Xsi(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,Ksi))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function aEr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var OS=E(le(),1),sEr={field:"prompt",selectionStart:0,selectionEnd:0};function lEr(){let[e,t]=(0,OS.useState)(""),[r,n]=(0,OS.useState)(),[i,o]=(0,OS.useState)(),[a,s]=(0,OS.useState)("claude"),[l,u]=(0,OS.useState)(),[f,d]=(0,OS.useState)(sEr),h=(0,OS.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(sEr)},[]);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 cEr(e,t=oEr){let{selectedCwd:r}=zn(),n=Ic(),i=lEr(),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:aEr(i.node,n)}:null}function uEr(e){Po(Zn("newSession").matches,e)}var fEr=E(le(),1);function dEr(e,t){let{selectedCwd:r}=zn(),[n,i]=Kc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,fEr.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 pEr=E(F(),1);function hEr({launchers:e}){let[t,r]=(0,IZ.useState)(!1),[n,i]=(0,IZ.useState)(0),o=cEr(n),a=(0,IZ.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return uEr(a),dEr(o,a),!t||!o?null:(0,pEr.jsx)(iEr,{draft:o,launchers:e,onClose:()=>r(!1)})}var Obe=E(F(),1);function mEr({reconnecting:e}){return(0,Obe.jsx)(zh,{open:e,children:(0,Obe.jsx)(Ci,{severity:"info",variant:"filled",icon:(0,Obe.jsx)($i,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var zv=E(F(),1);function gEr({socket:e,onViewLaunchedSession:t}){return(0,zv.jsxs)(zv.Fragment,{children:[(0,zv.jsx)(i5r,{}),(0,zv.jsx)(hEr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,zv.jsx)(mEr,{reconnecting:e.reconnecting}),(0,zv.jsx)(ic,{error:e.error,onClose:e.clearError}),(0,zv.jsx)(a5r,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Hv=E(le(),1);var Zsi=6e4;function Qsi(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function yEr(e){let t=e.nodes?.local,r=e.names.join(`
4022
+ `,S_r={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:`${hsi} 1.8s linear infinite`},msi={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${psi} 1.6s ease-in-out infinite`,"&::before":{...S_r,inset:0,zIndex:-1},"&::after":{...S_r,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:ul.rainbowPill.text,textShadow:ul.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function T_r({children:e}){return(0,C6.jsxs)(C6.Fragment,{children:[(0,C6.jsx)(I5,{styles:dsi}),(0,C6.jsx)(X,{component:"span","data-testid":"rainbow-pill",sx:msi,children:e})]})}function C_r({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function w_r(e){if(e.length!==2)return!1;let[t,r]=e;return C_r(t)===C_r(r)}var DS=E(F(),1);function __r({rateLimits:e}){let t=O_(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=w_r(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:xbe(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,DS.jsxs)(k_r.Fragment,{children:[a>0?(0,DS.jsx)(X,{component:"span",sx:{color:tz,mr:.5},children:","}):null,(0,DS.jsx)(x_r,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,DS.jsx)(T_r,{children:i}):(0,DS.jsx)(DS.Fragment,{children:i})}var Q_=E(F(),1);function R_r({groups:e}){return(0,Q_.jsx)(Q_.Fragment,{children:e.map((t,r)=>(0,Q_.jsxs)(E_r.Fragment,{children:[(0,Q_.jsx)(X,{component:"span",sx:{color:tz,ml:r>0?1:0,mr:.5},children:Bu(t.harness)}),(0,Q_.jsx)(__r,{rateLimits:t.rateLimits})]},t.harness))})}var A_r={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function gsi(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function ysi(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function vsi(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function M_r(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=bVe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=N_(e,t,r,n),a=gsi(o),s=ysi(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:vsi(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function Tbe(e){return t=>t.tokens.color.onAppBar.level[e]}function I_r(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${Dve(e.at,t)}`}var J_=E(F(),1),D_r={display:"contents"};function UVe({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,J_.jsxs)(X,{component:"span",sx:D_r,children:[(0,J_.jsx)("span",{}),(0,J_.jsx)("span",{})]});let n=(0,J_.jsx)(X,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),i=(0,J_.jsxs)(X,{component:"span",sx:{color:Tbe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,J_.jsxs)(X,{component:"span",sx:D_r,children:[r?i:n,r?n:i]})}var N_r={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var e5=E(F(),1);function O_r({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=N_r,a=N_(t,r,n,i),s=M_r(t,r,n,i),l=s.kind==="projected"?s:void 0;return(0,e5.jsxs)(X,{sx:o.row,children:[(0,e5.jsx)(X,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,e5.jsx)(UVe,{direction:"back",threshold:l?.recovery}),(0,e5.jsxs)(X,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:o.pctWeight,color:Tbe(a)},children:[Math.round(t),"%"]}),(0,e5.jsx)(UVe,{direction:"forward",threshold:l?.worse}),(0,e5.jsx)(X,{component:"span",sx:o.note,children:l?l.recovery&&I_r(l.recovery,i):"no projection yet"})]})}function B_r(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 $_r=E(F(),1);function F_r({rateLimits:e,now:t}){return B_r(e).map(r=>(0,$_r.jsx)(O_r,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var w6=E(F(),1);function z_r({groups:e}){let t=O_(3e4),r=A_r;return(0,w6.jsxs)(X,{sx:r.root,children:[e.map(n=>(0,w6.jsxs)(X,{sx:r.group,children:[(0,w6.jsx)(X,{sx:r.heading,children:Bu(n.harness)}),(0,w6.jsx)(F_r,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,w6.jsx)(X,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var WVe=E(F(),1),bsi="Claude account usage (5h / 7d windows) \u2014 view history";function H_r(e){return e.length===0?{title:bsi,content:"Usage"}:{title:(0,WVe.jsx)(z_r,{groups:e}),content:(0,WVe.jsx)(R_r,{groups:e})}}var U_r={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}},W_r={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var GVe=E(F(),1),xsi={};function G_r({rateLimits:e,harnessRateLimits:t=xsi}){let{title:r,content:n}=H_r(v_r(e,t));return(0,GVe.jsx)(sr,{title:r,placement:"top-start",slotProps:W_r,children:(0,GVe.jsx)(Vr,{component:Ua,to:"/usage",underline:"none",color:"inherit",sx:U_r,children:n})})}var j_r=E(le(),1);var t5="0.966.2";var Cbe=E(le(),1),VVe=(0,Cbe.createContext)(null);function wbe(){return(0,Cbe.useContext)(VVe)}var qVe=E(F(),1);function V_r(){let e=wbe();return!e||e===t5?null:(0,qVe.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${t5}. Restart the daemon to match.`,children:(0,qVe.jsx)(fbe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var q_r=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?$v(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>$v(t).hover,color:t=>$v(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>$v(t).dot,boxShadow:t=>`0 0 0 3px ${$v(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>$v(t).readyText}});var gg=E(F(),1);function Y_r(){let{entries:e}=x$(),t=Xn(),r=(0,j_r.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:i}=Zn("openUpdates");if(Po(n,r),!t5)return null;let o=e.filter(E$).length;return(0,gg.jsxs)(gg.Fragment,{children:[(0,gg.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,gg.jsx)(Fu,{label:"Updates",chords:i}),children:(0,gg.jsxs)(Or,{component:Ua,to:"/updates","aria-label":o?`Updates: ${o} node${o>1?"s have":" has"} an update ready`:"Updates",sx:q_r(o>0),children:[o>0&&(0,gg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,gg.jsxs)("span",{children:["v",t5]}),o>0&&(0,gg.jsxs)("span",{className:"ready-count",children:[o," ready"]})]})}),(0,gg.jsx)(V_r,{})]})}var kbe=E(F(),1);function K_r({socket:e}){return(0,kbe.jsx)(g_r,{start:(0,kbe.jsx)(G_r,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,kbe.jsx)(Y_r,{})})}var Pbe=E(le(),1);var Abe=E(le(),1);function X_r(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 r5=E(F(),1),Ssi={display:"flex",gap:1,alignItems:"center",minWidth:0},Tsi={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},Csi={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},wsi={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function ksi(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function Z_r({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,r5.jsx)(Yp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=ksi(i);return(0,r5.jsxs)(pn,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:Ssi,children:[(0,r5.jsx)(f0e,{path:i}),(0,r5.jsxs)(X,{sx:Tsi,children:[(0,r5.jsx)(Le,{component:"span",sx:Csi,children:s}),(0,r5.jsx)(Le,{component:"span",color:"text.secondary",sx:wsi,children:a})]})]},i)})})}var _be=E(F(),1),_si={maxHeight:420,overflowY:"auto"},Esi={px:2,py:2,fontSize:13};function Q_r({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,_be.jsx)(X,{sx:_si,children:e?(0,_be.jsx)(Le,{color:"text.secondary",sx:Esi,children:e}):(0,_be.jsx)(Z_r,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var J_r=E(F(),1),Rsi={mt:6,alignSelf:"flex-start"};function Ebe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,J_r.jsx)(Xl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Rsi},transition:{onEntered:t}},children:n})}var Rbe=E(le(),1);var e5r={files:[],loading:!1,error:!1};function t5r(e,t){let[r,n]=(0,Rbe.useState)(e5r),i=gr();return(0,Rbe.useEffect)(()=>{if(!e){n(e5r);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await hr(Xr(`/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 k6=E(F(),1);function Asi(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function r5r({onClose:e}){let{worktreeNode:t}=zn();return(0,k6.jsx)(xf.Provider,{value:t,children:(0,k6.jsx)(Psi,{onClose:e})})}function Psi({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=zn(),[n,i]=(0,Abe.useState)(""),o=t5r(t,n),a=Xn(),s=(0,Abe.useRef)(null),l=p=>a(Asi(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=W_(o.files,n,l,e),h=p=>{l(p),e()};return(0,k6.jsxs)(Ebe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,k6.jsx)(VT,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,k6.jsx)(Q_r,{message:X_r(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function n5r(e){Po(Zn("quickOpen").matches,e)}var o5r=E(F(),1);function i5r(){let[e,t]=(0,Pbe.useState)(!1);return n5r((0,Pbe.useCallback)(()=>t(!0),[])),e?(0,o5r.jsx)(r5r,{onClose:()=>t(!1)}):null}var Lbe=E(F(),1);function a5r({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,Lbe.jsx)(zh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,Lbe.jsx)(Ci,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,Lbe.jsx)(Mt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var IZ=E(le(),1);function s5r(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var x5r=E(le(),1);var l5r=E(F(),1),c5r=at((0,l5r.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 Lsi={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function u5r(e){return e?Lsi[e]:"success.main"}function f5r(e){return e.split("-")[0].split(".").map(Number)}function d5r(e,t){if(!e||!t||e===t)return;let r=f5r(e),n=f5r(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 _6=E(F(),1),Msi={height:16,fontSize:10},Isi={opacity:.6,fontSize:"0.85em"};function Dsi(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 LZ({nodes:e,name:t,showVersion:r=!1}){let n=wbe()??t5,i=e.links.find(a=>a.name===t),o=d5r(i?.peerVersion,n);return(0,_6.jsx)(sr,{title:Dsi(e,t),placement:"right",children:(0,_6.jsxs)(X,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,_6.jsx)(c5r,{sx:{fontSize:8,color:u5r(i?.state)}}),t,r&&i?.peerVersion&&(0,_6.jsxs)(X,{component:"span",sx:Isi,children:["v",i.peerVersion]}),o&&(0,_6.jsx)(Un,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:Msi})]})})}var E6=E(F(),1),Nsi={opacity:.6},Osi={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function h5r({nodes:e,name:t,clone:r}){let n=(0,E6.jsx)(LZ,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,E6.jsx)(X,{component:"span",sx:Nsi,children:n}):(0,E6.jsx)(sr,{title:z$(t,r.cloneTarget),children:(0,E6.jsxs)(X,{component:"span",sx:Osi,children:[(0,E6.jsx)($$,{sx:{fontSize:14}}),n]})})}var m5r=E(F(),1),Bsi={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 p5r({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,m5r.jsx)(Or,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:Bsi,children:t})}var g5r={ArrowRight:1,ArrowLeft:-1};function Fsi(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+g5r[e.key]+r)%r}function y5r(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!g5r[i.key]){K2(i);return}let o=Fsi(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var v5r=E(le(),1);function rz(e){return e?.querySelector('[aria-checked="true"]')}function b5r(e,t){(0,v5r.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=rz(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jVe=E(F(),1),$si={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function Mbe({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return b5r(o,r),(0,jVe.jsx)(_t,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:y5r(t,r,n,l),sx:$si,children:t.map(u=>(0,jVe.jsx)(p5r,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var YVe=E(F(),1);function S5r({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=Ic(),a=(0,x5r.useRef)(null);return!o||!n||!e?null:(0,YVe.jsx)(Mbe,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,YVe.jsx)(h5r,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var Ibe=E(F(),1);function T5r({prompt:e,children:t}){return(0,Ibe.jsxs)(_t,{children:[e,(0,Ibe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var w5r=E(F(),1),zsi=".MuiOutlinedInput-notchedOutline",Hsi={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${zsi}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function C5r({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,w5r.jsx)(Gn,{sx:Hsi,value:e,onChange:a=>t(a.target.value),onKeyDown:K2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var R5r=E(le(),1);var NS={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:lye,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},k5r=Object.keys(NS);var KVe=E(F(),1);function _5r({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,KVe.jsx)($s,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,KVe.jsx)(pn,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Bu(o)},o))})}var R6=E(F(),1);function E5r(e){return t=>t==="prompt"&&e?(0,R6.jsxs)(R6.Fragment,{children:["prompt",(0,R6.jsx)(X,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Bu(e)}`}),(0,R6.jsx)(_d,{sx:{fontSize:18,mr:-.75}})]}):t}var A6=E(F(),1);function A5r({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,R5r.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(rz(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,A6.jsxs)(A6.Fragment,{children:[(0,A6.jsx)(Mbe,{label:"Mode",options:k5r,value:e.mode,onChange:l,optionLabel:E5r(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,A6.jsx)(_5r,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var U5r=E(le(),1);var XVe=E(F(),1),Usi={zIndex:e=>e.zIndex.modal+1};function P5r({open:e,anchor:t,children:r}){return(0,XVe.jsx)(WP,{open:e,anchorEl:t,placement:"bottom-start",sx:Usi,children:(0,XVe.jsx)(on,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var L5r=E(F(),1),M5r=at((0,L5r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var ZVe=E(F(),1),Wsi={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},Gsi={fontSize:16,color:"text.disabled"};function I5r(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Wsi,endAdornment:(0,ZVe.jsx)(NSe,{position:"end",children:(0,ZVe.jsx)(M5r,{sx:Gsi})})}}}var D5r=E(RP(),1);function N5r({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}K2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,D5r.flushSync)(()=>{r(t),n()}),K2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function O5r(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Lv(n).toLowerCase().includes(r)):e}var QVe=E(le(),1);function B5r(){let[e,t]=(0,QVe.useState)(!1),[r,n]=(0,QVe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var $5r=E(le(),1);var F5r=e=>e?Lv(e):"";function z5r(e){let[t,r]=(0,$5r.useState)(()=>F5r(e));return{text:t,setText:r,showRepo:n=>r(F5r(n))}}function H5r(e,t,r){let n=B5r(),i=z5r(t),o=O5r(e,n.query),a=f=>{r(f),i.showRepo(f)},s=W_(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:N5r({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 nz=E(F(),1);function W5r({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=H5r(e,t,r),s=(0,U5r.useRef)(null);return(0,nz.jsxs)(X,{ref:s,sx:{flex:1,minWidth:0},children:[(0,nz.jsx)(Gn,{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:I5r(a.open)}),(0,nz.jsx)(P5r,{open:a.open,anchor:s.current,children:(0,nz.jsx)(abe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var n5=E(F(),1);function G5r({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=zn();return(0,n5.jsxs)(T5r,{prompt:(0,n5.jsx)(C5r,{value:r.prompt,onChange:r.setPrompt,placeholder:NS[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,n5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,n5.jsx)(W5r,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,n5.jsx)(A5r,{...t})]}),(0,n5.jsx)(S5r,{value:r.node,onChange:r.setNode,cloneState:e})]})}var j5r=E(F(),1),V5r=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function q5r({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,j5r.jsx)(Mt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var P6=E(F(),1),Vsi=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),qsi=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Y5r(e){return(0,P6.jsxs)(_t,{direction:"row",sx:Vsi,children:[V5r.map(([t,r])=>(0,P6.jsxs)("span",{children:[(0,P6.jsx)(X,{component:"kbd",sx:qsi,children:t}),r]},t)),(0,P6.jsx)(X,{sx:{flex:1}}),(0,P6.jsx)(q5r,{...e})]})}var L6=E(le(),1);function K5r(e,t){let r=(0,L6.useRef)(e),n=(0,L6.useRef)(null),i=(0,L6.useRef)(null),o=(0,L6.useRef)(null),a=(0,L6.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:rz(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 jsi(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:lbe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function X5r(e,t){let{names:r,visible:n}=Ic(),i=nbe(t,n?r:[void 0]);return{cloneState:i,target:jsi(t,e,i(e))}}function Z5r({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}]:[];Phr(NS[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function Q5r(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(Kve(r.prompt,n.onCreateAssist),!0):(Z5r({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var Dbe=E(le(),1);function J5r(e,t){let[r,n]=(0,Dbe.useState)(!1);return(0,Dbe.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function eEr(e,t,r,n,i){let o=J5r(e,()=>{Q5r(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var MZ=E(le(),1);function tEr(e,t){let r=(0,MZ.useRef)(e),n=(0,MZ.useRef)(null);return(0,MZ.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 nEr=E(F(),1),Ysi={border:0,margin:0,padding:0,minWidth:0};function rEr({loading:e,restoreFocus:t,children:r}){let n=tEr(e,t);return(0,nEr.jsx)("fieldset",{disabled:e,style:Ysi,onFocus:n,children:r})}var M6=E(F(),1);function iEr({draft:e,launchers:t,onClose:r}){let n=K5r(e.focus,e.setFocus),i=s5r(F_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=X5r(e.node,e.cwd),l=eEr(e,o,a,t,r);return(0,M6.jsx)(Ebe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,M6.jsx)("form",{onSubmit:l,children:(0,M6.jsxs)(rEr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,M6.jsx)(G5r,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,M6.jsx)(Y5r,{submitLabel:a.kind==="clone"?"Clone":NS[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var Nbe=E(le(),1);var Ksi=1e3;async function Xsi(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await hr(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(NS,n?.mode)?n.mode:null}catch{return null}}function oEr(e,t=0){let[r,n]=(0,Nbe.useState)(null);return(0,Nbe.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await Xsi(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,Ksi))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function aEr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var OS=E(le(),1),sEr={field:"prompt",selectionStart:0,selectionEnd:0};function lEr(){let[e,t]=(0,OS.useState)(""),[r,n]=(0,OS.useState)(),[i,o]=(0,OS.useState)(),[a,s]=(0,OS.useState)("claude"),[l,u]=(0,OS.useState)(),[f,d]=(0,OS.useState)(sEr),h=(0,OS.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(sEr)},[]);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 cEr(e,t=oEr){let{selectedCwd:r}=zn(),n=Ic(),i=lEr(),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:aEr(i.node,n)}:null}function uEr(e){Po(Zn("newSession").matches,e)}var fEr=E(le(),1);function dEr(e,t){let{selectedCwd:r}=zn(),[n,i]=Kc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,fEr.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 pEr=E(F(),1);function hEr({launchers:e}){let[t,r]=(0,IZ.useState)(!1),[n,i]=(0,IZ.useState)(0),o=cEr(n),a=(0,IZ.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return uEr(a),dEr(o,a),!t||!o?null:(0,pEr.jsx)(iEr,{draft:o,launchers:e,onClose:()=>r(!1)})}var Obe=E(F(),1);function mEr({reconnecting:e}){return(0,Obe.jsx)(zh,{open:e,children:(0,Obe.jsx)(Ci,{severity:"info",variant:"filled",icon:(0,Obe.jsx)($i,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var zv=E(F(),1);function gEr({socket:e,onViewLaunchedSession:t}){return(0,zv.jsxs)(zv.Fragment,{children:[(0,zv.jsx)(i5r,{}),(0,zv.jsx)(hEr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,zv.jsx)(mEr,{reconnecting:e.reconnecting}),(0,zv.jsx)(ic,{error:e.error,onClose:e.clearError}),(0,zv.jsx)(a5r,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Hv=E(le(),1);var Zsi=6e4;function Qsi(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function yEr(e){let t=e.nodes?.local,r=e.names.join(`
4023
4023
  `),[n,i]=(0,Hv.useState)([]),o=(0,Hv.useRef)(0),a=(0,Hv.useCallback)(()=>{let l=r?r.split(`
4024
4024
  `):[];if(l.length===0)return;let u=++o.current;i(f=>Qsi(f,l,t));for(let f of l)_ve(f,f===t).then(d=>{u===o.current&&i(h=>h.map(p=>p.name===f?d:p))})},[r,t]);(0,Hv.useEffect)(()=>{a();let l=setInterval(a,Zsi);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Hv.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var i5=E(F(),1);function vEr({shell:e,children:t}){let{socket:r,selection:n,launch:i,sidebarCollapse:o}=e,a=yEr(r.nodeSelection);return(0,i5.jsx)(uVe.Provider,{value:a,children:(0,i5.jsx)(i_e.Provider,{value:o,children:(0,i5.jsx)(uW.Provider,{value:n,children:(0,i5.jsx)(AVe.Provider,{value:r.nodeSelection,children:(0,i5.jsx)(xf.Provider,{value:n.selectedNode,children:(0,i5.jsx)(YHe.Provider,{value:i,children:(0,i5.jsx)(wat,{children:t})})})})})})})}var bEr=E(F(),1),xEr=at((0,bEr.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 SEr=E(le(),1);var W0=E(F(),1),Jsi={ml:1,textTransform:"none",fontSize:12};function TEr(){let{nodes:e,names:t,visible:r,selected:n,select:i}=Ic(),[o,a]=(0,SEr.useState)(null);return!r||!e||!n?null:(0,W0.jsxs)(W0.Fragment,{children:[(0,W0.jsx)(Mt,{size:"small",color:"inherit",startIcon:(0,W0.jsx)(xEr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:Jsi,children:(0,W0.jsx)(LZ,{nodes:e,name:n})}),(0,W0.jsx)($s,{anchorEl:o,open:!!o,onClose:()=>a(null),children:t.map(s=>(0,W0.jsx)(pn,{selected:s===n,onClick:()=>{i(s),a(null)},sx:{fontSize:13},children:(0,W0.jsx)(LZ,{nodes:e,name:s,showVersion:!0})},s))})]})}var DZ=E(le(),1);function CEr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var I6=E(F(),1),eli=[Wa("secondary"),{ml:.75}];function wEr({index:e,label:t,count:r,...n}){let{chords:i}=Zn("navTab");return(0,I6.jsx)(sr,{describeChild:!0,title:(0,I6.jsx)(Fu,{label:t,chords:[CEr(i,e)]}),children:(0,I6.jsx)(mb,{label:r?(0,I6.jsxs)("span",{children:[t,(0,I6.jsx)(X,{component:"span",sx:eli,children:r})]}):t,...n})})}var kEr=E(le(),1);var tli=6e4;function _Er(){let e=m0e();return(0,kEr.useEffect)(()=>{$2.refresh();let t=setInterval(()=>{$2.refresh()},tli);return()=>clearInterval(t)},[]),e?.length??0}var JVe=E(le(),1);function EEr(e,t){let{bound:r}=Zn("navTab"),n=e.length,i=(0,JVe.useCallback)(a=>(xW(a,r)??n)<n,[r,n]),o=(0,JVe.useCallback)(a=>{let s=e[xW(a,r)??-1];s&&t(s)},[e,t,r]);Po(i,o)}var Bbe=E(le(),1);function REr(){let[e,t]=(0,Bbe.useState)(!1);return(0,Bbe.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await hr("/api/news/nav")).json();r||t(i?.showInNav===!0)}catch{r||t(!1)}})(),()=>{r=!0}},[]),e}var Fbe=E(le(),1);async function rli(e,t){let r=await hr(Xr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function AEr(e){let[t,r]=(0,Fbe.useState)(null),n=gr(),i=`${n??""}\0${e}`;return(0,Fbe.useEffect)(()=>{if(!e)return;let o=!1;return rli(e,n).catch(()=>{}).then(a=>{o||r({key:i,configured:a})}),()=>{o=!0}},[e,n,i]),t?.key===i?t.configured:void 0}var PEr=E(le(),1);function LEr(e){let{pathname:t}=Vo(),r=Xn(),n=t==="/releases"||t.startsWith("/releases/");(0,PEr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var nli={path:"/sessions",label:"Sessions"},ili={path:"/backlog",label:"Backlog"},oli={path:"/next",label:"Next"},ali={path:"/releases",label:"Releases"},sli={path:"/news",label:"News"},lli={path:"/inbox",label:"Inbox"};function MEr(e,t){return[nli,ili,oli,...e?[ali]:[],...t?[sli]:[],lli]}var eqe=E(F(),1),cli={mx:"6px"};function IEr({cwd:e}){let t=Vo(),r=Xn(),n=AEr(e),i=REr(),o=_Er();LEr(n);let a=n===!0,s=(0,DZ.useMemo)(()=>MEr(a,i),[a,i]),l=(0,DZ.useMemo)(()=>s.map(d=>d.path),[s]),u=s.findIndex(d=>t.pathname.startsWith(d.path)),f=(0,DZ.useCallback)(d=>{t.pathname!==d&&r(d)},[t.pathname,r]);return EEr(l,f),(0,eqe.jsx)(uE,{sx:cli,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((d,h)=>(0,eqe.jsx)(wEr,{index:h,label:d.label,count:d.path==="/inbox"?o:void 0,onClick:()=>f(d.path)},d.path))})}var NZ=E(F(),1),DEr=(e,t)=>({bgcolor:e,color:t,"& .MuiSvgIcon-root":{color:t},transition:"filter 0.2s ease, transform 0.2s ease","&:hover":{bgcolor:e,color:t,filter:"brightness(1.08)"},"&:active":{transform:"translateY(1px)"}}),uli=e=>({ml:.75,...e.tokens.color.appBar?DEr("primary.main","primary.contrastText"):DEr("primary.contrastText","primary.main")});function NEr(){let[,e]=Kc(),{label:t,chords:r}=Zn("newSession");return(0,NZ.jsx)(sr,{title:(0,NZ.jsx)(Fu,{label:t,chords:r}),children:(0,NZ.jsx)(Qt,{sx:uli,"aria-label":"New session",onClick:()=>e(i=>(i.set("new",""),i),{replace:!0}),children:(0,NZ.jsx)(iC,{})})})}var $be=E(le(),1);var OZ=E(F(),1),fli={strokeWidth:2};function OEr(e){return(0,OZ.jsxs)(fye,{viewBox:"0 0 24 24",sx:fli,...e,children:[(0,OZ.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 3.5c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 10.5c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),(0,OZ.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var BZ=E(F(),1);function BEr({cwd:e}){let[t,r]=(0,$be.useState)(null),n=gr();return(0,$be.useEffect)(()=>{if(!e){r(null);return}let i=!1;return(async()=>{try{let a=await(await hr(Xr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();i||r(a?.url??null)}catch{i||r(null)}})(),()=>{i=!0}},[e,n]),t?(0,BZ.jsx)(sr,{title:"Open in GitHub",children:(0,BZ.jsx)(X,{component:"span",sx:dye,children:(0,BZ.jsx)(Qt,{onClick:()=>window.open(t,"_blank"),children:(0,BZ.jsx)(OEr,{})})})}):null}var G0=E(F(),1),dli={color:"inherit",mr:1.5};function FEr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:i}=D_("webserver",e);return(0,G0.jsxs)(G0.Fragment,{children:[(0,G0.jsx)(sr,{title:"Restart web server",children:(0,G0.jsx)("span",{children:(0,G0.jsx)(Qt,{sx:dli,disabled:t,onClick:i,children:t?(0,G0.jsx)($i,{size:24}):(0,G0.jsx)(wve,{})})})}),(0,G0.jsx)(ic,{error:r,onClose:n})]})}var HEr=E(le(),1);var $Er=E(le(),1);function zEr(e){let t=$n().palette.primary.main;Po(Zn("focusRepoPicker").matches,(0,$Er.useCallback)(()=>rc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var FZ=E(F(),1),hli={width:240,ml:2};function UEr({repos:e,selected:t,onSelect:r}){let n=(0,HEr.useRef)(null);zEr(n);let{chords:i}=Zn("focusRepoPicker");return(0,FZ.jsx)(X,{ref:n,sx:hli,children:(0,FZ.jsx)(cye,{label:t?Lv(t):"Select repo...",tooltip:(0,FZ.jsx)(Fu,{label:"Repo",chords:i}),typeToOpen:!0,children:(o,a)=>(0,FZ.jsx)(swr,{repos:e,selected:t,onSelect:r,close:o,initialFilter:a})})})}var QEr=E(le(),1);var $Z=E(le(),1);function zbe(e){let[t,r]=(0,$Z.useState)([]),[n,i]=(0,$Z.useState)(!0),o=gr();return(0,$Z.useEffect)(()=>{if(!e){r([]),i(!1);return}let a=!1;return i(!0),hr(Xr(`/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 tqe=E(F(),1);function rqe({text:e}){return(0,tqe.jsx)(X,{sx:{p:1.5},children:(0,tqe.jsx)(Le,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var D6=E(F(),1);function WEr({pr:e,highlighted:t,onHover:r,onPick:n}){let i=obe(t);return(0,D6.jsx)(pn,{ref:i,selected:t,onMouseDown:o=>o.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,D6.jsxs)(_t,{spacing:.25,sx:{minWidth:0},children:[(0,D6.jsxs)(Le,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,D6.jsx)(Un,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,D6.jsxs)(Le,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",zi(e.createdAt)]})]})})}var nqe=E(F(),1);function GEr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,nqe.jsx)(Yp,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((i,o)=>(0,nqe.jsx)(WEr,{pr:i,highlighted:o===t,onHover:()=>r(o),onPick:n},i.number))})}var qEr=E(le(),1);function VEr(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 jEr(e,t,r){let[n,i]=(0,qEr.useState)(""),o=VEr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=W_(o,n,t,r);return{filter:n,setFilter:i,filtered:o,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var o5=E(F(),1),YEr={...RF,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function KEr({cwd:e,onPick:t,close:r}){let{prs:n,loading:i}=zbe(e),o=jEr(n,t,r);return i||n.length===0?(0,o5.jsx)(on,{elevation:4,sx:YEr,children:(0,o5.jsx)(rqe,{text:i?"Loading open PRs\u2026":"No open PRs"})}):(0,o5.jsxs)(on,{elevation:4,sx:YEr,children:[(0,o5.jsx)(VT,{autoFocus:!0,value:o.filter,onChange:o.setFilter,onKeyDown:o.onKeyDown,placeholder:"Filter PRs..."}),o.filtered.length===0?(0,o5.jsx)(rqe,{text:"No PRs match"}):(0,o5.jsx)(GEr,{prs:o.filtered,highlight:o.highlight,onHighlight:o.setHighlight,onPick:o.select})]})}var ZEr=E(F(),1);function XEr({cwd:e,onPick:t,close:r}){return(0,ZEr.jsx)(KEr,{cwd:e,onPick:t,close:r})}var a5=E(F(),1);function JEr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:i}=zbe(e),[o,a]=(0,QEr.useState)(null);return i||n.length===0?null:(0,a5.jsxs)(a5.Fragment,{children:[(0,a5.jsx)(cye,{label:"prs",disabled:t,children:s=>(0,a5.jsx)(XEr,{cwd:e,onPick:a,close:s})}),o&&(0,a5.jsx)($0e,{pr:o,onSelect:s=>{r(o,s),a(null)},onCancel:()=>a(null)})]})}var t4r=E(F(),1);function e4r({onStartRun:e,cwd:t}){let r=iye(t);return!t||r.length===0?null:(0,t4r.jsx)(rye,{runs:r,onSelect:n=>e(n,t)})}var zZ=E(F(),1);function r4r({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=zn();return(0,zZ.jsxs)(_t,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,zZ.jsx)(JEr,{cwd:r,disabled:!r,onSelect:(i,o)=>e([...o,String(i.number)],r,{...fF(i),node:n})}),(0,zZ.jsx)(e4r,{onStartRun:(i,o)=>t(i,o,void 0,void 0,n),cwd:r})]})}var Lp=E(F(),1),pli={minHeight:48,pl:1,pr:14};function n4r({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=nC();return(0,Lp.jsxs)(cE,{variant:"dense",disableGutters:!0,sx:pli,children:[r&&(0,Lp.jsx)(Wne,{collapsed:r,onToggleCollapsed:n}),(0,Lp.jsx)(FEr,{reconnecting:e.reconnecting}),(0,Lp.jsx)(IEr,{cwd:t.selectedCwd}),(0,Lp.jsx)(TEr,{}),(0,Lp.jsx)(UEr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,Lp.jsxs)(X,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,Lp.jsx)(hye,{cwd:t.selectedCwd}),(0,Lp.jsx)(BEr,{cwd:t.selectedCwd}),(0,Lp.jsx)(NEr,{})]}),(0,Lp.jsx)(r4r,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var Hbe=E(le(),1);function i4r(){let[e,t]=(0,Hbe.useState)(null);return(0,Hbe.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await hr("/api/health")).json();!r&&typeof i?.nodeName=="string"&&t(i.nodeName)}catch{}})(),()=>{r=!0}},[]),e}var a4r=E(F(),1),mli={lineHeight:"32px",bgcolor:"transparent"};function o4r(){let e=i4r();return e?(0,a4r.jsx)(hSe,{sx:mli,children:e}):null}var s4r=E(F(),1),l4r=at((0,s4r.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 c4r=E(F(),1),u4r=at((0,c4r.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 f4r=E(F(),1),d4r=at((0,f4r.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 h4r=E(F(),1),p4r=at((0,h4r.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 iqe=E(F(),1);function m4r({mode:e}){return e==="dark"?(0,iqe.jsx)(p4r,{fontSize:"small"}):(0,iqe.jsx)(d4r,{fontSize:"small"})}var g4r=E(F(),1),y4r=at((0,g4r.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 iz=E(F(),1);function v4r(){let e=j0e();return(0,iz.jsxs)(pn,{onClick:()=>Y0t(!e),children:[(0,iz.jsx)(uT,{children:(0,iz.jsx)(y4r,{fontSize:"small"})}),(0,iz.jsx)(jp,{children:e?"Hide render HUD":"Show render HUD"})]})}var gl=E(F(),1);function b4r({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:i,onRestart:o,onUpdate:a}){return[(0,gl.jsxs)(pn,{onClick:n,children:[(0,gl.jsx)(uT,{children:(0,gl.jsx)(m4r,{mode:e})}),(0,gl.jsx)(jp,{children:"Toggle dark mode"})]},"color-mode"),(0,gl.jsx)(v4r,{},"render-hud"),(0,gl.jsxs)(pn,{onClick:i,children:[(0,gl.jsx)(uT,{children:(0,gl.jsx)(l4r,{fontSize:"small"})}),(0,gl.jsx)(jp,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,gl.jsx)(ni,{},"restart-divider"),(0,gl.jsxs)(pn,{onClick:o,children:[(0,gl.jsx)(uT,{children:(0,gl.jsx)(M7,{fontSize:"small"})}),(0,gl.jsx)(jp,{children:t})]},"restart"),(0,gl.jsxs)(pn,{onClick:a,children:[(0,gl.jsx)(uT,{children:(0,gl.jsx)(u4r,{fontSize:"small"})}),(0,gl.jsx)(jp,{children:r})]},"update")]}var x4r=E(le(),1);var T4r=E(F(),1);function S4r({peer:e,onRestart:t,onClose:r}){let[n,i]=(0,x4r.useState)(!1);return(0,T4r.jsx)(ki,{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 C4r(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 gli=Object.keys(E7);function w4r(){let e=R7();return C4r(gli.map(t=>XT(t,e)))}var Mp=E(F(),1),yli={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},vli={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function k4r({onClose:e}){let t=w4r();return(0,Mp.jsxs)(Xl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Mp.jsxs)(Lu,{id:"shortcuts-dialog-title",sx:yli,children:["Keyboard shortcuts",(0,Mp.jsx)(Qt,{size:"small","aria-label":"Close",onClick:e,children:(0,Mp.jsx)(Ao,{fontSize:"small"})})]}),(0,Mp.jsx)(Pu,{dividers:!0,children:t.map(r=>(0,Mp.jsxs)(X,{component:"section",sx:{mb:1.5},children:[(0,Mp.jsx)(Le,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Mp.jsxs)(X,{sx:vli,children:[(0,Mp.jsx)(Le,{variant:"body2",children:n.label}),(0,Mp.jsx)(_t,{direction:"row",spacing:.5,children:(0,Mp.jsx)(bne,{chords:n.chords})})]},n.label))]},r.name))})]})}var N6=E(F(),1);function _4r({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:i,restart:o}=D_(P$.target,e);return(0,N6.jsxs)(N6.Fragment,{children:[(0,N6.jsx)(ki,{title:P$.label,message:P$.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{o()},onCancel:t}),(0,N6.jsx)(ic,{error:n,onClose:i})]})}var R4r=E(F(),1);function bli(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 E4r({peer:e,onConfirm:t,onClose:r}){return(0,R4r.jsx)(ki,{...bli(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var V0=E(le(),1);async function xli(e){try{let t=await hr(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch{return null}}async function A4r(e,t){let r=await xli(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var BS=E(le(),1);function P4r(e){let{nodes:t}=Ic(),[r,n]=(0,BS.useState)(null),i=(0,BS.useRef)(!1),o=r?t?.links.find(l=>l.name===r.peer):void 0;(0,BS.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,BS.useCallback)((l,u)=>{i.current=!1,n({peer:l,describe:u})},[]),s=(0,BS.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var Sli=9e4;function Ube(){let[e,t]=(0,V0.useState)(null),[r,n]=(0,V0.useState)(null),i=(0,V0.useRef)(void 0),o=(0,V0.useCallback)(f=>{clearTimeout(i.current),t(f)},[]),{watch:a,stop:s}=P4r(o);(0,V0.useEffect)(()=>()=>clearTimeout(i.current),[]);let l=(0,V0.useCallback)(async(f,d)=>{n(await A4r(f,d))},[]);return{requestThenAwait:(0,V0.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`)},Sli),!0):(await l(f,`${d} failed (${await A$(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var Tli=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function L4r(){let{requestThenAwait:e,...t}=Ube();return{restart:n=>e(n,`Restart ${n}`,()=>I_("both",n),Tli),...t}}var HZ=E(le(),1);var q0=E(le(),1);function M4r(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function Wbe(e,t,r){let[n,i]=(0,q0.useState)(!1),[o,a]=(0,q0.useState)(!1),s=(0,q0.useRef)(!1),l=(0,q0.useRef)(e);l.current=e;let u=(0,q0.useRef)(new Set),f=(0,q0.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(M4r).map(d=>d.id)),i(!0)},[]);return(0,q0.useEffect)(()=>{if(!n||o)return;if(t){s.current=!0;return}if(!s.current)return;e.some(h=>M4r(h)&&h.node===r&&!u.current.has(h.id))&&a(!0)},[n,o,t,e,r]),{arm:f,completed:o}}var I4r=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function Cli(e){return hr(`/api/self-update?node=${encodeURIComponent(e)}`,{method:"POST"})}function D4r(e){let{nodes:t}=Ic(),{launchAssist:r}=fl(),{requestThenAwait:n,...i}=Ube(),[o,a]=(0,HZ.useState)(null),[s,l]=(0,HZ.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=Wbe(e,u(s)!=="connected",s);(0,HZ.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>I_("webserver",s),I4r))},[d,s,n]);let h=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>Cli(m),I4r),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 j0=E(F(),1);function N4r({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:i}){let{launchAssist:o,armUpdateReload:a}=fl(),s=L4r(),l=D4r(r);return(0,j0.jsxs)(j0.Fragment,{children:[e==="shortcuts"&&(0,j0.jsx)(k4r,{onClose:i}),e==="restart"&&t&&(0,j0.jsx)(S4r,{peer:t,onRestart:s.restart,onClose:i}),e==="restart"&&!t&&(0,j0.jsx)(_4r,{reconnecting:n,onClose:i}),e==="update"&&(0,j0.jsx)(E4r,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),o(["update"])},onClose:i}),(0,j0.jsx)(eZ,{notices:s}),(0,j0.jsx)(eZ,{notices:l})]})}var O4r=E(F(),1),B4r=at((0,O4r.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");var Gbe=E(F(),1),wli="https://staffordwilliams.com/assist";function F4r(){return(0,Gbe.jsx)(sr,{title:"Help",children:(0,Gbe.jsx)(Qt,{component:"a",href:wli,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,Gbe.jsx)(B4r,{fontSize:"small"})})})}var $4r=E(F(),1),z4r=at((0,$4r.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 H4r=E(le(),1);var UZ=E(F(),1);function U4r(){let e=Xn(),t=(0,H4r.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=Zn("openConfig");return Po(r,t),(0,UZ.jsx)(sr,{describeChild:!0,title:(0,UZ.jsx)(Fu,{label:"Config",chords:n}),children:(0,UZ.jsx)(Qt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,UZ.jsx)(z4r,{fontSize:"small"})})})}var W4r=E(F(),1),G4r=at((0,W4r.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var Vbe=E(le(),1);var WZ=E(F(),1);function V4r({open:e,onOpen:t}){let r=(0,Vbe.useRef)(null),{matches:n,chords:i}=Zn("openMenu");return Po(n,(0,Vbe.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,WZ.jsx)(sr,{describeChild:!0,title:(0,WZ.jsx)(Fu,{label:"Menu",chords:i}),children:(0,WZ.jsx)(Qt,{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,WZ.jsx)(G4r,{fontSize:"small"})})})}var oz=E(F(),1);function q4r({open:e,onOpen:t}){return(0,oz.jsxs)(X,{sx:{position:"fixed",top:8,right:16,zIndex:r=>r.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:r=>r.tokens.color.appBar?.text??r.palette.primary.contrastText},children:[(0,oz.jsx)(F4r,{}),(0,oz.jsx)(U4r,{}),(0,oz.jsx)(V4r,{open:e,onOpen:t})]})}var O6=E(le(),1);var Y4r=E(le(),1);var j4r=!0,kli=new Set(["openMenu","cycleCards"]),_li=Object.keys(E7).filter(e=>!kli.has(e));function K4r(e,t){let r=R7();(0,Y4r.useEffect)(()=>{if(!e)return;let n=i=>{_li.some(o=>XT(o,r).matches(i))&&t()};return globalThis.addEventListener("keydown",n,j4r),()=>globalThis.removeEventListener("keydown",n,j4r)},[e,t,r])}function X4r(){let[e,t]=(0,O6.useState)(null),[r,n]=(0,O6.useState)(!0),i=!!e,o=(0,O6.useCallback)(()=>t(null),[]),a=(0,O6.useCallback)(s=>{n(!0),t(s)},[]);return K4r(i,(0,O6.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:i,close:o,openAt:a,restoreFocus:r}}var GZ=E(le(),1);function Z4r(e){Po(Zn("shortcutsSheet").matches,e)}function Q4r(){let[e,t]=(0,GZ.useState)(null);Z4r((0,GZ.useCallback)(()=>t("shortcuts"),[]));let r=(0,GZ.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function J4r(){let{nodes:e,selected:t}=Ic();return e&&t&&t!==e.local?t:void 0}function e3r(e){return{restartLabel:e?`Restart ${e}`:P$.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var FS=E(F(),1);function t3r({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:i,open:o,close:a,openAt:s,restoreFocus:l}=X4r(),{dialog:u,showDialog:f,closeDialog:d}=Q4r(),h=J4r(),p=m=>()=>{a(),f(m)};return(0,FS.jsxs)(FS.Fragment,{children:[(0,FS.jsx)(q4r,{open:o,onOpen:s}),(0,FS.jsxs)($s,{anchorEl:i,open:o,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,FS.jsx)(o4r,{}),b4r({mode:e,...e3r(h),onToggleColorMode:()=>{t(),a()},onShowShortcuts:p("shortcuts"),onRestart:p("restart"),onUpdate:p("update")})]}),(0,FS.jsx)(N4r,{dialog:u,peer:h,sessions:r,reconnecting:n,onClose:d})]})}var i3r=E(le(),1);var n3r=E(F(),1);function r3r({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:i,port:o,group:a}=e.existing,s=tc(i),l=o?` on port ${o}`:"",u=s?` in ${s}`:"",f=a?`, holding the ${a} server slot`:"";return(0,n3r.jsx)(ki,{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 qbe=E(F(),1);function o3r({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:i,stopSession:o,startRun:a,discardSession:s}=e,l=(0,i3r.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,qbe.jsxs)(Xke.Provider,{value:l,children:[t,r&&(0,qbe.jsx)(r3r,{conflict:r,onConfirm:u,onCancel:n})]})}var a3r=new Map;function s3r(e,t){if(!Eoe())return;let r=a3r.get(e);if(a3r.set(e,t),!!r)for(let[n,i]of Object.entries(t))Object.is(i,r[n])||Ny(`\u0394 ${e}.${n}`)}var Ybe=E(le(),1);function l3r(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||um(i)!==t?null:n}function Uv(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function jbe(){let{pathname:e}=Vo();return e.startsWith("/backlog")||e.startsWith("/usage")}function c3r({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:i,onSelect:o}){let a=Uv(t,r,n),s=a&&um(a),l=!!(s&&s===e),u=l3r(i,e,r),f=(0,Ybe.useRef)(t),d=jbe();(0,Ybe.useEffect)(()=>{let h=f.current!==t&&!!s;f.current=t,!(d||h||l||!u)&&o(u)},[t,s,l,u,o,d])}var Zbe=E(le(),1);function u3r(e,t,r,n){return Uv(e,t,r)?.cwd||n}function f3r(e,t,r,n){let i=u3r(e,t,r,n.cwd),o=Uv(e,t,r);return{cwd:i,node:o?.cwd?o.node:n.node}}var oqe=E(le(),1);function d3r(e,t,r){let{cwd:n,node:i,origin:o}=r,a=(0,oqe.useCallback)((l,u)=>{let f=PS(u,t),d=TZ(e,l);return d?d.clones[f]:f===(l===n?i:Pp)?l:void 0},[e,t,n,i]),s=(0,oqe.useCallback)(l=>TZ(e,l)?.origin??(l===n?o:void 0),[e,n,o]);return{cloneOn:a,originOf:s}}var Kbe=E(le(),1);function h3r(e,t,r,n){let i=(0,Kbe.useRef)(e);(0,Kbe.useEffect)(()=>{if(i.current===e)return;i.current=e;let o=TZ(t,r)?.clones[e];o&&n(o,e)},[e,t,r,n])}var az=E(le(),1);function p3r(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(Pp)?Pp:[...n][0]}function m3r(e,t,r,n){let[i,o]=(0,az.useState)({cwd:e}),a=(0,az.useCallback)((l,u,f)=>o({cwd:l,node:u,origin:f}),[]);(0,az.useEffect)(()=>{e&&!i.cwd&&o({cwd:e})},[e,i.cwd]);let s=p3r(t,{cwd:i.cwd,node:i.node===void 0?void 0:PS(i.node,n)},r);return{selectedCwd:i.cwd,selectedNode:s||void 0,selectedPick:{cwd:i.cwd,node:s,origin:i.origin},setSelectedCwd:a}}var g3r=E(le(),1);function Xbe(e,t,r){let n=Uv(e,t,r);return n&&um(n)}function y3r(e,t,r,n){let i=Xbe(e,t,r),o=Uv(e,t,r),a=o?.node??Pp,s=o?.repoGroup?.origin;(0,g3r.useEffect)(()=>{i&&n(i,a,s)},[i,a,s,n])}function v3r(e,t,r,n,i){let o=i.nodes?.local,a=PS(i.selected,o),s=(0,Zbe.useMemo)(()=>Mwr(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=m3r(e,s,a,o);y3r(r,n,t,d),h3r(a,s,l,d);let{cloneOn:h,originOf:p}=d3r(s,o,f),m=(0,Zbe.useMemo)(()=>s.map(v=>Iwr(v,a)),[s,a]),{cwd:g,node:y}=f3r(r,n,t,{cwd:l,node:u});return(0,Zbe.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 Jbe=E(le(),1);var s5=E(le(),1);var b3r=E(le(),1),Qbe="assist:reloaded-after-update";function x3r(e){(0,b3r.useEffect)(()=>{globalThis.sessionStorage?.getItem(Qbe)&&(globalThis.sessionStorage.removeItem(Qbe),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function S3r(e,t,r,n){let{arm:i,completed:o}=Wbe(e,t),a=(0,s5.useRef)(!1),s=(0,s5.useCallback)(()=>{globalThis.sessionStorage?.setItem(Qbe,"1")},[]),{error:l,restart:u}=D_("webserver",t,s);return x3r(r),(0,s5.useEffect)(()=>{l&&n(l)},[l,n]),(0,s5.useEffect)(()=>{!o||a.current||(a.current=!0,u())},[o,u]),{armUpdateReload:(0,s5.useCallback)(()=>{a.current=!1,i()},[i])}}function T3r(e){let{armUpdateReload:t}=S3r(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=_y(e.selectSession),n=(0,Jbe.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=Xn(),o=(0,Jbe.useCallback)(a=>{e.selectSession(a),i("/sessions"),e.clearSuccess()},[i,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:o}}var C3r=E(le(),1);function w3r(e,t,r,n){let i=Xbe(e,t,r);(0,C3r.useEffect)(()=>{e&&i&&n({type:"set-active",cwd:i,sessionId:e})},[e,i,n])}var exe=E(le(),1);function k3r(e,t){let r=(0,exe.useRef)(new Map);(0,exe.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 sz=E(le(),1),_3r="assist.sessions.node";function Eli(){try{return localStorage.getItem(_3r)}catch{return null}}function Rli(e){try{localStorage.setItem(_3r,e)}catch{}}function E3r(e){let[t,r]=(0,sz.useState)(Eli),n=(0,sz.useCallback)(i=>{r(i),Rli(i)},[]);return(0,sz.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 A3r=E(le(),1);function R3r(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 P3r(e,t){return(0,A3r.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let i=R3r(r);i&&t(i)},[e,t])}var Wv=E(le(),1);function txe(e,t,r,n,i){e({type:"create",prompt:r||void 0,cwd:n,...t,...i?{node:i}:{}})}function L3r(e){return(t,r,n)=>txe(e,{design:!0},t,r,n)}function M3r(e){return(t,r,n,i)=>txe(e,{harness:t},r,n,i)}function I3r(e){return(t,r,n)=>txe(e,{auto:!0},t,r,n)}function D3r(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function N3r(e){return(t,r,n,i,o)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:i,node:o})}function O3r(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function B3r(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function F3r(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function $3r(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function z3r(e){return t=>e({type:"stop",sessionId:t})}function H3r(e){return(t,r,n,i,o)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:i,node:o})}function U3r(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function W3r(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function G3r(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function V3r(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:s6})}function q3r(e){return(t,r,n,i)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:s6,claim:i==="claim",refresh:i==="refresh"})}function j3r(e){return(t,r,n,i)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...i})}var B6=E(le(),1);function Y3r(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function K3r(e){return{createSession:(0,B6.useMemo)(()=>I3r(e),[e]),createSessionInStream:(0,B6.useMemo)(()=>Y3r(e),[e]),createDesignSession:(0,B6.useMemo)(()=>L3r(e),[e]),createHarnessSession:(0,B6.useMemo)(()=>M3r(e),[e]),createAssistSession:(0,B6.useMemo)(()=>D3r(e),[e]),resumeSession:(0,B6.useMemo)(()=>N3r(e),[e])}}var VZ=E(le(),1);function X3r(e,t){let r=(0,VZ.useCallback)((a,s)=>{O3r(e,t.current)(a,s)},[e,t]),n=(0,VZ.useCallback)(a=>{B3r(e,t.current)(a)},[e,t]),i=(0,VZ.useCallback)(a=>{F3r(e,t.current)(a)},[e,t]),o=(0,VZ.useCallback)(a=>{$3r(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:i,discardSession:o}}function Z3r(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 Q3r(e,t,r){let n={...K3r(e),sendInput:(0,Wv.useMemo)(()=>V3r(e),[e]),sendResize:(0,Wv.useMemo)(()=>q3r(e),[e]),sendPrDecision:(0,Wv.useMemo)(()=>j3r(e),[e]),setAutoApprove:(0,Wv.useMemo)(()=>U3r(e),[e]),setAutoAdvance:(0,Wv.useMemo)(()=>W3r(e),[e]),setStarred:(0,Wv.useMemo)(()=>G3r(e),[e]),stopSession:(0,Wv.useMemo)(()=>z3r(e),[e]),startRun:(0,Wv.useMemo)(()=>H3r(e),[e])},i=(0,Wv.useMemo)(()=>Z3r(e,t.current,r.current),[e,t,r]);return{...n,...X3r(e,t),onOutput:i}}var qZ=E(le(),1);function J3r(e,t,r){let n=(0,qZ.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),i=(0,qZ.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),o=(0,qZ.useCallback)(()=>{r(null)},[r]),a=(0,qZ.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:i,clearTranscript:o,selectSession:a}}var oxe=E(le(),1);function eRr(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 lz=E(le(),1);function tRr(){let[e,t]=(0,lz.useState)(null),r=(0,lz.useRef)(e);r.current=e;let n=(0,lz.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var nRr=E(le(),1);function rRr(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 iRr(e,t,r){let n=jbe();(0,nRr.useEffect)(()=>{if(n){t(null);return}t(i=>rRr(e,i,r))},[e,t,r,n])}var rxe=E(le(),1);function oRr(){let[e,t]=(0,rxe.useState)({}),[r,n]=(0,rxe.useState)(null),[i,o]=(0,rxe.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:i,setNodes:o}}var Y0=E(le(),1);function aRr(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function sRr(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function lRr(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 cRr(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 uRr(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var Ali=1500;function fRr(){let[e,t]=(0,Y0.useState)(new Set),r=(0,Y0.useRef)(new Map),n=(0,Y0.useRef)(new Map),i=(0,Y0.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),o=(0,Y0.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),i(u)},Ali))},[i]);(0,Y0.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,Y0.useCallback)(s=>{let l=sRr(r.current,s),u=[...cRr(r.current,s),...l],f=uRr(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),aRr(n.current,l),u.length&&t(d=>lRr(d,u)),o(f)},[o]);return{initialized:e,markInitialized:i,syncSessions:a}}var l5=E(le(),1);function dRr(){let[e,t]=(0,l5.useState)(null),[r,n]=(0,l5.useState)(null),[i,o]=(0,l5.useState)(null),a=(0,l5.useCallback)(()=>t(null),[]),s=(0,l5.useCallback)(()=>n(null),[]),l=(0,l5.useCallback)(()=>o(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:i,setServerConflict:o,clearServerConflict:l}}var Gv=E(le(),1);function hRr(e,t){return[...e,{...t,status:"launching"}]}function nxe(e){return e.find(t=>t.status==="launching")}function pRr(e){let t=nxe(e);return t?e.filter(r=>r.id!==t.id):e}function mRr(e,t){let r=nxe(e);return r?aqe(e,r.id,t):e}function aqe(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function gRr(e,t){return e.filter(r=>r.id!==t)}var yRr=E(le(),1);var Pli=6e4,Lli="Launch timed out \u2014 the session did not start.";function vRr(e,t){(0,yRr.useEffect)(()=>{let r=e.filter(i=>i.status==="launching");if(r.length===0)return;let n=r.map(i=>setTimeout(()=>t(o=>aqe(o,i.id,Lli)),Math.max(0,Pli-(Date.now()-i.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function bRr(){let[e,t]=(0,Gv.useState)([]),r=(0,Gv.useRef)([]),n=(0,Gv.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),i=(0,Gv.useCallback)(l=>{n(u=>hRr(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),o=(0,Gv.useCallback)(()=>{let l=nxe(r.current);return n(pRr),l?.named?l.title:void 0},[n]),a=(0,Gv.useCallback)(l=>n(u=>mRr(u,l)),[n]),s=(0,Gv.useCallback)(l=>n(u=>gRr(u,l)),[n]);return vRr(e,n),{pendingLaunches:e,addPendingLaunch:i,resolvePendingLaunch:o,failPendingLaunch:a,dismissPendingLaunch:s}}var jZ=E(le(),1);function xRr(){let[e,t]=(0,jZ.useState)(null),[r,n]=(0,jZ.useState)({}),i=(0,jZ.useCallback)((o,a)=>{o!=="claude"&&n(s=>({...s,[o]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:i}}var SRr=E(le(),1);function TRr(e,t){return(0,SRr.useCallback)(r=>{e(r),t(r)},[e,t])}var sqe=E(le(),1);function CRr(){let e=(0,sqe.useRef)(new Map),t=(0,sqe.useRef)(new Map);return{buffers:e,handlers:t}}var ixe=E(le(),1);function wRr(){let[e,t]=(0,ixe.useState)(null),[r,n]=(0,ixe.useState)(null),[i,o]=(0,ixe.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:i,setUserMessages:o}}var c5=E(le(),1);function kRr(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function _Rr(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 ERr(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function RRr(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function ARr(e,t){t.setNodes({local:e.local,links:e.links??[]})}function PRr(e,t){t.setSuccess({message:e.message,sessionId:null})}function LRr(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 MRr(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function IRr(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function DRr(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var Mli={sessions:IRr,created:_Rr,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:ARr,error:ERr,notice:PRr,"run-conflict":MRr,limits:RRr,clear:kRr,output:LRr,snapshot:DRr};function NRr(e,t){Mli[e.type]?.(e,t)}function ORr(e,t={}){let r=new WebSocket(qat("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{NRr(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function BRr(e,t,r,n){let i=!1,o,a=0,s=!1,l=()=>{i||t(ORr(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 FRr(e){let t=(0,c5.useRef)(null),[r,n]=(0,c5.useState)(!1),{handleSessions:i,markInitialized:o,buffers:a,handlers:s}=e;(0,c5.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let h of d.values())h("\x1Bc")},f=BRr({...e,setSessions:i},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[i,o,a,s]);let l=(0,c5.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function $Rr(){let[e,t]=(0,oxe.useState)([]),[r,n]=(0,oxe.useState)([]),{activeId:i,setActiveId:o,getActiveId:a}=tRr(),s=oRr(),l=wRr(),[u,f]=(0,oxe.useState)(""),d=dRr(),h=bRr(),p=xRr(),{initialized:m,markInitialized:g,syncSessions:y}=fRr(),v=CRr(),b=TRr(y,t),{wsRef:x,requestHistory:C,reconnecting:T}=FRr({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:o,...s,...l,setCurrentCwd:f,...d,...h,...p,markInitialized:g,...v});return iRr(e,o,eRr(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:T}}function axe(){let e=$Rr(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:i,activeId:o,sessions:a}=e,s=E3r(e.nodes),l=P3r(t,i),u=Q3r(l,r,n);w3r(o,a,e.history,l),k3r(a,l);let f=J3r(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var cz=E(le(),1);var zRr="assist:sidebar-collapsed";function HRr(){let[e,t]=(0,cz.useState)(()=>rf(zRr).length>0),r=(0,cz.useCallback)(()=>{t(n=>{let i=!n;return nf(zRr,i?[!0]:[]),i})},[]);return(0,cz.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var URr=E(le(),1);function WRr(){(0,URr.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await hr("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||HE.set(r)}catch{}})(),()=>{e=!0}},[])}function GRr(){let e=axe(),t=r0e(e),r=v3r(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);c3r({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:i}=T3r(e);WRr();let o=HRr();return s3r("shell",{...e,selection:r,launch:n,sidebarCollapse:o}),{socket:e,selection:r,launch:n,viewLaunchedSession:i,sidebarCollapse:o}}var yg=E(F(),1),Ili={zIndex:e=>e.zIndex.drawer+1},Dli={minHeight:48};function VRr({mode:e,toggle:t}){let r=GRr(),{socket:n,selection:i,viewLaunchedSession:o}=r;return(0,yg.jsx)(vEr,{shell:r,children:(0,yg.jsxs)(VVe.Provider,{value:n.daemonVersion,children:[(0,yg.jsx)(t3r,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,yg.jsx)(Z2e,{position:"fixed",sx:Ili,"data-testid":"toolbar",children:(0,yg.jsx)(n4r,{socket:n,selection:i})}),(0,yg.jsx)(cE,{variant:"dense",sx:Dli}),(0,yg.jsx)(o3r,{socket:n,children:(0,yg.jsx)(h_r,{socket:n})}),(0,yg.jsx)(K_r,{socket:n}),(0,yg.jsx)(gEr,{socket:n,onViewLaunchedSession:o})]})})}var qRr=E(le(),1);function jRr(){let[e,t]=(0,qRr.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})}}function YRr({color:e,radius:t}){return{MuiMenu:{styleOverrides:{paper:{borderRadius:t.md},list:{padding:4}}},MuiMenuItem:{styleOverrides:{root:{minHeight:30,padding:"5px 10px",borderRadius:4,fontSize:13,"&:hover":{backgroundColor:e.raised},"& .MuiListItemIcon-root":{minWidth:28},"& .MuiSvgIcon-root":{fontSize:16},"& .MuiListItemText-primary":{fontSize:13}}}}}}function KRr(e){let{color:t,radius:r,elevation:n,type:i}=e,o={border:`1px solid ${t.line}`};return{...YRr(e),MuiTooltip:{styleOverrides:{tooltip:{...o,backgroundColor:t.overlay.background,color:t.overlay.text,borderRadius:r.md,boxShadow:n.overlay,fontSize:`${i.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:t.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...o,boxShadow:n.overlay}}},MuiBackdrop:{styleOverrides:{root:{"&:not(.MuiBackdrop-invisible)":{backgroundColor:t.scrim,backdropFilter:"blur(2px)"}}}},MuiDialog:{styleOverrides:{paper:{...o,backgroundColor:t.surface,borderRadius:r.md+4,boxShadow:n.dialog}}}}}var XRr=({variant:e})=>e==="outlined"||e==="tonal",ZRr=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:XRr,style:{padding:"5px 11px"}},{props:e=>XRr(e)&&e.size==="small",style:{padding:"3px 8px"}}];var sxe=["primary","secondary","success","warning","error","info"];function YZ(e,t){return{backgroundColor:Dr(e,t),borderColor:Dr(e,.35),color:e}}function QRr({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}}},...sxe.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...YZ(e[t].main,.16),"&:hover":YZ(e[t].main,.24)}}))]}var JRr={"& > *:nth-of-type(1)":{fontSize:16}};function eAr(e){let{color:t,radius:r}=e;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:30,padding:"6px 12px",borderRadius:r.sm,fontSize:13,fontWeight:600,lineHeight:"18px"},startIcon:{marginLeft:-2,marginRight:6,...JRr},endIcon:{marginLeft:6,marginRight:-2,...JRr}},variants:[...ZRr,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...QRr(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Dr(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Dr(t.error.main,.1)}}}]}}}function lqe({color:e},t){return[{props:{variant:t,color:"default"},style:{backgroundColor:"transparent",border:`1px solid ${e.line}`,color:e.text.secondary,"&.MuiChip-clickable:hover":{backgroundColor:e.raised}}},...sxe.map(r=>({props:{variant:t,color:r},style:{...YZ(e[r].main,.14),borderColor:"transparent","& .MuiChip-deleteIcon":{color:Dr(e[r].main,.7),"&:hover, &:active":{color:e[r].main}},"&.MuiChip-clickable:hover":{backgroundColor:Dr(e[r].main,.22)}}}))]}function tAr(e){return{MuiChip:{styleOverrides:{root:{height:20,fontSize:11,fontWeight:600,borderRadius:999},sizeSmall:{height:20,"& .MuiChip-label":{padding:"0 7px"}},label:{padding:"0 8px"},icon:{fontSize:14,marginLeft:6,marginRight:-2},deleteIcon:{fontSize:14,marginLeft:-2,marginRight:4},outlined:{borderColor:e.color.line}},variants:[...lqe(e,"tonal"),...lqe(e,"filled")]}}}function rAr(e){return{...eAr(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...tAr(e)}}var cqe=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,Nli={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:cqe(8)},"&.Mui-selected":{color:"inherit",backgroundColor:cqe(12),boxShadow:`inset 0 0 0 1px ${cqe(18)}`}}};function nAr({color:e,radius:t}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:t.sm,textTransform:"none",fontSize:13,fontWeight:500,opacity:1,color:e.text.secondary,"&:hover":{backgroundColor:e.raised,color:e.text.primary},"&.Mui-selected":{color:e.text.primary,backgroundColor:e.raised,boxShadow:`inset 0 0 0 1px ${e.line}`},...!e.appBar&&Nli}}}}}var iAr=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function oAr({color:e,radius:t}){return{MuiIconButton:{styleOverrides:{root:{...iAr(30,18),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:iAr(26,16)},{props:{color:"default"},style:{color:e.text.secondary,"&:hover":{color:e.text.primary},...!e.appBar&&{".MuiAppBar-root &, .MuiAppBar-root &:hover":{color:"inherit"}}}}]}}}function aAr({color:e,radius:t}){return{MuiToggleButtonGroup:{styleOverrides:{root:{padding:2,gap:2,border:`1px solid ${e.line}`,borderRadius:t.sm,backgroundColor:e.background},grouped:{margin:0,border:0,borderRadius:4}}},MuiToggleButton:{styleOverrides:{root:{padding:"3px 8px",border:0,borderRadius:4,fontSize:13,fontWeight:500,lineHeight:"18px",textTransform:"none",color:e.text.secondary,"& .MuiSvgIcon-root":{fontSize:16},"&:hover":{backgroundColor:"transparent",color:e.text.primary},"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:e.raised,color:e.text.primary}}}}}}var lxe=".MuiOutlinedInput-notchedOutline";function sAr({color:e,radius:t}){return{MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:e.background,borderRadius:t.sm,fontSize:13,color:e.text.primary,[`& ${lxe}`]:{borderColor:e.line},[`&:hover ${lxe}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${lxe}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${lxe}`]:{borderColor:e.error.main}}}},MuiInputLabel:{styleOverrides:{root:{fontSize:13,color:e.text.secondary,"&.Mui-focused":{color:e.primary.main}}}},MuiSelect:{styleOverrides:{icon:{color:e.text.disabled}}}}}function lAr({color:e}){return{MuiSwitch:{styleOverrides:{root:{width:34,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:2,color:e.text.secondary,"&.Mui-checked":{transform:"translateX(14px)",color:e.primary.contrastText},"&.Mui-checked + .MuiSwitch-track":{backgroundColor:e.primary.main,opacity:1}},"& .MuiSwitch-thumb":{width:16,height:16,boxShadow:"none"},"& .MuiSwitch-track":{borderRadius:10,backgroundColor:e.line,opacity:1}}}},MuiFormControlLabel:{styleOverrides:{root:{"&:has(.MuiSwitch-root)":{marginLeft:0,gap:8}}}}}}function cAr(e){let{appBar:t}=e.color;return{...KRr(e),...rAr(e),...oAr(e),...aAr(e),...sAr(e),...lAr(e),...nAr(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 Vv="#0e1116",uqe="#141820",cxe="#1b202a",uxe="#e3e7ee",fqe="#8a93a3",KZ="#8b9cff",fxe="#5fd0a0",dxe="#f2b45a",hxe="#f27a7a",uAr={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)"},pxe={dark:{color:{background:Vv,surface:uqe,raised:cxe,line:"#262c37",lineSoft:"#1d222b",text:{primary:uxe,secondary:fqe,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:Vv,stripe:cxe,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:cxe,text:uxe},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:uqe,text:uxe},onAppBar:{...uAr,secondary:fqe,level:{ok:fxe,warn:dxe,over:hxe}},statusBar:{background:uqe,text:fqe,hoverText:uxe,secondary:"#5c6473",hover:cxe,active:"transparent",dot:KZ,dotRing:"rgba(139, 156, 255, 0.14)",readyText:KZ,level:{ok:fxe,warn:dxe,over:hxe}},primary:{main:KZ,contrastText:Vv},secondary:{main:"#c99bff",contrastText:Vv},success:{main:fxe,contrastText:Vv},warning:{main:dxe,contrastText:Vv},error:{main:hxe,contrastText:Vv},info:{main:"#6cb6ff",contrastText:Vv}},terminal:{background:Vv,foreground:"#d6dbe4",cursor:KZ,cursorAccent:Vv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:hxe,green:fxe,yellow:dxe,blue:KZ,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)",stuckHeader:"0 8px 8px -9px rgba(0, 0, 0, 0.8)"}},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:{warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)"},well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",codeWash:"rgba(0, 0, 0, 0.06)",overlay:{background:"rgba(97, 97, 97, 0.92)",text:"#fff"},onAppBar:{...uAr,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"},scrim:"rgba(15, 23, 42, 0.32)",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"}}},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:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)",stuckHeader:"0 6px 6px -7px rgba(0, 0, 0, 0.2)"}},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 $S=e=>`${e/16}rem`;function fAr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:$S(r.button)},caption:{fontSize:$S(r.caption)},body2:{fontSize:$S(r.body2)},body1:{fontSize:$S(r.body1)},subtitle2:{fontSize:$S(r.subtitle2)},subtitle1:{fontSize:$S(r.subtitle1)},h6:{fontSize:$S(r.h6)},h5:{fontSize:$S(r.h5)},h4:{fontSize:$S(r.h4)}}}function dAr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function Oli(e){let{dark:t,light:r,...n}=pxe;return{...n,...e==="dark"?t:r,mode:e}}function hAr(e){let t=Oli(e),{color:r}=t;return iy({tokens:t,palette:{mode:e,background:{default:r.background,paper:r.surface},primary:r.primary,secondary:r.secondary,success:r.success,warning:r.warning,error:r.error,info:r.info,text:r.text,divider:r.line,action:{hover:r.raised,selected:r.selected}},typography:fAr(t),shape:{borderRadius:t.radius.sm},spacing:t.spacing,components:{...dAr(t),...cAr(t)}})}function pAr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=pxe;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}fz();fz();var gqe=z6("Preferences",{web:()=>Promise.resolve().then(()=>(xAr(),bAr)).then(e=>new e.PreferencesWeb)});var mxe=E(le(),1);var yqe=E(le(),1);var TAr=E(F(),1);function SAr({value:e,error:t,onChange:r}){return(0,TAr.jsx)(Gn,{autoFocus:!0,label:"Node URL",placeholder:"https://mac.tail1234.ts.net:3100",value:e,onChange:n=>r(n.target.value),error:!!t,helperText:t,slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off",inputMode:"url"}}})}var Gli=/^[a-z]+:[/]{2}/i;function CAr(e){let t=e.trim(),r=Gli.test(t)?t:`https://${t}`;try{let n=new URL(r);return n.protocol!=="https:"&&n.protocol!=="http:"?void 0:n.origin}catch{return}}var u5=E(F(),1),Vli={height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",p:2,bgcolor:"background.default"};function wAr({onSave:e}){let[t,r]=(0,yqe.useState)(""),[n,i]=(0,yqe.useState)();return(0,u5.jsx)(X,{component:"form",onSubmit:a=>{a.preventDefault();let s=CAr(t);s?e(s):i("Enter an http(s) URL, e.g. https://mac.tail1234.ts.net:3100")},sx:Vli,children:(0,u5.jsxs)(_t,{spacing:2,sx:{width:"100%",maxWidth:420},children:[(0,u5.jsx)(Le,{variant:"h6",children:"Connect to a home node"}),(0,u5.jsx)(Le,{variant:"body2",color:"text.secondary",children:"Enter the Tailscale URL of the assist web server to view its sessions and those of the nodes it links to."}),(0,u5.jsx)(SAr,{value:t,error:n,onChange:a=>{r(a),i(void 0)}}),(0,u5.jsx)(Mt,{type:"submit",variant:"contained",disabled:!t.trim(),children:"Connect"})]})})}var RAr=E(F(),1),kAr="homeNodeUrl",_Ar=F6.isNativePlatform();function EAr({children:e}){let[t,r]=(0,mxe.useState)(_Ar?void 0:""),n=i=>{Vat(i),r(i)};return(0,mxe.useEffect)(()=>{_Ar&&gqe.get({key:kAr}).then(({value:i})=>{i?n(i):r(null)}).catch(()=>r(null))},[]),t===void 0?null:t===null?(0,RAr.jsx)(wAr,{onSave:i=>{gqe.set({key:kAr,value:i}),n(i)}}):e}fz();var gxe=F6.isNativePlatform();var S6r=E(le(),1);var IAr=E(le(),1);var qv={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var AAr=E(F(),1),PAr=at((0,AAr.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeft");var yxe=E(F(),1),qli={minHeight:44,px:.5,gap:.25,color:"primary.main",fontSize:16,borderRadius:1};function f5({label:e,to:t}){let r=Xn();return(0,yxe.jsxs)(Or,{sx:qli,onClick:()=>r(t),children:[(0,yxe.jsx)(PAr,{}),e]})}var jli={width:"100%",display:"grid",gridTemplateColumns:"18px 1fr auto",columnGap:1.25,rowGap:.25,alignItems:"start",textAlign:"left",px:2,py:1.375,borderBottom:1,borderColor:e=>e.tokens.color.lineSoft};function vxe(e){return{...jli,bgcolor:e==="waiting"?r=>r.tokens.color.wash.warning:e==="error"?r=>r.tokens.color.wash.error:"background.default"}}var bxe={gridColumn:2,gridRow:1,fontSize:16,fontWeight:500,lineHeight:"21px",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",minWidth:0},xxe={gridColumn:3,gridRow:"1 / span 3",alignSelf:"center",color:"text.disabled"},Sxe={gridColumn:2,display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75,fontSize:13,color:"text.secondary",minWidth:0},LAr={gridColumn:2,mt:.25,fontSize:14,lineHeight:"19px",color:"text.primary",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"pre-line"};var zS=E(F(),1);function MAr({entry:e,localNode:t}){let r=Xn();return(0,zS.jsxs)(Or,{sx:vxe("done"),onClick:()=>r(`/history/${e.sessionId}`),children:[(0,zS.jsx)(X,{sx:bxe,children:e.title??e.name}),(0,zS.jsx)(Vs,{fontSize:"small",sx:xxe}),(0,zS.jsxs)(X,{sx:Sxe,children:[(0,zS.jsx)("span",{children:tc(e.cwd)}),(0,zS.jsx)("span",{children:zi(e.timestamp)}),e.node&&e.node!==t&&(0,zS.jsx)(X,{component:"span",sx:Wa("neutral"),children:e.node})]})]})}var HS=E(F(),1),Yli={flex:"none",pt:qv.top,bgcolor:"background.default"},Kli={height:44,display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",columnGap:1,alignItems:"center",px:1},Xli={textAlign:"center",minWidth:0,maxWidth:220},Zli={fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Qli={fontSize:12,color:"text.secondary",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function jv({left:e,title:t,subtitle:r,right:n}){return(0,HS.jsx)(X,{component:"header",sx:Yli,children:(0,HS.jsxs)(X,{sx:Kli,children:[(0,HS.jsx)(X,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,HS.jsxs)(X,{sx:Xli,children:[(0,HS.jsx)(X,{sx:Zli,children:t}),r&&(0,HS.jsx)(X,{sx:Qli,children:r})]}),(0,HS.jsx)(X,{sx:{justifySelf:"end",display:"flex",gap:.25},children:n})]})})}var US=E(F(),1),Jli={flex:1,minHeight:0,overflowY:"auto",pb:qv.bottom};function DAr({history:e,localNode:t,requestHistory:r}){return(0,IAr.useEffect)(()=>r(),[r]),(0,US.jsxs)(US.Fragment,{children:[(0,US.jsx)(jv,{left:(0,US.jsx)(f5,{label:"Sessions",to:"/"}),title:"History"}),(0,US.jsx)(X,{sx:Jli,children:e.map(n=>(0,US.jsx)(MAr,{entry:n,localNode:t},`${n.node??""}:${n.sessionId}`))})]})}var NAr=E(F(),1),OAr=at((0,NAr.jsx)("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z"}),"History");var VAr=E(le(),1);var dz=e=>e.tokens.color.raised;var Txe=E(F(),1),eci={display:"inline-flex",alignItems:"center",gap:.75,height:32,px:1.25,borderRadius:"16px",border:1,borderColor:"divider",bgcolor:dz,fontFamily:"fontFamilyMono",fontSize:13,maxWidth:120,overflow:"hidden",whiteSpace:"nowrap"};function BAr({name:e,reconnecting:t}){return(0,Txe.jsxs)(X,{sx:eci,"data-testid":"phone-node-chip",children:[(0,Txe.jsx)(X,{sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:r=>t?r.palette.warning.main:r.palette.success.main}}),e??"\u2026"]})}var HAr=E(le(),1);function FAr(e){let t={needsYou:[],running:[],done:[]};for(let r of e){let n=Gs(r);n==="waiting"||n==="error"?t.needsYou.push(r):n==="running"?t.running.push(r):t.done.push(r)}return t}var d5=E(F(),1),tci={width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",px:2,py:1.5,fontSize:15,color:"text.secondary",borderBottom:1,borderColor:e=>e.tokens.color.lineSoft};function $Ar({count:e,expanded:t,onToggle:r}){return(0,d5.jsxs)(Or,{sx:tci,onClick:r,"aria-expanded":t,children:[(0,d5.jsxs)(X,{component:"span",sx:{display:"flex",gap:1},children:[(0,d5.jsx)(X,{component:"span",sx:{color:Tf.done},children:wd.done}),"Done",(0,d5.jsx)(X,{component:"span",sx:{fontFamily:"fontFamilyMono"},children:e})]}),t?(0,d5.jsx)(h8,{fontSize:"small"}):(0,d5.jsx)(ns,{fontSize:"small"})]})}var H6=E(F(),1);function Cxe({session:e,localNode:t}){let r=e.activity?.kind==="backlog"?e.activity.itemId:void 0,n=e.node&&e.node!==t?e.node:void 0;return(0,H6.jsxs)(H6.Fragment,{children:[r!==void 0&&(0,H6.jsx)(X,{component:"span",sx:Wa("primary"),children:wi(r)}),n&&(0,H6.jsx)(X,{component:"span",sx:Wa("neutral"),"data-testid":"node-badge",children:n})]})}function wxe({activity:e}){if(!(e?.kind!=="backlog"||!e.phase))return e.totalPhases?`${e.phase}/${e.totalPhases}`:`${e.phase}`}var K0=E(F(),1);function rci(e){return e.status==="error"?e.error:e.pendingPrPreview?.title??e.lastAssistantMessage}function kxe({session:e,localNode:t,showMessage:r}){let n=Xn(),i=Gs(e),o=tc(e.cwd),a=wxe(e),s=r?rci(e):void 0;return(0,K0.jsxs)(Or,{sx:vxe(i),onClick:()=>n(`/session/${e.id}`),"data-testid":"phone-session-row",children:[(0,K0.jsx)($ne,{status:i}),(0,K0.jsx)(X,{sx:bxe,children:rC(e)}),(0,K0.jsx)(Vs,{fontSize:"small",sx:xxe}),(0,K0.jsxs)(X,{sx:Sxe,children:[o&&(0,K0.jsx)("span",{children:o}),a&&(0,K0.jsx)("span",{children:a}),(0,K0.jsx)(Cxe,{session:e,localNode:t})]}),s&&(0,K0.jsx)(X,{sx:LAr,children:s})]})}var ZZ=E(F(),1),nci={display:"flex",justifyContent:"space-between",alignItems:"baseline",px:2,pt:1.75,pb:.75,fontSize:13,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"};function zAr({label:e,count:t,attention:r}){return(0,ZZ.jsxs)(X,{sx:{...nci,color:r?"warning.main":"text.secondary"},children:[(0,ZZ.jsx)("span",{children:e}),(0,ZZ.jsx)(X,{component:"span",sx:{fontFamily:"fontFamilyMono"},children:t})]})}var U6=E(F(),1);function vqe({label:e,sessions:t,localNode:r,attention:n}){return t.length===0?null:(0,U6.jsxs)(U6.Fragment,{children:[(0,U6.jsx)(zAr,{label:e,count:t.length,attention:n}),t.map(i=>(0,U6.jsx)(kxe,{session:i,localNode:r,showMessage:n},i.id))]})}var Yv=E(F(),1),ici={p:4,textAlign:"center",color:"text.secondary",fontSize:15};function UAr({sessions:e,localNode:t}){let[r,n]=(0,HAr.useState)(!1);if(e.length===0)return(0,Yv.jsx)(X,{sx:ici,children:"No sessions"});let{needsYou:i,running:o,done:a}=FAr(e);return(0,Yv.jsxs)(Yv.Fragment,{children:[(0,Yv.jsx)(vqe,{label:`${wd.waiting} Needs you`,sessions:i,localNode:t,attention:!0}),(0,Yv.jsx)(vqe,{label:"Running",sessions:o,localNode:t}),a.length>0&&(0,Yv.jsx)($Ar,{count:a.length,expanded:r,onToggle:()=>n(s=>!s)}),r&&a.map(s=>(0,Yv.jsx)(kxe,{session:s,localNode:t},s.id))]})}var bqe=E(F(),1);function WAr({pull:e,refreshing:t}){return e<=0&&!t?null:(0,bqe.jsx)(X,{sx:{display:"flex",justifyContent:"center",py:1},children:(0,bqe.jsx)($i,{size:20,variant:t?"indeterminate":"determinate",value:Math.min(100,e)})})}var QZ=E(le(),1),oci=70,aci=100,sci=800;function GAr(e,t){let[r,n]=(0,QZ.useState)(0),[i,o]=(0,QZ.useState)(!1);return(0,QZ.useEffect)(()=>{let a=e.current;if(!a)return;let s=null,l=0,u=h=>{s=a.scrollTop<=0?h.touches[0].clientY:null},f=h=>{s!==null&&(l=Math.min(aci,h.touches[0].clientY-s),n(Math.max(0,l)))},d=()=>{s!==null&&l>=oci&&(o(!0),t(),setTimeout(()=>o(!1),sci)),s=null,l=0,n(0)};return a.addEventListener("touchstart",u,{passive:!0}),a.addEventListener("touchmove",f,{passive:!0}),a.addEventListener("touchend",d,{passive:!0}),()=>{a.removeEventListener("touchstart",u),a.removeEventListener("touchmove",f),a.removeEventListener("touchend",d)}},[e,t]),{pull:r,refreshing:i}}var vg=E(F(),1),lci={flex:1,minHeight:0,overflowY:"auto",WebkitOverflowScrolling:"touch",pb:qv.bottom};function qAr({sessions:e,localNode:t,reconnecting:r,onRefresh:n}){let i=Xn(),o=(0,VAr.useRef)(null),{pull:a,refreshing:s}=GAr(o,n);return(0,vg.jsxs)(vg.Fragment,{children:[(0,vg.jsx)(jv,{left:(0,vg.jsx)(BAr,{name:t,reconnecting:r}),title:"Sessions",right:(0,vg.jsx)(Qt,{"aria-label":"History",sx:{color:"primary.main"},onClick:()=>i("/history"),children:(0,vg.jsx)(OAr,{})})}),(0,vg.jsxs)(X,{ref:o,sx:lci,children:[(0,vg.jsx)(WAr,{pull:a,refreshing:s}),(0,vg.jsx)(UAr,{sessions:e,localNode:t})]})]})}var jAr={label:"\u23CE",data:"\r"},YAr={label:"esc",data:"\x1B"},KAr={label:"\u2191",data:"\x1B[A"},XAr={label:"\u2193",data:"\x1B[B"};function ZAr(e){return e?[{label:"1",data:"1"},{label:"2",data:"2"},{label:"3",data:"3"},KAr,XAr,jAr,YAr]:[YAr,{label:"tab",data:" "},{label:"\u21E7tab",data:"\x1B[Z"},KAr,XAr,{label:"\u2303C",data:"",warn:!0},{label:"/",data:"/"},jAr]}var xqe=E(F(),1),cci={flex:"none",display:"flex",gap:.75,px:1,py:.75,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},bgcolor:"background.paper",borderTop:1,borderColor:"divider"},uci={flex:"none",minWidth:44,height:36,px:1,borderRadius:1,border:1,borderColor:"divider",bgcolor:dz,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13},fci=e=>e.preventDefault();function QAr({waiting:e,onKey:t}){return(0,xqe.jsx)(X,{sx:cci,"data-testid":"phone-key-strip",children:ZAr(e).map(r=>(0,xqe.jsx)(Or,{sx:{...uci,...r.warn&&{color:"error.main"}},onPointerDown:fci,onClick:()=>t(r.data),children:r.label},r.label))})}var JAr=E(le(),1);var hz=E(F(),1),dci={flex:"none",display:"flex",alignItems:"flex-end",gap:1,px:1.5,py:1.25,bgcolor:"background.paper"},hci={flex:1,minHeight:40,px:1.75,py:1,borderRadius:"20px",border:1,borderColor:"divider",bgcolor:"background.default",fontSize:16,"&.Mui-focused":{borderColor:"primary.main"}},pci={width:40,height:40,flex:"none",bgcolor:"primary.main",color:"primary.contrastText","&:hover":{bgcolor:"primary.main"},"&.Mui-disabled":{bgcolor:dz,color:"text.disabled"}},mci=e=>e.preventDefault();function e6r({onSend:e}){let[t,r]=(0,JAr.useState)(""),n=()=>{t.trim()&&(e(t),r(""))};return(0,hz.jsxs)(X,{sx:dci,children:[(0,hz.jsx)(Kl,{multiline:!0,maxRows:5,value:t,onChange:i=>r(i.target.value),placeholder:"Reply to Claude\u2026",sx:hci,inputProps:{"aria-label":"Reply"}}),(0,hz.jsx)(Qt,{"aria-label":"Send",sx:pci,disabled:!t.trim(),onPointerDown:mci,onClick:n,children:(0,hz.jsx)(Cve,{fontSize:"small"})})]})}var pz=E(F(),1);function t6r({waiting:e,keyboardOpen:t,onKey:r,onSend:n}){return(0,pz.jsxs)(X,{sx:{flex:"none",display:"flex",flexDirection:"column",bgcolor:"background.paper",pb:t?0:qv.bottom},children:[(0,pz.jsx)(X,{sx:{order:t?1:0},children:(0,pz.jsx)(QAr,{waiting:e,onKey:r})}),(0,pz.jsx)(e6r,{onSend:n})]})}var h5=E(F(),1),gci={flex:1,p:3,color:"text.secondary",textAlign:"center"};function r6r(){return(0,h5.jsxs)(h5.Fragment,{children:[(0,h5.jsx)(jv,{left:(0,h5.jsx)(f5,{label:"Sessions",to:"/"}),title:"Session"}),(0,h5.jsx)(X,{sx:gci,children:"This session has ended."})]})}var W6=E(F(),1),yci={flex:"none",display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,px:2,pt:.75,pb:1,borderBottom:1,borderColor:"divider",fontSize:13,color:"text.secondary"},vci={ml:"auto",fontFamily:"fontFamilyMono",fontSize:12};function bci(e,t){let r=Math.max(0,Math.floor((t*1e3-e)/6e4));return r<60?`${r}m`:`${Math.floor(r/60)}h`}function n6r({session:e,localNode:t}){let r=O_(3e4),n=Gs(e),i=wxe(e);return(0,W6.jsxs)(X,{sx:yci,children:[(0,W6.jsxs)(X,{component:"span",sx:[wF(Tf[n]),{fontSize:12}],children:[wd[n]," ",n[0].toUpperCase()+n.slice(1)]}),(0,W6.jsx)(Cxe,{session:e,localNode:t}),i&&(0,W6.jsxs)("span",{children:["phase ",i]}),(0,W6.jsx)(X,{component:"span",sx:vci,children:bci(e.startedAt,r)})]})}var eQ=E(le(),1);var i6r=(e,t,r)=>Math.min(r,Math.max(t,e));function o6r(e,t,r,n){let i=e/(t*r)*.97,o=i6r(i,12,18),a=Math.floor(o*n*4)/4;return i6r(a,4,32)}function a6r(e){let t=document.createElement("canvas").getContext("2d");if(!t)return .6;t.font=`100px ${e}`;let r=t.measureText("W").width;return r>0?r/100:.6}var JZ=E(le(),1),xci=24;function s6r(e){let t=(0,JZ.useRef)(!0),r=(0,JZ.useCallback)(()=>{let i=e.current;i&&t.current&&(i.scrollTop=i.scrollHeight)},[e]),n=(0,JZ.useCallback)(()=>{let i=e.current;i&&(t.current=i.scrollHeight-i.scrollTop-i.clientHeight<xci)},[e]);return{follow:r,trackStick:n}}var G6=E(le(),1);var Sci=1.25,Tci=20,Cci=5;function c6r(e,t,r){let n=12*r,i=12*Sci;return{cols:Math.max(Tci,Math.floor(e/n)),rows:Math.max(Cci,Math.floor(t/i))}}function u6r(e,t,r){let n=(0,G6.useRef)(r);n.current=r;let i=(0,G6.useCallback)(o=>{let a=e.current;if(!a||a.clientWidth===0||a.clientHeight===0)return;let{cols:s,rows:l}=c6r(a.clientWidth,a.clientHeight,t);n.current(s,l,o)},[e,t]);return(0,G6.useEffect)(()=>{let o=e.current;if(!o)return;i("claim");let a=new ResizeObserver(()=>i());return a.observe(o),()=>a.disconnect()},[e,i]),(0,G6.useCallback)(()=>i("claim"),[i])}var p5=E(le(),1);function f6r(e,t,{cols:r,rows:n},i,o,a){let{tokens:s}=$n(),l=(0,p5.useRef)(null),u=(0,p5.useRef)({tokens:s,fontSize:i,cols:r,rows:n}),f=(0,p5.useRef)(a);f.current=a,(0,p5.useEffect)(()=>{let d=e.current;if(!d)return;let{tokens:h,...p}=u.current,m=new cve({...QX(h),...p,disableStdin:!0,cursorBlink:!1,scrollback:5e3});m.open(d),l.current=m;let g=o(t,y=>m.write(y,()=>f.current()));return()=>{g(),m.dispose(),l.current=null}},[e,t,o]),(0,p5.useEffect)(()=>{l.current?.resize(r,n)},[r,n]),(0,p5.useEffect)(()=>{let d=l.current;d&&Object.assign(d.options,{...QX(s),fontSize:i})},[s,i])}var mz=E(le(),1),d6r=1,wci=.3,kci=3;function h6r(e){let[t,r]=[e[0],e[1]];return Math.hypot(t.clientX-r.clientX,t.clientY-r.clientY)}function p6r(e){let[t,r]=(0,mz.useState)(d6r),n=(0,mz.useRef)(d6r);return(0,mz.useEffect)(()=>{let i=e.current;if(!i)return;let o=null,a=u=>{u.touches.length===2&&(o={distance:h6r(u.touches),zoom:n.current})},s=u=>{if(!o||u.touches.length!==2)return;u.preventDefault();let f=o.zoom*h6r(u.touches)/o.distance;n.current=Math.min(kci,Math.max(wci,f)),r(n.current)},l=u=>{u.touches.length<2&&(o=null)};return i.addEventListener("touchstart",a,{passive:!0}),i.addEventListener("touchmove",s,{passive:!1}),i.addEventListener("touchend",l,{passive:!0}),i.addEventListener("touchcancel",l,{passive:!0}),()=>{i.removeEventListener("touchstart",a),i.removeEventListener("touchmove",s),i.removeEventListener("touchend",l),i.removeEventListener("touchcancel",l)}},[e]),t}var Sqe=E(F(),1),_ci={flex:1,minHeight:0,overflow:"auto",overscrollBehavior:"contain",WebkitOverflowScrolling:"touch",bgcolor:e=>e.tokens.terminal.background,"& .xterm":{width:"max-content"}};function m6r({sessionId:e,cols:t=120,rows:r=30,onOutput:n,sendSize:i,reclaimRef:o}){let a=(0,eQ.useRef)(null),s=(0,eQ.useRef)(null),{tokens:l}=$n(),u=(0,eQ.useMemo)(()=>a6r(l.font.terminal),[l.font.terminal]),f=C8(a)??window.innerWidth,d=p6r(a),h=o6r(f,t,u,d),{follow:p,trackStick:m}=s6r(a);return o.current=u6r(a,u,i),f6r(s,e,{cols:t,rows:r},h,n,p),(0,Sqe.jsx)(X,{ref:a,sx:_ci,onScroll:m,"data-testid":"phone-terminal",children:(0,Sqe.jsx)(X,{ref:s})})}var g6r=E(le(),1);function y6r(e,t){let r=(0,g6r.useRef)(null),n=e?.id??"",i=e?.activeViewer===s6,o=(a,s)=>{i||r.current?.(),t.sendInput(a,s)};return{reclaimRef:r,sendSize:(a,s,l)=>t.sendResize(n,a,s,l),onKey:a=>o(n,a),onSend:a=>tf(o,n,a)}}var X0=E(F(),1);function v6r({socket:e,keyboardOpen:t}){let{id:r}=BE(),n=e.sessions.find(s=>s.id===r),i=y6r(n,e);if(!n)return(0,X0.jsx)(r6r,{});let o=e.nodes?.local,a=[tc(n.cwd),n.node??o].filter(Boolean).join(" \xB7 ");return(0,X0.jsxs)(X0.Fragment,{children:[(0,X0.jsx)(jv,{left:(0,X0.jsx)(f5,{label:"Sessions",to:"/"}),title:rC(n),subtitle:a}),(0,X0.jsx)(n6r,{session:n,localNode:o}),(0,X0.jsx)(m6r,{sessionId:n.id,cols:n.cols,rows:n.rows,onOutput:e.onOutput,sendSize:i.sendSize,reclaimRef:i.reclaimRef},n.id),(0,X0.jsx)(t6r,{waiting:Gs(n)==="waiting",keyboardOpen:t,onKey:i.onKey,onSend:i.onSend})]})}var b6r=E(le(),1);var WS=E(F(),1),Eci={flex:1,minHeight:0,display:"flex",pb:qv.bottom};function x6r({socket:e}){let{id:t=""}=BE(),{viewTranscript:r,clearTranscript:n}=e,i=e.history.find(o=>o.sessionId===t);return(0,b6r.useEffect)(()=>(r(t),n),[t,r,n]),(0,WS.jsxs)(WS.Fragment,{children:[(0,WS.jsx)(jv,{left:(0,WS.jsx)(f5,{label:"History",to:"/history"}),title:i?.title??i?.name??"Transcript"}),(0,WS.jsx)(X,{sx:Eci,children:(0,WS.jsx)(mve,{sessionId:t,transcript:e.transcript})})]})}var Ip=E(F(),1);function T6r({socket:e,keyboardOpen:t}){let r=e.nodes?.local,{wsRef:n,requestHistory:i}=e,o=(0,S6r.useCallback)(()=>{n.current?.close(),i()},[n,i]);return(0,Ip.jsxs)(Hb,{children:[(0,Ip.jsx)(Ro,{index:!0,element:(0,Ip.jsx)(qAr,{sessions:e.sessions,localNode:r,reconnecting:e.reconnecting,onRefresh:o})}),(0,Ip.jsx)(Ro,{path:"session/:id",element:(0,Ip.jsx)(v6r,{socket:e,keyboardOpen:t})}),(0,Ip.jsx)(Ro,{path:"history",element:(0,Ip.jsx)(DAr,{history:e.history,localNode:r,requestHistory:i})}),(0,Ip.jsx)(Ro,{path:"history/:id",element:(0,Ip.jsx)(x6r,{socket:e})}),(0,Ip.jsx)(Ro,{path:"*",element:(0,Ip.jsx)(iW,{to:"/",replace:!0})})]})}var _xe=E(le(),1),Rci=120;function C6r(){let e=window.visualViewport,t=e?.height??window.innerHeight;return{height:t,offsetTop:e?.offsetTop??0,keyboardOpen:window.innerHeight-t>Rci}}function w6r(){let[e,t]=(0,_xe.useState)(C6r);return(0,_xe.useEffect)(()=>{let r=window.visualViewport;if(!r)return;let n=()=>t(C6r());return r.addEventListener("resize",n),r.addEventListener("scroll",n),()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n)}},[]),e}var Tqe=E(F(),1),Aci={position:"fixed",left:0,right:0,display:"flex",flexDirection:"column",overflow:"hidden",bgcolor:"background.default",color:"text.primary"};function k6r(){let e=axe(),t=w6r();return(0,Tqe.jsx)(X,{sx:Aci,style:{top:t.offsetTop,height:t.height},"data-testid":"phone-shell",children:(0,Tqe.jsx)(T6r,{socket:e,keyboardOpen:t.keyboardOpen})})}var _6r=E(le(),1);var Exe=E(F(),1),Pci=5;function E6r({children:e}){let[t,r]=(0,_6r.useState)(null);return(0,Exe.jsxs)(C_e.Provider,{value:t,children:[e,(0,Exe.jsx)(X,{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+${Pci+1})`]:{display:"none"}}})]})}fz();var tQ;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(tQ||(tQ={}));var R6r;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(R6r||(R6r={}));var A6r=z6("StatusBar");var P6r=E(le(),1);function L6r(e){(0,P6r.useEffect)(()=>{gxe&&A6r.setStyle({style:e==="dark"?tQ.Dark:tQ.Light}).catch(()=>{})},[e])}var Z0=E(F(),1);function Lci(){let{mode:e,toggle:t}=jRr(),r=(0,I6r.useMemo)(()=>hAr(e),[e]);return L6r(e),(0,Z0.jsxs)(cJ,{theme:r,children:[(0,Z0.jsx)(KJ,{}),(0,Z0.jsx)(E6r,{children:(0,Z0.jsx)(EAr,{children:gxe?(0,Z0.jsx)(k6r,{}):(0,Z0.jsx)(VRr,{mode:e,toggle:t})})})]})}var Mci=wke([{path:"*",element:(0,Z0.jsx)(Lci,{})}]);function Ici(){return(0,Z0.jsx)(yke,{router:Mci})}var M6r=document.getElementById("app");M6r&&pAr().then(()=>{(0,D6r.createRoot)(M6r).render((0,Z0.jsx)(Ici,{}))});})();
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.966.1",
9
+ version: "0.966.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -45412,7 +45412,7 @@ function link2() {
45412
45412
 
45413
45413
  // src/commands/run/add.ts
45414
45414
  import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync54 } from "fs";
45415
- import { join as join103 } from "path";
45415
+ import { dirname as dirname44 } from "path";
45416
45416
 
45417
45417
  // src/commands/run/editRepoRunList.ts
45418
45418
  async function editRepoRunList(repoName, cwd, edit2) {
@@ -45570,6 +45570,14 @@ function requireParsedArgs() {
45570
45570
  return extractAddArgs(addIndex);
45571
45571
  }
45572
45572
 
45573
+ // src/commands/run/runCommandFilePath.ts
45574
+ import { join as join103 } from "path";
45575
+ function runCommandFilePath(name) {
45576
+ const segments = name.split(":");
45577
+ const file = `${segments.pop()}.md`;
45578
+ return join103(".claude", "commands", ...segments, file);
45579
+ }
45580
+
45573
45581
  // src/commands/run/add.ts
45574
45582
  function formatDisplay(command, args) {
45575
45583
  return args.length > 0 ? `${command} ${args.join(" ")}` : command;
@@ -45583,15 +45591,14 @@ function saveProjectRunConfig(entry) {
45583
45591
  saveConfig(config);
45584
45592
  }
45585
45593
  function createCommandFile(name) {
45586
- const dir = join103(".claude", "commands");
45587
- mkdirSync36(dir, { recursive: true });
45594
+ const filePath = runCommandFilePath(name);
45595
+ mkdirSync36(dirname44(filePath), { recursive: true });
45588
45596
  const content = `---
45589
45597
  description: Run ${name}
45590
45598
  ---
45591
45599
 
45592
45600
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
45593
45601
  `;
45594
- const filePath = join103(dir, `${name}.md`);
45595
45602
  writeFileSync54(filePath, content);
45596
45603
  console.log(`Created command file: ${filePath}`);
45597
45604
  }
@@ -45696,8 +45703,8 @@ function registerRunAdd(runCommand) {
45696
45703
  }
45697
45704
 
45698
45705
  // src/commands/run/remove.ts
45699
- import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
45700
- import { join as join104 } from "path";
45706
+ import { existsSync as existsSync84, readdirSync as readdirSync24, rmdirSync, unlinkSync as unlinkSync19 } from "fs";
45707
+ import { dirname as dirname45, join as join104 } from "path";
45701
45708
 
45702
45709
  // src/commands/run/removeRepoRunConfig.ts
45703
45710
  function isNamed(entry, name) {
@@ -45714,12 +45721,23 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
45714
45721
  }
45715
45722
 
45716
45723
  // src/commands/run/remove.ts
45724
+ function removeEmptyNamespaceDirs(filePath) {
45725
+ const root2 = join104(".claude", "commands");
45726
+ for (let dir = dirname45(filePath); dir !== root2; dir = dirname45(dir)) {
45727
+ if (!existsSync84(dir) || readdirSync24(dir).length > 0) return;
45728
+ rmdirSync(dir);
45729
+ }
45730
+ }
45717
45731
  function deleteCommandFile(name) {
45718
- const filePath = join104(".claude", "commands", `${name}.md`);
45719
- if (existsSync84(filePath)) {
45720
- unlinkSync19(filePath);
45721
- console.log(`Deleted command file: ${filePath}`);
45732
+ const filePath = runCommandFilePath(name);
45733
+ const legacyPath = join104(".claude", "commands", `${name}.md`);
45734
+ for (const path108 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
45735
+ if (existsSync84(path108)) {
45736
+ unlinkSync19(path108);
45737
+ console.log(`Deleted command file: ${path108}`);
45738
+ }
45722
45739
  }
45740
+ removeEmptyNamespaceDirs(filePath);
45723
45741
  }
45724
45742
  function removeProjectRunConfig(name) {
45725
45743
  const config = loadProjectConfig();
@@ -47289,11 +47307,11 @@ function trimWatcherLog(cwd) {
47289
47307
 
47290
47308
  // src/commands/sessions/daemon/worktree/appendWatcherLog.ts
47291
47309
  import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync37 } from "fs";
47292
- import { dirname as dirname45 } from "path";
47310
+ import { dirname as dirname47 } from "path";
47293
47311
  function appendWatcherLog(cwd, data) {
47294
47312
  try {
47295
47313
  const path108 = watcherLogPath(cwd);
47296
- mkdirSync37(dirname45(path108), { recursive: true });
47314
+ mkdirSync37(dirname47(path108), { recursive: true });
47297
47315
  appendFileSync5(path108, data);
47298
47316
  } catch {
47299
47317
  }
@@ -47961,12 +47979,12 @@ function closeGateApplies(sessions, session) {
47961
47979
  }
47962
47980
 
47963
47981
  // src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
47964
- import { readdirSync as readdirSync25, readlinkSync } from "fs";
47982
+ import { readdirSync as readdirSync26, readlinkSync } from "fs";
47965
47983
  import { sep as sep4 } from "path";
47966
47984
  function liveProcessesInTree(treePath, procRoot = "/proc") {
47967
47985
  let entries;
47968
47986
  try {
47969
- entries = readdirSync25(procRoot);
47987
+ entries = readdirSync26(procRoot);
47970
47988
  } catch {
47971
47989
  return [];
47972
47990
  }
@@ -48769,7 +48787,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
48769
48787
 
48770
48788
  // src/commands/sessions/daemon/watchActivity.ts
48771
48789
  import { existsSync as existsSync96, mkdirSync as mkdirSync38, watch as watch2 } from "fs";
48772
- import { dirname as dirname46 } from "path";
48790
+ import { dirname as dirname48 } from "path";
48773
48791
 
48774
48792
  // src/commands/sessions/daemon/applyActivityToSession.ts
48775
48793
  function applyActivityToSession(session, activity2) {
@@ -48831,7 +48849,7 @@ var DEBOUNCE_MS2 = 50;
48831
48849
  function watchActivity(session, notify2, onClaudeSessionId) {
48832
48850
  if (session.commandType !== "assist" || !session.cwd) return;
48833
48851
  const path108 = activityPath(session.id);
48834
- const dir = dirname46(path108);
48852
+ const dir = dirname48(path108);
48835
48853
  try {
48836
48854
  mkdirSync38(dir, { recursive: true });
48837
48855
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.966.1",
3
+ "version": "0.966.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {