diff --git a/strix/interface/viewer/frontend/src/components/PastRunsView.tsx b/strix/interface/viewer/frontend/src/components/PastRunsView.tsx
index b0250131..89c9d116 100644
--- a/strix/interface/viewer/frontend/src/components/PastRunsView.tsx
+++ b/strix/interface/viewer/frontend/src/components/PastRunsView.tsx
@@ -167,7 +167,11 @@ export default function PastRunsView({
{run.open_count !== undefined && · {run.open_count} open · {run.closed_count ?? 0} false positives · {run.detected_count ?? run.open_count} found}
-
+ {run.severity_counts ? (
+
+ ) : (
+ Review unavailable
+ )}
);
diff --git a/strix/interface/viewer/frontend/src/data/serverSource.ts b/strix/interface/viewer/frontend/src/data/serverSource.ts
index e2497dc1..34878bac 100644
--- a/strix/interface/viewer/frontend/src/data/serverSource.ts
+++ b/strix/interface/viewer/frontend/src/data/serverSource.ts
@@ -210,7 +210,7 @@ export interface RunListEntry {
start_time: string | null;
end_time: string | null;
finished: boolean;
- severity_counts: RunSeverityCounts;
+ severity_counts: RunSeverityCounts | null;
open_count?: number;
closed_count?: number;
detected_count?: number;
diff --git a/strix/interface/viewer/server.py b/strix/interface/viewer/server.py
index a4e41d35..c6538bc6 100644
--- a/strix/interface/viewer/server.py
+++ b/strix/interface/viewer/server.py
@@ -71,9 +71,7 @@ def _iter_run_dirs(base_dir: Path) -> list[Path]:
def run_list_entry(run_dir: Path) -> dict[str, Any]:
"""Compact summary of a single run for the history list."""
record = read_run_summary(run_dir)
- findings = read_triaged_vulnerabilities(run_dir)
- active = [finding for finding in findings if finding.get("status") != "closed"]
- return {
+ entry = {
"name": record.get("run_name") or run_dir.name,
"target": primary_target(record),
"scan_mode": record.get("scan_mode"),
@@ -81,6 +79,16 @@ def run_list_entry(run_dir: Path) -> dict[str, Any]:
"start_time": record.get("start_time"),
"end_time": record.get("end_time"),
"finished": bool(record.get("finished")),
+ }
+ try:
+ findings = read_triaged_vulnerabilities(run_dir)
+ except TriageError:
+ # Keep the run selectable without claiming its review counts are known.
+ # Its findings endpoint still reports the error and preserves the data.
+ return {**entry, "severity_counts": None}
+ active = [finding for finding in findings if finding.get("status") != "closed"]
+ return {
+ **entry,
"severity_counts": severity_counts(active),
"open_count": len(active),
"closed_count": len(findings) - len(active),
diff --git a/strix/interface/viewer/static/assets/index-CMYkx6m6.js b/strix/interface/viewer/static/assets/index-RaZRtkBA.js
similarity index 96%
rename from strix/interface/viewer/static/assets/index-CMYkx6m6.js
rename to strix/interface/viewer/static/assets/index-RaZRtkBA.js
index 52bcef48..04e15f83 100644
--- a/strix/interface/viewer/static/assets/index-CMYkx6m6.js
+++ b/strix/interface/viewer/static/assets/index-RaZRtkBA.js
@@ -507,6 +507,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),qt=ve,ft=ze),We===void
... more content available`:"")})})()]})}function H7({args:e,result:t}){const r=(e.method??"GET").toUpperCase(),a=e.url??"",s=e.headers,o=e.body,c=typeof o=="string"?o:"",d=t,f=d?d.error??null:null,h=d?d.status_code??null:null,p=d?d.response_time_ms??null:null,g=d?d.body:null,b=typeof g=="string"?g:null;return m.jsxs("div",{children:[m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"request"}),m.jsxs("div",{className:"mt-1.5 font-mono text-[13px] space-y-0.5",children:[m.jsxs("div",{children:[m.jsx("span",{className:"text-[#555] select-none mr-1",children:">>"}),m.jsx("span",{className:`font-bold ${y2[r]??"text-[#888]"}`,children:r}),m.jsx("span",{className:"text-[#888] ml-1 break-all",children:Xr(a,180)})]}),s&&typeof s=="object"&&Object.entries(s).slice(0,5).map(([y,_])=>m.jsxs("div",{className:"text-[#555] pl-5",children:[y,": ",Ep(String(_),150)]},y))]}),c&&m.jsx(Ei,{className:"text-[#888]",children:Np(c,4)}),f&&m.jsx("div",{className:"text-red-400/70 text-[13px] mt-1.5",children:Ep(f,150)}),h!=null&&m.jsxs("div",{className:"font-mono text-[13px] mt-1.5",children:[m.jsx("span",{className:"text-[#555] select-none mr-1",children:"<<"}),m.jsx("span",{className:`font-bold ${Ng(h)}`,children:h}),p!=null&&m.jsxs("span",{className:"text-[#555] ml-2",children:[p,"ms"]})]}),b&&m.jsx(Ei,{className:"text-[#666]",children:Np(b,6)})]})}function $7({args:e,result:t}){const r=e.request_id,a=e.modifications,s=t,o=s?s.status_code??null:null,c=s?s.response_time_ms??null:null,d=s?s.body:null,f=typeof d=="string"?d:null;return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"repeating request"}),r!=null&&m.jsxs("span",{className:"text-[#888] text-[13px]",children:["#",r]})]}),a&&typeof a=="object"&&Object.keys(a).length>0&&m.jsx("div",{className:"mt-1.5 font-mono text-[13px] space-y-0.5",children:Object.entries(a).slice(0,5).map(([h,p])=>m.jsxs("div",{children:[m.jsxs("span",{className:"text-orange-400/60",children:[h,":"]})," ",m.jsx("span",{className:"text-[#777]",children:Ep(typeof p=="string"?p:JSON.stringify(p),150)})]},h))}),o!=null&&m.jsxs("div",{className:"font-mono text-[13px] mt-1.5",children:[m.jsx("span",{className:"text-[#555] select-none mr-1",children:"<<"}),m.jsx("span",{className:`font-bold ${Ng(o)}`,children:o}),c!=null&&m.jsxs("span",{className:"text-[#555] ml-2",children:[c,"ms"]})]}),f&&m.jsx(Ei,{className:"text-[#666]",children:Np(f,5)})]})}const q7={get:"getting",list:"listing",create:"creating",update:"updating",delete:"deleting"};function P7({args:e}){const t=e.action??"",r=e.scope_name??"",a=q7[t]??(t||"managing");return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:"text-purple-400/80 font-semibold text-sm",children:[a," proxy scope"]}),r&&m.jsx("span",{className:"text-[#888] text-[13px]",children:Xr(r,50)})]})}function F7({args:e}){const t=e.parent_id;return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"listing sitemap"}),t&&m.jsxs("span",{className:"text-[#888] text-[13px]",children:["under #",Xr(String(t),20)]})]})}function G7({args:e}){const t=e.entry_id;return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"viewing sitemap entry"}),t&&m.jsxs("span",{className:"text-[#888] text-[13px]",children:["#",Xr(String(t),20)]})]})}function V7(e){switch(e.toolName){case"list_requests":return m.jsx(B7,{...e});case"view_request":return m.jsx(U7,{...e});case"send_request":return m.jsx(H7,{...e});case"repeat_request":return m.jsx($7,{...e});case"scope_rules":return m.jsx(P7,{...e});case"list_sitemap":return m.jsx(F7,{...e});case"view_sitemap_entry":return m.jsx(G7,{...e});default:return m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:e.toolName.replace(/_/g," ")})}}function Y7({args:e}){const t=e.thought??e.content??"";return t?m.jsxs("div",{children:[m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:"Agent is thinking"}),m.jsx("div",{className:"mt-1.5 italic text-[#888]",children:m.jsx(Xt,{text:t,maxLines:20})})]}):null}function X7({toolName:e,args:t}){if(e==="create_agent"){const r=t.name??t.agent_name??"",a=t.task??"";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"spawning"}),r&&m.jsx("span",{className:"text-cyan-400 font-semibold text-sm",children:r})]}),a&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:a,maxLines:15})})]})}if(e==="agent_finish"){const r=t.result_summary??"",a=t.success,s=t.findings,o=Array.isArray(s)?s:void 0;return m.jsxs("div",{children:[m.jsx("span",{className:`font-semibold text-sm ${a===!1?"text-red-400/80":"text-emerald-400/80"}`,children:a===!1?"Agent failed":"Agent completed"}),r&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:r,maxLines:20})}),o&&o.length>0&&m.jsx("div",{className:"mt-1.5 space-y-0.5",children:o.map((c,d)=>m.jsxs("div",{className:"text-[13px] text-[#888]",children:[m.jsx("span",{className:"text-red-400/50 mr-1",children:"•"}),typeof c=="string"?c:JSON.stringify(c)]},d))})]})}if(e==="send_message_to_agent"){const r=t.message??"",a=t.target_agent_id??t.agent_id??"";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"message"}),a&&m.jsxs("span",{className:"text-[#888] text-[13px]",children:["to ",a.slice(0,16)]})]}),r&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:r,maxLines:20})})]})}if(e==="wait_for_agents"){const r=t.reason??"";return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"waiting"}),r&&m.jsx("span",{className:"text-[#888] text-[13px] truncate",children:r})]})}if(e==="stop_agent"){const r=t.target_agent_id??"",a=t.cascade!==!1,s=t.reason??"";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx("span",{className:"text-red-400/80 font-semibold text-sm",children:"stopping"}),r&&m.jsx("span",{className:"text-[#888] text-[13px]",children:r.slice(0,16)}),a&&m.jsx("span",{className:"text-[#555] text-[13px] italic",children:"+ descendants"})]}),s&&m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:s})]})}return e==="view_agent_graph"?m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:"viewing agents graph"}):m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:e.replace(/_/g," ")})}function K7({args:e,result:t}){const r=e.query??e.search_query??"",a=t,s=a?a.content??null:null,o=a&&!a.success?a.message??null:null;return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"Searching the web"}),r&&m.jsx("div",{className:"text-[#888] text-[13px] mt-0.5",children:r}),o&&m.jsx("div",{className:"text-red-400/70 text-[13px] mt-1.5",children:o}),s&&m.jsx("div",{className:"mt-2",children:m.jsx(Xt,{text:s,maxLines:15})})]})}const Z7=50,y_=200,v_=25,__=24,Q7=/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*\x07)/g,W7=/\.\.\. \[(stdout|stderr|result|output|error) truncated at \d+k? chars\]/g;function J7(e){return e.replace(Q7,"")}function Hm(e){const t=J7(e);return t.length>y_?t.slice(0,y_-3)+"...":t}function eU(e){return e.replace(W7,"").trim()}function tU(e){const t=e.split(`
`);if(t.length<=Z7)return t.map(Hm).join(`
`);const r=t.length-v_-__;return[...t.slice(0,v_).map(Hm),`... ${r} lines truncated ...`,...t.slice(-__).map(Hm)].join(`
-`)}function nU({args:e,result:t}){const r=e.action??"",a=e.code??e.script??"",s=t;let o=null;s&&typeof s=="object"?o=typeof s.stdout=="string"?s.stdout:null:typeof s=="string"&&(o=s);const c=r==="new_session"?"new session":r==="close"?"close session":r==="list_sessions"?"list sessions":null,d=o?tU(eU(o)):null;return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-yellow-400/80 font-semibold text-sm",children:"Python"}),c&&m.jsx("span",{className:"text-[#888] text-[13px]",children:c})]}),a&&m.jsx(wg,{code:a,language:"python",collapsible:!0}),d&&m.jsx(Ei,{className:"text-[#666]",children:d})]})}function rU({args:e}){const t=e.targets,a=(Array.isArray(t)?t:[]).map(s=>typeof s=="object"&&s?s.original??null:null).filter(Boolean);return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Starting penetration test"}),a.length===1&&m.jsxs("span",{className:"text-[#888] text-[13px]",children:["on ",a[0]]})]}),a.length>1&&m.jsx("div",{className:"mt-1.5 space-y-0.5",children:a.map((s,o)=>m.jsxs("div",{className:"text-[13px] text-[#888]",children:[m.jsx("span",{className:"text-[#555] mr-1",children:"•"}),s]},o))})]})}function iU({args:e}){const t=e.name??"Unknown Agent",r=e.task??"";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[#888] text-[13px]",children:"subagent"}),m.jsx("span",{className:"text-purple-400 font-semibold text-sm",children:t})]}),r&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:r,maxLines:15})})]})}function aU(e){return e.toolName==="subagent_start_info"?m.jsx(iU,{...e}):m.jsx(rU,{...e})}function sU({args:e}){const t=e.executive_summary??"",r=e.methodology??"",a=e.technical_analysis??"",s=e.recommendations??"";return m.jsxs("div",{className:"space-y-3",children:[m.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Penetration test completed"}),t&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Executive Summary"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:t,maxLines:25})})]}),r&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Methodology"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:r,maxLines:25})})]}),a&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Technical Analysis"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:a,maxLines:25})})]}),s&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Recommendations"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:s,maxLines:25})})]}),!t&&!r&&!a&&!s&&m.jsx("div",{className:"text-[#555] text-xs",children:"Generating final report..."})]})}function lU({toolName:e,args:t,result:r}){if(e==="create_note"){const a=t.title??"",s=t.content??"",o=t.category??"general";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"}),m.jsxs("span",{className:"text-[#555] text-[13px]",children:["(",o,")"]})]}),a&&m.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&m.jsx("div",{className:"mt-1",children:m.jsx(da,{text:s})})]})}if(e==="delete_note")return m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note removed"});if(e==="update_note"){const a=t.title??"",s=t.content??"";return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note updated"}),a&&m.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&m.jsx("div",{className:"mt-1",children:m.jsx(da,{text:s})})]})}if(e==="get_note"){const a=r,s=a&&typeof a=="object"&&a.success?a.note:void 0;return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note read"}),s&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"mt-1.5 text-[#999] text-[13px]",children:[s.title??"(untitled)",m.jsxs("span",{className:"text-[#555] ml-1",children:["(",s.category??"general",")"]}),(s.by_you||s.agent_name)&&m.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",s.by_you?"you":s.agent_name]})]}),s.content&&m.jsx("div",{className:"mt-1",children:m.jsx(da,{text:s.content})})]})]})}if(e==="list_notes"){const a=r;let s=[];if(a&&typeof a=="object"&&a.success){const o=a.notes;s=Array.isArray(o)?o:[]}return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"notes"}),s.length>0?m.jsx("div",{className:"mt-1.5 space-y-0.5",children:s.map((o,c)=>m.jsxs("div",{className:"text-[13px]",children:[m.jsx("span",{className:"text-[#555] mr-1",children:"-"}),m.jsx("span",{className:"text-[#999]",children:o.title??"(untitled)"}),m.jsxs("span",{className:"text-[#555] ml-1",children:["(",o.category??"general",")"]}),(o.by_you||o.agent_name)&&m.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",o.by_you?"you":o.agent_name]}),o.content&&m.jsx("div",{className:"ml-3",children:m.jsx(da,{text:o.content})})]},c))}):m.jsx("div",{className:"mt-1 text-[#555] text-xs",children:"No notes"})]})}return m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"})}const oU={create_todo:{label:"Task added",Icon:J_},list_todos:{label:"Plan",Icon:lC},update_todo:{label:"Task updated",Icon:lT},mark_todo_done:{label:"Task completed",Icon:V_},mark_todo_pending:{label:"Task reopened",Icon:gT},delete_todo:{label:"Task removed",Icon:OT}};function cU({status:e}){return e==="done"?m.jsx(V_,{className:"w-3.5 h-3.5 text-emerald-400/70 shrink-0"}):e==="in_progress"?m.jsx(yC,{className:"w-3.5 h-3.5 text-purple-400/70 shrink-0 animate-pulse"}):m.jsx(Y_,{className:"w-3.5 h-3.5 text-[#444] shrink-0"})}function uU({todos:e,highlightId:t}){return m.jsx("div",{className:"space-y-0",children:e.map((r,a)=>{const s=r.status??"pending",o=t&&r.id===t;return m.jsxs("div",{className:`flex items-start gap-2.5 py-1.5 px-2 -mx-2 rounded-md transition-colors ${o?"bg-purple-500/[0.08]":""}`,children:[m.jsx("div",{className:"mt-[1px]",children:m.jsx(cU,{status:s})}),m.jsx("span",{className:`text-[13px] leading-snug ${s==="done"?"text-[#555] line-through":s==="in_progress"?"text-[#bbb]":"text-[#999]"}`,children:r.title??"(untitled)"})]},r.id??a)})})}function dU({toolName:e,args:t,result:r}){const a=oU[e]??{label:"Plan",Icon:hT},s=a.Icon,o=r;if(typeof o=="string"&&o.trim())return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:o.trim()})]});let c=[],d=null,f;if(o&&typeof o=="object"){if(d=o.error??null,o.success){const p=o.todos;c=Array.isArray(p)?p:[]}f=o.id??t.todo_id??void 0}const h=e!=="list_todos"?f:void 0;return c.length===0&&!d?m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),d&&m.jsx("div",{className:"text-red-400/70 text-[13px] mb-2",children:d}),c.length>0&&m.jsx("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.015] px-3 py-2",children:m.jsx(uU,{todos:c,highlightId:h})})]})}function w_(e){if(e==null)return null;if(typeof e=="string")return e.trim()?e:null;if(typeof e=="object"){const t=e;if(typeof t.__raw=="string")return t.__raw;if(Object.keys(t).length===0)return null;try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function v2({toolName:e,args:t,result:r}){const a=w_(t),s=w_(r);return m.jsxs("div",{children:[m.jsx("span",{className:"text-[#888] font-semibold text-sm",children:e.replace(/_/g," ")}),a&&m.jsx(Ei,{className:"text-[#777]",children:a}),s&&m.jsx(Ei,{className:"text-[#666]",children:s})]})}function fU({args:e}){const t=e.skills,r=(Array.isArray(t)?t:String(t??"").split(",")).map(a=>String(a).trim()).filter(Boolean);return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Loading skill"}),r.length>0&&m.jsx("span",{className:"text-[#888] text-[13px]",children:r.join(", ")})]})}function hU({args:e}){const t=e.message??"";return t?m.jsxs("div",{children:[m.jsx(da,{text:t}),m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:"waiting for your reply"})]}):null}const mU={reported:{label:"reported",color:"text-orange-400",Icon:Tp},no_issue_found:{label:"no issue found",color:"text-emerald-400",Icon:ku},ruled_out:{label:"ruled out",color:"text-emerald-400/70",Icon:ku},not_applicable:{label:"not applicable",color:"text-[#777]",Icon:EC},needs_follow_up:{label:"needs follow-up",color:"text-yellow-400",Icon:_C}},pU=["reported","needs_follow_up","no_issue_found","ruled_out","not_applicable"];function go(e){const t=(e??"").trim().toLowerCase();return mU[t]??{label:t?t.replace(/_/g," "):"unrecorded",color:"text-[#777]",Icon:Y_}}const gU={record_coverage:"Coverage recorded",update_coverage:"Coverage updated",list_coverage:"Coverage"};function yu({toolName:e}){return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(X_,{className:"w-3.5 h-3.5 text-cyan-400/60"}),m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:gU[e]??"Coverage"})]})}function xU({entry:e}){const{label:t,color:r,Icon:a}=go(e.outcome),s=(e.previous_outcomes??[]).map(o=>go(o).label).filter(Boolean);return m.jsxs("div",{className:"flex items-start gap-2.5 py-1.5",children:[m.jsx(a,{className:`w-3.5 h-3.5 shrink-0 mt-[2px] ${r}`}),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"text-[13px] leading-snug",children:[m.jsx("span",{className:"text-[#bbb]",children:e.surface??"(unnamed surface)"}),e.risk_area&&m.jsxs("span",{className:"text-[#666]",children:[" · ",e.risk_area]})]}),m.jsxs("div",{className:"text-xs mt-0.5",children:[m.jsx("span",{className:r,children:t}),s.length>0&&m.jsxs("span",{className:"text-[#555]",children:[" (was ",s.join(" → "),")"]}),(e.by_you||e.agent_name)&&m.jsxs("span",{className:"text-[#555]",children:[" · ",e.by_you?"you":e.agent_name]})]}),e.evidence&&m.jsx("div",{className:"text-[#777] text-xs mt-1 leading-snug",children:e.evidence})]})]})}function bU({toolName:e,args:t,result:r}){const a=r;if(typeof a=="string"&&a.trim())return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:a.trim()})]});const s=a&&typeof a=="object"?a:null,o=t.surface??"",c=t.risk_area??"",d=t.evidence??"";if(s&&!s.success)return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),(o||c)&&m.jsxs("div",{className:"mt-1.5 text-[13px] text-[#bbb]",children:[o,c&&m.jsxs("span",{className:"text-[#666]",children:[" · ",c]})]}),m.jsx("div",{className:"mt-1 text-red-400/70 text-[13px]",children:s.error??"Coverage call failed"})]});if(e==="list_coverage"){const y=s==null?void 0:s.entries,_=Array.isArray(y)?y:[],N=(s==null?void 0:s.outcome_counts)??{},S=(s==null?void 0:s.total_count)??0;return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),Object.keys(N).length>0&&m.jsx("div",{className:"mt-2 flex items-center gap-3 flex-wrap",children:pU.filter(w=>N[w]).map(w=>{const{label:k,color:E}=go(w);return m.jsxs("span",{className:`text-xs ${E}`,children:[k,": ",N[w]]},w)})}),_.length>0?m.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.06] bg-white/[0.015] px-3 py-1 divide-y divide-white/[0.04]",children:_.map((w,k)=>m.jsx(xU,{entry:w},w.entry_id??k))}):m.jsx("div",{className:"mt-1.5 text-[#555] text-xs",children:S===0?"No surfaces recorded yet":"No surfaces match this filter"})]})}const f=(s==null?void 0:s.outcome)??"",h=(s==null?void 0:s.previous_outcome)??"",{label:p,color:g,Icon:b}=go(f);return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),m.jsxs("div",{className:"mt-2 flex items-start gap-2.5",children:[m.jsx(b,{className:`w-3.5 h-3.5 shrink-0 mt-[2px] ${g}`}),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"text-[13px] leading-snug text-[#bbb]",children:[o||(s!=null&&s.entry_id?`entry ${s.entry_id}`:"(unnamed surface)"),c&&m.jsxs("span",{className:"text-[#666]",children:[" · ",c]})]}),m.jsxs("div",{className:"text-xs mt-0.5",children:[h&&m.jsxs("span",{className:"text-[#666]",children:[go(h).label," → "]}),m.jsx("span",{className:g,children:p})]}),d&&m.jsx("div",{className:"text-[#777] text-xs mt-1 leading-snug",children:d})]})]})]})}const yU={get_threat_model:{label:"Threat model",Icon:Xu},save_threat_model:{label:"Threat model saved",Icon:bT},amend_threat_model:{label:"Threat model amended",Icon:J_}};function vU({toolName:e,args:t,result:r}){const a=yU[e]??{label:"Threat model",Icon:Xu},s=a.Icon,o=t.target??"",c=r,d=m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-blue-400/60"}),m.jsx("span",{className:"text-blue-400/80 font-semibold text-sm",children:a.label}),o&&m.jsx("span",{className:"text-[#666] font-mono text-xs",children:o})]});if(typeof c=="string"&&c.trim())return m.jsxs("div",{children:[d,m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:c.trim()})]});const f=c&&typeof c=="object"?c:null;if(f&&!f.success)return m.jsxs("div",{children:[d,m.jsx("div",{className:"mt-1.5 text-red-400/70 text-[13px]",children:f.error??"Threat model call failed"})]});if(e==="get_threat_model"){if(f&&!f.found)return m.jsxs("div",{children:[d,m.jsx("div",{className:"mt-1.5 text-[#555] text-xs",children:"No model derived for this target yet"})]});const g=f==null?void 0:f.amendments,b=Array.isArray(g)?g:[];return m.jsxs("div",{children:[d,b.length>0&&m.jsxs("div",{className:"mt-2",children:[m.jsxs("span",{className:"text-amber-400/70 text-xs font-semibold",children:[b.length," amendment",b.length===1?"":"s"]}),m.jsx("span",{className:"text-[#555] text-xs",children:" — later statements win"}),m.jsx("div",{className:"mt-1 space-y-1",children:b.map((y,_)=>m.jsxs("div",{className:"text-xs leading-snug",children:[m.jsx("span",{className:"text-[#666]",children:y.agent_name??"unknown agent"}),y.content&&m.jsxs("span",{className:"text-[#999]",children:[": ",y.content]})]},_))})]}),typeof(f==null?void 0:f.content)=="string"&&f.content.trim()&&m.jsx("div",{className:"mt-2",children:m.jsx(Xt,{text:f.content,maxLines:14})})]})}if(e==="amend_threat_model"){const g=t.addendum??"",b=f==null?void 0:f.amendment_count;return m.jsxs("div",{children:[d,b!=null&&m.jsxs("div",{className:"mt-1.5 text-[#666] text-xs",children:[b," amendment",b===1?"":"s"," on this model"]}),g&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:g,maxLines:10})})]})}const h=(f==null?void 0:f.amendments_cleared)??0,p=t.content??"";return m.jsxs("div",{children:[d,h>0&&m.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-yellow-400/80 text-xs",children:[m.jsx(Tp,{className:"w-3 h-3 shrink-0"}),m.jsxs("span",{children:["cleared ",h," amendment",h===1?"":"s"]})]}),p&&m.jsx("div",{className:"mt-2",children:m.jsx(Xt,{text:p,maxLines:14})})]})}function _U(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([t,r])=>{const a=typeof r=="string"?r:JSON.stringify(r);return`${t}: ${a??String(r)}`})}function wU(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return[]}const r=t&&typeof t=="object"&&!Array.isArray(t)?t.connections:null;return Array.isArray(r)?r.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,o=typeof s.name=="string"&&s.name.trim()?s.name.trim():typeof s.id=="string"?s.id.trim():"";if(!o)return[];const c=typeof s.tool_count=="number"?s.tool_count:null,d=s.dead===!0;return[{name:o,toolCount:c,dead:d}]}):[]}const E_=600;function EU(e){if(typeof e=="string"){const t=e.trim();return t?t.length>E_?`${t.slice(0,E_)}…`:t:null}return null}function NU({toolName:e,mcpTool:t,mcpConnection:r,args:a,result:s,status:o}){const c=_U(a),d=o==="failed"||o==="error",f=d?EU(s):null,h=e==="describe_mcp",p=e==="list_mcps",g=p?wU(s):[];return m.jsxs("div",{children:[m.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:p?m.jsx("span",{className:"text-[13px] text-[#555]",children:"Listing connected MCP servers"}):h?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-[13px] text-[#555]",children:"Inspecting MCP server"}),r&&m.jsx("span",{className:"font-mono text-teal-300 font-semibold text-sm",children:r})]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"font-mono text-teal-300 font-semibold text-sm",children:t||e}),m.jsx("span",{className:"text-[13px] text-[#555]",children:"via MCP server"}),r&&m.jsx("span",{className:"text-[13px] text-teal-400/80",children:r})]})}),c.length>0&&m.jsx("div",{className:"mt-1 font-mono text-[13px] leading-relaxed",children:c.map(b=>m.jsx("div",{className:"text-[#777] break-all",children:b},b))}),g.length>0&&m.jsx("div",{className:"mt-1 font-mono text-[13px] leading-relaxed",children:g.map(b=>m.jsxs("div",{className:`break-all${b.dead?" opacity-50":""}`,children:[m.jsx("span",{className:"text-teal-300",children:b.name}),b.dead?m.jsx("span",{className:"text-red-400/80",children:" · offline"}):b.toolCount!==null&&m.jsxs("span",{className:"text-[#555]",children:[" ","· ",b.toolCount," ",b.toolCount===1?"tool":"tools"]})]},b.name))}),m.jsxs("div",{className:"mt-1 text-[13px]",children:[o==="running"&&m.jsx("span",{className:"text-[#666]",children:"Running"}),o==="completed"&&m.jsx("span",{className:"text-emerald-400/80",children:"✓ Done"}),d&&m.jsx("span",{className:"text-red-400/80",children:"✗ Failed"})]}),f&&m.jsx("pre",{className:"mt-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap break-words text-red-400/70",children:f})]})}const Va={terminal:{renderer:y7,icon:nw,color:"text-emerald-400"},python:{renderer:nU,icon:TC,color:"text-yellow-400"},browser:{renderer:_7,icon:Q_,color:"text-blue-400"},filesystem:{renderer:w7,icon:LC,color:"text-sky-400"},proxy:{renderer:V7,icon:q_,color:"text-purple-400",match:/request|sitemap|scope/},reporting:{renderer:L7,icon:wT,color:"text-red-400"},thinking:{renderer:Y7,icon:P_,color:"text-purple-400"},agents:{renderer:X7,icon:Do,color:"text-cyan-400",match:/agent/},search:{renderer:K7,icon:vT,color:"text-amber-400"},lifecycle:{renderer:aU,icon:Z_,color:"text-emerald-400"},notes:{renderer:lU,icon:TT,color:"text-amber-400",match:/note/},skills:{renderer:fU,icon:Ym,color:"text-emerald-400"},todos:{renderer:dU,icon:WC,color:"text-purple-400",match:/todo/},coverage:{renderer:bU,icon:X_,color:"text-cyan-400",match:/coverage/},threatModel:{renderer:vU,icon:Xu,color:"text-blue-400",match:/threat_model/},telemetry:{renderer:v2,icon:Ym,color:"text-[#555]"},mcp:{renderer:NU,icon:W_,color:"text-teal-400"}},SU={terminal:["exec_command","write_stdin","terminal_execute"],python:["python_action"],browser:["browser_action"],filesystem:["apply_patch","view_image","str_replace_editor","list_files","search_files"],proxy:["list_requests","view_request","repeat_request","list_sitemap","view_sitemap_entry","scope_rules","send_request"],reporting:["create_vulnerability_report","update_vulnerability_report","list_reports","get_report"],thinking:["think"],agents:["create_agent","agent_finish","send_message_to_agent","wait_for_agents","view_agent_graph","stop_agent"],search:["web_search"],lifecycle:["scan_start_info","subagent_start_info","finish_scan","respond_to_user"],notes:["create_note","delete_note","update_note","list_notes","get_note"],skills:["load_skill"],todos:["create_todo","list_todos","update_todo","mark_todo_done","mark_todo_pending","delete_todo"],coverage:["record_coverage","update_coverage","list_coverage"],threatModel:["get_threat_model","save_threat_model","amend_threat_model"],telemetry:["sandbox_error_details","llm_error_details"],mcp:["list_mcps"]},kU=Object.fromEntries(Object.entries(SU).flatMap(([e,t])=>t.map(r=>[r,e]))),CU={finish_scan:sU,respond_to_user:hU,apply_patch:A7,view_image:R7,list_reports:b_,get_report:b_},TU={agent_finish:{icon:Z_,color:"text-cyan-400"},send_message_to_agent:{icon:vh,color:"text-cyan-400"},wait_for_agents:{icon:vh,color:"text-cyan-400"},respond_to_user:{icon:vh,color:"text-emerald-400"},view_agent_graph:{icon:jC,color:"text-cyan-400"},stop_agent:{icon:Gm,color:"text-red-400"},scan_start_info:{icon:Xu,color:"text-emerald-400"},subagent_start_info:{icon:Do,color:"text-purple-400"},view_image:{icon:XC,color:"text-sky-400"}},AU=Va.telemetry;function _2(e){var r;const t=kU[e];if(t)return t;for(const[a,s]of Object.entries(Va))if((r=s.match)!=null&&r.test(e))return a;return null}function MU(e,t){if(t)return Va.mcp.renderer;const r=CU[e];if(r)return r;const a=_2(e);return a?Va[a].renderer:v2}function OU(e,t){if(t)return{icon:Va.mcp.icon,color:Va.mcp.color};const r=TU[e];if(r)return r;const a=_2(e),s=a?Va[a]:AU;return{icon:s.icon,color:s.color}}const RU=30;function jU({role:e,content:t}){const r=e==="user"||e==="human";return m.jsxs("div",{children:[m.jsx("span",{className:`font-semibold text-sm ${r?"text-blue-400/80":"text-purple-400/80"}`,children:r?"User":"Thinking"}),m.jsx("div",{className:"mt-1.5 italic text-[#888]",children:m.jsx(Xt,{text:t,maxLines:RU})})]})}class DU extends J.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?m.jsx("span",{className:"text-[#555] font-semibold text-sm",children:this.props.toolName.replace(/_/g," ")}):this.props.children}}function LU(e){const t=MU(e.toolName,e.mcpConnection);return m.jsx(DU,{toolName:e.toolName,children:m.jsx(t,{...e})})}function w2(e){if(e==null||typeof e!="string")return e;const t=e.trim();if(!t)return e;try{return JSON.parse(t)}catch{}try{const r=t.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false").replace(/'/g,'"');return JSON.parse(r)}catch{return{__raw:e}}}function N_(e){return typeof e=="string"&&e?e:null}function E2(e){const t=w2(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:t==null?{}:{__raw:typeof t=="string"?t:JSON.stringify(t)}}function S_(e){const t=/(\d+)$/.exec(e);return t?parseInt(t[1],10):0}function Sg(e){var r;const t=(r=e.data)==null?void 0:r.role;return e.type==="chat"&&(t==="user"||t==="human")}function zU(e){var t;return Sg(e)&&String(((t=e.data)==null?void 0:t.content)??"").startsWith("[Message from ")}function IU(e){const t=new Set;let r=!1;for(const a of e)if(Sg(a)){if(zU(a)){t.add(a.id);continue}r||(r=!0,t.add(a.id))}return t}const BU={completed:"text-emerald-400 border-emerald-500/30 bg-emerald-500/10",running:"text-blue-400 border-blue-500/30 bg-blue-500/10",waiting:"text-yellow-400 border-yellow-500/30 bg-yellow-500/10",stopped:"text-[#aaa] border-[#333] bg-[#1a1a1a]",crashed:"text-red-400 border-red-500/30 bg-red-500/10",failed:"text-red-400 border-red-500/30 bg-red-500/10"};function UU(e){return e==="completed"?"completed":e==="running"?"running":e==="failed"||e==="crashed"?"failed":e}function HU(e,t){var d;const r=new Map;for(const f of e)if(f.parent_id){const h=r.get(f.parent_id)??[];h.push(f.id),r.set(f.parent_id,h)}const a=new Map,s=new Map,o=new Map;for(const f of t)if(f.type==="tool"){if(a.set(f.agent_id,(a.get(f.agent_id)??0)+1),((d=f.data)==null?void 0:d.tool_name)==="create_agent"){const h=E2(f.data.args),p=h.name??h.agent_name??"",g=h.task??"";p&&g&&o.set(p,g)}}else Sg(f)||s.set(f.agent_id,(s.get(f.agent_id)??0)+1);const c=new Map;for(const f of e)c.set(f.id,{id:f.id,name:f.name,task:o.get(f.name)??"",status:UU(f.status),parentId:f.parent_id,children:r.get(f.id)??[],createdAt:f.created_at,toolCount:a.get(f.id)??0,messageCount:s.get(f.id)??0});return c}function $U({agent:e,events:t,showHeader:r=!0}){const a=J.useMemo(()=>{const c=t.filter(f=>f.agent_id===e.id).sort((f,h)=>S_(f.id)-S_(h.id)),d=IU(c);return c.filter(f=>!d.has(f.id))},[t,e.id]),s=a.filter(c=>c.type==="tool").length,o=a.length-s;return m.jsxs("div",{children:[r&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[m.jsx("span",{className:"text-base font-semibold text-white truncate",children:e.name}),m.jsx("span",{className:`flex-shrink-0 text-xs font-medium capitalize px-2 py-0.5 rounded-full border ${BU[e.status]??"text-[#aaa] border-[#333] bg-[#1a1a1a]"}`,children:e.status}),m.jsx("span",{className:"font-mono text-xs text-[#555]",children:e.id})]}),m.jsxs("p",{className:"text-xs text-[#666] mb-4",children:[o," message",o===1?"":"s"," · ",s," tool call",s===1?"":"s"]})]}),a.length===0?m.jsx("p",{className:"text-sm text-[#666]",children:"No recorded activity for this agent."}):m.jsx("div",{className:"py-1",children:a.map((c,d)=>{var w,k,E,M,H,A,B,z;const f=d===a.length-1,h=c.type==="tool",p=h?String(((w=c.data)==null?void 0:w.tool_name)??"tool"):"",g=h?"":String(((k=c.data)==null?void 0:k.role)??"assistant"),b=N_((E=c.data)==null?void 0:E.mcp_connection),y=N_((M=c.data)==null?void 0:M.mcp_tool);let _,N;if(h){const X=OU(p,b);_=X.icon,N=X.color}else{const X=g==="user"||g==="human";_=X?Do:P_,N=X?"text-blue-400":"text-purple-400"}const S=h?String(((H=c.data)==null?void 0:H.status)??"completed"):"completed";return m.jsxs("div",{className:"flex gap-3",children:[m.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[m.jsx("div",{className:`w-[30px] h-[30px] rounded-full bg-black border flex items-center justify-center shrink-0 ${h&&S==="running"?"border-blue-500/40 animate-pulse":h&&S==="failed"?"border-red-500/30":"border-[#222]"}`,children:m.jsx(_,{className:`w-3.5 h-3.5 ${N}`})}),!f&&m.jsx("div",{className:"w-px flex-1 bg-[#1a1a1a] mt-1"})]}),m.jsx("div",{className:"flex-1 min-w-0 pt-[5px] pb-6",children:h?m.jsx(LU,{toolName:p,mcpConnection:b,mcpTool:y,args:E2((A=c.data)==null?void 0:A.args),result:w2((B=c.data)==null?void 0:B.result)??null,status:S}):m.jsx(jU,{role:g,content:String(((z=c.data)==null?void 0:z.content)??"")})})]},c.id)})})]})}class Fu extends Error{constructor(t){super(t),this.name="RunParseError"}}const qU=["critical","high","medium","low"];function PU(e){const t=String(e??"").toLowerCase().trim();return qU.includes(t)?t:"low"}function FU(e){if(typeof e=="string"&&e.trim()){const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(!Number.isNaN(r.getTime()))return r.toISOString();const a=new Date(e);if(!Number.isNaN(a.getTime()))return a.toISOString()}return new Date().toISOString()}function xt(e){return typeof e=="string"&&e.length>0?e:null}function GU(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function N2(e,t){try{return JSON.parse(e)}catch{throw new Fu(`${t} isn't valid JSON. Make sure you selected a Strix run directory.`)}}function VU(e){const t=N2(e,"run.json");if(!t||typeof t!="object"||Array.isArray(t))throw new Fu("run.json is not an object.");const r=t,a=[],s=r.targets_info;if(Array.isArray(s)){for(const y of s)if(y&&typeof y=="object"){const _=y.original;typeof _=="string"&&_&&a.push(_)}}const o=xt(r.start_time),c=xt(r.end_time);let d=null;if(o&&c){const y=new Date(o).getTime(),_=new Date(c).getTime();!Number.isNaN(y)&&!Number.isNaN(_)&&_>=y&&(d=Math.round((_-y)/1e3))}let f=null,h=null,p=null,g=null;const b=r.scan_results;if(b&&typeof b=="object"){const y=b;f=xt(y.executive_summary),h=xt(y.technical_analysis),p=xt(y.methodology),g=xt(y.recommendations)}return{runId:xt(r.run_id),runName:xt(r.run_name),targets:a,scanMode:xt(r.scan_mode),status:xt(r.status),startTime:o,endTime:c,durationSeconds:d,executiveSummary:f,technicalAnalysis:h,methodology:p,recommendations:g}}function YU(){return{pr_review_id:null,cve:null,cvss:null,potential_risk_saving:null,risk_saving_description:null,impact:null,endpoint:null,method:null,target:null,technical_analysis:null,poc_description:null,poc_script_code:null,code_diff:null,code_file:null,code_before:null,code_after:null,cwe:null,code_locations:null,remediation_steps:null,fix_pr_body:null,evidence:null,assumptions:null,fix_effort:null,cvss_breakdown:null,status_changed_at:null,status_changed_by:null,status_note:null,snoozed_until:null,reopened_at:null,reopened_by:null,original_severity:null,severity_changed_at:null,severity_changed_by:null,severity_override_reason:null,retest_of_vulnerability_id:null}}function XU(e,t,r){const a=e.cwe,s=typeof a=="string"&&a.trim()?[a.trim()]:Array.isArray(a)?a.filter(c=>typeof c=="string"&&c):null,o=e.status==="closed"?"closed":"open";return{...YU(),id:xt(e.id)??`vuln-${t+1}`,scan_id:r,title:xt(e.title)??"Untitled finding",description:xt(e.description)??"",severity:PU(e.severity),status:o,triage_status:e.triage_status==="closed"?"closed":"open",resolution_reason:e.resolution_reason==="false_positive"?"false_positive":null,reason_code:typeof e.reason_code=="string"&&Object.hasOwn(Mp,e.reason_code)?e.reason_code:"unspecified",triage_revision:typeof e.triage_revision=="number"&&Number.isSafeInteger(e.triage_revision)?e.triage_revision:0,finding_digest:xt(e.finding_digest)??"",review_stale:e.review_stale===!0,can_triage:e.can_triage===!0&&typeof e.id=="string"&&!!e.id,status_note:xt(e.status_note),status_changed_at:xt(e.status_changed_at),status_changed_by:xt(e.status_changed_by),created_at:FU(e.timestamp),cve:xt(e.cve),cvss:GU(e.cvss),impact:xt(e.impact),endpoint:xt(e.endpoint),method:xt(e.method),target:xt(e.target),technical_analysis:xt(e.technical_analysis),poc_description:xt(e.poc_description),poc_script_code:xt(e.poc_script_code),cwe:s,code_locations:Array.isArray(e.code_locations)?e.code_locations:null,remediation_steps:xt(e.remediation_steps),fix_pr_body:xt(e.fix_pr_body),evidence:xt(e.evidence),assumptions:xt(e.assumptions),fix_effort:xt(e.fix_effort)??null,cvss_breakdown:e.cvss_breakdown??null}}function S2(e,t=null){const r=N2(e,"vulnerabilities.json");if(!Array.isArray(r))throw new Fu("vulnerabilities.json is not a JSON array.");return r.map((a,s)=>{if(!a||typeof a!="object")throw new Fu(`vulnerabilities.json entry #${s+1} is not an object.`);return XU(a,s,t)})}function KU(e){const t={critical:0,high:0,medium:0,low:0};for(const r of e)t[r.severity]+=1;return t}function ZU(e){const t=e==null?void 0:e.mcp_connection_status;return Array.isArray(t)?t.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return[];const a=r,s=typeof a.name=="string"?a.name.trim():"";if(!s)return[];const o=typeof a.provider=="string"&&a.provider.trim()?a.provider.trim():null,c=typeof a.tool_count=="number"?a.tool_count:0,d=a.dead===!0;return[{name:s,provider:o,toolCount:c,dead:d}]}):[]}async function ga(e){const t=await fetch(e,{cache:"no-store"});if(!t.ok){const r=await t.json().catch(()=>null);throw(r==null?void 0:r.error)==="invalid_triage"?new Error("The saved triage file could not be read. Findings have not been refreshed; repair the file before continuing."):new Error(`Could not refresh run data (${t.status}).`)}return t.json()}function al(e){return e?`?run=${encodeURIComponent(e)}`:""}async function QU(e){const t=await ga("/api/run"+al(e)),r=VU(JSON.stringify(t)),a=t.finished===!0;return{summary:r,raw:t,finished:a}}async function Sp(e,t){const r=await ga("/api/vulnerabilities"+al(t));return S2(JSON.stringify(r),e)}async function WU(e){const t=await ga("/api/triage/revision"+al(e));return JSON.stringify(t.revision)}class co extends Error{constructor(t,r){super(r),this.code=t}}async function JU(e,t,r){const{ok:a,data:s}=await ts(`/api/vulnerabilities/${encodeURIComponent(e.id)}/triage`+al(r),{...t,expected_revision:e.triage_revision??0,reviewed_digest:e.finding_digest??""});if(!a||!s.finding||typeof s.finding!="object"){const o=String(s.error??"unavailable"),c={conflict:"This finding changed. Review the latest evidence and reopen the form before saving.",invalid_triage:"The saved triage file could not be read. Fix it before changing this finding.",read_only:"This run is read-only. Its findings cannot be changed.",unknown_finding:"This finding is no longer available in the run.",unverified:"Verify your email to access this historical run.",forbidden:"Your viewer session has expired. Reopen the viewer using its authorized link.",invalid_request:"The decision could not be saved. Check the form and try again."};throw new co(o,c[o]??"Could not save this decision. Try again.")}return S2(JSON.stringify([s.finding]),e.scan_id)[0]}async function eH(e){const t=await ga("/api/report"+al(e));return(t==null?void 0:t.markdown)??null}async function tH(e){const t=await ga("/api/transcript"+al(e));return{agents:Array.isArray(t==null?void 0:t.agents)?t.agents:[],events:Array.isArray(t==null?void 0:t.events)?t.events:[]}}async function nH(e){const{summary:t,raw:r,finished:a}=await QU(e),[s,o,c]=await Promise.all([Sp(t.runId,e),eH(e).catch(()=>null),tH(e).catch(()=>({agents:[],events:[]}))]);return{summary:t,raw:r,finished:a,vulnerabilities:s,reportMarkdown:o,transcript:c}}async function ts(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store"});let a={};try{const s=await r.json();s&&typeof s=="object"&&(a=s)}catch{}return{ok:r.ok,status:r.status,data:a}}async function rH(){const e=await ga("/api/runs");return{locked:(e==null?void 0:e.locked)??!0,count:typeof(e==null?void 0:e.count)=="number"?e.count:0,runs:Array.isArray(e==null?void 0:e.runs)?e.runs:[]}}async function iH(){const e=await ga("/api/capabilities");return{can_steer:(e==null?void 0:e.can_steer)===!0}}async function aH(e,t){const{ok:r,data:a}=await ts("/api/agents/steer",{agent_id:e,message:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function sH(e,t){const{ok:r,data:a}=await ts("/api/feedback",{message:e,email:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function lH(){const e=await ga("/api/auth/status");return{verified:(e==null?void 0:e.verified)===!0,email:(e==null?void 0:e.email)??null}}async function k2(e){const{ok:t,data:r}=await ts("/api/auth/otp/start",{email:e});return t&&r.ok===!0?{ok:!0}:{ok:!1,error:String(r.error??"unavailable")}}async function C2(e,t){const{ok:r,data:a}=await ts("/api/auth/otp/verify",{email:e,code:t});return r&&a.verified===!0?{verified:!0,email:String(a.email??e)}:{verified:!1,error:String(a.error??"invalid_code")}}async function oH(){await ts("/api/auth/forget",{})}async function cH(e){const{ok:t,data:r}=await ts("/api/report/send",e?{run:e}:{});return t&&r.ok===!0?{ok:!0,password:String(r.password??""),filename:String(r.filename??"strix-original-scan-report.pdf")}:{ok:!1,error:String(r.error??"unavailable")}}const Hs="__root__";function T2({agents:e,fixedAgentId:t,className:r}){const a=J.useRef(null),[s,o]=J.useState(!1),[c,d]=J.useState(!1),[f,h]=J.useState(""),[p,g]=J.useState(!1),[b,y]=J.useState(null),_=t!=null,N=J.useMemo(()=>e.find(I=>!I.parent_id)??e[0]??null,[e]),S=J.useMemo(()=>e.filter(I=>I.parent_id&&I.status==="running"),[e]),[w,k]=J.useState(Hs),[E,M]=J.useState(!1);J.useEffect(()=>{w!==Hs&&!S.some(I=>I.id===w)&&k(Hs)},[w,S]);const{targetId:H,targetName:A}=J.useMemo(()=>{if(_){const V=e.find(F=>F.id===t)??null;return{targetId:t??null,targetName:(V==null?void 0:V.name)??"this agent"}}if(w===Hs)return{targetId:(N==null?void 0:N.id)??null,targetName:"Root agent"};const I=e.find(V=>V.id===w)??null;return{targetId:(I==null?void 0:I.id)??(N==null?void 0:N.id)??null,targetName:(I==null?void 0:I.name)??"Root agent"}},[e,t,_,N,w]),B=f.trim().length===0;J.useLayoutEffect(()=>{const I=a.current;I&&(I.style.height="auto",I.style.height=`${I.scrollHeight}px`)},[f]);const z=J.useCallback(()=>{o(!0),requestAnimationFrame(()=>{var I;return(I=a.current)==null?void 0:I.focus()})},[]),X=J.useCallback(()=>{o(!1),d(!1),M(!1)},[]),j=J.useCallback(async()=>{if(p)return;const I=f.trim();if(!I||!H)return;g(!0),y(null);const V=A,F=await aH(H,I);g(!1),F.ok?(h(""),y(`Sent to ${V}`),Mr("agent_steered")):F.error==="not_delivered"?y("Could not reach that agent (it may have finished)."):y("Could not send that message. Try again.")},[p,f,H,A]);return s?m.jsxs("div",{className:br("mt-4 rounded-2xl border border-white/[0.08] bg-[#050505] overflow-hidden transition-colors duration-300",c?"border-white/[0.18]":"hover:border-white/[0.12]",r),children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-white/[0.06] px-5 py-3",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Vm,{className:"h-4 w-4 text-[#666]"}),m.jsx("p",{className:"text-sm font-medium text-white",children:"Live prompt"})]}),m.jsx("p",{className:"mt-0.5 text-xs text-[#777]",children:"Connected"})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[_?m.jsxs("div",{className:"rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-1 text-xs text-[#aaa]",children:["Target: ",m.jsx("span",{className:"text-white",children:A})]}):m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs text-[#aaa]",children:"Target:"}),m.jsxs("div",{className:"relative",children:[m.jsxs("button",{type:"button",onClick:()=>M(I=>!I),onBlur:()=>requestAnimationFrame(()=>M(!1)),className:"inline-flex h-7 items-center gap-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 text-xs text-white transition-colors hover:border-white/[0.16] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-haspopup":"listbox","aria-expanded":E,children:[m.jsx("span",{className:"max-w-[140px] truncate",children:A}),m.jsx(xo,{className:"h-3.5 w-3.5 text-[#999]"})]}),E&&m.jsxs("div",{className:"absolute right-0 z-10 mt-1 min-w-[160px] overflow-hidden rounded-lg border border-[#333] bg-[#0a0a0a] py-1 shadow-xl",role:"listbox",children:[m.jsx(k_,{label:"Root agent",active:w===Hs,onSelect:()=>{k(Hs),M(!1)}}),S.map(I=>m.jsx(k_,{label:I.name,active:w===I.id,onSelect:()=>{k(I.id),M(!1)}},I.id))]})]})]}),m.jsx("button",{type:"button",onClick:X,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[#777] transition-colors hover:bg-white/[0.06] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-label":"Collapse live prompt composer",children:m.jsx(xo,{className:"h-4 w-4"})})]})]}),m.jsx("div",{className:"px-5 pt-4 pb-3",children:m.jsx("textarea",{ref:a,rows:1,value:f,onChange:I=>h(I.target.value),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),j())},placeholder:"Send a live prompt to the running pentest…",maxLength:4e3,disabled:p,className:"block w-full resize-none border-0 bg-transparent p-0 text-[15px] leading-6 text-white placeholder:text-[#444] focus:outline-none disabled:opacity-60 max-h-[160px] overflow-y-auto"})}),m.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 pb-4",children:[m.jsx("div",{className:"text-xs text-[#666]",children:b??"Press Enter to send."}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),j()},disabled:p||B,className:br("inline-flex h-10 min-w-[112px] items-center justify-center gap-2 rounded-full px-4 text-sm font-medium transition-colors",p||B?"bg-white/[0.08] text-[#666]":"bg-white text-black hover:bg-neutral-200"),children:[p?m.jsx(Fs,{className:"h-4 w-4 animate-spin"}):m.jsx(Qk,{className:"h-4 w-4",strokeWidth:2.5}),m.jsx("span",{children:"Send prompt"})]})]})]}):m.jsxs("button",{type:"button",onClick:z,className:br("mt-4 flex w-full items-center justify-between gap-3 rounded-2xl border border-white/[0.08] bg-[#050505] px-5 py-3 text-left transition-colors duration-300 hover:border-white/[0.12] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20",r),"aria-expanded":!1,"aria-label":"Expand live prompt composer",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[m.jsx(Vm,{className:"h-4 w-4 shrink-0 text-[#666]"}),m.jsx("span",{className:"truncate text-sm font-medium text-white",children:"Guide the agent"})]}),m.jsx(G_,{className:"h-4 w-4 shrink-0 text-[#777]"})]})}function k_({label:e,active:t,onSelect:r}){return m.jsx("button",{type:"button",role:"option","aria-selected":t,onMouseDown:a=>{a.preventDefault(),r()},className:br("block w-full truncate px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/[0.06]",t?"text-white":"text-[#aaa]"),children:e})}const uH={completed:"bg-emerald-400",running:"bg-blue-400",waiting:"bg-yellow-400",stopped:"bg-[#888]",crashed:"bg-red-400",failed:"bg-red-400"},dH=80;function fH({open:e,agent:t,events:r,steerable:a,onClose:s}){const o=J.useRef(null),c=J.useRef(!1),[d,f]=J.useState(e),[h,p]=J.useState(e?"open":"closed"),[g,b]=J.useState(!1),y=J.useRef(t);J.useEffect(()=>{t&&(y.current=t)},[t]);const _=t??y.current;J.useEffect(()=>{if(e){f(!0),p("open");return}p("closed");const S=setTimeout(()=>f(!1),140);return()=>clearTimeout(S)},[e]),J.useEffect(()=>{if(!d){b(!1);return}const S=requestAnimationFrame(()=>b(!0));return()=>cancelAnimationFrame(S)},[d]);const N=J.useCallback(()=>{const S=o.current;S&&(c.current=S.scrollHeight-S.scrollTop-S.clientHeight{const S=o.current;!S||!c.current||requestAnimationFrame(()=>{S.scrollTo({top:S.scrollHeight,behavior:"smooth"})})},[r]),J.useEffect(()=>{if(!d)return;const S=k=>{k.key==="Escape"&&s()};document.addEventListener("keydown",S);const w=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",S),document.body.style.overflow=w}},[d,s]),!d||!_?null:m.jsx("div",{"data-state":h,className:"agent-modal fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 sm:p-8",onClick:s,role:"dialog","aria-modal":"true","aria-label":`Agent ${_.name}`,children:m.jsxs("div",{className:"relative flex h-[60vh] w-[calc(100vw-4rem)] max-w-6xl flex-col overflow-hidden rounded-xl border border-[#222] bg-[#0a0a0a] shadow-2xl",onClick:S=>S.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[#222] px-5 py-3.5",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:`h-2 w-2 flex-shrink-0 rounded-full ${uH[_.status]??"bg-[#888]"}`}),m.jsx("span",{className:"truncate text-sm font-semibold text-white",children:_.name}),m.jsx("span",{className:"flex-shrink-0 font-mono text-xs text-[#555]",children:_.id})]}),m.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"flex-shrink-0 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:m.jsx(Ap,{className:"h-4 w-4"})})]}),m.jsx("div",{ref:o,onScroll:N,className:"flex-1 overflow-y-auto p-5",children:g&&m.jsx($U,{agent:_,events:r,showHeader:!1})}),a&&m.jsx("div",{className:"border-t border-[#222] px-5 py-3",children:m.jsx(T2,{agents:[_],fixedAgentId:_.id,className:"mt-0"})})]})})}var A2={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},C_=fa.createContext&&fa.createContext(A2),hH=["attr","size","title"];function mH(e,t){if(e==null)return{};var r,a,s=pH(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;afa.createElement(t.tag,Vu({key:r},t.attr),M2(t.child)))}function kg(e){return t=>fa.createElement(yH,Gu({attr:Vu({},e.attr)},t),M2(e.child))}function yH(e){var t=r=>{var a=e.attr,s=e.size,o=e.title,c=mH(e,hH),d=s||r.size||"1em",f;return r.className&&(f=r.className),e.className&&(f=(f?f+" ":"")+e.className),fa.createElement("svg",Gu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,a,c,{className:f,style:Vu(Vu({color:e.color||r.color},r.style),e.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),o&&fa.createElement("title",null,o),e.children)};return C_!==void 0?fa.createElement(C_.Consumer,null,r=>t(r)):t(A2)}function vH(e){return kg({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"5",cy:"6",r:"3"},child:[]},{tag:"path",attr:{d:"M5 9v12"},child:[]},{tag:"circle",attr:{cx:"19",cy:"18",r:"3"},child:[]},{tag:"path",attr:{d:"m15 9-3-3 3-3"},child:[]},{tag:"path",attr:{d:"M12 6h5a2 2 0 0 1 2 2v7"},child:[]}]})(e)}function _H(e){return kg({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 4.95703C15 4.58711 14.8563 4.24054 14.5949 3.97992L12.0096 1.39234C11.4879 0.86922 10.5788 0.86922 10.0571 1.39234L8 3.45119V3.32321C8 2.55068 7.37187 1.922 6.6 1.922H2.4C1.62813 1.922 1 2.55068 1 3.32321V13.5988C1 14.3713 1.62813 15 2.4 15H12.6667C13.4385 15 14.0667 14.3713 14.0667 13.5988V9.39514C14.0667 8.62261 13.4385 7.99393 12.6667 7.99393H12.5379L14.5949 5.93508C14.8553 5.67445 15 5.32602 15 4.95703ZM2.4 2.85521H6.6C6.85667 2.85521 7.06667 3.06446 7.06667 3.32228V7.99299H1.93333V3.32228C1.93333 3.06446 2.14333 2.85521 2.4 2.85521ZM1.93333 13.5979V8.92714H7.06667V14.0649H2.4C2.14333 14.0649 1.93333 13.8547 1.93333 13.5979ZM13.1333 9.39421V13.5979C13.1333 13.8547 12.9233 14.0649 12.6667 14.0649H8V8.92714H12.6667C12.9233 8.92714 13.1333 9.13638 13.1333 9.39421ZM8 7.99299V6.46287L9.5288 7.99299H8ZM13.9351 5.2737L11.3488 7.86221C11.1789 8.03223 10.8859 8.03223 10.716 7.86221L8.12973 5.2737C8.0448 5.18963 7.99813 5.07753 7.99813 4.95796C7.99813 4.83839 8.0448 4.7263 8.12973 4.64129L10.716 2.05278C10.8009 1.96777 10.9129 1.92106 11.0324 1.92106C11.1519 1.92106 11.2639 1.96777 11.3488 2.05278L13.9351 4.64129C14.02 4.72536 14.0667 4.83746 14.0667 4.95703C14.0667 5.0766 14.02 5.1887 13.9351 5.2737Z"},child:[]}]})(e)}function O2(e){return kg({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a34 34 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1 15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.4 26.4 0 0 1 9.3-1.7 26 26 0 0 1 10.1 2l56.7 20.1a13.5 13.5 0 0 0 3.9 1 8 8 0 0 0 8-8 13 13 0 0 0-.5-2.7z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.3 7.3 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.2 159.2 0 0 0 284 432.11"},child:[]}]})(e)}const wH=[{icon:HC,label:"PR security reviews"},{icon:ST,label:"Attack surface monitoring"},{icon:HT,label:"Real-time threat intelligence"},{icon:aC,label:"Scheduled pentesting"},{icon:zT,label:"One-click autofix"},{icon:W_,label:"Jira, Linear & Slack integrations"}];function EH({open:e,onClose:t,description:r,source:a="sidebar"}){const[s,o]=J.useState(e),[c,d]=J.useState(e?"open":"closed");return J.useEffect(()=>{if(e){o(!0),d("open");return}d("closed");const f=setTimeout(()=>o(!1),200);return()=>clearTimeout(f)},[e]),J.useEffect(()=>{if(!s)return;const f=p=>{p.key==="Escape"&&t()};document.addEventListener("keydown",f);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",f),document.body.style.overflow=h}},[s,t]),s?m.jsx("div",{"data-state":c,className:"dialog-overlay fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:t,role:"dialog","aria-modal":"true","aria-label":"Upgrade your plan",children:m.jsxs("div",{"data-state":c,className:"dialog-panel relative w-full max-w-md rounded-2xl border border-[#222] bg-black p-6 shadow-lg sm:rounded-lg",onClick:f=>f.stopPropagation(),children:[m.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-4 top-4 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:m.jsx(Ap,{className:"h-4 w-4"})}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-lg text-white",children:"Available in Strix Cloud"}),r&&m.jsx("p",{className:"mt-2 text-base leading-relaxed text-[#e5e5e5]",children:r})]}),m.jsxs("div",{className:"space-y-4 pt-4",children:[m.jsxs("div",{className:"rounded-xl border border-[#333] bg-[#0a0a0a] p-4 sm:rounded-lg",children:[m.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[m.jsx(Vm,{className:"h-4 w-4 text-blue-400"}),m.jsx("span",{className:"text-sm font-medium text-white",children:"Strix Cloud also includes"})]}),m.jsx("ul",{className:"space-y-2 text-sm text-[#888]",children:wH.map(f=>m.jsxs("li",{className:"flex items-center gap-2",children:[m.jsx(f.icon,{className:"h-3.5 w-3.5 text-[#555]"}),f.label]},f.label))})]}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("a",{href:_i(Ku,"upgrade_try_free"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("upgrade_try_free",a),className:"flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-white px-4 text-sm font-semibold text-black transition-colors hover:bg-neutral-200",children:["Open Strix Cloud",m.jsx(my,{className:"h-3.5 w-3.5"})]}),m.jsxs("a",{href:_i(GT,"upgrade_view_plans"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("upgrade_view_plans",a),className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-lg border border-[#333] px-4 text-sm font-medium text-[#888] transition-colors hover:border-[#555] hover:text-white",children:["Learn more",m.jsx(my,{className:"h-3 w-3"})]})]}),m.jsxs("p",{className:"text-center text-xs text-[#666]",children:["SSO, compliance reports, or a private deployment?"," ",m.jsx("a",{href:_i(jp,"upgrade_book_demo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("upgrade_book_demo",a),className:"whitespace-nowrap text-[#aaa] underline underline-offset-2 transition-colors hover:text-white",children:"Try Strix Enterprise"})]})]})]})}):null}const $m=160,qm=260,ao=400,NH=140,A_="strix_viewer_sidebar_width",M_="strix_viewer_sidebar_collapsed";function SH(e,t){try{const r=localStorage.getItem(e),a=r?parseInt(r,10):NaN;return Number.isFinite(a)?a:t}catch{return t}}function kH({view:e,onSelectView:t,issuesCount:r,agentCount:a,mcpConnections:s,mcpInUse:o,runCount:c,finished:d,verified:f,email:h,onOpenEmail:p,onOpenHistory:g,onForget:b}){var F;const[y,_]=J.useState(()=>{const C=SH(A_,qm);return Math.min(ao,Math.max($m,C))}),[N,S]=J.useState(()=>{try{return localStorage.getItem(M_)==="1"}catch{return!1}}),[w,k]=J.useState(!1),[E,M]=J.useState(!1),[H,A]=J.useState(null),B=J.useRef(null),z=(C,$)=>{yr(C,"sidebar"),A($)},X=J.useCallback(C=>{_(C);try{localStorage.setItem(A_,String(C))}catch{}},[]),j=J.useCallback(C=>{S(C);try{localStorage.setItem(M_,C?"1":"0")}catch{}},[]),I=J.useCallback(()=>{j(!1),X(qm)},[j,X]),V=J.useCallback(C=>{C.preventDefault(),k(!0)},[]);return J.useEffect(()=>{if(!w||N)return;const C=R=>{const U=R.clientX;U>=$m&&U<=ao?_(U):U>ao&&_(ao)},$=R=>{const U=R.clientX;U{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",$)}},[w,N,j,X]),J.useEffect(()=>{if(!E)return;const C=$=>{B.current&&!B.current.contains($.target)&&M(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[E]),m.jsxs(m.Fragment,{children:[N&&m.jsx("div",{className:"fixed left-0 top-0 z-40 hidden h-full w-4 cursor-pointer transition-colors hover:bg-[rgba(255,255,255,0.08)] lg:block",onClick:I,title:"Expand sidebar"}),m.jsxs("aside",{className:br("sticky top-0 z-20 hidden h-screen flex-shrink-0 flex-col overflow-hidden border-r border-[rgba(255,255,255,0.08)] bg-black lg:flex",!w&&"transition-[width] duration-200 ease-out"),style:{width:N?0:y},children:[m.jsx("header",{className:"relative flex flex-col gap-1 pt-1 min-w-[160px]",children:m.jsx("div",{className:"flex flex-row py-1 px-2",children:m.jsxs("div",{className:"flex h-10 w-full flex-row items-center",children:[m.jsxs("a",{href:_i("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("logo","sidebar"),className:"flex flex-1 flex-row items-center gap-2 rounded-md py-2 pl-2.5 pr-1 min-w-0 transition-colors hover:bg-[rgba(255,255,255,0.06)]",title:"Open Strix Cloud",children:[m.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:m.jsx("span",{className:"text-[10px] font-semibold text-white",children:"S"})}),m.jsxs("span",{className:"flex flex-1 flex-row items-center gap-2 min-w-0",children:[m.jsx("span",{className:"truncate min-w-0 text-[14px] font-medium text-[#ededed]",children:"Strix"}),m.jsx("span",{className:"flex h-5 flex-shrink-0 items-center rounded px-2 text-[11px] font-medium text-[#888] bg-[rgba(255,255,255,0.08)]",children:"Local"})]})]}),m.jsx("a",{href:_i("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("logo","sidebar"),className:"flex flex-none items-center rounded-md px-1.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]","aria-label":"Open Strix Cloud",children:m.jsx(mC,{className:"h-4 w-4 text-[#666]"})})]})})}),m.jsx("nav",{className:"relative min-w-[160px] flex-1 overflow-y-auto overflow-x-clip scrollbar-thin pb-10 pt-2",children:m.jsxs("div",{className:"relative flex flex-col gap-px px-2",children:[m.jsx(yi,{icon:m.jsx(AH,{}),label:"Pentest Overview",active:e==="overview",onClick:()=>t("overview")}),m.jsx(yi,{icon:m.jsx(Tp,{className:"h-4 w-4"}),label:"Issues",count:r>0?r:void 0,active:e==="issues",onClick:()=>t("issues")}),a>0&&m.jsx(yi,{icon:m.jsx(Do,{className:"h-4 w-4"}),label:"Agents",count:a,active:e==="agents",onClick:()=>t("agents")}),s.length>0&&m.jsx(TH,{connections:s,inUse:o}),m.jsx(yi,{icon:m.jsx(Xs,{className:"h-4 w-4"}),label:"Past runs",count:c>0?c:void 0,active:e==="history",onClick:g}),d&&m.jsx(yi,{icon:m.jsx(Cp,{className:"h-4 w-4"}),label:"Export original report",active:e==="email",onClick:p}),m.jsx(yi,{icon:m.jsx(O2,{className:"h-4 w-4"}),label:"Feedback & support",active:e==="feedback",onClick:()=>t("feedback")}),m.jsx("hr",{className:"mx-0 my-1 h-px w-full border-0 bg-[rgba(255,255,255,0.08)]"}),m.jsx(yi,{icon:m.jsx(vH,{className:"h-4 w-4"}),label:"PR Security Reviews",active:!1,onClick:()=>z("pr_reviews","Strix reviews every pull request and flags exploitable changes before they merge.")}),m.jsx(yi,{icon:m.jsx(_H,{className:"h-4 w-4"}),label:"Integrations",active:!1,onClick:()=>z("integrations","Sync findings to Jira, Linear, and Slack so fixes happen where your team already works.")}),m.jsx(yi,{icon:m.jsx(DT,{className:"h-4 w-4"}),label:"Members",active:!1,onClick:()=>z("members","Invite your team, set roles, and share findings and run history across your org.")})]})}),m.jsx("section",{className:"flex min-w-[160px] flex-col gap-0.5",ref:B,children:m.jsxs("div",{className:"relative p-2",children:[f&&h?m.jsxs("button",{onClick:()=>M(C=>!C),className:"relative flex w-full cursor-pointer items-center gap-2 rounded-md bg-transparent px-2.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]",children:[m.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:m.jsx("span",{className:"text-[9px] font-semibold text-white",children:((F=h[0])==null?void 0:F.toUpperCase())||"U"})}),m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:[m.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:h}),m.jsx("span",{className:"truncate text-[11px] text-[#555]",children:"Linked to this machine"})]})]}):m.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2.5 py-2",children:[m.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:m.jsx("span",{className:"text-[9px] font-semibold text-white",children:"S"})}),m.jsx("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:m.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:"Local viewer"})})]}),E&&f&&h&&m.jsxs("div",{className:"absolute bottom-full left-2 right-2 z-50 mb-1 overflow-hidden rounded-lg border border-[#333] bg-black shadow-xl",children:[m.jsxs("div",{className:"border-b border-[#333] px-3 py-2",children:[m.jsx("p",{className:"truncate text-[13px] font-medium text-white",children:"Linked email"}),m.jsx("p",{className:"truncate text-[11px] text-[#666]",children:h})]}),m.jsxs("button",{onClick:()=>{M(!1),b()},className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-[#888] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-red-400",children:[m.jsx(rT,{className:"h-4 w-4"}),"Forget this email"]})]})]})}),m.jsx("div",{className:"group absolute right-0 top-0 z-30 h-full w-1 cursor-col-resize",onMouseDown:V,children:m.jsx("div",{className:br("absolute right-0 top-0 h-full w-px bg-[rgba(255,255,255,0.08)] transition-all duration-100",w?"w-0.5 bg-[rgba(255,255,255,0.3)]":"group-hover:bg-[rgba(255,255,255,0.2)]")})})]}),w&&m.jsx("div",{className:"fixed inset-0 z-10 cursor-col-resize"}),m.jsx(EH,{open:H!==null,description:H??"",source:"sidebar",onClose:()=>A(null)})]})}function yi({icon:e,label:t,active:r,onClick:a,count:s}){return m.jsxs("button",{onClick:a,className:br("group flex h-9 w-full origin-left flex-row items-center rounded-md transition-colors",r?"bg-[rgba(255,255,255,0.12)] text-white":"text-[#888] hover:bg-[rgba(255,255,255,0.06)] hover:text-[#ededed]"),children:[m.jsx("div",{className:"grid flex-none place-content-center",style:{width:36,height:36},children:e}),m.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[14px] font-medium",children:t}),s!=null&&m.jsx("span",{className:"mr-2 flex-none rounded-full border border-white/10 px-2 py-0.5 text-[10px] tabular-nums leading-none text-[#777]",children:s})]})}const O_=["◐","◓","◑","◒"],CH=220;function TH({connections:e,inUse:t}){const r=e.some(o=>!o.dead&&t.has(o.name)),[a,s]=J.useState(0);return J.useEffect(()=>{if(!r)return;const o=setInterval(()=>s(c=>(c+1)%O_.length),CH);return()=>clearInterval(o)},[r]),m.jsxs("div",{className:"mt-1",children:[m.jsxs("div",{className:"flex h-7 items-center px-2 text-[11px] font-medium text-[#666]",children:["MCP Connections (",e.length,")"]}),m.jsx("div",{className:"max-h-48 overflow-y-auto overflow-x-clip scrollbar-thin",children:e.map(o=>{const c=!o.dead&&t.has(o.name);return m.jsxs("div",{className:"flex h-7 items-center gap-2 rounded-md px-2",title:o.provider?`${o.name} · ${o.provider}`:o.name,children:[m.jsx("span",{className:br("w-3 flex-none text-center text-[11px] leading-none",o.dead?"text-red-400":"text-emerald-400"),"aria-hidden":"true",children:o.dead?"●":c?O_[a]:"●"}),m.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-[#ededed]",children:o.name}),o.dead?m.jsx("span",{className:"flex-none text-[11px] text-red-400",children:"offline"}):m.jsxs("span",{className:"flex-none text-[11px] tabular-nums text-[#666]",children:[o.toolCount," ",o.toolCount===1?"tool":"tools"]})]},o.name)})})]})}function AH(){return m.jsx("svg",{style:{width:16,height:16,color:"currentcolor"},viewBox:"0 0 16 16",fill:"currentColor",children:m.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.5 5.5V2.5H5.5V5.5H2.5ZM1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2ZM2.5 13.5V10.5H5.5V13.5H2.5ZM1 10C1 9.44772 1.44772 9 2 9H6C6.55228 9 7 9.44772 7 10V14C7 14.5523 6.55228 15 6 15H2C1.44772 15 1 14.5523 1 14V10ZM10.5 2.5V5.5H13.5V2.5H10.5ZM10 1C9.44772 1 9 1.44772 9 2V6C9 6.55228 9.44772 7 10 7H14C14.5523 7 15 6.55228 15 6V2C15 1.44772 14.5523 1 14 1H10ZM10.5 13.5V10.5H13.5V13.5H10.5ZM9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z"})})}const R_={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},MH=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function OH({onVerified:e}){const[t,r]=J.useState("email"),[a,s]=J.useState(""),[o,c]=J.useState(""),[d,f]=J.useState(!1),[h,p]=J.useState(null),[g,b]=J.useState(null),y=async()=>{const N=a.trim();if(!N){p("Enter your email to continue.");return}const S=N.slice(N.lastIndexOf("@")+1).toLowerCase();if(MH.has(S)){Mr("work_email_required"),p(R_.work_email_required);return}f(!0),p(null);const w=await k2(N);f(!1),w.ok?(Mr("email_submitted",{purpose:"verify"}),b(`We sent a 6-digit code to ${N}.`),r("code")):(w.error==="work_email_required"&&Mr("work_email_required"),p(R_[w.error]??"Could not send a code. Try again."))},_=async()=>{const N=o.trim();if(N.length<4){p("Enter the 6-digit code from your email.");return}f(!0),p(null);const S=await C2(a.trim(),N);if(f(!1),!S.verified){p("That code did not match. Check it and try again.");return}Mr("email_verified",{purpose:"verify"}),e()};return m.jsxs("div",{className:"mx-auto mt-5 max-w-sm text-left",children:[h&&m.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[m.jsx(Yu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs text-red-300",children:h})]}),g&&!h&&m.jsx("p",{className:"mb-3 text-xs text-[#888]",children:g}),t==="email"?m.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),y()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),m.jsx("input",{type:"email",autoFocus:!0,value:a,onChange:N=>s(N.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}}),m.jsx("span",{className:"mt-1.5 block text-[11px] text-[#666]",children:"Use your work email."})]}),m.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}):m.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),_()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),m.jsx("input",{inputMode:"numeric",autoFocus:!0,value:o,onChange:N=>c(N.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),m.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Verify"]}),m.jsx("button",{type:"button",onClick:()=>{r("email"),p(null),b(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]})]})}const RH=[{key:"critical",dot:"bg-red-500",text:"text-red-500"},{key:"high",dot:"bg-orange-500",text:"text-orange-500"},{key:"medium",dot:"bg-yellow-500",text:"text-yellow-500"},{key:"low",dot:"bg-blue-500",text:"text-blue-500"}];function jH({counts:e}){const t=RH.filter(r=>e[r.key]>0);return t.length===0?m.jsx("span",{className:"text-xs text-[#888]",children:"No open findings"}):m.jsx("div",{className:"flex items-center gap-3",children:t.map(r=>m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:`h-2 w-2 rounded-full ${r.dot}`,"aria-hidden":"true"}),m.jsx("span",{className:`text-xs tabular-nums ${r.text}`,children:e[r.key]})]},r.key))})}function DH(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);return Number.isNaN(r.getTime())?null:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function j_(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(Number.isNaN(r.getTime()))return null;const a=Date.now()-r.getTime(),s=Math.floor(a/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const o=Math.floor(s/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:DH(e)}function LH({runs:e,activeRun:t,onSelectRun:r,onVerified:a}){const s=(e==null?void 0:e.count)??0,[o,c]=J.useState(!1);return!e||e.locked?m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center",children:[m.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-xl",style:{border:"1px solid #2a2a2a",background:"rgba(255,255,255,0.04)"},children:m.jsx(Xs,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"})}),m.jsx("h2",{className:"text-base font-semibold text-white",children:"Browse every run on this machine"}),m.jsxs("p",{className:"mx-auto mt-1.5 max-w-md text-sm text-[#888]",children:["You have ",s," past ",s===1?"run":"runs"," on this machine."]}),o?m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"mx-auto mt-3 max-w-sm text-xs text-[#666]",children:"Verify your email with a one-time code to unlock the full history."}),m.jsx(OH,{onVerified:a})]}):m.jsx("button",{onClick:()=>{yr("history_unlock","past_runs"),c(!0)},className:"mt-4 cursor-pointer rounded-lg bg-white px-4 py-2 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"View runs"}),m.jsxs("p",{className:"mt-4 flex items-center justify-center gap-1.5 text-xs text-[#555]",children:[m.jsx(nw,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Or open one from the CLI with"," ",m.jsx("code",{className:"font-mono text-[#888]",children:"strix view "})]})]}):e.runs.length===0?m.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:"No past runs found on this machine yet."}):m.jsx("div",{className:"space-y-2",children:e.runs.map(d=>{const f=d.name===t,h=j_(d.start_time)??j_(d.end_time),p=_o(d.target,d.name);return m.jsxs("button",{onClick:()=>r(d.name),className:`animate-card-in group flex w-full cursor-pointer items-center gap-4 rounded-lg border px-4 py-3 text-left transition-colors ${f?"border-[#444] bg-[rgba(255,255,255,0.04)]":"border-[#222] bg-[rgba(255,255,255,0.02)] hover:border-[#444]"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"truncate text-sm font-medium text-white",children:p}),f&&m.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-400",style:{border:"1px solid rgba(16,185,129,0.3)"},children:"Active"})]}),m.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-[#666]",children:[d.scan_mode&&m.jsx("span",{className:"capitalize",children:d.scan_mode}),d.scan_mode&&(h||d.status)&&m.jsx("span",{className:"text-[#333]",children:"·"}),h&&m.jsx("span",{children:h}),h&&d.status&&m.jsx("span",{className:"text-[#333]",children:"·"}),d.status&&m.jsx("span",{className:"capitalize",children:d.status}),d.open_count!==void 0&&m.jsxs("span",{children:["· ",d.open_count," open · ",d.closed_count??0," false positives · ",d.detected_count??d.open_count," found"]})]})]}),m.jsx(jH,{counts:d.severity_counts}),m.jsx(dC,{className:"h-4 w-4 flex-shrink-0 text-[#555] transition-colors group-hover:text-[#aaa]","aria-hidden":"true"})]},d.name)})})}const D_={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},zH={forbidden:"This email was unsubscribed from Strix, so we cannot send to it.",too_large:"This report is too large to email. Try a smaller run.",unavailable:"The email service is unavailable right now. Try again shortly."},IH=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function BH({activeRun:e,auth:t,purpose:r,skipDisclosure:a=!1,onAuthChanged:s,onExit:o}){const c=(t==null?void 0:t.verified)===!0,d=r==="verify",[f,h]=J.useState(()=>d?"email":a?c?"sending":"email":"disclosure"),[p,g]=J.useState((t==null?void 0:t.email)??""),[b,y]=J.useState(""),[_,N]=J.useState(!1),[S,w]=J.useState(null),[k,E]=J.useState(null),[M,H]=J.useState(""),[A,B]=J.useState(""),[z,X]=J.useState(!1),[j,I]=J.useState(""),V=J.useRef(!1),F=async()=>{h("sending"),w(null);const Z=await cH(e);if(Z.ok){Mr("report_sent"),H(Z.password),B(Z.filename),h("password");return}if(Z.error==="reverify"||Z.error==="unverified"){E("Your verification expired. Enter your email to verify again."),h("email");return}w(zH[Z.error]??"Could not send the report. Try again."),h("disclosure")},C=()=>{w(null),E(null),c?F():h("email")};J.useEffect(()=>{!d&&a&&c&&!V.current&&(V.current=!0,F())},[]);const $=async()=>{const Z=p.trim();if(!Z){w("Enter your email to continue.");return}const O=Z.slice(Z.lastIndexOf("@")+1).toLowerCase();if(IH.has(O)){Mr("work_email_required"),w(D_.work_email_required);return}N(!0),w(null);const D=await k2(Z);N(!1),D.ok?(Mr("email_submitted",{purpose:r}),E(`We sent a 6-digit code to ${Z}.`),h("code")):(D.error==="work_email_required"&&Mr("work_email_required"),w(D_[D.error]??"Could not send a code. Try again."))},R=async()=>{const Z=b.trim();if(Z.length<4){w("Enter the 6-digit code from your email.");return}N(!0),w(null);const O=await C2(p.trim(),Z);if(N(!1),!O.verified){w("That code did not match. Check it and try again.");return}Mr("email_verified",{purpose:r}),I(O.email),s(),d?o("history"):F()},U=async()=>{try{await navigator.clipboard.writeText(M),X(!0),setTimeout(()=>X(!1),1500)}catch{}},K=j||(t==null?void 0:t.email)||p.trim();return m.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[m.jsxs("button",{onClick:()=>o(d?"history":"overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[m.jsx(kp,{className:"h-4 w-4"}),d?"Back to past runs":"Back to results"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Cp,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),m.jsx("h1",{className:"text-2xl font-semibold text-white",children:d?"Verify your email":"Export original scan report"})]}),!d&&m.jsx("p",{className:"text-sm text-[#aaa]",children:"This PDF preserves the original detected findings. Subsequent false-positive decisions and local triage notes are excluded."}),m.jsxs("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:[m.jsx("p",{className:"mb-4 text-xs text-[#666]",children:d?"We send a one-time code to confirm it is you.":"Verified by a one-time code sent to your email"}),S&&m.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[m.jsx(Yu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs text-red-300",children:S})]}),k&&!S&&f!=="password"&&m.jsx("p",{className:"mb-4 text-xs text-[#888]",children:k}),f==="disclosure"&&m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"space-y-2.5 rounded-lg p-3.5",style:{border:"1px solid #222",background:"rgba(255,255,255,0.02)"},children:[m.jsxs("div",{className:"flex items-start gap-2.5",children:[m.jsx(tw,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsxs("p",{className:"text-xs leading-relaxed text-[#aaa]",children:["We email an ",m.jsx("span",{className:"text-white",children:"encrypted PDF"}),". Nothing else leaves your machine."]})]}),m.jsxs("div",{className:"flex items-start gap-2.5",children:[m.jsx(tT,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),m.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:"Only you hold the password; Strix can't read it."})]})]}),m.jsx("button",{onClick:C,className:"w-full cursor-pointer rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"Export original report"}),c&&(t==null?void 0:t.email)&&m.jsxs("p",{className:"text-center text-xs text-[#666]",children:["Sending to ",t.email]})]}),f==="email"&&m.jsxs("form",{className:"space-y-4",onSubmit:Z=>{Z.preventDefault(),$()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),m.jsx("input",{type:"email",autoFocus:!0,value:p,onChange:Z=>g(Z.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),m.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}),f==="code"&&m.jsxs("form",{className:"space-y-4",onSubmit:Z=>{Z.preventDefault(),R()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),m.jsx("input",{inputMode:"numeric",autoFocus:!0,value:b,onChange:Z=>y(Z.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),m.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),d?"Verify":"Verify and send"]}),m.jsx("button",{type:"button",onClick:()=>{h("email"),w(null),E(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]}),f==="sending"&&m.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[m.jsx(Fs,{className:"h-6 w-6 animate-spin text-white","aria-hidden":"true"}),m.jsx("p",{className:"text-sm text-[#aaa]",children:"Generating and encrypting locally..."})]}),f==="password"&&m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5",children:[m.jsx(Ys,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsxs("p",{className:"text-xs text-emerald-200",children:["Sent to ",K,". Open the attached PDF with this password."]})]}),m.jsxs("div",{children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your one-time password"}),m.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-black p-3",style:{border:"1px solid #2a2a2a"},children:[m.jsx("code",{className:"flex-1 break-all font-mono text-base text-white",children:M}),m.jsxs("button",{onClick:U,className:"flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs text-[#aaa] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-white",style:{border:"1px solid #2a2a2a"},children:[z?m.jsx(Ys,{className:"h-3.5 w-3.5"}):m.jsx(bo,{className:"h-3.5 w-3.5"}),z?"Copied":"Copy"]})]}),m.jsxs("p",{className:"mt-2 text-xs text-[#666]",children:["Save this now. Strix never stores it, so we cannot show it again. File:"," ",m.jsx("span",{className:"font-mono text-[#888]",children:A})]})]}),m.jsx("button",{onClick:()=>o("overview"),className:"w-full cursor-pointer rounded-lg px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-[rgba(255,255,255,0.06)]",style:{border:"1px solid #2a2a2a"},children:"Done"})]})]})]})}function oa(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function so(e){return Array.isArray(e)?e:[]}function nr(e){return typeof e=="string"&&e.trim()?e:null}function Ua(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function UH(e){return e.replace(/_/g," ")}function L_(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function HH(e){if(e==null||e<0)return"n/a";const t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t?`${t}h ${r}m ${a}s`:r?`${r}m ${a}s`:`${a}s`}function En({label:e,children:t}){return m.jsxs("div",{className:"grid grid-cols-[7rem_1fr] gap-3 items-baseline",children:[m.jsx("dt",{className:"text-[11px] uppercase tracking-wide text-[#666]",children:e}),m.jsx("dd",{className:"min-w-0 break-words text-sm text-[#ddd]",children:t})]})}function $H({raw:e,durationSeconds:t}){const[r,a]=J.useState(!0),s=so(e.targets_info).map(F=>{const C=oa(F),$=nr(C.original)??nr(oa(C.details).target_url)??"unknown target",R=nr(C.type);return{display:$,type:R?UH(R):null}}),o=nr(e.instruction),c=L_(nr(e.scan_mode)),d=nr(e.scope_mode),f=oa(e.diff_scope),h=f.active===!0,p=nr(f.mode),g=nr(e.diff_base),b=e.non_interactive===!0,y=so(e.local_sources).map(F=>{if(typeof F=="string")return F;const C=oa(F);return nr(C.source_path)??nr(C.target_path)??""}).filter(Boolean),_=L_(nr(e.status));let N=d??"auto";h&&(N+=` (diff${p?`: ${p}`:""}${g?` vs ${g}`:""})`);const S=oa(e.llm_usage),w=Object.keys(S).length>0,k=so(S.agents).map(oa),E=Array.from(new Set(k.map(F=>nr(F.model)).filter(F=>!!F))),M=Ua(S.requests),H=Ua(S.input_tokens),A=Ua(oa(so(S.input_tokens_details)[0]).cached_tokens),B=Ua(S.output_tokens),z=Ua(oa(so(S.output_tokens_details)[0]).reasoning_tokens),X=Ua(S.total_tokens),j=Ua(S.cost),I=nr(e.auth_mode)==="subscription",V=(F,C)=>m.jsxs("span",{className:"text-[#666]",children:[" (",zs(F)," ",C,")"]});return m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsxs("button",{type:"button",onClick:()=>a(F=>!F),"aria-expanded":r,className:"flex w-full cursor-pointer items-center gap-2 text-left",children:[m.jsx(ZC,{className:"h-4 w-4 text-[#888]","aria-hidden":"true"}),m.jsx("h2",{className:"text-sm font-semibold text-white",children:"Run details"}),r?m.jsx(G_,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"}):m.jsx(xo,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"})]}),r&&m.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2",children:[m.jsxs("section",{children:[m.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Configuration"}),m.jsxs("dl",{className:"space-y-2.5",children:[s.length>0&&m.jsx(En,{label:"Targets",children:m.jsx("div",{className:"space-y-1",children:s.map((F,C)=>m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.jsx("span",{className:"font-mono text-[#ddd]",children:F.display}),F.type&&m.jsx("span",{className:"rounded-full border border-[#2a2a2a] px-1.5 py-0.5 text-[10px] text-[#888]",children:F.type})]},C))})}),m.jsx(En,{label:"Instruction",children:o?m.jsx("span",{className:"whitespace-pre-wrap",children:o}):m.jsx("span",{className:"text-[#666]",children:"None"})}),c&&m.jsx(En,{label:"Pentest mode",children:c}),m.jsx(En,{label:"Scope",children:N}),m.jsx(En,{label:"Mode",children:b?"Non-interactive":"Interactive"}),y.length>0&&m.jsx(En,{label:"Local sources",children:m.jsx("div",{className:"space-y-0.5 font-mono text-[#ddd]",children:y.map((F,C)=>m.jsx("div",{children:F},C))})}),_&&m.jsx(En,{label:"Status",children:_})]})]}),m.jsxs("section",{children:[m.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Usage & cost"}),w?m.jsxs("dl",{className:"space-y-2.5 tabular-nums",children:[m.jsx(En,{label:"Model",children:E.length?E.join(", "):"n/a"}),I&&m.jsx(En,{label:"Provider",children:m.jsx("span",{className:"inline-flex items-center gap-1.5",children:m.jsx("span",{className:"rounded-full border border-[#22c55e]/40 bg-[#22c55e]/10 px-2 py-0.5 text-[11px] text-[#22c55e]",children:"ChatGPT subscription"})})}),m.jsx(En,{label:"Run time",children:HH(t)}),M!=null&&m.jsx(En,{label:"Requests",children:zs(M)}),H!=null&&m.jsxs(En,{label:"Input tokens",children:[zs(H),A!=null&&V(A,"cached")]}),B!=null&&m.jsxs(En,{label:"Output tokens",children:[zs(B),z!=null&&V(z,"reasoning")]}),X!=null&&m.jsx(En,{label:"Total tokens",children:zs(X)}),I?m.jsxs(En,{label:"Cost",children:[m.jsx("span",{className:"text-[#22c55e]",children:"$0.00"}),m.jsx("span",{className:"text-[#666]",children:" (subscription)"})]}):j!=null&&m.jsxs(En,{label:"Cost",children:["$",j.toFixed(2)]}),k.length>0&&m.jsx(En,{label:"Agents",children:zs(k.length)})]}):m.jsx("p",{className:"text-sm text-[#666]",children:"Not available yet."})]})]})]})}const z_="strix_viewer_trust_dismissed";function qH({message:e}){const[t,r]=J.useState(()=>{try{return localStorage.getItem(z_)==="1"}catch{return!1}});if(t)return null;const a=()=>{try{localStorage.setItem(z_,"1")}catch{}r(!0)};return m.jsx("div",{className:"fixed bottom-3 left-3 z-[60] max-w-xs rounded-lg bg-[#0a0a0a] p-3 shadow-2xl",style:{border:"1px solid #2a2a2a"},role:"status",children:m.jsxs("div",{className:"flex gap-2.5",children:[m.jsx(tw,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:e}),m.jsx("button",{onClick:a,"aria-label":"Dismiss",className:"-mr-0.5 -mt-0.5 flex-shrink-0 cursor-pointer rounded p-0.5 text-[#666] transition-colors hover:text-white",children:m.jsx(Ap,{className:"h-3.5 w-3.5"})})]})})}const PH=5e3,I_={invalid_email:"That email doesn't look right.",invalid_message:"Please write a little more.",unavailable:"Couldn't send that just now. Try again."};function FH({defaultEmail:e,onExit:t}){const[r,a]=J.useState(""),[s,o]=J.useState(e??""),[c,d]=J.useState("form"),[f,h]=J.useState(null),p=r.trim().length>0&&s.trim().length>0&&c!=="sending",g=async()=>{if(!p)return;d("sending"),h(null);const b=await sH(r.trim(),s.trim());if(b.ok){d("sent");return}d("form"),h(I_[b.error]??I_.unavailable)};return m.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[m.jsxs("button",{onClick:()=>t("overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[m.jsx(kp,{className:"h-4 w-4"}),"Back to results"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(O2,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),m.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Feedback & support"})]}),m.jsx("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:c==="sent"?m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsx(ku,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"text-sm font-semibold text-white",children:"Thanks, we got it."}),m.jsx("p",{className:"mt-1 text-xs text-[#888]",children:"We read every message. If it needs a reply, we'll reach out to the email you gave."}),m.jsx("button",{onClick:()=>{a(""),d("form")},className:"mt-4 cursor-pointer text-xs text-[#888] transition-colors hover:text-white",children:"Send more feedback"})]})]}):m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"mb-4 text-xs text-[#666]",children:"Bugs, feature requests, or anything else. Tell us what's on your mind."}),f&&m.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[m.jsx(Yu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs text-red-300",children:f})]}),m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your feedback"}),m.jsx("textarea",{autoFocus:!0,value:r,maxLength:PH,onChange:b=>a(b.target.value),rows:5,placeholder:"What's working, what's not, what you'd love to see…",className:"w-full resize-y rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),m.jsxs("label",{className:"mt-4 block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),m.jsx("input",{type:"email",value:s,onChange:b=>o(b.target.value),placeholder:"you@company.com",className:"w-full rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),m.jsx("button",{onClick:()=>void g(),disabled:!p,className:"mt-4 flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:c==="sending"?"Sending…":"Send feedback"})]})})]})}function GH({text:e,children:t,className:r=""}){const[a,s]=J.useState(!1);return m.jsxs("span",{className:`relative inline-flex ${r}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[t,a&&m.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-[240px] -translate-x-1/2 rounded-md px-2.5 py-1.5 text-xs text-[#ddd] shadow-lg",style:{border:"1px solid #2a2a2a",background:"#0a0a0a"},children:e})]})}function Oo({label:e,desc:t,slug:r,icon:a,surface:s,href:o=Ku,primary:c=!1}){return m.jsx(GH,{text:t,children:m.jsxs("a",{href:_i(o,r),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr(r,s),className:c?"group inline-flex items-center gap-2 rounded-lg border border-white bg-white px-3 py-2 text-sm font-semibold text-black transition-colors hover:bg-[#e5e5e5]":"group inline-flex items-center gap-2 rounded-lg border border-[#222] bg-[rgba(255,255,255,0.02)] px-3 py-2 text-sm text-[#aaa] transition-colors hover:border-[#444] hover:text-white",children:[m.jsx(a,{className:c?"h-4 w-4 text-black":"h-4 w-4 text-[#888] transition-colors group-hover:text-white","aria-hidden":"true"}),m.jsx("span",{children:e})]})})}const VH="Your findings stay on your machine. They're rendered here locally in your browser and never uploaded or stored by Strix.",B_=["critical","high","medium","low"],YH=500;function XH(){const[e,t]=J.useState(null),[r,a]=J.useState(null),[s,o]=J.useState(null),[c,d]=J.useState(null),[f,h]=J.useState("overview"),[p,g]=J.useState(null),[b,y]=J.useState(null),[_,N]=J.useState("report"),[S,w]=J.useState(!1),[k,E]=J.useState(!1),[M,H]=J.useState("open"),A=J.useRef(e);A.current=e;const B=J.useRef(0),z=J.useRef(0),X=J.useRef(new Set),j=J.useRef(()=>{}),I=J.useCallback(async()=>{try{g(await lH())}catch{}},[]),V=J.useCallback(async()=>{try{y(await rH())}catch{}},[]);J.useEffect(()=>{I(),V(),iH().then(ae=>E(ae.can_steer)).catch(()=>{})},[I,V]),J.useEffect(()=>{let ae=!1,ue,ge=!1,ye="",Ee=!0,Se=!1;B.current+=1;const Ce=async()=>{if(ae||Se)return;ue&&clearTimeout(ue),Se=!0;const pt=B.current;try{if(z.current)return;const Et=await WU(e);if(ge&&Et===ye&&!Ee)return;const Dt=await nH(e);if(ae||pt!==B.current||z.current)return;ge=Dt.finished,ge&&ye&&Et!==ye&&V(),ye=Et,Ee=!1,a(Dt),o(null)}catch(Et){if(ae)return;o(Et instanceof Error?Et.message:"Could not load run data.")}finally{Se=!1,ae||(ue=setTimeout(Ce,ge?1500:YH))}},Ue=()=>{Ee=!0,Ce()};return j.current=Ue,window.addEventListener("focus",Ue),Ce(),()=>{ae=!0,ue&&clearTimeout(ue),window.removeEventListener("focus",Ue)}},[e,V]);const F=J.useCallback(async(ae,ue)=>{const ge=e,ye=JSON.stringify([ge,ae.id]);B.current+=1,z.current+=1;const Ee=Se=>{A.current===ge&&a(Ce=>Ce&&{...Ce,vulnerabilities:Se})};try{if(X.current.has(ye)){const Ce=await Sp(ae.scan_id,ge);Ee(Ce),X.current.delete(ye);const Ue=Ce.find(pt=>pt.id===ae.id);if(!Ue||Ue.triage_revision!==ae.triage_revision||Ue.finding_digest!==ae.finding_digest)throw new co("conflict","The saved finding changed. Review its current state before trying again.")}const Se=await JU(ae,ue,ge);return A.current===ge&&a(Ce=>Ce&&{...Ce,vulnerabilities:Ce.vulnerabilities.map(Ue=>Ue.id===Se.id?Se:Ue)}),V(),Se}catch(Se){Se instanceof co||X.current.add(ye);try{const Ce=await Sp(ae.scan_id,ge);Ee(Ce),X.current.delete(ye);const Ue=Ce.find(pt=>pt.id===ae.id);if(!(Se instanceof co)&&Ue&&Ue.triage_revision===(ae.triage_revision??0)+1&&Ue.finding_digest===ae.finding_digest&&Ue.status===ue.status&&(ue.status==="open"||Ue.reason_code===(ue.reason_code??"unspecified")&&(Ue.status_note??"")===(ue.note??"").trim()))return Ue}catch{}throw Se instanceof co?Se:new Error("Could not confirm the save. The latest saved state will refresh before you retry.")}finally{z.current-=1,B.current+=1,A.current===ge&&j.current()}},[e,V]),C=J.useMemo(()=>(r==null?void 0:r.vulnerabilities.filter(ae=>ae.status!=="closed"))??[],[r]),$=J.useMemo(()=>r?KU(C):null,[r,C]),R=(r==null?void 0:r.vulnerabilities.find(ae=>ae.id===c))??null,U=(r==null?void 0:r.transcript.agents.length)??0,K=(p==null?void 0:p.verified)===!0,Z=J.useMemo(()=>r?ZU(r.raw):[],[r]),O=J.useMemo(()=>{var ue,ge;const ae=new Set;for(const ye of(r==null?void 0:r.transcript.events)??[]){if(ye.type!=="tool")continue;const Ee=(ue=ye.data)==null?void 0:ue.mcp_connection;typeof Ee!="string"||!Ee||((ge=ye.data)==null?void 0:ge.status)==="running"&&ae.add(Ee)}return ae},[r]),D=J.useRef(!1);J.useEffect(()=>{D.current=!1},[e]),J.useEffect(()=>{D.current||!r||(r.finished?(D.current=!0,h("overview")):U>0&&(D.current=!0,h("agents")))},[r,U]);const Y=J.useCallback(ae=>{D.current=!0,h(ae)},[]),L=J.useCallback(ae=>{t(ae),d(null),a(null),o(null),H("open"),D.current=!1},[]),G=J.useCallback((ae,ue)=>{yr("email_report",ue),N("report"),w(ae),Y("email")},[Y]),q=J.useCallback(()=>G(!1,"sidebar"),[G]),Q=J.useCallback(()=>G(!0,"overview"),[G]),ee=J.useCallback(()=>{V(),Y("history")},[V,Y]),W=J.useCallback(async()=>{await I(),await V()},[I,V]),te=J.useCallback(async()=>{await oH(),await I(),await V()},[I,V]);return m.jsxs("div",{className:"min-h-screen bg-black text-white flex",children:[m.jsx(kH,{view:f,onSelectView:ae=>{d(null),ae==="history"?ee():Y(ae)},issuesCount:C.length,agentCount:U,mcpConnections:Z,mcpInUse:O,runCount:(b==null?void 0:b.count)??0,finished:(r==null?void 0:r.finished)??!1,verified:K,email:(p==null?void 0:p.email)??null,onOpenEmail:q,onOpenHistory:ee,onForget:()=>void te()}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"border-b border-[#222]",children:m.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-4 flex items-center gap-1.5",children:[m.jsxs("a",{href:_i("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("logo","topbar"),className:"flex items-center gap-1.5 opacity-90 transition-opacity hover:opacity-100 lg:hidden",title:"Open Strix Cloud",children:[m.jsx("img",{src:"./logo.png",alt:"Strix",className:"w-10 h-8 object-cover"}),m.jsx("div",{className:"text-base text-white font-medium tracking-tight",children:"Strix"})]}),r&&m.jsx(ZH,{finished:r.finished}),m.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[K&&b&&!b.locked&&b.runs.length>0&&m.jsx(KH,{runs:b,activeRun:e,launchedName:_o((r==null?void 0:r.summary.targets[0])??null,(r==null?void 0:r.summary.runName)??(r==null?void 0:r.summary.runId)??"Current run"),onSelect:L}),m.jsxs("a",{href:_i(Ku,"run_in_cloud"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("run_in_cloud","topbar"),className:"inline-flex items-center gap-1 rounded-lg bg-white px-3 py-1.5 text-xs font-semibold text-black transition-opacity hover:opacity-90",children:["Run in the cloud",m.jsx(q_,{className:"w-3 h-3","aria-hidden":"true"})]})]})]})}),m.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-8 sm:py-12 space-y-6",children:[s&&f!=="history"&&f!=="email"&&m.jsxs("div",{className:"rounded-lg px-4 py-3 flex gap-3 items-start border border-red-500/30 bg-red-500/5",children:[m.jsx(Yu,{className:"w-5 h-5 flex-shrink-0 mt-0.5 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-sm text-red-300",children:s})]}),m.jsx("div",{className:"animate-page-in space-y-6",children:f==="email"?m.jsx(BH,{activeRun:e,auth:p,purpose:_,skipDisclosure:S,onAuthChanged:()=>{I(),V()},onExit:ae=>h(ae==="history"?"history":"overview")}):f==="feedback"?m.jsx(FH,{defaultEmail:(p==null?void 0:p.email)??null,onExit:ae=>h(ae)}):f==="history"?m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Xs,{className:"w-5 h-5 text-[#888]","aria-hidden":"true"}),m.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Past runs"})]}),m.jsx(LH,{runs:b,activeRun:e,onSelectRun:L,onVerified:()=>void W()})]}):!r&&!s?m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-10 text-center",children:[m.jsx("div",{className:"w-6 h-6 mx-auto mb-3 rounded-full border-2 border-[#333] border-t-white animate-spin"}),m.jsx("p",{className:"text-sm text-[#888]",children:"Loading run data…"})]}):r&&$?m.jsxs(m.Fragment,{children:[m.jsx(WH,{summary:r.summary}),m.jsxs("div",{className:"flex gap-5 border-b border-[#2a2a2a] lg:hidden",children:[m.jsx(Fm,{active:f==="overview",onClick:()=>Y("overview"),children:"Pentest Overview"}),m.jsxs(Fm,{active:f==="issues",onClick:()=>Y("issues"),children:["Issues",r.vulnerabilities.length>0?` (${C.length} open)`:""]}),U>0&&m.jsxs(Fm,{active:f==="agents",onClick:()=>Y("agents"),children:["Agents (",U,")"]})]}),f==="overview"?m.jsx(r$,{summary:r.summary,counts:$,total:C.length,detected:r.vulnerabilities.length,reportMarkdown:r.reportMarkdown,raw:r.raw,finished:r.finished,onOpenEmail:Q}):f==="agents"&&U>0?m.jsx(i$,{run:r,canSteer:k}):R?m.jsxs("div",{className:"space-y-4",children:[m.jsxs("button",{onClick:()=>d(null),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] hover:text-white transition-colors",children:[m.jsx(kp,{className:"w-4 h-4"})," Back to all findings"]}),m.jsx(vD,{vulnerability:{...R,can_triage:R.can_triage&&!s},onTriage:F})]}):m.jsx(JH,{vulnerabilities:r.vulnerabilities,finished:r.finished,filter:M,onFilter:H,onSelect:ae=>d(ae)})]}):null},`${e??"launched"}:${f}:${c??""}`)]})]}),m.jsx(qH,{message:VH})]})}function KH({runs:e,activeRun:t,launchedName:r,onSelect:a}){const[s,o]=J.useState(!1),c=e.runs.find(f=>f.name===t),d=c?_o(c.target,c.name):r;return m.jsxs("div",{className:"relative",children:[m.jsxs("button",{onClick:()=>o(f=>!f),onBlur:()=>setTimeout(()=>o(!1),150),"aria-label":"Switch pentest",className:"flex items-center gap-2 rounded-lg border border-[#3a3a3a] bg-[rgba(255,255,255,0.05)] px-3 py-2 text-sm text-white transition-colors hover:border-[#555] hover:bg-[rgba(255,255,255,0.09)]",children:[m.jsx(Xs,{className:"h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),m.jsx("span",{className:"flex-shrink-0 text-[#888]",children:"Pentest"}),m.jsx("span",{className:"max-w-[260px] truncate font-medium",children:d}),m.jsx(xo,{className:"h-4 w-4 flex-shrink-0 text-[#aaa]","aria-hidden":"true"})]}),s&&m.jsxs("div",{className:"absolute right-0 z-50 mt-2 max-h-96 w-96 overflow-y-auto rounded-xl py-1.5 shadow-2xl",style:{border:"1px solid #3a3a3a",background:"#0a0a0a"},children:[m.jsx("div",{className:"border-b border-[#222] px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-[#666]",children:"Switch pentest"}),e.runs.map(f=>{const h=f.name===t;return m.jsxs("button",{onMouseDown:()=>a(f.name),className:`flex w-full items-center gap-2 px-3 py-2.5 text-left text-sm transition-colors hover:bg-[rgba(255,255,255,0.06)] ${h?"bg-[rgba(255,255,255,0.04)] text-white":"text-[#aaa]"}`,children:[m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsx("span",{className:"block truncate font-medium",children:_o(f.target,f.name)}),f.target&&m.jsx("span",{className:"block truncate font-mono text-xs text-[#666]",children:f.target})]}),h&&m.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400"})]},f.name)})]})]})}function ZH({finished:e}){return e?m.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-[#888]",children:[m.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#555]"}),"Complete"]}):m.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-emerald-400",children:[m.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[m.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75 animate-ping"}),m.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-400"})]}),"Live"]})}function QH(e){if(e==null)return null;if(e<60)return`${e}s`;const t=Math.floor(e/60);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function WH({summary:e}){const t=QH(e.durationSeconds);return m.jsxs("div",{children:[m.jsx("h1",{className:"text-2xl font-semibold text-white",children:_o(e.targets[0]??null,e.runName??e.runId??"Pentest results")}),m.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-[#888]",children:[e.targets.length>0&&m.jsx("span",{className:"font-mono text-[#aaa]",children:e.targets.join(", ")}),e.scanMode&&m.jsx(Pm,{label:e.scanMode}),t&&m.jsx(Pm,{label:t}),e.status&&m.jsx(Pm,{label:e.status})]})]})}function Pm({label:e}){return m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-[#333]",children:"·"}),m.jsx("span",{className:"capitalize",children:e})]})}function JH({vulnerabilities:e,finished:t,filter:r,onFilter:a,onSelect:s}){const o=e.filter(f=>f.status!=="closed").length,c=e.length-o,d=e.filter(f=>r==="all"||(r==="closed"?f.status==="closed":f.status!=="closed")).sort((f,h)=>B_.indexOf(f.severity)-B_.indexOf(h.severity));return e.length===0?m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:t?"No findings in this run.":"No findings yet. The pentest is still running…"}),t&&m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsx("p",{className:"text-sm font-medium text-white",children:"Stay ahead of new exposures"}),m.jsx("p",{className:"mt-0.5 mb-3 text-xs text-[#666]",children:"Attack surface monitoring catches new exposures for your org over time."}),m.jsx(Oo,{label:"Attack surface monitoring",desc:"Continuous coverage for your whole org.",slug:"asm",surface:"empty_state",icon:dT})]})]}):m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[m.jsx("div",{className:"flex gap-1 rounded-lg border border-[#333] p-1","aria-label":"Finding status",children:["open","closed","all"].map(f=>m.jsxs("button",{type:"button","aria-pressed":r===f,onClick:()=>a(f),className:`rounded-md px-3 py-1.5 text-sm capitalize ${r===f?"bg-white/10 text-white":"text-[#888] hover:text-white"}`,children:[f," (",f==="open"?o:f==="closed"?c:e.length,")"]},f))}),m.jsxs("p",{className:"text-sm text-[#888]",children:[o," open · ",c," false positives · ",e.length," found"]})]}),d.length===0&&m.jsx("div",{className:"rounded-xl border border-[#222] p-8 text-center text-sm text-[#aaa]",children:r==="open"?`No open findings. ${c} marked as false positives.`:"No closed findings."}),d.map(f=>m.jsxs("button",{onClick:()=>s(f.id),className:"animate-card-in cursor-pointer w-full text-left rounded-lg border border-[#222] hover:border-[#444] bg-[rgba(255,255,255,0.02)] px-4 py-3 transition-colors flex items-center gap-3",children:[m.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${Op(f.severity)}`,"aria-hidden":"true"}),m.jsxs("span",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"block text-sm font-medium text-white truncate",children:f.title}),f.target&&m.jsx("span",{className:"block text-xs text-[#666] font-mono truncate",children:f.target})]}),(f.status==="closed"||f.review_stale)&&m.jsx("span",{className:"text-xs text-[#aaa]",children:f.review_stale?"Needs review":"Closed · False positive"}),m.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full border capitalize ${rw[f.severity]}`,children:f.severity})]},f.id))]})}function e$(e){return e.replace(/^\s*#{1,6}[ \t]+.*(?:\r?\n)+/,"").trimStart()}function t$(e){const t=[];let r=null;for(const a of e.split(`
+`)}function nU({args:e,result:t}){const r=e.action??"",a=e.code??e.script??"",s=t;let o=null;s&&typeof s=="object"?o=typeof s.stdout=="string"?s.stdout:null:typeof s=="string"&&(o=s);const c=r==="new_session"?"new session":r==="close"?"close session":r==="list_sessions"?"list sessions":null,d=o?tU(eU(o)):null;return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-yellow-400/80 font-semibold text-sm",children:"Python"}),c&&m.jsx("span",{className:"text-[#888] text-[13px]",children:c})]}),a&&m.jsx(wg,{code:a,language:"python",collapsible:!0}),d&&m.jsx(Ei,{className:"text-[#666]",children:d})]})}function rU({args:e}){const t=e.targets,a=(Array.isArray(t)?t:[]).map(s=>typeof s=="object"&&s?s.original??null:null).filter(Boolean);return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Starting penetration test"}),a.length===1&&m.jsxs("span",{className:"text-[#888] text-[13px]",children:["on ",a[0]]})]}),a.length>1&&m.jsx("div",{className:"mt-1.5 space-y-0.5",children:a.map((s,o)=>m.jsxs("div",{className:"text-[13px] text-[#888]",children:[m.jsx("span",{className:"text-[#555] mr-1",children:"•"}),s]},o))})]})}function iU({args:e}){const t=e.name??"Unknown Agent",r=e.task??"";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[#888] text-[13px]",children:"subagent"}),m.jsx("span",{className:"text-purple-400 font-semibold text-sm",children:t})]}),r&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:r,maxLines:15})})]})}function aU(e){return e.toolName==="subagent_start_info"?m.jsx(iU,{...e}):m.jsx(rU,{...e})}function sU({args:e}){const t=e.executive_summary??"",r=e.methodology??"",a=e.technical_analysis??"",s=e.recommendations??"";return m.jsxs("div",{className:"space-y-3",children:[m.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Penetration test completed"}),t&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Executive Summary"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:t,maxLines:25})})]}),r&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Methodology"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:r,maxLines:25})})]}),a&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Technical Analysis"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:a,maxLines:25})})]}),s&&m.jsxs("div",{children:[m.jsx("span",{className:"text-emerald-400/60 text-sm font-semibold",children:"Recommendations"}),m.jsx("div",{className:"mt-1",children:m.jsx(Xt,{text:s,maxLines:25})})]}),!t&&!r&&!a&&!s&&m.jsx("div",{className:"text-[#555] text-xs",children:"Generating final report..."})]})}function lU({toolName:e,args:t,result:r}){if(e==="create_note"){const a=t.title??"",s=t.content??"",o=t.category??"general";return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"}),m.jsxs("span",{className:"text-[#555] text-[13px]",children:["(",o,")"]})]}),a&&m.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&m.jsx("div",{className:"mt-1",children:m.jsx(da,{text:s})})]})}if(e==="delete_note")return m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note removed"});if(e==="update_note"){const a=t.title??"",s=t.content??"";return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note updated"}),a&&m.jsx("div",{className:"mt-1.5 text-[#999] text-[13px]",children:a}),s&&m.jsx("div",{className:"mt-1",children:m.jsx(da,{text:s})})]})}if(e==="get_note"){const a=r,s=a&&typeof a=="object"&&a.success?a.note:void 0;return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note read"}),s&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"mt-1.5 text-[#999] text-[13px]",children:[s.title??"(untitled)",m.jsxs("span",{className:"text-[#555] ml-1",children:["(",s.category??"general",")"]}),(s.by_you||s.agent_name)&&m.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",s.by_you?"you":s.agent_name]})]}),s.content&&m.jsx("div",{className:"mt-1",children:m.jsx(da,{text:s.content})})]})]})}if(e==="list_notes"){const a=r;let s=[];if(a&&typeof a=="object"&&a.success){const o=a.notes;s=Array.isArray(o)?o:[]}return m.jsxs("div",{children:[m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"notes"}),s.length>0?m.jsx("div",{className:"mt-1.5 space-y-0.5",children:s.map((o,c)=>m.jsxs("div",{className:"text-[13px]",children:[m.jsx("span",{className:"text-[#555] mr-1",children:"-"}),m.jsx("span",{className:"text-[#999]",children:o.title??"(untitled)"}),m.jsxs("span",{className:"text-[#555] ml-1",children:["(",o.category??"general",")"]}),(o.by_you||o.agent_name)&&m.jsxs("span",{className:"text-[#666] ml-1 text-xs",children:["by ",o.by_you?"you":o.agent_name]}),o.content&&m.jsx("div",{className:"ml-3",children:m.jsx(da,{text:o.content})})]},c))}):m.jsx("div",{className:"mt-1 text-[#555] text-xs",children:"No notes"})]})}return m.jsx("span",{className:"text-amber-400/80 font-semibold text-sm",children:"note"})}const oU={create_todo:{label:"Task added",Icon:J_},list_todos:{label:"Plan",Icon:lC},update_todo:{label:"Task updated",Icon:lT},mark_todo_done:{label:"Task completed",Icon:V_},mark_todo_pending:{label:"Task reopened",Icon:gT},delete_todo:{label:"Task removed",Icon:OT}};function cU({status:e}){return e==="done"?m.jsx(V_,{className:"w-3.5 h-3.5 text-emerald-400/70 shrink-0"}):e==="in_progress"?m.jsx(yC,{className:"w-3.5 h-3.5 text-purple-400/70 shrink-0 animate-pulse"}):m.jsx(Y_,{className:"w-3.5 h-3.5 text-[#444] shrink-0"})}function uU({todos:e,highlightId:t}){return m.jsx("div",{className:"space-y-0",children:e.map((r,a)=>{const s=r.status??"pending",o=t&&r.id===t;return m.jsxs("div",{className:`flex items-start gap-2.5 py-1.5 px-2 -mx-2 rounded-md transition-colors ${o?"bg-purple-500/[0.08]":""}`,children:[m.jsx("div",{className:"mt-[1px]",children:m.jsx(cU,{status:s})}),m.jsx("span",{className:`text-[13px] leading-snug ${s==="done"?"text-[#555] line-through":s==="in_progress"?"text-[#bbb]":"text-[#999]"}`,children:r.title??"(untitled)"})]},r.id??a)})})}function dU({toolName:e,args:t,result:r}){const a=oU[e]??{label:"Plan",Icon:hT},s=a.Icon,o=r;if(typeof o=="string"&&o.trim())return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:o.trim()})]});let c=[],d=null,f;if(o&&typeof o=="object"){if(d=o.error??null,o.success){const p=o.todos;c=Array.isArray(p)?p:[]}f=o.id??t.todo_id??void 0}const h=e!=="list_todos"?f:void 0;return c.length===0&&!d?m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-purple-400/60"}),m.jsx("span",{className:"text-purple-400/80 font-semibold text-sm",children:a.label})]}),d&&m.jsx("div",{className:"text-red-400/70 text-[13px] mb-2",children:d}),c.length>0&&m.jsx("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.015] px-3 py-2",children:m.jsx(uU,{todos:c,highlightId:h})})]})}function w_(e){if(e==null)return null;if(typeof e=="string")return e.trim()?e:null;if(typeof e=="object"){const t=e;if(typeof t.__raw=="string")return t.__raw;if(Object.keys(t).length===0)return null;try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function v2({toolName:e,args:t,result:r}){const a=w_(t),s=w_(r);return m.jsxs("div",{children:[m.jsx("span",{className:"text-[#888] font-semibold text-sm",children:e.replace(/_/g," ")}),a&&m.jsx(Ei,{className:"text-[#777]",children:a}),s&&m.jsx(Ei,{className:"text-[#666]",children:s})]})}function fU({args:e}){const t=e.skills,r=(Array.isArray(t)?t:String(t??"").split(",")).map(a=>String(a).trim()).filter(Boolean);return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-emerald-400/80 font-semibold text-sm",children:"Loading skill"}),r.length>0&&m.jsx("span",{className:"text-[#888] text-[13px]",children:r.join(", ")})]})}function hU({args:e}){const t=e.message??"";return t?m.jsxs("div",{children:[m.jsx(da,{text:t}),m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:"waiting for your reply"})]}):null}const mU={reported:{label:"reported",color:"text-orange-400",Icon:Tp},no_issue_found:{label:"no issue found",color:"text-emerald-400",Icon:ku},ruled_out:{label:"ruled out",color:"text-emerald-400/70",Icon:ku},not_applicable:{label:"not applicable",color:"text-[#777]",Icon:EC},needs_follow_up:{label:"needs follow-up",color:"text-yellow-400",Icon:_C}},pU=["reported","needs_follow_up","no_issue_found","ruled_out","not_applicable"];function go(e){const t=(e??"").trim().toLowerCase();return mU[t]??{label:t?t.replace(/_/g," "):"unrecorded",color:"text-[#777]",Icon:Y_}}const gU={record_coverage:"Coverage recorded",update_coverage:"Coverage updated",list_coverage:"Coverage"};function yu({toolName:e}){return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(X_,{className:"w-3.5 h-3.5 text-cyan-400/60"}),m.jsx("span",{className:"text-cyan-400/80 font-semibold text-sm",children:gU[e]??"Coverage"})]})}function xU({entry:e}){const{label:t,color:r,Icon:a}=go(e.outcome),s=(e.previous_outcomes??[]).map(o=>go(o).label).filter(Boolean);return m.jsxs("div",{className:"flex items-start gap-2.5 py-1.5",children:[m.jsx(a,{className:`w-3.5 h-3.5 shrink-0 mt-[2px] ${r}`}),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"text-[13px] leading-snug",children:[m.jsx("span",{className:"text-[#bbb]",children:e.surface??"(unnamed surface)"}),e.risk_area&&m.jsxs("span",{className:"text-[#666]",children:[" · ",e.risk_area]})]}),m.jsxs("div",{className:"text-xs mt-0.5",children:[m.jsx("span",{className:r,children:t}),s.length>0&&m.jsxs("span",{className:"text-[#555]",children:[" (was ",s.join(" → "),")"]}),(e.by_you||e.agent_name)&&m.jsxs("span",{className:"text-[#555]",children:[" · ",e.by_you?"you":e.agent_name]})]}),e.evidence&&m.jsx("div",{className:"text-[#777] text-xs mt-1 leading-snug",children:e.evidence})]})]})}function bU({toolName:e,args:t,result:r}){const a=r;if(typeof a=="string"&&a.trim())return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:a.trim()})]});const s=a&&typeof a=="object"?a:null,o=t.surface??"",c=t.risk_area??"",d=t.evidence??"";if(s&&!s.success)return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),(o||c)&&m.jsxs("div",{className:"mt-1.5 text-[13px] text-[#bbb]",children:[o,c&&m.jsxs("span",{className:"text-[#666]",children:[" · ",c]})]}),m.jsx("div",{className:"mt-1 text-red-400/70 text-[13px]",children:s.error??"Coverage call failed"})]});if(e==="list_coverage"){const y=s==null?void 0:s.entries,_=Array.isArray(y)?y:[],N=(s==null?void 0:s.outcome_counts)??{},S=(s==null?void 0:s.total_count)??0;return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),Object.keys(N).length>0&&m.jsx("div",{className:"mt-2 flex items-center gap-3 flex-wrap",children:pU.filter(w=>N[w]).map(w=>{const{label:k,color:E}=go(w);return m.jsxs("span",{className:`text-xs ${E}`,children:[k,": ",N[w]]},w)})}),_.length>0?m.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.06] bg-white/[0.015] px-3 py-1 divide-y divide-white/[0.04]",children:_.map((w,k)=>m.jsx(xU,{entry:w},w.entry_id??k))}):m.jsx("div",{className:"mt-1.5 text-[#555] text-xs",children:S===0?"No surfaces recorded yet":"No surfaces match this filter"})]})}const f=(s==null?void 0:s.outcome)??"",h=(s==null?void 0:s.previous_outcome)??"",{label:p,color:g,Icon:b}=go(f);return m.jsxs("div",{children:[m.jsx(yu,{toolName:e}),m.jsxs("div",{className:"mt-2 flex items-start gap-2.5",children:[m.jsx(b,{className:`w-3.5 h-3.5 shrink-0 mt-[2px] ${g}`}),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"text-[13px] leading-snug text-[#bbb]",children:[o||(s!=null&&s.entry_id?`entry ${s.entry_id}`:"(unnamed surface)"),c&&m.jsxs("span",{className:"text-[#666]",children:[" · ",c]})]}),m.jsxs("div",{className:"text-xs mt-0.5",children:[h&&m.jsxs("span",{className:"text-[#666]",children:[go(h).label," → "]}),m.jsx("span",{className:g,children:p})]}),d&&m.jsx("div",{className:"text-[#777] text-xs mt-1 leading-snug",children:d})]})]})]})}const yU={get_threat_model:{label:"Threat model",Icon:Xu},save_threat_model:{label:"Threat model saved",Icon:bT},amend_threat_model:{label:"Threat model amended",Icon:J_}};function vU({toolName:e,args:t,result:r}){const a=yU[e]??{label:"Threat model",Icon:Xu},s=a.Icon,o=t.target??"",c=r,d=m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx(s,{className:"w-3.5 h-3.5 text-blue-400/60"}),m.jsx("span",{className:"text-blue-400/80 font-semibold text-sm",children:a.label}),o&&m.jsx("span",{className:"text-[#666] font-mono text-xs",children:o})]});if(typeof c=="string"&&c.trim())return m.jsxs("div",{children:[d,m.jsx("div",{className:"mt-1.5 text-[#888] text-[13px]",children:c.trim()})]});const f=c&&typeof c=="object"?c:null;if(f&&!f.success)return m.jsxs("div",{children:[d,m.jsx("div",{className:"mt-1.5 text-red-400/70 text-[13px]",children:f.error??"Threat model call failed"})]});if(e==="get_threat_model"){if(f&&!f.found)return m.jsxs("div",{children:[d,m.jsx("div",{className:"mt-1.5 text-[#555] text-xs",children:"No model derived for this target yet"})]});const g=f==null?void 0:f.amendments,b=Array.isArray(g)?g:[];return m.jsxs("div",{children:[d,b.length>0&&m.jsxs("div",{className:"mt-2",children:[m.jsxs("span",{className:"text-amber-400/70 text-xs font-semibold",children:[b.length," amendment",b.length===1?"":"s"]}),m.jsx("span",{className:"text-[#555] text-xs",children:" — later statements win"}),m.jsx("div",{className:"mt-1 space-y-1",children:b.map((y,_)=>m.jsxs("div",{className:"text-xs leading-snug",children:[m.jsx("span",{className:"text-[#666]",children:y.agent_name??"unknown agent"}),y.content&&m.jsxs("span",{className:"text-[#999]",children:[": ",y.content]})]},_))})]}),typeof(f==null?void 0:f.content)=="string"&&f.content.trim()&&m.jsx("div",{className:"mt-2",children:m.jsx(Xt,{text:f.content,maxLines:14})})]})}if(e==="amend_threat_model"){const g=t.addendum??"",b=f==null?void 0:f.amendment_count;return m.jsxs("div",{children:[d,b!=null&&m.jsxs("div",{className:"mt-1.5 text-[#666] text-xs",children:[b," amendment",b===1?"":"s"," on this model"]}),g&&m.jsx("div",{className:"mt-1.5",children:m.jsx(Xt,{text:g,maxLines:10})})]})}const h=(f==null?void 0:f.amendments_cleared)??0,p=t.content??"";return m.jsxs("div",{children:[d,h>0&&m.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-yellow-400/80 text-xs",children:[m.jsx(Tp,{className:"w-3 h-3 shrink-0"}),m.jsxs("span",{children:["cleared ",h," amendment",h===1?"":"s"]})]}),p&&m.jsx("div",{className:"mt-2",children:m.jsx(Xt,{text:p,maxLines:14})})]})}function _U(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([t,r])=>{const a=typeof r=="string"?r:JSON.stringify(r);return`${t}: ${a??String(r)}`})}function wU(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return[]}const r=t&&typeof t=="object"&&!Array.isArray(t)?t.connections:null;return Array.isArray(r)?r.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,o=typeof s.name=="string"&&s.name.trim()?s.name.trim():typeof s.id=="string"?s.id.trim():"";if(!o)return[];const c=typeof s.tool_count=="number"?s.tool_count:null,d=s.dead===!0;return[{name:o,toolCount:c,dead:d}]}):[]}const E_=600;function EU(e){if(typeof e=="string"){const t=e.trim();return t?t.length>E_?`${t.slice(0,E_)}…`:t:null}return null}function NU({toolName:e,mcpTool:t,mcpConnection:r,args:a,result:s,status:o}){const c=_U(a),d=o==="failed"||o==="error",f=d?EU(s):null,h=e==="describe_mcp",p=e==="list_mcps",g=p?wU(s):[];return m.jsxs("div",{children:[m.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:p?m.jsx("span",{className:"text-[13px] text-[#555]",children:"Listing connected MCP servers"}):h?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-[13px] text-[#555]",children:"Inspecting MCP server"}),r&&m.jsx("span",{className:"font-mono text-teal-300 font-semibold text-sm",children:r})]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"font-mono text-teal-300 font-semibold text-sm",children:t||e}),m.jsx("span",{className:"text-[13px] text-[#555]",children:"via MCP server"}),r&&m.jsx("span",{className:"text-[13px] text-teal-400/80",children:r})]})}),c.length>0&&m.jsx("div",{className:"mt-1 font-mono text-[13px] leading-relaxed",children:c.map(b=>m.jsx("div",{className:"text-[#777] break-all",children:b},b))}),g.length>0&&m.jsx("div",{className:"mt-1 font-mono text-[13px] leading-relaxed",children:g.map(b=>m.jsxs("div",{className:`break-all${b.dead?" opacity-50":""}`,children:[m.jsx("span",{className:"text-teal-300",children:b.name}),b.dead?m.jsx("span",{className:"text-red-400/80",children:" · offline"}):b.toolCount!==null&&m.jsxs("span",{className:"text-[#555]",children:[" ","· ",b.toolCount," ",b.toolCount===1?"tool":"tools"]})]},b.name))}),m.jsxs("div",{className:"mt-1 text-[13px]",children:[o==="running"&&m.jsx("span",{className:"text-[#666]",children:"Running"}),o==="completed"&&m.jsx("span",{className:"text-emerald-400/80",children:"✓ Done"}),d&&m.jsx("span",{className:"text-red-400/80",children:"✗ Failed"})]}),f&&m.jsx("pre",{className:"mt-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap break-words text-red-400/70",children:f})]})}const Va={terminal:{renderer:y7,icon:nw,color:"text-emerald-400"},python:{renderer:nU,icon:TC,color:"text-yellow-400"},browser:{renderer:_7,icon:Q_,color:"text-blue-400"},filesystem:{renderer:w7,icon:LC,color:"text-sky-400"},proxy:{renderer:V7,icon:q_,color:"text-purple-400",match:/request|sitemap|scope/},reporting:{renderer:L7,icon:wT,color:"text-red-400"},thinking:{renderer:Y7,icon:P_,color:"text-purple-400"},agents:{renderer:X7,icon:Do,color:"text-cyan-400",match:/agent/},search:{renderer:K7,icon:vT,color:"text-amber-400"},lifecycle:{renderer:aU,icon:Z_,color:"text-emerald-400"},notes:{renderer:lU,icon:TT,color:"text-amber-400",match:/note/},skills:{renderer:fU,icon:Ym,color:"text-emerald-400"},todos:{renderer:dU,icon:WC,color:"text-purple-400",match:/todo/},coverage:{renderer:bU,icon:X_,color:"text-cyan-400",match:/coverage/},threatModel:{renderer:vU,icon:Xu,color:"text-blue-400",match:/threat_model/},telemetry:{renderer:v2,icon:Ym,color:"text-[#555]"},mcp:{renderer:NU,icon:W_,color:"text-teal-400"}},SU={terminal:["exec_command","write_stdin","terminal_execute"],python:["python_action"],browser:["browser_action"],filesystem:["apply_patch","view_image","str_replace_editor","list_files","search_files"],proxy:["list_requests","view_request","repeat_request","list_sitemap","view_sitemap_entry","scope_rules","send_request"],reporting:["create_vulnerability_report","update_vulnerability_report","list_reports","get_report"],thinking:["think"],agents:["create_agent","agent_finish","send_message_to_agent","wait_for_agents","view_agent_graph","stop_agent"],search:["web_search"],lifecycle:["scan_start_info","subagent_start_info","finish_scan","respond_to_user"],notes:["create_note","delete_note","update_note","list_notes","get_note"],skills:["load_skill"],todos:["create_todo","list_todos","update_todo","mark_todo_done","mark_todo_pending","delete_todo"],coverage:["record_coverage","update_coverage","list_coverage"],threatModel:["get_threat_model","save_threat_model","amend_threat_model"],telemetry:["sandbox_error_details","llm_error_details"],mcp:["list_mcps"]},kU=Object.fromEntries(Object.entries(SU).flatMap(([e,t])=>t.map(r=>[r,e]))),CU={finish_scan:sU,respond_to_user:hU,apply_patch:A7,view_image:R7,list_reports:b_,get_report:b_},TU={agent_finish:{icon:Z_,color:"text-cyan-400"},send_message_to_agent:{icon:vh,color:"text-cyan-400"},wait_for_agents:{icon:vh,color:"text-cyan-400"},respond_to_user:{icon:vh,color:"text-emerald-400"},view_agent_graph:{icon:jC,color:"text-cyan-400"},stop_agent:{icon:Gm,color:"text-red-400"},scan_start_info:{icon:Xu,color:"text-emerald-400"},subagent_start_info:{icon:Do,color:"text-purple-400"},view_image:{icon:XC,color:"text-sky-400"}},AU=Va.telemetry;function _2(e){var r;const t=kU[e];if(t)return t;for(const[a,s]of Object.entries(Va))if((r=s.match)!=null&&r.test(e))return a;return null}function MU(e,t){if(t)return Va.mcp.renderer;const r=CU[e];if(r)return r;const a=_2(e);return a?Va[a].renderer:v2}function OU(e,t){if(t)return{icon:Va.mcp.icon,color:Va.mcp.color};const r=TU[e];if(r)return r;const a=_2(e),s=a?Va[a]:AU;return{icon:s.icon,color:s.color}}const RU=30;function jU({role:e,content:t}){const r=e==="user"||e==="human";return m.jsxs("div",{children:[m.jsx("span",{className:`font-semibold text-sm ${r?"text-blue-400/80":"text-purple-400/80"}`,children:r?"User":"Thinking"}),m.jsx("div",{className:"mt-1.5 italic text-[#888]",children:m.jsx(Xt,{text:t,maxLines:RU})})]})}class DU extends J.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?m.jsx("span",{className:"text-[#555] font-semibold text-sm",children:this.props.toolName.replace(/_/g," ")}):this.props.children}}function LU(e){const t=MU(e.toolName,e.mcpConnection);return m.jsx(DU,{toolName:e.toolName,children:m.jsx(t,{...e})})}function w2(e){if(e==null||typeof e!="string")return e;const t=e.trim();if(!t)return e;try{return JSON.parse(t)}catch{}try{const r=t.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false").replace(/'/g,'"');return JSON.parse(r)}catch{return{__raw:e}}}function N_(e){return typeof e=="string"&&e?e:null}function E2(e){const t=w2(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:t==null?{}:{__raw:typeof t=="string"?t:JSON.stringify(t)}}function S_(e){const t=/(\d+)$/.exec(e);return t?parseInt(t[1],10):0}function Sg(e){var r;const t=(r=e.data)==null?void 0:r.role;return e.type==="chat"&&(t==="user"||t==="human")}function zU(e){var t;return Sg(e)&&String(((t=e.data)==null?void 0:t.content)??"").startsWith("[Message from ")}function IU(e){const t=new Set;let r=!1;for(const a of e)if(Sg(a)){if(zU(a)){t.add(a.id);continue}r||(r=!0,t.add(a.id))}return t}const BU={completed:"text-emerald-400 border-emerald-500/30 bg-emerald-500/10",running:"text-blue-400 border-blue-500/30 bg-blue-500/10",waiting:"text-yellow-400 border-yellow-500/30 bg-yellow-500/10",stopped:"text-[#aaa] border-[#333] bg-[#1a1a1a]",crashed:"text-red-400 border-red-500/30 bg-red-500/10",failed:"text-red-400 border-red-500/30 bg-red-500/10"};function UU(e){return e==="completed"?"completed":e==="running"?"running":e==="failed"||e==="crashed"?"failed":e}function HU(e,t){var d;const r=new Map;for(const f of e)if(f.parent_id){const h=r.get(f.parent_id)??[];h.push(f.id),r.set(f.parent_id,h)}const a=new Map,s=new Map,o=new Map;for(const f of t)if(f.type==="tool"){if(a.set(f.agent_id,(a.get(f.agent_id)??0)+1),((d=f.data)==null?void 0:d.tool_name)==="create_agent"){const h=E2(f.data.args),p=h.name??h.agent_name??"",g=h.task??"";p&&g&&o.set(p,g)}}else Sg(f)||s.set(f.agent_id,(s.get(f.agent_id)??0)+1);const c=new Map;for(const f of e)c.set(f.id,{id:f.id,name:f.name,task:o.get(f.name)??"",status:UU(f.status),parentId:f.parent_id,children:r.get(f.id)??[],createdAt:f.created_at,toolCount:a.get(f.id)??0,messageCount:s.get(f.id)??0});return c}function $U({agent:e,events:t,showHeader:r=!0}){const a=J.useMemo(()=>{const c=t.filter(f=>f.agent_id===e.id).sort((f,h)=>S_(f.id)-S_(h.id)),d=IU(c);return c.filter(f=>!d.has(f.id))},[t,e.id]),s=a.filter(c=>c.type==="tool").length,o=a.length-s;return m.jsxs("div",{children:[r&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[m.jsx("span",{className:"text-base font-semibold text-white truncate",children:e.name}),m.jsx("span",{className:`flex-shrink-0 text-xs font-medium capitalize px-2 py-0.5 rounded-full border ${BU[e.status]??"text-[#aaa] border-[#333] bg-[#1a1a1a]"}`,children:e.status}),m.jsx("span",{className:"font-mono text-xs text-[#555]",children:e.id})]}),m.jsxs("p",{className:"text-xs text-[#666] mb-4",children:[o," message",o===1?"":"s"," · ",s," tool call",s===1?"":"s"]})]}),a.length===0?m.jsx("p",{className:"text-sm text-[#666]",children:"No recorded activity for this agent."}):m.jsx("div",{className:"py-1",children:a.map((c,d)=>{var w,k,E,M,H,A,B,z;const f=d===a.length-1,h=c.type==="tool",p=h?String(((w=c.data)==null?void 0:w.tool_name)??"tool"):"",g=h?"":String(((k=c.data)==null?void 0:k.role)??"assistant"),b=N_((E=c.data)==null?void 0:E.mcp_connection),y=N_((M=c.data)==null?void 0:M.mcp_tool);let _,N;if(h){const X=OU(p,b);_=X.icon,N=X.color}else{const X=g==="user"||g==="human";_=X?Do:P_,N=X?"text-blue-400":"text-purple-400"}const S=h?String(((H=c.data)==null?void 0:H.status)??"completed"):"completed";return m.jsxs("div",{className:"flex gap-3",children:[m.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[m.jsx("div",{className:`w-[30px] h-[30px] rounded-full bg-black border flex items-center justify-center shrink-0 ${h&&S==="running"?"border-blue-500/40 animate-pulse":h&&S==="failed"?"border-red-500/30":"border-[#222]"}`,children:m.jsx(_,{className:`w-3.5 h-3.5 ${N}`})}),!f&&m.jsx("div",{className:"w-px flex-1 bg-[#1a1a1a] mt-1"})]}),m.jsx("div",{className:"flex-1 min-w-0 pt-[5px] pb-6",children:h?m.jsx(LU,{toolName:p,mcpConnection:b,mcpTool:y,args:E2((A=c.data)==null?void 0:A.args),result:w2((B=c.data)==null?void 0:B.result)??null,status:S}):m.jsx(jU,{role:g,content:String(((z=c.data)==null?void 0:z.content)??"")})})]},c.id)})})]})}class Fu extends Error{constructor(t){super(t),this.name="RunParseError"}}const qU=["critical","high","medium","low"];function PU(e){const t=String(e??"").toLowerCase().trim();return qU.includes(t)?t:"low"}function FU(e){if(typeof e=="string"&&e.trim()){const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(!Number.isNaN(r.getTime()))return r.toISOString();const a=new Date(e);if(!Number.isNaN(a.getTime()))return a.toISOString()}return new Date().toISOString()}function xt(e){return typeof e=="string"&&e.length>0?e:null}function GU(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function N2(e,t){try{return JSON.parse(e)}catch{throw new Fu(`${t} isn't valid JSON. Make sure you selected a Strix run directory.`)}}function VU(e){const t=N2(e,"run.json");if(!t||typeof t!="object"||Array.isArray(t))throw new Fu("run.json is not an object.");const r=t,a=[],s=r.targets_info;if(Array.isArray(s)){for(const y of s)if(y&&typeof y=="object"){const _=y.original;typeof _=="string"&&_&&a.push(_)}}const o=xt(r.start_time),c=xt(r.end_time);let d=null;if(o&&c){const y=new Date(o).getTime(),_=new Date(c).getTime();!Number.isNaN(y)&&!Number.isNaN(_)&&_>=y&&(d=Math.round((_-y)/1e3))}let f=null,h=null,p=null,g=null;const b=r.scan_results;if(b&&typeof b=="object"){const y=b;f=xt(y.executive_summary),h=xt(y.technical_analysis),p=xt(y.methodology),g=xt(y.recommendations)}return{runId:xt(r.run_id),runName:xt(r.run_name),targets:a,scanMode:xt(r.scan_mode),status:xt(r.status),startTime:o,endTime:c,durationSeconds:d,executiveSummary:f,technicalAnalysis:h,methodology:p,recommendations:g}}function YU(){return{pr_review_id:null,cve:null,cvss:null,potential_risk_saving:null,risk_saving_description:null,impact:null,endpoint:null,method:null,target:null,technical_analysis:null,poc_description:null,poc_script_code:null,code_diff:null,code_file:null,code_before:null,code_after:null,cwe:null,code_locations:null,remediation_steps:null,fix_pr_body:null,evidence:null,assumptions:null,fix_effort:null,cvss_breakdown:null,status_changed_at:null,status_changed_by:null,status_note:null,snoozed_until:null,reopened_at:null,reopened_by:null,original_severity:null,severity_changed_at:null,severity_changed_by:null,severity_override_reason:null,retest_of_vulnerability_id:null}}function XU(e,t,r){const a=e.cwe,s=typeof a=="string"&&a.trim()?[a.trim()]:Array.isArray(a)?a.filter(c=>typeof c=="string"&&c):null,o=e.status==="closed"?"closed":"open";return{...YU(),id:xt(e.id)??`vuln-${t+1}`,scan_id:r,title:xt(e.title)??"Untitled finding",description:xt(e.description)??"",severity:PU(e.severity),status:o,triage_status:e.triage_status==="closed"?"closed":"open",resolution_reason:e.resolution_reason==="false_positive"?"false_positive":null,reason_code:typeof e.reason_code=="string"&&Object.hasOwn(Mp,e.reason_code)?e.reason_code:"unspecified",triage_revision:typeof e.triage_revision=="number"&&Number.isSafeInteger(e.triage_revision)?e.triage_revision:0,finding_digest:xt(e.finding_digest)??"",review_stale:e.review_stale===!0,can_triage:e.can_triage===!0&&typeof e.id=="string"&&!!e.id,status_note:xt(e.status_note),status_changed_at:xt(e.status_changed_at),status_changed_by:xt(e.status_changed_by),created_at:FU(e.timestamp),cve:xt(e.cve),cvss:GU(e.cvss),impact:xt(e.impact),endpoint:xt(e.endpoint),method:xt(e.method),target:xt(e.target),technical_analysis:xt(e.technical_analysis),poc_description:xt(e.poc_description),poc_script_code:xt(e.poc_script_code),cwe:s,code_locations:Array.isArray(e.code_locations)?e.code_locations:null,remediation_steps:xt(e.remediation_steps),fix_pr_body:xt(e.fix_pr_body),evidence:xt(e.evidence),assumptions:xt(e.assumptions),fix_effort:xt(e.fix_effort)??null,cvss_breakdown:e.cvss_breakdown??null}}function S2(e,t=null){const r=N2(e,"vulnerabilities.json");if(!Array.isArray(r))throw new Fu("vulnerabilities.json is not a JSON array.");return r.map((a,s)=>{if(!a||typeof a!="object")throw new Fu(`vulnerabilities.json entry #${s+1} is not an object.`);return XU(a,s,t)})}function KU(e){const t={critical:0,high:0,medium:0,low:0};for(const r of e)t[r.severity]+=1;return t}function ZU(e){const t=e==null?void 0:e.mcp_connection_status;return Array.isArray(t)?t.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return[];const a=r,s=typeof a.name=="string"?a.name.trim():"";if(!s)return[];const o=typeof a.provider=="string"&&a.provider.trim()?a.provider.trim():null,c=typeof a.tool_count=="number"?a.tool_count:0,d=a.dead===!0;return[{name:s,provider:o,toolCount:c,dead:d}]}):[]}async function ga(e){const t=await fetch(e,{cache:"no-store"});if(!t.ok){const r=await t.json().catch(()=>null);throw(r==null?void 0:r.error)==="invalid_triage"?new Error("The saved triage file could not be read. Findings have not been refreshed; repair the file before continuing."):new Error(`Could not refresh run data (${t.status}).`)}return t.json()}function al(e){return e?`?run=${encodeURIComponent(e)}`:""}async function QU(e){const t=await ga("/api/run"+al(e)),r=VU(JSON.stringify(t)),a=t.finished===!0;return{summary:r,raw:t,finished:a}}async function Sp(e,t){const r=await ga("/api/vulnerabilities"+al(t));return S2(JSON.stringify(r),e)}async function WU(e){const t=await ga("/api/triage/revision"+al(e));return JSON.stringify(t.revision)}class co extends Error{constructor(t,r){super(r),this.code=t}}async function JU(e,t,r){const{ok:a,data:s}=await ts(`/api/vulnerabilities/${encodeURIComponent(e.id)}/triage`+al(r),{...t,expected_revision:e.triage_revision??0,reviewed_digest:e.finding_digest??""});if(!a||!s.finding||typeof s.finding!="object"){const o=String(s.error??"unavailable"),c={conflict:"This finding changed. Review the latest evidence and reopen the form before saving.",invalid_triage:"The saved triage file could not be read. Fix it before changing this finding.",read_only:"This run is read-only. Its findings cannot be changed.",unknown_finding:"This finding is no longer available in the run.",unverified:"Verify your email to access this historical run.",forbidden:"Your viewer session has expired. Reopen the viewer using its authorized link.",invalid_request:"The decision could not be saved. Check the form and try again."};throw new co(o,c[o]??"Could not save this decision. Try again.")}return S2(JSON.stringify([s.finding]),e.scan_id)[0]}async function eH(e){const t=await ga("/api/report"+al(e));return(t==null?void 0:t.markdown)??null}async function tH(e){const t=await ga("/api/transcript"+al(e));return{agents:Array.isArray(t==null?void 0:t.agents)?t.agents:[],events:Array.isArray(t==null?void 0:t.events)?t.events:[]}}async function nH(e){const{summary:t,raw:r,finished:a}=await QU(e),[s,o,c]=await Promise.all([Sp(t.runId,e),eH(e).catch(()=>null),tH(e).catch(()=>({agents:[],events:[]}))]);return{summary:t,raw:r,finished:a,vulnerabilities:s,reportMarkdown:o,transcript:c}}async function ts(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store"});let a={};try{const s=await r.json();s&&typeof s=="object"&&(a=s)}catch{}return{ok:r.ok,status:r.status,data:a}}async function rH(){const e=await ga("/api/runs");return{locked:(e==null?void 0:e.locked)??!0,count:typeof(e==null?void 0:e.count)=="number"?e.count:0,runs:Array.isArray(e==null?void 0:e.runs)?e.runs:[]}}async function iH(){const e=await ga("/api/capabilities");return{can_steer:(e==null?void 0:e.can_steer)===!0}}async function aH(e,t){const{ok:r,data:a}=await ts("/api/agents/steer",{agent_id:e,message:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function sH(e,t){const{ok:r,data:a}=await ts("/api/feedback",{message:e,email:t});return r&&a.ok===!0?{ok:!0}:{ok:!1,error:String(a.error??"unavailable")}}async function lH(){const e=await ga("/api/auth/status");return{verified:(e==null?void 0:e.verified)===!0,email:(e==null?void 0:e.email)??null}}async function k2(e){const{ok:t,data:r}=await ts("/api/auth/otp/start",{email:e});return t&&r.ok===!0?{ok:!0}:{ok:!1,error:String(r.error??"unavailable")}}async function C2(e,t){const{ok:r,data:a}=await ts("/api/auth/otp/verify",{email:e,code:t});return r&&a.verified===!0?{verified:!0,email:String(a.email??e)}:{verified:!1,error:String(a.error??"invalid_code")}}async function oH(){await ts("/api/auth/forget",{})}async function cH(e){const{ok:t,data:r}=await ts("/api/report/send",e?{run:e}:{});return t&&r.ok===!0?{ok:!0,password:String(r.password??""),filename:String(r.filename??"strix-original-scan-report.pdf")}:{ok:!1,error:String(r.error??"unavailable")}}const Hs="__root__";function T2({agents:e,fixedAgentId:t,className:r}){const a=J.useRef(null),[s,o]=J.useState(!1),[c,d]=J.useState(!1),[f,h]=J.useState(""),[p,g]=J.useState(!1),[b,y]=J.useState(null),_=t!=null,N=J.useMemo(()=>e.find(I=>!I.parent_id)??e[0]??null,[e]),S=J.useMemo(()=>e.filter(I=>I.parent_id&&I.status==="running"),[e]),[w,k]=J.useState(Hs),[E,M]=J.useState(!1);J.useEffect(()=>{w!==Hs&&!S.some(I=>I.id===w)&&k(Hs)},[w,S]);const{targetId:H,targetName:A}=J.useMemo(()=>{if(_){const V=e.find(F=>F.id===t)??null;return{targetId:t??null,targetName:(V==null?void 0:V.name)??"this agent"}}if(w===Hs)return{targetId:(N==null?void 0:N.id)??null,targetName:"Root agent"};const I=e.find(V=>V.id===w)??null;return{targetId:(I==null?void 0:I.id)??(N==null?void 0:N.id)??null,targetName:(I==null?void 0:I.name)??"Root agent"}},[e,t,_,N,w]),B=f.trim().length===0;J.useLayoutEffect(()=>{const I=a.current;I&&(I.style.height="auto",I.style.height=`${I.scrollHeight}px`)},[f]);const z=J.useCallback(()=>{o(!0),requestAnimationFrame(()=>{var I;return(I=a.current)==null?void 0:I.focus()})},[]),X=J.useCallback(()=>{o(!1),d(!1),M(!1)},[]),j=J.useCallback(async()=>{if(p)return;const I=f.trim();if(!I||!H)return;g(!0),y(null);const V=A,F=await aH(H,I);g(!1),F.ok?(h(""),y(`Sent to ${V}`),Mr("agent_steered")):F.error==="not_delivered"?y("Could not reach that agent (it may have finished)."):y("Could not send that message. Try again.")},[p,f,H,A]);return s?m.jsxs("div",{className:br("mt-4 rounded-2xl border border-white/[0.08] bg-[#050505] overflow-hidden transition-colors duration-300",c?"border-white/[0.18]":"hover:border-white/[0.12]",r),children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-white/[0.06] px-5 py-3",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Vm,{className:"h-4 w-4 text-[#666]"}),m.jsx("p",{className:"text-sm font-medium text-white",children:"Live prompt"})]}),m.jsx("p",{className:"mt-0.5 text-xs text-[#777]",children:"Connected"})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[_?m.jsxs("div",{className:"rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-1 text-xs text-[#aaa]",children:["Target: ",m.jsx("span",{className:"text-white",children:A})]}):m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs text-[#aaa]",children:"Target:"}),m.jsxs("div",{className:"relative",children:[m.jsxs("button",{type:"button",onClick:()=>M(I=>!I),onBlur:()=>requestAnimationFrame(()=>M(!1)),className:"inline-flex h-7 items-center gap-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 text-xs text-white transition-colors hover:border-white/[0.16] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-haspopup":"listbox","aria-expanded":E,children:[m.jsx("span",{className:"max-w-[140px] truncate",children:A}),m.jsx(xo,{className:"h-3.5 w-3.5 text-[#999]"})]}),E&&m.jsxs("div",{className:"absolute right-0 z-10 mt-1 min-w-[160px] overflow-hidden rounded-lg border border-[#333] bg-[#0a0a0a] py-1 shadow-xl",role:"listbox",children:[m.jsx(k_,{label:"Root agent",active:w===Hs,onSelect:()=>{k(Hs),M(!1)}}),S.map(I=>m.jsx(k_,{label:I.name,active:w===I.id,onSelect:()=>{k(I.id),M(!1)}},I.id))]})]})]}),m.jsx("button",{type:"button",onClick:X,className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[#777] transition-colors hover:bg-white/[0.06] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20","aria-label":"Collapse live prompt composer",children:m.jsx(xo,{className:"h-4 w-4"})})]})]}),m.jsx("div",{className:"px-5 pt-4 pb-3",children:m.jsx("textarea",{ref:a,rows:1,value:f,onChange:I=>h(I.target.value),onFocus:()=>d(!0),onBlur:()=>d(!1),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),j())},placeholder:"Send a live prompt to the running pentest…",maxLength:4e3,disabled:p,className:"block w-full resize-none border-0 bg-transparent p-0 text-[15px] leading-6 text-white placeholder:text-[#444] focus:outline-none disabled:opacity-60 max-h-[160px] overflow-y-auto"})}),m.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 pb-4",children:[m.jsx("div",{className:"text-xs text-[#666]",children:b??"Press Enter to send."}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),j()},disabled:p||B,className:br("inline-flex h-10 min-w-[112px] items-center justify-center gap-2 rounded-full px-4 text-sm font-medium transition-colors",p||B?"bg-white/[0.08] text-[#666]":"bg-white text-black hover:bg-neutral-200"),children:[p?m.jsx(Fs,{className:"h-4 w-4 animate-spin"}):m.jsx(Qk,{className:"h-4 w-4",strokeWidth:2.5}),m.jsx("span",{children:"Send prompt"})]})]})]}):m.jsxs("button",{type:"button",onClick:z,className:br("mt-4 flex w-full items-center justify-between gap-3 rounded-2xl border border-white/[0.08] bg-[#050505] px-5 py-3 text-left transition-colors duration-300 hover:border-white/[0.12] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/20",r),"aria-expanded":!1,"aria-label":"Expand live prompt composer",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[m.jsx(Vm,{className:"h-4 w-4 shrink-0 text-[#666]"}),m.jsx("span",{className:"truncate text-sm font-medium text-white",children:"Guide the agent"})]}),m.jsx(G_,{className:"h-4 w-4 shrink-0 text-[#777]"})]})}function k_({label:e,active:t,onSelect:r}){return m.jsx("button",{type:"button",role:"option","aria-selected":t,onMouseDown:a=>{a.preventDefault(),r()},className:br("block w-full truncate px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/[0.06]",t?"text-white":"text-[#aaa]"),children:e})}const uH={completed:"bg-emerald-400",running:"bg-blue-400",waiting:"bg-yellow-400",stopped:"bg-[#888]",crashed:"bg-red-400",failed:"bg-red-400"},dH=80;function fH({open:e,agent:t,events:r,steerable:a,onClose:s}){const o=J.useRef(null),c=J.useRef(!1),[d,f]=J.useState(e),[h,p]=J.useState(e?"open":"closed"),[g,b]=J.useState(!1),y=J.useRef(t);J.useEffect(()=>{t&&(y.current=t)},[t]);const _=t??y.current;J.useEffect(()=>{if(e){f(!0),p("open");return}p("closed");const S=setTimeout(()=>f(!1),140);return()=>clearTimeout(S)},[e]),J.useEffect(()=>{if(!d){b(!1);return}const S=requestAnimationFrame(()=>b(!0));return()=>cancelAnimationFrame(S)},[d]);const N=J.useCallback(()=>{const S=o.current;S&&(c.current=S.scrollHeight-S.scrollTop-S.clientHeight{const S=o.current;!S||!c.current||requestAnimationFrame(()=>{S.scrollTo({top:S.scrollHeight,behavior:"smooth"})})},[r]),J.useEffect(()=>{if(!d)return;const S=k=>{k.key==="Escape"&&s()};document.addEventListener("keydown",S);const w=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",S),document.body.style.overflow=w}},[d,s]),!d||!_?null:m.jsx("div",{"data-state":h,className:"agent-modal fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 sm:p-8",onClick:s,role:"dialog","aria-modal":"true","aria-label":`Agent ${_.name}`,children:m.jsxs("div",{className:"relative flex h-[60vh] w-[calc(100vw-4rem)] max-w-6xl flex-col overflow-hidden rounded-xl border border-[#222] bg-[#0a0a0a] shadow-2xl",onClick:S=>S.stopPropagation(),children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[#222] px-5 py-3.5",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:`h-2 w-2 flex-shrink-0 rounded-full ${uH[_.status]??"bg-[#888]"}`}),m.jsx("span",{className:"truncate text-sm font-semibold text-white",children:_.name}),m.jsx("span",{className:"flex-shrink-0 font-mono text-xs text-[#555]",children:_.id})]}),m.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"flex-shrink-0 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:m.jsx(Ap,{className:"h-4 w-4"})})]}),m.jsx("div",{ref:o,onScroll:N,className:"flex-1 overflow-y-auto p-5",children:g&&m.jsx($U,{agent:_,events:r,showHeader:!1})}),a&&m.jsx("div",{className:"border-t border-[#222] px-5 py-3",children:m.jsx(T2,{agents:[_],fixedAgentId:_.id,className:"mt-0"})})]})})}var A2={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},C_=fa.createContext&&fa.createContext(A2),hH=["attr","size","title"];function mH(e,t){if(e==null)return{};var r,a,s=pH(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;afa.createElement(t.tag,Vu({key:r},t.attr),M2(t.child)))}function kg(e){return t=>fa.createElement(yH,Gu({attr:Vu({},e.attr)},t),M2(e.child))}function yH(e){var t=r=>{var a=e.attr,s=e.size,o=e.title,c=mH(e,hH),d=s||r.size||"1em",f;return r.className&&(f=r.className),e.className&&(f=(f?f+" ":"")+e.className),fa.createElement("svg",Gu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,a,c,{className:f,style:Vu(Vu({color:e.color||r.color},r.style),e.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),o&&fa.createElement("title",null,o),e.children)};return C_!==void 0?fa.createElement(C_.Consumer,null,r=>t(r)):t(A2)}function vH(e){return kg({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"5",cy:"6",r:"3"},child:[]},{tag:"path",attr:{d:"M5 9v12"},child:[]},{tag:"circle",attr:{cx:"19",cy:"18",r:"3"},child:[]},{tag:"path",attr:{d:"m15 9-3-3 3-3"},child:[]},{tag:"path",attr:{d:"M12 6h5a2 2 0 0 1 2 2v7"},child:[]}]})(e)}function _H(e){return kg({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 4.95703C15 4.58711 14.8563 4.24054 14.5949 3.97992L12.0096 1.39234C11.4879 0.86922 10.5788 0.86922 10.0571 1.39234L8 3.45119V3.32321C8 2.55068 7.37187 1.922 6.6 1.922H2.4C1.62813 1.922 1 2.55068 1 3.32321V13.5988C1 14.3713 1.62813 15 2.4 15H12.6667C13.4385 15 14.0667 14.3713 14.0667 13.5988V9.39514C14.0667 8.62261 13.4385 7.99393 12.6667 7.99393H12.5379L14.5949 5.93508C14.8553 5.67445 15 5.32602 15 4.95703ZM2.4 2.85521H6.6C6.85667 2.85521 7.06667 3.06446 7.06667 3.32228V7.99299H1.93333V3.32228C1.93333 3.06446 2.14333 2.85521 2.4 2.85521ZM1.93333 13.5979V8.92714H7.06667V14.0649H2.4C2.14333 14.0649 1.93333 13.8547 1.93333 13.5979ZM13.1333 9.39421V13.5979C13.1333 13.8547 12.9233 14.0649 12.6667 14.0649H8V8.92714H12.6667C12.9233 8.92714 13.1333 9.13638 13.1333 9.39421ZM8 7.99299V6.46287L9.5288 7.99299H8ZM13.9351 5.2737L11.3488 7.86221C11.1789 8.03223 10.8859 8.03223 10.716 7.86221L8.12973 5.2737C8.0448 5.18963 7.99813 5.07753 7.99813 4.95796C7.99813 4.83839 8.0448 4.7263 8.12973 4.64129L10.716 2.05278C10.8009 1.96777 10.9129 1.92106 11.0324 1.92106C11.1519 1.92106 11.2639 1.96777 11.3488 2.05278L13.9351 4.64129C14.02 4.72536 14.0667 4.83746 14.0667 4.95703C14.0667 5.0766 14.02 5.1887 13.9351 5.2737Z"},child:[]}]})(e)}function O2(e){return kg({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a34 34 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1 15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.4 26.4 0 0 1 9.3-1.7 26 26 0 0 1 10.1 2l56.7 20.1a13.5 13.5 0 0 0 3.9 1 8 8 0 0 0 8-8 13 13 0 0 0-.5-2.7z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.3 7.3 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.2 159.2 0 0 0 284 432.11"},child:[]}]})(e)}const wH=[{icon:HC,label:"PR security reviews"},{icon:ST,label:"Attack surface monitoring"},{icon:HT,label:"Real-time threat intelligence"},{icon:aC,label:"Scheduled pentesting"},{icon:zT,label:"One-click autofix"},{icon:W_,label:"Jira, Linear & Slack integrations"}];function EH({open:e,onClose:t,description:r,source:a="sidebar"}){const[s,o]=J.useState(e),[c,d]=J.useState(e?"open":"closed");return J.useEffect(()=>{if(e){o(!0),d("open");return}d("closed");const f=setTimeout(()=>o(!1),200);return()=>clearTimeout(f)},[e]),J.useEffect(()=>{if(!s)return;const f=p=>{p.key==="Escape"&&t()};document.addEventListener("keydown",f);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",f),document.body.style.overflow=h}},[s,t]),s?m.jsx("div",{"data-state":c,className:"dialog-overlay fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:t,role:"dialog","aria-modal":"true","aria-label":"Upgrade your plan",children:m.jsxs("div",{"data-state":c,className:"dialog-panel relative w-full max-w-md rounded-2xl border border-[#222] bg-black p-6 shadow-lg sm:rounded-lg",onClick:f=>f.stopPropagation(),children:[m.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-4 top-4 rounded-md p-1 text-[#888] transition-colors hover:bg-[#1a1a1a] hover:text-white",children:m.jsx(Ap,{className:"h-4 w-4"})}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-lg text-white",children:"Available in Strix Cloud"}),r&&m.jsx("p",{className:"mt-2 text-base leading-relaxed text-[#e5e5e5]",children:r})]}),m.jsxs("div",{className:"space-y-4 pt-4",children:[m.jsxs("div",{className:"rounded-xl border border-[#333] bg-[#0a0a0a] p-4 sm:rounded-lg",children:[m.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[m.jsx(Vm,{className:"h-4 w-4 text-blue-400"}),m.jsx("span",{className:"text-sm font-medium text-white",children:"Strix Cloud also includes"})]}),m.jsx("ul",{className:"space-y-2 text-sm text-[#888]",children:wH.map(f=>m.jsxs("li",{className:"flex items-center gap-2",children:[m.jsx(f.icon,{className:"h-3.5 w-3.5 text-[#555]"}),f.label]},f.label))})]}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs("a",{href:_i(Ku,"upgrade_try_free"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("upgrade_try_free",a),className:"flex h-10 w-full items-center justify-center gap-2 rounded-lg bg-white px-4 text-sm font-semibold text-black transition-colors hover:bg-neutral-200",children:["Open Strix Cloud",m.jsx(my,{className:"h-3.5 w-3.5"})]}),m.jsxs("a",{href:_i(GT,"upgrade_view_plans"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("upgrade_view_plans",a),className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-lg border border-[#333] px-4 text-sm font-medium text-[#888] transition-colors hover:border-[#555] hover:text-white",children:["Learn more",m.jsx(my,{className:"h-3 w-3"})]})]}),m.jsxs("p",{className:"text-center text-xs text-[#666]",children:["SSO, compliance reports, or a private deployment?"," ",m.jsx("a",{href:_i(jp,"upgrade_book_demo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("upgrade_book_demo",a),className:"whitespace-nowrap text-[#aaa] underline underline-offset-2 transition-colors hover:text-white",children:"Try Strix Enterprise"})]})]})]})}):null}const $m=160,qm=260,ao=400,NH=140,A_="strix_viewer_sidebar_width",M_="strix_viewer_sidebar_collapsed";function SH(e,t){try{const r=localStorage.getItem(e),a=r?parseInt(r,10):NaN;return Number.isFinite(a)?a:t}catch{return t}}function kH({view:e,onSelectView:t,issuesCount:r,agentCount:a,mcpConnections:s,mcpInUse:o,runCount:c,finished:d,verified:f,email:h,onOpenEmail:p,onOpenHistory:g,onForget:b}){var F;const[y,_]=J.useState(()=>{const C=SH(A_,qm);return Math.min(ao,Math.max($m,C))}),[N,S]=J.useState(()=>{try{return localStorage.getItem(M_)==="1"}catch{return!1}}),[w,k]=J.useState(!1),[E,M]=J.useState(!1),[H,A]=J.useState(null),B=J.useRef(null),z=(C,$)=>{yr(C,"sidebar"),A($)},X=J.useCallback(C=>{_(C);try{localStorage.setItem(A_,String(C))}catch{}},[]),j=J.useCallback(C=>{S(C);try{localStorage.setItem(M_,C?"1":"0")}catch{}},[]),I=J.useCallback(()=>{j(!1),X(qm)},[j,X]),V=J.useCallback(C=>{C.preventDefault(),k(!0)},[]);return J.useEffect(()=>{if(!w||N)return;const C=R=>{const U=R.clientX;U>=$m&&U<=ao?_(U):U>ao&&_(ao)},$=R=>{const U=R.clientX;U{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",$)}},[w,N,j,X]),J.useEffect(()=>{if(!E)return;const C=$=>{B.current&&!B.current.contains($.target)&&M(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[E]),m.jsxs(m.Fragment,{children:[N&&m.jsx("div",{className:"fixed left-0 top-0 z-40 hidden h-full w-4 cursor-pointer transition-colors hover:bg-[rgba(255,255,255,0.08)] lg:block",onClick:I,title:"Expand sidebar"}),m.jsxs("aside",{className:br("sticky top-0 z-20 hidden h-screen flex-shrink-0 flex-col overflow-hidden border-r border-[rgba(255,255,255,0.08)] bg-black lg:flex",!w&&"transition-[width] duration-200 ease-out"),style:{width:N?0:y},children:[m.jsx("header",{className:"relative flex flex-col gap-1 pt-1 min-w-[160px]",children:m.jsx("div",{className:"flex flex-row py-1 px-2",children:m.jsxs("div",{className:"flex h-10 w-full flex-row items-center",children:[m.jsxs("a",{href:_i("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("logo","sidebar"),className:"flex flex-1 flex-row items-center gap-2 rounded-md py-2 pl-2.5 pr-1 min-w-0 transition-colors hover:bg-[rgba(255,255,255,0.06)]",title:"Open Strix Cloud",children:[m.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:m.jsx("span",{className:"text-[10px] font-semibold text-white",children:"S"})}),m.jsxs("span",{className:"flex flex-1 flex-row items-center gap-2 min-w-0",children:[m.jsx("span",{className:"truncate min-w-0 text-[14px] font-medium text-[#ededed]",children:"Strix"}),m.jsx("span",{className:"flex h-5 flex-shrink-0 items-center rounded px-2 text-[11px] font-medium text-[#888] bg-[rgba(255,255,255,0.08)]",children:"Local"})]})]}),m.jsx("a",{href:_i("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("logo","sidebar"),className:"flex flex-none items-center rounded-md px-1.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]","aria-label":"Open Strix Cloud",children:m.jsx(mC,{className:"h-4 w-4 text-[#666]"})})]})})}),m.jsx("nav",{className:"relative min-w-[160px] flex-1 overflow-y-auto overflow-x-clip scrollbar-thin pb-10 pt-2",children:m.jsxs("div",{className:"relative flex flex-col gap-px px-2",children:[m.jsx(yi,{icon:m.jsx(AH,{}),label:"Pentest Overview",active:e==="overview",onClick:()=>t("overview")}),m.jsx(yi,{icon:m.jsx(Tp,{className:"h-4 w-4"}),label:"Issues",count:r>0?r:void 0,active:e==="issues",onClick:()=>t("issues")}),a>0&&m.jsx(yi,{icon:m.jsx(Do,{className:"h-4 w-4"}),label:"Agents",count:a,active:e==="agents",onClick:()=>t("agents")}),s.length>0&&m.jsx(TH,{connections:s,inUse:o}),m.jsx(yi,{icon:m.jsx(Xs,{className:"h-4 w-4"}),label:"Past runs",count:c>0?c:void 0,active:e==="history",onClick:g}),d&&m.jsx(yi,{icon:m.jsx(Cp,{className:"h-4 w-4"}),label:"Export original report",active:e==="email",onClick:p}),m.jsx(yi,{icon:m.jsx(O2,{className:"h-4 w-4"}),label:"Feedback & support",active:e==="feedback",onClick:()=>t("feedback")}),m.jsx("hr",{className:"mx-0 my-1 h-px w-full border-0 bg-[rgba(255,255,255,0.08)]"}),m.jsx(yi,{icon:m.jsx(vH,{className:"h-4 w-4"}),label:"PR Security Reviews",active:!1,onClick:()=>z("pr_reviews","Strix reviews every pull request and flags exploitable changes before they merge.")}),m.jsx(yi,{icon:m.jsx(_H,{className:"h-4 w-4"}),label:"Integrations",active:!1,onClick:()=>z("integrations","Sync findings to Jira, Linear, and Slack so fixes happen where your team already works.")}),m.jsx(yi,{icon:m.jsx(DT,{className:"h-4 w-4"}),label:"Members",active:!1,onClick:()=>z("members","Invite your team, set roles, and share findings and run history across your org.")})]})}),m.jsx("section",{className:"flex min-w-[160px] flex-col gap-0.5",ref:B,children:m.jsxs("div",{className:"relative p-2",children:[f&&h?m.jsxs("button",{onClick:()=>M(C=>!C),className:"relative flex w-full cursor-pointer items-center gap-2 rounded-md bg-transparent px-2.5 py-2 transition-colors hover:bg-[rgba(255,255,255,0.06)]",children:[m.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:m.jsx("span",{className:"text-[9px] font-semibold text-white",children:((F=h[0])==null?void 0:F.toUpperCase())||"U"})}),m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:[m.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:h}),m.jsx("span",{className:"truncate text-[11px] text-[#555]",children:"Linked to this machine"})]})]}):m.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2.5 py-2",children:[m.jsx("span",{className:"flex flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-emerald-400 to-cyan-500",style:{width:20,height:20},children:m.jsx("span",{className:"text-[9px] font-semibold text-white",children:"S"})}),m.jsx("span",{className:"flex min-w-0 flex-1 flex-col text-left",children:m.jsx("span",{className:"truncate text-[13px] font-medium text-[#ededed]",children:"Local viewer"})})]}),E&&f&&h&&m.jsxs("div",{className:"absolute bottom-full left-2 right-2 z-50 mb-1 overflow-hidden rounded-lg border border-[#333] bg-black shadow-xl",children:[m.jsxs("div",{className:"border-b border-[#333] px-3 py-2",children:[m.jsx("p",{className:"truncate text-[13px] font-medium text-white",children:"Linked email"}),m.jsx("p",{className:"truncate text-[11px] text-[#666]",children:h})]}),m.jsxs("button",{onClick:()=>{M(!1),b()},className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-[#888] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-red-400",children:[m.jsx(rT,{className:"h-4 w-4"}),"Forget this email"]})]})]})}),m.jsx("div",{className:"group absolute right-0 top-0 z-30 h-full w-1 cursor-col-resize",onMouseDown:V,children:m.jsx("div",{className:br("absolute right-0 top-0 h-full w-px bg-[rgba(255,255,255,0.08)] transition-all duration-100",w?"w-0.5 bg-[rgba(255,255,255,0.3)]":"group-hover:bg-[rgba(255,255,255,0.2)]")})})]}),w&&m.jsx("div",{className:"fixed inset-0 z-10 cursor-col-resize"}),m.jsx(EH,{open:H!==null,description:H??"",source:"sidebar",onClose:()=>A(null)})]})}function yi({icon:e,label:t,active:r,onClick:a,count:s}){return m.jsxs("button",{onClick:a,className:br("group flex h-9 w-full origin-left flex-row items-center rounded-md transition-colors",r?"bg-[rgba(255,255,255,0.12)] text-white":"text-[#888] hover:bg-[rgba(255,255,255,0.06)] hover:text-[#ededed]"),children:[m.jsx("div",{className:"grid flex-none place-content-center",style:{width:36,height:36},children:e}),m.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[14px] font-medium",children:t}),s!=null&&m.jsx("span",{className:"mr-2 flex-none rounded-full border border-white/10 px-2 py-0.5 text-[10px] tabular-nums leading-none text-[#777]",children:s})]})}const O_=["◐","◓","◑","◒"],CH=220;function TH({connections:e,inUse:t}){const r=e.some(o=>!o.dead&&t.has(o.name)),[a,s]=J.useState(0);return J.useEffect(()=>{if(!r)return;const o=setInterval(()=>s(c=>(c+1)%O_.length),CH);return()=>clearInterval(o)},[r]),m.jsxs("div",{className:"mt-1",children:[m.jsxs("div",{className:"flex h-7 items-center px-2 text-[11px] font-medium text-[#666]",children:["MCP Connections (",e.length,")"]}),m.jsx("div",{className:"max-h-48 overflow-y-auto overflow-x-clip scrollbar-thin",children:e.map(o=>{const c=!o.dead&&t.has(o.name);return m.jsxs("div",{className:"flex h-7 items-center gap-2 rounded-md px-2",title:o.provider?`${o.name} · ${o.provider}`:o.name,children:[m.jsx("span",{className:br("w-3 flex-none text-center text-[11px] leading-none",o.dead?"text-red-400":"text-emerald-400"),"aria-hidden":"true",children:o.dead?"●":c?O_[a]:"●"}),m.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-[#ededed]",children:o.name}),o.dead?m.jsx("span",{className:"flex-none text-[11px] text-red-400",children:"offline"}):m.jsxs("span",{className:"flex-none text-[11px] tabular-nums text-[#666]",children:[o.toolCount," ",o.toolCount===1?"tool":"tools"]})]},o.name)})})]})}function AH(){return m.jsx("svg",{style:{width:16,height:16,color:"currentcolor"},viewBox:"0 0 16 16",fill:"currentColor",children:m.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.5 5.5V2.5H5.5V5.5H2.5ZM1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2ZM2.5 13.5V10.5H5.5V13.5H2.5ZM1 10C1 9.44772 1.44772 9 2 9H6C6.55228 9 7 9.44772 7 10V14C7 14.5523 6.55228 15 6 15H2C1.44772 15 1 14.5523 1 14V10ZM10.5 2.5V5.5H13.5V2.5H10.5ZM10 1C9.44772 1 9 1.44772 9 2V6C9 6.55228 9.44772 7 10 7H14C14.5523 7 15 6.55228 15 6V2C15 1.44772 14.5523 1 14 1H10ZM10.5 13.5V10.5H13.5V13.5H10.5ZM9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z"})})}const R_={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},MH=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function OH({onVerified:e}){const[t,r]=J.useState("email"),[a,s]=J.useState(""),[o,c]=J.useState(""),[d,f]=J.useState(!1),[h,p]=J.useState(null),[g,b]=J.useState(null),y=async()=>{const N=a.trim();if(!N){p("Enter your email to continue.");return}const S=N.slice(N.lastIndexOf("@")+1).toLowerCase();if(MH.has(S)){Mr("work_email_required"),p(R_.work_email_required);return}f(!0),p(null);const w=await k2(N);f(!1),w.ok?(Mr("email_submitted",{purpose:"verify"}),b(`We sent a 6-digit code to ${N}.`),r("code")):(w.error==="work_email_required"&&Mr("work_email_required"),p(R_[w.error]??"Could not send a code. Try again."))},_=async()=>{const N=o.trim();if(N.length<4){p("Enter the 6-digit code from your email.");return}f(!0),p(null);const S=await C2(a.trim(),N);if(f(!1),!S.verified){p("That code did not match. Check it and try again.");return}Mr("email_verified",{purpose:"verify"}),e()};return m.jsxs("div",{className:"mx-auto mt-5 max-w-sm text-left",children:[h&&m.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[m.jsx(Yu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs text-red-300",children:h})]}),g&&!h&&m.jsx("p",{className:"mb-3 text-xs text-[#888]",children:g}),t==="email"?m.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),y()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),m.jsx("input",{type:"email",autoFocus:!0,value:a,onChange:N=>s(N.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}}),m.jsx("span",{className:"mt-1.5 block text-[11px] text-[#666]",children:"Use your work email."})]}),m.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}):m.jsxs("form",{className:"space-y-3",onSubmit:N=>{N.preventDefault(),_()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),m.jsx("input",{inputMode:"numeric",autoFocus:!0,value:o,onChange:N=>c(N.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),m.jsxs("button",{type:"submit",disabled:d,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[d&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Verify"]}),m.jsx("button",{type:"button",onClick:()=>{r("email"),p(null),b(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]})]})}const RH=[{key:"critical",dot:"bg-red-500",text:"text-red-500"},{key:"high",dot:"bg-orange-500",text:"text-orange-500"},{key:"medium",dot:"bg-yellow-500",text:"text-yellow-500"},{key:"low",dot:"bg-blue-500",text:"text-blue-500"}];function jH({counts:e}){const t=RH.filter(r=>e[r.key]>0);return t.length===0?m.jsx("span",{className:"text-xs text-[#888]",children:"No open findings"}):m.jsx("div",{className:"flex items-center gap-3",children:t.map(r=>m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:`h-2 w-2 rounded-full ${r.dot}`,"aria-hidden":"true"}),m.jsx("span",{className:`text-xs tabular-nums ${r.text}`,children:e[r.key]})]},r.key))})}function DH(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);return Number.isNaN(r.getTime())?null:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function j_(e){if(!e)return null;const t=e.trim().replace(" UTC","Z").replace(" ","T"),r=new Date(t);if(Number.isNaN(r.getTime()))return null;const a=Date.now()-r.getTime(),s=Math.floor(a/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const o=Math.floor(s/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:DH(e)}function LH({runs:e,activeRun:t,onSelectRun:r,onVerified:a}){const s=(e==null?void 0:e.count)??0,[o,c]=J.useState(!1);return!e||e.locked?m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center",children:[m.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-xl",style:{border:"1px solid #2a2a2a",background:"rgba(255,255,255,0.04)"},children:m.jsx(Xs,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"})}),m.jsx("h2",{className:"text-base font-semibold text-white",children:"Browse every run on this machine"}),m.jsxs("p",{className:"mx-auto mt-1.5 max-w-md text-sm text-[#888]",children:["You have ",s," past ",s===1?"run":"runs"," on this machine."]}),o?m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"mx-auto mt-3 max-w-sm text-xs text-[#666]",children:"Verify your email with a one-time code to unlock the full history."}),m.jsx(OH,{onVerified:a})]}):m.jsx("button",{onClick:()=>{yr("history_unlock","past_runs"),c(!0)},className:"mt-4 cursor-pointer rounded-lg bg-white px-4 py-2 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"View runs"}),m.jsxs("p",{className:"mt-4 flex items-center justify-center gap-1.5 text-xs text-[#555]",children:[m.jsx(nw,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Or open one from the CLI with"," ",m.jsx("code",{className:"font-mono text-[#888]",children:"strix view "})]})]}):e.runs.length===0?m.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:"No past runs found on this machine yet."}):m.jsx("div",{className:"space-y-2",children:e.runs.map(d=>{const f=d.name===t,h=j_(d.start_time)??j_(d.end_time),p=_o(d.target,d.name);return m.jsxs("button",{onClick:()=>r(d.name),className:`animate-card-in group flex w-full cursor-pointer items-center gap-4 rounded-lg border px-4 py-3 text-left transition-colors ${f?"border-[#444] bg-[rgba(255,255,255,0.04)]":"border-[#222] bg-[rgba(255,255,255,0.02)] hover:border-[#444]"}`,children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"truncate text-sm font-medium text-white",children:p}),f&&m.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-400",style:{border:"1px solid rgba(16,185,129,0.3)"},children:"Active"})]}),m.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-[#666]",children:[d.scan_mode&&m.jsx("span",{className:"capitalize",children:d.scan_mode}),d.scan_mode&&(h||d.status)&&m.jsx("span",{className:"text-[#333]",children:"·"}),h&&m.jsx("span",{children:h}),h&&d.status&&m.jsx("span",{className:"text-[#333]",children:"·"}),d.status&&m.jsx("span",{className:"capitalize",children:d.status}),d.open_count!==void 0&&m.jsxs("span",{children:["· ",d.open_count," open · ",d.closed_count??0," false positives · ",d.detected_count??d.open_count," found"]})]})]}),d.severity_counts?m.jsx(jH,{counts:d.severity_counts}):m.jsx("span",{className:"text-xs text-[#888]",children:"Review unavailable"}),m.jsx(dC,{className:"h-4 w-4 flex-shrink-0 text-[#555] transition-colors group-hover:text-[#aaa]","aria-hidden":"true"})]},d.name)})})}const D_={work_email_required:"Please use your work email, not a personal one.",rate_limited:"Too many requests. Wait a minute and try again.",invalid_email:"That email does not look right. Check it and try again.",unavailable:"The email service is unavailable right now. Try again shortly."},zH={forbidden:"This email was unsubscribed from Strix, so we cannot send to it.",too_large:"This report is too large to email. Try a smaller run.",unavailable:"The email service is unavailable right now. Try again shortly."},IH=new Set(["gmail.com","googlemail.com","yahoo.com","ymail.com","outlook.com","hotmail.com","live.com","icloud.com","me.com","aol.com","proton.me","protonmail.com","gmx.com","mail.com"]);function BH({activeRun:e,auth:t,purpose:r,skipDisclosure:a=!1,onAuthChanged:s,onExit:o}){const c=(t==null?void 0:t.verified)===!0,d=r==="verify",[f,h]=J.useState(()=>d?"email":a?c?"sending":"email":"disclosure"),[p,g]=J.useState((t==null?void 0:t.email)??""),[b,y]=J.useState(""),[_,N]=J.useState(!1),[S,w]=J.useState(null),[k,E]=J.useState(null),[M,H]=J.useState(""),[A,B]=J.useState(""),[z,X]=J.useState(!1),[j,I]=J.useState(""),V=J.useRef(!1),F=async()=>{h("sending"),w(null);const Z=await cH(e);if(Z.ok){Mr("report_sent"),H(Z.password),B(Z.filename),h("password");return}if(Z.error==="reverify"||Z.error==="unverified"){E("Your verification expired. Enter your email to verify again."),h("email");return}w(zH[Z.error]??"Could not send the report. Try again."),h("disclosure")},C=()=>{w(null),E(null),c?F():h("email")};J.useEffect(()=>{!d&&a&&c&&!V.current&&(V.current=!0,F())},[]);const $=async()=>{const Z=p.trim();if(!Z){w("Enter your email to continue.");return}const O=Z.slice(Z.lastIndexOf("@")+1).toLowerCase();if(IH.has(O)){Mr("work_email_required"),w(D_.work_email_required);return}N(!0),w(null);const D=await k2(Z);N(!1),D.ok?(Mr("email_submitted",{purpose:r}),E(`We sent a 6-digit code to ${Z}.`),h("code")):(D.error==="work_email_required"&&Mr("work_email_required"),w(D_[D.error]??"Could not send a code. Try again."))},R=async()=>{const Z=b.trim();if(Z.length<4){w("Enter the 6-digit code from your email.");return}N(!0),w(null);const O=await C2(p.trim(),Z);if(N(!1),!O.verified){w("That code did not match. Check it and try again.");return}Mr("email_verified",{purpose:r}),I(O.email),s(),d?o("history"):F()},U=async()=>{try{await navigator.clipboard.writeText(M),X(!0),setTimeout(()=>X(!1),1500)}catch{}},K=j||(t==null?void 0:t.email)||p.trim();return m.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[m.jsxs("button",{onClick:()=>o(d?"history":"overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[m.jsx(kp,{className:"h-4 w-4"}),d?"Back to past runs":"Back to results"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Cp,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),m.jsx("h1",{className:"text-2xl font-semibold text-white",children:d?"Verify your email":"Export original scan report"})]}),!d&&m.jsx("p",{className:"text-sm text-[#aaa]",children:"This PDF preserves the original detected findings. Subsequent false-positive decisions and local triage notes are excluded."}),m.jsxs("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:[m.jsx("p",{className:"mb-4 text-xs text-[#666]",children:d?"We send a one-time code to confirm it is you.":"Verified by a one-time code sent to your email"}),S&&m.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[m.jsx(Yu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs text-red-300",children:S})]}),k&&!S&&f!=="password"&&m.jsx("p",{className:"mb-4 text-xs text-[#888]",children:k}),f==="disclosure"&&m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"space-y-2.5 rounded-lg p-3.5",style:{border:"1px solid #222",background:"rgba(255,255,255,0.02)"},children:[m.jsxs("div",{className:"flex items-start gap-2.5",children:[m.jsx(tw,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsxs("p",{className:"text-xs leading-relaxed text-[#aaa]",children:["We email an ",m.jsx("span",{className:"text-white",children:"encrypted PDF"}),". Nothing else leaves your machine."]})]}),m.jsxs("div",{className:"flex items-start gap-2.5",children:[m.jsx(tT,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),m.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:"Only you hold the password; Strix can't read it."})]})]}),m.jsx("button",{onClick:C,className:"w-full cursor-pointer rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90",children:"Export original report"}),c&&(t==null?void 0:t.email)&&m.jsxs("p",{className:"text-center text-xs text-[#666]",children:["Sending to ",t.email]})]}),f==="email"&&m.jsxs("form",{className:"space-y-4",onSubmit:Z=>{Z.preventDefault(),$()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),m.jsx("input",{type:"email",autoFocus:!0,value:p,onChange:Z=>g(Z.target.value),placeholder:"you@company.com",className:"w-full rounded-lg bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),m.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Send me a code"]})]}),f==="code"&&m.jsxs("form",{className:"space-y-4",onSubmit:Z=>{Z.preventDefault(),R()},children:[m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"6-digit code"}),m.jsx("input",{inputMode:"numeric",autoFocus:!0,value:b,onChange:Z=>y(Z.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:"w-full rounded-lg bg-black px-3 py-2.5 text-center text-lg font-mono tracking-[0.4em] text-white outline-none transition-colors focus:border-[#444]",style:{border:"1px solid #2a2a2a"}})]}),m.jsxs("button",{type:"submit",disabled:_,className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:[_&&m.jsx(Fs,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),d?"Verify":"Verify and send"]}),m.jsx("button",{type:"button",onClick:()=>{h("email"),w(null),E(null)},className:"w-full cursor-pointer text-center text-xs text-[#666] transition-colors hover:text-[#aaa]",children:"Use a different email"})]}),f==="sending"&&m.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[m.jsx(Fs,{className:"h-6 w-6 animate-spin text-white","aria-hidden":"true"}),m.jsx("p",{className:"text-sm text-[#aaa]",children:"Generating and encrypting locally..."})]}),f==="password"&&m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5",children:[m.jsx(Ys,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsxs("p",{className:"text-xs text-emerald-200",children:["Sent to ",K,". Open the attached PDF with this password."]})]}),m.jsxs("div",{children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your one-time password"}),m.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-black p-3",style:{border:"1px solid #2a2a2a"},children:[m.jsx("code",{className:"flex-1 break-all font-mono text-base text-white",children:M}),m.jsxs("button",{onClick:U,className:"flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs text-[#aaa] transition-colors hover:bg-[rgba(255,255,255,0.06)] hover:text-white",style:{border:"1px solid #2a2a2a"},children:[z?m.jsx(Ys,{className:"h-3.5 w-3.5"}):m.jsx(bo,{className:"h-3.5 w-3.5"}),z?"Copied":"Copy"]})]}),m.jsxs("p",{className:"mt-2 text-xs text-[#666]",children:["Save this now. Strix never stores it, so we cannot show it again. File:"," ",m.jsx("span",{className:"font-mono text-[#888]",children:A})]})]}),m.jsx("button",{onClick:()=>o("overview"),className:"w-full cursor-pointer rounded-lg px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-[rgba(255,255,255,0.06)]",style:{border:"1px solid #2a2a2a"},children:"Done"})]})]})]})}function oa(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function so(e){return Array.isArray(e)?e:[]}function nr(e){return typeof e=="string"&&e.trim()?e:null}function Ua(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function UH(e){return e.replace(/_/g," ")}function L_(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function HH(e){if(e==null||e<0)return"n/a";const t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t?`${t}h ${r}m ${a}s`:r?`${r}m ${a}s`:`${a}s`}function En({label:e,children:t}){return m.jsxs("div",{className:"grid grid-cols-[7rem_1fr] gap-3 items-baseline",children:[m.jsx("dt",{className:"text-[11px] uppercase tracking-wide text-[#666]",children:e}),m.jsx("dd",{className:"min-w-0 break-words text-sm text-[#ddd]",children:t})]})}function $H({raw:e,durationSeconds:t}){const[r,a]=J.useState(!0),s=so(e.targets_info).map(F=>{const C=oa(F),$=nr(C.original)??nr(oa(C.details).target_url)??"unknown target",R=nr(C.type);return{display:$,type:R?UH(R):null}}),o=nr(e.instruction),c=L_(nr(e.scan_mode)),d=nr(e.scope_mode),f=oa(e.diff_scope),h=f.active===!0,p=nr(f.mode),g=nr(e.diff_base),b=e.non_interactive===!0,y=so(e.local_sources).map(F=>{if(typeof F=="string")return F;const C=oa(F);return nr(C.source_path)??nr(C.target_path)??""}).filter(Boolean),_=L_(nr(e.status));let N=d??"auto";h&&(N+=` (diff${p?`: ${p}`:""}${g?` vs ${g}`:""})`);const S=oa(e.llm_usage),w=Object.keys(S).length>0,k=so(S.agents).map(oa),E=Array.from(new Set(k.map(F=>nr(F.model)).filter(F=>!!F))),M=Ua(S.requests),H=Ua(S.input_tokens),A=Ua(oa(so(S.input_tokens_details)[0]).cached_tokens),B=Ua(S.output_tokens),z=Ua(oa(so(S.output_tokens_details)[0]).reasoning_tokens),X=Ua(S.total_tokens),j=Ua(S.cost),I=nr(e.auth_mode)==="subscription",V=(F,C)=>m.jsxs("span",{className:"text-[#666]",children:[" (",zs(F)," ",C,")"]});return m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsxs("button",{type:"button",onClick:()=>a(F=>!F),"aria-expanded":r,className:"flex w-full cursor-pointer items-center gap-2 text-left",children:[m.jsx(ZC,{className:"h-4 w-4 text-[#888]","aria-hidden":"true"}),m.jsx("h2",{className:"text-sm font-semibold text-white",children:"Run details"}),r?m.jsx(G_,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"}):m.jsx(xo,{className:"ml-auto h-4 w-4 text-[#666]","aria-hidden":"true"})]}),r&&m.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2",children:[m.jsxs("section",{children:[m.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Configuration"}),m.jsxs("dl",{className:"space-y-2.5",children:[s.length>0&&m.jsx(En,{label:"Targets",children:m.jsx("div",{className:"space-y-1",children:s.map((F,C)=>m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.jsx("span",{className:"font-mono text-[#ddd]",children:F.display}),F.type&&m.jsx("span",{className:"rounded-full border border-[#2a2a2a] px-1.5 py-0.5 text-[10px] text-[#888]",children:F.type})]},C))})}),m.jsx(En,{label:"Instruction",children:o?m.jsx("span",{className:"whitespace-pre-wrap",children:o}):m.jsx("span",{className:"text-[#666]",children:"None"})}),c&&m.jsx(En,{label:"Pentest mode",children:c}),m.jsx(En,{label:"Scope",children:N}),m.jsx(En,{label:"Mode",children:b?"Non-interactive":"Interactive"}),y.length>0&&m.jsx(En,{label:"Local sources",children:m.jsx("div",{className:"space-y-0.5 font-mono text-[#ddd]",children:y.map((F,C)=>m.jsx("div",{children:F},C))})}),_&&m.jsx(En,{label:"Status",children:_})]})]}),m.jsxs("section",{children:[m.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wide text-[#555]",children:"Usage & cost"}),w?m.jsxs("dl",{className:"space-y-2.5 tabular-nums",children:[m.jsx(En,{label:"Model",children:E.length?E.join(", "):"n/a"}),I&&m.jsx(En,{label:"Provider",children:m.jsx("span",{className:"inline-flex items-center gap-1.5",children:m.jsx("span",{className:"rounded-full border border-[#22c55e]/40 bg-[#22c55e]/10 px-2 py-0.5 text-[11px] text-[#22c55e]",children:"ChatGPT subscription"})})}),m.jsx(En,{label:"Run time",children:HH(t)}),M!=null&&m.jsx(En,{label:"Requests",children:zs(M)}),H!=null&&m.jsxs(En,{label:"Input tokens",children:[zs(H),A!=null&&V(A,"cached")]}),B!=null&&m.jsxs(En,{label:"Output tokens",children:[zs(B),z!=null&&V(z,"reasoning")]}),X!=null&&m.jsx(En,{label:"Total tokens",children:zs(X)}),I?m.jsxs(En,{label:"Cost",children:[m.jsx("span",{className:"text-[#22c55e]",children:"$0.00"}),m.jsx("span",{className:"text-[#666]",children:" (subscription)"})]}):j!=null&&m.jsxs(En,{label:"Cost",children:["$",j.toFixed(2)]}),k.length>0&&m.jsx(En,{label:"Agents",children:zs(k.length)})]}):m.jsx("p",{className:"text-sm text-[#666]",children:"Not available yet."})]})]})]})}const z_="strix_viewer_trust_dismissed";function qH({message:e}){const[t,r]=J.useState(()=>{try{return localStorage.getItem(z_)==="1"}catch{return!1}});if(t)return null;const a=()=>{try{localStorage.setItem(z_,"1")}catch{}r(!0)};return m.jsx("div",{className:"fixed bottom-3 left-3 z-[60] max-w-xs rounded-lg bg-[#0a0a0a] p-3 shadow-2xl",style:{border:"1px solid #2a2a2a"},role:"status",children:m.jsxs("div",{className:"flex gap-2.5",children:[m.jsx(tw,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs leading-relaxed text-[#aaa]",children:e}),m.jsx("button",{onClick:a,"aria-label":"Dismiss",className:"-mr-0.5 -mt-0.5 flex-shrink-0 cursor-pointer rounded p-0.5 text-[#666] transition-colors hover:text-white",children:m.jsx(Ap,{className:"h-3.5 w-3.5"})})]})})}const PH=5e3,I_={invalid_email:"That email doesn't look right.",invalid_message:"Please write a little more.",unavailable:"Couldn't send that just now. Try again."};function FH({defaultEmail:e,onExit:t}){const[r,a]=J.useState(""),[s,o]=J.useState(e??""),[c,d]=J.useState("form"),[f,h]=J.useState(null),p=r.trim().length>0&&s.trim().length>0&&c!=="sending",g=async()=>{if(!p)return;d("sending"),h(null);const b=await sH(r.trim(),s.trim());if(b.ok){d("sent");return}d("form"),h(I_[b.error]??I_.unavailable)};return m.jsxs("div",{className:"mx-auto max-w-xl space-y-4",children:[m.jsxs("button",{onClick:()=>t("overview"),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] transition-colors hover:text-white",children:[m.jsx(kp,{className:"h-4 w-4"}),"Back to results"]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(O2,{className:"h-5 w-5 text-[#888]","aria-hidden":"true"}),m.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Feedback & support"})]}),m.jsx("div",{className:"w-full rounded-2xl bg-[rgba(255,255,255,0.02)] p-6",style:{border:"1px solid #2a2a2a"},children:c==="sent"?m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsx(ku,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-emerald-400","aria-hidden":"true"}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"text-sm font-semibold text-white",children:"Thanks, we got it."}),m.jsx("p",{className:"mt-1 text-xs text-[#888]",children:"We read every message. If it needs a reply, we'll reach out to the email you gave."}),m.jsx("button",{onClick:()=>{a(""),d("form")},className:"mt-4 cursor-pointer text-xs text-[#888] transition-colors hover:text-white",children:"Send more feedback"})]})]}):m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"mb-4 text-xs text-[#666]",children:"Bugs, feature requests, or anything else. Tell us what's on your mind."}),f&&m.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2",children:[m.jsx(Yu,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-xs text-red-300",children:f})]}),m.jsxs("label",{className:"block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your feedback"}),m.jsx("textarea",{autoFocus:!0,value:r,maxLength:PH,onChange:b=>a(b.target.value),rows:5,placeholder:"What's working, what's not, what you'd love to see…",className:"w-full resize-y rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),m.jsxs("label",{className:"mt-4 block",children:[m.jsx("span",{className:"mb-1.5 block text-xs text-[#888]",children:"Your work email"}),m.jsx("input",{type:"email",value:s,onChange:b=>o(b.target.value),placeholder:"you@company.com",className:"w-full rounded-lg border border-[#2a2a2a] bg-black px-3 py-2.5 text-sm text-white outline-none transition-colors focus:border-white/50 focus:ring-2 focus:ring-white/10"})]}),m.jsx("button",{onClick:()=>void g(),disabled:!p,className:"mt-4 flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-black transition-opacity hover:opacity-90 disabled:opacity-60",children:c==="sending"?"Sending…":"Send feedback"})]})})]})}function GH({text:e,children:t,className:r=""}){const[a,s]=J.useState(!1);return m.jsxs("span",{className:`relative inline-flex ${r}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),children:[t,a&&m.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-[240px] -translate-x-1/2 rounded-md px-2.5 py-1.5 text-xs text-[#ddd] shadow-lg",style:{border:"1px solid #2a2a2a",background:"#0a0a0a"},children:e})]})}function Oo({label:e,desc:t,slug:r,icon:a,surface:s,href:o=Ku,primary:c=!1}){return m.jsx(GH,{text:t,children:m.jsxs("a",{href:_i(o,r),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr(r,s),className:c?"group inline-flex items-center gap-2 rounded-lg border border-white bg-white px-3 py-2 text-sm font-semibold text-black transition-colors hover:bg-[#e5e5e5]":"group inline-flex items-center gap-2 rounded-lg border border-[#222] bg-[rgba(255,255,255,0.02)] px-3 py-2 text-sm text-[#aaa] transition-colors hover:border-[#444] hover:text-white",children:[m.jsx(a,{className:c?"h-4 w-4 text-black":"h-4 w-4 text-[#888] transition-colors group-hover:text-white","aria-hidden":"true"}),m.jsx("span",{children:e})]})})}const VH="Your findings stay on your machine. They're rendered here locally in your browser and never uploaded or stored by Strix.",B_=["critical","high","medium","low"],YH=500;function XH(){const[e,t]=J.useState(null),[r,a]=J.useState(null),[s,o]=J.useState(null),[c,d]=J.useState(null),[f,h]=J.useState("overview"),[p,g]=J.useState(null),[b,y]=J.useState(null),[_,N]=J.useState("report"),[S,w]=J.useState(!1),[k,E]=J.useState(!1),[M,H]=J.useState("open"),A=J.useRef(e);A.current=e;const B=J.useRef(0),z=J.useRef(0),X=J.useRef(new Set),j=J.useRef(()=>{}),I=J.useCallback(async()=>{try{g(await lH())}catch{}},[]),V=J.useCallback(async()=>{try{y(await rH())}catch{}},[]);J.useEffect(()=>{I(),V(),iH().then(ae=>E(ae.can_steer)).catch(()=>{})},[I,V]),J.useEffect(()=>{let ae=!1,ue,ge=!1,ye="",Ee=!0,Se=!1;B.current+=1;const Ce=async()=>{if(ae||Se)return;ue&&clearTimeout(ue),Se=!0;const pt=B.current;try{if(z.current)return;const Et=await WU(e);if(ge&&Et===ye&&!Ee)return;const Dt=await nH(e);if(ae||pt!==B.current||z.current)return;ge=Dt.finished,ge&&ye&&Et!==ye&&V(),ye=Et,Ee=!1,a(Dt),o(null)}catch(Et){if(ae)return;o(Et instanceof Error?Et.message:"Could not load run data.")}finally{Se=!1,ae||(ue=setTimeout(Ce,ge?1500:YH))}},Ue=()=>{Ee=!0,Ce()};return j.current=Ue,window.addEventListener("focus",Ue),Ce(),()=>{ae=!0,ue&&clearTimeout(ue),window.removeEventListener("focus",Ue)}},[e,V]);const F=J.useCallback(async(ae,ue)=>{const ge=e,ye=JSON.stringify([ge,ae.id]);B.current+=1,z.current+=1;const Ee=Se=>{A.current===ge&&a(Ce=>Ce&&{...Ce,vulnerabilities:Se})};try{if(X.current.has(ye)){const Ce=await Sp(ae.scan_id,ge);Ee(Ce),X.current.delete(ye);const Ue=Ce.find(pt=>pt.id===ae.id);if(!Ue||Ue.triage_revision!==ae.triage_revision||Ue.finding_digest!==ae.finding_digest)throw new co("conflict","The saved finding changed. Review its current state before trying again.")}const Se=await JU(ae,ue,ge);return A.current===ge&&a(Ce=>Ce&&{...Ce,vulnerabilities:Ce.vulnerabilities.map(Ue=>Ue.id===Se.id?Se:Ue)}),V(),Se}catch(Se){Se instanceof co||X.current.add(ye);try{const Ce=await Sp(ae.scan_id,ge);Ee(Ce),X.current.delete(ye);const Ue=Ce.find(pt=>pt.id===ae.id);if(!(Se instanceof co)&&Ue&&Ue.triage_revision===(ae.triage_revision??0)+1&&Ue.finding_digest===ae.finding_digest&&Ue.status===ue.status&&(ue.status==="open"||Ue.reason_code===(ue.reason_code??"unspecified")&&(Ue.status_note??"")===(ue.note??"").trim()))return Ue}catch{}throw Se instanceof co?Se:new Error("Could not confirm the save. The latest saved state will refresh before you retry.")}finally{z.current-=1,B.current+=1,A.current===ge&&j.current()}},[e,V]),C=J.useMemo(()=>(r==null?void 0:r.vulnerabilities.filter(ae=>ae.status!=="closed"))??[],[r]),$=J.useMemo(()=>r?KU(C):null,[r,C]),R=(r==null?void 0:r.vulnerabilities.find(ae=>ae.id===c))??null,U=(r==null?void 0:r.transcript.agents.length)??0,K=(p==null?void 0:p.verified)===!0,Z=J.useMemo(()=>r?ZU(r.raw):[],[r]),O=J.useMemo(()=>{var ue,ge;const ae=new Set;for(const ye of(r==null?void 0:r.transcript.events)??[]){if(ye.type!=="tool")continue;const Ee=(ue=ye.data)==null?void 0:ue.mcp_connection;typeof Ee!="string"||!Ee||((ge=ye.data)==null?void 0:ge.status)==="running"&&ae.add(Ee)}return ae},[r]),D=J.useRef(!1);J.useEffect(()=>{D.current=!1},[e]),J.useEffect(()=>{D.current||!r||(r.finished?(D.current=!0,h("overview")):U>0&&(D.current=!0,h("agents")))},[r,U]);const Y=J.useCallback(ae=>{D.current=!0,h(ae)},[]),L=J.useCallback(ae=>{t(ae),d(null),a(null),o(null),H("open"),D.current=!1},[]),G=J.useCallback((ae,ue)=>{yr("email_report",ue),N("report"),w(ae),Y("email")},[Y]),q=J.useCallback(()=>G(!1,"sidebar"),[G]),Q=J.useCallback(()=>G(!0,"overview"),[G]),ee=J.useCallback(()=>{V(),Y("history")},[V,Y]),W=J.useCallback(async()=>{await I(),await V()},[I,V]),te=J.useCallback(async()=>{await oH(),await I(),await V()},[I,V]);return m.jsxs("div",{className:"min-h-screen bg-black text-white flex",children:[m.jsx(kH,{view:f,onSelectView:ae=>{d(null),ae==="history"?ee():Y(ae)},issuesCount:C.length,agentCount:U,mcpConnections:Z,mcpInUse:O,runCount:(b==null?void 0:b.count)??0,finished:(r==null?void 0:r.finished)??!1,verified:K,email:(p==null?void 0:p.email)??null,onOpenEmail:q,onOpenHistory:ee,onForget:()=>void te()}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"border-b border-[#222]",children:m.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-4 flex items-center gap-1.5",children:[m.jsxs("a",{href:_i("https://app.strix.ai","logo"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("logo","topbar"),className:"flex items-center gap-1.5 opacity-90 transition-opacity hover:opacity-100 lg:hidden",title:"Open Strix Cloud",children:[m.jsx("img",{src:"./logo.png",alt:"Strix",className:"w-10 h-8 object-cover"}),m.jsx("div",{className:"text-base text-white font-medium tracking-tight",children:"Strix"})]}),r&&m.jsx(ZH,{finished:r.finished}),m.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[K&&b&&!b.locked&&b.runs.length>0&&m.jsx(KH,{runs:b,activeRun:e,launchedName:_o((r==null?void 0:r.summary.targets[0])??null,(r==null?void 0:r.summary.runName)??(r==null?void 0:r.summary.runId)??"Current run"),onSelect:L}),m.jsxs("a",{href:_i(Ku,"run_in_cloud"),target:"_blank",rel:"noopener noreferrer",onClick:()=>yr("run_in_cloud","topbar"),className:"inline-flex items-center gap-1 rounded-lg bg-white px-3 py-1.5 text-xs font-semibold text-black transition-opacity hover:opacity-90",children:["Run in the cloud",m.jsx(q_,{className:"w-3 h-3","aria-hidden":"true"})]})]})]})}),m.jsxs("div",{className:"max-w-[88rem] mx-auto px-3 sm:px-6 py-8 sm:py-12 space-y-6",children:[s&&f!=="history"&&f!=="email"&&m.jsxs("div",{className:"rounded-lg px-4 py-3 flex gap-3 items-start border border-red-500/30 bg-red-500/5",children:[m.jsx(Yu,{className:"w-5 h-5 flex-shrink-0 mt-0.5 text-red-400","aria-hidden":"true"}),m.jsx("p",{className:"text-sm text-red-300",children:s})]}),m.jsx("div",{className:"animate-page-in space-y-6",children:f==="email"?m.jsx(BH,{activeRun:e,auth:p,purpose:_,skipDisclosure:S,onAuthChanged:()=>{I(),V()},onExit:ae=>h(ae==="history"?"history":"overview")}):f==="feedback"?m.jsx(FH,{defaultEmail:(p==null?void 0:p.email)??null,onExit:ae=>h(ae)}):f==="history"?m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Xs,{className:"w-5 h-5 text-[#888]","aria-hidden":"true"}),m.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Past runs"})]}),m.jsx(LH,{runs:b,activeRun:e,onSelectRun:L,onVerified:()=>void W()})]}):!r&&!s?m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-10 text-center",children:[m.jsx("div",{className:"w-6 h-6 mx-auto mb-3 rounded-full border-2 border-[#333] border-t-white animate-spin"}),m.jsx("p",{className:"text-sm text-[#888]",children:"Loading run data…"})]}):r&&$?m.jsxs(m.Fragment,{children:[m.jsx(WH,{summary:r.summary}),m.jsxs("div",{className:"flex gap-5 border-b border-[#2a2a2a] lg:hidden",children:[m.jsx(Fm,{active:f==="overview",onClick:()=>Y("overview"),children:"Pentest Overview"}),m.jsxs(Fm,{active:f==="issues",onClick:()=>Y("issues"),children:["Issues",r.vulnerabilities.length>0?` (${C.length} open)`:""]}),U>0&&m.jsxs(Fm,{active:f==="agents",onClick:()=>Y("agents"),children:["Agents (",U,")"]})]}),f==="overview"?m.jsx(r$,{summary:r.summary,counts:$,total:C.length,detected:r.vulnerabilities.length,reportMarkdown:r.reportMarkdown,raw:r.raw,finished:r.finished,onOpenEmail:Q}):f==="agents"&&U>0?m.jsx(i$,{run:r,canSteer:k}):R?m.jsxs("div",{className:"space-y-4",children:[m.jsxs("button",{onClick:()=>d(null),className:"cursor-pointer inline-flex items-center gap-1.5 text-sm text-[#888] hover:text-white transition-colors",children:[m.jsx(kp,{className:"w-4 h-4"})," Back to all findings"]}),m.jsx(vD,{vulnerability:{...R,can_triage:R.can_triage&&!s},onTriage:F})]}):m.jsx(JH,{vulnerabilities:r.vulnerabilities,finished:r.finished,filter:M,onFilter:H,onSelect:ae=>d(ae)})]}):null},`${e??"launched"}:${f}:${c??""}`)]})]}),m.jsx(qH,{message:VH})]})}function KH({runs:e,activeRun:t,launchedName:r,onSelect:a}){const[s,o]=J.useState(!1),c=e.runs.find(f=>f.name===t),d=c?_o(c.target,c.name):r;return m.jsxs("div",{className:"relative",children:[m.jsxs("button",{onClick:()=>o(f=>!f),onBlur:()=>setTimeout(()=>o(!1),150),"aria-label":"Switch pentest",className:"flex items-center gap-2 rounded-lg border border-[#3a3a3a] bg-[rgba(255,255,255,0.05)] px-3 py-2 text-sm text-white transition-colors hover:border-[#555] hover:bg-[rgba(255,255,255,0.09)]",children:[m.jsx(Xs,{className:"h-4 w-4 flex-shrink-0 text-[#888]","aria-hidden":"true"}),m.jsx("span",{className:"flex-shrink-0 text-[#888]",children:"Pentest"}),m.jsx("span",{className:"max-w-[260px] truncate font-medium",children:d}),m.jsx(xo,{className:"h-4 w-4 flex-shrink-0 text-[#aaa]","aria-hidden":"true"})]}),s&&m.jsxs("div",{className:"absolute right-0 z-50 mt-2 max-h-96 w-96 overflow-y-auto rounded-xl py-1.5 shadow-2xl",style:{border:"1px solid #3a3a3a",background:"#0a0a0a"},children:[m.jsx("div",{className:"border-b border-[#222] px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-[#666]",children:"Switch pentest"}),e.runs.map(f=>{const h=f.name===t;return m.jsxs("button",{onMouseDown:()=>a(f.name),className:`flex w-full items-center gap-2 px-3 py-2.5 text-left text-sm transition-colors hover:bg-[rgba(255,255,255,0.06)] ${h?"bg-[rgba(255,255,255,0.04)] text-white":"text-[#aaa]"}`,children:[m.jsxs("span",{className:"min-w-0 flex-1",children:[m.jsx("span",{className:"block truncate font-medium",children:_o(f.target,f.name)}),f.target&&m.jsx("span",{className:"block truncate font-mono text-xs text-[#666]",children:f.target})]}),h&&m.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full bg-emerald-400"})]},f.name)})]})]})}function ZH({finished:e}){return e?m.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-[#888]",children:[m.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#555]"}),"Complete"]}):m.jsxs("span",{className:"ml-3 inline-flex items-center gap-1.5 text-xs text-emerald-400",children:[m.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[m.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75 animate-ping"}),m.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-400"})]}),"Live"]})}function QH(e){if(e==null)return null;if(e<60)return`${e}s`;const t=Math.floor(e/60);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function WH({summary:e}){const t=QH(e.durationSeconds);return m.jsxs("div",{children:[m.jsx("h1",{className:"text-2xl font-semibold text-white",children:_o(e.targets[0]??null,e.runName??e.runId??"Pentest results")}),m.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-[#888]",children:[e.targets.length>0&&m.jsx("span",{className:"font-mono text-[#aaa]",children:e.targets.join(", ")}),e.scanMode&&m.jsx(Pm,{label:e.scanMode}),t&&m.jsx(Pm,{label:t}),e.status&&m.jsx(Pm,{label:e.status})]})]})}function Pm({label:e}){return m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-[#333]",children:"·"}),m.jsx("span",{className:"capitalize",children:e})]})}function JH({vulnerabilities:e,finished:t,filter:r,onFilter:a,onSelect:s}){const o=e.filter(f=>f.status!=="closed").length,c=e.length-o,d=e.filter(f=>r==="all"||(r==="closed"?f.status==="closed":f.status!=="closed")).sort((f,h)=>B_.indexOf(f.severity)-B_.indexOf(h.severity));return e.length===0?m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-8 text-center text-sm text-[#888]",children:t?"No findings in this run.":"No findings yet. The pentest is still running…"}),t&&m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsx("p",{className:"text-sm font-medium text-white",children:"Stay ahead of new exposures"}),m.jsx("p",{className:"mt-0.5 mb-3 text-xs text-[#666]",children:"Attack surface monitoring catches new exposures for your org over time."}),m.jsx(Oo,{label:"Attack surface monitoring",desc:"Continuous coverage for your whole org.",slug:"asm",surface:"empty_state",icon:dT})]})]}):m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[m.jsx("div",{className:"flex gap-1 rounded-lg border border-[#333] p-1","aria-label":"Finding status",children:["open","closed","all"].map(f=>m.jsxs("button",{type:"button","aria-pressed":r===f,onClick:()=>a(f),className:`rounded-md px-3 py-1.5 text-sm capitalize ${r===f?"bg-white/10 text-white":"text-[#888] hover:text-white"}`,children:[f," (",f==="open"?o:f==="closed"?c:e.length,")"]},f))}),m.jsxs("p",{className:"text-sm text-[#888]",children:[o," open · ",c," false positives · ",e.length," found"]})]}),d.length===0&&m.jsx("div",{className:"rounded-xl border border-[#222] p-8 text-center text-sm text-[#aaa]",children:r==="open"?`No open findings. ${c} marked as false positives.`:"No closed findings."}),d.map(f=>m.jsxs("button",{onClick:()=>s(f.id),className:"animate-card-in cursor-pointer w-full text-left rounded-lg border border-[#222] hover:border-[#444] bg-[rgba(255,255,255,0.02)] px-4 py-3 transition-colors flex items-center gap-3",children:[m.jsx("span",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${Op(f.severity)}`,"aria-hidden":"true"}),m.jsxs("span",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"block text-sm font-medium text-white truncate",children:f.title}),f.target&&m.jsx("span",{className:"block text-xs text-[#666] font-mono truncate",children:f.target})]}),(f.status==="closed"||f.review_stale)&&m.jsx("span",{className:"text-xs text-[#aaa]",children:f.review_stale?"Needs review":"Closed · False positive"}),m.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full border capitalize ${rw[f.severity]}`,children:f.severity})]},f.id))]})}function e$(e){return e.replace(/^\s*#{1,6}[ \t]+.*(?:\r?\n)+/,"").trimStart()}function t$(e){const t=[];let r=null;for(const a of e.split(`
`)){const s=a.match(/^#{1,6}\s+(.*)$/);if(s){const o=s[1].trim().toLowerCase();if(o===r)continue;r=o}else a.trim()!==""&&(r=null);t.push(a)}return t.join(`
`)}function n$({onOpenEmail:e}){return m.jsx("button",{onClick:e,className:"group w-full cursor-pointer rounded-xl border border-emerald-500/25 bg-emerald-500/[0.06] p-4 text-left transition-colors hover:border-emerald-500/40",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg",style:{border:"1px solid rgba(16,185,129,0.3)",background:"rgba(16,185,129,0.08)"},children:m.jsx(Cp,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-sm font-semibold text-white",children:"Email the original scan report as an encrypted PDF"}),m.jsx("p",{className:"mt-0.5 text-xs text-[#888]",children:"Excludes subsequent triage. Encrypted with a key only you can see; email verified before sending."})]}),m.jsx("span",{className:"flex-shrink-0 rounded-lg bg-white px-3 py-1.5 text-xs font-semibold text-black transition-opacity group-hover:opacity-90",children:"Export original report"})]})})}function r$({summary:e,counts:t,total:r,detected:a,reportMarkdown:s,raw:o,finished:c,onOpenEmail:d}){const f=[["Executive Summary",e.executiveSummary],["Technical Analysis",e.technicalAnalysis],["Methodology",e.methodology],["Recommendations",e.recommendations]].filter(([,h])=>!!h).map(([h,p])=>({title:h,content:e$(p)}));return m.jsxs("div",{className:"space-y-6",children:[m.jsx("div",{className:"animate-card-in",children:m.jsx($H,{raw:o,durationSeconds:e.durationSeconds})}),a>0&&m.jsxs("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsxs("p",{className:"mb-3 text-sm text-[#aaa]",children:[r," open · ",a-r," false positives · ",a," found"]}),m.jsx(_D,{findings:{total:r,...t}})]}),c&&m.jsx("div",{className:"animate-card-in",children:m.jsx(n$,{onOpenEmail:d})}),c&&m.jsxs("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsx("p",{className:"text-sm font-semibold text-white",children:"Strix Cloud"}),m.jsx("p",{className:"mt-0.5 text-xs text-[#666]",children:"Run your next pentest in Strix Cloud."}),m.jsxs("div",{className:"mt-3 flex flex-wrap gap-2.5",children:[m.jsx(Oo,{label:"Run a pentest in Strix Cloud",desc:"Validated findings, autofix, and PR reviews.",slug:"overview_cloud",surface:"overview",icon:ew,primary:!0}),m.jsx(Oo,{label:"Try Strix Enterprise",desc:"SSO, compliance-ready reports, VPC or self-hosted deployment.",slug:"book_demo",surface:"overview",icon:F_,href:jp})]})]}),f.length>0?m.jsxs("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5 space-y-8",children:[m.jsx(U_,{}),f.map(h=>m.jsx(ca,{title:h.title,content:h.content},h.title))]}):s?m.jsxs("div",{className:"animate-card-in rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsx(U_,{}),m.jsx(ca,{content:t$(s)})]}):r===0&&m.jsx("p",{className:"text-sm text-[#888]",children:"No summary available for this run yet."})]})}function U_(){return m.jsxs("div",{className:"mb-5",children:[m.jsx("h2",{className:"text-base font-semibold text-white",children:"Original scan report"}),m.jsx("p",{className:"mt-1 text-sm text-[#888]",children:"Preserved as generated. Subsequent false-positive decisions are excluded; current triage counts appear above."})]})}function Fm({active:e,onClick:t,children:r}){return m.jsxs("button",{onClick:t,className:`cursor-pointer relative pb-2.5 text-sm font-semibold transition-colors ${e?"text-white":"text-[#666] hover:text-white"}`,children:[r,e&&m.jsx("span",{className:"absolute bottom-0 inset-x-0 h-0.5 bg-white rounded-full"})]})}function i$({run:e,canSteer:t}){const{agents:r,events:a}=e.transcript,s=J.useMemo(()=>HU(r,a),[r,a]),[o,c]=J.useState(null),d=o?r.find(h=>h.id===o)??null:null,f=t&&!e.finished;return m.jsxs("div",{className:"space-y-5",children:[m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Do,{className:"w-4 h-4 text-[#888]","aria-hidden":"true"}),m.jsx("h2",{className:"text-sm font-semibold text-white",children:"Agent graph"}),m.jsxs("span",{className:"text-xs text-[#666]",children:[r.length," agent",r.length===1?"":"s"]})]}),m.jsx("p",{className:"mt-1 mb-4 text-xs text-[#666]",children:"Click an agent to open its full transcript."}),m.jsx("div",{className:"h-[480px] rounded-lg border border-[#1a1a1a] overflow-hidden",children:m.jsx(u7,{agents:s,selectedAgentId:o,onSelectAgent:h=>c(h),eventsLoaded:!0,eventsEmpty:s.size===0,scanCompleted:e.finished})})]}),f&&m.jsx(T2,{agents:r}),m.jsxs("div",{className:"rounded-xl border border-[#222] bg-[rgba(255,255,255,0.02)] p-5",children:[m.jsx("p",{className:"text-sm font-semibold text-white",children:"Run this pentest with more depth"}),m.jsx("p",{className:"mt-0.5 text-xs text-[#666]",children:"Run this pentest again in Strix Cloud."}),m.jsxs("div",{className:"mt-3 flex flex-wrap gap-2.5",children:[m.jsx(Oo,{label:"Re-run in Strix Pro with more depth",desc:"More depth, validated findings, and autofix.",slug:"live_scan",surface:"agents",icon:ew,primary:!0}),m.jsx(Oo,{label:"Try Strix Enterprise",desc:"SSO, compliance-ready reports, VPC or self-hosted deployment.",slug:"book_demo",surface:"agents",icon:F_,href:jp})]})]}),m.jsx(fH,{open:d!==null,agent:d,events:a,steerable:f,onClose:()=>c(null)})]})}qk.createRoot(document.getElementById("root")).render(m.jsx(J.StrictMode,{children:m.jsx(XH,{})}));
diff --git a/strix/interface/viewer/static/index.html b/strix/interface/viewer/static/index.html
index 60312b0e..c6a9e692 100644
--- a/strix/interface/viewer/static/index.html
+++ b/strix/interface/viewer/static/index.html
@@ -6,7 +6,7 @@
Strix Results
-
+
diff --git a/strix/report/triage_store.py b/strix/report/triage_store.py
index aaaaca79..5a2361c0 100644
--- a/strix/report/triage_store.py
+++ b/strix/report/triage_store.py
@@ -109,6 +109,8 @@ def _file_lock(descriptor: int, *, unlock: bool = False) -> None:
if sys.platform == "win32":
import msvcrt # noqa: PLC0415
+ # The CRT permits locking beyond EOF, so even an empty file has byte zero
+ # available as a stable lock region. Always unlock that same region.
os.lseek(descriptor, 0, os.SEEK_SET)
msvcrt.locking(descriptor, msvcrt.LK_UNLCK if unlock else msvcrt.LK_NBLCK, 1)
else:
diff --git a/tests/test_triage_store.py b/tests/test_triage_store.py
new file mode 100644
index 00000000..93f322e4
--- /dev/null
+++ b/tests/test_triage_store.py
@@ -0,0 +1,40 @@
+"""Native operating-system locking invariants for the local review sidecar."""
+
+from __future__ import annotations
+
+import os
+from typing import TYPE_CHECKING
+
+import pytest
+
+from strix.report.triage_store import _file_lock
+
+
+if TYPE_CHECKING:
+ from pathlib import Path
+
+
+@pytest.mark.parametrize("contents", [b"", b"existing lock file"])
+def test_file_lock_excludes_other_handles_and_releases(tmp_path: Path, contents: bytes) -> None:
+ """Exercise fcntl on POSIX and the real msvcrt implementation on Windows."""
+ path = tmp_path / "triage.lock"
+ path.write_bytes(contents)
+ first = os.open(path, os.O_RDWR)
+ try:
+ second = os.open(path, os.O_RDWR)
+ try:
+ _file_lock(first)
+ try:
+ with pytest.raises(OSError):
+ _file_lock(second)
+ # Locking/unlocking must agree on byte zero, regardless of position.
+ os.lseek(first, 100, os.SEEK_SET)
+ finally:
+ _file_lock(first, unlock=True)
+ _file_lock(second)
+ _file_lock(second, unlock=True)
+ finally:
+ os.close(second)
+ finally:
+ os.close(first)
+ assert path.read_bytes() == contents
diff --git a/tests/test_viewer_triage.py b/tests/test_viewer_triage.py
index a2a4c9f5..87c09375 100644
--- a/tests/test_viewer_triage.py
+++ b/tests/test_viewer_triage.py
@@ -261,6 +261,71 @@ def test_corrupt_sidecar_is_a_visible_error_not_empty_findings(viewer: ViewerCli
assert read_vulnerabilities(viewer.run_dir)[0]["evidence"] == "original evidence"
+@pytest.mark.parametrize("damage", ["malformed", "null", "schema", "identity", "findings"])
+def test_invalid_historical_run_does_not_break_history(
+ viewer: ViewerClient, monkeypatch: pytest.MonkeyPatch, damage: str
+) -> None:
+ other = viewer.run_dir.parent / "damaged"
+ other.mkdir()
+ (other / "run.json").write_text(
+ json.dumps({"run_name": "damaged", "status": "completed", "end_time": "2026-09-15"}),
+ encoding="utf-8",
+ )
+ (other / "vulnerabilities.json").write_bytes(
+ (viewer.run_dir / "vulnerabilities.json").read_bytes()
+ )
+ finding = read_triaged_vulnerabilities(other)[0]
+ triage_finding(
+ other,
+ finding["id"],
+ status="closed",
+ expected_revision=0,
+ reviewed_digest=finding["finding_digest"],
+ surface="tui",
+ )
+ sidecar = other / "triage.json"
+ document = json.loads(sidecar.read_text(encoding="utf-8"))
+ if damage == "malformed":
+ sidecar.write_text("{", encoding="utf-8")
+ elif damage == "null":
+ sidecar.write_text("null", encoding="utf-8")
+ elif damage == "findings":
+ (other / "vulnerabilities.json").write_text("[null]", encoding="utf-8")
+ else:
+ if damage == "schema":
+ document["schema_version"] = 2
+ else:
+ document["run_identity"]["run_id"] = "another-run"
+ sidecar.write_text(json.dumps(document), encoding="utf-8")
+ saved = sidecar.read_bytes()
+ evidence = (other / "vulnerabilities.json").read_bytes()
+
+ # The locked history must not try to read the damaged run's findings.
+ assert viewer.request("/api/runs") == (200, {"locked": True, "count": 2, "runs": []})
+ monkeypatch.setattr("strix.interface.viewer.auth.is_verified", lambda: True)
+ status, payload = viewer.request("/api/runs")
+ assert status == 200
+ assert payload["count"] == 2
+ runs = {run["name"]: run for run in payload["runs"]}
+ assert runs["example"]["open_count"] == 1
+ assert runs["example"]["severity_counts"]["high"] == 1
+ assert runs["damaged"]["status"] == "completed"
+ assert runs["damaged"]["severity_counts"] is None
+ assert all(
+ key not in runs["damaged"] for key in ("open_count", "closed_count", "detected_count")
+ )
+ assert viewer.finding()["status"] == "open"
+ assert viewer.request("/api/vulnerabilities?run=damaged")[0] == 409
+ body = {
+ "status": "open",
+ "expected_revision": 1,
+ "reviewed_digest": finding["finding_digest"],
+ }
+ assert viewer.request("/api/vulnerabilities/vuln-0001/triage?run=damaged", body)[0] == 409
+ assert sidecar.read_bytes() == saved
+ assert (other / "vulnerabilities.json").read_bytes() == evidence
+
+
def test_read_only_run_has_no_write_capability(viewer: ViewerClient) -> None:
viewer.run_dir.chmod(0o500)
try: