@staff0rd/assist 0.1015.0 → 0.1015.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
|
`,D0o=wi`
|
|
4020
4020
|
0%, 100% { transform: scale(1); }
|
|
4021
4021
|
50% { transform: scale(1.08); }
|
|
4022
|
-
`,TAr={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:`${M0o} 1.8s linear infinite`},N0o={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${D0o} 1.6s ease-in-out infinite`,"&::before":{...TAr,inset:0,zIndex:-1},"&::after":{...TAr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:kl.rainbowPill.text,textShadow:kl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function CAr({children:e}){return(0,kL.jsxs)(kL.Fragment,{children:[(0,kL.jsx)(A4,{styles:I0o}),(0,kL.jsx)(V,{component:"span","data-testid":"rainbow-pill",sx:N0o,children:e})]})}function wAr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function kAr(e){if(e.length!==2)return!1;let[t,r]=e;return wAr(t)===wAr(r)}var UT=k(I(),1);function EAr({rateLimits:e}){let t=Ug(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=kAr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:rTe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,UT.jsxs)(_Ar.Fragment,{children:[a>0?(0,UT.jsx)(V,{component:"span",sx:{color:RU,mr:.5},children:","}):null,(0,UT.jsx)(SAr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,UT.jsx)(CAr,{children:o}):(0,UT.jsx)(UT.Fragment,{children:o})}var M5=k(I(),1);function AAr({groups:e}){return(0,M5.jsx)(M5.Fragment,{children:e.map((t,r)=>(0,M5.jsxs)(RAr.Fragment,{children:[(0,M5.jsx)(V,{component:"span",sx:{color:RU,ml:r>0?1:0,mr:.5},children:vc(t.harness)}),(0,M5.jsx)(EAr,{rateLimits:t.rateLimits})]},t.harness))})}var PAr={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 O0o(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function B0o(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function F0o(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function MAr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=UKe(t,r,n);if(o==null)return{kind:"unprojectable"};let i=wb(e,t,r,n),a=O0o(i),s=B0o(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:F0o(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function oTe(e){return t=>t.tokens.color.onAppBar.level[e]}function DAr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${oU(e.at,t)}`}var D5=k(I(),1),NAr={display:"contents"};function cXe({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,D5.jsxs)(V,{component:"span",sx:NAr,children:[(0,D5.jsx)("span",{}),(0,D5.jsx)("span",{})]});let n=(0,D5.jsx)(V,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,D5.jsxs)(V,{component:"span",sx:{color:oTe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,D5.jsxs)(V,{component:"span",sx:NAr,children:[r?o:n,r?n:o]})}var OAr={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 N5=k(I(),1);function BAr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=OAr,a=wb(t,r,n,o),s=MAr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,N5.jsxs)(V,{sx:i.row,children:[(0,N5.jsx)(V,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,N5.jsx)(cXe,{direction:"back",threshold:l?.recovery}),(0,N5.jsxs)(V,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:oTe(a)},children:[Math.round(t),"%"]}),(0,N5.jsx)(cXe,{direction:"forward",threshold:l?.worse}),(0,N5.jsx)(V,{component:"span",sx:i.note,children:l?l.recovery&&DAr(l.recovery,o):"no projection yet"})]})}function iTe(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 $Ar=k(I(),1);function FAr({rateLimits:e,now:t}){return iTe(e).map(r=>(0,$Ar.jsx)(BAr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var _L=k(I(),1);function zAr({groups:e}){let t=Ug(3e4),r=PAr;return(0,_L.jsxs)(V,{sx:r.root,children:[e.map(n=>(0,_L.jsxs)(V,{sx:r.group,children:[(0,_L.jsx)(V,{sx:r.heading,children:vc(n.harness)}),(0,_L.jsx)(FAr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,_L.jsx)(V,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var uXe=k(I(),1),$0o="Claude account usage (5h / 7d windows) \u2014 view history";function HAr(e){return e.length===0?{title:$0o,content:"Usage"}:{title:(0,uXe.jsx)(zAr,{groups:e}),content:(0,uXe.jsx)(AAr,{groups:e})}}var UAr={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}},WAr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var fXe=k(I(),1),z0o={};function GAr({rateLimits:e,harnessRateLimits:t=z0o}){let{title:r,content:n}=HAr(tTe(e,t));return(0,fXe.jsx)(rr,{title:r,placement:"top-start",slotProps:WAr,children:(0,fXe.jsx)(Ur,{component:Ki,to:"/usage",underline:"none",color:"inherit",sx:UAr,children:n})})}var jAr=k(oe(),1);var Op="0.1015.0";var aTe=k(oe(),1),dXe=(0,aTe.createContext)(null);function sTe(){return(0,aTe.useContext)(dXe)}var pXe=k(I(),1);function VAr(){let e=sTe();return!e||e===Op?null:(0,pXe.jsx)(rr,{title:`Daemon is running v${e}, but this page was served by v${Op}. Restart the daemon to match.`,children:(0,pXe.jsx)(WSe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var qAr=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?Bb(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Bb(t).hover,color:t=>Bb(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Bb(t).dot,boxShadow:t=>`0 0 0 3px ${Bb(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Bb(t).readyText}});var qg=k(I(),1);function YAr(){let{entries:e}=d5(),t=Kr(),r=(0,jAr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=to("openUpdates");if(Bi(n,r),!Op)return null;let i=e.filter(m5).length;return(0,qg.jsxs)(qg.Fragment,{children:[(0,qg.jsx)(rr,{describeChild:!0,placement:"top-end",title:(0,qg.jsx)(of,{label:"Updates",chords:o}),children:(0,qg.jsxs)(ir,{component:Ki,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:qAr(i>0),children:[i>0&&(0,qg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,qg.jsxs)("span",{children:["v",Op]}),i>0&&(0,qg.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,qg.jsx)(VAr,{})]})}var WT=k(I(),1);function KAr({socket:e}){return(0,WT.jsx)(sAr,{start:(0,WT.jsx)(GAr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,WT.jsxs)(WT.Fragment,{children:[(0,WT.jsx)(vAr,{}),(0,WT.jsx)(YAr,{})]})})}var XAr=k(oe(),1);var GT=k(I(),1),H0o=2e4;function QAr(){let{entries:e,refresh:t}=d5(),[r,n]=(0,XAr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,GT.jsx)(hu,{open:a,children:(0,GT.jsxs)(jn,{severity:"info",variant:"filled",action:(0,GT.jsxs)(GT.Fragment,{children:[(0,GT.jsx)(Tt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,H0o),children:"Install"}),(0,GT.jsx)(Tt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var dTe=k(oe(),1);var fTe=k(oe(),1);function ZAr(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 O5=k(I(),1),U0o={display:"flex",gap:1,alignItems:"center",minWidth:0},W0o={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},G0o={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},V0o={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function q0o(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function JAr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,O5.jsx)(Sm,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=q0o(o);return(0,O5.jsxs)(un,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:U0o,children:[(0,O5.jsx)(Lve,{path:o}),(0,O5.jsxs)(V,{sx:W0o,children:[(0,O5.jsx)(Ee,{component:"span",sx:G0o,children:s}),(0,O5.jsx)(Ee,{component:"span",color:"text.secondary",sx:V0o,children:a})]})]},o)})})}var lTe=k(I(),1),j0o={maxHeight:420,overflowY:"auto"},Y0o={px:2,py:2,fontSize:13};function ePr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,lTe.jsx)(V,{sx:j0o,children:e?(0,lTe.jsx)(Ee,{color:"text.secondary",sx:Y0o,children:e}):(0,lTe.jsx)(JAr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var tPr=k(I(),1),K0o={mt:6,alignSelf:"flex-start"};function cTe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,tPr.jsx)(pc,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:K0o},transition:{onEntered:t}},children:n})}var uTe=k(oe(),1);var rPr={files:[],loading:!1,error:!1};function nPr(e,t){let[r,n]=(0,uTe.useState)(rPr),o=pr();return(0,uTe.useEffect)(()=>{if(!e){n(rPr);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await Jt(Vr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Cr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var EL=k(I(),1);function X0o(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function oPr({onClose:e}){let{worktreeNode:t}=Vn();return(0,EL.jsx)(Fl.Provider,{value:t,children:(0,EL.jsx)(Q0o,{onClose:e})})}function Q0o({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=Vn(),[n,o]=(0,fTe.useState)(""),i=nPr(t,n),a=Kr(),s=(0,fTe.useRef)(null),l=h=>a(X0o(h,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=w5(i.files,n,l,e),p=h=>{l(h),e()};return(0,EL.jsxs)(cTe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,EL.jsx)(bw,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:d,placeholder:"Search files by name..."}),(0,EL.jsx)(ePr,{message:ZAr(t,n,i),files:i.files,highlight:u,onHighlight:f,onSelect:p})]})}function iPr(e){Bi(to("quickOpen").matches,e)}var sPr=k(I(),1);function aPr(){let[e,t]=(0,dTe.useState)(!1);return iPr((0,dTe.useCallback)(()=>t(!0),[])),e?(0,sPr.jsx)(oPr,{onClose:()=>t(!1)}):null}var pTe=k(I(),1);function lPr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,pTe.jsx)(hu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,pTe.jsx)(jn,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,pTe.jsx)(Tt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Dee=k(oe(),1);function AU(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var SPr=k(oe(),1);var cPr=k(I(),1),uPr=nt((0,cPr.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 Z0o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function fPr(e){return e?Z0o[e]:"success.main"}function dPr(e){return e.split("-")[0].split(".").map(Number)}function pPr(e,t){if(!e||!t||e===t)return;let r=dPr(e),n=dPr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var RL=k(I(),1),J0o={height:16,fontSize:10},eyo={opacity:.6,fontSize:"0.85em"};function tyo(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 Iee({nodes:e,name:t,showVersion:r=!1}){let n=sTe()??Op,o=e.links.find(a=>a.name===t),i=pPr(o?.peerVersion,n);return(0,RL.jsx)(rr,{title:tyo(e,t),placement:"right",children:(0,RL.jsxs)(V,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,RL.jsx)(uPr,{sx:{fontSize:8,color:fPr(o?.state)}}),t,r&&o?.peerVersion&&(0,RL.jsxs)(V,{component:"span",sx:eyo,children:["v",o.peerVersion]}),i&&(0,RL.jsx)(Yn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:J0o})]})})}var AL=k(I(),1),ryo={opacity:.6},nyo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function hPr({nodes:e,name:t,clone:r}){let n=(0,AL.jsx)(Iee,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,AL.jsx)(V,{component:"span",sx:ryo,children:n}):(0,AL.jsx)(rr,{title:fU(t,r.cloneTarget),children:(0,AL.jsxs)(V,{component:"span",sx:nyo,children:[(0,AL.jsx)(uU,{sx:{fontSize:14}}),n]})})}var gPr=k(I(),1),oyo={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 mPr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,gPr.jsx)(ir,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:oyo,children:t})}var yPr={ArrowRight:1,ArrowLeft:-1};function iyo(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+yPr[e.key]+r)%r}function vPr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!yPr[o.key]){rT(o);return}let i=iyo(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var bPr=k(oe(),1);function PU(e){return e?.querySelector('[aria-checked="true"]')}function xPr(e,t){(0,bPr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=PU(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var hXe=k(I(),1),ayo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function hTe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return xPr(i,r),(0,hXe.jsx)(_t,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:vPr(t,r,n,l),sx:ayo,children:t.map(u=>(0,hXe.jsx)(mPr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var mXe=k(I(),1);function TPr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=il(),a=(0,SPr.useRef)(null);return!i||!n||!e?null:(0,mXe.jsx)(hTe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,mXe.jsx)(hPr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var mTe=k(I(),1);function CPr({prompt:e,children:t}){return(0,mTe.jsxs)(_t,{children:[e,(0,mTe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var kPr=k(I(),1),syo=".MuiOutlinedInput-notchedOutline",lyo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${syo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function wPr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,kPr.jsx)(Un,{sx:lyo,value:e,onChange:a=>t(a.target.value),onKeyDown:rT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var APr=k(oe(),1);var Ey={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:Ibe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},_Pr=Object.keys(Ey);var gXe=k(I(),1);function EPr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,gXe.jsx)(Js,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,gXe.jsx)(un,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:vc(i)},i))})}var PL=k(I(),1);function RPr(e){return t=>t==="prompt"&&e?(0,PL.jsxs)(PL.Fragment,{children:["prompt",(0,PL.jsx)(V,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${vc(e)}`}),(0,PL.jsx)(jd,{sx:{fontSize:18,mr:-.75}})]}):t}var LL=k(I(),1);function PPr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,APr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(PU(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,LL.jsxs)(LL.Fragment,{children:[(0,LL.jsx)(hTe,{label:"Mode",options:_Pr,value:e.mode,onChange:l,optionLabel:RPr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,LL.jsx)(EPr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var UPr=k(oe(),1);var yXe=k(I(),1),cyo={zIndex:e=>e.zIndex.modal+1};function LPr({open:e,anchor:t,children:r}){return(0,yXe.jsx)(o7,{open:e,anchorEl:t,placement:"bottom-start",sx:cyo,children:(0,yXe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var IPr=k(I(),1),MPr=nt((0,IPr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var vXe=k(I(),1),uyo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},fyo={fontSize:16,color:"text.disabled"};function DPr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:uyo,endAdornment:(0,vXe.jsx)(Vke,{position:"end",children:(0,vXe.jsx)(MPr,{sx:fyo})})}}}var NPr=k(WI(),1);function OPr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}rT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,NPr.flushSync)(()=>{r(t),n()}),rT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function gTe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Rb(n).toLowerCase().includes(r)):e}var bXe=k(oe(),1);function BPr(){let[e,t]=(0,bXe.useState)(!1),[r,n]=(0,bXe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var $Pr=k(oe(),1);var FPr=e=>e?Rb(e):"";function zPr(e){let[t,r]=(0,$Pr.useState)(()=>FPr(e));return{text:t,setText:r,showRepo:n=>r(FPr(n))}}function HPr(e,t,r){let n=BPr(),o=zPr(t),i=gTe(e,n.query),a=f=>{r(f),o.showRepo(f)},s=w5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:OPr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{o.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:f=>{a(f),n.close()}}}var LU=k(I(),1);function WPr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=HPr(e,t,r),s=(0,UPr.useRef)(null);return(0,LU.jsxs)(V,{ref:s,sx:{flex:1,minWidth:0},children:[(0,LU.jsx)(Un,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:DPr(a.open)}),(0,LU.jsx)(LPr,{open:a.open,anchor:s.current,children:(0,LU.jsx)(BSe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var B5=k(I(),1);function GPr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=Vn();return(0,B5.jsxs)(CPr,{prompt:(0,B5.jsx)(wPr,{value:r.prompt,onChange:r.setPrompt,placeholder:Ey[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,B5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,B5.jsx)(WPr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,B5.jsx)(PPr,{...t})]}),(0,B5.jsx)(TPr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var jPr=k(I(),1),VPr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function qPr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,jPr.jsx)(Tt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var IL=k(I(),1),dyo=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"}),pyo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function YPr(e){return(0,IL.jsxs)(_t,{direction:"row",sx:dyo,children:[VPr.map(([t,r])=>(0,IL.jsxs)("span",{children:[(0,IL.jsx)(V,{component:"kbd",sx:pyo,children:t}),r]},t)),(0,IL.jsx)(V,{sx:{flex:1}}),(0,IL.jsx)(qPr,{...e})]})}var ML=k(oe(),1);function KPr(e,t){let r=(0,ML.useRef)(e),n=(0,ML.useRef)(null),o=(0,ML.useRef)(null),i=(0,ML.useRef)(null),a=(0,ML.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:p}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,p)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:PU(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function hyo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:$Se(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function XPr(e,t){let{names:r,visible:n}=il(),o=DSe(t,n?r:[void 0]);return{cloneState:o,target:hyo(t,e,o(e))}}function yTe({mode:e,harness:t,prompt:r,cwd:n,node:o},i){let a=n||void 0,s=o?[o]:[];if(e==="prompt"){t==="claude"?i.onCreate(r,a,...s):i.onCreateHarness(t,r,a,...s);return}if(e==="design"){i.onCreateDesign(r,a,...s);return}let l=o?[{node:o}]:[];C1r(Ey[e].sessionMode,n,(u,f)=>i.onCreateAssist(u,f,...l),()=>{},r)}function QPr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(_Se(r.prompt,n.onCreateAssist),!0):(yTe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var vTe=k(oe(),1);function ZPr(e,t){let[r,n]=(0,vTe.useState)(!1);return(0,vTe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function JPr(e,t,r,n,o){let i=ZPr(e,()=>{QPr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Mee=k(oe(),1);function e6r(e,t){let r=(0,Mee.useRef)(e),n=(0,Mee.useRef)(null);return(0,Mee.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var r6r=k(I(),1),myo={border:0,margin:0,padding:0,minWidth:0};function t6r({loading:e,restoreFocus:t,children:r}){let n=e6r(e,t);return(0,r6r.jsx)("fieldset",{disabled:e,style:myo,onFocus:n,children:r})}var xTe=k(I(),1);function bTe({error:e,onRetry:t}){return e?(0,xTe.jsxs)(jn,{severity:"error",sx:{mx:2,my:1},action:t&&(0,xTe.jsx)(Tt,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var F5=k(I(),1);function n6r({draft:e,launchers:t,onClose:r}){let n=KPr(e.focus,e.setFocus),o=AU(Wg()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=XPr(e.node,e.cwd),l=JPr(e,i,a,t,r);return(0,F5.jsx)(cTe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,F5.jsx)("form",{onSubmit:l,children:(0,F5.jsxs)(t6r,{loading:e.modePending,restoreFocus:n.restore,children:[(0,F5.jsx)(GPr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,F5.jsx)(bTe,{error:e.modeError,onRetry:e.retryMode}),(0,F5.jsx)(YPr,{submitLabel:a.kind==="clone"?"Clone":Ey[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var DL=k(oe(),1);async function gyo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await Jt(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(Ey,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Cr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function STe(e,t=0){let[r,n]=(0,DL.useState)(0),[o,i]=(0,DL.useState)(null),a=(0,DL.useCallback)(()=>n(l=>l+1),[]);if((0,DL.useEffect)(()=>{let l=!1;return gyo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function TTe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function o6r(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var VT=k(oe(),1),i6r={field:"prompt",selectionStart:0,selectionEnd:0};function a6r(){let[e,t]=(0,VT.useState)(""),[r,n]=(0,VT.useState)(),[o,i]=(0,VT.useState)(),[a,s]=(0,VT.useState)("claude"),[l,u]=(0,VT.useState)(),[f,d]=(0,VT.useState)(i6r),p=(0,VT.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),d(i6r)},[]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:d,clear:p}}function s6r(e,t=STe){let{selectedCwd:r}=Vn(),n=il(),o=a6r(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:TTe(o.mode,a),retryMode:a.retry,node:o6r(o.node,n)}:null}function l6r(e){Bi(to("newSession").matches,e)}var c6r=k(oe(),1);function u6r(e,t){let{selectedCwd:r}=Vn(),[n,o]=$s(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,c6r.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[i,a,s,l,u,t,o])}var d6r=k(I(),1);function f6r({launchers:e}){let[t,r]=(0,Dee.useState)(!1),[n,o]=(0,Dee.useState)(0),i=s6r(n),a=(0,Dee.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return l6r(a),u6r(i,a),!t||!i?null:(0,d6r.jsx)(n6r,{draft:i,launchers:e,onClose:()=>r(!1)})}var CTe=k(I(),1);function p6r({reconnecting:e}){return(0,CTe.jsx)(hu,{open:e,children:(0,CTe.jsx)(jn,{severity:"info",variant:"filled",icon:(0,CTe.jsx)(bo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Ry=k(I(),1);function h6r({socket:e,onViewLaunchedSession:t}){return(0,Ry.jsxs)(Ry.Fragment,{children:[(0,Ry.jsx)(aPr,{}),(0,Ry.jsx)(f6r,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Ry.jsx)(p6r,{reconnecting:e.reconnecting}),(0,Ry.jsx)(QAr,{}),(0,Ry.jsx)(sl,{error:e.error,onClose:e.clearError}),(0,Ry.jsx)(lPr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Fb=k(oe(),1);var yyo=6e4;function vyo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function wTe(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4022
|
+
`,TAr={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:`${M0o} 1.8s linear infinite`},N0o={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${D0o} 1.6s ease-in-out infinite`,"&::before":{...TAr,inset:0,zIndex:-1},"&::after":{...TAr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:kl.rainbowPill.text,textShadow:kl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function CAr({children:e}){return(0,kL.jsxs)(kL.Fragment,{children:[(0,kL.jsx)(A4,{styles:I0o}),(0,kL.jsx)(V,{component:"span","data-testid":"rainbow-pill",sx:N0o,children:e})]})}function wAr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function kAr(e){if(e.length!==2)return!1;let[t,r]=e;return wAr(t)===wAr(r)}var UT=k(I(),1);function EAr({rateLimits:e}){let t=Ug(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=kAr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:rTe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,UT.jsxs)(_Ar.Fragment,{children:[a>0?(0,UT.jsx)(V,{component:"span",sx:{color:RU,mr:.5},children:","}):null,(0,UT.jsx)(SAr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,UT.jsx)(CAr,{children:o}):(0,UT.jsx)(UT.Fragment,{children:o})}var M5=k(I(),1);function AAr({groups:e}){return(0,M5.jsx)(M5.Fragment,{children:e.map((t,r)=>(0,M5.jsxs)(RAr.Fragment,{children:[(0,M5.jsx)(V,{component:"span",sx:{color:RU,ml:r>0?1:0,mr:.5},children:vc(t.harness)}),(0,M5.jsx)(EAr,{rateLimits:t.rateLimits})]},t.harness))})}var PAr={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 O0o(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function B0o(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function F0o(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function MAr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=UKe(t,r,n);if(o==null)return{kind:"unprojectable"};let i=wb(e,t,r,n),a=O0o(i),s=B0o(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:F0o(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function oTe(e){return t=>t.tokens.color.onAppBar.level[e]}function DAr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${oU(e.at,t)}`}var D5=k(I(),1),NAr={display:"contents"};function cXe({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,D5.jsxs)(V,{component:"span",sx:NAr,children:[(0,D5.jsx)("span",{}),(0,D5.jsx)("span",{})]});let n=(0,D5.jsx)(V,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,D5.jsxs)(V,{component:"span",sx:{color:oTe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,D5.jsxs)(V,{component:"span",sx:NAr,children:[r?o:n,r?n:o]})}var OAr={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 N5=k(I(),1);function BAr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=OAr,a=wb(t,r,n,o),s=MAr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,N5.jsxs)(V,{sx:i.row,children:[(0,N5.jsx)(V,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,N5.jsx)(cXe,{direction:"back",threshold:l?.recovery}),(0,N5.jsxs)(V,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:oTe(a)},children:[Math.round(t),"%"]}),(0,N5.jsx)(cXe,{direction:"forward",threshold:l?.worse}),(0,N5.jsx)(V,{component:"span",sx:i.note,children:l?l.recovery&&DAr(l.recovery,o):"no projection yet"})]})}function iTe(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 $Ar=k(I(),1);function FAr({rateLimits:e,now:t}){return iTe(e).map(r=>(0,$Ar.jsx)(BAr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var _L=k(I(),1);function zAr({groups:e}){let t=Ug(3e4),r=PAr;return(0,_L.jsxs)(V,{sx:r.root,children:[e.map(n=>(0,_L.jsxs)(V,{sx:r.group,children:[(0,_L.jsx)(V,{sx:r.heading,children:vc(n.harness)}),(0,_L.jsx)(FAr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,_L.jsx)(V,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var uXe=k(I(),1),$0o="Claude account usage (5h / 7d windows) \u2014 view history";function HAr(e){return e.length===0?{title:$0o,content:"Usage"}:{title:(0,uXe.jsx)(zAr,{groups:e}),content:(0,uXe.jsx)(AAr,{groups:e})}}var UAr={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}},WAr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var fXe=k(I(),1),z0o={};function GAr({rateLimits:e,harnessRateLimits:t=z0o}){let{title:r,content:n}=HAr(tTe(e,t));return(0,fXe.jsx)(rr,{title:r,placement:"top-start",slotProps:WAr,children:(0,fXe.jsx)(Ur,{component:Ki,to:"/usage",underline:"none",color:"inherit",sx:UAr,children:n})})}var jAr=k(oe(),1);var Op="0.1015.2";var aTe=k(oe(),1),dXe=(0,aTe.createContext)(null);function sTe(){return(0,aTe.useContext)(dXe)}var pXe=k(I(),1);function VAr(){let e=sTe();return!e||e===Op?null:(0,pXe.jsx)(rr,{title:`Daemon is running v${e}, but this page was served by v${Op}. Restart the daemon to match.`,children:(0,pXe.jsx)(WSe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var qAr=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?Bb(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Bb(t).hover,color:t=>Bb(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Bb(t).dot,boxShadow:t=>`0 0 0 3px ${Bb(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Bb(t).readyText}});var qg=k(I(),1);function YAr(){let{entries:e}=d5(),t=Kr(),r=(0,jAr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=to("openUpdates");if(Bi(n,r),!Op)return null;let i=e.filter(m5).length;return(0,qg.jsxs)(qg.Fragment,{children:[(0,qg.jsx)(rr,{describeChild:!0,placement:"top-end",title:(0,qg.jsx)(of,{label:"Updates",chords:o}),children:(0,qg.jsxs)(ir,{component:Ki,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:qAr(i>0),children:[i>0&&(0,qg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,qg.jsxs)("span",{children:["v",Op]}),i>0&&(0,qg.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,qg.jsx)(VAr,{})]})}var WT=k(I(),1);function KAr({socket:e}){return(0,WT.jsx)(sAr,{start:(0,WT.jsx)(GAr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,WT.jsxs)(WT.Fragment,{children:[(0,WT.jsx)(vAr,{}),(0,WT.jsx)(YAr,{})]})})}var XAr=k(oe(),1);var GT=k(I(),1),H0o=2e4;function QAr(){let{entries:e,refresh:t}=d5(),[r,n]=(0,XAr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,GT.jsx)(hu,{open:a,children:(0,GT.jsxs)(jn,{severity:"info",variant:"filled",action:(0,GT.jsxs)(GT.Fragment,{children:[(0,GT.jsx)(Tt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,H0o),children:"Install"}),(0,GT.jsx)(Tt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var dTe=k(oe(),1);var fTe=k(oe(),1);function ZAr(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 O5=k(I(),1),U0o={display:"flex",gap:1,alignItems:"center",minWidth:0},W0o={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},G0o={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},V0o={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function q0o(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function JAr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,O5.jsx)(Sm,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=q0o(o);return(0,O5.jsxs)(un,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:U0o,children:[(0,O5.jsx)(Lve,{path:o}),(0,O5.jsxs)(V,{sx:W0o,children:[(0,O5.jsx)(Ee,{component:"span",sx:G0o,children:s}),(0,O5.jsx)(Ee,{component:"span",color:"text.secondary",sx:V0o,children:a})]})]},o)})})}var lTe=k(I(),1),j0o={maxHeight:420,overflowY:"auto"},Y0o={px:2,py:2,fontSize:13};function ePr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,lTe.jsx)(V,{sx:j0o,children:e?(0,lTe.jsx)(Ee,{color:"text.secondary",sx:Y0o,children:e}):(0,lTe.jsx)(JAr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var tPr=k(I(),1),K0o={mt:6,alignSelf:"flex-start"};function cTe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,tPr.jsx)(pc,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:K0o},transition:{onEntered:t}},children:n})}var uTe=k(oe(),1);var rPr={files:[],loading:!1,error:!1};function nPr(e,t){let[r,n]=(0,uTe.useState)(rPr),o=pr();return(0,uTe.useEffect)(()=>{if(!e){n(rPr);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await Jt(Vr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Cr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var EL=k(I(),1);function X0o(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function oPr({onClose:e}){let{worktreeNode:t}=Vn();return(0,EL.jsx)(Fl.Provider,{value:t,children:(0,EL.jsx)(Q0o,{onClose:e})})}function Q0o({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=Vn(),[n,o]=(0,fTe.useState)(""),i=nPr(t,n),a=Kr(),s=(0,fTe.useRef)(null),l=h=>a(X0o(h,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=w5(i.files,n,l,e),p=h=>{l(h),e()};return(0,EL.jsxs)(cTe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,EL.jsx)(bw,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:d,placeholder:"Search files by name..."}),(0,EL.jsx)(ePr,{message:ZAr(t,n,i),files:i.files,highlight:u,onHighlight:f,onSelect:p})]})}function iPr(e){Bi(to("quickOpen").matches,e)}var sPr=k(I(),1);function aPr(){let[e,t]=(0,dTe.useState)(!1);return iPr((0,dTe.useCallback)(()=>t(!0),[])),e?(0,sPr.jsx)(oPr,{onClose:()=>t(!1)}):null}var pTe=k(I(),1);function lPr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,pTe.jsx)(hu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,pTe.jsx)(jn,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,pTe.jsx)(Tt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Dee=k(oe(),1);function AU(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var SPr=k(oe(),1);var cPr=k(I(),1),uPr=nt((0,cPr.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 Z0o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function fPr(e){return e?Z0o[e]:"success.main"}function dPr(e){return e.split("-")[0].split(".").map(Number)}function pPr(e,t){if(!e||!t||e===t)return;let r=dPr(e),n=dPr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var RL=k(I(),1),J0o={height:16,fontSize:10},eyo={opacity:.6,fontSize:"0.85em"};function tyo(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 Iee({nodes:e,name:t,showVersion:r=!1}){let n=sTe()??Op,o=e.links.find(a=>a.name===t),i=pPr(o?.peerVersion,n);return(0,RL.jsx)(rr,{title:tyo(e,t),placement:"right",children:(0,RL.jsxs)(V,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,RL.jsx)(uPr,{sx:{fontSize:8,color:fPr(o?.state)}}),t,r&&o?.peerVersion&&(0,RL.jsxs)(V,{component:"span",sx:eyo,children:["v",o.peerVersion]}),i&&(0,RL.jsx)(Yn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:J0o})]})})}var AL=k(I(),1),ryo={opacity:.6},nyo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function hPr({nodes:e,name:t,clone:r}){let n=(0,AL.jsx)(Iee,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,AL.jsx)(V,{component:"span",sx:ryo,children:n}):(0,AL.jsx)(rr,{title:fU(t,r.cloneTarget),children:(0,AL.jsxs)(V,{component:"span",sx:nyo,children:[(0,AL.jsx)(uU,{sx:{fontSize:14}}),n]})})}var gPr=k(I(),1),oyo={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 mPr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,gPr.jsx)(ir,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:oyo,children:t})}var yPr={ArrowRight:1,ArrowLeft:-1};function iyo(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+yPr[e.key]+r)%r}function vPr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!yPr[o.key]){rT(o);return}let i=iyo(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var bPr=k(oe(),1);function PU(e){return e?.querySelector('[aria-checked="true"]')}function xPr(e,t){(0,bPr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=PU(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var hXe=k(I(),1),ayo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function hTe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return xPr(i,r),(0,hXe.jsx)(_t,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:vPr(t,r,n,l),sx:ayo,children:t.map(u=>(0,hXe.jsx)(mPr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var mXe=k(I(),1);function TPr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=il(),a=(0,SPr.useRef)(null);return!i||!n||!e?null:(0,mXe.jsx)(hTe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,mXe.jsx)(hPr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var mTe=k(I(),1);function CPr({prompt:e,children:t}){return(0,mTe.jsxs)(_t,{children:[e,(0,mTe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var kPr=k(I(),1),syo=".MuiOutlinedInput-notchedOutline",lyo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${syo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function wPr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,kPr.jsx)(Un,{sx:lyo,value:e,onChange:a=>t(a.target.value),onKeyDown:rT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var APr=k(oe(),1);var Ey={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:Ibe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},_Pr=Object.keys(Ey);var gXe=k(I(),1);function EPr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,gXe.jsx)(Js,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,gXe.jsx)(un,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:vc(i)},i))})}var PL=k(I(),1);function RPr(e){return t=>t==="prompt"&&e?(0,PL.jsxs)(PL.Fragment,{children:["prompt",(0,PL.jsx)(V,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${vc(e)}`}),(0,PL.jsx)(jd,{sx:{fontSize:18,mr:-.75}})]}):t}var LL=k(I(),1);function PPr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,APr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(PU(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,LL.jsxs)(LL.Fragment,{children:[(0,LL.jsx)(hTe,{label:"Mode",options:_Pr,value:e.mode,onChange:l,optionLabel:RPr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,LL.jsx)(EPr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var UPr=k(oe(),1);var yXe=k(I(),1),cyo={zIndex:e=>e.zIndex.modal+1};function LPr({open:e,anchor:t,children:r}){return(0,yXe.jsx)(o7,{open:e,anchorEl:t,placement:"bottom-start",sx:cyo,children:(0,yXe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var IPr=k(I(),1),MPr=nt((0,IPr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var vXe=k(I(),1),uyo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},fyo={fontSize:16,color:"text.disabled"};function DPr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:uyo,endAdornment:(0,vXe.jsx)(Vke,{position:"end",children:(0,vXe.jsx)(MPr,{sx:fyo})})}}}var NPr=k(WI(),1);function OPr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}rT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,NPr.flushSync)(()=>{r(t),n()}),rT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function gTe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Rb(n).toLowerCase().includes(r)):e}var bXe=k(oe(),1);function BPr(){let[e,t]=(0,bXe.useState)(!1),[r,n]=(0,bXe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var $Pr=k(oe(),1);var FPr=e=>e?Rb(e):"";function zPr(e){let[t,r]=(0,$Pr.useState)(()=>FPr(e));return{text:t,setText:r,showRepo:n=>r(FPr(n))}}function HPr(e,t,r){let n=BPr(),o=zPr(t),i=gTe(e,n.query),a=f=>{r(f),o.showRepo(f)},s=w5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:OPr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{o.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:f=>{a(f),n.close()}}}var LU=k(I(),1);function WPr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=HPr(e,t,r),s=(0,UPr.useRef)(null);return(0,LU.jsxs)(V,{ref:s,sx:{flex:1,minWidth:0},children:[(0,LU.jsx)(Un,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:DPr(a.open)}),(0,LU.jsx)(LPr,{open:a.open,anchor:s.current,children:(0,LU.jsx)(BSe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var B5=k(I(),1);function GPr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=Vn();return(0,B5.jsxs)(CPr,{prompt:(0,B5.jsx)(wPr,{value:r.prompt,onChange:r.setPrompt,placeholder:Ey[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,B5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,B5.jsx)(WPr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,B5.jsx)(PPr,{...t})]}),(0,B5.jsx)(TPr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var jPr=k(I(),1),VPr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function qPr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,jPr.jsx)(Tt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var IL=k(I(),1),dyo=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"}),pyo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function YPr(e){return(0,IL.jsxs)(_t,{direction:"row",sx:dyo,children:[VPr.map(([t,r])=>(0,IL.jsxs)("span",{children:[(0,IL.jsx)(V,{component:"kbd",sx:pyo,children:t}),r]},t)),(0,IL.jsx)(V,{sx:{flex:1}}),(0,IL.jsx)(qPr,{...e})]})}var ML=k(oe(),1);function KPr(e,t){let r=(0,ML.useRef)(e),n=(0,ML.useRef)(null),o=(0,ML.useRef)(null),i=(0,ML.useRef)(null),a=(0,ML.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:p}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,p)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:PU(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function hyo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:$Se(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function XPr(e,t){let{names:r,visible:n}=il(),o=DSe(t,n?r:[void 0]);return{cloneState:o,target:hyo(t,e,o(e))}}function yTe({mode:e,harness:t,prompt:r,cwd:n,node:o},i){let a=n||void 0,s=o?[o]:[];if(e==="prompt"){t==="claude"?i.onCreate(r,a,...s):i.onCreateHarness(t,r,a,...s);return}if(e==="design"){i.onCreateDesign(r,a,...s);return}let l=o?[{node:o}]:[];C1r(Ey[e].sessionMode,n,(u,f)=>i.onCreateAssist(u,f,...l),()=>{},r)}function QPr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(_Se(r.prompt,n.onCreateAssist),!0):(yTe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var vTe=k(oe(),1);function ZPr(e,t){let[r,n]=(0,vTe.useState)(!1);return(0,vTe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function JPr(e,t,r,n,o){let i=ZPr(e,()=>{QPr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Mee=k(oe(),1);function e6r(e,t){let r=(0,Mee.useRef)(e),n=(0,Mee.useRef)(null);return(0,Mee.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var r6r=k(I(),1),myo={border:0,margin:0,padding:0,minWidth:0};function t6r({loading:e,restoreFocus:t,children:r}){let n=e6r(e,t);return(0,r6r.jsx)("fieldset",{disabled:e,style:myo,onFocus:n,children:r})}var xTe=k(I(),1);function bTe({error:e,onRetry:t}){return e?(0,xTe.jsxs)(jn,{severity:"error",sx:{mx:2,my:1},action:t&&(0,xTe.jsx)(Tt,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var F5=k(I(),1);function n6r({draft:e,launchers:t,onClose:r}){let n=KPr(e.focus,e.setFocus),o=AU(Wg()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=XPr(e.node,e.cwd),l=JPr(e,i,a,t,r);return(0,F5.jsx)(cTe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,F5.jsx)("form",{onSubmit:l,children:(0,F5.jsxs)(t6r,{loading:e.modePending,restoreFocus:n.restore,children:[(0,F5.jsx)(GPr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,F5.jsx)(bTe,{error:e.modeError,onRetry:e.retryMode}),(0,F5.jsx)(YPr,{submitLabel:a.kind==="clone"?"Clone":Ey[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var DL=k(oe(),1);async function gyo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await Jt(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(Ey,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Cr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function STe(e,t=0){let[r,n]=(0,DL.useState)(0),[o,i]=(0,DL.useState)(null),a=(0,DL.useCallback)(()=>n(l=>l+1),[]);if((0,DL.useEffect)(()=>{let l=!1;return gyo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function TTe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function o6r(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var VT=k(oe(),1),i6r={field:"prompt",selectionStart:0,selectionEnd:0};function a6r(){let[e,t]=(0,VT.useState)(""),[r,n]=(0,VT.useState)(),[o,i]=(0,VT.useState)(),[a,s]=(0,VT.useState)("claude"),[l,u]=(0,VT.useState)(),[f,d]=(0,VT.useState)(i6r),p=(0,VT.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),d(i6r)},[]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:d,clear:p}}function s6r(e,t=STe){let{selectedCwd:r}=Vn(),n=il(),o=a6r(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:TTe(o.mode,a),retryMode:a.retry,node:o6r(o.node,n)}:null}function l6r(e){Bi(to("newSession").matches,e)}var c6r=k(oe(),1);function u6r(e,t){let{selectedCwd:r}=Vn(),[n,o]=$s(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,c6r.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[i,a,s,l,u,t,o])}var d6r=k(I(),1);function f6r({launchers:e}){let[t,r]=(0,Dee.useState)(!1),[n,o]=(0,Dee.useState)(0),i=s6r(n),a=(0,Dee.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return l6r(a),u6r(i,a),!t||!i?null:(0,d6r.jsx)(n6r,{draft:i,launchers:e,onClose:()=>r(!1)})}var CTe=k(I(),1);function p6r({reconnecting:e}){return(0,CTe.jsx)(hu,{open:e,children:(0,CTe.jsx)(jn,{severity:"info",variant:"filled",icon:(0,CTe.jsx)(bo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Ry=k(I(),1);function h6r({socket:e,onViewLaunchedSession:t}){return(0,Ry.jsxs)(Ry.Fragment,{children:[(0,Ry.jsx)(aPr,{}),(0,Ry.jsx)(f6r,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Ry.jsx)(p6r,{reconnecting:e.reconnecting}),(0,Ry.jsx)(QAr,{}),(0,Ry.jsx)(sl,{error:e.error,onClose:e.clearError}),(0,Ry.jsx)(lPr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Fb=k(oe(),1);var yyo=6e4;function vyo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function wTe(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4023
4023
|
`),[n,o]=(0,Fb.useState)([]),i=(0,Fb.useRef)(0),a=(0,Fb.useCallback)(()=>{let l=r?r.split(`
|
|
4024
4024
|
`):[];if(l.length===0)return;let u=++i.current;o(f=>vyo(f,l,t));for(let f of l)tSe(f,f===t).then(d=>{u===i.current&&o(p=>p.map(h=>h.name===f?d:h))})},[r,t]);(0,Fb.useEffect)(()=>{a();let l=setInterval(a,yyo);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Fb.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var $5=k(I(),1);function m6r({shell:e,children:t}){let{socket:r,selection:n,launch:o,sidebarCollapse:i}=e,a=wTe(r.nodeSelection);return(0,$5.jsx)(MKe.Provider,{value:a,children:(0,$5.jsx)(C3e.Provider,{value:i,children:(0,$5.jsx)(cq.Provider,{value:n,children:(0,$5.jsx)(t3e.Provider,{value:r.nodeSelection,children:(0,$5.jsx)(Fl.Provider,{value:n.selectedNode,children:(0,$5.jsx)(vqe.Provider,{value:o,children:(0,$5.jsx)(xft,{children:t})})})})})})})}var g6r=k(I(),1),y6r=nt((0,g6r.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 v6r=k(oe(),1);var Ay=k(I(),1),byo={ml:1,textTransform:"none",fontSize:12};function b6r(){let{nodes:e,names:t,visible:r,selected:n,select:o}=il(),[i,a]=(0,v6r.useState)(null);return!r||!e||!n?null:(0,Ay.jsxs)(Ay.Fragment,{children:[(0,Ay.jsx)(Tt,{size:"small",color:"inherit",startIcon:(0,Ay.jsx)(y6r,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:byo,children:(0,Ay.jsx)(Iee,{nodes:e,name:n})}),(0,Ay.jsx)(Js,{anchorEl:i,open:!!i,onClose:()=>a(null),children:t.map(s=>(0,Ay.jsx)(un,{selected:s===n,onClick:()=>{o(s),a(null)},sx:{fontSize:13},children:(0,Ay.jsx)(Iee,{nodes:e,name:s,showVersion:!0})},s))})]})}var Nee=k(oe(),1);function x6r(e,t){return[...e[0].slice(0,-1),String(t+1)]}var NL=k(I(),1),xyo=[Oi("secondary"),{ml:.75}];function S6r({index:e,label:t,count:r,...n}){let{chords:o}=to("navTab");return(0,NL.jsx)(rr,{describeChild:!0,title:(0,NL.jsx)(of,{label:t,chords:[x6r(o,e)]}),children:(0,NL.jsx)(Tx,{label:r?(0,NL.jsxs)("span",{children:[t,(0,NL.jsx)(V,{component:"span",sx:xyo,children:r})]}):t,...n})})}var T6r=k(oe(),1);var Syo=6e4;function C6r(){let e=Wve();return(0,T6r.useEffect)(()=>{Es.refresh();let t=setInterval(()=>{Es.refresh()},Syo);return()=>clearInterval(t)},[]),e?.length??0}var xXe=k(oe(),1);function w6r(e,t){let{bound:r}=to("navTab"),n=e.length,o=(0,xXe.useCallback)(a=>(vq(a,r)??n)<n,[r,n]),i=(0,xXe.useCallback)(a=>{let s=e[vq(a,r)??-1];s&&t(s)},[e,t,r]);Bi(o,i)}var kTe=k(oe(),1);function k6r(){let[e,t]=(0,kTe.useState)(!1);return(0,kTe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await Jt("/api/news/nav")).json();r||t(o?.showInNav===!0)}catch(n){Cr(n,"news nav"),r||t(!1)}})(),()=>{r=!0}},[]),e}var _Te=k(oe(),1);async function Tyo(e,t){let r=await Jt(Vr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function _6r(e){let[t,r]=(0,_Te.useState)(null),n=pr(),o=`${n??""}\0${e}`;return(0,_Te.useEffect)(()=>{if(!e)return;let i=!1;return Tyo(e,n).catch(a=>{Cr(a,"releases configured")}).then(a=>{i||r({key:o,configured:a})}),()=>{i=!0}},[e,n,o]),t?.key===o?t.configured:void 0}var E6r=k(oe(),1);function R6r(e){let{pathname:t}=ii(),r=Kr(),n=t==="/releases"||t.startsWith("/releases/");(0,E6r.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var Cyo={path:"/sessions",label:"Sessions"},wyo={path:"/backlog",label:"Backlog"},kyo={path:"/next",label:"Next"},_yo={path:"/releases",label:"Releases"},Eyo={path:"/news",label:"News"},Ryo={path:"/inbox",label:"Inbox"};function A6r(e,t){return[Cyo,wyo,kyo,...e?[_yo]:[],...t?[Eyo]:[],Ryo]}var SXe=k(I(),1),Ayo={mx:"6px"};function P6r({cwd:e}){let t=ii(),r=Kr(),n=_6r(e),o=k6r(),i=C6r();R6r(n);let a=n===!0,s=(0,Nee.useMemo)(()=>A6r(a,o),[a,o]),l=(0,Nee.useMemo)(()=>s.map(d=>d.path),[s]),u=s.findIndex(d=>t.pathname.startsWith(d.path)),f=(0,Nee.useCallback)(d=>{t.pathname!==d&&r(d)},[t.pathname,r]);return w6r(l,f),(0,SXe.jsx)(a3,{sx:Ayo,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((d,p)=>(0,SXe.jsx)(S6r,{index:p,label:d.label,count:d.path==="/inbox"?i:void 0,onClick:()=>f(d.path)},d.path))})}var Oee=k(I(),1),L6r=(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)"}}),Pyo=e=>({ml:.75,...e.tokens.color.appBar?L6r("primary.main","primary.contrastText"):L6r("primary.contrastText","primary.main")});function I6r(){let[,e]=$s(),{label:t,chords:r}=to("newSession");return(0,Oee.jsx)(rr,{title:(0,Oee.jsx)(of,{label:t,chords:r}),children:(0,Oee.jsx)(Vt,{sx:Pyo,"aria-label":"New session",onClick:()=>e(o=>(o.set("new",""),o),{replace:!0}),children:(0,Oee.jsx)(qd,{})})})}var ETe=k(oe(),1);var Bee=k(I(),1),Lyo={strokeWidth:2};function M6r(e){return(0,Bee.jsxs)(Nbe,{viewBox:"0 0 24 24",sx:Lyo,...e,children:[(0,Bee.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,Bee.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var Fee=k(I(),1);function D6r({cwd:e}){let[t,r]=(0,ETe.useState)(null),n=pr();return(0,ETe.useEffect)(()=>{if(!e){r(null);return}let o=!1;return(async()=>{try{let a=await(await Jt(Vr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();o||r(a?.url??null)}catch(i){Cr(i,"GitHub URL"),o||r(null)}})(),()=>{o=!0}},[e,n]),t?(0,Fee.jsx)(rr,{title:"Open in GitHub",children:(0,Fee.jsx)(V,{component:"span",sx:Obe,children:(0,Fee.jsx)(Vt,{onClick:()=>window.open(t,"_blank"),children:(0,Fee.jsx)(M6r,{})})})}):null}var Py=k(I(),1),Iyo={color:"inherit",mr:1.5};function N6r({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:o}=v5("webserver",e);return(0,Py.jsxs)(Py.Fragment,{children:[(0,Py.jsx)(rr,{title:"Restart web server",children:(0,Py.jsx)("span",{children:(0,Py.jsx)(Vt,{sx:Iyo,disabled:t,onClick:o,children:t?(0,Py.jsx)(bo,{size:24}):(0,Py.jsx)(Dz,{})})})}),(0,Py.jsx)(sl,{error:r,onClose:n})]})}var F6r=k(oe(),1);var O6r=k(oe(),1);function B6r(e){let t=Sn().palette.primary.main;Bi(to("focusRepoPicker").matches,(0,O6r.useCallback)(()=>bc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var $ee=k(I(),1),Myo={width:240,ml:2};function $6r({repos:e,selected:t,onSelect:r}){let n=(0,F6r.useRef)(null);B6r(n);let{chords:o}=to("focusRepoPicker");return(0,$ee.jsx)(V,{ref:n,sx:Myo,children:(0,$ee.jsx)(Mbe,{label:t?Rb(t):"Select repo...",tooltip:(0,$ee.jsx)(of,{label:"Repo",chords:o}),typeToOpen:!0,children:(i,a)=>(0,$ee.jsx)(V4r,{repos:e,selected:t,onSelect:r,close:i,initialFilter:a})})})}var K6r=k(oe(),1);var zee=k(oe(),1);function RTe(e){let[t,r]=(0,zee.useState)([]),[n,o]=(0,zee.useState)(!0),i=pr();return(0,zee.useEffect)(()=>{if(!e){r([]),o(!1);return}let a=!1;return o(!0),Jt(Vr(`/api/pr-list?cwd=${encodeURIComponent(e)}`,i)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),o(!1))}).catch(s=>{Cr(s,"open PRs"),!a&&(r([]),o(!1))}),()=>{a=!0}},[e,i]),{prs:t,loading:n}}var TXe=k(I(),1);function CXe({text:e}){return(0,TXe.jsx)(V,{sx:{p:1.5},children:(0,TXe.jsx)(Ee,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var OL=k(I(),1);function z6r({pr:e,highlighted:t,onHover:r,onPick:n}){let o=OSe(t);return(0,OL.jsx)(un,{ref:o,selected:t,onMouseDown:i=>i.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,OL.jsxs)(_t,{spacing:.25,sx:{minWidth:0},children:[(0,OL.jsxs)(Ee,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,OL.jsx)(Yn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,OL.jsxs)(Ee,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",Po(e.createdAt)]})]})})}var wXe=k(I(),1);function H6r({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,wXe.jsx)(Sm,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((o,i)=>(0,wXe.jsx)(z6r,{pr:o,highlighted:i===t,onHover:()=>r(i),onPick:n},o.number))})}var W6r=k(oe(),1);function U6r(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(o=>o.title.toLowerCase().includes(r)||o.author.toLowerCase().includes(r)||n!==""&&String(o.number).includes(n))}function G6r(e,t,r){let[n,o]=(0,W6r.useState)(""),i=U6r(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=w5(i,n,t,r);return{filter:n,setFilter:o,filtered:i,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var z5=k(I(),1),V6r={...rH,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function q6r({cwd:e,onPick:t,close:r}){let{prs:n,loading:o}=RTe(e),i=G6r(n,t,r);return o||n.length===0?(0,z5.jsx)(rn,{elevation:4,sx:V6r,children:(0,z5.jsx)(CXe,{text:o?"Loading open PRs\u2026":"No open PRs"})}):(0,z5.jsxs)(rn,{elevation:4,sx:V6r,children:[(0,z5.jsx)(bw,{autoFocus:!0,value:i.filter,onChange:i.setFilter,onKeyDown:i.onKeyDown,placeholder:"Filter PRs..."}),i.filtered.length===0?(0,z5.jsx)(CXe,{text:"No PRs match"}):(0,z5.jsx)(H6r,{prs:i.filtered,highlight:i.highlight,onHighlight:i.setHighlight,onPick:i.select})]})}var Y6r=k(I(),1);function j6r({cwd:e,onPick:t,close:r}){return(0,Y6r.jsx)(q6r,{cwd:e,onPick:t,close:r})}var H5=k(I(),1);function X6r({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:o}=RTe(e),[i,a]=(0,K6r.useState)(null);return o||n.length===0?null:(0,H5.jsxs)(H5.Fragment,{children:[(0,H5.jsx)(Mbe,{label:"prs",disabled:t,children:s=>(0,H5.jsx)(j6r,{cwd:e,onPick:a,close:s})}),i&&(0,H5.jsx)(fbe,{pr:i,onSelect:s=>{r(i,s),a(null)},onCancel:()=>a(null)})]})}var Z6r=k(I(),1);function Q6r({onStartRun:e,cwd:t}){let r=Pbe(t);return!t||r.length===0?null:(0,Z6r.jsx)(Rbe,{runs:r,onSelect:n=>e(n,t)})}var Hee=k(I(),1);function J6r({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=Vn();return(0,Hee.jsxs)(_t,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,Hee.jsx)(X6r,{cwd:r,disabled:!r,onSelect:(o,i)=>e([...i,String(o.number)],r,{...SE(o),node:n})}),(0,Hee.jsx)(Q6r,{onStartRun:(o,i)=>t(o,i,void 0,void 0,n),cwd:r})]})}var tm=k(I(),1),Dyo={minHeight:48,pl:1,pr:14};function eLr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=Lw();return(0,tm.jsxs)(i3,{variant:"dense",disableGutters:!0,sx:Dyo,children:[r&&(0,tm.jsx)(sse,{collapsed:r,onToggleCollapsed:n}),(0,tm.jsx)(N6r,{reconnecting:e.reconnecting}),(0,tm.jsx)(P6r,{cwd:t.selectedCwd}),(0,tm.jsx)(b6r,{}),(0,tm.jsx)($6r,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,tm.jsxs)(V,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,tm.jsx)(Bbe,{cwd:t.selectedCwd}),(0,tm.jsx)(D6r,{cwd:t.selectedCwd}),(0,tm.jsx)(I6r,{})]}),(0,tm.jsx)(J6r,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var ATe=k(oe(),1);function tLr(){let[e,t]=(0,ATe.useState)(null);return(0,ATe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await Jt("/api/health")).json();!r&&typeof o?.nodeName=="string"&&t(o.nodeName)}catch(n){Cr(n,"node name")}})(),()=>{r=!0}},[]),e}var nLr=k(I(),1),Nyo={lineHeight:"32px",bgcolor:"transparent"};function rLr(){let e=tLr();return e?(0,nLr.jsx)(Tke,{sx:Nyo,children:e}):null}var oLr=k(I(),1),iLr=nt((0,oLr.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 aLr=k(I(),1),sLr=nt((0,aLr.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 lLr=k(I(),1),cLr=nt((0,lLr.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 uLr=k(I(),1),fLr=nt((0,uLr.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 kXe=k(I(),1);function dLr({mode:e}){return e==="dark"?(0,kXe.jsx)(fLr,{fontSize:"small"}):(0,kXe.jsx)(cLr,{fontSize:"small"})}var pLr=k(I(),1),hLr=nt((0,pLr.jsx)("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m4.5-4H7V4h9z"}),"PhoneIphone");var IU=k(I(),1);function mLr({onClose:e}){let t=Kr();return(0,IU.jsxs)(un,{onClick:()=>{e(),t("/connect-mobile")},children:[(0,IU.jsx)(r1,{children:(0,IU.jsx)(hLr,{fontSize:"small"})}),(0,IU.jsx)(Nd,{children:"Connect mobile"})]})}var gLr=k(I(),1),yLr=nt((0,gLr.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 MU=k(I(),1);function vLr(){let e=bbe();return(0,MU.jsxs)(un,{onClick:()=>h2t(!e),children:[(0,MU.jsx)(r1,{children:(0,MU.jsx)(yLr,{fontSize:"small"})}),(0,MU.jsx)(Nd,{children:e?"Hide render HUD":"Show render HUD"})]})}var Ys=k(I(),1);function bLr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:o,onConnectMobile:i,onRestart:a,onUpdate:s}){return[(0,Ys.jsxs)(un,{onClick:n,children:[(0,Ys.jsx)(r1,{children:(0,Ys.jsx)(dLr,{mode:e})}),(0,Ys.jsx)(Nd,{children:"Toggle dark mode"})]},"color-mode"),(0,Ys.jsx)(vLr,{},"render-hud"),(0,Ys.jsxs)(un,{onClick:o,children:[(0,Ys.jsx)(r1,{children:(0,Ys.jsx)(iLr,{fontSize:"small"})}),(0,Ys.jsx)(Nd,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,Ys.jsx)(mLr,{onClose:i},"connect-mobile"),(0,Ys.jsx)(lo,{},"restart-divider"),(0,Ys.jsxs)(un,{onClick:a,children:[(0,Ys.jsx)(r1,{children:(0,Ys.jsx)(rM,{fontSize:"small"})}),(0,Ys.jsx)(Nd,{children:t})]},"restart"),(0,Ys.jsxs)(un,{onClick:s,children:[(0,Ys.jsx)(r1,{children:(0,Ys.jsx)(sLr,{fontSize:"small"})}),(0,Ys.jsx)(Nd,{children:r})]},"update")]}var xLr=k(oe(),1);var TLr=k(I(),1);function SLr({peer:e,onRestart:t,onClose:r}){let[n,o]=(0,xLr.useState)(!1);return(0,TLr.jsx)(Io,{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:()=>{o(!0),t(e).finally(r)},onCancel:r})}function CLr(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 Oyo=Object.keys(K8);function wLr(){let e=X8();return CLr(Oyo.map(t=>ww(t,e)))}var rm=k(I(),1),Byo={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},Fyo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function kLr({onClose:e}){let t=wLr();return(0,rm.jsxs)(pc,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,rm.jsxs)(Xu,{id:"shortcuts-dialog-title",sx:Byo,children:["Keyboard shortcuts",(0,rm.jsx)(Vt,{size:"small","aria-label":"Close",onClick:e,children:(0,rm.jsx)(Lo,{fontSize:"small"})})]}),(0,rm.jsx)(Ku,{dividers:!0,children:t.map(r=>(0,rm.jsxs)(V,{component:"section",sx:{mb:1.5},children:[(0,rm.jsx)(Ee,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,rm.jsxs)(V,{sx:Fyo,children:[(0,rm.jsx)(Ee,{variant:"body2",children:n.label}),(0,rm.jsx)(_t,{direction:"row",spacing:.5,children:(0,rm.jsx)($ae,{chords:n.chords})})]},n.label))]},r.name))})]})}var BL=k(I(),1);function _Lr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:o,restart:i}=v5(JH.target,e);return(0,BL.jsxs)(BL.Fragment,{children:[(0,BL.jsx)(Io,{title:JH.label,message:JH.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{i()},onCancel:t}),(0,BL.jsx)(sl,{error:n,onClose:o})]})}var RLr=k(I(),1);function $yo(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 ELr({peer:e,onConfirm:t,onClose:r}){return(0,RLr.jsx)(Io,{...$yo(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var Ly=k(oe(),1);async function zyo(e){try{let t=await Jt(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch(t){return Cr(t,"node doctor"),null}}async function ALr(e,t){let r=await zyo(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var qT=k(oe(),1);function PLr(e){let{nodes:t}=il(),[r,n]=(0,qT.useState)(null),o=(0,qT.useRef)(!1),i=r?t?.links.find(l=>l.name===r.peer):void 0;(0,qT.useEffect)(()=>{if(!(!r||!i)){if(i.state!=="connected"){o.current=!0;return}o.current&&(n(null),e(r.describe(r.peer,i.peerVersion)))}},[r,i,e]);let a=(0,qT.useCallback)((l,u)=>{o.current=!1,n({peer:l,describe:u})},[]),s=(0,qT.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var Hyo=9e4;function PTe(){let[e,t]=(0,Ly.useState)(null),[r,n]=(0,Ly.useState)(null),o=(0,Ly.useRef)(void 0),i=(0,Ly.useCallback)(f=>{clearTimeout(o.current),t(f)},[]),{watch:a,stop:s}=PLr(i);(0,Ly.useEffect)(()=>()=>clearTimeout(o.current),[]);let l=(0,Ly.useCallback)(async(f,d)=>{n(await ALr(f,d))},[]);return{requestThenAwait:(0,Ly.useCallback)(async(f,d,p,h)=>{let m;try{m=await p()}catch(g){Cr(g,`${d} ${f}`)}return m?.ok?(a(f,h),clearTimeout(o.current),o.current=setTimeout(()=>{s(),l(f,`${f} did not come back`)},Hyo),!0):(await l(f,`${d} failed (${await g5(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var Uyo=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function LLr(){let{requestThenAwait:e,...t}=PTe();return{restart:n=>e(n,`Restart ${n}`,()=>y5("both",n),Uyo),...t}}var Uee=k(oe(),1);function LTe(e){return Jt(Vr("/api/self-update",e),{method:"POST",timeoutMs:66e4})}var Iy=k(oe(),1);function ILr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function ITe(e,t,r){let[n,o]=(0,Iy.useState)(!1),[i,a]=(0,Iy.useState)(!1),s=(0,Iy.useRef)(!1),l=(0,Iy.useRef)(e);l.current=e;let u=(0,Iy.useRef)(new Set),f=(0,Iy.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(ILr).map(d=>d.id)),o(!0)},[]);return(0,Iy.useEffect)(()=>{if(!n||i)return;if(t){s.current=!0;return}if(!s.current)return;e.some(p=>ILr(p)&&p.node===r&&!u.current.has(p.id))&&a(!0)},[n,i,t,e,r]),{arm:f,completed:i}}var MLr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function DLr(e){let{nodes:t}=il(),{launchAssist:r}=_l(),{requestThenAwait:n,...o}=PTe(),[i,a]=(0,Uee.useState)(null),[s,l]=(0,Uee.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=ITe(e,u(s)!=="connected",s);(0,Uee.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>y5("webserver",s),MLr))},[d,s,n]);let p=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>LTe(m),MLr),a(null)};return{update:m=>{if(u(m)!=="connected"){p(m);return}l(m),f(),r(["update"],void 0,{node:m})},progress:i,...o}}var My=k(I(),1);function NLr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:o}){let{launchAssist:i,armUpdateReload:a}=_l(),s=LLr(),l=DLr(r);return(0,My.jsxs)(My.Fragment,{children:[e==="shortcuts"&&(0,My.jsx)(kLr,{onClose:o}),e==="restart"&&t&&(0,My.jsx)(SLr,{peer:t,onRestart:s.restart,onClose:o}),e==="restart"&&!t&&(0,My.jsx)(_Lr,{reconnecting:n,onClose:o}),e==="update"&&(0,My.jsx)(ELr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),i(["update"])},onClose:o}),(0,My.jsx)(JJ,{notices:s}),(0,My.jsx)(JJ,{notices:l})]})}var OLr=k(I(),1),BLr=nt((0,OLr.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 MTe=k(I(),1),Wyo="https://staffordwilliams.com/assist";function FLr(){return(0,MTe.jsx)(rr,{title:"Help",children:(0,MTe.jsx)(Vt,{component:"a",href:Wyo,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,MTe.jsx)(BLr,{fontSize:"small"})})})}var $Lr=k(I(),1),zLr=nt((0,$Lr.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 HLr=k(oe(),1);var Wee=k(I(),1);function ULr(){let e=Kr(),t=(0,HLr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=to("openConfig");return Bi(r,t),(0,Wee.jsx)(rr,{describeChild:!0,title:(0,Wee.jsx)(of,{label:"Config",chords:n}),children:(0,Wee.jsx)(Vt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,Wee.jsx)(zLr,{fontSize:"small"})})})}var WLr=k(I(),1),GLr=nt((0,WLr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var DTe=k(oe(),1);var Gee=k(I(),1);function VLr({open:e,onOpen:t}){let r=(0,DTe.useRef)(null),{matches:n,chords:o}=to("openMenu");return Bi(n,(0,DTe.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,Gee.jsx)(rr,{describeChild:!0,title:(0,Gee.jsx)(of,{label:"Menu",chords:o}),children:(0,Gee.jsx)(Vt,{ref:r,onClick:i=>t(i.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,Gee.jsx)(GLr,{fontSize:"small"})})})}var DU=k(I(),1);function qLr({open:e,onOpen:t}){return(0,DU.jsxs)(V,{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,DU.jsx)(FLr,{}),(0,DU.jsx)(ULr,{}),(0,DU.jsx)(VLr,{open:e,onOpen:t})]})}var FL=k(oe(),1);var YLr=k(oe(),1);var jLr=!0,Gyo=new Set(["openMenu","cycleCards"]),Vyo=Object.keys(K8).filter(e=>!Gyo.has(e));function KLr(e,t){let r=X8();(0,YLr.useEffect)(()=>{if(!e)return;let n=o=>{Vyo.some(i=>ww(i,r).matches(o))&&t()};return globalThis.addEventListener("keydown",n,jLr),()=>globalThis.removeEventListener("keydown",n,jLr)},[e,t,r])}function XLr(){let[e,t]=(0,FL.useState)(null),[r,n]=(0,FL.useState)(!0),o=!!e,i=(0,FL.useCallback)(()=>t(null),[]),a=(0,FL.useCallback)(s=>{n(!0),t(s)},[]);return KLr(o,(0,FL.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:o,close:i,openAt:a,restoreFocus:r}}var Vee=k(oe(),1);function QLr(e){Bi(to("shortcutsSheet").matches,e)}function ZLr(){let[e,t]=(0,Vee.useState)(null);QLr((0,Vee.useCallback)(()=>t("shortcuts"),[]));let r=(0,Vee.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function JLr(){let{nodes:e,selected:t}=il();return e&&t&&t!==e.local?t:void 0}function eIr(e){return{restartLabel:e?`Restart ${e}`:JH.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var jT=k(I(),1);function tIr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:o,open:i,close:a,openAt:s,restoreFocus:l}=XLr(),{dialog:u,showDialog:f,closeDialog:d}=ZLr(),p=JLr(),h=m=>()=>{a(),f(m)};return(0,jT.jsxs)(jT.Fragment,{children:[(0,jT.jsx)(qLr,{open:i,onOpen:s}),(0,jT.jsxs)(Js,{anchorEl:o,open:i,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,jT.jsx)(rLr,{}),bLr({mode:e,...eIr(p),onToggleColorMode:()=>{t(),a()},onShowShortcuts:h("shortcuts"),onConnectMobile:a,onRestart:h("restart"),onUpdate:h("update")})]}),(0,jT.jsx)(NLr,{dialog:u,peer:p,sessions:r,reconnecting:n,onClose:d})]})}var oIr=k(oe(),1);var nIr=k(I(),1);function rIr({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:o,port:i,group:a}=e.existing,s=Da(o),l=i?` on port ${i}`:"",u=s?` in ${s}`:"",f=a?`, holding the ${a} server slot`:"";return(0,nIr.jsx)(Io,{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 NTe=k(I(),1);function iIr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:o,stopSession:i,startRun:a,discardSession:s}=e,l=(0,oIr.useMemo)(()=>({onStop:i,onStart:a,onDiscard:s}),[i,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&o(r.sessionId,!0),n())};return(0,NTe.jsxs)(m3e.Provider,{value:l,children:[t,r&&(0,NTe.jsx)(rIr,{conflict:r,onConfirm:u,onCancel:n})]})}var aIr=new Map;function sIr(e,t){if(!qle())return;let r=aIr.get(e);if(aIr.set(e,t),!!r)for(let[n,o]of Object.entries(t))Object.is(o,r[n])||E1(`\u0394 ${e}.${n}`)}var BTe=k(oe(),1);function lIr(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let o=r.find(i=>i.id===n);return!o||ol(o)!==t?null:n}function $b(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function OTe(){let{pathname:e}=ii();return e.startsWith("/backlog")||e.startsWith("/usage")}function cIr({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:o,onSelect:i}){let a=$b(t,r,n),s=a&&ol(a),l=!!(s&&s===e),u=lIr(o,e,r),f=(0,BTe.useRef)(t),d=OTe();(0,BTe.useEffect)(()=>{let p=f.current!==t&&!!s;f.current=t,!(d||p||l||!u)&&i(u)},[t,s,l,u,i,d])}var zTe=k(oe(),1);function uIr(e,t,r,n){return $b(e,t,r)?.cwd||n}function fIr(e,t,r,n){let o=uIr(e,t,r,n.cwd),i=$b(e,t,r);return{cwd:o,node:i?.cwd?i.node:n.node}}var _Xe=k(oe(),1);function dIr(e,t,r){let{cwd:n,node:o,origin:i}=r,a=(0,_Xe.useCallback)((l,u)=>{let f=Dp(u,t),d=Cee(e,l);return d?d.clones[f]:f===(l===n?o:Ad)?l:void 0},[e,t,n,o]),s=(0,_Xe.useCallback)(l=>Cee(e,l)?.origin??(l===n?i:void 0),[e,n,i]);return{cloneOn:a,originOf:s}}var FTe=k(oe(),1);function pIr(e,t,r,n){let o=(0,FTe.useRef)(e);(0,FTe.useEffect)(()=>{if(o.current===e)return;o.current=e;let i=Cee(t,r)?.clones[e];i&&n(i,e)},[e,t,r,n])}var NU=k(oe(),1);function hIr(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(o=>Object.entries(o.clones).filter(([,i])=>i===t.cwd).map(([i])=>i)));return n.has(r)?r:n.size===0||n.has(Ad)?Ad:[...n][0]}function mIr(e,t,r,n){let[o,i]=(0,NU.useState)({cwd:e}),a=(0,NU.useCallback)((l,u,f)=>i({cwd:l,node:u,origin:f}),[]);(0,NU.useEffect)(()=>{e&&!o.cwd&&i({cwd:e})},[e,o.cwd]);let s=hIr(t,{cwd:o.cwd,node:o.node===void 0?void 0:Dp(o.node,n)},r);return{selectedCwd:o.cwd,selectedNode:s||void 0,selectedPick:{cwd:o.cwd,node:s,origin:o.origin},setSelectedCwd:a}}var gIr=k(oe(),1);function $Te(e,t,r){let n=$b(e,t,r);return n&&ol(n)}function yIr(e,t,r,n){let o=$Te(e,t,r),i=$b(e,t,r),a=i?.node??Ad,s=i?.repoGroup?.origin;(0,gIr.useEffect)(()=>{o&&n(o,a,s)},[o,a,s,n])}function vIr(e,t,r,n,o){let i=o.nodes?.local,a=Dp(o.selected,i),s=(0,zTe.useMemo)(()=>_5(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=mIr(e,s,a,i);yIr(r,n,t,d),pIr(a,s,l,d);let{cloneOn:p,originOf:h}=dIr(s,i,f),m=(0,zTe.useMemo)(()=>s.map(v=>_3r(v,a)),[s,a]),{cwd:g,node:y}=fIr(r,n,t,{cwd:l,node:u});return(0,zTe.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:d,cloneOn:p,originOf:h}),[m,l,u,g,y,d,p,h])}var UTe=k(oe(),1);var U5=k(oe(),1);var bIr=k(oe(),1),HTe="assist:reloaded-after-update";function xIr(e){(0,bIr.useEffect)(()=>{globalThis.sessionStorage?.getItem(HTe)&&(globalThis.sessionStorage.removeItem(HTe),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function SIr(e,t,r,n){let{arm:o,completed:i}=ITe(e,t),a=(0,U5.useRef)(!1),s=(0,U5.useCallback)(()=>{globalThis.sessionStorage?.setItem(HTe,"1")},[]),{error:l,restart:u}=v5("webserver",t,s);return xIr(r),(0,U5.useEffect)(()=>{l&&n(l)},[l,n]),(0,U5.useEffect)(()=>{!i||a.current||(a.current=!0,u())},[i,u]),{armUpdateReload:(0,U5.useCallback)(()=>{a.current=!1,o()},[o])}}function TIr(e){let{armUpdateReload:t}=SIr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=b1(e.selectSession),n=(0,UTe.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]),o=Kr(),i=(0,UTe.useCallback)(a=>{e.selectSession(a),o("/sessions"),e.clearSuccess()},[o,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:i}}var CIr=k(oe(),1);function wIr(e,t,r,n){let o=$Te(e,t,r);(0,CIr.useEffect)(()=>{e&&o&&n({type:"set-active",cwd:o,sessionId:e})},[e,o,n])}var WTe=k(oe(),1);function kIr(e,t){let r=(0,WTe.useRef)(new Map);(0,WTe.useEffect)(()=>{let n=new Set;for(let{id:o,status:i}of e)n.add(o),r.current.get(o)!==i&&(r.current.set(o,i),console.debug(`[sessions] render session ${o} status=${i}`),t({type:"ui-status",sessionId:o,status:i}));for(let o of r.current.keys())n.has(o)||r.current.delete(o)},[e,t])}var OU=k(oe(),1),_Ir="assist.sessions.node";function qyo(){try{return localStorage.getItem(_Ir)}catch{return null}}function jyo(e){try{localStorage.setItem(_Ir,e)}catch{}}function EIr(e){let[t,r]=(0,OU.useState)(qyo),n=(0,OU.useCallback)(o=>{r(o),jyo(o)},[]);return(0,OU.useMemo)(()=>{let o=e?[e.local,...e.links.map(i=>i.name)]:[];return{nodes:e,names:o,visible:o.length>1,selected:t&&o.includes(t)?t:e?.local,select:n}},[e,t,n])}var AIr=k(oe(),1);function RIr(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 PIr(e,t){return(0,AIr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let o=RIr(r);o&&t(o)},[e,t])}var zb=k(oe(),1);function GTe(e,t,r,n,o){e({type:"create",prompt:r||void 0,cwd:n,...t,...o?{node:o}:{}})}function LIr(e){return(t,r,n)=>GTe(e,{design:!0},t,r,n)}function IIr(e){return(t,r,n,o)=>GTe(e,{harness:t},r,n,o)}function MIr(e){return(t,r,n)=>GTe(e,{auto:!0},t,r,n)}function DIr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function NIr(e){return(t,r,n,o,i)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:o,node:i})}function OIr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function BIr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function FIr(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function $Ir(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function zIr(e){return t=>e({type:"stop",sessionId:t})}function HIr(e){return(t,r,n,o,i)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:o,node:i})}function UIr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function WIr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function GIr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function VIr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:lL})}function qIr(e){return(t,r,n,o)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:lL,claim:o==="claim",refresh:o==="refresh"})}function jIr(e){return(t,r,n,o)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...o})}var $L=k(oe(),1);function YIr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function KIr(e){return{createSession:(0,$L.useMemo)(()=>MIr(e),[e]),createSessionInStream:(0,$L.useMemo)(()=>YIr(e),[e]),createDesignSession:(0,$L.useMemo)(()=>LIr(e),[e]),createHarnessSession:(0,$L.useMemo)(()=>IIr(e),[e]),createAssistSession:(0,$L.useMemo)(()=>DIr(e),[e]),resumeSession:(0,$L.useMemo)(()=>NIr(e),[e])}}var qee=k(oe(),1);function XIr(e,t){let r=(0,qee.useCallback)((a,s)=>{OIr(e,t.current)(a,s)},[e,t]),n=(0,qee.useCallback)(a=>{BIr(e,t.current)(a)},[e,t]),o=(0,qee.useCallback)(a=>{FIr(e,t.current)(a)},[e,t]),i=(0,qee.useCallback)(a=>{$Ir(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:o,discardSession:i}}function QIr(e,t,r){return(n,o)=>{let i=t.get(n);return i&&(o(i),e({type:"snapshot",sessionId:n})),r.set(n,o),()=>r.delete(n)}}function ZIr(e,t,r){let n={...KIr(e),sendInput:(0,zb.useMemo)(()=>VIr(e),[e]),sendResize:(0,zb.useMemo)(()=>qIr(e),[e]),sendPrDecision:(0,zb.useMemo)(()=>jIr(e),[e]),setAutoApprove:(0,zb.useMemo)(()=>UIr(e),[e]),setAutoAdvance:(0,zb.useMemo)(()=>WIr(e),[e]),setStarred:(0,zb.useMemo)(()=>GIr(e),[e]),stopSession:(0,zb.useMemo)(()=>zIr(e),[e]),startRun:(0,zb.useMemo)(()=>HIr(e),[e])},o=(0,zb.useMemo)(()=>QIr(e,t.current,r.current),[e,t,r]);return{...n,...XIr(e,t),onOutput:o}}var jee=k(oe(),1);function JIr(e,t,r){let n=(0,jee.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),o=(0,jee.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),i=(0,jee.useCallback)(()=>{r(null)},[r]),a=(0,jee.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:o,clearTranscript:i,selectSession:a}}var YTe=k(oe(),1);function e7r(e,t){let r=new Set(t.map(o=>o.id)),n=null;for(let o of Object.values(e))r.has(o)&&(n=o);return n}var BU=k(oe(),1);function t7r(){let[e,t]=(0,BU.useState)(null),r=(0,BU.useRef)(e);r.current=e;let n=(0,BU.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var n7r=k(oe(),1);function r7r(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 o7r(e,t,r){let n=OTe();(0,n7r.useEffect)(()=>{if(n){t(null);return}t(o=>r7r(e,o,r))},[e,t,r,n])}var VTe=k(oe(),1);function i7r(){let[e,t]=(0,VTe.useState)({}),[r,n]=(0,VTe.useState)(null),[o,i]=(0,VTe.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:o,setNodes:i}}var Dy=k(oe(),1);function a7r(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function s7r(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function l7r(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 c7r(e,t){let r=[];for(let n of t){let o=e.get(n.id);o!==void 0&&o!==n.startedAt&&r.push(n.id)}return r}function u7r(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var Yyo=1500;function f7r(){let[e,t]=(0,Dy.useState)(new Set),r=(0,Dy.useRef)(new Map),n=(0,Dy.useRef)(new Map),o=(0,Dy.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),i=(0,Dy.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),o(u)},Yyo))},[o]);(0,Dy.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,Dy.useCallback)(s=>{let l=s7r(r.current,s),u=[...c7r(r.current,s),...l],f=u7r(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),a7r(n.current,l),u.length&&t(d=>l7r(d,u)),i(f)},[i]);return{initialized:e,markInitialized:o,syncSessions:a}}var W5=k(oe(),1);function d7r(){let[e,t]=(0,W5.useState)(null),[r,n]=(0,W5.useState)(null),[o,i]=(0,W5.useState)(null),a=(0,W5.useCallback)(()=>t(null),[]),s=(0,W5.useCallback)(()=>n(null),[]),l=(0,W5.useCallback)(()=>i(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:o,setServerConflict:i,clearServerConflict:l}}var Hb=k(oe(),1);function p7r(e,t){return[...e,{...t,status:"launching"}]}function qTe(e){return e.find(t=>t.status==="launching")}function h7r(e){let t=qTe(e);return t?e.filter(r=>r.id!==t.id):e}function m7r(e,t){let r=qTe(e);return r?EXe(e,r.id,t):e}function EXe(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function g7r(e,t){return e.filter(r=>r.id!==t)}var y7r=k(oe(),1);var Kyo=6e4,Xyo="Launch timed out \u2014 the session did not start.";function v7r(e,t){(0,y7r.useEffect)(()=>{let r=e.filter(o=>o.status==="launching");if(r.length===0)return;let n=r.map(o=>setTimeout(()=>t(i=>EXe(i,o.id,Xyo)),Math.max(0,Kyo-(Date.now()-o.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function b7r(){let[e,t]=(0,Hb.useState)([]),r=(0,Hb.useRef)([]),n=(0,Hb.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),o=(0,Hb.useCallback)(l=>{n(u=>p7r(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),i=(0,Hb.useCallback)(()=>{let l=qTe(r.current);return n(h7r),l?.named?l.title:void 0},[n]),a=(0,Hb.useCallback)(l=>n(u=>m7r(u,l)),[n]),s=(0,Hb.useCallback)(l=>n(u=>g7r(u,l)),[n]);return v7r(e,n),{pendingLaunches:e,addPendingLaunch:o,resolvePendingLaunch:i,failPendingLaunch:a,dismissPendingLaunch:s}}var Yee=k(oe(),1);function x7r(){let[e,t]=(0,Yee.useState)(null),[r,n]=(0,Yee.useState)({}),o=(0,Yee.useCallback)((i,a)=>{i!=="claude"&&n(s=>({...s,[i]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:o}}var S7r=k(oe(),1);function T7r(e,t){return(0,S7r.useCallback)(r=>{e(r),t(r)},[e,t])}var RXe=k(oe(),1);function C7r(){let e=(0,RXe.useRef)(new Map),t=(0,RXe.useRef)(new Map);return{buffers:e,handlers:t}}var jTe=k(oe(),1);function w7r(){let[e,t]=(0,jTe.useState)(null),[r,n]=(0,jTe.useState)(null),[o,i]=(0,jTe.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:o,setUserMessages:i}}var G5=k(oe(),1);function k7r(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function _7r(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 E7r(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function R7r(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function A7r(e,t){t.setNodes({local:e.local,links:e.links??[]})}function P7r(e,t){t.setSuccess({message:e.message,sessionId:null})}function L7r(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 I7r(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function M7r(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function D7r(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var Qyo={sessions:M7r,created:_7r,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:A7r,error:E7r,notice:P7r,inbox:()=>{Es.refresh(),Es.refreshStatus()},"inbox-activity":()=>{Es.refreshStatus()},"run-conflict":I7r,limits:R7r,clear:k7r,output:L7r,snapshot:D7r};function N7r(e,t){Qyo[e.type]?.(e,t)}function O7r(e,t={}){let r=new WebSocket(Hft("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{N7r(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function B7r(e,t,r,n){let o=!1,i,a=0,s=!1,l=()=>{o||t(O7r(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(o)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,i=setTimeout(l,u)}}))};return l(),()=>{o=!0,i&&clearTimeout(i)}}function F7r(e){let t=(0,G5.useRef)(null),[r,n]=(0,G5.useState)(!1),{handleSessions:o,markInitialized:i,buffers:a,handlers:s}=e;(0,G5.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let p of d.values())p("\x1Bc")},f=B7r({...e,setSessions:o},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[o,i,a,s]);let l=(0,G5.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function $7r(){let[e,t]=(0,YTe.useState)([]),[r,n]=(0,YTe.useState)([]),{activeId:o,setActiveId:i,getActiveId:a}=t7r(),s=i7r(),l=w7r(),[u,f]=(0,YTe.useState)(""),d=d7r(),p=b7r(),h=x7r(),{initialized:m,markInitialized:g,syncSessions:y}=f7r(),v=C7r(),b=T7r(y,t),{wsRef:x,requestHistory:T,reconnecting:C}=F7r({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:i,...s,...l,setCurrentCwd:f,...d,...p,...h,markInitialized:g,...v});return o7r(e,i,e7r(s.activeByRepo,e)),{sessions:e,history:r,activeId:o,setActiveId:i,...s,...l,currentCwd:u,...d,...p,...h,initialized:m,wsRef:x,...v,requestHistory:T,reconnecting:C}}function KTe(){let e=$7r(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:o,activeId:i,sessions:a}=e,s=EIr(e.nodes),l=PIr(t,o),u=ZIr(l,r,n);wIr(i,a,e.history,l),kIr(a,l);let f=JIr(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var FU=k(oe(),1);var z7r="assist:sidebar-collapsed";function H7r(){let[e,t]=(0,FU.useState)(()=>Tf(z7r).length>0),r=(0,FU.useCallback)(()=>{t(n=>{let o=!n;return Cf(z7r,o?[!0]:[]),o})},[]);return(0,FU.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var U7r=k(oe(),1);function W7r(){(0,U7r.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await Jt("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||B3.set(r)}catch(t){Cr(t,"hotkey bindings")}})(),()=>{e=!0}},[])}function G7r(){let e=KTe(),t=Tve(e),r=vIr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);cIr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:o}=TIr(e);W7r();let i=H7r();return sIr("shell",{...e,selection:r,launch:n,sidebarCollapse:i}),{socket:e,selection:r,launch:n,viewLaunchedSession:o,sidebarCollapse:i}}var jg=k(I(),1),Zyo={zIndex:e=>e.zIndex.drawer+1},Jyo={minHeight:48};function V7r({mode:e,toggle:t}){let r=G7r(),{socket:n,selection:o,viewLaunchedSession:i}=r;return(0,jg.jsx)(m6r,{shell:r,children:(0,jg.jsxs)(dXe.Provider,{value:n.daemonVersion,children:[(0,jg.jsx)(tIr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,jg.jsx)(ake,{position:"fixed",sx:Zyo,"data-testid":"toolbar",children:(0,jg.jsx)(eLr,{socket:n,selection:o})}),(0,jg.jsx)(i3,{variant:"dense",sx:Jyo}),(0,jg.jsx)(iIr,{socket:n,children:(0,jg.jsx)(oAr,{socket:n})}),(0,jg.jsx)(KAr,{socket:n}),(0,jg.jsx)(h6r,{socket:n,onViewLaunchedSession:i})]})})}function Y7r(e){return e instanceof Error?e.message:String(e)}function e1o(e){return e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:""}function q7r(e){iq(e.error)||(I3(e.error),aq("error",`${e.message||Y7r(e.error)}${e1o(e)}`))}function j7r(e){iq(e.reason)||(I3(e.reason),aq("rejection",Y7r(e.reason)))}function K7r(){return globalThis.addEventListener("error",q7r),globalThis.addEventListener("unhandledrejection",j7r),()=>{globalThis.removeEventListener("error",q7r),globalThis.removeEventListener("unhandledrejection",j7r)}}var X7r=k(oe(),1);function Q7r(){let[e,t]=(0,X7r.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let o=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",o)}catch{}return o})}}function Z7r({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 J7r(e){let{color:t,radius:r,elevation:n,type:o}=e,i={border:`1px solid ${t.line}`};return{...Z7r(e),MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:t.overlay.background,color:t.overlay.text,borderRadius:r.md,boxShadow:n.overlay,fontSize:`${o.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:t.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:n.overlay}}},MuiBackdrop:{styleOverrides:{root:{"&:not(.MuiBackdrop-invisible)":{backgroundColor:t.scrim,backdropFilter:"blur(2px)"}}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:t.surface,borderRadius:r.md+4,boxShadow:n.dialog}}}}}var e8r=({variant:e})=>e==="outlined"||e==="tonal",t8r=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:e8r,style:{padding:"5px 11px"}},{props:e=>e8r(e)&&e.size==="small",style:{padding:"3px 8px"}}];var XTe=["primary","secondary","success","warning","error","info"];function Kee(e,t){return{backgroundColor:Dr(e,t),borderColor:Dr(e,.35),color:e}}function r8r({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}}},...XTe.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...Kee(e[t].main,.16),"&:hover":Kee(e[t].main,.24)}}))]}var n8r={"& > *:nth-of-type(1)":{fontSize:16}};function o8r(e){let{color:t,radius:r,density:n}=e,{minHeight:o,fontSize:i,paddingX:a}=n.button;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:o,padding:`6px ${a}px`,borderRadius:r.sm,fontSize:i,fontWeight:600,lineHeight:"18px"},startIcon:{marginLeft:-2,marginRight:6,...n8r},endIcon:{marginLeft:6,marginRight:-2,...n8r}},variants:[...t8r,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...r8r(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 AXe({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}}},...XTe.map(r=>({props:{variant:t,color:r},style:{...Kee(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 i8r(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:[...AXe(e,"tonal"),...AXe(e,"filled")]}}}function a8r(e){return{...o8r(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...i8r(e)}}var PXe=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,t1o={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:PXe(8)},"&.Mui-selected":{color:"inherit",backgroundColor:PXe(12),boxShadow:`inset 0 0 0 1px ${PXe(18)}`}}};function s8r({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&&t1o}}}}}var l8r=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function c8r({color:e,radius:t,density:r}){let{side:n,icon:o,smallSide:i,smallIcon:a}=r.iconButton;return{MuiIconButton:{styleOverrides:{root:{...l8r(n,o),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:l8r(i,a)},{props:{color:"default"},style:{color:e.text.secondary,"&:hover":{color:e.text.primary},...!e.appBar&&{".MuiAppBar-root &, .MuiAppBar-root &:hover":{color:"inherit"}}}}]}}}function u8r({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 QTe=".MuiOutlinedInput-notchedOutline";function f8r({color:e,radius:t,density:r}){let n=r.inputFontSize;return{MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:e.background,borderRadius:t.sm,fontSize:n,color:e.text.primary,[`& ${QTe}`]:{borderColor:e.line},[`&:hover ${QTe}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${QTe}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${QTe}`]:{borderColor:e.error.main}}}},MuiInputLabel:{styleOverrides:{root:{fontSize:n,color:e.text.secondary,"&.Mui-focused":{color:e.primary.main}}}},MuiSelect:{styleOverrides:{icon:{color:e.text.disabled}}}}}function d8r({color:e,density:t}){let{width:r,height:n,thumb:o}=t.switch;return{MuiSwitch:{styleOverrides:{root:{width:r,height:n,padding:0,"& .MuiSwitch-switchBase":{padding:2,color:e.text.secondary,"&.Mui-checked":{transform:`translateX(${r-n}px)`,color:e.primary.contrastText},"&.Mui-checked + .MuiSwitch-track":{backgroundColor:e.primary.main,opacity:1}},"& .MuiSwitch-thumb":{width:o,height:o,boxShadow:"none"},"& .MuiSwitch-track":{borderRadius:n/2,backgroundColor:e.line,opacity:1}}}},MuiFormControlLabel:{styleOverrides:{root:{"&:has(.MuiSwitch-root)":{marginLeft:0,gap:8}}}}}}function p8r(e){let{appBar:t}=e.color;return{...J7r(e),...a8r(e),...c8r(e),...u8r(e),...f8r(e),...d8r(e),...s8r(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 Ub="#0e1116",LXe="#141820",ZTe="#1b202a",JTe="#e3e7ee",IXe="#8a93a3",Xee="#8b9cff",eCe="#5fd0a0",tCe="#f2b45a",rCe="#f27a7a",h8r={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)"},nCe={dark:{color:{background:Ub,surface:LXe,raised:ZTe,line:"#262c37",lineSoft:"#1d222b",text:{primary:JTe,secondary:IXe,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)",accent:"rgba(139, 156, 255, 0.1)"},well:Ub,stripe:ZTe,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:ZTe,text:JTe},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:LXe,text:JTe},onAppBar:{...h8r,secondary:IXe,level:{ok:eCe,warn:tCe,over:rCe}},statusBar:{background:LXe,text:IXe,hoverText:JTe,secondary:"#5c6473",hover:ZTe,active:"transparent",dot:Xee,dotRing:"rgba(139, 156, 255, 0.14)",readyText:Xee,level:{ok:eCe,warn:tCe,over:rCe}},primary:{main:Xee,contrastText:Ub},secondary:{main:"#c99bff",contrastText:Ub},success:{main:eCe,contrastText:Ub},warning:{main:tCe,contrastText:Ub},error:{main:rCe,contrastText:Ub},info:{main:"#6cb6ff",contrastText:Ub}},terminal:{background:Ub,foreground:"#d6dbe4",cursor:Xee,cursorAccent:Ub,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:rCe,green:eCe,yellow:tCe,blue:Xee,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)",accent:"rgba(25, 118, 210, 0.08)"},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:{...h8r,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,densities:{desktop:{target:30,bar:40,iconButton:{side:30,icon:18,smallSide:26,smallIcon:16},button:{minHeight:30,fontSize:13,paddingX:12},switch:{width:34,height:20,thumb:16},inputFontSize:13,tabBar:{height:44,icon:20,label:10,badge:16,insetTrim:0}},touch:{target:48,bar:60,iconButton:{side:48,icon:30,smallSide:40,smallIcon:24},button:{minHeight:48,fontSize:17,paddingX:20},switch:{width:51,height:31,thumb:27},inputFontSize:16,tabBar:{height:49,icon:26,label:11,badge:18,insetTrim:12}}}};var YT=e=>`${e/16}rem`;function m8r({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:YT(r.button)},caption:{fontSize:YT(r.caption)},body2:{fontSize:YT(r.body2)},body1:{fontSize:YT(r.body1)},subtitle2:{fontSize:YT(r.subtitle2)},subtitle1:{fontSize:YT(r.subtitle1)},h6:{fontSize:YT(r.h6)},h5:{fontSize:YT(r.h5)},h4:{fontSize:YT(r.h4)}}}function g8r(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function r1o(e,t){let{dark:r,light:n,densities:o,...i}=nCe;return{...i,...e==="dark"?r:n,mode:e,density:o[t]}}function y8r(e,t="desktop"){let r=r1o(e,t),{color:n}=r;return Qy({tokens:r,palette:{mode:e,background:{default:n.background,paper:n.surface},primary:n.primary,secondary:n.secondary,success:n.success,warning:n.warning,error:n.error,info:n.info,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:m8r(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...g8r(r),...p8r(r)}})}function v8r(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=nCe;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var NMr=k(oe(),1);var V5=k(I(),1);function b8r({status:e,onClose:t}){return(0,V5.jsxs)(V5.Fragment,{children:[(0,V5.jsx)(hu,{open:e.kind==="probing",children:(0,V5.jsx)(jn,{severity:"info",variant:"filled",children:e.kind==="probing"?`Connecting to ${e.name}\u2026`:""})}),(0,V5.jsx)(sl,{error:e.kind==="error"?e.message:null,onClose:t})]})}var iCe=k(oe(),1);var n1o=/^\d+(\.\d+){3}$/;function zL(e){try{let{hostname:t}=new URL(e);return n1o.test(t)?t:t.split(".")[0]}catch{return""}}var o1o=/^[a-z]+:[/]{2}/i;function oCe(e){let t=e.trim(),r=o1o.test(t)?t:`https://${t}`;try{let n=new URL(r);return n.protocol!=="https:"&&n.protocol!=="http:"?void 0:n.origin}catch{return}}function i1o(e){try{return new URL(e)}catch{return}}function a1o(e){return e.protocol==="assist:"&&e.hostname==="add-node"&&(e.pathname===""||e.pathname==="/")}function x8r(e){let t=i1o(e);if(!t||!a1o(t))return{ok:!1,error:`Not an assist add-node link: ${e}`};let r=t.searchParams.get("url"),n=r?oCe(r):void 0;return n?{ok:!0,node:{name:t.searchParams.get("name")?.trim()||zL(n),url:n}}:{ok:!1,error:`The link has no valid node URL: ${r??"(missing)"}`}}var S8r=5e3,T8r="/api/health";async function s1o(e){let t=new AbortController,r=setTimeout(()=>t.abort(),S8r);try{let n=await fetch(`${e}${T8r}`,{signal:t.signal,cache:"no-store"});return n.ok?{ok:!0,health:await n.json()}:{ok:!1,error:`HTTP ${n.status}`,status:n.status}}catch(n){return t.signal.aborted?{ok:!1,error:`timed out after ${S8r/1e3}s`}:{ok:!1,error:n instanceof Error?n.message:String(n)}}finally{clearTimeout(r)}}async function q5(e){let t=Date.now(),r=await s1o(e);return r.ok||$8({at:new Date(t).toISOString(),method:"GET",path:T8r,base:e,status:r.status,error:r.status===void 0?r.error:void 0,durationMs:Date.now()-t}),r}async function C8r(e,t){let r=x8r(e);if(!r.ok)return r;let{node:n}=r;t(n);let o=await q5(n.url);return o.ok?{ok:!0,node:n,health:o.health}:{ok:!1,error:`Can't reach ${n.name} at ${n.url}: ${o.error}`}}HL();var BXe=XT("App",{web:()=>Promise.resolve().then(()=>(A8r(),R8r)).then(e=>new e.AppWeb)});var zU=k(oe(),1);var m1o=5e3;function P8r(e){let t=(0,zU.useRef)(e),r=(0,zU.useRef)(void 0);(0,zU.useEffect)(()=>{t.current=e},[e]),(0,zU.useEffect)(()=>{let n=i=>{let a=Date.now(),s=r.current?.url===i&&a-r.current.at<m1o;r.current={url:i,at:a},s||t.current(i)},o=BXe.addListener("appUrlOpen",({url:i})=>n(i));return BXe.getLaunchUrl().then(i=>{i?.url&&n(i.url)}).catch(i=>Cr(i,"launch url")),()=>{o.then(i=>i.remove())}},[])}function L8r(e){let[t,r]=(0,iCe.useState)({kind:"idle"});P8r(async o=>{let i=await C8r(o,a=>r({kind:"probing",name:a.name}));if(!i.ok){r({kind:"error",message:i.error});return}e(i.node,i.health),r({kind:"idle"})});let n=(0,iCe.useCallback)(()=>r({kind:"idle"}),[]);return{status:t,dismiss:n}}var Jee=k(I(),1);function I8r({name:e}){return(0,Jee.jsxs)(V,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,Jee.jsx)(bo,{size:28}),(0,Jee.jsxs)(Ee,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var aCe=k(oe(),1),FXe=(0,aCe.createContext)(null);function j5(){return(0,aCe.useContext)(FXe)}var Ks={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var D8r=k(I(),1);function M8r({value:e,error:t,onChange:r}){return(0,D8r.jsx)(Un,{autoFocus:!0,label:"Web server URL",placeholder:"https://mac.tail1234.ts.net:3100",value:e,onChange:n=>r(n.target.value),error:!!t,helperText:t??"The address where you open the sessions page in a browser.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off",inputMode:"url"}}})}var ete=k(oe(),1);function N8r(e,t){let[r,n]=(0,ete.useState)(e?.url??""),[o,i]=(0,ete.useState)(e?.name),[a,s]=(0,ete.useState)(),[l,u]=(0,ete.useState)(!1),f=oCe(r),d=o??(f?zL(f):"");return{url:r,changeUrl:m=>{n(m),s(void 0)},name:d,setName:i,error:a,busy:l,submit:async m=>{if(m.preventDefault(),!f){s("Enter an http(s) URL, e.g. https://mac.tail1234.ts.net:3100");return}u(!0);let g=await t({name:d.trim()||zL(f),url:f});u(!1),s(g)}}}var HU=k(I(),1);function sCe({initial:e,submitLabel:t,onSubmit:r,children:n}){let o=N8r(e,r);return(0,HU.jsxs)(_t,{component:"form",spacing:2,onSubmit:o.submit,children:[(0,HU.jsx)(M8r,{value:o.url,error:o.error,onChange:o.changeUrl}),(0,HU.jsx)(Un,{label:"Name",value:o.name,onChange:i=>o.setName(i.target.value),helperText:"Filled in from the host name. Shown on the node chip.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off"}}}),(0,HU.jsx)(Tt,{type:"submit",variant:"contained",size:"large",disabled:!o.url.trim()||o.busy,children:o.busy?"Checking\u2026":t}),n]})}var QT=k(I(),1),g1o={height:"100%",boxSizing:"border-box",overflowY:"auto",display:"flex",justifyContent:"center",pt:`calc(${Ks.top} + 28px)`,pb:`calc(${Ks.bottom} + 24px)`,px:2.5,bgcolor:"background.default"},y1o={width:56,height:56,borderRadius:"14px",bgcolor:"action.hover",border:1,borderColor:"divider",display:"grid",placeItems:"center",fontFamily:"fontFamilyMono",fontSize:22,fontWeight:600,color:"primary.main"};function O8r({onConnect:e}){return(0,QT.jsx)(V,{sx:g1o,children:(0,QT.jsxs)(_t,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,QT.jsx)(V,{sx:y1o,children:">_"}),(0,QT.jsx)(Ee,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,QT.jsxs)(Ee,{variant:"body2",color:"text.secondary",children:["The phone connects to one assist web server over Tailscale. You'll see its sessions and the sessions of every node it links to. Make sure Tailscale is connected on this phone and"," ",(0,QT.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,QT.jsx)(sCe,{submitLabel:"Connect",onSubmit:async r=>{let n=await q5(r.url);if(!n.ok)return`Can't reach ${r.url}: ${n.error}`;e(r,n.health)}})]})})}var SMr=k(oe(),1);var Ny=k(I(),1),v1o={flex:"none",pt:Ks.top,bgcolor:"background.default"},b1o={height:e=>e.tokens.density.bar,display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",columnGap:1,alignItems:"center",px:1.5},x1o={height:e=>e.tokens.density.bar,display:"flex",alignItems:"center",gap:.5,px:.5},S1o={textAlign:"center",minWidth:0,maxWidth:220,fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},T1o={flex:1,minWidth:0,fontSize:15,fontWeight:600,lineHeight:1.25,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"};function Zc({left:e,title:t,right:r,leadingTitle:n}){return(0,Ny.jsx)(V,{component:"header",sx:v1o,children:n?(0,Ny.jsxs)(V,{sx:x1o,children:[(0,Ny.jsx)(V,{sx:{flex:"none"},children:e}),(0,Ny.jsx)(V,{component:"h1",sx:[T1o,{m:0}],children:t}),(0,Ny.jsx)(V,{sx:{flex:"none",display:"flex"},children:r})]}):(0,Ny.jsxs)(V,{sx:b1o,children:[(0,Ny.jsx)(V,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,Ny.jsx)(V,{sx:S1o,children:t}),(0,Ny.jsx)(V,{sx:{justifySelf:"end",display:"flex",gap:.25},children:r})]})})}var Wb=e=>e.tokens.color.raised;var B8r=k(I(),1),C1o={ok:e=>e.palette.success.main,warn:e=>e.palette.warning.main,error:e=>e.palette.error.main,off:e=>e.palette.text.disabled};function Yg({tone:e}){return(0,B8r.jsx)(V,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:C1o[e]}})}var ic=e=>e.tokens.density.target;var UU=k(I(),1),w1o={display:"inline-flex",alignItems:"center",gap:.75,height:ic,pl:1.125,pr:.75,borderRadius:"24px",border:1,borderColor:"divider",bgcolor:Wb,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13,maxWidth:140,justifyContent:"flex-start"},k1o={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function lCe({name:e,tone:t,onClick:r}){return(0,UU.jsxs)(ir,{sx:w1o,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,UU.jsx)(Yg,{tone:t}),(0,UU.jsx)(V,{component:"span",sx:k1o,children:e??"\u2026"}),r&&(0,UU.jsx)(ea,{sx:{fontSize:16,flex:"none"}})]})}var mMr=k(oe(),1);var cCe=k(I(),1);function F8r({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,cCe.jsx)(V,{sx:{px:2.5,pt:1},children:(0,cCe.jsx)(sCe,{initial:t,submitLabel:t?"Save":"Add node",onSubmit:async i=>{if(e.nodes.some(s=>s.url===i.url&&s.url!==t?.url))return"That URL is already saved";e.saveNode(t?.url??i.url,i),r()},children:t&&(0,cCe.jsx)(Tt,{color:"error",size:"large",disabled:n,onClick:()=>{e.removeNode(t.url),r()},children:n?"Switch home node to delete this one":"Delete node"})})})}var $8r=k(I(),1),_1o={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function WU(){return(0,$8r.jsx)(V,{sx:_1o})}var ZT=k(I(),1),E1o={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},R1o={color:"primary.main",fontSize:16,minHeight:ic,px:.5,borderRadius:1};function GU({title:e,actionLabel:t,onAction:r}){return(0,ZT.jsxs)(ZT.Fragment,{children:[(0,ZT.jsx)(WU,{}),(0,ZT.jsxs)(V,{sx:E1o,children:[(0,ZT.jsx)(V,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,ZT.jsx)(ir,{sx:R1o,onClick:r,children:t})]})]})}var UL=k(I(),1);function z8r({homeNode:e,node:t,onDone:r}){return(0,UL.jsxs)(UL.Fragment,{children:[(0,UL.jsx)(GU,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,UL.jsx)(F8r,{homeNode:e,node:t,onDone:r},t?.url??"add")]})}var Ar={group:{flexShrink:0,mx:2,my:.75,borderRadius:"12px",bgcolor:"background.default",border:1,borderColor:"divider",overflow:"hidden","& > *:not(:last-child)":{borderBottom:1,borderColor:e=>e.tokens.color.lineSoft}},item:{width:"100%",minHeight:ic,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1.5,px:1.75,py:1,textAlign:"left",fontSize:16},grow:{flex:1,minWidth:0},detail:{display:"block",fontSize:13,color:"text.secondary",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},end:{display:"flex",alignItems:"center",gap:.75,color:"text.secondary",fontSize:14},label:{px:4,pt:1.75,pb:.25,fontSize:13,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"text.secondary"}};function H8r(e,t){return e.replace(/\/+$/,"")===t.replace(/\/+$/,"")}function VU(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]||0)-(n[o]||0);if(i!==0)return Math.sign(i)}return 0}function U8r(e,t,r){let n=t.filter(a=>a.node===e.name).length,o=[e.state,`${n} session${n===1?"":"s"}`,e.peerVersion&&`v${e.peerVersion}`,e.state!=="connected"&&e.error],i=e.peerVersion&&r?VU(e.peerVersion,r):0;return{text:o.filter(Boolean).join(" \xB7 "),drift:i<0?"behind":i>0?"ahead":void 0}}var uCe={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var $Xe=k(I(),1);function W8r({name:e,onSave:t}){return(0,$Xe.jsx)(Vt,{"aria-label":`Save ${e} as a home node`,onClick:t,sx:{color:"primary.main",borderRadius:0},children:(0,$Xe.jsx)(qd,{fontSize:"small"})})}var JT=k(I(),1),A1o={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function G8r({links:e,sessions:t,homeVersion:r,isSaved:n,onSave:o}){return(0,JT.jsx)(V,{sx:Ar.group,children:e.map(i=>{let{text:a,drift:s}=U8r(i,t,r);return(0,JT.jsxs)(V,{sx:[Ar.item,{pr:0}],children:[(0,JT.jsx)(Yg,{tone:uCe[i.state]}),(0,JT.jsxs)(V,{component:"span",sx:Ar.grow,children:[i.name,(0,JT.jsx)(V,{component:"span",sx:Ar.detail,children:a})]}),s&&(0,JT.jsx)(V,{component:"span",sx:A1o,children:s}),!n(i.url)&&(0,JT.jsx)(W8r,{name:i.name,onSave:()=>o(i)})]},i.name)})})}var Gb=k(I(),1);function qU({title:e,rows:t}){return(0,Gb.jsxs)(Gb.Fragment,{children:[(0,Gb.jsx)(V,{sx:Ar.label,children:e}),(0,Gb.jsx)(V,{sx:Ar.group,children:t.map(r=>(0,Gb.jsxs)(V,{sx:Ar.item,children:[(0,Gb.jsx)(V,{component:"span",sx:Ar.grow,children:r.label}),(0,Gb.jsx)(V,{component:"span",sx:[Ar.end,{fontFamily:"fontFamilyMono"},r.color?{color:r.color}:{}],children:r.value})]},r.key))})]})}var q8r=k(I(),1);function V8r({rateLimits:e,harnessRateLimits:t}){let r=Ug(3e4),n=tTe(e,t).flatMap(o=>iTe(o.rateLimits).map(i=>({key:`${o.harness}-${i.label}`,label:`${vc(o.harness)} \xB7 ${i.label}`,value:i.resetsAt!=null?`${Math.round(i.pct)}% \xB7 ${oU(i.resetsAt,r)}`:`${Math.round(i.pct)}%`,color:dSe(wb(i.pct,i.resetsAt,i.windowSeconds,r))})));return n.length===0?null:(0,q8r.jsx)(qU,{title:"Rate limits",rows:n})}var Vb=k(I(),1);function j8r({status:e,homeVersion:t,homeNode:r}){let n=e.nodes?.links??[];return(0,Vb.jsxs)(Vb.Fragment,{children:[n.length>0&&(0,Vb.jsxs)(Vb.Fragment,{children:[(0,Vb.jsxs)(V,{sx:Ar.label,children:["Linked through ",e.nodes?.local]}),(0,Vb.jsx)(G8r,{links:n,sessions:e.sessions,homeVersion:t,isSaved:o=>r.nodes.some(i=>H8r(i.url,o)),onSave:({name:o,url:i})=>r.saveNode("",{name:o,url:i})})]}),(0,Vb.jsx)(V8r,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var P1o={ok:"ok",ready:"warn",diverged:"warn",retrying:"warn",paused:"off",off:"off",loading:"off",unavailable:"error"};function fCe(e,t){let r=zg(e),{status:n}=e,o=!!n&&!!t&&VU(t,n.built)>0,i=m5(e),a=n&&(n.running===n.built?`v${n.running}`:`v${n.running} \u2192 v${n.built}`),s=o?`v${t} available`:i?"restart pending":r.label.toLowerCase();return{tone:o?"warn":P1o[r.kind],detail:[a,s].filter(Boolean).join(" \xB7 "),updateAvailable:o,restartPending:i}}var nm=k(I(),1);function Y8r({updates:e,onOpen:t}){let{entries:r,latest:n,notices:o}=e;return r.length===0?null:(0,nm.jsxs)(nm.Fragment,{children:[(0,nm.jsx)(V,{sx:Ar.label,children:"Updates"}),(0,nm.jsx)(V,{sx:Ar.group,children:r.map(i=>{let a=fCe(i,n),s=o.busy[i.name];return(0,nm.jsxs)(ir,{sx:Ar.item,onClick:()=>t(i.name),"data-testid":`phone-update-row-${i.name}`,children:[(0,nm.jsx)(Yg,{tone:a.tone}),(0,nm.jsxs)(V,{component:"span",sx:Ar.grow,children:[i.name,(0,nm.jsx)(V,{component:"span",sx:Ar.detail,children:a.detail})]}),(0,nm.jsxs)(V,{component:"span",sx:Ar.end,children:[s&&`${s}\u2026`,(0,nm.jsx)(qo,{})]})]},i.name)})})]})}var tte=k(I(),1);function dCe({onAdd:e}){return(0,tte.jsxs)(ir,{sx:Ar.item,onClick:e,children:[(0,tte.jsx)(qd,{sx:{color:"primary.main"}}),(0,tte.jsx)(V,{component:"span",sx:{color:"primary.main"},children:"Add node URL"})]})}function qb(e){try{return new URL(e).host}catch{return e}}function pCe(e){if(!e)return{tone:"off",text:"checking\u2026"};if(!e.ok)return{tone:"error",text:"unreachable"};let t=e.health.version;return{tone:"ok",text:t?`reachable \xB7 v${t}`:"reachable"}}var hCe=k(oe(),1);var L1o=15e3;function mCe(e){let[t,r]=(0,hCe.useState)({}),n=e.join(`
|
|
4025
4025
|
`);return(0,hCe.useEffect)(()=>{if(!n)return;let o=!1,i=()=>{for(let s of n.split(`
|