@staff0rd/assist 0.1012.0 → 0.1013.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/claude/commands/draft.md
CHANGED
|
@@ -24,9 +24,19 @@ Ask one question at a time. Wait for the user's response before asking the next.
|
|
|
24
24
|
|
|
25
25
|
If the harness provides a structured question tool, ask each question with it — one question per call, with fixed options and a recommended default where they apply. Only fall back to plain chat text when no such tool exists.
|
|
26
26
|
|
|
27
|
-
## Step 3:
|
|
27
|
+
## Step 3: Design the UI change
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
From the clarifying answers, decide whether the story involves a **substantial UI change** — a new screen, panel, view or component, or a reworked layout or interaction flow. A trivial UI change (a label, a button, a tweak to an existing control) or no UI change at all is not substantial: skip this step entirely and do not mention it.
|
|
30
|
+
|
|
31
|
+
If it is substantial, do not ask whether to design it — follow `/design` (`~/.claude/commands/design.md`) for the story's UI, applying it to what the user described and answered. Publish the design as an artifact, give the user its URL, and iterate on it with them — editing the same file and republishing to the same URL — until they say they are happy with it. Only then move on.
|
|
32
|
+
|
|
33
|
+
Keep the artifact's URL and name: the item's description references the design (Step 4), and the artifact is attached to the item once it is created (Step 5).
|
|
34
|
+
|
|
35
|
+
## Step 4: Compose the item
|
|
36
|
+
|
|
37
|
+
Compose the item's content, but do not show it to the user yet and do not work out where the review should happen — `propose` decides that in Step 5 and tells you what to do next.
|
|
38
|
+
|
|
39
|
+
If Step 3 produced a design, the description links to it (e.g. a `## Design` section with the artifact URL) so the implementer builds against it.
|
|
30
40
|
|
|
31
41
|
**Name:** (concise title)
|
|
32
42
|
**Type:** story or bug
|
|
@@ -94,7 +104,7 @@ If it reports the key is not set, plan docs updates as the change needs them.
|
|
|
94
104
|
|
|
95
105
|
Most phases should NOT have manual checks. Only add `manualChecks` to a phase when the checks are genuinely difficult to automate (e.g. visual appearance, UX flow, hardware interaction). Do not add a final phase just for end-to-end verification — a `Review` phase is appended to every plan automatically, and authoring one is rejected.
|
|
96
106
|
|
|
97
|
-
## Step
|
|
107
|
+
## Step 5: Propose the item
|
|
98
108
|
|
|
99
109
|
Propose the item and capture the id it prints. Use `propose`, not `assist backlog add` plus `add-phase` — `propose` is the reviewed path for an agent-authored item, and it writes the item and every phase on a single approval:
|
|
100
110
|
|
|
@@ -153,9 +163,19 @@ assist backlog add-activity a<id> slack "<permalink>" --url "<permalink>" --titl
|
|
|
153
163
|
|
|
154
164
|
Use the same permalink verbatim for both the ref and `--url`, and the item's name for `--title`. If no Slack thread was referenced, skip this step.
|
|
155
165
|
|
|
166
|
+
### Attach the design
|
|
167
|
+
|
|
168
|
+
If Step 3 published a design artifact, attach it to the created item so it renders as a linked design row in the Activity section:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
assist backlog add-activity a<id> design "<artifact-url>" --url "<artifact-url>" --title "<artifact name>" 2>&1
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Use the artifact URL verbatim for both the ref and `--url`, and the artifact's name for `--title`. If Step 3 was skipped, skip this step.
|
|
175
|
+
|
|
156
176
|
Then show the user the item was created. If `propose` printed `Started a backlog run session for a<id>.`, the user chose **Approve & start** and implementation is already running — say so, and do not suggest running it. Otherwise suggest they can run `assist backlog run a<id>` to start implementation.
|
|
157
177
|
|
|
158
|
-
If the conversation established that more items still need to be drafted (e.g. a follow-up item, or one in another repo), do not signal yet — draft each remaining item now, repeating Steps 3
|
|
178
|
+
If the conversation established that more items still need to be drafted (e.g. a follow-up item, or one in another repo), do not signal yet — draft each remaining item now, repeating Steps 3 to 5 for it.
|
|
159
179
|
|
|
160
180
|
Finally, once the last item is created, signal that the drafting task is complete, passing every item id created in this session (a-prefixed, e.g. `a555 a556`):
|
|
161
181
|
|
|
@@ -99,11 +99,32 @@ assist backlog comment <id> "Comment text"
|
|
|
99
99
|
|
|
100
100
|
After applying changes, show the updated item with `assist backlog view <id> 2>&1` so the user can verify.
|
|
101
101
|
|
|
102
|
-
## Step 4:
|
|
102
|
+
## Step 4: Design the UI change
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
Check the item's Activity section (from `assist backlog view <id>`) for an existing `design` row, then decide whether a design is needed. A **substantial UI change** is a new screen, panel, view or component, or a reworked layout or interaction flow; a trivial UI change (a label, a button, a tweak to an existing control) or no UI change at all is not.
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
- **No `design` activity** and the item, as refined, involves a substantial UI change — produce a new design.
|
|
107
|
+
- **An existing `design` activity** and this refinement changes the UI substantially — update that design, republishing to its existing artifact URL rather than creating a new one.
|
|
108
|
+
- Otherwise — skip this step entirely and do not mention it.
|
|
109
|
+
|
|
110
|
+
When a design is needed, do not ask whether to design it — follow `/design` (`~/.claude/commands/design.md`) for the item's UI, applying it to the item as refined. To update an existing design, read the artifact at its URL first and build on it, publishing back to the same URL. Give the user the artifact's URL and iterate on it with them — editing the same file and republishing to the same URL — until they say they are happy with it.
|
|
111
|
+
|
|
112
|
+
Then keep the item in sync with the design:
|
|
113
|
+
|
|
114
|
+
- **Description** — make sure it links to the design (e.g. a `## Design` section with the artifact URL) so the implementer builds against it. Add the link if it is missing or points elsewhere, using `update-field --desc` with the full description.
|
|
115
|
+
- **Activity** — if the design is new, attach it so it renders as a linked design row in the Activity section:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
assist backlog add-activity <id> design "<artifact-url>" --url "<artifact-url>" --title "<artifact name>" 2>&1
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Use the artifact URL verbatim for both the ref and `--url`, and the artifact's name for `--title`. A republished design keeps its URL, so its existing activity needs no change.
|
|
122
|
+
|
|
123
|
+
## Step 5: Iterate
|
|
124
|
+
|
|
125
|
+
Ask if there is anything else to refine. Continue the conversation until the user is satisfied, revisiting Step 4 whenever a further refinement changes the UI substantially.
|
|
126
|
+
|
|
127
|
+
## Step 6: Signal completion
|
|
107
128
|
|
|
108
129
|
Once the user confirms they are done refining — and any new items the conversation called for (e.g. a split-out follow-up) have been created — signal that the task is complete, passing the ids of any items created in this session:
|
|
109
130
|
|
|
@@ -4013,13 +4013,13 @@ ${f.join(`
|
|
|
4013
4013
|
`)})}var jH=k(I(),1);function bEr({entry:e,state:t,actions:r}){return(0,jH.jsxs)(V,{sx:{px:2,pb:2,pl:{xs:2,sm:7.5},display:"grid",gap:1.5},children:[(0,jH.jsx)(yEr,{entry:e,state:t,actions:r}),(0,jH.jsx)(Ee,{variant:"caption",color:"text.secondary",children:"History \xB7 ~/.assist/watchers/"}),(0,jH.jsx)(vEr,{lines:e.status?.history??[]})]})}function p5(e){let t=e.status?.loop;return t!==void 0&&(t.phase!=="off"||t.paused===!0)}var YH=k(I(),1),_ho={display:"flex",gap:.5,flexWrap:"wrap",justifyContent:{xs:"flex-start",sm:"flex-end"},gridColumn:{xs:"1 / -1",sm:"auto"}};function xEr({entry:e,state:t,actions:r}){let n=r.notices.busy[e.name],o=e.status?.loop.paused===!0;return(0,YH.jsxs)(V,{sx:_ho,children:[t.kind==="ready"&&(0,YH.jsx)(j2e,{entry:e,actions:r}),t.kind==="diverged"&&(0,YH.jsx)(G2e,{entry:e,actions:r}),p5(e)&&(0,YH.jsx)(Tt,{size:"small",disabled:n!==void 0,onClick:()=>{r.control(e,o?"resume":"pause")},children:o?"Resume":"Pause"})]})}var Eho={ready:"warning",diverged:"error"},SEr=e=>t=>{let r=Eho[e];return{display:"grid",gridTemplateColumns:{xs:"28px minmax(0,1fr)",sm:"28px minmax(0,1.3fr) minmax(0,1fr) minmax(0,1.6fr) auto"},alignItems:"center",columnGap:1.5,rowGap:1,px:2,py:1.5,boxShadow:r?`inset 3px 0 0 ${t.palette[r].main}`:"none"}};var TEr=k(I(),1),K2e=nt((0,TEr.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");var CEr=k(I(),1),wEr=nt((0,CEr.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4c-1.48 0-2.85.43-4.01 1.17l1.46 1.46C10.21 6.23 11.08 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3 0 1.13-.64 2.11-1.56 2.62l1.45 1.45C23.16 18.16 24 16.68 24 15c0-2.64-2.05-4.78-4.65-4.96M3 5.27l2.75 2.74C2.56 8.15 0 10.77 0 14c0 3.31 2.69 6 6 6h11.73l2 2L21 20.73 4.27 4zM7.73 10l8 8H6c-2.21 0-4-1.79-4-4s1.79-4 4-4z"}),"CloudOff");var kEr=k(I(),1),_Er=nt((0,kEr.jsx)("path",{d:"M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z"}),"HourglassEmpty");var EEr=k(I(),1),REr=nt((0,EEr.jsx)("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause");var AEr=k(I(),1),PEr=nt((0,AEr.jsx)("path",{d:"M13 3h-2v10h2zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83"}),"PowerSettingsNew");var LEr=k(I(),1),IEr=nt((0,LEr.jsx)("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}),"Warning");var by=k(I(),1),Rho={ok:{tone:"success",icon:(0,by.jsx)(xc,{})},ready:{tone:"warning",icon:(0,by.jsx)(K2e,{})},diverged:{tone:"error",icon:(0,by.jsx)(IEr,{})},retrying:{tone:"warning",icon:(0,by.jsx)(x6,{})},paused:{tone:"neutral",icon:(0,by.jsx)(REr,{})},off:{tone:"neutral",icon:(0,by.jsx)(PEr,{})},loading:{tone:"neutral",icon:(0,by.jsx)(_Er,{})},unavailable:{tone:"neutral",icon:(0,by.jsx)(wEr,{})}};function Aho(e,t){return t==="neutral"?e.palette.text.secondary:e.palette[t].main}function MEr({state:e}){let{tone:t,icon:r}=Rho[e.kind];return(0,by.jsxs)(V,{component:"span",sx:n=>({alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:.75,height:24,px:1.25,borderRadius:3,fontSize:12,fontWeight:500,whiteSpace:"nowrap",color:Aho(n,t),bgcolor:t==="neutral"?n.palette.action.hover:Dr(n.palette[t].main,.1),border:t==="neutral"?`1px solid ${n.palette.divider}`:0,"& svg":{fontSize:14}}),children:[r,e.label]})}var JJ=k(I(),1);function DEr({state:e}){return(0,JJ.jsxs)(V,{sx:{...W2e,gridColumn:{xs:"2",sm:"auto"},gap:.25},children:[(0,JJ.jsx)(MEr,{state:e}),(0,JJ.jsx)(Ee,{variant:"caption",color:"text.secondary",noWrap:!0,children:e.line})]})}var Sb=k(I(),1),NEr={gridColumn:{xs:"2",sm:"auto"}},Pho={fontFamily:"fontFamilyMono",fontSize:12,fontVariantNumeric:"tabular-nums"};function OEr({entry:e}){let t=e.status;if(!t)return(0,Sb.jsx)(Ee,{variant:"caption",color:"text.secondary",sx:NEr,children:"\u2014"});let r=t.running!==t.built;return(0,Sb.jsxs)(V,{sx:{...NEr,display:"flex",flexDirection:"column"},children:[(0,Sb.jsxs)(V,{component:"span",sx:Pho,children:["v",t.running,r&&(0,Sb.jsxs)(Sb.Fragment,{children:[" ",(0,Sb.jsx)(V,{component:"span",sx:{color:"warning.main"},children:"\u2192"})," ","v",t.built]})]}),(0,Sb.jsx)(Ee,{variant:"caption",color:"text.secondary",children:r?"running \u2192 built":"running"})]})}function h5(e){return(e.status?.restart.length??0)>0}function BEr(e,t){return e.paused?{kind:"paused",label:"Paused",line:"won't pull until resumed"}:e.phase==="off"?{kind:"off",label:"Off",line:e.reason??"not running"}:e.phase==="retrying"?{kind:"retrying",label:"Retrying",line:`${e.reason??"lap failed"} \xB7 ${t}`}:{kind:"ok",label:"Up to date",line:`watching origin since ${t}`}}function zg(e){let{status:t}=e;if(e.loading)return{kind:"loading",label:"Checking",line:"waiting for node"};if(!t)return{kind:"unavailable",label:"Unavailable",line:e.error??"no update state"};let{loop:r}=t,n=Po(r.since);return r.phase==="diverged"?{kind:"diverged",label:"Diverged \xB7 fixing",line:`diverged ${n}${r.escalationId?` \xB7 session ${r.escalationId}`:""}`}:h5(e)?{kind:"ready",label:"Restart to update",line:`restart ${t.restart.map(d5).join(" + ")}${r.paused?" \xB7 paused":""}`}:BEr(r,n)}var Tb=k(I(),1);function $Er({entry:e,actions:t}){let[r,n]=(0,FEr.useState)(!1),o=zg(e);return(0,Tb.jsxs)(V,{component:"article",sx:{"& + &":{borderTop:1,borderColor:"divider"}},children:[(0,Tb.jsxs)(V,{sx:SEr(o.kind),children:[(0,Tb.jsx)(fEr,{open:r,label:`${r?"Hide":"Show"} history for ${e.name}`,onToggle:()=>n(i=>!i)}),(0,Tb.jsx)(dEr,{entry:e}),(0,Tb.jsx)(OEr,{entry:e}),(0,Tb.jsx)(DEr,{state:o}),(0,Tb.jsx)(xEr,{entry:e,state:o,actions:t})]}),r&&(0,Tb.jsx)(bEr,{entry:e,state:o,actions:t})]})}var IKe=k(oe(),1);var KH=k(I(),1);function zEr({entries:e,actions:t}){let[r,n]=(0,IKe.useState)(!1),[o,i]=(0,IKe.useState)(!1),a=e.filter(l=>zg(l).kind==="ready").length,s=e.some(l=>p5(l)&&!l.status?.loop.paused);return(0,KH.jsxs)(V,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:[(0,KH.jsx)(Tt,{variant:"outlined",size:"small",startIcon:(0,KH.jsx)(Lz,{}),disabled:!s||r,onClick:()=>{n(!0),t.checkAll(e).finally(()=>n(!1))},children:"Check now"}),(0,KH.jsx)(Tt,{variant:"contained",size:"small",disabled:a===0||o,onClick:()=>{i(!0),t.restartReady(e).finally(()=>i(!1))},children:a?`Restart ready nodes (${a})`:"Restart ready nodes"})]})}function HEr(e){let t=e.map(i=>zg(i).kind),r=i=>t.filter(a=>a===i).length,n=r("ready"),o=[`${e.length} node${e.length===1?"":"s"}`];return o.push(n?`${n} ready to restart`:"all running their latest build"),r("diverged")&&o.push(`${r("diverged")} diverged`),r("loading")&&o.push(`${r("loading")} checking`),r("unavailable")&&o.push(`${r("unavailable")} unavailable`),o.join(" \xB7 ")}var ZEr=k(oe(),1);function UEr(e,t){return`${e}:${t}`}var MKe=k(oe(),1);async function m5(e){if(!e)return"web server unreachable";try{return(await e.json()).error??`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}async function WEr(e,t){let r;try{r=await Jt(Vr(`/api/updates/control?action=${t}`,e.local?void 0:e.name),{method:"POST"})}catch(n){Cr(n,"update loop control")}return r?.ok?void 0:m5(r)}var Lho=5e3,GEr={pause:"Pausing",resume:"Resuming",check:"Checking"};function X2e(e,t){let{mark:r,setError:n,setBack:o}=e,i=(0,MKe.useCallback)(async(s,l)=>{r(s.name,GEr[l]);let u=await WEr(s,l);return u&&n(`${GEr[l]} ${s.name} failed: ${u}`),r(s.name),t(),!u&&l==="check"&&setTimeout(t,Lho),!u},[r,n,t]),a=(0,MKe.useCallback)(async s=>{let l=s.filter(d=>p5(d)&&!d.status?.loop.paused),f=(await Promise.all(l.map(d=>i(d,"check")))).filter(Boolean).length;f&&o(`Checking ${f} node${f===1?"":"s"} against origin`)},[i,o]);return{control:i,checkAll:a}}var DKe=k(oe(),1);var Cb=k(oe(),1);var XH={target:"both",label:"Restart daemon",message:"This restarts the sessions daemon and the web server, then reloads the page once the server is back."};function g5(e,t){let r=t?`&node=${encodeURIComponent(t)}`:"";return Jt(`/api/restart?target=${e}${r}`,{method:"POST"})}var MT=k(oe(),1);var Iho=300,Mho=2,Dho="/api/health";async function Nho(){try{return(await Jt(Dho,{cache:"no-store",capture:!1})).ok}catch{return!1}}async function VEr(e){let t=0;for(;!e();){if(t=await Nho()?t+1:0,t>=Mho)return!e();await new Promise(r=>setTimeout(r,Iho))}return!1}function Oho(){return{sawDisconnect:!1,waiting:!1,abandoned:!0}}function qEr(e,t,r){let n=(0,MT.useRef)(Oho()),o=(0,MT.useRef)(r);o.current=r,(0,MT.useEffect)(()=>{let s=n.current;if(!(!e||s.abandoned)){if(t){s.sawDisconnect=!0;return}!s.sawDisconnect||s.waiting||(s.waiting=!0,VEr(()=>s.abandoned).then(l=>{l&&o.current()}))}},[e,t]);let i=(0,MT.useCallback)(()=>{n.current.abandoned=!0},[]),a=(0,MT.useCallback)(()=>{n.current.abandoned=!0,n.current={sawDisconnect:!1,waiting:!1,abandoned:!1}},[]);return(0,MT.useEffect)(()=>i,[i]),{arm:a,abandon:i}}var Bho=15e3;function y5(e,t,r){let[n,o]=(0,Cb.useState)(!1),[i,a]=(0,Cb.useState)(null),s=(0,Cb.useRef)(void 0),{arm:l,abandon:u}=qEr(n,t,()=>{clearTimeout(s.current),r?.(),globalThis.location.reload()});(0,Cb.useEffect)(()=>()=>clearTimeout(s.current),[]);let f=(0,Cb.useCallback)(async p=>{o(!0),l(),s.current=setTimeout(()=>{u(),o(!1),a("Web server did not come back")},Bho);try{if(!(await g5(p)).ok)throw new Error("restart failed")}catch(h){Cr(h,"web server restart"),u(),clearTimeout(s.current),o(!1),a("Failed to restart web server")}},[l,u]),d=(0,Cb.useCallback)(()=>f(e),[f,e]);return{pending:n,error:i,clearError:()=>a(null),restart:d,restartTo:f}}function Q2e(e){return e.local&&h5(e)}var jEr=15e3;async function Z2e(e,t){try{let r=await Jt(Vr("/api/updates",t?void 0:e),{signal:AbortSignal.timeout(jEr)}),n=await r.json();if(!r.ok)throw new Error(n?.error??`HTTP ${r.status}`);return{name:e,local:t,status:n}}catch(r){return{name:e,local:t,error:Fho(r)}}}function Fho(e){return e instanceof DOMException&&e.name==="TimeoutError"?`No response after ${jEr/1e3}s`:e instanceof Error?e.message:"Failed to load update state"}var $ho=2e3,zho=9e4,Hho=e=>new Promise(t=>setTimeout(t,e));async function J2e(e,t){let r=Date.now()+zho;for(;Date.now()<r;){await Hho($ho);let n=await Z2e(e.name,e.local);if(t(n))return n}}function YEr(e,t){return J2e(e,({status:r})=>!!(r?.daemonReachable&&!t.some(n=>r.restart.includes(n))))}async function KEr(e,t,r){let n;try{n=await g5(t,e.local?void 0:e.name)}catch(i){Cr(i,"node restart")}if(!n?.ok)throw new Error(await m5(n));let o=await YEr(e,r);if(!o?.status)throw new Error(`${e.name} did not come back`);return o.status.running}async function XEr(e,t,r){try{let n=await KEr(e,t,e.status?.restart??[]);r.setBack(`${e.name} is running v${n}`)}catch(n){r.setError(`Restart ${e.name} failed: ${n instanceof Error?n.message:String(n)}`)}}function QEr(e){return e.length>1?"both":e[0]}function eSe(e,t,r){let n=y5("webserver",e),o=(0,DKe.useCallback)(async a=>{let s=QEr(a.status?.restart??[]);if(s){if(t.mark(a.name,"Restarting"),Q2e(a))return n.restartTo(s==="daemon"?"both":s);await XEr(a,s,t),t.mark(a.name),r()}},[n,t,r]),i=(0,DKe.useCallback)(async a=>{let s=a.filter(l=>zg(l).kind==="ready");await Promise.all(s.filter(l=>!Q2e(l)).map(l=>o(l)));for(let l of s.filter(Q2e))await o(l)},[o]);return{restart:o,restartReady:i,localError:n.error,clearLocalError:n.clearError}}var QH=k(oe(),1);function tSe(){let[e,t]=(0,QH.useState)(null),[r,n]=(0,QH.useState)(null),[o,i]=(0,QH.useState)({}),a=(0,QH.useCallback)((s,l)=>{i(u=>{let f={...u};return l?f[s]=l:delete f[s],f})},[]);return{busy:o,mark:a,back:e,setBack:t,clearBack:()=>t(null),error:r,setError:n,clearError:()=>n(null)}}function JEr(e,t){let{refresh:r}=f5(),n=tSe(),o=eSe(e,n,r),i=X2e(n,r),a=b1(t),s=(0,ZEr.useCallback)(l=>{let u=l.status?.loop.escalationId;u&&a(l.local?u:UEr(l.name,u))},[a]);return{...o,...i,openFix:s,notices:n}}var xy=k(I(),1);function e5r({reconnecting:e,selectSession:t}){let{entries:r,loading:n}=f5(),o=JEr(e,t),{notices:i}=o;return(0,xy.jsxs)(ps,{loading:n,header:(0,xy.jsxs)(V,{sx:{display:"flex",alignItems:"flex-end",gap:2,flexWrap:"wrap",mb:3},children:[(0,xy.jsxs)(V,{sx:{flex:"1 1 auto"},children:[(0,xy.jsx)(Ee,{variant:"h5",component:"h1",children:"Updates"}),(0,xy.jsx)(Ee,{variant:"body2",color:"text.secondary",children:HEr(r)})]}),(0,xy.jsx)(zEr,{entries:r,actions:o})]}),children:[(0,xy.jsx)(rn,{variant:"outlined",component:"section","aria-label":"Nodes",children:r.map(a=>(0,xy.jsx)($Er,{entry:a,actions:o},a.name))}),(0,xy.jsx)(QJ,{notices:{...i,error:i.error??o.localError,clearError:()=>{i.clearError(),o.clearLocalError()}}})]})}var U5r=k(oe(),1);var ZH=k(oe(),1);function rSe(e,t){let r=(0,ZH.useRef)(null),[n,o]=(0,ZH.useState)();return(0,ZH.useLayoutEffect)(()=>{e===t&&r.current&&o(r.current.offsetHeight)},[e,t]),{ref:r,height:n}}var r5r=k(oe(),1);function nSe(e){if(e.startsWith("local:")){let n=e.slice(6).replace(/\/+$/,"").split("/").filter(Boolean);return n[n.length-1]??e}let t=e.indexOf("/");return t===-1?e:e.slice(t+1)}function oSe(e){let t=i=>i.startsWith("local:"),r=i=>{let a=nSe(i),s=a.split("/");return s[s.length-1]??a},n=new Map;for(let i of new Set(e)){if(t(i))continue;let a=r(i);n.set(a,(n.get(a)??0)+1)}let o=new Map;for(let i of e){if(t(i)){o.set(i,nSe(i));continue}let a=r(i),s=(n.get(a)??0)>1;o.set(i,s?nSe(i):a)}return o}var eee={field:"lastPhase",direction:"desc"};var tee="all",ree="all";async function t5r(e,t,r){let n=new URLSearchParams({page:String(e),pageSize:String(t)});r.origin!==tee&&n.set("origin",r.origin),r.status!==ree&&n.set("status",r.status),r.sort.field!==eee.field&&n.set("sort",r.sort.field),r.sort.direction!==eee.direction&&n.set("direction",r.sort.direction);let o=await Jt(`/api/usage/items?${n}`);if(!o.ok)throw new Error(`Failed to load item usage (HTTP ${o.status}).`);return o.json()}var nee=k(I(),1);function n5r({origins:e,origin:t,onChange:r}){let n=(0,r5r.useMemo)(()=>oSe(e.map(i=>i.origin)),[e]),o=e.reduce((i,a)=>i+a.count,0);return(0,nee.jsxs)(Un,{select:!0,size:"small",label:"Repo",value:t,onChange:i=>r(i.target.value),sx:{minWidth:220},children:[(0,nee.jsx)(un,{value:tee,children:`All repos (${o})`}),e.map(i=>(0,nee.jsx)(un,{value:i.origin,children:`${n.get(i.origin)??i.origin} (${i.count})`},i.origin))]})}var NKe=k(I(),1),Uho=[{value:ree,label:"All"},{value:"done",label:"Done"},{value:"running",label:"Running"}];function o5r({status:e,onChange:t}){return(0,NKe.jsx)(hc,{size:"small",exclusive:!0,value:e,onChange:(r,n)=>n&&t(n),"aria-label":"Filter items by status",children:Uho.map(r=>(0,NKe.jsx)(Qa,{value:r.value,children:r.label},r.value))})}var JH=k(I(),1),Who={display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",mb:2},Gho="Repos show their bare name, or org/repo when two share one. Totals sum every phase's recorded usage.";function i5r({origins:e,origin:t,onOriginChange:r,status:n,onStatusChange:o}){return(0,JH.jsxs)(V,{sx:Who,children:[(0,JH.jsx)(o5r,{status:n,onChange:o}),(0,JH.jsx)(n5r,{origins:e,origin:t,onChange:r}),(0,JH.jsx)(Ee,{variant:"caption",color:"text.disabled",children:Gho})]})}var y5r=k(oe(),1);function Sy(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let r=Math.floor(t/60);if(r<60){let i=t%60;return i>0?`${r}m ${i}s`:`${r}m`}let n=Math.floor(r/60),o=r%60;return o>0?`${n}h ${o}m`:`${n}h`}var aSe=k(I(),1),Vho={whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},a5r={display:"block",fontSize:"0.75rem",color:"text.disabled",whiteSpace:"nowrap"},qho={...a5r,fontStyle:"italic"};function iSe({total:e,perPhase:t,partial:r}){return(0,aSe.jsxs)(Dn,{align:"right",sx:Vho,children:[e,t?(0,aSe.jsx)(Ee,{component:"span",sx:r?qho:a5r,children:t}):null]})}var oee=k(I(),1),jho={width:"100%",maxWidth:0},Yho={display:"block",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Kho={display:"block",mt:"2px",fontSize:"0.75rem",color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function s5r({id:e,name:t,type:r,repoLabel:n}){return(0,oee.jsxs)(Dn,{sx:jho,children:[(0,oee.jsx)(Ur,{component:Ki,to:nf(e),underline:"hover",color:"text.primary",title:t,sx:Yho,children:t}),(0,oee.jsxs)(Ee,{component:"span",sx:Kho,children:[mn(e)," \xB7 ",r," \xB7 ",n]})]})}function l5r(e){let t=Math.max(1,e.recordedPhases);return{active:`${Sy(e.activeMs/t)} / phase`,tokens:`${zc(Math.round((e.tokensUp+e.tokensDown)/t))} / phase`}}function c5r(e){if(!(e.status==="done"||e.recordedPhases>e.phaseCount))return`${e.recordedPhases} of ${e.phaseCount} phases`}var sSe={story:"info",bug:"error"},lSe={todo:"default","in-progress":"warning",done:"success",wontdo:"error"};var Xho=new Set(["done","wontdo"]);function u5r(e){return Xho.has(e)?{label:e,color:lSe[e]}:{label:"running",color:"warning"}}var OKe=k(I(),1),Qho={height:20,fontSize:"0.6875rem"};function f5r({status:e}){let t=u5r(e);return(0,OKe.jsx)(Dn,{children:(0,OKe.jsx)(Yn,{label:t.label,size:"small",variant:"outlined",color:t.color,sx:Qho})})}var Ty=k(I(),1),d5r={whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"};function p5r({row:e,repoLabel:t}){let r=l5r(e);return(0,Ty.jsxs)(Of,{hover:!0,children:[(0,Ty.jsx)(s5r,{id:e.id,name:e.name,type:e.type,repoLabel:t}),(0,Ty.jsx)(f5r,{status:e.status}),(0,Ty.jsx)(iSe,{total:String(e.phaseCount||e.recordedPhases),perPhase:c5r(e),partial:!0}),(0,Ty.jsx)(iSe,{total:Sy(e.activeMs),perPhase:r.active}),(0,Ty.jsx)(iSe,{total:`\u2191 ${zc(e.tokensUp)} \u2193 ${zc(e.tokensDown)}`,perPhase:r.tokens}),(0,Ty.jsx)(Dn,{align:"right",sx:d5r,children:(0,Ty.jsxs)(V,{component:"span",sx:{color:Lae(e.peakContextPct)},children:[Math.round(e.peakContextPct),"%"]})}),(0,Ty.jsx)(Dn,{align:"right",sx:d5r,children:e.lastPhaseAt?Po(e.lastPhaseAt):"\u2014"})]})}var h5r=[{label:"Item"},{label:"Status"},{label:"Phases",sort:"phases",numeric:!0},{label:"Active",sort:"active",numeric:!0,tooltip:"Accumulated active time across the item's phases \u2014 not wall clock."},{label:"Tokens",sort:"tokens",numeric:!0},{label:"Peak ctx",sort:"peakContext",numeric:!0,tooltip:"The highest context-window usage any one phase reached."},{label:"Last phase",sort:"lastPhase",numeric:!0,tooltip:"When the item's most recent phase session started."}];var Hg=k(I(),1),Zho={"& th":{whiteSpace:"nowrap"}};function m5r({column:e}){return e.tooltip?(0,Hg.jsx)(rr,{title:e.tooltip,describeChild:!0,children:(0,Hg.jsx)("span",{children:e.label})}):(0,Hg.jsx)(Hg.Fragment,{children:e.label})}function g5r({sort:e,onSort:t}){return(0,Hg.jsx)(n3,{sx:Zho,children:(0,Hg.jsx)(Of,{children:h5r.map(r=>{let n=r.sort,o=n!==void 0&&e.field===n;return(0,Hg.jsx)(Dn,{align:r.numeric?"right":"left",sortDirection:o?e.direction:!1,children:n===void 0?(0,Hg.jsx)(m5r,{column:r}):(0,Hg.jsx)(x_e,{active:o,direction:o?e.direction:"desc",onClick:()=>t(n),children:(0,Hg.jsx)(m5r,{column:r})})},r.label)})})})}var lL=k(I(),1),Jho={"& td, & th":{px:1.5}};function v5r({rows:e,origins:t,sort:r,onSort:n}){let o=(0,y5r.useMemo)(()=>oSe([...t,...e.map(i=>i.origin)]),[t,e]);return(0,lL.jsx)(r3,{component:rn,children:(0,lL.jsxs)(Cx,{size:"small",sx:Jho,children:[(0,lL.jsx)(g5r,{sort:r,onSort:n}),(0,lL.jsx)(wx,{children:e.map(i=>(0,lL.jsx)(p5r,{row:i,repoLabel:o.get(i.origin)??i.origin},i.id))})]})})}function b5r(e){let t=Math.max(1,e.medianPhases),r=e.repoCount===1?"repo":"repos";return{items:String(e.itemCount),itemsFoot:`across ${e.repoCount} ${r} \xB7 ${e.doneCount} done`,phases:String(Math.round(e.medianPhases*10)/10),active:Sy(e.medianActiveMs),activeFoot:`${Sy(e.medianActiveMs/t)} per phase`,tokens:zc(Math.round(e.medianTokens)),tokensFoot:`${zc(Math.round(e.medianTokens/t))} per phase`}}var eU=k(I(),1),x5r={display:"block"},emo={fontWeight:400,fontVariantNumeric:"tabular-nums"};function iee({label:e,value:t,foot:r}){return(0,eU.jsxs)(V,{children:[(0,eU.jsx)(Ee,{variant:"caption",color:"text.secondary",sx:x5r,children:e}),(0,eU.jsx)(Ee,{variant:"h5",sx:emo,children:t}),r?(0,eU.jsx)(Ee,{variant:"caption",color:"text.disabled",sx:x5r,children:r}):null]})}var cL=k(I(),1),tmo={display:"flex",flexDirection:{xs:"column",sm:"row"},mb:3,"& > *":{flex:1,minWidth:0,p:2},"& > * + *":{borderColor:"divider",borderTop:{xs:1,sm:0},borderLeft:{xs:0,sm:1}}};function S5r({summary:e}){let t=b5r(e);return(0,cL.jsxs)(rn,{sx:tmo,children:[(0,cL.jsx)(iee,{label:"Items with recorded usage",value:t.items,foot:t.itemsFoot}),(0,cL.jsx)(iee,{label:"Median phases",value:t.phases}),(0,cL.jsx)(iee,{label:"Median active time",value:t.active,foot:t.activeFoot}),(0,cL.jsx)(iee,{label:"Median tokens",value:t.tokens,foot:t.tokensFoot})]})}var Jh=k(I(),1);function T5r({items:e,data:t}){let{rows:r,total:n,page:o,pageSize:i}=e,{ref:a,height:s}=rSe(r.length,i);return(0,Jh.jsxs)(Jh.Fragment,{children:[(0,Jh.jsx)(S5r,{summary:t.summary}),(0,Jh.jsx)(i5r,{origins:t.origins,origin:e.origin,onOriginChange:e.selectOrigin,status:e.status,onStatusChange:e.selectStatus}),n===0?(0,Jh.jsx)(Ee,{color:"text.secondary",align:"center",sx:{py:6},children:"No items match this filter."}):(0,Jh.jsxs)(Jh.Fragment,{children:[(0,Jh.jsx)(V,{ref:a,sx:{minHeight:s},children:(0,Jh.jsx)(v5r,{rows:r,origins:t.origins.map(l=>l.origin),sort:e.sort,onSort:e.sortBy})}),(0,Jh.jsx)(HG,{component:"div",count:n,page:o,rowsPerPage:i,rowsPerPageOptions:[i],onPageChange:(l,u)=>e.setPage(u)})]})]})}var DT=k(I(),1);function C5r({items:e}){let{data:t}=e;return(0,DT.jsxs)(DT.Fragment,{children:[(0,DT.jsx)(V,{sx:{height:4,mb:1},children:e.fetching&&(0,DT.jsx)(gx,{})}),t?t.origins.length===0?(0,DT.jsx)(Ee,{color:"text.secondary",align:"center",sx:{py:6},children:"No item usage recorded yet."}):(0,DT.jsx)(T5r,{items:e,data:t}):null]})}function BKe(e,t,r){if(e==null)return;let n=Math.max(0,e-r),o=Math.max(0,t-n)/t;if(!(o<.05))return o}function tU(e,t){let r=Math.max(0,e-t),n=Math.floor(r/86400),o=Math.floor(r%86400/3600),i=Math.floor(r%3600/60);return n>0?`${n}d ${o}h`:o>0?`${o}h ${i}m`:`${i}m`}function rmo(e,t,r,n){let o=BKe(t,r,n);if(o!=null)return e/o}function wb(e,t,r,n){let o=rmo(e,t,r,n);return o==null?"ok":o>100?"over":o>75?"warn":"ok"}var nmo=["five_hour","seven_day"],omo=["claude","codex","pi"];function w5r(e){let[t,r]=e.includes(":")?e.split(":",2):["claude",e],n=omo.find(i=>i===t),o=nmo.find(i=>i===r);if(!(!n||!o)&&!(n==="claude"&&e.includes(":")))return{harness:n,window:o}}var k5r={five_hour:{label:"5h",seconds:18e3},seven_day:{label:"7d",seconds:604800,striped:!0}};function rU(e){let t=w5r(e);if(!t)return k5r.five_hour;let r=k5r[t.window];return t.harness==="claude"?r:{...r,label:`${vc(t.harness)} ${r.label}`}}var imo={ok:"success.main",warn:"warning.main",over:"error.main"};function cSe(e){return imo[e]}var lee=k(I(),1),amo={ok:"success",warn:"warning",over:"error"};function _5r({percentage:e,level:t}){return(0,lee.jsxs)(V,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,lee.jsx)(gx,{variant:"determinate",value:Math.min(100,e),color:amo[t],sx:{flexGrow:1,height:8,borderRadius:1}}),(0,lee.jsxs)(V,{sx:{minWidth:40,textAlign:"right",color:cSe(t)},children:[Math.round(e),"%"]})]})}function E5r(e){return e.avgContextPct==null?"\u2014":`${Math.round(e.avgContextPct)}%`}var smo=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function FKe(e){return smo.format(e)}var uSe=k(I(),1);function R5r({peak:e}){return(0,uSe.jsx)(Dn,{align:"right",sx:{whiteSpace:"nowrap"},children:(0,uSe.jsx)(rr,{title:`Cycle started ${FKe(new Date(e.createdAt))}`,children:(0,uSe.jsx)("span",{children:FKe(new Date(e.resetsAt*1e3))})})})}var P5r=k(I(),1);function A5r(){return(0,P5r.jsx)(Yn,{label:"reset",size:"small",color:"warning",variant:"outlined",title:"Quota reset mid-cycle \u2014 this is the peak reached before the reset.",sx:{ml:1}})}function L5r(e){return!e.tokensUp&&!e.tokensDown?"\u2014":`\u2191 ${zc(e.tokensUp)} \u2193 ${zc(e.tokensDown)}`}var Cy=k(I(),1);function I5r({peak:e,now:t}){let{label:r,seconds:n,striped:o}=rU(e.window),i=wb(e.usedPercentage,e.resetsAt,n,t);return(0,Cy.jsxs)(Of,{sx:a=>({backgroundColor:o?a.tokens.color.stripe:void 0}),children:[(0,Cy.jsxs)(Dn,{children:[r,e.resetDetected&&(0,Cy.jsx)(A5r,{})]}),(0,Cy.jsx)(Dn,{sx:{minWidth:160},children:(0,Cy.jsx)(_5r,{percentage:e.usedPercentage,level:i})}),(0,Cy.jsx)(Dn,{align:"right",sx:{whiteSpace:"nowrap"},children:E5r(e)}),(0,Cy.jsx)(Dn,{align:"right",sx:{whiteSpace:"nowrap"},children:e.phaseCount??0}),(0,Cy.jsx)(Dn,{align:"right",sx:{whiteSpace:"nowrap"},children:L5r(e)}),(0,Cy.jsx)(R5r,{peak:e})]})}var fSe=k(oe(),1);function Ug(e){let[t,r]=(0,fSe.useState)(()=>Math.floor(Date.now()/1e3));return(0,fSe.useEffect)(()=>{let n=setInterval(()=>r(Math.floor(Date.now()/1e3)),e);return()=>clearInterval(n)},[e]),t}var Qc=k(I(),1);function M5r({peaks:e}){let t=Ug(3e4);return(0,Qc.jsx)(r3,{component:rn,children:(0,Qc.jsxs)(Cx,{size:"small",children:[(0,Qc.jsx)(n3,{sx:{"& th":{whiteSpace:"nowrap"}},children:(0,Qc.jsxs)(Of,{children:[(0,Qc.jsx)(Dn,{children:"Window"}),(0,Qc.jsx)(Dn,{children:"Peak usage"}),(0,Qc.jsx)(Dn,{align:"right",children:(0,Qc.jsx)(rr,{title:"Mean context-window usage across all readings in this rate-limit cycle \u2014 distinct from the Peak usage quota above.",children:(0,Qc.jsx)("span",{children:"Avg context"})})}),(0,Qc.jsx)(Dn,{align:"right",children:(0,Qc.jsx)(rr,{title:"Number of phase readings behind the average.",children:(0,Qc.jsx)("span",{children:"Phases"})})}),(0,Qc.jsx)(Dn,{align:"right",children:"Tokens spent"}),(0,Qc.jsx)(Dn,{align:"right",children:"Cycle reset"})]})}),(0,Qc.jsx)(wx,{children:e.map(r=>(0,Qc.jsx)(I5r,{peak:r,now:t},`${r.window}-${r.resetsAt}-${r.segment}`))})]})})}var v5=k(I(),1);function D5r({rows:e,total:t,page:r,pageSize:n,onPageChange:o}){let{ref:i,height:a}=rSe(e.length,n);return(0,v5.jsxs)(v5.Fragment,{children:[(0,v5.jsx)(V,{ref:i,sx:{minHeight:a},children:(0,v5.jsx)(M5r,{peaks:e})}),(0,v5.jsx)(HG,{component:"div",count:t,page:r,rowsPerPage:n,rowsPerPageOptions:[n],onPageChange:(s,l)=>o(l)})]})}var cee=k(oe(),1);function Wg(){let[e,t]=(0,cee.useState)(!1),[r,n]=(0,cee.useState)(!1);return(0,cee.useEffect)(()=>{let o=!1;return(async()=>{try{let a=await(await Jt("/api/harness")).json();o||(t(!!a?.exposeCodexActions),n(!!a?.exposePiActions))}catch(i){Cr(i,"harness capabilities"),t(!1),n(!1)}})(),()=>{o=!0}},[]),{exposeCodexActions:e,exposePiActions:r}}var $Ke=k(I(),1),N5r=["five_hour","seven_day"],lmo=["codex:five_hour","codex:seven_day"];function cmo(e){let t=e?[...N5r,...lmo]:N5r;return[{value:"all",label:"All"},...t.map(r=>({value:r,label:rU(r).label}))]}function O5r({window:e,onChange:t}){let{exposeCodexActions:r}=Wg();return(0,$Ke.jsx)(hc,{size:"small",exclusive:!0,value:e,onChange:(n,o)=>o&&t(o),"aria-label":"Filter peaks by rate-limit window",children:cmo(r).map(n=>(0,$Ke.jsx)(Qa,{value:n.value,children:n.label},n.value))})}var kb=k(I(),1);function B5r({history:e}){let{window:t,total:r}=e;return(0,kb.jsxs)(kb.Fragment,{children:[(0,kb.jsx)(O5r,{window:t,onChange:e.selectWindow}),(0,kb.jsx)(V,{sx:{height:4,my:1},children:e.fetching&&(0,kb.jsx)(gx,{})}),r===0?(0,kb.jsx)(Ee,{color:"text.secondary",align:"center",sx:{py:6},children:t==="all"?"No usage peaks recorded yet.":`No ${rU(t).label} usage peaks recorded yet.`}):(0,kb.jsx)(D5r,{rows:e.rows,total:r,page:e.page,pageSize:e.pageSize,onPageChange:e.setPage})]})}var pSe=k(oe(),1);async function F5r(e,t,r){let n=new URLSearchParams({page:String(e),pageSize:String(t)});r!=="all"&&n.set("window",r);let o=await Jt(`/api/usage/history?${n}`);if(!o.ok)throw new Error(`Failed to load usage history (HTTP ${o.status}).`);return o.json()}var b5=k(oe(),1);function dSe(e,t,r=!0){let[n,o]=(0,b5.useState)(0),[i,a]=(0,b5.useState)(null),[s,l]=(0,b5.useState)(!1),[u,f]=(0,b5.useState)(null);(0,b5.useEffect)(()=>{if(!r)return;let h=!1;return l(!0),e(n,t).then(m=>{h||(a(m),l(!1))},m=>{h||(f(m instanceof Error?m:new Error(String(m))),l(!1))}),()=>{h=!0}},[e,n,t,r]);let d=i?.total??0;(0,b5.useEffect)(()=>{if(d===0)return;let h=Math.ceil(d/t)-1;n>h&&o(h)},[n,t,d]);let p=i?.rows??[];return{data:i,rows:p,total:d,loaded:i!==null,fetching:s,error:u,page:n,setPage:o,pageSize:t}}var umo=30;function $5r(){let[e,t]=(0,pSe.useState)("all"),r=(0,pSe.useCallback)((i,a)=>F5r(i,a,e),[e]),n=dSe(r,umo);return{...n,window:e,selectWindow:i=>{t(i),n.setPage(0)}}}var nU=k(oe(),1);function z5r(e,t){return e.field!==t?{field:t,direction:"desc"}:{field:t,direction:e.direction==="desc"?"asc":"desc"}}var fmo=30;function H5r(e){let[t,r]=(0,nU.useState)(tee),[n,o]=(0,nU.useState)(ree),[i,a]=(0,nU.useState)(eee),s=(0,nU.useCallback)((p,h)=>t5r(p,h,{origin:t,status:n,sort:i}),[t,n,i]),l=dSe(s,fmo,e);return{...l,origin:t,selectOrigin:p=>{r(p),l.setPage(0)},status:n,selectStatus:p=>{o(p),l.setPage(0)},sort:i,sortBy:p=>{a(h=>z5r(h,p)),l.setPage(0)}}}var x5=k(I(),1),dmo={borderBottom:1,borderColor:"divider",mb:2};function W5r(){let[e,t]=(0,U5r.useState)("limits"),r=$5r(),n=H5r(e==="items");if(r.error)throw r.error;if(n.error)throw n.error;return(0,x5.jsxs)(ps,{loading:!r.loaded,title:"Usage history",maxWidth:"lg",children:[(0,x5.jsxs)(i3,{value:e,onChange:(o,i)=>t(i),textColor:"inherit",indicatorColor:"secondary",sx:dmo,"aria-label":"Usage history views",children:[(0,x5.jsx)(Tx,{label:"Rate limits",value:"limits"}),(0,x5.jsx)(Tx,{label:"Items",value:"items"})]}),e==="limits"?(0,x5.jsx)(B5r,{history:r}):(0,x5.jsx)(C5r,{items:n})]})}var hSe=k(oe(),1),zKe=(0,hSe.createContext)([]);function mSe(){return(0,hSe.useContext)(zKe)}var l3r=k(oe(),1);function Gi(){let{selectedCwd:e}=Vn();return e||void 0}var NT=k(oe(),1);var V5r=k(oe(),1);var pmo=new Set(["todo","done","all"]);function G5r(e){return e&&pmo.has(e)?e:"todo"}var q5r="backlog-filter",HKe=new Set,j5r=hmo();function hmo(){try{return G5r(localStorage.getItem(q5r))}catch{return"todo"}}function mmo(e){return HKe.add(e),()=>HKe.delete(e)}function gmo(){return j5r}function ymo(e){j5r=e;try{localStorage.setItem(q5r,e)}catch{}for(let t of HKe)t()}function oU(){return[(0,V5r.useSyncExternalStore)(mmo,gmo),ymo]}function Y5r(){let e=Gi(),t=pr(),[r]=oU(),[n,o]=(0,NT.useState)(""),[i,a]=(0,NT.useState)(null),[s,l]=(0,NT.useState)(!1),[u,f]=(0,NT.useState)(e),d=(0,NT.useRef)(void 0);return e!==u&&(f(e),a(null),l(n.trim().length>0)),(0,NT.useEffect)(()=>{if(d.current!==void 0&&clearTimeout(d.current),!n.trim()){a(null),l(!1);return}let p=new AbortController,{signal:h}=p;return l(!0),d.current=setTimeout(async()=>{try{let m=await Cw({query:n,cwd:e,node:t,signal:h,filter:r});if(h.aborted)return;a(m),l(!1)}catch(m){if(!h.aborted)throw m}},250),()=>{d.current!==void 0&&clearTimeout(d.current),p.abort()}},[n,e,t,r]),{query:n,setQuery:o,results:i,loading:s}}var Z5r={position:"relative",display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",alignItems:"center",columnGap:1.5,width:"100%",p:2,mb:1,borderRadius:2,border:1,borderColor:"divider",bgcolor:"background.paper",transition:"box-shadow 0.2s","&:hover":{boxShadow:3}},vmo={"&::after":{content:'""',position:"absolute",inset:0,borderRadius:2,zIndex:1},"&:focus-visible":{outline:"none"},"&:focus-visible::after":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"2px"}},K5r={position:"relative",zIndex:2},X5r=8,UKe=24,bmo=wi`
|
|
4014
4014
|
from { background-position: 0 0; }
|
|
4015
4015
|
to { background-position: 0 ${UKe}px; }
|
|
4016
|
-
`,J5r={...Z5r,borderColor:"warning.main",borderLeft:4,borderLeftColor:"warning.main",bgcolor:e=>Dr(e.palette.warning.main,.08)},xmo={...J5r,borderLeftColor:"transparent",backgroundImage:e=>`repeating-linear-gradient(to bottom, ${e.palette.warning.main} 0 ${X5r}px, transparent ${X5r}px ${UKe}px)`,backgroundOrigin:"border-box",backgroundRepeat:"repeat-y",backgroundSize:`4px ${UKe}px`,animation:`${bmo} 0.9s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},Q5r={"& .MuiButtonBase-root:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"2px"}},_b={card:Z5r,inProgressCard:J5r,inProgressRunningCard:xmo,main:{minWidth:0,textAlign:"left"},stretchedNameLink:{display:"block",fontWeight:500,color:"text.primary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...vmo},meta:{display:"flex",alignItems:"center",gap:1,...K5r,width:"fit-content",maxWidth:"100%",fontSize:"0.75rem",color:"text.secondary","& a, & p":{fontSize:"0.75rem"},...Q5r},id:{color:"text.disabled"},actions:{display:"flex",alignItems:"center",gap:1,flexShrink:0,...K5r,...Q5r}};function gSe(e){let t=e.peakContextPct>0?` \xB7 \u2593 ${Math.round(e.peakContextPct)}%`:"";return`\u2191 ${zc(e.tokensUp)} \u2193 ${zc(e.tokensDown)} \xB7 \u23F1 ${Sy(e.activeMs)}${t}`}var t4r=k(I(),1),Smo={width:6,height:6,borderRadius:"50%",bgcolor:"currentColor",flexShrink:0};function e4r(){return(0,t4r.jsx)(V,{component:"span",sx:Smo})}var uee=k(I(),1),r4r={display:"inline-flex",alignItems:"center",gap:.625,color:"warning.main",fontWeight:500,fontSize:"0.75rem",whiteSpace:"nowrap",borderRadius:1};function n4r({item:e,openSession:t,onSelectSession:r}){let n=Kr();if(e.status!=="in-progress"||e.currentPhase==null)return null;let o=`phase ${e.currentPhase} of ${e.totalPhases??e.currentPhase}`,i=(0,uee.jsx)(e4r,{});if(!t)return(0,uee.jsxs)(V,{component:"span",sx:r4r,children:[i,o]});let a=()=>{r?.(t.id),n("/sessions")};return(0,uee.jsxs)(ir,{sx:r4r,title:`Open the ${t.status} session`,onClick:a,children:[i,o]})}var em=k(I(),1),Tmo={display:"inline-flex",alignItems:"center",gap:.5},Cmo={width:8,height:8,borderRadius:"50%",flexShrink:0},wmo={whiteSpace:"nowrap"};function kmo({type:e}){let t=sSe[e];return(0,em.jsxs)(V,{component:"span",sx:Tmo,children:[(0,em.jsx)(V,{component:"span",sx:{...Cmo,bgcolor:`${t}.main`}}),e]})}function _mo({item:e}){return e.usageTotal?(0,em.jsx)(rr,{title:gSe(e.usageTotal),children:(0,em.jsx)(V,{component:"span",sx:wmo,children:`\u23F1 ${Sy(e.usageTotal.activeMs)}`})}):null}function o4r({item:e,openSession:t,onSelectSession:r}){return(0,em.jsxs)(V,{sx:_b.meta,children:[(0,em.jsx)(V,{component:"span",sx:_b.id,children:mn(e.id)}),(0,em.jsx)(kmo,{type:e.type}),(0,em.jsx)(n4r,{item:e,openSession:t,onSelectSession:r}),(0,em.jsx)(L8,{jiraKey:e.jiraKey}),(0,em.jsx)(Tw,{githubIssue:e.githubIssue,variant:"icon"}),(0,em.jsx)(_mo,{item:e})]})}function i4r(e,t){return e.filter(r=>rb(r)?.itemId===t).reduce((r,n)=>r&&r.startedAt>=n.startedAt?r:n,void 0)}var a4r=k(I(),1),Emo={todo:"\u25CB","in-progress":"\u25D4",done:"\u25CF",wontdo:"\u2715"},Rmo={todo:"text.disabled","in-progress":"warning.main",done:"success.main",wontdo:"error.main"};function Amo(e){return{fontSize:"1.125rem",flexShrink:0,color:Rmo[e]}}function ySe({status:e}){return(0,a4r.jsx)(Ee,{sx:Amo(e),children:Emo[e]})}function iU(e){return e.status==="todo"||e.status==="in-progress"}function Pmo(e){if(e.status==="done")return e.totalPhases;if(e.status==="in-progress")return e.currentPhase}function Lmo(e,t,r){return r?"complete":e<t?"done":e===t?"current":"remaining"}function s4r(e){let t=e.totalPhases,r=Pmo(e);if(!t||r==null)return;let n=e.status==="done";return{reached:r,total:t,segments:Array.from({length:t},(o,i)=>({phase:i+1,kind:Lmo(i+1,r,n)}))}}var aU=k(I(),1),Imo={done:"text.secondary",current:"warning.main",remaining:"divider",complete:"success.main"},Mmo={display:"inline-flex",alignItems:"center",gap:.5,flexShrink:0},Dmo={fontSize:"0.6875rem",color:"text.secondary",fontVariantNumeric:"tabular-nums"},Nmo={display:"inline-flex",alignItems:"center",gap:"2px"},Omo={width:6,height:12,borderRadius:"1px",flexShrink:0};function l4r({item:e}){let t=s4r(e);return t?(0,aU.jsxs)(V,{sx:Mmo,title:`Phase ${t.reached} of ${t.total}`,children:[(0,aU.jsx)(V,{component:"span",sx:Dmo,children:`${t.reached}/${t.total}`}),(0,aU.jsx)(V,{component:"span",sx:Nmo,"aria-hidden":!0,children:t.segments.map(r=>(0,aU.jsx)(V,{component:"span","data-segment":r.kind,sx:{...Omo,bgcolor:Imo[r.kind]}},r.phase))})]}):null}var D4r=k(oe(),1);var SSe=k(oe(),1);var uL=k(I(),1),Bmo={minWidth:0,p:.5,borderRadius:"50%"};function vSe({tooltip:e,disabled:t,onClick:r,compact:n=!1}){return(0,uL.jsx)(rr,{title:e,children:(0,uL.jsx)(V,{component:"span",sx:{display:"flex"},children:n?(0,uL.jsx)(Tt,{"aria-label":"Build",variant:"contained",color:"success",size:"small",disabled:t,sx:Bmo,onClick:r,children:(0,uL.jsx)(S0,{fontSize:"small"})}):(0,uL.jsx)(Tt,{startIcon:(0,uL.jsx)(S0,{}),disabled:t,onClick:r,children:"Build"})})})}var WKe=k(I(),1);function bSe(e){let t=[];return e.exposeCodexActions&&t.push({kind:"codex",label:"with Codex"}),e.exposePiActions&&t.push({kind:"pi",label:"with pi"}),t}function xSe({anchorEl:e,open:t,onClose:r,options:n,onSelect:o,stop:i}){return(0,WKe.jsx)(Js,{anchorEl:e,open:t,onClose:r,onClick:i,children:n.map(a=>(0,WKe.jsx)(un,{onClick:s=>{i(s),o(a.kind)},children:a.label},a.kind))})}var Eb=k(I(),1);function c4r({tooltip:e,disabled:t,onBuild:r,onSelectHarness:n}){let o=bSe(Wg()),i=(0,SSe.useRef)(null),[a,s]=(0,SSe.useState)(!1),l=u=>u.stopPropagation();return(0,Eb.jsxs)(Eb.Fragment,{children:[(0,Eb.jsxs)(OC,{ref:i,variant:"contained",color:"primary",size:"small",disabled:t,children:[(0,Eb.jsx)(vSe,{tooltip:e,disabled:t,onClick:u=>{l(u),r()}}),o.length>0&&(0,Eb.jsx)(Tt,{"aria-label":"Build with a different harness",onClick:u=>{l(u),s(!0)},children:(0,Eb.jsx)(jd,{})})]}),(0,Eb.jsx)(xSe,{anchorEl:i.current,open:a,onClose:()=>s(!1),options:o,onSelect:u=>{s(!1),n(u)},stop:l})]})}var u4r=k(I(),1),sU=nt((0,u4r.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3m-5.55-8h-2.9v3H8l4 4 4-4h-2.55z"}),"CloudDownloadOutlined");var S5=k(I(),1),Fmo={vertical:"bottom",horizontal:"center"};function TSe({clone:e}){let{prompt:t,confirm:r,cancel:n,error:o,dismissError:i}=e;return(0,S5.jsxs)(S5.Fragment,{children:[t&&(0,S5.jsx)(Io,{title:"Clone repository",message:`Clone ${t.displayName} over SSH into ${t.cloneTarget}${t.node?` on ${t.node}`:""}?`,confirmLabel:"Clone",confirmColor:"primary",onConfirm:r,onCancel:n}),(0,S5.jsx)(xx,{open:!!o,autoHideDuration:8e3,onClose:i,anchorOrigin:Fmo,children:(0,S5.jsx)(jn,{severity:"error",onClose:i,variant:"filled",children:o})})]})}var wy=k(oe(),1);function GKe(e){return["backlog","clone",e]}function CSe(e,t){t(GKe(e.origin),void 0,{title:`Clone ${e.displayName}`,subtitle:e.origin,...e.node&&{node:e.node}})}function f4r(e,t){return!!e&&e.length===t.length&&e.every((r,n)=>r===t[n])}function d4r(e,t,r){let n=GKe(t.origin),o=new Set(e.filter(i=>f4r(i.assistArgs,n)).map(i=>i.id));return CSe(t,r),{args:n,target:t.cloneTarget,node:t.node,preexisting:o}}function p4r(e,t){if(!t.id){let n=e.find(o=>f4r(o.assistArgs,t.args)&&!t.preexisting.has(o.id));return n?{type:"latch",id:n.id}:null}let r=e.find(n=>n.id===t.id);return r?r.status==="done"?{type:"done"}:r.status==="error"?{type:"error",message:r.error||"Clone failed."}:null:null}function wSe(e){let{setSelectedCwd:t}=Vn(),{launchAssist:r}=_l(),[n,o]=(0,wy.useState)(null),[i,a]=(0,wy.useState)(null),[s,l]=(0,wy.useState)(null),u=(0,wy.useCallback)(h=>{l(null),o(h)},[]),f=(0,wy.useCallback)(()=>o(null),[]),d=(0,wy.useCallback)(()=>l(null),[]),p=(0,wy.useCallback)(()=>{n&&(a(d4r(e,n,r)),o(null))},[n,e,r]);return(0,wy.useEffect)(()=>{if(!i)return;let h=p4r(e,i);h&&(h.type==="latch"?a(m=>m&&{...m,id:h.id}):h.type==="done"?(i.node?t(i.target,i.node):t(i.target),a(null)):(l(h.message),a(null)))},[e,i,t]),{prompt:n,requestClone:u,confirm:p,cancel:f,error:s,dismissError:d}}function lU(e,t){return`Not cloned ${e?`on ${e}`:"locally"} \u2014 click to clone into ${t}`}var OT=k(I(),1),$mo={border:1,borderStyle:"dashed"};function h4r({target:e}){let t=wSe(mSe());return(0,OT.jsxs)(OT.Fragment,{children:[(0,OT.jsx)(rr,{title:lU(e.node,e.cloneTarget),children:(0,OT.jsx)(Vt,{"aria-label":"Clone",size:"small",sx:$mo,onClick:r=>{r.stopPropagation(),t.requestClone(e)},children:(0,OT.jsx)(sU,{fontSize:"small"})})}),(0,OT.jsx)(TSe,{clone:t})]})}var hee=k(oe(),1);var fee=k(oe(),1);function m4r(e,t,r,n){let o=Gi(),i=pr(),a=(0,fee.useRef)(!1),[s,l]=(0,fee.useState)(!1),[u,f]=(0,fee.useState)(null);return{busy:s,error:u,clearError:()=>f(null),confirm:async()=>{if(!a.current){a.current=!0,l(!0);try{await W8(e,t,o,i)}catch{f(r),a.current=!1,l(!1);return}await n()}}}}var dee=k(I(),1),zmo={done:{verb:"done",action:"Mark done"},wontdo:{verb:"won't do",action:"Won't do"}};function g4r({itemId:e,status:t,target:r,onClose:n}){let{verb:o,action:i}=zmo[t],a=mn(e),{busy:s,error:l,clearError:u,confirm:f}=m4r(e,t,`Failed to mark item ${a} as ${o}`,async()=>{n(),await r.onClosed()});return(0,dee.jsxs)(ma,{children:[(0,dee.jsx)(Io,{title:`Mark ${a} ${o}`,message:`${r.currentPhase??0} of ${r.totalPhases??0} phases completed. Mark this backlog item as ${o}?`,confirmLabel:i,busy:s,onConfirm:f,onCancel:n}),(0,dee.jsx)(sl,{error:l,onClose:u})]})}var cU=k(I(),1),Hmo=[{status:"done",label:"Mark done"},{status:"wontdo",label:"Won't do"}];function y4r({anchorEl:e,open:t,onClose:r,onRefine:n,onSelect:o,stop:i}){return(0,cU.jsxs)(Js,{anchorEl:e,open:t,onClose:r,onClick:i,children:[(0,cU.jsx)(un,{onClick:a=>{i(a),n()},children:"Refine"}),(0,cU.jsx)(lo,{}),Hmo.map(({status:a,label:s})=>(0,cU.jsx)(un,{onClick:l=>{i(l),o(a)},children:s},a))]})}var v4r=k(I(),1),b4r=nt((0,v4r.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var VKe=k(I(),1);function x4r({anchorRef:e,onClick:t}){return(0,VKe.jsx)(Vt,{ref:e,"aria-label":"More actions",size:"small",onClick:t,children:(0,VKe.jsx)(b4r,{fontSize:"small"})})}var pee=k(I(),1);function S4r({anchorRef:e,tooltip:t,disabled:r,onBuild:n,onMore:o}){return(0,pee.jsxs)(V,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,pee.jsx)(vSe,{compact:!0,tooltip:t,disabled:r,onClick:n}),(0,pee.jsx)(x4r,{anchorRef:e,onClick:o})]})}var T4r=k(oe(),1);function kSe(e){let{launchAssist:t}=_l(),r=Kr(),n=Gi(),o=pr(),[i,a]=(0,T4r.useState)(!1);return{launched:i,launch:l=>{if(i)return;a(!0);let u=o?[{node:o}]:[];t(["refine","--once",...l,mn(e)],n,...u),r("/sessions")}}}var T5=k(I(),1);function C4r({itemId:e,tooltip:t,disabled:r,onBuild:n,closeTarget:o}){let i=(0,hee.useRef)(null),[a,s]=(0,hee.useState)(!1),[l,u]=(0,hee.useState)(null),f=kSe(e),d=p=>p.stopPropagation();return(0,T5.jsxs)(T5.Fragment,{children:[(0,T5.jsx)(S4r,{anchorRef:i,tooltip:t,disabled:r,onBuild:p=>{d(p),n()},onMore:p=>{d(p),s(!0)}}),(0,T5.jsx)(y4r,{anchorEl:i.current,open:a,onClose:()=>s(!1),onRefine:()=>{s(!1),f.launch([])},onSelect:p=>{s(!1),u(p)},stop:d}),l&&(0,T5.jsx)(g4r,{itemId:e,status:l,target:o,onClose:()=>u(null)})]})}var _Se=k(oe(),1),qKe=(0,_Se.createContext)(()=>{});function w4r(){return(0,_Se.useContext)(qKe)}var ESe=k(I(),1);function k4r({session:e}){let t=b1(w4r());return(0,ESe.jsxs)(Tt,{variant:"contained",size:"small",startIcon:(0,ESe.jsx)(qve,{}),onClick:r=>{r.stopPropagation(),t(e.id)},children:["Session ",e.id]})}function RSe(e,t,r,n){let o=r.node?[{node:r.node}]:[];e(["backlog","run",mn(t),...n],r.cwd,...o)}function Umo(e,t){let r=e.assistArgs;if(r?.[0]!=="backlog"||r[1]!=="run"||!r[2])return!1;try{return I8(r[2])===t}catch{return!1}}function uU(e,t){return e.find(r=>r.status!=="done"&&r.status!=="error"&&(Umo(r,t)||rb(r)?.itemId===t))}function ASe(){let{nodes:e,selected:t}=il();return t&&t!==e?.local?t:void 0}var R4r=k(oe(),1);var PSe=k(oe(),1);function _4r(e,t){return Promise.all(t.map(async r=>{let n=await Wmo(e,r).catch(o=>(Cr(o,`clone location on ${r}`),{}));return[r,n]}))}async function Wmo(e,t){let r=await Jt(Vr(`/api/repo-location?origin=${encodeURIComponent(e)}`,t||void 0));return r.ok?r.json():{}}var jKe="\0";function E4r(e,t){let[r,n]=(0,PSe.useState)(null);return(0,PSe.useEffect)(()=>{if(!e||!t)return;let o=!1;return _4r(e,t.split(jKe)).then(i=>{o||n({origin:e,byNode:Object.fromEntries(i)})}),()=>{o=!0}},[e,t]),r}function LSe(e,t){let{cloneOn:r,originOf:n}=Vn(),o=e?n(e):void 0,i=t.filter(s=>!e||!r(e,s)).map(s=>s??"").join(jKe),a=E4r(o,i);return(0,R4r.useCallback)(s=>{let l=e?r(e,s):void 0;if(l)return{kind:"cloned",cwd:l};let u=a&&a.origin===o?a.byNode[s??""]:void 0;return u?.cwd?{kind:"cloned",cwd:u.cwd}:o&&u?.cloneTarget?{kind:"clonable",origin:o,cloneTarget:u.cloneTarget}:{kind:"unavailable"}},[e,r,o,a])}var fU=k(oe(),1);var ISe=k(oe(),1);function MSe(e){let t=(0,ISe.useRef)(null);return(0,ISe.useEffect)(()=>{e&&t.current?.scrollIntoView({block:"nearest"})},[e]),t}var P4r=k(I(),1);function A4r({cwd:e,selected:t,highlighted:r,onHover:n,onSelect:o}){let i=MSe(r);return(0,P4r.jsx)(un,{ref:i,selected:t,title:e,onClick:o,onMouseEnter:n,sx:{fontSize:12,display:"flex",justifyContent:"space-between",gap:1,...r&&{bgcolor:"action.hover"}},children:Rb(e)})}var YKe=k(I(),1);function DSe({repos:e,selected:t,highlight:r,onHighlight:n,onSelect:o}){return(0,YKe.jsx)(Sm,{dense:!0,children:e.map((i,a)=>(0,YKe.jsx)(A4r,{cwd:i,selected:i===t,highlighted:a===r,onHover:()=>n(a),onSelect:()=>o(i)},i))})}var NSe=k(oe(),1);function C5(e,t,r,n){let[o,i]=(0,NSe.useState)(0);return(0,NSe.useEffect)(()=>{i(0)},[t]),{highlight:o,setHighlight:i,onKeyDown:s=>{let l=e.length;if(s.key==="ArrowDown")s.preventDefault(),l>0&&i(u=>(u+1)%l);else if(s.key==="ArrowUp")s.preventDefault(),l>0&&i(u=>(u-1+l)%l);else if(s.key==="Enter"){s.preventDefault();let u=e[o];u!==void 0&&(r(u),n())}else s.key==="Escape"&&(s.preventDefault(),n())}}}var mee=k(I(),1);function Rb(e){let t=e.includes("\\")?"\\":"/";return e.split(t).filter(Boolean).pop()??e}var Gmo={...Jz};function L4r({repos:e,selected:t,onSelect:r,close:n,initialFilter:o=""}){let[i,a]=(0,fU.useState)(o),s=(0,fU.useRef)(null);(0,fU.useEffect)(()=>{s.current?.focus()},[]);let l=i.trim().toLowerCase(),u=l?e.filter(m=>m.toLowerCase().includes(l)):e,{highlight:f,setHighlight:d,onKeyDown:p}=C5(u,l,r,n);return(0,mee.jsxs)(rn,{elevation:4,sx:Gmo,children:[(0,mee.jsx)(Sw,{inputRef:s,value:i,onChange:a,onKeyDown:p,placeholder:"Filter repos..."}),(0,mee.jsx)(DSe,{repos:u,selected:t,highlight:f,onHighlight:d,onSelect:m=>{r(m),n()}})]})}function OSe(e,t){return{origin:e.origin,cloneTarget:e.cloneTarget,displayName:Rb(e.origin),node:t}}function I4r(){let e=Gi(),t=ASe(),r=LSe(e??"",[t])(t);return e?r.kind==="cloned"?{kind:"ready",cwd:r.cwd,node:t}:r.kind==="clonable"?{kind:"clone",prompt:OSe(r,t)}:{kind:"unavailable",node:t??"this machine"}:{kind:"ready",node:t}}function M4r(e){return e?`Not cloned on ${e}`:"Build"}var gee=k(I(),1);function BSe({itemId:e,compact:t}){let{launchAssist:r}=_l(),n=I4r(),o=uU(mSe(),e),[i,a]=(0,D4r.useState)(!1);if(n.kind==="clone")return(0,gee.jsx)(h4r,{target:n.prompt});if(o)return(0,gee.jsx)(k4r,{session:o});let s=n.kind==="unavailable"?n.node:void 0,l=i||!!s,u=d=>{l||n.kind!=="ready"||(a(!0),RSe(r,e,n,d))},f=M4r(s);return t?(0,gee.jsx)(C4r,{itemId:e,tooltip:f,disabled:l,onBuild:()=>u([]),closeTarget:t}):(0,gee.jsx)(c4r,{tooltip:f,disabled:l,onBuild:()=>u([]),onSelectHarness:d=>u(["--harness",d])})}var N4r=k(oe(),1);var dU=k(I(),1);function O4r({itemId:e,starred:t,onToggled:r}){let n=Gi(),o=pr(),[i,a]=(0,N4r.useState)(!1);return(0,dU.jsx)(rr,{title:t?"Unstar":"Star",children:(0,dU.jsx)("span",{children:(0,dU.jsx)(Vt,{"aria-label":t?"Unstar":"Star","aria-pressed":t,color:t?"warning":"default",size:"small",disabled:i,onClick:async l=>{if(l.stopPropagation(),!i){a(!0);try{await bae(e,!t,n,o),await r()}finally{a(!1)}}},children:t?(0,dU.jsx)(DE,{}):(0,dU.jsx)(NE,{})})})})}var w5=k(I(),1);function B4r({item:e,onReload:t}){return(0,w5.jsxs)(w5.Fragment,{children:[(0,w5.jsx)(l4r,{item:e}),(0,w5.jsx)(O4r,{itemId:e.id,starred:e.starred,onToggled:t}),iU(e)&&(0,w5.jsx)(BSe,{itemId:e.id,compact:{currentPhase:e.currentPhase,totalPhases:e.totalPhases,onClosed:t}})]})}var BT=k(I(),1);function Vmo(e,t){return e?t?_b.inProgressRunningCard:_b.inProgressCard:_b.card}function F4r({item:e,to:t,socket:r,onReload:n}){let o=i4r(r.sessions,e.id),i=e.status==="in-progress",a=i&&o?.status==="running";return(0,BT.jsxs)(V,{sx:Vmo(i,a),children:[(0,BT.jsx)(ySe,{status:e.status}),(0,BT.jsxs)(V,{sx:_b.main,children:[(0,BT.jsx)(Ur,{component:Ki,to:t,underline:"none",title:e.name,sx:_b.stretchedNameLink,children:e.name}),(0,BT.jsx)(o4r,{item:e,openSession:o,onSelectSession:r.selectSession})]}),(0,BT.jsx)(V,{sx:_b.actions,children:(0,BT.jsx)(B4r,{item:e,onReload:n})})]})}var z4r=k(I(),1),qmo={all:"items",story:"stories",bug:"bugs"},jmo={textAlign:"center",color:"text.disabled",py:6,px:2};function $4r({query:e,typeFilter:t}){let r=qmo[t],n=e.trim()?`No ${r} match your search.`:`No ${r} in the backlog.`;return(0,z4r.jsx)(V,{sx:jmo,children:n})}var Ab=k(I(),1),Ymo={display:"flex",justifyContent:"center",py:6};function H4r({loading:e,error:t,query:r,typeFilter:n,items:o,socket:i,itemPath:a,onReload:s}){if(e)return(0,Ab.jsx)(V,{sx:Ymo,children:(0,Ab.jsx)(bo,{})});let l=t&&(0,Ab.jsx)(jn,{severity:"error",children:t});return o.length===0?l||(0,Ab.jsx)($4r,{query:r,typeFilter:n}):(0,Ab.jsxs)(Ab.Fragment,{children:[l,o.map(u=>(0,Ab.jsx)(F4r,{item:u,to:a(u),socket:i,onReload:s},u.id))]})}var pU=k(oe(),1);function Kmo(e){let t=new URLSearchParams;for(let n of e)t.append("knownCwd",n);let r=t.toString();return r?`/api/backlog/summary?${r}`:"/api/backlog/summary"}async function FSe({cwd:e,node:t,knownCwds:r,signal:n}){return(await Jt(Bl(Kmo(r),e,t),{signal:n})).json()}function U4r(){let{repos:e,selectedCwd:t,cloneOn:r}=Vn(),n=ASe(),[o,i]=(0,pU.useState)([]),a=(0,pU.useMemo)(()=>e.map(l=>r(l,n)).filter(l=>!!l),[e,r,n]),s=t?r(t,n):void 0;return(0,pU.useEffect)(()=>{let l=new AbortController;return FSe({cwd:s,node:n,knownCwds:a,signal:l.signal}).then(i).catch(()=>{}),()=>l.abort()},[a,s,n]),{summaries:o,node:n}}var $Se=k(I(),1),Xmo={borderStyle:"dashed"};function W4r({summary:e,node:t,onSelectCwd:r,onRequestClone:n}){let{origin:o,displayName:i,openCount:a,isCurrent:s,cwd:l,cloneTarget:u}=e,f=!l&&!!u,d=l?()=>r(l):f&&u?()=>n({origin:o,cloneTarget:u,displayName:i,node:t}):void 0,p=(0,$Se.jsx)(Yn,{label:`${i} (${a})`,size:"small",color:s?"primary":"default",variant:s?"filled":"outlined",disabled:!l&&!f,onClick:d,icon:f?(0,$Se.jsx)(sU,{}):void 0,sx:f?Xmo:void 0});return!f||!u?p:(0,$Se.jsx)(rr,{describeChild:!0,title:lU(t,u),children:p})}var yee=k(I(),1),Qmo={flexWrap:"wrap",gap:1,mb:2};function G4r({sessions:e}){let{summaries:t,node:r}=U4r(),{setSelectedCwd:n}=Vn(),o=wSe(e);return t.length===0?null:(0,yee.jsxs)(_t,{direction:"row",sx:Qmo,children:[t.map(i=>(0,yee.jsx)(W4r,{summary:i,node:r,onSelectCwd:a=>r?n(a,r):n(a),onRequestClone:o.requestClone},i.origin)),(0,yee.jsx)(TSe,{clone:o})]})}var q4r=k(I(),1);function V4r({value:e,onChange:t}){return(0,q4r.jsx)(Un,{"data-backlog-focus":"search",autoFocus:!0,fullWidth:!0,size:"small",placeholder:"Search backlog\u2026",value:e,onChange:r=>t(r.target.value),sx:{mb:2}})}var HSe=k(oe(),1);var KKe=k(I(),1),zSe=nt([(0,KKe.jsx)("path",{d:"M12 5.99 19.53 19H4.47zM12 2 1 21h22z"},"0"),(0,KKe.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");var vee=k(I(),1);function XKe({warn:e,tooltip:t,children:r}){return(0,vee.jsx)(rr,{title:t,children:(0,vee.jsxs)(Ur,{component:Ki,to:"/backups",underline:"hover",color:e?"warning.main":"text.secondary",variant:"body2",sx:e?{display:"inline-flex",alignItems:"center",gap:.5}:void 0,children:[e&&(0,vee.jsx)(zSe,{fontSize:"inherit"}),r]})})}var USe=k(I(),1);async function Zmo(){let[e,t]=await Promise.all([Jt("/api/backups/list"),Jt("/api/backups/status")]),r=await e.json(),{staleAfterMs:n}=await t.json();return{row:r[0]??null,staleAfterMs:n}}function j4r(){let[e,t]=(0,HSe.useState)();if((0,HSe.useEffect)(()=>{Zmo().then(t)},[]),e===void 0)return null;let{row:r,staleAfterMs:n}=e;if(r===null)return(0,USe.jsx)(XKe,{warn:!0,tooltip:"No backup has been recorded",children:"Never backed up"});let o=new Date(r.createdAt).toLocaleString(),i=Date.now()-new Date(r.createdAt).getTime()>n;return(0,USe.jsxs)(XKe,{warn:i,tooltip:i?`Backup overdue \u2014 last backed up ${o}`:o,children:["Last backed up ",Po(String(r.createdAt))]})}var hU=k(I(),1);function Y4r(){let[e,t]=oU();return(0,hU.jsxs)(hc,{value:e,exclusive:!0,size:"small","aria-label":"Status filter",onChange:(r,n)=>{n!==null&&t(n)},children:[(0,hU.jsx)(Qa,{value:"todo",children:"Todo"}),(0,hU.jsx)(Qa,{value:"done",children:"Done"}),(0,hU.jsx)(Qa,{value:"all",children:"All"})]})}var K4r=k(I(),1),WSe=nt((0,K4r.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Sync");var o3r=k(oe(),1);var X4r=k(oe(),1);function Q4r(e,t,r){let n=Kr(),[o,i]=(0,X4r.useState)(!1);return{creating:o,create:async()=>{i(!0);try{let s=await gdt(e,t);s.outcome!=="nothing-unswept"&&n(nf(s.id,e,t))}finally{i(!1),r()}}}}var GSe=k(oe(),1);function Z4r(e,t,r){let[n,o]=(0,GSe.useState)();return(0,GSe.useEffect)(()=>{let i=new AbortController;return mdt(e,t,i.signal).then(o).catch(()=>{}),()=>i.abort()},[e,t,r]),n}var bee=k(I(),1),Jmo={fontFamily:"fontFamilyMono",color:"text.disabled",ml:.75};function J4r({id:e,to:t}){return(0,bee.jsxs)(Tt,{variant:"outlined",size:"small",startIcon:(0,bee.jsx)(WSe,{}),component:Ki,to:t,children:["Refresh docs",(0,bee.jsx)(V,{component:"span",sx:Jmo,children:mn(e)})]})}var fL=k(I(),1),ego={listStyle:"none",m:0,py:.5,px:0,maxHeight:240,overflow:"auto",borderBlock:1,borderColor:"divider"},tgo={display:"flex",gap:1,px:2,py:.75,color:"text.primary","&:hover":{bgcolor:"action.hover"}},rgo={fontFamily:"fontFamilyMono",color:"text.disabled",flexShrink:0},ngo={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function e3r({stories:e,cwd:t,node:r,onSelect:n}){return(0,fL.jsx)(V,{component:"ul",sx:ego,children:e.map(o=>(0,fL.jsx)("li",{children:(0,fL.jsxs)(Ur,{component:Ki,to:nf(o.id,t,r),underline:"none",sx:tgo,onClick:n,children:[(0,fL.jsx)(V,{component:"span",sx:rgo,children:mn(o.id)}),(0,fL.jsx)(V,{component:"span",sx:ngo,title:o.name,children:o.name})]})},o.id))})}var FT=k(I(),1),ogo={width:380,maxWidth:"calc(100vw - 48px)"},t3r={px:2,py:1.5},igo={...t3r,justifyContent:"flex-end"},ago={fontWeight:600};function r3r({anchorEl:e,stories:t,cwd:r,node:n,creating:o,onClose:i,onCreate:a}){let s=t.length===1?"story":"stories";return(0,FT.jsxs)(Zu,{anchorEl:e,open:!!e,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:ogo}},children:[(0,FT.jsxs)(_t,{sx:t3r,children:[(0,FT.jsx)(Ee,{sx:ago,children:`${t.length} ${s} pending docs`}),(0,FT.jsx)(Ee,{variant:"body2",color:"text.secondary",children:"Done stories not covered by a Refresh docs item yet."})]}),(0,FT.jsx)(e3r,{stories:t,cwd:r,node:n,onSelect:i}),(0,FT.jsx)(_t,{direction:"row",sx:igo,children:(0,FT.jsx)(Tt,{variant:"contained",size:"small",disabled:o,onClick:a,children:"Create Refresh docs"})})]})}var n3r=e=>({ml:.75,fontFamily:e.typography.fontFamilyMono,fontSize:12,lineHeight:"18px",minWidth:20,px:.75,borderRadius:999,textAlign:"center",bgcolor:Dr(e.palette.info.main,.1),color:"info.main"});var Pb=k(I(),1);function i3r({revision:e}){let t=Gi(),r=pr(),n=Z4r(t,r,e),[o,i]=(0,o3r.useState)(null),{creating:a,create:s}=Q4r(t,r,()=>i(null));if(!n)return null;if(n.openId!==void 0)return(0,Pb.jsx)(J4r,{id:n.openId,to:nf(n.openId,t,r)});let l=n.unswept.length;return(0,Pb.jsxs)(Pb.Fragment,{children:[(0,Pb.jsxs)(Tt,{variant:"outlined",size:"small",startIcon:(0,Pb.jsx)(WSe,{}),disabled:l===0,"aria-haspopup":"dialog","aria-expanded":!!o,onClick:u=>i(u.currentTarget),children:["Refresh docs",l>0&&(0,Pb.jsx)(V,{component:"span",sx:n3r,children:l})]}),(0,Pb.jsx)(r3r,{anchorEl:o,stories:n.unswept,cwd:t,node:r,creating:a,onClose:()=>i(null),onCreate:s})]})}var mU=k(I(),1);function a3r({value:e,onChange:t}){return(0,mU.jsxs)(hc,{value:e,exclusive:!0,size:"small","aria-label":"Type filter",onChange:(r,n)=>{n!==null&&t(n)},children:[(0,mU.jsx)(Qa,{value:"all",children:"All"}),(0,mU.jsx)(Qa,{value:"story",children:"Stories"}),(0,mU.jsx)(Qa,{value:"bug",children:"Bugs"})]})}var $T=k(I(),1),sgo={justifyContent:"space-between",alignItems:"center",mb:3},lgo={fontWeight:600},cgo={alignItems:"center"};function s3r({typeFilter:e,onTypeFilterChange:t,revision:r}){return(0,$T.jsxs)(_t,{direction:"row",sx:sgo,children:[(0,$T.jsx)(Ee,{variant:"h5",sx:lgo,children:"Backlog"}),(0,$T.jsxs)(_t,{direction:"row",spacing:2,sx:cgo,children:[(0,$T.jsx)(j4r,{}),(0,$T.jsx)(a3r,{value:e,onChange:t}),(0,$T.jsx)(Y4r,{}),(0,$T.jsx)(i3r,{revision:r})]})]})}var zT=k(I(),1);function c3r({items:e,loading:t,error:r,socket:n,onReload:o}){let i=Gi(),a=pr(),{query:s,setQuery:l,results:u,loading:f}=Y5r(),[d,p]=(0,l3r.useState)("all"),h=u??e,m=d==="all"?h:h.filter(g=>g.type===d);return(0,zT.jsxs)(zT.Fragment,{children:[(0,zT.jsx)(s3r,{typeFilter:d,onTypeFilterChange:p,revision:e}),(0,zT.jsx)(V4r,{value:s,onChange:l}),(0,zT.jsx)(G4r,{sessions:n.sessions}),(0,zT.jsx)(H4r,{loading:t||f,error:u?null:r,query:s,typeFilter:d,items:m,socket:n,itemPath:g=>nf(g.id,i,a),onReload:o})]})}var KSe=k(oe(),1);var dL=k(oe(),1);async function xee(e,t,r){let n=await Jt(Bl(`/api/items/${mn(e)}`,t.cwd,t.node),{signal:r});return n.ok?n.json():null}function u3r(e){let t=Gi(),r=pr(),[n,o]=(0,dL.useState)(null),[i,a]=(0,dL.useState)(!0),s=(0,dL.useCallback)(async()=>{o(await xee(e,{cwd:t,node:r}))},[e,t,r]);return(0,dL.useEffect)(()=>{let l=new AbortController,{signal:u}=l;return a(!0),(async()=>{try{let f=await xee(e,{cwd:t,node:r},u);if(u.aborted)return;o(f),a(!1)}catch(f){if(!u.aborted)throw f}})(),()=>l.abort()},[e,t,r]),{item:n,loading:i,reload:s}}function f3r(e,t){let r=new Set,n=new Set,o=[];for(let i of t){if(i.cwdMissing)continue;let a=D8(i),s=ol(i);!a||!s||r.has(a)||n.has(s)||(r.add(a),n.add(s),o.push(s))}return e&&!r.has(N8(e,t))&&!n.has(e)&&o.unshift(e),o}var Ad="";function ugo(e){let t=new Map([[Ad,[]]]);for(let r of e){let n=r.node??Ad;t.set(n,[...t.get(n)??[],r])}return t}function k5(e,t){var n;let r=new Map;for(let[o,i]of ugo(t)){let a=o===Ad?e:"";for(let s of f3r(a,i)){let l=N8(s,i),u=r.get(l)??{key:l,origin:l===s?void 0:l,clones:{}};(n=u.clones)[o]??(n[o]=s),r.set(l,u)}}return[...r.values()]}function d3r(e,t){return e.clones[t]??e.clones[Ad]??Object.values(e.clones)[0]}function See(e,t){return e.find(r=>Object.values(r.clones).includes(t))}function Dp(e,t){return!e||e===t?Ad:e}function p3r(e,t,r,n){if(!t)return e;let o=Dp(r,n);return{...e,selectedCwd:t,selectedNode:r,cloneOn:(i,a)=>{let s=e.cloneOn(i,a);return i!==t||s!==i||Dp(a,n)===o?s:void 0}}}var _5={description:"item-section-description",acceptanceCriteria:"item-section-acceptance-criteria",docsRefreshFor:"item-section-docs-refresh-for",plan:"item-section-plan",activity:"item-section-activity",comments:"item-section-comments"},Tee=140,QKe="--pinned-header-height",fgo=`var(${QKe}, ${Tee}px)`,h3r=`calc(${fgo} + 8px)`;function Gg(e){return{id:_5[e],sx:{mb:2,scrollMarginTop:h3r}}}function VSe(e){return{id:`item-phase-${e}`,sx:{scrollMarginTop:h3r}}}var Vg={color:"text.disabled",mb:1,display:"block",letterSpacing:"0.08em",fontSize:11,fontWeight:600,lineHeight:1.6};var E5=k(I(),1),dgo={maxWidth:"68ch",fontSize:14},pgo=e=>({mr:1,minWidth:14,color:"text.disabled",fontFamily:e.typography.fontFamilyMono,fontSize:12});function m3r({criteria:e}){return e.length===0?null:(0,E5.jsxs)(V,{...Gg("acceptanceCriteria"),children:[(0,E5.jsx)(Ee,{variant:"overline",sx:Vg,children:"Acceptance Criteria"}),(0,E5.jsx)(t1,{disablePadding:!0,sx:dgo,children:e.map((t,r)=>(0,E5.jsxs)($C,{disableGutters:!0,disablePadding:!0,sx:{py:.5,display:"flex",alignItems:"baseline"},children:[(0,E5.jsxs)(Ee,{component:"span",sx:pgo,children:[r+1,"."]}),(0,E5.jsx)(Tc,{component:"span",className:"markdown",html:iE(t)})]},t))})]})}var Cee=k(I(),1);function g3r({description:e}){return e?(0,Cee.jsxs)(V,{...Gg("description"),children:[(0,Cee.jsx)(Ee,{variant:"overline",sx:Vg,children:"Description"}),(0,Cee.jsx)(aE,{content:e,renderMermaid:!0})]}):null}var k3r=k(oe(),1);function y3r(e,t=10){let r=o=>e.filter(i=>i.kind===o).reverse(),n=r("commit");return{docsUnlocks:r("docs-unlock"),branches:r("branch"),commits:n.slice(0,t),overflowCommits:n.slice(t),prs:r("pr"),slacks:r("slack"),sessions:r("session")}}var b3r=k(I(),1),hgo={color:"text.secondary",alignSelf:"flex-start",textAlign:"left"};function v3r({hiddenCount:e,expanded:t,onToggle:r}){return e===0?null:(0,b3r.jsx)(Ur,{component:"button",type:"button",variant:"body2",underline:"hover",sx:hgo,onClick:n=>{n.stopPropagation(),r()},children:t?"Show fewer commits":`\u2026 and ${e} more commits`})}var pL=k(I(),1),mgo={display:"flex",alignItems:"center",gap:1},ggo={color:"text.secondary",fontFamily:"fontFamilyMono"},ygo={flex:1,overflowWrap:"anywhere"},vgo={color:"text.disabled","&:hover":{color:"text.primary"}};function x3r({conversation:e}){let{resumeSession:t}=_l(),r=n=>{n.stopPropagation(),t(e.sessionId,e.cwd??"",e.title,e.harness)};return(0,pL.jsxs)(V,{sx:mgo,children:[(0,pL.jsx)(Ee,{variant:"body2",component:"span",sx:ggo,children:"session"}),(0,pL.jsx)(Ee,{variant:"body2",component:"span",sx:ygo,children:e.title??e.sessionId}),(0,pL.jsx)(Vt,{size:"small",title:"Resume",sx:vgo,onClick:r,children:(0,pL.jsx)(S0,{sx:{fontSize:14}})})]})}var T3r=k(I(),1),bgo={color:"text.disabled",ml:1};function S3r({gitRef:e}){return e.kind!=="commit"&&e.kind!=="docs-unlock"||!e.createdAt?null:(0,T3r.jsx)(V,{component:"span",sx:bgo,children:xgo(e.createdAt)})}function xgo(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function C3r(e){if(e.kind==="commit"){let t=e.title?` ${e.title}`:"";return`${e.ref.slice(0,8)}${t}`}if(e.kind==="pr"){let t=e.title?` ${e.title}`:"",r=e.state?` (${e.state.toLowerCase()})`:"";return`#${e.ref}${t}${r}`}return e.kind==="slack"||e.kind==="session"||e.kind==="docs-unlock"?e.title??e.ref:e.ref}var Lb=k(I(),1),Sgo={color:"text.secondary",mr:1,fontFamily:"fontFamilyMono"};function Tgo({gitRef:e}){let t=C3r(e);return!e.url||e.kind==="session"?(0,Lb.jsx)(Lb.Fragment,{children:t}):(0,Lb.jsx)(Ur,{href:e.url,target:"_blank",rel:"noopener",onClick:r=>r.stopPropagation(),children:t})}function w3r({gitRef:e}){return(0,Lb.jsxs)(Ee,{variant:"body2",children:[(0,Lb.jsx)(V,{component:"span",sx:Sgo,children:e.kind}),(0,Lb.jsx)(Tgo,{gitRef:e}),(0,Lb.jsx)(S3r,{gitRef:e})]})}var R5=k(I(),1);function _3r({gitRefs:e,conversations:t=[]}){let[r,n]=(0,k3r.useState)(!1),{docsUnlocks:o,branches:i,commits:a,overflowCommits:s,prs:l,slacks:u}=y3r(e),f=[...o,...i,...a,...r?s:[],...l,...u];return f.length===0&&t.length===0?null:(0,R5.jsxs)(V,{...Gg("activity"),children:[(0,R5.jsx)(Ee,{variant:"overline",sx:Vg,children:"Activity"}),(0,R5.jsxs)(_t,{spacing:1,children:[f.map(d=>(0,R5.jsx)(w3r,{gitRef:d},`${d.kind}:${d.ref}`)),t.map(d=>(0,R5.jsx)(x3r,{conversation:d},d.sessionId)),(0,R5.jsx)(v3r,{hiddenCount:s.length,expanded:r,onToggle:()=>n(d=>!d)})]})]})}var hL=k(I(),1),Cgo={alignItems:"center",fontSize:"0.75rem",color:"text.secondary",mb:.5},wgo={color:"text.disabled"},kgo={fontWeight:500},_go={summary:"Phase summary",comment:"Comment"};function E3r({comment:e}){return(0,hL.jsxs)(_t,{direction:"row",spacing:.5,sx:Cgo,children:[e.id!==void 0&&(0,hL.jsxs)(Ee,{variant:"caption",sx:wgo,children:["#",e.id]}),(0,hL.jsx)(Ee,{variant:"caption",sx:kgo,children:_go[e.type]}),e.phase!==void 0&&(0,hL.jsxs)(Ee,{variant:"caption",children:["\xB7 Phase ",e.phase]}),(0,hL.jsxs)(Ee,{variant:"caption",children:["\xB7 ",Ego(e.timestamp)]})]})}function Ego(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}var R3r=k(I(),1),A3r=nt((0,R3r.jsx)("path",{d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"}),"DeleteOutlined");var ZKe=k(oe(),1);async function P3r(e,t,r,n){let o=await fetch(Bl(`/api/items/${mn(e)}/comments/${t}`,r,n),{method:"DELETE"});if(!o.ok){let i=await o.json().catch(()=>{});throw new Error(i?.error??`Failed to delete comment (${o.status})`)}}var Ib=k(I(),1),Rgo={mt:-.5,mr:-.5,color:"text.secondary"};function L3r({itemId:e,commentId:t,onDeleted:r}){let n=Gi(),o=pr(),[i,a]=(0,ZKe.useState)(!1),[s,l]=(0,ZKe.useState)(),u=()=>l(void 0);return(0,Ib.jsxs)(Ib.Fragment,{children:[i&&(0,Ib.jsx)(Io,{message:"Are you sure you want to delete this comment?",onConfirm:async()=>{a(!1);try{await P3r(e,t,n,o),await r()}catch(f){l(f instanceof Error?f.message:"Failed to delete comment")}},onCancel:()=>a(!1)}),(0,Ib.jsx)(xx,{open:s!==void 0,autoHideDuration:6e3,onClose:u,children:(0,Ib.jsx)(jn,{severity:"error",variant:"filled",onClose:u,children:s})}),(0,Ib.jsx)(Vt,{"aria-label":"Delete comment",size:"small",sx:Rgo,onClick:()=>a(!0),children:(0,Ib.jsx)(A3r,{fontSize:"inherit"})})]})}var mL=k(I(),1),Ago={summary:{bgcolor:"warning.light",borderColor:"warning.dark"},comment:{bgcolor:"action.selected",borderColor:"divider"}},Pgo={justifyContent:"space-between",alignItems:"flex-start"},Lgo={color:"text.primary",whiteSpace:"pre-wrap"};function Igo(e){return{p:1.5,bgcolor:e.bgcolor,borderColor:e.borderColor}}function I3r({comment:e,itemId:t,onDeleted:r}){return(0,mL.jsxs)(rn,{variant:"outlined",sx:Igo(Ago[e.type]),children:[(0,mL.jsxs)(_t,{direction:"row",sx:Pgo,children:[(0,mL.jsx)(E3r,{comment:e}),e.id!==void 0&&t!==void 0&&r&&(0,mL.jsx)(L3r,{itemId:t,commentId:e.id,onDeleted:r})]}),(0,mL.jsx)(Ee,{variant:"body2",sx:Lgo,children:e.text})]})}var gU=k(I(),1);function M3r({comments:e,itemId:t,onCommentDeleted:r}){return e.length===0?null:(0,gU.jsxs)(V,{...Gg("comments"),children:[(0,gU.jsx)(Ee,{variant:"overline",sx:Vg,children:"Comments"}),(0,gU.jsx)(_t,{spacing:1,children:e.map((n,o)=>(0,gU.jsx)(I3r,{comment:n,itemId:t,onDeleted:r},`${n.timestamp}-${o}`))})]})}var Mb=k(I(),1),Mgo={color:"text.secondary",mr:1,fontFamily:"fontFamilyMono"};function D3r({stories:e}){let t=Gi(),r=pr();if(e.length===0)return null;let n=e.slice().sort((o,i)=>o.id-i.id);return(0,Mb.jsxs)(V,{...Gg("docsRefreshFor"),children:[(0,Mb.jsx)(Ee,{variant:"overline",sx:Vg,children:"Refreshes docs for"}),(0,Mb.jsx)(_t,{spacing:.5,children:n.map(o=>(0,Mb.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,Mb.jsx)(ySe,{status:o.status}),(0,Mb.jsxs)(Ee,{variant:"body2",children:[(0,Mb.jsx)(V,{component:"span",sx:Mgo,children:mn(o.id)}),(0,Mb.jsx)(Ur,{component:Ki,to:nf(o.id,t,r),children:o.name})]})]},o.id))})]})}var N3r=k(I(),1);function yU({total:e,sx:t}){return(0,N3r.jsx)(Ee,{sx:t,children:gSe(e)})}var B3r=k(I(),1),Dgo={color:"text.secondary",fontSize:"0.75rem"};function O3r({usage:e}){let t={tokensUp:e.reduce((r,n)=>r+n.tokensUp,0),tokensDown:e.reduce((r,n)=>r+n.tokensDown,0),activeMs:e.reduce((r,n)=>r+n.activeMs,0),peakContextPct:e.reduce((r,n)=>Math.max(r,n.peakContextPct),0)};return(0,B3r.jsx)(yU,{total:t,sx:Dgo})}var HT=k(I(),1);function F3r({checks:e}){return(0,HT.jsxs)(V,{sx:{mt:1,pt:1},children:[(0,HT.jsx)(lo,{sx:{mb:1}}),(0,HT.jsx)(Ee,{variant:"overline",sx:{color:"text.disabled",letterSpacing:"0.08em"},children:"Manual Checks"}),(0,HT.jsx)(t1,{disablePadding:!0,sx:{ml:.5,mt:.5},children:e.map(t=>(0,HT.jsxs)($C,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,HT.jsx)(Ee,{component:"span",sx:{mr:1,fontSize:"0.875rem",color:"text.secondary"},children:"\u2610"}),(0,HT.jsx)(Tc,{component:"span",className:"markdown",sx:{fontSize:"0.875rem",color:"text.secondary"},html:iE(t)})]},t))})]})}var qSe="task-marker";function Ngo(e,t){let{primary:r,success:n,divider:o}=e.palette;return t==="done"?Dr(n.main,.3):t==="current"?Dr(r.main,.6):o}function Ogo(e,t){let r=t==="done";return{display:"grid",gap:1,px:2,py:"14px","& .MuiList-root":{ml:0},"& .MuiListItem-root":{py:"2px",fontSize:13.5,color:r?"text.primary":"text.secondary"},[`& .${qSe}`]:{width:16,flexShrink:0,mr:"6px",fontSize:"inherit",textAlign:"center",color:r?"success.main":"text.disabled"},bgcolor:"background.paper",borderRadius:`${e.tokens.radius.md}px`,borderColor:Ngo(e,t),...t==="current"&&{boxShadow:`0 0 0 3px ${e.palette.action.selected}`}}}function $3r(e){return t=>Ogo(t,e)}var z3r={done:"\u2713",current:"\xB7",upcoming:"\xB7"};var wee=k(I(),1),Bgo={color:"text.secondary",fontSize:"0.75rem",letterSpacing:"0.08em",display:"block"},Fgo={color:"text.secondary",fontSize:"0.75rem",fontFamily:"fontFamilyMono",display:"block"};function H3r({sessions:e}){return(0,wee.jsxs)(V,{sx:{mb:1},children:[(0,wee.jsx)(Ee,{variant:"overline",sx:Bgo,children:"Sessions"}),e.map(t=>(0,wee.jsx)(Ee,{sx:Fgo,children:`${t.hostname} / ${t.osUser} / ${t.claudeSessionId}`},t.claudeSessionId))]})}var W3r=k(I(),1),$go={color:"text.secondary",fontSize:"0.75rem",mb:1,display:"block"};function U3r({usage:e}){return(0,W3r.jsx)(yU,{total:e,sx:$go})}var q3r=k(oe(),1);var G3r=k(oe(),1),Db=k(I(),1);function V3r({phaseName:e,onConfirm:t,onCancel:r}){let[n,o]=(0,G3r.useState)("");return(0,Db.jsxs)(pc,{open:!0,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,Db.jsxs)(Xu,{children:["Rewind to ",e,"?"]}),(0,Db.jsxs)(Ku,{children:[(0,Db.jsx)(Ee,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will mark all later phases as incomplete."}),(0,Db.jsx)(Un,{fullWidth:!0,multiline:!0,rows:3,size:"small",placeholder:"Reason for rewinding...",value:n,onChange:i=>o(i.target.value)})]}),(0,Db.jsxs)(Dd,{children:[(0,Db.jsx)(Tt,{onClick:r,children:"Cancel"}),(0,Db.jsx)(Tt,{variant:"contained",color:"warning",disabled:n.trim().length===0,onClick:()=>t(n.trim()),children:"Rewind"})]})]})}var gL=k(I(),1),zgo={ml:"auto",minHeight:0,px:"6px",py:"2px",fontSize:12,fontWeight:500,borderRadius:"4px"};function j3r({itemId:e,phaseNumber:t,phaseName:r,onRewound:n}){let o=Gi(),i=pr(),[a,s]=(0,q3r.useState)(!1);return(0,gL.jsxs)(gL.Fragment,{children:[(0,gL.jsx)(Tt,{size:"small",color:"primary",variant:"text",onClick:()=>s(!0),sx:zgo,children:"Rewind"}),a&&(0,gL.jsx)(V3r,{phaseName:r,onConfirm:async l=>{await hdt(e,t,l,o,i),await n()},onCancel:()=>s(!1)})]})}var K3r=k(I(),1);function Y3r({phase:e,index:t,status:r,itemId:n,onRewind:o}){return r!=="done"||n===void 0||!o?null:(0,K3r.jsx)(j3r,{itemId:n,phaseNumber:t+1,phaseName:e.name,onRewound:o})}var yL=k(I(),1),Hgo={done:{label:"Done",color:"success"},current:{label:"In progress",color:"primary"},upcoming:{label:"To do",color:"default"}},Ugo={alignItems:"center",flexWrap:"wrap",gap:1,fontSize:14,fontWeight:600},Wgo=e=>({fontFamily:e.typography.fontFamilyMono,fontSize:12,fontWeight:500,color:"text.disabled"});function X3r(e){let t=Hgo[e.status];return(0,yL.jsxs)(_t,{direction:"row",sx:Ugo,children:[(0,yL.jsx)(V,{component:"span",sx:Wgo,children:e.index+1}),(0,yL.jsx)("span",{children:e.phase.name}),(0,yL.jsx)(Yn,{label:t.label,size:"small",color:t.color}),(0,yL.jsx)(Y3r,{...e})]})}var vU=k(I(),1);function Q3r({tasks:e,marker:t}){return(0,vU.jsx)(t1,{disablePadding:!0,sx:{ml:.5},children:e.map(r=>(0,vU.jsxs)($C,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,vU.jsx)(Ee,{component:"span",className:qSe,sx:{color:"text.secondary",mr:1},children:t}),(0,vU.jsx)(Tc,{component:"span",className:"markdown",html:iE(r.task)})]},r.task))})}var A5=k(I(),1);function Z3r({phase:e,index:t,status:r,itemId:n,usage:o,sessions:i,onRewind:a}){let s=e.manualChecks??[],l=VSe(t),u=z3r[r];return(0,A5.jsxs)(rn,{variant:"outlined",id:l.id,sx:[$3r(r),l.sx],children:[(0,A5.jsx)(X3r,{phase:e,index:t,status:r,itemId:n,onRewind:a}),o&&(0,A5.jsx)(U3r,{usage:o}),(0,A5.jsx)(Q3r,{tasks:e.tasks,marker:u}),s.length>0&&(0,A5.jsx)(F3r,{checks:s}),i&&i.length>0&&(0,A5.jsx)(H3r,{sessions:i})]})}var kee={name:"Review",tasks:[]};function jSe(e){return e.at(-1)?.name===kee.name?e.length-1:e.length}function bU(e,t){if(t===void 0)return"upcoming";let r=e+1;return r<t?"done":r===t?"current":"upcoming"}function J3r(e=[]){return new Map(e.map(t=>[t.phaseIdx,t]))}function eRr(e=[]){let t=new Map;for(let r of e){let n=t.get(r.phaseIdx);n?n.push(r):t.set(r.phaseIdx,[r])}return t}var JKe=k(I(),1);function tRr({phases:e,currentPhase:t,itemId:r,usage:n,sessions:o,onRewind:i}){let a=J3r(n),s=eRr(o),l=jSe(e),u=(o??[]).filter(d=>d.phaseIdx>=l),f=l===e.length&&u.length>0?[...e,kee]:e;return(0,JKe.jsx)(_t,{spacing:1.5,children:f.map((d,p)=>(0,JKe.jsx)(Z3r,{phase:d,index:p,status:bU(p,t),itemId:r,usage:a.get(p),sessions:p===l?u:s.get(p),onRewind:p<e.length?i:void 0},d.name))})}var vL=k(I(),1),Ggo={alignItems:"baseline",justifyContent:"space-between",mb:1},Vgo=[Vg,{mb:0}];function rRr({phases:e,currentPhase:t,itemId:r,usage:n,sessions:o,onRewind:i}){return e.length===0?null:(0,vL.jsxs)(V,{...Gg("plan"),children:[(0,vL.jsxs)(_t,{direction:"row",sx:Ggo,children:[(0,vL.jsx)(Ee,{variant:"overline",sx:Vgo,children:"Plan"}),n&&n.length>0&&(0,vL.jsx)(O3r,{usage:n})]}),(0,vL.jsx)(tRr,{phases:e,currentPhase:t,itemId:r,usage:n,sessions:o,onRewind:i})]})}var UT=k(I(),1);function nRr({item:e,onRewind:t,onCommentDeleted:r}){return(0,UT.jsxs)(UT.Fragment,{children:[e.docsRefreshFor&&(0,UT.jsx)(D3r,{stories:e.docsRefreshFor}),e.plan&&(0,UT.jsx)(rRr,{phases:e.plan,currentPhase:e.currentPhase,itemId:e.id,usage:e.phaseUsage,sessions:e.phaseSessions,onRewind:t}),(0,UT.jsx)(_3r,{gitRefs:e.gitRefs??[],conversations:e.conversations}),e.comments&&(0,UT.jsx)(M3r,{comments:e.comments,itemId:e.id,onCommentDeleted:r})]})}var xU=k(I(),1);function oRr({item:e,onRewind:t,onCommentDeleted:r}){return(0,xU.jsxs)(V,{sx:{pt:2,flex:1,minWidth:0},children:[(0,xU.jsx)(g3r,{description:e.description}),(0,xU.jsx)(m3r,{criteria:e.acceptanceCriteria}),(0,xU.jsx)(nRr,{item:e,onRewind:t,onCommentDeleted:r})]})}var iRr="item-detail";var SU={wideQuery:`@container ${iRr} (min-width: 760px)`,containerSx:{containerType:"inline-size",containerName:iRr},columnsSx:{display:"flex",alignItems:"flex-start",columnGap:4},mainColumnSx:{flex:1,minWidth:0}};var _ee=k(I(),1);function aRr({style:e,header:t,body:r,navigator:n}){return(0,_ee.jsx)(V,{style:e,sx:SU.containerSx,children:(0,_ee.jsxs)(V,{sx:SU.columnsSx,children:[(0,_ee.jsxs)(V,{sx:SU.mainColumnSx,children:[t,r]}),n]})})}function qgo(e){let t=e.plan??[];if(t.length===0)return[];let r=jSe(t),o=r===t.length&&(e.phaseSessions??[]).some(i=>i.phaseIdx>=r)?[...t,kee]:t;return[{id:_5.plan,label:"Phases"},...o.map((i,a)=>({id:VSe(a).id,label:`${a+1}`,title:i.name,status:bU(a,e.currentPhase),nested:!0}))]}function sRr(e){let t=[];return e.description&&t.push({id:_5.description,label:"Description"}),e.acceptanceCriteria.length>0&&t.push({id:_5.acceptanceCriteria,label:"Acceptance Criteria"}),(e.docsRefreshFor?.length??0)>0&&t.push({id:_5.docsRefreshFor,label:"Refreshes docs for"}),t.push(...qgo(e)),(e.gitRefs?.length??0)+(e.conversations?.length??0)>0&&t.push({id:_5.activity,label:"Activity"}),(e.comments?.length??0)>0&&t.push({id:_5.comments,label:"Comments"}),t}var jgo=48,lRr={display:"none",[SU.wideQuery]:{display:"grid"},alignContent:"start",gap:"2px",position:"sticky",top:0,alignSelf:"flex-start",width:200,flexShrink:0,maxHeight:`calc(100vh - ${jgo}px - ${x1})`,overflowY:"auto",overflowX:"hidden",pt:"44px",pb:2};function cRr(e){return{justifyContent:"flex-start",px:"10px",py:.5,borderLeft:2,borderColor:e?"primary.main":"divider",fontSize:13,textAlign:"left",color:e?"text.primary":"text.secondary",transition:"color .2s ease","&:hover":{color:"text.primary"}}}var uRr={display:"grid",gap:"2px",pl:"10px",borderLeft:2,borderColor:"divider"};function fRr(e){return t=>({display:"inline-grid",placeItems:"center",flexShrink:0,width:18,height:18,border:1,borderRadius:"50%",fontStyle:"normal",fontFamily:t.typography.fontFamilyMono,fontSize:10,...Ygo(t,e)})}function Ygo(e,t){return t==="done"?{bgcolor:Dr(e.palette.success.main,.18),borderColor:"transparent",color:"success.main"}:t==="current"?{bgcolor:"primary.main",borderColor:"transparent",color:"primary.contrastText"}:{borderColor:"divider",color:"text.disabled"}}function dRr(e){return{justifyContent:"flex-start",alignItems:"flex-start",gap:1,minWidth:0,py:"3px",pl:.5,fontSize:12,textAlign:"left",color:e?"text.primary":"text.secondary",transition:"color .2s ease","&:hover":{color:"text.primary"},"& .phase-label":{minWidth:0,lineHeight:"18px",overflowWrap:"anywhere"}}}var Eee=k(I(),1);function pRr({section:e,active:t,onSelect:r}){return(0,Eee.jsxs)(ir,{sx:dRr(t),onClick:()=>r(e.id),title:e.title,"aria-current":t?"true":void 0,children:[(0,Eee.jsx)(V,{component:"i",sx:fRr(e.status),children:e.label}),(0,Eee.jsx)(V,{component:"span",className:"phase-label",children:e.title})]})}var bL=k(I(),1);function Kgo(e){let t=[];for(let r of e){let n=t.at(-1);r.nested&&n?n.phases.push(r):t.push({link:r,phases:[]})}return t}function Xgo(e){return e.charAt(0)+e.slice(1).toLowerCase()}function hRr({sections:e,activeId:t,onSelect:r}){return(0,bL.jsx)(V,{component:"nav",sx:lRr,children:Kgo(e).map(({link:n,phases:o})=>(0,bL.jsxs)(V,{sx:{display:"contents"},children:[(0,bL.jsx)(ir,{sx:cRr(n.id===t),onClick:()=>r(n.id),"aria-current":n.id===t?"true":void 0,children:Xgo(n.label)}),o.length>0&&(0,bL.jsx)(V,{sx:uRr,children:o.map(i=>(0,bL.jsx)(pRr,{section:i,active:i.id===t,onSelect:r},i.id))})]},n.id))})}function mRr(e,t=Tee){return lve(e,t)}var yRr=k(I(),1);function Qgo(e){document.getElementById(e)?.scrollIntoView({behavior:"smooth",block:"start"})}function gRr({item:e,headerHeight:t}){let r=sRr(e),n=mRr(r.map(o=>o.id),t);return r.length===0?null:(0,yRr.jsx)(hRr,{sections:r,activeId:n,onSelect:Qgo})}var bRr=k(I(),1),Zgo={justifySelf:"start",minHeight:0,minWidth:0,p:0,fontSize:12,fontWeight:400,lineHeight:1.5,"&:hover":{bgcolor:"transparent"}};function vRr({to:e}){let t=Kr();return(0,bRr.jsx)(Tt,{"data-backlog-focus":"back",variant:"text",size:"small",onClick:()=>t(e),sx:Zgo,children:"\u2190 Backlog"})}var xRr=k(oe(),1);var xL=k(I(),1);function SRr({itemId:e,onDeleted:t}){let r=Gi(),n=pr(),[o,i]=(0,xRr.useState)(!1);return(0,xL.jsxs)(xL.Fragment,{children:[o&&(0,xL.jsx)(Io,{onConfirm:async()=>{await pdt(e,r,n),await t()},onCancel:()=>i(!1)}),(0,xL.jsx)(Tt,{variant:"outlined",color:"error",size:"small",onClick:()=>i(!0),children:"Delete"})]})}var YSe=k(oe(),1);var Nb=k(I(),1);function TRr({itemId:e}){let{launched:t,launch:r}=kSe(e),n=Wg(),o=(0,YSe.useRef)(null),[i,a]=(0,YSe.useState)(!1),s=u=>u.stopPropagation(),l=bSe(n);return(0,Nb.jsxs)(Nb.Fragment,{children:[(0,Nb.jsxs)(OC,{ref:o,variant:"tonal",size:"small",disabled:t,children:[(0,Nb.jsx)(Tt,{onClick:u=>{s(u),r([])},children:"Refine"}),l.length>0&&(0,Nb.jsx)(Tt,{size:"small","aria-label":"Refine with a different harness",onClick:u=>{s(u),a(!0)},children:(0,Nb.jsx)(jd,{})})]}),(0,Nb.jsx)(xSe,{anchorEl:o.current,open:i,onClose:()=>a(!1),options:l,onSelect:u=>{a(!1),r(["--harness",u])},stop:s})]})}var TU=k(I(),1);function CRr({item:e,onDeleted:t}){return(0,TU.jsxs)(_t,{direction:"row",spacing:1,children:[iU(e)&&(0,TU.jsx)(BSe,{itemId:e.id}),(0,TU.jsx)(TRr,{itemId:e.id}),(0,TU.jsx)(SRr,{itemId:e.id,onDeleted:t})]})}var Jgo={todo:"text.secondary","in-progress":"warning.main",done:"success.main",wontdo:"error.main"},e0o={todo:"to do","in-progress":"in progress",done:"done",wontdo:"won't do"};function eXe(e){return e0o[e]}function wRr(e){return t=>{let r=Ove(t,Jgo[e]);return{height:20,minHeight:0,borderRadius:999,fontSize:11,fontWeight:600,color:r,bgcolor:Dr(r,.15),"&:hover":{bgcolor:Dr(r,.22)},"& .MuiOutlinedInput-notchedOutline, &:hover .MuiOutlinedInput-notchedOutline, &.Mui-focused .MuiOutlinedInput-notchedOutline":{border:0},"& .MuiSelect-select.MuiSelect-select":{py:0,pl:1,pr:"22px",minHeight:0,lineHeight:"20px"},"& .MuiSelect-icon":{color:"inherit",fontSize:16,right:4}}}}var tXe=k(I(),1),kRr=e=>{let{value:t,options:r,onChange:n,label:o,sx:i}=e;return(0,tXe.jsx)(HC,{value:t,onChange:a=>n(a.target.value),size:"small",renderValue:o,sx:i,children:r.map(a=>(0,tXe.jsx)(un,{value:a,children:o(a)},a))})};var rXe=k(I(),1),t0o=["todo","in-progress","done","wontdo"];function _Rr({current:e,onStatusChange:t}){return t?(0,rXe.jsx)(kRr,{value:e,options:t0o,onChange:t,label:eXe,sx:wRr(e)}):(0,rXe.jsx)(Yn,{label:eXe(e),size:"small",color:lSe[e]})}var WT=k(I(),1),r0o={alignItems:"center",color:"text.disabled",fontSize:"0.875rem"},n0o={fontFamily:"fontFamilyMono",fontSize:12},o0o={color:"text.secondary",fontSize:"0.75rem"};function ERr({item:e,onStatusChange:t}){let r=sSe[e.type];return(0,WT.jsxs)(_t,{direction:"row",spacing:.75,sx:r0o,children:[(0,WT.jsx)(Ee,{variant:"body2",color:"text.disabled",sx:n0o,children:mn(e.id)}),r&&(0,WT.jsx)(Yn,{label:e.type,size:"small",color:r}),(0,WT.jsx)(_Rr,{current:e.status,onStatusChange:t}),(0,WT.jsx)(L8,{jiraKey:e.jiraKey}),(0,WT.jsx)(Tw,{githubIssue:e.githubIssue,origin:e.origin}),e.usageTotal&&(0,WT.jsx)(yU,{total:e.usageTotal,sx:o0o})]})}var P5=k(I(),1),i0o={justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:1.5},a0o={display:"grid",gap:"6px",minWidth:0},s0o={m:0,fontSize:24,fontWeight:600,lineHeight:1.25,letterSpacing:"-0.015em"};function RRr({item:e,onDeleted:t,onStatusChange:r}){return(0,P5.jsxs)(_t,{direction:"row",sx:i0o,children:[(0,P5.jsxs)(V,{sx:a0o,children:[(0,P5.jsx)(vRr,{to:"/backlog"}),(0,P5.jsx)(Ee,{component:"h2",sx:s0o,children:e.name}),(0,P5.jsx)(ERr,{item:e,onStatusChange:r})]}),(0,P5.jsx)(CRr,{item:e,onDeleted:t})]})}var CU=k(oe(),1);function ARr(){let e=(0,CU.useRef)(null),[t,r]=(0,CU.useState)(!1);return(0,CU.useEffect)(()=>{let n=e.current;if(!n)return;let o=new IntersectionObserver(([i])=>r(!i.isIntersecting),{threshold:0});return o.observe(n),()=>o.disconnect()},[]),{sentinelRef:e,stuck:t}}var L5=k(I(),1);function l0o(e){return t=>({position:"sticky",top:0,zIndex:1,bgcolor:"background.default",mx:-2,px:2,pb:2,boxShadow:e?t.tokens.elevation.stuckHeader:"none",transition:t.transitions.create("box-shadow")})}function PRr({ref:e,...t}){let{sentinelRef:r,stuck:n}=ARr();return(0,L5.jsxs)(L5.Fragment,{children:[(0,L5.jsx)(V,{ref:r,sx:{height:0}}),(0,L5.jsx)(V,{ref:e,sx:l0o(n),children:(0,L5.jsx)(RRr,{...t})})]})}var LRr=k(oe(),1);function IRr(){let e=(0,LRr.useRef)(null),t=cxe(e,Tee),r={[QKe]:`${t}px`};return{headerRef:e,headerHeight:t,style:r}}var Ree=k(I(),1);function MRr({item:e,onReload:t}){let r=Kr(),n=Gi(),o=pr(),{headerRef:i,headerHeight:a,style:s}=IRr();return E1("ItemDetail"),(0,Ree.jsx)(aRr,{style:s,header:(0,Ree.jsx)(PRr,{ref:i,item:e,onDeleted:async()=>{await t(),r("/backlog")},onStatusChange:async f=>{await W8(e.id,f,n,o),await t()}}),body:(0,Ree.jsx)(oRr,{item:e,onRewind:t,onCommentDeleted:t}),navigator:(0,Ree.jsx)(gRr,{item:e,headerHeight:a})})}var SL=k(I(),1),c0o={display:"flex",justifyContent:"center",py:6};function DRr({onReload:e}){let[t]=$s(),r=t.get("cwd")||void 0,n=t.get("node")||void 0,o=Vn(),i=il().nodes?.local,a=(0,KSe.useMemo)(()=>p3r(o,r,n,i),[o,r,n,i]);return E1("ItemRoute"),(0,SL.jsx)(aq.Provider,{value:a,children:(0,SL.jsx)(Fl.Provider,{value:a.selectedNode,children:(0,SL.jsx)(u0o,{onReload:e})})})}function u0o({onReload:e}){let{id:t}=Yx(),r=Number.NaN;try{r=I8(t??"")}catch{r=Number.NaN}let{item:n,loading:o,reload:i}=u3r(r),a=(0,KSe.useCallback)(async()=>{await Promise.all([i(),e()])},[i,e]);return o?(0,SL.jsx)(V,{sx:c0o,children:(0,SL.jsx)(bo,{})}):n?(0,SL.jsx)(MRr,{item:n,onReload:a}):null}var TL=k(I(),1);function NRr({items:e,loading:t,error:r,socket:n,onReload:o}){return(0,TL.jsxs)(Kx,{children:[(0,TL.jsx)(Ao,{index:!0,element:(0,TL.jsx)(c3r,{items:e,loading:t,error:r,socket:n,onReload:o})}),(0,TL.jsx)(Ao,{path:"items/:id",element:(0,TL.jsx)(DRr,{onReload:o})})]})}var ky=k(oe(),1);var ORr=new Map;function BRr(e,t,r){return JSON.stringify([e??null,t,r??null])}var Aee={get(e,t,r){return ORr.get(BRr(e,t,r))},set(e,t,r,n){ORr.set(BRr(e,t,n),r)}};function f0o(e,t){return e===t?!0:!e||!t?!1:e.tokensUp===t.tokensUp&&e.tokensDown===t.tokensDown&&e.activeMs===t.activeMs&&e.peakContextPct===t.peakContextPct}function FRr(e,t){return e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{let o=t[n];return r.id===o.id&&r.type===o.type&&r.name===o.name&&r.status===o.status&&r.starred===o.starred&&f0o(r.usageTotal,o.usageTotal)})}function XSe({setItems:e,setLoading:t,setError:r}){return{onLoaded:n=>{e(o=>FRr(o,n)?o:n),t(!1),r(null)},onError:n=>{t(!1),r(n)}}}async function $Rr(e,t,r,n){let o=await Cw({cwd:e,node:n,signal:r,filter:t});return r.aborted||Aee.set(e,t,o,n),o}function zRr(e,t,r,{onLoaded:n,onError:o},i){return(async()=>{try{let a=await $Rr(e,t,r,i);r.aborted||n(a)}catch(a){r.aborted||o(a instanceof Error?a.message:"Failed to load.")}})()}var d0o=5e3;function QSe(e,t,r,n){let o=new AbortController,i=!1,a=()=>{i||(i=!0,zRr(e,t,o.signal,r,n).finally(()=>{i=!1}))};a();let s=setInterval(a,d0o);return()=>{o.abort(),clearInterval(s)}}function HRr(){let e=Gi(),t=pr(),[r]=oU(),n=Aee.get(e,r,t),o=n??[],i=n===void 0,[a,s]=(0,ky.useState)(o),[l,u]=(0,ky.useState)(i),[f,d]=(0,ky.useState)(null),[p,h]=(0,ky.useState)(e),[m,g]=(0,ky.useState)(t),[y,v]=(0,ky.useState)(r);(e!==p||t!==m||r!==y)&&(h(e),g(t),v(r),s(o),u(i),d(null));let b=(0,ky.useCallback)(async()=>{let x=await Cw({cwd:e,node:t,filter:r});s(x),Aee.set(e,r,x,t),u(!1)},[e,t,r]);return(0,ky.useEffect)(()=>QSe(e,r,XSe({setItems:s,setLoading:u,setError:d}),t),[e,t,r]),{items:a,loading:l,error:f,reload:b}}var wU=k(I(),1);function URr({socket:e}){let{items:t,loading:r,error:n,reload:o}=HRr();return yse(!r),(0,wU.jsx)(zKe.Provider,{value:e.sessions,children:(0,wU.jsx)(qKe.Provider,{value:e.selectSession,children:(0,wU.jsx)(Kx,{children:(0,wU.jsx)(Ao,{path:"/*",element:(0,wU.jsx)(NRr,{items:t,loading:r,error:n,socket:e,onReload:o})})})})})}var nXe=k(I(),1);function WRr({socket:e}){return(0,nXe.jsx)(gG,{maxWidth:"lg",sx:{py:3,px:2},children:(0,nXe.jsx)(URr,{socket:e})})}var vo=k(I(),1);function GRr({socket:e}){return E1("AppRoutes"),(0,vo.jsxs)(vo.Fragment,{children:[(0,vo.jsx)(yyr,{}),(0,vo.jsx)(Kx,{children:(0,vo.jsxs)(Ao,{element:(0,vo.jsx)(gmt,{socket:e}),children:[(0,vo.jsx)(Ao,{path:"sessions",element:(0,vo.jsx)(uEr,{socket:e})}),(0,vo.jsx)(Ao,{path:"backlog/*",element:(0,vo.jsx)(WRr,{socket:e})}),(0,vo.jsx)(Ao,{path:"next",element:(0,vo.jsx)(g0r,{sessions:e.sessions,selectSession:e.selectSession})}),(0,vo.jsx)(Ao,{path:"news",element:(0,vo.jsx)(ygr,{})}),(0,vo.jsx)(Ao,{path:"inbox",element:(0,vo.jsx)(dgr,{})}),(0,vo.jsx)(Ao,{path:"releases",element:(0,vo.jsx)(dyr,{})}),(0,vo.jsx)(Ao,{path:"usage",element:(0,vo.jsx)(W5r,{})}),(0,vo.jsx)(Ao,{path:"backups",element:(0,vo.jsx)(wmt,{})}),(0,vo.jsx)(Ao,{path:"config",element:(0,vo.jsx)(E0t,{})}),(0,vo.jsx)(Ao,{path:"connect-mobile",element:(0,vo.jsx)(W0t,{})}),(0,vo.jsx)(Ao,{path:"updates",element:(0,vo.jsx)(e5r,{reconnecting:e.reconnecting,selectSession:e.selectSession})}),(0,vo.jsx)(Ao,{path:"diff",element:(0,vo.jsx)(kpr,{socket:e})}),(0,vo.jsx)(Ao,{path:"file",element:(0,vo.jsx)(Gmr,{socket:e})}),(0,vo.jsx)(Ao,{path:"*",element:(0,vo.jsx)(JV,{to:"/sessions",replace:!0})})]})})]})}var Ob=k(I(),1),qRr=28,p0o={":root":{[_3e]:`${qRr}px`}},h0o={position:"fixed",left:0,right:0,bottom:0,height:qRr,zIndex:e=>e.zIndex.appBar,display:"flex",alignItems:"center",gap:.5,px:.75,borderTop:1,borderColor:"divider",bgcolor:e=>e.tokens.color.statusBar?.background,color:e=>e.tokens.color.statusBar?.text,fontFamily:"fontFamilyMono",fontSize:"11.5px",whiteSpace:"nowrap",minWidth:0},VRr={display:"flex",alignItems:"center",gap:.5,minWidth:0};function jRr({start:e,end:t}){return(0,Ob.jsxs)(Ob.Fragment,{children:[(0,Ob.jsx)(R4,{styles:p0o}),(0,Ob.jsxs)(V,{component:"footer","data-testid":"status-bar",sx:h0o,children:[(0,Ob.jsx)(V,{sx:VRr,children:e}),(0,Ob.jsx)(V,{sx:{flex:1}}),(0,Ob.jsx)(V,{sx:VRr,children:t})]})]})}var nAr=k(oe(),1);var YRr=k(oe(),1);function KRr(){return(0,YRr.useSyncExternalStore)(Hft,V4e,V4e)}var tAr=k(oe(),1);var XRr={display:"inline-flex",alignItems:"center",gap:.5,px:1,height:22,borderRadius:1,fontSize:"inherit",color:"error.main","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar.hover}},QRr={width:"min(720px, calc(100vw - 32px))",maxHeight:"min(420px, 70vh)",display:"flex",flexDirection:"column",fontFamily:"fontFamilyMono",fontSize:12},ZRr={display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:.75,borderBottom:1,borderColor:"divider"},JRr={overflow:"auto",display:"grid",gridTemplateColumns:"auto auto minmax(0, 2fr) auto minmax(0, 1.5fr) auto",columnGap:1.5,rowGap:.5,px:1.5,py:1,alignItems:"baseline","& > span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& > .muted":{color:"text.secondary"},"& > .outcome":{color:"error.main"},"& > .duration":{textAlign:"right",color:"text.secondary"}};function m0o(e){try{return new URL(e).host}catch{return e}}function eAr(e){return{time:new Date(e.at).toLocaleTimeString(),method:e.method,path:e.path,node:e.node??m0o(e.base),outcome:[e.status===void 0?void 0:String(e.status),e.error].filter(Boolean).join(" ")||"unknown error",duration:e.kind?"":`${e.durationMs}ms`}}var Np=k(I(),1);function rAr({failures:e,onClear:t}){return(0,Np.jsxs)(V,{sx:QRr,role:"region","aria-label":"Recent failures",children:[(0,Np.jsxs)(V,{sx:ZRr,children:[(0,Np.jsxs)("span",{children:["Recent failures (",e.length,")"]}),(0,Np.jsx)(Tt,{size:"small",onClick:t,children:"Clear"})]}),(0,Np.jsx)(V,{sx:JRr,children:e.map((r,n)=>{let o=eAr(r);return(0,Np.jsxs)(tAr.Fragment,{children:[(0,Np.jsx)("span",{className:"muted",children:o.time}),(0,Np.jsx)("span",{children:o.method}),(0,Np.jsx)("span",{title:o.path,children:o.path}),(0,Np.jsx)("span",{className:"muted",children:o.node}),(0,Np.jsx)("span",{className:"outcome",title:o.outcome,children:o.outcome}),(0,Np.jsx)("span",{className:"duration",children:o.duration})]},`${r.at}-${n}`)})})]})}var _y=k(I(),1);function oAr(){let e=KRr(),[t,r]=(0,nAr.useState)(null);if(e.length===0)return null;let n=`${e.length} failed request${e.length>1?"s":""}`;return(0,_y.jsxs)(_y.Fragment,{children:[(0,_y.jsx)(rr,{title:n,placement:"top-end",children:(0,_y.jsxs)(ir,{"aria-label":n,sx:XRr,onClick:o=>r(o.currentTarget),children:[(0,_y.jsx)(Eae,{sx:{fontSize:14}}),(0,_y.jsx)("span",{children:e.length})]})}),(0,_y.jsx)(Zu,{anchorEl:t,open:!!t,onClose:()=>r(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,_y.jsx)(rAr,{failures:e,onClear:()=>{zft(),r(null)}})})]})}function iAr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function ZSe(e,t){let r=[];iAr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,o]of Object.entries(t))iAr(o)&&r.push({harness:n,rateLimits:o});return r}var hAr=k(oe(),1);var Bb=e=>e.tokens.color.statusBar;var kU=e=>Bb(e).secondary;function aAr(e){return t=>Bb(t).level[e]}var dAr=k(oe(),1);function JSe(e,t,r){return e!=null?tU(e,r):t}var eTe=k(I(),1);function sAr({window:e,windowSeconds:t,fallbackLabel:r,now:n}){let o=e?.used_percentage;if(o==null)return null;let i=wb(o,e?.resets_at,t,n),a=JSe(e?.resets_at,r,n);return(0,eTe.jsxs)(V,{component:"span",children:[(0,eTe.jsxs)(V,{component:"span",sx:{color:aAr(i)},children:[Math.round(o),"%"]})," ",(0,eTe.jsxs)(V,{component:"span",sx:{color:kU},children:["(",a,")"]})]})}var CL=k(I(),1),g0o='@property --rainbow-pill-h { syntax: "<number>"; inherits: true; initial-value: 0; }',y0o=wi`
|
|
4016
|
+
`,J5r={...Z5r,borderColor:"warning.main",borderLeft:4,borderLeftColor:"warning.main",bgcolor:e=>Dr(e.palette.warning.main,.08)},xmo={...J5r,borderLeftColor:"transparent",backgroundImage:e=>`repeating-linear-gradient(to bottom, ${e.palette.warning.main} 0 ${X5r}px, transparent ${X5r}px ${UKe}px)`,backgroundOrigin:"border-box",backgroundRepeat:"repeat-y",backgroundSize:`4px ${UKe}px`,animation:`${bmo} 0.9s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},Q5r={"& .MuiButtonBase-root:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"2px"}},_b={card:Z5r,inProgressCard:J5r,inProgressRunningCard:xmo,main:{minWidth:0,textAlign:"left"},stretchedNameLink:{display:"block",fontWeight:500,color:"text.primary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...vmo},meta:{display:"flex",alignItems:"center",gap:1,...K5r,width:"fit-content",maxWidth:"100%",fontSize:"0.75rem",color:"text.secondary","& a, & p":{fontSize:"0.75rem"},...Q5r},id:{color:"text.disabled"},actions:{display:"flex",alignItems:"center",gap:1,flexShrink:0,...K5r,...Q5r}};function gSe(e){let t=e.peakContextPct>0?` \xB7 \u2593 ${Math.round(e.peakContextPct)}%`:"";return`\u2191 ${zc(e.tokensUp)} \u2193 ${zc(e.tokensDown)} \xB7 \u23F1 ${Sy(e.activeMs)}${t}`}var t4r=k(I(),1),Smo={width:6,height:6,borderRadius:"50%",bgcolor:"currentColor",flexShrink:0};function e4r(){return(0,t4r.jsx)(V,{component:"span",sx:Smo})}var uee=k(I(),1),r4r={display:"inline-flex",alignItems:"center",gap:.625,color:"warning.main",fontWeight:500,fontSize:"0.75rem",whiteSpace:"nowrap",borderRadius:1};function n4r({item:e,openSession:t,onSelectSession:r}){let n=Kr();if(e.status!=="in-progress"||e.currentPhase==null)return null;let o=`phase ${e.currentPhase} of ${e.totalPhases??e.currentPhase}`,i=(0,uee.jsx)(e4r,{});if(!t)return(0,uee.jsxs)(V,{component:"span",sx:r4r,children:[i,o]});let a=()=>{r?.(t.id),n("/sessions")};return(0,uee.jsxs)(ir,{sx:r4r,title:`Open the ${t.status} session`,onClick:a,children:[i,o]})}var em=k(I(),1),Tmo={display:"inline-flex",alignItems:"center",gap:.5},Cmo={width:8,height:8,borderRadius:"50%",flexShrink:0},wmo={whiteSpace:"nowrap"};function kmo({type:e}){let t=sSe[e];return(0,em.jsxs)(V,{component:"span",sx:Tmo,children:[(0,em.jsx)(V,{component:"span",sx:{...Cmo,bgcolor:`${t}.main`}}),e]})}function _mo({item:e}){return e.usageTotal?(0,em.jsx)(rr,{title:gSe(e.usageTotal),children:(0,em.jsx)(V,{component:"span",sx:wmo,children:`\u23F1 ${Sy(e.usageTotal.activeMs)}`})}):null}function o4r({item:e,openSession:t,onSelectSession:r}){return(0,em.jsxs)(V,{sx:_b.meta,children:[(0,em.jsx)(V,{component:"span",sx:_b.id,children:mn(e.id)}),(0,em.jsx)(kmo,{type:e.type}),(0,em.jsx)(n4r,{item:e,openSession:t,onSelectSession:r}),(0,em.jsx)(L8,{jiraKey:e.jiraKey}),(0,em.jsx)(Tw,{githubIssue:e.githubIssue,variant:"icon"}),(0,em.jsx)(_mo,{item:e})]})}function i4r(e,t){return e.filter(r=>rb(r)?.itemId===t).reduce((r,n)=>r&&r.startedAt>=n.startedAt?r:n,void 0)}var a4r=k(I(),1),Emo={todo:"\u25CB","in-progress":"\u25D4",done:"\u25CF",wontdo:"\u2715"},Rmo={todo:"text.disabled","in-progress":"warning.main",done:"success.main",wontdo:"error.main"};function Amo(e){return{fontSize:"1.125rem",flexShrink:0,color:Rmo[e]}}function ySe({status:e}){return(0,a4r.jsx)(Ee,{sx:Amo(e),children:Emo[e]})}function iU(e){return e.status==="todo"||e.status==="in-progress"}function Pmo(e){if(e.status==="done")return e.totalPhases;if(e.status==="in-progress")return e.currentPhase}function Lmo(e,t,r){return r?"complete":e<t?"done":e===t?"current":"remaining"}function s4r(e){let t=e.totalPhases,r=Pmo(e);if(!t||r==null)return;let n=e.status==="done";return{reached:r,total:t,segments:Array.from({length:t},(o,i)=>({phase:i+1,kind:Lmo(i+1,r,n)}))}}var aU=k(I(),1),Imo={done:"text.secondary",current:"warning.main",remaining:"divider",complete:"success.main"},Mmo={display:"inline-flex",alignItems:"center",gap:.5,flexShrink:0},Dmo={fontSize:"0.6875rem",color:"text.secondary",fontVariantNumeric:"tabular-nums"},Nmo={display:"inline-flex",alignItems:"center",gap:"2px"},Omo={width:6,height:12,borderRadius:"1px",flexShrink:0};function l4r({item:e}){let t=s4r(e);return t?(0,aU.jsxs)(V,{sx:Mmo,title:`Phase ${t.reached} of ${t.total}`,children:[(0,aU.jsx)(V,{component:"span",sx:Dmo,children:`${t.reached}/${t.total}`}),(0,aU.jsx)(V,{component:"span",sx:Nmo,"aria-hidden":!0,children:t.segments.map(r=>(0,aU.jsx)(V,{component:"span","data-segment":r.kind,sx:{...Omo,bgcolor:Imo[r.kind]}},r.phase))})]}):null}var D4r=k(oe(),1);var SSe=k(oe(),1);var uL=k(I(),1),Bmo={minWidth:0,p:.5,borderRadius:"50%"};function vSe({tooltip:e,disabled:t,onClick:r,compact:n=!1}){return(0,uL.jsx)(rr,{title:e,children:(0,uL.jsx)(V,{component:"span",sx:{display:"flex"},children:n?(0,uL.jsx)(Tt,{"aria-label":"Build",variant:"contained",color:"success",size:"small",disabled:t,sx:Bmo,onClick:r,children:(0,uL.jsx)(S0,{fontSize:"small"})}):(0,uL.jsx)(Tt,{startIcon:(0,uL.jsx)(S0,{}),disabled:t,onClick:r,children:"Build"})})})}var WKe=k(I(),1);function bSe(e){let t=[];return e.exposeCodexActions&&t.push({kind:"codex",label:"with Codex"}),e.exposePiActions&&t.push({kind:"pi",label:"with pi"}),t}function xSe({anchorEl:e,open:t,onClose:r,options:n,onSelect:o,stop:i}){return(0,WKe.jsx)(Js,{anchorEl:e,open:t,onClose:r,onClick:i,children:n.map(a=>(0,WKe.jsx)(un,{onClick:s=>{i(s),o(a.kind)},children:a.label},a.kind))})}var Eb=k(I(),1);function c4r({tooltip:e,disabled:t,onBuild:r,onSelectHarness:n}){let o=bSe(Wg()),i=(0,SSe.useRef)(null),[a,s]=(0,SSe.useState)(!1),l=u=>u.stopPropagation();return(0,Eb.jsxs)(Eb.Fragment,{children:[(0,Eb.jsxs)(OC,{ref:i,variant:"contained",color:"primary",size:"small",disabled:t,children:[(0,Eb.jsx)(vSe,{tooltip:e,disabled:t,onClick:u=>{l(u),r()}}),o.length>0&&(0,Eb.jsx)(Tt,{"aria-label":"Build with a different harness",onClick:u=>{l(u),s(!0)},children:(0,Eb.jsx)(jd,{})})]}),(0,Eb.jsx)(xSe,{anchorEl:i.current,open:a,onClose:()=>s(!1),options:o,onSelect:u=>{s(!1),n(u)},stop:l})]})}var u4r=k(I(),1),sU=nt((0,u4r.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3m-5.55-8h-2.9v3H8l4 4 4-4h-2.55z"}),"CloudDownloadOutlined");var S5=k(I(),1),Fmo={vertical:"bottom",horizontal:"center"};function TSe({clone:e}){let{prompt:t,confirm:r,cancel:n,error:o,dismissError:i}=e;return(0,S5.jsxs)(S5.Fragment,{children:[t&&(0,S5.jsx)(Io,{title:"Clone repository",message:`Clone ${t.displayName} over SSH into ${t.cloneTarget}${t.node?` on ${t.node}`:""}?`,confirmLabel:"Clone",confirmColor:"primary",onConfirm:r,onCancel:n}),(0,S5.jsx)(xx,{open:!!o,autoHideDuration:8e3,onClose:i,anchorOrigin:Fmo,children:(0,S5.jsx)(jn,{severity:"error",onClose:i,variant:"filled",children:o})})]})}var wy=k(oe(),1);function GKe(e){return["backlog","clone",e]}function CSe(e,t){t(GKe(e.origin),void 0,{title:`Clone ${e.displayName}`,subtitle:e.origin,...e.node&&{node:e.node}})}function f4r(e,t){return!!e&&e.length===t.length&&e.every((r,n)=>r===t[n])}function d4r(e,t,r){let n=GKe(t.origin),o=new Set(e.filter(i=>f4r(i.assistArgs,n)).map(i=>i.id));return CSe(t,r),{args:n,target:t.cloneTarget,node:t.node,preexisting:o}}function p4r(e,t){if(!t.id){let n=e.find(o=>f4r(o.assistArgs,t.args)&&!t.preexisting.has(o.id));return n?{type:"latch",id:n.id}:null}let r=e.find(n=>n.id===t.id);return r?r.status==="done"?{type:"done"}:r.status==="error"?{type:"error",message:r.error||"Clone failed."}:null:null}function wSe(e){let{setSelectedCwd:t}=Vn(),{launchAssist:r}=_l(),[n,o]=(0,wy.useState)(null),[i,a]=(0,wy.useState)(null),[s,l]=(0,wy.useState)(null),u=(0,wy.useCallback)(h=>{l(null),o(h)},[]),f=(0,wy.useCallback)(()=>o(null),[]),d=(0,wy.useCallback)(()=>l(null),[]),p=(0,wy.useCallback)(()=>{n&&(a(d4r(e,n,r)),o(null))},[n,e,r]);return(0,wy.useEffect)(()=>{if(!i)return;let h=p4r(e,i);h&&(h.type==="latch"?a(m=>m&&{...m,id:h.id}):h.type==="done"?(i.node?t(i.target,i.node):t(i.target),a(null)):(l(h.message),a(null)))},[e,i,t]),{prompt:n,requestClone:u,confirm:p,cancel:f,error:s,dismissError:d}}function lU(e,t){return`Not cloned ${e?`on ${e}`:"locally"} \u2014 click to clone into ${t}`}var OT=k(I(),1),$mo={border:1,borderStyle:"dashed"};function h4r({target:e}){let t=wSe(mSe());return(0,OT.jsxs)(OT.Fragment,{children:[(0,OT.jsx)(rr,{title:lU(e.node,e.cloneTarget),children:(0,OT.jsx)(Vt,{"aria-label":"Clone",size:"small",sx:$mo,onClick:r=>{r.stopPropagation(),t.requestClone(e)},children:(0,OT.jsx)(sU,{fontSize:"small"})})}),(0,OT.jsx)(TSe,{clone:t})]})}var hee=k(oe(),1);var fee=k(oe(),1);function m4r(e,t,r,n){let o=Gi(),i=pr(),a=(0,fee.useRef)(!1),[s,l]=(0,fee.useState)(!1),[u,f]=(0,fee.useState)(null);return{busy:s,error:u,clearError:()=>f(null),confirm:async()=>{if(!a.current){a.current=!0,l(!0);try{await W8(e,t,o,i)}catch{f(r),a.current=!1,l(!1);return}await n()}}}}var dee=k(I(),1),zmo={done:{verb:"done",action:"Mark done"},wontdo:{verb:"won't do",action:"Won't do"}};function g4r({itemId:e,status:t,target:r,onClose:n}){let{verb:o,action:i}=zmo[t],a=mn(e),{busy:s,error:l,clearError:u,confirm:f}=m4r(e,t,`Failed to mark item ${a} as ${o}`,async()=>{n(),await r.onClosed()});return(0,dee.jsxs)(ma,{children:[(0,dee.jsx)(Io,{title:`Mark ${a} ${o}`,message:`${r.currentPhase??0} of ${r.totalPhases??0} phases completed. Mark this backlog item as ${o}?`,confirmLabel:i,busy:s,onConfirm:f,onCancel:n}),(0,dee.jsx)(sl,{error:l,onClose:u})]})}var cU=k(I(),1),Hmo=[{status:"done",label:"Mark done"},{status:"wontdo",label:"Won't do"}];function y4r({anchorEl:e,open:t,onClose:r,onRefine:n,onSelect:o,stop:i}){return(0,cU.jsxs)(Js,{anchorEl:e,open:t,onClose:r,onClick:i,children:[(0,cU.jsx)(un,{onClick:a=>{i(a),n()},children:"Refine"}),(0,cU.jsx)(lo,{}),Hmo.map(({status:a,label:s})=>(0,cU.jsx)(un,{onClick:l=>{i(l),o(a)},children:s},a))]})}var v4r=k(I(),1),b4r=nt((0,v4r.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert");var VKe=k(I(),1);function x4r({anchorRef:e,onClick:t}){return(0,VKe.jsx)(Vt,{ref:e,"aria-label":"More actions",size:"small",onClick:t,children:(0,VKe.jsx)(b4r,{fontSize:"small"})})}var pee=k(I(),1);function S4r({anchorRef:e,tooltip:t,disabled:r,onBuild:n,onMore:o}){return(0,pee.jsxs)(V,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,pee.jsx)(vSe,{compact:!0,tooltip:t,disabled:r,onClick:n}),(0,pee.jsx)(x4r,{anchorRef:e,onClick:o})]})}var T4r=k(oe(),1);function kSe(e){let{launchAssist:t}=_l(),r=Kr(),n=Gi(),o=pr(),[i,a]=(0,T4r.useState)(!1);return{launched:i,launch:l=>{if(i)return;a(!0);let u=o?[{node:o}]:[];t(["refine","--once",...l,mn(e)],n,...u),r("/sessions")}}}var T5=k(I(),1);function C4r({itemId:e,tooltip:t,disabled:r,onBuild:n,closeTarget:o}){let i=(0,hee.useRef)(null),[a,s]=(0,hee.useState)(!1),[l,u]=(0,hee.useState)(null),f=kSe(e),d=p=>p.stopPropagation();return(0,T5.jsxs)(T5.Fragment,{children:[(0,T5.jsx)(S4r,{anchorRef:i,tooltip:t,disabled:r,onBuild:p=>{d(p),n()},onMore:p=>{d(p),s(!0)}}),(0,T5.jsx)(y4r,{anchorEl:i.current,open:a,onClose:()=>s(!1),onRefine:()=>{s(!1),f.launch([])},onSelect:p=>{s(!1),u(p)},stop:d}),l&&(0,T5.jsx)(g4r,{itemId:e,status:l,target:o,onClose:()=>u(null)})]})}var _Se=k(oe(),1),qKe=(0,_Se.createContext)(()=>{});function w4r(){return(0,_Se.useContext)(qKe)}var ESe=k(I(),1);function k4r({session:e}){let t=b1(w4r());return(0,ESe.jsxs)(Tt,{variant:"contained",size:"small",startIcon:(0,ESe.jsx)(qve,{}),onClick:r=>{r.stopPropagation(),t(e.id)},children:["Session ",e.id]})}function RSe(e,t,r,n){let o=r.node?[{node:r.node}]:[];e(["backlog","run",mn(t),...n],r.cwd,...o)}function Umo(e,t){let r=e.assistArgs;if(r?.[0]!=="backlog"||r[1]!=="run"||!r[2])return!1;try{return I8(r[2])===t}catch{return!1}}function uU(e,t){return e.find(r=>r.status!=="done"&&r.status!=="error"&&(Umo(r,t)||rb(r)?.itemId===t))}function ASe(){let{nodes:e,selected:t}=il();return t&&t!==e?.local?t:void 0}var R4r=k(oe(),1);var PSe=k(oe(),1);function _4r(e,t){return Promise.all(t.map(async r=>{let n=await Wmo(e,r).catch(o=>(Cr(o,`clone location on ${r}`),{}));return[r,n]}))}async function Wmo(e,t){let r=await Jt(Vr(`/api/repo-location?origin=${encodeURIComponent(e)}`,t||void 0));return r.ok?r.json():{}}var jKe="\0";function E4r(e,t){let[r,n]=(0,PSe.useState)(null);return(0,PSe.useEffect)(()=>{if(!e||!t)return;let o=!1;return _4r(e,t.split(jKe)).then(i=>{o||n({origin:e,byNode:Object.fromEntries(i)})}),()=>{o=!0}},[e,t]),r}function LSe(e,t){let{cloneOn:r,originOf:n}=Vn(),o=e?n(e):void 0,i=t.filter(s=>!e||!r(e,s)).map(s=>s??"").join(jKe),a=E4r(o,i);return(0,R4r.useCallback)(s=>{let l=e?r(e,s):void 0;if(l)return{kind:"cloned",cwd:l};let u=a&&a.origin===o?a.byNode[s??""]:void 0;return u?.cwd?{kind:"cloned",cwd:u.cwd}:o&&u?.cloneTarget?{kind:"clonable",origin:o,cloneTarget:u.cloneTarget}:{kind:"unavailable"}},[e,r,o,a])}var fU=k(oe(),1);var ISe=k(oe(),1);function MSe(e){let t=(0,ISe.useRef)(null);return(0,ISe.useEffect)(()=>{e&&t.current?.scrollIntoView({block:"nearest"})},[e]),t}var P4r=k(I(),1);function A4r({cwd:e,selected:t,highlighted:r,onHover:n,onSelect:o}){let i=MSe(r);return(0,P4r.jsx)(un,{ref:i,selected:t,title:e,onClick:o,onMouseEnter:n,sx:{fontSize:12,display:"flex",justifyContent:"space-between",gap:1,...r&&{bgcolor:"action.hover"}},children:Rb(e)})}var YKe=k(I(),1);function DSe({repos:e,selected:t,highlight:r,onHighlight:n,onSelect:o}){return(0,YKe.jsx)(Sm,{dense:!0,children:e.map((i,a)=>(0,YKe.jsx)(A4r,{cwd:i,selected:i===t,highlighted:a===r,onHover:()=>n(a),onSelect:()=>o(i)},i))})}var NSe=k(oe(),1);function C5(e,t,r,n){let[o,i]=(0,NSe.useState)(0);return(0,NSe.useEffect)(()=>{i(0)},[t]),{highlight:o,setHighlight:i,onKeyDown:s=>{let l=e.length;if(s.key==="ArrowDown")s.preventDefault(),l>0&&i(u=>(u+1)%l);else if(s.key==="ArrowUp")s.preventDefault(),l>0&&i(u=>(u-1+l)%l);else if(s.key==="Enter"){s.preventDefault();let u=e[o];u!==void 0&&(r(u),n())}else s.key==="Escape"&&(s.preventDefault(),n())}}}var mee=k(I(),1);function Rb(e){let t=e.includes("\\")?"\\":"/";return e.split(t).filter(Boolean).pop()??e}var Gmo={...Jz};function L4r({repos:e,selected:t,onSelect:r,close:n,initialFilter:o=""}){let[i,a]=(0,fU.useState)(o),s=(0,fU.useRef)(null);(0,fU.useEffect)(()=>{s.current?.focus()},[]);let l=i.trim().toLowerCase(),u=l?e.filter(m=>m.toLowerCase().includes(l)):e,{highlight:f,setHighlight:d,onKeyDown:p}=C5(u,l,r,n);return(0,mee.jsxs)(rn,{elevation:4,sx:Gmo,children:[(0,mee.jsx)(Sw,{inputRef:s,value:i,onChange:a,onKeyDown:p,placeholder:"Filter repos..."}),(0,mee.jsx)(DSe,{repos:u,selected:t,highlight:f,onHighlight:d,onSelect:m=>{r(m),n()}})]})}function OSe(e,t){return{origin:e.origin,cloneTarget:e.cloneTarget,displayName:Rb(e.origin),node:t}}function I4r(){let e=Gi(),t=ASe(),r=LSe(e??"",[t])(t);return e?r.kind==="cloned"?{kind:"ready",cwd:r.cwd,node:t}:r.kind==="clonable"?{kind:"clone",prompt:OSe(r,t)}:{kind:"unavailable",node:t??"this machine"}:{kind:"ready",node:t}}function M4r(e){return e?`Not cloned on ${e}`:"Build"}var gee=k(I(),1);function BSe({itemId:e,compact:t}){let{launchAssist:r}=_l(),n=I4r(),o=uU(mSe(),e),[i,a]=(0,D4r.useState)(!1);if(n.kind==="clone")return(0,gee.jsx)(h4r,{target:n.prompt});if(o)return(0,gee.jsx)(k4r,{session:o});let s=n.kind==="unavailable"?n.node:void 0,l=i||!!s,u=d=>{l||n.kind!=="ready"||(a(!0),RSe(r,e,n,d))},f=M4r(s);return t?(0,gee.jsx)(C4r,{itemId:e,tooltip:f,disabled:l,onBuild:()=>u([]),closeTarget:t}):(0,gee.jsx)(c4r,{tooltip:f,disabled:l,onBuild:()=>u([]),onSelectHarness:d=>u(["--harness",d])})}var N4r=k(oe(),1);var dU=k(I(),1);function O4r({itemId:e,starred:t,onToggled:r}){let n=Gi(),o=pr(),[i,a]=(0,N4r.useState)(!1);return(0,dU.jsx)(rr,{title:t?"Unstar":"Star",children:(0,dU.jsx)("span",{children:(0,dU.jsx)(Vt,{"aria-label":t?"Unstar":"Star","aria-pressed":t,color:t?"warning":"default",size:"small",disabled:i,onClick:async l=>{if(l.stopPropagation(),!i){a(!0);try{await bae(e,!t,n,o),await r()}finally{a(!1)}}},children:t?(0,dU.jsx)(DE,{}):(0,dU.jsx)(NE,{})})})})}var w5=k(I(),1);function B4r({item:e,onReload:t}){return(0,w5.jsxs)(w5.Fragment,{children:[(0,w5.jsx)(l4r,{item:e}),(0,w5.jsx)(O4r,{itemId:e.id,starred:e.starred,onToggled:t}),iU(e)&&(0,w5.jsx)(BSe,{itemId:e.id,compact:{currentPhase:e.currentPhase,totalPhases:e.totalPhases,onClosed:t}})]})}var BT=k(I(),1);function Vmo(e,t){return e?t?_b.inProgressRunningCard:_b.inProgressCard:_b.card}function F4r({item:e,to:t,socket:r,onReload:n}){let o=i4r(r.sessions,e.id),i=e.status==="in-progress",a=i&&o?.status==="running";return(0,BT.jsxs)(V,{sx:Vmo(i,a),children:[(0,BT.jsx)(ySe,{status:e.status}),(0,BT.jsxs)(V,{sx:_b.main,children:[(0,BT.jsx)(Ur,{component:Ki,to:t,underline:"none",title:e.name,sx:_b.stretchedNameLink,children:e.name}),(0,BT.jsx)(o4r,{item:e,openSession:o,onSelectSession:r.selectSession})]}),(0,BT.jsx)(V,{sx:_b.actions,children:(0,BT.jsx)(B4r,{item:e,onReload:n})})]})}var z4r=k(I(),1),qmo={all:"items",story:"stories",bug:"bugs"},jmo={textAlign:"center",color:"text.disabled",py:6,px:2};function $4r({query:e,typeFilter:t}){let r=qmo[t],n=e.trim()?`No ${r} match your search.`:`No ${r} in the backlog.`;return(0,z4r.jsx)(V,{sx:jmo,children:n})}var Ab=k(I(),1),Ymo={display:"flex",justifyContent:"center",py:6};function H4r({loading:e,error:t,query:r,typeFilter:n,items:o,socket:i,itemPath:a,onReload:s}){if(e)return(0,Ab.jsx)(V,{sx:Ymo,children:(0,Ab.jsx)(bo,{})});let l=t&&(0,Ab.jsx)(jn,{severity:"error",children:t});return o.length===0?l||(0,Ab.jsx)($4r,{query:r,typeFilter:n}):(0,Ab.jsxs)(Ab.Fragment,{children:[l,o.map(u=>(0,Ab.jsx)(F4r,{item:u,to:a(u),socket:i,onReload:s},u.id))]})}var pU=k(oe(),1);function Kmo(e){let t=new URLSearchParams;for(let n of e)t.append("knownCwd",n);let r=t.toString();return r?`/api/backlog/summary?${r}`:"/api/backlog/summary"}async function FSe({cwd:e,node:t,knownCwds:r,signal:n}){return(await Jt(Bl(Kmo(r),e,t),{signal:n})).json()}function U4r(){let{repos:e,selectedCwd:t,cloneOn:r}=Vn(),n=ASe(),[o,i]=(0,pU.useState)([]),a=(0,pU.useMemo)(()=>e.map(l=>r(l,n)).filter(l=>!!l),[e,r,n]),s=t?r(t,n):void 0;return(0,pU.useEffect)(()=>{let l=new AbortController;return FSe({cwd:s,node:n,knownCwds:a,signal:l.signal}).then(i).catch(()=>{}),()=>l.abort()},[a,s,n]),{summaries:o,node:n}}var $Se=k(I(),1),Xmo={borderStyle:"dashed"};function W4r({summary:e,node:t,onSelectCwd:r,onRequestClone:n}){let{origin:o,displayName:i,openCount:a,isCurrent:s,cwd:l,cloneTarget:u}=e,f=!l&&!!u,d=l?()=>r(l):f&&u?()=>n({origin:o,cloneTarget:u,displayName:i,node:t}):void 0,p=(0,$Se.jsx)(Yn,{label:`${i} (${a})`,size:"small",color:s?"primary":"default",variant:s?"filled":"outlined",disabled:!l&&!f,onClick:d,icon:f?(0,$Se.jsx)(sU,{}):void 0,sx:f?Xmo:void 0});return!f||!u?p:(0,$Se.jsx)(rr,{describeChild:!0,title:lU(t,u),children:p})}var yee=k(I(),1),Qmo={flexWrap:"wrap",gap:1,mb:2};function G4r({sessions:e}){let{summaries:t,node:r}=U4r(),{setSelectedCwd:n}=Vn(),o=wSe(e);return t.length===0?null:(0,yee.jsxs)(_t,{direction:"row",sx:Qmo,children:[t.map(i=>(0,yee.jsx)(W4r,{summary:i,node:r,onSelectCwd:a=>r?n(a,r):n(a),onRequestClone:o.requestClone},i.origin)),(0,yee.jsx)(TSe,{clone:o})]})}var q4r=k(I(),1);function V4r({value:e,onChange:t}){return(0,q4r.jsx)(Un,{"data-backlog-focus":"search",autoFocus:!0,fullWidth:!0,size:"small",placeholder:"Search backlog\u2026",value:e,onChange:r=>t(r.target.value),sx:{mb:2}})}var HSe=k(oe(),1);var KKe=k(I(),1),zSe=nt([(0,KKe.jsx)("path",{d:"M12 5.99 19.53 19H4.47zM12 2 1 21h22z"},"0"),(0,KKe.jsx)("path",{d:"M13 16h-2v2h2zm0-6h-2v5h2z"},"1")],"WarningAmber");var vee=k(I(),1);function XKe({warn:e,tooltip:t,children:r}){return(0,vee.jsx)(rr,{title:t,children:(0,vee.jsxs)(Ur,{component:Ki,to:"/backups",underline:"hover",color:e?"warning.main":"text.secondary",variant:"body2",sx:e?{display:"inline-flex",alignItems:"center",gap:.5}:void 0,children:[e&&(0,vee.jsx)(zSe,{fontSize:"inherit"}),r]})})}var USe=k(I(),1);async function Zmo(){let[e,t]=await Promise.all([Jt("/api/backups/list"),Jt("/api/backups/status")]),r=await e.json(),{staleAfterMs:n}=await t.json();return{row:r[0]??null,staleAfterMs:n}}function j4r(){let[e,t]=(0,HSe.useState)();if((0,HSe.useEffect)(()=>{Zmo().then(t)},[]),e===void 0)return null;let{row:r,staleAfterMs:n}=e;if(r===null)return(0,USe.jsx)(XKe,{warn:!0,tooltip:"No backup has been recorded",children:"Never backed up"});let o=new Date(r.createdAt).toLocaleString(),i=Date.now()-new Date(r.createdAt).getTime()>n;return(0,USe.jsxs)(XKe,{warn:i,tooltip:i?`Backup overdue \u2014 last backed up ${o}`:o,children:["Last backed up ",Po(String(r.createdAt))]})}var hU=k(I(),1);function Y4r(){let[e,t]=oU();return(0,hU.jsxs)(hc,{value:e,exclusive:!0,size:"small","aria-label":"Status filter",onChange:(r,n)=>{n!==null&&t(n)},children:[(0,hU.jsx)(Qa,{value:"todo",children:"Todo"}),(0,hU.jsx)(Qa,{value:"done",children:"Done"}),(0,hU.jsx)(Qa,{value:"all",children:"All"})]})}var K4r=k(I(),1),WSe=nt((0,K4r.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Sync");var o3r=k(oe(),1);var X4r=k(oe(),1);function Q4r(e,t,r){let n=Kr(),[o,i]=(0,X4r.useState)(!1);return{creating:o,create:async()=>{i(!0);try{let s=await gdt(e,t);s.outcome!=="nothing-unswept"&&n(nf(s.id,e,t))}finally{i(!1),r()}}}}var GSe=k(oe(),1);function Z4r(e,t,r){let[n,o]=(0,GSe.useState)();return(0,GSe.useEffect)(()=>{let i=new AbortController;return mdt(e,t,i.signal).then(o).catch(()=>{}),()=>i.abort()},[e,t,r]),n}var bee=k(I(),1),Jmo={fontFamily:"fontFamilyMono",color:"text.disabled",ml:.75};function J4r({id:e,to:t}){return(0,bee.jsxs)(Tt,{variant:"outlined",size:"small",startIcon:(0,bee.jsx)(WSe,{}),component:Ki,to:t,children:["Refresh docs",(0,bee.jsx)(V,{component:"span",sx:Jmo,children:mn(e)})]})}var fL=k(I(),1),ego={listStyle:"none",m:0,py:.5,px:0,maxHeight:240,overflow:"auto",borderBlock:1,borderColor:"divider"},tgo={display:"flex",gap:1,px:2,py:.75,color:"text.primary","&:hover":{bgcolor:"action.hover"}},rgo={fontFamily:"fontFamilyMono",color:"text.disabled",flexShrink:0},ngo={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function e3r({stories:e,cwd:t,node:r,onSelect:n}){return(0,fL.jsx)(V,{component:"ul",sx:ego,children:e.map(o=>(0,fL.jsx)("li",{children:(0,fL.jsxs)(Ur,{component:Ki,to:nf(o.id,t,r),underline:"none",sx:tgo,onClick:n,children:[(0,fL.jsx)(V,{component:"span",sx:rgo,children:mn(o.id)}),(0,fL.jsx)(V,{component:"span",sx:ngo,title:o.name,children:o.name})]})},o.id))})}var FT=k(I(),1),ogo={width:380,maxWidth:"calc(100vw - 48px)"},t3r={px:2,py:1.5},igo={...t3r,justifyContent:"flex-end"},ago={fontWeight:600};function r3r({anchorEl:e,stories:t,cwd:r,node:n,creating:o,onClose:i,onCreate:a}){let s=t.length===1?"story":"stories";return(0,FT.jsxs)(Zu,{anchorEl:e,open:!!e,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:ogo}},children:[(0,FT.jsxs)(_t,{sx:t3r,children:[(0,FT.jsx)(Ee,{sx:ago,children:`${t.length} ${s} pending docs`}),(0,FT.jsx)(Ee,{variant:"body2",color:"text.secondary",children:"Done stories not covered by a Refresh docs item yet."})]}),(0,FT.jsx)(e3r,{stories:t,cwd:r,node:n,onSelect:i}),(0,FT.jsx)(_t,{direction:"row",sx:igo,children:(0,FT.jsx)(Tt,{variant:"contained",size:"small",disabled:o,onClick:a,children:"Create Refresh docs"})})]})}var n3r=e=>({ml:.75,fontFamily:e.typography.fontFamilyMono,fontSize:12,lineHeight:"18px",minWidth:20,px:.75,borderRadius:999,textAlign:"center",bgcolor:Dr(e.palette.info.main,.1),color:"info.main"});var Pb=k(I(),1);function i3r({revision:e}){let t=Gi(),r=pr(),n=Z4r(t,r,e),[o,i]=(0,o3r.useState)(null),{creating:a,create:s}=Q4r(t,r,()=>i(null));if(!n)return null;if(n.openId!==void 0)return(0,Pb.jsx)(J4r,{id:n.openId,to:nf(n.openId,t,r)});let l=n.unswept.length;return(0,Pb.jsxs)(Pb.Fragment,{children:[(0,Pb.jsxs)(Tt,{variant:"outlined",size:"small",startIcon:(0,Pb.jsx)(WSe,{}),disabled:l===0,"aria-haspopup":"dialog","aria-expanded":!!o,onClick:u=>i(u.currentTarget),children:["Refresh docs",l>0&&(0,Pb.jsx)(V,{component:"span",sx:n3r,children:l})]}),(0,Pb.jsx)(r3r,{anchorEl:o,stories:n.unswept,cwd:t,node:r,creating:a,onClose:()=>i(null),onCreate:s})]})}var mU=k(I(),1);function a3r({value:e,onChange:t}){return(0,mU.jsxs)(hc,{value:e,exclusive:!0,size:"small","aria-label":"Type filter",onChange:(r,n)=>{n!==null&&t(n)},children:[(0,mU.jsx)(Qa,{value:"all",children:"All"}),(0,mU.jsx)(Qa,{value:"story",children:"Stories"}),(0,mU.jsx)(Qa,{value:"bug",children:"Bugs"})]})}var $T=k(I(),1),sgo={justifyContent:"space-between",alignItems:"center",mb:3},lgo={fontWeight:600},cgo={alignItems:"center"};function s3r({typeFilter:e,onTypeFilterChange:t,revision:r}){return(0,$T.jsxs)(_t,{direction:"row",sx:sgo,children:[(0,$T.jsx)(Ee,{variant:"h5",sx:lgo,children:"Backlog"}),(0,$T.jsxs)(_t,{direction:"row",spacing:2,sx:cgo,children:[(0,$T.jsx)(j4r,{}),(0,$T.jsx)(a3r,{value:e,onChange:t}),(0,$T.jsx)(Y4r,{}),(0,$T.jsx)(i3r,{revision:r})]})]})}var zT=k(I(),1);function c3r({items:e,loading:t,error:r,socket:n,onReload:o}){let i=Gi(),a=pr(),{query:s,setQuery:l,results:u,loading:f}=Y5r(),[d,p]=(0,l3r.useState)("all"),h=u??e,m=d==="all"?h:h.filter(g=>g.type===d);return(0,zT.jsxs)(zT.Fragment,{children:[(0,zT.jsx)(s3r,{typeFilter:d,onTypeFilterChange:p,revision:e}),(0,zT.jsx)(V4r,{value:s,onChange:l}),(0,zT.jsx)(G4r,{sessions:n.sessions}),(0,zT.jsx)(H4r,{loading:t||f,error:u?null:r,query:s,typeFilter:d,items:m,socket:n,itemPath:g=>nf(g.id,i,a),onReload:o})]})}var KSe=k(oe(),1);var dL=k(oe(),1);async function xee(e,t,r){let n=await Jt(Bl(`/api/items/${mn(e)}`,t.cwd,t.node),{signal:r});return n.ok?n.json():null}function u3r(e){let t=Gi(),r=pr(),[n,o]=(0,dL.useState)(null),[i,a]=(0,dL.useState)(!0),s=(0,dL.useCallback)(async()=>{o(await xee(e,{cwd:t,node:r}))},[e,t,r]);return(0,dL.useEffect)(()=>{let l=new AbortController,{signal:u}=l;return a(!0),(async()=>{try{let f=await xee(e,{cwd:t,node:r},u);if(u.aborted)return;o(f),a(!1)}catch(f){if(!u.aborted)throw f}})(),()=>l.abort()},[e,t,r]),{item:n,loading:i,reload:s}}function f3r(e,t){let r=new Set,n=new Set,o=[];for(let i of t){if(i.cwdMissing)continue;let a=D8(i),s=ol(i);!a||!s||r.has(a)||n.has(s)||(r.add(a),n.add(s),o.push(s))}return e&&!r.has(N8(e,t))&&!n.has(e)&&o.unshift(e),o}var Ad="";function ugo(e){let t=new Map([[Ad,[]]]);for(let r of e){let n=r.node??Ad;t.set(n,[...t.get(n)??[],r])}return t}function k5(e,t){var n;let r=new Map;for(let[o,i]of ugo(t)){let a=o===Ad?e:"";for(let s of f3r(a,i)){let l=N8(s,i),u=r.get(l)??{key:l,origin:l===s?void 0:l,clones:{}};(n=u.clones)[o]??(n[o]=s),r.set(l,u)}}return[...r.values()]}function d3r(e,t){return e.clones[t]??e.clones[Ad]??Object.values(e.clones)[0]}function See(e,t){return e.find(r=>Object.values(r.clones).includes(t))}function Dp(e,t){return!e||e===t?Ad:e}function p3r(e,t,r,n){if(!t)return e;let o=Dp(r,n);return{...e,selectedCwd:t,selectedNode:r,cloneOn:(i,a)=>{let s=e.cloneOn(i,a);return i!==t||s!==i||Dp(a,n)===o?s:void 0}}}var _5={description:"item-section-description",acceptanceCriteria:"item-section-acceptance-criteria",docsRefreshFor:"item-section-docs-refresh-for",plan:"item-section-plan",activity:"item-section-activity",comments:"item-section-comments"},Tee=140,QKe="--pinned-header-height",fgo=`var(${QKe}, ${Tee}px)`,h3r=`calc(${fgo} + 8px)`;function Gg(e){return{id:_5[e],sx:{mb:2,scrollMarginTop:h3r}}}function VSe(e){return{id:`item-phase-${e}`,sx:{scrollMarginTop:h3r}}}var Vg={color:"text.disabled",mb:1,display:"block",letterSpacing:"0.08em",fontSize:11,fontWeight:600,lineHeight:1.6};var E5=k(I(),1),dgo={maxWidth:"68ch",fontSize:14},pgo=e=>({mr:1,minWidth:14,color:"text.disabled",fontFamily:e.typography.fontFamilyMono,fontSize:12});function m3r({criteria:e}){return e.length===0?null:(0,E5.jsxs)(V,{...Gg("acceptanceCriteria"),children:[(0,E5.jsx)(Ee,{variant:"overline",sx:Vg,children:"Acceptance Criteria"}),(0,E5.jsx)(t1,{disablePadding:!0,sx:dgo,children:e.map((t,r)=>(0,E5.jsxs)($C,{disableGutters:!0,disablePadding:!0,sx:{py:.5,display:"flex",alignItems:"baseline"},children:[(0,E5.jsxs)(Ee,{component:"span",sx:pgo,children:[r+1,"."]}),(0,E5.jsx)(Tc,{component:"span",className:"markdown",html:iE(t)})]},t))})]})}var Cee=k(I(),1);function g3r({description:e}){return e?(0,Cee.jsxs)(V,{...Gg("description"),children:[(0,Cee.jsx)(Ee,{variant:"overline",sx:Vg,children:"Description"}),(0,Cee.jsx)(aE,{content:e,renderMermaid:!0})]}):null}var k3r=k(oe(),1);function y3r(e,t=10){let r=o=>e.filter(i=>i.kind===o).reverse(),n=r("commit");return{docsUnlocks:r("docs-unlock"),designs:r("design"),branches:r("branch"),commits:n.slice(0,t),overflowCommits:n.slice(t),prs:r("pr"),slacks:r("slack"),sessions:r("session")}}var b3r=k(I(),1),hgo={color:"text.secondary",alignSelf:"flex-start",textAlign:"left"};function v3r({hiddenCount:e,expanded:t,onToggle:r}){return e===0?null:(0,b3r.jsx)(Ur,{component:"button",type:"button",variant:"body2",underline:"hover",sx:hgo,onClick:n=>{n.stopPropagation(),r()},children:t?"Show fewer commits":`\u2026 and ${e} more commits`})}var pL=k(I(),1),mgo={display:"flex",alignItems:"center",gap:1},ggo={color:"text.secondary",fontFamily:"fontFamilyMono"},ygo={flex:1,overflowWrap:"anywhere"},vgo={color:"text.disabled","&:hover":{color:"text.primary"}};function x3r({conversation:e}){let{resumeSession:t}=_l(),r=n=>{n.stopPropagation(),t(e.sessionId,e.cwd??"",e.title,e.harness)};return(0,pL.jsxs)(V,{sx:mgo,children:[(0,pL.jsx)(Ee,{variant:"body2",component:"span",sx:ggo,children:"session"}),(0,pL.jsx)(Ee,{variant:"body2",component:"span",sx:ygo,children:e.title??e.sessionId}),(0,pL.jsx)(Vt,{size:"small",title:"Resume",sx:vgo,onClick:r,children:(0,pL.jsx)(S0,{sx:{fontSize:14}})})]})}var T3r=k(I(),1),bgo={color:"text.disabled",ml:1};function S3r({gitRef:e}){return e.kind!=="commit"&&e.kind!=="docs-unlock"||!e.createdAt?null:(0,T3r.jsx)(V,{component:"span",sx:bgo,children:xgo(e.createdAt)})}function xgo(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function C3r(e){if(e.kind==="commit"){let t=e.title?` ${e.title}`:"";return`${e.ref.slice(0,8)}${t}`}if(e.kind==="pr"){let t=e.title?` ${e.title}`:"",r=e.state?` (${e.state.toLowerCase()})`:"";return`#${e.ref}${t}${r}`}return e.kind==="slack"||e.kind==="session"||e.kind==="docs-unlock"||e.kind==="design"?e.title??e.ref:e.ref}var Lb=k(I(),1),Sgo={color:"text.secondary",mr:1,fontFamily:"fontFamilyMono"};function Tgo({gitRef:e}){let t=C3r(e);return!e.url||e.kind==="session"?(0,Lb.jsx)(Lb.Fragment,{children:t}):(0,Lb.jsx)(Ur,{href:e.url,target:"_blank",rel:"noopener",onClick:r=>r.stopPropagation(),children:t})}function w3r({gitRef:e}){return(0,Lb.jsxs)(Ee,{variant:"body2",children:[(0,Lb.jsx)(V,{component:"span",sx:Sgo,children:e.kind}),(0,Lb.jsx)(Tgo,{gitRef:e}),(0,Lb.jsx)(S3r,{gitRef:e})]})}var R5=k(I(),1);function _3r({gitRefs:e,conversations:t=[]}){let[r,n]=(0,k3r.useState)(!1),{docsUnlocks:o,designs:i,branches:a,commits:s,overflowCommits:l,prs:u,slacks:f}=y3r(e),d=[...o,...i,...a,...s,...r?l:[],...u,...f];return d.length===0&&t.length===0?null:(0,R5.jsxs)(V,{...Gg("activity"),children:[(0,R5.jsx)(Ee,{variant:"overline",sx:Vg,children:"Activity"}),(0,R5.jsxs)(_t,{spacing:1,children:[d.map(p=>(0,R5.jsx)(w3r,{gitRef:p},`${p.kind}:${p.ref}`)),t.map(p=>(0,R5.jsx)(x3r,{conversation:p},p.sessionId)),(0,R5.jsx)(v3r,{hiddenCount:l.length,expanded:r,onToggle:()=>n(p=>!p)})]})]})}var hL=k(I(),1),Cgo={alignItems:"center",fontSize:"0.75rem",color:"text.secondary",mb:.5},wgo={color:"text.disabled"},kgo={fontWeight:500},_go={summary:"Phase summary",comment:"Comment"};function E3r({comment:e}){return(0,hL.jsxs)(_t,{direction:"row",spacing:.5,sx:Cgo,children:[e.id!==void 0&&(0,hL.jsxs)(Ee,{variant:"caption",sx:wgo,children:["#",e.id]}),(0,hL.jsx)(Ee,{variant:"caption",sx:kgo,children:_go[e.type]}),e.phase!==void 0&&(0,hL.jsxs)(Ee,{variant:"caption",children:["\xB7 Phase ",e.phase]}),(0,hL.jsxs)(Ee,{variant:"caption",children:["\xB7 ",Ego(e.timestamp)]})]})}function Ego(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}var R3r=k(I(),1),A3r=nt((0,R3r.jsx)("path",{d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"}),"DeleteOutlined");var ZKe=k(oe(),1);async function P3r(e,t,r,n){let o=await fetch(Bl(`/api/items/${mn(e)}/comments/${t}`,r,n),{method:"DELETE"});if(!o.ok){let i=await o.json().catch(()=>{});throw new Error(i?.error??`Failed to delete comment (${o.status})`)}}var Ib=k(I(),1),Rgo={mt:-.5,mr:-.5,color:"text.secondary"};function L3r({itemId:e,commentId:t,onDeleted:r}){let n=Gi(),o=pr(),[i,a]=(0,ZKe.useState)(!1),[s,l]=(0,ZKe.useState)(),u=()=>l(void 0);return(0,Ib.jsxs)(Ib.Fragment,{children:[i&&(0,Ib.jsx)(Io,{message:"Are you sure you want to delete this comment?",onConfirm:async()=>{a(!1);try{await P3r(e,t,n,o),await r()}catch(f){l(f instanceof Error?f.message:"Failed to delete comment")}},onCancel:()=>a(!1)}),(0,Ib.jsx)(xx,{open:s!==void 0,autoHideDuration:6e3,onClose:u,children:(0,Ib.jsx)(jn,{severity:"error",variant:"filled",onClose:u,children:s})}),(0,Ib.jsx)(Vt,{"aria-label":"Delete comment",size:"small",sx:Rgo,onClick:()=>a(!0),children:(0,Ib.jsx)(A3r,{fontSize:"inherit"})})]})}var mL=k(I(),1),Ago={summary:{bgcolor:"warning.light",borderColor:"warning.dark"},comment:{bgcolor:"action.selected",borderColor:"divider"}},Pgo={justifyContent:"space-between",alignItems:"flex-start"},Lgo={color:"text.primary",whiteSpace:"pre-wrap"};function Igo(e){return{p:1.5,bgcolor:e.bgcolor,borderColor:e.borderColor}}function I3r({comment:e,itemId:t,onDeleted:r}){return(0,mL.jsxs)(rn,{variant:"outlined",sx:Igo(Ago[e.type]),children:[(0,mL.jsxs)(_t,{direction:"row",sx:Pgo,children:[(0,mL.jsx)(E3r,{comment:e}),e.id!==void 0&&t!==void 0&&r&&(0,mL.jsx)(L3r,{itemId:t,commentId:e.id,onDeleted:r})]}),(0,mL.jsx)(Ee,{variant:"body2",sx:Lgo,children:e.text})]})}var gU=k(I(),1);function M3r({comments:e,itemId:t,onCommentDeleted:r}){return e.length===0?null:(0,gU.jsxs)(V,{...Gg("comments"),children:[(0,gU.jsx)(Ee,{variant:"overline",sx:Vg,children:"Comments"}),(0,gU.jsx)(_t,{spacing:1,children:e.map((n,o)=>(0,gU.jsx)(I3r,{comment:n,itemId:t,onDeleted:r},`${n.timestamp}-${o}`))})]})}var Mb=k(I(),1),Mgo={color:"text.secondary",mr:1,fontFamily:"fontFamilyMono"};function D3r({stories:e}){let t=Gi(),r=pr();if(e.length===0)return null;let n=e.slice().sort((o,i)=>o.id-i.id);return(0,Mb.jsxs)(V,{...Gg("docsRefreshFor"),children:[(0,Mb.jsx)(Ee,{variant:"overline",sx:Vg,children:"Refreshes docs for"}),(0,Mb.jsx)(_t,{spacing:.5,children:n.map(o=>(0,Mb.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,Mb.jsx)(ySe,{status:o.status}),(0,Mb.jsxs)(Ee,{variant:"body2",children:[(0,Mb.jsx)(V,{component:"span",sx:Mgo,children:mn(o.id)}),(0,Mb.jsx)(Ur,{component:Ki,to:nf(o.id,t,r),children:o.name})]})]},o.id))})]})}var N3r=k(I(),1);function yU({total:e,sx:t}){return(0,N3r.jsx)(Ee,{sx:t,children:gSe(e)})}var B3r=k(I(),1),Dgo={color:"text.secondary",fontSize:"0.75rem"};function O3r({usage:e}){let t={tokensUp:e.reduce((r,n)=>r+n.tokensUp,0),tokensDown:e.reduce((r,n)=>r+n.tokensDown,0),activeMs:e.reduce((r,n)=>r+n.activeMs,0),peakContextPct:e.reduce((r,n)=>Math.max(r,n.peakContextPct),0)};return(0,B3r.jsx)(yU,{total:t,sx:Dgo})}var HT=k(I(),1);function F3r({checks:e}){return(0,HT.jsxs)(V,{sx:{mt:1,pt:1},children:[(0,HT.jsx)(lo,{sx:{mb:1}}),(0,HT.jsx)(Ee,{variant:"overline",sx:{color:"text.disabled",letterSpacing:"0.08em"},children:"Manual Checks"}),(0,HT.jsx)(t1,{disablePadding:!0,sx:{ml:.5,mt:.5},children:e.map(t=>(0,HT.jsxs)($C,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,HT.jsx)(Ee,{component:"span",sx:{mr:1,fontSize:"0.875rem",color:"text.secondary"},children:"\u2610"}),(0,HT.jsx)(Tc,{component:"span",className:"markdown",sx:{fontSize:"0.875rem",color:"text.secondary"},html:iE(t)})]},t))})]})}var qSe="task-marker";function Ngo(e,t){let{primary:r,success:n,divider:o}=e.palette;return t==="done"?Dr(n.main,.3):t==="current"?Dr(r.main,.6):o}function Ogo(e,t){let r=t==="done";return{display:"grid",gap:1,px:2,py:"14px","& .MuiList-root":{ml:0},"& .MuiListItem-root":{py:"2px",fontSize:13.5,color:r?"text.primary":"text.secondary"},[`& .${qSe}`]:{width:16,flexShrink:0,mr:"6px",fontSize:"inherit",textAlign:"center",color:r?"success.main":"text.disabled"},bgcolor:"background.paper",borderRadius:`${e.tokens.radius.md}px`,borderColor:Ngo(e,t),...t==="current"&&{boxShadow:`0 0 0 3px ${e.palette.action.selected}`}}}function $3r(e){return t=>Ogo(t,e)}var z3r={done:"\u2713",current:"\xB7",upcoming:"\xB7"};var wee=k(I(),1),Bgo={color:"text.secondary",fontSize:"0.75rem",letterSpacing:"0.08em",display:"block"},Fgo={color:"text.secondary",fontSize:"0.75rem",fontFamily:"fontFamilyMono",display:"block"};function H3r({sessions:e}){return(0,wee.jsxs)(V,{sx:{mb:1},children:[(0,wee.jsx)(Ee,{variant:"overline",sx:Bgo,children:"Sessions"}),e.map(t=>(0,wee.jsx)(Ee,{sx:Fgo,children:`${t.hostname} / ${t.osUser} / ${t.claudeSessionId}`},t.claudeSessionId))]})}var W3r=k(I(),1),$go={color:"text.secondary",fontSize:"0.75rem",mb:1,display:"block"};function U3r({usage:e}){return(0,W3r.jsx)(yU,{total:e,sx:$go})}var q3r=k(oe(),1);var G3r=k(oe(),1),Db=k(I(),1);function V3r({phaseName:e,onConfirm:t,onCancel:r}){let[n,o]=(0,G3r.useState)("");return(0,Db.jsxs)(pc,{open:!0,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,Db.jsxs)(Xu,{children:["Rewind to ",e,"?"]}),(0,Db.jsxs)(Ku,{children:[(0,Db.jsx)(Ee,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will mark all later phases as incomplete."}),(0,Db.jsx)(Un,{fullWidth:!0,multiline:!0,rows:3,size:"small",placeholder:"Reason for rewinding...",value:n,onChange:i=>o(i.target.value)})]}),(0,Db.jsxs)(Dd,{children:[(0,Db.jsx)(Tt,{onClick:r,children:"Cancel"}),(0,Db.jsx)(Tt,{variant:"contained",color:"warning",disabled:n.trim().length===0,onClick:()=>t(n.trim()),children:"Rewind"})]})]})}var gL=k(I(),1),zgo={ml:"auto",minHeight:0,px:"6px",py:"2px",fontSize:12,fontWeight:500,borderRadius:"4px"};function j3r({itemId:e,phaseNumber:t,phaseName:r,onRewound:n}){let o=Gi(),i=pr(),[a,s]=(0,q3r.useState)(!1);return(0,gL.jsxs)(gL.Fragment,{children:[(0,gL.jsx)(Tt,{size:"small",color:"primary",variant:"text",onClick:()=>s(!0),sx:zgo,children:"Rewind"}),a&&(0,gL.jsx)(V3r,{phaseName:r,onConfirm:async l=>{await hdt(e,t,l,o,i),await n()},onCancel:()=>s(!1)})]})}var K3r=k(I(),1);function Y3r({phase:e,index:t,status:r,itemId:n,onRewind:o}){return r!=="done"||n===void 0||!o?null:(0,K3r.jsx)(j3r,{itemId:n,phaseNumber:t+1,phaseName:e.name,onRewound:o})}var yL=k(I(),1),Hgo={done:{label:"Done",color:"success"},current:{label:"In progress",color:"primary"},upcoming:{label:"To do",color:"default"}},Ugo={alignItems:"center",flexWrap:"wrap",gap:1,fontSize:14,fontWeight:600},Wgo=e=>({fontFamily:e.typography.fontFamilyMono,fontSize:12,fontWeight:500,color:"text.disabled"});function X3r(e){let t=Hgo[e.status];return(0,yL.jsxs)(_t,{direction:"row",sx:Ugo,children:[(0,yL.jsx)(V,{component:"span",sx:Wgo,children:e.index+1}),(0,yL.jsx)("span",{children:e.phase.name}),(0,yL.jsx)(Yn,{label:t.label,size:"small",color:t.color}),(0,yL.jsx)(Y3r,{...e})]})}var vU=k(I(),1);function Q3r({tasks:e,marker:t}){return(0,vU.jsx)(t1,{disablePadding:!0,sx:{ml:.5},children:e.map(r=>(0,vU.jsxs)($C,{disableGutters:!0,disablePadding:!0,sx:{py:.25,display:"flex",alignItems:"baseline"},children:[(0,vU.jsx)(Ee,{component:"span",className:qSe,sx:{color:"text.secondary",mr:1},children:t}),(0,vU.jsx)(Tc,{component:"span",className:"markdown",html:iE(r.task)})]},r.task))})}var A5=k(I(),1);function Z3r({phase:e,index:t,status:r,itemId:n,usage:o,sessions:i,onRewind:a}){let s=e.manualChecks??[],l=VSe(t),u=z3r[r];return(0,A5.jsxs)(rn,{variant:"outlined",id:l.id,sx:[$3r(r),l.sx],children:[(0,A5.jsx)(X3r,{phase:e,index:t,status:r,itemId:n,onRewind:a}),o&&(0,A5.jsx)(U3r,{usage:o}),(0,A5.jsx)(Q3r,{tasks:e.tasks,marker:u}),s.length>0&&(0,A5.jsx)(F3r,{checks:s}),i&&i.length>0&&(0,A5.jsx)(H3r,{sessions:i})]})}var kee={name:"Review",tasks:[]};function jSe(e){return e.at(-1)?.name===kee.name?e.length-1:e.length}function bU(e,t){if(t===void 0)return"upcoming";let r=e+1;return r<t?"done":r===t?"current":"upcoming"}function J3r(e=[]){return new Map(e.map(t=>[t.phaseIdx,t]))}function eRr(e=[]){let t=new Map;for(let r of e){let n=t.get(r.phaseIdx);n?n.push(r):t.set(r.phaseIdx,[r])}return t}var JKe=k(I(),1);function tRr({phases:e,currentPhase:t,itemId:r,usage:n,sessions:o,onRewind:i}){let a=J3r(n),s=eRr(o),l=jSe(e),u=(o??[]).filter(d=>d.phaseIdx>=l),f=l===e.length&&u.length>0?[...e,kee]:e;return(0,JKe.jsx)(_t,{spacing:1.5,children:f.map((d,p)=>(0,JKe.jsx)(Z3r,{phase:d,index:p,status:bU(p,t),itemId:r,usage:a.get(p),sessions:p===l?u:s.get(p),onRewind:p<e.length?i:void 0},d.name))})}var vL=k(I(),1),Ggo={alignItems:"baseline",justifyContent:"space-between",mb:1},Vgo=[Vg,{mb:0}];function rRr({phases:e,currentPhase:t,itemId:r,usage:n,sessions:o,onRewind:i}){return e.length===0?null:(0,vL.jsxs)(V,{...Gg("plan"),children:[(0,vL.jsxs)(_t,{direction:"row",sx:Ggo,children:[(0,vL.jsx)(Ee,{variant:"overline",sx:Vgo,children:"Plan"}),n&&n.length>0&&(0,vL.jsx)(O3r,{usage:n})]}),(0,vL.jsx)(tRr,{phases:e,currentPhase:t,itemId:r,usage:n,sessions:o,onRewind:i})]})}var UT=k(I(),1);function nRr({item:e,onRewind:t,onCommentDeleted:r}){return(0,UT.jsxs)(UT.Fragment,{children:[e.docsRefreshFor&&(0,UT.jsx)(D3r,{stories:e.docsRefreshFor}),e.plan&&(0,UT.jsx)(rRr,{phases:e.plan,currentPhase:e.currentPhase,itemId:e.id,usage:e.phaseUsage,sessions:e.phaseSessions,onRewind:t}),(0,UT.jsx)(_3r,{gitRefs:e.gitRefs??[],conversations:e.conversations}),e.comments&&(0,UT.jsx)(M3r,{comments:e.comments,itemId:e.id,onCommentDeleted:r})]})}var xU=k(I(),1);function oRr({item:e,onRewind:t,onCommentDeleted:r}){return(0,xU.jsxs)(V,{sx:{pt:2,flex:1,minWidth:0},children:[(0,xU.jsx)(g3r,{description:e.description}),(0,xU.jsx)(m3r,{criteria:e.acceptanceCriteria}),(0,xU.jsx)(nRr,{item:e,onRewind:t,onCommentDeleted:r})]})}var iRr="item-detail";var SU={wideQuery:`@container ${iRr} (min-width: 760px)`,containerSx:{containerType:"inline-size",containerName:iRr},columnsSx:{display:"flex",alignItems:"flex-start",columnGap:4},mainColumnSx:{flex:1,minWidth:0}};var _ee=k(I(),1);function aRr({style:e,header:t,body:r,navigator:n}){return(0,_ee.jsx)(V,{style:e,sx:SU.containerSx,children:(0,_ee.jsxs)(V,{sx:SU.columnsSx,children:[(0,_ee.jsxs)(V,{sx:SU.mainColumnSx,children:[t,r]}),n]})})}function qgo(e){let t=e.plan??[];if(t.length===0)return[];let r=jSe(t),o=r===t.length&&(e.phaseSessions??[]).some(i=>i.phaseIdx>=r)?[...t,kee]:t;return[{id:_5.plan,label:"Phases"},...o.map((i,a)=>({id:VSe(a).id,label:`${a+1}`,title:i.name,status:bU(a,e.currentPhase),nested:!0}))]}function sRr(e){let t=[];return e.description&&t.push({id:_5.description,label:"Description"}),e.acceptanceCriteria.length>0&&t.push({id:_5.acceptanceCriteria,label:"Acceptance Criteria"}),(e.docsRefreshFor?.length??0)>0&&t.push({id:_5.docsRefreshFor,label:"Refreshes docs for"}),t.push(...qgo(e)),(e.gitRefs?.length??0)+(e.conversations?.length??0)>0&&t.push({id:_5.activity,label:"Activity"}),(e.comments?.length??0)>0&&t.push({id:_5.comments,label:"Comments"}),t}var jgo=48,lRr={display:"none",[SU.wideQuery]:{display:"grid"},alignContent:"start",gap:"2px",position:"sticky",top:0,alignSelf:"flex-start",width:200,flexShrink:0,maxHeight:`calc(100vh - ${jgo}px - ${x1})`,overflowY:"auto",overflowX:"hidden",pt:"44px",pb:2};function cRr(e){return{justifyContent:"flex-start",px:"10px",py:.5,borderLeft:2,borderColor:e?"primary.main":"divider",fontSize:13,textAlign:"left",color:e?"text.primary":"text.secondary",transition:"color .2s ease","&:hover":{color:"text.primary"}}}var uRr={display:"grid",gap:"2px",pl:"10px",borderLeft:2,borderColor:"divider"};function fRr(e){return t=>({display:"inline-grid",placeItems:"center",flexShrink:0,width:18,height:18,border:1,borderRadius:"50%",fontStyle:"normal",fontFamily:t.typography.fontFamilyMono,fontSize:10,...Ygo(t,e)})}function Ygo(e,t){return t==="done"?{bgcolor:Dr(e.palette.success.main,.18),borderColor:"transparent",color:"success.main"}:t==="current"?{bgcolor:"primary.main",borderColor:"transparent",color:"primary.contrastText"}:{borderColor:"divider",color:"text.disabled"}}function dRr(e){return{justifyContent:"flex-start",alignItems:"flex-start",gap:1,minWidth:0,py:"3px",pl:.5,fontSize:12,textAlign:"left",color:e?"text.primary":"text.secondary",transition:"color .2s ease","&:hover":{color:"text.primary"},"& .phase-label":{minWidth:0,lineHeight:"18px",overflowWrap:"anywhere"}}}var Eee=k(I(),1);function pRr({section:e,active:t,onSelect:r}){return(0,Eee.jsxs)(ir,{sx:dRr(t),onClick:()=>r(e.id),title:e.title,"aria-current":t?"true":void 0,children:[(0,Eee.jsx)(V,{component:"i",sx:fRr(e.status),children:e.label}),(0,Eee.jsx)(V,{component:"span",className:"phase-label",children:e.title})]})}var bL=k(I(),1);function Kgo(e){let t=[];for(let r of e){let n=t.at(-1);r.nested&&n?n.phases.push(r):t.push({link:r,phases:[]})}return t}function Xgo(e){return e.charAt(0)+e.slice(1).toLowerCase()}function hRr({sections:e,activeId:t,onSelect:r}){return(0,bL.jsx)(V,{component:"nav",sx:lRr,children:Kgo(e).map(({link:n,phases:o})=>(0,bL.jsxs)(V,{sx:{display:"contents"},children:[(0,bL.jsx)(ir,{sx:cRr(n.id===t),onClick:()=>r(n.id),"aria-current":n.id===t?"true":void 0,children:Xgo(n.label)}),o.length>0&&(0,bL.jsx)(V,{sx:uRr,children:o.map(i=>(0,bL.jsx)(pRr,{section:i,active:i.id===t,onSelect:r},i.id))})]},n.id))})}function mRr(e,t=Tee){return lve(e,t)}var yRr=k(I(),1);function Qgo(e){document.getElementById(e)?.scrollIntoView({behavior:"smooth",block:"start"})}function gRr({item:e,headerHeight:t}){let r=sRr(e),n=mRr(r.map(o=>o.id),t);return r.length===0?null:(0,yRr.jsx)(hRr,{sections:r,activeId:n,onSelect:Qgo})}var bRr=k(I(),1),Zgo={justifySelf:"start",minHeight:0,minWidth:0,p:0,fontSize:12,fontWeight:400,lineHeight:1.5,"&:hover":{bgcolor:"transparent"}};function vRr({to:e}){let t=Kr();return(0,bRr.jsx)(Tt,{"data-backlog-focus":"back",variant:"text",size:"small",onClick:()=>t(e),sx:Zgo,children:"\u2190 Backlog"})}var xRr=k(oe(),1);var xL=k(I(),1);function SRr({itemId:e,onDeleted:t}){let r=Gi(),n=pr(),[o,i]=(0,xRr.useState)(!1);return(0,xL.jsxs)(xL.Fragment,{children:[o&&(0,xL.jsx)(Io,{onConfirm:async()=>{await pdt(e,r,n),await t()},onCancel:()=>i(!1)}),(0,xL.jsx)(Tt,{variant:"outlined",color:"error",size:"small",onClick:()=>i(!0),children:"Delete"})]})}var YSe=k(oe(),1);var Nb=k(I(),1);function TRr({itemId:e}){let{launched:t,launch:r}=kSe(e),n=Wg(),o=(0,YSe.useRef)(null),[i,a]=(0,YSe.useState)(!1),s=u=>u.stopPropagation(),l=bSe(n);return(0,Nb.jsxs)(Nb.Fragment,{children:[(0,Nb.jsxs)(OC,{ref:o,variant:"tonal",size:"small",disabled:t,children:[(0,Nb.jsx)(Tt,{onClick:u=>{s(u),r([])},children:"Refine"}),l.length>0&&(0,Nb.jsx)(Tt,{size:"small","aria-label":"Refine with a different harness",onClick:u=>{s(u),a(!0)},children:(0,Nb.jsx)(jd,{})})]}),(0,Nb.jsx)(xSe,{anchorEl:o.current,open:i,onClose:()=>a(!1),options:l,onSelect:u=>{a(!1),r(["--harness",u])},stop:s})]})}var TU=k(I(),1);function CRr({item:e,onDeleted:t}){return(0,TU.jsxs)(_t,{direction:"row",spacing:1,children:[iU(e)&&(0,TU.jsx)(BSe,{itemId:e.id}),(0,TU.jsx)(TRr,{itemId:e.id}),(0,TU.jsx)(SRr,{itemId:e.id,onDeleted:t})]})}var Jgo={todo:"text.secondary","in-progress":"warning.main",done:"success.main",wontdo:"error.main"},e0o={todo:"to do","in-progress":"in progress",done:"done",wontdo:"won't do"};function eXe(e){return e0o[e]}function wRr(e){return t=>{let r=Ove(t,Jgo[e]);return{height:20,minHeight:0,borderRadius:999,fontSize:11,fontWeight:600,color:r,bgcolor:Dr(r,.15),"&:hover":{bgcolor:Dr(r,.22)},"& .MuiOutlinedInput-notchedOutline, &:hover .MuiOutlinedInput-notchedOutline, &.Mui-focused .MuiOutlinedInput-notchedOutline":{border:0},"& .MuiSelect-select.MuiSelect-select":{py:0,pl:1,pr:"22px",minHeight:0,lineHeight:"20px"},"& .MuiSelect-icon":{color:"inherit",fontSize:16,right:4}}}}var tXe=k(I(),1),kRr=e=>{let{value:t,options:r,onChange:n,label:o,sx:i}=e;return(0,tXe.jsx)(HC,{value:t,onChange:a=>n(a.target.value),size:"small",renderValue:o,sx:i,children:r.map(a=>(0,tXe.jsx)(un,{value:a,children:o(a)},a))})};var rXe=k(I(),1),t0o=["todo","in-progress","done","wontdo"];function _Rr({current:e,onStatusChange:t}){return t?(0,rXe.jsx)(kRr,{value:e,options:t0o,onChange:t,label:eXe,sx:wRr(e)}):(0,rXe.jsx)(Yn,{label:eXe(e),size:"small",color:lSe[e]})}var WT=k(I(),1),r0o={alignItems:"center",color:"text.disabled",fontSize:"0.875rem"},n0o={fontFamily:"fontFamilyMono",fontSize:12},o0o={color:"text.secondary",fontSize:"0.75rem"};function ERr({item:e,onStatusChange:t}){let r=sSe[e.type];return(0,WT.jsxs)(_t,{direction:"row",spacing:.75,sx:r0o,children:[(0,WT.jsx)(Ee,{variant:"body2",color:"text.disabled",sx:n0o,children:mn(e.id)}),r&&(0,WT.jsx)(Yn,{label:e.type,size:"small",color:r}),(0,WT.jsx)(_Rr,{current:e.status,onStatusChange:t}),(0,WT.jsx)(L8,{jiraKey:e.jiraKey}),(0,WT.jsx)(Tw,{githubIssue:e.githubIssue,origin:e.origin}),e.usageTotal&&(0,WT.jsx)(yU,{total:e.usageTotal,sx:o0o})]})}var P5=k(I(),1),i0o={justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:1.5},a0o={display:"grid",gap:"6px",minWidth:0},s0o={m:0,fontSize:24,fontWeight:600,lineHeight:1.25,letterSpacing:"-0.015em"};function RRr({item:e,onDeleted:t,onStatusChange:r}){return(0,P5.jsxs)(_t,{direction:"row",sx:i0o,children:[(0,P5.jsxs)(V,{sx:a0o,children:[(0,P5.jsx)(vRr,{to:"/backlog"}),(0,P5.jsx)(Ee,{component:"h2",sx:s0o,children:e.name}),(0,P5.jsx)(ERr,{item:e,onStatusChange:r})]}),(0,P5.jsx)(CRr,{item:e,onDeleted:t})]})}var CU=k(oe(),1);function ARr(){let e=(0,CU.useRef)(null),[t,r]=(0,CU.useState)(!1);return(0,CU.useEffect)(()=>{let n=e.current;if(!n)return;let o=new IntersectionObserver(([i])=>r(!i.isIntersecting),{threshold:0});return o.observe(n),()=>o.disconnect()},[]),{sentinelRef:e,stuck:t}}var L5=k(I(),1);function l0o(e){return t=>({position:"sticky",top:0,zIndex:1,bgcolor:"background.default",mx:-2,px:2,pb:2,boxShadow:e?t.tokens.elevation.stuckHeader:"none",transition:t.transitions.create("box-shadow")})}function PRr({ref:e,...t}){let{sentinelRef:r,stuck:n}=ARr();return(0,L5.jsxs)(L5.Fragment,{children:[(0,L5.jsx)(V,{ref:r,sx:{height:0}}),(0,L5.jsx)(V,{ref:e,sx:l0o(n),children:(0,L5.jsx)(RRr,{...t})})]})}var LRr=k(oe(),1);function IRr(){let e=(0,LRr.useRef)(null),t=cxe(e,Tee),r={[QKe]:`${t}px`};return{headerRef:e,headerHeight:t,style:r}}var Ree=k(I(),1);function MRr({item:e,onReload:t}){let r=Kr(),n=Gi(),o=pr(),{headerRef:i,headerHeight:a,style:s}=IRr();return E1("ItemDetail"),(0,Ree.jsx)(aRr,{style:s,header:(0,Ree.jsx)(PRr,{ref:i,item:e,onDeleted:async()=>{await t(),r("/backlog")},onStatusChange:async f=>{await W8(e.id,f,n,o),await t()}}),body:(0,Ree.jsx)(oRr,{item:e,onRewind:t,onCommentDeleted:t}),navigator:(0,Ree.jsx)(gRr,{item:e,headerHeight:a})})}var SL=k(I(),1),c0o={display:"flex",justifyContent:"center",py:6};function DRr({onReload:e}){let[t]=$s(),r=t.get("cwd")||void 0,n=t.get("node")||void 0,o=Vn(),i=il().nodes?.local,a=(0,KSe.useMemo)(()=>p3r(o,r,n,i),[o,r,n,i]);return E1("ItemRoute"),(0,SL.jsx)(aq.Provider,{value:a,children:(0,SL.jsx)(Fl.Provider,{value:a.selectedNode,children:(0,SL.jsx)(u0o,{onReload:e})})})}function u0o({onReload:e}){let{id:t}=Yx(),r=Number.NaN;try{r=I8(t??"")}catch{r=Number.NaN}let{item:n,loading:o,reload:i}=u3r(r),a=(0,KSe.useCallback)(async()=>{await Promise.all([i(),e()])},[i,e]);return o?(0,SL.jsx)(V,{sx:c0o,children:(0,SL.jsx)(bo,{})}):n?(0,SL.jsx)(MRr,{item:n,onReload:a}):null}var TL=k(I(),1);function NRr({items:e,loading:t,error:r,socket:n,onReload:o}){return(0,TL.jsxs)(Kx,{children:[(0,TL.jsx)(Ao,{index:!0,element:(0,TL.jsx)(c3r,{items:e,loading:t,error:r,socket:n,onReload:o})}),(0,TL.jsx)(Ao,{path:"items/:id",element:(0,TL.jsx)(DRr,{onReload:o})})]})}var ky=k(oe(),1);var ORr=new Map;function BRr(e,t,r){return JSON.stringify([e??null,t,r??null])}var Aee={get(e,t,r){return ORr.get(BRr(e,t,r))},set(e,t,r,n){ORr.set(BRr(e,t,n),r)}};function f0o(e,t){return e===t?!0:!e||!t?!1:e.tokensUp===t.tokensUp&&e.tokensDown===t.tokensDown&&e.activeMs===t.activeMs&&e.peakContextPct===t.peakContextPct}function FRr(e,t){return e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{let o=t[n];return r.id===o.id&&r.type===o.type&&r.name===o.name&&r.status===o.status&&r.starred===o.starred&&f0o(r.usageTotal,o.usageTotal)})}function XSe({setItems:e,setLoading:t,setError:r}){return{onLoaded:n=>{e(o=>FRr(o,n)?o:n),t(!1),r(null)},onError:n=>{t(!1),r(n)}}}async function $Rr(e,t,r,n){let o=await Cw({cwd:e,node:n,signal:r,filter:t});return r.aborted||Aee.set(e,t,o,n),o}function zRr(e,t,r,{onLoaded:n,onError:o},i){return(async()=>{try{let a=await $Rr(e,t,r,i);r.aborted||n(a)}catch(a){r.aborted||o(a instanceof Error?a.message:"Failed to load.")}})()}var d0o=5e3;function QSe(e,t,r,n){let o=new AbortController,i=!1,a=()=>{i||(i=!0,zRr(e,t,o.signal,r,n).finally(()=>{i=!1}))};a();let s=setInterval(a,d0o);return()=>{o.abort(),clearInterval(s)}}function HRr(){let e=Gi(),t=pr(),[r]=oU(),n=Aee.get(e,r,t),o=n??[],i=n===void 0,[a,s]=(0,ky.useState)(o),[l,u]=(0,ky.useState)(i),[f,d]=(0,ky.useState)(null),[p,h]=(0,ky.useState)(e),[m,g]=(0,ky.useState)(t),[y,v]=(0,ky.useState)(r);(e!==p||t!==m||r!==y)&&(h(e),g(t),v(r),s(o),u(i),d(null));let b=(0,ky.useCallback)(async()=>{let x=await Cw({cwd:e,node:t,filter:r});s(x),Aee.set(e,r,x,t),u(!1)},[e,t,r]);return(0,ky.useEffect)(()=>QSe(e,r,XSe({setItems:s,setLoading:u,setError:d}),t),[e,t,r]),{items:a,loading:l,error:f,reload:b}}var wU=k(I(),1);function URr({socket:e}){let{items:t,loading:r,error:n,reload:o}=HRr();return yse(!r),(0,wU.jsx)(zKe.Provider,{value:e.sessions,children:(0,wU.jsx)(qKe.Provider,{value:e.selectSession,children:(0,wU.jsx)(Kx,{children:(0,wU.jsx)(Ao,{path:"/*",element:(0,wU.jsx)(NRr,{items:t,loading:r,error:n,socket:e,onReload:o})})})})})}var nXe=k(I(),1);function WRr({socket:e}){return(0,nXe.jsx)(gG,{maxWidth:"lg",sx:{py:3,px:2},children:(0,nXe.jsx)(URr,{socket:e})})}var vo=k(I(),1);function GRr({socket:e}){return E1("AppRoutes"),(0,vo.jsxs)(vo.Fragment,{children:[(0,vo.jsx)(yyr,{}),(0,vo.jsx)(Kx,{children:(0,vo.jsxs)(Ao,{element:(0,vo.jsx)(gmt,{socket:e}),children:[(0,vo.jsx)(Ao,{path:"sessions",element:(0,vo.jsx)(uEr,{socket:e})}),(0,vo.jsx)(Ao,{path:"backlog/*",element:(0,vo.jsx)(WRr,{socket:e})}),(0,vo.jsx)(Ao,{path:"next",element:(0,vo.jsx)(g0r,{sessions:e.sessions,selectSession:e.selectSession})}),(0,vo.jsx)(Ao,{path:"news",element:(0,vo.jsx)(ygr,{})}),(0,vo.jsx)(Ao,{path:"inbox",element:(0,vo.jsx)(dgr,{})}),(0,vo.jsx)(Ao,{path:"releases",element:(0,vo.jsx)(dyr,{})}),(0,vo.jsx)(Ao,{path:"usage",element:(0,vo.jsx)(W5r,{})}),(0,vo.jsx)(Ao,{path:"backups",element:(0,vo.jsx)(wmt,{})}),(0,vo.jsx)(Ao,{path:"config",element:(0,vo.jsx)(E0t,{})}),(0,vo.jsx)(Ao,{path:"connect-mobile",element:(0,vo.jsx)(W0t,{})}),(0,vo.jsx)(Ao,{path:"updates",element:(0,vo.jsx)(e5r,{reconnecting:e.reconnecting,selectSession:e.selectSession})}),(0,vo.jsx)(Ao,{path:"diff",element:(0,vo.jsx)(kpr,{socket:e})}),(0,vo.jsx)(Ao,{path:"file",element:(0,vo.jsx)(Gmr,{socket:e})}),(0,vo.jsx)(Ao,{path:"*",element:(0,vo.jsx)(JV,{to:"/sessions",replace:!0})})]})})]})}var Ob=k(I(),1),qRr=28,p0o={":root":{[_3e]:`${qRr}px`}},h0o={position:"fixed",left:0,right:0,bottom:0,height:qRr,zIndex:e=>e.zIndex.appBar,display:"flex",alignItems:"center",gap:.5,px:.75,borderTop:1,borderColor:"divider",bgcolor:e=>e.tokens.color.statusBar?.background,color:e=>e.tokens.color.statusBar?.text,fontFamily:"fontFamilyMono",fontSize:"11.5px",whiteSpace:"nowrap",minWidth:0},VRr={display:"flex",alignItems:"center",gap:.5,minWidth:0};function jRr({start:e,end:t}){return(0,Ob.jsxs)(Ob.Fragment,{children:[(0,Ob.jsx)(R4,{styles:p0o}),(0,Ob.jsxs)(V,{component:"footer","data-testid":"status-bar",sx:h0o,children:[(0,Ob.jsx)(V,{sx:VRr,children:e}),(0,Ob.jsx)(V,{sx:{flex:1}}),(0,Ob.jsx)(V,{sx:VRr,children:t})]})]})}var nAr=k(oe(),1);var YRr=k(oe(),1);function KRr(){return(0,YRr.useSyncExternalStore)(Hft,V4e,V4e)}var tAr=k(oe(),1);var XRr={display:"inline-flex",alignItems:"center",gap:.5,px:1,height:22,borderRadius:1,fontSize:"inherit",color:"error.main","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar.hover}},QRr={width:"min(720px, calc(100vw - 32px))",maxHeight:"min(420px, 70vh)",display:"flex",flexDirection:"column",fontFamily:"fontFamilyMono",fontSize:12},ZRr={display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:.75,borderBottom:1,borderColor:"divider"},JRr={overflow:"auto",display:"grid",gridTemplateColumns:"auto auto minmax(0, 2fr) auto minmax(0, 1.5fr) auto",columnGap:1.5,rowGap:.5,px:1.5,py:1,alignItems:"baseline","& > span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& > .muted":{color:"text.secondary"},"& > .outcome":{color:"error.main"},"& > .duration":{textAlign:"right",color:"text.secondary"}};function m0o(e){try{return new URL(e).host}catch{return e}}function eAr(e){return{time:new Date(e.at).toLocaleTimeString(),method:e.method,path:e.path,node:e.node??m0o(e.base),outcome:[e.status===void 0?void 0:String(e.status),e.error].filter(Boolean).join(" ")||"unknown error",duration:e.kind?"":`${e.durationMs}ms`}}var Np=k(I(),1);function rAr({failures:e,onClear:t}){return(0,Np.jsxs)(V,{sx:QRr,role:"region","aria-label":"Recent failures",children:[(0,Np.jsxs)(V,{sx:ZRr,children:[(0,Np.jsxs)("span",{children:["Recent failures (",e.length,")"]}),(0,Np.jsx)(Tt,{size:"small",onClick:t,children:"Clear"})]}),(0,Np.jsx)(V,{sx:JRr,children:e.map((r,n)=>{let o=eAr(r);return(0,Np.jsxs)(tAr.Fragment,{children:[(0,Np.jsx)("span",{className:"muted",children:o.time}),(0,Np.jsx)("span",{children:o.method}),(0,Np.jsx)("span",{title:o.path,children:o.path}),(0,Np.jsx)("span",{className:"muted",children:o.node}),(0,Np.jsx)("span",{className:"outcome",title:o.outcome,children:o.outcome}),(0,Np.jsx)("span",{className:"duration",children:o.duration})]},`${r.at}-${n}`)})})]})}var _y=k(I(),1);function oAr(){let e=KRr(),[t,r]=(0,nAr.useState)(null);if(e.length===0)return null;let n=`${e.length} failed request${e.length>1?"s":""}`;return(0,_y.jsxs)(_y.Fragment,{children:[(0,_y.jsx)(rr,{title:n,placement:"top-end",children:(0,_y.jsxs)(ir,{"aria-label":n,sx:XRr,onClick:o=>r(o.currentTarget),children:[(0,_y.jsx)(Eae,{sx:{fontSize:14}}),(0,_y.jsx)("span",{children:e.length})]})}),(0,_y.jsx)(Zu,{anchorEl:t,open:!!t,onClose:()=>r(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,_y.jsx)(rAr,{failures:e,onClear:()=>{zft(),r(null)}})})]})}function iAr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function ZSe(e,t){let r=[];iAr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,o]of Object.entries(t))iAr(o)&&r.push({harness:n,rateLimits:o});return r}var hAr=k(oe(),1);var Bb=e=>e.tokens.color.statusBar;var kU=e=>Bb(e).secondary;function aAr(e){return t=>Bb(t).level[e]}var dAr=k(oe(),1);function JSe(e,t,r){return e!=null?tU(e,r):t}var eTe=k(I(),1);function sAr({window:e,windowSeconds:t,fallbackLabel:r,now:n}){let o=e?.used_percentage;if(o==null)return null;let i=wb(o,e?.resets_at,t,n),a=JSe(e?.resets_at,r,n);return(0,eTe.jsxs)(V,{component:"span",children:[(0,eTe.jsxs)(V,{component:"span",sx:{color:aAr(i)},children:[Math.round(o),"%"]})," ",(0,eTe.jsxs)(V,{component:"span",sx:{color:kU},children:["(",a,")"]})]})}var CL=k(I(),1),g0o='@property --rainbow-pill-h { syntax: "<number>"; inherits: true; initial-value: 0; }',y0o=wi`
|
|
4017
4017
|
from { --rainbow-pill-h: 0; }
|
|
4018
4018
|
to { --rainbow-pill-h: 360; }
|
|
4019
4019
|
`,v0o=wi`
|
|
4020
4020
|
0%, 100% { transform: scale(1); }
|
|
4021
4021
|
50% { transform: scale(1.08); }
|
|
4022
|
-
`,lAr={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:`${y0o} 1.8s linear infinite`},b0o={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${v0o} 1.6s ease-in-out infinite`,"&::before":{...lAr,inset:0,zIndex:-1},"&::after":{...lAr,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,CL.jsxs)(CL.Fragment,{children:[(0,CL.jsx)(R4,{styles:g0o}),(0,CL.jsx)(V,{component:"span","data-testid":"rainbow-pill",sx:b0o,children:e})]})}function uAr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function fAr(e){if(e.length!==2)return!1;let[t,r]=e;return uAr(t)===uAr(r)}var GT=k(I(),1);function pAr({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=fAr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:JSe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,GT.jsxs)(dAr.Fragment,{children:[a>0?(0,GT.jsx)(V,{component:"span",sx:{color:kU,mr:.5},children:","}):null,(0,GT.jsx)(sAr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,GT.jsx)(cAr,{children:o}):(0,GT.jsx)(GT.Fragment,{children:o})}var I5=k(I(),1);function mAr({groups:e}){return(0,I5.jsx)(I5.Fragment,{children:e.map((t,r)=>(0,I5.jsxs)(hAr.Fragment,{children:[(0,I5.jsx)(V,{component:"span",sx:{color:kU,ml:r>0?1:0,mr:.5},children:vc(t.harness)}),(0,I5.jsx)(pAr,{rateLimits:t.rateLimits})]},t.harness))})}var gAr={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 x0o(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function S0o(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function T0o(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function bAr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=BKe(t,r,n);if(o==null)return{kind:"unprojectable"};let i=wb(e,t,r,n),a=x0o(i),s=S0o(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:T0o(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function tTe(e){return t=>t.tokens.color.onAppBar.level[e]}function xAr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${tU(e.at,t)}`}var M5=k(I(),1),SAr={display:"contents"};function oXe({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,M5.jsxs)(V,{component:"span",sx:SAr,children:[(0,M5.jsx)("span",{}),(0,M5.jsx)("span",{})]});let n=(0,M5.jsx)(V,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,M5.jsxs)(V,{component:"span",sx:{color:tTe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,M5.jsxs)(V,{component:"span",sx:SAr,children:[r?o:n,r?n:o]})}var TAr={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 D5=k(I(),1);function CAr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=TAr,a=wb(t,r,n,o),s=bAr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,D5.jsxs)(V,{sx:i.row,children:[(0,D5.jsx)(V,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,D5.jsx)(oXe,{direction:"back",threshold:l?.recovery}),(0,D5.jsxs)(V,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:tTe(a)},children:[Math.round(t),"%"]}),(0,D5.jsx)(oXe,{direction:"forward",threshold:l?.worse}),(0,D5.jsx)(V,{component:"span",sx:i.note,children:l?l.recovery&&xAr(l.recovery,o):"no projection yet"})]})}function rTe(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 kAr=k(I(),1);function wAr({rateLimits:e,now:t}){return rTe(e).map(r=>(0,kAr.jsx)(CAr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var wL=k(I(),1);function _Ar({groups:e}){let t=Ug(3e4),r=gAr;return(0,wL.jsxs)(V,{sx:r.root,children:[e.map(n=>(0,wL.jsxs)(V,{sx:r.group,children:[(0,wL.jsx)(V,{sx:r.heading,children:vc(n.harness)}),(0,wL.jsx)(wAr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,wL.jsx)(V,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var iXe=k(I(),1),C0o="Claude account usage (5h / 7d windows) \u2014 view history";function EAr(e){return e.length===0?{title:C0o,content:"Usage"}:{title:(0,iXe.jsx)(_Ar,{groups:e}),content:(0,iXe.jsx)(mAr,{groups:e})}}var RAr={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}},AAr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var aXe=k(I(),1),w0o={};function PAr({rateLimits:e,harnessRateLimits:t=w0o}){let{title:r,content:n}=EAr(ZSe(e,t));return(0,aXe.jsx)(rr,{title:r,placement:"top-start",slotProps:AAr,children:(0,aXe.jsx)(Ur,{component:Ki,to:"/usage",underline:"none",color:"inherit",sx:RAr,children:n})})}var MAr=k(oe(),1);var Op="0.1012.0";var nTe=k(oe(),1),sXe=(0,nTe.createContext)(null);function oTe(){return(0,nTe.useContext)(sXe)}var lXe=k(I(),1);function LAr(){let e=oTe();return!e||e===Op?null:(0,lXe.jsx)(rr,{title:`Daemon is running v${e}, but this page was served by v${Op}. Restart the daemon to match.`,children:(0,lXe.jsx)(zSe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var IAr=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 DAr(){let{entries:e}=f5(),t=Kr(),r=(0,MAr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=to("openUpdates");if(Bi(n,r),!Op)return null;let i=e.filter(h5).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:IAr(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)(LAr,{})]})}var VT=k(I(),1);function NAr({socket:e}){return(0,VT.jsx)(jRr,{start:(0,VT.jsx)(PAr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,VT.jsxs)(VT.Fragment,{children:[(0,VT.jsx)(oAr,{}),(0,VT.jsx)(DAr,{})]})})}var OAr=k(oe(),1);var qT=k(I(),1),k0o=2e4;function BAr(){let{entries:e,refresh:t}=f5(),[r,n]=(0,OAr.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,qT.jsx)(hu,{open:a,children:(0,qT.jsxs)(jn,{severity:"info",variant:"filled",action:(0,qT.jsxs)(qT.Fragment,{children:[(0,qT.jsx)(Tt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,k0o),children:"Install"}),(0,qT.jsx)(Tt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var cTe=k(oe(),1);var lTe=k(oe(),1);function FAr(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 N5=k(I(),1),_0o={display:"flex",gap:1,alignItems:"center",minWidth:0},E0o={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},R0o={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},A0o={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function P0o(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function $Ar({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,N5.jsx)(Sm,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=P0o(o);return(0,N5.jsxs)(un,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:_0o,children:[(0,N5.jsx)(Rve,{path:o}),(0,N5.jsxs)(V,{sx:E0o,children:[(0,N5.jsx)(Ee,{component:"span",sx:R0o,children:s}),(0,N5.jsx)(Ee,{component:"span",color:"text.secondary",sx:A0o,children:a})]})]},o)})})}var iTe=k(I(),1),L0o={maxHeight:420,overflowY:"auto"},I0o={px:2,py:2,fontSize:13};function zAr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,iTe.jsx)(V,{sx:L0o,children:e?(0,iTe.jsx)(Ee,{color:"text.secondary",sx:I0o,children:e}):(0,iTe.jsx)($Ar,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var HAr=k(I(),1),M0o={mt:6,alignSelf:"flex-start"};function aTe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,HAr.jsx)(pc,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:M0o},transition:{onEntered:t}},children:n})}var sTe=k(oe(),1);var UAr={files:[],loading:!1,error:!1};function WAr(e,t){let[r,n]=(0,sTe.useState)(UAr),o=pr();return(0,sTe.useEffect)(()=>{if(!e){n(UAr);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 kL=k(I(),1);function D0o(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function GAr({onClose:e}){let{worktreeNode:t}=Vn();return(0,kL.jsx)(Fl.Provider,{value:t,children:(0,kL.jsx)(N0o,{onClose:e})})}function N0o({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=Vn(),[n,o]=(0,lTe.useState)(""),i=WAr(t,n),a=Kr(),s=(0,lTe.useRef)(null),l=h=>a(D0o(h,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=C5(i.files,n,l,e),p=h=>{l(h),e()};return(0,kL.jsxs)(aTe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,kL.jsx)(Sw,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:d,placeholder:"Search files by name..."}),(0,kL.jsx)(zAr,{message:FAr(t,n,i),files:i.files,highlight:u,onHighlight:f,onSelect:p})]})}function VAr(e){Bi(to("quickOpen").matches,e)}var jAr=k(I(),1);function qAr(){let[e,t]=(0,cTe.useState)(!1);return VAr((0,cTe.useCallback)(()=>t(!0),[])),e?(0,jAr.jsx)(GAr,{onClose:()=>t(!1)}):null}var uTe=k(I(),1);function YAr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,uTe.jsx)(hu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,uTe.jsx)(jn,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,uTe.jsx)(Tt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Iee=k(oe(),1);function _U(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var sPr=k(oe(),1);var KAr=k(I(),1),XAr=nt((0,KAr.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 O0o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function QAr(e){return e?O0o[e]:"success.main"}function ZAr(e){return e.split("-")[0].split(".").map(Number)}function JAr(e,t){if(!e||!t||e===t)return;let r=ZAr(e),n=ZAr(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 _L=k(I(),1),B0o={height:16,fontSize:10},F0o={opacity:.6,fontSize:"0.85em"};function $0o(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 Pee({nodes:e,name:t,showVersion:r=!1}){let n=oTe()??Op,o=e.links.find(a=>a.name===t),i=JAr(o?.peerVersion,n);return(0,_L.jsx)(rr,{title:$0o(e,t),placement:"right",children:(0,_L.jsxs)(V,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,_L.jsx)(XAr,{sx:{fontSize:8,color:QAr(o?.state)}}),t,r&&o?.peerVersion&&(0,_L.jsxs)(V,{component:"span",sx:F0o,children:["v",o.peerVersion]}),i&&(0,_L.jsx)(Yn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:B0o})]})})}var EL=k(I(),1),z0o={opacity:.6},H0o={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function ePr({nodes:e,name:t,clone:r}){let n=(0,EL.jsx)(Pee,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,EL.jsx)(V,{component:"span",sx:z0o,children:n}):(0,EL.jsx)(rr,{title:lU(t,r.cloneTarget),children:(0,EL.jsxs)(V,{component:"span",sx:H0o,children:[(0,EL.jsx)(sU,{sx:{fontSize:14}}),n]})})}var rPr=k(I(),1),U0o={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 tPr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,rPr.jsx)(ir,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:U0o,children:t})}var nPr={ArrowRight:1,ArrowLeft:-1};function W0o(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+nPr[e.key]+r)%r}function oPr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!nPr[o.key]){oT(o);return}let i=W0o(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var iPr=k(oe(),1);function EU(e){return e?.querySelector('[aria-checked="true"]')}function aPr(e,t){(0,iPr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=EU(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var cXe=k(I(),1),G0o={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function fTe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return aPr(i,r),(0,cXe.jsx)(_t,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:oPr(t,r,n,l),sx:G0o,children:t.map(u=>(0,cXe.jsx)(tPr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var uXe=k(I(),1);function lPr({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,uXe.jsx)(fTe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,uXe.jsx)(ePr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var dTe=k(I(),1);function cPr({prompt:e,children:t}){return(0,dTe.jsxs)(_t,{children:[e,(0,dTe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var fPr=k(I(),1),V0o=".MuiOutlinedInput-notchedOutline",q0o={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${V0o}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function uPr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,fPr.jsx)(Un,{sx:q0o,value:e,onChange:a=>t(a.target.value),onKeyDown:oT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var mPr=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:Abe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},dPr=Object.keys(Ey);var fXe=k(I(),1);function pPr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,fXe.jsx)(Js,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,fXe.jsx)(un,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:vc(i)},i))})}var RL=k(I(),1);function hPr(e){return t=>t==="prompt"&&e?(0,RL.jsxs)(RL.Fragment,{children:["prompt",(0,RL.jsx)(V,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${vc(e)}`}),(0,RL.jsx)(jd,{sx:{fontSize:18,mr:-.75}})]}):t}var AL=k(I(),1);function gPr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,mPr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(EU(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,AL.jsxs)(AL.Fragment,{children:[(0,AL.jsx)(fTe,{label:"Mode",options:dPr,value:e.mode,onChange:l,optionLabel:hPr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,AL.jsx)(pPr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var RPr=k(oe(),1);var dXe=k(I(),1),j0o={zIndex:e=>e.zIndex.modal+1};function yPr({open:e,anchor:t,children:r}){return(0,dXe.jsx)(r7,{open:e,anchorEl:t,placement:"bottom-start",sx:j0o,children:(0,dXe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var vPr=k(I(),1),bPr=nt((0,vPr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var pXe=k(I(),1),Y0o={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},K0o={fontSize:16,color:"text.disabled"};function xPr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Y0o,endAdornment:(0,pXe.jsx)(Uke,{position:"end",children:(0,pXe.jsx)(bPr,{sx:K0o})})}}}var SPr=k(HI(),1);function TPr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}oT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,SPr.flushSync)(()=>{r(t),n()}),oT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function pTe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Rb(n).toLowerCase().includes(r)):e}var hXe=k(oe(),1);function CPr(){let[e,t]=(0,hXe.useState)(!1),[r,n]=(0,hXe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var kPr=k(oe(),1);var wPr=e=>e?Rb(e):"";function _Pr(e){let[t,r]=(0,kPr.useState)(()=>wPr(e));return{text:t,setText:r,showRepo:n=>r(wPr(n))}}function EPr(e,t,r){let n=CPr(),o=_Pr(t),i=pTe(e,n.query),a=f=>{r(f),o.showRepo(f)},s=C5(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:TPr({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 RU=k(I(),1);function APr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=EPr(e,t,r),s=(0,RPr.useRef)(null);return(0,RU.jsxs)(V,{ref:s,sx:{flex:1,minWidth:0},children:[(0,RU.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:xPr(a.open)}),(0,RU.jsx)(yPr,{open:a.open,anchor:s.current,children:(0,RU.jsx)(DSe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var O5=k(I(),1);function PPr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=Vn();return(0,O5.jsxs)(cPr,{prompt:(0,O5.jsx)(uPr,{value:r.prompt,onChange:r.setPrompt,placeholder:Ey[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,O5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,O5.jsx)(APr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,O5.jsx)(gPr,{...t})]}),(0,O5.jsx)(lPr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var MPr=k(I(),1),LPr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function IPr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,MPr.jsx)(Tt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var PL=k(I(),1),X0o=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"}),Q0o=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function DPr(e){return(0,PL.jsxs)(_t,{direction:"row",sx:X0o,children:[LPr.map(([t,r])=>(0,PL.jsxs)("span",{children:[(0,PL.jsx)(V,{component:"kbd",sx:Q0o,children:t}),r]},t)),(0,PL.jsx)(V,{sx:{flex:1}}),(0,PL.jsx)(IPr,{...e})]})}var LL=k(oe(),1);function NPr(e,t){let r=(0,LL.useRef)(e),n=(0,LL.useRef)(null),o=(0,LL.useRef)(null),i=(0,LL.useRef)(null),a=(0,LL.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:EU(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 Z0o(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:OSe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function OPr(e,t){let{names:r,visible:n}=il(),o=LSe(t,n?r:[void 0]);return{cloneState:o,target:Z0o(t,e,o(e))}}function hTe({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 BPr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(CSe(r.prompt,n.onCreateAssist),!0):(hTe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var mTe=k(oe(),1);function FPr(e,t){let[r,n]=(0,mTe.useState)(!1);return(0,mTe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function $Pr(e,t,r,n,o){let i=FPr(e,()=>{BPr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Lee=k(oe(),1);function zPr(e,t){let r=(0,Lee.useRef)(e),n=(0,Lee.useRef)(null);return(0,Lee.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 UPr=k(I(),1),J0o={border:0,margin:0,padding:0,minWidth:0};function HPr({loading:e,restoreFocus:t,children:r}){let n=zPr(e,t);return(0,UPr.jsx)("fieldset",{disabled:e,style:J0o,onFocus:n,children:r})}var yTe=k(I(),1);function gTe({error:e,onRetry:t}){return e?(0,yTe.jsxs)(jn,{severity:"error",sx:{mx:2,my:1},action:t&&(0,yTe.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 B5=k(I(),1);function WPr({draft:e,launchers:t,onClose:r}){let n=NPr(e.focus,e.setFocus),o=_U(Wg()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=OPr(e.node,e.cwd),l=$Pr(e,i,a,t,r);return(0,B5.jsx)(aTe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,B5.jsx)("form",{onSubmit:l,children:(0,B5.jsxs)(HPr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,B5.jsx)(PPr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,B5.jsx)(gTe,{error:e.modeError,onRetry:e.retryMode}),(0,B5.jsx)(DPr,{submitLabel:a.kind==="clone"?"Clone":Ey[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var IL=k(oe(),1);async function eyo(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 vTe(e,t=0){let[r,n]=(0,IL.useState)(0),[o,i]=(0,IL.useState)(null),a=(0,IL.useCallback)(()=>n(l=>l+1),[]);if((0,IL.useEffect)(()=>{let l=!1;return eyo(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 bTe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function GPr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var jT=k(oe(),1),VPr={field:"prompt",selectionStart:0,selectionEnd:0};function qPr(){let[e,t]=(0,jT.useState)(""),[r,n]=(0,jT.useState)(),[o,i]=(0,jT.useState)(),[a,s]=(0,jT.useState)("claude"),[l,u]=(0,jT.useState)(),[f,d]=(0,jT.useState)(VPr),p=(0,jT.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),d(VPr)},[]);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 jPr(e,t=vTe){let{selectedCwd:r}=Vn(),n=il(),o=qPr(),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:bTe(o.mode,a),retryMode:a.retry,node:GPr(o.node,n)}:null}function YPr(e){Bi(to("newSession").matches,e)}var KPr=k(oe(),1);function XPr(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,KPr.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 ZPr=k(I(),1);function QPr({launchers:e}){let[t,r]=(0,Iee.useState)(!1),[n,o]=(0,Iee.useState)(0),i=jPr(n),a=(0,Iee.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return YPr(a),XPr(i,a),!t||!i?null:(0,ZPr.jsx)(WPr,{draft:i,launchers:e,onClose:()=>r(!1)})}var xTe=k(I(),1);function JPr({reconnecting:e}){return(0,xTe.jsx)(hu,{open:e,children:(0,xTe.jsx)(jn,{severity:"info",variant:"filled",icon:(0,xTe.jsx)(bo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Ry=k(I(),1);function e6r({socket:e,onViewLaunchedSession:t}){return(0,Ry.jsxs)(Ry.Fragment,{children:[(0,Ry.jsx)(qAr,{}),(0,Ry.jsx)(QPr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Ry.jsx)(JPr,{reconnecting:e.reconnecting}),(0,Ry.jsx)(BAr,{}),(0,Ry.jsx)(sl,{error:e.error,onClose:e.clearError}),(0,Ry.jsx)(YAr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Fb=k(oe(),1);var tyo=6e4;function ryo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function STe(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4022
|
+
`,lAr={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:`${y0o} 1.8s linear infinite`},b0o={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${v0o} 1.6s ease-in-out infinite`,"&::before":{...lAr,inset:0,zIndex:-1},"&::after":{...lAr,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,CL.jsxs)(CL.Fragment,{children:[(0,CL.jsx)(R4,{styles:g0o}),(0,CL.jsx)(V,{component:"span","data-testid":"rainbow-pill",sx:b0o,children:e})]})}function uAr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function fAr(e){if(e.length!==2)return!1;let[t,r]=e;return uAr(t)===uAr(r)}var GT=k(I(),1);function pAr({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=fAr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:JSe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,GT.jsxs)(dAr.Fragment,{children:[a>0?(0,GT.jsx)(V,{component:"span",sx:{color:kU,mr:.5},children:","}):null,(0,GT.jsx)(sAr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,GT.jsx)(cAr,{children:o}):(0,GT.jsx)(GT.Fragment,{children:o})}var I5=k(I(),1);function mAr({groups:e}){return(0,I5.jsx)(I5.Fragment,{children:e.map((t,r)=>(0,I5.jsxs)(hAr.Fragment,{children:[(0,I5.jsx)(V,{component:"span",sx:{color:kU,ml:r>0?1:0,mr:.5},children:vc(t.harness)}),(0,I5.jsx)(pAr,{rateLimits:t.rateLimits})]},t.harness))})}var gAr={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 x0o(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function S0o(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function T0o(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function bAr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=BKe(t,r,n);if(o==null)return{kind:"unprojectable"};let i=wb(e,t,r,n),a=x0o(i),s=S0o(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:T0o(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function tTe(e){return t=>t.tokens.color.onAppBar.level[e]}function xAr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${tU(e.at,t)}`}var M5=k(I(),1),SAr={display:"contents"};function oXe({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,M5.jsxs)(V,{component:"span",sx:SAr,children:[(0,M5.jsx)("span",{}),(0,M5.jsx)("span",{})]});let n=(0,M5.jsx)(V,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,M5.jsxs)(V,{component:"span",sx:{color:tTe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,M5.jsxs)(V,{component:"span",sx:SAr,children:[r?o:n,r?n:o]})}var TAr={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 D5=k(I(),1);function CAr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=TAr,a=wb(t,r,n,o),s=bAr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,D5.jsxs)(V,{sx:i.row,children:[(0,D5.jsx)(V,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,D5.jsx)(oXe,{direction:"back",threshold:l?.recovery}),(0,D5.jsxs)(V,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:tTe(a)},children:[Math.round(t),"%"]}),(0,D5.jsx)(oXe,{direction:"forward",threshold:l?.worse}),(0,D5.jsx)(V,{component:"span",sx:i.note,children:l?l.recovery&&xAr(l.recovery,o):"no projection yet"})]})}function rTe(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 kAr=k(I(),1);function wAr({rateLimits:e,now:t}){return rTe(e).map(r=>(0,kAr.jsx)(CAr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var wL=k(I(),1);function _Ar({groups:e}){let t=Ug(3e4),r=gAr;return(0,wL.jsxs)(V,{sx:r.root,children:[e.map(n=>(0,wL.jsxs)(V,{sx:r.group,children:[(0,wL.jsx)(V,{sx:r.heading,children:vc(n.harness)}),(0,wL.jsx)(wAr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,wL.jsx)(V,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var iXe=k(I(),1),C0o="Claude account usage (5h / 7d windows) \u2014 view history";function EAr(e){return e.length===0?{title:C0o,content:"Usage"}:{title:(0,iXe.jsx)(_Ar,{groups:e}),content:(0,iXe.jsx)(mAr,{groups:e})}}var RAr={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}},AAr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var aXe=k(I(),1),w0o={};function PAr({rateLimits:e,harnessRateLimits:t=w0o}){let{title:r,content:n}=EAr(ZSe(e,t));return(0,aXe.jsx)(rr,{title:r,placement:"top-start",slotProps:AAr,children:(0,aXe.jsx)(Ur,{component:Ki,to:"/usage",underline:"none",color:"inherit",sx:RAr,children:n})})}var MAr=k(oe(),1);var Op="0.1013.0";var nTe=k(oe(),1),sXe=(0,nTe.createContext)(null);function oTe(){return(0,nTe.useContext)(sXe)}var lXe=k(I(),1);function LAr(){let e=oTe();return!e||e===Op?null:(0,lXe.jsx)(rr,{title:`Daemon is running v${e}, but this page was served by v${Op}. Restart the daemon to match.`,children:(0,lXe.jsx)(zSe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var IAr=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 DAr(){let{entries:e}=f5(),t=Kr(),r=(0,MAr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=to("openUpdates");if(Bi(n,r),!Op)return null;let i=e.filter(h5).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:IAr(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)(LAr,{})]})}var VT=k(I(),1);function NAr({socket:e}){return(0,VT.jsx)(jRr,{start:(0,VT.jsx)(PAr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,VT.jsxs)(VT.Fragment,{children:[(0,VT.jsx)(oAr,{}),(0,VT.jsx)(DAr,{})]})})}var OAr=k(oe(),1);var qT=k(I(),1),k0o=2e4;function BAr(){let{entries:e,refresh:t}=f5(),[r,n]=(0,OAr.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,qT.jsx)(hu,{open:a,children:(0,qT.jsxs)(jn,{severity:"info",variant:"filled",action:(0,qT.jsxs)(qT.Fragment,{children:[(0,qT.jsx)(Tt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,k0o),children:"Install"}),(0,qT.jsx)(Tt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var cTe=k(oe(),1);var lTe=k(oe(),1);function FAr(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 N5=k(I(),1),_0o={display:"flex",gap:1,alignItems:"center",minWidth:0},E0o={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},R0o={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},A0o={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function P0o(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function $Ar({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,N5.jsx)(Sm,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=P0o(o);return(0,N5.jsxs)(un,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:_0o,children:[(0,N5.jsx)(Rve,{path:o}),(0,N5.jsxs)(V,{sx:E0o,children:[(0,N5.jsx)(Ee,{component:"span",sx:R0o,children:s}),(0,N5.jsx)(Ee,{component:"span",color:"text.secondary",sx:A0o,children:a})]})]},o)})})}var iTe=k(I(),1),L0o={maxHeight:420,overflowY:"auto"},I0o={px:2,py:2,fontSize:13};function zAr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,iTe.jsx)(V,{sx:L0o,children:e?(0,iTe.jsx)(Ee,{color:"text.secondary",sx:I0o,children:e}):(0,iTe.jsx)($Ar,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var HAr=k(I(),1),M0o={mt:6,alignSelf:"flex-start"};function aTe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,HAr.jsx)(pc,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:M0o},transition:{onEntered:t}},children:n})}var sTe=k(oe(),1);var UAr={files:[],loading:!1,error:!1};function WAr(e,t){let[r,n]=(0,sTe.useState)(UAr),o=pr();return(0,sTe.useEffect)(()=>{if(!e){n(UAr);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 kL=k(I(),1);function D0o(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function GAr({onClose:e}){let{worktreeNode:t}=Vn();return(0,kL.jsx)(Fl.Provider,{value:t,children:(0,kL.jsx)(N0o,{onClose:e})})}function N0o({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=Vn(),[n,o]=(0,lTe.useState)(""),i=WAr(t,n),a=Kr(),s=(0,lTe.useRef)(null),l=h=>a(D0o(h,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=C5(i.files,n,l,e),p=h=>{l(h),e()};return(0,kL.jsxs)(aTe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,kL.jsx)(Sw,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:d,placeholder:"Search files by name..."}),(0,kL.jsx)(zAr,{message:FAr(t,n,i),files:i.files,highlight:u,onHighlight:f,onSelect:p})]})}function VAr(e){Bi(to("quickOpen").matches,e)}var jAr=k(I(),1);function qAr(){let[e,t]=(0,cTe.useState)(!1);return VAr((0,cTe.useCallback)(()=>t(!0),[])),e?(0,jAr.jsx)(GAr,{onClose:()=>t(!1)}):null}var uTe=k(I(),1);function YAr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,uTe.jsx)(hu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,uTe.jsx)(jn,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,uTe.jsx)(Tt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Iee=k(oe(),1);function _U(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var sPr=k(oe(),1);var KAr=k(I(),1),XAr=nt((0,KAr.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 O0o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function QAr(e){return e?O0o[e]:"success.main"}function ZAr(e){return e.split("-")[0].split(".").map(Number)}function JAr(e,t){if(!e||!t||e===t)return;let r=ZAr(e),n=ZAr(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 _L=k(I(),1),B0o={height:16,fontSize:10},F0o={opacity:.6,fontSize:"0.85em"};function $0o(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 Pee({nodes:e,name:t,showVersion:r=!1}){let n=oTe()??Op,o=e.links.find(a=>a.name===t),i=JAr(o?.peerVersion,n);return(0,_L.jsx)(rr,{title:$0o(e,t),placement:"right",children:(0,_L.jsxs)(V,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,_L.jsx)(XAr,{sx:{fontSize:8,color:QAr(o?.state)}}),t,r&&o?.peerVersion&&(0,_L.jsxs)(V,{component:"span",sx:F0o,children:["v",o.peerVersion]}),i&&(0,_L.jsx)(Yn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:B0o})]})})}var EL=k(I(),1),z0o={opacity:.6},H0o={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function ePr({nodes:e,name:t,clone:r}){let n=(0,EL.jsx)(Pee,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,EL.jsx)(V,{component:"span",sx:z0o,children:n}):(0,EL.jsx)(rr,{title:lU(t,r.cloneTarget),children:(0,EL.jsxs)(V,{component:"span",sx:H0o,children:[(0,EL.jsx)(sU,{sx:{fontSize:14}}),n]})})}var rPr=k(I(),1),U0o={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 tPr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,rPr.jsx)(ir,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:U0o,children:t})}var nPr={ArrowRight:1,ArrowLeft:-1};function W0o(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+nPr[e.key]+r)%r}function oPr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!nPr[o.key]){oT(o);return}let i=W0o(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var iPr=k(oe(),1);function EU(e){return e?.querySelector('[aria-checked="true"]')}function aPr(e,t){(0,iPr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=EU(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var cXe=k(I(),1),G0o={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function fTe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return aPr(i,r),(0,cXe.jsx)(_t,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:oPr(t,r,n,l),sx:G0o,children:t.map(u=>(0,cXe.jsx)(tPr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var uXe=k(I(),1);function lPr({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,uXe.jsx)(fTe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,uXe.jsx)(ePr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var dTe=k(I(),1);function cPr({prompt:e,children:t}){return(0,dTe.jsxs)(_t,{children:[e,(0,dTe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var fPr=k(I(),1),V0o=".MuiOutlinedInput-notchedOutline",q0o={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${V0o}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function uPr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,fPr.jsx)(Un,{sx:q0o,value:e,onChange:a=>t(a.target.value),onKeyDown:oT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var mPr=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:Abe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},dPr=Object.keys(Ey);var fXe=k(I(),1);function pPr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,fXe.jsx)(Js,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,fXe.jsx)(un,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:vc(i)},i))})}var RL=k(I(),1);function hPr(e){return t=>t==="prompt"&&e?(0,RL.jsxs)(RL.Fragment,{children:["prompt",(0,RL.jsx)(V,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${vc(e)}`}),(0,RL.jsx)(jd,{sx:{fontSize:18,mr:-.75}})]}):t}var AL=k(I(),1);function gPr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,mPr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(EU(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,AL.jsxs)(AL.Fragment,{children:[(0,AL.jsx)(fTe,{label:"Mode",options:dPr,value:e.mode,onChange:l,optionLabel:hPr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,AL.jsx)(pPr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var RPr=k(oe(),1);var dXe=k(I(),1),j0o={zIndex:e=>e.zIndex.modal+1};function yPr({open:e,anchor:t,children:r}){return(0,dXe.jsx)(r7,{open:e,anchorEl:t,placement:"bottom-start",sx:j0o,children:(0,dXe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var vPr=k(I(),1),bPr=nt((0,vPr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var pXe=k(I(),1),Y0o={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},K0o={fontSize:16,color:"text.disabled"};function xPr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Y0o,endAdornment:(0,pXe.jsx)(Uke,{position:"end",children:(0,pXe.jsx)(bPr,{sx:K0o})})}}}var SPr=k(HI(),1);function TPr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}oT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,SPr.flushSync)(()=>{r(t),n()}),oT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function pTe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Rb(n).toLowerCase().includes(r)):e}var hXe=k(oe(),1);function CPr(){let[e,t]=(0,hXe.useState)(!1),[r,n]=(0,hXe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var kPr=k(oe(),1);var wPr=e=>e?Rb(e):"";function _Pr(e){let[t,r]=(0,kPr.useState)(()=>wPr(e));return{text:t,setText:r,showRepo:n=>r(wPr(n))}}function EPr(e,t,r){let n=CPr(),o=_Pr(t),i=pTe(e,n.query),a=f=>{r(f),o.showRepo(f)},s=C5(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:TPr({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 RU=k(I(),1);function APr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=EPr(e,t,r),s=(0,RPr.useRef)(null);return(0,RU.jsxs)(V,{ref:s,sx:{flex:1,minWidth:0},children:[(0,RU.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:xPr(a.open)}),(0,RU.jsx)(yPr,{open:a.open,anchor:s.current,children:(0,RU.jsx)(DSe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var O5=k(I(),1);function PPr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=Vn();return(0,O5.jsxs)(cPr,{prompt:(0,O5.jsx)(uPr,{value:r.prompt,onChange:r.setPrompt,placeholder:Ey[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,O5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,O5.jsx)(APr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,O5.jsx)(gPr,{...t})]}),(0,O5.jsx)(lPr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var MPr=k(I(),1),LPr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function IPr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,MPr.jsx)(Tt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var PL=k(I(),1),X0o=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"}),Q0o=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function DPr(e){return(0,PL.jsxs)(_t,{direction:"row",sx:X0o,children:[LPr.map(([t,r])=>(0,PL.jsxs)("span",{children:[(0,PL.jsx)(V,{component:"kbd",sx:Q0o,children:t}),r]},t)),(0,PL.jsx)(V,{sx:{flex:1}}),(0,PL.jsx)(IPr,{...e})]})}var LL=k(oe(),1);function NPr(e,t){let r=(0,LL.useRef)(e),n=(0,LL.useRef)(null),o=(0,LL.useRef)(null),i=(0,LL.useRef)(null),a=(0,LL.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:EU(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 Z0o(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:OSe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function OPr(e,t){let{names:r,visible:n}=il(),o=LSe(t,n?r:[void 0]);return{cloneState:o,target:Z0o(t,e,o(e))}}function hTe({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 BPr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(CSe(r.prompt,n.onCreateAssist),!0):(hTe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var mTe=k(oe(),1);function FPr(e,t){let[r,n]=(0,mTe.useState)(!1);return(0,mTe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function $Pr(e,t,r,n,o){let i=FPr(e,()=>{BPr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Lee=k(oe(),1);function zPr(e,t){let r=(0,Lee.useRef)(e),n=(0,Lee.useRef)(null);return(0,Lee.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 UPr=k(I(),1),J0o={border:0,margin:0,padding:0,minWidth:0};function HPr({loading:e,restoreFocus:t,children:r}){let n=zPr(e,t);return(0,UPr.jsx)("fieldset",{disabled:e,style:J0o,onFocus:n,children:r})}var yTe=k(I(),1);function gTe({error:e,onRetry:t}){return e?(0,yTe.jsxs)(jn,{severity:"error",sx:{mx:2,my:1},action:t&&(0,yTe.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 B5=k(I(),1);function WPr({draft:e,launchers:t,onClose:r}){let n=NPr(e.focus,e.setFocus),o=_U(Wg()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=OPr(e.node,e.cwd),l=$Pr(e,i,a,t,r);return(0,B5.jsx)(aTe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,B5.jsx)("form",{onSubmit:l,children:(0,B5.jsxs)(HPr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,B5.jsx)(PPr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,B5.jsx)(gTe,{error:e.modeError,onRetry:e.retryMode}),(0,B5.jsx)(DPr,{submitLabel:a.kind==="clone"?"Clone":Ey[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var IL=k(oe(),1);async function eyo(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 vTe(e,t=0){let[r,n]=(0,IL.useState)(0),[o,i]=(0,IL.useState)(null),a=(0,IL.useCallback)(()=>n(l=>l+1),[]);if((0,IL.useEffect)(()=>{let l=!1;return eyo(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 bTe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function GPr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var jT=k(oe(),1),VPr={field:"prompt",selectionStart:0,selectionEnd:0};function qPr(){let[e,t]=(0,jT.useState)(""),[r,n]=(0,jT.useState)(),[o,i]=(0,jT.useState)(),[a,s]=(0,jT.useState)("claude"),[l,u]=(0,jT.useState)(),[f,d]=(0,jT.useState)(VPr),p=(0,jT.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),d(VPr)},[]);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 jPr(e,t=vTe){let{selectedCwd:r}=Vn(),n=il(),o=qPr(),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:bTe(o.mode,a),retryMode:a.retry,node:GPr(o.node,n)}:null}function YPr(e){Bi(to("newSession").matches,e)}var KPr=k(oe(),1);function XPr(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,KPr.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 ZPr=k(I(),1);function QPr({launchers:e}){let[t,r]=(0,Iee.useState)(!1),[n,o]=(0,Iee.useState)(0),i=jPr(n),a=(0,Iee.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return YPr(a),XPr(i,a),!t||!i?null:(0,ZPr.jsx)(WPr,{draft:i,launchers:e,onClose:()=>r(!1)})}var xTe=k(I(),1);function JPr({reconnecting:e}){return(0,xTe.jsx)(hu,{open:e,children:(0,xTe.jsx)(jn,{severity:"info",variant:"filled",icon:(0,xTe.jsx)(bo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Ry=k(I(),1);function e6r({socket:e,onViewLaunchedSession:t}){return(0,Ry.jsxs)(Ry.Fragment,{children:[(0,Ry.jsx)(qAr,{}),(0,Ry.jsx)(QPr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Ry.jsx)(JPr,{reconnecting:e.reconnecting}),(0,Ry.jsx)(BAr,{}),(0,Ry.jsx)(sl,{error:e.error,onClose:e.clearError}),(0,Ry.jsx)(YAr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Fb=k(oe(),1);var tyo=6e4;function ryo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function STe(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=>ryo(f,l,t));for(let f of l)Z2e(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,tyo);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Fb.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var F5=k(I(),1);function t6r({shell:e,children:t}){let{socket:r,selection:n,launch:o,sidebarCollapse:i}=e,a=STe(r.nodeSelection);return(0,F5.jsx)(RKe.Provider,{value:a,children:(0,F5.jsx)(x3e.Provider,{value:i,children:(0,F5.jsx)(aq.Provider,{value:n,children:(0,F5.jsx)(Z4e.Provider,{value:r.nodeSelection,children:(0,F5.jsx)(Fl.Provider,{value:n.selectedNode,children:(0,F5.jsx)(pqe.Provider,{value:o,children:(0,F5.jsx)(mft,{children:t})})})})})})})}var r6r=k(I(),1),n6r=nt((0,r6r.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 o6r=k(oe(),1);var Ay=k(I(),1),nyo={ml:1,textTransform:"none",fontSize:12};function i6r(){let{nodes:e,names:t,visible:r,selected:n,select:o}=il(),[i,a]=(0,o6r.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)(n6r,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:nyo,children:(0,Ay.jsx)(Pee,{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)(Pee,{nodes:e,name:s,showVersion:!0})},s))})]})}var Mee=k(oe(),1);function a6r(e,t){return[...e[0].slice(0,-1),String(t+1)]}var ML=k(I(),1),oyo=[Oi("secondary"),{ml:.75}];function s6r({index:e,label:t,count:r,...n}){let{chords:o}=to("navTab");return(0,ML.jsx)(rr,{describeChild:!0,title:(0,ML.jsx)(of,{label:t,chords:[a6r(o,e)]}),children:(0,ML.jsx)(Tx,{label:r?(0,ML.jsxs)("span",{children:[t,(0,ML.jsx)(V,{component:"span",sx:oyo,children:r})]}):t,...n})})}var l6r=k(oe(),1);var iyo=6e4;function c6r(){let e=zve();return(0,l6r.useEffect)(()=>{Es.refresh();let t=setInterval(()=>{Es.refresh()},iyo);return()=>clearInterval(t)},[]),e?.length??0}var mXe=k(oe(),1);function u6r(e,t){let{bound:r}=to("navTab"),n=e.length,o=(0,mXe.useCallback)(a=>(gq(a,r)??n)<n,[r,n]),i=(0,mXe.useCallback)(a=>{let s=e[gq(a,r)??-1];s&&t(s)},[e,t,r]);Bi(o,i)}var TTe=k(oe(),1);function f6r(){let[e,t]=(0,TTe.useState)(!1);return(0,TTe.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 CTe=k(oe(),1);async function ayo(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 d6r(e){let[t,r]=(0,CTe.useState)(null),n=pr(),o=`${n??""}\0${e}`;return(0,CTe.useEffect)(()=>{if(!e)return;let i=!1;return ayo(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 p6r=k(oe(),1);function h6r(e){let{pathname:t}=ii(),r=Kr(),n=t==="/releases"||t.startsWith("/releases/");(0,p6r.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var syo={path:"/sessions",label:"Sessions"},lyo={path:"/backlog",label:"Backlog"},cyo={path:"/next",label:"Next"},uyo={path:"/releases",label:"Releases"},fyo={path:"/news",label:"News"},dyo={path:"/inbox",label:"Inbox"};function m6r(e,t){return[syo,lyo,cyo,...e?[uyo]:[],...t?[fyo]:[],dyo]}var gXe=k(I(),1),pyo={mx:"6px"};function g6r({cwd:e}){let t=ii(),r=Kr(),n=d6r(e),o=f6r(),i=c6r();h6r(n);let a=n===!0,s=(0,Mee.useMemo)(()=>m6r(a,o),[a,o]),l=(0,Mee.useMemo)(()=>s.map(d=>d.path),[s]),u=s.findIndex(d=>t.pathname.startsWith(d.path)),f=(0,Mee.useCallback)(d=>{t.pathname!==d&&r(d)},[t.pathname,r]);return u6r(l,f),(0,gXe.jsx)(i3,{sx:pyo,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((d,p)=>(0,gXe.jsx)(s6r,{index:p,label:d.label,count:d.path==="/inbox"?i:void 0,onClick:()=>f(d.path)},d.path))})}var Dee=k(I(),1),y6r=(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)"}}),hyo=e=>({ml:.75,...e.tokens.color.appBar?y6r("primary.main","primary.contrastText"):y6r("primary.contrastText","primary.main")});function v6r(){let[,e]=$s(),{label:t,chords:r}=to("newSession");return(0,Dee.jsx)(rr,{title:(0,Dee.jsx)(of,{label:t,chords:r}),children:(0,Dee.jsx)(Vt,{sx:hyo,"aria-label":"New session",onClick:()=>e(o=>(o.set("new",""),o),{replace:!0}),children:(0,Dee.jsx)(qd,{})})})}var wTe=k(oe(),1);var Nee=k(I(),1),myo={strokeWidth:2};function b6r(e){return(0,Nee.jsxs)(Ibe,{viewBox:"0 0 24 24",sx:myo,...e,children:[(0,Nee.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,Nee.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var Oee=k(I(),1);function x6r({cwd:e}){let[t,r]=(0,wTe.useState)(null),n=pr();return(0,wTe.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,Oee.jsx)(rr,{title:"Open in GitHub",children:(0,Oee.jsx)(V,{component:"span",sx:Mbe,children:(0,Oee.jsx)(Vt,{onClick:()=>window.open(t,"_blank"),children:(0,Oee.jsx)(b6r,{})})})}):null}var Py=k(I(),1),gyo={color:"inherit",mr:1.5};function S6r({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:o}=y5("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:gyo,disabled:t,onClick:o,children:t?(0,Py.jsx)(bo,{size:24}):(0,Py.jsx)(Lz,{})})})}),(0,Py.jsx)(sl,{error:r,onClose:n})]})}var w6r=k(oe(),1);var T6r=k(oe(),1);function C6r(e){let t=Sn().palette.primary.main;Bi(to("focusRepoPicker").matches,(0,T6r.useCallback)(()=>bc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var Bee=k(I(),1),yyo={width:240,ml:2};function k6r({repos:e,selected:t,onSelect:r}){let n=(0,w6r.useRef)(null);C6r(n);let{chords:o}=to("focusRepoPicker");return(0,Bee.jsx)(V,{ref:n,sx:yyo,children:(0,Bee.jsx)(Pbe,{label:t?Rb(t):"Select repo...",tooltip:(0,Bee.jsx)(of,{label:"Repo",chords:o}),typeToOpen:!0,children:(i,a)=>(0,Bee.jsx)(L4r,{repos:e,selected:t,onSelect:r,close:i,initialFilter:a})})})}var N6r=k(oe(),1);var Fee=k(oe(),1);function kTe(e){let[t,r]=(0,Fee.useState)([]),[n,o]=(0,Fee.useState)(!0),i=pr();return(0,Fee.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 yXe=k(I(),1);function vXe({text:e}){return(0,yXe.jsx)(V,{sx:{p:1.5},children:(0,yXe.jsx)(Ee,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var DL=k(I(),1);function _6r({pr:e,highlighted:t,onHover:r,onPick:n}){let o=MSe(t);return(0,DL.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,DL.jsxs)(_t,{spacing:.25,sx:{minWidth:0},children:[(0,DL.jsxs)(Ee,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,DL.jsx)(Yn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,DL.jsxs)(Ee,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",Po(e.createdAt)]})]})})}var bXe=k(I(),1);function E6r({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,bXe.jsx)(Sm,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((o,i)=>(0,bXe.jsx)(_6r,{pr:o,highlighted:i===t,onHover:()=>r(i),onPick:n},o.number))})}var A6r=k(oe(),1);function R6r(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 P6r(e,t,r){let[n,o]=(0,A6r.useState)(""),i=R6r(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=C5(i,n,t,r);return{filter:n,setFilter:o,filtered:i,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var $5=k(I(),1),L6r={...Jz,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function I6r({cwd:e,onPick:t,close:r}){let{prs:n,loading:o}=kTe(e),i=P6r(n,t,r);return o||n.length===0?(0,$5.jsx)(rn,{elevation:4,sx:L6r,children:(0,$5.jsx)(vXe,{text:o?"Loading open PRs\u2026":"No open PRs"})}):(0,$5.jsxs)(rn,{elevation:4,sx:L6r,children:[(0,$5.jsx)(Sw,{autoFocus:!0,value:i.filter,onChange:i.setFilter,onKeyDown:i.onKeyDown,placeholder:"Filter PRs..."}),i.filtered.length===0?(0,$5.jsx)(vXe,{text:"No PRs match"}):(0,$5.jsx)(E6r,{prs:i.filtered,highlight:i.highlight,onHighlight:i.setHighlight,onPick:i.select})]})}var D6r=k(I(),1);function M6r({cwd:e,onPick:t,close:r}){return(0,D6r.jsx)(I6r,{cwd:e,onPick:t,close:r})}var z5=k(I(),1);function O6r({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:o}=kTe(e),[i,a]=(0,N6r.useState)(null);return o||n.length===0?null:(0,z5.jsxs)(z5.Fragment,{children:[(0,z5.jsx)(Pbe,{label:"prs",disabled:t,children:s=>(0,z5.jsx)(M6r,{cwd:e,onPick:a,close:s})}),i&&(0,z5.jsx)(lbe,{pr:i,onSelect:s=>{r(i,s),a(null)},onCancel:()=>a(null)})]})}var F6r=k(I(),1);function B6r({onStartRun:e,cwd:t}){let r=Ebe(t);return!t||r.length===0?null:(0,F6r.jsx)(kbe,{runs:r,onSelect:n=>e(n,t)})}var $ee=k(I(),1);function $6r({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=Vn();return(0,$ee.jsxs)(_t,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,$ee.jsx)(O6r,{cwd:r,disabled:!r,onSelect:(o,i)=>e([...i,String(o.number)],r,{...xE(o),node:n})}),(0,$ee.jsx)(B6r,{onStartRun:(o,i)=>t(o,i,void 0,void 0,n),cwd:r})]})}var tm=k(I(),1),vyo={minHeight:48,pl:1,pr:14};function z6r({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=Iw();return(0,tm.jsxs)(o3,{variant:"dense",disableGutters:!0,sx:vyo,children:[r&&(0,tm.jsx)(ise,{collapsed:r,onToggleCollapsed:n}),(0,tm.jsx)(S6r,{reconnecting:e.reconnecting}),(0,tm.jsx)(g6r,{cwd:t.selectedCwd}),(0,tm.jsx)(i6r,{}),(0,tm.jsx)(k6r,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,tm.jsxs)(V,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,tm.jsx)(Dbe,{cwd:t.selectedCwd}),(0,tm.jsx)(x6r,{cwd:t.selectedCwd}),(0,tm.jsx)(v6r,{})]}),(0,tm.jsx)($6r,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var _Te=k(oe(),1);function H6r(){let[e,t]=(0,_Te.useState)(null);return(0,_Te.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 W6r=k(I(),1),byo={lineHeight:"32px",bgcolor:"transparent"};function U6r(){let e=H6r();return e?(0,W6r.jsx)(bke,{sx:byo,children:e}):null}var G6r=k(I(),1),V6r=nt((0,G6r.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 q6r=k(I(),1),j6r=nt((0,q6r.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 Y6r=k(I(),1),K6r=nt((0,Y6r.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 X6r=k(I(),1),Q6r=nt((0,X6r.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 xXe=k(I(),1);function Z6r({mode:e}){return e==="dark"?(0,xXe.jsx)(Q6r,{fontSize:"small"}):(0,xXe.jsx)(K6r,{fontSize:"small"})}var J6r=k(I(),1),eLr=nt((0,J6r.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 AU=k(I(),1);function tLr({onClose:e}){let t=Kr();return(0,AU.jsxs)(un,{onClick:()=>{e(),t("/connect-mobile")},children:[(0,AU.jsx)(r1,{children:(0,AU.jsx)(eLr,{fontSize:"small"})}),(0,AU.jsx)(Nd,{children:"Connect mobile"})]})}var rLr=k(I(),1),nLr=nt((0,rLr.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 PU=k(I(),1);function oLr(){let e=gbe();return(0,PU.jsxs)(un,{onClick:()=>c2t(!e),children:[(0,PU.jsx)(r1,{children:(0,PU.jsx)(nLr,{fontSize:"small"})}),(0,PU.jsx)(Nd,{children:e?"Hide render HUD":"Show render HUD"})]})}var Ys=k(I(),1);function iLr({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)(Z6r,{mode:e})}),(0,Ys.jsx)(Nd,{children:"Toggle dark mode"})]},"color-mode"),(0,Ys.jsx)(oLr,{},"render-hud"),(0,Ys.jsxs)(un,{onClick:o,children:[(0,Ys.jsx)(r1,{children:(0,Ys.jsx)(V6r,{fontSize:"small"})}),(0,Ys.jsx)(Nd,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,Ys.jsx)(tLr,{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)(eM,{fontSize:"small"})}),(0,Ys.jsx)(Nd,{children:t})]},"restart"),(0,Ys.jsxs)(un,{onClick:s,children:[(0,Ys.jsx)(r1,{children:(0,Ys.jsx)(j6r,{fontSize:"small"})}),(0,Ys.jsx)(Nd,{children:r})]},"update")]}var aLr=k(oe(),1);var lLr=k(I(),1);function sLr({peer:e,onRestart:t,onClose:r}){let[n,o]=(0,aLr.useState)(!1);return(0,lLr.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 xyo=Object.keys(j8);function uLr(){let e=Y8();return cLr(xyo.map(t=>_w(t,e)))}var rm=k(I(),1),Syo={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},Tyo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function fLr({onClose:e}){let t=uLr();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:Syo,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:Tyo,children:[(0,rm.jsx)(Ee,{variant:"body2",children:n.label}),(0,rm.jsx)(_t,{direction:"row",spacing:.5,children:(0,rm.jsx)(Bae,{chords:n.chords})})]},n.label))]},r.name))})]})}var NL=k(I(),1);function dLr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:o,restart:i}=y5(XH.target,e);return(0,NL.jsxs)(NL.Fragment,{children:[(0,NL.jsx)(Io,{title:XH.label,message:XH.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{i()},onCancel:t}),(0,NL.jsx)(sl,{error:n,onClose:o})]})}var hLr=k(I(),1);function Cyo(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 pLr({peer:e,onConfirm:t,onClose:r}){return(0,hLr.jsx)(Io,{...Cyo(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var Ly=k(oe(),1);async function wyo(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 mLr(e,t){let r=await wyo(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var YT=k(oe(),1);function gLr(e){let{nodes:t}=il(),[r,n]=(0,YT.useState)(null),o=(0,YT.useRef)(!1),i=r?t?.links.find(l=>l.name===r.peer):void 0;(0,YT.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,YT.useCallback)((l,u)=>{o.current=!1,n({peer:l,describe:u})},[]),s=(0,YT.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var kyo=9e4;function ETe(){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}=gLr(i);(0,Ly.useEffect)(()=>()=>clearTimeout(o.current),[]);let l=(0,Ly.useCallback)(async(f,d)=>{n(await mLr(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`)},kyo),!0):(await l(f,`${d} failed (${await m5(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var _yo=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function yLr(){let{requestThenAwait:e,...t}=ETe();return{restart:n=>e(n,`Restart ${n}`,()=>g5("both",n),_yo),...t}}var zee=k(oe(),1);function RTe(e){return Jt(Vr("/api/self-update",e),{method:"POST",timeoutMs:66e4})}var Iy=k(oe(),1);function vLr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function ATe(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(vLr).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=>vLr(p)&&p.node===r&&!u.current.has(p.id))&&a(!0)},[n,i,t,e,r]),{arm:f,completed:i}}var bLr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function xLr(e){let{nodes:t}=il(),{launchAssist:r}=_l(),{requestThenAwait:n,...o}=ETe(),[i,a]=(0,zee.useState)(null),[s,l]=(0,zee.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=ATe(e,u(s)!=="connected",s);(0,zee.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>g5("webserver",s),bLr))},[d,s,n]);let p=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>RTe(m),bLr),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 SLr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:o}){let{launchAssist:i,armUpdateReload:a}=_l(),s=yLr(),l=xLr(r);return(0,My.jsxs)(My.Fragment,{children:[e==="shortcuts"&&(0,My.jsx)(fLr,{onClose:o}),e==="restart"&&t&&(0,My.jsx)(sLr,{peer:t,onRestart:s.restart,onClose:o}),e==="restart"&&!t&&(0,My.jsx)(dLr,{reconnecting:n,onClose:o}),e==="update"&&(0,My.jsx)(pLr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),i(["update"])},onClose:o}),(0,My.jsx)(QJ,{notices:s}),(0,My.jsx)(QJ,{notices:l})]})}var TLr=k(I(),1),CLr=nt((0,TLr.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 PTe=k(I(),1),Eyo="https://staffordwilliams.com/assist";function wLr(){return(0,PTe.jsx)(rr,{title:"Help",children:(0,PTe.jsx)(Vt,{component:"a",href:Eyo,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,PTe.jsx)(CLr,{fontSize:"small"})})})}var kLr=k(I(),1),_Lr=nt((0,kLr.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 ELr=k(oe(),1);var Hee=k(I(),1);function RLr(){let e=Kr(),t=(0,ELr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=to("openConfig");return Bi(r,t),(0,Hee.jsx)(rr,{describeChild:!0,title:(0,Hee.jsx)(of,{label:"Config",chords:n}),children:(0,Hee.jsx)(Vt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,Hee.jsx)(_Lr,{fontSize:"small"})})})}var ALr=k(I(),1),PLr=nt((0,ALr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var LTe=k(oe(),1);var Uee=k(I(),1);function LLr({open:e,onOpen:t}){let r=(0,LTe.useRef)(null),{matches:n,chords:o}=to("openMenu");return Bi(n,(0,LTe.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,Uee.jsx)(rr,{describeChild:!0,title:(0,Uee.jsx)(of,{label:"Menu",chords:o}),children:(0,Uee.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,Uee.jsx)(PLr,{fontSize:"small"})})})}var LU=k(I(),1);function ILr({open:e,onOpen:t}){return(0,LU.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,LU.jsx)(wLr,{}),(0,LU.jsx)(RLr,{}),(0,LU.jsx)(LLr,{open:e,onOpen:t})]})}var OL=k(oe(),1);var DLr=k(oe(),1);var MLr=!0,Ryo=new Set(["openMenu","cycleCards"]),Ayo=Object.keys(j8).filter(e=>!Ryo.has(e));function NLr(e,t){let r=Y8();(0,DLr.useEffect)(()=>{if(!e)return;let n=o=>{Ayo.some(i=>_w(i,r).matches(o))&&t()};return globalThis.addEventListener("keydown",n,MLr),()=>globalThis.removeEventListener("keydown",n,MLr)},[e,t,r])}function OLr(){let[e,t]=(0,OL.useState)(null),[r,n]=(0,OL.useState)(!0),o=!!e,i=(0,OL.useCallback)(()=>t(null),[]),a=(0,OL.useCallback)(s=>{n(!0),t(s)},[]);return NLr(o,(0,OL.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:o,close:i,openAt:a,restoreFocus:r}}var Wee=k(oe(),1);function BLr(e){Bi(to("shortcutsSheet").matches,e)}function FLr(){let[e,t]=(0,Wee.useState)(null);BLr((0,Wee.useCallback)(()=>t("shortcuts"),[]));let r=(0,Wee.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function $Lr(){let{nodes:e,selected:t}=il();return e&&t&&t!==e.local?t:void 0}function zLr(e){return{restartLabel:e?`Restart ${e}`:XH.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var KT=k(I(),1);function HLr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:o,open:i,close:a,openAt:s,restoreFocus:l}=OLr(),{dialog:u,showDialog:f,closeDialog:d}=FLr(),p=$Lr(),h=m=>()=>{a(),f(m)};return(0,KT.jsxs)(KT.Fragment,{children:[(0,KT.jsx)(ILr,{open:i,onOpen:s}),(0,KT.jsxs)(Js,{anchorEl:o,open:i,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,KT.jsx)(U6r,{}),iLr({mode:e,...zLr(p),onToggleColorMode:()=>{t(),a()},onShowShortcuts:h("shortcuts"),onConnectMobile:a,onRestart:h("restart"),onUpdate:h("update")})]}),(0,KT.jsx)(SLr,{dialog:u,peer:p,sessions:r,reconnecting:n,onClose:d})]})}var GLr=k(oe(),1);var WLr=k(I(),1);function ULr({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,WLr.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 ITe=k(I(),1);function VLr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:o,stopSession:i,startRun:a,discardSession:s}=e,l=(0,GLr.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,ITe.jsxs)(d3e.Provider,{value:l,children:[t,r&&(0,ITe.jsx)(ULr,{conflict:r,onConfirm:u,onCancel:n})]})}var qLr=new Map;function jLr(e,t){if(!Gle())return;let r=qLr.get(e);if(qLr.set(e,t),!!r)for(let[n,o]of Object.entries(t))Object.is(o,r[n])||E1(`\u0394 ${e}.${n}`)}var DTe=k(oe(),1);function YLr(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 MTe(){let{pathname:e}=ii();return e.startsWith("/backlog")||e.startsWith("/usage")}function KLr({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=YLr(o,e,r),f=(0,DTe.useRef)(t),d=MTe();(0,DTe.useEffect)(()=>{let p=f.current!==t&&!!s;f.current=t,!(d||p||l||!u)&&i(u)},[t,s,l,u,i,d])}var BTe=k(oe(),1);function XLr(e,t,r,n){return $b(e,t,r)?.cwd||n}function QLr(e,t,r,n){let o=XLr(e,t,r,n.cwd),i=$b(e,t,r);return{cwd:o,node:i?.cwd?i.node:n.node}}var SXe=k(oe(),1);function ZLr(e,t,r){let{cwd:n,node:o,origin:i}=r,a=(0,SXe.useCallback)((l,u)=>{let f=Dp(u,t),d=See(e,l);return d?d.clones[f]:f===(l===n?o:Ad)?l:void 0},[e,t,n,o]),s=(0,SXe.useCallback)(l=>See(e,l)?.origin??(l===n?i:void 0),[e,n,i]);return{cloneOn:a,originOf:s}}var NTe=k(oe(),1);function JLr(e,t,r,n){let o=(0,NTe.useRef)(e);(0,NTe.useEffect)(()=>{if(o.current===e)return;o.current=e;let i=See(t,r)?.clones[e];i&&n(i,e)},[e,t,r,n])}var IU=k(oe(),1);function eIr(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 tIr(e,t,r,n){let[o,i]=(0,IU.useState)({cwd:e}),a=(0,IU.useCallback)((l,u,f)=>i({cwd:l,node:u,origin:f}),[]);(0,IU.useEffect)(()=>{e&&!o.cwd&&i({cwd:e})},[e,o.cwd]);let s=eIr(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 rIr=k(oe(),1);function OTe(e,t,r){let n=$b(e,t,r);return n&&ol(n)}function nIr(e,t,r,n){let o=OTe(e,t,r),i=$b(e,t,r),a=i?.node??Ad,s=i?.repoGroup?.origin;(0,rIr.useEffect)(()=>{o&&n(o,a,s)},[o,a,s,n])}function oIr(e,t,r,n,o){let i=o.nodes?.local,a=Dp(o.selected,i),s=(0,BTe.useMemo)(()=>k5(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=tIr(e,s,a,i);nIr(r,n,t,d),JLr(a,s,l,d);let{cloneOn:p,originOf:h}=ZLr(s,i,f),m=(0,BTe.useMemo)(()=>s.map(v=>d3r(v,a)),[s,a]),{cwd:g,node:y}=QLr(r,n,t,{cwd:l,node:u});return(0,BTe.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 $Te=k(oe(),1);var H5=k(oe(),1);var iIr=k(oe(),1),FTe="assist:reloaded-after-update";function aIr(e){(0,iIr.useEffect)(()=>{globalThis.sessionStorage?.getItem(FTe)&&(globalThis.sessionStorage.removeItem(FTe),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function sIr(e,t,r,n){let{arm:o,completed:i}=ATe(e,t),a=(0,H5.useRef)(!1),s=(0,H5.useCallback)(()=>{globalThis.sessionStorage?.setItem(FTe,"1")},[]),{error:l,restart:u}=y5("webserver",t,s);return aIr(r),(0,H5.useEffect)(()=>{l&&n(l)},[l,n]),(0,H5.useEffect)(()=>{!i||a.current||(a.current=!0,u())},[i,u]),{armUpdateReload:(0,H5.useCallback)(()=>{a.current=!1,o()},[o])}}function lIr(e){let{armUpdateReload:t}=sIr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=b1(e.selectSession),n=(0,$Te.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,$Te.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 uIr(e,t,r,n){let o=OTe(e,t,r);(0,cIr.useEffect)(()=>{e&&o&&n({type:"set-active",cwd:o,sessionId:e})},[e,o,n])}var zTe=k(oe(),1);function fIr(e,t){let r=(0,zTe.useRef)(new Map);(0,zTe.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 MU=k(oe(),1),dIr="assist.sessions.node";function Pyo(){try{return localStorage.getItem(dIr)}catch{return null}}function Lyo(e){try{localStorage.setItem(dIr,e)}catch{}}function pIr(e){let[t,r]=(0,MU.useState)(Pyo),n=(0,MU.useCallback)(o=>{r(o),Lyo(o)},[]);return(0,MU.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 mIr=k(oe(),1);function hIr(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 gIr(e,t){return(0,mIr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let o=hIr(r);o&&t(o)},[e,t])}var zb=k(oe(),1);function HTe(e,t,r,n,o){e({type:"create",prompt:r||void 0,cwd:n,...t,...o?{node:o}:{}})}function yIr(e){return(t,r,n)=>HTe(e,{design:!0},t,r,n)}function vIr(e){return(t,r,n,o)=>HTe(e,{harness:t},r,n,o)}function bIr(e){return(t,r,n)=>HTe(e,{auto:!0},t,r,n)}function xIr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function SIr(e){return(t,r,n,o,i)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:o,node:i})}function TIr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function CIr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function wIr(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function kIr(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function _Ir(e){return t=>e({type:"stop",sessionId:t})}function EIr(e){return(t,r,n,o,i)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:o,node:i})}function RIr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function AIr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function PIr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function LIr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:aL})}function IIr(e){return(t,r,n,o)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:aL,claim:o==="claim",refresh:o==="refresh"})}function MIr(e){return(t,r,n,o)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...o})}var BL=k(oe(),1);function DIr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function NIr(e){return{createSession:(0,BL.useMemo)(()=>bIr(e),[e]),createSessionInStream:(0,BL.useMemo)(()=>DIr(e),[e]),createDesignSession:(0,BL.useMemo)(()=>yIr(e),[e]),createHarnessSession:(0,BL.useMemo)(()=>vIr(e),[e]),createAssistSession:(0,BL.useMemo)(()=>xIr(e),[e]),resumeSession:(0,BL.useMemo)(()=>SIr(e),[e])}}var Gee=k(oe(),1);function OIr(e,t){let r=(0,Gee.useCallback)((a,s)=>{TIr(e,t.current)(a,s)},[e,t]),n=(0,Gee.useCallback)(a=>{CIr(e,t.current)(a)},[e,t]),o=(0,Gee.useCallback)(a=>{wIr(e,t.current)(a)},[e,t]),i=(0,Gee.useCallback)(a=>{kIr(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:o,discardSession:i}}function BIr(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 FIr(e,t,r){let n={...NIr(e),sendInput:(0,zb.useMemo)(()=>LIr(e),[e]),sendResize:(0,zb.useMemo)(()=>IIr(e),[e]),sendPrDecision:(0,zb.useMemo)(()=>MIr(e),[e]),setAutoApprove:(0,zb.useMemo)(()=>RIr(e),[e]),setAutoAdvance:(0,zb.useMemo)(()=>AIr(e),[e]),setStarred:(0,zb.useMemo)(()=>PIr(e),[e]),stopSession:(0,zb.useMemo)(()=>_Ir(e),[e]),startRun:(0,zb.useMemo)(()=>EIr(e),[e])},o=(0,zb.useMemo)(()=>BIr(e,t.current,r.current),[e,t,r]);return{...n,...OIr(e,t),onOutput:o}}var Vee=k(oe(),1);function $Ir(e,t,r){let n=(0,Vee.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),o=(0,Vee.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),i=(0,Vee.useCallback)(()=>{r(null)},[r]),a=(0,Vee.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:o,clearTranscript:i,selectSession:a}}var VTe=k(oe(),1);function zIr(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 DU=k(oe(),1);function HIr(){let[e,t]=(0,DU.useState)(null),r=(0,DU.useRef)(e);r.current=e;let n=(0,DU.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var WIr=k(oe(),1);function UIr(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 GIr(e,t,r){let n=MTe();(0,WIr.useEffect)(()=>{if(n){t(null);return}t(o=>UIr(e,o,r))},[e,t,r,n])}var UTe=k(oe(),1);function VIr(){let[e,t]=(0,UTe.useState)({}),[r,n]=(0,UTe.useState)(null),[o,i]=(0,UTe.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:o,setNodes:i}}var Dy=k(oe(),1);function qIr(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function jIr(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function YIr(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 KIr(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 XIr(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var Iyo=1500;function QIr(){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)},Iyo))},[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=jIr(r.current,s),u=[...KIr(r.current,s),...l],f=XIr(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),qIr(n.current,l),u.length&&t(d=>YIr(d,u)),i(f)},[i]);return{initialized:e,markInitialized:o,syncSessions:a}}var U5=k(oe(),1);function ZIr(){let[e,t]=(0,U5.useState)(null),[r,n]=(0,U5.useState)(null),[o,i]=(0,U5.useState)(null),a=(0,U5.useCallback)(()=>t(null),[]),s=(0,U5.useCallback)(()=>n(null),[]),l=(0,U5.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 JIr(e,t){return[...e,{...t,status:"launching"}]}function WTe(e){return e.find(t=>t.status==="launching")}function e7r(e){let t=WTe(e);return t?e.filter(r=>r.id!==t.id):e}function t7r(e,t){let r=WTe(e);return r?TXe(e,r.id,t):e}function TXe(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function r7r(e,t){return e.filter(r=>r.id!==t)}var n7r=k(oe(),1);var Myo=6e4,Dyo="Launch timed out \u2014 the session did not start.";function o7r(e,t){(0,n7r.useEffect)(()=>{let r=e.filter(o=>o.status==="launching");if(r.length===0)return;let n=r.map(o=>setTimeout(()=>t(i=>TXe(i,o.id,Dyo)),Math.max(0,Myo-(Date.now()-o.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function i7r(){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=>JIr(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),i=(0,Hb.useCallback)(()=>{let l=WTe(r.current);return n(e7r),l?.named?l.title:void 0},[n]),a=(0,Hb.useCallback)(l=>n(u=>t7r(u,l)),[n]),s=(0,Hb.useCallback)(l=>n(u=>r7r(u,l)),[n]);return o7r(e,n),{pendingLaunches:e,addPendingLaunch:o,resolvePendingLaunch:i,failPendingLaunch:a,dismissPendingLaunch:s}}var qee=k(oe(),1);function a7r(){let[e,t]=(0,qee.useState)(null),[r,n]=(0,qee.useState)({}),o=(0,qee.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 l7r(e,t){return(0,s7r.useCallback)(r=>{e(r),t(r)},[e,t])}var CXe=k(oe(),1);function c7r(){let e=(0,CXe.useRef)(new Map),t=(0,CXe.useRef)(new Map);return{buffers:e,handlers:t}}var GTe=k(oe(),1);function u7r(){let[e,t]=(0,GTe.useState)(null),[r,n]=(0,GTe.useState)(null),[o,i]=(0,GTe.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:o,setUserMessages:i}}var W5=k(oe(),1);function f7r(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function d7r(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 p7r(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function h7r(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function m7r(e,t){t.setNodes({local:e.local,links:e.links??[]})}function g7r(e,t){t.setSuccess({message:e.message,sessionId:null})}function y7r(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 v7r(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function b7r(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function x7r(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var Nyo={sessions:b7r,created:d7r,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:m7r,error:p7r,notice:g7r,inbox:()=>{Es.refresh(),Es.refreshStatus()},"inbox-activity":()=>{Es.refreshStatus()},"run-conflict":v7r,limits:h7r,clear:f7r,output:y7r,snapshot:x7r};function S7r(e,t){Nyo[e.type]?.(e,t)}function T7r(e,t={}){let r=new WebSocket(Oft("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{S7r(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function C7r(e,t,r,n){let o=!1,i,a=0,s=!1,l=()=>{o||t(T7r(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 w7r(e){let t=(0,W5.useRef)(null),[r,n]=(0,W5.useState)(!1),{handleSessions:o,markInitialized:i,buffers:a,handlers:s}=e;(0,W5.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let p of d.values())p("\x1Bc")},f=C7r({...e,setSessions:o},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[o,i,a,s]);let l=(0,W5.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function k7r(){let[e,t]=(0,VTe.useState)([]),[r,n]=(0,VTe.useState)([]),{activeId:o,setActiveId:i,getActiveId:a}=HIr(),s=VIr(),l=u7r(),[u,f]=(0,VTe.useState)(""),d=ZIr(),p=i7r(),h=a7r(),{initialized:m,markInitialized:g,syncSessions:y}=QIr(),v=c7r(),b=l7r(y,t),{wsRef:x,requestHistory:T,reconnecting:C}=w7r({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:i,...s,...l,setCurrentCwd:f,...d,...p,...h,markInitialized:g,...v});return GIr(e,i,zIr(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 qTe(){let e=k7r(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:o,activeId:i,sessions:a}=e,s=pIr(e.nodes),l=gIr(t,o),u=FIr(l,r,n);uIr(i,a,e.history,l),fIr(a,l);let f=$Ir(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var NU=k(oe(),1);var _7r="assist:sidebar-collapsed";function E7r(){let[e,t]=(0,NU.useState)(()=>Tf(_7r).length>0),r=(0,NU.useCallback)(()=>{t(n=>{let o=!n;return Cf(_7r,o?[!0]:[]),o})},[]);return(0,NU.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var R7r=k(oe(),1);function A7r(){(0,R7r.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await Jt("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||N3.set(r)}catch(t){Cr(t,"hotkey bindings")}})(),()=>{e=!0}},[])}function P7r(){let e=qTe(),t=bve(e),r=oIr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);KLr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:o}=lIr(e);A7r();let i=E7r();return jLr("shell",{...e,selection:r,launch:n,sidebarCollapse:i}),{socket:e,selection:r,launch:n,viewLaunchedSession:o,sidebarCollapse:i}}var jg=k(I(),1),Oyo={zIndex:e=>e.zIndex.drawer+1},Byo={minHeight:48};function L7r({mode:e,toggle:t}){let r=P7r(),{socket:n,selection:o,viewLaunchedSession:i}=r;return(0,jg.jsx)(t6r,{shell:r,children:(0,jg.jsxs)(sXe.Provider,{value:n.daemonVersion,children:[(0,jg.jsx)(HLr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,jg.jsx)(nke,{position:"fixed",sx:Oyo,"data-testid":"toolbar",children:(0,jg.jsx)(z6r,{socket:n,selection:o})}),(0,jg.jsx)(o3,{variant:"dense",sx:Byo}),(0,jg.jsx)(VLr,{socket:n,children:(0,jg.jsx)(GRr,{socket:n})}),(0,jg.jsx)(NAr,{socket:n}),(0,jg.jsx)(e6r,{socket:n,onViewLaunchedSession:i})]})})}function D7r(e){return e instanceof Error?e.message:String(e)}function Fyo(e){return e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:""}function I7r(e){rq(e.error)||(L3(e.error),nq("error",`${e.message||D7r(e.error)}${Fyo(e)}`))}function M7r(e){rq(e.reason)||(L3(e.reason),nq("rejection",D7r(e.reason)))}function N7r(){return globalThis.addEventListener("error",I7r),globalThis.addEventListener("unhandledrejection",M7r),()=>{globalThis.removeEventListener("error",I7r),globalThis.removeEventListener("unhandledrejection",M7r)}}var O7r=k(oe(),1);function B7r(){let[e,t]=(0,O7r.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 F7r({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 $7r(e){let{color:t,radius:r,elevation:n,type:o}=e,i={border:`1px solid ${t.line}`};return{...F7r(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 z7r=({variant:e})=>e==="outlined"||e==="tonal",H7r=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:z7r,style:{padding:"5px 11px"}},{props:e=>z7r(e)&&e.size==="small",style:{padding:"3px 8px"}}];var jTe=["primary","secondary","success","warning","error","info"];function jee(e,t){return{backgroundColor:Dr(e,t),borderColor:Dr(e,.35),color:e}}function U7r({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}}},...jTe.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...jee(e[t].main,.16),"&:hover":jee(e[t].main,.24)}}))]}var W7r={"& > *:nth-of-type(1)":{fontSize:16}};function G7r(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,...W7r},endIcon:{marginLeft:6,marginRight:-2,...W7r}},variants:[...H7r,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...U7r(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 wXe({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}}},...jTe.map(r=>({props:{variant:t,color:r},style:{...jee(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 V7r(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:[...wXe(e,"tonal"),...wXe(e,"filled")]}}}function q7r(e){return{...G7r(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...V7r(e)}}var kXe=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,$yo={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:kXe(8)},"&.Mui-selected":{color:"inherit",backgroundColor:kXe(12),boxShadow:`inset 0 0 0 1px ${kXe(18)}`}}};function j7r({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&&$yo}}}}}var Y7r=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function K7r({color:e,radius:t,density:r}){let{side:n,icon:o,smallSide:i,smallIcon:a}=r.iconButton;return{MuiIconButton:{styleOverrides:{root:{...Y7r(n,o),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:Y7r(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 X7r({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 YTe=".MuiOutlinedInput-notchedOutline";function Q7r({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,[`& ${YTe}`]:{borderColor:e.line},[`&:hover ${YTe}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${YTe}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${YTe}`]:{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 Z7r({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 J7r(e){let{appBar:t}=e.color;return{...$7r(e),...q7r(e),...K7r(e),...X7r(e),...Q7r(e),...Z7r(e),...j7r(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",_Xe="#141820",KTe="#1b202a",XTe="#e3e7ee",EXe="#8a93a3",Yee="#8b9cff",QTe="#5fd0a0",ZTe="#f2b45a",JTe="#f27a7a",e8r={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)"},eCe={dark:{color:{background:Ub,surface:_Xe,raised:KTe,line:"#262c37",lineSoft:"#1d222b",text:{primary:XTe,secondary:EXe,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:KTe,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:KTe,text:XTe},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:_Xe,text:XTe},onAppBar:{...e8r,secondary:EXe,level:{ok:QTe,warn:ZTe,over:JTe}},statusBar:{background:_Xe,text:EXe,hoverText:XTe,secondary:"#5c6473",hover:KTe,active:"transparent",dot:Yee,dotRing:"rgba(139, 156, 255, 0.14)",readyText:Yee,level:{ok:QTe,warn:ZTe,over:JTe}},primary:{main:Yee,contrastText:Ub},secondary:{main:"#c99bff",contrastText:Ub},success:{main:QTe,contrastText:Ub},warning:{main:ZTe,contrastText:Ub},error:{main:JTe,contrastText:Ub},info:{main:"#6cb6ff",contrastText:Ub}},terminal:{background:Ub,foreground:"#d6dbe4",cursor:Yee,cursorAccent:Ub,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:JTe,green:QTe,yellow:ZTe,blue:Yee,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:{...e8r,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 XT=e=>`${e/16}rem`;function t8r({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:XT(r.button)},caption:{fontSize:XT(r.caption)},body2:{fontSize:XT(r.body2)},body1:{fontSize:XT(r.body1)},subtitle2:{fontSize:XT(r.subtitle2)},subtitle1:{fontSize:XT(r.subtitle1)},h6:{fontSize:XT(r.h6)},h5:{fontSize:XT(r.h5)},h4:{fontSize:XT(r.h4)}}}function r8r(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function zyo(e,t){let{dark:r,light:n,densities:o,...i}=eCe;return{...i,...e==="dark"?r:n,mode:e,density:o[t]}}function n8r(e,t="desktop"){let r=zyo(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:t8r(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...r8r(r),...J7r(r)}})}function o8r(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=eCe;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var SMr=k(oe(),1);var G5=k(I(),1);function i8r({status:e,onClose:t}){return(0,G5.jsxs)(G5.Fragment,{children:[(0,G5.jsx)(hu,{open:e.kind==="probing",children:(0,G5.jsx)(jn,{severity:"info",variant:"filled",children:e.kind==="probing"?`Connecting to ${e.name}\u2026`:""})}),(0,G5.jsx)(sl,{error:e.kind==="error"?e.message:null,onClose:t})]})}var rCe=k(oe(),1);var Hyo=/^\d+(\.\d+){3}$/;function FL(e){try{let{hostname:t}=new URL(e);return Hyo.test(t)?t:t.split(".")[0]}catch{return""}}var Uyo=/^[a-z]+:[/]{2}/i;function tCe(e){let t=e.trim(),r=Uyo.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 Wyo(e){try{return new URL(e)}catch{return}}function Gyo(e){return e.protocol==="assist:"&&e.hostname==="add-node"&&(e.pathname===""||e.pathname==="/")}function a8r(e){let t=Wyo(e);if(!t||!Gyo(t))return{ok:!1,error:`Not an assist add-node link: ${e}`};let r=t.searchParams.get("url"),n=r?tCe(r):void 0;return n?{ok:!0,node:{name:t.searchParams.get("name")?.trim()||FL(n),url:n}}:{ok:!1,error:`The link has no valid node URL: ${r??"(missing)"}`}}var s8r=5e3,l8r="/api/health";async function Vyo(e){let t=new AbortController,r=setTimeout(()=>t.abort(),s8r);try{let n=await fetch(`${e}${l8r}`,{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 V5(e){let t=Date.now(),r=await Vyo(e);return r.ok||B8({at:new Date(t).toISOString(),method:"GET",path:l8r,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=a8r(e);if(!r.ok)return r;let{node:n}=r;t(n);let o=await V5(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}`}}$L();var IXe=ZT("App",{web:()=>Promise.resolve().then(()=>(m8r(),h8r)).then(e=>new e.AppWeb)});var BU=k(oe(),1);var Jyo=5e3;function g8r(e){let t=(0,BU.useRef)(e),r=(0,BU.useRef)(void 0);(0,BU.useEffect)(()=>{t.current=e},[e]),(0,BU.useEffect)(()=>{let n=i=>{let a=Date.now(),s=r.current?.url===i&&a-r.current.at<Jyo;r.current={url:i,at:a},s||t.current(i)},o=IXe.addListener("appUrlOpen",({url:i})=>n(i));return IXe.getLaunchUrl().then(i=>{i?.url&&n(i.url)}).catch(i=>Cr(i,"launch url")),()=>{o.then(i=>i.remove())}},[])}function y8r(e){let[t,r]=(0,rCe.useState)({kind:"idle"});g8r(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,rCe.useCallback)(()=>r({kind:"idle"}),[]);return{status:t,dismiss:n}}var Qee=k(I(),1);function v8r({name:e}){return(0,Qee.jsxs)(V,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,Qee.jsx)(bo,{size:28}),(0,Qee.jsxs)(Ee,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var nCe=k(oe(),1),MXe=(0,nCe.createContext)(null);function q5(){return(0,nCe.useContext)(MXe)}var Ks={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var x8r=k(I(),1);function b8r({value:e,error:t,onChange:r}){return(0,x8r.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 Zee=k(oe(),1);function S8r(e,t){let[r,n]=(0,Zee.useState)(e?.url??""),[o,i]=(0,Zee.useState)(e?.name),[a,s]=(0,Zee.useState)(),[l,u]=(0,Zee.useState)(!1),f=tCe(r),d=o??(f?FL(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()||FL(f),url:f});u(!1),s(g)}}}var FU=k(I(),1);function oCe({initial:e,submitLabel:t,onSubmit:r,children:n}){let o=S8r(e,r);return(0,FU.jsxs)(_t,{component:"form",spacing:2,onSubmit:o.submit,children:[(0,FU.jsx)(b8r,{value:o.url,error:o.error,onChange:o.changeUrl}),(0,FU.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,FU.jsx)(Tt,{type:"submit",variant:"contained",size:"large",disabled:!o.url.trim()||o.busy,children:o.busy?"Checking\u2026":t}),n]})}var JT=k(I(),1),e1o={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"},t1o={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 T8r({onConnect:e}){return(0,JT.jsx)(V,{sx:e1o,children:(0,JT.jsxs)(_t,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,JT.jsx)(V,{sx:t1o,children:">_"}),(0,JT.jsx)(Ee,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,JT.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,JT.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,JT.jsx)(oCe,{submitLabel:"Connect",onSubmit:async r=>{let n=await V5(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),r1o={flex:"none",pt:Ks.top,bgcolor:"background.default"},n1o={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},o1o={height:e=>e.tokens.density.bar,display:"flex",alignItems:"center",gap:.5,px:.5},i1o={textAlign:"center",minWidth:0,maxWidth:220,fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},a1o={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:r1o,children:n?(0,Ny.jsxs)(V,{sx:o1o,children:[(0,Ny.jsx)(V,{sx:{flex:"none"},children:e}),(0,Ny.jsx)(V,{component:"h1",sx:[a1o,{m:0}],children:t}),(0,Ny.jsx)(V,{sx:{flex:"none",display:"flex"},children:r})]}):(0,Ny.jsxs)(V,{sx:n1o,children:[(0,Ny.jsx)(V,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,Ny.jsx)(V,{sx:i1o,children:t}),(0,Ny.jsx)(V,{sx:{justifySelf:"end",display:"flex",gap:.25},children:r})]})})}var Wb=e=>e.tokens.color.raised;var C8r=k(I(),1),s1o={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,C8r.jsx)(V,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:s1o[e]}})}var ic=e=>e.tokens.density.target;var $U=k(I(),1),l1o={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"},c1o={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function iCe({name:e,tone:t,onClick:r}){return(0,$U.jsxs)(ir,{sx:l1o,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,$U.jsx)(Yg,{tone:t}),(0,$U.jsx)(V,{component:"span",sx:c1o,children:e??"\u2026"}),r&&(0,$U.jsx)(ea,{sx:{fontSize:16,flex:"none"}})]})}var tMr=k(oe(),1);var aCe=k(I(),1);function w8r({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,aCe.jsx)(V,{sx:{px:2.5,pt:1},children:(0,aCe.jsx)(oCe,{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,aCe.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 k8r=k(I(),1),u1o={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function zU(){return(0,k8r.jsx)(V,{sx:u1o})}var eC=k(I(),1),f1o={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},d1o={color:"primary.main",fontSize:16,minHeight:ic,px:.5,borderRadius:1};function HU({title:e,actionLabel:t,onAction:r}){return(0,eC.jsxs)(eC.Fragment,{children:[(0,eC.jsx)(zU,{}),(0,eC.jsxs)(V,{sx:f1o,children:[(0,eC.jsx)(V,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,eC.jsx)(ir,{sx:d1o,onClick:r,children:t})]})]})}var zL=k(I(),1);function _8r({homeNode:e,node:t,onDone:r}){return(0,zL.jsxs)(zL.Fragment,{children:[(0,zL.jsx)(HU,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,zL.jsx)(w8r,{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 E8r(e,t){return e.replace(/\/+$/,"")===t.replace(/\/+$/,"")}function UU(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 R8r(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?UU(e.peerVersion,r):0;return{text:o.filter(Boolean).join(" \xB7 "),drift:i<0?"behind":i>0?"ahead":void 0}}var sCe={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var DXe=k(I(),1);function A8r({name:e,onSave:t}){return(0,DXe.jsx)(Vt,{"aria-label":`Save ${e} as a home node`,onClick:t,sx:{color:"primary.main",borderRadius:0},children:(0,DXe.jsx)(qd,{fontSize:"small"})})}var tC=k(I(),1),p1o={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function P8r({links:e,sessions:t,homeVersion:r,isSaved:n,onSave:o}){return(0,tC.jsx)(V,{sx:Ar.group,children:e.map(i=>{let{text:a,drift:s}=R8r(i,t,r);return(0,tC.jsxs)(V,{sx:[Ar.item,{pr:0}],children:[(0,tC.jsx)(Yg,{tone:sCe[i.state]}),(0,tC.jsxs)(V,{component:"span",sx:Ar.grow,children:[i.name,(0,tC.jsx)(V,{component:"span",sx:Ar.detail,children:a})]}),s&&(0,tC.jsx)(V,{component:"span",sx:p1o,children:s}),!n(i.url)&&(0,tC.jsx)(A8r,{name:i.name,onSave:()=>o(i)})]},i.name)})})}var Gb=k(I(),1);function WU({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 I8r=k(I(),1);function L8r({rateLimits:e,harnessRateLimits:t}){let r=Ug(3e4),n=ZSe(e,t).flatMap(o=>rTe(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 ${tU(i.resetsAt,r)}`:`${Math.round(i.pct)}%`,color:cSe(wb(i.pct,i.resetsAt,i.windowSeconds,r))})));return n.length===0?null:(0,I8r.jsx)(WU,{title:"Rate limits",rows:n})}var Vb=k(I(),1);function M8r({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)(P8r,{links:n,sessions:e.sessions,homeVersion:t,isSaved:o=>r.nodes.some(i=>E8r(i.url,o)),onSave:({name:o,url:i})=>r.saveNode("",{name:o,url:i})})]}),(0,Vb.jsx)(L8r,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var h1o={ok:"ok",ready:"warn",diverged:"warn",retrying:"warn",paused:"off",off:"off",loading:"off",unavailable:"error"};function lCe(e,t){let r=zg(e),{status:n}=e,o=!!n&&!!t&&UU(t,n.built)>0,i=h5(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":h1o[r.kind],detail:[a,s].filter(Boolean).join(" \xB7 "),updateAvailable:o,restartPending:i}}var nm=k(I(),1);function D8r({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=lCe(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 Jee=k(I(),1);function cCe({onAdd:e}){return(0,Jee.jsxs)(ir,{sx:Ar.item,onClick:e,children:[(0,Jee.jsx)(qd,{sx:{color:"primary.main"}}),(0,Jee.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 uCe(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 fCe=k(oe(),1);var m1o=15e3;function dCe(e){let[t,r]=(0,fCe.useState)({}),n=e.join(`
|
|
4025
4025
|
`);return(0,fCe.useEffect)(()=>{if(!n)return;let o=!1,i=()=>{for(let s of n.split(`
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.1013.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2886,7 +2886,8 @@ var gitRefKindSchema = z7.enum([
|
|
|
2886
2886
|
"pr",
|
|
2887
2887
|
"slack",
|
|
2888
2888
|
"session",
|
|
2889
|
-
"docs-unlock"
|
|
2889
|
+
"docs-unlock",
|
|
2890
|
+
"design"
|
|
2890
2891
|
]);
|
|
2891
2892
|
var gitRefSchema = z7.strictObject({
|
|
2892
2893
|
kind: gitRefKindSchema,
|
|
@@ -16293,7 +16294,7 @@ function errorMessage2(error) {
|
|
|
16293
16294
|
function registerActivityCommands(cmd) {
|
|
16294
16295
|
internalCommand(
|
|
16295
16296
|
cmd.command("add-activity <id> <kind> <ref>").description(
|
|
16296
|
-
"Attach an activity ref (branch|commit|pr|slack|session) to a backlog item"
|
|
16297
|
+
"Attach an activity ref (branch|commit|pr|slack|session|design) to a backlog item"
|
|
16297
16298
|
).option("--title <title>", "Title metadata for the ref").option("--url <url>", "URL metadata (auto-filled for branch/commit)").option("--state <state>", "State metadata for the ref").action(addActivity),
|
|
16298
16299
|
"/draft and /bug"
|
|
16299
16300
|
);
|
|
@@ -20514,6 +20515,7 @@ function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
|
|
|
20514
20515
|
const commits2 = newestFirst2("commit");
|
|
20515
20516
|
return {
|
|
20516
20517
|
docsUnlocks: newestFirst2("docs-unlock"),
|
|
20518
|
+
designs: newestFirst2("design"),
|
|
20517
20519
|
branches: newestFirst2("branch"),
|
|
20518
20520
|
commits: commits2.slice(0, commitLimit),
|
|
20519
20521
|
overflowCommits: commits2.slice(commitLimit),
|
|
@@ -20534,7 +20536,7 @@ function refLabel(ref) {
|
|
|
20534
20536
|
const state = ref.state ? ` (${ref.state.toLowerCase()})` : "";
|
|
20535
20537
|
return `#${ref.ref}${title}${state}`;
|
|
20536
20538
|
}
|
|
20537
|
-
if (ref.kind === "slack" || ref.kind === "session" || ref.kind === "docs-unlock") {
|
|
20539
|
+
if (ref.kind === "slack" || ref.kind === "session" || ref.kind === "docs-unlock" || ref.kind === "design") {
|
|
20538
20540
|
return ref.title ?? ref.ref;
|
|
20539
20541
|
}
|
|
20540
20542
|
return ref.ref;
|
|
@@ -20549,6 +20551,7 @@ function printRef(ref) {
|
|
|
20549
20551
|
function printActivity(item, options2 = {}) {
|
|
20550
20552
|
const {
|
|
20551
20553
|
docsUnlocks,
|
|
20554
|
+
designs,
|
|
20552
20555
|
branches,
|
|
20553
20556
|
commits: commits2,
|
|
20554
20557
|
overflowCommits,
|
|
@@ -20561,6 +20564,7 @@ function printActivity(item, options2 = {}) {
|
|
|
20561
20564
|
);
|
|
20562
20565
|
const ordered = [
|
|
20563
20566
|
...docsUnlocks,
|
|
20567
|
+
...designs,
|
|
20564
20568
|
...branches,
|
|
20565
20569
|
...commits2,
|
|
20566
20570
|
...prs2,
|
|
@@ -20570,6 +20574,7 @@ function printActivity(item, options2 = {}) {
|
|
|
20570
20574
|
if (ordered.length === 0) return;
|
|
20571
20575
|
console.log(chalk109.bold("Activity"));
|
|
20572
20576
|
for (const unlock of docsUnlocks) printRef(unlock);
|
|
20577
|
+
for (const design of designs) printRef(design);
|
|
20573
20578
|
for (const branch2 of branches) printRef(branch2);
|
|
20574
20579
|
for (const commit2 of commits2) printRef(commit2);
|
|
20575
20580
|
if (overflowCommits.length > 0) {
|