import{b as n}from"./vendor-lit-B2r-dKc0.js";import{a as s}from"./vendor-mini-lit-CpUQub-j.js";import"./app-session-runtime-CeFJDILJ.js";import{B as i,aN as a}from"./vendor-lucide-B9Yl1Gez.js";function o(t){const e=Math.round(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m${e%60}s`}function u(t,e){return t.length<=e?t:t.slice(0,e)+"…"}function b(t){const e=t.split(`
`)[0].trim();return u(e,100)}function d(t){return t==="completed"?"text-green-500":t==="timeout"?"text-orange-500":t==="running"||t==="starting"?"text-blue-500 animate-pulse":t==="waiting"||t==="skipped"?"text-muted-foreground":"text-red-500"}function l(t){return t==="completed"?"✓":t==="running"||t==="starting"?"●":t==="waiting"?"○":t==="timeout"?"⏱":t==="skipped"?"—":"✗"}function c(t){return t?n`
		<a href="#/session/${t}"
			class="inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground border border-border rounded hover:bg-accent transition-colors"
			title="View delegate session"
			@click=${e=>{e.preventDefault(),e.stopPropagation(),location.hash="#/session/"+t}}
		>${s(a,"xs")} view</a>
	`:n``}function f(t){if(t.status==="running"||t.status==="starting"){const e=Date.now()-t.durationMs;return n`<span class="text-xs text-muted-foreground"><live-timer .startTime=${e} .running=${!0}></live-timer></span>`}return n`<span class="text-xs text-muted-foreground">${o(t.durationMs)}</span>`}function p(t){return n`
		<div class="p-2 border border-border rounded text-sm flex items-center gap-2">
			<span class="${d(t.status)}">${l(t.status)}</span>
			<span class="inline-block text-muted-foreground">${s(i,"sm")}</span>
			<span class="font-mono text-xs flex-1 min-w-0 truncate">${t.name}</span>
			${f(t)}
			${c(t.sessionId)}
		</div>
	`}function v(t,e){return n`
		<div class="p-2 border border-border rounded text-sm flex items-center gap-2">
			<span class="text-blue-500 animate-pulse">●</span>
			<span class="inline-block text-muted-foreground">${s(i,"sm")}</span>
			<span class="font-mono text-xs flex-1 min-w-0 truncate">${t}</span>
			<span class="text-xs text-muted-foreground">starting…</span>
		</div>
	`}function h(t){const e=t.filter(r=>r.status!=="completed"&&r.status!=="running"&&r.status!=="starting"&&r.status!=="skipped"&&r.status!=="waiting").length;return n`
		<div class="space-y-1">
			${t.map(r=>p(r))}
		</div>
		${e>0?n`<div class="mt-2 text-sm text-destructive">Warning: ${e} delegate(s) failed or timed out.</div>`:""}
	`}export{v as a,d as b,h as c,l as d,f as e,o as f,c as r,b as s};
