import{b as t,n as _,e as E}from"./vendor-lit-B2r-dKc0.js";import{aC as v,aE as o,aF as g,aD as D}from"./app-session-runtime-CeFJDILJ.js";import{r as m}from"./delegate-cards-BbatMXY8.js";import{$ as T,ax as w,ay as A,U as k,as as h,az as S,Z as y}from"./vendor-lucide-B9Yl1Gez.js";import"./vendor-mini-lit-CpUQub-j.js";import"./vendor-marked-_iteVaMm.js";import"./app-review-C3CmcSYC.js";import"./app-panel-workspace-C3XDRCgE.js";import"./app-routing-C_r2pdnC.js";import"./app-message-reducer-wATqnZGf.js";import"./vendor-sortable-B1o3v0Qs.js";import"./app-inbox-CaZD85aD.js";import"./app-pr-walkthrough-WipZACSB.js";function u(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 L(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 O{render(n,e,d){const r=v(e,d),s=n?.role||"agent",a=n?.task?C(n.task,80):"";if(!e)return{content:t`<div>${o(r,S,t`Spawning ${b(s)} ${a?t`— <span class="text-xs text-muted-foreground">${a}</span>`:""}`)}</div>`,isCustom:!1};const{data:c}=u(e),p=c?.sessionId||c?.session_id,x=t`Spawned ${b(s)} ${p?m(p):""} ${a?t`— <span class="text-xs text-muted-foreground">${a}</span>`:""}`;if(e.isError){const{text:$}=u(e),f=g(e);return{content:t`<div>
					${o(r,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(r,S,x)}</div>`,isCustom:!1}}}class G{render(n,e,d){const r=v(e,d);if(!e)return{content:t`<div>${o(r,k,"Listing team agents…")}</div>`,isCustom:!1};const{data:s,text:a}=u(e);if(e.isError){const l=g(e);return{content:t`<div>
					${o(r,k,l?"Aborted team list":"Team list failed")}
					<div class="mt-1 text-xs ${l?"text-amber-600 dark:text-amber-400":"text-destructive"}">${a}</div>
				</div>`,isCustom:!1}}const c=s?.agents||(Array.isArray(s)?s:[]);if(c.length===0)return{content:t`<div>${o(r,k,"Team — no agents")}</div>`,isCustom:!1};const p=E(),x=E(),$=new Map;for(const l of c)$.set(l.role,($.get(l.role)||0)+1);const f=Array.from($.entries()).map(([l,R])=>`${R} ${l}${R>1?"s":""}`).join(", ");return{content:t`<div>
				${D(r,k,t`Team — ${c.length} agents <span class="text-xs text-muted-foreground ml-1">(${f})</span>`,p,x,!1)}
				<div ${_(p)} 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">
								${L(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 K{render(n,e,d){const r=v(e,d),s=n?.session_id;if(!e)return{content:t`<div>${o(r,A,t`Dismissing agent ${s?m(s):""}`)}</div>`,isCustom:!1};if(e.isError){const{text:a}=u(e),c=g(e);return{content:t`<div>
					${o(r,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"}">${a}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(r,A,t`Dismissed agent ${s?m(s):""}`)}</div>`,isCustom:!1}}}class Q{render(n,e,d){const r=v(e,d);if(!e)return{content:t`<div>${o(r,w,"Completing team…")}</div>`,isCustom:!1};if(e.isError){const{text:s}=u(e),a=g(e);return{content:t`<div>
					${o(r,w,a?"Aborted team completion":"Team completion failed")}
					<div class="mt-1 text-xs ${a?"text-amber-600 dark:text-amber-400":"text-destructive"}">${s}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(r,w,t`Team completed — all agents dismissed`)}</div>`,isCustom:!1}}}class V{render(n,e,d){const r=v(e,d),s=n?.session_id,a=n?.message?C(n.message,80):"";if(!e)return{content:t`<div>${o(r,y,t`Steering ${s?m(s):"agent"} ${a?t`— <span class="text-xs text-muted-foreground">${a}</span>`:""}`)}</div>`,isCustom:!1};if(e.isError){const{text:c}=u(e),p=g(e);return{content:t`<div>
					${o(r,y,p?t`Aborted steer ${s?m(s):""}`:t`Steer failed ${s?m(s):""}`)}
					<div class="mt-1 text-xs ${p?"text-amber-600 dark:text-amber-400":"text-destructive"}">${c}</div>
				</div>`,isCustom:!1}}return{content:t`<div>${o(r,y,t`Steered ${s?m(s):"agent"} ${a?t`— <span class="text-xs text-muted-foreground">${a}</span>`:""}`)}</div>`,isCustom:!1}}}class W{render(n,e,d){const r=v(e,d),s=n?.session_id,a=n?.message?C(n.message,80):"";if(!e)return{content:t`<div>${o(r,h,t`Prompting ${s?m(s):"agent"} ${a?t`— <span class="text-xs text-muted-foreground">${a}</span>`:""}`)}</div>`,isCustom:!1};const{data:c,text:p}=u(e);if(e.isError){const f=g(e);return{content:t`<div>
					${o(r,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"}">${p}</div>
				</div>`,isCustom:!1}}const $=(c?.status||"sent")==="queued"?"queued":"dispatched";return{content:t`<div>${o(r,h,t`Prompted ${s?m(s):"agent"} <span class="text-xs text-muted-foreground">(${$})</span> ${a?t`— <span class="text-xs text-muted-foreground">${a}</span>`:""}`)}</div>`,isCustom:!1}}}class X{render(n,e,d){const r=v(e,d),s=n?.session_id;if(!e)return{content:t`<div>${o(r,T,t`Aborting ${s?m(s):"agent"}`)}</div>`,isCustom:!1};if(e.isError){const{text:p}=u(e),x=g(e);return{content:t`<div>
					${o(r,T,x?t`Skipped abort of ${s?m(s):""}`:t`Abort failed ${s?m(s):""}`)}
					<div class="mt-1 text-xs ${x?"text-amber-600 dark:text-amber-400":"text-destructive"}">${p}</div>
				</div>`,isCustom:!1}}const{data:a}=u(e),c=a?.status||"aborted";return{content:t`<div>${o(r,T,t`Aborted ${s?m(s):"agent"} — <span class="text-xs text-muted-foreground">${c}</span>`)}</div>`,isCustom:!1}}}export{X as TeamAbortRenderer,Q as TeamCompleteRenderer,K as TeamDismissRenderer,G as TeamListRenderer,W as TeamPromptRenderer,O as TeamSpawnRenderer,V as TeamSteerRenderer};
