PageSourceSearch

https://agentoai.dk/assets/AdminStatus-D0E_AMXA.js

js agentoai.dk collected 2026-10-02 01:54:30 UTC 21,819 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlatformDiagnostics-WAAEE21H.js","assets/framer-motion-CQxuJa5n.js","assets/index-CSx7K-7R.js","assets/recharts-CFjfazL9.js","assets/index-BtyNKRkV.css","assets/badge-Yar_qzGV.js","assets/progress-xZI-P8gz.js","assets/shield-check-BcKgGayo.js","assets/shield-x-C5T_TFbh.js","assets/shield-alert-B6j4nH7K.js","assets/search-CTXuE0h0.js","assets/wrench-DfDJJ0Jp.js","assets/circle-check-big-BvOaTfBT.js","assets/circle-x-Bjw_qpIQ.js","assets/settings-ClDRCqQC.js","assets/chevron-up-fhR0nOsN.js","assets/chevron-down-DvU9LH4D.js","assets/message-square-CQ8acRkB.js","assets/credit-card-B8-qqxBo.js","assets/phone-DfeYL_-y.js","assets/format-CUd6TPP6.js","assets/en-US-Bs6ECJID.js","assets/da-D_Ezdzgg.js","assets/ConversationMetricsDashboard-CamgJig-.js","assets/select-BP_Q7Vjk.js","assets/index-BdQq_4o_.js","assets/index-CwKDC_mg.js","assets/index-srxnih4L.js","assets/check-BKeeD-3t.js","assets/clock-x2s7C7KC.js","assets/VoiceHealthSummary-DNeYqJMI.js","assets/flask-conical-DPInzIZf.js","assets/formatDistanceToNow-Diw_coPg.js","assets/constructNow-BhFeEnPH.js","assets/differenceInCalendarMonths-Hx-puyxs.js","assets/endOfDay-DsjgSdLA.js","assets/endOfMonth-CbBpMaqD.js","assets/differenceInMilliseconds-BIhMah9-.js","assets/SystemIntegrationsPanel-DaoQi0Hy.js","assets/ear-uMRQXG-t.js","assets/SystemReadinessPanel-CgNS6n0w.js","assets/ProductionReadinessReport-DuHTmCYE.js","assets/play-Bwj0pelq.js","assets/skip-forward-DEmKorBr.js"])))=>i.map(i=>d[i]);
2import{s as p,an as w,H,K as d,B as O,R as ke,C as o,i as c,ac as Q,f as ee,g as se,h as Ce,G as Ee,Z as Ae,al as De,t as te,_ as y}from"./index-CSx7K-7R.js";import{r as t,j as e}from"./framer-motion-CQxuJa5n.js";import{B as m}from"./badge-Yar_qzGV.js";import{T as Se,a as Ie,b as j,c as v}from"./tabs-sn5fbWIA.js";import{S as Re}from"./switch-GLkYldml.js";import{C as Fe,a as Te,b as Le}from"./collapsible-VrVLN1fc.js";import{A as Me,h as He,a as Oe,b as Pe,c as Be,d as Ve,e as Ke,f as ze,g as Ue}from"./alert-dialog-DED_7G_3.js";import{C as re}from"./circle-x-Bjw_qpIQ.js";import{C as ae}from"./circle-check-big-BvOaTfBT.js";import{P}from"./phone-forwarded-Bahxs-rZ.js";import{P as $e}from"./phone-DfeYL_-y.js";import{C as le}from"./clock-x2s7C7KC.js";import{S as ne}from"./shield-check-BcKgGayo.js";import{S as Ge}from"./server-DYOLfZsj.js";import{R as Ye}from"./radio-CEdjniLT.js";import{C as qe}from"./chevron-down-DvU9LH4D.js";import{T as We}from"./trash-2-DxlklYFw.js";import{f as Ze}from"./formatDistanceToNow-Diw_coPg.js";import{f as ie}from"./format-CUd6TPP6.js";import{d as B}from"./da-D_Ezdzgg.js";import"./recharts-CFjfazL9.js";import"./index-CVOcPLpq.js";import"./index-CwKDC_mg.js";import"./index-srxnih4L.js";import"./index-oMQApiRp.js";import"./constructNow-BhFeEnPH.js";import"./en-US-Bs6ECJID.js";import"./differenceInCalendarMonths-Hx-puyxs.js";import"./endOfDay-DsjgSdLA.js";import"./endOfMonth-CbBpMaqD.js";import"./differenceInMilliseconds-BIhMah9-.js";const Xe=t.lazy(()=>y(()=>import("./PlatformDiagnostics-WAAEE21H.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))),Je=t.lazy(()=>y(()=>import("./ConversationMetricsDashboard-CamgJig-.js"),__vite__mapDeps([23,1,2,3,4,5,24,25,26,27,16,28,15,29,17]))),Qe=t.lazy(()=>y(()=>import("./VoiceHealthSummary-DNeYqJMI.js"),__vite__mapDeps([30,1,2,3,4,5,29,17,31,12,13,32,33,21,34,35,36,37,22]))),es=t.lazy(()=>y(()=>import("./SystemIntegrationsPanel-DaoQi0Hy.js"),__vite__mapDeps([38,1,2,3,4,5,19,17,39,18,12,13,20,21,22]))),ss=t.lazy(()=>y(()=>import("./SystemReadinessPanel-CgNS6n0w.js"),__vite__mapDeps([40,1,2,3,4,5,12,13,29,20,21,22]))),ts=t.lazy(()=>y(()=>import("./ProductionReadinessReport-DuHTmCYE.js"),__vite__mapDeps([41,1,2,3,4,5,6,42,43,13,12])));function Ls(){const[R,V]=t.useState([]),[x,K]=t.useState([]),[oe,ce]=t.useState(!0),[z,U]=t.useState(!1),[k,de]=t.useState(null),[$,G]=t.useState([]),[C,me]=t.useState(null),[Y,xe]=t.useState(!1),[he,ue]=t.useState(new Set),[,ge]=t.useState(0),fe=s=>
2{ue(a=>{const n=new Set(a);return n.has(s)?n.delete(s):n.add(s),n})},N=t.useCallback(async()=>{U(!0);try{const s=new Date(Date.now()-864e5).toISOString(),[a,n,u]=await Promise.all([p.from("voice_brain_logs").select("id, agent_id, error_type, error_message, created_at, call_sid, turn_number, user_input, source_type").not("error_message","is",null).gte("created_at",s).order("created_at",{ascending:!1}).limit(100),p.from("voice_brain_logs").select("agent_id, error_message, error_type, latency_ms, created_at").gte("created_at",s),p.from("voice_calls").select("agent_id, created_at").gte("created_at",s)]);let _=await p.from("voice_agents").select("id, name, status, phone_number, scraped_content, url, user_id, is_deleted").eq("is_deleted",!1);_.error&&!w(_.error)&&(_=await p.from("voice_agents").select("id, name, status, phone_number, scraped_content, url, user_id"));const S=w(a.error)||w(n.error);if(a.error&&!S)throw a.error;if(n.error&&!S)throw n.error;if(u.error&&!w(u.error))throw u.error;if(_.error&&!w(_.error))throw _.error;const T=S?[]:a.data||[],ve=S?[]:n.data||[],Ne=w(u.error)?[]:u.data||[],I=_.data||[];if(T.length>0){const g=new Map;for(const i of T){const h=i.error_type||"UNKNOWN";g.set(h,(g.get(h)||0)+1)}const r=[];for(const[i,h]of g)r.push({type:i,label:Z(i),count:h});r.sort((i,h)=>h.count-i.count),G(r)}else G([]);if(I.length>0){const g=I.map(r=>{const i=(ve||[]).filter(l=>l.agent_id===r.id),h=Ne.filter(l=>l.agent_id===r.id),b=i.filter(l=>l.error_message),L=i.map(l=>l.latency_ms).filter(Boolean),J=b.sort((l,M)=>new Date(M.created_at).getTime()-new Date(l.created_at).getTime())[0],be=b.filter(l=>l.error_type==="EMERGENCY_HANDOFF").length,we=b.some(l=>/brain|openai|llm|token|gpt/i.test(`${l.error_type||""} ${l.error_message||""}`)),ye=b.some(l=>/eleven|tts|voice|audio|ulaw|mulaw/i.test(`${l.error_type||""} ${l.error_message||""}`));return{agent_id:r.id,agent_name:r.name,status:r.status,total_calls_24h:h.length,errors_24h:b.length,error_rate:h.length>0?b.length/h.length*100:0,last_error:J?.error_message||null,last_error_at:J?.created_at||null,avg_latency_ms:L.length>0?Math.round(L.reduce((l,M)=>l+M,0)/L.length):null,brain_token_ok:we?!1:null,elevenlabs_ok:ye?!1:null,knowledge_ok:!!(r.scraped_content||r.url),emergency_handoffs_24h:be}});g.sort((r,i)=>r.emergency_handoffs_24h>0&&i.emergency_handoffs_24h===0?-1:r.emergency_handoffs_24h===0&&i.emergency_handoffs_24h>0?1:r.errors_24h>0&&i.errors_24h===0?-1:r.errors_24h===0&&i.errors_24h>0?1:i.error_rate-r.error_rate),K(g)}if(I.length>0){const g=new Map(I.map(r=>[r.id,r.name]));V(T.map(r=>({...r,agent_name:g.get(r.agent_id)||"Ukendt agent"})))}else K([]),V([])}catch(s){console.error("Failed to load status data:",s)}finally{ce(!1),U(!1),me(new Date)}},[]);t.useEffect(()=>{N()},[N]),t.useEffect(()=>{const s=setInterval(N,15e3);return()=>clearInterval(s)},[N]),t.useEffect(()=>{const s=setInterval(()=>ge(a=>a+1),1e3);return()=>clearInterval(s)},[]);const f=R.length,E=x.filter(s=>s.error_rate>10),q=x.filter(s=>s.status==="active"),A=x.reduce((s,a)=>s+a.emergency_handoffs_24h,0),W=k?R.filter(s=>s.agent_id===k):R,D=(()=>{const s=x.map(a=>a.avg_latency_ms).filter(Boolean);return s.length>0?Math.round(s.reduce((a,n)=>a+n,0)/s.length):0})(),_e=(C?Date.now()-C.getTime():1/0)<3e4,F=Y?x:x.filter(s=>s.status==="active"),Z=s=>{switch(s){case"FAILED_IN_CALL":return"LLM Fejl";case"TIMEOUT":return"Timeout";case"KB_FAILURE":return"Viden Fejl";case"AUTH_FAILURE":return"Auth Fejl";case"EMERGENCY_HANDOFF":return"Nød-viderestilling";case"NO_SPEECH_DETECTED":return"Ingen tale";case"STREAM_ERROR":return"Stream Fejl";default:return s||"Ukendt"}},X=x.filter(s=>s.emergency_handoffs_24h>0),pe=s=>s.emergency_handoffs_24h>0?"bg-destructive text-destructive-foreground":s.error_rate>10?"bg-destructive/80 text-destructive-foreground":s.error_rate>0?"bg-yellow-500/80 text-white":s.total_calls_24h>0?"bg-green-600 text-white":"bg-muted text-muted-foreground",je=s=>s.emergency_handoffs_24h>0?"Kritisk":s.error_rate>10?"Dårlig":s.error_rate>0?"Advarsel":s.total_calls_24h>0?"Sund":"Inaktiv";return e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("div",{className:"max-w-6xl mx-auto p-3 sm:p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl sm:text-2xl font-bold flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(H,{className:"h-5 w-5 text-primary"})}),"System Status",e.jsx("span",{className:d("inline-block h-2.5 w-2.5 rounded-full",_e?"bg-green-500 animate-pulse":"bg-yellow-500")})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Live fejlovervågning · ",C?e.jsxs(e.Fragment,{children:["Opdateret ",Ze(C,{locale:B,addSuffix:!0})]}):"Indlæser..."," · ",q.length," aktive agenter · ",D,"ms avg latens"]})]}),e.jsxs("div",{className:"flex items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Inaktive"}),e.jsx(Re,{checked:Y,onCheckedChange:xe})]}),e.jsxs(O,{onClick:N,disabled:z,size:"sm",variant:"outline",className:"ml-auto sm:ml-0",children:[e.jsx(ke,{className:d("h-4 w-4 mr-2",z&&"animate-spin")}),"Opdater"]})]})]}),e.jsx(t.Suspense,{fallback:e.jsx(o,{children:e.jsx(c,{className:"py-6 text-center text-muted-foreground",children:"Beregner health..."})}),children:e.jsx(Qe,{})}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:[{icon:f>0?re:ae,iconColor:f>0?"text-destructive":"text-green-500",bgColor:f>0?"bg-destructive/10":"bg-green-500/10",borderColor:f>0?"border-destructive/30":"border-green-500/30",value:f,label:"Fejl (24t)"},{icon:P,iconColor:A>0?"text-destructive":"text-green-500",bgColor:A>0?"bg-destructive/10":"bg-green-500/10",borderColor:A>0?"border-destructive/30":"",value:A,label:"Nød-viderestill."},{icon:Q,iconColor:E.length>0?"text-yellow-500":"text-green-500",bgColor:E.length>0?"bg-yellow-500/10":"bg-green-500/10",borderColor:E.length>0?"border-yellow-500/30":"",value:E.length,label:"Kritiske agenter"},{icon:H,iconColor:"text-green-500",bgColor:"bg-green-500/10",borderColor:"",value:`${q.length}/${x.length}`,label:"Aktive agenter"},{icon:$e,iconColor:"text-primary",bgColor:"bg-primary/10",borderColor:"",value:x.reduce((s,a)=>s+a.total_calls_24h,0),label:"Brain-kald (24t)"}
2,{icon:le,iconColor:D>2e3?"text-yellow-500":"text-green-500",bgColor:D>2e3?"bg-yellow-500/10":"bg-green-500/10",borderColor:"",value:`${D}ms`,label:"Gns. latens"}].map((s,a)=>e.jsx(o,{className:d("relative overflow-hidden",s.borderColor),children:e.jsx(c,{className:"pt-5 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:d("p-2 rounded-xl shrink-0",s.bgColor),children:e.jsx(s.icon,{className:d("h-4 w-4 sm:h-5 sm:w-5",s.iconColor)})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold truncate",children:s.value}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground truncate",children:s.label})]})]})})},a))}),X.length>0&&e.jsxs(o,{className:"border-destructive/50 bg-destructive/5",children:[e.jsxs(ee,{className:"pb-3",children:[e.jsxs(se,{className:"text-destructive flex items-center gap-2 text-base sm:text-lg",children:[e.jsx(Q,{className:"h-5 w-5"}),"KRITISK — Automatisk viderestilling aktiv"]}),e.jsx(Ce,{children:"Disse agenter har haft gentagne fejl og automatisk viderestillet kald"})]}),e.jsx(c,{children:e.jsx("div",{className:"space-y-2",children:X.map(s=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 bg-destructive/10 rounded-xl gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:s.agent_name}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(m,{variant:"destructive",children:[s.emergency_handoffs_24h," nød-viderestilling(er)"]}),e.jsxs(m,{variant:"outline",children:[s.errors_24h," fejl total"]})]})]},s.agent_id))})})]}),$.length>0&&e.jsxs(o,{children:[e.jsx(ee,{className:"pb-3",children:e.jsx(se,{className:"text-sm font-medium",children:"Fejlkategorisering (24t)"})}),e.jsx(c,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:$.map(s=>e.jsxs(m,{variant:s.type==="EMERGENCY_HANDOFF"?"destructive":"secondary",className:"text-xs",children:[s.label,": ",s.count]},s.type))})})]}),e.jsxs(Se,{defaultValue:"agents",children:[e.jsx("div",{className:"overflow-x-auto -mx-3 px-3 sm:mx-0 sm:px-0",children:e.jsxs(Ie,{className:"inline-flex w-auto min-w-full sm:min-w-0",children:[e.jsxs(j,{value:"diagnostics",className:"text-xs sm:text-sm whitespace-nowrap",children:[e.jsx(ne,{className:"h-3.5 w-3.5 mr-1"})," Diagnostik"]}),e.jsxs(j,{value:"integrations",className:"text-xs sm:text-sm whitespace-nowrap",children:[e.jsx(Ge,{className:"h-3.5 w-3.5 mr-1"})," Integrationer"]}),e.jsxs(j,{value:"agents",className:"text-xs sm:text-sm whitespace-nowrap",children:["Agent Sundhed",e.jsx(m,{variant:"secondary",className:"ml-1.5 text-[10px] h-5 px-1.5",children:F.length})]}),e.jsxs(j,{value:"errors",className:"text-xs sm:text-sm whitespace-nowrap",children:["Fejllog",f>0&&e.jsx(m,{variant:"destructive",className:"ml-1.5 text-[10px] h-5 px-1.5",children:f})]}),e.jsx(j,{value:"conv-metrics",className:"text-xs sm:text-sm whitespace-nowrap",children:"Conversation Engine"}),e.jsxs(j,{value:"readiness",className:"text-xs sm:text-sm whitespace-nowrap",children:[e.jsx(ne,{className:"h-3.5 w-3.5 mr-1"})," Readiness"]}),e.jsxs(j,{value:"simulation",className:"text-xs sm:text-sm whitespace-nowrap",children:[e.jsx(Ye,{className:"h-3.5 w-3.5 mr-1"})," Simulation"]})]})}),e.jsx(v,{value:"diagnostics",children:e.jsx(t.Suspense,{fallback:e.jsx(o,{children:e.jsx(c,{className:"py-8 text-center text-muted-foreground",children:"Indlæser diagnostik..."})}),children:e.jsx(Xe,{})})}),e.jsx(v,{value:"integrations",children:e.jsx(t.Suspense,{fallback:e.jsx(o,{children:e.jsx(c,{className:"py-8 text-center text-muted-foreground",children:"Indlæser integrationer..."})}),children:e.jsx(es,{})})}),e.jsx(v,{value:"conv-metrics",children:e.jsx(t.Suspense,{fallback:e.jsx(o,{children:e.jsx(c,{className:"py-8 text-center text-muted-foreground",children:"Indlæser metrics..."})}),children:e.jsx(Je,{})})}),e.jsx(v,{value:"readiness",children:e.jsx(t.Suspense,{fallback:e.jsx(o,{children:e.jsx(c,{className:"py-8 text-center text-muted-foreground",children:"Indlæser readiness..."})}),children:e.jsx(ss,{})})}),e.jsx(v,{value:"simulation",children:e.jsx(t.Suspense,{fallback:e.jsx(o,{children:e.jsx(c,{className:"py-8 text-center text-muted-foreground",children:"Indlæser simulation..."})}),children:e.jsx(ts,{})})}),e.jsx(v,{value:"agents",children:oe?e.jsx(o,{children:e.jsx(c,{className:"py-8 text-center text-muted-foreground",children:"Indlæser..."})}):F.length===0?e.jsx(o,{children:e.jsxs(c,{className:"py-12 text-center",children:[e.jsx(H,{className:"h-12 w-12 text-muted-foreground
2/30 mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"Ingen agenter fundet"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:F.map(s=>{const a=he.has(s.agent_id);return e.jsx(o,{className:d("transition-all hover:shadow-md",s.emergency_handoffs_24h>0&&"border-destructive/70 bg-destructive/5",s.emergency_handoffs_24h===0&&s.error_rate>10&&"border-destructive/50",s.emergency_handoffs_24h===0&&s.error_rate>0&&s.error_rate<=10&&"border-yellow-500/50"),children:e.jsxs(c,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:d("w-2.5 h-2.5 rounded-full shrink-0",s.emergency_handoffs_24h>0?"bg-destructive animate-pulse":s.errors_24h===0&&s.total_calls_24h>0?"bg-green-500":s.error_rate>10?"bg-destructive":s.error_rate>0?"bg-yellow-500":"bg-muted-foreground/30")}),e.jsx("p",{className:"font-semibold truncate",children:s.agent_name})]}),e.jsx(m,{className:d("text-[10px] shrink-0",pe(s)),children:je(s)})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center mb-3",children:[e.jsxs("div",{className:"p-2 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-lg font-bold",children:s.total_calls_24h}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Kald"})]}),e.jsxs("div",{className:"p-2 rounded-lg bg-muted/50",children:[e.jsx("p",{className:d("text-lg font-bold",s.errors_24h>0&&"text-destructive"),children:s.errors_24h}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Fejl"})]}),e.jsxs("div",{className:"p-2 rounded-lg bg-muted/50",children:[e.jsxs("p",{className:"text-lg font-bold",children:[s.avg_latency_ms||"-",e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"ms"})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Latens"})]})]}),e.jsxs("div",{className:"flex gap-1.5 flex-wrap mb-2",children:[e.jsxs(m,{variant:s.brain_token_ok===!1?"destructive":s.brain_token_ok===!0?"default":"outline",className:d("text-[10px]",s.brain_token_ok===!0&&"bg-green-600/80"),children:[e.jsx(Ee,{className:"h-2.5 w-2.5 mr-0.5"})," Brain",s.brain_token_ok===null?" ?":""]}),e.jsxs(m,{variant:s.elevenlabs_ok===!1?"destructive":s.elevenlabs_ok===!0?"default":"outline",className:d("text-[10px]",s.elevenlabs_ok===!0&&"bg-green-600/80"),children:[e.jsx(Ae,{className:"h-2.5 w-2.5 mr-0.5"})," Voice",s.elevenlabs_ok===null?" ?":""]}),e.jsx(m,{variant:s.knowledge_ok?"default":"destructive",className:d("text-[10px]",s.knowledge_ok&&"bg-green-600/80"),children:"KB"}),s.emergency_handoffs_24h>0&&e.jsxs(m,{variant:"destructive",className:"text-[10px] animate-pulse",children:[e.jsx(P,{className:"h-2.5 w-2.5 mr-0.5"}),s.emergency_handoffs_24h," handoff"]})]}),s.last_error&&e.jsxs(Fe,{open:a,onOpenChange:()=>fe(s.agent_id),children:[e.jsxs(Te,{className:"flex items-center gap-1 text-xs text-destructive/80 hover:text-destructive w-full mt-1",children:[a?e.jsx(qe,{className:"h-3 w-3"}):e.jsx(De,{className:"h-3 w-3"}),"Vis seneste fejl"]}),e.jsx(Le,{children:e.jsxs("div",{className:"mt-2 p-2.5 rounded-lg bg-destructive/5 border border-destructive/20",children:[e.jsx("p",{className:"text-xs font-mono text-destructive/80 break-all",children:s.last_error}),s.last_error_at&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:[e.jsx(le,{className:"h-3 w-3 inline mr-1"}),ie(new Date(s.last_error_at),"dd MMM HH:mm",{locale:B})]})]})})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsxs(Me,{children:[e.jsx(He,{asChild:!0,children:e.jsx(O,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive/50 hover:text-destructive",children:e.jsx(We,{className:"h-3.5 w-3.5"})})}),e.jsxs(Oe,{children:[e.jsxs(Pe,{children:[e.jsxs(Be,{children:["Slet agent: ",s.agent_name,"?"]}),e.jsx(Ve,{children:"Agenten skjules (soft delete). Data og historik bevares — nummeret frigives."})]}),e.jsxs(Ke,{children:[e.jsx(ze,{children:"Annuller"}),e.jsx(Ue,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:async()=>{try{await p.from("partner_tenants").update({status:"deleted"}).eq("agent_id",s.agent_id);const n=new Date().toISOString(),{error:u}=await p.from("voice_agents").update({is_deleted:!0,deleted_at:n,status:"paused",phone_number:null}).eq("id",s.agent_id);if(u)throw u;te.success(`Agent "${s.agent_name}" arkiveret`),N()}catch(n){te.error(`Kunne ikke slette: ${n.message}`)}},children:"Arkivér agent"})]})]})]})})]})},s.agent_id)})})}),e.jsxs(v,{value:"errors",className:"space-y-3",children:[k&&e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs(m,{variant:"outline",children:["Filtreret: ",x.find(s=>s.agent_id===k)?.agent_name]}),e.jsx(O,{size:"sm",variant:"ghost",onClick:()=>de(null),children:"Vis alle"})]}),W.length===0?e.jsx(o,{children:e.jsxs(c,{className:"py-12 text-center",children:[e.jsx(ae,{className:"h-12 w-12 text-green-500 mx-auto mb-3"}),e.jsx("p",{className:"font-medium text-green-600",children:"Ingen fejl de seneste 24 timer!"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Alle agenter kører som de skal."})]})}):W.map(s=>e.jsx(o,{className:d("border-destructive/30",s.error_type==="EMERGENCY_HANDOFF"&&"border-destructive/70 bg-destructive/5"),children:e.jsx(c,{className:"py-3 px-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[s.error_type==="EMERGENCY_HANDOFF"?e.jsx(P,{className:"h-4 w-4 text-destructive shrink-0"}):e.jsx(re,{className:"h-4 w-4 text-destructive shrink-0"}),e.jsx("span",{className:"font-medium text-sm",children:s.agent_name}),e.jsx(m,{variant:s.error_type==="EMERGENCY_HANDOFF"?"destructive":"outline",className:"text-xs",children:Z(s.error_type)}),s.source_type&&e.jsx(m,{variant:"secondary",className:"text-xs",children:s.source_type})]}),e.jsx("p",{className:"text-xs font-mono text-destructive/80 break-all",children:s.error_message}),s.user_input&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:['Bruger sagde: "',s.user_input,'"']})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:ie(new Date(s.created_at),"dd MMM HH:mm:ss",{locale:B})}),s.call_sid&&e.jsxs("p",{className:"text-xs font-mono text-muted-foreground",children:[s.call_sid.slice(0,10),"..."]})]})]})})},s.id))]})]})]})})}export{Ls as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.