hackagent-webui 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hackagent_webui/__init__.py +55 -0
- hackagent_webui/static/404.html +1 -0
- hackagent_webui/static/VERSION +1 -0
- hackagent_webui/static/_next/static/chunks/144-7c65ac1a3b9b2a8a.js +1 -0
- hackagent_webui/static/_next/static/chunks/151-6f51e268c96b3129.js +1 -0
- hackagent_webui/static/_next/static/chunks/187-849543277a4f9394.js +1 -0
- hackagent_webui/static/_next/static/chunks/1a258343-3a341c585963097c.js +1 -0
- hackagent_webui/static/_next/static/chunks/200-82851f7d6d761059.js +1 -0
- hackagent_webui/static/_next/static/chunks/292-fca7393c81ef214a.js +1 -0
- hackagent_webui/static/_next/static/chunks/326-a9081b3f86c9dd18.js +1 -0
- hackagent_webui/static/_next/static/chunks/377-e53ad1c182dbc31b.js +1 -0
- hackagent_webui/static/_next/static/chunks/391-c0e09f348021cffc.js +1 -0
- hackagent_webui/static/_next/static/chunks/411-da316013bbf4d70a.js +1 -0
- hackagent_webui/static/_next/static/chunks/493-bafbeb5ae66518b5.js +1 -0
- hackagent_webui/static/_next/static/chunks/4bd1b696-409494caf8c83275.js +1 -0
- hackagent_webui/static/_next/static/chunks/511-dd81e821519476da.js +1 -0
- hackagent_webui/static/_next/static/chunks/532-11a48022caced11c.js +1 -0
- hackagent_webui/static/_next/static/chunks/539-4b1c7db488293715.js +1 -0
- hackagent_webui/static/_next/static/chunks/594-97628408277cbac5.js +1 -0
- hackagent_webui/static/_next/static/chunks/619-7c7bed420eb7c654.js +1 -0
- hackagent_webui/static/_next/static/chunks/641-043f989d6143544b.js +1 -0
- hackagent_webui/static/_next/static/chunks/680-25d8e1ea98a28dad.js +1 -0
- hackagent_webui/static/_next/static/chunks/772-39e3838894a53779.js +1 -0
- hackagent_webui/static/_next/static/chunks/8-42d532ba984375d8.js +1 -0
- hackagent_webui/static/_next/static/chunks/816-19f20afc3075826e.js +1 -0
- hackagent_webui/static/_next/static/chunks/855-a78b13b4bd1c76cb.js +1 -0
- hackagent_webui/static/_next/static/chunks/9-22df388e4049bb14.js +1 -0
- hackagent_webui/static/_next/static/chunks/905-ff5fbcc54083c7ee.js +1 -0
- hackagent_webui/static/_next/static/chunks/921-18103c2d5cd6c671.js +1 -0
- hackagent_webui/static/_next/static/chunks/924-bbaf675cfa822d94.js +1 -0
- hackagent_webui/static/_next/static/chunks/959-f7b708ac280ce10a.js +1 -0
- hackagent_webui/static/_next/static/chunks/abf9ae41-a2ad9357d01c2a31.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/_not-found/page-72f9264520fc0b6a.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/agents/page-63d562af288bd470.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/api-keys/page-efb5b8e15af445f7.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/attacks/builder/page-4401ce40343e7239.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/attacks/page-e34de8a5ee4cf257.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/layout-4f66546247356e83.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/not-found-60bbe1f5c6cf66f2.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/page-65cb30228b8a1502.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/profile/page-002f78d4c4a0a548.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/reports/page-1507b6373935769e.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/stats/page-3d8df1bcc06245db.js +1 -0
- hackagent_webui/static/_next/static/chunks/framework-e2c84bf8dbc6c531.js +1 -0
- hackagent_webui/static/_next/static/chunks/main-app-641b4390ed531d52.js +1 -0
- hackagent_webui/static/_next/static/chunks/main-c0161e7c327c4241.js +1 -0
- hackagent_webui/static/_next/static/chunks/pages/_app-fcbe3e68b26044e2.js +1 -0
- hackagent_webui/static/_next/static/chunks/pages/_error-394ce64747f32b60.js +1 -0
- hackagent_webui/static/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- hackagent_webui/static/_next/static/chunks/webpack-a101479ef1443c74.js +1 -0
- hackagent_webui/static/_next/static/css/008a05b0ad6b854a.css +31 -0
- hackagent_webui/static/_next/static/css/c66d365ae0bced97.css +1 -0
- hackagent_webui/static/_next/static/esjZ6Ucner1eQeNRDDLzS/_buildManifest.js +1 -0
- hackagent_webui/static/_next/static/esjZ6Ucner1eQeNRDDLzS/_ssgManifest.js +1 -0
- hackagent_webui/static/agents.html +1 -0
- hackagent_webui/static/agents.txt +23 -0
- hackagent_webui/static/android-chrome-192x192.png +0 -0
- hackagent_webui/static/android-chrome-512x512.png +0 -0
- hackagent_webui/static/api-keys.html +1 -0
- hackagent_webui/static/api-keys.txt +23 -0
- hackagent_webui/static/apple-touch-icon.png +0 -0
- hackagent_webui/static/attacks/builder.html +1 -0
- hackagent_webui/static/attacks/builder.txt +24 -0
- hackagent_webui/static/attacks.html +1 -0
- hackagent_webui/static/attacks.txt +23 -0
- hackagent_webui/static/favicon-16x16.png +0 -0
- hackagent_webui/static/favicon-32x32.png +0 -0
- hackagent_webui/static/favicon.ico +0 -0
- hackagent_webui/static/index.html +1 -0
- hackagent_webui/static/index.txt +23 -0
- hackagent_webui/static/profile.html +1 -0
- hackagent_webui/static/profile.txt +23 -0
- hackagent_webui/static/raccoon.png +0 -0
- hackagent_webui/static/reports.html +1 -0
- hackagent_webui/static/reports.txt +23 -0
- hackagent_webui/static/silent-check-sso.html +11 -0
- hackagent_webui/static/stats.html +1 -0
- hackagent_webui/static/stats.txt +23 -0
- hackagent_webui-0.2.0.dist-info/METADATA +59 -0
- hackagent_webui-0.2.0.dist-info/RECORD +81 -0
- hackagent_webui-0.2.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[22],{50113:(e,t,s)=>{"use strict";s.d(t,{CG:()=>i,Ez:()=>r,JX:()=>a,xk:()=>l,xv:()=>n});let r={vulnerable:"#ef4444",safe:"#22c55e",error:"#f59e0b",pending:"#94a3b8"},l={vulnerable:"#f87171",safe:"#4ade80",error:"#fbbf24",pending:"#cbd5e1"},n={low:"#22c55e",medium:"#eab308",high:"#f97316",critical:"#ef4444"},a={LITELLM:"LiteLLM",OPENAI_SDK:"OpenAI SDK / API",GOOGLE_ADK:"Google ADK",OTHER:"Other / Proprietary",UNKNOWN:"Unknown"},i=new Set(["attack_type","generator"])},52428:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eB});var r=s(95155),l=s(12115),n=s(86948),a=s(11647),i=s(3998),c=s(17037),o=s(35299),d=s(39867),x=s(27937),p=s(50906),u=s(16485),m=s(1524),h=s(52056),g=s(26983),f=s(89715),j=s(17910),b=s(78192),v=s(57828),y=s(13496),k=s(17983),N=s(7831),w=s(41444),S=s(22470),A=s(56419),z=s(63819),T=s(10281),R=s(56373),C=s(69386),L=s(26265),E=s(96324),B=s(68425),M=s(47734),W=s(73697),F=s(33420),D=s(37665),O=s(86618),P=s(62319),I=s(26411),_=s(32909),J=s(88230),V=s(39548),G=s(61362),K=s(78874),H=s(59427),U=s(37494),Z=s(50113),$=s(63479),q=s(28567);function X(e){var t;return e?null!=(t=Z.JX[e])?t:e:"Unknown"}function Q(e){return null==e?"—":"string"==typeof e?e:String(e)}function Y(e){let{v:t,depth:s=0}=e;if(null==t)return(0,r.jsx)("span",{className:"text-muted-foreground",children:"—"});if(Array.isArray(t))return 0===t.length?(0,r.jsx)("span",{className:"text-muted-foreground",children:"—"}):(0,r.jsx)("div",{className:"space-y-0.5",children:t.map((e,t)=>(0,r.jsx)("div",{children:(0,r.jsx)(Y,{v:e,depth:s})},t))});if("object"==typeof t){let e=Object.entries(t);return 0===e.length?(0,r.jsx)("span",{className:"text-muted-foreground",children:"—"}):(0,r.jsx)("dl",{className:"space-y-0.5 ".concat(s>0?"pl-3 border-l border-border":""),children:e.map(e=>{let[t,l]=e;return(0,r.jsxs)("div",{className:"flex gap-2 items-baseline",children:[(0,r.jsx)("dt",{className:"text-muted-foreground shrink-0 min-w-[72px] text-[10px] uppercase tracking-wide",children:t}),(0,r.jsx)("dd",{className:"font-mono text-[11px]",children:(0,r.jsx)(Y,{v:l,depth:s+1})})]},t)})})}return(0,r.jsx)("span",{className:"font-mono",children:Q(t)})}function ee(e){let{v:t,depth:s=0}=e;if(null==t)return(0,r.jsx)("span",{style:{color:"#9ca3af"},children:"—"});if(Array.isArray(t))return 0===t.length?(0,r.jsx)("span",{style:{color:"#9ca3af"},children:"—"}):(0,r.jsx)("div",{children:t.map((e,t)=>(0,r.jsx)("div",{children:(0,r.jsx)(ee,{v:e,depth:s})},t))});if("object"==typeof t){let e=Object.entries(t);return 0===e.length?(0,r.jsx)("span",{style:{color:"#9ca3af"},children:"—"}):(0,r.jsx)("div",{style:s>0?{paddingLeft:"10px",borderLeft:"2px solid #e5e7eb"}:{},children:e.map(e=>{let[t,l]=e;return(0,r.jsxs)("div",{style:{display:"flex",gap:"8px",marginBottom:"2px",alignItems:"flex-start"},children:[(0,r.jsx)("span",{style:{color:"#9ca3af",fontSize:"9px",textTransform:"uppercase",letterSpacing:"0.04em",minWidth:"72px",flexShrink:0,paddingTop:"1px"},children:t}),(0,r.jsx)("span",{style:{fontFamily:"monospace",fontSize:"10px",color:"#374151"},children:(0,r.jsx)(ee,{v:l,depth:s+1})})]},t)})})}return(0,r.jsx)("span",{style:{fontFamily:"monospace",fontSize:"10px",color:"#374151"},children:Q(t)})}function et(e){return e>=70?"#16a34a":e>=40?"#d97706":"#dc2626"}function es(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:18;return e.length>t?e.slice(0,t-1)+"…":e}let er=[25,50,75,100],el="system-ui, -apple-system, 'Helvetica Neue', sans-serif";function en(e,t){return 2*Math.PI*t/e-Math.PI/2}function ea(e,t,s){return 230+t*Math.cos(en(e,s))}function ei(e,t,s){return 200+t*Math.sin(en(e,s))}function ec(e,t){return Array.from({length:e},(s,r)=>"".concat(ea(e,140*t(r),r),",").concat(ei(e,140*t(r),r))).join(" ")}function eo(e,t){let s=Math.cos(en(e,t));return .25>Math.abs(s)?"middle":s>0?"start":"end"}function ed(e,t){let s=Math.sin(en(e,t));return s<-.7?-4:s>.7?14:4}function ex(e){return"dark"===e?{bg:"#111827",ringFill:"none",ringStroke:"#9ca3af",ringLabel:"#d1d5db",axisStroke:"#9ca3af",polyFill:"#60a5fa1a",polyStroke:"#93c5fd",dotStroke:"#f3f4f6",labelText:"#f3f4f6"}:{bg:"#ffffff",ringFill:"none",ringStroke:"#4b5563",ringLabel:"#374151",axisStroke:"#4b5563",polyFill:"#3b82f614",polyStroke:"#60a5fa",dotStroke:"#111827",labelText:"#111827"}}function ep(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function eu(e){let{data:t,theme:s="light"}=e,l=t.length;if(l<3)return null;let n=ex(s),a=(e,t)=>ea(l,e,t),i=(e,t)=>ei(l,e,t),c=e=>ec(l,e),o=e=>eo(l,e);return(0,r.jsxs)("svg",{viewBox:"0 0 ".concat(460," ").concat(400),width:460,height:400,style:{display:"block",margin:"0 auto",maxWidth:"100%"},children:[(0,r.jsx)("rect",{width:460,height:400,fill:"none"}),er.map(e=>(0,r.jsx)("polygon",{points:c(()=>e/100),fill:100===e?n.ringFill:"none",stroke:n.ringStroke,strokeWidth:"0.9"},e)),er.map(e=>(0,r.jsx)("text",{x:233,y:200-e/100*140-3,fontSize:"8",fill:n.ringLabel,fontFamily:el,textAnchor:"start",children:e},e)),t.map((e,t)=>(0,r.jsx)("line",{x1:230,y1:200,x2:a(140,t),y2:i(140,t),stroke:n.axisStroke,strokeWidth:"0.9"},t)),(0,r.jsx)("polygon",{points:c(e=>t[e].robustness/100),fill:n.polyFill,stroke:n.polyStroke,strokeWidth:"1.6",strokeLinejoin:"round"}),t.map((e,t)=>(0,r.jsx)("circle",{cx:a(e.robustness/100*140,t),cy:i(e.robustness/100*140,t),r:4,fill:et(e.robustness),stroke:n.dotStroke,strokeWidth:"1.5"},t)),t.map((e,t)=>{let s=a(164,t),c=i(164,t)+ed(l,t);return(0,r.jsxs)("g",{children:[(0,r.jsx)("text",{x:s,y:c,fontSize:"10",fontWeight:"600",fill:n.labelText,fontFamily:el,textAnchor:o(t),children:es(e.name)}),(0,r.jsxs)("text",{x:s,y:c+13,fontSize:"9",fill:et(e.robustness),fontFamily:el,textAnchor:o(t),fontWeight:"700",children:[e.robustness,"% robust"]})]},t)})]})}var em=s(6259),eh=s(23327),eg=s(37397),ef=s(45345);function ej(e){let{agent:t,attack:s,results:l,isLoading:n}=e,i=null==s?void 0:s._configuration,c=(0,q.PL)(i),d=Array.from(new Set(l.map(e=>(0,q.Bn)(e,i)))),x=i?Object.entries(i).filter(e=>{let[t,s]=e;return null!=s&&!Z.CG.has(t)}):[],p=null==i?void 0:i.generator;return n?(0,r.jsxs)("div",{className:"border rounded-lg p-5 flex items-center gap-3 text-muted-foreground",children:[(0,r.jsx)(o.A,{className:"h-4 w-4 animate-spin shrink-0"}),(0,r.jsx)("span",{className:"text-sm",children:"Loading test scope details…"})]}):t||s||0!==d.length||c?(0,r.jsxs)("div",{className:"border rounded-lg divide-y print-avoid-break",children:[(0,r.jsxs)("div",{className:"px-4 py-3 flex items-center gap-2 bg-muted/30",children:[(0,r.jsx)(eh.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("h3",{className:"text-sm font-semibold",children:"Scope of Testing"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x",children:[t&&(0,r.jsxs)("div",{className:"px-4 py-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(b.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:"Agent Under Test"})]}),(0,r.jsxs)("div",{className:"space-y-2 pl-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Name"}),(0,r.jsx)("p",{className:"text-sm font-semibold",children:t.name})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Type"}),(0,r.jsx)(a.E,{variant:"secondary",className:"text-xs mt-0.5",children:X(t.agentType)})]}),t.endpoint&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Endpoint"}),(0,r.jsx)("p",{className:"text-xs font-mono text-muted-foreground break-all",children:t.endpoint})]}),t.description&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Description"}),(0,r.jsx)("p",{className:"text-xs",children:t.description})]})]})]}),(0,r.jsxs)("div",{className:"px-4 py-4 space-y-4",children:[s&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(eg.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:"Attack Strategy"})]}),(0,r.jsxs)("div",{className:"pl-6 space-y-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Type"}),(0,r.jsx)(a.E,{variant:"outline",className:"text-xs mt-0.5",children:s.type})]}),p&&(0,r.jsxs)(r.Fragment,{children:[p.identifier&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Model"}),(0,r.jsx)("p",{className:"text-xs font-mono",children:String(p.identifier)})]}),p.agent_type&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Generator Type"}),(0,r.jsx)(a.E,{variant:"secondary",className:"text-xs mt-0.5",children:String(p.agent_type)})]}),p.endpoint&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Generator Endpoint"}),(0,r.jsx)("p",{className:"text-xs font-mono text-muted-foreground break-all",children:String(p.endpoint)})]})]})]})]}),(c||x.length>0||d.length>0)&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(ef.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:"Datasets & Harmful Categories"})]}),(0,r.jsxs)("div",{className:"pl-6 space-y-2",children:[c&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide mb-1",children:"Dataset"}),(0,r.jsx)(a.E,{variant:"outline",className:"text-xs",children:c})]}),x.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide mb-1",children:"Parameters"}),(0,r.jsx)("dl",{className:"mt-1 space-y-1.5",children:x.map(e=>{let[t,s]=e;return(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{className:"text-[10px] text-muted-foreground uppercase tracking-wide mb-0.5",children:t}),(0,r.jsx)("dd",{className:"pl-0 text-xs",children:(0,r.jsx)(Y,{v:s})})]},t)})})]}),d.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-xs text-muted-foreground uppercase tracking-wide mb-1",children:["Harm Categories (",d.length,")"]}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:d.map(e=>(0,r.jsx)(a.E,{variant:"secondary",className:"text-xs",children:e},e))})]})]})]}),!s&&0===d.length&&!c&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground pl-6",children:"No attack or dataset metadata available."})]})]})]}):null}let eb=e=>{let{cx:t,cy:s,riskScore:l,riskLevel:n}=e;return(0,r.jsxs)("g",{children:[(0,r.jsxs)("text",{x:t,y:s-10,textAnchor:"middle",fontSize:28,fontWeight:"700",fill:Z.xv[n],children:[l,"%"]}),(0,r.jsx)("text",{x:t,y:s+14,textAnchor:"middle",fontSize:12,fill:"#6b7280",children:"Risk Score"})]})};function ev(e){let{report:t}=e,s=100-t.riskScore,l=[{name:"Risk",value:t.riskScore,color:Z.xv[t.riskLevel]},{name:"Remaining",value:s,color:"#e5e7eb"}];return(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsxs)(T.r,{width:240,height:220,children:[(0,r.jsx)(R.Fq,{data:l,cx:120,cy:110,innerRadius:72,outerRadius:102,startAngle:90,endAngle:-270,paddingAngle:0,dataKey:"value",isAnimationActive:!1,children:l.map(e=>(0,r.jsx)(C.f,{fill:e.color},e.name))}),(0,r.jsx)(eb,{cx:120,cy:110,riskScore:t.riskScore,riskLevel:t.riskLevel})]}),(0,r.jsx)("div",{className:"text-center",children:(0,r.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wide px-2 py-0.5 rounded",style:{background:"".concat(Z.xv[t.riskLevel],"22"),color:Z.xv[t.riskLevel],border:"1px solid ".concat(Z.xv[t.riskLevel],"55")},children:[t.riskLevel," risk"]})})]})}function ey(e){let{results:t,attack:s=null}=e,{resolvedTheme:l}=(0,$.D)(),n="dark"===l?Z.xk:Z.Ez,a=null==s?void 0:s._configuration,i={};t.forEach(e=>{let t=(0,q.Bn)(e,a);i[t]||(i[t]={vulnerable:0,safe:0,error:0});let s=(0,q.km)(e.evaluationStatus);"vulnerable"===s?i[t].vulnerable++:"safe"===s?i[t].safe++:i[t].error++});let c=Object.entries(i).map(e=>{let[t,s]=e;return{name:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:22;return e.length>t?e.slice(0,t-1)+"…":e}(t),Vulnerable:s.vulnerable,Mitigated:s.safe,Error:s.error}}).sort((e,t)=>t.Vulnerable-e.Vulnerable);if(0===c.length)return null;let o=Math.max(220,32*c.length+80);return(0,r.jsx)(L.u,{width:"100%",height:o,children:(0,r.jsxs)(E.E,{data:c,layout:"vertical",margin:{top:4,right:30,left:8,bottom:4},barCategoryGap:"25%",children:[(0,r.jsx)(B.d,{horizontal:!1,strokeDasharray:"3 3",stroke:"#e5e7eb"}),(0,r.jsx)(M.W,{type:"number",allowDecimals:!1,tick:{fontSize:11}}),(0,r.jsx)(W.h,{type:"category",dataKey:"name",tick:{fontSize:11},width:120}),(0,r.jsx)(F.m,{wrapperStyle:{fontSize:12},cursor:{fill:"rgba(0,0,0,0.04)"}}),(0,r.jsx)(D.s,{wrapperStyle:{fontSize:11}}),(0,r.jsx)(O.yP,{dataKey:"Vulnerable",stackId:"a",fill:n.vulnerable,isAnimationActive:!1}),(0,r.jsx)(O.yP,{dataKey:"Mitigated",stackId:"a",fill:n.safe,isAnimationActive:!1}),(0,r.jsx)(O.yP,{dataKey:"Error",stackId:"a",fill:n.error,isAnimationActive:!1,radius:[0,3,3,0]})]})})}function ek(e){let{results:t}=e,{resolvedTheme:s}=(0,$.D)(),l=t.map(e=>e.latencyMs).filter(e=>"number"==typeof e);if(0===l.length)return null;let n=[{label:"<500ms",min:0,max:500},{label:"0.5-1s",min:500,max:1e3},{label:"1-2s",min:1e3,max:2e3},{label:"2-5s",min:2e3,max:5e3},{label:">5s",min:5e3,max:1/0}].map(e=>({label:e.label,Count:l.filter(t=>t>=e.min&&t<e.max).length})).filter(e=>e.Count>0);if(0===n.length)return null;let a=Math.round(l.reduce((e,t)=>e+t,0)/l.length),i=[...l].sort((e,t)=>e-t)[Math.floor(.95*l.length)];return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex gap-6 text-xs text-muted-foreground",children:[(0,r.jsxs)("span",{children:["Avg: ",(0,r.jsx)("strong",{children:a<1e3?"".concat(a,"ms"):"".concat((a/1e3).toFixed(1),"s")})]}),(0,r.jsxs)("span",{children:["p95: ",(0,r.jsx)("strong",{children:i<1e3?"".concat(i,"ms"):"".concat((i/1e3).toFixed(1),"s")})]}),(0,r.jsxs)("span",{children:["n=",l.length]})]}),(0,r.jsx)(L.u,{width:"100%",height:160,children:(0,r.jsxs)(E.E,{data:n,margin:{top:4,right:8,left:-10,bottom:4},children:[(0,r.jsx)(B.d,{vertical:!1,strokeDasharray:"3 3",stroke:"#e5e7eb"}),(0,r.jsx)(M.W,{dataKey:"label",tick:{fontSize:11}}),(0,r.jsx)(W.h,{allowDecimals:!1,tick:{fontSize:11}}),(0,r.jsx)(F.m,{wrapperStyle:{fontSize:12}}),(0,r.jsx)(O.yP,{dataKey:"Count",fill:"dark"===s?"#818cf8":"#6366f1",radius:[3,3,0,0],isAnimationActive:!1})]})})]})}function eN(e){let{status:t}=e,s=(0,q.km)(t);return"vulnerable"===s?(0,r.jsx)(h.A,{className:"h-3.5 w-3.5 shrink-0",style:{color:Z.Ez.vulnerable}}):"safe"===s?(0,r.jsx)(G.A,{className:"h-3.5 w-3.5 shrink-0",style:{color:Z.Ez.safe}}):"error"===s?(0,r.jsx)(K.A,{className:"h-3.5 w-3.5 shrink-0",style:{color:Z.Ez.error}}):(0,r.jsx)(g.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})}function ew(e,t,s){let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"light",s=e.length;if(s<3)return"";let r=ex(t),l=er.map(e=>{let t=ec(s,()=>e/100);return'<polygon points="'.concat(t,'" fill="none" stroke="').concat(r.ringStroke,'" stroke-width="0.9"/>')}).join("\n "),n=er.map(e=>'<text x="'.concat(233,'" y="').concat(200-e/100*140-3,'" font-size="8" fill="').concat(r.ringLabel,'" font-family="').concat(ep(el),'" text-anchor="start">').concat(e,"</text>")).join("\n "),a=Array.from({length:s},(e,t)=>'<line x1="'.concat(230,'" y1="').concat(200,'" x2="').concat(ea(s,140,t),'" y2="').concat(ei(s,140,t),'" stroke="').concat(r.axisStroke,'" stroke-width="0.9"/>')).join("\n "),i='<polygon points="'.concat(ec(s,t=>e[t].robustness/100),'" fill="').concat(r.polyFill,'" stroke="').concat(r.polyStroke,'" stroke-width="1.6" stroke-linejoin="round"/>'),c=e.map((e,t)=>{let l=e.robustness/100*140;return'<circle cx="'.concat(ea(s,l,t),'" cy="').concat(ei(s,l,t),'" r="4" fill="').concat(et(e.robustness),'" stroke="').concat(r.dotStroke,'" stroke-width="1.5"/>')}).join("\n "),o=e.map((e,t)=>{let l=ea(s,164,t),n=ei(s,164,t)+ed(s,t),a=eo(s,t);return['<text x="'.concat(l,'" y="').concat(n,'" font-size="10" font-weight="600" fill="').concat(r.labelText,'" font-family="').concat(ep(el),'" text-anchor="').concat(a,'">').concat(ep(es(e.name)),"</text>"),'<text x="'.concat(l,'" y="').concat(n+13,'" font-size="9" fill="').concat(et(e.robustness),'" font-family="').concat(ep(el),'" text-anchor="').concat(a,'" font-weight="700">').concat(e.robustness,"% robust</text>")].join("\n ")}).join("\n ");return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '.concat(460," ").concat(400,'" width="').concat(460,'" height="').concat(400,'">\n ').concat(l,"\n ").concat(n,"\n ").concat(a,"\n ").concat(i,"\n ").concat(c,"\n ").concat(o,"\n</svg>")}(e,t);if(!r)return;let l=new Blob([r],{type:"image/svg+xml"}),n=URL.createObjectURL(l),a=document.createElement("a");a.href=n,a.download="robustness-radar-".concat(s,"-").concat(t,".svg"),document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(n),100)}function eS(e){var t;let{results:s,attack:l=null}=e,n=null==l?void 0:l._configuration,a=(()=>{let e={};return s.forEach(t=>{let s=(0,q.Bn)(t,n);e[s]||(e[s]={vuln:0,safe:0,error:0,total:0});let r=(0,q.km)(t.evaluationStatus);"vulnerable"===r?e[s].vuln++:"safe"===r?e[s].safe++:e[s].error++,e[s].total++}),Object.entries(e).map(e=>{let[t,s]=e;return{name:t,...s,rate:s.total>0?Math.round(s.vuln/s.total*100):0}}).sort((e,t)=>t.vuln-e.vuln)})(),c=a.map(e=>({name:e.name,robustness:100-e.rate,vuln:e.vuln,total:e.total}));if(0===c.length)return null;let o=Math.round(c.reduce((e,t)=>e+t.robustness,0)/c.length),x=o>=70?"#16a34a":o>=40?"#d97706":"#dc2626",p=s[0]&&null!=(t=s[0].run)?t:"report",u=e=>e>=70?"#16a34a":e>=40?"#d97706":"#dc2626",m=()=>(0,r.jsxs)(em.rI,{children:[(0,r.jsx)(em.ty,{asChild:!0,children:(0,r.jsxs)(i.$,{variant:"outline",size:"sm",className:"h-7 px-2.5 gap-1.5 text-xs",children:[(0,r.jsx)(d.A,{className:"h-3 w-3"})," Download SVG"]})}),(0,r.jsxs)(em.SQ,{align:"end",children:[(0,r.jsxs)(em._2,{onClick:()=>ew(c,"light",p),children:[(0,r.jsx)(H.A,{className:"h-3.5 w-3.5 mr-2"})," Light background"]}),(0,r.jsxs)(em._2,{onClick:()=>ew(c,"dark",p),children:[(0,r.jsx)(U.A,{className:"h-3.5 w-3.5 mr-2"})," Dark background"]})]})]});return c.length<3?(0,r.jsxs)("div",{className:"space-y-3 w-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Overall robustness"}),(0,r.jsxs)("span",{className:"text-lg font-bold",style:{color:x},children:[o,"%"]})]}),(0,r.jsx)(m,{})]}),a.map(e=>(0,r.jsxs)("div",{className:"grid items-center gap-2",style:{gridTemplateColumns:"180px 1fr 40px"},children:[(0,r.jsx)("span",{className:"text-xs font-medium truncate",children:e.name}),(0,r.jsx)("div",{className:"h-2 bg-muted rounded overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded",style:{width:"".concat(100-e.rate,"%"),background:u(100-e.rate)}})}),(0,r.jsxs)("span",{className:"text-xs font-semibold text-right",style:{color:u(100-e.rate)},children:[100-e.rate,"%"]})]},e.name)),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Robustness = 100 − vulnerability rate per category"})]}):(0,r.jsxs)("div",{className:"flex flex-col gap-2 w-full",children:[(0,r.jsxs)("div",{className:"flex w-full items-center justify-between px-1",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground uppercase tracking-widest",children:"Overall robustness"}),(0,r.jsxs)("p",{className:"text-3xl font-bold",style:{color:x},children:[o,"%"]})]}),(0,r.jsx)(m,{})]}),(0,r.jsx)(L.u,{width:"100%",height:340,children:(0,r.jsxs)(P.V,{data:c,margin:{top:10,right:40,bottom:10,left:40},children:[(0,r.jsx)(I.z,{stroke:"currentColor",className:"text-border"}),(0,r.jsx)(_.r,{dataKey:"name",tick:e=>{let{x:t,y:s,textAnchor:l,payload:n}=e,a=n.value,i=a.length>18?a.slice(0,17)+"…":a;return(0,r.jsx)("text",{x:t,y:s,textAnchor:l,fontSize:11,fill:"currentColor",className:"text-foreground",dy:4,children:i})}}),(0,r.jsx)(J.E,{domain:[0,100],tickCount:5,tick:{fontSize:9}}),(0,r.jsx)(V.Vd,{name:"Robustness",dataKey:"robustness",stroke:"#3b82f6",fill:"#3b82f6",fillOpacity:.15,strokeWidth:2,dot:e=>{let{cx:t,cy:s,payload:l}=e;return(0,r.jsx)("circle",{cx:t,cy:s,r:5,fill:u(l.robustness),stroke:"white",strokeWidth:1.5},"dot-".concat(l.name))}}),(0,r.jsx)(F.m,{content:(0,r.jsx)(e=>{let{active:t,payload:s}=e;if(!t||!(null==s?void 0:s.length))return null;let l=s[0].payload;return(0,r.jsxs)("div",{className:"bg-background border rounded-lg shadow-md px-3 py-2 text-xs space-y-1",children:[(0,r.jsx)("p",{className:"font-semibold text-sm",children:l.name}),(0,r.jsxs)("p",{children:["Robustness: ",(0,r.jsxs)("strong",{style:{color:u(l.robustness)},children:[l.robustness,"%"]})]}),(0,r.jsxs)("p",{className:"text-muted-foreground",children:["Vulnerable: ",l.vuln," / ",l.total]})]})},{})})]})}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:"Robustness = 100 − vulnerability rate per category. Hover a point for details."})]})}function eA(e){let{report:t,agent:s=null,attack:l=null,results:n=[]}=e,a=Z.xv[t.riskLevel],i=null==l?void 0:l._configuration,c=(0,q.PL)(i),o=Array.from(new Set(n.map(e=>(0,q.Bn)(e,i)))),d=(()=>{let e={};return n.forEach(t=>{let s=(0,q.Bn)(t,i);e[s]||(e[s]={vuln:0,safe:0,error:0,total:0});let r=(0,q.km)(t.evaluationStatus);"vulnerable"===r?e[s].vuln++:"safe"===r?e[s].safe++:e[s].error++,e[s].total++}),Object.entries(e).map(e=>{let[t,s]=e;return{name:t,...s,rate:s.total>0?Math.round(s.vuln/s.total*100):0}}).sort((e,t)=>t.vuln-e.vuln)})(),x="Category",p=null==l?void 0:l._configuration,u=p?Object.entries(p).filter(e=>{let[t,s]=e;return null!=s&&!Z.CG.has(t)}):[],m=null==p?void 0:p.generator,h={border:"1px solid #e5e7eb",borderRadius:"8px",marginBottom:"20px",overflow:"hidden",pageBreakInside:"avoid"},g={background:"#f9fafb",padding:"9px 14px",borderBottom:"1px solid #e5e7eb"},f={margin:0,fontSize:"12px",fontWeight:700,color:"#111827"},j={margin:"2px 0 0",fontSize:"10px",color:"#9ca3af"},b={padding:"7px 10px",textAlign:"left",fontWeight:500,color:"#6b7280",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",background:"#f9fafb",borderBottom:"1px solid #e5e7eb"},v={padding:"7px 10px",fontSize:"11px",borderBottom:"1px solid #f3f4f6"},y=e=>({display:"inline-block",padding:"2px 7px",borderRadius:"4px",fontSize:"10px",fontWeight:500,marginRight:"4px",marginBottom:"4px",background:e+"18",color:e,border:"1px solid ".concat(e,"44")});return(0,r.jsxs)("div",{style:{fontFamily:'system-ui, -apple-system, "Helvetica Neue", sans-serif',color:"#111827",lineHeight:1.5},children:[(0,r.jsxs)("div",{style:{borderBottom:"3px solid ".concat(a),paddingBottom:"18px",marginBottom:"20px",display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"5px"},children:[(0,r.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",children:[(0,r.jsx)("path",{d:"M12 2L3 7v5c0 5.25 3.75 10.15 9 11.25C17.25 22.15 21 17.25 21 12V7L12 2z",fill:a,fillOpacity:"0.15",stroke:a,strokeWidth:"1.8"}),(0,r.jsx)("path",{d:"M9 12l2 2 4-4",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,r.jsx)("h1",{style:{margin:0,fontSize:"20px",fontWeight:700,letterSpacing:"-0.02em"},children:"HackAgent Security Report"})]}),(0,r.jsxs)("p",{style:{margin:"2px 0",fontSize:"12px",color:"#6b7280"},children:["Agent: ",(0,r.jsx)("strong",{style:{color:"#111827"},children:t.run.agentName}),t.run.organizationName&&(0,r.jsxs)(r.Fragment,{children:[" \xa0\xb7\xa0 Org: ",(0,r.jsx)("strong",{style:{color:"#111827"},children:t.run.organizationName})]})]}),(0,r.jsxs)("p",{style:{margin:"1px 0 0",fontSize:"10px",color:"#9ca3af"},children:["Run ID: ",t.run.id," \xa0\xb7\xa0 ",new Date(t.run.timestamp).toLocaleString()]})]}),(0,r.jsxs)("div",{style:{textAlign:"right",flexShrink:0},children:[(0,r.jsx)("p",{style:{margin:0,fontSize:"10px",color:"#9ca3af"},children:"Generated"}),(0,r.jsx)("p",{style:{margin:"2px 0 0",fontSize:"11px",fontWeight:500},children:new Date().toLocaleString()}),(0,r.jsxs)("span",{style:{display:"inline-block",marginTop:"6px",padding:"2px 8px",borderRadius:"4px",fontSize:"10px",fontWeight:700,background:a+"18",color:a,border:"1px solid ".concat(a,"55"),textTransform:"uppercase",letterSpacing:"0.06em"},children:[t.riskLevel," risk"]})]})]}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"10px",marginBottom:"20px"},children:[{label:"Total Tests",value:String(t.totalTests),color:"#3b82f6"},{label:"Vulnerabilities",value:String(t.successfulJailbreaks),color:Z.Ez.vulnerable},{label:"Mitigated",value:String(t.failedJailbreaks),color:Z.Ez.safe},{label:"Errors",value:String(t.errors),color:Z.Ez.error},{label:"Risk Score",value:"".concat(t.riskScore,"%"),color:a}].map(e=>(0,r.jsxs)("div",{style:{border:"1px solid #e5e7eb",borderTop:"3px solid ".concat(e.color),borderRadius:"6px",padding:"10px 8px",textAlign:"center"},children:[(0,r.jsx)("p",{style:{margin:0,fontSize:"22px",fontWeight:700,color:e.color},children:e.value}),(0,r.jsx)("p",{style:{margin:"3px 0 0",fontSize:"9px",color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.04em"},children:e.label})]},e.label))}),(0,r.jsxs)("div",{style:h,children:[(0,r.jsxs)("div",{style:g,children:[(0,r.jsx)("h2",{style:f,children:"What Was Tested"}),(0,r.jsx)("p",{style:j,children:"Agent details, attack strategy, and evaluated datasets / harmful categories"})]}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:s?"1fr 1fr":"1fr"},children:[s&&(0,r.jsxs)("div",{style:{padding:"14px",borderRight:"1px solid #e5e7eb"},children:[(0,r.jsx)("p",{style:{margin:"0 0 10px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"#6b7280"},children:"Agent Under Test"}),(0,r.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:(0,r.jsxs)("tbody",{children:[(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",width:"85px",verticalAlign:"top"},children:"Name"}),(0,r.jsx)("td",{style:{fontWeight:600,paddingBottom:"6px"},children:s.name})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",verticalAlign:"top"},children:"Type"}),(0,r.jsx)("td",{style:{paddingBottom:"6px"},children:(0,r.jsx)("span",{style:{background:"#f3f4f6",color:"#374151",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:500},children:X(s.agentType)})})]}),s.endpoint&&(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",verticalAlign:"top"},children:"Endpoint"}),(0,r.jsx)("td",{style:{fontFamily:"monospace",fontSize:"9px",color:"#374151",paddingBottom:"6px",wordBreak:"break-all"},children:s.endpoint})]}),s.description&&(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",verticalAlign:"top"},children:"Description"}),(0,r.jsx)("td",{style:{fontSize:"11px",color:"#374151"},children:s.description})]})]})})]}),(0,r.jsxs)("div",{style:{padding:"14px"},children:[l&&(0,r.jsxs)("div",{style:{marginBottom:c||m||u.length>0||o.length>0?"16px":0},children:[(0,r.jsx)("p",{style:{margin:"0 0 10px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"#6b7280"},children:"Attack Strategy"}),(0,r.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:(0,r.jsxs)("tbody",{children:[l.type&&(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",width:"85px",verticalAlign:"top",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Type"}),(0,r.jsx)("td",{style:{paddingBottom:"6px"},children:(0,r.jsx)("span",{style:{background:"#f3f4f6",color:"#374151",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:500},children:l.type})})]}),(null==m?void 0:m.identifier)!=null&&(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",width:"85px",verticalAlign:"top",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Model"}),(0,r.jsx)("td",{style:{paddingBottom:"6px",fontFamily:"monospace",fontSize:"11px"},children:String(m.identifier)})]}),(null==m?void 0:m.agent_type)!=null&&(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",width:"85px",verticalAlign:"top",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Gen. Type"}),(0,r.jsx)("td",{style:{paddingBottom:"6px"},children:(0,r.jsx)("span",{style:{background:"#f3f4f6",color:"#374151",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:500},children:String(m.agent_type)})})]}),(null==m?void 0:m.endpoint)!=null&&(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",width:"85px",verticalAlign:"top",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Gen. Endpoint"}),(0,r.jsx)("td",{style:{paddingBottom:"6px",fontFamily:"monospace",fontSize:"10px",wordBreak:"break-all",color:"#6b7280"},children:String(m.endpoint)})]})]})})]}),(c||u.length>0||o.length>0)&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{style:{margin:"0 0 10px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"#6b7280"},children:"Datasets & Harmful Categories"}),c&&(0,r.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,r.jsx)("p",{style:{margin:"0 0 5px",fontSize:"10px",color:"#9ca3af"},children:"Dataset"}),(0,r.jsx)("div",{children:(0,r.jsx)("span",{style:y("#7c3aed"),children:c})})]}),u.length>0&&(0,r.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,r.jsx)("p",{style:{margin:"0 0 6px",fontSize:"10px",color:"#9ca3af"},children:"Parameters"}),(0,r.jsx)("table",{style:{width:"100%",borderCollapse:"collapse"},children:(0,r.jsx)("tbody",{children:u.map(e=>{let[t,s]=e;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{color:"#9ca3af",paddingBottom:"6px",verticalAlign:"top",width:"85px",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.04em"},children:t}),(0,r.jsx)("td",{style:{paddingBottom:"6px",fontSize:"11px"},children:(0,r.jsx)(ee,{v:s})})]},t)})})})]}),o.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{style:{margin:"0 0 5px",fontSize:"10px",color:"#9ca3af"},children:["Harm Categories (",o.length,")"]}),(0,r.jsx)("div",{children:o.map(e=>(0,r.jsx)("span",{style:y("#1d4ed8"),children:e},e))})]})]}),!s&&!l&&0===o.length&&!c&&(0,r.jsx)("p",{style:{fontSize:"12px",color:"#9ca3af"},children:"No test metadata available."})]})]})]}),d.length>0&&(0,r.jsxs)("div",{style:{...h,pageBreakBefore:"always"},children:[(0,r.jsxs)("div",{style:g,children:[(0,r.jsx)("h2",{style:f,children:"Vulnerability Results by Category"}),(0,r.jsx)("p",{style:j,children:"Breakdown of test outcomes per harm category"})]}),(0,r.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse"},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:b,children:x}),(0,r.jsx)("th",{style:{...b,textAlign:"center",width:"60px"},children:"Tests"}),(0,r.jsx)("th",{style:{...b,textAlign:"center",width:"80px",color:Z.Ez.vulnerable},children:"Vulnerable"}),(0,r.jsx)("th",{style:{...b,textAlign:"center",width:"80px",color:Z.Ez.safe},children:"Mitigated"}),(0,r.jsx)("th",{style:{...b,width:"130px"},children:"Vuln. Rate"})]})}),(0,r.jsx)("tbody",{children:d.map(e=>(0,r.jsxs)("tr",{style:{background:e.vuln>0?"#fff5f550":"white"},children:[(0,r.jsx)("td",{style:{...v,fontWeight:500},children:e.name}),(0,r.jsx)("td",{style:{...v,textAlign:"center",color:"#6b7280"},children:e.total}),(0,r.jsx)("td",{style:{...v,textAlign:"center",color:Z.Ez.vulnerable,fontWeight:e.vuln>0?600:400},children:e.vuln}),(0,r.jsx)("td",{style:{...v,textAlign:"center",color:Z.Ez.safe},children:e.safe}),(0,r.jsx)("td",{style:{...v},children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,r.jsx)("div",{style:{flex:1,height:"5px",background:"#f3f4f6",borderRadius:"3px",overflow:"hidden"},children:(0,r.jsx)("div",{style:{width:"".concat(e.rate,"%"),height:"100%",borderRadius:"3px",background:e.rate>60?Z.Ez.vulnerable:e.rate>30?"#f97316":Z.Ez.safe}})}),(0,r.jsxs)("span",{style:{fontSize:"10px",color:"#374151",minWidth:"28px",textAlign:"right"},children:[e.rate,"%"]})]})})]},e.name))})]})]}),(()=>{let e=d.map(e=>({name:e.name,robustness:100-e.rate,vuln:e.vuln,total:e.total}));if(e.length<3)return(0,r.jsxs)("div",{style:h,children:[(0,r.jsxs)("div",{style:g,children:[(0,r.jsxs)("h2",{style:f,children:["Robustness by ",x]}),(0,r.jsx)("p",{style:j,children:"Robustness score = 100 − vulnerability rate"})]}),(0,r.jsx)("div",{style:{padding:"14px"},children:(d.length,d).map(e=>(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"180px 1fr 40px",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[(0,r.jsx)("span",{style:{fontSize:"11px",fontWeight:500,color:"#374151"},children:e.name}),(0,r.jsx)("div",{style:{height:"8px",background:"#f3f4f6",borderRadius:"4px",overflow:"hidden"},children:(0,r.jsx)("div",{style:{width:"".concat(100-e.rate,"%"),height:"100%",borderRadius:"4px",background:e.rate>60?"#dc2626":e.rate>30?"#d97706":"#16a34a"}})}),(0,r.jsxs)("span",{style:{fontSize:"11px",fontWeight:600,textAlign:"right",color:e.rate>60?"#dc2626":e.rate>30?"#d97706":"#16a34a"},children:[100-e.rate,"%"]})]},e.name))})]});let t=Math.round(e.reduce((e,t)=>e+t.robustness,0)/e.length);return(0,r.jsxs)("div",{style:h,children:[(0,r.jsxs)("div",{style:g,children:[(0,r.jsx)("h2",{style:f,children:"Robustness by Category"}),(0,r.jsx)("p",{style:j,children:"Robustness score = 100 − vulnerability rate per harm category. Higher = more robust."})]}),(0,r.jsxs)("div",{style:{padding:"20px",display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,r.jsx)("p",{style:{margin:"0 0 4px",fontSize:"10px",color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Overall robustness"}),(0,r.jsxs)("p",{style:{margin:"0 0 16px",fontSize:"28px",fontWeight:700,color:t>=70?"#16a34a":t>=40?"#d97706":"#dc2626"},children:[t,"%"]}),(0,r.jsx)(eu,{data:e})]})]})})(),(0,r.jsxs)("div",{style:{borderTop:"1px solid #e5e7eb",paddingTop:"10px",marginTop:"4px",display:"flex",justifyContent:"space-between",fontSize:"9px",color:"#9ca3af"},children:[(0,r.jsxs)("span",{children:["Generated by HackAgent \xb7 ",new Date().toLocaleString()]}),(0,r.jsx)("span",{children:"Confidential"})]})]})}var ez=s(52619),eT=s.n(ez);let eR=(0,w.h)("ReportsPage"),eC=e=>{let t,s=e.totalResults,r=e.successfulJailbreaks,l=e.failedJailbreaks,n=e.errors,a=e.notEvaluated,i=s>0?Math.round(r/s*100):0;return t=i<=10?"low":i<=30?"medium":i<=60?"high":"critical",{run:e,totalTests:s,successfulJailbreaks:r,failedJailbreaks:l,errors:n,notEvaluated:a,riskScore:i,riskLevel:t}},eL=e=>{switch(e){case"low":default:return"outline";case"medium":return"secondary";case"high":return"default";case"critical":return"destructive"}},eE=e=>{switch(e){case"low":return"text-green-600 dark:text-green-400";case"medium":return"text-yellow-600 dark:text-yellow-400";case"high":return"text-orange-600 dark:text-orange-400";case"critical":return"text-red-600 dark:text-red-400";default:return"text-muted-foreground"}},eB=()=>{let[e,t]=(0,l.useState)([]),[s,w]=(0,l.useState)(!0),[T,R]=(0,l.useState)(null),[C,L]=(0,l.useState)(0),[E,B]=(0,l.useState)(1),[M,W]=(0,l.useState)(null),[F,D]=(0,l.useState)(null),[O,P]=(0,l.useState)(null),[I,_]=(0,l.useState)(!1),[J,V]=(0,l.useState)([]),[G,K]=(0,l.useState)(!1),H=(0,l.useCallback)(async e=>{w(!0),R(null);try{var s,r;let l=await N.ME.runList({page:e,pageSize:20,status:k.S5d.Completed}),n=(null!=(s=l.results)?s:[]).map(eC);t(n),L(null!=(r=l.count)?r:0),eR.debug({count:n.length,total:l.count},"Fetched reports")}catch(e){eR.error({err:e},"Failed to fetch reports"),R(e.message||"Failed to fetch reports. Please try again.")}w(!1)},[]);(0,l.useEffect)(()=>{H(E)},[H,E]);let U=(0,l.useCallback)(async e=>{_(!0),K(!0),V([]),P(null);try{let[t,s]=await Promise.allSettled([N.in.agentRetrieve({id:e.run.agent}),e.run.attack?N.vm.attackRetrieve({id:e.run.attack}):Promise.resolve(null)]),r="fulfilled"===t.status?t.value:null,l="fulfilled"===s.status?s.value:null;P({agent:r,attack:l}),eR.debug({agentId:e.run.agent},"Fetched report detail")}catch(e){eR.error({err:e},"Failed to fetch report detail"),P({agent:null,attack:null})}_(!1);try{var t,s,r;let l=await N.ui.resultList({run:e.run.id,pageSize:1e3,page:1}),n=null!=(t=l.results)?t:[],a=null!=(s=l.count)?s:0,i=Math.ceil(a/1e3);if(i>1)for(let t of(await Promise.all(Array.from({length:i-1},(t,s)=>N.ui.resultList({run:e.run.id,pageSize:1e3,page:s+2})))))n=n.concat(null!=(r=t.results)?r:[]);V(n)}catch(e){eR.error({err:e},"Failed to fetch results for report")}K(!1)},[]),Z=l.useMemo(()=>{let t=new Map;return e.forEach(e=>{var s;let r=null!=(s=e.run.agentName)?s:"Unknown Agent";t.has(r)||t.set(r,[]),t.get(r).push(e)}),t},[e]),$=l.useMemo(()=>Array.from(Z.entries()),[Z]),q=$.length,X=Math.ceil(C/20),Q=l.useMemo(()=>{if(0===e.length)return null;let t=e.reduce((e,t)=>e+t.totalTests,0);return{totalTests:t,totalJailbreaks:e.reduce((e,t)=>e+t.successfulJailbreaks,0),avgRisk:Math.round(e.reduce((e,t)=>e+t.riskScore,0)/e.length)}},[e]);if(s)return(0,r.jsx)(S.M,{title:"Security Reports",children:(0,r.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,r.jsx)(o.A,{className:"h-8 w-8 animate-spin text-muted-foreground"})})});if(M){var Y,ee,et,es,er,el;let e=J.some(e=>"number"==typeof e.latencyMs),t=J.length>0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"print-only",children:(0,r.jsx)(eA,{report:M,agent:null!=(Y=null==O?void 0:O.agent)?Y:null,attack:null!=(ee=null==O?void 0:O.attack)?ee:null,results:J})}),(0,r.jsx)("div",{className:"no-print",children:(0,r.jsx)(S.M,{title:"Report Details",action:(0,r.jsxs)(i.$,{variant:"outline",size:"sm",onClick:()=>{window.print()},className:"gap-2",children:[(0,r.jsx)(d.A,{className:"h-4 w-4"}),"Export PDF"]}),children:(0,r.jsxs)("div",{className:"space-y-6 px-6 pb-8",children:[(0,r.jsxs)(i.$,{variant:"ghost",onClick:()=>{W(null),D(null)},className:"gap-2",children:[(0,r.jsx)(x.A,{className:"h-4 w-4 rotate-180"}),"Back to Reports"]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Total Tests",value:M.totalTests,color:"text-blue-600 dark:text-blue-400"},{label:"Vulnerabilities",value:M.successfulJailbreaks,color:"text-red-600 dark:text-red-400"},{label:"Mitigated",value:M.failedJailbreaks,color:"text-green-600 dark:text-green-400"},{label:"Errors",value:M.errors,color:"text-amber-600 dark:text-amber-400"}].map(e=>(0,r.jsxs)("div",{className:"border rounded-lg p-4 text-center",children:[(0,r.jsx)("p",{className:"text-3xl font-bold ".concat(e.color),children:e.value}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.label})]},e.label))}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)(n.Zp,{children:[(0,r.jsxs)(n.aR,{className:"pb-2",children:[(0,r.jsxs)(n.ZB,{className:"text-sm flex items-center gap-1.5",children:[(0,r.jsx)(p.A,{className:"h-4 w-4 text-muted-foreground"})," Risk Score"]}),(0,r.jsxs)(n.BT,{className:"flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1 text-xs",children:[(0,r.jsx)(u.A,{className:"h-3 w-3"})," ",new Date(M.run.timestamp).toLocaleString()]}),(0,r.jsx)(a.E,{variant:eL(M.riskLevel),className:"text-xs",children:M.riskLevel.toUpperCase()})]})]}),(0,r.jsx)(n.Wu,{className:"flex justify-center",children:(0,r.jsx)(ev,{report:M})})]}),(0,r.jsxs)(n.Zp,{children:[(0,r.jsxs)(n.aR,{className:"pb-2",children:[(0,r.jsxs)(n.ZB,{className:"text-sm flex items-center gap-1.5",children:[(0,r.jsx)(m.A,{className:"h-4 w-4 text-muted-foreground"})," Robustness Radar"]}),(0,r.jsx)(n.BT,{children:"Robustness = 100 − vulnerability rate per category. Higher is better."})]}),(0,r.jsx)(n.Wu,{className:"flex items-center justify-center min-h-[200px]",children:G?(0,r.jsx)(o.A,{className:"h-6 w-6 animate-spin text-muted-foreground"}):t?(0,r.jsx)(eS,{results:J,attack:null!=(et=null==O?void 0:O.attack)?et:null}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No results available"})})]})]}),(0,r.jsxs)(n.Zp,{children:[(0,r.jsxs)(n.aR,{className:"pb-2",children:[(0,r.jsxs)(n.ZB,{className:"text-sm flex items-center gap-1.5",children:[(0,r.jsx)(h.A,{className:"h-4 w-4 text-muted-foreground"})," Vulnerability by Category"]}),(0,r.jsx)(n.BT,{children:"Stacked distribution of outcomes per harm category"})]}),(0,r.jsx)(n.Wu,{className:"flex items-center justify-center min-h-[160px]",children:G?(0,r.jsx)(o.A,{className:"h-6 w-6 animate-spin text-muted-foreground"}):t?(0,r.jsx)(ey,{results:J,attack:null!=(es=null==O?void 0:O.attack)?es:null}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No results available"})})]}),(G||e)&&(0,r.jsxs)(n.Zp,{children:[(0,r.jsxs)(n.aR,{className:"pb-2",children:[(0,r.jsxs)(n.ZB,{className:"text-sm flex items-center gap-1.5",children:[(0,r.jsx)(g.A,{className:"h-4 w-4 text-muted-foreground"})," Response Latency Distribution"]}),(0,r.jsx)(n.BT,{children:"Count of results per response-time bucket"})]}),(0,r.jsx)(n.Wu,{className:"flex items-center justify-center min-h-[160px]",children:G?(0,r.jsx)(o.A,{className:"h-6 w-6 animate-spin text-muted-foreground"}):(0,r.jsx)(ek,{results:J})})]}),(0,r.jsx)(ej,{agent:null!=(er=null==O?void 0:O.agent)?er:null,attack:null!=(el=null==O?void 0:O.attack)?el:null,results:J,isLoading:I}),(0,r.jsxs)("div",{className:"flex flex-col lg:flex-row gap-6",children:[(0,r.jsxs)("div",{className:"space-y-2 ".concat(F?"lg:w-2/5":"w-full"),children:[(0,r.jsxs)("h3",{className:"text-sm font-medium px-1",children:["Test Results ",(0,r.jsx)("span",{className:"text-muted-foreground font-normal",children:"— click a row to inspect"})]}),(0,r.jsx)(c.F,{className:"h-[340px] border rounded-lg",children:(0,r.jsx)("div",{className:"space-y-1 p-2",children:G?(0,r.jsx)("div",{className:"flex items-center justify-center h-[300px]",children:(0,r.jsx)(o.A,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-3 p-2.5 rounded-md cursor-pointer transition-colors hover:bg-muted/60 ".concat((null==F?void 0:F.id)===e.id?"bg-muted ring-1 ring-primary":""),onClick:()=>{D(e)},children:[(0,r.jsx)(eN,{status:e.evaluationStatus}),(0,r.jsx)("div",{className:"flex-1 min-w-0",children:(0,r.jsx)("p",{className:"text-xs font-medium truncate",children:"Test #".concat(t+1)})}),(0,r.jsx)(a.E,{variant:e.evaluationStatus===k.on2.SuccessfulJailbreak?"destructive":e.evaluationStatus===k.on2.FailedJailbreak||e.evaluationStatus===k.on2.PassedCriteria?"outline":"secondary",className:"text-xs shrink-0",children:e.evaluationStatus===k.on2.SuccessfulJailbreak?"Vulnerable":e.evaluationStatus===k.on2.FailedJailbreak||e.evaluationStatus===k.on2.PassedCriteria?"Safe":"Error"})]},e.id))})})]}),F&&(0,r.jsx)("div",{className:"lg:w-3/5 border rounded-lg bg-card overflow-hidden",children:(0,r.jsx)(z.I,{result:F,onClose:()=>{D(null)}})})]})]})})})]})}return(0,r.jsxs)(S.M,{title:"Security Reports",description:"Security test results and vulnerability analysis.",children:[Q&&(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 px-6 pb-6",children:[(0,r.jsxs)("div",{className:"border p-4 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30",children:(0,r.jsx)(f.A,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-2xl font-bold",children:C}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total Reports"})]})]}),(0,r.jsxs)("div",{className:"border p-4 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30",children:(0,r.jsx)(p.A,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-2xl font-bold",children:Q.totalTests}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Tests (this page)"})]})]}),(0,r.jsxs)("div",{className:"border p-4 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"p-2 bg-red-100 dark:bg-red-900/30",children:(0,r.jsx)(h.A,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-2xl font-bold",children:Q.totalJailbreaks}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Vulnerabilities (this page)"})]})]}),(0,r.jsxs)("div",{className:"border p-4 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"p-2 bg-amber-100 dark:bg-amber-900/30",children:(0,r.jsx)(m.A,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-2xl font-bold",children:[Q.avgRisk,"%"]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Avg. Risk Score (this page)"})]})]})]}),(0,r.jsxs)("div",{className:"border mx-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(j.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("h2",{className:"text-sm font-medium",children:"Security Reports"})]}),(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:[q," agent",1!==q?"s":""," on this page"]})]}),(0,r.jsxs)("div",{className:"p-4",children:[T&&(0,r.jsx)("div",{className:"bg-destructive/10 border border-destructive/30 rounded-md p-4 mb-4",children:(0,r.jsx)("p",{className:"text-sm text-destructive",children:T})}),0===e.length?(0,r.jsx)(A.p,{icon:f.A,title:"No reports yet",description:"Complete a security test run to see your first report here.",action:(0,r.jsx)(i.$,{asChild:!0,children:(0,r.jsx)(eT(),{href:"/stats",children:"View Test Runs"})})}):(0,r.jsx)(y.nD,{type:"multiple",className:"space-y-2",children:$.map(e=>{let[t,s]=e,l=s.reduce((e,t)=>{let s=["low","medium","high","critical"];return s.indexOf(t.riskLevel)>s.indexOf(e)?t.riskLevel:e},"low"),n=s.reduce((e,t)=>e+t.successfulJailbreaks,0),c=s.reduce((e,t)=>e+t.totalTests,0);return(0,r.jsxs)(y.As,{value:t,className:"border rounded-lg px-0 overflow-hidden",children:[(0,r.jsx)(y.$m,{className:"px-4 py-3 hover:no-underline hover:bg-muted/50 [&[data-state=open]]:bg-muted/30",children:(0,r.jsxs)("div",{className:"flex items-center gap-4 flex-1 text-left",children:[(0,r.jsx)("div",{className:"p-2 rounded-lg ".concat("low"===l?"bg-green-100 dark:bg-green-900/30":"medium"===l?"bg-yellow-100 dark:bg-yellow-900/30":"high"===l?"bg-orange-100 dark:bg-orange-900/30":"bg-red-100 dark:bg-red-900/30"),children:(0,r.jsx)(b.A,{className:"h-5 w-5 ".concat(eE(l))})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsx)("span",{className:"font-medium",children:t}),(0,r.jsx)(a.E,{variant:eL(l),className:"text-xs",children:l.toUpperCase()})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground mt-0.5",children:[(0,r.jsxs)("span",{children:[s.length," report",1!==s.length?"s":""]}),(0,r.jsxs)("span",{children:[c," tests total"]}),n>0&&(0,r.jsxs)("span",{className:"text-red-600 dark:text-red-400",children:[n," vulnerabilities"]})]})]})]})}),(0,r.jsx)(y.ub,{className:"px-0 pb-0",children:(0,r.jsx)("div",{className:"divide-y",children:s.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>(e=>{W(e),D(null),P(null),U(e)})(e),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full ".concat((e=>{switch(e){case"low":return"bg-green-500";case"medium":return"bg-yellow-500";case"high":return"bg-orange-500";case"critical":return"bg-red-500";default:return"bg-muted"}})(e.riskLevel))}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(a.E,{variant:eL(e.riskLevel),className:"text-xs",children:e.riskLevel.toUpperCase()}),e.successfulJailbreaks>0&&(0,r.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:[e.successfulJailbreaks," vuln",1!==e.successfulJailbreaks?"s":""]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground mt-0.5",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(u.A,{className:"h-3 w-3"}),new Date(e.run.timestamp).toLocaleDateString()]}),(0,r.jsxs)("span",{children:[e.totalTests," tests"]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"text-right hidden sm:block",children:[(0,r.jsxs)("p",{className:"text-base font-semibold ".concat(eE(e.riskLevel)),children:[e.riskScore,"%"]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Risk"})]}),(0,r.jsx)(i.$,{variant:"ghost",size:"icon",children:(0,r.jsx)(v.A,{className:"h-4 w-4"})})]})]},e.run.id))})})]},t)})}),X>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-6 pt-4 border-t",children:[(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Page ",E," of ",X," (",C," reports total)"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>B(e=>Math.max(1,e-1)),disabled:1===E,children:"Previous"}),(0,r.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>B(e=>Math.min(X,e+1)),disabled:E>=X,children:"Next"})]})]})]})]})]})}},63479:(e,t,s)=>{"use strict";s.d(t,{D:()=>a,N:()=>o});var r=s(95155),l=s(12115);let n=(0,l.createContext)({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function a(){return(0,l.useContext)(n)}let i="hackagent-theme";function c(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function o(e){let{children:t}=e,[s,a]=(0,l.useState)("system"),[o,d]=(0,l.useState)("light"),x=e=>{let t=document.documentElement;"dark"===e?t.classList.add("dark"):t.classList.remove("dark")};return(0,l.useEffect)(()=>{var e;let t=null!=(e=localStorage.getItem(i))?e:"system";a(t);let s="system"===t?c():t;d(s),x(s)},[]),(0,l.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{if("system"===s){let e=c();d(e),x(e)}};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[s]),(0,r.jsx)(n.Provider,{value:{theme:s,resolvedTheme:o,setTheme:e=>{localStorage.setItem(i,e),a(e);let t="system"===e?c():e;d(t),x(t)}},children:t})}},95515:(e,t,s)=>{Promise.resolve().then(s.bind(s,52428))}},e=>{e.O(0,[187,539,619,8,144,855,9,532,411,641,151,924,680,441,493,358],()=>e(e.s=95515)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[266],{11186:(e,t,s)=>{"use strict";s.d(t,{bq:()=>u,eb:()=>m,gC:()=>x,l6:()=>o,yv:()=>c});var a=s(95155);s(12115);var n=s(59929),l=s(24033),r=s(5917),i=s(12108),d=s(64269);function o(e){let{...t}=e;return(0,a.jsx)(n.bL,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,a.jsx)(n.WT,{"data-slot":"select-value",...t})}function u(e){let{className:t,size:s="default",children:r,...i}=e;return(0,a.jsxs)(n.l9,{"data-slot":"select-trigger","data-size":s,className:(0,d.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...i,children:[r,(0,a.jsx)(n.In,{asChild:!0,children:(0,a.jsx)(l.A,{className:"size-4 opacity-50"})})]})}function x(e){let{className:t,children:s,position:l="popper",...r}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{"data-slot":"select-content",className:(0,d.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...r,children:[(0,a.jsx)(h,{}),(0,a.jsx)(n.LM,{className:(0,d.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),(0,a.jsx)(p,{})]})})}function m(e){let{className:t,children:s,...l}=e;return(0,a.jsxs)(n.q7,{"data-slot":"select-item",className:(0,d.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...l,children:[(0,a.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(r.A,{className:"size-4"})})}),(0,a.jsx)(n.p4,{children:s})]})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(n.PP,{"data-slot":"select-scroll-up-button",className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,a.jsx)(i.A,{className:"size-4"})})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(n.wn,{"data-slot":"select-scroll-down-button",className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,a.jsx)(l.A,{className:"size-4"})})}},34105:(e,t,s)=>{"use strict";s.d(t,{c:()=>a});let a=(0,s(12115).createContext)(void 0)},46767:(e,t,s)=>{"use strict";s.d(t,{Bc:()=>r,ZI:()=>o,k$:()=>d,m_:()=>i});var a=s(95155);s(12115);var n=s(53583),l=s(64269);function r(e){let{delayDuration:t=0,...s}=e;return(0,a.jsx)(n.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function i(e){let{...t}=e;return(0,a.jsx)(r,{children:(0,a.jsx)(n.bL,{"data-slot":"tooltip",...t})})}function d(e){let{...t}=e;return(0,a.jsx)(n.l9,{"data-slot":"tooltip-trigger",...t})}function o(e){let{className:t,sideOffset:s=0,children:r,...i}=e;return(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{"data-slot":"tooltip-content",sideOffset:s,className:(0,l.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[r,(0,a.jsx)(n.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},49819:(e,t,s)=>{Promise.resolve().then(s.bind(s,60232))},51834:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>u,Es:()=>m,HM:()=>o,L3:()=>h,c7:()=>x,lG:()=>i,rr:()=>p});var a=s(95155);s(12115);var n=s(88292),l=s(65229),r=s(64269);function i(e){let{...t}=e;return(0,a.jsx)(n.bL,{"data-slot":"dialog",...t})}function d(e){let{...t}=e;return(0,a.jsx)(n.ZL,{"data-slot":"dialog-portal",...t})}function o(e){let{...t}=e;return(0,a.jsx)(n.bm,{"data-slot":"dialog-close",...t})}function c(e){let{className:t,...s}=e;return(0,a.jsx)(n.hJ,{"data-slot":"dialog-overlay",className:(0,r.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function u(e){let{className:t,children:s,...i}=e;return(0,a.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,a.jsx)(c,{}),(0,a.jsxs)(n.UC,{"data-slot":"dialog-content",className:(0,r.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...i,children:[s,(0,a.jsxs)(n.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(l.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function x(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,r.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function m(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,r.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(n.hE,{"data-slot":"dialog-title",className:(0,r.cn)("text-lg leading-none font-semibold",t),...s})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(n.VY,{"data-slot":"dialog-description",className:(0,r.cn)("text-muted-foreground text-sm",t),...s})}},60232:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>em});var a=s(95155),n=s(12115),l=s(18332),r=s(50803),i=s(66955),d=s(65229),o=s(26989),c=s(35299),u=s(50906),x=s(3998),m=s(17983),h=s(7831),p=s(41444),g=s(80230),f=s(74054),j=s(5917),v=s(64269),N=s(41808),b=s(86651);function w(e){let{className:t,...s}=e;return(0,a.jsx)(N.uB,{"data-slot":"command",className:(0,v.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...s})}function y(e){let{className:t,...s}=e;return(0,a.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,a.jsx)(b.A,{className:"size-4 shrink-0 opacity-50"}),(0,a.jsx)(N.uB.Input,{"data-slot":"command-input",className:(0,v.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...s})]})}function k(e){let{className:t,...s}=e;return(0,a.jsx)(N.uB.List,{"data-slot":"command-list",className:(0,v.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...s})}function S(e){let{...t}=e;return(0,a.jsx)(N.uB.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function C(e){let{className:t,...s}=e;return(0,a.jsx)(N.uB.Group,{"data-slot":"command-group",className:(0,v.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...s})}function A(e){let{className:t,...s}=e;return(0,a.jsx)(N.uB.Item,{"data-slot":"command-item",className:(0,v.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}s(51834);var z=s(90067);function _(e){let{...t}=e;return(0,a.jsx)(z.bL,{"data-slot":"popover",...t})}function R(e){let{...t}=e;return(0,a.jsx)(z.l9,{"data-slot":"popover-trigger",...t})}function D(e){let{className:t,align:s="center",sideOffset:n=4,...l}=e;return(0,a.jsx)(z.ZL,{children:(0,a.jsx)(z.UC,{"data-slot":"popover-content",align:s,sideOffset:n,className:(0,v.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...l})})}var F=s(46767);function M(e){let{options:t,value:s,onChange:l,triggerPlaceholder:r="Select an option...",searchPlaceholder:i="Search...",emptyStateMessage:d="No option found.",className:o}=e,[c,u]=n.useState(!1),m=t.find(e=>e.value===s);return(0,a.jsxs)(_,{open:c,onOpenChange:u,children:[(0,a.jsx)(F.Bc,{children:(0,a.jsxs)(F.m_,{children:[(0,a.jsx)(F.k$,{asChild:!0,children:(0,a.jsx)(R,{asChild:!0,children:(0,a.jsxs)(x.$,{variant:"outline",role:"combobox","aria-expanded":c,className:(0,v.cn)("w-[200px] justify-between overflow-hidden",o),children:[m?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;return e.length<=t?e:"".concat(e.substring(0,t),"...")}(m.label):r,(0,a.jsx)(f.A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),m&&(0,a.jsx)(F.ZI,{children:(0,a.jsx)("p",{children:m.label})})]})}),(0,a.jsx)(D,{className:(0,v.cn)("w-[200px] p-0",o),children:(0,a.jsxs)(w,{children:[(0,a.jsx)(y,{placeholder:i}),(0,a.jsxs)(k,{children:[(0,a.jsx)(S,{children:d}),(0,a.jsx)(C,{children:t.map(e=>(0,a.jsxs)(A,{value:e.value,onSelect:e=>{l(e===s?"":e),u(!1)},children:[(0,a.jsx)(j.A,{className:(0,v.cn)("mr-2 h-4 w-4",s===e.value?"opacity-100":"opacity-0")}),e.label]},e.value))})]})]})})]})}var O=s(22470),L=s(56419),I=s(11186),P=s(82077);function E(e){let{className:t,...s}=e;return(0,a.jsx)(P.bL,{"data-slot":"checkbox",className:(0,v.cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:(0,a.jsx)(P.C1,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,a.jsx)(j.A,{className:"size-3.5"})})})}var T=s(76444),J=s(86259),$=s(87270);let B={agent:!0,owner:!1,organization:!1,attack:!0,status:!0,notes:!0},U=e=>{let{runs:t,selectedRunIds:s,onSelectAllRuns:i,isDetailViewActive:d,children:o,columnVisibility:c}=e,u=t.length>0&&s.size===t.filter(e=>void 0!==e.id).length,x=s.size>0&&!u;return 0===t.length?(0,a.jsxs)(l.Fc,{className:"mt-4",children:[(0,a.jsx)(r.A,{className:"h-4 w-4"}),(0,a.jsx)(l.XL,{children:"No Runs Found"}),(0,a.jsx)(l.TN,{children:"No attack runs have been executed yet."})]}):(0,a.jsx)("div",{children:(0,a.jsxs)($.XI,{children:[(0,a.jsx)($.A0,{children:(0,a.jsxs)($.Hj,{children:[(0,a.jsx)($.nd,{className:"w-[80px]"}),(0,a.jsx)($.nd,{className:"w-[50px] px-2",children:(0,a.jsx)(E,{checked:x?"indeterminate":u,onCheckedChange:i,"aria-label":"Select all runs"})}),(0,a.jsx)($.nd,{className:"w-[70px]",children:"Run #"}),!d&&c.agent&&(0,a.jsx)($.nd,{children:"Agent"}),!d&&c.owner&&(0,a.jsx)($.nd,{children:"Owner"}),!d&&c.organization&&(0,a.jsx)($.nd,{children:"Organization"}),!d&&c.attack&&(0,a.jsx)($.nd,{children:"Attack"}),!d&&c.status&&(0,a.jsx)($.nd,{children:"Status"}),(0,a.jsx)($.nd,{children:"Timestamp"}),(0,a.jsx)($.nd,{children:"Results"}),!d&&c.notes&&(0,a.jsx)($.nd,{className:"max-w-[180px]",children:"Notes"}),!d&&(0,a.jsx)($.nd,{className:"w-[60px]",children:"Actions"})]})}),(0,a.jsx)($.BF,{children:n.Children.map(o,e=>e)})]})})};var V=s(11647),H=s(24033),Z=s(27937),q=s(61362),W=s(78874),X=s(52056),G=s(26983),K=s(20017),Q=s(6259);let Y=/^(google-oauth2|github|windowslive|facebook|twitter|apple|linkedin|email)[|_]/i,ee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function et(e){return!!e&&(Y.test(e)||ee.test(e))}let es=(0,n.memo)(e=>{let{run:t,index:s,selectedRunIds:n,expandedRunId:l,onSelectRun:r,onToggleExpand:i,onDeleteRun:d,deletingRunIds:o,currentUserPk:c,currentUserDisplayName:u,attackName:h,isDetailViewActive:p,totalRuns:g,currentPage:f=1,runsPerPage:j=10,userDisplayNameMap:v={},columnVisibility:N}=e,b=l===t.id,w=void 0!==t.id&&n.has(t.id),y=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"N/A";if(e.includes("@")){let s=e.split("@")[0];return t?"Org ".concat(s):s}if(et(e)){if(v[e])return t?"Org ".concat(v[e]):v[e];let s=e.replace(/^[a-z0-9-]+[|_]/i,"").substring(0,8);return t?"Org ".concat(s):"User ".concat(s)}if(e.includes("'s Organization")){let t=e.replace("'s Organization","").trim();if(v[t])return"Org ".concat(v[t]);if(t.includes("@")){let e=t.split("@")[0];return"Org ".concat(e)}if(et(t)){if(v[t])return"Org ".concat(v[t]);let e=t.replace(/^[a-z0-9-]+[|_]/i,"").substring(0,8);return"Org ".concat(e)}return"Org ".concat(t)}return t?"Org ".concat(e):e},k=e=>{e.stopPropagation(),void 0!==t.id&&i(t.id)};return(0,a.jsxs)($.Hj,{className:"cursor-pointer hover:bg-muted/50","data-state":w?"selected":"",children:[(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:(0,a.jsx)(x.$,{variant:"ghost",size:"sm",children:b?(0,a.jsx)(H.A,{className:"h-4 w-4"}):(0,a.jsx)(Z.A,{className:"h-4 w-4"})})}),(0,a.jsx)($.nA,{className:"px-2",children:void 0!==t.id&&(0,a.jsx)(E,{checked:w,onCheckedChange:e=>r(t.id,e),onClick:e=>{e.stopPropagation()},"aria-label":"Select run ".concat(t.id)})}),(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer font-medium",children:void 0===g?s+1:g-((f-1)*j+s)}),!p&&N.agent&&(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:t.agentName}),!p&&N.owner&&(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:function(e,t){return null!=e&&null!=t&&e===t}(t.owner,c)&&u?u:y(t.ownerUsername,!1)}),!p&&N.organization&&(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:y(t.organizationName,!0)}),!p&&N.attack&&(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:t.attack?h||"Loading type...":"Direct Run"}),!p&&N.status&&(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:(0,a.jsxs)(V.E,{variant:t.status===m.S5d.Completed?"default":t.status===m.S5d.Failed?"destructive":"secondary",className:"capitalize",children:[t.status===m.S5d.Completed&&(0,a.jsx)(q.A,{className:"h-3 w-3 mr-1"}),t.status===m.S5d.Failed&&(0,a.jsx)(W.A,{className:"h-3 w-3 mr-1"}),t.status]})}),(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-sm tabular-nums",title:new Date(t.timestamp).toLocaleString(),children:(e=>{let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return"just now";let s=Math.floor(t/60);if(s<60)return"".concat(s," min ago");let a=Math.floor(s/60);if(a<24)return"".concat(a," h ago");let n=Math.floor(a/24);return n<30?"".concat(n," d ago"):e.toLocaleDateString()})(new Date(t.timestamp))}),(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:new Date(t.timestamp).toLocaleDateString()})]})}),(()=>{var e,s,n,l,r;let i=null!=(e=t.totalResults)?e:0,d=null!=(s=t.successfulJailbreaks)?s:0,o=null!=(n=t.failedJailbreaks)?n:0,c=null!=(l=t.errors)?l:0,u=null!=(r=t.notEvaluated)?r:0,x=e=>i>0?e/i*100:0;return(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer",children:0===i?(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[o>0&&(0,a.jsxs)("span",{className:"flex items-center gap-0.5 text-emerald-600 dark:text-emerald-400 font-medium",children:[(0,a.jsx)(q.A,{className:"h-3 w-3"}),o]}),d>0&&(0,a.jsxs)("span",{className:"flex items-center gap-0.5 text-destructive font-medium",children:[(0,a.jsx)(X.A,{className:"h-3 w-3"}),d]}),c>0&&(0,a.jsxs)("span",{className:"flex items-center gap-0.5 text-amber-600 dark:text-amber-400 font-medium",children:[(0,a.jsx)(W.A,{className:"h-3 w-3"}),c]}),u>0&&(0,a.jsxs)("span",{className:"flex items-center gap-0.5 text-muted-foreground",children:[(0,a.jsx)(G.A,{className:"h-3 w-3"}),u]})]}),(0,a.jsxs)("div",{className:"flex h-1.5 w-20 overflow-hidden rounded-full bg-muted",children:[o>0&&(0,a.jsx)("div",{className:"h-full bg-emerald-500",style:{width:"".concat(x(o),"%")}}),d>0&&(0,a.jsx)("div",{className:"h-full bg-destructive",style:{width:"".concat(x(d),"%")}}),c>0&&(0,a.jsx)("div",{className:"h-full bg-amber-500",style:{width:"".concat(x(c),"%")}})]})]})})})(),!p&&N.notes&&(0,a.jsx)($.nA,{onClick:k,className:"cursor-pointer max-w-[180px]",children:t.runNotes?(0,a.jsx)("span",{className:"block truncate text-sm text-muted-foreground",title:t.runNotes,children:t.runNotes}):(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"—"})}),!p&&(0,a.jsxs)($.nA,{children:[" ",(0,a.jsxs)(Q.rI,{children:[(0,a.jsx)(Q.ty,{asChild:!0,children:(0,a.jsx)(x.$,{variant:"ghost",size:"icon",title:"Actions",children:(0,a.jsx)(K.A,{className:"h-4 w-4"})})}),(0,a.jsx)(Q.SQ,{align:"end",children:(0,a.jsx)(Q._2,{onClick:e=>{e.stopPropagation(),t.id&&d(t.id)},disabled:o.has(t.id),className:"text-red-600 hover:text-red-600 hover:bg-red-100 dark:hover:bg-red-900 dark:hover:text-red-50",children:o.has(t.id)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"animate-spin mr-2",children:(0,a.jsxs)("svg",{width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",opacity:"0.25"}),(0,a.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round"})]})}),"Deleting..."]}):"Delete"})})]})]})]})});es.displayName="RunRow";var ea=s(13496),en=s(75426);let el=e=>{let{logs:t}=e;return 0===t.length?null:(0,a.jsx)(ea.nD,{type:"multiple",className:"w-full",children:t.map((e,t)=>(0,a.jsxs)(ea.As,{value:"step-".concat(t),children:[(0,a.jsx)(ea.$m,{className:"hover:no-underline",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-medium text-sm",children:e.step_name}),(0,a.jsx)(V.E,{variant:"Completed"===e.status?"default":"destructive",className:"text-xs",children:e.status})]})}),(0,a.jsxs)(ea.ub,{children:[(0,a.jsx)("div",{className:"flex justify-end mb-2",children:(0,a.jsxs)(x.$,{size:"sm",variant:"outline",onClick:()=>{var t;return t=e.data_json,void navigator.clipboard.writeText(t)},children:[(0,a.jsx)(en.A,{className:"w-3.5 h-3.5 mr-1.5"}),"Copy JSON"]})}),(0,a.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-96 leading-relaxed",children:JSON.stringify(JSON.parse(e.data_json),null,2)})]})]},t))})};var er=s(41303);let ei=e=>{let{run:t,isLoading:s,onShowResultDetail:n,isDetailViewActive:l}=e;return s?(0,a.jsx)($.Hj,{children:(0,a.jsx)($.nA,{colSpan:100,className:"p-0",children:(0,a.jsxs)("div",{className:"flex items-center justify-center p-6 h-28 bg-muted/30",children:[(0,a.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"}),(0,a.jsx)("p",{className:"ml-2 text-sm text-muted-foreground",children:"Loading results…"})]})})}):t&&t.results?(0,a.jsx)($.Hj,{children:(0,a.jsx)($.nA,{colSpan:100,className:"p-0",children:(0,a.jsxs)("div",{className:"border-t bg-background",children:[(0,a.jsx)(er.xr,{results:t.results,onShowResultDetail:n,isDetailViewActive:l}),t.step_logs&&t.step_logs.length>0&&(0,a.jsx)("div",{className:"border-t px-4 py-3",children:(0,a.jsx)(el,{logs:t.step_logs})})]})})}):(0,a.jsx)($.Hj,{children:(0,a.jsx)($.nA,{colSpan:100,className:"p-0",children:(0,a.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm bg-muted/20",children:"No results found or run data missing."})})})};var ed=s(90368),eo=s(28567);let ec=e=>{let{runs:t,expandedRunId:s,selectedRun:n,isLoadingRuns:l,isLoadingResults:r,selectedResultId:i,onToggleExpand:d,onShowResultDetail:o,totalRuns:u,currentPage:h,runsPerPage:p,onPageChange:g}=e,f=Math.ceil(u/p);return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-muted/10",children:[(0,a.jsx)("div",{className:"px-3 py-2.5 border-b bg-card shrink-0",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"Runs"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[u," total"]})]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:l?(0,a.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,a.jsx)(c.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===t.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground text-center py-6 px-3",children:"No runs found."}):(0,a.jsx)("div",{className:"divide-y",children:t.map((e,t)=>{let l=s===e.id,x=e.attack?e.attackType||"Unknown":"Direct";return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{className:"w-full text-left px-3 py-2.5 hover:bg-muted/50 transition-colors flex items-start gap-2 ".concat(l?"bg-muted/40":""),onClick:()=>e.id&&d(e.id),children:[(0,a.jsx)("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:l?(0,a.jsx)(H.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(Z.A,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,a.jsxs)("span",{className:"text-xs font-medium",children:["Run #",u-((h-1)*p+t)]}),(0,a.jsx)(V.E,{variant:(e=>e===m.S5d.Completed?"default":e===m.S5d.Failed?"destructive":"secondary")(e.status),className:"text-[10px] py-0 px-1.5 h-4 shrink-0",children:e.status})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground truncate mt-0.5",children:x}),(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:new Date(e.timestamp).toLocaleDateString()})]})]}),l&&(0,a.jsx)("div",{className:"border-t ml-4 border-l-2 border-l-primary/40 bg-muted/20",children:r?(0,a.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):(null==n?void 0:n.results)&&n.results.length>0?(0,a.jsx)("div",{className:"divide-y",children:[...n.results].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()).map((e,t)=>{let s=(0,er.jI)(e.evaluationStatus),n=(0,eo.Bn)(e,null),l=e.id===i;return(0,a.jsxs)("button",{className:"w-full text-left px-3 py-2 hover:bg-muted/50 transition-colors ".concat(l?"bg-primary/10 border-r-2 border-r-primary":""),onClick:()=>o(e),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,a.jsxs)("span",{className:"text-[11px] font-medium text-muted-foreground",children:["Result ",t+1]}),(0,a.jsx)(V.E,{variant:s.variant,className:"text-[10px] py-0 px-1.5 h-4 shrink-0",children:s.label})]}),n&&(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground truncate mt-0.5",children:n})]},e.id)})}):(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground text-center py-3",children:"No results"})})]},e.id)})})}),f>1&&(0,a.jsxs)("div",{className:"border-t px-3 py-2 bg-card shrink-0 flex items-center justify-between",children:[(0,a.jsx)(x.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>g(Math.max(1,h-1)),disabled:1===h,children:(0,a.jsx)(ed.A,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[h," / ",f]}),(0,a.jsx)(x.$,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>g(Math.min(f,h+1)),disabled:h===f,children:(0,a.jsx)(Z.A,{className:"h-3.5 w-3.5"})})]})]})};var eu=s(63819);let ex=(0,p.h)("StatsPage"),em=()=>{var e,t;let[s,p]=(0,n.useState)([]),[f,j]=(0,n.useState)(null),[v,N]=(0,n.useState)(!0),[b,w]=(0,n.useState)(!1),[y,k]=(0,n.useState)(null),[S,C]=(0,n.useState)(null),[A,z]=(0,n.useState)(new Set),[F,P]=(0,n.useState)(0),[$,V]=(0,n.useState)(1),[H,Z]=(0,n.useState)(10),[q,W]=(0,n.useState)(new Set),[X,G]=(0,n.useState)(null),[K,Q]=(0,n.useState)(null),[Y,ee]=(0,n.useState)({}),[ea,en]=(0,n.useState)(void 0),[el,er]=(0,n.useState)(void 0),[ed,eo]=(0,n.useState)(void 0),[em,eh]=(0,n.useState)(void 0),[ep,eg]=(0,n.useState)(B),{user:ef}=(0,g.h)(),ej=(0,n.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};N(!0),C(null);try{var t;let s={page:$,pageSize:H,agent:e.agentId,status:e.status,attack:e.attackId};Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);let a=await h.ME.runList(s);p(a.results||[]),P(a.count||0),ex.debug({count:null==(t=a.results)?void 0:t.length},"Fetched runs")}catch(e){ex.error({err:e},"Failed to fetch runs"),C(e.message||"Failed to fetch runs. Please try again.")}N(!1)},[$,H]);(0,n.useEffect)(()=>{let e=!1;return h.userApi.userMeRetrieve().then(t=>{var s;e||G(null!=(s=t.user)?s:null)}).catch(()=>{}),()=>{e=!0}},[]),(0,n.useEffect)(()=>{ej({agentId:ed,status:em,attackId:el,runId:ea})},[ej,ed,em,el,ea,H,$]),(0,n.useEffect)(()=>{(async()=>{if(!s||0===s.length)return;let e=e=>{let t=[e];return e.includes("|")&&t.push(e.replace("|","_")),e.includes("_")&&t.push(e.replace("_","|")),t},t=Array.from(new Set(s.map(e=>e.ownerUsername).filter(t=>!!t&&!e(t).some(e=>Y[e]))));if(0!==t.length){ex.debug({count:t.length},"Fetching user profiles for current page runs");try{let t=await h.userApi.userList({page:1}),s={};if(t.results)for(let a of t.results){let t=a.email?a.email.split("@")[0]:null;if(!t)continue;let n=a.keycloakUserId||a.auth0UserId;if(n)for(let a of e(n))s[a]=t;if(a.username&&et(a.username))for(let n of e(a.username))s[n]=t}Object.keys(s).length>0&&(ee(e=>({...e,...s})),ex.debug({count:Object.keys(s).length},"Fetched user display names"))}catch(e){ex.error({err:e},"Failed to fetch user profiles")}}})()},[s]);let ev=(e,t)=>{z(s=>{let a=new Set(s);return!0===t?a.add(e):a.delete(e),a})},eN=async e=>{if(e&&confirm("Are you sure you want to delete this run? This action cannot be undone.")){W(t=>new Set(t).add(e)),C(null);try{await h.ME.runDestroy({id:e}),p(t=>t.filter(t=>t.id!==e)),z(t=>{let s=new Set(t);return s.delete(e),s})}catch(e){C(e.message||"Failed to delete run.")}finally{W(t=>{let s=new Set(t);return s.delete(e),s})}}},eb=async()=>{if(0!==A.size&&confirm("Are you sure you want to delete the selected runs? This action cannot be undone.")){C(null),W(new Set(A));try{await Promise.all(Array.from(A).map(e=>h.ME.runDestroy({id:e}))),p(e=>e.filter(e=>e.id&&!A.has(e.id))),z(new Set)}catch(e){C(e.message||"Failed to delete selected runs.")}finally{W(new Set)}}},ew=async e=>{if(y===e)k(null),j(null);else{k(e),w(!0),j(null);try{var t,s,a;let n=await h.ME.runRetrieve({id:e});j(n),ex.debug({runId:e,resultCount:(null==(t=n.results)?void 0:t.length)||0,firstResultFields:(null==(s=n.results)?void 0:s[0])?{responseStatusCode:n.results[0].responseStatusCode,latencyMs:n.results[0].latencyMs,tracesCount:(null==(a=n.results[0].traces)?void 0:a.length)||0}:null},"Run details fetched")}catch(t){ex.error({err:t,runId:e},"Failed to fetch run details"),C(t.message||"Failed to load details for Run ".concat(e,".")),k(null)}finally{w(!1)}}},ey=e=>{Q(e),ex.debug({resultId:e.id},"Showing detail view for result")},ek=!!K,eS=(0,n.useMemo)(()=>K&&(null==f?void 0:f.results)?[...f.results].sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()).findIndex(e=>e.id===K.id):-1,[K,f]);return(0,a.jsxs)(O.M,{title:"Stats",description:"Monitor and analyze your attack runs.",children:[S&&(0,a.jsxs)(l.Fc,{variant:"destructive",className:"mx-6 mb-4",children:[(0,a.jsx)(r.A,{className:"h-4 w-4"}),(0,a.jsx)(l.XL,{children:"Error"}),(0,a.jsx)(l.TN,{children:S})]}),ek&&K?(0,a.jsxs)("div",{className:"mx-6 border flex overflow-hidden",style:{height:"calc(100vh - 9rem)"},children:[(0,a.jsx)("div",{className:"w-64 shrink-0 border-r overflow-hidden flex flex-col",children:(0,a.jsx)(ec,{runs:s,expandedRunId:y,selectedRun:f,isLoadingRuns:v,isLoadingResults:b,selectedResultId:K.id,onToggleExpand:ew,onShowResultDetail:ey,totalRuns:F,currentPage:$,runsPerPage:H,onPageChange:V})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsx)(eu.I,{result:K,onClose:()=>{Q(null)},attackId:null!=(t=null==f?void 0:f.attack)?t:null,resultIndex:eS,totalResults:null==f||null==(e=f.results)?void 0:e.length})})]}):(0,a.jsxs)("div",{className:"border mx-6",children:[!v&&F>0&&(0,a.jsxs)("div",{className:"px-4 py-3 border-b flex flex-wrap justify-between items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 items-center",children:[(0,a.jsxs)(_,{children:[(0,a.jsx)(R,{asChild:!0,children:(0,a.jsxs)(x.$,{variant:"outline",size:"sm",className:"h-8",children:[(0,a.jsx)(i.A,{className:"h-4 w-4 mr-2"}),"Filters",(em||ed||el)&&(0,a.jsx)("span",{className:"ml-2 rounded-full bg-primary text-primary-foreground text-xs px-1.5 py-0.5",children:[em,ed,el].filter(Boolean).length})]})}),(0,a.jsx)(D,{className:"w-[320px] p-4",align:"start",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h4",{className:"font-medium text-sm",children:"Filters"}),(em||ed||el)&&(0,a.jsxs)(x.$,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>{eh(void 0),eo(void 0),er(void 0)},children:[(0,a.jsx)(d.A,{className:"h-3 w-3 mr-1"}),"Clear all"]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(T.J,{className:"text-xs text-muted-foreground",children:"Status"}),(0,a.jsx)(M,{options:Object.values(m.S5d).map(e=>({value:e,label:e})),value:em,onChange:e=>eh(e||void 0),triggerPlaceholder:"Select status...",searchPlaceholder:"Search Status...",emptyStateMessage:"No Status found.",className:"w-full"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(T.J,{className:"text-xs text-muted-foreground",children:"Agent"}),(0,a.jsx)(M,{options:s.map(e=>e.agent).filter((e,t,s)=>e&&s.indexOf(e)===t).map(e=>({value:e,label:e})),value:ed,onChange:e=>eo(e||void 0),triggerPlaceholder:"Select agent...",searchPlaceholder:"Search Agent...",emptyStateMessage:"No Agent found.",className:"w-full"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(T.J,{className:"text-xs text-muted-foreground",children:"Attack"}),(0,a.jsx)(M,{options:s.map(e=>e.attack).filter((e,t,s)=>e&&s.indexOf(e)===t).map(e=>({value:e,label:e})),value:el,onChange:e=>er(e||void 0),triggerPlaceholder:"Select attack...",searchPlaceholder:"Search Attack...",emptyStateMessage:"No Attack found.",className:"w-full"})]})]})]})})]}),(0,a.jsxs)(_,{children:[(0,a.jsx)(R,{asChild:!0,children:(0,a.jsxs)(x.$,{variant:"outline",size:"sm",className:"h-8",children:[(0,a.jsx)(o.A,{className:"h-4 w-4 mr-2"}),"Columns"]})}),(0,a.jsx)(D,{className:"w-[200px] p-4",align:"start",children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h4",{className:"font-medium text-sm",children:"Toggle columns"}),(0,a.jsx)(J.w,{}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(E,{id:"col-agent",checked:ep.agent,onCheckedChange:()=>eg({...ep,agent:!ep.agent})}),(0,a.jsx)(T.J,{htmlFor:"col-agent",className:"text-sm cursor-pointer",children:"Agent"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(E,{id:"col-owner",checked:ep.owner,onCheckedChange:()=>eg({...ep,owner:!ep.owner})}),(0,a.jsx)(T.J,{htmlFor:"col-owner",className:"text-sm cursor-pointer",children:"Owner"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(E,{id:"col-organization",checked:ep.organization,onCheckedChange:()=>eg({...ep,organization:!ep.organization})}),(0,a.jsx)(T.J,{htmlFor:"col-organization",className:"text-sm cursor-pointer",children:"Organization"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(E,{id:"col-attack",checked:ep.attack,onCheckedChange:()=>eg({...ep,attack:!ep.attack})}),(0,a.jsx)(T.J,{htmlFor:"col-attack",className:"text-sm cursor-pointer",children:"Attack"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(E,{id:"col-status",checked:ep.status,onCheckedChange:()=>eg({...ep,status:!ep.status})}),(0,a.jsx)(T.J,{htmlFor:"col-status",className:"text-sm cursor-pointer",children:"Status"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(E,{id:"col-notes",checked:ep.notes,onCheckedChange:()=>eg({...ep,notes:!ep.notes})}),(0,a.jsx)(T.J,{htmlFor:"col-notes",className:"text-sm cursor-pointer",children:"Notes"})]})]})]})})]}),A.size>0&&(0,a.jsxs)(x.$,{variant:"destructive",size:"sm",onClick:()=>eb(),disabled:q.size>0,children:["Delete Selected (",A.size,")"]})]}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Per page:"}),(0,a.jsxs)(I.l6,{value:H.toString(),onValueChange:e=>{Z(parseInt(e,10)),V(1)},children:[(0,a.jsx)(I.bq,{className:"w-[70px] h-8",children:(0,a.jsx)(I.yv,{placeholder:H.toString()})}),(0,a.jsx)(I.gC,{children:[10,20,50,100].map(e=>(0,a.jsx)(I.eb,{value:e.toString(),children:e},e))})]})]}),(0,a.jsxs)("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["Page ",$," of ",Math.ceil(F/H)]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(x.$,{variant:"outline",size:"sm",className:"h-8",onClick:()=>V(e=>Math.max(1,e-1)),disabled:1===$,children:"Previous"}),(0,a.jsx)(x.$,{variant:"outline",size:"sm",className:"h-8",onClick:()=>V(e=>Math.min(Math.ceil(F/H),e+1)),disabled:$===Math.ceil(F/H)||0===F,children:"Next"})]})]})})]}),(0,a.jsx)("div",{className:"p-4",children:v?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,a.jsx)(c.A,{className:"h-10 w-10 animate-spin text-muted-foreground mb-3"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"Loading runs..."})]}):0===s.length?(0,a.jsx)(L.p,{icon:u.A,title:"No Runs Found",description:"No attack runs have been executed yet. Start a new attack to see results here."}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:(0,a.jsx)("div",{className:"w-full min-w-0",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)(U,{runs:s,selectedRunIds:A,onSelectAllRuns:e=>{!0===e?z(new Set(s.map(e=>e.id).filter(e=>void 0!==e))):z(new Set)},isDetailViewActive:!1,columnVisibility:ep,children:s.map((e,t)=>{var s;return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(es,{run:e,index:t,selectedRunIds:A,expandedRunId:y,onSelectRun:ev,onToggleExpand:ew,onDeleteRun:eN,deletingRunIds:q,currentUserPk:X,currentUserDisplayName:ef?(e=>{if(e)return e.name||e.email||e.preferred_username||e.nickname||void 0})(ef):void 0,attackName:null!=(s=e.attackType)?s:null,isDetailViewActive:!1,totalRuns:F,currentPage:$,runsPerPage:H,userDisplayNameMap:Y,columnVisibility:ep}),y===e.id&&(0,a.jsx)(ei,{run:f,isLoading:b,onShowResultDetail:ey,isDetailViewActive:!1})]},e.id)})})})})})})]})]})}},76444:(e,t,s)=>{"use strict";s.d(t,{J:()=>r});var a=s(95155);s(12115);var n=s(85408),l=s(64269);function r(e){let{className:t,...s}=e;return(0,a.jsx)(n.b,{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}},80230:(e,t,s)=>{"use strict";s.d(t,{h:()=>r});var a=s(12115),n=s(34105);let l=async()=>"";function r(){let e=(0,a.useContext)(n.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:l}}}},e=>{e.O(0,[187,539,292,8,9,532,391,594,411,200,924,680,441,493,358],()=>e(e.s=49819)),_N_E=e.O()}]);
|