const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GateVerificationLive-B4tiitOA.js","assets/vendor-lit-B2r-dKc0.js","assets/app-session-runtime-CeFJDILJ.js","assets/vendor-mini-lit-CpUQub-j.js","assets/vendor-lucide-B9Yl1Gez.js","assets/vendor-marked-_iteVaMm.js","assets/app-review-C3CmcSYC.js","assets/app-panel-workspace-C3XDRCgE.js","assets/app-routing-C_r2pdnC.js","assets/app-review-DNV3xjGU.css","assets/app-message-reducer-wATqnZGf.js","assets/vendor-sortable-B1o3v0Qs.js","assets/app-inbox-CaZD85aD.js","assets/app-pr-walkthrough-WipZACSB.js","assets/app-session-runtime--8a3Kqim.css","assets/VerificationOutputModal-CNZX7C5l.js","assets/index-DV9GoJhq.js","assets/index-DDzNN3Yn.css","assets/delegate-cards-BbatMXY8.js"])))=>i.map(i=>d[i]);
import{b as t,n as L,e as _}from"./vendor-lit-B2r-dKc0.js";import{aC as b,aE as d,aF as S,aD as E}from"./app-session-runtime-CeFJDILJ.js";import{_ as O}from"./app-review-C3CmcSYC.js";import{ae as o}from"./vendor-lucide-B9Yl1Gez.js";import"./vendor-mini-lit-CpUQub-j.js";import"./vendor-marked-_iteVaMm.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-panel-workspace-C3XDRCgE.js";import"./app-pr-walkthrough-WipZACSB.js";let R=!1;function G(){R||(R=!0,O(()=>import("./GateVerificationLive-B4tiitOA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])))}function x(u){const f=u?.content?.filter(l=>l.type==="text").map(l=>l.text).join(`
`)||"";let e=null;try{e=JSON.parse(f)}catch{}return{text:f,data:e}}function j(u){const e={pending:"bg-muted text-muted-foreground",passed:"bg-green-500/20 text-green-600 dark:text-green-400",failed:"bg-red-500/20 text-red-600 dark:text-red-400",running:"bg-blue-500/20 text-blue-600 dark:text-blue-400"}[u]||"bg-muted text-muted-foreground";return t`<span class="px-1.5 py-0.5 rounded text-xs font-medium ${e}">${u}</span>`}class z{render(f,e,l){const i=b(e,l);if(!e)return{content:t`<div>${d(i,o,"Listing gates…")}</div>`,isCustom:!1};const{data:n,text:a}=x(e);if(e.isError){const s=S(e);return{content:t`<div>
					${d(i,o,s?"Aborted gate list":"Gate list failed")}
					<div class="mt-1 text-xs ${s?"text-amber-600 dark:text-amber-400":"text-destructive"}">${a}</div>
				</div>`,isCustom:!1}}const c=n?.gates||(Array.isArray(n)?n:[]);if(c.length===0)return{content:t`<div>${d(i,o,"No gates")}</div>`,isCustom:!1};const r=new Map;for(const s of c)r.set(s.status||"pending",(r.get(s.status||"pending")||0)+1);const v=Array.from(r.entries()).map(([s,m])=>`${m} ${s}`).join(", "),g=_(),p=_();return{content:t`<div>
				${E(i,o,t`${c.length} gates <span class="text-xs text-muted-foreground ml-1">(${v})</span>`,g,p,!1)}
				<div ${L(g)} class="max-h-0 overflow-hidden transition-all duration-300">
					<div class="mt-2 space-y-1">${c.map(s=>t`
						<div class="flex items-center gap-2 text-xs py-0.5">
							${j(s.status||"pending")}
							<span class="font-medium truncate">${s.name||s.gateId}</span>
							${s.dependsOn?.length?t`<span class="text-muted-foreground">← ${s.dependsOn.join(", ")}</span>`:""}
						</div>
					`)}</div>
				</div>
			</div>`,isCustom:!1}}}class K{render(f,e,l){G();const i=b(e,l),n=f?.gate_id||"gate";if(!e)return{content:t`<div>${d(i,o,t`Signaling <span class="font-mono">${n}</span>…`)}</div>`,isCustom:!1};if(e.isError){const{text:p}=x(e),s=S(e),m=p.includes("409")||p.toLowerCase().includes("upstream")||p.toLowerCase().includes("has not passed"),$=s||m?"text-amber-600 dark:text-amber-400":"text-destructive";return{content:t`<div>
					${d(i,o,s?t`Aborted signal for <span class="font-mono">${n}</span>`:t`Failed to signal <span class="font-mono">${n}</span>`)}
					<div class="mt-1 text-xs ${$}">${p}</div>
				</div>`,isCustom:!1}}const{data:a}=x(e),c=a?.signal?.id||"",r=a?.signal?.goalId||a?.goalId||"",v=a?.signal?.status||"";if(v==="passed"||v==="failed")return{content:t`<div>
					${d(i,o,t`Signaled <span class="font-mono">${n}</span>`)}
					<gate-verification-live
						.goalId=${r}
						.gateId=${n}
						.signalId=${c}
						.finalStatus=${v}
					></gate-verification-live>
				</div>`,isCustom:!1};const g=a?.signal?.steps||[];return{content:t`<div>
				${d(i,o,t`Signaled <span class="font-mono">${n}</span>`)}
				<gate-verification-live
					.goalId=${r}
					.gateId=${n}
					.signalId=${c}
					.initialSteps=${g}
				></gate-verification-live>
			</div>`,isCustom:!1}}}class Q{render(f,e,l){G();const i=b(e,l),n=f?.gate_id||"gate";if(!e)return{content:t`<div>${d(i,o,t`Checking gate <span class="font-mono">${n}</span>…`)}</div>`,isCustom:!1};const{data:a,text:c}=x(e);if(e.isError){const y=S(e);return{content:t`<div>
					${d(i,o,y?t`Aborted check of gate <span class="font-mono">${n}</span>`:t`Failed to check gate <span class="font-mono">${n}</span>`)}
					<div class="mt-1 text-xs ${y?"text-amber-600 dark:text-amber-400":"text-destructive"}">${c}</div>
				</div>`,isCustom:!1}}if(!a)return{content:t`<div>${d(i,o,t`Gate <span class="font-mono">${n}</span>`)}</div>`,isCustom:!1};const r=a.gateId||n,v=a.name||r,g=a.status||"pending",p=a.dependsOn||[],s=a.signals||[],m=a.latestSignal||(s.length>0?s[s.length-1]:null),$=m?.verification,C=m?.id||"",I=$?.status||"",h=a.goalId||m?.goalId||"",k=!!(m&&$&&h&&r&&C),A=g!=="pending"&&!k?t` — <span class="${g==="passed"?"text-green-600 dark:text-green-400":g==="failed"?"text-red-600 dark:text-red-400":""}">${g}</span>`:"";return{content:t`<div>
				${d(i,o,t`Gate <span class="font-mono">${v}</span>${A}`)}
				${p.length?t`<div class="text-xs text-muted-foreground mt-1">Depends on: ${p.join(", ")}</div>`:""}
				${k?t`
					<gate-verification-live
						.goalId=${h}
						.gateId=${r}
						.signalId=${C}
						.finalStatus=${I==="passed"||I==="failed"?I:void 0}
						.initialSteps=${$?.steps||[]}
					></gate-verification-live>
				`:""}
			</div>`,isCustom:!1}}}export{z as GateListRenderer,K as GateSignalRenderer,Q as GateStatusRenderer,j as gateBadge,x as getResult};
