import{at as h,au as w,aw as v,ax as y,av as C}from"./index-rvuS68Al.js";import{b as r,n as R,e as u}from"./vendor-lit-BtHfzs80.js";import{aG as d}from"./vendor-lucide-DBEJLfdn.js";import"./vendor-mini-lit-Cx886NBU.js";import"./vendor-marked-_iteVaMm.js";import"./vendor-sortable-B1o3v0Qs.js";function f(s){const t=s?.content?.filter(o=>o.type==="text").map(o=>o.text).join(`
`)||"";let e=null;try{e=JSON.parse(t)}catch{}return{text:t,data:e}}function p(s){const t=s?.toLowerCase()==="pass";return r`<span class="px-1.5 py-0.5 rounded text-xs font-medium ${t?"bg-green-500/20 text-green-600 dark:text-green-400":"bg-red-500/20 text-red-600 dark:text-red-400"}">${t?"✓ PASS":"✗ FAIL"}</span>`}class M{render(t,e,o){h();const i=w(e,o);if(!e)return{content:r`<div>
					${v(i,d,"Submitting verification…")}
					${t?r`<div class="mt-2 space-y-2">
						${t.verdict?r`<div>${p(t.verdict)}</div>`:""}
						${t.summary?r`<div class="text-sm"><markdown-block .content=${t.summary}></markdown-block></div>`:""}
						${t.report_html?r`<div class="text-xs text-muted-foreground italic">HTML report attached</div>`:""}
					</div>`:""}
				</div>`,isCustom:!1};if(e.isError){const{text:g}=f(e),x=y(e);return{content:r`<div>
					${v(i,d,x?"Aborted verification":"Verification failed")}
					<div class="mt-1 text-xs ${x?"text-amber-600 dark:text-amber-400":"text-destructive"}">${g}</div>
				</div>`,isCustom:!1}}const{data:n,text:b}=f(e),$=n?.verdict||t?.verdict||"",a=n?.summary||t?.summary||b||"",c=n?.report_html||t?.report_html||"",l=a.length>300,m=u(),k=u();return{content:r`<div>
				${C(i,d,r`Verification: ${p($)}`,m,k,!l)}
				<div ${R(m)} class="${l?"max-h-0":"max-h-[2000px] mt-3"} overflow-hidden transition-all duration-300">
					<div class="text-sm">
						<markdown-block .content=${a}></markdown-block>
					</div>
					${c?r`
						<details class="mt-3">
							<summary class="text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors">View HTML report</summary>
							<iframe
								class="w-full h-[400px] mt-2 rounded border border-border"
								sandbox="allow-scripts"
								.srcdoc=${c}
							></iframe>
						</details>
					`:""}
				</div>
			</div>`,isCustom:!1}}}export{M as VerificationResultRenderer};
