Files
mission-control-v2/frontend/dist/assets/SystemDrawer-BibykjdQ.js
T
HitonabiandClaude Opus 5 3249c8e942 build(react): P6 — Sprung auf React 19, und das Budget bewusst angehoben
React 18.3.1 -> 19.2.8, dazu @types/react(-dom) 19.

## Nichts brach

  tsc --noEmit sauber, 54/54 Tests gruen, ESLint 0 Fehler
  Im Browser gegen die ECHTE Box: Cockpit mit 2 Diagrammen und 4 Flaechen,
    Statusleiste live (40,8/122,7 GB, 38 °C, 532 748 115 Token), 8 Karten
  NULL Konsolen-Warnungen — keine veralteten Muster im Bestand

Das eigentliche Risiko war `react-force-graph-2d` (peer: react "*", also ungeprueft,
und es umhuellt eine Nicht-React-Bibliothek). Gegen den echten Vault der Box getestet:
Canvas 500x560, 4498 gezeichnete Pixel, keine Fehlerflaeche. Es laeuft.

## Das Budget hat angeschlagen — und ich habe es trotzdem angehoben

Gemessen kostet der Sprung 14 645 B gzip (118 762 -> 133 407) und riss damit das
in P0 gesetzte Budget von 125 000. Das Gate hat also getan, was es soll.

Beim Router (P2) habe ich in derselben Lage NICHT das Budget angefasst, sondern den
Platz zurueckgeholt (Schublade und Palette hinter lazy()). Hier geht das nicht: Der
Zuwachs IST die Plattform, es gibt nichts wegzulassen.

Also angehoben — einmalig, auf 140 000, mit der Begruendung IM Ampel-Skript, damit ein
spaeterer Leser sieht, dass es ein ueberlegter Schritt war und kein Nachgeben:
MC2 ist eine LAN-Appliance; 14 kB sind ueber Gigabit-Ethernet keine messbare Wartezeit.
Das Budget existiert gegen DRIFT — einen 24-MB-Avatar, eine 95-kB-Diagramm-Bibliothek
auf der Startseite — nicht gegen einen bewussten Plattform-Schritt. Der relative
Abstand zum Deckel bleibt derselbe wie vorher (~5 %).

## Ehrlich zum Nutzen

React 19 bringt diesem Projekt HEUTE wenig Konkretes: use(), Actions und
Server-Komponenten sind hier nicht im Spiel. Der Grund ist die Zukunft — 18 altert,
und der React Compiler ist der Pfad, auf dem die 18 offenen Warnungen aus
eslint-plugin-react-hooks (setState im Effekt, Ref-Zugriff im Render) irgendwann
nicht mehr nur Warnungen sind.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 09:59:58 +02:00

