import{r as a,k as e}from"./index-BVfpSx5Q.js";function h(){const s=Date.now();return[{id:"ta-1",timestamp:s-3e4,title:"CPU spike on checkout-service-7b4",severity:"high",service:"checkout",metric:"cpu.system.percent",mlScore:92,noiseScore:8,correlationGroup:"CG-001",explanation:"Sustained CPU increase correlates with 3x traffic spike from marketing campaign launch. Pattern matches seasonal event-driven load.",suggestedAction:"Auto-scale HPA target to 12 replicas",status:"open",causalContext:"Root cause: traffic surge from email campaign (10:00 UTC blast). Causal chain: email_click → checkout_page_load → cpu_spike."},{id:"ta-2",timestamp:s-45e3,title:"HTTP 5xx rate above threshold",severity:"critical",service:"payments",metric:"http.error_rate_5xx",mlScore:97,noiseScore:3,correlationGroup:"CG-001",explanation:"Error spike tied to upstream database connection saturation. Not an independent alert — correlated with CG-001 checkout CPU alert.",suggestedAction:"Increase pg connection pool max_connections",status:"open",causalContext:"Root cause: pg.connections.active at 95% capacity. Payments service waiting for DB connections, timing out after 30s."},{id:"ta-3",timestamp:s-12e4,title:"Redis memory above 90%",severity:"medium",service:"redis",metric:"redis.memory.used_percent",mlScore:74,noiseScore:26,correlationGroup:null,explanation:"Gradual memory growth over 48h. Toto forecaster predicts breach of 95% threshold in ~6 hours. Likely cache key accumulation without TTL.",suggestedAction:"Audit keys without TTL; set default expiry policy",status:"acknowledged",causalContext:"Trend analysis: linear growth at 0.8%/hr. No upstream anomaly — internal cache policy issue."},{id:"ta-4",timestamp:s-3e5,title:"DNS resolution latency spike",severity:"low",service:"cdn",metric:"dns.resolution_time",mlScore:31,noiseScore:69,correlationGroup:null,explanation:"Transient spike lasting 45 seconds. Pattern matches known ISP route flap noise. ML classifier: 69% probability of false positive.",suggestedAction:"Suppress — noise pattern",status:"suppressed",causalContext:"No downstream impact detected. Historical: 12 similar events in past 30 days, all self-resolved."},{id:"ta-5",timestamp:s-6e5,title:"Kafka consumer lag growing",severity:"high",service:"kafka",metric:"kafka.consumer.lag",mlScore:85,noiseScore:15,correlationGroup:"CG-002",explanation:'Consumer group "inventory-sync" lagging. 2 of 4 consumers unhealthy after OOM kills. Self-healing workflow triggered.',suggestedAction:"Self-healing in progress: restart consumers + scale",status:"auto-resolved",causalContext:"Root cause: memory limit too low for batch processing spike. Self-healing engine resolved in 3m 12s."},{id:"ta-6",timestamp:s-9e5,title:"Auth token validation failures",severity:"medium",service:"auth",metric:"auth.validation.failures",mlScore:68,noiseScore:32,correlationGroup:null,explanation:"Spike in JWT validation failures from mobile clients. Clock skew detected on mobile app v3.2.1 builds.",suggestedAction:"Add 30s clock skew tolerance to JWT validator",status:"open",causalContext:"Mobile app clock sync issue. Not a security threat — legitimate requests with slightly expired tokens."},{id:"ta-7",timestamp:s-12e5,title:"Search index replication delay",severity:"low",service:"search",metric:"es.replication.lag_ms",mlScore:42,noiseScore:58,correlationGroup:null,explanation:"Elasticsearch cross-cluster replication delayed by 800ms. Within acceptable bounds for search use case.",suggestedAction:"Monitor — within SLO tolerance",status:"suppressed",causalContext:"Network congestion between us-east-1 and eu-west-1. Expected during peak hours."},{id:"ta-8",timestamp:s-15e5,title:"Notification service queue depth",severity:"medium",service:"notifications",metric:"queue.depth",mlScore:71,noiseScore:29,correlationGroup:"CG-001",explanation:"Queue depth increase correlated with CG-001 traffic spike. Notifications are queued, not dropped. Will clear as traffic normalizes.",suggestedAction:"No action — self-resolving with traffic normalization",status:"acknowledged",causalContext:"Downstream effect of marketing campaign surge. Queue is bounded, no data loss risk."}]}function d({severity:s}){const r={critical:"bg-red-500/10 text-red-400 border-red-500/20",high:"bg-orange-500/10 text-orange-400 border-orange-500/20",medium:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",low:"bg-green-500/10 text-green-400 border-green-500/20"};return e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 text-[10px] font-mono rounded border uppercase ${r[s]||""}`,children:s})}function p({noise:s}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-1.5 bg-white/[0.04] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:s>50?"#ef4444":s>30?"#facc15":"#4ade80"}})}),e.jsxs("span",{className:"text-[10px] font-mono",style:{color:s>50?"#ef4444":s>30?"#facc15":"#4ade80"},children:[s,"%"]})]})}function f(){const[s,r]=a.useState([]),[o,i]=a.useState(null);a.useEffect(()=>{const t=h();r(t),i(t[0])},[]);const n=s.length,l=s.filter(t=>t.status==="suppressed").length,c=s.filter(t=>t.status==="auto-resolved").length,u=new Set(s.filter(t=>t.correlationGroup).map(t=>t.correlationGroup)).size,m=l+c;return e.jsxs("div",{className:"space-y-6 max-w-[1400px] mx-auto",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-mono uppercase tracking-[0.2em] text-[#f5f5f5]/40 mb-1",children:"A11OY · INTELLIGENCE · ALERT TRIAGE"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-[#f5f5f5]",children:"AI Alert Triage"}),e.jsx("p",{className:"text-sm text-[#f5f5f5]/50 mt-1 max-w-3xl",children:"ML-powered alert prioritization, noise suppression, and correlation grouping. Each alert includes causal context, LLM-generated explanation, and suggested remediation. Reduces alert fatigue by correlating related signals and suppressing known-noise patterns."})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3",children:[{label:"Total Alerts",value:n,color:"#06b6d4"},{label:"Noise Reduced",value:`${m}/${n}`,color:"#4ade80"},{label:"Corr. Groups",value:u,color:"#a78bfa"},{label:"Auto-Resolved",value:c,color:"#4ade80"},{label:"Suppressed",value:l,color:"#facc15"}].map(t=>e.jsxs("div",{className:"bg-[#0a0a0f] border border-white/[0.06] rounded-lg p-3 space-y-1",children:[e.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-white/30",children:t.label}),e.jsx("p",{className:"text-xl font-mono font-bold",style:{color:t.color},children:t.value})]},t.label))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"lg:col-span-2 bg-[#0a0a0f] border border-white/[0.06] rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:[e.jsxs("div",{className:"p-4 border-b border-white/[0.06] sticky top-0 bg-[#0a0a0f] z-10",children:[e.jsx("h2",{className:"text-sm font-mono font-semibold uppercase tracking-wider text-white/70",children:"Alert Queue"}),e.jsx("p",{className:"text-[10px] font-mono text-white/30",children:"Ranked by ML priority score"})]}),e.jsx("div",{className:"divide-y divide-white/[0.03]",children:[...s].sort((t,x)=>x.mlScore-t.mlScore).map(t=>e.jsxs("button",{type:"button",className:`w-full text-left px-4 py-3 cursor-pointer transition-colors ${(o==null?void 0:o.id)===t.id?"bg-white/[0.04]":"hover:bg-white/[0.02]"} ${t.status==="suppressed"?"opacity-40":""}`,onClick:()=>i(t),children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(d,{severity:t.severity}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.correlationGroup&&e.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-purple-500/10 text-purple-400 border border-purple-500/20",children:t.correlationGroup}),e.jsx("span",{className:`text-[10px] font-mono ${t.status==="auto-resolved"?"text-green-400":t.status==="suppressed"?"text-white/30":"text-white/50"}`,children:t.status})]})]}),e.jsx("p",{className:"text-xs font-bold text-white/80 mb-1",children:t.title}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#c9b787]",children:t.service}),e.jsx(p,{noise:t.noiseScore})]})]},t.id))})]}),o&&e.jsx("div",{className:"lg:col-span-3 space-y-4",children:e.jsxs("div",{className:"bg-[#0a0a0f] border border-white/[0.06] rounded-lg p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(d,{severity:o.severity}),e.jsx("h2",{className:"text-sm font-mono font-bold text-white/80",children:o.title})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"p-2 rounded bg-white/[0.02] border border-white/[0.04]",children:[e.jsx("p",{className:"text-[10px] font-mono text-white/30 mb-0.5",children:"ML Priority"}),e.jsx("p",{className:"text-lg font-mono font-bold",style:{color:o.mlScore>80?"#ef4444":o.mlScore>60?"#fb923c":"#4ade80"},children:o.mlScore})]}),e.jsxs("div",{className:"p-2 rounded bg-white/[0.02] border border-white/[0.04]",children:[e.jsx("p",{className:"text-[10px] font-mono text-white/30 mb-0.5",children:"Noise Probability"}),e.jsx(p,{noise:o.noiseScore})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"p-3 rounded bg-white/[0.02] border border-white/[0.04]",children:[e.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-white/40 mb-1",children:"AI Explanation"}),e.jsx("p",{className:"text-[11px] text-white/60 leading-relaxed",children:o.explanation})]}),e.jsxs("div",{className:"p-3 rounded bg-white/[0.02] border border-white/[0.04]",children:[e.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-white/40 mb-1",children:"Causal Context"}),e.jsx("p",{className:"text-[11px] text-white/60 leading-relaxed",children:o.causalContext})]}),e.jsxs("div",{className:"p-3 rounded bg-[#c9b787]/5 border border-[#c9b787]/10",children:[e.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-[#c9b787]/60 mb-1",children:"Suggested Action"}),e.jsx("p",{className:"text-[11px] text-[#c9b787]/80 leading-relaxed",children:o.suggestedAction})]})]})]})})]})]})}export{f as AlertTriage};