import{b as t,n as _,e as E}from"./vendor-lit-BtHfzs80.js";import{au as v,aw as o,ax as g,av as L}from"./index-rvuS68Al.js";import{r as m}from"./delegate-cards-BUepigK_.js";import{$ as w,au as T,av as A,U as k,aq as h,aw as S,Z as R}from"./vendor-lucide-DBEJLfdn.js";import"./vendor-mini-lit-Cx886NBU.js";import"./vendor-marked-_iteVaMm.js";import"./vendor-sortable-B1o3v0Qs.js";function x(i){const n=i?.content?.filter(d=>d.type==="text").map(d=>d.text).join(`
`)||"";let e=null;try{e=JSON.parse(n)}catch{}return{text:n,data:e}}function b(i){const e={"team-lead":"bg-amber-500/20 text-amber-600 dark:text-amber-400",coder:"bg-blue-500/20 text-blue-600 dark:text-blue-400",reviewer:"bg-purple-500/20 text-purple-600 dark:text-purple-400",tester:"bg-green-500/20 text-green-600 dark:text-green-400"}[i]||"bg-muted text-muted-foreground";return t`<span class="px-1.5 py-0.5 rounded text-xs font-medium ${e}">${i}</span>`}function P(i){const n=i?.toLowerCase()||"unknown";return n==="idle"||n==="completed"?t`<span class="inline-block w-1.5 h-1.5 rounded-full bg-green-500" title="${i}"></span>`:n==="streaming"||n==="running"||n==="working"?t`<span class="inline-block w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse" title="${i}"></span>`:t`<span class="inline-block w-1.5 h-1.5 rounded-full bg-muted-foreground" title="${i}"></span>`}function C(i,n=60){return i?i.length>n?i.slice(0,n)+"…":i:""}class H{render(n,e,d){const a=v(e,d),s=n?.role||"agent",r=n?.task?C(n.task,80):"";if(!e)return{content:t`<div>${o(a,S,t`Spawning ${b(s)} ${r?t`— <span class="text-xs text-muted-foreground">${r}</span>`:""}`)}</div>`,isCustom:!1};const{data:c}=x(e),u=c?.sessionId||c?.session_id,p=t`Spawned ${b(s)} ${u?m(u):""} ${r?t`— <span class="text-xs text-muted-foreground">${r}</span>`:""}`;if(e.isError){const{text:$}=x(e),f=g(e);return{content:t`<div>
					${o(a,S,f?t`Aborted spawn of ${b(s)}`:t`Failed to spawn ${b(s)}`)}
					<div class="mt-1 text-xs ${f?"text-amber-600 dark:text-amber-400":"text-destructive"}">${$}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(a,S,p)}</div>`,isCustom:!1}}}class Z{render(n,e,d){const a=v(e,d);if(!e)return{content:t`<div>${o(a,k,"Listing team agents…")}</div>`,isCustom:!1};const{data:s,text:r}=x(e);if(e.isError){const l=g(e);return{content:t`<div>
					${o(a,k,l?"Aborted team list":"Team list failed")}
					<div class="mt-1 text-xs ${l?"text-amber-600 dark:text-amber-400":"text-destructive"}">${r}</div>
				</div>`,isCustom:!1}}const c=s?.agents||(Array.isArray(s)?s:[]);if(c.length===0)return{content:t`<div>${o(a,k,"Team — no agents")}</div>`,isCustom:!1};const u=E(),p=E(),$=new Map;for(const l of c)$.set(l.role,($.get(l.role)||0)+1);const f=Array.from($.entries()).map(([l,y])=>`${y} ${l}${y>1?"s":""}`).join(", ");return{content:t`<div>
				${L(a,k,t`Team — ${c.length} agents <span class="text-xs text-muted-foreground ml-1">(${f})</span>`,u,p,!1)}
				<div ${_(u)} class="max-h-0 overflow-hidden transition-all duration-300">
					<div class="mt-2 space-y-1">
						${c.map(l=>t`
							<div class="flex items-center gap-2 text-xs py-0.5">
								${P(l.status||"")}
								${b(l.role)}
								${l.sessionId?m(l.sessionId):""}
								<span class="text-muted-foreground truncate">${C(l.task||l.title||"",50)}</span>
							</div>
						`)}
					</div>
				</div>
			</div>`,isCustom:!1}}}class B{render(n,e,d){const a=v(e,d),s=n?.session_id;if(!e)return{content:t`<div>${o(a,A,t`Dismissing agent ${s?m(s):""}`)}</div>`,isCustom:!1};if(e.isError){const{text:r}=x(e),c=g(e);return{content:t`<div>
					${o(a,A,c?t`Aborted dismiss`:t`Failed to dismiss agent`)}
					<div class="mt-1 text-xs ${c?"text-amber-600 dark:text-amber-400":"text-destructive"}">${r}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(a,A,t`Dismissed agent ${s?m(s):""}`)}</div>`,isCustom:!1}}}class J{render(n,e,d){const a=v(e,d);if(!e)return{content:t`<div>${o(a,T,"Completing team…")}</div>`,isCustom:!1};if(e.isError){const{text:s}=x(e),r=g(e);return{content:t`<div>
					${o(a,T,r?"Aborted team completion":"Team completion failed")}
					<div class="mt-1 text-xs ${r?"text-amber-600 dark:text-amber-400":"text-destructive"}">${s}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(a,T,t`Team completed — all agents dismissed`)}</div>`,isCustom:!1}}}class N{render(n,e,d){const a=v(e,d),s=n?.session_id,r=n?.message?C(n.message,80):"";if(!e)return{content:t`<div>${o(a,R,t`Steering ${s?m(s):"agent"} ${r?t`— <span class="text-xs text-muted-foreground">${r}</span>`:""}`)}</div>`,isCustom:!1};if(e.isError){const{text:c}=x(e),u=g(e);return{content:t`<div>
					${o(a,R,u?t`Aborted steer ${s?m(s):""}`:t`Steer failed ${s?m(s):""}`)}
					<div class="mt-1 text-xs ${u?"text-amber-600 dark:text-amber-400":"text-destructive"}">${c}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(a,R,t`Steered ${s?m(s):"agent"} ${r?t`— <span class="text-xs text-muted-foreground">${r}</span>`:""}`)}</div>`,isCustom:!1}}}class O{render(n,e,d){const a=v(e,d),s=n?.session_id,r=n?.message?C(n.message,80):"";if(!e)return{content:t`<div>${o(a,h,t`Prompting ${s?m(s):"agent"} ${r?t`— <span class="text-xs text-muted-foreground">${r}</span>`:""}`)}</div>`,isCustom:!1};const{data:c,text:u}=x(e);if(e.isError){const f=g(e);return{content:t`<div>
					${o(a,h,f?t`Aborted prompt ${s?m(s):""}`:t`Prompt failed ${s?m(s):""}`)}
					<div class="mt-1 text-xs ${f?"text-amber-600 dark:text-amber-400":"text-destructive"}">${u}</div>
				</div>`,isCustom:!1}}const $=(c?.status||"sent")==="queued"?"queued":"dispatched";return{content:t`<div>${o(a,h,t`Prompted ${s?m(s):"agent"} <span class="text-xs text-muted-foreground">(${$})</span> ${r?t`— <span class="text-xs text-muted-foreground">${r}</span>`:""}`)}</div>`,isCustom:!1}}}class z{render(n,e,d){const a=v(e,d),s=n?.session_id;if(!e)return{content:t`<div>${o(a,w,t`Aborting ${s?m(s):"agent"}`)}</div>`,isCustom:!1};if(e.isError){const{text:u}=x(e),p=g(e);return{content:t`<div>
					${o(a,w,p?t`Skipped abort of ${s?m(s):""}`:t`Abort failed ${s?m(s):""}`)}
					<div class="mt-1 text-xs ${p?"text-amber-600 dark:text-amber-400":"text-destructive"}">${u}</div>
				</div>`,isCustom:!1}}const{data:r}=x(e),c=r?.status||"aborted";return{content:t`<div>${o(a,w,t`Aborted ${s?m(s):"agent"} — <span class="text-xs text-muted-foreground">${c}</span>`)}</div>`,isCustom:!1}}}export{z as TeamAbortRenderer,J as TeamCompleteRenderer,B as TeamDismissRenderer,Z as TeamListRenderer,O as TeamPromptRenderer,H as TeamSpawnRenderer,N as TeamSteerRenderer};