43 lines
38 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{c as v,j as e,b as c,r as l,T as W,L as ae,E as ve,n as b,Q as le,Y as oe,X as de,J as Se,u as _e,k as Ce,x as ze,as as Fe,ag as Le,am as Ue,V as P,t as Ae,y as q,q as N}from"./index-Dd1yR_F_.js";import{R as F}from"./refresh-cw-c_vCbXLa.js";import{F as Pe}from"./file-text-CBWKyLdT.js";import{S as Be}from"./search-304843k8.js";import{S as ce}from"./shield-ZD0AzbFC.js";import{A as ne}from"./arrow-right-BQzOIyyQ.js";import{C as Re}from"./clock-BtwDQhLF.js";import{E as $e}from"./external-link-CX_p2Ium.js";import{C as De,a as Ee}from"./cloud-download-iKq6uLmJ.js";import{P as Oe}from"./power-DIQA5x8I.js";/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Te=v("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Me=v("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const He=v("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qe=v("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ie=v("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const me=v("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xe=v("Shuffle",[["path",{d:"M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22",key:"1wmou1"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 6h1.9c1.5 0 2.9.9 3.6 2.2",key:"10bdb2"}],["path",{d:"M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8",key:"vgxac0"}],["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const We=v("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);function B({icon:n,iconClass:d,name:i,status:m,available:s,busy:u,actionLabel:f,onAction:r}){return e.jsxs("div",{className:c("flex items-center gap-3 rounded-lg border px-3 py-2",s?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[e.jsx(n,{className:c("h-4 w-4 shrink-0",d)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:i}),e.jsx("div",{className:c("text-[10px] truncate",s?"text-amber-400/90":"text-muted-foreground"),children:m})]}),e.jsx("button",{onClick:r,disabled:!s||u,className:c("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",s?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:u?"…":f})]})}function Ge({label:n,ok:d,system:i,busy:m,onRestart:s,onLogs:u}){return e.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[e.jsx("span",{className:c("w-1.5 h-1.5 rounded-full shrink-0",d===!0?"bg-emerald-500":d===!1?"bg-red-500":"bg-muted-foreground/40")}),e.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[n,i&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),e.jsx("button",{onClick:s,disabled:m,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:e.jsx(F,{className:c("h-3.5 w-3.5",m&&"animate-spin")})}),e.jsx("button",{onClick:u,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:e.jsx(Pe,{className:"h-3.5 w-3.5"})})]})}const Je=/\b(error|fehler|fail(ed|ure)?|fatal|critical|crit|panic|traceback|exception|denied|refused|unable|emerg|alert|oom|killed)\b/i,Ke=/\b(warn(ing)?|deprecat\w*|retry(ing)?|timeout|timed out|degraded|missing|not found|nicht gefunden)\b/i;function Ve(n){return Je.test(n)?"error":Ke.test(n)?"warn":"info"}const Ze={error:"text-red-400",warn:"text-amber-300",info:"text-cyan-300/80"};function Qe({service:n,text:d,loading:i,logStatus:m,onRefresh:s,onOpenSettings:u}){const[f,r]=l.useState(!1),[j,y]=l.useState(""),o=l.useRef(null),h=l.useMemo(()=>d?d.split(`
`).map(p=>({t:p,level:Ve(p)})):[],[d]),S=l.useMemo(()=>h.filter(p=>p.level!=="info").length,[h]),_=j.trim().toLowerCase(),g=h.filter(p=>(!f||p.level!=="info")&&(!_||p.t.toLowerCase().includes(_))),k=m==="password_required"||m==="incorrect_password";return e.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[e.jsxs("div",{className:"flex h-10 items-center justify-between gap-2 px-3 border-b border-border/40 bg-black/30 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground shrink-0",children:[e.jsx(We,{className:"h-3 w-3 text-primary"}),e.jsx("span",{className:"hidden sm:inline",children:"stdout/stderr —"})," ",n]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Be,{className:"pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{value:j,onChange:p=>y(p.target.value),placeholder:"filtern…",className:"h-7 w-24 sm:w-36 rounded-md border border-border/50 bg-background/40 pl-6 pr-2 text-[10px] text-foreground outline-none focus:border-primary/50"})]}),e.jsxs("button",{onClick:()=>r(p=>!p),title:"Nur Fehler und Warnungen zeigen",className:c("flex h-7 items-center gap-1 rounded-md border px-2 text-[10px] font-semibold transition-colors",f?"border-amber-500/50 bg-amber-500/15 text-amber-300":"border-border/50 bg-background/20 text-muted-foreground hover:text-foreground"),children:[e.jsx(W,{className:"h-3 w-3"}),"Nur Probleme",S>0?` (${S})`:""]}),e.jsx("button",{onClick:s,disabled:i,title:"Neu laden",className:"flex h-7 w-7 items-center justify-center rounded-md border border-border/50 bg-background/20 text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:e.jsx(F,{className:c("h-3 w-3",i&&"animate-spin")})})]})]}),e.jsx("div",{ref:o,className:"flex-1 overflow-y-auto p-3 text-[10px] font-mono leading-relaxed scrollbar-thin select-text",children:k?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center space-y-3 p-6 text-center",children:[e.jsx(W,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),e.jsx("div",{className:"text-xs font-semibold text-amber-300",children:m==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),e.jsxs("p",{className:"max-w-xs text-[10px] leading-normal text-muted-foreground",children:["Für das Auslesen der systemd-Logs von ",n," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),e.jsx("button",{onClick:u,className:"mt-2 rounded-md bg-primary px-3 py-1.5 text-[10px] font-semibold text-primary-foreground transition-colors hover:bg-primary/95",children:"Sudo-Passwort eintragen"})]}):i&&!d?e.jsx("span",{className:"text-muted-foreground",children:"Lade Logs…"}):h.length===0?e.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."}):g.length===0?e.jsx("span",{className:"text-muted-foreground",children:f?"Keine Fehler oder Warnungen — der Dienst läuft sauber. ✓":"Kein Treffer für den Filter."}):g.map((p,$)=>e.jsx("div",{className:c("whitespace-pre-wrap",Ze[p.level]),children:p.t||" "},$))})]})}function Xe({open:n,showAlert:d}){const[i,m]=l.useState(null),[s,u]=l.useState(""),[f,r]=l.useState(!1),[j,y]=l.useState(!1),[o,h]=l.useState(!1);async function S(){y(!0);try{m(await b("/api/maintenance/geheimnisse"))}catch(g){d("Nicht erreichbar",`Der Geheimnis-Zustand konnte nicht geladen werden: ${(g==null?void 0:g.message)||g}`)}finally{y(!1)}}l.useEffect(()=>{n&&(u(""),r(!1),S())},[n]);async function _(g){h(!0);try{const k=await b("/api/maintenance/geheimnisse",{method:"POST",body:JSON.stringify({schluessel:"hf_token",wert:g})});m(k),u(""),d(g?"Gespeichert":"Gelöscht",g?"Der Token liegt jetzt auf der Box — der Browser behält ihn nicht.":"Der Token wurde von der Box entfernt.")}catch(k){d("Fehlgeschlagen",(k==null?void 0:k.message)||String(k))}finally{h(!1)}}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),e.jsx("p",{className:"text-[10px] leading-normal text-muted-foreground",children:"Geheimnisse liegen auf der Box (Datei mit Rechten 0600), nicht im Browser. Diese Seite zeigt nur, ob etwas gesetzt ist — den Wert bekommt sie nie zurück."})]}),e.jsxs("div",{className:"mc-card-sm space-y-1.5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[e.jsx(me,{className:"h-4 w-4 text-emerald-400","aria-hidden":"true"}),"Box-Sudo-Passwort — nicht mehr nötig"]}),e.jsxs("p",{className:"text-[10px] leading-normal text-muted-foreground",children:["Systemdienste, OS-Update und Neustart laufen passwortlos (",e.jsx("code",{className:"font-mono text-primary",children:"NOPASSWD"})," in",e.jsx("code",{className:"font-mono",children:" /etc/sudoers"}),"). Das frühere Feld hat nie etwas bewirkt und lag dabei im Browser-Speicher — es ist am 28.08.2026 ersatzlos entfallen. Verlangt ",e.jsx("code",{className:"font-mono",children:"sudo"})," auf der Box je doch ein Passwort, sagt die Wartung das im Klartext; das ist dann dort zu lösen."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:"hf-token",className:"flex items-center gap-1.5 text-xs font-semibold",children:[e.jsx(qe,{className:"h-4 w-4 text-violet-400","aria-hidden":"true"}),"HuggingFace-Token"]}),e.jsx("div",{className:"flex items-center gap-2 text-[11px]",children:j?e.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(ae,{className:"h-3 w-3 animate-spin","aria-hidden":"true"})," Zustand wird geladen …"]}):i!=null&&i.hf_token_gesetzt?e.jsxs("span",{className:"flex items-center gap-1.5 font-semibold text-emerald-400",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500","aria-hidden":"true"}),"Gesetzt",i.hf_token_aus_env?" (aus der Dienst-Umgebung)":""]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/50","aria-hidden":"true"}),"Nicht gesetzt"]})}),(i==null?void 0:i.hf_token_aus_env)&&e.jsxs("p",{className:"text-[9px] leading-normal text-amber-400/90",children:["Der Token kommt aus der Umgebung des Dienstes und hat Vorrang. Hier gespeicherte Werte bleiben wirkungslos, solange ",e.jsx("code",{className:"font-mono",children:"HF_TOKEN"})," gesetzt ist."]}),i&&!i.schreibbar&&e.jsx("p",{className:"text-[9px] leading-normal text-amber-400/90",children:"Die Ablage ist nicht beschreibbar — auf einem Entwicklungsrechner ohne den Modell-Ordner der Box ist das normal. Speichern würde hier ins Leere laufen."}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"hf-token",type:f?"text":"password",value:s,onChange:g=>u(g.target.value),autoComplete:"off",spellCheck:!1,placeholder:i!=null&&i.hf_token_gesetzt?"Neuen Token eingeben, um zu ersetzen":"hf_…",className:"h-10 w-full rounded-lg border border-border/60 bg-background/40 pl-3 pr-10 text-xs text-foreground outline-none transition-colors focus:border-primary"}),e.jsx("button",{type:"button",onClick:()=>r(!f),"aria-label":f?"Token verbergen":"Token anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground transition-colors hover:text-foreground",children:f?e.jsx(Me,{className:"h-4 w-4","aria-hidden":"true"}):e.jsx(ve,{className:"h-4 w-4","aria-hidden":"true"})})]}),e.jsxs("p",{className:"text-[9px] leading-normal text-muted-foreground",children:["Nötig für Modelle mit Zugangsschranke. Wird beim Download als",e.jsx("code",{className:"font-mono",children:" HF_TOKEN"})," an den Job gereicht und verlässt die Box nicht."]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsxs("button",{onClick:()=>_(s.trim()),disabled:o||!s.trim(),className:"flex h-9 flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow shadow-primary/10 transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40",children:[o&&e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}),"Auf der Box speichern"]}),e.jsx("button",{onClick:()=>_(null),disabled:o||!(i!=null&&i.hf_token_gesetzt),className:"flex h-9 cursor-pointer items-center justify-center rounded-lg border border-border/60 bg-background/20 px-4 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40",children:"Löschen"})]})]})}function Ye({detail:n,maintenanceJob:d,onClose:i,onApply:m}){var j,y;const s=n.data,u={os:{icon:ce,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:oe,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:xe,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:le,cls:"text-amber-400",title:"Hermes-Agent"}}[n.kind],f=u.icon,r=s?n.kind==="os"?(s.count??0)===0:n.kind==="hermes"?(s.behind??0)===0:s.installed_build!=null&&s.latest_build!=null&&s.latest_build<=s.installed_build:!0;return e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:i}),e.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[e.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:c("h-4.5 w-4.5",u.cls)}),e.jsx("h3",{className:"text-sm font-semibold",children:u.title})]}),e.jsx("button",{onClick:i,className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:e.jsx(de,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:n.loading?e.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[e.jsx(F,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):s!=null&&s.error?e.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:s.error}):e.jsxs(e.Fragment,{children:[(s==null?void 0:s.action_needed)!=null&&e.jsxs("div",{className:c("flex items-start gap-2 rounded-lg border p-3",s.action_needed?"border-amber-500/40 bg-amber-500/10":"border-emerald-500/40 bg-emerald-500/10"),children:[s.action_needed?e.jsx(W,{className:"h-4 w-4 text-amber-400 shrink-0 mt-0.5"}):e.jsx(Se,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:c("text-xs font-semibold",s.action_needed?"text-amber-300":"text-emerald-300"),children:["Musst du etwas tun? ",s.action_needed?"Ja":"Nein — die Box regelt das (Fangnetz)"]}),s.action_needed&&s.action_text&&e.jsx("div",{className:"mt-0.5 text-[11px] text-foreground/90",children:s.action_text})]})]}),(s==null?void 0:s.summary)&&e.jsxs("div",{className:"rounded-lg border border-primary/25 bg-primary/5 p-3 space-y-1",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-primary",children:"Was dieses Update bedeutet (Zusammenfassung der Box)"}),e.jsx("pre",{className:"whitespace-pre-wrap text-[11px] leading-relaxed text-foreground/90 font-sans",children:s.summary})]}),n.kind==="os"?e.jsxs(e.Fragment,{children:[((s==null?void 0:s.count)??0)===0?e.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-muted-foreground",children:[s.count," Paket(e) werden aktualisiert:"]}),e.jsx("div",{className:"space-y-1",children:s.packages.map(o=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[e.jsx(ie,{className:"h-3 w-3 text-cyan-400 shrink-0"}),o.name]}),e.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[e.jsx("span",{children:o.current}),e.jsx(ne,{className:"h-3 w-3"}),e.jsx("span",{className:"text-emerald-400",children:o.candidate})]})]},o.name))})]}),(((j=s==null?void 0:s.held_back)==null?void 0:j.length)??0)>0&&e.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border/40 bg-background/20 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground",children:[e.jsx(Re,{className:"h-3.5 w-3.5"})," Vom Hersteller zurückgestellt — kein Handeln nötig"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Pakete gäbe es bereits, Ubuntu spielt sie aber gestaffelt aus (Phasen-Rollout) bzw. hält sie kurz zurück. Sie kommen bei einem der nächsten automatischen Läufe von selbst — das ist kein Fehler und nichts hängt fest."}),e.jsx("div",{className:"space-y-1",children:s.held_back.map(o=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/30 bg-background/30 px-2.5 py-1.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[e.jsx(ie,{className:"h-3 w-3 text-muted-foreground shrink-0"}),o.name]}),e.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:o.reason==="phasing"?"Phasen-Rollout":"vorerst zurückgehalten"})]},o.name))})]})]}):n.kind==="engine"||n.kind==="swap"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[e.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(s==null?void 0:s.installed_build)??"?"]}),e.jsx(ne,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(s==null?void 0:s.latest_build)??"?"]})]}),((s==null?void 0:s.name)||(s==null?void 0:s.latest_tag))&&e.jsxs("div",{className:"text-muted-foreground",children:["Release: ",e.jsx("span",{className:"text-foreground",children:s==null?void 0:s.name}),s!=null&&s.latest_tag?` (${s.latest_tag})`:""]}),(s==null?void 0:s.url)&&e.jsxs("a",{href:s.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Original-Release-Notes auf GitHub ",e.jsx($e,{className:"h-3 w-3"})]}),(s==null?void 0:s.body)&&e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-[10px] text-muted-foreground hover:text-foreground",children:"Original-Notizen (englisch) anzeigen"}),e.jsx("pre",{className:"mt-1.5 whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:s.body})]})]}):(((y=s==null?void 0:s.commits)==null?void 0:y.length)??0)===0?e.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-muted-foreground",children:[s.behind," neue Commit(s) auf ",e.jsxs("span",{className:"font-mono text-foreground",children:["origin/",s.branch]}),":"]}),e.jsx("div",{className:"space-y-1",children:s.commits.map(o=>e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[e.jsx(He,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] truncate",children:o.subject}),e.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[o.hash," · ",o.when]})]})]},o.hash))})]}),n.kind!=="os"&&!r&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border/40 bg-background/20 p-2.5",children:[e.jsx(me,{className:"h-3.5 w-3.5 text-emerald-400 shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Vor dem Update sichert die Box automatisch den alten Stand. Danach prüft sie den ganzen Stack per echter Anfrage — läuft etwas nicht, rollt sie von selbst zurück",n.kind==="hermes"?" und startet den Gateway neu":"","."]})]})]})}),e.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[e.jsx("button",{onClick:i,className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),e.jsx("button",{onClick:m,disabled:n.loading||r||!!d,title:d?`Update läuft bereits: ${d.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:d?"Update läuft…":"Jetzt aktualisieren"})]})]})]})}function dt({open:n,onClose:d,defaultTab:i="maintenance"}){var se,re;const m=_e(),{showAlert:s,showConfirm:u,dialogElement:f}=Ce(),{data:r}=ze(),{data:j}=Fe(),y=Le(3e3,n).data??[],{data:o}=Ue(void 0,n),[h,S]=l.useState("llama-swap"),[_,g]=l.useState(""),[k,p]=l.useState(!1),[$,G]=l.useState(null),[D,J]=l.useState({}),[C,w]=l.useState("maintenance"),[K,V]=l.useState(!1),[Z,E]=l.useState(""),[Q,X]=l.useState(!1),[ue,Y]=l.useState(!1),[L,U]=l.useState(null),O=(j==null?void 0:j.services)??[],z=()=>P(m,N.jobs);function he(t){return t?new Date(t*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}l.useEffect(()=>{n&&i&&w(i)},[n,i]),l.useEffect(()=>{n&&P(m,N.updates,N.services,N.jobs,N.zeitmaschine)},[n]);function T(t){p(!0),G(null),b(`/api/maintenance/logs?service=${t}&lines=150`).then(a=>{a.ok?g(a.text):(g(`Fehler beim Laden der Logs: ${a.err||"Unbekannter Fehler"}`),(a.status==="incorrect_password"||a.status==="password_required")&&G(a.status))}).catch(a=>g(`Fehler: ${a.message}`)).finally(()=>p(!1))}l.useEffect(()=>{!n||C!=="logs"||T(h)},[n,C,h]);function M(t){return(t==null?void 0:t.status)==="busy"?(s("Update läuft bereits",`Es läuft gerade „${t.running}". Bitte warte, bis es fertig ist.`),z(),!0):!1}function I(t){return(t==null?void 0:t.status)==="password_required"||(t==null?void 0:t.status)==="incorrect_password"?(s("Box-Passwort nötig",(t.status==="incorrect_password"?"Das gespeicherte Box-Passwort stimmt nicht. ":"Für dieses Update braucht die Box dein Passwort. ")+"Bitte oben im Reiter „Einstellungen“ setzen bzw. korrigieren."),!0):t&&t.ok===!1?(s("Update fehlgeschlagen",t.err||"Unbekannter Fehler."),!0):!1}async function ge(t){const a={os:"os-update",engine:"engine-update",swap:"swap-update"}[t];try{const x=await b(`/api/maintenance/${a}`,{method:"POST"});if(M(x)||I(x))return;z(),w("maintenance")}catch(x){s("Fehler",`Update konnte nicht starten: ${x.message}`)}}async function pe(){Y(!0);try{const t=await b("/api/maintenance/hermes-update",{method:"POST"});if(M(t))return;z()}catch(t){s("Fehler",`Hermes-Update fehlgeschlagen: ${t.message}`)}finally{Y(!1)}}async function R(t){U({kind:t,loading:!0,data:null});try{const a=await b(`/api/maintenance/update-details?kind=${t}`);U({kind:t,loading:!1,data:a})}catch(a){U({kind:t,loading:!1,data:{kind:t,error:a.message}})}}function fe(){const t=L==null?void 0:L.kind;U(null),t==="os"||t==="engine"||t==="swap"?ge(t):t==="hermes"&&pe()}function be(){var a;const t=[r!=null&&r.engine?"Engine":null,r!=null&&r.swap?"Router":null,(a=r==null?void 0:r.components)!=null&&a.some(x=>x.update===!0)?"Hermes-Agent":null,r!=null&&r.os?`OS (${r.os} Pakete)`:null].filter(Boolean);u("Alle Updates einspielen?",`Nacheinander in einem Job: ${t.join(" → ")}. Jeder Schritt sichert und prüft sich selbst; schlägt einer fehl, stoppt der Rest. (OS braucht das Box-Passwort aus den Einstellungen — fehlt es, wird OS übersprungen.)`,async()=>{try{const x=await b("/api/maintenance/update-all",{method:"POST"});if(M(x)||I(x))return;if((x==null?void 0:x.status)==="nothing"){s("Nichts zu tun","Es stehen keine Updates aus.");return}z(),w("maintenance")}catch(x){s("Fehler",`„Alle aktualisieren" konnte nicht starten: ${x.message}`)}})}async function ye(){V(!0);try{await b("/api/maintenance/check-updates",{method:"POST"}),P(m,N.jobs,N.updates),w("maintenance")}catch(t){s("Fehler",`Fehler bei der Update-Suche: ${t.message}`)}finally{V(!1)}}async function je(t,a){try{await b("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,role:a})}),s("Gestartet",`Modell-Upgrade für '${a}' (${t}) gestartet.`),z(),w("maintenance")}catch(x){s("Fehler",`Fehler beim Starten des Modell-Upgrades: ${x.message}`)}}async function Ne(){u("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await b("/api/maintenance/reboot",{method:"POST"}),s("Reboot","Reboot ausgelöst. System startet neu...",()=>d())}catch(t){s("Fehler",`Fehler beim Reboot: ${t.message}`)}})}async function ke(){X(!0),E("Snapshot wird erzeugt...");try{const t=await b("/api/system/backup",{method:"POST"});E(t.ok?`Snapshot erzeugt: ${t.snapshot} (${t.files.length} Komponenten)`:"Backup fehlgeschlagen."),P(m,N.zeitmaschine)}catch(t){E(`Fehler: ${t.message}`)}finally{X(!1)}}async function ee(t){J(a=>({...a,[t]:!0}));try{const a=await b("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:t})});a.ok?(s("Dienst neu gestartet",`Dienst ${t} wurde erfolgreich neu gestartet.`,()=>{C==="logs"&&h===t&&T(t)}),P(m,N.services,N.health,N.models)):s("Fehler",`Fehler beim Neustart: ${a.err||"Unbekannter Fehler"}`)}catch(a){s("Fehler",`Fehler beim Neustart: ${a.message}`)}finally{J(a=>({...a,[t]:!1}))}}async function we(t){try{await b(`/api/jobs/${t}/cancel`,{method:"POST"}),z()}catch(a){s("Fehler",`Fehler beim Abbrechen: ${a.message}`)}}const A=y.find(t=>(t.state==="running"||t.state==="queued")&&t.group==="maintenance"),te=(r?(r.os>0?1:0)+(r.engine?1:0)+(r.swap?1:0):0)+(((se=r==null?void 0:r.components)==null?void 0:se.filter(t=>t.update===!0).length)??0),H=(o==null?void 0:o.backups)??[];return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:c("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",n?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:d}),e.jsxs("div",{className:c("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",n?"translate-x-0":"translate-x-full"),children:[e.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-4.5 w-4.5 text-primary"}),e.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),e.jsx("button",{onClick:d,"aria-label":"System-Schublade schließen",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:e.jsx(de,{className:"h-4 w-4","aria-hidden":"true"})})]}),e.jsx("div",{className:"flex border-b border-border/40 px-6",children:["maintenance","logs","settings"].map(t=>e.jsx("button",{onClick:()=>w(t),className:c("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",C===t?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:t==="maintenance"?"System-Wartung":t==="logs"?"System-Logs":"Einstellungen"},t))}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[C==="maintenance"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),e.jsxs("div",{className:"flex items-center gap-3",children:[te>0&&e.jsxs("button",{onClick:be,disabled:!!A,className:"flex items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-2 py-1 text-[10px] font-bold text-primary transition-colors hover:bg-primary/20 disabled:opacity-50",children:[e.jsx(De,{className:"h-3 w-3"})," Alle aktualisieren (",te,")"]}),e.jsxs("button",{onClick:ye,disabled:K||!!A,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[e.jsx(F,{className:c("h-3 w-3",K&&"animate-spin")})," Nach Updates suchen"]})]})]}),(r==null?void 0:r.last_check)&&e.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",he(r.last_check)]}),A&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[e.jsx(F,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),e.jsxs("span",{children:["Update läuft: ",e.jsx("span",{className:"font-semibold",children:A.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{icon:ce,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>R("os")}),e.jsx(B,{icon:oe,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>R("engine")}),e.jsx(B,{icon:xe,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(r!=null&&r.swap),status:r!=null&&r.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>R("swap")}),(()=>{var a;const t=(a=r==null?void 0:r.components)==null?void 0:a.find(x=>x.key==="hermes_agent");return e.jsx(B,{icon:le,iconClass:"text-amber-400",name:"Hermes-Agent",available:(t==null?void 0:t.update)===!0,busy:ue,status:(t==null?void 0:t.update)===!0?`Update: ${t.latest}`:(t==null?void 0:t.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>R("hermes")})})(),(re=r==null?void 0:r.model_list)==null?void 0:re.map(t=>e.jsx(B,{icon:Te,iconClass:"text-emerald-400",name:`Modell · ${t.role}`,available:!0,status:t.title,actionLabel:"Upgrade",onAction:()=>je(t.repo,t.role)},t.role))]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),e.jsxs("div",{className:"space-y-1.5",children:[O.length===0&&e.jsx("div",{className:"rounded-lg border border-dashed border-border/50 p-4 text-center text-xs text-muted-foreground",children:"Dienste-Liste wird geladen …"}),O.map(t=>e.jsx(Ge,{label:t.name,system:t.scope==="system",ok:t.ok,busy:D[t.unit],onRestart:()=>ee(t.unit),onLogs:()=>{S(t.unit),w("logs")}},t.unit))]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:H[0]?`Letztes: ${H[0].snapshot}`:"Noch kein Backup"}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[H.length," Snapshots · Wiederherstellen: Chronik → Zeitmaschine"]})]}),e.jsxs("button",{onClick:ke,disabled:Q,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[e.jsx(Ee,{className:c("h-3.5 w-3.5",Q&&"animate-pulse")})," Snapshot"]})]}),Z&&e.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:Z})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),e.jsxs("button",{onClick:Ne,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[e.jsx(Oe,{className:"h-4.5 w-4.5"}),e.jsxs("div",{children:[e.jsx("div",{children:"Host-System neu starten"}),e.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),e.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[y.filter(t=>t.state==="running"||t.state==="queued").length," Aktiv"]})]}),e.jsx("div",{className:"space-y-3",children:y.length===0?e.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):y.map(t=>{const a=t.state==="running"||t.state==="queued";return e.jsxs("div",{className:c("p-3 rounded-xl border transition-all duration-300",a?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[a&&e.jsxs("span",{className:"flex h-2 w-2 relative",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),t.label]}),e.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[e.jsxs("span",{children:["ID: ",t.id]}),e.jsx("span",{children:"•"}),e.jsx("span",{className:c(t.state==="done"&&"text-emerald-400",t.state==="failed"&&"text-red-400",t.state==="running"&&"text-primary",t.state==="queued"&&"text-amber-400",t.state==="canceled"&&"text-muted-foreground"),children:t.state})]})]}),a&&e.jsx("button",{onClick:()=>we(t.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),t.state==="running"&&e.jsxs("div",{className:"mt-3 space-y-1",children:[e.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${t.progress??0}%`}})}),e.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[e.jsxs("span",{children:[t.progress??0,"%"]}),t.done_bytes!=null&&t.total_bytes!=null&&e.jsxs("span",{children:[q(t.done_bytes)," / ",q(t.total_bytes),t.rate_bps!=null&&` (${q(t.rate_bps)}/s)`]}),t.eta_s!=null&&e.jsxs("span",{children:["ETA: ",t.eta_s,"s"]})]})]})]},t.id)})})]})]}),C==="logs"&&e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:h,onChange:t=>S(t.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:O.map(t=>e.jsxs("option",{value:t.unit,children:[t.name," (",t.scope==="system"?"systemd-root":"user",")"]},t.unit))}),e.jsxs("button",{onClick:()=>ee(h),disabled:D[h],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[e.jsx(F,{className:c("h-3.5 w-3.5",D[h]&&"animate-spin")}),"Restart"]})]}),e.jsx(Qe,{service:h,text:_,loading:k,logStatus:$,onRefresh:()=>T(h),onOpenSettings:()=>w("settings")})]}),C==="settings"&&e.jsx(Xe,{open:n,showAlert:s})]})]}),L&&e.jsx(Ye,{detail:L,maintenanceJob:A,onClose:()=>U(null),onApply:fe}),f]})}export{dt as SystemDrawer};