From 38f039416657c893b723da6febc6287519ece9d0 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Sat, 27 Jun 2026 02:26:27 +0200 Subject: [PATCH] Fix: Modell-Manager Rollen-Taxonomie vereinheitlicht (5 Rollen) + echter Vocab-Check - Rollen ueberall = fast/heavy/coder/vision/scout (eine Quelle der Wahrheit): sources.py CATEGORIES (agent/reasoning raus, fast/heavy rein), llamaswap.ROLE_IDS, maintenance ROLE_MAP entfernt (Discover-Rollen == Serving-Rollen), Discover.tsx ROLE_METADATA, ModelBadges.ROLES, ActiveModelsCard (stale reasoning-Farbe raus). Behebt: Discover zeigte "Reasoning"/"agent"; aus Discover installierte Modelle landeten in keinem Cockpit-Slot. - gguf_meta: Vocab-Check jetzt ECHT - sha256 ueber die vollstaendige Token-Liste statt nur Metadaten. Familienunabhaengig (Qwen/Llama/Mistral/...). Verifiziert: Coder + Qwen3-0.6B byte-identisch (kompatibel), Qwen3.6 abweichend (inkompatibel), 0.11s/Scan. - RolesCard SPEC-Badge -> spec_active (Konsistenz mit Cockpit). Co-Authored-By: Claude Opus 4.8 --- backend/services/gguf_meta.py | 33 +++++++++++++------ backend/services/llamaswap.py | 5 +-- backend/services/maintenance.py | 16 +++------ backend/services/sources.py | 21 ++++++++---- .../{index-D9tRIUA4.js => index-CrPS-3Fn.js} | 22 ++++++------- frontend/dist/index.html | 2 +- .../components/dashboard/ActiveModelsCard.tsx | 1 - .../src/components/dashboard/RolesCard.tsx | 2 +- .../src/components/models/ModelBadges.tsx | 3 +- frontend/src/views/models/Discover.tsx | 33 ++++++++++--------- 10 files changed, 76 insertions(+), 62 deletions(-) rename frontend/dist/assets/{index-D9tRIUA4.js => index-CrPS-3Fn.js} (82%) diff --git a/backend/services/gguf_meta.py b/backend/services/gguf_meta.py index e0e712b..dd7f39f 100644 --- a/backend/services/gguf_meta.py +++ b/backend/services/gguf_meta.py @@ -11,6 +11,7 @@ Fälle zu unterscheiden (Qwen2.5 vs Qwen3 vs Qwen3.6 etc.). Die llama.cpp-Prüfu beim Laden bleibt der letzte Schiedsrichter. """ +import hashlib import struct from functools import lru_cache @@ -79,16 +80,26 @@ def _read_fingerprint(path: str) -> dict | None: r.u32() # version r.u64() # tensor_count kv_count = r.u64() - fp: dict = {"model": None, "pre": None, "arch": None, "n_vocab": None} + fp: dict = {"model": None, "pre": None, "arch": None, "n_vocab": None, + "tokens_sha": None} for _ in range(kv_count): key = r.gstr() vtype = r.u32() if key == "tokenizer.ggml.tokens" and vtype == _T_ARRAY: etype = r.u32() - fp["n_vocab"] = r.u64() - # Wir haben alles (model/pre kommen vor tokens) → abbrechen. + count = r.u64() + fp["n_vocab"] = count if etype != _T_STRING: return None + # ECHTE Vocab-Identität: sha256 über die tatsächliche Token-Liste + # (familienunabhängig — funktioniert für Qwen, Llama, Mistral, …). + h = hashlib.sha256() + h.update(count.to_bytes(8, "little")) + for _ in range(count): + n = r.u64() + h.update(r.read(n)) + fp["tokens_sha"] = h.hexdigest() + # model/pre kommen vor tokens → wir haben alles. Abbrechen. break if key in _WANT_STRINGS and vtype == _T_STRING: val = r.gstr() @@ -112,12 +123,12 @@ def _cached(path: str, mtime: float, size: int) -> tuple | None: fp = _read_fingerprint(path) if fp is None: return None - return (fp.get("model"), fp.get("pre"), fp.get("n_vocab"), fp.get("arch")) + return (fp.get("model"), fp.get("pre"), fp.get("n_vocab"), fp.get("arch"), fp.get("tokens_sha")) def fingerprint(path: str) -> dict | None: """Tokenizer-Fingerprint eines GGUF (gecacht nach Pfad+mtime+size). - Returns dict(model, pre, n_vocab, arch) oder None wenn nicht lesbar.""" + Returns dict(model, pre, n_vocab, arch, tokens_sha) oder None wenn nicht lesbar.""" import os try: st = os.stat(path) @@ -126,16 +137,18 @@ def fingerprint(path: str) -> dict | None: t = _cached(path, st.st_mtime, st.st_size) if t is None: return None - return {"model": t[0], "pre": t[1], "n_vocab": t[2], "arch": t[3]} + return {"model": t[0], "pre": t[1], "n_vocab": t[2], "arch": t[3], "tokens_sha": t[4]} def vocab_key(path: str) -> tuple | None: - """Vergleichsschlüssel für Vocab-Kompatibilität: (model, pre, n_vocab). - Genau diese Identität verlangt llama.cpp für Speculative Decoding.""" + """ECHTER Vergleichsschlüssel für Vocab-Kompatibilität: (model, pre, n_vocab, sha256 + der vollständigen Token-Liste). Vergleicht den TATSÄCHLICHEN Vokabular-Inhalt, nicht + nur Metadaten — familienunabhängig (Qwen, Llama, Mistral, …). Genau diese Identität + verlangt llama.cpp für Speculative Decoding.""" fp = fingerprint(path) - if not fp or fp["n_vocab"] is None: + if not fp or fp["n_vocab"] is None or not fp.get("tokens_sha"): return None - return (fp["model"], fp["pre"], fp["n_vocab"]) + return (fp["model"], fp["pre"], fp["n_vocab"], fp["tokens_sha"]) def compatible(target_path: str, draft_path: str) -> bool | None: diff --git a/backend/services/llamaswap.py b/backend/services/llamaswap.py index a508c46..98f1645 100644 --- a/backend/services/llamaswap.py +++ b/backend/services/llamaswap.py @@ -20,8 +20,9 @@ from config import ( log = logging.getLogger(__name__) -# Kanonische Rollen (vereinheitlicht ggü. v1: kein manager/reviewer mehr). -ROLE_IDS = {"vision", "coder", "agent", "scout"} +# Kanonische Serving-Rollen — EINE Quelle der Wahrheit (identisch zu sources.ROLE_IDS, +# maintenance, frontend ModelBadges.ROLES). Kein agent/reasoning mehr. +ROLE_IDS = {"fast", "heavy", "coder", "vision", "scout"} _CTX_RE = re.compile(r"-(?:c|-ctx-size)\s+(\d+)") _PATH_RE = re.compile(r"-(?:m|-model)\s+([^\s]+)") diff --git a/backend/services/maintenance.py b/backend/services/maintenance.py index f8a0f3a..36993e4 100644 --- a/backend/services/maintenance.py +++ b/backend/services/maintenance.py @@ -168,19 +168,11 @@ def model_upgrades() -> list[dict]: cmds = " ".join(str(s.get("cmd", "")).lower() for s in (llamaswap.read_config().get("models") or {}).values()) out = [] - - ROLE_MAP = { - "agent": "fast", - "scout": "fast", - "coder": "coder", - "vision": "vision" - } + # Discover-Rollen == Serving-Rollen (fast/heavy/coder/vision/scout) → kein Mapping mehr. for c in disc.get("categories", []): - disc_role = c["role"] - mapped_role = ROLE_MAP.get(disc_role, disc_role) - - if mapped_role not in active_roles: + role = c["role"] + if role not in active_roles: # nur Rollen, die bereits ein Modell haben continue rec = c.get("recommended") @@ -190,7 +182,7 @@ def model_upgrades() -> list[dict]: stem = base[:-5] if base.endswith("-gguf") else base if base in cmds or (stem and stem in cmds): continue - out.append({"role": mapped_role, "title": c["title"], "repo": rec}) + out.append({"role": role, "title": c["title"], "repo": rec}) return out diff --git a/backend/services/sources.py b/backend/services/sources.py index 05d4945..22a900a 100644 --- a/backend/services/sources.py +++ b/backend/services/sources.py @@ -1,24 +1,31 @@ """ Vertrauenswürdige Quellen + Kategorien für die automatische Modell-Entdeckung. -Portiert aus Mission Control v1 (sources.py). Rollen sind die EINE Quelle der -Wahrheit (vereinheitlicht): vision · coder · agent · scout. +Rollen = die EINE Quelle der Wahrheit, identisch zu den llama-swap-Serving-Rollen +und der UI: fast · heavy · coder · vision · scout. """ # HF-Orgs, die zuverlässig aktuelle, hochwertige GGUF-Quants veröffentlichen. TRUSTED_AUTHORS = ["unsloth", "bartowski", "ggml-org", "lmstudio-community"] +# Kanonische Rollen — eine Quelle der Wahrheit (deckt sich mit llamaswap.ROLE_IDS, +# maintenance.ROLE_MAP, frontend ModelBadges.ROLES + Discover.ROLE_METADATA). +ROLE_IDS = ["fast", "heavy", "coder", "vision", "scout"] + # Kategorien (Reihenfolge = Anzeige + Zuordnungs-Priorität). Ein Modell wird der # ERSTEN Kategorie zugeordnet, deren Stichwort im Repo-Namen vorkommt; sonst „scout". -# Die `role` ist zugleich der Alias-Vorschlag und gehört zu ROLE_IDS. +# Die `role` ist zugleich der Alias-Vorschlag und EINE der 5 kanonischen Rollen. CATEGORIES = [ {"role": "vision", "title": "Bilder verstehen", "icon": "eye", "kw": ["-vl-", "-vl", "vision", "llava", "multimodal", "-mm-", "pixtral"]}, {"role": "coder", "title": "Coden & Programmieren", "icon": "code", "kw": ["coder", "-code-", "code-", "codestral", "starcoder"]}, - {"role": "agent", "title": "Agenten & Tool-Use", "icon": "layers", - "kw": ["hermes", "-tool", "command-r", "watt", "-fc-", "function"]}, - {"role": "scout", "title": "Allrounder & Chat", "icon": "compass", - "kw": []}, # Fallback: instruct/chat-Modelle + {"role": "heavy", "title": "Schweres Reasoning", "icon": "brain", + "kw": ["reasoning", "-think", "thinking", "gpt-oss", "deepseek-r", "-r1", "qwq", + "-70b", "-72b", "-120b", "-123b", "-235b", "-405b", "-a10b", "-a22b"]}, + {"role": "fast", "title": "Schnelles Alltags-Hirn", "icon": "zap", + "kw": ["-a3b", "-a1", "-a2", "-30b", "-32b", "-14b", "-8b", "-7b", "-4b", "-moe"]}, + {"role": "scout", "title": "Multimodal-Allrounder", "icon": "compass", + "kw": []}, # Fallback: instruct/chat-Modelle, die in keine Spezialrolle fallen ] # Repo-Namensteile, die bei der Entdeckung übersprungen werden (Roh-/Spezialformate). diff --git a/frontend/dist/assets/index-D9tRIUA4.js b/frontend/dist/assets/index-CrPS-3Fn.js similarity index 82% rename from frontend/dist/assets/index-D9tRIUA4.js rename to frontend/dist/assets/index-CrPS-3Fn.js index 7440764..fa8c523 100644 --- a/frontend/dist/assets/index-D9tRIUA4.js +++ b/frontend/dist/assets/index-CrPS-3Fn.js @@ -77,7 +77,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const To=pe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + */const ya=pe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -87,7 +87,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lo=pe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const To=pe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -167,7 +167,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ya=pe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + */const ba=pe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -207,7 +207,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zo=pe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const Lo=pe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -297,7 +297,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ba=pe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const wa=pe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -317,7 +317,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fo=pe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const zo=pe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -327,7 +327,7 @@ Error generating stack: `+d.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wa=pe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Xc=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:R0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:g0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:Ot},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Lo},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:T0},{id:"agent",label:"Hermes",hint:"Agent-Status & AnythingLLM öffnen",icon:To},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:j0}];var Pp=1,V0=.9,H0=.8,G0=.17,wc=.1,jc=.999,W0=.9999,K0=.99,Q0=/[\\\/_+.#"@\[\(\{&]/,q0=/[\\\/_+.#"@\[\(\{&]/g,Z0=/[\s-]/,Rh=/[\s-]/g;function ed(s,o,a,c,u,f,m){if(f===o.length)return u===s.length?Pp:K0;var p=`${u},${f}`;if(m[p]!==void 0)return m[p];for(var v=c.charAt(f),x=a.indexOf(v,u),b=0,w,P,O,z;x>=0;)w=ed(s,o,a,c,x+1,f+1,m),w>b&&(x===u?w*=Pp:Q0.test(s.charAt(x-1))?(w*=H0,O=s.slice(u,x-1).match(q0),O&&u>0&&(w*=Math.pow(jc,O.length))):Z0.test(s.charAt(x-1))?(w*=V0,z=s.slice(u,x-1).match(Rh),z&&u>0&&(w*=Math.pow(jc,z.length))):(w*=G0,u>0&&(w*=Math.pow(jc,x-u))),s.charAt(x)!==o.charAt(f)&&(w*=W0)),(ww&&(w=P*wc)),w>b&&(b=w),x=a.indexOf(v,x+1);return m[p]=b,b}function Mp(s){return s.toLowerCase().replace(Rh," ")}function Y0(s,o,a){return s=a&&a.length>0?`${s+" "+a.join(" ")}`:s,ed(s,o,Mp(s),Mp(o),0,0,{})}function rn(s,o,{checkForDefaultPrevented:a=!0}={}){return function(u){if(s==null||s(u),a===!1||!u.defaultPrevented)return o==null?void 0:o(u)}}function Rp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function As(...s){return o=>{let a=!1;const c=s.map(u=>{const f=Rp(u,o);return!a&&typeof f=="function"&&(a=!0),f});if(a)return()=>{for(let u=0;u{var M;const{scope:P,children:O,...z}=w,j=((M=P==null?void 0:P[s])==null?void 0:M[v])||p,N=g.useMemo(()=>z,Object.values(z));return r.jsx(j.Provider,{value:N,children:O})};x.displayName=f+"Provider";function b(w,P){var j;const O=((j=P==null?void 0:P[s])==null?void 0:j[v])||p,z=g.useContext(O);if(z)return z;if(m!==void 0)return m;throw new Error(`\`${w}\` must be used within \`${f}\``)}return[x,b]}const u=()=>{const f=a.map(m=>g.createContext(m));return function(p){const v=(p==null?void 0:p[s])||f;return g.useMemo(()=>({[`__scope${s}`]:{...p,[s]:v}}),[p,v])}};return u.scopeName=s,[c,X0(u,...o)]}function X0(...s){const o=s[0];if(s.length===1)return o;const a=()=>{const c=s.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(f){const m=c.reduce((p,{useScope:v,scopeName:x})=>{const w=v(f)[`__scope${x}`];return{...p,...w}},{});return g.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return a.scopeName=o.scopeName,a}var Io=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},ev=id[" useId ".trim().toString()]||(()=>{}),tv=0;function br(s){const[o,a]=g.useState(ev());return Io(()=>{a(c=>c??String(tv++))},[s]),o?`radix-${o}`:""}var rv=id[" useInsertionEffect ".trim().toString()]||Io;function nv({prop:s,defaultProp:o,onChange:a=()=>{},caller:c}){const[u,f,m]=sv({defaultProp:o,onChange:a}),p=s!==void 0,v=p?s:u;{const b=g.useRef(s!==void 0);g.useEffect(()=>{const w=b.current;w!==p&&console.warn(`${c} is changing from ${w?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=p},[p,c])}const x=g.useCallback(b=>{var w;if(p){const P=ov(b)?b(s):b;P!==s&&((w=m.current)==null||w.call(m,P))}else f(b)},[p,s,f,m]);return[v,x]}function sv({defaultProp:s,onChange:o}){const[a,c]=g.useState(s),u=g.useRef(a),f=g.useRef(o);return rv(()=>{f.current=o},[o]),g.useEffect(()=>{var m;u.current!==a&&((m=f.current)==null||m.call(f,a),u.current=a)},[a,u]),[a,c,f]}function ov(s){return typeof s=="function"}var Oh=fh();function Dh(s){const o=g.forwardRef((a,c)=>{let{children:u,...f}=a,m=null,p=!1;const v=[];Op(u)&&typeof la=="function"&&(u=la(u._payload)),g.Children.forEach(u,P=>{var O;if(dv(P)){p=!0;const z=P;let j="child"in z.props?z.props.child:z.props.children;Op(j)&&typeof la=="function"&&(j=la(j._payload)),m=av(z,j),v.push((O=m==null?void 0:m.props)==null?void 0:O.children)}else v.push(P)}),m?m=g.cloneElement(m,void 0,v):!p&&g.Children.count(u)===1&&g.isValidElement(u)&&(m=u);const x=m?cv(m):void 0,b=zn(c,x);if(!m){if(u||u===0)throw new Error(p?hv(s):pv(s));return u}const w=iv(f,m.props??{});return m.type!==g.Fragment&&(w.ref=c?b:x),g.cloneElement(m,w)});return o.displayName=`${s}.Slot`,o}var lv=Symbol.for("radix.slottable"),av=(s,o)=>{if("child"in s.props){const a=s.props.child;return g.isValidElement(a)?g.cloneElement(a,void 0,s.props.children(a.props.children)):null}return g.isValidElement(o)?o:null};function iv(s,o){const a={...o};for(const c in o){const u=s[c],f=o[c];/^on[A-Z]/.test(c)?u&&f?a[c]=(...p)=>{const v=f(...p);return u(...p),v}:u&&(a[c]=u):c==="style"?a[c]={...u,...f}:c==="className"&&(a[c]=[u,f].filter(Boolean).join(" "))}return{...s,...a}}function cv(s){var c,u;let o=(c=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:c.get,a=o&&"isReactWarning"in o&&o.isReactWarning;return a?s.ref:(o=(u=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:u.get,a=o&&"isReactWarning"in o&&o.isReactWarning,a?s.props.ref:s.props.ref||s.ref)}function dv(s){return g.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===lv}var uv=Symbol.for("react.lazy");function Op(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===uv&&"_payload"in s&&fv(s._payload)}function fv(s){return typeof s=="object"&&s!==null&&"then"in s}var pv=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,hv=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,la=id[" use ".trim().toString()],mv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],at=mv.reduce((s,o)=>{const a=Dh(`Primitive.${o}`),c=g.forwardRef((u,f)=>{const{asChild:m,...p}=u,v=m?a:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(v,{...p,ref:f})});return c.displayName=`Primitive.${o}`,{...s,[o]:c}},{});function xv(s,o){s&&Oh.flushSync(()=>s.dispatchEvent(o))}function $o(s){const o=g.useRef(s);return g.useEffect(()=>{o.current=s}),g.useMemo(()=>((...a)=>{var c;return(c=o.current)==null?void 0:c.call(o,...a)}),[])}function gv(s,o=globalThis==null?void 0:globalThis.document){const a=$o(s);g.useEffect(()=>{const c=u=>{u.key==="Escape"&&a(u)};return o.addEventListener("keydown",c,{capture:!0}),()=>o.removeEventListener("keydown",c,{capture:!0})},[a,o])}var vv="DismissableLayer",td="dismissableLayer.update",yv="dismissableLayer.pointerDownOutside",bv="dismissableLayer.focusOutside",Dp,hd=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ah=g.forwardRef((s,o)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:v,...x}=s,b=g.useContext(hd),[w,P]=g.useState(null),O=(w==null?void 0:w.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,z]=g.useState({}),j=zn(o,ne=>P(ne)),N=Array.from(b.layers),[M]=[...b.layersWithOutsidePointerEventsDisabled].slice(-1),R=N.indexOf(M),V=w?N.indexOf(w):-1,L=b.layersWithOutsidePointerEventsDisabled.size>0,$=V>=R,I=g.useRef(!1),B=Nv(ne=>{const ve=ne.target;if(!(ve instanceof Node))return;const ye=[...b.branches].some(ue=>ue.contains(ve));!$||ye||(f==null||f(ne),p==null||p(ne),ne.defaultPrevented||v==null||v())},{ownerDocument:O,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:b.dismissableSurfaces}),X=Sv(ne=>{if(c&&I.current)return;const ve=ne.target;[...b.branches].some(ue=>ue.contains(ve))||(m==null||m(ne),p==null||p(ne),ne.defaultPrevented||v==null||v())},O);return gv(ne=>{V===b.layers.size-1&&(u==null||u(ne),!ne.defaultPrevented&&v&&(ne.preventDefault(),v()))},O),g.useEffect(()=>{if(w)return a&&(b.layersWithOutsidePointerEventsDisabled.size===0&&(Dp=O.body.style.pointerEvents,O.body.style.pointerEvents="none"),b.layersWithOutsidePointerEventsDisabled.add(w)),b.layers.add(w),Ap(),()=>{a&&(b.layersWithOutsidePointerEventsDisabled.delete(w),b.layersWithOutsidePointerEventsDisabled.size===0&&(O.body.style.pointerEvents=Dp))}},[w,O,a,b]),g.useEffect(()=>()=>{w&&(b.layers.delete(w),b.layersWithOutsidePointerEventsDisabled.delete(w),Ap())},[w,b]),g.useEffect(()=>{const ne=()=>z({});return document.addEventListener(td,ne),()=>document.removeEventListener(td,ne)},[]),r.jsx(at.div,{...x,ref:j,style:{pointerEvents:L?$?"auto":"none":void 0,...s.style},onFocusCapture:rn(s.onFocusCapture,X.onFocusCapture),onBlurCapture:rn(s.onBlurCapture,X.onBlurCapture),onPointerDownCapture:rn(s.onPointerDownCapture,B.onPointerDownCapture)})});Ah.displayName=vv;var wv="DismissableLayerBranch",jv=g.forwardRef((s,o)=>{const a=g.useContext(hd),c=g.useRef(null),u=zn(o,c);return g.useEffect(()=>{const f=c.current;if(f)return a.branches.add(f),()=>{a.branches.delete(f)}},[a.branches]),r.jsx(at.div,{...s,ref:u})});jv.displayName=wv;function kv(){const s=g.useContext(hd),[o,a]=g.useState(null);return g.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),a}function Nv(s,o){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:u,dismissableSurfaces:f}=o,m=$o(s),p=g.useRef(!1),v=g.useRef(!1),x=g.useRef(new Map),b=g.useRef(()=>{});return g.useEffect(()=>{function w(){v.current=!1,u.current=!1,x.current.clear()}function P(){return Array.from(x.current.values()).some(Boolean)}function O(R){if(!v.current)return;const V=R.target;V instanceof Node&&[...f].some($=>$.contains(V))||x.current.set(R.type,!0),R.type==="click"&&window.setTimeout(()=>{v.current&&b.current()},0)}function z(R){v.current&&x.current.set(R.type,!1)}const j=R=>{if(R.target&&!p.current){let V=function(){a.removeEventListener("click",b.current);const $=P();w(),$||Th(yv,m,L,{discrete:!0})};const L={originalEvent:R};v.current=!0,u.current=c&&R.button===0,x.current.clear(),!c||R.button!==0?V():(a.removeEventListener("click",b.current),b.current=V,a.addEventListener("click",b.current,{once:!0}))}else a.removeEventListener("click",b.current),w();p.current=!1},N=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const R of N)a.addEventListener(R,O,!0),a.addEventListener(R,z);const M=window.setTimeout(()=>{a.addEventListener("pointerdown",j)},0);return()=>{window.clearTimeout(M),a.removeEventListener("pointerdown",j),a.removeEventListener("click",b.current);for(const R of N)a.removeEventListener(R,O,!0),a.removeEventListener(R,z)}},[a,m,c,u,f]),{onPointerDownCapture:()=>p.current=!0}}function Sv(s,o=globalThis==null?void 0:globalThis.document){const a=$o(s),c=g.useRef(!1);return g.useEffect(()=>{const u=f=>{f.target&&!c.current&&Th(bv,a,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",u),()=>o.removeEventListener("focusin",u)},[o,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Ap(){const s=new CustomEvent(td);document.dispatchEvent(s)}function Th(s,o,a,{discrete:c}){const u=a.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:a});o&&u.addEventListener(s,o,{once:!0}),c?xv(u,f):u.dispatchEvent(f)}var kc="focusScope.autoFocusOnMount",Nc="focusScope.autoFocusOnUnmount",Tp={bubbles:!1,cancelable:!0},Cv="FocusScope",Lh=g.forwardRef((s,o)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:u,onUnmountAutoFocus:f,...m}=s,[p,v]=g.useState(null),x=$o(u),b=$o(f),w=g.useRef(null),P=zn(o,j=>v(j)),O=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(c){let j=function(V){if(O.paused||!p)return;const L=V.target;p.contains(L)?w.current=L:Wr(w.current,{select:!0})},N=function(V){if(O.paused||!p)return;const L=V.relatedTarget;L!==null&&(p.contains(L)||Wr(w.current,{select:!0}))},M=function(V){if(document.activeElement===document.body)for(const $ of V)$.removedNodes.length>0&&Wr(p)};document.addEventListener("focusin",j),document.addEventListener("focusout",N);const R=new MutationObserver(M);return p&&R.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",N),R.disconnect()}}},[c,p,O.paused]),g.useEffect(()=>{if(p){zp.add(O);const j=document.activeElement;if(!p.contains(j)){const M=new CustomEvent(kc,Tp);p.addEventListener(kc,x),p.dispatchEvent(M),M.defaultPrevented||(Ev(Ov(zh(p)),{select:!0}),document.activeElement===j&&Wr(p))}return()=>{p.removeEventListener(kc,x),setTimeout(()=>{const M=new CustomEvent(Nc,Tp);p.addEventListener(Nc,b),p.dispatchEvent(M),M.defaultPrevented||Wr(j??document.body,{select:!0}),p.removeEventListener(Nc,b),zp.remove(O)},0)}}},[p,x,b,O]);const z=g.useCallback(j=>{if(!a&&!c||O.paused)return;const N=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,M=document.activeElement;if(N&&M){const R=j.currentTarget,[V,L]=_v(R);V&&L?!j.shiftKey&&M===L?(j.preventDefault(),a&&Wr(V,{select:!0})):j.shiftKey&&M===V&&(j.preventDefault(),a&&Wr(L,{select:!0})):M===R&&j.preventDefault()}},[a,c,O.paused]);return r.jsx(at.div,{tabIndex:-1,...m,ref:P,onKeyDown:z})});Lh.displayName=Cv;function Ev(s,{select:o=!1}={}){const a=document.activeElement;for(const c of s)if(Wr(c,{select:o}),document.activeElement!==a)return}function _v(s){const o=zh(s),a=Lp(o,s),c=Lp(o.reverse(),s);return[a,c]}function zh(s){const o=[],a=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const u=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||u?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)o.push(a.currentNode);return o}function Lp(s,o){for(const a of s)if(!Pv(a,{upTo:o}))return a}function Pv(s,{upTo:o}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(o!==void 0&&s===o)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function Mv(s){return s instanceof HTMLInputElement&&"select"in s}function Wr(s,{select:o=!1}={}){if(s&&s.focus){const a=document.activeElement;s.focus({preventScroll:!0}),s!==a&&Mv(s)&&o&&s.select()}}var zp=Rv();function Rv(){let s=[];return{add(o){const a=s[0];o!==a&&(a==null||a.pause()),s=Fp(s,o),s.unshift(o)},remove(o){var a;s=Fp(s,o),(a=s[0])==null||a.resume()}}}function Fp(s,o){const a=[...s],c=a.indexOf(o);return c!==-1&&a.splice(c,1),a}function Ov(s){return s.filter(o=>o.tagName!=="A")}var Dv="Portal",Fh=g.forwardRef((s,o)=>{var p;const{container:a,...c}=s,[u,f]=g.useState(!1);Io(()=>f(!0),[]);const m=a||u&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return m?Oh.createPortal(r.jsx(at.div,{...c,ref:o}),m):null});Fh.displayName=Dv;function Av(s,o){return g.useReducer((a,c)=>o[a][c]??a,s)}var ka=s=>{const{present:o,children:a}=s,c=Tv(o),u=typeof a=="function"?a({present:c.isPresent}):g.Children.only(a),f=Lv(c.ref,zv(u));return typeof a=="function"||c.isPresent?g.cloneElement(u,{ref:f}):null};ka.displayName="Presence";function Tv(s){const[o,a]=g.useState(),c=g.useRef(null),u=g.useRef(s),f=g.useRef("none"),m=s?"mounted":"unmounted",[p,v]=Av(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const x=aa(c.current);f.current=p==="mounted"?x:"none"},[p]),Io(()=>{const x=c.current,b=u.current;if(b!==s){const P=f.current,O=aa(x);s?v("MOUNT"):O==="none"||(x==null?void 0:x.display)==="none"?v("UNMOUNT"):v(b&&P!==O?"ANIMATION_OUT":"UNMOUNT"),u.current=s}},[s,v]),Io(()=>{if(o){let x;const b=o.ownerDocument.defaultView??window,w=O=>{const j=aa(c.current).includes(CSS.escape(O.animationName));if(O.target===o&&j&&(v("ANIMATION_END"),!u.current)){const N=o.style.animationFillMode;o.style.animationFillMode="forwards",x=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=N)})}},P=O=>{O.target===o&&(f.current=aa(c.current))};return o.addEventListener("animationstart",P),o.addEventListener("animationcancel",w),o.addEventListener("animationend",w),()=>{b.clearTimeout(x),o.removeEventListener("animationstart",P),o.removeEventListener("animationcancel",w),o.removeEventListener("animationend",w)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:g.useCallback(x=>{c.current=x?getComputedStyle(x):null,a(x)},[])}}function Ip(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Lv(...s){const o=g.useRef(s);return o.current=s,g.useCallback(a=>{const c=o.current;let u=!1;const f=c.map(m=>{const p=Ip(m,a);return!u&&typeof p=="function"&&(u=!0),p});if(u)return()=>{for(let m=0;m{tr||(tr={start:$p(),end:$p()});const{start:s,end:o}=tr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),ia++,()=>{ia===1&&(tr==null||tr.start.remove(),tr==null||tr.end.remove(),tr=null),ia=Math.max(0,ia-1)}},[])}function $p(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var or=function(){return or=Object.assign||function(o){for(var a,c=1,u=arguments.length;c"u")return ty;var o=ry(s),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,c-a+o[2]-o[0])}},sy=Bh(),vs="data-scroll-locked",oy=function(s,o,a,c){var u=s.left,f=s.top,m=s.right,p=s.gap;return a===void 0&&(a="margin"),` + */const Fo=pe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Xc=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:R0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:g0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:Ot},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:To},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:T0},{id:"agent",label:"Hermes",hint:"Agent-Status & AnythingLLM öffnen",icon:ya},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:j0}];var Pp=1,V0=.9,H0=.8,G0=.17,wc=.1,jc=.999,W0=.9999,K0=.99,Q0=/[\\\/_+.#"@\[\(\{&]/,q0=/[\\\/_+.#"@\[\(\{&]/g,Z0=/[\s-]/,Rh=/[\s-]/g;function ed(s,o,a,c,u,f,m){if(f===o.length)return u===s.length?Pp:K0;var p=`${u},${f}`;if(m[p]!==void 0)return m[p];for(var v=c.charAt(f),x=a.indexOf(v,u),b=0,w,P,O,z;x>=0;)w=ed(s,o,a,c,x+1,f+1,m),w>b&&(x===u?w*=Pp:Q0.test(s.charAt(x-1))?(w*=H0,O=s.slice(u,x-1).match(q0),O&&u>0&&(w*=Math.pow(jc,O.length))):Z0.test(s.charAt(x-1))?(w*=V0,z=s.slice(u,x-1).match(Rh),z&&u>0&&(w*=Math.pow(jc,z.length))):(w*=G0,u>0&&(w*=Math.pow(jc,x-u))),s.charAt(x)!==o.charAt(f)&&(w*=W0)),(ww&&(w=P*wc)),w>b&&(b=w),x=a.indexOf(v,x+1);return m[p]=b,b}function Mp(s){return s.toLowerCase().replace(Rh," ")}function Y0(s,o,a){return s=a&&a.length>0?`${s+" "+a.join(" ")}`:s,ed(s,o,Mp(s),Mp(o),0,0,{})}function rn(s,o,{checkForDefaultPrevented:a=!0}={}){return function(u){if(s==null||s(u),a===!1||!u.defaultPrevented)return o==null?void 0:o(u)}}function Rp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function As(...s){return o=>{let a=!1;const c=s.map(u=>{const f=Rp(u,o);return!a&&typeof f=="function"&&(a=!0),f});if(a)return()=>{for(let u=0;u{var M;const{scope:P,children:O,...z}=w,j=((M=P==null?void 0:P[s])==null?void 0:M[v])||p,N=g.useMemo(()=>z,Object.values(z));return r.jsx(j.Provider,{value:N,children:O})};x.displayName=f+"Provider";function b(w,P){var j;const O=((j=P==null?void 0:P[s])==null?void 0:j[v])||p,z=g.useContext(O);if(z)return z;if(m!==void 0)return m;throw new Error(`\`${w}\` must be used within \`${f}\``)}return[x,b]}const u=()=>{const f=a.map(m=>g.createContext(m));return function(p){const v=(p==null?void 0:p[s])||f;return g.useMemo(()=>({[`__scope${s}`]:{...p,[s]:v}}),[p,v])}};return u.scopeName=s,[c,X0(u,...o)]}function X0(...s){const o=s[0];if(s.length===1)return o;const a=()=>{const c=s.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(f){const m=c.reduce((p,{useScope:v,scopeName:x})=>{const w=v(f)[`__scope${x}`];return{...p,...w}},{});return g.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return a.scopeName=o.scopeName,a}var Io=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},ev=id[" useId ".trim().toString()]||(()=>{}),tv=0;function br(s){const[o,a]=g.useState(ev());return Io(()=>{a(c=>c??String(tv++))},[s]),o?`radix-${o}`:""}var rv=id[" useInsertionEffect ".trim().toString()]||Io;function nv({prop:s,defaultProp:o,onChange:a=()=>{},caller:c}){const[u,f,m]=sv({defaultProp:o,onChange:a}),p=s!==void 0,v=p?s:u;{const b=g.useRef(s!==void 0);g.useEffect(()=>{const w=b.current;w!==p&&console.warn(`${c} is changing from ${w?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=p},[p,c])}const x=g.useCallback(b=>{var w;if(p){const P=ov(b)?b(s):b;P!==s&&((w=m.current)==null||w.call(m,P))}else f(b)},[p,s,f,m]);return[v,x]}function sv({defaultProp:s,onChange:o}){const[a,c]=g.useState(s),u=g.useRef(a),f=g.useRef(o);return rv(()=>{f.current=o},[o]),g.useEffect(()=>{var m;u.current!==a&&((m=f.current)==null||m.call(f,a),u.current=a)},[a,u]),[a,c,f]}function ov(s){return typeof s=="function"}var Oh=fh();function Dh(s){const o=g.forwardRef((a,c)=>{let{children:u,...f}=a,m=null,p=!1;const v=[];Op(u)&&typeof la=="function"&&(u=la(u._payload)),g.Children.forEach(u,P=>{var O;if(dv(P)){p=!0;const z=P;let j="child"in z.props?z.props.child:z.props.children;Op(j)&&typeof la=="function"&&(j=la(j._payload)),m=av(z,j),v.push((O=m==null?void 0:m.props)==null?void 0:O.children)}else v.push(P)}),m?m=g.cloneElement(m,void 0,v):!p&&g.Children.count(u)===1&&g.isValidElement(u)&&(m=u);const x=m?cv(m):void 0,b=zn(c,x);if(!m){if(u||u===0)throw new Error(p?hv(s):pv(s));return u}const w=iv(f,m.props??{});return m.type!==g.Fragment&&(w.ref=c?b:x),g.cloneElement(m,w)});return o.displayName=`${s}.Slot`,o}var lv=Symbol.for("radix.slottable"),av=(s,o)=>{if("child"in s.props){const a=s.props.child;return g.isValidElement(a)?g.cloneElement(a,void 0,s.props.children(a.props.children)):null}return g.isValidElement(o)?o:null};function iv(s,o){const a={...o};for(const c in o){const u=s[c],f=o[c];/^on[A-Z]/.test(c)?u&&f?a[c]=(...p)=>{const v=f(...p);return u(...p),v}:u&&(a[c]=u):c==="style"?a[c]={...u,...f}:c==="className"&&(a[c]=[u,f].filter(Boolean).join(" "))}return{...s,...a}}function cv(s){var c,u;let o=(c=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:c.get,a=o&&"isReactWarning"in o&&o.isReactWarning;return a?s.ref:(o=(u=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:u.get,a=o&&"isReactWarning"in o&&o.isReactWarning,a?s.props.ref:s.props.ref||s.ref)}function dv(s){return g.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===lv}var uv=Symbol.for("react.lazy");function Op(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===uv&&"_payload"in s&&fv(s._payload)}function fv(s){return typeof s=="object"&&s!==null&&"then"in s}var pv=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,hv=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,la=id[" use ".trim().toString()],mv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],at=mv.reduce((s,o)=>{const a=Dh(`Primitive.${o}`),c=g.forwardRef((u,f)=>{const{asChild:m,...p}=u,v=m?a:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(v,{...p,ref:f})});return c.displayName=`Primitive.${o}`,{...s,[o]:c}},{});function xv(s,o){s&&Oh.flushSync(()=>s.dispatchEvent(o))}function $o(s){const o=g.useRef(s);return g.useEffect(()=>{o.current=s}),g.useMemo(()=>((...a)=>{var c;return(c=o.current)==null?void 0:c.call(o,...a)}),[])}function gv(s,o=globalThis==null?void 0:globalThis.document){const a=$o(s);g.useEffect(()=>{const c=u=>{u.key==="Escape"&&a(u)};return o.addEventListener("keydown",c,{capture:!0}),()=>o.removeEventListener("keydown",c,{capture:!0})},[a,o])}var vv="DismissableLayer",td="dismissableLayer.update",yv="dismissableLayer.pointerDownOutside",bv="dismissableLayer.focusOutside",Dp,hd=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ah=g.forwardRef((s,o)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:v,...x}=s,b=g.useContext(hd),[w,P]=g.useState(null),O=(w==null?void 0:w.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,z]=g.useState({}),j=zn(o,ne=>P(ne)),N=Array.from(b.layers),[M]=[...b.layersWithOutsidePointerEventsDisabled].slice(-1),R=N.indexOf(M),V=w?N.indexOf(w):-1,L=b.layersWithOutsidePointerEventsDisabled.size>0,$=V>=R,I=g.useRef(!1),B=Nv(ne=>{const ve=ne.target;if(!(ve instanceof Node))return;const ye=[...b.branches].some(ue=>ue.contains(ve));!$||ye||(f==null||f(ne),p==null||p(ne),ne.defaultPrevented||v==null||v())},{ownerDocument:O,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:b.dismissableSurfaces}),X=Sv(ne=>{if(c&&I.current)return;const ve=ne.target;[...b.branches].some(ue=>ue.contains(ve))||(m==null||m(ne),p==null||p(ne),ne.defaultPrevented||v==null||v())},O);return gv(ne=>{V===b.layers.size-1&&(u==null||u(ne),!ne.defaultPrevented&&v&&(ne.preventDefault(),v()))},O),g.useEffect(()=>{if(w)return a&&(b.layersWithOutsidePointerEventsDisabled.size===0&&(Dp=O.body.style.pointerEvents,O.body.style.pointerEvents="none"),b.layersWithOutsidePointerEventsDisabled.add(w)),b.layers.add(w),Ap(),()=>{a&&(b.layersWithOutsidePointerEventsDisabled.delete(w),b.layersWithOutsidePointerEventsDisabled.size===0&&(O.body.style.pointerEvents=Dp))}},[w,O,a,b]),g.useEffect(()=>()=>{w&&(b.layers.delete(w),b.layersWithOutsidePointerEventsDisabled.delete(w),Ap())},[w,b]),g.useEffect(()=>{const ne=()=>z({});return document.addEventListener(td,ne),()=>document.removeEventListener(td,ne)},[]),r.jsx(at.div,{...x,ref:j,style:{pointerEvents:L?$?"auto":"none":void 0,...s.style},onFocusCapture:rn(s.onFocusCapture,X.onFocusCapture),onBlurCapture:rn(s.onBlurCapture,X.onBlurCapture),onPointerDownCapture:rn(s.onPointerDownCapture,B.onPointerDownCapture)})});Ah.displayName=vv;var wv="DismissableLayerBranch",jv=g.forwardRef((s,o)=>{const a=g.useContext(hd),c=g.useRef(null),u=zn(o,c);return g.useEffect(()=>{const f=c.current;if(f)return a.branches.add(f),()=>{a.branches.delete(f)}},[a.branches]),r.jsx(at.div,{...s,ref:u})});jv.displayName=wv;function kv(){const s=g.useContext(hd),[o,a]=g.useState(null);return g.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),a}function Nv(s,o){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:u,dismissableSurfaces:f}=o,m=$o(s),p=g.useRef(!1),v=g.useRef(!1),x=g.useRef(new Map),b=g.useRef(()=>{});return g.useEffect(()=>{function w(){v.current=!1,u.current=!1,x.current.clear()}function P(){return Array.from(x.current.values()).some(Boolean)}function O(R){if(!v.current)return;const V=R.target;V instanceof Node&&[...f].some($=>$.contains(V))||x.current.set(R.type,!0),R.type==="click"&&window.setTimeout(()=>{v.current&&b.current()},0)}function z(R){v.current&&x.current.set(R.type,!1)}const j=R=>{if(R.target&&!p.current){let V=function(){a.removeEventListener("click",b.current);const $=P();w(),$||Th(yv,m,L,{discrete:!0})};const L={originalEvent:R};v.current=!0,u.current=c&&R.button===0,x.current.clear(),!c||R.button!==0?V():(a.removeEventListener("click",b.current),b.current=V,a.addEventListener("click",b.current,{once:!0}))}else a.removeEventListener("click",b.current),w();p.current=!1},N=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const R of N)a.addEventListener(R,O,!0),a.addEventListener(R,z);const M=window.setTimeout(()=>{a.addEventListener("pointerdown",j)},0);return()=>{window.clearTimeout(M),a.removeEventListener("pointerdown",j),a.removeEventListener("click",b.current);for(const R of N)a.removeEventListener(R,O,!0),a.removeEventListener(R,z)}},[a,m,c,u,f]),{onPointerDownCapture:()=>p.current=!0}}function Sv(s,o=globalThis==null?void 0:globalThis.document){const a=$o(s),c=g.useRef(!1);return g.useEffect(()=>{const u=f=>{f.target&&!c.current&&Th(bv,a,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",u),()=>o.removeEventListener("focusin",u)},[o,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Ap(){const s=new CustomEvent(td);document.dispatchEvent(s)}function Th(s,o,a,{discrete:c}){const u=a.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:a});o&&u.addEventListener(s,o,{once:!0}),c?xv(u,f):u.dispatchEvent(f)}var kc="focusScope.autoFocusOnMount",Nc="focusScope.autoFocusOnUnmount",Tp={bubbles:!1,cancelable:!0},Cv="FocusScope",Lh=g.forwardRef((s,o)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:u,onUnmountAutoFocus:f,...m}=s,[p,v]=g.useState(null),x=$o(u),b=$o(f),w=g.useRef(null),P=zn(o,j=>v(j)),O=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(c){let j=function(V){if(O.paused||!p)return;const L=V.target;p.contains(L)?w.current=L:Wr(w.current,{select:!0})},N=function(V){if(O.paused||!p)return;const L=V.relatedTarget;L!==null&&(p.contains(L)||Wr(w.current,{select:!0}))},M=function(V){if(document.activeElement===document.body)for(const $ of V)$.removedNodes.length>0&&Wr(p)};document.addEventListener("focusin",j),document.addEventListener("focusout",N);const R=new MutationObserver(M);return p&&R.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",N),R.disconnect()}}},[c,p,O.paused]),g.useEffect(()=>{if(p){zp.add(O);const j=document.activeElement;if(!p.contains(j)){const M=new CustomEvent(kc,Tp);p.addEventListener(kc,x),p.dispatchEvent(M),M.defaultPrevented||(Ev(Ov(zh(p)),{select:!0}),document.activeElement===j&&Wr(p))}return()=>{p.removeEventListener(kc,x),setTimeout(()=>{const M=new CustomEvent(Nc,Tp);p.addEventListener(Nc,b),p.dispatchEvent(M),M.defaultPrevented||Wr(j??document.body,{select:!0}),p.removeEventListener(Nc,b),zp.remove(O)},0)}}},[p,x,b,O]);const z=g.useCallback(j=>{if(!a&&!c||O.paused)return;const N=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,M=document.activeElement;if(N&&M){const R=j.currentTarget,[V,L]=_v(R);V&&L?!j.shiftKey&&M===L?(j.preventDefault(),a&&Wr(V,{select:!0})):j.shiftKey&&M===V&&(j.preventDefault(),a&&Wr(L,{select:!0})):M===R&&j.preventDefault()}},[a,c,O.paused]);return r.jsx(at.div,{tabIndex:-1,...m,ref:P,onKeyDown:z})});Lh.displayName=Cv;function Ev(s,{select:o=!1}={}){const a=document.activeElement;for(const c of s)if(Wr(c,{select:o}),document.activeElement!==a)return}function _v(s){const o=zh(s),a=Lp(o,s),c=Lp(o.reverse(),s);return[a,c]}function zh(s){const o=[],a=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const u=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||u?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)o.push(a.currentNode);return o}function Lp(s,o){for(const a of s)if(!Pv(a,{upTo:o}))return a}function Pv(s,{upTo:o}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(o!==void 0&&s===o)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function Mv(s){return s instanceof HTMLInputElement&&"select"in s}function Wr(s,{select:o=!1}={}){if(s&&s.focus){const a=document.activeElement;s.focus({preventScroll:!0}),s!==a&&Mv(s)&&o&&s.select()}}var zp=Rv();function Rv(){let s=[];return{add(o){const a=s[0];o!==a&&(a==null||a.pause()),s=Fp(s,o),s.unshift(o)},remove(o){var a;s=Fp(s,o),(a=s[0])==null||a.resume()}}}function Fp(s,o){const a=[...s],c=a.indexOf(o);return c!==-1&&a.splice(c,1),a}function Ov(s){return s.filter(o=>o.tagName!=="A")}var Dv="Portal",Fh=g.forwardRef((s,o)=>{var p;const{container:a,...c}=s,[u,f]=g.useState(!1);Io(()=>f(!0),[]);const m=a||u&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return m?Oh.createPortal(r.jsx(at.div,{...c,ref:o}),m):null});Fh.displayName=Dv;function Av(s,o){return g.useReducer((a,c)=>o[a][c]??a,s)}var ka=s=>{const{present:o,children:a}=s,c=Tv(o),u=typeof a=="function"?a({present:c.isPresent}):g.Children.only(a),f=Lv(c.ref,zv(u));return typeof a=="function"||c.isPresent?g.cloneElement(u,{ref:f}):null};ka.displayName="Presence";function Tv(s){const[o,a]=g.useState(),c=g.useRef(null),u=g.useRef(s),f=g.useRef("none"),m=s?"mounted":"unmounted",[p,v]=Av(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const x=aa(c.current);f.current=p==="mounted"?x:"none"},[p]),Io(()=>{const x=c.current,b=u.current;if(b!==s){const P=f.current,O=aa(x);s?v("MOUNT"):O==="none"||(x==null?void 0:x.display)==="none"?v("UNMOUNT"):v(b&&P!==O?"ANIMATION_OUT":"UNMOUNT"),u.current=s}},[s,v]),Io(()=>{if(o){let x;const b=o.ownerDocument.defaultView??window,w=O=>{const j=aa(c.current).includes(CSS.escape(O.animationName));if(O.target===o&&j&&(v("ANIMATION_END"),!u.current)){const N=o.style.animationFillMode;o.style.animationFillMode="forwards",x=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=N)})}},P=O=>{O.target===o&&(f.current=aa(c.current))};return o.addEventListener("animationstart",P),o.addEventListener("animationcancel",w),o.addEventListener("animationend",w),()=>{b.clearTimeout(x),o.removeEventListener("animationstart",P),o.removeEventListener("animationcancel",w),o.removeEventListener("animationend",w)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:g.useCallback(x=>{c.current=x?getComputedStyle(x):null,a(x)},[])}}function Ip(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Lv(...s){const o=g.useRef(s);return o.current=s,g.useCallback(a=>{const c=o.current;let u=!1;const f=c.map(m=>{const p=Ip(m,a);return!u&&typeof p=="function"&&(u=!0),p});if(u)return()=>{for(let m=0;m{tr||(tr={start:$p(),end:$p()});const{start:s,end:o}=tr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),ia++,()=>{ia===1&&(tr==null||tr.start.remove(),tr==null||tr.end.remove(),tr=null),ia=Math.max(0,ia-1)}},[])}function $p(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var or=function(){return or=Object.assign||function(o){for(var a,c=1,u=arguments.length;c"u")return ty;var o=ry(s),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,c-a+o[2]-o[0])}},sy=Bh(),vs="data-scroll-locked",oy=function(s,o,a,c){var u=s.left,f=s.top,m=s.right,p=s.gap;return a===void 0&&(a="margin"),` .`.concat($v,` { overflow: hidden `).concat(c,`; padding-right: `).concat(p,"px ").concat(c,`; @@ -367,7 +367,7 @@ Error generating stack: `+d.message+` `)},Bp=function(){var s=parseInt(document.body.getAttribute(vs)||"0",10);return isFinite(s)?s:0},ly=function(){g.useEffect(function(){return document.body.setAttribute(vs,(Bp()+1).toString()),function(){var s=Bp()-1;s<=0?document.body.removeAttribute(vs):document.body.setAttribute(vs,s.toString())}},[])},ay=function(s){var o=s.noRelative,a=s.noImportant,c=s.gapMode,u=c===void 0?"margin":c;ly();var f=g.useMemo(function(){return ny(u)},[u]);return g.createElement(sy,{styles:oy(f,!o,u,a?"":"!important")})},rd=!1;if(typeof window<"u")try{var ca=Object.defineProperty({},"passive",{get:function(){return rd=!0,!0}});window.addEventListener("test",ca,ca),window.removeEventListener("test",ca,ca)}catch{rd=!1}var fs=rd?{passive:!1}:!1,iy=function(s){return s.tagName==="TEXTAREA"},Vh=function(s,o){if(!(s instanceof Element))return!1;var a=window.getComputedStyle(s);return a[o]!=="hidden"&&!(a.overflowY===a.overflowX&&!iy(s)&&a[o]==="visible")},cy=function(s){return Vh(s,"overflowY")},dy=function(s){return Vh(s,"overflowX")},Vp=function(s,o){var a=o.ownerDocument,c=o;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var u=Hh(s,c);if(u){var f=Gh(s,c),m=f[1],p=f[2];if(m>p)return!0}c=c.parentNode}while(c&&c!==a.body);return!1},uy=function(s){var o=s.scrollTop,a=s.scrollHeight,c=s.clientHeight;return[o,a,c]},fy=function(s){var o=s.scrollLeft,a=s.scrollWidth,c=s.clientWidth;return[o,a,c]},Hh=function(s,o){return s==="v"?cy(o):dy(o)},Gh=function(s,o){return s==="v"?uy(o):fy(o)},py=function(s,o){return s==="h"&&o==="rtl"?-1:1},hy=function(s,o,a,c,u){var f=py(s,window.getComputedStyle(o).direction),m=f*c,p=a.target,v=o.contains(p),x=!1,b=m>0,w=0,P=0;do{if(!p)break;var O=Gh(s,p),z=O[0],j=O[1],N=O[2],M=j-N-f*z;(z||M)&&Hh(s,p)&&(w+=M,P+=z);var R=p.parentNode;p=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!v&&p!==document.body||v&&(o.contains(p)||o===p));return(b&&Math.abs(w)<1||!b&&Math.abs(P)<1)&&(x=!0),x},da=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},Hp=function(s){return[s.deltaX,s.deltaY]},Gp=function(s){return s&&"current"in s?s.current:s},my=function(s,o){return s[0]===o[0]&&s[1]===o[1]},xy=function(s){return` .block-interactivity-`.concat(s,` {pointer-events: none;} .allow-interactivity-`).concat(s,` {pointer-events: all;} -`)},gy=0,ps=[];function vy(s){var o=g.useRef([]),a=g.useRef([0,0]),c=g.useRef(),u=g.useState(gy++)[0],f=g.useState(Bh)[0],m=g.useRef(s);g.useEffect(function(){m.current=s},[s]),g.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(u));var j=Iv([s.lockRef.current],(s.shards||[]).map(Gp),!0).filter(Boolean);return j.forEach(function(N){return N.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),j.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(u))})}}},[s.inert,s.lockRef.current,s.shards]);var p=g.useCallback(function(j,N){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!m.current.allowPinchZoom;var M=da(j),R=a.current,V="deltaX"in j?j.deltaX:R[0]-M[0],L="deltaY"in j?j.deltaY:R[1]-M[1],$,I=j.target,B=Math.abs(V)>Math.abs(L)?"h":"v";if("touches"in j&&B==="h"&&I.type==="range")return!1;var X=window.getSelection(),ne=X&&X.anchorNode,ve=ne?ne===I||ne.contains(I):!1;if(ve)return!1;var ye=Vp(B,I);if(!ye)return!0;if(ye?$=B:($=B==="v"?"h":"v",ye=Vp(B,I)),!ye)return!1;if(!c.current&&"changedTouches"in j&&(V||L)&&(c.current=$),!$)return!0;var ue=c.current||$;return hy(ue,N,j,ue==="h"?V:L)},[]),v=g.useCallback(function(j){var N=j;if(!(!ps.length||ps[ps.length-1]!==f)){var M="deltaY"in N?Hp(N):da(N),R=o.current.filter(function($){return $.name===N.type&&($.target===N.target||N.target===$.shadowParent)&&my($.delta,M)})[0];if(R&&R.should){N.cancelable&&N.preventDefault();return}if(!R){var V=(m.current.shards||[]).map(Gp).filter(Boolean).filter(function($){return $.contains(N.target)}),L=V.length>0?p(N,V[0]):!m.current.noIsolation;L&&N.cancelable&&N.preventDefault()}}},[]),x=g.useCallback(function(j,N,M,R){var V={name:j,delta:N,target:M,should:R,shadowParent:yy(M)};o.current.push(V),setTimeout(function(){o.current=o.current.filter(function(L){return L!==V})},1)},[]),b=g.useCallback(function(j){a.current=da(j),c.current=void 0},[]),w=g.useCallback(function(j){x(j.type,Hp(j),j.target,p(j,s.lockRef.current))},[]),P=g.useCallback(function(j){x(j.type,da(j),j.target,p(j,s.lockRef.current))},[]);g.useEffect(function(){return ps.push(f),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:P}),document.addEventListener("wheel",v,fs),document.addEventListener("touchmove",v,fs),document.addEventListener("touchstart",b,fs),function(){ps=ps.filter(function(j){return j!==f}),document.removeEventListener("wheel",v,fs),document.removeEventListener("touchmove",v,fs),document.removeEventListener("touchstart",b,fs)}},[]);var O=s.removeScrollBar,z=s.inert;return g.createElement(g.Fragment,null,z?g.createElement(f,{styles:xy(u)}):null,O?g.createElement(ay,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function yy(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const by=Qv(Uh,vy);var Wh=g.forwardRef(function(s,o){return g.createElement(Na,or({},s,{ref:o,sideCar:by}))});Wh.classNames=Na.classNames;var wy=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},hs=new WeakMap,ua=new WeakMap,fa={},_c=0,Kh=function(s){return s&&(s.host||Kh(s.parentNode))},jy=function(s,o){return o.map(function(a){if(s.contains(a))return a;var c=Kh(a);return c&&s.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",s,". Doing nothing"),null)}).filter(function(a){return!!a})},ky=function(s,o,a,c){var u=jy(o,Array.isArray(s)?s:[s]);fa[a]||(fa[a]=new WeakMap);var f=fa[a],m=[],p=new Set,v=new Set(u),x=function(w){!w||p.has(w)||(p.add(w),x(w.parentNode))};u.forEach(x);var b=function(w){!w||v.has(w)||Array.prototype.forEach.call(w.children,function(P){if(p.has(P))b(P);else try{var O=P.getAttribute(c),z=O!==null&&O!=="false",j=(hs.get(P)||0)+1,N=(f.get(P)||0)+1;hs.set(P,j),f.set(P,N),m.push(P),j===1&&z&&ua.set(P,!0),N===1&&P.setAttribute(a,"true"),z||P.setAttribute(c,"true")}catch(M){console.error("aria-hidden: cannot operate on ",P,M)}})};return b(o),p.clear(),_c++,function(){m.forEach(function(w){var P=hs.get(w)-1,O=f.get(w)-1;hs.set(w,P),f.set(w,O),P||(ua.has(w)||w.removeAttribute(c),ua.delete(w)),O||w.removeAttribute(a)}),_c--,_c||(hs=new WeakMap,hs=new WeakMap,ua=new WeakMap,fa={})}},Ny=function(s,o,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(s)?s:[s]),u=wy(s);return u?(c.push.apply(c,Array.from(u.querySelectorAll("[aria-live], script"))),ky(c,u,a,"aria-hidden")):function(){return null}},Sa="Dialog",[Qh]=J0(Sa),[Sy,qt]=Qh(Sa),qh=s=>{const{__scopeDialog:o,children:a,open:c,defaultOpen:u,onOpenChange:f,modal:m=!0}=s,p=g.useRef(null),v=g.useRef(null),[x,b]=nv({prop:c,defaultProp:u??!1,onChange:f,caller:Sa});return r.jsx(Sy,{scope:o,triggerRef:p,contentRef:v,contentId:br(),titleId:br(),descriptionId:br(),open:x,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(w=>!w),[b]),modal:m,children:a})};qh.displayName=Sa;var Zh="DialogTrigger",Cy=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(Zh,a),f=zn(o,u.triggerRef);return r.jsx(at.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":xd(u.open),...c,ref:f,onClick:rn(s.onClick,u.onOpenToggle)})});Cy.displayName=Zh;var md="DialogPortal",[Ey,Yh]=Qh(md,{forceMount:void 0}),Jh=s=>{const{__scopeDialog:o,forceMount:a,children:c,container:u}=s,f=qt(md,o);return r.jsx(Ey,{scope:o,forceMount:a,children:g.Children.map(c,m=>r.jsx(ka,{present:a||f.open,children:r.jsx(Fh,{asChild:!0,container:u,children:m})}))})};Jh.displayName=md;var ja="DialogOverlay",Xh=g.forwardRef((s,o)=>{const a=Yh(ja,s.__scopeDialog),{forceMount:c=a.forceMount,...u}=s,f=qt(ja,s.__scopeDialog);return f.modal?r.jsx(ka,{present:c||f.open,children:r.jsx(Py,{...u,ref:o})}):null});Xh.displayName=ja;var _y=Dh("DialogOverlay.RemoveScroll"),Py=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(ja,a),f=kv(),m=zn(o,f);return r.jsx(Wh,{as:_y,allowPinchZoom:!0,shards:[u.contentRef],children:r.jsx(at.div,{"data-state":xd(u.open),...c,ref:m,style:{pointerEvents:"auto",...c.style}})})}),Ts="DialogContent",em=g.forwardRef((s,o)=>{const a=Yh(Ts,s.__scopeDialog),{forceMount:c=a.forceMount,...u}=s,f=qt(Ts,s.__scopeDialog);return r.jsx(ka,{present:c||f.open,children:f.modal?r.jsx(My,{...u,ref:o}):r.jsx(Ry,{...u,ref:o})})});em.displayName=Ts;var My=g.forwardRef((s,o)=>{const a=qt(Ts,s.__scopeDialog),c=g.useRef(null),u=zn(o,a.contentRef,c);return g.useEffect(()=>{const f=c.current;if(f)return Ny(f)},[]),r.jsx(tm,{...s,ref:u,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:rn(s.onCloseAutoFocus,f=>{var m;f.preventDefault(),(m=a.triggerRef.current)==null||m.focus()}),onPointerDownOutside:rn(s.onPointerDownOutside,f=>{const m=f.detail.originalEvent,p=m.button===0&&m.ctrlKey===!0;(m.button===2||p)&&f.preventDefault()}),onFocusOutside:rn(s.onFocusOutside,f=>f.preventDefault())})}),Ry=g.forwardRef((s,o)=>{const a=qt(Ts,s.__scopeDialog),c=g.useRef(!1),u=g.useRef(!1);return r.jsx(tm,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var m,p;(m=s.onCloseAutoFocus)==null||m.call(s,f),f.defaultPrevented||(c.current||(p=a.triggerRef.current)==null||p.focus(),f.preventDefault()),c.current=!1,u.current=!1},onInteractOutside:f=>{var v,x;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(c.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const m=f.target;((x=a.triggerRef.current)==null?void 0:x.contains(m))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})}),tm=g.forwardRef((s,o)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:u,onCloseAutoFocus:f,...m}=s,p=qt(Ts,a);return Fv(),r.jsx(r.Fragment,{children:r.jsx(Lh,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:u,onUnmountAutoFocus:f,children:r.jsx(Ah,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":xd(p.open),...m,ref:o,deferPointerDownOutside:!0,onDismiss:()=>p.onOpenChange(!1)})})})}),rm="DialogTitle",Oy=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(rm,a);return r.jsx(at.h2,{id:u.titleId,...c,ref:o})});Oy.displayName=rm;var nm="DialogDescription",Dy=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(nm,a);return r.jsx(at.p,{id:u.descriptionId,...c,ref:o})});Dy.displayName=nm;var sm="DialogClose",Ay=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(sm,a);return r.jsx(at.button,{type:"button",...c,ref:o,onClick:rn(s.onClick,()=>u.onOpenChange(!1))})});Ay.displayName=sm;function xd(s){return s?"open":"closed"}var Eo='[cmdk-group=""]',Pc='[cmdk-group-items=""]',Ty='[cmdk-group-heading=""]',om='[cmdk-item=""]',Wp=`${om}:not([aria-disabled="true"])`,nd="cmdk-item-select",xs="data-value",Ly=(s,o,a)=>Y0(s,o,a),lm=g.createContext(void 0),Qo=()=>g.useContext(lm),am=g.createContext(void 0),gd=()=>g.useContext(am),im=g.createContext(void 0),cm=g.forwardRef((s,o)=>{let a=gs(()=>{var E,Y;return{search:"",value:(Y=(E=s.value)!=null?E:s.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=gs(()=>new Set),u=gs(()=>new Map),f=gs(()=>new Map),m=gs(()=>new Set),p=dm(s),{label:v,children:x,value:b,onValueChange:w,filter:P,shouldFilter:O,loop:z,disablePointerSelection:j=!1,vimBindings:N=!0,...M}=s,R=br(),V=br(),L=br(),$=g.useRef(null),I=Ky();Ln(()=>{if(b!==void 0){let E=b.trim();a.current.value=E,B.emit()}},[b]),Ln(()=>{I(6,Re)},[]);let B=g.useMemo(()=>({subscribe:E=>(m.current.add(E),()=>m.current.delete(E)),snapshot:()=>a.current,setState:(E,Y,ee)=>{var Z,le,fe,we;if(!Object.is(a.current[E],Y)){if(a.current[E]=Y,E==="search")ue(),ve(),I(1,ye);else if(E==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(L);U?U.focus():(Z=document.getElementById(R))==null||Z.focus()}if(I(7,()=>{var U;a.current.selectedItemId=(U=Ee())==null?void 0:U.id,B.emit()}),ee||I(5,Re),((le=p.current)==null?void 0:le.value)!==void 0){let U=Y??"";(we=(fe=p.current).onValueChange)==null||we.call(fe,U);return}}B.emit()}},emit:()=>{m.current.forEach(E=>E())}}),[]),X=g.useMemo(()=>({value:(E,Y,ee)=>{var Z;Y!==((Z=f.current.get(E))==null?void 0:Z.value)&&(f.current.set(E,{value:Y,keywords:ee}),a.current.filtered.items.set(E,ne(Y,ee)),I(2,()=>{ve(),B.emit()}))},item:(E,Y)=>(c.current.add(E),Y&&(u.current.has(Y)?u.current.get(Y).add(E):u.current.set(Y,new Set([E]))),I(3,()=>{ue(),ve(),a.current.value||ye(),B.emit()}),()=>{f.current.delete(E),c.current.delete(E),a.current.filtered.items.delete(E);let ee=Ee();I(4,()=>{ue(),(ee==null?void 0:ee.getAttribute("id"))===E&&ye(),B.emit()})}),group:E=>(u.current.has(E)||u.current.set(E,new Set),()=>{f.current.delete(E),u.current.delete(E)}),filter:()=>p.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:R,inputId:L,labelId:V,listInnerRef:$}),[]);function ne(E,Y){var ee,Z;let le=(Z=(ee=p.current)==null?void 0:ee.filter)!=null?Z:Ly;return E?le(E,a.current.search,Y):0}function ve(){if(!a.current.search||p.current.shouldFilter===!1)return;let E=a.current.filtered.items,Y=[];a.current.filtered.groups.forEach(Z=>{let le=u.current.get(Z),fe=0;le.forEach(we=>{let U=E.get(we);fe=Math.max(U,fe)}),Y.push([Z,fe])});let ee=$.current;ze().sort((Z,le)=>{var fe,we;let U=Z.getAttribute("id"),he=le.getAttribute("id");return((fe=E.get(he))!=null?fe:0)-((we=E.get(U))!=null?we:0)}).forEach(Z=>{let le=Z.closest(Pc);le?le.appendChild(Z.parentElement===le?Z:Z.closest(`${Pc} > *`)):ee.appendChild(Z.parentElement===ee?Z:Z.closest(`${Pc} > *`))}),Y.sort((Z,le)=>le[1]-Z[1]).forEach(Z=>{var le;let fe=(le=$.current)==null?void 0:le.querySelector(`${Eo}[${xs}="${encodeURIComponent(Z[0])}"]`);fe==null||fe.parentElement.appendChild(fe)})}function ye(){let E=ze().find(ee=>ee.getAttribute("aria-disabled")!=="true"),Y=E==null?void 0:E.getAttribute(xs);B.setState("value",Y||void 0)}function ue(){var E,Y,ee,Z;if(!a.current.search||p.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let le=0;for(let fe of c.current){let we=(Y=(E=f.current.get(fe))==null?void 0:E.value)!=null?Y:"",U=(Z=(ee=f.current.get(fe))==null?void 0:ee.keywords)!=null?Z:[],he=ne(we,U);a.current.filtered.items.set(fe,he),he>0&&le++}for(let[fe,we]of u.current)for(let U of we)if(a.current.filtered.items.get(U)>0){a.current.filtered.groups.add(fe);break}a.current.filtered.count=le}function Re(){var E,Y,ee;let Z=Ee();Z&&(((E=Z.parentElement)==null?void 0:E.firstChild)===Z&&((ee=(Y=Z.closest(Eo))==null?void 0:Y.querySelector(Ty))==null||ee.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function Ee(){var E;return(E=$.current)==null?void 0:E.querySelector(`${om}[aria-selected="true"]`)}function ze(){var E;return Array.from(((E=$.current)==null?void 0:E.querySelectorAll(Wp))||[])}function Oe(E){let Y=ze()[E];Y&&B.setState("value",Y.getAttribute(xs))}function Pe(E){var Y;let ee=Ee(),Z=ze(),le=Z.findIndex(we=>we===ee),fe=Z[le+E];(Y=p.current)!=null&&Y.loop&&(fe=le+E<0?Z[Z.length-1]:le+E===Z.length?Z[0]:Z[le+E]),fe&&B.setState("value",fe.getAttribute(xs))}function K(E){let Y=Ee(),ee=Y==null?void 0:Y.closest(Eo),Z;for(;ee&&!Z;)ee=E>0?Gy(ee,Eo):Wy(ee,Eo),Z=ee==null?void 0:ee.querySelector(Wp);Z?B.setState("value",Z.getAttribute(xs)):Pe(E)}let se=()=>Oe(ze().length-1),Q=E=>{E.preventDefault(),E.metaKey?se():E.altKey?K(1):Pe(1)},C=E=>{E.preventDefault(),E.metaKey?Oe(0):E.altKey?K(-1):Pe(-1)};return g.createElement(at.div,{ref:o,tabIndex:-1,...M,"cmdk-root":"",onKeyDown:E=>{var Y;(Y=M.onKeyDown)==null||Y.call(M,E);let ee=E.nativeEvent.isComposing||E.keyCode===229;if(!(E.defaultPrevented||ee))switch(E.key){case"n":case"j":{N&&E.ctrlKey&&Q(E);break}case"ArrowDown":{Q(E);break}case"p":case"k":{N&&E.ctrlKey&&C(E);break}case"ArrowUp":{C(E);break}case"Home":{E.preventDefault(),Oe(0);break}case"End":{E.preventDefault(),se();break}case"Enter":{E.preventDefault();let Z=Ee();if(Z){let le=new Event(nd);Z.dispatchEvent(le)}}}}},g.createElement("label",{"cmdk-label":"",htmlFor:X.inputId,id:X.labelId,style:qy},v),Ca(s,E=>g.createElement(am.Provider,{value:B},g.createElement(lm.Provider,{value:X},E))))}),zy=g.forwardRef((s,o)=>{var a,c;let u=br(),f=g.useRef(null),m=g.useContext(im),p=Qo(),v=dm(s),x=(c=(a=v.current)==null?void 0:a.forceMount)!=null?c:m==null?void 0:m.forceMount;Ln(()=>{if(!x)return p.item(u,m==null?void 0:m.id)},[x]);let b=um(u,f,[s.value,s.children,f],s.keywords),w=gd(),P=on(I=>I.value&&I.value===b.current),O=on(I=>x||p.filter()===!1?!0:I.search?I.filtered.items.get(u)>0:!0);g.useEffect(()=>{let I=f.current;if(!(!I||s.disabled))return I.addEventListener(nd,z),()=>I.removeEventListener(nd,z)},[O,s.onSelect,s.disabled]);function z(){var I,B;j(),(B=(I=v.current).onSelect)==null||B.call(I,b.current)}function j(){w.setState("value",b.current,!0)}if(!O)return null;let{disabled:N,value:M,onSelect:R,forceMount:V,keywords:L,...$}=s;return g.createElement(at.div,{ref:As(f,o),...$,id:u,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!P,"data-disabled":!!N,"data-selected":!!P,onPointerMove:N||p.getDisablePointerSelection()?void 0:j,onClick:N?void 0:z},s.children)}),Fy=g.forwardRef((s,o)=>{let{heading:a,children:c,forceMount:u,...f}=s,m=br(),p=g.useRef(null),v=g.useRef(null),x=br(),b=Qo(),w=on(O=>u||b.filter()===!1?!0:O.search?O.filtered.groups.has(m):!0);Ln(()=>b.group(m),[]),um(m,p,[s.value,s.heading,v]);let P=g.useMemo(()=>({id:m,forceMount:u}),[u]);return g.createElement(at.div,{ref:As(p,o),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0},a&&g.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:x},a),Ca(s,O=>g.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?x:void 0},g.createElement(im.Provider,{value:P},O))))}),Iy=g.forwardRef((s,o)=>{let{alwaysRender:a,...c}=s,u=g.useRef(null),f=on(m=>!m.search);return!a&&!f?null:g.createElement(at.div,{ref:As(u,o),...c,"cmdk-separator":"",role:"separator"})}),$y=g.forwardRef((s,o)=>{let{onValueChange:a,...c}=s,u=s.value!=null,f=gd(),m=on(x=>x.search),p=on(x=>x.selectedItemId),v=Qo();return g.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),g.createElement(at.input,{ref:o,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":p,id:v.inputId,type:"text",value:u?s.value:m,onChange:x=>{u||f.setState("search",x.target.value),a==null||a(x.target.value)}})}),Uy=g.forwardRef((s,o)=>{let{children:a,label:c="Suggestions",...u}=s,f=g.useRef(null),m=g.useRef(null),p=on(x=>x.selectedItemId),v=Qo();return g.useEffect(()=>{if(m.current&&f.current){let x=m.current,b=f.current,w,P=new ResizeObserver(()=>{w=requestAnimationFrame(()=>{let O=x.offsetHeight;b.style.setProperty("--cmdk-list-height",O.toFixed(1)+"px")})});return P.observe(x),()=>{cancelAnimationFrame(w),P.unobserve(x)}}},[]),g.createElement(at.div,{ref:As(f,o),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":c,id:v.listId},Ca(s,x=>g.createElement("div",{ref:As(m,v.listInnerRef),"cmdk-list-sizer":""},x)))}),By=g.forwardRef((s,o)=>{let{open:a,onOpenChange:c,overlayClassName:u,contentClassName:f,container:m,...p}=s;return g.createElement(qh,{open:a,onOpenChange:c},g.createElement(Jh,{container:m},g.createElement(Xh,{"cmdk-overlay":"",className:u}),g.createElement(em,{"aria-label":s.label,"cmdk-dialog":"",className:f},g.createElement(cm,{ref:o,...p}))))}),Vy=g.forwardRef((s,o)=>on(a=>a.filtered.count===0)?g.createElement(at.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Hy=g.forwardRef((s,o)=>{let{progress:a,children:c,label:u="Loading...",...f}=s;return g.createElement(at.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},Ca(s,m=>g.createElement("div",{"aria-hidden":!0},m)))}),ms=Object.assign(cm,{List:Uy,Item:zy,Input:$y,Group:Fy,Separator:Iy,Dialog:By,Empty:Vy,Loading:Hy});function Gy(s,o){let a=s.nextElementSibling;for(;a;){if(a.matches(o))return a;a=a.nextElementSibling}}function Wy(s,o){let a=s.previousElementSibling;for(;a;){if(a.matches(o))return a;a=a.previousElementSibling}}function dm(s){let o=g.useRef(s);return Ln(()=>{o.current=s}),o}var Ln=typeof window>"u"?g.useEffect:g.useLayoutEffect;function gs(s){let o=g.useRef();return o.current===void 0&&(o.current=s()),o}function on(s){let o=gd(),a=()=>s(o.snapshot());return g.useSyncExternalStore(o.subscribe,a,a)}function um(s,o,a,c=[]){let u=g.useRef(),f=Qo();return Ln(()=>{var m;let p=(()=>{var x;for(let b of a){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(x=b.current.textContent)==null?void 0:x.trim():u.current}})(),v=c.map(x=>x.trim());f.value(s,p,v),(m=o.current)==null||m.setAttribute(xs,p),u.current=p}),u}var Ky=()=>{let[s,o]=g.useState(),a=gs(()=>new Map);return Ln(()=>{a.current.forEach(c=>c()),a.current=new Map},[s]),(c,u)=>{a.current.set(c,u),o({})}};function Qy(s){let o=s.type;return typeof o=="function"?o(s.props):"render"in o?o.render(s.props):s}function Ca({asChild:s,children:o},a){return s&&g.isValidElement(o)?g.cloneElement(Qy(o),{ref:o.ref},a(o.props.children)):a(o)}var qy={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Zy({onNavigate:s}){const[o,a]=g.useState(!1);return g.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key.toLowerCase()==="k"&&(u.preventDefault(),a(f=>!f))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),r.jsx(ms.Dialog,{open:o,onOpenChange:a,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>a(!1),children:r.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:c=>c.stopPropagation(),children:[r.jsx(ms.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),r.jsxs(ms.List,{className:"max-h-80 overflow-y-auto p-2",children:[r.jsx(ms.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),r.jsx(ms.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Xc.map(c=>r.jsxs(ms.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{s(c.id),a(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[r.jsx(c.icon,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:c.label}),r.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function be(s,o){var v;const a={"Content-Type":"application/json",...o==null?void 0:o.headers},c=localStorage.getItem("mc_sudo_password"),u=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let f=o==null?void 0:o.body;if((((v=o==null?void 0:o.method)==null?void 0:v.toUpperCase())||"GET")==="POST"){if(typeof f=="string")try{const x=JSON.parse(f);let b=!1;c&&!("sudo_password"in x)&&(x.sudo_password=c,b=!0),u&&!("hf_token"in x)&&(x.hf_token=u,b=!0),b&&(f=JSON.stringify(x))}catch{}else if(!f){const x={};c&&(x.sudo_password=c),u&&(x.hf_token=u),Object.keys(x).length>0&&(f=JSON.stringify(x))}}const p=await fetch(s,{...o,headers:a,body:f});if(!p.ok)throw new Error(`${p.status} ${p.statusText}`);return p.json()}const Ze={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],updates:["updates"],discover:["discover"],drafts:s=>["drafts",s??""],connect:s=>["connect",s??""],memory:(s,o)=>["memory",s??"",o??""]},Yy=()=>Dt({queryKey:Ze.health,queryFn:()=>be("/api/health"),refetchInterval:1e4}),vd=(s=5e3)=>Dt({queryKey:Ze.systemStatus,queryFn:()=>be("/api/system/status"),refetchInterval:s}),Jy=(s=3e3)=>Dt({queryKey:Ze.services,queryFn:()=>be("/api/system/services"),refetchInterval:s}),Ls=(s=4e3)=>Dt({queryKey:Ze.models,queryFn:()=>be("/api/models"),refetchInterval:s}),Xy=(s=4e3)=>Dt({queryKey:Ze.routing,queryFn:()=>be("/api/routing"),refetchInterval:s}),fm=(s=2e3)=>Dt({queryKey:Ze.jobs,queryFn:()=>be("/api/jobs"),refetchInterval:s,select:o=>o.jobs??[]}),pm=(s=3e3)=>Dt({queryKey:Ze.tokenStats,queryFn:()=>be("/api/system/token-stats"),refetchInterval:s}),hm=(s=5e3)=>Dt({queryKey:Ze.agentStatus,queryFn:()=>be("/api/agent/status"),refetchInterval:s}),yd=s=>Dt({queryKey:Ze.updates,queryFn:()=>be("/api/maintenance/updates"),refetchInterval:s}),eb=()=>Dt({queryKey:Ze.discover,queryFn:()=>be("/api/discover")}),tb=s=>Dt({queryKey:Ze.drafts(s),queryFn:()=>be(`/api/models/drafts?target=${encodeURIComponent(s??"")}`),enabled:!!s}),mm=s=>Dt({queryKey:Ze.connect(s),queryFn:()=>be(s?`/api/connect?${s}`:"/api/connect")}),xm=s=>Dt({queryKey:Ze.memory(s==null?void 0:s.q,s==null?void 0:s.category),queryFn:()=>{const o=new URLSearchParams;return s!=null&&s.q&&o.set("q",s.q),s!=null&&s.category&&o.set("category",s.category),be(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function St(s){return(s/1024**3).toFixed(1)}function sd(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function gr(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function rb(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Kp(s){return s?`${Math.round(s/1024)}k`:"—"}function gm(s){var o,a,c="";if(typeof s=="string"||typeof s=="number")c+=s;else if(typeof s=="object")if(Array.isArray(s)){var u=s.length;for(o=0;o{const o=lb(s),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=s;return{getClassGroupId:m=>{const p=m.split(bd);return p[0]===""&&p.length!==1&&p.shift(),vm(p,o)||ob(m)},getConflictingClassGroupIds:(m,p)=>{const v=a[m]||[];return p&&c[m]?[...v,...c[m]]:v}}},vm=(s,o)=>{var m;if(s.length===0)return o.classGroupId;const a=s[0],c=o.nextPart.get(a),u=c?vm(s.slice(1),c):void 0;if(u)return u;if(o.validators.length===0)return;const f=s.join(bd);return(m=o.validators.find(({validator:p})=>p(f)))==null?void 0:m.classGroupId},Qp=/^\[(.+)\]$/,ob=s=>{if(Qp.test(s)){const o=Qp.exec(s)[1],a=o==null?void 0:o.substring(0,o.indexOf(":"));if(a)return"arbitrary.."+a}},lb=s=>{const{theme:o,prefix:a}=s,c={nextPart:new Map,validators:[]};return ib(Object.entries(s.classGroups),a).forEach(([f,m])=>{od(m,c,f,o)}),c},od=(s,o,a,c)=>{s.forEach(u=>{if(typeof u=="string"){const f=u===""?o:qp(o,u);f.classGroupId=a;return}if(typeof u=="function"){if(ab(u)){od(u(c),o,a,c);return}o.validators.push({validator:u,classGroupId:a});return}Object.entries(u).forEach(([f,m])=>{od(m,qp(o,f),a,c)})})},qp=(s,o)=>{let a=s;return o.split(bd).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},ab=s=>s.isThemeGetter,ib=(s,o)=>o?s.map(([a,c])=>{const u=c.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([m,p])=>[o+m,p])):f);return[a,u]}):s,cb=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,a=new Map,c=new Map;const u=(f,m)=>{a.set(f,m),o++,o>s&&(o=0,c=a,a=new Map)};return{get(f){let m=a.get(f);if(m!==void 0)return m;if((m=c.get(f))!==void 0)return u(f,m),m},set(f,m){a.has(f)?a.set(f,m):u(f,m)}}},ym="!",db=s=>{const{separator:o,experimentalParseClassName:a}=s,c=o.length===1,u=o[0],f=o.length,m=p=>{const v=[];let x=0,b=0,w;for(let N=0;Nb?w-b:void 0;return{modifiers:v,hasImportantModifier:O,baseClassName:z,maybePostfixModifierPosition:j}};return a?p=>a({className:p,parseClassName:m}):m},ub=s=>{if(s.length<=1)return s;const o=[];let a=[];return s.forEach(c=>{c[0]==="["?(o.push(...a.sort(),c),a=[]):a.push(c)}),o.push(...a.sort()),o},fb=s=>({cache:cb(s.cacheSize),parseClassName:db(s),...sb(s)}),pb=/\s+/,hb=(s,o)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:u}=o,f=[],m=s.trim().split(pb);let p="";for(let v=m.length-1;v>=0;v-=1){const x=m[v],{modifiers:b,hasImportantModifier:w,baseClassName:P,maybePostfixModifierPosition:O}=a(x);let z=!!O,j=c(z?P.substring(0,O):P);if(!j){if(!z){p=x+(p.length>0?" "+p:p);continue}if(j=c(P),!j){p=x+(p.length>0?" "+p:p);continue}z=!1}const N=ub(b).join(":"),M=w?N+ym:N,R=M+j;if(f.includes(R))continue;f.push(R);const V=u(j,z);for(let L=0;L0?" "+p:p)}return p};function mb(){let s=0,o,a,c="";for(;s{if(typeof s=="string")return s;let o,a="";for(let c=0;cw(b),s());return a=fb(x),c=a.cache.get,u=a.cache.set,f=p,p(v)}function p(v){const x=c(v);if(x)return x;const b=hb(v,a);return u(v,b),b}return function(){return f(mb.apply(null,arguments))}}const Ue=s=>{const o=a=>a[s]||[];return o.isThemeGetter=!0,o},wm=/^\[(?:([a-z-]+):)?(.+)\]$/i,gb=/^\d+\/\d+$/,vb=new Set(["px","full","screen"]),yb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mr=s=>ys(s)||vb.has(s)||gb.test(s),Vr=s=>zs(s,"length",Rb),ys=s=>!!s&&!Number.isNaN(Number(s)),Mc=s=>zs(s,"number",ys),_o=s=>!!s&&Number.isInteger(Number(s)),Nb=s=>s.endsWith("%")&&ys(s.slice(0,-1)),Ne=s=>wm.test(s),Hr=s=>yb.test(s),Sb=new Set(["length","size","percentage"]),Cb=s=>zs(s,Sb,jm),Eb=s=>zs(s,"position",jm),_b=new Set(["image","url"]),Pb=s=>zs(s,_b,Db),Mb=s=>zs(s,"",Ob),Po=()=>!0,zs=(s,o,a)=>{const c=wm.exec(s);return c?c[1]?typeof o=="string"?c[1]===o:o.has(c[1]):a(c[2]):!1},Rb=s=>bb.test(s)&&!wb.test(s),jm=()=>!1,Ob=s=>jb.test(s),Db=s=>kb.test(s),Ab=()=>{const s=Ue("colors"),o=Ue("spacing"),a=Ue("blur"),c=Ue("brightness"),u=Ue("borderColor"),f=Ue("borderRadius"),m=Ue("borderSpacing"),p=Ue("borderWidth"),v=Ue("contrast"),x=Ue("grayscale"),b=Ue("hueRotate"),w=Ue("invert"),P=Ue("gap"),O=Ue("gradientColorStops"),z=Ue("gradientColorStopPositions"),j=Ue("inset"),N=Ue("margin"),M=Ue("opacity"),R=Ue("padding"),V=Ue("saturate"),L=Ue("scale"),$=Ue("sepia"),I=Ue("skew"),B=Ue("space"),X=Ue("translate"),ne=()=>["auto","contain","none"],ve=()=>["auto","hidden","clip","visible","scroll"],ye=()=>["auto",Ne,o],ue=()=>[Ne,o],Re=()=>["",mr,Vr],Ee=()=>["auto",ys,Ne],ze=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Oe=()=>["solid","dashed","dotted","double","none"],Pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],se=()=>["","0",Ne],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>[ys,Ne];return{cacheSize:500,separator:":",theme:{colors:[Po],spacing:[mr,Vr],blur:["none","",Hr,Ne],brightness:C(),borderColor:[s],borderRadius:["none","","full",Hr,Ne],borderSpacing:ue(),borderWidth:Re(),contrast:C(),grayscale:se(),hueRotate:C(),invert:se(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[Nb,Vr],inset:ye(),margin:ye(),opacity:C(),padding:ue(),saturate:C(),scale:C(),sepia:se(),skew:C(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[Hr]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ze(),Ne]}],overflow:[{overflow:ve()}],"overflow-x":[{"overflow-x":ve()}],"overflow-y":[{"overflow-y":ve()}],overscroll:[{overscroll:ne()}],"overscroll-x":[{"overscroll-x":ne()}],"overscroll-y":[{"overscroll-y":ne()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",_o,Ne]}],basis:[{basis:ye()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ne]}],grow:[{grow:se()}],shrink:[{shrink:se()}],order:[{order:["first","last","none",_o,Ne]}],"grid-cols":[{"grid-cols":[Po]}],"col-start-end":[{col:["auto",{span:["full",_o,Ne]},Ne]}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":[Po]}],"row-start-end":[{row:["auto",{span:[_o,Ne]},Ne]}],"row-start":[{"row-start":Ee()}],"row-end":[{"row-end":Ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[P]}],"gap-x":[{"gap-x":[P]}],"gap-y":[{"gap-y":[P]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],pe:[{pe:[R]}],pt:[{pt:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[N]}],mx:[{mx:[N]}],my:[{my:[N]}],ms:[{ms:[N]}],me:[{me:[N]}],mt:[{mt:[N]}],mr:[{mr:[N]}],mb:[{mb:[N]}],ml:[{ml:[N]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ne,o]}],"min-w":[{"min-w":[Ne,o,"min","max","fit"]}],"max-w":[{"max-w":[Ne,o,"none","full","min","max","fit","prose",{screen:[Hr]},Hr]}],h:[{h:[Ne,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ne,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ne,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ne,o,"auto","min","max","fit"]}],"font-size":[{text:["base",Hr,Vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mc]}],"font-family":[{font:[Po]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ne]}],"line-clamp":[{"line-clamp":["none",ys,Mc]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mr,Ne]}],"list-image":[{"list-image":["none",Ne]}],"list-style-type":[{list:["none","disc","decimal",Ne]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[s]}],"placeholder-opacity":[{"placeholder-opacity":[M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[M]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mr,Vr]}],"underline-offset":[{"underline-offset":["auto",mr,Ne]}],"text-decoration-color":[{decoration:[s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[M]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ze(),Eb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Cb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Pb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[z]}],"gradient-via-pos":[{via:[z]}],"gradient-to-pos":[{to:[z]}],"gradient-from":[{from:[O]}],"gradient-via":[{via:[O]}],"gradient-to":[{to:[O]}],rounded:[{rounded:[f]}],"rounded-s":[{"rounded-s":[f]}],"rounded-e":[{"rounded-e":[f]}],"rounded-t":[{"rounded-t":[f]}],"rounded-r":[{"rounded-r":[f]}],"rounded-b":[{"rounded-b":[f]}],"rounded-l":[{"rounded-l":[f]}],"rounded-ss":[{"rounded-ss":[f]}],"rounded-se":[{"rounded-se":[f]}],"rounded-ee":[{"rounded-ee":[f]}],"rounded-es":[{"rounded-es":[f]}],"rounded-tl":[{"rounded-tl":[f]}],"rounded-tr":[{"rounded-tr":[f]}],"rounded-br":[{"rounded-br":[f]}],"rounded-bl":[{"rounded-bl":[f]}],"border-w":[{border:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[M]}],"border-style":[{border:[...Oe(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[M]}],"divide-style":[{divide:Oe()}],"border-color":[{border:[u]}],"border-color-x":[{"border-x":[u]}],"border-color-y":[{"border-y":[u]}],"border-color-s":[{"border-s":[u]}],"border-color-e":[{"border-e":[u]}],"border-color-t":[{"border-t":[u]}],"border-color-r":[{"border-r":[u]}],"border-color-b":[{"border-b":[u]}],"border-color-l":[{"border-l":[u]}],"divide-color":[{divide:[u]}],"outline-style":[{outline:["",...Oe()]}],"outline-offset":[{"outline-offset":[mr,Ne]}],"outline-w":[{outline:[mr,Vr]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[M]}],"ring-offset-w":[{"ring-offset":[mr,Vr]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",Hr,Mb]}],"shadow-color":[{shadow:[Po]}],opacity:[{opacity:[M]}],"mix-blend":[{"mix-blend":[...Pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Pe()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",Hr,Ne]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[w]}],saturate:[{saturate:[V]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[M]}],"backdrop-saturate":[{"backdrop-saturate":[V]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[m]}],"border-spacing-x":[{"border-spacing-x":[m]}],"border-spacing-y":[{"border-spacing-y":[m]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ne]}],duration:[{duration:C()}],ease:[{ease:["linear","in","out","in-out",Ne]}],delay:[{delay:C()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[L]}],"scale-x":[{"scale-x":[L]}],"scale-y":[{"scale-y":[L]}],rotate:[{rotate:[_o,Ne]}],"translate-x":[{"translate-x":[X]}],"translate-y":[{"translate-y":[X]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ne]}],accent:[{accent:["auto",s]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ne]}],"caret-color":[{caret:[s]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ne]}],fill:[{fill:[s,"none"]}],"stroke-w":[{stroke:[mr,Vr,Mc]}],stroke:[{stroke:[s,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Tb=xb(Ab);function J(...s){return Tb(nb(s))}function Uo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const Lb={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",reasoning:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"};function zb(){const{data:s}=Ls(2e3),{data:o}=pm(2e3),a=(s==null?void 0:s.models)??[],c=(s==null?void 0:s.running)??[],u=a.filter(v=>c.includes(v.name)),f=g.useRef(null),[m,p]=g.useState(!1);return g.useEffect(()=>{if(!o)return;const v=o.total_tokens;if(f.current!==null&&v>f.current){p(!0);const x=setTimeout(()=>p(!1),4e3);return f.current=v,()=>clearTimeout(x)}f.current=v},[o==null?void 0:o.total_tokens]),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),r.jsxs("span",{className:J("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",m?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[m?r.jsx(wa,{className:"h-3 w-3 animate-pulse"}):r.jsx(D0,{className:"h-3 w-3"}),m?"Inferenz aktiv":"Idle"]})]}),u.length===0?r.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):r.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:u.map(v=>{var x;return r.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[v.role&&r.jsx("span",{className:J("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",Lb[v.role]||"bg-slate-500/15 text-slate-300 border-slate-500/25"),children:v.role}),r.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(x=v.name.split("/").pop())==null?void 0:x.replace(/\.gguf$/i,"")})]}),r.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[gr(v.size_bytes)," im Unified-RAM"]})]}),r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[r.jsx("span",{className:J("h-1.5 w-1.5 rounded-full bg-emerald-500",m&&"animate-pulse")})," warm"]})]},v.name)})})]})}function pa({value:s,label:o,detail:a}){const u=2*Math.PI*24,f=u-Math.min(s,100)/100*u,m=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return r.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[r.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),r.jsx("circle",{cx:"32",cy:"32",r:24,className:J("fill-none transition-all duration-700 ease-out",m),strokeWidth:"4.5",strokeDasharray:u,strokeDashoffset:f,strokeLinecap:"round"})]}),r.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),r.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),a&&r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function Fb(){const{data:s}=vd(3e3);return r.jsxs("div",{className:"md:col-span-2 flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(pa,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),r.jsx(pa,{value:s.ram.percent,label:"RAM",detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&r.jsx(pa,{value:s.gpu.busy_percent,label:"GPU",detail:`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB`}),s.disk&&r.jsx(pa,{value:s.disk.percent,label:"Disk",detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(s==null?void 0:s.temp)&&(s.temp.cpu||s.temp.gpu)&&r.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[s.temp.cpu!=null&&r.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&r.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]})}function km({type:s,title:o,message:a,defaultValue:c,onConfirm:u,onCancel:f}){const m=g.useRef(null);return r.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),r.jsx("button",{onClick:f||(()=>u()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),s==="prompt"&&r.jsx("input",{ref:m,type:"text",defaultValue:c,className:"w-full h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:p=>{var v;p.key==="Enter"&&u((v=m.current)==null?void 0:v.value)}}),r.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&r.jsx("button",{onClick:f,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),r.jsx("button",{onClick:()=>{var v;const p=s==="prompt"?(v=m.current)==null?void 0:v.value:void 0;u(p)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:s==="confirm"?"Ja, fortfahren":s==="prompt"?"Übernehmen":"OK"})]})]})})}function Fn(){const[s,o]=g.useState(null),a=g.useCallback(()=>o(null),[]),c=g.useCallback((p,v,x)=>{o({type:"alert",title:p,message:v,onConfirm:()=>{o(null),x==null||x()}})},[]),u=g.useCallback((p,v,x,b)=>{o({type:"confirm",title:p,message:v,onConfirm:()=>{o(null),x()},onCancel:()=>{o(null),b==null||b()}})},[]),f=g.useCallback((p,v,x,b,w)=>{o({type:"prompt",title:p,message:v,defaultValue:x,onConfirm:P=>{o(null),b(P)},onCancel:()=>{o(null),w==null||w()}})},[]),m=s?r.jsx(km,{...s}):null;return{showAlert:c,showConfirm:u,showPrompt:f,close:a,dialogElement:m}}function Ib(){var $;const s=ln(),{data:o}=yd(3e3),{data:a=[]}=fm(3e3),{showConfirm:c,dialogElement:u}=Fn(),[f,m]=g.useState(""),[p,v]=g.useState(!1),[x,b]=g.useState(""),[w,P]=g.useState(!1),[O,z]=g.useState({open:!1,actionPath:"",actionLabel:""}),j=()=>{s.invalidateQueries({queryKey:Ze.updates}),s.invalidateQueries({queryKey:Ze.jobs}),s.invalidateQueries({queryKey:Ze.models})};async function N(I,B,X,ne){m(`${B} wird ausgeführt...`),v(!0);try{const ve={...X},ye=await be(I,{method:"POST",body:JSON.stringify(ve)});if(ye.status==="password_required"||ye.status==="incorrect_password"){z({open:!0,actionPath:I,actionLabel:B,payload:X,error:ye.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),m("");return}ye.job_id?m(`${B} gestartet (Job-ID: ${ye.job_id})`):ye.ok?m(`${B} erfolgreich ausgeführt.`):m(`Fehler: ${ye.err||"Unbekannter Fehler"}`),j()}catch(ve){m(`Fehler bei ${B}: ${ve.message}`)}finally{v(!1)}}async function M(){P(!0);try{const I={...O.payload,sudo_password:x},B=await be(O.actionPath,{method:"POST",body:JSON.stringify(I)});if(B.status==="password_required"||B.status==="incorrect_password"){z(X=>({...X,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}B.job_id?m(`${O.actionLabel} gestartet (Job-ID: ${B.job_id})`):B.ok?m(`${O.actionLabel} erfolgreich ausgeführt.`):m(`Fehler: ${B.err||"Unbekannter Fehler"}`),z({open:!1,actionPath:"",actionLabel:""}),b(""),j()}catch(I){m(`Fehler: ${I.message}`),z({open:!1,actionPath:"",actionLabel:""}),b("")}finally{P(!1)}}async function R(I,B){m(`Upgrade für ${I} wird gestartet...`);try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:I,role:B,quant:"Q4_K_M",jinja:!0})}),m("Upgrade-Download gestartet."),j()}catch(X){m(`Upgrade fehlgeschlagen: ${X.message}`)}}const V=a.find(I=>I.label.includes("OS-Update")&&(I.state==="running"||I.state==="queued")),L=a.find(I=>I.label.includes("Engine-Update")&&(I.state==="running"||I.state==="queued"));return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[O.open&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:r.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/60 bg-card/90 backdrop-blur-xl p-5 shadow-2xl space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),r.jsx("button",{onClick:()=>{z({open:!1,actionPath:"",actionLabel:""}),b("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",r.jsx("strong",{children:O.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"password",value:x,onChange:I=>b(I.target.value),placeholder:"Sudo-Passwort eingeben...",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground",onKeyDown:I=>I.key==="Enter"&&M(),autoFocus:!0}),O.error&&r.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:O.error})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{z({open:!1,actionPath:"",actionLabel:""}),b("")},className:"h-8 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent transition-all cursor-pointer",children:"Abbrechen"}),r.jsx("button",{onClick:M,disabled:!x||w,className:"h-8 px-4 rounded-lg bg-primary text-primary-foreground text-[10px] font-bold uppercase hover:opacity-90 transition-all disabled:opacity-50 cursor-pointer flex items-center justify-center gap-1.5",children:w?"Prüfe...":"Ausführen"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(I0,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(o==null?void 0:o.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(o.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),o?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.os>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsx("span",{children:"OS-Pakete"}),r.jsx("span",{className:"font-mono",children:o.os>0?`${o.os} verfügbar`:"aktuell"})]}),r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.engine>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsx("span",{children:"Engine (llama.cpp)"}),r.jsx("span",{className:"font-mono",children:o.engine>0?"Update verfügbar":"aktuell"})]}),r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsx("span",{children:"Modell-Upgrades"}),r.jsx("span",{className:"font-mono",children:o.models>0?`${o.models} verfügbar`:"aktuell"})]}),($=o.components)==null?void 0:$.map(I=>{const B=I.update===!0;return r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",B?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[I.name,I.reachable===!1&&r.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),r.jsx("span",{className:"font-mono text-[10px]",title:I.current?`installiert: ${I.current}`:void 0,children:B?`Update: ${I.latest}`:I.update===!1?"aktuell":I.latest?`neueste: ${I.latest}`:"—"})]},I.key)})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[r.jsx("button",{onClick:()=>N("/api/maintenance/os-update","OS-Update"),disabled:p||!!V,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:V?r.jsxs(r.Fragment,{children:[r.jsx(An,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",V.progress??0,"%)"]})]}):r.jsx("span",{children:"OS Update"})}),r.jsx("button",{onClick:()=>N("/api/maintenance/engine-update","Engine-Update"),disabled:p||!!L,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:L?r.jsxs(r.Fragment,{children:[r.jsx(An,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",L.progress??0,"%)"]})]}):r.jsx("span",{children:"Engine Update"})})]}),r.jsxs("button",{onClick:()=>{c("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>N("/api/maintenance/reboot","Reboot"))},disabled:p,className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 text-red-400 text-[10px] font-bold uppercase hover:bg-red-500/10 transition-all cursor-pointer disabled:opacity-50",children:[r.jsx(Ph,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Host Reboot"})]}),o.model_list.length>0&&r.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[r.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),r.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:o.model_list.map(I=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-background/25 border border-border/30 text-[10px] font-mono text-muted-foreground",children:[r.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${I.role}: ${I.repo}`,children:[r.jsx("span",{className:"text-primary font-bold uppercase",children:I.role}),": ",I.repo.split("/").pop()]}),r.jsxs("button",{onClick:()=>R(I.repo,I.role),className:"px-2 py-0.5 text-[8px] font-bold uppercase rounded bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer flex items-center gap-0.5",children:[r.jsx(Tn,{className:"h-2.5 w-2.5"})," Laden"]})]},I.repo))})]})]}):r.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),f&&r.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:f}),r.jsxs("div",{className:"text-[9px] text-muted-foreground/60 leading-normal border-t border-border/10 pt-2.5 flex items-start gap-1",children:[r.jsx(Ds,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),r.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",r.jsx("code",{children:"/etc/sudoers"})," (z.B. ",r.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),r.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:r.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer")),className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer shadow-md shadow-primary/10",children:"System-Zentrale öffnen"})}),u]})}function $b(){const s=ln(),{data:o}=hm(3e3),{data:a}=Ls(),{showAlert:c,dialogElement:u}=Fn(),[f,m]=g.useState(!1),p=(a==null?void 0:a.models)??[];async function v(x){try{await be("/api/agent/brain",{method:"POST",body:JSON.stringify({model:x})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${x}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Ze.agentStatus}),m(!1)}catch(b){c("Fehler",`Fehler beim Wechseln des Gehirns: ${b.message}`)}}return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(o==null?void 0:o.webui_url)&&r.jsxs("a",{href:Uo(o.webui_url),target:"_blank",rel:"noopener",className:J("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[r.jsx(ya,{className:"h-3 w-3"})," AnythingLLM öffnen"]})]}),o?r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.gateway_reachable?"Online":"Offline"})]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"AnythingLLM"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.webui_reachable?"Online":"Offline"})]})]}),r.jsxs("div",{onClick:()=>m(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),r.jsx(Ot,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[r.jsx(zo,{className:"h-3 w-3 shrink-0"}),o.brain_model||"auto"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),r.jsx(Fo,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[r.jsxs("div",{children:["Config: ",o.has_config?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Skills: ",o.has_skills?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Memory: ",o.has_memories?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),o&&r.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Telegram"}),r.jsx("span",{className:J("font-semibold",o.telegram_enabled?"text-emerald-400":""),children:o.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"MCP-Server"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[o.mcp_server_count??0," verbunden"]})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"PC Executor"}),r.jsx("span",{className:J("font-semibold",o.pc_executor_reachable?"text-emerald-400":""),children:o.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),o&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),r.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',r.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),r.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...p.map(x=>{var b;return((b=x.name.split("/").pop())==null?void 0:b.replace(".gguf",""))||x.name})].map(x=>{const b=["auto","fast","heavy"].includes(x);return r.jsxs("button",{onClick:()=>v(x),className:J("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",o.brain_model===x||!o.brain_model&&x==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:x}),r.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:b?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===x||!o.brain_model&&x==="auto")&&r.jsx(nn,{className:"h-4 w-4 shrink-0 text-primary"})]},x)})})]})}),u]})}const Ub=["fast","heavy","coder","vision","scout"];function Bb(){const{data:s}=Ls(3e3),o=(s==null?void 0:s.models)??[],a=(s==null?void 0:s.running)??[];return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(zo,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:Ub.map(c=>{var m;const u=o.find(p=>p.role===c),f=u?a.includes(u.name):!1;return r.jsxs("div",{className:J("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",f?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":u?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[r.jsx("div",{className:"min-w-0 flex-1 mr-2",children:r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:J("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",c==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":c==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":c==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":c==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:c}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:u?(m=u.name.split("/").pop())==null?void 0:m.replace(/\.gguf$/i,""):"nicht zugewiesen"}),u&&r.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[u.prompt_cache&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),u.spec_draft_model&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${u.spec_draft_model})`,children:"SPEC"}),u.parallel_slots>1&&r.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${u.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",u.parallel_slots]}),u.incomplete&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),r.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:u?f?r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},c)})})]}),r.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Vb(){const s=ln(),{data:o=[]}=xm({limit:3}),[a,c]=g.useState(""),[u,f]=g.useState("stable"),[m,p]=g.useState(!1);async function v(){if(!(!a.trim()||m)){p(!0);try{await be("/api/memory",{method:"POST",body:JSON.stringify({content:a,category:u,source:"dashboard"})}),c(""),s.invalidateQueries({queryKey:["memory"]})}catch(x){console.error(x)}finally{p(!1)}}}return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Lo,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("textarea",{value:a,onChange:x=>c(x.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),r.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[r.jsxs("select",{value:u,onChange:x=>f(x.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[r.jsx("option",{value:"stable",children:"🔵 Fakt"}),r.jsx("option",{value:"instruction",children:"📋 Regel"}),r.jsx("option",{value:"user",children:"👤 User"}),r.jsx("option",{value:"versioned",children:"🟡 Version"})]}),r.jsxs("button",{onClick:v,disabled:!a.trim()||m,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[r.jsx(_h,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),r.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[r.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),r.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:o.length===0?r.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):o.map(x=>r.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[r.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:x.category}),r.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:x.content,children:x.content})]},x.id))})]})]}),r.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}function Hb(){var o;const{data:s}=pm(3e3);return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(N0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),s?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),r.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[s.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),r.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",s.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),r.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:s.total_tokens.toLocaleString("de-DE")}),r.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Input (Prompts):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Output (Antworten):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),r.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet ggü. Cloud-APIs",(o=s==null?void 0:s.pricing)!=null&&o.heavy?` (Ø ${(s.pricing.heavy.in??0).toFixed(2).replace(".",",")} $ / ${(s.pricing.heavy.out??0).toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})}function Gb(){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),r.jsx(zb,{}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[r.jsx(Fb,{}),r.jsx(Ib,{})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[r.jsx($b,{}),r.jsx(Bb,{}),r.jsx(Vb,{}),r.jsx(Hb,{})]})]})}function Wb(){const s=ln(),{data:o=[]}=fm(2e3),{showAlert:a,dialogElement:c}=Fn();async function u(p){try{await be(`/api/jobs/${p}/cancel`,{method:"POST"}),s.invalidateQueries({queryKey:Ze.jobs})}catch(v){a("Fehler",v.message)}}const f=o.filter(p=>p.state==="running"||p.state==="queued"),m=o.filter(p=>p.state!=="running"&&p.state!=="queued").slice(-3);return f.length===0&&m.length===0?null:r.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[r.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),f.map(p=>r.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center text-xs",children:[r.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:p.label}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-muted-foreground font-mono",children:[p.progress??0,"% • ",sd(p.done_bytes),"/",sd(p.total_bytes),p.eta_s?` • ETA ${rb(p.eta_s)}`:""]}),r.jsx("button",{onClick:()=>u(p.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),r.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${p.progress??0}%`}})})]},p.id)),m.map(p=>r.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[r.jsx("span",{className:"truncate",children:p.label}),r.jsx("span",{className:J("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",p.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:p.state})]},p.id)),c]})}function kn({children:s,tone:o="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return r.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[o]}`,children:s})}function Zp({caps:s}){return s?r.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&r.jsx(kn,{children:"💻 Code"}),s.vision&&r.jsx(kn,{children:"👁 Bild"}),s.reasoning&&r.jsx(kn,{children:"🧠 Reason"}),s.moe&&r.jsxs(kn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&r.jsx(kn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&r.jsx(kn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&r.jsx(kn,{children:"🔢 Embed"})]}):null}const Kb=["fast","heavy","coder","agent","vision","scout"];function Qb({fit:s}){const o={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[s.level];return r.jsxs("span",{className:J("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}function Yp(s){const o=s.toLowerCase();return o.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:o.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:o.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:o.includes("mistral")||o.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:o.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:o.includes("hermes")||o.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:o.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function qb({model:s,onClose:o,onChanged:a}){var j,N;const{data:c,isLoading:u}=tb(s.gguf_path),[f,m]=g.useState(null),[p,v]=g.useState(""),x=c==null?void 0:c.target_vocab,b=(c==null?void 0:c.drafts)??[],w=b.filter(M=>M.compatible===!0),P=s.spec_draft_model;async function O(M){m(M??"__clear__"),v("");try{await be(`/api/models/${encodeURIComponent(s.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:M})}),a(),o()}catch(R){v(String((R==null?void 0:R.message)||R)),m(null)}}const z=M=>{var R;return M?`${M.pre??"?"} · ${((R=M.n_vocab)==null?void 0:R.toLocaleString())??"?"} Tokens`:"—"};return r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[r.jsx(wa,{className:"h-4 w-4"})," Speculative Draft"]}),r.jsx("button",{onClick:o,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',r.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),r.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:(j=s.name.split("/").pop())==null?void 0:j.replace(/\.gguf$/i,"")}),r.jsxs("span",{className:"text-foreground",children:["Vocab: ",z(x)]})]}),s.spec_active&&P&&r.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[r.jsx(nn,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",P]}),r.jsx("button",{onClick:()=>O(null),disabled:f!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(c!=null&&c.target_exists)&&r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[r.jsx(Jc,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),r.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:u?r.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):b.length===0?r.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",r.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):b.map(M=>{var L,$;const R=M.filename===P,V=M.compatible===!0;return r.jsxs("div",{className:J("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",V?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",R&&"border-primary/40 bg-primary/10"),children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:M.filename}),r.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[gr(M.size_bytes)," · Vocab: ",z(M.vocab)]})]}),V?R?r.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[r.jsx(nn,{className:"h-3.5 w-3.5"})," Aktiv"]}):r.jsx("button",{onClick:()=>O(M.path),disabled:f!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):r.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:M.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(L=M.vocab)==null?void 0:L.pre}/${($=M.vocab)==null?void 0:$.n_vocab} ≠ Modell ${x==null?void 0:x.pre}/${x==null?void 0:x.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[r.jsx(Jc,{className:"h-3.5 w-3.5"})," ",M.compatible===!1?"Vocab ≠":"n/a"]})]},M.path)})}),!u&&(c==null?void 0:c.target_exists)&&b.length>0&&w.length===0&&r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",r.jsx("span",{className:"font-mono",children:x==null?void 0:x.pre}),", n_vocab=",r.jsx("span",{className:"font-mono",children:(N=x==null?void 0:x.n_vocab)==null?void 0:N.toLocaleString()}),")."]}),p&&r.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:p})]})})}function Zb(){var Is,$n,$s,Un,jr;const s=ln(),{data:o,isLoading:a,error:c}=Ls(4e3),{data:u}=Xy(4e3),{data:f}=mm(),{data:m}=yd(4e3),{showAlert:p,showConfirm:v,showPrompt:x,dialogElement:b}=Fn(),w=(o==null?void 0:o.models)??[],P=(o==null?void 0:o.running)??[],O=c?String(c):"",z=()=>{s.invalidateQueries({queryKey:Ze.models}),s.invalidateQueries({queryKey:Ze.routing})},[j,N]=g.useState(null),[M,R]=g.useState(null),[V,L]=g.useState(null),[$,I]=g.useState(!1),[B,X]=g.useState(null),[ne,ve]=g.useState("grid"),[ye,ue]=g.useState("all"),Re=w.filter(A=>ye==="in_use"?!!A.role||P.includes(A.name):!0),[Ee,ze]=g.useState({width:800,height:360}),Oe=g.useRef(null),Pe=g.useCallback(A=>{if(Oe.current&&(Oe.current.disconnect(),Oe.current=null),A){const ae=new ResizeObserver(ke=>{if(!ke||ke.length===0)return;const Te=ke[0].contentRect;ze({width:Te.width,height:Te.height})});ae.observe(A),Oe.current=ae}},[]),K=Ee.width,se=Ee.height,Q=A=>{const ae=K*.1,ke=se*A,Te=K*.5,Ve=se*.5,lr=K*.3,cn=ke,kr=K*.3;return`M ${ae} ${ke} C ${lr} ${cn}, ${kr} ${Ve}, ${Te} ${Ve}`},C=A=>{const ae=K*.5,ke=se*.5,Te=K*.9,Ve=se*A,lr=K*.7,cn=ke,kr=K*.7;return`M ${ae} ${ke} C ${lr} ${cn}, ${kr} ${Ve}, ${Te} ${Ve}`};async function E(A){try{await be(`/api/models/${encodeURIComponent(A)}/load`,{method:"POST"}),z()}catch(ae){p("Fehler",`Fehler beim Laden des Modells: ${ae.message}`)}}async function Y(A){try{await be(`/api/models/${encodeURIComponent(A)}/unload`,{method:"POST"}),z()}catch(ae){p("Fehler",`Fehler beim Entladen des Modells: ${ae.message}`)}}async function ee(){try{await be("/api/models/unload",{method:"POST"}),z()}catch(A){p("Fehler",`Fehler beim Entladen aller Modelle: ${A.message}`)}}async function Z(A,ae){try{await be(`/api/models/${encodeURIComponent(ae)}/role`,{method:"POST",body:JSON.stringify({role:A||null})}),z()}catch(ke){p("Fehler",`Fehler beim Zuweisen der Rolle: ${ke.message||ke}`)}}async function le(A,ae){x("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(ae||32768),async ke=>{if(ke)try{await be(`/api/models/${encodeURIComponent(A)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ke,10)})}),z()}catch(Te){p("Fehler",`Fehler beim Setzen des Kontexts: ${Te.message||Te}`)}})}async function fe(A){v("Modell löschen?",`Modell '${A}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await be(`/api/models/${encodeURIComponent(A)}`,{method:"DELETE"}),z()}catch(ae){p("Fehler",`Fehler beim Löschen: ${ae.message||ae}`)}})}async function we(A,ae,ke,Te){try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:A,role:ae,quant:ke,jinja:Te})}),p("Herunterladen gestartet",`Download für '${A}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ve){p("Fehler",`Fehler beim Starten des Upgrades: ${Ve.message||Ve}`)}}async function U(A){A&&(await navigator.clipboard.writeText(A),I(!0),setTimeout(()=>I(!1),1500))}if(a)return r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(O)return r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",O,")."]});const he=w.filter(A=>P.includes(A.name)),pt=he.reduce((A,ae)=>A+(ae.size_bytes||0),0),Fs=16*1024**3,an=pt>Fs?pt*1.2:Fs,In=A=>w.find(ae=>ae.role===A),wr=A=>{const ae=In(A);return ae?P.includes(ae.name):!1};return r.jsxs("div",{className:"space-y-8",children:[r.jsx("style",{children:` +`)},gy=0,ps=[];function vy(s){var o=g.useRef([]),a=g.useRef([0,0]),c=g.useRef(),u=g.useState(gy++)[0],f=g.useState(Bh)[0],m=g.useRef(s);g.useEffect(function(){m.current=s},[s]),g.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(u));var j=Iv([s.lockRef.current],(s.shards||[]).map(Gp),!0).filter(Boolean);return j.forEach(function(N){return N.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),j.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(u))})}}},[s.inert,s.lockRef.current,s.shards]);var p=g.useCallback(function(j,N){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!m.current.allowPinchZoom;var M=da(j),R=a.current,V="deltaX"in j?j.deltaX:R[0]-M[0],L="deltaY"in j?j.deltaY:R[1]-M[1],$,I=j.target,B=Math.abs(V)>Math.abs(L)?"h":"v";if("touches"in j&&B==="h"&&I.type==="range")return!1;var X=window.getSelection(),ne=X&&X.anchorNode,ve=ne?ne===I||ne.contains(I):!1;if(ve)return!1;var ye=Vp(B,I);if(!ye)return!0;if(ye?$=B:($=B==="v"?"h":"v",ye=Vp(B,I)),!ye)return!1;if(!c.current&&"changedTouches"in j&&(V||L)&&(c.current=$),!$)return!0;var ue=c.current||$;return hy(ue,N,j,ue==="h"?V:L)},[]),v=g.useCallback(function(j){var N=j;if(!(!ps.length||ps[ps.length-1]!==f)){var M="deltaY"in N?Hp(N):da(N),R=o.current.filter(function($){return $.name===N.type&&($.target===N.target||N.target===$.shadowParent)&&my($.delta,M)})[0];if(R&&R.should){N.cancelable&&N.preventDefault();return}if(!R){var V=(m.current.shards||[]).map(Gp).filter(Boolean).filter(function($){return $.contains(N.target)}),L=V.length>0?p(N,V[0]):!m.current.noIsolation;L&&N.cancelable&&N.preventDefault()}}},[]),x=g.useCallback(function(j,N,M,R){var V={name:j,delta:N,target:M,should:R,shadowParent:yy(M)};o.current.push(V),setTimeout(function(){o.current=o.current.filter(function(L){return L!==V})},1)},[]),b=g.useCallback(function(j){a.current=da(j),c.current=void 0},[]),w=g.useCallback(function(j){x(j.type,Hp(j),j.target,p(j,s.lockRef.current))},[]),P=g.useCallback(function(j){x(j.type,da(j),j.target,p(j,s.lockRef.current))},[]);g.useEffect(function(){return ps.push(f),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:P}),document.addEventListener("wheel",v,fs),document.addEventListener("touchmove",v,fs),document.addEventListener("touchstart",b,fs),function(){ps=ps.filter(function(j){return j!==f}),document.removeEventListener("wheel",v,fs),document.removeEventListener("touchmove",v,fs),document.removeEventListener("touchstart",b,fs)}},[]);var O=s.removeScrollBar,z=s.inert;return g.createElement(g.Fragment,null,z?g.createElement(f,{styles:xy(u)}):null,O?g.createElement(ay,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function yy(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const by=Qv(Uh,vy);var Wh=g.forwardRef(function(s,o){return g.createElement(Na,or({},s,{ref:o,sideCar:by}))});Wh.classNames=Na.classNames;var wy=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},hs=new WeakMap,ua=new WeakMap,fa={},_c=0,Kh=function(s){return s&&(s.host||Kh(s.parentNode))},jy=function(s,o){return o.map(function(a){if(s.contains(a))return a;var c=Kh(a);return c&&s.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",s,". Doing nothing"),null)}).filter(function(a){return!!a})},ky=function(s,o,a,c){var u=jy(o,Array.isArray(s)?s:[s]);fa[a]||(fa[a]=new WeakMap);var f=fa[a],m=[],p=new Set,v=new Set(u),x=function(w){!w||p.has(w)||(p.add(w),x(w.parentNode))};u.forEach(x);var b=function(w){!w||v.has(w)||Array.prototype.forEach.call(w.children,function(P){if(p.has(P))b(P);else try{var O=P.getAttribute(c),z=O!==null&&O!=="false",j=(hs.get(P)||0)+1,N=(f.get(P)||0)+1;hs.set(P,j),f.set(P,N),m.push(P),j===1&&z&&ua.set(P,!0),N===1&&P.setAttribute(a,"true"),z||P.setAttribute(c,"true")}catch(M){console.error("aria-hidden: cannot operate on ",P,M)}})};return b(o),p.clear(),_c++,function(){m.forEach(function(w){var P=hs.get(w)-1,O=f.get(w)-1;hs.set(w,P),f.set(w,O),P||(ua.has(w)||w.removeAttribute(c),ua.delete(w)),O||w.removeAttribute(a)}),_c--,_c||(hs=new WeakMap,hs=new WeakMap,ua=new WeakMap,fa={})}},Ny=function(s,o,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(s)?s:[s]),u=wy(s);return u?(c.push.apply(c,Array.from(u.querySelectorAll("[aria-live], script"))),ky(c,u,a,"aria-hidden")):function(){return null}},Sa="Dialog",[Qh]=J0(Sa),[Sy,qt]=Qh(Sa),qh=s=>{const{__scopeDialog:o,children:a,open:c,defaultOpen:u,onOpenChange:f,modal:m=!0}=s,p=g.useRef(null),v=g.useRef(null),[x,b]=nv({prop:c,defaultProp:u??!1,onChange:f,caller:Sa});return r.jsx(Sy,{scope:o,triggerRef:p,contentRef:v,contentId:br(),titleId:br(),descriptionId:br(),open:x,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(w=>!w),[b]),modal:m,children:a})};qh.displayName=Sa;var Zh="DialogTrigger",Cy=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(Zh,a),f=zn(o,u.triggerRef);return r.jsx(at.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":xd(u.open),...c,ref:f,onClick:rn(s.onClick,u.onOpenToggle)})});Cy.displayName=Zh;var md="DialogPortal",[Ey,Yh]=Qh(md,{forceMount:void 0}),Jh=s=>{const{__scopeDialog:o,forceMount:a,children:c,container:u}=s,f=qt(md,o);return r.jsx(Ey,{scope:o,forceMount:a,children:g.Children.map(c,m=>r.jsx(ka,{present:a||f.open,children:r.jsx(Fh,{asChild:!0,container:u,children:m})}))})};Jh.displayName=md;var ja="DialogOverlay",Xh=g.forwardRef((s,o)=>{const a=Yh(ja,s.__scopeDialog),{forceMount:c=a.forceMount,...u}=s,f=qt(ja,s.__scopeDialog);return f.modal?r.jsx(ka,{present:c||f.open,children:r.jsx(Py,{...u,ref:o})}):null});Xh.displayName=ja;var _y=Dh("DialogOverlay.RemoveScroll"),Py=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(ja,a),f=kv(),m=zn(o,f);return r.jsx(Wh,{as:_y,allowPinchZoom:!0,shards:[u.contentRef],children:r.jsx(at.div,{"data-state":xd(u.open),...c,ref:m,style:{pointerEvents:"auto",...c.style}})})}),Ts="DialogContent",em=g.forwardRef((s,o)=>{const a=Yh(Ts,s.__scopeDialog),{forceMount:c=a.forceMount,...u}=s,f=qt(Ts,s.__scopeDialog);return r.jsx(ka,{present:c||f.open,children:f.modal?r.jsx(My,{...u,ref:o}):r.jsx(Ry,{...u,ref:o})})});em.displayName=Ts;var My=g.forwardRef((s,o)=>{const a=qt(Ts,s.__scopeDialog),c=g.useRef(null),u=zn(o,a.contentRef,c);return g.useEffect(()=>{const f=c.current;if(f)return Ny(f)},[]),r.jsx(tm,{...s,ref:u,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:rn(s.onCloseAutoFocus,f=>{var m;f.preventDefault(),(m=a.triggerRef.current)==null||m.focus()}),onPointerDownOutside:rn(s.onPointerDownOutside,f=>{const m=f.detail.originalEvent,p=m.button===0&&m.ctrlKey===!0;(m.button===2||p)&&f.preventDefault()}),onFocusOutside:rn(s.onFocusOutside,f=>f.preventDefault())})}),Ry=g.forwardRef((s,o)=>{const a=qt(Ts,s.__scopeDialog),c=g.useRef(!1),u=g.useRef(!1);return r.jsx(tm,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var m,p;(m=s.onCloseAutoFocus)==null||m.call(s,f),f.defaultPrevented||(c.current||(p=a.triggerRef.current)==null||p.focus(),f.preventDefault()),c.current=!1,u.current=!1},onInteractOutside:f=>{var v,x;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(c.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const m=f.target;((x=a.triggerRef.current)==null?void 0:x.contains(m))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})}),tm=g.forwardRef((s,o)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:u,onCloseAutoFocus:f,...m}=s,p=qt(Ts,a);return Fv(),r.jsx(r.Fragment,{children:r.jsx(Lh,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:u,onUnmountAutoFocus:f,children:r.jsx(Ah,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":xd(p.open),...m,ref:o,deferPointerDownOutside:!0,onDismiss:()=>p.onOpenChange(!1)})})})}),rm="DialogTitle",Oy=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(rm,a);return r.jsx(at.h2,{id:u.titleId,...c,ref:o})});Oy.displayName=rm;var nm="DialogDescription",Dy=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(nm,a);return r.jsx(at.p,{id:u.descriptionId,...c,ref:o})});Dy.displayName=nm;var sm="DialogClose",Ay=g.forwardRef((s,o)=>{const{__scopeDialog:a,...c}=s,u=qt(sm,a);return r.jsx(at.button,{type:"button",...c,ref:o,onClick:rn(s.onClick,()=>u.onOpenChange(!1))})});Ay.displayName=sm;function xd(s){return s?"open":"closed"}var Eo='[cmdk-group=""]',Pc='[cmdk-group-items=""]',Ty='[cmdk-group-heading=""]',om='[cmdk-item=""]',Wp=`${om}:not([aria-disabled="true"])`,nd="cmdk-item-select",xs="data-value",Ly=(s,o,a)=>Y0(s,o,a),lm=g.createContext(void 0),Qo=()=>g.useContext(lm),am=g.createContext(void 0),gd=()=>g.useContext(am),im=g.createContext(void 0),cm=g.forwardRef((s,o)=>{let a=gs(()=>{var E,Y;return{search:"",value:(Y=(E=s.value)!=null?E:s.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=gs(()=>new Set),u=gs(()=>new Map),f=gs(()=>new Map),m=gs(()=>new Set),p=dm(s),{label:v,children:x,value:b,onValueChange:w,filter:P,shouldFilter:O,loop:z,disablePointerSelection:j=!1,vimBindings:N=!0,...M}=s,R=br(),V=br(),L=br(),$=g.useRef(null),I=Ky();Ln(()=>{if(b!==void 0){let E=b.trim();a.current.value=E,B.emit()}},[b]),Ln(()=>{I(6,Re)},[]);let B=g.useMemo(()=>({subscribe:E=>(m.current.add(E),()=>m.current.delete(E)),snapshot:()=>a.current,setState:(E,Y,ee)=>{var Z,le,fe,we;if(!Object.is(a.current[E],Y)){if(a.current[E]=Y,E==="search")ue(),ve(),I(1,ye);else if(E==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(L);U?U.focus():(Z=document.getElementById(R))==null||Z.focus()}if(I(7,()=>{var U;a.current.selectedItemId=(U=Ee())==null?void 0:U.id,B.emit()}),ee||I(5,Re),((le=p.current)==null?void 0:le.value)!==void 0){let U=Y??"";(we=(fe=p.current).onValueChange)==null||we.call(fe,U);return}}B.emit()}},emit:()=>{m.current.forEach(E=>E())}}),[]),X=g.useMemo(()=>({value:(E,Y,ee)=>{var Z;Y!==((Z=f.current.get(E))==null?void 0:Z.value)&&(f.current.set(E,{value:Y,keywords:ee}),a.current.filtered.items.set(E,ne(Y,ee)),I(2,()=>{ve(),B.emit()}))},item:(E,Y)=>(c.current.add(E),Y&&(u.current.has(Y)?u.current.get(Y).add(E):u.current.set(Y,new Set([E]))),I(3,()=>{ue(),ve(),a.current.value||ye(),B.emit()}),()=>{f.current.delete(E),c.current.delete(E),a.current.filtered.items.delete(E);let ee=Ee();I(4,()=>{ue(),(ee==null?void 0:ee.getAttribute("id"))===E&&ye(),B.emit()})}),group:E=>(u.current.has(E)||u.current.set(E,new Set),()=>{f.current.delete(E),u.current.delete(E)}),filter:()=>p.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:R,inputId:L,labelId:V,listInnerRef:$}),[]);function ne(E,Y){var ee,Z;let le=(Z=(ee=p.current)==null?void 0:ee.filter)!=null?Z:Ly;return E?le(E,a.current.search,Y):0}function ve(){if(!a.current.search||p.current.shouldFilter===!1)return;let E=a.current.filtered.items,Y=[];a.current.filtered.groups.forEach(Z=>{let le=u.current.get(Z),fe=0;le.forEach(we=>{let U=E.get(we);fe=Math.max(U,fe)}),Y.push([Z,fe])});let ee=$.current;ze().sort((Z,le)=>{var fe,we;let U=Z.getAttribute("id"),he=le.getAttribute("id");return((fe=E.get(he))!=null?fe:0)-((we=E.get(U))!=null?we:0)}).forEach(Z=>{let le=Z.closest(Pc);le?le.appendChild(Z.parentElement===le?Z:Z.closest(`${Pc} > *`)):ee.appendChild(Z.parentElement===ee?Z:Z.closest(`${Pc} > *`))}),Y.sort((Z,le)=>le[1]-Z[1]).forEach(Z=>{var le;let fe=(le=$.current)==null?void 0:le.querySelector(`${Eo}[${xs}="${encodeURIComponent(Z[0])}"]`);fe==null||fe.parentElement.appendChild(fe)})}function ye(){let E=ze().find(ee=>ee.getAttribute("aria-disabled")!=="true"),Y=E==null?void 0:E.getAttribute(xs);B.setState("value",Y||void 0)}function ue(){var E,Y,ee,Z;if(!a.current.search||p.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let le=0;for(let fe of c.current){let we=(Y=(E=f.current.get(fe))==null?void 0:E.value)!=null?Y:"",U=(Z=(ee=f.current.get(fe))==null?void 0:ee.keywords)!=null?Z:[],he=ne(we,U);a.current.filtered.items.set(fe,he),he>0&&le++}for(let[fe,we]of u.current)for(let U of we)if(a.current.filtered.items.get(U)>0){a.current.filtered.groups.add(fe);break}a.current.filtered.count=le}function Re(){var E,Y,ee;let Z=Ee();Z&&(((E=Z.parentElement)==null?void 0:E.firstChild)===Z&&((ee=(Y=Z.closest(Eo))==null?void 0:Y.querySelector(Ty))==null||ee.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function Ee(){var E;return(E=$.current)==null?void 0:E.querySelector(`${om}[aria-selected="true"]`)}function ze(){var E;return Array.from(((E=$.current)==null?void 0:E.querySelectorAll(Wp))||[])}function Oe(E){let Y=ze()[E];Y&&B.setState("value",Y.getAttribute(xs))}function Pe(E){var Y;let ee=Ee(),Z=ze(),le=Z.findIndex(we=>we===ee),fe=Z[le+E];(Y=p.current)!=null&&Y.loop&&(fe=le+E<0?Z[Z.length-1]:le+E===Z.length?Z[0]:Z[le+E]),fe&&B.setState("value",fe.getAttribute(xs))}function K(E){let Y=Ee(),ee=Y==null?void 0:Y.closest(Eo),Z;for(;ee&&!Z;)ee=E>0?Gy(ee,Eo):Wy(ee,Eo),Z=ee==null?void 0:ee.querySelector(Wp);Z?B.setState("value",Z.getAttribute(xs)):Pe(E)}let se=()=>Oe(ze().length-1),Q=E=>{E.preventDefault(),E.metaKey?se():E.altKey?K(1):Pe(1)},C=E=>{E.preventDefault(),E.metaKey?Oe(0):E.altKey?K(-1):Pe(-1)};return g.createElement(at.div,{ref:o,tabIndex:-1,...M,"cmdk-root":"",onKeyDown:E=>{var Y;(Y=M.onKeyDown)==null||Y.call(M,E);let ee=E.nativeEvent.isComposing||E.keyCode===229;if(!(E.defaultPrevented||ee))switch(E.key){case"n":case"j":{N&&E.ctrlKey&&Q(E);break}case"ArrowDown":{Q(E);break}case"p":case"k":{N&&E.ctrlKey&&C(E);break}case"ArrowUp":{C(E);break}case"Home":{E.preventDefault(),Oe(0);break}case"End":{E.preventDefault(),se();break}case"Enter":{E.preventDefault();let Z=Ee();if(Z){let le=new Event(nd);Z.dispatchEvent(le)}}}}},g.createElement("label",{"cmdk-label":"",htmlFor:X.inputId,id:X.labelId,style:qy},v),Ca(s,E=>g.createElement(am.Provider,{value:B},g.createElement(lm.Provider,{value:X},E))))}),zy=g.forwardRef((s,o)=>{var a,c;let u=br(),f=g.useRef(null),m=g.useContext(im),p=Qo(),v=dm(s),x=(c=(a=v.current)==null?void 0:a.forceMount)!=null?c:m==null?void 0:m.forceMount;Ln(()=>{if(!x)return p.item(u,m==null?void 0:m.id)},[x]);let b=um(u,f,[s.value,s.children,f],s.keywords),w=gd(),P=on(I=>I.value&&I.value===b.current),O=on(I=>x||p.filter()===!1?!0:I.search?I.filtered.items.get(u)>0:!0);g.useEffect(()=>{let I=f.current;if(!(!I||s.disabled))return I.addEventListener(nd,z),()=>I.removeEventListener(nd,z)},[O,s.onSelect,s.disabled]);function z(){var I,B;j(),(B=(I=v.current).onSelect)==null||B.call(I,b.current)}function j(){w.setState("value",b.current,!0)}if(!O)return null;let{disabled:N,value:M,onSelect:R,forceMount:V,keywords:L,...$}=s;return g.createElement(at.div,{ref:As(f,o),...$,id:u,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!P,"data-disabled":!!N,"data-selected":!!P,onPointerMove:N||p.getDisablePointerSelection()?void 0:j,onClick:N?void 0:z},s.children)}),Fy=g.forwardRef((s,o)=>{let{heading:a,children:c,forceMount:u,...f}=s,m=br(),p=g.useRef(null),v=g.useRef(null),x=br(),b=Qo(),w=on(O=>u||b.filter()===!1?!0:O.search?O.filtered.groups.has(m):!0);Ln(()=>b.group(m),[]),um(m,p,[s.value,s.heading,v]);let P=g.useMemo(()=>({id:m,forceMount:u}),[u]);return g.createElement(at.div,{ref:As(p,o),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0},a&&g.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:x},a),Ca(s,O=>g.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?x:void 0},g.createElement(im.Provider,{value:P},O))))}),Iy=g.forwardRef((s,o)=>{let{alwaysRender:a,...c}=s,u=g.useRef(null),f=on(m=>!m.search);return!a&&!f?null:g.createElement(at.div,{ref:As(u,o),...c,"cmdk-separator":"",role:"separator"})}),$y=g.forwardRef((s,o)=>{let{onValueChange:a,...c}=s,u=s.value!=null,f=gd(),m=on(x=>x.search),p=on(x=>x.selectedItemId),v=Qo();return g.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),g.createElement(at.input,{ref:o,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":p,id:v.inputId,type:"text",value:u?s.value:m,onChange:x=>{u||f.setState("search",x.target.value),a==null||a(x.target.value)}})}),Uy=g.forwardRef((s,o)=>{let{children:a,label:c="Suggestions",...u}=s,f=g.useRef(null),m=g.useRef(null),p=on(x=>x.selectedItemId),v=Qo();return g.useEffect(()=>{if(m.current&&f.current){let x=m.current,b=f.current,w,P=new ResizeObserver(()=>{w=requestAnimationFrame(()=>{let O=x.offsetHeight;b.style.setProperty("--cmdk-list-height",O.toFixed(1)+"px")})});return P.observe(x),()=>{cancelAnimationFrame(w),P.unobserve(x)}}},[]),g.createElement(at.div,{ref:As(f,o),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":c,id:v.listId},Ca(s,x=>g.createElement("div",{ref:As(m,v.listInnerRef),"cmdk-list-sizer":""},x)))}),By=g.forwardRef((s,o)=>{let{open:a,onOpenChange:c,overlayClassName:u,contentClassName:f,container:m,...p}=s;return g.createElement(qh,{open:a,onOpenChange:c},g.createElement(Jh,{container:m},g.createElement(Xh,{"cmdk-overlay":"",className:u}),g.createElement(em,{"aria-label":s.label,"cmdk-dialog":"",className:f},g.createElement(cm,{ref:o,...p}))))}),Vy=g.forwardRef((s,o)=>on(a=>a.filtered.count===0)?g.createElement(at.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Hy=g.forwardRef((s,o)=>{let{progress:a,children:c,label:u="Loading...",...f}=s;return g.createElement(at.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},Ca(s,m=>g.createElement("div",{"aria-hidden":!0},m)))}),ms=Object.assign(cm,{List:Uy,Item:zy,Input:$y,Group:Fy,Separator:Iy,Dialog:By,Empty:Vy,Loading:Hy});function Gy(s,o){let a=s.nextElementSibling;for(;a;){if(a.matches(o))return a;a=a.nextElementSibling}}function Wy(s,o){let a=s.previousElementSibling;for(;a;){if(a.matches(o))return a;a=a.previousElementSibling}}function dm(s){let o=g.useRef(s);return Ln(()=>{o.current=s}),o}var Ln=typeof window>"u"?g.useEffect:g.useLayoutEffect;function gs(s){let o=g.useRef();return o.current===void 0&&(o.current=s()),o}function on(s){let o=gd(),a=()=>s(o.snapshot());return g.useSyncExternalStore(o.subscribe,a,a)}function um(s,o,a,c=[]){let u=g.useRef(),f=Qo();return Ln(()=>{var m;let p=(()=>{var x;for(let b of a){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(x=b.current.textContent)==null?void 0:x.trim():u.current}})(),v=c.map(x=>x.trim());f.value(s,p,v),(m=o.current)==null||m.setAttribute(xs,p),u.current=p}),u}var Ky=()=>{let[s,o]=g.useState(),a=gs(()=>new Map);return Ln(()=>{a.current.forEach(c=>c()),a.current=new Map},[s]),(c,u)=>{a.current.set(c,u),o({})}};function Qy(s){let o=s.type;return typeof o=="function"?o(s.props):"render"in o?o.render(s.props):s}function Ca({asChild:s,children:o},a){return s&&g.isValidElement(o)?g.cloneElement(Qy(o),{ref:o.ref},a(o.props.children)):a(o)}var qy={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Zy({onNavigate:s}){const[o,a]=g.useState(!1);return g.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key.toLowerCase()==="k"&&(u.preventDefault(),a(f=>!f))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),r.jsx(ms.Dialog,{open:o,onOpenChange:a,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>a(!1),children:r.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:c=>c.stopPropagation(),children:[r.jsx(ms.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),r.jsxs(ms.List,{className:"max-h-80 overflow-y-auto p-2",children:[r.jsx(ms.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),r.jsx(ms.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Xc.map(c=>r.jsxs(ms.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{s(c.id),a(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[r.jsx(c.icon,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:c.label}),r.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function be(s,o){var v;const a={"Content-Type":"application/json",...o==null?void 0:o.headers},c=localStorage.getItem("mc_sudo_password"),u=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let f=o==null?void 0:o.body;if((((v=o==null?void 0:o.method)==null?void 0:v.toUpperCase())||"GET")==="POST"){if(typeof f=="string")try{const x=JSON.parse(f);let b=!1;c&&!("sudo_password"in x)&&(x.sudo_password=c,b=!0),u&&!("hf_token"in x)&&(x.hf_token=u,b=!0),b&&(f=JSON.stringify(x))}catch{}else if(!f){const x={};c&&(x.sudo_password=c),u&&(x.hf_token=u),Object.keys(x).length>0&&(f=JSON.stringify(x))}}const p=await fetch(s,{...o,headers:a,body:f});if(!p.ok)throw new Error(`${p.status} ${p.statusText}`);return p.json()}const Ze={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],updates:["updates"],discover:["discover"],drafts:s=>["drafts",s??""],connect:s=>["connect",s??""],memory:(s,o)=>["memory",s??"",o??""]},Yy=()=>Dt({queryKey:Ze.health,queryFn:()=>be("/api/health"),refetchInterval:1e4}),vd=(s=5e3)=>Dt({queryKey:Ze.systemStatus,queryFn:()=>be("/api/system/status"),refetchInterval:s}),Jy=(s=3e3)=>Dt({queryKey:Ze.services,queryFn:()=>be("/api/system/services"),refetchInterval:s}),Ls=(s=4e3)=>Dt({queryKey:Ze.models,queryFn:()=>be("/api/models"),refetchInterval:s}),Xy=(s=4e3)=>Dt({queryKey:Ze.routing,queryFn:()=>be("/api/routing"),refetchInterval:s}),fm=(s=2e3)=>Dt({queryKey:Ze.jobs,queryFn:()=>be("/api/jobs"),refetchInterval:s,select:o=>o.jobs??[]}),pm=(s=3e3)=>Dt({queryKey:Ze.tokenStats,queryFn:()=>be("/api/system/token-stats"),refetchInterval:s}),hm=(s=5e3)=>Dt({queryKey:Ze.agentStatus,queryFn:()=>be("/api/agent/status"),refetchInterval:s}),yd=s=>Dt({queryKey:Ze.updates,queryFn:()=>be("/api/maintenance/updates"),refetchInterval:s}),eb=()=>Dt({queryKey:Ze.discover,queryFn:()=>be("/api/discover")}),tb=s=>Dt({queryKey:Ze.drafts(s),queryFn:()=>be(`/api/models/drafts?target=${encodeURIComponent(s??"")}`),enabled:!!s}),mm=s=>Dt({queryKey:Ze.connect(s),queryFn:()=>be(s?`/api/connect?${s}`:"/api/connect")}),xm=s=>Dt({queryKey:Ze.memory(s==null?void 0:s.q,s==null?void 0:s.category),queryFn:()=>{const o=new URLSearchParams;return s!=null&&s.q&&o.set("q",s.q),s!=null&&s.category&&o.set("category",s.category),be(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function St(s){return(s/1024**3).toFixed(1)}function sd(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function gr(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function rb(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Kp(s){return s?`${Math.round(s/1024)}k`:"—"}function gm(s){var o,a,c="";if(typeof s=="string"||typeof s=="number")c+=s;else if(typeof s=="object")if(Array.isArray(s)){var u=s.length;for(o=0;o{const o=lb(s),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=s;return{getClassGroupId:m=>{const p=m.split(bd);return p[0]===""&&p.length!==1&&p.shift(),vm(p,o)||ob(m)},getConflictingClassGroupIds:(m,p)=>{const v=a[m]||[];return p&&c[m]?[...v,...c[m]]:v}}},vm=(s,o)=>{var m;if(s.length===0)return o.classGroupId;const a=s[0],c=o.nextPart.get(a),u=c?vm(s.slice(1),c):void 0;if(u)return u;if(o.validators.length===0)return;const f=s.join(bd);return(m=o.validators.find(({validator:p})=>p(f)))==null?void 0:m.classGroupId},Qp=/^\[(.+)\]$/,ob=s=>{if(Qp.test(s)){const o=Qp.exec(s)[1],a=o==null?void 0:o.substring(0,o.indexOf(":"));if(a)return"arbitrary.."+a}},lb=s=>{const{theme:o,prefix:a}=s,c={nextPart:new Map,validators:[]};return ib(Object.entries(s.classGroups),a).forEach(([f,m])=>{od(m,c,f,o)}),c},od=(s,o,a,c)=>{s.forEach(u=>{if(typeof u=="string"){const f=u===""?o:qp(o,u);f.classGroupId=a;return}if(typeof u=="function"){if(ab(u)){od(u(c),o,a,c);return}o.validators.push({validator:u,classGroupId:a});return}Object.entries(u).forEach(([f,m])=>{od(m,qp(o,f),a,c)})})},qp=(s,o)=>{let a=s;return o.split(bd).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},ab=s=>s.isThemeGetter,ib=(s,o)=>o?s.map(([a,c])=>{const u=c.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([m,p])=>[o+m,p])):f);return[a,u]}):s,cb=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,a=new Map,c=new Map;const u=(f,m)=>{a.set(f,m),o++,o>s&&(o=0,c=a,a=new Map)};return{get(f){let m=a.get(f);if(m!==void 0)return m;if((m=c.get(f))!==void 0)return u(f,m),m},set(f,m){a.has(f)?a.set(f,m):u(f,m)}}},ym="!",db=s=>{const{separator:o,experimentalParseClassName:a}=s,c=o.length===1,u=o[0],f=o.length,m=p=>{const v=[];let x=0,b=0,w;for(let N=0;Nb?w-b:void 0;return{modifiers:v,hasImportantModifier:O,baseClassName:z,maybePostfixModifierPosition:j}};return a?p=>a({className:p,parseClassName:m}):m},ub=s=>{if(s.length<=1)return s;const o=[];let a=[];return s.forEach(c=>{c[0]==="["?(o.push(...a.sort(),c),a=[]):a.push(c)}),o.push(...a.sort()),o},fb=s=>({cache:cb(s.cacheSize),parseClassName:db(s),...sb(s)}),pb=/\s+/,hb=(s,o)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:u}=o,f=[],m=s.trim().split(pb);let p="";for(let v=m.length-1;v>=0;v-=1){const x=m[v],{modifiers:b,hasImportantModifier:w,baseClassName:P,maybePostfixModifierPosition:O}=a(x);let z=!!O,j=c(z?P.substring(0,O):P);if(!j){if(!z){p=x+(p.length>0?" "+p:p);continue}if(j=c(P),!j){p=x+(p.length>0?" "+p:p);continue}z=!1}const N=ub(b).join(":"),M=w?N+ym:N,R=M+j;if(f.includes(R))continue;f.push(R);const V=u(j,z);for(let L=0;L0?" "+p:p)}return p};function mb(){let s=0,o,a,c="";for(;s{if(typeof s=="string")return s;let o,a="";for(let c=0;cw(b),s());return a=fb(x),c=a.cache.get,u=a.cache.set,f=p,p(v)}function p(v){const x=c(v);if(x)return x;const b=hb(v,a);return u(v,b),b}return function(){return f(mb.apply(null,arguments))}}const Ue=s=>{const o=a=>a[s]||[];return o.isThemeGetter=!0,o},wm=/^\[(?:([a-z-]+):)?(.+)\]$/i,gb=/^\d+\/\d+$/,vb=new Set(["px","full","screen"]),yb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mr=s=>ys(s)||vb.has(s)||gb.test(s),Vr=s=>zs(s,"length",Rb),ys=s=>!!s&&!Number.isNaN(Number(s)),Mc=s=>zs(s,"number",ys),_o=s=>!!s&&Number.isInteger(Number(s)),Nb=s=>s.endsWith("%")&&ys(s.slice(0,-1)),Ne=s=>wm.test(s),Hr=s=>yb.test(s),Sb=new Set(["length","size","percentage"]),Cb=s=>zs(s,Sb,jm),Eb=s=>zs(s,"position",jm),_b=new Set(["image","url"]),Pb=s=>zs(s,_b,Db),Mb=s=>zs(s,"",Ob),Po=()=>!0,zs=(s,o,a)=>{const c=wm.exec(s);return c?c[1]?typeof o=="string"?c[1]===o:o.has(c[1]):a(c[2]):!1},Rb=s=>bb.test(s)&&!wb.test(s),jm=()=>!1,Ob=s=>jb.test(s),Db=s=>kb.test(s),Ab=()=>{const s=Ue("colors"),o=Ue("spacing"),a=Ue("blur"),c=Ue("brightness"),u=Ue("borderColor"),f=Ue("borderRadius"),m=Ue("borderSpacing"),p=Ue("borderWidth"),v=Ue("contrast"),x=Ue("grayscale"),b=Ue("hueRotate"),w=Ue("invert"),P=Ue("gap"),O=Ue("gradientColorStops"),z=Ue("gradientColorStopPositions"),j=Ue("inset"),N=Ue("margin"),M=Ue("opacity"),R=Ue("padding"),V=Ue("saturate"),L=Ue("scale"),$=Ue("sepia"),I=Ue("skew"),B=Ue("space"),X=Ue("translate"),ne=()=>["auto","contain","none"],ve=()=>["auto","hidden","clip","visible","scroll"],ye=()=>["auto",Ne,o],ue=()=>[Ne,o],Re=()=>["",mr,Vr],Ee=()=>["auto",ys,Ne],ze=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Oe=()=>["solid","dashed","dotted","double","none"],Pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],se=()=>["","0",Ne],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>[ys,Ne];return{cacheSize:500,separator:":",theme:{colors:[Po],spacing:[mr,Vr],blur:["none","",Hr,Ne],brightness:C(),borderColor:[s],borderRadius:["none","","full",Hr,Ne],borderSpacing:ue(),borderWidth:Re(),contrast:C(),grayscale:se(),hueRotate:C(),invert:se(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[Nb,Vr],inset:ye(),margin:ye(),opacity:C(),padding:ue(),saturate:C(),scale:C(),sepia:se(),skew:C(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Ne]}],container:["container"],columns:[{columns:[Hr]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ze(),Ne]}],overflow:[{overflow:ve()}],"overflow-x":[{"overflow-x":ve()}],"overflow-y":[{"overflow-y":ve()}],overscroll:[{overscroll:ne()}],"overscroll-x":[{"overscroll-x":ne()}],"overscroll-y":[{"overscroll-y":ne()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",_o,Ne]}],basis:[{basis:ye()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ne]}],grow:[{grow:se()}],shrink:[{shrink:se()}],order:[{order:["first","last","none",_o,Ne]}],"grid-cols":[{"grid-cols":[Po]}],"col-start-end":[{col:["auto",{span:["full",_o,Ne]},Ne]}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":[Po]}],"row-start-end":[{row:["auto",{span:[_o,Ne]},Ne]}],"row-start":[{"row-start":Ee()}],"row-end":[{"row-end":Ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ne]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ne]}],gap:[{gap:[P]}],"gap-x":[{"gap-x":[P]}],"gap-y":[{"gap-y":[P]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],pe:[{pe:[R]}],pt:[{pt:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[N]}],mx:[{mx:[N]}],my:[{my:[N]}],ms:[{ms:[N]}],me:[{me:[N]}],mt:[{mt:[N]}],mr:[{mr:[N]}],mb:[{mb:[N]}],ml:[{ml:[N]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ne,o]}],"min-w":[{"min-w":[Ne,o,"min","max","fit"]}],"max-w":[{"max-w":[Ne,o,"none","full","min","max","fit","prose",{screen:[Hr]},Hr]}],h:[{h:[Ne,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ne,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ne,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ne,o,"auto","min","max","fit"]}],"font-size":[{text:["base",Hr,Vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mc]}],"font-family":[{font:[Po]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ne]}],"line-clamp":[{"line-clamp":["none",ys,Mc]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mr,Ne]}],"list-image":[{"list-image":["none",Ne]}],"list-style-type":[{list:["none","disc","decimal",Ne]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[s]}],"placeholder-opacity":[{"placeholder-opacity":[M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[M]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mr,Vr]}],"underline-offset":[{"underline-offset":["auto",mr,Ne]}],"text-decoration-color":[{decoration:[s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[M]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ze(),Eb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Cb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Pb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[z]}],"gradient-via-pos":[{via:[z]}],"gradient-to-pos":[{to:[z]}],"gradient-from":[{from:[O]}],"gradient-via":[{via:[O]}],"gradient-to":[{to:[O]}],rounded:[{rounded:[f]}],"rounded-s":[{"rounded-s":[f]}],"rounded-e":[{"rounded-e":[f]}],"rounded-t":[{"rounded-t":[f]}],"rounded-r":[{"rounded-r":[f]}],"rounded-b":[{"rounded-b":[f]}],"rounded-l":[{"rounded-l":[f]}],"rounded-ss":[{"rounded-ss":[f]}],"rounded-se":[{"rounded-se":[f]}],"rounded-ee":[{"rounded-ee":[f]}],"rounded-es":[{"rounded-es":[f]}],"rounded-tl":[{"rounded-tl":[f]}],"rounded-tr":[{"rounded-tr":[f]}],"rounded-br":[{"rounded-br":[f]}],"rounded-bl":[{"rounded-bl":[f]}],"border-w":[{border:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[M]}],"border-style":[{border:[...Oe(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[M]}],"divide-style":[{divide:Oe()}],"border-color":[{border:[u]}],"border-color-x":[{"border-x":[u]}],"border-color-y":[{"border-y":[u]}],"border-color-s":[{"border-s":[u]}],"border-color-e":[{"border-e":[u]}],"border-color-t":[{"border-t":[u]}],"border-color-r":[{"border-r":[u]}],"border-color-b":[{"border-b":[u]}],"border-color-l":[{"border-l":[u]}],"divide-color":[{divide:[u]}],"outline-style":[{outline:["",...Oe()]}],"outline-offset":[{"outline-offset":[mr,Ne]}],"outline-w":[{outline:[mr,Vr]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[M]}],"ring-offset-w":[{"ring-offset":[mr,Vr]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",Hr,Mb]}],"shadow-color":[{shadow:[Po]}],opacity:[{opacity:[M]}],"mix-blend":[{"mix-blend":[...Pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Pe()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",Hr,Ne]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[w]}],saturate:[{saturate:[V]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[M]}],"backdrop-saturate":[{"backdrop-saturate":[V]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[m]}],"border-spacing-x":[{"border-spacing-x":[m]}],"border-spacing-y":[{"border-spacing-y":[m]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ne]}],duration:[{duration:C()}],ease:[{ease:["linear","in","out","in-out",Ne]}],delay:[{delay:C()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ne]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[L]}],"scale-x":[{"scale-x":[L]}],"scale-y":[{"scale-y":[L]}],rotate:[{rotate:[_o,Ne]}],"translate-x":[{"translate-x":[X]}],"translate-y":[{"translate-y":[X]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ne]}],accent:[{accent:["auto",s]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ne]}],"caret-color":[{caret:[s]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ne]}],fill:[{fill:[s,"none"]}],"stroke-w":[{stroke:[mr,Vr,Mc]}],stroke:[{stroke:[s,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Tb=xb(Ab);function J(...s){return Tb(nb(s))}function Uo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const Lb={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"};function zb(){const{data:s}=Ls(2e3),{data:o}=pm(2e3),a=(s==null?void 0:s.models)??[],c=(s==null?void 0:s.running)??[],u=a.filter(v=>c.includes(v.name)),f=g.useRef(null),[m,p]=g.useState(!1);return g.useEffect(()=>{if(!o)return;const v=o.total_tokens;if(f.current!==null&&v>f.current){p(!0);const x=setTimeout(()=>p(!1),4e3);return f.current=v,()=>clearTimeout(x)}f.current=v},[o==null?void 0:o.total_tokens]),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ao,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),r.jsxs("span",{className:J("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",m?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[m?r.jsx(Fo,{className:"h-3 w-3 animate-pulse"}):r.jsx(D0,{className:"h-3 w-3"}),m?"Inferenz aktiv":"Idle"]})]}),u.length===0?r.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):r.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:u.map(v=>{var x;return r.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[v.role&&r.jsx("span",{className:J("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",Lb[v.role]||"bg-slate-500/15 text-slate-300 border-slate-500/25"),children:v.role}),r.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(x=v.name.split("/").pop())==null?void 0:x.replace(/\.gguf$/i,"")})]}),r.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[gr(v.size_bytes)," im Unified-RAM"]})]}),r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[r.jsx("span",{className:J("h-1.5 w-1.5 rounded-full bg-emerald-500",m&&"animate-pulse")})," warm"]})]},v.name)})})]})}function pa({value:s,label:o,detail:a}){const u=2*Math.PI*24,f=u-Math.min(s,100)/100*u,m=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return r.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[r.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),r.jsx("circle",{cx:"32",cy:"32",r:24,className:J("fill-none transition-all duration-700 ease-out",m),strokeWidth:"4.5",strokeDasharray:u,strokeDashoffset:f,strokeLinecap:"round"})]}),r.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),r.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),a&&r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function Fb(){const{data:s}=vd(3e3);return r.jsxs("div",{className:"md:col-span-2 flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(pa,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),r.jsx(pa,{value:s.ram.percent,label:"RAM",detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&r.jsx(pa,{value:s.gpu.busy_percent,label:"GPU",detail:`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB`}),s.disk&&r.jsx(pa,{value:s.disk.percent,label:"Disk",detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(s==null?void 0:s.temp)&&(s.temp.cpu||s.temp.gpu)&&r.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[s.temp.cpu!=null&&r.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&r.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]})}function km({type:s,title:o,message:a,defaultValue:c,onConfirm:u,onCancel:f}){const m=g.useRef(null);return r.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),r.jsx("button",{onClick:f||(()=>u()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),s==="prompt"&&r.jsx("input",{ref:m,type:"text",defaultValue:c,className:"w-full h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:p=>{var v;p.key==="Enter"&&u((v=m.current)==null?void 0:v.value)}}),r.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&r.jsx("button",{onClick:f,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),r.jsx("button",{onClick:()=>{var v;const p=s==="prompt"?(v=m.current)==null?void 0:v.value:void 0;u(p)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:s==="confirm"?"Ja, fortfahren":s==="prompt"?"Übernehmen":"OK"})]})]})})}function Fn(){const[s,o]=g.useState(null),a=g.useCallback(()=>o(null),[]),c=g.useCallback((p,v,x)=>{o({type:"alert",title:p,message:v,onConfirm:()=>{o(null),x==null||x()}})},[]),u=g.useCallback((p,v,x,b)=>{o({type:"confirm",title:p,message:v,onConfirm:()=>{o(null),x()},onCancel:()=>{o(null),b==null||b()}})},[]),f=g.useCallback((p,v,x,b,w)=>{o({type:"prompt",title:p,message:v,defaultValue:x,onConfirm:P=>{o(null),b(P)},onCancel:()=>{o(null),w==null||w()}})},[]),m=s?r.jsx(km,{...s}):null;return{showAlert:c,showConfirm:u,showPrompt:f,close:a,dialogElement:m}}function Ib(){var $;const s=ln(),{data:o}=yd(3e3),{data:a=[]}=fm(3e3),{showConfirm:c,dialogElement:u}=Fn(),[f,m]=g.useState(""),[p,v]=g.useState(!1),[x,b]=g.useState(""),[w,P]=g.useState(!1),[O,z]=g.useState({open:!1,actionPath:"",actionLabel:""}),j=()=>{s.invalidateQueries({queryKey:Ze.updates}),s.invalidateQueries({queryKey:Ze.jobs}),s.invalidateQueries({queryKey:Ze.models})};async function N(I,B,X,ne){m(`${B} wird ausgeführt...`),v(!0);try{const ve={...X},ye=await be(I,{method:"POST",body:JSON.stringify(ve)});if(ye.status==="password_required"||ye.status==="incorrect_password"){z({open:!0,actionPath:I,actionLabel:B,payload:X,error:ye.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),m("");return}ye.job_id?m(`${B} gestartet (Job-ID: ${ye.job_id})`):ye.ok?m(`${B} erfolgreich ausgeführt.`):m(`Fehler: ${ye.err||"Unbekannter Fehler"}`),j()}catch(ve){m(`Fehler bei ${B}: ${ve.message}`)}finally{v(!1)}}async function M(){P(!0);try{const I={...O.payload,sudo_password:x},B=await be(O.actionPath,{method:"POST",body:JSON.stringify(I)});if(B.status==="password_required"||B.status==="incorrect_password"){z(X=>({...X,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}B.job_id?m(`${O.actionLabel} gestartet (Job-ID: ${B.job_id})`):B.ok?m(`${O.actionLabel} erfolgreich ausgeführt.`):m(`Fehler: ${B.err||"Unbekannter Fehler"}`),z({open:!1,actionPath:"",actionLabel:""}),b(""),j()}catch(I){m(`Fehler: ${I.message}`),z({open:!1,actionPath:"",actionLabel:""}),b("")}finally{P(!1)}}async function R(I,B){m(`Upgrade für ${I} wird gestartet...`);try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:I,role:B,quant:"Q4_K_M",jinja:!0})}),m("Upgrade-Download gestartet."),j()}catch(X){m(`Upgrade fehlgeschlagen: ${X.message}`)}}const V=a.find(I=>I.label.includes("OS-Update")&&(I.state==="running"||I.state==="queued")),L=a.find(I=>I.label.includes("Engine-Update")&&(I.state==="running"||I.state==="queued"));return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[O.open&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:r.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/60 bg-card/90 backdrop-blur-xl p-5 shadow-2xl space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),r.jsx("button",{onClick:()=>{z({open:!1,actionPath:"",actionLabel:""}),b("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",r.jsx("strong",{children:O.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"password",value:x,onChange:I=>b(I.target.value),placeholder:"Sudo-Passwort eingeben...",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground",onKeyDown:I=>I.key==="Enter"&&M(),autoFocus:!0}),O.error&&r.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:O.error})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{z({open:!1,actionPath:"",actionLabel:""}),b("")},className:"h-8 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent transition-all cursor-pointer",children:"Abbrechen"}),r.jsx("button",{onClick:M,disabled:!x||w,className:"h-8 px-4 rounded-lg bg-primary text-primary-foreground text-[10px] font-bold uppercase hover:opacity-90 transition-all disabled:opacity-50 cursor-pointer flex items-center justify-center gap-1.5",children:w?"Prüfe...":"Ausführen"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(I0,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(o==null?void 0:o.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(o.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),o?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.os>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsx("span",{children:"OS-Pakete"}),r.jsx("span",{className:"font-mono",children:o.os>0?`${o.os} verfügbar`:"aktuell"})]}),r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.engine>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsx("span",{children:"Engine (llama.cpp)"}),r.jsx("span",{className:"font-mono",children:o.engine>0?"Update verfügbar":"aktuell"})]}),r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",o.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsx("span",{children:"Modell-Upgrades"}),r.jsx("span",{className:"font-mono",children:o.models>0?`${o.models} verfügbar`:"aktuell"})]}),($=o.components)==null?void 0:$.map(I=>{const B=I.update===!0;return r.jsxs("div",{className:J("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",B?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[I.name,I.reachable===!1&&r.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),r.jsx("span",{className:"font-mono text-[10px]",title:I.current?`installiert: ${I.current}`:void 0,children:B?`Update: ${I.latest}`:I.update===!1?"aktuell":I.latest?`neueste: ${I.latest}`:"—"})]},I.key)})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[r.jsx("button",{onClick:()=>N("/api/maintenance/os-update","OS-Update"),disabled:p||!!V,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:V?r.jsxs(r.Fragment,{children:[r.jsx(An,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",V.progress??0,"%)"]})]}):r.jsx("span",{children:"OS Update"})}),r.jsx("button",{onClick:()=>N("/api/maintenance/engine-update","Engine-Update"),disabled:p||!!L,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:L?r.jsxs(r.Fragment,{children:[r.jsx(An,{className:"h-3 w-3 animate-spin text-primary"}),r.jsxs("span",{children:["Aktiv (",L.progress??0,"%)"]})]}):r.jsx("span",{children:"Engine Update"})})]}),r.jsxs("button",{onClick:()=>{c("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>N("/api/maintenance/reboot","Reboot"))},disabled:p,className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 text-red-400 text-[10px] font-bold uppercase hover:bg-red-500/10 transition-all cursor-pointer disabled:opacity-50",children:[r.jsx(Ph,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Host Reboot"})]}),o.model_list.length>0&&r.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[r.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),r.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:o.model_list.map(I=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-background/25 border border-border/30 text-[10px] font-mono text-muted-foreground",children:[r.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${I.role}: ${I.repo}`,children:[r.jsx("span",{className:"text-primary font-bold uppercase",children:I.role}),": ",I.repo.split("/").pop()]}),r.jsxs("button",{onClick:()=>R(I.repo,I.role),className:"px-2 py-0.5 text-[8px] font-bold uppercase rounded bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer flex items-center gap-0.5",children:[r.jsx(Tn,{className:"h-2.5 w-2.5"})," Laden"]})]},I.repo))})]})]}):r.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),f&&r.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:f}),r.jsxs("div",{className:"text-[9px] text-muted-foreground/60 leading-normal border-t border-border/10 pt-2.5 flex items-start gap-1",children:[r.jsx(Ds,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),r.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",r.jsx("code",{children:"/etc/sudoers"})," (z.B. ",r.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),r.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:r.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer")),className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer shadow-md shadow-primary/10",children:"System-Zentrale öffnen"})}),u]})}function $b(){const s=ln(),{data:o}=hm(3e3),{data:a}=Ls(),{showAlert:c,dialogElement:u}=Fn(),[f,m]=g.useState(!1),p=(a==null?void 0:a.models)??[];async function v(x){try{await be("/api/agent/brain",{method:"POST",body:JSON.stringify({model:x})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${x}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Ze.agentStatus}),m(!1)}catch(b){c("Fehler",`Fehler beim Wechseln des Gehirns: ${b.message}`)}}return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ya,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(o==null?void 0:o.webui_url)&&r.jsxs("a",{href:Uo(o.webui_url),target:"_blank",rel:"noopener",className:J("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[r.jsx(ba,{className:"h-3 w-3"})," AnythingLLM öffnen"]})]}),o?r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.gateway_reachable?"Online":"Offline"})]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"AnythingLLM"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",o.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-medium",children:o.webui_reachable?"Online":"Offline"})]})]}),r.jsxs("div",{onClick:()=>m(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),r.jsx(Ot,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[r.jsx(Lo,{className:"h-3 w-3 shrink-0"}),o.brain_model||"auto"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),r.jsx(zo,{className:"h-3 w-3 text-primary"})]}),r.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[r.jsxs("div",{children:["Config: ",o.has_config?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Skills: ",o.has_skills?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),r.jsxs("div",{children:["Memory: ",o.has_memories?r.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),o&&r.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Telegram"}),r.jsx("span",{className:J("font-semibold",o.telegram_enabled?"text-emerald-400":""),children:o.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"MCP-Server"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[o.mcp_server_count??0," verbunden"]})]}),r.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"PC Executor"}),r.jsx("span",{className:J("font-semibold",o.pc_executor_reachable?"text-emerald-400":""),children:o.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),o&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),r.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',r.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),r.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...p.map(x=>{var b;return((b=x.name.split("/").pop())==null?void 0:b.replace(".gguf",""))||x.name})].map(x=>{const b=["auto","fast","heavy"].includes(x);return r.jsxs("button",{onClick:()=>v(x),className:J("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",o.brain_model===x||!o.brain_model&&x==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:x}),r.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:b?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===x||!o.brain_model&&x==="auto")&&r.jsx(nn,{className:"h-4 w-4 shrink-0 text-primary"})]},x)})})]})}),u]})}const Ub=["fast","heavy","coder","vision","scout"];function Bb(){const{data:s}=Ls(3e3),o=(s==null?void 0:s.models)??[],a=(s==null?void 0:s.running)??[];return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Lo,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),r.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:Ub.map(c=>{var m;const u=o.find(p=>p.role===c),f=u?a.includes(u.name):!1;return r.jsxs("div",{className:J("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",f?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":u?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[r.jsx("div",{className:"min-w-0 flex-1 mr-2",children:r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:J("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",c==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":c==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":c==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":c==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:c}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:u?(m=u.name.split("/").pop())==null?void 0:m.replace(/\.gguf$/i,""):"nicht zugewiesen"}),u&&r.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[u.prompt_cache&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),u.spec_active&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${u.spec_draft_model})`,children:"SPEC"}),u.parallel_slots>1&&r.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${u.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",u.parallel_slots]}),u.incomplete&&r.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),r.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:u?f?r.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):r.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},c)})})]}),r.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Vb(){const s=ln(),{data:o=[]}=xm({limit:3}),[a,c]=g.useState(""),[u,f]=g.useState("stable"),[m,p]=g.useState(!1);async function v(){if(!(!a.trim()||m)){p(!0);try{await be("/api/memory",{method:"POST",body:JSON.stringify({content:a,category:u,source:"dashboard"})}),c(""),s.invalidateQueries({queryKey:["memory"]})}catch(x){console.error(x)}finally{p(!1)}}}return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("textarea",{value:a,onChange:x=>c(x.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),r.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[r.jsxs("select",{value:u,onChange:x=>f(x.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[r.jsx("option",{value:"stable",children:"🔵 Fakt"}),r.jsx("option",{value:"instruction",children:"📋 Regel"}),r.jsx("option",{value:"user",children:"👤 User"}),r.jsx("option",{value:"versioned",children:"🟡 Version"})]}),r.jsxs("button",{onClick:v,disabled:!a.trim()||m,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[r.jsx(_h,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),r.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[r.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),r.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:o.length===0?r.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):o.map(x=>r.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[r.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:x.category}),r.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:x.content,children:x.content})]},x.id))})]})]}),r.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}function Hb(){var o;const{data:s}=pm(3e3);return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(N0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),s?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),r.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[s.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),r.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",s.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),r.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),r.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:s.total_tokens.toLocaleString("de-DE")}),r.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Input (Prompts):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),r.jsxs("div",{className:"flex justify-between items-center font-mono",children:[r.jsx("span",{children:"Output (Antworten):"}),r.jsxs("span",{className:"font-semibold text-foreground",children:[s.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):r.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),r.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet ggü. Cloud-APIs",(o=s==null?void 0:s.pricing)!=null&&o.heavy?` (Ø ${(s.pricing.heavy.in??0).toFixed(2).replace(".",",")} $ / ${(s.pricing.heavy.out??0).toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})}function Gb(){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),r.jsx(zb,{}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[r.jsx(Fb,{}),r.jsx(Ib,{})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[r.jsx($b,{}),r.jsx(Bb,{}),r.jsx(Vb,{}),r.jsx(Hb,{})]})]})}function Wb(){const s=ln(),{data:o=[]}=fm(2e3),{showAlert:a,dialogElement:c}=Fn();async function u(p){try{await be(`/api/jobs/${p}/cancel`,{method:"POST"}),s.invalidateQueries({queryKey:Ze.jobs})}catch(v){a("Fehler",v.message)}}const f=o.filter(p=>p.state==="running"||p.state==="queued"),m=o.filter(p=>p.state!=="running"&&p.state!=="queued").slice(-3);return f.length===0&&m.length===0?null:r.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[r.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),f.map(p=>r.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[r.jsxs("div",{className:"flex justify-between items-center text-xs",children:[r.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:p.label}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-muted-foreground font-mono",children:[p.progress??0,"% • ",sd(p.done_bytes),"/",sd(p.total_bytes),p.eta_s?` • ETA ${rb(p.eta_s)}`:""]}),r.jsx("button",{onClick:()=>u(p.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),r.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${p.progress??0}%`}})})]},p.id)),m.map(p=>r.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[r.jsx("span",{className:"truncate",children:p.label}),r.jsx("span",{className:J("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",p.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:p.state})]},p.id)),c]})}function kn({children:s,tone:o="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return r.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[o]}`,children:s})}function Zp({caps:s}){return s?r.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&r.jsx(kn,{children:"💻 Code"}),s.vision&&r.jsx(kn,{children:"👁 Bild"}),s.reasoning&&r.jsx(kn,{children:"🧠 Reason"}),s.moe&&r.jsxs(kn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&r.jsx(kn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&r.jsx(kn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&r.jsx(kn,{children:"🔢 Embed"})]}):null}const Kb=["fast","heavy","coder","vision","scout"];function Qb({fit:s}){const o={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[s.level];return r.jsxs("span",{className:J("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}function Yp(s){const o=s.toLowerCase();return o.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:o.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:o.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:o.includes("mistral")||o.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:o.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:o.includes("hermes")||o.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:o.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function qb({model:s,onClose:o,onChanged:a}){var j,N;const{data:c,isLoading:u}=tb(s.gguf_path),[f,m]=g.useState(null),[p,v]=g.useState(""),x=c==null?void 0:c.target_vocab,b=(c==null?void 0:c.drafts)??[],w=b.filter(M=>M.compatible===!0),P=s.spec_draft_model;async function O(M){m(M??"__clear__"),v("");try{await be(`/api/models/${encodeURIComponent(s.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:M})}),a(),o()}catch(R){v(String((R==null?void 0:R.message)||R)),m(null)}}const z=M=>{var R;return M?`${M.pre??"?"} · ${((R=M.n_vocab)==null?void 0:R.toLocaleString())??"?"} Tokens`:"—"};return r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[r.jsx(Fo,{className:"h-4 w-4"})," Speculative Draft"]}),r.jsx("button",{onClick:o,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',r.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),r.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:(j=s.name.split("/").pop())==null?void 0:j.replace(/\.gguf$/i,"")}),r.jsxs("span",{className:"text-foreground",children:["Vocab: ",z(x)]})]}),s.spec_active&&P&&r.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[r.jsx(nn,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",P]}),r.jsx("button",{onClick:()=>O(null),disabled:f!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(c!=null&&c.target_exists)&&r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[r.jsx(Jc,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),r.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:u?r.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):b.length===0?r.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",r.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):b.map(M=>{var L,$;const R=M.filename===P,V=M.compatible===!0;return r.jsxs("div",{className:J("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",V?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",R&&"border-primary/40 bg-primary/10"),children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:M.filename}),r.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[gr(M.size_bytes)," · Vocab: ",z(M.vocab)]})]}),V?R?r.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[r.jsx(nn,{className:"h-3.5 w-3.5"})," Aktiv"]}):r.jsx("button",{onClick:()=>O(M.path),disabled:f!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):r.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:M.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(L=M.vocab)==null?void 0:L.pre}/${($=M.vocab)==null?void 0:$.n_vocab} ≠ Modell ${x==null?void 0:x.pre}/${x==null?void 0:x.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[r.jsx(Jc,{className:"h-3.5 w-3.5"})," ",M.compatible===!1?"Vocab ≠":"n/a"]})]},M.path)})}),!u&&(c==null?void 0:c.target_exists)&&b.length>0&&w.length===0&&r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",r.jsx("span",{className:"font-mono",children:x==null?void 0:x.pre}),", n_vocab=",r.jsx("span",{className:"font-mono",children:(N=x==null?void 0:x.n_vocab)==null?void 0:N.toLocaleString()}),")."]}),p&&r.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:p})]})})}function Zb(){var Is,$n,$s,Un,jr;const s=ln(),{data:o,isLoading:a,error:c}=Ls(4e3),{data:u}=Xy(4e3),{data:f}=mm(),{data:m}=yd(4e3),{showAlert:p,showConfirm:v,showPrompt:x,dialogElement:b}=Fn(),w=(o==null?void 0:o.models)??[],P=(o==null?void 0:o.running)??[],O=c?String(c):"",z=()=>{s.invalidateQueries({queryKey:Ze.models}),s.invalidateQueries({queryKey:Ze.routing})},[j,N]=g.useState(null),[M,R]=g.useState(null),[V,L]=g.useState(null),[$,I]=g.useState(!1),[B,X]=g.useState(null),[ne,ve]=g.useState("grid"),[ye,ue]=g.useState("all"),Re=w.filter(A=>ye==="in_use"?!!A.role||P.includes(A.name):!0),[Ee,ze]=g.useState({width:800,height:360}),Oe=g.useRef(null),Pe=g.useCallback(A=>{if(Oe.current&&(Oe.current.disconnect(),Oe.current=null),A){const ae=new ResizeObserver(ke=>{if(!ke||ke.length===0)return;const Te=ke[0].contentRect;ze({width:Te.width,height:Te.height})});ae.observe(A),Oe.current=ae}},[]),K=Ee.width,se=Ee.height,Q=A=>{const ae=K*.1,ke=se*A,Te=K*.5,Ve=se*.5,lr=K*.3,cn=ke,kr=K*.3;return`M ${ae} ${ke} C ${lr} ${cn}, ${kr} ${Ve}, ${Te} ${Ve}`},C=A=>{const ae=K*.5,ke=se*.5,Te=K*.9,Ve=se*A,lr=K*.7,cn=ke,kr=K*.7;return`M ${ae} ${ke} C ${lr} ${cn}, ${kr} ${Ve}, ${Te} ${Ve}`};async function E(A){try{await be(`/api/models/${encodeURIComponent(A)}/load`,{method:"POST"}),z()}catch(ae){p("Fehler",`Fehler beim Laden des Modells: ${ae.message}`)}}async function Y(A){try{await be(`/api/models/${encodeURIComponent(A)}/unload`,{method:"POST"}),z()}catch(ae){p("Fehler",`Fehler beim Entladen des Modells: ${ae.message}`)}}async function ee(){try{await be("/api/models/unload",{method:"POST"}),z()}catch(A){p("Fehler",`Fehler beim Entladen aller Modelle: ${A.message}`)}}async function Z(A,ae){try{await be(`/api/models/${encodeURIComponent(ae)}/role`,{method:"POST",body:JSON.stringify({role:A||null})}),z()}catch(ke){p("Fehler",`Fehler beim Zuweisen der Rolle: ${ke.message||ke}`)}}async function le(A,ae){x("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(ae||32768),async ke=>{if(ke)try{await be(`/api/models/${encodeURIComponent(A)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ke,10)})}),z()}catch(Te){p("Fehler",`Fehler beim Setzen des Kontexts: ${Te.message||Te}`)}})}async function fe(A){v("Modell löschen?",`Modell '${A}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await be(`/api/models/${encodeURIComponent(A)}`,{method:"DELETE"}),z()}catch(ae){p("Fehler",`Fehler beim Löschen: ${ae.message||ae}`)}})}async function we(A,ae,ke,Te){try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:A,role:ae,quant:ke,jinja:Te})}),p("Herunterladen gestartet",`Download für '${A}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ve){p("Fehler",`Fehler beim Starten des Upgrades: ${Ve.message||Ve}`)}}async function U(A){A&&(await navigator.clipboard.writeText(A),I(!0),setTimeout(()=>I(!1),1500))}if(a)return r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(O)return r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",O,")."]});const he=w.filter(A=>P.includes(A.name)),pt=he.reduce((A,ae)=>A+(ae.size_bytes||0),0),Fs=16*1024**3,an=pt>Fs?pt*1.2:Fs,In=A=>w.find(ae=>ae.role===A),wr=A=>{const ae=In(A);return ae?P.includes(ae.name):!1};return r.jsxs("div",{className:"space-y-8",children:[r.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -377,7 +377,7 @@ Error generating stack: `+d.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zc,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",gr(pt)," / ",gr(an)," geladen"]}),P.length>0&&r.jsx("button",{onClick:ee,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),r.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:he.length===0?r.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):he.map((A,ae)=>{var Ve;const ke=(A.size_bytes||0)/an*100,Te=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][ae%4];return r.jsxs("div",{style:{width:`${ke}%`},className:J("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Te),title:`${A.name} (${gr(A.size_bytes)})`,children:[r.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[A.role?`[${A.role}] `:"",(Ve=A.name.split("/").pop())==null?void 0:Ve.replace(".gguf","")]}),r.jsx("span",{className:"text-[8px] font-mono opacity-80",children:gr(A.size_bytes)})]},A.name)})})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),r.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),r.jsxs("div",{ref:Pe,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[r.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),r.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),r.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),r.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),r.jsx("path",{d:Q(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="roocode"||j==="roocode")&&r.jsx("path",{d:Q(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="cursor"||j==="cursor")&&r.jsx("path",{d:Q(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="opencode"||j==="opencode")&&r.jsx("path",{d:Q(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="zed"||j==="zed")&&r.jsx("path",{d:Q(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="continue"||j==="continue")&&r.jsx("path",{d:Q(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("fast")&&r.jsx("path",{d:C(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("heavy")&&r.jsx("path",{d:C(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("coder")&&r.jsx("path",{d:C(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("vision")&&r.jsx("path",{d:C(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("scout")&&r.jsx("path",{d:C(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>X("roocode"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="roocode"?null:"roocode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Roo Code"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>X("cursor"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="cursor"?null:"cursor"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Cursor IDE"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>X("opencode"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="opencode"?null:"opencode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"OpenCode"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>X("zed"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="zed"?null:"zed"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Zed"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>X("continue"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="continue"?null:"continue"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Continue"})]}),r.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[r.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",u!=null&&u.heavy_threshold_chars?u.heavy_threshold_chars/1e3:"4","k Zeichen"]}),r.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),Kb.map(A=>{var lr;const ae=["12%","31%","50%","69%","88%"],ke=In(A),Te=ke?P.includes(ke.name):!1;if(A==="agent")return null;const Ve={fast:0,heavy:1,coder:2,vision:3,scout:4}[A];return r.jsxs("div",{className:J("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",Te?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ke?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:ae[Ve]},onClick:()=>R(A),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:A}),Te&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ke?(lr=ke.name.split("/").pop())==null?void 0:lr.replace(".gguf",""):"Keine Zuweisung"})]},A)}),j&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[j==="roocode"&&"Roo Code Setup",j==="cursor"&&"Cursor Setup",j==="opencode"&&"OpenCode Setup",j==="zed"&&"Zed Setup",j==="continue"&&"Continue Setup"]}),r.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[j==="roocode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",r.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),r.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",r.jsx("strong",{children:"OpenAI Compatible"}),"."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",r.jsx("code",{children:"settings.json"})," ein."]})]}),j==="cursor"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne Cursor Settings ➔ ",r.jsx("strong",{children:"Models"}),"."]}),r.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",r.jsx("strong",{children:"OpenAI API"})," auf."]}),r.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",r.jsx("strong",{children:"auto"}),"."]})]}),j==="opencode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die ",r.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),r.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",r.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),j==="zed"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die Zed Settings (",r.jsx("code",{children:"ctrl+,"}),")."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",r.jsx("code",{children:"language_models"})," ein."]})]}),j==="continue"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),r.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",r.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),f.tools&&r.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),r.jsxs("button",{onClick:()=>{var A,ae,ke,Te,Ve;return U(j==="roocode"?(A=f.tools.cline)==null?void 0:A.snippet:j==="cursor"?(ae=f.tools.cursor)==null?void 0:ae.snippet:j==="opencode"?(ke=f.tools.opencode)==null?void 0:ke.snippet:j==="zed"?(Te=f.tools.zed)==null?void 0:Te.snippet:(Ve=f.tools.continue)==null?void 0:Ve.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[$?r.jsx(nn,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Eh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:$?"Kopiert":"Kopieren"})]})]}),r.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:r.jsxs("code",{children:[j==="roocode"&&((Is=f.tools.cline)==null?void 0:Is.snippet),j==="cursor"&&(($n=f.tools.cursor)==null?void 0:$n.snippet),j==="opencode"&&(($s=f.tools.opencode)==null?void 0:$s.snippet),j==="zed"&&((Un=f.tools.zed)==null?void 0:Un.snippet),j==="continue"&&((jr=f.tools.continue)==null?void 0:jr.snippet)]})})]}),r.jsx("button",{onClick:()=>N(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),r.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),r.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),r.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(A=>{var Te;const ae=w.find(Ve=>Ve.role===A),ke=ae?P.includes(ae.name):!1;return r.jsxs("div",{onClick:()=>R(A),className:J("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",ke?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":ae?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:J("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",A==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":A==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":A==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":A==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:A}),ke&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:ae==null?void 0:ae.name,children:ae?(Te=ae.name.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,""):"nicht zugewiesen"}),r.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},A)})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[r.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Re.length," von ",w.length,")"]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>ue("all"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ye==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),r.jsx("button",{onClick:()=>ue("in_use"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ye==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>ve("grid"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),r.jsx("button",{onClick:()=>ve("list"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),ne==="grid"?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Re.length===0?r.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ye==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(A=>{const ae=P.includes(A.name),ke=m==null?void 0:m.model_list.find(Ve=>Ve.role===A.role),Te=Yp(A.name);return r.jsxs("div",{className:J("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",ae?"border-primary/45 shadow-primary/5":A.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-start justify-between gap-3",children:r.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[r.jsx("div",{className:J("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Te.color),title:Te.name,children:Te.initial}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:A.name,children:A.name.split("/").pop()}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[r.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:A.quant||"GGUF"}),ae&&r.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[r.jsx(Ao,{className:"h-3 w-3 animate-pulse"})," Warm"]}),A.role&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:A.role}),A.prompt_cache&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),A.spec_active?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${A.spec_draft_model})`,children:"SPEC"}):A.spec_draft_model?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${A.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,A.parallel_slots>1&&r.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${A.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",A.parallel_slots]}),A.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),r.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:r.jsx(Zp,{caps:A.capabilities})})]}),r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(Zc,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),r.jsx("div",{className:"text-foreground font-semibold",children:gr(A.size_bytes)})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(A0,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),r.jsx("div",{className:"text-foreground font-semibold",children:Kp(A.ctx)})]})]})]}),ke&&r.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),r.jsxs("span",{children:["Upgrade verfügbar: ",ke.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>we(ke.repo,A.role,A.quant||"Q4_K_M",A.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[r.jsx(Tn,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[r.jsx("button",{onClick:()=>ae?Y(A.name):E(A.name),disabled:A.incomplete&&!ae,className:J("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",A.incomplete&&!ae?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ae?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ae?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>le(A.name,A.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),r.jsxs("button",{onClick:()=>L(A),className:J("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",A.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":A.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[r.jsx(wa,{className:"h-3 w-3"})," Spec"]}),r.jsx("button",{onClick:()=>fe(A.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:r.jsx(Yc,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})}):r.jsx("div",{className:"space-y-2",children:Re.length===0?r.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ye==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(A=>{const ae=P.includes(A.name),ke=Yp(A.name);return r.jsxs("div",{className:J("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",ae?"border-primary/45":A.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx("div",{className:J("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ke.color),title:ke.name,children:ke.initial}),r.jsxs("div",{className:"min-w-0 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:A.name,children:A.name.split("/").pop()}),A.role&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:A.role}),A.prompt_cache&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),A.spec_active?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${A.spec_draft_model})`,children:"SPEC"}):A.spec_draft_model?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${A.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,A.parallel_slots>1&&r.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${A.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",A.parallel_slots]}),A.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),ae&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[r.jsxs("span",{children:["Größe: ",gr(A.size_bytes)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Kontext: ",Kp(A.ctx)]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:"font-mono text-[9px]",children:A.quant||"GGUF"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[r.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:r.jsx(Zp,{caps:A.capabilities})}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{onClick:()=>ae?Y(A.name):E(A.name),disabled:A.incomplete&&!ae,className:J("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",A.incomplete&&!ae?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ae?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ae?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>le(A.name,A.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),r.jsxs("button",{onClick:()=>L(A),className:J("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",A.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":A.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[r.jsx(wa,{className:"h-3 w-3"})," Spec"]}),r.jsx("button",{onClick:()=>fe(A.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:r.jsx(Yc,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})})]}),M&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",M,"' konfigurieren"]}),r.jsx("button",{onClick:()=>R(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",r.jsx("strong",{className:"text-foreground",children:M}),":"]}),r.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[r.jsx("button",{onClick:()=>{Z(M,""),R(null)},className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:r.jsx("span",{children:"Zuweisung entfernen"})}),w.map(A=>{var ae;return r.jsxs("button",{onClick:()=>{Z(M,A.name),R(null)},className:J("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",A.role===M?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(ae=A.name.split("/").pop())==null?void 0:ae.replace(".gguf","")}),r.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[gr(A.size_bytes)," · ",A.quant]})]}),A.role===M&&r.jsx(nn,{className:"h-4 w-4 shrink-0 text-primary"})]},A.name)})]})]})}),V&&r.jsx(qb,{model:V,onClose:()=>L(null),onChanged:z}),b]})}function Yb(){const[s,o]=g.useState(""),[a,c]=g.useState([]),[u,f]=g.useState("Q4_K_M"),[m,p]=g.useState(""),[v,x]=g.useState(""),[b,w]=g.useState(""),[P,O]=g.useState([]),z=["fast","heavy","coder","vision","scout"];async function j(R){const V=R??s;if(V.trim()){p("Analysiere HuggingFace Repository...");try{const L=await be(`/api/hf/quants?repo=${encodeURIComponent(V)}`);o(L.repo),c(L.quants),L.quants.length&&f(L.quants.includes("Q4_K_M")?"Q4_K_M":L.quants[0]),p(L.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(L){p(`Fehler: ${L}`)}}}async function N(){if(b.trim()){p("Durchsuche HuggingFace...");try{const R=await be(`/api/hf/search?q=${encodeURIComponent(b)}`);O(R.results),p(R.results.length?"":"Keine Ergebnisse gefunden.")}catch(R){p(`Suche fehlgeschlagen: ${R}`)}}}async function M(){if(s.trim()){p("Download-Job wird initiiert...");try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:u,role:v||void 0,jinja:!0})}),p(`Download gestartet: ${s} (${u})${v?`, Rolle: ${v}`:""}. Fortschritt oben.`+(v==="fast"||v==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(R){p(`Download-Fehler: ${R}`)}}}return r.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsx("input",{value:s,onChange:R=>o(R.target.value),placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>j(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),a.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("select",{value:u,onChange:R=>f(R.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:a.map(R=>r.jsx("option",{value:R,className:"bg-popover text-foreground",children:R},R))}),r.jsxs("select",{value:v,onChange:R=>x(R.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration wie parallele Slots",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[r.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),z.map(R=>r.jsx("option",{value:R,className:"bg-popover text-foreground",children:R},R))]}),r.jsxs("button",{onClick:M,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[r.jsx(Tn,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),r.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:b,onChange:R=>w(R.target.value),onKeyDown:R=>R.key==="Enter"&&N(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),r.jsx(pd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.jsx("button",{onClick:N,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),P.length>0&&r.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:P.map(R=>r.jsxs("button",{onClick:()=>{o(R.repo),O([]),w(""),j(R.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[r.jsx("span",{className:"font-semibold truncate",children:R.repo}),r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[r.jsx(Tn,{className:"h-3 w-3"})," ",R.downloads.toLocaleString()]})]},R.repo))}),m&&r.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:m})]})}const Jb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:qc},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Kc},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Lo},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:To},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Qc}};function Xb(){const{data:s,isLoading:o,error:a}=eb(),{data:c}=Ls(),{data:u}=yd(),f=(c==null?void 0:c.models)??[],m=a?String(a):"",[p,v]=g.useState({}),[x,b]=g.useState({}),[w,P]=g.useState(!1);async function O(z,j,N,M){v(R=>({...R,[z]:"Starte..."}));try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:z,role:j,quant:N,jinja:M})}),v(R=>({...R,[z]:"Download läuft"}))}catch{v(V=>({...V,[z]:"Fehler"}))}}return o?r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):m||!s?r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",m,")."]}):r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[r.jsxs("div",{children:["Modell-Registry geladen für ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Mh,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),r.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(z=>{const j=Jb[z.role]||{title:z.title||z.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:zo},N=j.icon,M=f.find(B=>B.role===z.role),R=u==null?void 0:u.model_list.find(B=>B.role===z.role),V=z.models.find(B=>B.repo===z.recommended)||z.models[0];if(!V)return null;const L=p[V.repo],$=z.models.filter(B=>B.repo!==z.recommended),I=!!x[z.role];return r.jsxs("div",{className:J("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",M?"border-border/60":"border-primary/20 shadow-primary/5"),children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:r.jsx(N,{className:"h-5.5 w-5.5"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:j.title}),r.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",z.role]})]})]}),M?r.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):r.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:j.desc}),r.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:M?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:M.name,children:M.name.split("/").pop()}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[r.jsxs("span",{children:["Größe: ",sd(M.size_bytes||0)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",M.quant||"GGUF"]})]})]}):r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:V.name,children:V.name}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{children:["Ersteller: ",V.author]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",V.quant]})]}),r.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:r.jsx(Qb,{fit:V.fit})})]})}),r.jsx("div",{className:"pt-1",children:M?R?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),r.jsxs("span",{children:["Bessere Version in der Registry: ",R.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>O(R.repo,z.role,V.quant||"Q4_K_M",V.caps.tools!=="no"),disabled:!!p[R.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[r.jsx(Tn,{className:"h-3.5 w-3.5"}),p[R.repo]||"Auf neue Version aktualisieren"]})]}):r.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[r.jsx(nn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):r.jsxs("button",{onClick:()=>O(V.repo,z.role,V.quant||"Q4_K_M",V.caps.tools!=="no"),disabled:!!L,className:J("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",L?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[r.jsx(Tn,{className:"h-3.5 w-3.5"}),L||"Optimales Modell einsetzen"]})})]}),$.length>0&&r.jsxs("div",{className:"border-t border-border/20 pt-3",children:[r.jsxs("button",{onClick:()=>b(B=>({...B,[z.role]:!I})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[I?r.jsx(w0,{className:"h-3 w-3"}):r.jsx(v0,{className:"h-3 w-3"}),r.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",$.length,")"]})]}),I&&r.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:$.map(B=>r.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:B.name,children:B.name}),r.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[r.jsxs("span",{children:["Quant: ",B.quant]}),r.jsx("span",{children:"•"}),r.jsx("span",{children:B.fit.text})]})]}),r.jsx("button",{onClick:()=>O(B.repo,z.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!p[B.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:p[B.repo]||"Installieren"})]},B.repo))})]})]},z.role)})}),r.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[r.jsxs("button",{onClick:()=>P(!w),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pd,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),r.jsx("span",{className:"text-[10px] text-primary hover:underline",children:w?"Ausblenden ▲":"Anzeigen ▼"})]}),w&&r.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:r.jsx(Yb,{})})]})]})}function e1(){const[s,o]=g.useState("cockpit");return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),r.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(a=>r.jsx("button",{onClick:()=>o(a),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",s===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),r.jsx(Wb,{}),r.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?r.jsx(Zb,{}):r.jsx(Xb,{})})]})}function ha({label:s,percent:o,detail:a,icon:c}){const u=o>90?"bg-red-500 shadow-md shadow-red-500/20":o>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/30 transition-all duration-300",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),r.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),r.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:r.jsx("div",{className:J("h-full transition-all duration-700 ease-out",u),style:{width:`${Math.min(o,100)}%`}})}),a&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function t1(){const{data:s,error:o}=vd(3e3),{data:a}=Jy(3e3),{showAlert:c,dialogElement:u}=Fn(),f=o?String(o):"",[m,p]=g.useState(""),[v,x]=g.useState({});async function b(){p("Backup snapshotted...");try{const P=await be("/api/system/backup",{method:"POST"});p(P.ok?`Snapshot erzeugt: ${P.snapshot} (${P.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(P){p(`Fehler: ${P.message}`)}}async function w(P){x(O=>({...O,[P]:!0}));try{const O=await be("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:P})});O.ok?c("Erfolgreich",`Dienst ${P} wurde erfolgreich neu gestartet.`):c("Fehler beim Neustart",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){c("Fehler",`Fehler: ${O.message}`)}finally{x(O=>({...O,[P]:!1}))}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"System-Diagnose & Status"}),r.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["System-Status nicht lesbar (",f,")."]}),s&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(ha,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:Ot}),r.jsx(ha,{label:"RAM",percent:s.ram.percent,detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`,icon:Ao}),s.gpu&&s.gpu.busy_percent!=null&&r.jsx(ha,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${St(s.gpu.vram_used)} / ${St(s.gpu.vram_total)} GB VRAM`:void 0,icon:Ot}),s.disk&&r.jsx(ha,{label:"Disk",percent:s.disk.percent,detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`,icon:Zc})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&r.jsxs("div",{className:"flex gap-3 text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-2.5 rounded-xl self-start w-fit",children:[s.temp.cpu!=null&&r.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&r.jsx("span",{children:"|"}),s.temp.gpu!=null&&r.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),a&&r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),r.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"h-7 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",children:"System-Logs anzeigen"})]}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(P=>r.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-xl bg-background/20 border border-border/30 hover:border-primary/20 transition-all group",children:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx("span",{className:J("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",P.ok?"bg-emerald-500":"bg-amber-500")}),r.jsxs("div",{className:"truncate",children:[r.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:P.name}),r.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:P.url})]})]}),r.jsx("button",{onClick:()=>w(P.name),disabled:v[P.name],className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-primary hover:bg-primary/5 flex items-center justify-center transition-all opacity-0 group-hover:opacity-100",title:"Dienst neu starten",children:r.jsx(An,{className:J("h-3.5 w-3.5",v[P.name]&&"animate-spin")})})]},P.name))}),r.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[r.jsxs("a",{href:Uo(a.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[r.jsx(ya,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),r.jsxs("a",{href:Uo(a.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[r.jsx(ya,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),r.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:r.jsxs("button",{onClick:b,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[r.jsx(L0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),m&&r.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:m}),u]})}function r1(){const[s,o]=g.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=g.useState(localStorage.getItem("mc_mcp_path")||""),[u,f]=g.useState("cline"),[m,p]=g.useState(!1),v=new URLSearchParams({host:s});a&&v.set("mcp_path",a);const{data:x,error:b}=mm(v.toString()),w=b?String(b):"";function P(N){o(N),N&&localStorage.setItem("mc_host",N)}function O(N){c(N),localStorage.setItem("mc_mcp_path",N)}const z=x==null?void 0:x.tools[u];async function j(){z&&(await navigator.clipboard.writeText(z.snippet),p(!0),setTimeout(()=>p(!1),1500))}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Kopiere vorgefertigte Konfigurationsdateien für deinen lokalen PC (IDEs, Cline, Roo Code, Cursor), um direkt auf das geteilte Gedächtnis und den Auto-Swap-Gateway der Box zuzugreifen."})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(_0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),r.jsx("input",{value:s,onChange:N=>P(N.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(E0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),r.jsx("input",{value:a,onChange:N=>O(N.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]})]}),w&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",w]}),x&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex flex-wrap gap-1 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:Object.entries(x.tools).map(([N,M])=>r.jsx("button",{onClick:()=>f(N),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",u===N?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:M.label},N))}),z&&r.jsxs("div",{className:"space-y-3",children:[z.note&&r.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-xs text-muted-foreground leading-relaxed",children:[r.jsx(P0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),r.jsx("span",{children:z.note})]}),r.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:[r.jsx(ba,{className:"h-3.5 w-3.5 text-primary"}),r.jsx("span",{children:u==="cline"||u==="cursor"?"config.json":"settings.json"})]}),r.jsxs("button",{onClick:j,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[m?r.jsx(nn,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Eh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:m?"Kopiert":"Kopieren"})]})]}),r.jsx("pre",{className:"p-5 overflow-x-auto text-xs font-mono text-cyan-200/90 whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",children:r.jsx("code",{children:z.snippet})})]})]})]})]})}const Jp=["user","instruction","stable","versioned","ephemeral"],Rc={user:{label:"User",icon:B0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:z0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Ds,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:U0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:k0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Xp={label:"Gedächtnis",icon:Ch,bg:"bg-muted/10",text:"text-muted-foreground"},n1={user:"border-l-cyan-500/80",instruction:"border-l-violet-500/80",stable:"border-l-indigo-500/80",versioned:"border-l-amber-500/80",ephemeral:"border-l-pink-500/80"};function s1(){const[s,o]=g.useState(""),[a,c]=g.useState(""),[u,f]=g.useState(""),[m,p]=g.useState("stable"),[v,x]=g.useState(!1),b=ln(),{showAlert:w,showConfirm:P,dialogElement:O}=Fn(),{data:z=[],error:j}=xm({q:a,category:s}),N=j?String(j):"",M=()=>b.invalidateQueries({queryKey:["memory"]});async function R(){u.trim()&&(await be("/api/memory",{method:"POST",body:JSON.stringify({content:u,category:m,source:"ui"})}),f(""),M())}async function V($){await be(`/api/memory/${$}`,{method:"DELETE"}),M()}async function L(){x(!0);try{const $=await be("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if($.duplicate_count===0){w("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}P("Deduplizierung bestätigen",`${$.duplicate_count} Dublette(n) in ${$.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await be("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),M()}catch(I){w("Fehler",`Fehler beim Löschen: ${I.message}`)}})}catch($){w("Fehler",`Fehler bei der Deduplizierung: ${$.message}`)}finally{x(!1)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool (Memory)"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Die geteilte Konstitution des Systems. Alle Instanzen (Hermes, IDEs, Gateway) lesen und schreiben hierauf per MCP-Protokoll."})]}),r.jsxs("button",{onClick:L,disabled:v,className:"flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50 shrink-0 self-start",children:[r.jsx($0,{className:"h-4 w-4 text-primary animate-pulse"}),r.jsx("span",{children:"Deduplizieren"})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),r.jsx("textarea",{value:u,onChange:$=>f($.target.value),placeholder:"Füge eine neue Regel, eine Vorliebe oder einen stabilen Fakt über das Projekt oder dich hinzu...",rows:3,className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3.5 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground transition-all leading-relaxed"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),r.jsx("select",{value:m,onChange:$=>p($.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 py-1 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Jp.map($=>{var I;return r.jsx("option",{value:$,className:"bg-popover text-foreground",children:((I=Rc[$])==null?void 0:I.label)||$},$)})})]}),r.jsxs("button",{onClick:R,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[r.jsx(_h,{className:"h-4 w-4"})," Speichern"]})]})]}),r.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:a,onChange:$=>c($.target.value),placeholder:"Gedächtnis durchsuchen...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),r.jsx(pd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl overflow-x-auto max-w-full",children:[r.jsx("button",{onClick:()=>o(""),className:J("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",s?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Jp.map($=>{const I=Rc[$]||Xp,B=I.icon;return r.jsxs("button",{onClick:()=>o($),className:J("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 whitespace-nowrap",s===$?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[r.jsx(B,{className:"h-3 w-3"}),r.jsx("span",{children:I.label})]},$)})]})]}),N&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Laden des Gedächtnisses: ",N]}),r.jsx("div",{className:"space-y-3",children:z.length===0?r.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):z.map($=>{const I=Rc[$.category]||Xp,B=I.icon;return r.jsxs("div",{className:J("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",n1[$.category]||"border-l-muted"),children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[r.jsxs("span",{className:J("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",I.bg,I.text),children:[r.jsx(B,{className:"h-3 w-3"}),r.jsx("span",{className:"hidden sm:inline",children:I.label})]}),r.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:$.content})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[r.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-background/20 px-1.5 py-0.5 rounded uppercase tracking-wider",children:$.source}),r.jsx("button",{onClick:()=>V($.id),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",title:"Eintrag löschen",children:r.jsx(Yc,{className:"h-3.5 w-3.5"})})]})]},$.id)})}),O]})}function ma({label:s,ok:o,detail:a,icon:c,onClick:u}){return r.jsxs("div",{onClick:u,className:J("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",o?"border-border/60":"border-amber-500/30",u&&"cursor-pointer hover:bg-card/70"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),r.jsx(c,{className:J("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),a&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),u&&r.jsxs("button",{onClick:f=>{f.stopPropagation(),u()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[r.jsx(Ot,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Gehirn wechseln"})]})]})}function o1(){const{data:s,error:o}=hm(5e3),{data:a}=Ls(),{showAlert:c,dialogElement:u}=Fn(),f=ln(),m=o?String(o):"",p=g.useMemo(()=>["auto","fast","heavy",...((a==null?void 0:a.models)??[]).map($=>{var I;return((I=$.name.split("/").pop())==null?void 0:I.replace(".gguf",""))||$.name})],[a]),[v,x]=g.useState(null),[b,w]=g.useState(!1),[P,O]=g.useState({width:800,height:360}),z=g.useRef(null),j=g.useCallback(L=>{if(z.current&&(z.current.disconnect(),z.current=null),L){const $=new ResizeObserver(I=>{if(!I||I.length===0)return;const B=I[0].contentRect;O({width:B.width,height:B.height})});$.observe(L),z.current=$}},[]),N=P.width,M=P.height,R=(L,$,I,B)=>{const X=(L+I)/2;return`M ${L} ${$} C ${X} ${$}, ${X} ${B}, ${I} ${B}`};async function V(L){try{await be("/api/agent/brain",{method:"POST",body:JSON.stringify({model:L})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${L}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:Ze.agentStatus}),w(!1)}catch($){c("Fehler",`Fehler beim Wechseln des Gehirns: ${$.message}`)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("style",{children:` + `}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zc,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",gr(pt)," / ",gr(an)," geladen"]}),P.length>0&&r.jsx("button",{onClick:ee,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),r.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:he.length===0?r.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):he.map((A,ae)=>{var Ve;const ke=(A.size_bytes||0)/an*100,Te=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][ae%4];return r.jsxs("div",{style:{width:`${ke}%`},className:J("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Te),title:`${A.name} (${gr(A.size_bytes)})`,children:[r.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[A.role?`[${A.role}] `:"",(Ve=A.name.split("/").pop())==null?void 0:Ve.replace(".gguf","")]}),r.jsx("span",{className:"text-[8px] font-mono opacity-80",children:gr(A.size_bytes)})]},A.name)})})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),r.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),r.jsxs("div",{ref:Pe,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[r.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),r.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),r.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),r.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),r.jsx("path",{d:Q(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="roocode"||j==="roocode")&&r.jsx("path",{d:Q(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="cursor"||j==="cursor")&&r.jsx("path",{d:Q(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="opencode"||j==="opencode")&&r.jsx("path",{d:Q(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="zed"||j==="zed")&&r.jsx("path",{d:Q(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:Q(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(B==="continue"||j==="continue")&&r.jsx("path",{d:Q(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("fast")&&r.jsx("path",{d:C(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("heavy")&&r.jsx("path",{d:C(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("coder")&&r.jsx("path",{d:C(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("vision")&&r.jsx("path",{d:C(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:C(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),wr("scout")&&r.jsx("path",{d:C(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>X("roocode"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="roocode"?null:"roocode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Roo Code"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>X("cursor"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="cursor"?null:"cursor"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Cursor IDE"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>X("opencode"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="opencode"?null:"opencode"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"OpenCode"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>X("zed"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="zed"?null:"zed"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Zed"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>X("continue"),onMouseLeave:()=>X(null),onClick:()=>N(A=>A==="continue"?null:"continue"),children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),r.jsx("span",{children:"Continue"})]}),r.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[r.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",u!=null&&u.heavy_threshold_chars?u.heavy_threshold_chars/1e3:"4","k Zeichen"]}),r.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),Kb.map(A=>{var lr;const ae=["12%","31%","50%","69%","88%"],ke=In(A),Te=ke?P.includes(ke.name):!1;if(A==="agent")return null;const Ve={fast:0,heavy:1,coder:2,vision:3,scout:4}[A];return r.jsxs("div",{className:J("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",Te?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ke?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:ae[Ve]},onClick:()=>R(A),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:A}),Te&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ke?(lr=ke.name.split("/").pop())==null?void 0:lr.replace(".gguf",""):"Keine Zuweisung"})]},A)}),j&&f&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[j==="roocode"&&"Roo Code Setup",j==="cursor"&&"Cursor Setup",j==="opencode"&&"OpenCode Setup",j==="zed"&&"Zed Setup",j==="continue"&&"Continue Setup"]}),r.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[j==="roocode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",r.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),r.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",r.jsx("strong",{children:"OpenAI Compatible"}),"."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",r.jsx("code",{children:"settings.json"})," ein."]})]}),j==="cursor"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne Cursor Settings ➔ ",r.jsx("strong",{children:"Models"}),"."]}),r.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",r.jsx("strong",{children:"OpenAI API"})," auf."]}),r.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",r.jsx("strong",{children:"auto"}),"."]})]}),j==="opencode"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die ",r.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),r.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",r.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),j==="zed"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsxs("li",{children:["Öffne die Zed Settings (",r.jsx("code",{children:"ctrl+,"}),")."]}),r.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",r.jsx("code",{children:"language_models"})," ein."]})]}),j==="continue"&&r.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[r.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),r.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",r.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),f.tools&&r.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[r.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),r.jsxs("button",{onClick:()=>{var A,ae,ke,Te,Ve;return U(j==="roocode"?(A=f.tools.cline)==null?void 0:A.snippet:j==="cursor"?(ae=f.tools.cursor)==null?void 0:ae.snippet:j==="opencode"?(ke=f.tools.opencode)==null?void 0:ke.snippet:j==="zed"?(Te=f.tools.zed)==null?void 0:Te.snippet:(Ve=f.tools.continue)==null?void 0:Ve.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[$?r.jsx(nn,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Eh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:$?"Kopiert":"Kopieren"})]})]}),r.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:r.jsxs("code",{children:[j==="roocode"&&((Is=f.tools.cline)==null?void 0:Is.snippet),j==="cursor"&&(($n=f.tools.cursor)==null?void 0:$n.snippet),j==="opencode"&&(($s=f.tools.opencode)==null?void 0:$s.snippet),j==="zed"&&((Un=f.tools.zed)==null?void 0:Un.snippet),j==="continue"&&((jr=f.tools.continue)==null?void 0:jr.snippet)]})})]}),r.jsx("button",{onClick:()=>N(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),r.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),r.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),r.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(A=>{var Te;const ae=w.find(Ve=>Ve.role===A),ke=ae?P.includes(ae.name):!1;return r.jsxs("div",{onClick:()=>R(A),className:J("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",ke?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":ae?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:J("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",A==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":A==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":A==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":A==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:A}),ke&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:ae==null?void 0:ae.name,children:ae?(Te=ae.name.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,""):"nicht zugewiesen"}),r.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},A)})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[r.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Re.length," von ",w.length,")"]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>ue("all"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ye==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),r.jsx("button",{onClick:()=>ue("in_use"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ye==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),r.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[r.jsx("button",{onClick:()=>ve("grid"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),r.jsx("button",{onClick:()=>ve("list"),className:J("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),ne==="grid"?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Re.length===0?r.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ye==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(A=>{const ae=P.includes(A.name),ke=m==null?void 0:m.model_list.find(Ve=>Ve.role===A.role),Te=Yp(A.name);return r.jsxs("div",{className:J("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",ae?"border-primary/45 shadow-primary/5":A.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-start justify-between gap-3",children:r.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[r.jsx("div",{className:J("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Te.color),title:Te.name,children:Te.initial}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:A.name,children:A.name.split("/").pop()}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[r.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:A.quant||"GGUF"}),ae&&r.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[r.jsx(Ao,{className:"h-3 w-3 animate-pulse"})," Warm"]}),A.role&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:A.role}),A.prompt_cache&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),A.spec_active?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${A.spec_draft_model})`,children:"SPEC"}):A.spec_draft_model?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${A.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,A.parallel_slots>1&&r.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${A.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",A.parallel_slots]}),A.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),r.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:r.jsx(Zp,{caps:A.capabilities})})]}),r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(Zc,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),r.jsx("div",{className:"text-foreground font-semibold",children:gr(A.size_bytes)})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[r.jsx(A0,{className:"h-3.5 w-3.5 text-primary/80"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),r.jsx("div",{className:"text-foreground font-semibold",children:Kp(A.ctx)})]})]})]}),ke&&r.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),r.jsxs("span",{children:["Upgrade verfügbar: ",ke.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>we(ke.repo,A.role,A.quant||"Q4_K_M",A.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[r.jsx(Tn,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[r.jsx("button",{onClick:()=>ae?Y(A.name):E(A.name),disabled:A.incomplete&&!ae,className:J("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",A.incomplete&&!ae?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ae?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ae?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>le(A.name,A.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),r.jsxs("button",{onClick:()=>L(A),className:J("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",A.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":A.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[r.jsx(Fo,{className:"h-3 w-3"})," Spec"]}),r.jsx("button",{onClick:()=>fe(A.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:r.jsx(Yc,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})}):r.jsx("div",{className:"space-y-2",children:Re.length===0?r.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ye==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(A=>{const ae=P.includes(A.name),ke=Yp(A.name);return r.jsxs("div",{className:J("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",ae?"border-primary/45":A.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx("div",{className:J("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ke.color),title:ke.name,children:ke.initial}),r.jsxs("div",{className:"min-w-0 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:A.name,children:A.name.split("/").pop()}),A.role&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:A.role}),A.prompt_cache&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),A.spec_active?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${A.spec_draft_model})`,children:"SPEC"}):A.spec_draft_model?r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${A.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,A.parallel_slots>1&&r.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${A.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",A.parallel_slots]}),A.incomplete&&r.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),ae&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[r.jsxs("span",{children:["Größe: ",gr(A.size_bytes)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Kontext: ",Kp(A.ctx)]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:"font-mono text-[9px]",children:A.quant||"GGUF"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[r.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:r.jsx(Zp,{caps:A.capabilities})}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{onClick:()=>ae?Y(A.name):E(A.name),disabled:A.incomplete&&!ae,className:J("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",A.incomplete&&!ae?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ae?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ae?"Entladen":"Laden"}),r.jsx("button",{onClick:()=>le(A.name,A.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),r.jsxs("button",{onClick:()=>L(A),className:J("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",A.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":A.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[r.jsx(Fo,{className:"h-3 w-3"})," Spec"]}),r.jsx("button",{onClick:()=>fe(A.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:r.jsx(Yc,{className:"h-3.5 w-3.5"})})]})]})]},A.name)})})]}),M&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",M,"' konfigurieren"]}),r.jsx("button",{onClick:()=>R(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",r.jsx("strong",{className:"text-foreground",children:M}),":"]}),r.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[r.jsx("button",{onClick:()=>{Z(M,""),R(null)},className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:r.jsx("span",{children:"Zuweisung entfernen"})}),w.map(A=>{var ae;return r.jsxs("button",{onClick:()=>{Z(M,A.name),R(null)},className:J("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",A.role===M?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(ae=A.name.split("/").pop())==null?void 0:ae.replace(".gguf","")}),r.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[gr(A.size_bytes)," · ",A.quant]})]}),A.role===M&&r.jsx(nn,{className:"h-4 w-4 shrink-0 text-primary"})]},A.name)})]})]})}),V&&r.jsx(qb,{model:V,onClose:()=>L(null),onChanged:z}),b]})}function Yb(){const[s,o]=g.useState(""),[a,c]=g.useState([]),[u,f]=g.useState("Q4_K_M"),[m,p]=g.useState(""),[v,x]=g.useState(""),[b,w]=g.useState(""),[P,O]=g.useState([]),z=["fast","heavy","coder","vision","scout"];async function j(R){const V=R??s;if(V.trim()){p("Analysiere HuggingFace Repository...");try{const L=await be(`/api/hf/quants?repo=${encodeURIComponent(V)}`);o(L.repo),c(L.quants),L.quants.length&&f(L.quants.includes("Q4_K_M")?"Q4_K_M":L.quants[0]),p(L.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(L){p(`Fehler: ${L}`)}}}async function N(){if(b.trim()){p("Durchsuche HuggingFace...");try{const R=await be(`/api/hf/search?q=${encodeURIComponent(b)}`);O(R.results),p(R.results.length?"":"Keine Ergebnisse gefunden.")}catch(R){p(`Suche fehlgeschlagen: ${R}`)}}}async function M(){if(s.trim()){p("Download-Job wird initiiert...");try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:u,role:v||void 0,jinja:!0})}),p(`Download gestartet: ${s} (${u})${v?`, Rolle: ${v}`:""}. Fortschritt oben.`+(v==="fast"||v==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(R){p(`Download-Fehler: ${R}`)}}}return r.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[r.jsx("input",{value:s,onChange:R=>o(R.target.value),placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>j(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),a.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("select",{value:u,onChange:R=>f(R.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:a.map(R=>r.jsx("option",{value:R,className:"bg-popover text-foreground",children:R},R))}),r.jsxs("select",{value:v,onChange:R=>x(R.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration wie parallele Slots",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[r.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),z.map(R=>r.jsx("option",{value:R,className:"bg-popover text-foreground",children:R},R))]}),r.jsxs("button",{onClick:M,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[r.jsx(Tn,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),r.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:b,onChange:R=>w(R.target.value),onKeyDown:R=>R.key==="Enter"&&N(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),r.jsx(pd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.jsx("button",{onClick:N,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),P.length>0&&r.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:P.map(R=>r.jsxs("button",{onClick:()=>{o(R.repo),O([]),w(""),j(R.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[r.jsx("span",{className:"font-semibold truncate",children:R.repo}),r.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[r.jsx(Tn,{className:"h-3 w-3"})," ",R.downloads.toLocaleString()]})]},R.repo))}),m&&r.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:m})]})}const Jb={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:Fo},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:To},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Kc},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:qc},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:Qc}};function Xb(){const{data:s,isLoading:o,error:a}=eb(),{data:c}=Ls(),{data:u}=yd(),f=(c==null?void 0:c.models)??[],m=a?String(a):"",[p,v]=g.useState({}),[x,b]=g.useState({}),[w,P]=g.useState(!1);async function O(z,j,N,M){v(R=>({...R,[z]:"Starte..."}));try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:z,role:j,quant:N,jinja:M})}),v(R=>({...R,[z]:"Download läuft"}))}catch{v(V=>({...V,[z]:"Fehler"}))}}return o?r.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):m||!s?r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",m,")."]}):r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[r.jsxs("div",{children:["Modell-Registry geladen für ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Mh,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),r.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(z=>{const j=Jb[z.role]||{title:z.title||z.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:Lo},N=j.icon,M=f.find(B=>B.role===z.role),R=u==null?void 0:u.model_list.find(B=>B.role===z.role),V=z.models.find(B=>B.repo===z.recommended)||z.models[0];if(!V)return null;const L=p[V.repo],$=z.models.filter(B=>B.repo!==z.recommended),I=!!x[z.role];return r.jsxs("div",{className:J("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",M?"border-border/60":"border-primary/20 shadow-primary/5"),children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:r.jsx(N,{className:"h-5.5 w-5.5"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:j.title}),r.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",z.role]})]})]}),M?r.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):r.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:j.desc}),r.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:M?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:M.name,children:M.name.split("/").pop()}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[r.jsxs("span",{children:["Größe: ",sd(M.size_bytes||0)]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",M.quant||"GGUF"]})]})]}):r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),r.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:V.name,children:V.name}),r.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{children:["Ersteller: ",V.author]}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:["Quant: ",V.quant]})]}),r.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:r.jsx(Qb,{fit:V.fit})})]})}),r.jsx("div",{className:"pt-1",children:M?R?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),r.jsxs("span",{children:["Bessere Version in der Registry: ",R.repo.split("/").pop()]})]}),r.jsxs("button",{onClick:()=>O(R.repo,z.role,V.quant||"Q4_K_M",V.caps.tools!=="no"),disabled:!!p[R.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[r.jsx(Tn,{className:"h-3.5 w-3.5"}),p[R.repo]||"Auf neue Version aktualisieren"]})]}):r.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[r.jsx(nn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):r.jsxs("button",{onClick:()=>O(V.repo,z.role,V.quant||"Q4_K_M",V.caps.tools!=="no"),disabled:!!L,className:J("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",L?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[r.jsx(Tn,{className:"h-3.5 w-3.5"}),L||"Optimales Modell einsetzen"]})})]}),$.length>0&&r.jsxs("div",{className:"border-t border-border/20 pt-3",children:[r.jsxs("button",{onClick:()=>b(B=>({...B,[z.role]:!I})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[I?r.jsx(w0,{className:"h-3 w-3"}):r.jsx(v0,{className:"h-3 w-3"}),r.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",$.length,")"]})]}),I&&r.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:$.map(B=>r.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:B.name,children:B.name}),r.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[r.jsxs("span",{children:["Quant: ",B.quant]}),r.jsx("span",{children:"•"}),r.jsx("span",{children:B.fit.text})]})]}),r.jsx("button",{onClick:()=>O(B.repo,z.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!p[B.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:p[B.repo]||"Installieren"})]},B.repo))})]})]},z.role)})}),r.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[r.jsxs("button",{onClick:()=>P(!w),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pd,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),r.jsx("span",{className:"text-[10px] text-primary hover:underline",children:w?"Ausblenden ▲":"Anzeigen ▼"})]}),w&&r.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:r.jsx(Yb,{})})]})]})}function e1(){const[s,o]=g.useState("cockpit");return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),r.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(a=>r.jsx("button",{onClick:()=>o(a),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",s===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),r.jsx(Wb,{}),r.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?r.jsx(Zb,{}):r.jsx(Xb,{})})]})}function ha({label:s,percent:o,detail:a,icon:c}){const u=o>90?"bg-red-500 shadow-md shadow-red-500/20":o>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/30 transition-all duration-300",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),r.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),r.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:r.jsx("div",{className:J("h-full transition-all duration-700 ease-out",u),style:{width:`${Math.min(o,100)}%`}})}),a&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function t1(){const{data:s,error:o}=vd(3e3),{data:a}=Jy(3e3),{showAlert:c,dialogElement:u}=Fn(),f=o?String(o):"",[m,p]=g.useState(""),[v,x]=g.useState({});async function b(){p("Backup snapshotted...");try{const P=await be("/api/system/backup",{method:"POST"});p(P.ok?`Snapshot erzeugt: ${P.snapshot} (${P.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(P){p(`Fehler: ${P.message}`)}}async function w(P){x(O=>({...O,[P]:!0}));try{const O=await be("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:P})});O.ok?c("Erfolgreich",`Dienst ${P} wurde erfolgreich neu gestartet.`):c("Fehler beim Neustart",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){c("Fehler",`Fehler: ${O.message}`)}finally{x(O=>({...O,[P]:!1}))}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"System-Diagnose & Status"}),r.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["System-Status nicht lesbar (",f,")."]}),s&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(ha,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:Ot}),r.jsx(ha,{label:"RAM",percent:s.ram.percent,detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`,icon:Ao}),s.gpu&&s.gpu.busy_percent!=null&&r.jsx(ha,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${St(s.gpu.vram_used)} / ${St(s.gpu.vram_total)} GB VRAM`:void 0,icon:Ot}),s.disk&&r.jsx(ha,{label:"Disk",percent:s.disk.percent,detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`,icon:Zc})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&r.jsxs("div",{className:"flex gap-3 text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-2.5 rounded-xl self-start w-fit",children:[s.temp.cpu!=null&&r.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&r.jsx("span",{children:"|"}),s.temp.gpu!=null&&r.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",r.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),a&&r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),r.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"h-7 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",children:"System-Logs anzeigen"})]}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(P=>r.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-xl bg-background/20 border border-border/30 hover:border-primary/20 transition-all group",children:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx("span",{className:J("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",P.ok?"bg-emerald-500":"bg-amber-500")}),r.jsxs("div",{className:"truncate",children:[r.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:P.name}),r.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:P.url})]})]}),r.jsx("button",{onClick:()=>w(P.name),disabled:v[P.name],className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-primary hover:bg-primary/5 flex items-center justify-center transition-all opacity-0 group-hover:opacity-100",title:"Dienst neu starten",children:r.jsx(An,{className:J("h-3.5 w-3.5",v[P.name]&&"animate-spin")})})]},P.name))}),r.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[r.jsxs("a",{href:Uo(a.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[r.jsx(ba,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),r.jsxs("a",{href:Uo(a.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[r.jsx(ba,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),r.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:r.jsxs("button",{onClick:b,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[r.jsx(L0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),m&&r.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:m}),u]})}function r1(){const[s,o]=g.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=g.useState(localStorage.getItem("mc_mcp_path")||""),[u,f]=g.useState("cline"),[m,p]=g.useState(!1),v=new URLSearchParams({host:s});a&&v.set("mcp_path",a);const{data:x,error:b}=mm(v.toString()),w=b?String(b):"";function P(N){o(N),N&&localStorage.setItem("mc_host",N)}function O(N){c(N),localStorage.setItem("mc_mcp_path",N)}const z=x==null?void 0:x.tools[u];async function j(){z&&(await navigator.clipboard.writeText(z.snippet),p(!0),setTimeout(()=>p(!1),1500))}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Kopiere vorgefertigte Konfigurationsdateien für deinen lokalen PC (IDEs, Cline, Roo Code, Cursor), um direkt auf das geteilte Gedächtnis und den Auto-Swap-Gateway der Box zuzugreifen."})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(_0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),r.jsx("input",{value:s,onChange:N=>P(N.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[r.jsx(E0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),r.jsx("input",{value:a,onChange:N=>O(N.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]})]}),w&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",w]}),x&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex flex-wrap gap-1 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:Object.entries(x.tools).map(([N,M])=>r.jsx("button",{onClick:()=>f(N),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",u===N?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:M.label},N))}),z&&r.jsxs("div",{className:"space-y-3",children:[z.note&&r.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-xs text-muted-foreground leading-relaxed",children:[r.jsx(P0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),r.jsx("span",{children:z.note})]}),r.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),r.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:[r.jsx(wa,{className:"h-3.5 w-3.5 text-primary"}),r.jsx("span",{children:u==="cline"||u==="cursor"?"config.json":"settings.json"})]}),r.jsxs("button",{onClick:j,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[m?r.jsx(nn,{className:"h-3.5 w-3.5 text-emerald-400"}):r.jsx(Eh,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:m?"Kopiert":"Kopieren"})]})]}),r.jsx("pre",{className:"p-5 overflow-x-auto text-xs font-mono text-cyan-200/90 whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",children:r.jsx("code",{children:z.snippet})})]})]})]})]})}const Jp=["user","instruction","stable","versioned","ephemeral"],Rc={user:{label:"User",icon:B0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:z0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Ds,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:U0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:k0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Xp={label:"Gedächtnis",icon:Ch,bg:"bg-muted/10",text:"text-muted-foreground"},n1={user:"border-l-cyan-500/80",instruction:"border-l-violet-500/80",stable:"border-l-indigo-500/80",versioned:"border-l-amber-500/80",ephemeral:"border-l-pink-500/80"};function s1(){const[s,o]=g.useState(""),[a,c]=g.useState(""),[u,f]=g.useState(""),[m,p]=g.useState("stable"),[v,x]=g.useState(!1),b=ln(),{showAlert:w,showConfirm:P,dialogElement:O}=Fn(),{data:z=[],error:j}=xm({q:a,category:s}),N=j?String(j):"",M=()=>b.invalidateQueries({queryKey:["memory"]});async function R(){u.trim()&&(await be("/api/memory",{method:"POST",body:JSON.stringify({content:u,category:m,source:"ui"})}),f(""),M())}async function V($){await be(`/api/memory/${$}`,{method:"DELETE"}),M()}async function L(){x(!0);try{const $=await be("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if($.duplicate_count===0){w("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}P("Deduplizierung bestätigen",`${$.duplicate_count} Dublette(n) in ${$.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await be("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),M()}catch(I){w("Fehler",`Fehler beim Löschen: ${I.message}`)}})}catch($){w("Fehler",`Fehler bei der Deduplizierung: ${$.message}`)}finally{x(!1)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool (Memory)"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Die geteilte Konstitution des Systems. Alle Instanzen (Hermes, IDEs, Gateway) lesen und schreiben hierauf per MCP-Protokoll."})]}),r.jsxs("button",{onClick:L,disabled:v,className:"flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50 shrink-0 self-start",children:[r.jsx($0,{className:"h-4 w-4 text-primary animate-pulse"}),r.jsx("span",{children:"Deduplizieren"})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),r.jsx("textarea",{value:u,onChange:$=>f($.target.value),placeholder:"Füge eine neue Regel, eine Vorliebe oder einen stabilen Fakt über das Projekt oder dich hinzu...",rows:3,className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3.5 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground transition-all leading-relaxed"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),r.jsx("select",{value:m,onChange:$=>p($.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 py-1 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Jp.map($=>{var I;return r.jsx("option",{value:$,className:"bg-popover text-foreground",children:((I=Rc[$])==null?void 0:I.label)||$},$)})})]}),r.jsxs("button",{onClick:R,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[r.jsx(_h,{className:"h-4 w-4"})," Speichern"]})]})]}),r.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{value:a,onChange:$=>c($.target.value),placeholder:"Gedächtnis durchsuchen...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),r.jsx(pd,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl overflow-x-auto max-w-full",children:[r.jsx("button",{onClick:()=>o(""),className:J("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",s?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Jp.map($=>{const I=Rc[$]||Xp,B=I.icon;return r.jsxs("button",{onClick:()=>o($),className:J("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 whitespace-nowrap",s===$?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[r.jsx(B,{className:"h-3 w-3"}),r.jsx("span",{children:I.label})]},$)})]})]}),N&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Laden des Gedächtnisses: ",N]}),r.jsx("div",{className:"space-y-3",children:z.length===0?r.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):z.map($=>{const I=Rc[$.category]||Xp,B=I.icon;return r.jsxs("div",{className:J("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",n1[$.category]||"border-l-muted"),children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[r.jsxs("span",{className:J("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",I.bg,I.text),children:[r.jsx(B,{className:"h-3 w-3"}),r.jsx("span",{className:"hidden sm:inline",children:I.label})]}),r.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:$.content})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[r.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-background/20 px-1.5 py-0.5 rounded uppercase tracking-wider",children:$.source}),r.jsx("button",{onClick:()=>V($.id),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",title:"Eintrag löschen",children:r.jsx(Yc,{className:"h-3.5 w-3.5"})})]})]},$.id)})}),O]})}function ma({label:s,ok:o,detail:a,icon:c,onClick:u}){return r.jsxs("div",{onClick:u,className:J("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",o?"border-border/60":"border-amber-500/30",u&&"cursor-pointer hover:bg-card/70"),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),r.jsx(c,{className:J("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),a&&r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),u&&r.jsxs("button",{onClick:f=>{f.stopPropagation(),u()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[r.jsx(Ot,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Gehirn wechseln"})]})]})}function o1(){const{data:s,error:o}=hm(5e3),{data:a}=Ls(),{showAlert:c,dialogElement:u}=Fn(),f=ln(),m=o?String(o):"",p=g.useMemo(()=>["auto","fast","heavy",...((a==null?void 0:a.models)??[]).map($=>{var I;return((I=$.name.split("/").pop())==null?void 0:I.replace(".gguf",""))||$.name})],[a]),[v,x]=g.useState(null),[b,w]=g.useState(!1),[P,O]=g.useState({width:800,height:360}),z=g.useRef(null),j=g.useCallback(L=>{if(z.current&&(z.current.disconnect(),z.current=null),L){const $=new ResizeObserver(I=>{if(!I||I.length===0)return;const B=I[0].contentRect;O({width:B.width,height:B.height})});$.observe(L),z.current=$}},[]),N=P.width,M=P.height,R=(L,$,I,B)=>{const X=(L+I)/2;return`M ${L} ${$} C ${X} ${$}, ${X} ${B}, ${I} ${B}`};async function V(L){try{await be("/api/agent/brain",{method:"POST",body:JSON.stringify({model:L})}),c("Erfolgreich",`Hermes-Gehirn wurde auf '${L}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:Ze.agentStatus}),w(!1)}catch($){c("Fehler",`Fehler beim Wechseln des Gehirns: ${$.message}`)}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -387,9 +387,9 @@ Error generating stack: `+d.message+` stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",r.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(s==null?void 0:s.webui_url)&&r.jsxs("a",{href:Uo(s.webui_url),target:"_blank",rel:"noopener",className:J("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",s.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[r.jsx(ya,{className:"h-4 w-4"}),r.jsx("span",{children:"AnythingLLM öffnen"})]})]}),m&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",m,")."]}),s&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(ma,{label:"Agent Gateway",ok:s.gateway_reachable,detail:"Port :8642 (REST API)",icon:To}),r.jsx(ma,{label:"AnythingLLM",ok:s.webui_reachable,detail:"Chat-UI (AnythingLLM)",icon:Ao}),r.jsx(ma,{label:"Aktives Gehirn",ok:s.gateway_reachable,detail:s.brain_model?`Model: ${s.brain_model}`:"Model: auto",icon:Ot,onClick:()=>w(!0)}),r.jsx(ma,{label:"Verdrahtung",ok:s.has_config,detail:`Config: ${s.has_config?"✓":"—"} · Skills: ${s.has_skills?"✓":"—"} · Memory: ${s.has_memories?"✓":"—"}`,icon:Fo})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),r.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),r.jsxs("div",{ref:j,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[r.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),r.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),r.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),r.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),r.jsx("path",{d:R(N*.15,M*.5,N*.5,M*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="webui"||s.webui_reachable)&&r.jsx("path",{d:R(N*.15,M*.5,N*.5,M*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="brain"||s.gateway_reachable)&&r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="wiring"||s.gateway_reachable)&&r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>x("webui"),onMouseLeave:()=>x(null),onClick:()=>s.webui_reachable&&window.open(Uo(s.webui_url),"_blank"),title:s.webui_reachable?"Klicken um AnythingLLM zu öffnen":"AnythingLLM offline",children:[r.jsx(Ao,{className:J("h-3.5 w-3.5",s.webui_reachable?"text-emerald-400":"text-amber-500")}),r.jsx("span",{children:"AnythingLLM"}),r.jsx("span",{className:J("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",s.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),r.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>x("gateway"),onMouseLeave:()=>x(null),children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(To,{className:"h-3.5 w-3.5 text-primary"}),r.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),r.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),r.jsx("div",{className:J("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",s.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:s.gateway_reachable?"Online":"Offline"})]}),r.jsxs("div",{className:J("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",s.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>x("brain"),onMouseLeave:()=>x(null),onClick:()=>w(!0),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ot,{className:"h-3 w-3 text-primary"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),s.gateway_reachable&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:s.brain_model,children:s.brain_model||"auto"})]}),r.jsxs("div",{className:J("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",s.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>x("wiring"),onMouseLeave:()=>x(null),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Fo,{className:"h-3 w-3 text-primary"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),s.has_config&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[r.jsxs("span",{children:["Config: ",s.has_config?"✓":"—"]}),r.jsxs("span",{children:["Skills: ",s.has_skills?"✓":"—"]}),r.jsxs("span",{children:["Memory: ",s.has_memories?"✓":"—"]})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),r.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),r.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(O0,{className:"h-5 w-5 text-primary"}),r.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",s.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-semibold text-foreground",children:s.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{children:["Der ",r.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",r.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),r.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",r.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),r.jsx("div",{className:"space-y-3",children:s.pc_executor_reachable?r.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[r.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),r.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder WebUI Befehle auf TobisNicerPC ausführen. Nutze ",r.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",r.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",r.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),r.jsxs("p",{children:["Starte ",r.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",r.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),r.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!s.gateway_reachable&&r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-5 w-5 text-amber-500"}),r.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[r.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),r.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",r.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),r.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[r.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),r.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),r.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),r.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",r.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),s&&b&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),r.jsx("button",{onClick:()=>w(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',r.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),r.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:p.map(L=>{const $=["auto","fast","heavy"].includes(L);return r.jsxs("button",{onClick:()=>V(L),className:J("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",s.brain_model===L||!s.brain_model&&L==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:L}),r.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:$?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(s.brain_model===L||!s.brain_model&&L==="auto")&&r.jsx(nn,{className:"h-4 w-4 shrink-0 text-primary"})]},L)})})]})}),u]})}function l1(){const[s,o]=g.useState("connect"),[a,c]=g.useState("roocode"),[u,f]=g.useState(null),m="192.168.178.151",[p,v]=g.useState(!1),[x,b]=g.useState(null);function w(){v(!0),be("/api/health").then(P=>{f(P),b(P.engine_reachable?"success":"partial")}).catch(()=>{f(null),b("fail")}).finally(()=>v(!1))}return g.useEffect(()=>{w()},[]),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Stack-Anleitung & Vibe-Coding-Guide"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Einsteigerfreundliche Erklärungen zu deinem Stack und Schritt-für-Schritt-Anleitungen zur Anbindung deiner Editoren."})]}),r.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[r.jsx("button",{onClick:()=>o("connect"),className:J("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),r.jsx("button",{onClick:()=>o("concepts"),className:J("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),s==="connect"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:J("h-3 w-3 rounded-full ring-2 ring-black/40",x==="success"&&"bg-emerald-500 animate-pulse",x==="partial"&&"bg-amber-500",x==="fail"&&"bg-red-500",!x&&"bg-muted")}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),r.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[x==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(u==null?void 0:u.version)||""}).`,x==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",x==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!x&&"Verbindung wird geprüft..."]})]})]}),r.jsxs("button",{onClick:w,disabled:p,className:"h-8 px-3 flex 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 cursor-pointer self-start sm:self-auto shrink-0",children:[r.jsx(An,{className:J("h-3.5 w-3.5",p&&"animate-spin")}),r.jsx("span",{children:"Testen"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 px-1",children:[r.jsx(Ch,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[r.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4 text-cyan-400"}),r.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),r.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein Dashboard. Hier siehst du die CPU-/RAM- und GPU-Last der Box und siehst sofort, ob Updates anstehen."})]}),r.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(zo,{className:"h-4 w-4 text-violet-400"}),r.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),r.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",r.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),r.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Lo,{className:"h-4 w-4 text-indigo-400"}),r.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),r.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein geteiltes Langzeitgedächtnis (Memory-Pool). Hier merkt sich dein Agent Regeln, Projekt-Details und Vorlieben."})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 px-1",children:[r.jsx(Kc,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),r.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[r.jsxs("button",{onClick:()=>c("roocode"),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",a==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Mh,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),r.jsx("button",{onClick:()=>c("cursor"),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",a==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),r.jsx("button",{onClick:()=>c("opencode"),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",a==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[a==="roocode"&&r.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),r.jsx("p",{children:"Roo Code ist die beliebteste und flexibelste Vibe-Coding-Erweiterung für VS Code im Jahr 2026. Sie ermöglicht vollen Zugriff auf das Terminal und das MCP-Gedächtnis."})]}),r.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Roo Code installieren"]}),r.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",r.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"API-Anbindung konfigurieren"]}),r.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),r.jsx("div",{className:"pl-6 pt-1",children:r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",r.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"MCP Gedächtnis verknüpfen (Optional, aber empfohlen)"]}),r.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",r.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",r.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&r.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),r.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),r.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Einstellungen öffnen"]}),r.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",r.jsx("strong",{children:"Models"}),"."]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"OpenAI API überschreiben"]}),r.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",r.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),r.jsx("div",{className:"pl-6 pt-1",children:r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",m,":9001/v1"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",r.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Modell hinzufügen"]}),r.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",r.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),a==="opencode"&&r.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),r.jsx("p",{children:"OpenCode ist eine standalone Desktop-App für ein ablenkungsfreies Coden über natürliche Sprache. Es trennt den KI-Prozess von deinem Editor."})]}),r.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"OpenCode Desktop herunterladen"]}),r.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"Endpunkt auf Box-Gateway setzen"]}),r.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),r.jsx("div",{className:"pl-6 pt-1",children:r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Erster Vibe-Coding Test"]}),r.jsx("p",{className:"pl-6",children:'Starte eine neue Session und teste die Verbindung mit einem einfachen Prompt, z. B. *"Erstelle ein einfaches Skript, das die Fibonaccizahlen berechnet"*. Das Box-Gateway tauscht das Modell im Hintergrund vollautomatisch aus.'})]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 space-y-3 shadow-lg shadow-black/10",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ba,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),r.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Keine Verbindung?"})," Überprüfe im Live-Verbindungsprüfer oben, ob die Box-IP erreichbar ist. Stelle sicher, dass dein lokaler PC im selben WLAN/LAN-Netzwerk wie die Box eingeloggt ist."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",r.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",r.jsx("strong",{children:"Restart"}),"."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in AnythingLLM einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex items-start gap-4",children:[r.jsx(Qc,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),r.jsx("p",{className:"text-xs text-muted-foreground leading-normal",children:"Willkommen im Wissenszentrum für dein Mission Control 2 Setup. Hier erfährst du, wie die verschiedenen Technologien (MoE, MCP, Skills, Hermes) zusammenarbeiten und wie du das Maximum aus deinen AI-Prozessabläufen herausholst."})]})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(zo,{className:"h-5 w-5 text-cyan-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),r.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," Bei traditionellen LLMs wird für jedes Wort das gesamte neuronale Netz aktiviert. Bei MoE besteht das Modell aus mehreren spezialisierten Teilnetzwerken (den ",r.jsx("em",{children:"Experts"}),"). Ein intelligenter ",r.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Warum in MC2?"})," So können extrem leistungsstarke Modelle (wie DeepSeek-V3, Mixtral oder Command R+) mit wesentlich geringeren Hardwarekosten ausgeführt werden. Es wird nur ein Bruchteil der Parameter geladen und aktiv berechnet, was Speicherplatz spart und die Inferenz beschleunigt."]}),r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[r.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Qc,{className:"h-5 w-5 text-violet-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),r.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," MCP ist ein offenes Protokoll (initiiert von Anthropic), das festlegt, wie ein KI-Client (z.B. Roo Code auf deinem PC) mit externen Datenquellen und Tools kommuniziert. Es funktioniert wie ein USB-Standard für KI."]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Warum in MC2?"})," MCP trennt den AI-Kern von der Umgebung. Statt für jeden Editor eigene Tools zu schreiben, binden deine Agenten (Roo Code, Hermes) einfach MCP-Server an. Diese Server können Dateien lesen, Websuchen durchführen, Git bedienen oder mit deiner App interagieren."]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[r.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("a",{href:"https://smithery.ai/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Smithery Registry"})," — Ein Portal zum Suchen und automatischen Installieren von MCP Servern."]}),r.jsxs("li",{children:[r.jsx("a",{href:"https://glama.ai/mcp/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Glama MCP Registry"})," — Eine kuratierte, umfangreiche Community-Datenbank von MCP Servern."]}),r.jsxs("li",{children:[r.jsx("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Offizielles Anthropic Repo"})," — Das offizielle Repository mit Standards wie filesystem, postgres, sqlite, brave-search und puppeteer."]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Lo,{className:"h-5 w-5 text-emerald-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),r.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," Ein Skill ist ein Verzeichnis mit standardisierten Anweisungen, Scripten und Beispielen, das deine Agenten für spezifische Aufgaben trainiert (z.B. Test-Driven Development, Code-Vereinfachung, API-Design)."]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",r.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",r.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),r.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- + `}),r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",r.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(s==null?void 0:s.webui_url)&&r.jsxs("a",{href:Uo(s.webui_url),target:"_blank",rel:"noopener",className:J("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",s.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[r.jsx(ba,{className:"h-4 w-4"}),r.jsx("span",{children:"AnythingLLM öffnen"})]})]}),m&&r.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",m,")."]}),s&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(ma,{label:"Agent Gateway",ok:s.gateway_reachable,detail:"Port :8642 (REST API)",icon:ya}),r.jsx(ma,{label:"AnythingLLM",ok:s.webui_reachable,detail:"Chat-UI (AnythingLLM)",icon:Ao}),r.jsx(ma,{label:"Aktives Gehirn",ok:s.gateway_reachable,detail:s.brain_model?`Model: ${s.brain_model}`:"Model: auto",icon:Ot,onClick:()=>w(!0)}),r.jsx(ma,{label:"Verdrahtung",ok:s.has_config,detail:`Config: ${s.has_config?"✓":"—"} · Skills: ${s.has_skills?"✓":"—"} · Memory: ${s.has_memories?"✓":"—"}`,icon:zo})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),r.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),r.jsxs("div",{ref:j,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[r.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),r.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),r.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[r.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),r.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),r.jsx("path",{d:R(N*.15,M*.5,N*.5,M*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="webui"||s.webui_reachable)&&r.jsx("path",{d:R(N*.15,M*.5,N*.5,M*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="brain"||s.gateway_reachable)&&r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="wiring"||s.gateway_reachable)&&r.jsx("path",{d:R(N*.5,M*.5,N*.85,M*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),r.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>x("webui"),onMouseLeave:()=>x(null),onClick:()=>s.webui_reachable&&window.open(Uo(s.webui_url),"_blank"),title:s.webui_reachable?"Klicken um AnythingLLM zu öffnen":"AnythingLLM offline",children:[r.jsx(Ao,{className:J("h-3.5 w-3.5",s.webui_reachable?"text-emerald-400":"text-amber-500")}),r.jsx("span",{children:"AnythingLLM"}),r.jsx("span",{className:J("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",s.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),r.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>x("gateway"),onMouseLeave:()=>x(null),children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ya,{className:"h-3.5 w-3.5 text-primary"}),r.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),r.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),r.jsx("div",{className:J("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",s.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:s.gateway_reachable?"Online":"Offline"})]}),r.jsxs("div",{className:J("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",s.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>x("brain"),onMouseLeave:()=>x(null),onClick:()=>w(!0),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ot,{className:"h-3 w-3 text-primary"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),s.gateway_reachable&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:s.brain_model,children:s.brain_model||"auto"})]}),r.jsxs("div",{className:J("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",s.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>x("wiring"),onMouseLeave:()=>x(null),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(zo,{className:"h-3 w-3 text-primary"}),r.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),s.has_config&&r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),r.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[r.jsxs("span",{children:["Config: ",s.has_config?"✓":"—"]}),r.jsxs("span",{children:["Skills: ",s.has_skills?"✓":"—"]}),r.jsxs("span",{children:["Memory: ",s.has_memories?"✓":"—"]})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),r.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),r.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(O0,{className:"h-5 w-5 text-primary"}),r.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full",s.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),r.jsx("span",{className:"text-xs font-semibold text-foreground",children:s.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{children:["Der ",r.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",r.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),r.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",r.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),r.jsx("div",{className:"space-y-3",children:s.pc_executor_reachable?r.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[r.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),r.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder WebUI Befehle auf TobisNicerPC ausführen. Nutze ",r.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",r.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",r.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),r.jsxs("p",{children:["Starte ",r.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",r.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),r.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!s.gateway_reachable&&r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ds,{className:"h-5 w-5 text-amber-500"}),r.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[r.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),r.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",r.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),r.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[r.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),r.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),r.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),r.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",r.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),s&&b&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[r.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4"}),r.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),r.jsx("button",{onClick:()=>w(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',r.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",r.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),r.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:p.map(L=>{const $=["auto","fast","heavy"].includes(L);return r.jsxs("button",{onClick:()=>V(L),className:J("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",s.brain_model===L||!s.brain_model&&L==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[r.jsxs("div",{className:"flex flex-col text-left",children:[r.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:L}),r.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:$?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(s.brain_model===L||!s.brain_model&&L==="auto")&&r.jsx(nn,{className:"h-4 w-4 shrink-0 text-primary"})]},L)})})]})}),u]})}function l1(){const[s,o]=g.useState("connect"),[a,c]=g.useState("roocode"),[u,f]=g.useState(null),m="192.168.178.151",[p,v]=g.useState(!1),[x,b]=g.useState(null);function w(){v(!0),be("/api/health").then(P=>{f(P),b(P.engine_reachable?"success":"partial")}).catch(()=>{f(null),b("fail")}).finally(()=>v(!1))}return g.useEffect(()=>{w()},[]),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Stack-Anleitung & Vibe-Coding-Guide"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Einsteigerfreundliche Erklärungen zu deinem Stack und Schritt-für-Schritt-Anleitungen zur Anbindung deiner Editoren."})]}),r.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[r.jsx("button",{onClick:()=>o("connect"),className:J("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),r.jsx("button",{onClick:()=>o("concepts"),className:J("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),s==="connect"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:J("h-3 w-3 rounded-full ring-2 ring-black/40",x==="success"&&"bg-emerald-500 animate-pulse",x==="partial"&&"bg-amber-500",x==="fail"&&"bg-red-500",!x&&"bg-muted")}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),r.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[x==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(u==null?void 0:u.version)||""}).`,x==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",x==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!x&&"Verbindung wird geprüft..."]})]})]}),r.jsxs("button",{onClick:w,disabled:p,className:"h-8 px-3 flex 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 cursor-pointer self-start sm:self-auto shrink-0",children:[r.jsx(An,{className:J("h-3.5 w-3.5",p&&"animate-spin")}),r.jsx("span",{children:"Testen"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2 px-1",children:[r.jsx(Ch,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[r.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ot,{className:"h-4 w-4 text-cyan-400"}),r.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),r.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein Dashboard. Hier siehst du die CPU-/RAM- und GPU-Last der Box und siehst sofort, ob Updates anstehen."})]}),r.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Lo,{className:"h-4 w-4 text-violet-400"}),r.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),r.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",r.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),r.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(To,{className:"h-4 w-4 text-indigo-400"}),r.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),r.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein geteiltes Langzeitgedächtnis (Memory-Pool). Hier merkt sich dein Agent Regeln, Projekt-Details und Vorlieben."})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 px-1",children:[r.jsx(Kc,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),r.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[r.jsxs("button",{onClick:()=>c("roocode"),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",a==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Mh,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),r.jsx("button",{onClick:()=>c("cursor"),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",a==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),r.jsx("button",{onClick:()=>c("opencode"),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",a==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[a==="roocode"&&r.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),r.jsx("p",{children:"Roo Code ist die beliebteste und flexibelste Vibe-Coding-Erweiterung für VS Code im Jahr 2026. Sie ermöglicht vollen Zugriff auf das Terminal und das MCP-Gedächtnis."})]}),r.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Roo Code installieren"]}),r.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",r.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"API-Anbindung konfigurieren"]}),r.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),r.jsx("div",{className:"pl-6 pt-1",children:r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",r.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"MCP Gedächtnis verknüpfen (Optional, aber empfohlen)"]}),r.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",r.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",r.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&r.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),r.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),r.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Einstellungen öffnen"]}),r.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",r.jsx("strong",{children:"Models"}),"."]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"OpenAI API überschreiben"]}),r.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",r.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),r.jsx("div",{className:"pl-6 pt-1",children:r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",m,":9001/v1"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",r.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Modell hinzufügen"]}),r.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",r.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),a==="opencode"&&r.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),r.jsx("p",{children:"OpenCode ist eine standalone Desktop-App für ein ablenkungsfreies Coden über natürliche Sprache. Es trennt den KI-Prozess von deinem Editor."})]}),r.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"OpenCode Desktop herunterladen"]}),r.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"Endpunkt auf Box-Gateway setzen"]}),r.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),r.jsx("div",{className:"pl-6 pt-1",children:r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",m,":9001/v1"]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[r.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Erster Vibe-Coding Test"]}),r.jsx("p",{className:"pl-6",children:'Starte eine neue Session und teste die Verbindung mit einem einfachen Prompt, z. B. *"Erstelle ein einfaches Skript, das die Fibonaccizahlen berechnet"*. Das Box-Gateway tauscht das Modell im Hintergrund vollautomatisch aus.'})]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 space-y-3 shadow-lg shadow-black/10",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wa,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),r.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Keine Verbindung?"})," Überprüfe im Live-Verbindungsprüfer oben, ob die Box-IP erreichbar ist. Stelle sicher, dass dein lokaler PC im selben WLAN/LAN-Netzwerk wie die Box eingeloggt ist."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",r.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",r.jsx("strong",{children:"Restart"}),"."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in AnythingLLM einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex items-start gap-4",children:[r.jsx(Qc,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),r.jsx("p",{className:"text-xs text-muted-foreground leading-normal",children:"Willkommen im Wissenszentrum für dein Mission Control 2 Setup. Hier erfährst du, wie die verschiedenen Technologien (MoE, MCP, Skills, Hermes) zusammenarbeiten und wie du das Maximum aus deinen AI-Prozessabläufen herausholst."})]})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Lo,{className:"h-5 w-5 text-cyan-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),r.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," Bei traditionellen LLMs wird für jedes Wort das gesamte neuronale Netz aktiviert. Bei MoE besteht das Modell aus mehreren spezialisierten Teilnetzwerken (den ",r.jsx("em",{children:"Experts"}),"). Ein intelligenter ",r.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Warum in MC2?"})," So können extrem leistungsstarke Modelle (wie DeepSeek-V3, Mixtral oder Command R+) mit wesentlich geringeren Hardwarekosten ausgeführt werden. Es wird nur ein Bruchteil der Parameter geladen und aktiv berechnet, was Speicherplatz spart und die Inferenz beschleunigt."]}),r.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[r.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Qc,{className:"h-5 w-5 text-violet-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),r.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," MCP ist ein offenes Protokoll (initiiert von Anthropic), das festlegt, wie ein KI-Client (z.B. Roo Code auf deinem PC) mit externen Datenquellen und Tools kommuniziert. Es funktioniert wie ein USB-Standard für KI."]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Warum in MC2?"})," MCP trennt den AI-Kern von der Umgebung. Statt für jeden Editor eigene Tools zu schreiben, binden deine Agenten (Roo Code, Hermes) einfach MCP-Server an. Diese Server können Dateien lesen, Websuchen durchführen, Git bedienen oder mit deiner App interagieren."]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[r.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("a",{href:"https://smithery.ai/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Smithery Registry"})," — Ein Portal zum Suchen und automatischen Installieren von MCP Servern."]}),r.jsxs("li",{children:[r.jsx("a",{href:"https://glama.ai/mcp/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Glama MCP Registry"})," — Eine kuratierte, umfangreiche Community-Datenbank von MCP Servern."]}),r.jsxs("li",{children:[r.jsx("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Offizielles Anthropic Repo"})," — Das offizielle Repository mit Standards wie filesystem, postgres, sqlite, brave-search und puppeteer."]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(To,{className:"h-5 w-5 text-emerald-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),r.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," Ein Skill ist ein Verzeichnis mit standardisierten Anweisungen, Scripten und Beispielen, das deine Agenten für spezifische Aufgaben trainiert (z.B. Test-Driven Development, Code-Vereinfachung, API-Design)."]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",r.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",r.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),r.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- name: tdd-pro description: Drive development with strict TDD practices --- # Instructions -...`}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[r.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",r.jsx("a",{href:"https://skills.sh/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"skills.sh"}),"). Du kannst Skills direkt über das Terminal suchen und in deinem Projekt installieren:",r.jsxs("div",{className:"mt-1 font-mono text-[9px] bg-background/40 p-2 rounded border border-border/30 text-cyan-300",children:["# Nach Skills suchen:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills find"}),r.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Globaler Pfad:"})," ",r.jsx("code",{className:"text-foreground select-all",children:"C:\\Users\\TobisPC\\.gemini\\config\\plugins\\agent-skills\\skills\\"}),". Hier sind deine vorinstallierten, global verfügbaren Skills (wie ",r.jsx("i",{children:"code-simplification"}),", ",r.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Projekt-Pfad:"})," ",r.jsx("code",{className:"text-foreground select-all",children:".agents/skills/"}),". Lege diesen Ordner im Root eines beliebigen Projekts an. Dein lokaler Editor-Agent (z.B. Roo Code) liest ihn beim Starten automatisch ein."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",r.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ot,{className:"h-5 w-5 text-indigo-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),r.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," Hermes ist der auf der Box installierte, autonome Hintergrund-Agent. Er verwaltet das Dateisystem und kann über REST (Port 8642) oder eine interaktive ChatUI (Port 8787) gesteuert werden."]}),r.jsx("p",{children:r.jsx("strong",{children:"Best Practices für Hermes:"})}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",r.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (AnythingLLM-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Fo,{className:"h-5 w-5 text-amber-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),r.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(ba,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),r.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",r.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Kc,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),r.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",r.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Fo,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),r.jsx("p",{className:"text-[11px]",children:"Koppele deine Debug-Dienste mit dem Chrome-DevTools-Plugin. So kann der Agent Fehler in der Konsole live analysieren und das DOM verifizieren, anstatt blind zu raten."})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ds,{className:"h-5 w-5 text-emerald-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),r.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[r.jsxs("p",{children:["Mission Control 2 ist als ",r.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Ep,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),r.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),r.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Ep,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),r.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[r.jsx("strong",{children:"Fazit:"})," Der Stack erledigt die Kärrnerarbeit (Modelle tauschen, API-Adapter bereitstellen, Sandbox-Verbindungen herstellen) komplett im Hintergrund. Er agiert als dein persönlicher, treuer Copilot, ohne jemals ungefragt schädliche Operationen auf deinem Hauptsystem auszuführen."]})]})]})]})]})]})}function a1({title:s,hint:o}){return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold",children:s}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),r.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[r.jsx(C0,{className:"h-8 w-8 text-muted-foreground"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const i1=[{id:"llama-swap",label:"Llama Swap",type:"system"},{id:"mission-control-2",label:"Mission Control 2",type:"user"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user"},{id:"hermes-dashboard",label:"Hermes Dashboard",type:"user"},{id:"hermes-webui",label:"Hermes WebUI",type:"user"}];function Oc(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function c1({open:s,onClose:o,defaultTab:a="maintenance"}){const[c,u]=g.useState(null),[f,m]=g.useState([]),[p,v]=g.useState("llama-swap"),[x,b]=g.useState(""),[w,P]=g.useState(!1),[O,z]=g.useState(null),[j,N]=g.useState({}),[M,R]=g.useState("maintenance"),[V,L]=g.useState(!1),[$,I]=g.useState(null);function B(U,he,pt){I({type:"alert",title:U,message:he,onConfirm:()=>{I(null),pt&&pt()}})}function X(U,he,pt){I({type:"confirm",title:U,message:he,onConfirm:()=>{I(null),pt()},onCancel:()=>I(null)})}function ne(U){return U?new Date(U*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[ve,ye]=g.useState(""),[ue,Re]=g.useState(""),[Ee,ze]=g.useState(!1),[Oe,Pe]=g.useState(!1);g.useEffect(()=>{s&&(ye(localStorage.getItem("mc_sudo_password")||""),Re(localStorage.getItem("mc_hf_token")||""))},[s]),g.useEffect(()=>{s&&a&&R(a)},[s,a]);const K=g.useRef(null);function se(){be("/api/maintenance/updates").then(u).catch(U=>console.error("Error loading updates",U))}function Q(){be("/api/jobs").then(U=>m(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function C(U){P(!0),z(null),be(`/api/maintenance/logs?service=${U}&lines=150`).then(he=>{he.ok?b(he.text):(b(`Fehler beim Laden der Logs: ${he.err||"Unbekannter Fehler"}`),(he.status==="incorrect_password"||he.status==="password_required")&&z(he.status))}).catch(he=>b(`Fehler: ${he.message}`)).finally(()=>{P(!1),setTimeout(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},50)})}g.useEffect(()=>{if(!s)return;se(),Q();const U=setInterval(()=>{Q(),se()},3e3);return()=>clearInterval(U)},[s]),g.useEffect(()=>{!s||M!=="logs"||C(p)},[s,M,p]);async function E(){try{await be("/api/maintenance/os-update",{method:"POST"}),Q(),R("maintenance")}catch(U){B("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function Y(){try{await be("/api/maintenance/engine-update",{method:"POST"}),Q(),R("maintenance")}catch(U){B("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function ee(){L(!0);try{await be("/api/maintenance/check-updates",{method:"POST"}),Q(),R("maintenance")}catch(U){B("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{L(!1)}}async function Z(U,he){try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:he})}),B("Gestartet",`Modell-Upgrade für '${he}' (${U}) gestartet.`),Q(),R("maintenance")}catch(pt){B("Fehler",`Fehler beim Starten des Modell-Upgrades: ${pt.message}`)}}async function le(){X("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await be("/api/maintenance/reboot",{method:"POST"}),B("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){B("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function fe(U){N(he=>({...he,[U]:!0}));try{const he=await be("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});he.ok?B("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{M==="logs"&&p===U&&C(U)}):B("Fehler",`Fehler beim Neustart: ${he.err||"Unbekannter Fehler"}`)}catch(he){B("Fehler",`Fehler beim Neustart: ${he.message}`)}finally{N(he=>({...he,[U]:!1}))}}async function we(U){try{await be(`/api/jobs/${U}/cancel`,{method:"POST"}),Q()}catch(he){B("Fehler",`Fehler beim Abbrechen: ${he.message}`)}}return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:J("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",s?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:o}),r.jsxs("div",{className:J("fixed inset-y-0 right-0 w-full sm:w-[500px] 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",s?"translate-x-0":"translate-x-full"),children:[r.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),r.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[r.jsx("button",{onClick:()=>R("maintenance"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",M==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),r.jsx("button",{onClick:()=>R("logs"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",M==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),r.jsx("button",{onClick:()=>R("settings"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",M==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[M==="maintenance"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),r.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",ne(c.last_check)]}),r.jsxs("button",{onClick:ee,disabled:V,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[r.jsx(An,{className:J("h-3 w-3",V&&"animate-spin")}),"Nach Updates suchen"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:E,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[r.jsx(Ds,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),r.jsxs("button",{onClick:Y,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[r.jsx(F0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),r.jsxs("button",{onClick:le,className:"flex w-full items-center gap-3 p-3 rounded-xl 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:[r.jsx(Ph,{className:"h-4.5 w-4.5"}),r.jsxs("div",{children:[r.jsx("div",{children:"Host-System neu starten (Reboot)"}),r.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(c==null?void 0:c.model_list)&&c.model_list.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",ne(c.last_check)]})]}),r.jsx("div",{className:"space-y-2",children:c.model_list.map(U=>r.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold",children:U.title}),r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),r.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),r.jsxs("button",{onClick:()=>Z(U.repo,U.role),className:"flex items-center gap-1.5 text-[10px] font-semibold text-emerald-400 hover:text-emerald-300 border border-emerald-500/20 bg-emerald-500/5 hover:bg-emerald-500/10 px-2 py-1 rounded-lg transition-colors shrink-0",children:[r.jsx(Tn,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),r.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[f.filter(U=>U.state==="running"||U.state==="queued").length," Aktiv"]})]}),r.jsx("div",{className:"space-y-3",children:f.length===0?r.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."}):f.map(U=>{const he=U.state==="running"||U.state==="queued";return r.jsxs("div",{className:J("p-3 rounded-xl border transition-all duration-300",he?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[he&&r.jsxs("span",{className:"flex h-2 w-2 relative",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[r.jsxs("span",{children:["ID: ",U.id]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:J(U.state==="done"&&"text-emerald-400",U.state==="failed"&&"text-red-400",U.state==="running"&&"text-primary",U.state==="queued"&&"text-amber-400",U.state==="canceled"&&"text-muted-foreground"),children:U.state})]})]}),he&&r.jsx("button",{onClick:()=>we(U.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"})]}),U.state==="running"&&r.jsxs("div",{className:"mt-3 space-y-1",children:[r.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),r.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[r.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&r.jsxs("span",{children:[Oc(U.done_bytes)," / ",Oc(U.total_bytes),U.rate_bps!=null&&` (${Oc(U.rate_bps)}/s)`]}),U.eta_s!=null&&r.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),M==="logs"&&r.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("select",{value:p,onChange:U=>v(U.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:i1.map(U=>r.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),r.jsxs("button",{onClick:()=>fe(p),disabled:j[p],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:[r.jsx(An,{className:J("h-3.5 w-3.5",j[p]&&"animate-spin")}),"Restart"]})]}),r.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:[r.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[r.jsx(ba,{className:"h-3 w-3 text-primary"}),r.jsxs("span",{children:["stdout/stderr - ",p]})]}),r.jsx("button",{onClick:()=>C(p),disabled:w,className:"text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(An,{className:J("h-3 w-3",w&&"animate-spin")})})]}),r.jsx("pre",{ref:K,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:O==="password_required"||O==="incorrect_password"?r.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[r.jsx(Jc,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),r.jsx("div",{className:"text-xs font-semibold text-amber-300",children:O==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),r.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",p," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),r.jsx("button",{onClick:()=>R("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):w&&!x?r.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):x||r.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),M==="settings"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),r.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(Ds,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Ee?"text":"password",value:ve,onChange:U=>ye(U.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),r.jsx("button",{type:"button",onClick:()=>ze(!Ee),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ee?r.jsx(_p,{className:"h-4 w-4"}):r.jsx(qc,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(M0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Oe?"text":"password",value:ue,onChange:U=>Re(U.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),r.jsx("button",{type:"button",onClick:()=>Pe(!Oe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Oe?r.jsx(_p,{className:"h-4 w-4"}):r.jsx(qc,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",ve),localStorage.setItem("mc_hf_token",ue),B("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),r.jsx("button",{onClick:()=>{ye(""),Re(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),B("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),$&&r.jsx(km,{type:$.type,title:$.title,message:$.message,onConfirm:$.onConfirm,onCancel:$.onCancel})]})}function d1(){var w,P,O,z,j;const[s,o]=g.useState("dashboard"),[a,c]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[u,f]=g.useState(!1),[m,p]=g.useState("maintenance"),{data:v}=Yy(),{data:x}=vd(2e4);g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const N=M=>{var V;p(((V=M.detail)==null?void 0:V.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",N),()=>window.removeEventListener("open-system-drawer",N)},[]);const b=Xc.find(N=>N.id===s);return r.jsxs("div",{className:"flex h-full relative",children:[r.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[r.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),r.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),r.jsx(Zy,{onNavigate:o}),r.jsx(c1,{open:u,onClose:()=>f(!1),defaultTab:m}),r.jsxs("aside",{className:J("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",a?"w-16":"w-60"),children:[r.jsxs("div",{className:J("flex items-center py-4 border-b border-border/40 shrink-0",a?"flex-col gap-3 px-2":"justify-between px-5"),children:[r.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[r.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!a&&r.jsxs("div",{className:"leading-tight",children:[r.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),r.jsx("button",{onClick:()=>{c(N=>{const M=!N;return localStorage.setItem("mc_sidebar_collapsed",M.toString()),M})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:a?"Maximieren":"Minimieren",children:a?r.jsx(b0,{className:"h-4 w-4"}):r.jsx(y0,{className:"h-4 w-4"})})]}),r.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Xc.map(N=>r.jsxs("button",{onClick:()=>o(N.id),className:J("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",a?"justify-center p-2.5":"gap-3 px-3 py-2",s===N.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:a?N.label:void 0,children:[r.jsx(N.icon,{className:"h-4.5 w-4.5 shrink-0"}),!a&&r.jsx("span",{className:"truncate",children:N.label})]},N.id))}),r.jsx("div",{className:J("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",a?"px-2 text-center":"px-5"),children:a?r.jsx("div",{className:"flex justify-center",children:r.jsx("span",{className:J("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",v?v.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:v?`Engine ${v.engine_reachable?"online":"offline"}`:"Backend offline"})}):r.jsxs("div",{className:"space-y-2 text-left",children:[v?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),r.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",r.jsx("span",{className:"truncate",children:"Backend offline"})]}),(x==null?void 0:x.versions)&&r.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[r.jsxs("div",{className:"truncate",title:x.versions.mc2?`${x.versions.mc2.branch}-${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""} (${x.versions.mc2.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"MC2:"})," ",x.versions.mc2?`${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:((w=x.versions.engine)==null?void 0:w.type)==="git"?`${x.versions.engine.branch}-${x.versions.engine.hash}${x.versions.engine.dirty?"*":""} (${x.versions.engine.date})`:((P=x.versions.engine)==null?void 0:P.version_text)||"unbekannt",children:[r.jsx("strong",{children:"Engine:"})," ",((O=x.versions.engine)==null?void 0:O.type)==="git"?`${x.versions.engine.hash}${x.versions.engine.dirty?"*":""}`:((j=(z=x.versions.engine)==null?void 0:z.version_text)==null?void 0:j.split(" ").pop())||"—"]}),r.jsxs("div",{className:"truncate",title:x.versions.hermes_ui?`${x.versions.hermes_ui.branch}-${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""} (${x.versions.hermes_ui.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes UI:"})," ",x.versions.hermes_ui?`${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:x.versions.hermes_agent?`${x.versions.hermes_agent.branch}-${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""} (${x.versions.hermes_agent.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes Agent:"})," ",x.versions.hermes_agent?`${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),r.jsxs("button",{onClick:()=>{const N=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(N)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[r.jsx(S0,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Suchen"}),r.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),r.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&r.jsx(Gb,{}),s==="models"&&r.jsx(e1,{}),s==="system"&&r.jsx(t1,{}),s==="connect"&&r.jsx(r1,{}),s==="memory"&&r.jsx(s1,{}),s==="agent"&&r.jsx(o1,{}),s==="guide"&&r.jsx(l1,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&r.jsx(a1,{title:b.label,hint:b.hint})]})]})]})}const u1=new t0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});Pg.createRoot(document.getElementById("root")).render(r.jsx(uh.StrictMode,{children:r.jsx(r0,{client:u1,children:r.jsx(d1,{})})})); +...`}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[r.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),r.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",r.jsx("a",{href:"https://skills.sh/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"skills.sh"}),"). Du kannst Skills direkt über das Terminal suchen und in deinem Projekt installieren:",r.jsxs("div",{className:"mt-1 font-mono text-[9px] bg-background/40 p-2 rounded border border-border/30 text-cyan-300",children:["# Nach Skills suchen:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills find"}),r.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",r.jsx("br",{}),r.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Globaler Pfad:"})," ",r.jsx("code",{className:"text-foreground select-all",children:"C:\\Users\\TobisPC\\.gemini\\config\\plugins\\agent-skills\\skills\\"}),". Hier sind deine vorinstallierten, global verfügbaren Skills (wie ",r.jsx("i",{children:"code-simplification"}),", ",r.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Projekt-Pfad:"})," ",r.jsx("code",{className:"text-foreground select-all",children:".agents/skills/"}),". Lege diesen Ordner im Root eines beliebigen Projekts an. Dein lokaler Editor-Agent (z.B. Roo Code) liest ihn beim Starten automatisch ein."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",r.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ot,{className:"h-5 w-5 text-indigo-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),r.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Was ist das?"})," Hermes ist der auf der Box installierte, autonome Hintergrund-Agent. Er verwaltet das Dateisystem und kann über REST (Port 8642) oder eine interaktive ChatUI (Port 8787) gesteuert werden."]}),r.jsx("p",{children:r.jsx("strong",{children:"Best Practices für Hermes:"})}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",r.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (AnythingLLM-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(zo,{className:"h-5 w-5 text-amber-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),r.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(wa,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),r.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",r.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(Kc,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),r.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",r.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),r.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[r.jsx(zo,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),r.jsx("p",{className:"text-[11px]",children:"Koppele deine Debug-Dienste mit dem Chrome-DevTools-Plugin. So kann der Agent Fehler in der Konsole live analysieren und das DOM verifizieren, anstatt blind zu raten."})]})]})]}),r.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[r.jsx(Ds,{className:"h-5 w-5 text-emerald-400"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),r.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[r.jsxs("p",{children:["Mission Control 2 ist als ",r.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Ep,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),r.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),r.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[r.jsx(Ep,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),r.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),r.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[r.jsx("strong",{children:"Fazit:"})," Der Stack erledigt die Kärrnerarbeit (Modelle tauschen, API-Adapter bereitstellen, Sandbox-Verbindungen herstellen) komplett im Hintergrund. Er agiert als dein persönlicher, treuer Copilot, ohne jemals ungefragt schädliche Operationen auf deinem Hauptsystem auszuführen."]})]})]})]})]})]})}function a1({title:s,hint:o}){return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold",children:s}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),r.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[r.jsx(C0,{className:"h-8 w-8 text-muted-foreground"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const i1=[{id:"llama-swap",label:"Llama Swap",type:"system"},{id:"mission-control-2",label:"Mission Control 2",type:"user"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user"},{id:"hermes-dashboard",label:"Hermes Dashboard",type:"user"},{id:"hermes-webui",label:"Hermes WebUI",type:"user"}];function Oc(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function c1({open:s,onClose:o,defaultTab:a="maintenance"}){const[c,u]=g.useState(null),[f,m]=g.useState([]),[p,v]=g.useState("llama-swap"),[x,b]=g.useState(""),[w,P]=g.useState(!1),[O,z]=g.useState(null),[j,N]=g.useState({}),[M,R]=g.useState("maintenance"),[V,L]=g.useState(!1),[$,I]=g.useState(null);function B(U,he,pt){I({type:"alert",title:U,message:he,onConfirm:()=>{I(null),pt&&pt()}})}function X(U,he,pt){I({type:"confirm",title:U,message:he,onConfirm:()=>{I(null),pt()},onCancel:()=>I(null)})}function ne(U){return U?new Date(U*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[ve,ye]=g.useState(""),[ue,Re]=g.useState(""),[Ee,ze]=g.useState(!1),[Oe,Pe]=g.useState(!1);g.useEffect(()=>{s&&(ye(localStorage.getItem("mc_sudo_password")||""),Re(localStorage.getItem("mc_hf_token")||""))},[s]),g.useEffect(()=>{s&&a&&R(a)},[s,a]);const K=g.useRef(null);function se(){be("/api/maintenance/updates").then(u).catch(U=>console.error("Error loading updates",U))}function Q(){be("/api/jobs").then(U=>m(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function C(U){P(!0),z(null),be(`/api/maintenance/logs?service=${U}&lines=150`).then(he=>{he.ok?b(he.text):(b(`Fehler beim Laden der Logs: ${he.err||"Unbekannter Fehler"}`),(he.status==="incorrect_password"||he.status==="password_required")&&z(he.status))}).catch(he=>b(`Fehler: ${he.message}`)).finally(()=>{P(!1),setTimeout(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},50)})}g.useEffect(()=>{if(!s)return;se(),Q();const U=setInterval(()=>{Q(),se()},3e3);return()=>clearInterval(U)},[s]),g.useEffect(()=>{!s||M!=="logs"||C(p)},[s,M,p]);async function E(){try{await be("/api/maintenance/os-update",{method:"POST"}),Q(),R("maintenance")}catch(U){B("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function Y(){try{await be("/api/maintenance/engine-update",{method:"POST"}),Q(),R("maintenance")}catch(U){B("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function ee(){L(!0);try{await be("/api/maintenance/check-updates",{method:"POST"}),Q(),R("maintenance")}catch(U){B("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{L(!1)}}async function Z(U,he){try{await be("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:he})}),B("Gestartet",`Modell-Upgrade für '${he}' (${U}) gestartet.`),Q(),R("maintenance")}catch(pt){B("Fehler",`Fehler beim Starten des Modell-Upgrades: ${pt.message}`)}}async function le(){X("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await be("/api/maintenance/reboot",{method:"POST"}),B("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){B("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function fe(U){N(he=>({...he,[U]:!0}));try{const he=await be("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});he.ok?B("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{M==="logs"&&p===U&&C(U)}):B("Fehler",`Fehler beim Neustart: ${he.err||"Unbekannter Fehler"}`)}catch(he){B("Fehler",`Fehler beim Neustart: ${he.message}`)}finally{N(he=>({...he,[U]:!1}))}}async function we(U){try{await be(`/api/jobs/${U}/cancel`,{method:"POST"}),Q()}catch(he){B("Fehler",`Fehler beim Abbrechen: ${he.message}`)}}return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:J("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",s?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:o}),r.jsxs("div",{className:J("fixed inset-y-0 right-0 w-full sm:w-[500px] 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",s?"translate-x-0":"translate-x-full"),children:[r.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ot,{className:"h-4.5 w-4.5 text-primary"}),r.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),r.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:r.jsx(sn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[r.jsx("button",{onClick:()=>R("maintenance"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",M==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),r.jsx("button",{onClick:()=>R("logs"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",M==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),r.jsx("button",{onClick:()=>R("settings"),className:J("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",M==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[M==="maintenance"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),r.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",ne(c.last_check)]}),r.jsxs("button",{onClick:ee,disabled:V,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[r.jsx(An,{className:J("h-3 w-3",V&&"animate-spin")}),"Nach Updates suchen"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:E,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[r.jsx(Ds,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),r.jsxs("button",{onClick:Y,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[r.jsx(F0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),r.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),r.jsxs("button",{onClick:le,className:"flex w-full items-center gap-3 p-3 rounded-xl 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:[r.jsx(Ph,{className:"h-4.5 w-4.5"}),r.jsxs("div",{children:[r.jsx("div",{children:"Host-System neu starten (Reboot)"}),r.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(c==null?void 0:c.model_list)&&c.model_list.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(c==null?void 0:c.last_check)&&r.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",ne(c.last_check)]})]}),r.jsx("div",{className:"space-y-2",children:c.model_list.map(U=>r.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold",children:U.title}),r.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),r.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),r.jsxs("button",{onClick:()=>Z(U.repo,U.role),className:"flex items-center gap-1.5 text-[10px] font-semibold text-emerald-400 hover:text-emerald-300 border border-emerald-500/20 bg-emerald-500/5 hover:bg-emerald-500/10 px-2 py-1 rounded-lg transition-colors shrink-0",children:[r.jsx(Tn,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),r.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[f.filter(U=>U.state==="running"||U.state==="queued").length," Aktiv"]})]}),r.jsx("div",{className:"space-y-3",children:f.length===0?r.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."}):f.map(U=>{const he=U.state==="running"||U.state==="queued";return r.jsxs("div",{className:J("p-3 rounded-xl border transition-all duration-300",he?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[he&&r.jsxs("span",{className:"flex h-2 w-2 relative",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),r.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[r.jsxs("span",{children:["ID: ",U.id]}),r.jsx("span",{children:"•"}),r.jsx("span",{className:J(U.state==="done"&&"text-emerald-400",U.state==="failed"&&"text-red-400",U.state==="running"&&"text-primary",U.state==="queued"&&"text-amber-400",U.state==="canceled"&&"text-muted-foreground"),children:U.state})]})]}),he&&r.jsx("button",{onClick:()=>we(U.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"})]}),U.state==="running"&&r.jsxs("div",{className:"mt-3 space-y-1",children:[r.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),r.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[r.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&r.jsxs("span",{children:[Oc(U.done_bytes)," / ",Oc(U.total_bytes),U.rate_bps!=null&&` (${Oc(U.rate_bps)}/s)`]}),U.eta_s!=null&&r.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),M==="logs"&&r.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("select",{value:p,onChange:U=>v(U.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:i1.map(U=>r.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),r.jsxs("button",{onClick:()=>fe(p),disabled:j[p],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:[r.jsx(An,{className:J("h-3.5 w-3.5",j[p]&&"animate-spin")}),"Restart"]})]}),r.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:[r.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[r.jsx(wa,{className:"h-3 w-3 text-primary"}),r.jsxs("span",{children:["stdout/stderr - ",p]})]}),r.jsx("button",{onClick:()=>C(p),disabled:w,className:"text-muted-foreground hover:text-foreground transition-colors",children:r.jsx(An,{className:J("h-3 w-3",w&&"animate-spin")})})]}),r.jsx("pre",{ref:K,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:O==="password_required"||O==="incorrect_password"?r.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[r.jsx(Jc,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),r.jsx("div",{className:"text-xs font-semibold text-amber-300",children:O==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),r.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",p," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),r.jsx("button",{onClick:()=>R("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):w&&!x?r.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):x||r.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),M==="settings"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),r.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(Ds,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Ee?"text":"password",value:ve,onChange:U=>ye(U.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),r.jsx("button",{type:"button",onClick:()=>ze(!Ee),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ee?r.jsx(_p,{className:"h-4 w-4"}):r.jsx(qc,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx(M0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{type:Oe?"text":"password",value:ue,onChange:U=>Re(U.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),r.jsx("button",{type:"button",onClick:()=>Pe(!Oe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Oe?r.jsx(_p,{className:"h-4 w-4"}):r.jsx(qc,{className:"h-4 w-4"})})]}),r.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",ve),localStorage.setItem("mc_hf_token",ue),B("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),r.jsx("button",{onClick:()=>{ye(""),Re(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),B("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),$&&r.jsx(km,{type:$.type,title:$.title,message:$.message,onConfirm:$.onConfirm,onCancel:$.onCancel})]})}function d1(){var w,P,O,z,j;const[s,o]=g.useState("dashboard"),[a,c]=g.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[u,f]=g.useState(!1),[m,p]=g.useState("maintenance"),{data:v}=Yy(),{data:x}=vd(2e4);g.useEffect(()=>{document.documentElement.classList.add("dark")},[]),g.useEffect(()=>{const N=M=>{var V;p(((V=M.detail)==null?void 0:V.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",N),()=>window.removeEventListener("open-system-drawer",N)},[]);const b=Xc.find(N=>N.id===s);return r.jsxs("div",{className:"flex h-full relative",children:[r.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[r.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),r.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),r.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),r.jsx(Zy,{onNavigate:o}),r.jsx(c1,{open:u,onClose:()=>f(!1),defaultTab:m}),r.jsxs("aside",{className:J("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",a?"w-16":"w-60"),children:[r.jsxs("div",{className:J("flex items-center py-4 border-b border-border/40 shrink-0",a?"flex-col gap-3 px-2":"justify-between px-5"),children:[r.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[r.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!a&&r.jsxs("div",{className:"leading-tight",children:[r.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),r.jsx("button",{onClick:()=>{c(N=>{const M=!N;return localStorage.setItem("mc_sidebar_collapsed",M.toString()),M})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:a?"Maximieren":"Minimieren",children:a?r.jsx(b0,{className:"h-4 w-4"}):r.jsx(y0,{className:"h-4 w-4"})})]}),r.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Xc.map(N=>r.jsxs("button",{onClick:()=>o(N.id),className:J("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",a?"justify-center p-2.5":"gap-3 px-3 py-2",s===N.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:a?N.label:void 0,children:[r.jsx(N.icon,{className:"h-4.5 w-4.5 shrink-0"}),!a&&r.jsx("span",{className:"truncate",children:N.label})]},N.id))}),r.jsx("div",{className:J("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",a?"px-2 text-center":"px-5"),children:a?r.jsx("div",{className:"flex justify-center",children:r.jsx("span",{className:J("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",v?v.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:v?`Engine ${v.engine_reachable?"online":"offline"}`:"Backend offline"})}):r.jsxs("div",{className:"space-y-2 text-left",children:[v?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:J("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),r.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",r.jsx("span",{className:"truncate",children:"Backend offline"})]}),(x==null?void 0:x.versions)&&r.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[r.jsxs("div",{className:"truncate",title:x.versions.mc2?`${x.versions.mc2.branch}-${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""} (${x.versions.mc2.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"MC2:"})," ",x.versions.mc2?`${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:((w=x.versions.engine)==null?void 0:w.type)==="git"?`${x.versions.engine.branch}-${x.versions.engine.hash}${x.versions.engine.dirty?"*":""} (${x.versions.engine.date})`:((P=x.versions.engine)==null?void 0:P.version_text)||"unbekannt",children:[r.jsx("strong",{children:"Engine:"})," ",((O=x.versions.engine)==null?void 0:O.type)==="git"?`${x.versions.engine.hash}${x.versions.engine.dirty?"*":""}`:((j=(z=x.versions.engine)==null?void 0:z.version_text)==null?void 0:j.split(" ").pop())||"—"]}),r.jsxs("div",{className:"truncate",title:x.versions.hermes_ui?`${x.versions.hermes_ui.branch}-${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""} (${x.versions.hermes_ui.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes UI:"})," ",x.versions.hermes_ui?`${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""}`:"—"]}),r.jsxs("div",{className:"truncate",title:x.versions.hermes_agent?`${x.versions.hermes_agent.branch}-${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""} (${x.versions.hermes_agent.date})`:"nicht gefunden",children:[r.jsx("strong",{children:"Hermes Agent:"})," ",x.versions.hermes_agent?`${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),r.jsxs("button",{onClick:()=>{const N=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(N)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[r.jsx(S0,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:"Suchen"}),r.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),r.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&r.jsx(Gb,{}),s==="models"&&r.jsx(e1,{}),s==="system"&&r.jsx(t1,{}),s==="connect"&&r.jsx(r1,{}),s==="memory"&&r.jsx(s1,{}),s==="agent"&&r.jsx(o1,{}),s==="guide"&&r.jsx(l1,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&r.jsx(a1,{title:b.label,hint:b.hint})]})]})]})}const u1=new t0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});Pg.createRoot(document.getElementById("root")).render(r.jsx(uh.StrictMode,{children:r.jsx(r0,{client:u1,children:r.jsx(d1,{})})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 1b4bcd1..174ce38 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/components/dashboard/ActiveModelsCard.tsx b/frontend/src/components/dashboard/ActiveModelsCard.tsx index b8c2e06..58d4566 100644 --- a/frontend/src/components/dashboard/ActiveModelsCard.tsx +++ b/frontend/src/components/dashboard/ActiveModelsCard.tsx @@ -8,7 +8,6 @@ const ROLE_TONE: Record = { fast: "bg-cyan-500/15 text-cyan-400 border-cyan-500/25", heavy: "bg-amber-500/15 text-amber-400 border-amber-500/25", coder: "bg-violet-500/15 text-violet-400 border-violet-500/25", - reasoning: "bg-emerald-500/15 text-emerald-400 border-emerald-500/25", vision: "bg-pink-500/15 text-pink-400 border-pink-500/25", scout: "bg-teal-500/15 text-teal-400 border-teal-500/25", hermes: "bg-indigo-500/15 text-indigo-400 border-indigo-500/25", diff --git a/frontend/src/components/dashboard/RolesCard.tsx b/frontend/src/components/dashboard/RolesCard.tsx index d6ef962..7608ecd 100644 --- a/frontend/src/components/dashboard/RolesCard.tsx +++ b/frontend/src/components/dashboard/RolesCard.tsx @@ -57,7 +57,7 @@ export function RolesCard() { PC )} - {m.spec_draft_model && ( + {m.spec_active && ( SPEC diff --git a/frontend/src/components/models/ModelBadges.tsx b/frontend/src/components/models/ModelBadges.tsx index 60b93b4..20385a1 100644 --- a/frontend/src/components/models/ModelBadges.tsx +++ b/frontend/src/components/models/ModelBadges.tsx @@ -1,7 +1,8 @@ import { type Fit } from "@/lib/api" import { cn } from "@/lib/utils" -export const ROLES = ["fast", "heavy", "coder", "agent", "vision", "scout"] +// Die 5 kanonischen Serving-Rollen (identisch zu Backend sources.py/llamaswap.ROLE_IDS). +export const ROLES = ["fast", "heavy", "coder", "vision", "scout"] export function FitBadge({ fit }: { fit: Fit }) { const tone = { diff --git a/frontend/src/views/models/Discover.tsx b/frontend/src/views/models/Discover.tsx index b3942f2..d07a5f7 100644 --- a/frontend/src/views/models/Discover.tsx +++ b/frontend/src/views/models/Discover.tsx @@ -1,5 +1,5 @@ import { useState } from "react" -import { Download, Search, Star, Layers, Check, Bot, Eye, Code, Brain, Compass, ChevronDown, ChevronUp } from "lucide-react" +import { Download, Search, Star, Layers, Check, Zap, Eye, Code, Brain, Compass, ChevronDown, ChevronUp } from "lucide-react" import { api } from "@/lib/api" import { useModels, useUpdates, useDiscover } from "@/lib/queries" import { cn } from "@/lib/utils" @@ -7,30 +7,31 @@ import { fmtBytes } from "@/lib/format" import { FitBadge } from "@/components/models/ModelBadges" import { AddModel } from "./AddModel" +// Die 5 kanonischen Rollen (identisch zu sources.py / ModelBadges.ROLES). const ROLE_METADATA: Record = { - vision: { - title: "Bilder & Vision", - desc: "Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.", - icon: Eye + fast: { + title: "Schnelles Alltags-Hirn", + desc: "Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.", + icon: Zap + }, + heavy: { + title: "Schweres Reasoning", + desc: "Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.", + icon: Brain }, coder: { title: "Coden & Entwicklung", desc: "Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.", icon: Code }, - reasoning: { - title: "Logik & Nachdenken", - desc: "Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).", - icon: Brain - }, - agent: { - title: "Autonomer Agent (Hermes)", - desc: "Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.", - icon: Bot + vision: { + title: "Bilder & Vision", + desc: "Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.", + icon: Eye }, scout: { - title: "Allrounder & Chat", - desc: "Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.", + title: "Multimodal-Allrounder", + desc: "Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.", icon: Compass } }